@nivaro/react 0.2.54 → 0.2.56

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 (151) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +367 -2
  4. package/dist/index.js +645 -616
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/stale-chunk.js +60 -0
  150. package/dist/shared/lib/worker-socket.js +200 -0
  151. package/package.json +1 -1
@@ -5,19 +5,20 @@ import { createPortal as $e } from "react-dom";
5
5
  import { useNivaroClient as O } from "../context.js";
6
6
  import { get as v, post as j, patch as Te, del as Ae } from "../lib/commands.js";
7
7
  import { useLiveOps as je } from "../lib/live-ops.js";
8
- import { cn as f } from "../lib/utils.js";
9
- import { BroadcastDraftPanel as Ke } from "./BroadcastDraft.js";
8
+ import { useLiveRefetchInterval as Ke } from "../lib/live-queries.js";
9
+ import { cn as y } from "../lib/utils.js";
10
+ import { BroadcastDraftPanel as Le } from "./BroadcastDraft.js";
10
11
  import { useHelpVideoLibrary as Fe } from "./help-videos/api.js";
11
- import { formatDuration as Le } from "./help-videos/viewer/format.js";
12
- import { PickList as Pe } from "./imports/ServiceConfigBuilder.js";
12
+ import { formatDuration as Pe } from "./help-videos/viewer/format.js";
13
+ import { PickList as De } from "./imports/ServiceConfigBuilder.js";
13
14
  const ce = {
14
15
  info: "bg-sky-500",
15
16
  warn: "bg-amber-500",
16
17
  critical: "bg-red-500"
17
18
  };
