@nivaro/react 0.2.54 → 0.2.55

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 (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  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/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -6,42 +6,43 @@ import { useNivaroClient as z, useApiFetchConfig as be } from "../../context.js"
6
6
  import { get as A } from "../../lib/commands.js";
7
7
  import { cn as v, formatDateTime as f, formatRelative as V } from "../../lib/utils.js";
8
8
  import { TipLayer as ue } from "../TipLayer.js";
9
- import { useUserSearch as ge } from "./chat-core.js";
9
+ import { ChannelsAdminTab as ge } from "./ChannelArchive.js";
10
+ import { useUserSearch as ke } from "./chat-core.js";
10
11
  const U = {
11
12
  dm: "Direct message",
12
13
  group: "Group conversation",
13
14
  channel: "Channel",
14
15
  general: "General",
15
16
  record: "Record room"
16
- }, ke = {
17
+ }, Ne = {
17
18
  dm: "DM",
18
19
  group: "Group",
19
20
  channel: "Channel",
20
21
  general: "General",
21
22
  record: "Record"
22
23
  };
23
- function X(r) {
24
- if (r == null) return "—";
25
- if (r < 1) return "under a minute";
26
- if (r < 60) return `${Math.round(r)} min`;
27
- const i = r / 60;
24
+ function X(s) {
25
+ if (s == null) return "—";
26
+ if (s < 1) return "under a minute";
27
+ if (s < 60) return `${Math.round(s)} min`;
28
+ const i = s / 60;
28
29
  return i < 24 ? `${i.toFixed(i < 10 ? 1 : 0)} h` : `${(i / 24).toFixed(1)} days`;
29
30
  }
30
- function C({ label: r, value: i, sub: o }) {
31
+ function C({ label: s, value: i, sub: o }) {
31
32
  return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
32
- /* @__PURE__ */ e("p", { className: "text-[11px] font-medium uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: r }),
33
+ /* @__PURE__ */ e("p", { className: "text-[11px] font-medium uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: s }),
33
34
  /* @__PURE__ */ e("p", { className: "mt-1 text-[22px] font-semibold tabular-nums text-slate-900 dark:text-slate-50", children: i }),
34
35
  o && /* @__PURE__ */ e("p", { className: "mt-0.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: o })
35
36
  ] });
36
37
  }
37
38
  function J({
38
- values: r,
39
+ values: s,
39
40
  labels: i,
40
41
  tips: o,
41
42
  height: h = 120,
42
- axis: s
43
+ axis: r
43
44
  }) {
44
- const a = Math.max(1, ...r);
45
+ const a = Math.max(1, ...s);
45
46
  return /* @__PURE__ */ t("div", { children: [
46
47
  /* @__PURE__ */ e(
47
48
  "div",
@@ -50,7 +51,7 @@ function J({
50
51
  style: { height: h },
51
52
  role: "img",
52
53
  "aria-label": o.join("; "),
53
- children: r.map((p, u) => /* @__PURE__ */ e(
54
+ children: s.map((p, u) => /* @__PURE__ */ e(
54
55
  "div",
55
56
  {
56
57
  className: "group flex h-full min-w-0 flex-1 items-end",
@@ -70,11 +71,11 @@ function J({
70
71
  ))
71
72
  }
72
73
  ),
73
- /* @__PURE__ */ e("div", { className: "relative mt-1 h-4 border-t border-slate-200 dark:border-border", children: s.map((p) => /* @__PURE__ */ e(
74
+ /* @__PURE__ */ e("div", { className: "relative mt-1 h-4 border-t border-slate-200 dark:border-border", children: r.map((p) => /* @__PURE__ */ e(
74
75
  "span",
75
76
  {
76
77
  className: "absolute top-0.5 -translate-x-1/2 whitespace-nowrap text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400",
77
- style: { left: `${(p.index + 0.5) / r.length * 100}%` },
78
+ style: { left: `${(p.index + 0.5) / s.length * 100}%` },
78
79
  children: p.text
79
80
  },
80
81
  p.index
@@ -83,63 +84,63 @@ function J({
83
84
  ] });
84
85
  }
85
86
  function S({
86
- title: r,
87
+ title: s,
87
88
  children: i,
88
89
  note: o
89
90
  }) {
90
91
  return /* @__PURE__ */ t("section", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
91
92
  /* @__PURE__ */ t("div", { className: "mb-3 flex items-baseline justify-between gap-3", children: [
92
- /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: r }),
93
+ /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: s }),
93
94
  o && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: o })
94
95
  ] }),
95
96
  i
96
97
  ] });
97
98
  }
98
99
  function Y({
99
- rows: r,
100
+ rows: s,
100
101
  empty: i,
101
102
  onOpen: o
102
103
  }) {
103
- if (r.length === 0)
104
+ if (s.length === 0)
104
105
  return /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: i });
105
- const h = Math.max(1, ...r.map((s) => s.messages));
106
+ const h = Math.max(1, ...s.map((r) => r.messages));
106
107
  return /* @__PURE__ */ t("table", { className: "w-full text-[12.5px]", children: [
107
108
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { className: "text-left text-[10.5px] uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: [
108
109
  /* @__PURE__ */ e("th", { className: "pb-1.5 font-medium", children: "Room" }),
109
110
  /* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "Messages" }),
110
111
  /* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "People" })
111
112
  ] }) }),
112
- /* @__PURE__ */ e("tbody", { className: "tabular-nums", children: r.map((s) => /* @__PURE__ */ t("tr", { className: "border-t border-slate-100 dark:border-border/60", children: [
113
+ /* @__PURE__ */ e("tbody", { className: "tabular-nums", children: s.map((r) => /* @__PURE__ */ t("tr", { className: "border-t border-slate-100 dark:border-border/60", children: [
113
114
  /* @__PURE__ */ t("td", { className: "py-1.5 pr-3", children: [
114
115
  /* @__PURE__ */ e(
115
116
  "button",
116
117
  {
117
118
  type: "button",
118
- onClick: () => o(s.room, s.label),
119
+ onClick: () => o(r.room, r.label),
119
120
  className: "block max-w-full truncate text-left font-medium text-slate-800 hover:underline dark:text-slate-100",
120
121
  title: "Read the messages in this room",
121
- children: s.label
122
+ children: r.label
122
123
  }
123
124
  ),
124
125
  /* @__PURE__ */ e("span", { className: "mt-1 block h-1 rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
125
126
  "span",
126
127
  {
127
128
  className: "block h-1 rounded-full bg-nvr-cyan",
128
- style: { width: `${s.messages / h * 100}%` }
129
+ style: { width: `${r.messages / h * 100}%` }
129
130
  }
130
131
  ) })
131
132
  ] }),
132
- /* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children: s.messages }),
133
- /* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children: s.senders })
134
- ] }, s.room)) })
133
+ /* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children: r.messages }),
134
+ /* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children: r.senders })
135
+ ] }, r.room)) })
135
136
  ] });
136
137
  }
137
- function Ne({ onOpenRoom: r }) {
138
- const i = z(), [o, h] = b(30), { data: s, isLoading: a, isError: p, refetch: u, isFetching: c } = K({
138
+ function fe({ onOpenRoom: s }) {
139
+ const i = z(), [o, h] = b(30), { data: r, isLoading: a, isError: p, refetch: u, isFetching: c } = K({
139
140
  queryKey: ["nvr-chat-analytics", o],
140
141
  queryFn: () => i.request(A("/chat/admin/analytics", { days: o })).then((d) => d.data),
141
142
  staleTime: 6e4
142
- }), m = (s == null ? void 0 : s.per_day) ?? [], n = m.map(
143
+ }), m = (r == null ? void 0 : r.per_day) ?? [], n = m.map(
143
144
  (d) => `${(/* @__PURE__ */ new Date(`${d.day}T12:00:00`)).toLocaleDateString("en-US", { month: "short", day: "numeric" })}: ${d.messages} message${d.messages === 1 ? "" : "s"} from ${d.senders} ${d.senders === 1 ? "person" : "people"}`
144
145
  ), x = xe(() => {
145
146
  const d = m.length;
@@ -187,9 +188,9 @@ function Ne({ onOpenRoom: r }) {
187
188
  ]
188
189
  }
189
190
  ),
190
- s && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: [
191
+ r && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: [
191
192
  "Times in ",
192
- s.window.time_zone.replace(/_/g, " "),
193
+ r.window.time_zone.replace(/_/g, " "),
193
194
  ". Counts only — no message text on this tab."
194
195
  ] })
195
196
  ] }),
@@ -205,43 +206,43 @@ function Ne({ onOpenRoom: r }) {
205
206
  },
206
207
  d
207
208
  )) }),
208
- s && /* @__PURE__ */ t(de, { children: [
209
- s.window.truncated && /* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "Only the newest 50,000 messages in this window were counted." }),
209
+ r && /* @__PURE__ */ t(de, { children: [
210
+ r.window.truncated && /* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "Only the newest 50,000 messages in this window were counted." }),
210
211
  /* @__PURE__ */ t(
211
212
  "div",
212
213
  {
213
214
  className: "grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6",
214
215
  "data-chat-analytics-totals": !0,
215
216
  children: [
216
- /* @__PURE__ */ e(C, { label: "Messages", value: s.totals.messages.toLocaleString() }),
217
- /* @__PURE__ */ e(C, { label: "People who wrote", value: s.totals.senders.toLocaleString() }),
218
- /* @__PURE__ */ e(C, { label: "Active rooms", value: s.totals.active_rooms.toLocaleString() }),
217
+ /* @__PURE__ */ e(C, { label: "Messages", value: r.totals.messages.toLocaleString() }),
218
+ /* @__PURE__ */ e(C, { label: "People who wrote", value: r.totals.senders.toLocaleString() }),
219
+ /* @__PURE__ */ e(C, { label: "Active rooms", value: r.totals.active_rooms.toLocaleString() }),
219
220
  /* @__PURE__ */ e(
220
221
  C,
221
222
  {
222
223
  label: "DM reply time",
223
- value: X(s.dm_response.median_minutes),
224
- sub: s.dm_response.samples ? `median of ${s.dm_response.samples} replies · 90% within ${X(s.dm_response.p90_minutes)}` : "no replies in this window"
224
+ value: X(r.dm_response.median_minutes),
225
+ sub: r.dm_response.samples ? `median of ${r.dm_response.samples} replies · 90% within ${X(r.dm_response.p90_minutes)}` : "no replies in this window"
225
226
  }
226
227
  ),
227
228
  /* @__PURE__ */ e(
228
229
  C,
229
230
  {
230
231
  label: "DMs answered within an hour",
231
- value: s.dm_response.within_hour_pct == null ? "—" : `${s.dm_response.within_hour_pct}%`
232
+ value: r.dm_response.within_hour_pct == null ? "—" : `${r.dm_response.within_hour_pct}%`
232
233
  }
233
234
  ),
234
235
  /* @__PURE__ */ e(
235
236
  C,
236
237
  {
237
238
  label: "Files · reactions",
238
- value: `${s.totals.attachments} · ${s.totals.reactions}`
239
+ value: `${r.totals.attachments} · ${r.totals.reactions}`
239
240
  }
240
241
  )
241
242
  ]
242
243
  }
243
244
  ),
244
- /* @__PURE__ */ e(S, { title: "Messages per day", note: `Last ${s.window.days} days`, children: /* @__PURE__ */ e(
245
+ /* @__PURE__ */ e(S, { title: "Messages per day", note: `Last ${r.window.days} days`, children: /* @__PURE__ */ e(
245
246
  J,
246
247
  {
247
248
  values: m.map((d) => d.messages),
@@ -254,24 +255,24 @@ function Ne({ onOpenRoom: r }) {
254
255
  /* @__PURE__ */ e(S, { title: "When people write", note: "Messages by hour of day", children: /* @__PURE__ */ e(
255
256
  J,
256
257
  {
257
- values: s.by_hour,
258
- labels: s.by_hour.map((d, k) => `${y(k)} ${d}`),
259
- tips: s.by_hour.map(
258
+ values: r.by_hour,
259
+ labels: r.by_hour.map((d, k) => `${y(k)} ${d}`),
260
+ tips: r.by_hour.map(
260
261
  (d, k) => `${y(k)}m–${y((k + 1) % 24)}m: ${d} message${d === 1 ? "" : "s"}`
261
262
  ),
262
263
  height: 96,
263
264
  axis: [0, 6, 12, 18].map((d) => ({ index: d, text: y(d) }))
264
265
  }
265
266
  ) }),
266
- /* @__PURE__ */ e(S, { title: "Where people write", children: s.by_kind.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "No messages in this window." }) : /* @__PURE__ */ t("table", { className: "w-full text-[12.5px] tabular-nums", children: [
267
+ /* @__PURE__ */ e(S, { title: "Where people write", children: r.by_kind.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "No messages in this window." }) : /* @__PURE__ */ t("table", { className: "w-full text-[12.5px] tabular-nums", children: [
267
268
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { className: "text-left text-[10.5px] uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: [
268
269
  /* @__PURE__ */ e("th", { className: "pb-1.5 font-medium", children: "Kind" }),
269
270
  /* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "Rooms" }),
270
271
  /* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "Messages" }),
271
272
  /* @__PURE__ */ e("th", { className: "pb-1.5 pl-3 font-medium", children: "Share" })
272
273
  ] }) }),
273
- /* @__PURE__ */ e("tbody", { children: s.by_kind.map((d) => {
274
- const k = s.totals.messages ? d.messages / s.totals.messages * 100 : 0;
274
+ /* @__PURE__ */ e("tbody", { children: r.by_kind.map((d) => {
275
+ const k = r.totals.messages ? d.messages / r.totals.messages * 100 : 0;
275
276
  return /* @__PURE__ */ t(
276
277
  "tr",
277
278
  {
@@ -304,17 +305,17 @@ function Ne({ onOpenRoom: r }) {
304
305
  /* @__PURE__ */ e(S, { title: "Busiest channels", children: /* @__PURE__ */ e(
305
306
  Y,
306
307
  {
307
- rows: s.busiest_channels,
308
+ rows: r.busiest_channels,
308
309
  empty: "No channel messages in this window.",
309
- onOpen: r
310
+ onOpen: s
310
311
  }
311
312
  ) }),
312
313
  /* @__PURE__ */ e(S, { title: "Busiest record conversations", children: /* @__PURE__ */ e(
313
314
  Y,
314
315
  {
315
- rows: s.busiest_records,
316
+ rows: r.busiest_records,
316
317
  empty: "No record conversations in this window.",
317
- onOpen: r
318
+ onOpen: s
318
319
  }
319
320
  ) })
320
321
  ] })
@@ -322,20 +323,20 @@ function Ne({ onOpenRoom: r }) {
322
323
  ] });
323
324
  }
324
325
  function Z({
325
- label: r,
326
+ label: s,
326
327
  value: i,
327
328
  onChange: o
328
329
  }) {
329
- const [h, s] = b(!1), [a, p] = b(""), { users: u } = ge(a, h);
330
+ const [h, r] = b(!1), [a, p] = b(""), { users: u } = ke(a, h);
330
331
  return i ? /* @__PURE__ */ t("span", { className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-2 text-[12px] dark:border-border dark:bg-card", children: [
331
- /* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-slate-400", children: r }),
332
+ /* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-slate-400", children: s }),
332
333
  /* @__PURE__ */ e("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: i.name }),
333
334
  /* @__PURE__ */ e(
334
335
  "button",
335
336
  {
336
337
  type: "button",
337
338
  onClick: () => o(null),
338
- "aria-label": `Clear ${r}`,
339
+ "aria-label": `Clear ${s}`,
339
340
  className: "rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-100",
340
341
  children: /* @__PURE__ */ e(P, { className: "h-3 w-3" })
341
342
  }
@@ -345,12 +346,12 @@ function Z({
345
346
  "input",
346
347
  {
347
348
  value: a,
348
- onFocus: () => s(!0),
349
- onBlur: () => setTimeout(() => s(!1), 150),
349
+ onFocus: () => r(!0),
350
+ onBlur: () => setTimeout(() => r(!1), 150),
350
351
  onChange: (c) => p(c.target.value),
351
- placeholder: `${r}: anyone`,
352
+ placeholder: `${s}: anyone`,
352
353
  className: "h-8 w-44 rounded-md border border-slate-200 bg-white px-2 text-[12px] outline-none focus:border-slate-400 dark:border-border dark:bg-card",
353
- "aria-label": `${r} person`
354
+ "aria-label": `${s} person`
354
355
  }
355
356
  ),
356
357
  h && u.length > 0 && /* @__PURE__ */ e("div", { className: "absolute left-0 top-9 z-20 max-h-64 w-64 overflow-y-auto rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card", children: u.map((c) => {
@@ -361,7 +362,7 @@ function Z({
361
362
  type: "button",
362
363
  onMouseDown: (n) => n.preventDefault(),
363
364
  onClick: () => {
364
- o({ id: c.id, name: m }), p(""), s(!1);
365
+ o({ id: c.id, name: m }), p(""), r(!1);
365
366
  },
366
367
  className: "block w-full truncate px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
367
368
  children: [
@@ -374,20 +375,20 @@ function Z({
374
375
  }) })
375
376
  ] });
376
377
  }
377
- function ee(r) {
378
- return r.kind === "group" && r.participant_count ? `${r.room_label} · ${r.participant_count} people` : r.room_label;
378
+ function ee(s) {
379
+ return s.kind === "group" && s.participant_count ? `${s.room_label} · ${s.participant_count} people` : s.room_label;
379
380
  }
380
- function te({ kind: r }) {
381
- return /* @__PURE__ */ e("span", { className: "inline-flex shrink-0 rounded border border-slate-200 px-1.5 text-[10.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300", children: ke[r] });
381
+ function te({ kind: s }) {
382
+ return /* @__PURE__ */ e("span", { className: "inline-flex shrink-0 rounded border border-slate-200 px-1.5 text-[10.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300", children: Ne[s] });
382
383
  }
383
- function fe({
384
- room: r,
384
+ function ve({
385
+ room: s,
385
386
  onRoomChange: i
386
387
  }) {
387
- const o = z(), [h, s] = b(null), [a, p] = b(null), [u, c] = b([]), [m, n] = b(""), [x, y] = b(""), [d, k] = b(""), [w, _] = b(""), [E, ae] = b(!1), [W, se] = b(!1), [M, T] = b(1), [D, R] = b(null), I = 50, G = {
388
+ const o = z(), [h, r] = b(null), [a, p] = b(null), [u, c] = b([]), [m, n] = b(""), [x, y] = b(""), [d, k] = b(""), [w, _] = b(""), [E, ae] = b(!1), [W, se] = b(!1), [M, F] = b(1), [D, R] = b(null), I = 50, G = {
388
389
  ...h ? { sender: h.id } : {},
389
390
  ...a ? { participant: a.id } : {},
390
- ...r ? { room: r.room } : {},
391
+ ...s ? { room: s.room } : {},
391
392
  ...u.length ? { kind: u.join(",") } : {},
392
393
  ...x.trim().length >= 2 ? { q: x.trim() } : {},
393
394
  ...d ? { since: (/* @__PURE__ */ new Date(`${d}T00:00:00`)).toISOString() } : {},
@@ -400,7 +401,7 @@ function fe({
400
401
  queryKey: ["nvr-chat-admin-messages", G],
401
402
  queryFn: () => o.request(A("/chat/admin/messages", G)),
402
403
  placeholderData: (l) => l
403
- }), H = ($ == null ? void 0 : $.data) ?? [], F = ($ == null ? void 0 : $.total) ?? 0, L = Math.max(1, Math.ceil(F / I)), N = () => T(1);
404
+ }), H = ($ == null ? void 0 : $.data) ?? [], T = ($ == null ? void 0 : $.total) ?? 0, L = Math.max(1, Math.ceil(T / I)), N = () => F(1);
404
405
  return /* @__PURE__ */ t("div", { className: "space-y-3", children: [
405
406
  /* @__PURE__ */ t(
406
407
  "p",
@@ -420,7 +421,7 @@ function fe({
420
421
  label: "From",
421
422
  value: h,
422
423
  onChange: (l) => {
423
- s(l), N();
424
+ r(l), N();
424
425
  }
425
426
  }
426
427
  ),
@@ -434,9 +435,9 @@ function fe({
434
435
  }
435
436
  }
436
437
  ),
437
- r && /* @__PURE__ */ t("span", { className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-2 text-[12px] dark:border-border dark:bg-card", children: [
438
+ s && /* @__PURE__ */ t("span", { className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-2 text-[12px] dark:border-border dark:bg-card", children: [
438
439
  /* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-slate-400", children: "Room" }),
439
- /* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-800 dark:text-slate-100", children: r.label }),
440
+ /* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-800 dark:text-slate-100", children: s.label }),
440
441
  /* @__PURE__ */ e(
441
442
  "button",
442
443
  {
@@ -563,8 +564,8 @@ function fe({
563
564
  children: [
564
565
  /* @__PURE__ */ t("div", { className: "min-w-0 overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
565
566
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 text-[12px] text-slate-500 dark:border-border/60 dark:text-slate-400", children: [
566
- /* @__PURE__ */ t("span", { "data-chat-admin-total": F, children: [
567
- j ? "Loading…" : `${F.toLocaleString()} message${F === 1 ? "" : "s"}`,
567
+ /* @__PURE__ */ t("span", { "data-chat-admin-total": T, children: [
568
+ j ? "Loading…" : `${T.toLocaleString()} message${T === 1 ? "" : "s"}`,
568
569
  le && !j && " · updating…"
569
570
  ] }),
570
571
  L > 1 && /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
@@ -573,7 +574,7 @@ function fe({
573
574
  {
574
575
  type: "button",
575
576
  disabled: M <= 1,
576
- onClick: () => T((l) => l - 1),
577
+ onClick: () => F((l) => l - 1),
577
578
  className: "rounded p-1 hover:bg-slate-100 disabled:opacity-40 dark:hover:bg-muted",
578
579
  "aria-label": "Previous page",
579
580
  children: /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5" })
@@ -589,7 +590,7 @@ function fe({
589
590
  {
590
591
  type: "button",
591
592
  disabled: M >= L,
592
- onClick: () => T((l) => l + 1),
593
+ onClick: () => F((l) => l + 1),
593
594
  className: "rounded p-1 hover:bg-slate-100 disabled:opacity-40 dark:hover:bg-muted",
594
595
  "aria-label": "Next page",
595
596
  children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
@@ -658,7 +659,7 @@ function fe({
658
659
  ] })
659
660
  ] }),
660
661
  D != null && /* @__PURE__ */ e(
661
- ve,
662
+ ye,
662
663
  {
663
664
  id: D,
664
665
  onClose: () => R(null),
@@ -672,13 +673,13 @@ function fe({
672
673
  )
673
674
  ] });
674
675
  }
675
- function g({ label: r, children: i }) {
676
+ function g({ label: s, children: i }) {
676
677
  return /* @__PURE__ */ t("div", { className: "grid grid-cols-[104px_minmax(0,1fr)] gap-2 py-1 text-[12.5px]", children: [
677
- /* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-slate-400", children: r }),
678
+ /* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-slate-400", children: s }),
678
679
  /* @__PURE__ */ e("dd", { className: "min-w-0 text-slate-800 dark:text-slate-100", children: i })
679
680
  ] });
680
681
  }
681
- function B({ m: r, target: i }) {
682
+ function B({ m: s, target: i }) {
682
683
  return /* @__PURE__ */ t(
683
684
  "div",
684
685
  {
@@ -686,26 +687,26 @@ function B({ m: r, target: i }) {
686
687
  "rounded-md px-2.5 py-1.5",
687
688
  i ? "bg-[#f2fdff] ring-1 ring-nvr-cyan/50 dark:bg-[#20303a]" : ""
688
689
  ),
689
- "data-chat-admin-context": r.id,
690
+ "data-chat-admin-context": s.id,
690
691
  children: [
691
692
  /* @__PURE__ */ t("p", { className: "flex items-baseline gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
692
- /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: r.sender_name ?? "Unknown" }),
693
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: f(r.date_created) }),
694
- r.edited_at && /* @__PURE__ */ e("span", { children: "edited" })
693
+ /* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: s.sender_name ?? "Unknown" }),
694
+ /* @__PURE__ */ e("span", { className: "tabular-nums", children: f(s.date_created) }),
695
+ s.edited_at && /* @__PURE__ */ e("span", { children: "edited" })
695
696
  ] }),
696
- /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap break-words text-[12.5px] text-slate-800 dark:text-slate-100", children: r.deleted_at ? /* @__PURE__ */ e("em", { className: "text-slate-500 dark:text-slate-400", children: "Deleted" }) : r.message || "—" })
697
+ /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap break-words text-[12.5px] text-slate-800 dark:text-slate-100", children: s.deleted_at ? /* @__PURE__ */ e("em", { className: "text-slate-500 dark:text-slate-400", children: "Deleted" }) : s.message || "—" })
697
698
  ]
698
699
  }
699
700
  );
700
701
  }
701
- function ve({
702
- id: r,
702
+ function ye({
703
+ id: s,
703
704
  onClose: i,
704
705
  onRoom: o
705
706
  }) {
706
- const h = z(), { apiBase: s } = be(), { data: a, isLoading: p, isError: u } = K({
707
- queryKey: ["nvr-chat-admin-message", r],
708
- queryFn: () => h.request(A(`/chat/admin/messages/${r}`)).then((n) => n.data)
707
+ const h = z(), { apiBase: r } = be(), { data: a, isLoading: p, isError: u } = K({
708
+ queryKey: ["nvr-chat-admin-message", s],
709
+ queryFn: () => h.request(A(`/chat/admin/messages/${s}`)).then((n) => n.data)
709
710
  }), c = (a == null ? void 0 : a.reads.filter(
710
711
  (n) => !n.read && n.user.toUpperCase() !== String(a.message.sender ?? "").toUpperCase()
711
712
  )) ?? [], m = (a == null ? void 0 : a.reads.filter(
@@ -715,12 +716,12 @@ function ve({
715
716
  "aside",
716
717
  {
717
718
  className: "min-w-0 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card xl:sticky xl:top-0 xl:max-h-[calc(100vh-180px)] xl:overflow-y-auto",
718
- "data-chat-admin-detail": r,
719
+ "data-chat-admin-detail": s,
719
720
  children: [
720
721
  /* @__PURE__ */ t("div", { className: "flex items-center justify-between border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
721
722
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
722
723
  "Message #",
723
- r
724
+ s
724
725
  ] }),
725
726
  /* @__PURE__ */ e(
726
727
  "button",
@@ -787,7 +788,7 @@ function ve({
787
788
  /* @__PURE__ */ t(
788
789
  "a",
789
790
  {
790
- href: `${s}/files/${n.id}?download=1`,
791
+ href: `${r}/files/${n.id}?download=1`,
791
792
  className: "inline-flex items-center gap-1 hover:underline",
792
793
  target: "_blank",
793
794
  rel: "noreferrer",
@@ -862,7 +863,7 @@ function ve({
862
863
  /* @__PURE__ */ t(
863
864
  "a",
864
865
  {
865
- href: `${s}/files/${x.id}?download=1`,
866
+ href: `${r}/files/${x.id}?download=1`,
866
867
  className: "inline-flex items-center gap-1 hover:underline",
867
868
  target: "_blank",
868
869
  rel: "noreferrer",
@@ -914,39 +915,40 @@ function ve({
914
915
  }
915
916
  );
916
917
  }
917
- function Te() {
918
- const [r, i] = b("overview"), [o, h] = b(null);
918
+ function je() {
919
+ const [s, i] = b("overview"), [o, h] = b(null);
919
920
  return /* @__PURE__ */ t("div", { className: "space-y-4", "data-chat-analytics": !0, children: [
920
921
  /* @__PURE__ */ e(ue, {}),
921
922
  /* @__PURE__ */ e("div", { className: "flex gap-1 border-b border-slate-200 dark:border-border", role: "tablist", children: [
922
923
  ["overview", "Overview"],
923
- ["messages", "Messages"]
924
- ].map(([s, a]) => /* @__PURE__ */ e(
924
+ ["messages", "Messages"],
925
+ ["channels", "Channels"]
926
+ ].map(([r, a]) => /* @__PURE__ */ e(
925
927
  "button",
926
928
  {
927
929
  type: "button",
928
930
  role: "tab",
929
- "aria-selected": r === s,
930
- onClick: () => i(s),
931
+ "aria-selected": s === r,
932
+ onClick: () => i(r),
931
933
  className: v(
932
934
  "-mb-px border-b-2 px-3 py-2 text-[13px] font-medium",
933
- r === s ? "border-nvr-cyan text-slate-900 dark:text-slate-50" : "border-transparent text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-100"
935
+ s === r ? "border-nvr-cyan text-slate-900 dark:text-slate-50" : "border-transparent text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-100"
934
936
  ),
935
- "data-chat-analytics-tab": s,
937
+ "data-chat-analytics-tab": r,
936
938
  children: a
937
939
  },
938
- s
940
+ r
939
941
  )) }),
940
- r === "overview" ? /* @__PURE__ */ e(
941
- Ne,
942
+ s === "overview" ? /* @__PURE__ */ e(
943
+ fe,
942
944
  {
943
- onOpenRoom: (s, a) => {
944
- h({ room: s, label: a }), i("messages");
945
+ onOpenRoom: (r, a) => {
946
+ h({ room: r, label: a }), i("messages");
945
947
  }
946
948
  }
947
- ) : /* @__PURE__ */ e(fe, { room: o, onRoomChange: h })
949
+ ) : s === "channels" ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(ve, { room: o, onRoomChange: h })
948
950
  ] });
949
951
  }
950
952
  export {
951
- Te as ChatAnalyticsView
953
+ je as ChatAnalyticsView
952
954
  };