@nivaro/react 0.3.52 → 0.3.54

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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +4196 -4163
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +645 -593
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
  14. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  15. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  16. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  17. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
  19. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  20. package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
  21. package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
  22. package/dist/shared/components/item-edit/line-qty.js +115 -53
  23. package/dist/shared/components/item-edit/save-outcome.js +48 -0
  24. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  25. package/dist/shared/components/item-edit/stale-banner.js +13 -0
  26. package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
  27. package/dist/shared/components/panels/CommentPanel.js +204 -197
  28. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  29. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  30. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  31. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  32. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  33. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  34. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  35. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  36. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  37. package/dist/shared/lib/activity-sentence.js +236 -227
  38. package/dist/shared/lib/draft-store.js +35 -29
  39. package/dist/shared/lib/page-widget-access.js +11 -0
  40. package/dist/shared/lib/record-ref.js +43 -34
  41. package/package.json +1 -1
@@ -1,38 +1,50 @@
1
- import { jsxs as r, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
2
  import { readUnreadNotificationCount as ye, markNotificationRead as Ne, markNotificationsRead as Ce, markAllNotificationsRead as $e } from "@nivaro/sdk";
3
- import { useQueryClient as Se, useQuery as ne, useMutation as E } from "@tanstack/react-query";
4
- import { Bell as qe, CheckCheck as _e, ExternalLink as re, Check as z, History as Ee, ShieldCheck as Re, ChevronDown as Ae } from "lucide-react";
5
- import { useState as N, useRef as oe, useEffect as O, useMemo as le, Fragment as ie } from "react";
6
- import { createPortal as Fe } from "react-dom";
7
- import { useNivaroClient as Le } from "../context.js";
3
+ import { useQueryClient as _e, useQuery as ne, useMutation as E } from "@tanstack/react-query";
4
+ import { Bell as Se, CheckCheck as qe, ExternalLink as re, Check as z, History as Ee, ShieldCheck as Ae, ChevronDown as Le } from "lucide-react";
5
+ import { useState as $, useRef as oe, useEffect as O, useMemo as le, Fragment as ie } from "react";
6
+ import { createPortal as Re } from "react-dom";
7
+ import { useNivaroClient as Fe } from "../context.js";
8
8
  import { get as Me, post as Ie } from "../lib/commands.js";
9
9
  import { useLiveRefetchInterval as De } from "../lib/live-queries.js";
10
- import { resolveNotificationTargetFor as R, runNotificationTarget as A } from "../lib/notification-target.js";
10
+ import { resolveNotificationTargetFor as A, runNotificationTarget as L } from "../lib/notification-target.js";
11
11
  import { useTabAttention as Te } from "../lib/tab-attention.js";
12
12
  import { formatRelative as se } from "../lib/utils.js";
13
13
  import { AsItWasSheet as Ke } from "./notifications/AsItWasSheet.js";
14
14
  import { bundleLocally as Be, laneTone as je, bundleAsNotification as ze, bundleHeadline as Oe, categoryChipLabel as Pe } from "./notifications/bundles.js";
15
15
  import { DeliveryChips as Qe } from "./notifications/DeliveryChips.js";
16
16
  import { NotificationActions as He } from "./notifications/NotificationActions.js";
17
- import { NotificationDetailBits as Ye } from "./notifications/NotificationDetailBits.js";
18
- function Ge(l) {
19
- var d, p;
20
- return de(l) ? l.revision_id != null || (((p = (d = l.detail) == null ? void 0 : d.changes) == null ? void 0 : p.length) ?? 0) > 0 || l.category === "watch" || l.category === "workflow" : !1;
17
+ import { NotificationDetailBits as Ge } from "./notifications/NotificationDetailBits.js";
18
+ function Ue(n) {
19
+ var u, h;
20
+ if (!n) return null;
21
+ if (n.target_label && n.kind !== "record") return n.target_label;
22
+ if (String(n.collection ?? "") === "__chat__") return "Chat";
23
+ if (!n.collection) return null;
24
+ const d = ((u = n.record_collection_label) == null ? void 0 : u.trim()) || (() => {
25
+ const f = String(n.collection).replace(/_/g, " ").trim();
26
+ return f ? f.charAt(0).toUpperCase() + f.slice(1) : null;
27
+ })(), c = (h = n.record_label) == null ? void 0 : h.trim();
28
+ return d && c ? `${d} ${c}` : c || d || null;
21
29
  }
22
- function de(l) {
23
- var C, $, S;
24
- if ((((C = l.target) == null ? void 0 : C.kind) ?? l.kind ?? (l.collection && l.item ? "record" : null)) !== "record") return !1;
25
- const p = (($ = l.target) == null ? void 0 : $.collection) ?? l.collection, x = ((S = l.target) == null ? void 0 : S.id) ?? l.item;
26
- return !!p && x != null && x !== "" && !/^(nivaro|directus)_|^__/i.test(p);
30
+ function Ye(n) {
31
+ var d, c;
32
+ return de(n) ? n.revision_id != null || (((c = (d = n.detail) == null ? void 0 : d.changes) == null ? void 0 : c.length) ?? 0) > 0 || n.category === "watch" || n.category === "workflow" : !1;
27
33
  }
28
- function ut({
29
- routes: l,
34
+ function de(n) {
35
+ var h, f, _;
36
+ if ((((h = n.target) == null ? void 0 : h.kind) ?? n.kind ?? (n.collection && n.item ? "record" : null)) !== "record") return !1;
37
+ const c = ((f = n.target) == null ? void 0 : f.collection) ?? n.collection, u = ((_ = n.target) == null ? void 0 : _.id) ?? n.item;
38
+ return !!c && u != null && u !== "" && !/^(nivaro|directus)_|^__/i.test(c);
39
+ }
40
+ function mt({
41
+ routes: n,
30
42
  onNavigate: d,
31
- app: p,
32
- subscribe: x,
33
- buttonClassName: C,
34
- panelClassName: $,
35
- beforeList: S,
43
+ app: c,
44
+ subscribe: u,
45
+ buttonClassName: h,
46
+ panelClassName: f,
47
+ beforeList: _,
36
48
  extraBadge: P = 0,
37
49
  mailLogUrl: ce,
38
50
  renderTrigger: Q,
@@ -40,46 +52,46 @@ function ut({
40
52
  subscriptionsPath: ue,
41
53
  rulesPath: me,
42
54
  onActionError: pe,
43
- panelPlacement: v = "below",
55
+ panelPlacement: y = "below",
44
56
  tabBadge: xe = !0
45
57
  }) {
46
- const b = Le(), [f, c] = N(!1), [h, Y] = N("attention"), F = oe(null), G = oe(null), [L, fe] = N(null), U = Se(), w = () => {
47
- U.invalidateQueries({ queryKey: ["notification-count"] }), U.invalidateQueries({ queryKey: ["notifications"] });
48
- }, he = De(6e4, { enabled: !!x, safetyMs: 12e4 }), { data: u } = ne({
58
+ const k = Fe(), [b, m] = $(!1), [g, G] = $("attention"), R = oe(null), U = oe(null), [F, fe] = $(null), Y = _e(), N = () => {
59
+ Y.invalidateQueries({ queryKey: ["notification-count"] }), Y.invalidateQueries({ queryKey: ["notifications"] });
60
+ }, he = De(6e4, { enabled: !!u, safetyMs: 12e4 }), { data: p } = ne({
49
61
  queryKey: ["notification-count"],
50
- queryFn: () => b.request(ye()),
62
+ queryFn: () => k.request(ye()),
51
63
  refetchInterval: he
52
- }), M = (u == null ? void 0 : u.unread) ?? 0, I = (u == null ? void 0 : u.attention) ?? M, q = (u == null ? void 0 : u.lanes) ?? { critical: 0, fyi: 0 }, k = M + P;
64
+ }), M = (p == null ? void 0 : p.unread) ?? 0, I = (p == null ? void 0 : p.attention) ?? M, S = (p == null ? void 0 : p.lanes) ?? { critical: 0, fyi: 0 }, w = M + P;
53
65
  Te(I + P, { enabled: xe });
54
- const { data: m } = ne({
55
- queryKey: ["notifications", "bell", p ?? null, h],
56
- queryFn: () => b.request(
66
+ const { data: x } = ne({
67
+ queryKey: ["notifications", "bell", c ?? null, g],
68
+ queryFn: () => k.request(
57
69
  Me("/notifications", {
58
70
  limit: 60,
59
- app: p,
71
+ app: c,
60
72
  bundle: "record",
61
- ...h === "attention" ? { lane: "attention", status: "inbox" } : {},
62
- ...h === "fyi" ? { lane: "fyi", status: "inbox" } : {}
73
+ ...g === "attention" ? { lane: "attention", status: "inbox" } : {},
74
+ ...g === "fyi" ? { lane: "fyi", status: "inbox" } : {}
63
75
  })
64
76
  ).then((e) => {
65
- const t = e.pinned ?? [], o = new Set(t.map((n) => n.id)), s = (e.data ?? []).filter((n) => !o.has(n.id));
77
+ const t = e.pinned ?? [], l = new Set(t.map((r) => r.id)), s = (e.data ?? []).filter((r) => !l.has(r.id));
66
78
  return e.bundles ? { rows: s, bundles: e.bundles, pinned: t } : { ...Be(s), pinned: t };
67
79
  }),
68
- enabled: f
69
- }), V = (m == null ? void 0 : m.rows) ?? [], D = (m == null ? void 0 : m.pinned) ?? [], W = (m == null ? void 0 : m.bundles) ?? [], [be, J] = N(() => /* @__PURE__ */ new Set()), [g, T] = N(null);
70
- O(() => x == null ? void 0 : x(w), [x]), O(() => {
71
- if (!f) return;
80
+ enabled: b
81
+ }), V = (x == null ? void 0 : x.rows) ?? [], D = (x == null ? void 0 : x.pinned) ?? [], W = (x == null ? void 0 : x.bundles) ?? [], [be, J] = $(() => /* @__PURE__ */ new Set()), [v, T] = $(null);
82
+ O(() => u == null ? void 0 : u(N), [u]), O(() => {
83
+ if (!b) return;
72
84
  const e = (t) => {
73
- var s, n;
74
- const o = t.target;
75
- (s = F.current) != null && s.contains(o) || (n = G.current) != null && n.contains(o) || c(!1);
85
+ var s, r;
86
+ const l = t.target;
87
+ (s = R.current) != null && s.contains(l) || (r = U.current) != null && r.contains(l) || m(!1);
76
88
  };
77
89
  return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
78
- }, [f]), O(() => {
79
- if (!f || v !== "right") return;
90
+ }, [b]), O(() => {
91
+ if (!b || y !== "right") return;
80
92
  const e = () => {
81
- var o;
82
- const t = (o = F.current) == null ? void 0 : o.getBoundingClientRect();
93
+ var l;
94
+ const t = (l = R.current) == null ? void 0 : l.getBoundingClientRect();
83
95
  t && fe({
84
96
  left: Math.round(t.right + 12),
85
97
  bottom: Math.max(8, Math.round(window.innerHeight - t.bottom))
@@ -88,47 +100,47 @@ function ut({
88
100
  return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
89
101
  window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
90
102
  };
91
- }, [f, v]);
103
+ }, [b, y]);
92
104
  const X = E({
93
- mutationFn: (e) => b.request(Ie(`/notifications/${e}/acknowledge`)),
94
- onSuccess: w
105
+ mutationFn: (e) => k.request(Ie(`/notifications/${e}/acknowledge`)),
106
+ onSuccess: N
95
107
  }), K = E({
96
- mutationFn: (e) => b.request(Ne(e)),
97
- onSuccess: w
108
+ mutationFn: (e) => k.request(Ne(e)),
109
+ onSuccess: N
98
110
  }), B = E({
99
- mutationFn: (e) => b.request(Ce(e)),
100
- onSuccess: w
101
- }), ke = E({
102
- mutationFn: () => b.request($e()),
103
- onSuccess: w
111
+ mutationFn: (e) => k.request(Ce(e)),
112
+ onSuccess: N
113
+ }), ge = E({
114
+ mutationFn: () => k.request($e()),
115
+ onSuccess: N
104
116
  }), Z = le(() => V.slice(0, 40), [V]), ee = le(() => {
105
117
  const e = /* @__PURE__ */ new Map();
106
118
  for (const t of Z) {
107
- const o = t.collection && t.item ? `${t.collection}:${t.item}` : `single:${t.id}`, s = e.get(o) ?? {
108
- key: o,
119
+ const l = t.collection && t.item ? `${t.collection}:${t.item}` : `single:${t.id}`, s = e.get(l) ?? {
120
+ key: l,
109
121
  collection: t.collection ?? null,
110
122
  item: t.item ?? null,
111
123
  rows: []
112
124
  };
113
- s.rows.push(t), e.set(o, s);
125
+ s.rows.push(t), e.set(l, s);
114
126
  }
115
127
  return [...e.values()];
116
- }, [Z]), ge = (e) => {
117
- const t = R(e, l);
118
- t && (c(!1), A(t, d));
128
+ }, [Z]), ke = (e) => {
129
+ const t = A(e, n);
130
+ t && (m(!1), L(t, d));
119
131
  }, te = (e) => {
120
- c(!1), d(e);
121
- }, j = (e, t, o = !1) => {
132
+ m(!1), d(e);
133
+ }, j = (e, t, l = !1) => {
122
134
  var s;
123
- return /* @__PURE__ */ r(ie, { children: [
124
- /* @__PURE__ */ r(
135
+ return /* @__PURE__ */ o(ie, { children: [
136
+ /* @__PURE__ */ o(
125
137
  "button",
126
138
  {
127
139
  type: "button",
128
140
  onClick: () => {
129
- e.read || K.mutate(e.id), ge(e);
141
+ e.read || K.mutate(e.id), ke(e);
130
142
  },
131
- className: `flex w-full items-start gap-2.5 py-2 pr-3 text-left transition-colors ${o ? "pl-7" : "pl-3"} ${t ? "hover:bg-slate-50 dark:hover:bg-muted" : "cursor-default"}`,
143
+ className: `flex w-full items-start gap-2.5 py-2 pr-3 text-left transition-colors ${l ? "pl-7" : "pl-3"} ${t ? "hover:bg-slate-50 dark:hover:bg-muted" : "cursor-default"}`,
132
144
  "data-notification-row": e.id,
133
145
  children: [
134
146
  /* @__PURE__ */ a(
@@ -137,8 +149,8 @@ function ut({
137
149
  className: `mt-1.5 h-2 w-2 shrink-0 rounded-full ${e.read ? "bg-transparent" : e.lane === "critical" ? "bg-red-500" : "bg-nvr-cyan"}`
138
150
  }
139
151
  ),
140
- /* @__PURE__ */ r("span", { className: "min-w-0 flex-1", children: [
141
- /* @__PURE__ */ r(
152
+ /* @__PURE__ */ o("span", { className: "min-w-0 flex-1", children: [
153
+ /* @__PURE__ */ o(
142
154
  "span",
143
155
  {
144
156
  className: `block truncate text-[12.5px] ${e.read ? "font-normal text-slate-600 dark:text-slate-400" : "font-medium text-slate-900 dark:text-slate-100"}`,
@@ -149,7 +161,7 @@ function ut({
149
161
  }
150
162
  ),
151
163
  e.message && /* @__PURE__ */ a("span", { className: "mt-0.5 line-clamp-2 text-[11px] leading-snug text-slate-500", children: e.message.replace(/<[^>]+>/g, "") }),
152
- /* @__PURE__ */ r("span", { className: "mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10.5px] text-slate-400", children: [
164
+ /* @__PURE__ */ o("span", { className: "mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10.5px] text-slate-400", children: [
153
165
  se(e.created_at),
154
166
  /* @__PURE__ */ a(
155
167
  Qe,
@@ -160,18 +172,18 @@ function ut({
160
172
  }
161
173
  ),
162
174
  de(e) && // biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
163
- /* @__PURE__ */ r(
175
+ /* @__PURE__ */ o(
164
176
  "span",
165
177
  {
166
178
  role: "button",
167
179
  tabIndex: -1,
168
180
  "data-notification-as-it-was": e.id,
169
181
  "data-tip": "The record as it was when you were told",
170
- onClick: (n) => {
171
- n.stopPropagation(), c(!1), T(e);
182
+ onClick: (r) => {
183
+ r.stopPropagation(), m(!1), T(e);
172
184
  },
173
- onKeyDown: (n) => {
174
- (n.key === "Enter" || n.key === " ") && (n.preventDefault(), n.stopPropagation(), c(!1), T(e));
185
+ onKeyDown: (r) => {
186
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.stopPropagation(), m(!1), T(e));
175
187
  },
176
188
  className: "inline-flex items-center gap-0.5 rounded px-1 text-[10.5px] text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
177
189
  children: [
@@ -189,11 +201,11 @@ function ut({
189
201
  role: "button",
190
202
  tabIndex: -1,
191
203
  title: "Mark read",
192
- onClick: (n) => {
193
- n.stopPropagation(), K.mutate(e.id);
204
+ onClick: (r) => {
205
+ r.stopPropagation(), K.mutate(e.id);
194
206
  },
195
- onKeyDown: (n) => {
196
- (n.key === "Enter" || n.key === " ") && (n.preventDefault(), n.stopPropagation(), K.mutate(e.id));
207
+ onKeyDown: (r) => {
208
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.stopPropagation(), K.mutate(e.id));
197
209
  },
198
210
  className: "mt-0.5 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
199
211
  children: /* @__PURE__ */ a(z, { className: "h-3 w-3" })
@@ -202,7 +214,7 @@ function ut({
202
214
  ]
203
215
  }
204
216
  ),
205
- ((s = e.ack) == null ? void 0 : s.required) && !e.ack.at && /* @__PURE__ */ a("div", { className: `pb-2 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`, children: /* @__PURE__ */ r(
217
+ ((s = e.ack) == null ? void 0 : s.required) && !e.ack.at && /* @__PURE__ */ a("div", { className: `pb-2 pr-3 ${l ? "pl-[46px]" : "pl-[30px]"}`, children: /* @__PURE__ */ o(
206
218
  "button",
207
219
  {
208
220
  type: "button",
@@ -211,7 +223,7 @@ function ut({
211
223
  "data-notification-acknowledge": e.id,
212
224
  className: "inline-flex items-center gap-1 rounded-md bg-nvr-cyan px-2 py-1 text-[11px] font-medium text-white hover:opacity-90 disabled:opacity-50",
213
225
  children: [
214
- /* @__PURE__ */ a(Re, { className: "h-3 w-3" }),
226
+ /* @__PURE__ */ a(Ae, { className: "h-3 w-3" }),
215
227
  "Acknowledge"
216
228
  ]
217
229
  }
@@ -222,27 +234,27 @@ function ut({
222
234
  actions: e.actions,
223
235
  notificationId: e.id,
224
236
  onError: pe,
225
- className: `pb-2 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`
237
+ className: `pb-2 pr-3 ${l ? "pl-[46px]" : "pl-[30px]"}`
226
238
  }
227
239
  ),
228
240
  /* @__PURE__ */ a(
229
- Ye,
241
+ Ge,
230
242
  {
231
243
  detail: e.detail,
232
244
  why: e.why,
233
245
  delivery: e.delivery,
234
246
  notificationId: e.id,
235
- recordChanges: Ge(e),
247
+ recordChanges: Ye(e),
236
248
  subscriptionsPath: ue,
237
249
  rulesPath: me,
238
250
  onNavigate: te,
239
- className: `-mt-1 pb-2 pr-3 ${o ? "pl-[46px]" : "pl-[30px]"}`
251
+ className: `-mt-1 pb-2 pr-3 ${l ? "pl-[46px]" : "pl-[30px]"}`
240
252
  }
241
253
  )
242
254
  ] }, e.id);
243
- }, ve = (e) => {
244
- const t = `${e.collection}:${e.item}`, o = be.has(t), s = je(e.lane), n = e.deleted ? null : R(ze(e), l), y = e.rows.filter((i) => !i.read).map((i) => i.id);
245
- return /* @__PURE__ */ r(
255
+ }, we = (e) => {
256
+ const t = `${e.collection}:${e.item}`, l = be.has(t), s = je(e.lane), r = e.deleted ? null : A(ze(e), n), C = e.rows.filter((i) => !i.read).map((i) => i.id);
257
+ return /* @__PURE__ */ o(
246
258
  "div",
247
259
  {
248
260
  className: "border-b border-slate-50 last:border-b-0 dark:border-border/50",
@@ -251,37 +263,37 @@ function ut({
251
263
  "data-notification-bundle-count": e.count,
252
264
  "data-notification-bundle-lane": e.lane,
253
265
  children: [
254
- /* @__PURE__ */ r("div", { className: "flex items-start gap-2 px-3 py-2", children: [
266
+ /* @__PURE__ */ o("div", { className: "flex items-start gap-2 px-3 py-2", children: [
255
267
  /* @__PURE__ */ a(
256
268
  "button",
257
269
  {
258
270
  type: "button",
259
- "aria-expanded": o,
260
- "aria-label": o ? "Collapse" : "Expand",
271
+ "aria-expanded": l,
272
+ "aria-label": l ? "Collapse" : "Expand",
261
273
  "data-notification-bundle-expand": t,
262
274
  onClick: () => J((i) => {
263
- const _ = new Set(i);
264
- return _.has(t) ? _.delete(t) : _.add(t), _;
275
+ const q = new Set(i);
276
+ return q.has(t) ? q.delete(t) : q.add(t), q;
265
277
  }),
266
278
  className: "mt-0.5 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
267
279
  children: /* @__PURE__ */ a(
268
- Ae,
280
+ Le,
269
281
  {
270
- className: `h-3.5 w-3.5 transition-transform ${o ? "" : "-rotate-90"}`
282
+ className: `h-3.5 w-3.5 transition-transform ${l ? "" : "-rotate-90"}`
271
283
  }
272
284
  )
273
285
  }
274
286
  ),
275
- /* @__PURE__ */ r(
287
+ /* @__PURE__ */ o(
276
288
  "button",
277
289
  {
278
290
  type: "button",
279
291
  onClick: () => {
280
- n ? (c(!1), A(n, d)) : J((i) => new Set(i).add(t));
292
+ r ? (m(!1), L(r, d)) : J((i) => new Set(i).add(t));
281
293
  },
282
294
  className: "min-w-0 flex-1 text-left",
283
295
  children: [
284
- /* @__PURE__ */ r("span", { className: "flex items-center gap-1.5", children: [
296
+ /* @__PURE__ */ o("span", { className: "flex items-center gap-1.5", children: [
285
297
  /* @__PURE__ */ a(
286
298
  "span",
287
299
  {
@@ -296,7 +308,7 @@ function ut({
296
308
  }
297
309
  )
298
310
  ] }),
299
- /* @__PURE__ */ r("span", { className: "mt-1 flex flex-wrap items-center gap-1 pl-3.5 text-[10.5px] text-slate-400", children: [
311
+ /* @__PURE__ */ o("span", { className: "mt-1 flex flex-wrap items-center gap-1 pl-3.5 text-[10.5px] text-slate-400", children: [
300
312
  e.lane === "critical" && e.unread > 0 && /* @__PURE__ */ a(
301
313
  "span",
302
314
  {
@@ -330,7 +342,7 @@ function ut({
330
342
  i
331
343
  )),
332
344
  /* @__PURE__ */ a("span", { children: e.newest ? se(e.newest) : "" }),
333
- e.unread > 0 && e.unread < e.count && /* @__PURE__ */ r("span", { children: [
345
+ e.unread > 0 && e.unread < e.count && /* @__PURE__ */ o("span", { children: [
334
346
  "· ",
335
347
  e.unread,
336
348
  " unread"
@@ -339,33 +351,33 @@ function ut({
339
351
  ]
340
352
  }
341
353
  ),
342
- /* @__PURE__ */ r("span", { className: "flex shrink-0 items-center gap-0.5", children: [
343
- n && /* @__PURE__ */ a(
354
+ /* @__PURE__ */ o("span", { className: "flex shrink-0 items-center gap-0.5", children: [
355
+ r && /* @__PURE__ */ a(
344
356
  "button",
345
357
  {
346
358
  type: "button",
347
359
  title: "Open record",
348
360
  onClick: () => {
349
- c(!1), A(n, d);
361
+ m(!1), L(r, d);
350
362
  },
351
363
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
352
364
  children: /* @__PURE__ */ a(re, { className: "h-3 w-3" })
353
365
  }
354
366
  ),
355
- y.length > 0 && /* @__PURE__ */ a(
367
+ C.length > 0 && /* @__PURE__ */ a(
356
368
  "button",
357
369
  {
358
370
  type: "button",
359
371
  title: "Mark all read",
360
372
  "data-notification-bundle-read": t,
361
- onClick: () => B.mutate(y),
373
+ onClick: () => B.mutate(C),
362
374
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
363
375
  children: /* @__PURE__ */ a(z, { className: "h-3 w-3" })
364
376
  }
365
377
  )
366
378
  ] })
367
379
  ] }),
368
- o && /* @__PURE__ */ a(
380
+ l && /* @__PURE__ */ a(
369
381
  "div",
370
382
  {
371
383
  className: "border-t border-slate-50 bg-slate-50/50 dark:border-border/50 dark:bg-muted/30",
@@ -377,56 +389,56 @@ function ut({
377
389
  },
378
390
  `bundle:${t}`
379
391
  );
380
- }, we = [
392
+ }, ve = [
381
393
  { key: "attention", label: "Needs you", count: I },
382
- { key: "fyi", label: "FYI", count: q.fyi },
394
+ { key: "fyi", label: "FYI", count: S.fyi },
383
395
  { key: "all", label: "All", count: null }
384
- ], ae = () => c((e) => (!e && h === "attention" && I === 0 && q.fyi > 0 && Y("fyi"), !e));
385
- return /* @__PURE__ */ r("div", { ref: F, className: "relative", "data-nvr-notification-bell": !0, children: [
386
- Q ? Q({ open: f, badge: k, toggle: ae }) : /* @__PURE__ */ r(
396
+ ], ae = () => m((e) => (!e && g === "attention" && I === 0 && S.fyi > 0 && G("fyi"), !e));
397
+ return /* @__PURE__ */ o("div", { ref: R, className: "relative", "data-nvr-notification-bell": !0, children: [
398
+ Q ? Q({ open: b, badge: w, toggle: ae }) : /* @__PURE__ */ o(
387
399
  "button",
388
400
  {
389
401
  type: "button",
390
402
  onClick: ae,
391
- className: C ?? "relative rounded-md p-1.5 text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-muted",
392
- "aria-label": k ? `Notifications (${k} unread)` : "Notifications",
403
+ className: h ?? "relative rounded-md p-1.5 text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-muted",
404
+ "aria-label": w ? `Notifications (${w} unread)` : "Notifications",
393
405
  children: [
394
- /* @__PURE__ */ a(qe, { className: "h-4 w-4", strokeWidth: 1.8 }),
395
- k > 0 && /* @__PURE__ */ a(
406
+ /* @__PURE__ */ a(Se, { className: "h-4 w-4", strokeWidth: 1.8 }),
407
+ w > 0 && /* @__PURE__ */ a(
396
408
  "span",
397
409
  {
398
410
  "data-nvr-recording-hide": !0,
399
- className: `absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold ${q.critical > 0 ? "bg-red-500 text-white" : "bg-nvr-cyan text-nvr-navy"}`,
400
- children: k > 99 ? "99+" : k
411
+ className: `absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold ${S.critical > 0 ? "bg-red-500 text-white" : "bg-nvr-cyan text-nvr-navy"}`,
412
+ children: w > 99 ? "99+" : w
401
413
  }
402
414
  )
403
415
  ]
404
416
  }
405
417
  ),
406
- f && (v === "right" ? Fe : (e) => e)(
407
- /* @__PURE__ */ r(
418
+ b && (y === "right" ? Re : (e) => e)(
419
+ /* @__PURE__ */ o(
408
420
  "div",
409
421
  {
410
- ref: G,
411
- className: `${v === "right" ? "fixed z-[110]" : "absolute right-0 top-10 z-40"} w-[360px] overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-border dark:bg-card ${$ ?? ""}`,
412
- style: v === "right" && L ? { left: L.left, bottom: L.bottom } : void 0,
422
+ ref: U,
423
+ className: `${y === "right" ? "fixed z-[110]" : "absolute right-0 top-10 z-40"} w-[360px] overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-border dark:bg-card ${f ?? ""}`,
424
+ style: y === "right" && F ? { left: F.left, bottom: F.bottom } : void 0,
413
425
  "data-nvr-notification-panel": !0,
414
426
  children: [
415
- S,
416
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 dark:border-border/60", children: [
417
- /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-md bg-slate-100 p-0.5 dark:bg-muted", children: we.map((e) => /* @__PURE__ */ r(
427
+ _,
428
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 dark:border-border/60", children: [
429
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-md bg-slate-100 p-0.5 dark:bg-muted", children: ve.map((e) => /* @__PURE__ */ o(
418
430
  "button",
419
431
  {
420
432
  type: "button",
421
- onClick: () => Y(e.key),
433
+ onClick: () => G(e.key),
422
434
  "data-nvr-lane-tab": e.key,
423
- className: h === e.key ? "rounded bg-white px-2 py-0.5 text-[11px] font-medium text-slate-900 shadow-sm dark:bg-card dark:text-slate-100" : "rounded px-2 py-0.5 text-[11px] font-medium text-slate-500 hover:text-slate-700 dark:text-slate-400",
435
+ className: g === e.key ? "rounded bg-white px-2 py-0.5 text-[11px] font-medium text-slate-900 shadow-sm dark:bg-card dark:text-slate-100" : "rounded px-2 py-0.5 text-[11px] font-medium text-slate-500 hover:text-slate-700 dark:text-slate-400",
424
436
  children: [
425
437
  e.label,
426
438
  e.count != null && e.count > 0 && /* @__PURE__ */ a(
427
439
  "span",
428
440
  {
429
- className: `ml-1 rounded-full px-1 text-[9.5px] font-bold ${e.key === "attention" && q.critical > 0 ? "bg-red-500/15 text-red-600 dark:text-red-400" : "bg-slate-200 text-slate-600 dark:bg-slate-700 dark:text-slate-300"}`,
441
+ className: `ml-1 rounded-full px-1 text-[9.5px] font-bold ${e.key === "attention" && S.critical > 0 ? "bg-red-500/15 text-red-600 dark:text-red-400" : "bg-slate-200 text-slate-600 dark:bg-slate-700 dark:text-slate-300"}`,
430
442
  children: e.count
431
443
  }
432
444
  )
@@ -434,46 +446,46 @@ function ut({
434
446
  },
435
447
  e.key
436
448
  )) }),
437
- M > 0 && /* @__PURE__ */ r(
449
+ M > 0 && /* @__PURE__ */ o(
438
450
  "button",
439
451
  {
440
452
  type: "button",
441
- onClick: () => ke.mutate(),
453
+ onClick: () => ge.mutate(),
442
454
  className: "inline-flex items-center gap-1 text-[11px] font-medium text-slate-400 transition-colors hover:text-nvr-cyan",
443
455
  children: [
444
- /* @__PURE__ */ a(_e, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
456
+ /* @__PURE__ */ a(qe, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
445
457
  "Mark all read"
446
458
  ]
447
459
  }
448
460
  )
449
461
  ] }),
450
- /* @__PURE__ */ r("div", { className: "max-h-96 overflow-y-auto", children: [
451
- D.length > 0 && /* @__PURE__ */ r("div", { "data-notification-pinned": !0, children: [
462
+ /* @__PURE__ */ o("div", { className: "max-h-96 overflow-y-auto", children: [
463
+ D.length > 0 && /* @__PURE__ */ o("div", { "data-notification-pinned": !0, children: [
452
464
  /* @__PURE__ */ a("div", { className: "bg-amber-50 px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-400/10 dark:text-amber-300", children: "Needs your acknowledgement" }),
453
- D.map((e) => /* @__PURE__ */ a(ie, { children: j(e, !!R(e, l)) }, e.id))
465
+ D.map((e) => /* @__PURE__ */ a(ie, { children: j(e, !!A(e, n)) }, e.id))
454
466
  ] }),
455
- ee.length === 0 && W.length === 0 && D.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-[12px] text-slate-400", children: h === "attention" ? "Nothing needs you right now." : h === "fyi" ? "No FYI notifications." : "No notifications" }) : [
456
- ...W.map(ve),
467
+ ee.length === 0 && W.length === 0 && D.length === 0 ? /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-[12px] text-slate-400", children: g === "attention" ? "Nothing needs you right now." : g === "fyi" ? "No FYI notifications." : "No notifications" }) : [
468
+ ...W.map(we),
457
469
  ...ee.map((e) => {
458
- const t = e.rows.filter((i) => !i.read).map((i) => i.id), o = R(e.rows[0], l), s = !!o, n = e.rows[0], y = n != null && n.target_label && (n == null ? void 0 : n.kind) !== "record" ? `${n.target_label}${e.item ? ` · ${e.item}` : ""}` : String(e.collection) === "__chat__" ? "Chat" : e.collection ? `${String(e.collection).replace(/_/g, " ")}${e.item ? ` · ${e.item}` : ""}` : null;
459
- return /* @__PURE__ */ r(
470
+ const t = e.rows.filter((i) => !i.read).map((i) => i.id), l = A(e.rows[0], n), s = !!l, r = e.rows.find((i) => i.record_label) ?? e.rows[0], C = Ue(r);
471
+ return /* @__PURE__ */ o(
460
472
  "div",
461
473
  {
462
474
  className: "border-b border-slate-50 last:border-b-0 dark:border-border/50",
463
475
  children: [
464
- s && y && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 px-3 pt-2", children: [
465
- /* @__PURE__ */ r("span", { className: "truncate text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: [
466
- y,
476
+ s && C && /* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 px-3 pt-2", children: [
477
+ /* @__PURE__ */ o("span", { className: "truncate text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: [
478
+ C,
467
479
  e.rows.length > 1 ? ` · ${e.rows.length}` : ""
468
480
  ] }),
469
- /* @__PURE__ */ r("span", { className: "ml-auto flex items-center gap-0.5", children: [
481
+ /* @__PURE__ */ o("span", { className: "ml-auto flex items-center gap-0.5", children: [
470
482
  /* @__PURE__ */ a(
471
483
  "button",
472
484
  {
473
485
  type: "button",
474
486
  title: "Open record",
475
487
  onClick: () => {
476
- t.length && B.mutate(t), c(!1), A(o, d);
488
+ t.length && B.mutate(t), m(!1), L(l, d);
477
489
  },
478
490
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
479
491
  children: /* @__PURE__ */ a(re, { className: "h-3 w-3" })
@@ -504,7 +516,7 @@ function ut({
504
516
  {
505
517
  type: "button",
506
518
  onClick: () => {
507
- c(!1), d(H);
519
+ m(!1), d(H);
508
520
  },
509
521
  className: "block w-full border-t border-slate-100 px-3 py-1.5 text-center text-[11px] font-medium text-slate-500 hover:text-nvr-cyan dark:border-border/60",
510
522
  children: "See all notifications"
@@ -518,15 +530,16 @@ function ut({
518
530
  /* @__PURE__ */ a(
519
531
  Ke,
520
532
  {
521
- notificationId: (g == null ? void 0 : g.id) ?? null,
522
- title: (g == null ? void 0 : g.title) ?? null,
533
+ notificationId: (v == null ? void 0 : v.id) ?? null,
534
+ title: (v == null ? void 0 : v.title) ?? null,
523
535
  onClose: () => T(null)
524
536
  }
525
537
  )
526
538
  ] });
527
539
  }
528
540
  export {
529
- ut as NotificationBell,
541
+ mt as NotificationBell,
542
+ Ue as bellGroupLabel,
530
543
  de as hasSnapshotView,
531
- Ge as offersChanges
544
+ Ye as offersChanges
532
545
  };