18
- function We({ className: r }) {
19
+ function et({ className: r }) {
19
20
  var le;
20
- const i = O(), m = ie(), [h, x] = p(""), [l, u] = p(""), [o, n] = p("info"), [s, d] = p(!1), [g, y] = p(!1), [N, ue] = p(!0), [Q, pe] = p(!1), [_, xe] = p("banner"), [I, he] = p(!1), [Y, be] = p(""), [R, M] = p(""), [Z, ge] = p(""), [K, H] = p([]), [$, fe] = p([]), [J, q] = p(null), [T, W] = p(""), [X, ee] = p(""), A = Fe({ status: "published" }), te = () => {
21
+ const o = O(), c = ie(), [b, h] = p(""), [s, u] = p(""), [l, n] = p("info"), [m, x] = p(!1), [d, N] = p(!1), [g, ue] = p(!0), [I, pe] = p(!1), [_, xe] = p("banner"), [Q, he] = p(!1), [Y, be] = p(""), [R, M] = p(""), [Z, ge] = p(""), [K, H] = p([]), [$, fe] = p([]), [J, q] = p(null), [T, W] = p(""), [X, ee] = p(""), A = Fe({ status: "published" }), te = () => {
21
22
  if (!T) return {};
22
23
  const e = Number(X);
23
24
  return {
@@ -26,122 +27,122 @@ function We({ className: r }) {
26
27
  };
27
28
  }, { data: V } = k({
28
29
  queryKey: ["broadcast-config"],
29
- queryFn: () => i.request(v("/announcements/config")).then((e) => e.data).catch(() => ({ sms_enabled: !1 })),
30
+ queryFn: () => o.request(v("/announcements/config")).then((e) => e.data).catch(() => ({ sms_enabled: !1 })),
30
31
  staleTime: 5 * 6e4
31
32
  }), { data: ye = [] } = k({
32
33
  queryKey: ["broadcast-dimensions"],
33
- queryFn: () => i.request(v("/scope-dimensions")).then((e) => e.data ?? []).catch(() => []),
34
+ queryFn: () => o.request(v("/scope-dimensions")).then((e) => e.data ?? []).catch(() => []),
34
35
  staleTime: 5 * 6e4
35
36
  }), { data: ke = [] } = k({
36
37
  queryKey: ["broadcast-roles"],
37
- queryFn: () => i.request(v("/chat/roles")).then((e) => e.data ?? []).catch(() => []),
38
+ queryFn: () => o.request(v("/chat/roles")).then((e) => e.data ?? []).catch(() => []),
38
39
  staleTime: 5 * 6e4
39
40
  }), { data: ae = [] } = k({
40
41
  queryKey: ["broadcasts"],
41
- queryFn: () => i.request(v("/announcements")).then((e) => e.data ?? [])
42
+ queryFn: () => o.request(v("/announcements")).then((e) => e.data ?? [])
42
43
  });
43
44
  je("broadcasts", () => {
44
- m.invalidateQueries({ queryKey: ["broadcasts"] }), m.invalidateQueries({ queryKey: ["broadcast-receipt-summary"] }), m.invalidateQueries({ queryKey: ["broadcast-receipts"] });
45
+ c.invalidateQueries({ queryKey: ["broadcasts"] }), c.invalidateQueries({ queryKey: ["broadcast-receipt-summary"] }), c.invalidateQueries({ queryKey: ["broadcast-receipts"] });
45
46
  });
46
47
  const w = z(() => {
47
48
  const e = [];
48
- return N && e.push(_), s && e.push("email"), g && e.push("sms"), Q && e.push("login"), e;
49
- }, [N, _, s, g, Q]), F = z(
49
+ return g && e.push(_), m && e.push("email"), d && e.push("sms"), I && e.push("login"), e;
50
+ }, [g, _, m, d, I]), L = z(
50
51
  () => K.map((e) => {
51
- const c = {};
52
- for (const [b, S] of Object.entries(e)) b && S.length > 0 && (c[b] = S);
53
- return c;
52
+ const i = {};
53
+ for (const [f, S] of Object.entries(e)) f && S.length > 0 && (i[f] = S);
54
+ return i;
54
55
  }).filter((e) => Object.keys(e).length > 0),
55
56
  [K]
56
- ), L = z(
57
+ ), F = z(
57
58
  () => ({
58
- ...F.length > 0 ? { groups: F } : {},
59
+ ...L.length > 0 ? { groups: L } : {},
59
60
  ...$.length > 0 ? { roles: $ } : {}
60
61
  }),
61
- [F, $]
62
+ [L, $]
62
63
  ), P = C({
63
- mutationFn: () => i.request(
64
+ mutationFn: () => o.request(
64
65
  j("/announcements", {
65
- subject: h.trim() || void 0,
66
- message: l.trim(),
67
- severity: o,
66
+ subject: b.trim() || void 0,
67
+ message: s.trim(),
68
+ severity: l,
68
69
  channels: w,
69
70
  starts_at: Y || void 0,
70
71
  scheduled_send_at: R || void 0,
71
72
  ends_at: Z || void 0,
72
- require_ack: N && _ === "banner" ? I : !1,
73
- audience: L,
73
+ require_ack: g && _ === "banner" ? Q : !1,
74
+ audience: F,
74
75
  ...te()
75
76
  })
76
77
  ),
77
78
  onSuccess: (e) => {
78
- const c = e.data.scheduled_for;
79
+ const i = e.data.scheduled_for;
79
80
  q(
80
- c ? `Scheduled — delivers ${new Date(c).toLocaleString()}. Cancel from the history below.` : w.some((b) => b !== "banner") ? `Sent — reached ${e.data.delivered} recipient(s).` : "Banner published."
81
- ), u(""), x(""), M(""), W(""), ee(""), m.invalidateQueries({ queryKey: ["broadcasts"] }), m.invalidateQueries({ queryKey: ["announcements-active"] });
81
+ i ? `Scheduled — delivers ${new Date(i).toLocaleString()}. Cancel from the history below.` : w.some((f) => f !== "banner") ? `Sent — reached ${e.data.delivered} recipient(s).` : "Banner published."
82
+ ), u(""), h(""), M(""), W(""), ee(""), c.invalidateQueries({ queryKey: ["broadcasts"] }), c.invalidateQueries({ queryKey: ["announcements-active"] });
82
83
  },
83
84
  onError: (e) => q(e.message)
84
- }), D = l.trim().length > 0 && w.length > 0 && !P.isPending, { data: re = [] } = k({
85
+ }), D = s.trim().length > 0 && w.length > 0 && !P.isPending, { data: re = [] } = k({
85
86
  queryKey: ["broadcast-templates"],
86
- queryFn: () => i.request(v("/announcements/templates")).then((e) => e.data ?? []).catch(() => []),
87
+ queryFn: () => o.request(v("/announcements/templates")).then((e) => e.data ?? []).catch(() => []),
87
88
  staleTime: 6e4
88
89
  }), ne = C({
89
- mutationFn: (e) => i.request(
90
+ mutationFn: (e) => o.request(
90
91
  j("/announcements/templates", {
91
92
  name: e,
92
93
  snapshot: {
93
- subject: h,
94
- message: l,
95
- severity: o,
94
+ subject: b,
95
+ message: s,
96
+ severity: l,
96
97
  channels: w,
97
- require_ack: I,
98
- audience: L
98
+ require_ack: Q,
99
+ audience: F
99
100
  }
100
101
  })
101
102
  ),
102
- onSuccess: () => void m.invalidateQueries({ queryKey: ["broadcast-templates"] })
103
+ onSuccess: () => void c.invalidateQueries({ queryKey: ["broadcast-templates"] })
103
104
  }), ve = (e) => {
104
- const c = e.snapshot ?? {};
105
- typeof c.subject == "string" && x(c.subject), typeof c.message == "string" && u(c.message);
105
+ const i = e.snapshot ?? {};
106
+ typeof i.subject == "string" && h(i.subject), typeof i.message == "string" && u(i.message);
106
107
  }, [U, se] = p(""), [Ne, de] = p(!1), B = C({
107
- mutationFn: () => i.request(
108
+ mutationFn: () => o.request(
108
109
  j("/announcements/test-send", {
109
- subject: h.trim() || void 0,
110
- message: l.trim(),
110
+ subject: b.trim() || void 0,
111
+ message: s.trim(),
111
112
  channels: w.filter((e) => e !== "banner"),
112
113
  ...te()
113
114
  })
114
115
  ),
115
116
  onSuccess: (e) => q(
116
- `Test sent to you — ${Object.entries(e.data ?? {}).map(([c, b]) => `${c}: ${b}`).join(", ")}`
117
+ `Test sent to you — ${Object.entries(e.data ?? {}).map(([i, f]) => `${i}: ${f}`).join(", ")}`
117
118
  ),
118
119
  onError: (e) => q(e.message)
119
120
  }), E = (/* @__PURE__ */ new Date()).getHours(), we = !R && (E >= 21 || E < 7), Se = C({
120
- mutationFn: ({ id: e, body: c }) => i.request(Te(`/announcements/${e}`, c)),
121
+ mutationFn: ({ id: e, body: i }) => o.request(Te(`/announcements/${e}`, i)),
121
122
  onSuccess: () => {
122
- m.invalidateQueries({ queryKey: ["broadcasts"] }), m.invalidateQueries({ queryKey: ["announcements-active"] });
123
+ c.invalidateQueries({ queryKey: ["broadcasts"] }), c.invalidateQueries({ queryKey: ["announcements-active"] });
123
124
  }
124
125
  }), _e = C({
125
- mutationFn: (e) => i.request(Ae(`/announcements/${e}`)),
126
+ mutationFn: (e) => o.request(Ae(`/announcements/${e}`)),
126
127
  onSuccess: () => {
127
- m.invalidateQueries({ queryKey: ["broadcasts"] }), m.invalidateQueries({ queryKey: ["announcements-active"] });
128
+ c.invalidateQueries({ queryKey: ["broadcasts"] }), c.invalidateQueries({ queryKey: ["announcements-active"] });
128
129
  }
129
130
  });
130
- return /* @__PURE__ */ a("div", { className: f("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-6", r), children: [
131
+ return /* @__PURE__ */ a("div", { className: y("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-6", r), children: [
131
132
  /* @__PURE__ */ a("div", { className: "max-w-[760px] rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
132
133
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-foreground", children: "Audience" }),
133
134
  /* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] text-slate-400", children: "No selection = everyone. Zone/role targeting narrows both send channels and who sees a banner." }),
134
135
  /* @__PURE__ */ a("div", { className: "mt-3 space-y-2", children: [
135
- K.map((e, c) => /* @__PURE__ */ t(
136
- Ee,
136
+ K.map((e, i) => /* @__PURE__ */ t(
137
+ Oe,
137
138
  {
138
- index: c,
139
+ index: i,
139
140
  group: e,
140
141
  dimensions: ye,
141
- onChange: (b) => H((S) => S.map((G, qe) => qe === c ? b : G)),
142
- onRemove: () => H((b) => b.filter((S, G) => G !== c))
142
+ onChange: (f) => H((S) => S.map((G, qe) => qe === i ? f : G)),
143
+ onRemove: () => H((f) => f.filter((S, G) => G !== i))
143
144
  },
144
- c
145
+ i
145
146
  )),
146
147
  /* @__PURE__ */ a(
147
148
  "button",
@@ -160,15 +161,15 @@ function We({ className: r }) {
160
161
  /* @__PURE__ */ a("div", { className: "mt-3", children: [
161
162
  /* @__PURE__ */ t("p", { className: "mb-1 text-[11.5px] font-medium text-slate-700 dark:text-foreground", children: "Limit to roles" }),
162
163
  /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1.5", children: ke.map((e) => {
163
- const c = $.includes(e.id);
164
+ const i = $.includes(e.id);
164
165
  return /* @__PURE__ */ t(
165
166
  "button",
166
167
  {
167
168
  type: "button",
168
- onClick: () => fe((b) => c ? b.filter((S) => S !== e.id) : [...b, e.id]),
169
- className: f(
169
+ onClick: () => fe((f) => i ? f.filter((S) => S !== e.id) : [...f, e.id]),
170
+ className: y(
170
171
  "rounded-full border px-2.5 py-0.5 text-[11.5px] transition-colors",
171
- c ? "border-nvr-cyan/50 bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-muted-foreground"
172
+ i ? "border-nvr-cyan/50 bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-muted-foreground"
172
173
  ),
173
174
  children: e.name
174
175
  },
@@ -179,8 +180,8 @@ function We({ className: r }) {
179
180
  /* @__PURE__ */ t("div", { className: "mt-3 border-t border-slate-100 pt-2.5 dark:border-border", children: /* @__PURE__ */ t(
180
181
  me,
181
182
  {
182
- audience: L,
183
- everyone: F.length === 0 && $.length === 0,
183
+ audience: F,
184
+ everyone: L.length === 0 && $.length === 0,
184
185
  label: "Sending to"
185
186
  }
186
187
  ) })
@@ -188,21 +189,21 @@ function We({ className: r }) {
188
189
  /* @__PURE__ */ a("div", { className: "max-w-[760px] rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
189
190
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-foreground", children: "Message" }),
190
191
  /* @__PURE__ */ t(
191
- Ke,
192
+ Le,
192
193
  {
193
- audience: L,
194
+ audience: F,
194
195
  channels: w,
195
- severity: o,
196
+ severity: l,
196
197
  onUse: (e) => {
197
- e.subject !== void 0 && x(e.subject), u(e.message);
198
+ e.subject !== void 0 && h(e.subject), u(e.message);
198
199
  }
199
200
  }
200
201
  ),
201
202
  /* @__PURE__ */ t(
202
203
  "input",
203
204
  {
204
- value: h,
205
- onChange: (e) => x(e.target.value),
205
+ value: b,
206
+ onChange: (e) => h(e.target.value),
206
207
  placeholder: "Subject…",
207
208
  className: "mt-2 h-8 w-full rounded-md border border-slate-200 bg-background px-2.5 text-[12.5px] text-slate-800 dark:border-border dark:text-foreground"
208
209
  }
@@ -210,7 +211,7 @@ function We({ className: r }) {
210
211
  /* @__PURE__ */ t(
211
212
  "textarea",
212
213
  {
213
- value: l,
214
+ value: s,
214
215
  onChange: (e) => u(e.target.value),
215
216
  rows: 5,
216
217
  placeholder: "Compose your message… (plain text; line breaks are kept)",
@@ -223,7 +224,7 @@ function We({ className: r }) {
223
224
  "button",
224
225
  {
225
226
  type: "button",
226
- onClick: () => u((c) => c ? `${c} ${e}` : e),
227
+ onClick: () => u((i) => i ? `${i} ${e}` : e),
227
228
  className: "rounded bg-slate-100 px-1.5 py-0.5 font-mono text-[10.5px] text-slate-600 hover:bg-slate-200 dark:bg-muted dark:text-slate-300 dark:hover:bg-accent",
228
229
  title: `Insert ${e} — replaced with each recipient's ${e === "{{name}}" ? "full name" : "first name"} at send time`,
229
230
  children: e
@@ -252,7 +253,7 @@ function We({ className: r }) {
252
253
  /* @__PURE__ */ t("option", { value: "", children: "None" }),
253
254
  (((le = A.data) == null ? void 0 : le.data) ?? []).map((e) => /* @__PURE__ */ a("option", { value: e.id, children: [
254
255
  e.title || "Untitled video",
255
- e.duration_ms != null ? ` (${Le(e.duration_ms)})` : ""
256
+ e.duration_ms != null ? ` (${Pe(e.duration_ms)})` : ""
256
257
  ] }, e.id))
257
258
  ]
258
259
  }
@@ -296,14 +297,14 @@ function We({ className: r }) {
296
297
  "input",
297
298
  {
298
299
  type: "checkbox",
299
- checked: N,
300
+ checked: g,
300
301
  onChange: (e) => ue(e.target.checked),
301
302
  className: "h-3.5 w-3.5"
302
303
  }
303
304
  ),
304
305
  "In-app"
305
306
  ] }),
306
- N && /* @__PURE__ */ t("span", { className: "flex rounded-md border border-slate-200 p-0.5 dark:border-border", children: [
307
+ g && /* @__PURE__ */ t("span", { className: "flex rounded-md border border-slate-200 p-0.5 dark:border-border", children: [
307
308
  { value: "banner", label: "Banner" },
308
309
  { value: "message", label: "Inbox message" }
309
310
  ].map((e) => /* @__PURE__ */ t(
@@ -311,7 +312,7 @@ function We({ className: r }) {
311
312
  {
312
313
  type: "button",
313
314
  onClick: () => xe(e.value),
314
- className: f(
315
+ className: y(
315
316
  "rounded px-2 py-0.5 text-[11px] font-medium transition-colors",
316
317
  _ === e.value ? "bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "text-slate-400 hover:text-slate-600"
317
318
  ),
@@ -324,8 +325,8 @@ function We({ className: r }) {
324
325
  "input",
325
326
  {
326
327
  type: "checkbox",
327
- checked: s,
328
- onChange: (e) => d(e.target.checked),
328
+ checked: m,
329
+ onChange: (e) => x(e.target.checked),
329
330
  className: "h-3.5 w-3.5"
330
331
  }
331
332
  ),
@@ -341,7 +342,7 @@ function We({ className: r }) {
341
342
  "input",
342
343
  {
343
344
  type: "checkbox",
344
- checked: Q,
345
+ checked: I,
345
346
  onChange: (e) => pe(e.target.checked),
346
347
  className: "h-3.5 w-3.5"
347
348
  }
@@ -355,20 +356,20 @@ function We({ className: r }) {
355
356
  "input",
356
357
  {
357
358
  type: "checkbox",
358
- checked: g,
359
- onChange: (e) => y(e.target.checked),
359
+ checked: d,
360
+ onChange: (e) => N(e.target.checked),
360
361
  className: "h-3.5 w-3.5"
361
362
  }
362
363
  ),
363
364
  "Text (SMS)"
364
365
  ] }),
365
- N && _ === "banner" && /* @__PURE__ */ a(oe, { children: [
366
+ g && _ === "banner" && /* @__PURE__ */ a(oe, { children: [
366
367
  /* @__PURE__ */ a("label", { className: "flex cursor-pointer items-center gap-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: [
367
368
  /* @__PURE__ */ t(
368
369
  "input",
369
370
  {
370
371
  type: "checkbox",
371
- checked: I,
372
+ checked: Q,
372
373
  onChange: (e) => he(e.target.checked),
373
374
  className: "h-3.5 w-3.5"
374
375
  }
@@ -380,12 +381,12 @@ function We({ className: r }) {
380
381
  {
381
382
  type: "button",
382
383
  onClick: () => n(e),
383
- className: f(
384
+ className: y(
384
385
  "flex items-center gap-1.5 rounded px-2 py-0.5 text-[11px] font-medium capitalize transition-colors",
385
- o === e ? "bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "text-slate-400 hover:text-slate-600"
386
+ l === e ? "bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "text-slate-400 hover:text-slate-600"
386
387
  ),
387
388
  children: [
388
- /* @__PURE__ */ t("span", { className: f("h-1.5 w-1.5 rounded-full", ce[e]) }),
389
+ /* @__PURE__ */ t("span", { className: y("h-1.5 w-1.5 rounded-full", ce[e]) }),
389
390
  e
390
391
  ]
391
392
  },
@@ -417,7 +418,7 @@ function We({ className: r }) {
417
418
  ] })
418
419
  ] })
419
420
  ] }),
420
- N && _ === "banner" && /* @__PURE__ */ t("p", { className: "mt-1.5 text-[11px] text-slate-400", children: "Starts/Ends control only the banner's visibility window: it appears at Starts (empty = right away) and auto-expires at Ends for everyone who hasn't dismissed it (empty = stays up until each person dismisses it, or you turn it Off in history). Email, text, and inbox messages always send once, immediately — the window doesn't delay them." }),
421
+ g && _ === "banner" && /* @__PURE__ */ t("p", { className: "mt-1.5 text-[11px] text-slate-400", children: "Starts/Ends control only the banner's visibility window: it appears at Starts (empty = right away) and auto-expires at Ends for everyone who hasn't dismissed it (empty = stays up until each person dismisses it, or you turn it Off in history). Email, text, and inbox messages always send once, immediately — the window doesn't delay them." }),
421
422
  /* @__PURE__ */ a("div", { className: "mt-4 flex flex-wrap items-center gap-3", children: [
422
423
  /* @__PURE__ */ a("label", { className: "flex items-center gap-1.5 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
423
424
  "Send later",
@@ -483,7 +484,7 @@ function We({ className: r }) {
483
484
  "button",
484
485
  {
485
486
  type: "button",
486
- disabled: !l.trim(),
487
+ disabled: !s.trim(),
487
488
  onClick: () => de(!0),
488
489
  "data-tip": "Save this compose (audience + channels + text) as a reusable template (#104)",
489
490
  className: "h-8 rounded-md border border-dashed border-slate-300 px-2.5 text-[11.5px] text-slate-500 hover:text-slate-700 disabled:opacity-40 dark:border-border",
@@ -506,9 +507,9 @@ function We({ className: r }) {
506
507
  onClick: () => {
507
508
  const e = /* @__PURE__ */ new Date();
508
509
  E >= 21 && e.setDate(e.getDate() + 1), e.setHours(8, 0, 0, 0);
509
- const c = (b) => String(b).padStart(2, "0");
510
+ const i = (f) => String(f).padStart(2, "0");
510
511
  M(
511
- `${e.getFullYear()}-${c(e.getMonth() + 1)}-${c(e.getDate())}T${c(e.getHours())}:${c(e.getMinutes())}`
512
+ `${e.getFullYear()}-${i(e.getMonth() + 1)}-${i(e.getDate())}T${i(e.getHours())}:${i(e.getMinutes())}`
512
513
  );
513
514
  },
514
515
  children: "Schedule for 8:00 AM"
@@ -539,7 +540,7 @@ function We({ className: r }) {
539
540
  /* @__PURE__ */ t("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "History" }),
540
541
  ae.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Nothing sent yet." }),
541
542
  ae.map((e) => /* @__PURE__ */ t(
542
- De,
543
+ Ee,
543
544
  {
544
545
  broadcast: e,
545
546
  onPatch: Se.mutate,
@@ -550,35 +551,35 @@ function We({ className: r }) {
550
551
  ] })
551
552
  ] });
552
553
  }
553
- function De({
554
+ function Ee({
554
555
  broadcast: r,
555
- onPatch: i,
556
- onRemove: m
556
+ onPatch: o,
557
+ onRemove: c
557
558
  }) {
558
- const h = O(), x = ie(), [l, u] = p(!1), { data: o } = k({
559
+ const b = O(), h = ie(), [s, u] = p(!1), { data: l } = k({
559
560
  queryKey: ["broadcast-receipt-summary", r.id],
560
- queryFn: () => h.request(v(`/announcements/${r.id}/receipts/summary`)).then((d) => d.data),
561
- enabled: l,
561
+ queryFn: () => b.request(v(`/announcements/${r.id}/receipts/summary`)).then((d) => d.data),
562
+ enabled: s,
562
563
  staleTime: 5e3
563
564
  }), n = C({
564
- mutationFn: () => h.request(
565
+ mutationFn: () => b.request(
565
566
  j(`/announcements/${r.id}/nudge`, {})
566
567
  ),
567
568
  onSuccess: () => {
568
- x.invalidateQueries({ queryKey: ["broadcast-receipt-summary", r.id] }), x.invalidateQueries({ queryKey: ["broadcast-receipts", r.id] });
569
+ h.invalidateQueries({ queryKey: ["broadcast-receipt-summary", r.id] }), h.invalidateQueries({ queryKey: ["broadcast-receipts", r.id] });
569
570
  }
570
- }), { data: s } = k({
571
+ }), m = Ke(4e3), { data: x } = k({
571
572
  queryKey: ["broadcast-receipts", r.id],
572
- queryFn: () => h.request(v(`/announcements/${r.id}/receipts`)).then((d) => d.data),
573
- enabled: l,
573
+ queryFn: () => b.request(v(`/announcements/${r.id}/receipts`)).then((d) => d.data),
574
+ enabled: s,
574
575
  staleTime: 5e3,
575
576
  // Live ticker (#265): a freshly-sent broadcast's counts climb in real
576
577
  // time while the fan-out runs — fast poll for the first 10 minutes.
577
- refetchInterval: l && r.sent_at && Date.now() - new Date(r.sent_at).getTime() < 10 * 6e4 ? 4e3 : !1
578
+ refetchInterval: s && r.sent_at && Date.now() - new Date(r.sent_at).getTime() < 10 * 6e4 ? m : !1
578
579
  });
579
580
  return /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
580
581
  /* @__PURE__ */ a("div", { className: "flex items-start gap-3 px-4 py-3", children: [
581
- /* @__PURE__ */ t("span", { className: f("mt-1.5 h-2 w-2 shrink-0 rounded-full", ce[r.severity]) }),
582
+ /* @__PURE__ */ t("span", { className: y("mt-1.5 h-2 w-2 shrink-0 rounded-full", ce[r.severity]) }),
582
583
  /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
583
584
  r.subject && /* @__PURE__ */ t("p", { className: "text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: r.subject }),
584
585
  /* @__PURE__ */ t("p", { className: "text-[12.5px] text-slate-600 dark:text-muted-foreground", children: r.message }),
@@ -595,7 +596,7 @@ function De({
595
596
  "button",
596
597
  {
597
598
  type: "button",
598
- onClick: () => m(r.id),
599
+ onClick: () => c(r.id),
599
600
  className: "text-slate-400 underline decoration-dotted hover:text-red-500",
600
601
  children: "Cancel send"
601
602
  }
@@ -614,7 +615,7 @@ function De({
614
615
  onClick: () => u((d) => !d),
615
616
  className: "underline decoration-dotted underline-offset-2 hover:text-slate-600 dark:hover:text-muted-foreground",
616
617
  children: [
617
- l ? "hide receipts" : "who saw this?",
618
+ s ? "hide receipts" : "who saw this?",
618
619
  (r.click_count ?? 0) > 0 && /* @__PURE__ */ a("span", { className: "ml-1.5 rounded bg-nvr-cyan/[0.08] px-1.5 py-px text-[10px] font-medium text-[#007a99] dark:text-nvr-cyan", children: [
619
620
  r.click_count,
620
621
  " link click",
@@ -629,8 +630,8 @@ function De({
629
630
  "button",
630
631
  {
631
632
  type: "button",
632
- onClick: () => i({ id: r.id, body: { is_active: !r.is_active } }),
633
- className: f(
633
+ onClick: () => o({ id: r.id, body: { is_active: !r.is_active } }),
634
+ className: y(
634
635
  "shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium",
635
636
  r.is_active ? "border-emerald-300 text-emerald-700 dark:border-emerald-500/40 dark:text-emerald-400" : "border-slate-200 text-slate-400 dark:border-border"
636
637
  ),
@@ -641,13 +642,13 @@ function De({
641
642
  "button",
642
643
  {
643
644
  type: "button",
644
- onClick: () => m(r.id),
645
+ onClick: () => c(r.id),
645
646
  className: "shrink-0 text-[13px] text-slate-300 transition-colors hover:text-red-500",
646
647
  children: "✕"
647
648
  }
648
649
  )
649
650
  ] }),
650
- l && o && (o.totals.delivered > 0 || o.totals.acked > 0) && /* @__PURE__ */ a(
651
+ s && l && (l.totals.delivered > 0 || l.totals.acked > 0) && /* @__PURE__ */ a(
651
652
  "div",
652
653
  {
653
654
  className: "border-t border-slate-100 px-4 py-3 dark:border-border",
@@ -657,17 +658,17 @@ function De({
657
658
  /* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "By audience" }),
658
659
  /* @__PURE__ */ a("span", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
659
660
  "delivered ",
660
- /* @__PURE__ */ t("b", { children: o.totals.delivered }),
661
+ /* @__PURE__ */ t("b", { children: l.totals.delivered }),
661
662
  " · opened ",
662
- /* @__PURE__ */ t("b", { children: o.totals.opened }),
663
+ /* @__PURE__ */ t("b", { children: l.totals.opened }),
663
664
  " · acknowledged ",
664
- /* @__PURE__ */ t("b", { children: o.totals.acked }),
665
+ /* @__PURE__ */ t("b", { children: l.totals.acked }),
665
666
  " · still unread",
666
667
  " ",
667
- /* @__PURE__ */ t("b", { children: o.totals.unread })
668
+ /* @__PURE__ */ t("b", { children: l.totals.unread })
668
669
  ] }),
669
670
  /* @__PURE__ */ t("span", { className: "flex-1" }),
670
- o.totals.unread > 0 && /* @__PURE__ */ t(
671
+ l.totals.unread > 0 && /* @__PURE__ */ t(
671
672
  "button",
672
673
  {
673
674
  type: "button",
@@ -675,12 +676,12 @@ function De({
675
676
  onClick: () => n.mutate(),
676
677
  className: "rounded-md border border-amber-300 bg-amber-50 px-2.5 py-1 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-300",
677
678
  "data-nvr-nudge": !0,
678
- children: n.isPending ? "Nudging…" : n.data ? `Nudged ${n.data.data.nudged}` : `Nudge ${o.totals.unread} unread`
679
+ children: n.isPending ? "Nudging…" : n.data ? `Nudged ${n.data.data.nudged}` : `Nudge ${l.totals.unread} unread`
679
680
  }
680
681
  )
681
682
  ] }),
682
- /* @__PURE__ */ t("div", { className: "mt-2 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3", children: [["Role", o.by_role], ...Object.entries(o.by_dimension)].map(
683
- ([d, g]) => /* @__PURE__ */ a("table", { className: "w-full text-[11.5px] tabular-nums", children: [
683
+ /* @__PURE__ */ t("div", { className: "mt-2 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3", children: [["Role", l.by_role], ...Object.entries(l.by_dimension)].map(
684
+ ([d, N]) => /* @__PURE__ */ a("table", { className: "w-full text-[11.5px] tabular-nums", children: [
684
685
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ a("tr", { className: "text-left text-[10px] uppercase tracking-wide text-slate-400", children: [
685
686
  /* @__PURE__ */ t("th", { className: "py-0.5 font-semibold", children: d }),
686
687
  /* @__PURE__ */ t("th", { className: "py-0.5 text-right font-semibold", children: "Sent" }),
@@ -688,53 +689,53 @@ function De({
688
689
  /* @__PURE__ */ t("th", { className: "py-0.5 text-right font-semibold", children: "Ack" }),
689
690
  /* @__PURE__ */ t("th", { className: "py-0.5 text-right font-semibold", children: "Unread" })
690
691
  ] }) }),
691
- /* @__PURE__ */ t("tbody", { children: g.map((y) => /* @__PURE__ */ a("tr", { className: "border-t border-slate-100 dark:border-border", children: [
692
- /* @__PURE__ */ t("td", { className: "py-0.5 text-slate-700 dark:text-foreground", children: y.label }),
693
- /* @__PURE__ */ t("td", { className: "py-0.5 text-right", children: y.delivered }),
694
- /* @__PURE__ */ t("td", { className: "py-0.5 text-right text-emerald-700 dark:text-emerald-400", children: y.opened }),
695
- /* @__PURE__ */ t("td", { className: "py-0.5 text-right", children: y.acked }),
692
+ /* @__PURE__ */ t("tbody", { children: N.map((g) => /* @__PURE__ */ a("tr", { className: "border-t border-slate-100 dark:border-border", children: [
693
+ /* @__PURE__ */ t("td", { className: "py-0.5 text-slate-700 dark:text-foreground", children: g.label }),
694
+ /* @__PURE__ */ t("td", { className: "py-0.5 text-right", children: g.delivered }),
695
+ /* @__PURE__ */ t("td", { className: "py-0.5 text-right text-emerald-700 dark:text-emerald-400", children: g.opened }),
696
+ /* @__PURE__ */ t("td", { className: "py-0.5 text-right", children: g.acked }),
696
697
  /* @__PURE__ */ t(
697
698
  "td",
698
699
  {
699
- className: f(
700
+ className: y(
700
701
  "py-0.5 text-right",
701
- y.unread > 0 ? "text-amber-700 dark:text-amber-400" : "text-slate-400"
702
+ g.unread > 0 ? "text-amber-700 dark:text-amber-400" : "text-slate-400"
702
703
  ),
703
- children: y.unread
704
+ children: g.unread
704
705
  }
705
706
  )
706
- ] }, y.label)) })
707
+ ] }, g.label)) })
707
708
  ] }, d)
708
709
  ) }),
709
- o.unread_users.length > 0 && /* @__PURE__ */ a("p", { className: "mt-2 text-[11px] text-slate-400", children: [
710
+ l.unread_users.length > 0 && /* @__PURE__ */ a("p", { className: "mt-2 text-[11px] text-slate-400", children: [
710
711
  "Unread:",
711
712
  " ",
712
- o.unread_users.slice(0, 12).map((d) => d.name).join(", "),
713
- o.unread_users.length > 12 ? ` +${o.unread_users.length - 12} more` : ""
713
+ l.unread_users.slice(0, 12).map((d) => d.name).join(", "),
714
+ l.unread_users.length > 12 ? ` +${l.unread_users.length - 12} more` : ""
714
715
  ] })
715
716
  ]
716
717
  }
717
718
  ),
718
- l && /* @__PURE__ */ a("div", { className: "grid grid-cols-1 gap-4 border-t border-slate-100 px-4 py-3 dark:border-border sm:grid-cols-2", children: [
719
+ s && /* @__PURE__ */ a("div", { className: "grid grid-cols-1 gap-4 border-t border-slate-100 px-4 py-3 dark:border-border sm:grid-cols-2", children: [
719
720
  /* @__PURE__ */ a("div", { children: [
720
721
  /* @__PURE__ */ t("p", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Seen (banner dismissed)" }),
721
- !s && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Loading…" }),
722
- s && s.acks.length === 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Nobody has dismissed it yet." }),
723
- s == null ? void 0 : s.acks.map((d, g) => /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
722
+ !x && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Loading…" }),
723
+ x && x.acks.length === 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Nobody has dismissed it yet." }),
724
+ x == null ? void 0 : x.acks.map((d, N) => /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
724
725
  d.user_name || d.user_email || "Unknown",
725
726
  /* @__PURE__ */ t("span", { className: "text-slate-400", children: d.acked_at ? ` · ${new Date(d.acked_at).toLocaleString()}` : "" })
726
- ] }, g))
727
+ ] }, N))
727
728
  ] }),
728
729
  /* @__PURE__ */ a("div", { children: [
729
730
  /* @__PURE__ */ t("p", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Deliveries" }),
730
- !s && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Loading…" }),
731
- s && s.deliveries.length === 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Banner-only — no send channels on this broadcast." }),
732
- s == null ? void 0 : s.deliveries.map((d, g) => /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
731
+ !x && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Loading…" }),
732
+ x && x.deliveries.length === 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Banner-only — no send channels on this broadcast." }),
733
+ x == null ? void 0 : x.deliveries.map((d, N) => /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
733
734
  d.user_name || d.user_email || "Unknown",
734
735
  /* @__PURE__ */ a(
735
736
  "span",
736
737
  {
737
- className: f(
738
+ className: y(
738
739
  "ml-1.5 rounded px-1 py-px text-[9.5px] font-medium uppercase",
739
740
  d.status === "sent" ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400" : d.status === "failed" ? "bg-red-500/10 text-red-700 dark:text-red-400" : "bg-slate-500/10 text-slate-500"
740
741
  ),
@@ -746,31 +747,31 @@ function De({
746
747
  }
747
748
  ),
748
749
  /* @__PURE__ */ t("span", { className: "text-slate-400", children: d.delivered_at ? ` · ${new Date(d.delivered_at).toLocaleString()}` : "" })
749
- ] }, g))
750
+ ] }, N))
750
751
  ] })
751
752
  ] })
752
753
  ] });
753
754
  }
754
- function Ee({
755
+ function Oe({
755
756
  index: r,
756
- group: i,
757
- dimensions: m,
758
- onChange: h,
759
- onRemove: x
757
+ group: o,
758
+ dimensions: c,
759
+ onChange: b,
760
+ onRemove: h
760
761
  }) {
761
- const l = Object.keys(i), u = m.filter((n) => !l.includes(n.name)), o = l.length > 0 && l.every((n) => (i[n] ?? []).length > 0);
762
+ const s = Object.keys(o), u = c.filter((n) => !s.includes(n.name)), l = s.length > 0 && s.every((n) => (o[n] ?? []).length > 0);
762
763
  return /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-3 dark:border-border dark:bg-muted/30", children: [
763
764
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
764
765
  /* @__PURE__ */ a("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: [
765
766
  "Group ",
766
767
  r + 1,
767
- l.length > 1 && " · all conditions must match"
768
+ s.length > 1 && " · all conditions must match"
768
769
  ] }),
769
770
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2.5", children: [
770
- o && /* @__PURE__ */ t(
771
+ l && /* @__PURE__ */ t(
771
772
  me,
772
773
  {
773
- audience: { groups: [i] },
774
+ audience: { groups: [o] },
774
775
  everyone: !1,
775
776
  label: "Matches",
776
777
  compact: !0
@@ -780,7 +781,7 @@ function Ee({
780
781
  "button",
781
782
  {
782
783
  type: "button",
783
- onClick: x,
784
+ onClick: h,
784
785
  className: "text-[12px] text-slate-300 transition-colors hover:text-red-500",
785
786
  children: "✕"
786
787
  }
@@ -788,48 +789,48 @@ function Ee({
788
789
  ] })
789
790
  ] }),
790
791
  /* @__PURE__ */ a("div", { className: "mt-2 space-y-2", children: [
791
- l.map((n) => {
792
- const s = m.find((d) => d.name === n);
792
+ s.map((n) => {
793
+ const m = c.find((x) => x.name === n);
793
794
  return /* @__PURE__ */ a("div", { className: "flex flex-wrap items-start gap-2", children: [
794
- /* @__PURE__ */ t("span", { className: "mt-0.5 w-[110px] shrink-0 text-[11.5px] font-medium text-slate-600 dark:text-muted-foreground", children: (s == null ? void 0 : s.label) ?? n }),
795
- /* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: s ? /* @__PURE__ */ t(
796
- Oe,
795
+ /* @__PURE__ */ t("span", { className: "mt-0.5 w-[110px] shrink-0 text-[11.5px] font-medium text-slate-600 dark:text-muted-foreground", children: (m == null ? void 0 : m.label) ?? n }),
796
+ /* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: m ? /* @__PURE__ */ t(
797
+ Ie,
797
798
  {
798
- dim: s,
799
- selected: i[n] ?? [],
800
- onChange: (d) => {
801
- const g = { ...i };
802
- d.length === 0 ? delete g[n] : g[n] = d, h(g);
799
+ dim: m,
800
+ selected: o[n] ?? [],
801
+ onChange: (x) => {
802
+ const d = { ...o };
803
+ x.length === 0 ? delete d[n] : d[n] = x, b(d);
803
804
  }
804
805
  }
805
806
  ) : /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-400", children: "Unknown scope" }) })
806
807
  ] }, n);
807
808
  }),
808
809
  u.length > 0 && /* @__PURE__ */ t("div", { className: "w-[200px]", children: /* @__PURE__ */ t(
809
- Pe,
810
+ De,
810
811
  {
811
812
  value: "",
812
813
  onChange: (n) => {
813
- n && h({ ...i, [n]: [] });
814
+ n && b({ ...o, [n]: [] });
814
815
  },
815
816
  options: u.map((n) => ({ value: n.name, label: n.label })),
816
- placeholder: l.length === 0 ? "Pick a scope…" : "+ And also…"
817
+ placeholder: s.length === 0 ? "Pick a scope…" : "+ And also…"
817
818
  }
818
819
  ) })
819
820
  ] })
820
821
  ] });
821
822
  }
822
- function Oe({
823
+ function Ie({
823
824
  dim: r,
824
- selected: i,
825
- onChange: m
825
+ selected: o,
826
+ onChange: c
826
827
  }) {
827
- const h = O(), { data: x = [] } = k({
828
+ const b = O(), { data: h = [] } = k({
828
829
  queryKey: ["broadcast-dim-options", r.target_collection],
829
- queryFn: () => h.request(
830
+ queryFn: () => b.request(
830
831
  v(`/items/${r.target_collection}`, { limit: 200 })
831
832
  ).then(
832
- (l) => (l.data ?? []).map((u) => ({
833
+ (s) => (s.data ?? []).map((u) => ({
833
834
  id: u.id,
834
835
  label: String(u[r.display_field || "name"] ?? u.id)
835
836
  }))
@@ -837,41 +838,41 @@ function Oe({
837
838
  staleTime: 5 * 6e4
838
839
  });
839
840
  return /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-1.5", children: [
840
- x.length === 0 && /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-400", children: "Loading…" }),
841
- x.map((l) => {
842
- const u = i.some((o) => String(o) === String(l.id));
841
+ h.length === 0 && /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-400", children: "Loading…" }),
842
+ h.map((s) => {
843
+ const u = o.some((l) => String(l) === String(s.id));
843
844
  return /* @__PURE__ */ t(
844
845
  "button",
845
846
  {
846
847
  type: "button",
847
- onClick: () => m(
848
- u ? i.filter((o) => String(o) !== String(l.id)) : [...i, l.id]
848
+ onClick: () => c(
849
+ u ? o.filter((l) => String(l) !== String(s.id)) : [...o, s.id]
849
850
  ),
850
- className: f(
851
+ className: y(
851
852
  "rounded-full border px-2.5 py-0.5 text-[11.5px] transition-colors",
852
853
  u ? "border-nvr-cyan/50 bg-nvr-cyan/10 text-slate-800 dark:text-foreground" : "border-slate-200 bg-white text-slate-500 hover:text-slate-700 dark:border-border dark:bg-card dark:text-muted-foreground"
853
854
  ),
854
- children: l.label
855
+ children: s.label
855
856
  },
856
- String(l.id)
857
+ String(s.id)
857
858
  );
858
859
  })
859
860
  ] });
860
861
  }
861
862
  function me({
862
863
  audience: r,
863
- everyone: i,
864
- label: m,
865
- compact: h
864
+ everyone: o,
865
+ label: c,
866
+ compact: b
866
867
  }) {
867
- const x = O(), [l, u] = p(!1), o = JSON.stringify(r), { data: n } = k({
868
- queryKey: ["broadcast-audience-preview", o],
869
- queryFn: () => x.request(j("/announcements/preview-audience", { audience: r })).then((s) => s.data),
870
- enabled: !i,
868
+ const h = O(), [s, u] = p(!1), l = JSON.stringify(r), { data: n } = k({
869
+ queryKey: ["broadcast-audience-preview", l],
870
+ queryFn: () => h.request(j("/announcements/preview-audience", { audience: r })).then((m) => m.data),
871
+ enabled: !o,
871
872
  staleTime: 3e4
872
873
  });
873
- return i ? /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
874
- m,
874
+ return o ? /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
875
+ c,
875
876
  ": ",
876
877
  /* @__PURE__ */ t("span", { className: "font-medium", children: "Everyone" })
877
878
  ] }) : /* @__PURE__ */ a(oe, { children: [
@@ -883,18 +884,18 @@ function me({
883
884
  className: "text-[11.5px] text-slate-500 underline decoration-dotted underline-offset-2 hover:text-slate-700 dark:text-muted-foreground",
884
885
  title: "Click to see who",
885
886
  children: [
886
- m,
887
+ c,
887
888
  ":",
888
889
  " ",
889
890
  /* @__PURE__ */ t("span", { className: "font-medium", children: n ? `${n.count} user${n.count === 1 ? "" : "s"}` : "…" }),
890
- !h && n != null && n.count > 0 && " (deduped across groups)"
891
+ !b && n != null && n.count > 0 && " (deduped across groups)"
891
892
  ]
892
893
  }
893
894
  ),
894
- l && n && /* @__PURE__ */ t(
895
+ s && n && /* @__PURE__ */ t(
895
896
  Qe,
896
897
  {
897
- title: m === "Matches" ? "This group matches" : "Sending to",
898
+ title: c === "Matches" ? "This group matches" : "Sending to",
898
899
  count: n.count,
899
900
  users: n.users,
900
901
  truncated: n.truncated,
@@ -905,40 +906,40 @@ function me({
905
906
  }
906
907
  function Qe({
907
908
  title: r,
908
- count: i,
909
- users: m,
910
- truncated: h,
911
- onClose: x
909
+ count: o,
910
+ users: c,
911
+ truncated: b,
912
+ onClose: h
912
913
  }) {
913
- const [l, u] = p("");
914
+ const [s, u] = p("");
914
915
  Ce(() => {
915
- const s = (d) => {
916
- d.key === "Escape" && x();
916
+ const m = (x) => {
917
+ x.key === "Escape" && h();
917
918
  };
918
- return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
919
- }, [x]);
920
- const o = l.trim().toLowerCase(), n = o ? m.filter(
921
- (s) => s.name.toLowerCase().includes(o) || (s.email ?? "").toLowerCase().includes(o)
922
- ) : m;
919
+ return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
920
+ }, [h]);
921
+ const l = s.trim().toLowerCase(), n = l ? c.filter(
922
+ (m) => m.name.toLowerCase().includes(l) || (m.email ?? "").toLowerCase().includes(l)
923
+ ) : c;
923
924
  return $e(
924
925
  /* @__PURE__ */ a("div", { className: "fixed inset-0 z-[100]", children: [
925
- /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-black/30", onClick: x }),
926
+ /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-black/30", onClick: h }),
926
927
  /* @__PURE__ */ a("div", { className: "absolute right-0 top-0 flex h-full w-[380px] max-w-[92vw] flex-col border-l border-slate-200 bg-white shadow-xl dark:border-border dark:bg-card", children: [
927
928
  /* @__PURE__ */ a("div", { className: "shrink-0 border-b border-slate-100 px-4 py-3 dark:border-border", children: [
928
929
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
929
930
  /* @__PURE__ */ a("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-foreground", children: [
930
931
  r,
931
932
  /* @__PURE__ */ a("span", { className: "ml-1.5 font-normal text-slate-400", children: [
932
- i,
933
+ o,
933
934
  " user",
934
- i === 1 ? "" : "s"
935
+ o === 1 ? "" : "s"
935
936
  ] })
936
937
  ] }),
937
938
  /* @__PURE__ */ t(
938
939
  "button",
939
940
  {
940
941
  type: "button",
941
- onClick: x,
942
+ onClick: h,
942
943
  className: "text-[14px] text-slate-300 transition-colors hover:text-slate-600",
943
944
  children: "✕"
944
945
  }
@@ -948,31 +949,31 @@ function Qe({
948
949
  "input",
949
950
  {
950
951
  autoFocus: !0,
951
- value: l,
952
- onChange: (s) => u(s.target.value),
952
+ value: s,
953
+ onChange: (m) => u(m.target.value),
953
954
  placeholder: "Search name or email…",
954
955
  className: "mt-2 h-8 w-full rounded-md border border-slate-200 bg-background px-2.5 text-[12.5px] text-slate-800 dark:border-border dark:text-foreground"
955
956
  }
956
957
  )
957
958
  ] }),
958
959
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto px-4 py-2", children: [
959
- n.length === 0 && /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: m.length === 0 ? "No one matches this yet." : "No matches for that search." }),
960
- n.map((s) => /* @__PURE__ */ a(
960
+ n.length === 0 && /* @__PURE__ */ t("p", { className: "py-3 text-[12px] text-slate-400", children: c.length === 0 ? "No one matches this yet." : "No matches for that search." }),
961
+ n.map((m) => /* @__PURE__ */ a(
961
962
  "div",
962
963
  {
963
964
  className: "border-b border-slate-50 py-1.5 last:border-0 dark:border-border/40",
964
965
  children: [
965
- /* @__PURE__ */ t("p", { className: "text-[12.5px] text-slate-700 dark:text-foreground", children: s.name }),
966
- s.email && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: s.email })
966
+ /* @__PURE__ */ t("p", { className: "text-[12.5px] text-slate-700 dark:text-foreground", children: m.name }),
967
+ m.email && /* @__PURE__ */ t("p", { className: "text-[11px] text-slate-400", children: m.email })
967
968
  ]
968
969
  },
969
- s.id
970
+ m.id
970
971
  )),
971
- h && /* @__PURE__ */ a("p", { className: "py-2 text-[11px] text-slate-400", children: [
972
+ b && /* @__PURE__ */ a("p", { className: "py-2 text-[11px] text-slate-400", children: [
972
973
  "Showing the first ",
973
- m.length,
974
+ c.length,
974
975
  " of ",
975
- i,
976
+ o,
976
977
  "."
977
978
  ] })
978
979
  ] })
@@ -982,5 +983,5 @@ function Qe({
982
983
  );
983
984
  }
984
985
  export {
985
- We as BroadcastView
986
+ et as BroadcastView
986
987
  };