@nivaro/react 0.2.55 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/components/slots/TasksSlot.js +31 -29
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +101 -1
  5. package/dist/index.js +538 -525
  6. package/dist/shared/components/ItemEditForm.js +666 -658
  7. package/dist/shared/components/MyWorkView.js +47 -37
  8. package/dist/shared/components/ProfileView.js +163 -144
  9. package/dist/shared/components/ai/AiPlanCard.js +427 -0
  10. package/dist/shared/components/ai/AiPlanChanges.js +117 -0
  11. package/dist/shared/components/ai/TaskDo.js +1022 -0
  12. package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
  13. package/dist/shared/components/chat/ChatPanel.js +1356 -1317
  14. package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
  15. package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
  16. package/dist/shared/components/chat/chat-core.js +273 -264
  17. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
  18. package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
  19. package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
  20. package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
  21. package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
  22. package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
  23. package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
  24. package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
  25. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
  26. package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
  27. package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
  28. package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
  29. package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
  30. package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
  31. package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
  32. package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
  33. package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
  34. package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
  35. package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
  36. package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
  37. package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
  38. package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
  39. package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
  40. package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
  41. package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
  42. package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
  43. package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
  44. package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
  45. package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
  46. package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
  47. package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
  48. package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
  49. package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
  50. package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
  51. package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
  52. package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
  53. package/dist/shared/components/item-edit/GroupSection.js +1 -0
  54. package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
  55. package/dist/shared/components/item-edit/UserChip.js +145 -142
  56. package/dist/shared/components/panels/TaskPanel.js +51 -49
  57. package/dist/shared/components/support/TicketDetailSheet.js +57 -42
  58. package/dist/shared/lib/notification-sound.js +25 -16
  59. package/dist/shared/lib/stale-chunk.js +60 -0
  60. package/package.json +2 -1
@@ -1,46 +1,52 @@
1
- import { jsxs as a, jsx as e, Fragment as Ne } from "react/jsx-runtime";
2
- import { useQuery as we, useQueryClient as Rt, useMutation as qe } from "@tanstack/react-query";
3
- import { Search as qn, Plus as qa, Hash as _t, Lock as Ea, ChevronLeft as ct, X as dt, PinOff as Ba, Pin as St, PlayCircle as Wa, MessageCircle as En, Users as Tt, AtSign as Fa, AlarmClock as za, Sparkles as Ha, BellOff as Sn, PencilLine as Ga, Star as Qa, ArchiveRestore as Ka, Archive as Ja, Bell as Ya, LogOut as Za, Info as Va, MapPin as Xa, Check as At, ArrowUpDown as es, MessageSquareReply as ts, Quote as ns, ClipboardPlus as as, NotebookPen as ss, Bookmark as rs, Pencil as ls, Trash2 as os, AlertTriangle as is, Paperclip as cs, Bot as ds, CheckCheck as us, Plane as ms, FilePlus2 as ps } from "lucide-react";
4
- import { useState as T, useEffect as ae, useMemo as fe, useRef as oe, useContext as hs } from "react";
1
+ import { jsxs as a, jsx as e, Fragment as Ce } from "react/jsx-runtime";
2
+ import { useQuery as Ne, useQueryClient as Rt, useMutation as Ee } from "@tanstack/react-query";
3
+ import { Search as Wn, Plus as Wa, Hash as _t, Lock as Fa, ChevronLeft as ct, X as dt, PinOff as za, Pin as St, Headphones as Ha, PlayCircle as Ga, MessageCircle as Fn, Users as Tt, AtSign as Qa, AlarmClock as Ka, Sparkles as Ja, BellOff as Sn, PencilLine as Ya, Star as Za, ArchiveRestore as Va, Archive as Xa, Bell as es, LogOut as ts, Info as ns, MapPin as as, Check as At, ArrowUpDown as ss, MessageSquareReply as rs, Quote as ls, ClipboardPlus as os, NotebookPen as is, Bookmark as cs, Pencil as ds, Trash2 as us, AlertTriangle as ms, Paperclip as ps, Bot as hs, CheckCheck as fs, Plane as xs, FilePlus2 as gs } from "lucide-react";
4
+ import { useState as T, useEffect as ae, useMemo as fe, useRef as oe, useContext as bs } from "react";
5
5
  import { toast as he } from "sonner";
6
- import { useItemEditAuth as ut, useNavigation as fs, useNivaroClient as Je } from "../../context.js";
7
- import { get as xe, post as Ee, patch as xs } from "../../lib/commands.js";
8
- import { useLiveRecord as bs, batchTouches as gs, LIVE_ASPECTS as vs } from "../../lib/live.js";
6
+ import { useItemEditAuth as ut, useNavigation as vs, useNivaroClient as Je } from "../../context.js";
7
+ import { get as xe, post as Be, patch as ys } from "../../lib/commands.js";
8
+ import { useLiveRecord as ks, batchTouches as ws, LIVE_ASPECTS as Ns } from "../../lib/live.js";
9
9
  import { presencePlaceHref as Tn, stuckText as Un, fullHref as Dn } from "../../lib/presence-state.js";
10
- import { invalidateRecordTasks as ys } from "../../lib/record-tasks.js";
11
- import { userCardQuery as ks } from "../../lib/user-cards.js";
12
- import { cn as b, getDisplayTimezone as Mt, formatRelative as Bn } from "../../lib/utils.js";
13
- import { CustomStatusEditor as ws } from "../CustomStatusEditor.js";
14
- import { DoNotDisturbRow as Ns } from "../DoNotDisturb.js";
15
- import { FilePreviewLightbox as Cs } from "../FilePreviewLightbox.js";
16
- import { UserChip as Wn } from "../item-edit/UserChip.js";
17
- import { UserAvatar as _s } from "../UserAvatar.js";
10
+ import { invalidateRecordTasks as Cs } from "../../lib/record-tasks.js";
11
+ import { userCardQuery as _s } from "../../lib/user-cards.js";
12
+ import { cn as g, getDisplayTimezone as Mt, formatRelative as zn } from "../../lib/utils.js";
13
+ import { CustomStatusEditor as Ss } from "../CustomStatusEditor.js";
14
+ import { DoNotDisturbRow as Ts } from "../DoNotDisturb.js";
15
+ import { FilePreviewLightbox as Us } from "../FilePreviewLightbox.js";
16
+ import { UserChip as Hn } from "../item-edit/UserChip.js";
17
+ import { UserAvatar as Ds } from "../UserAvatar.js";
18
18
  import { Popover as Ye, PopoverTrigger as Ze, PopoverContent as Ve } from "../ui/popover.js";
19
19
  import { SimpleSelect as Ot } from "../ui/SimpleSelect.js";
20
- import { useBotStream as Ss, BotStreamBubble as Ts } from "./BotStream.js";
21
- import { MembershipHistory as Us, ArchiveSuggestionBanner as Ds } from "./ChannelArchive.js";
22
- import { ChannelExtrasEditor as $s, BulkInvitePanel as Rs, ChannelAuditLog as As } from "./ChannelExtras.js";
23
- import { ChannelTile as Ke, ChannelLookPicker as Fn } from "./ChannelLook.js";
24
- import { MentionsView as zn, ScheduledView as Hn, CatchUpView as Gn, useSearchFilterState as Ms, FilterToggle as Os, ChatSettingsButton as Ls, SearchFilterBar as Ps } from "./ChatViews.js";
25
- import { ChatComposer as Is } from "./Composer.js";
26
- import { useMyPreferences as Lt, useSetMyPreferences as Qn, useChatRoles as Kn, useChannelDirectory as js, useRoomMembership as Pt, useCreateChannel as qs, useChatConfig as Ae, useChannelMembers as It, useChannelAdmin as Jn, useUserSearch as jt, GENERAL_CHANNEL_ID as Yn, useChatRooms as Zn, useArchivedRooms as Vn, dmRoom as Ut, CHAT_DEFAULTS as it, ChatConfigContext as Xn, useChatBotInfo as qt, useChatSearch as Es, dmPeer as ke, useChatMessages as Bs, useOpenRoomRegistration as Ws, useMarkRoomRead as Fs, useTypingIndicator as zs, usePeerReadAt as Hs, useEntityRoomLink as Gs, useToggleReaction as Qs, useRoomPins as Ks, useTogglePin as Js, useEditMessage as Ys, useDeleteMessage as Zs, useChatBotName as Vs, useChatThread as Xs, useRecordBrowserTimezone as er, chatInitials as tr, chatAvatarColor as nr, useCreateGroupDm as ar, canOpenDm as sr, openDmWith as rr, chatRoomTypesQuery as ea, REACTION_EMOJI as lr } from "./chat-core.js";
27
- import { useDraftRooms as or } from "./chat-drafts.js";
28
- import { useCustomEmoji as ir, EmojiButton as cr, EmojiGlyph as dr } from "./chat-emoji.js";
29
- import { useRoomRecord as ta, useRecordFileTargets as ur } from "./chat-hooks.js";
30
- import { offHoursNote as mr } from "./chat-local-time.js";
31
- import { useMessageWindow as pr } from "./chat-window.js";
32
- import { HuddleControls as hr } from "./huddle/HuddleControls.js";
33
- import { HuddleStage as fr } from "./huddle/HuddleStage.js";
34
- import { useHuddle as xr } from "./huddle/useHuddle.js";
35
- import { useMessageActions as br, MessageActionsMenu as gr, actionsForMessage as vr } from "./MessageActions.js";
36
- import { FormattedMessage as yr, LinkPreviews as kr } from "./MessageFormat.js";
37
- import { PollCard as wr } from "./PollCard.js";
38
- import { RoomStatusMarks as Nr, headerIconIdle as $n, headerIconButton as Rn, RoomHeaderMenu as Cr } from "./RoomHeaderMenu.js";
39
- import { MemberCountLine as _r, ChannelIntro as Sr, WelcomeNote as Tr, ThreadPane as Ur, RoomInfoDrawer as Dr } from "./RoomParts.js";
40
- import { clipInfo as $r, ClipPlayer as Rr } from "./ScreenClip.js";
41
- import { useOutbox as na } from "./chat-outbox.js";
42
- import { OutboxBubbles as aa } from "./OutboxBubbles.js";
43
- const sa = {
20
+ import { useBotStream as $s, BotStreamBubble as Rs } from "./BotStream.js";
21
+ import { MembershipHistory as As, ArchiveSuggestionBanner as Ms } from "./ChannelArchive.js";
22
+ import { ChannelExtrasEditor as Os, BulkInvitePanel as Ls, ChannelAuditLog as Ps } from "./ChannelExtras.js";
23
+ import { ChannelTile as Ke, ChannelLookPicker as Gn } from "./ChannelLook.js";
24
+ import { MentionsView as Qn, ScheduledView as Kn, CatchUpView as Jn, useSearchFilterState as Is, FilterToggle as js, ChatSettingsButton as qs, SearchFilterBar as Es } from "./ChatViews.js";
25
+ import { ChatComposer as Bs } from "./Composer.js";
26
+ import { useMyPreferences as Lt, useSetMyPreferences as Yn, useChatRoles as Zn, useChannelDirectory as Ws, useRoomMembership as Pt, useCreateChannel as Fs, useChatConfig as Me, useChannelMembers as It, useChannelAdmin as Vn, useUserSearch as jt, GENERAL_CHANNEL_ID as Xn, useChatRooms as ea, useArchivedRooms as ta, dmRoom as Ut, CHAT_DEFAULTS as it, ChatConfigContext as na, useChatBotInfo as qt, useChatSearch as zs, dmPeer as we, useChatMessages as Hs, useOpenRoomRegistration as Gs, useMarkRoomRead as Qs, useTypingIndicator as Ks, usePeerReadAt as Js, useEntityRoomLink as Ys, useToggleReaction as Zs, useRoomPins as Vs, useTogglePin as Xs, useEditMessage as er, useDeleteMessage as tr, useChatBotName as nr, useChatThread as ar, useRecordBrowserTimezone as sr, chatInitials as rr, chatAvatarColor as lr, useCreateGroupDm as or, canOpenDm as ir, openDmWith as cr, chatRoomTypesQuery as aa, REACTION_EMOJI as dr } from "./chat-core.js";
27
+ import { useDraftRooms as ur } from "./chat-drafts.js";
28
+ import { useCustomEmoji as mr, EmojiButton as pr, EmojiGlyph as hr } from "./chat-emoji.js";
29
+ import { useRoomRecord as sa, useRecordFileTargets as fr } from "./chat-hooks.js";
30
+ import { offHoursNote as xr } from "./chat-local-time.js";
31
+ import { useMessageWindow as gr } from "./chat-window.js";
32
+ import { HuddleFollowHost as $n } from "./huddle/HuddleCollab.js";
33
+ import { HuddleControls as br } from "./huddle/HuddleControls.js";
34
+ import { HuddleLiveBadge as vr } from "./huddle/HuddleLiveBadge.js";
35
+ import { HuddleScheduleCard as yr } from "./huddle/HuddleScheduleCard.js";
36
+ import { HuddleScheduleForm as kr } from "./huddle/HuddleScheduleForm.js";
37
+ import { HuddleStage as wr } from "./huddle/HuddleStage.js";
38
+ import { useHuddleLive as Nr } from "./huddle/huddle-live.js";
39
+ import { stripHuddleRef as Rn, huddleRefOf as An } from "./huddle/huddle-schedule.js";
40
+ import { useHuddle as Cr } from "./huddle/useHuddle.js";
41
+ import { useMessageActions as _r, MessageActionsMenu as Sr, actionsForMessage as Tr } from "./MessageActions.js";
42
+ import { FormattedMessage as Ur, LinkPreviews as Dr } from "./MessageFormat.js";
43
+ import { PollCard as $r } from "./PollCard.js";
44
+ import { RoomStatusMarks as Rr, headerIconIdle as Mn, headerIconButton as On, RoomHeaderMenu as Ar } from "./RoomHeaderMenu.js";
45
+ import { MemberCountLine as Mr, ChannelIntro as Or, WelcomeNote as Lr, ThreadPane as Pr, RoomInfoDrawer as Ir } from "./RoomParts.js";
46
+ import { clipInfo as jr, ClipPlayer as qr } from "./ScreenClip.js";
47
+ import { useOutbox as ra } from "./chat-outbox.js";
48
+ import { OutboxBubbles as la } from "./OutboxBubbles.js";
49
+ const oa = {
44
50
  bubbleMine: "bg-nvr-cyan text-white",
45
51
  bubbleOther: "bg-slate-100 text-slate-800 dark:bg-muted dark:text-slate-100",
46
52
  accentText: "text-nvr-navy dark:text-nvr-cyan",
@@ -51,43 +57,43 @@ const sa = {
51
57
  input: "border-slate-200 bg-slate-50 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-slate-100",
52
58
  divider: "border-slate-100 dark:border-border/60"
53
59
  }, Et = {};
54
- Et.current = sa;
55
- function zl({
60
+ Et.current = oa;
61
+ function so({
56
62
  children: n,
57
63
  me: s,
58
64
  onlineUsers: o = [],
59
65
  collections: r,
60
66
  globalRoom: l = it.globalRoom,
61
67
  globalLabel: i = it.globalLabel,
62
- entityPattern: u = it.entityPattern,
68
+ entityPattern: d = it.entityPattern,
63
69
  entityUrl: c = () => null,
64
- roomLabel: f,
65
- recordUrl: g,
66
- sessionUrl: p,
67
- realtime: x,
68
- subscribeRooms: v,
70
+ roomLabel: h,
71
+ recordUrl: f,
72
+ sessionUrl: u,
73
+ realtime: p,
74
+ subscribeRooms: b,
69
75
  setTypingRoom: U,
70
76
  navigate: $,
71
- sound: N = !0,
72
- theme: _
77
+ sound: C = !0,
78
+ theme: S
73
79
  }) {
74
- const P = fe(
80
+ const W = fe(
75
81
  () => ({
76
82
  collections: { ...it.collections, ...r },
77
83
  globalRoom: l,
78
84
  globalLabel: i,
79
- entityPattern: u,
85
+ entityPattern: d,
80
86
  entityUrl: c,
81
- roomLabel: f,
82
- recordUrl: g,
83
- sessionUrl: p,
84
- realtime: x,
85
- subscribeRooms: v,
87
+ roomLabel: h,
88
+ recordUrl: f,
89
+ sessionUrl: u,
90
+ realtime: p,
91
+ subscribeRooms: b,
86
92
  me: s,
87
93
  onlineUsers: o,
88
94
  setTypingRoom: U,
89
95
  navigate: $,
90
- sound: N
96
+ sound: C
91
97
  }),
92
98
  // eslint-disable-next-line react-hooks/exhaustive-deps
93
99
  [
@@ -96,65 +102,65 @@ function zl({
96
102
  r,
97
103
  l,
98
104
  i,
99
- u,
100
- x,
105
+ d,
106
+ p,
101
107
  U,
102
- N
108
+ C
103
109
  ]
104
110
  );
105
- return Et.current = { ...sa, ..._ }, /* @__PURE__ */ e(Xn.Provider, { value: P, children: n });
111
+ return Et.current = { ...oa, ...S }, /* @__PURE__ */ e(na.Provider, { value: W, children: n });
106
112
  }
107
113
  function ie() {
108
114
  return Et.current;
109
115
  }
110
- const An = /* @__PURE__ */ new WeakMap();
111
- function Ar(n, s) {
116
+ const Ln = /* @__PURE__ */ new WeakMap();
117
+ function Er(n, s) {
112
118
  const o = String(s).toUpperCase();
113
- let r = An.get(n);
114
- r || (r = { ids: /* @__PURE__ */ new Map(), timer: null }, An.set(n, r));
119
+ let r = Ln.get(n);
120
+ r || (r = { ids: /* @__PURE__ */ new Map(), timer: null }, Ln.set(n, r));
115
121
  const l = r;
116
122
  return new Promise((i) => {
117
- const u = l.ids.get(o) ?? [];
118
- u.push(i), l.ids.set(o, u), !l.timer && (l.timer = setTimeout(async () => {
123
+ const d = l.ids.get(o) ?? [];
124
+ d.push(i), l.ids.set(o, d), !l.timer && (l.timer = setTimeout(async () => {
119
125
  const c = new Map(l.ids);
120
126
  l.ids.clear(), l.timer = null;
121
- const f = [...c.keys()], g = /* @__PURE__ */ new Map();
122
- for (let p = 0; p < f.length; p += 100)
127
+ const h = [...c.keys()], f = /* @__PURE__ */ new Map();
128
+ for (let u = 0; u < h.length; u += 100)
123
129
  try {
124
- const x = await n.request(
125
- xe("/presence/people", { ids: f.slice(p, p + 100).join(",") })
130
+ const p = await n.request(
131
+ xe("/presence/people", { ids: h.slice(u, u + 100).join(",") })
126
132
  );
127
- for (const v of x.data ?? []) g.set(String(v.user_id).toUpperCase(), v);
133
+ for (const b of p.data ?? []) f.set(String(b.user_id).toUpperCase(), b);
128
134
  } catch {
129
135
  }
130
- for (const [p, x] of c) for (const v of x) v(g.get(p) ?? null);
136
+ for (const [u, p] of c) for (const b of p) b(f.get(u) ?? null);
131
137
  }, 0));
132
138
  });
133
139
  }
134
140
  function Bt(n, s = !0) {
135
- const o = Je(), { data: r } = we({
141
+ const o = Je(), { data: r } = Ne({
136
142
  queryKey: ["nvr-person-info", n ? String(n).toUpperCase() : null],
137
- queryFn: () => Ar(o, n),
143
+ queryFn: () => Er(o, n),
138
144
  enabled: !!n && s,
139
145
  staleTime: 6e4
140
146
  });
141
147
  return r ?? null;
142
148
  }
143
- function ra(n) {
144
- return n != null && n.last_seen ? `last seen ${Bn(n.last_seen)}` : null;
149
+ function ia(n) {
150
+ return n != null && n.last_seen ? `last seen ${zn(n.last_seen)}` : null;
145
151
  }
146
- function la(n) {
147
- const s = hs(Xn), o = da(), r = String(n).toUpperCase();
152
+ function ca(n) {
153
+ const s = bs(na), o = pa(), r = String(n).toUpperCase();
148
154
  if (o.loaded) {
149
155
  const i = o.byUser.get(r);
150
156
  if (!i) return { state: "offline", title: "Offline", page: null };
151
- const u = i.page ?? ua(i.current_path);
152
- return i.away ? { state: "away", title: "Away", page: null } : i.is_idle ? { state: "idle", title: Dt(i), page: u } : { state: "online", title: "Online", page: u };
157
+ const d = i.page ?? ha(i.current_path);
158
+ return i.away ? { state: "away", title: "Away", page: null } : i.is_idle ? { state: "idle", title: Dt(i), page: d } : { state: "online", title: "Online", page: d };
153
159
  }
154
160
  const l = s == null ? void 0 : s.onlineUsers.find((i) => String(i.user_id).toUpperCase() === r);
155
161
  return l ? l.is_idle ? { state: "idle", title: Dt(l), page: null } : { state: "online", title: "Online", page: null } : { state: "offline", title: "Offline", page: null };
156
162
  }
157
- function oa(n) {
163
+ function da(n) {
158
164
  return n != null && n.out_of_office ? n.ooo_end ? `Out of office until ${new Date(n.ooo_end).toLocaleDateString(void 0, {
159
165
  weekday: "short",
160
166
  month: "short",
@@ -162,24 +168,24 @@ function oa(n) {
162
168
  timeZone: Mt() ?? void 0
163
169
  })}` : "Out of office" : null;
164
170
  }
165
- function Mr({ id: n, size: s }) {
166
- const { state: o, title: r, page: l } = la(n), i = Bt(n), u = o === "offline" ? ra(i) : null, c = oa(i), f = s >= 30 ? 10 : 8, g = [
167
- u ? `Offline · ${u}` : r,
171
+ function Br({ id: n, size: s }) {
172
+ const { state: o, title: r, page: l } = ca(n), i = Bt(n), d = o === "offline" ? ia(i) : null, c = da(i), h = s >= 30 ? 10 : 8, f = [
173
+ d ? `Offline · ${d}` : r,
168
174
  l && o !== "offline" ? `On ${l}` : null,
169
175
  c,
170
176
  c && (i != null && i.delegate) ? `${i.delegate.name} is covering` : null
171
177
  ].filter(Boolean).join(" · ");
172
- return /* @__PURE__ */ a(Ne, { children: [
178
+ return /* @__PURE__ */ a(Ce, { children: [
173
179
  /* @__PURE__ */ e(
174
180
  "span",
175
181
  {
176
- className: b(
182
+ className: g(
177
183
  "absolute -bottom-0.5 -right-0.5 rounded-full border-2 border-white dark:border-card",
178
184
  o === "online" ? "bg-emerald-400" : o === "idle" || o === "away" ? "border-amber-400 bg-white dark:border-amber-400 dark:bg-card" : "bg-slate-300 dark:bg-slate-600"
179
185
  ),
180
- style: { width: f, height: f },
181
- "data-tip": g,
182
- title: g,
186
+ style: { width: h, height: h },
187
+ "data-tip": f,
188
+ title: f,
183
189
  "data-chat-presence": o
184
190
  }
185
191
  ),
@@ -189,16 +195,16 @@ function Mr({ id: n, size: s }) {
189
195
  "span",
190
196
  {
191
197
  className: "absolute -right-1 -top-1 flex items-center justify-center rounded-full border-2 border-white bg-violet-600 text-white dark:border-card",
192
- style: { width: f + 2, height: f + 2 },
198
+ style: { width: h + 2, height: h + 2 },
193
199
  "data-chat-ooo": !0,
194
- title: g,
200
+ title: f,
195
201
  "aria-label": c,
196
- children: /* @__PURE__ */ e(ms, { style: { width: f - 3, height: f - 3 }, strokeWidth: 2.5 })
202
+ children: /* @__PURE__ */ e(xs, { style: { width: h - 3, height: h - 3 }, strokeWidth: 2.5 })
197
203
  }
198
204
  )
199
205
  ] });
200
206
  }
201
- function V({
207
+ function Z({
202
208
  id: n,
203
209
  name: s,
204
210
  size: o = 32,
@@ -211,14 +217,14 @@ function V({
211
217
  style: {
212
218
  width: o,
213
219
  height: o,
214
- backgroundColor: nr(n),
220
+ backgroundColor: lr(n),
215
221
  fontSize: o * 0.36
216
222
  },
217
223
  "aria-hidden": !0,
218
- children: tr(s)
224
+ children: rr(s)
219
225
  }
220
- ), u = /* @__PURE__ */ e(
221
- _s,
226
+ ), d = /* @__PURE__ */ e(
227
+ Ds,
222
228
  {
223
229
  userId: n,
224
230
  fallback: i,
@@ -226,14 +232,14 @@ function V({
226
232
  alt: s ?? ""
227
233
  }
228
234
  ), c = n === "__bot__" || !!l.bot_user_id && String(l.bot_user_id).toUpperCase() === String(n).toUpperCase();
229
- return !r || c ? u : /* @__PURE__ */ a("span", { className: "relative inline-flex shrink-0", style: { width: o, height: o }, children: [
230
- u,
231
- /* @__PURE__ */ e(Mr, { id: n, size: o })
235
+ return !r || c ? d : /* @__PURE__ */ a("span", { className: "relative inline-flex shrink-0", style: { width: o, height: o }, children: [
236
+ d,
237
+ /* @__PURE__ */ e(Br, { id: n, size: o })
232
238
  ] });
233
239
  }
234
- function Or({ peerId: n, name: s }) {
235
- const o = qt(), r = n === "__bot__" || !!o.bot_user_id && String(o.bot_user_id).toUpperCase() === n.toUpperCase(), l = /* @__PURE__ */ e(V, { id: n, name: s, size: 28 });
236
- return r ? /* @__PURE__ */ e("span", { className: "mr-1 inline-flex shrink-0", children: l }) : /* @__PURE__ */ e(Wn, { userId: n, children: /* @__PURE__ */ e(
240
+ function Wr({ peerId: n, name: s }) {
241
+ const o = qt(), r = n === "__bot__" || !!o.bot_user_id && String(o.bot_user_id).toUpperCase() === n.toUpperCase(), l = /* @__PURE__ */ e(Z, { id: n, name: s, size: 28 });
242
+ return r ? /* @__PURE__ */ e("span", { className: "mr-1 inline-flex shrink-0", children: l }) : /* @__PURE__ */ e(Hn, { userId: n, children: /* @__PURE__ */ e(
237
243
  "button",
238
244
  {
239
245
  type: "button",
@@ -244,42 +250,42 @@ function Or({ peerId: n, name: s }) {
244
250
  }
245
251
  ) });
246
252
  }
247
- function Mn({ token: n, url: s, mine: o }) {
248
- const r = Ae(), l = ie(), i = Je(), { data: u } = we(ea(i)), { data: c } = we({
253
+ function Pn({ token: n, url: s, mine: o }) {
254
+ const r = Me(), l = ie(), i = Je(), { data: d } = Ne(aa(i)), { data: c } = Ne({
249
255
  queryKey: ["nvr-chat-entity-card", n],
250
256
  queryFn: async () => {
251
- var p, x, v, U;
252
- for (const $ of u ?? [])
257
+ var u, p, b, U;
258
+ for (const $ of d ?? [])
253
259
  try {
254
- const _ = (x = (p = (await i.request(
260
+ const S = (p = (u = (await i.request(
255
261
  xe(`/items/${$.collection}`, {
256
262
  limit: 1,
257
263
  fields: "id",
258
264
  filter: JSON.stringify({ [$.match_field]: { _eq: n } })
259
265
  })
260
- )).data) == null ? void 0 : p[0]) == null ? void 0 : x.id;
261
- if (_ == null) continue;
262
- const R = (U = (v = (await i.request(
263
- xe(`/pipelines/instance/${$.collection}/${_}`)
264
- )).data) == null ? void 0 : v.instance) == null ? void 0 : U.current_state_obj;
266
+ )).data) == null ? void 0 : u[0]) == null ? void 0 : p.id;
267
+ if (S == null) continue;
268
+ const M = (U = (b = (await i.request(
269
+ xe(`/pipelines/instance/${$.collection}/${S}`)
270
+ )).data) == null ? void 0 : b.instance) == null ? void 0 : U.current_state_obj;
265
271
  return {
266
272
  collection: $.collection,
267
- id: _,
268
- state: (R == null ? void 0 : R.label) ?? null,
269
- color: (R == null ? void 0 : R.color) ?? null
273
+ id: S,
274
+ state: (M == null ? void 0 : M.label) ?? null,
275
+ color: (M == null ? void 0 : M.color) ?? null
270
276
  };
271
277
  } catch {
272
278
  }
273
279
  return null;
274
280
  },
275
- enabled: ((u == null ? void 0 : u.length) ?? 0) > 0,
281
+ enabled: ((d == null ? void 0 : d.length) ?? 0) > 0,
276
282
  staleTime: 10 * 6e4
277
- }), f = Rt();
278
- return bs(
283
+ }), h = Rt();
284
+ return ks(
279
285
  c == null ? void 0 : c.collection,
280
286
  c == null ? void 0 : c.id,
281
- (p) => {
282
- gs(p, vs.state) && f.invalidateQueries({ queryKey: ["nvr-chat-entity-card", n] });
287
+ (u) => {
288
+ ws(u, Ns.state) && h.invalidateQueries({ queryKey: ["nvr-chat-entity-card", n] });
283
289
  },
284
290
  { includeOwn: !0, debounceMs: 400 }
285
291
  ), /* @__PURE__ */ a(
@@ -287,17 +293,17 @@ function Mn({ token: n, url: s, mine: o }) {
287
293
  {
288
294
  type: "button",
289
295
  onClick: () => {
290
- var p, x;
296
+ var u, p;
291
297
  if (c) {
292
- const U = (r.recordUrl ?? (($, N) => `/collections/${$}/${N}`))(c.collection, c.id);
298
+ const U = (r.recordUrl ?? (($, C) => `/collections/${$}/${C}`))(c.collection, c.id);
293
299
  if (U) {
294
- (p = r.navigate) == null || p.call(r, U);
300
+ (u = r.navigate) == null || u.call(r, U);
295
301
  return;
296
302
  }
297
303
  }
298
- s && ((x = r.navigate) == null || x.call(r, s));
304
+ s && ((p = r.navigate) == null || p.call(r, s));
299
305
  },
300
- className: b(
306
+ className: g(
301
307
  "inline-flex max-w-full items-center gap-1 align-baseline font-medium underline-offset-2 hover:underline",
302
308
  o ? "underline" : l.accentText
303
309
  ),
@@ -319,11 +325,11 @@ function Mn({ token: n, url: s, mine: o }) {
319
325
  }
320
326
  );
321
327
  }
322
- function Lr(n) {
328
+ function Fr(n) {
323
329
  const s = new Date(n), o = /* @__PURE__ */ new Date(), r = new Date(o);
324
330
  return r.setDate(o.getDate() - 1), s.toDateString() === o.toDateString() ? "Today" : s.toDateString() === r.toDateString() ? "Yesterday" : s.toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric" });
325
331
  }
326
- function Pr({ botName: n }) {
332
+ function zr({ botName: n }) {
327
333
  const s = ie(), o = [
328
334
  {
329
335
  k: "@name",
@@ -373,7 +379,7 @@ function Pr({ botName: n }) {
373
379
  r.kind === "code" ? /* @__PURE__ */ e(
374
380
  "code",
375
381
  {
376
- className: b(
382
+ className: g(
377
383
  "h-fit w-fit self-start whitespace-nowrap rounded px-1.5 py-0.5 text-[10.5px] font-semibold",
378
384
  s.accentSoft
379
385
  ),
@@ -387,91 +393,91 @@ function Pr({ botName: n }) {
387
393
  )) })
388
394
  ] });
389
395
  }
390
- function Ir({ room: n }) {
391
- const s = Ae(), o = ie(), r = Je(), l = n.indexOf(":"), i = l > 0 ? n.slice(0, l) : null, u = l > 0 ? n.slice(l + 1) : null, c = !!i && !!u && n !== s.globalRoom && i !== "dm" && i !== "ch", f = Rt(), { data: g } = we({
396
+ function Hr({ room: n }) {
397
+ const s = Me(), o = ie(), r = Je(), l = n.indexOf(":"), i = l > 0 ? n.slice(0, l) : null, d = l > 0 ? n.slice(l + 1) : null, c = !!i && !!d && n !== s.globalRoom && i !== "dm" && i !== "ch", h = Rt(), { data: f } = Ne({
392
398
  queryKey: ["nvr-chat-room-card", n],
393
399
  queryFn: async () => {
394
- var A, F, z, Y;
395
- const _ = (await f.fetchQuery(ea(r))).find((ee) => ee.is_active && ee.prefix === i);
396
- if (!_) return null;
397
- const R = (F = (A = (await r.request(
398
- xe(`/items/${_.collection}`, {
400
+ var R, G, H, V;
401
+ const S = (await h.fetchQuery(aa(r))).find((se) => se.is_active && se.prefix === i);
402
+ if (!S) return null;
403
+ const M = (G = (R = (await r.request(
404
+ xe(`/items/${S.collection}`, {
399
405
  limit: 1,
400
406
  fields: "id",
401
- filter: JSON.stringify({ [_.match_field]: { _eq: u } })
407
+ filter: JSON.stringify({ [S.match_field]: { _eq: d } })
402
408
  })
403
- )).data) == null ? void 0 : A[0]) == null ? void 0 : F.id;
404
- if (R == null) return null;
405
- const I = (Y = (z = (await r.request(
406
- xe(`/pipelines/instance/${_.collection}/${R}`)
407
- )).data) == null ? void 0 : z.instance) == null ? void 0 : Y.current_state_obj;
409
+ )).data) == null ? void 0 : R[0]) == null ? void 0 : G.id;
410
+ if (M == null) return null;
411
+ const B = (V = (H = (await r.request(
412
+ xe(`/pipelines/instance/${S.collection}/${M}`)
413
+ )).data) == null ? void 0 : H.instance) == null ? void 0 : V.current_state_obj;
408
414
  return {
409
- collection: _.collection,
410
- type_label: _.label ?? _.collection.replace(/_/g, " "),
411
- id: R,
412
- state: (I == null ? void 0 : I.label) ?? null,
413
- color: (I == null ? void 0 : I.color) ?? null
415
+ collection: S.collection,
416
+ type_label: S.label ?? S.collection.replace(/_/g, " "),
417
+ id: M,
418
+ state: (B == null ? void 0 : B.label) ?? null,
419
+ color: (B == null ? void 0 : B.color) ?? null
414
420
  };
415
421
  },
416
422
  enabled: c,
417
423
  staleTime: 6e4
418
- }), p = ta(n, c && !!g);
419
- if (!c || !g) return null;
420
- const v = (s.recordUrl ?? ((N, _) => `/collections/${N}/${_}`))(g.collection, g.id), U = (p == null ? void 0 : p.sla) ?? null, $ = (U == null ? void 0 : U.status) === "breached" ? "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300" : (U == null ? void 0 : U.status) === "warning" ? "bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300" : "bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300";
424
+ }), u = sa(n, c && !!f);
425
+ if (!c || !f) return null;
426
+ const b = (s.recordUrl ?? ((C, S) => `/collections/${C}/${S}`))(f.collection, f.id), U = (u == null ? void 0 : u.sla) ?? null, $ = (U == null ? void 0 : U.status) === "breached" ? "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300" : (U == null ? void 0 : U.status) === "warning" ? "bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300" : "bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300";
421
427
  return /* @__PURE__ */ a(
422
428
  "div",
423
429
  {
424
- className: b("flex shrink-0 items-center gap-2 border-b px-3 py-1.5", o.divider),
430
+ className: g("flex shrink-0 items-center gap-2 border-b px-3 py-1.5", o.divider),
425
431
  "data-chat-room-card": !0,
426
432
  children: [
427
- /* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: g.type_label }),
428
- /* @__PURE__ */ e("span", { className: "truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: u }),
429
- g.state && /* @__PURE__ */ e(
433
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: f.type_label }),
434
+ /* @__PURE__ */ e("span", { className: "truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: d }),
435
+ f.state && /* @__PURE__ */ e(
430
436
  "span",
431
437
  {
432
438
  className: "rounded-full px-2 py-0.5 text-[10px] font-semibold",
433
439
  style: {
434
- backgroundColor: g.color ? `${g.color}26` : "rgba(100,116,139,.15)",
435
- color: g.color ?? void 0
440
+ backgroundColor: f.color ? `${f.color}26` : "rgba(100,116,139,.15)",
441
+ color: f.color ?? void 0
436
442
  },
437
- children: g.state
443
+ children: f.state
438
444
  }
439
445
  ),
440
446
  U && /* @__PURE__ */ e(
441
447
  "span",
442
448
  {
443
- className: b("rounded-full px-1.5 py-0.5 text-[10px] font-semibold", $),
449
+ className: g("rounded-full px-1.5 py-0.5 text-[10px] font-semibold", $),
444
450
  title: U.due_hours != null ? `${Math.round(U.elapsed_hours ?? 0)}h in this state of ${U.due_hours}h allowed` : void 0,
445
451
  "data-chat-room-sla": U.status,
446
452
  children: U.status === "breached" ? "Past SLA" : U.status === "warning" ? "SLA soon" : "On time"
447
453
  }
448
454
  ),
449
- p && p.owners.length > 0 && /* @__PURE__ */ a(
455
+ u && u.owners.length > 0 && /* @__PURE__ */ a(
450
456
  "span",
451
457
  {
452
458
  className: "ml-auto flex -space-x-1.5",
453
- title: `Owners: ${p.owners.map((N) => N.name).join(", ")}`,
454
- "data-chat-room-owners": p.owners.length,
459
+ title: `Owners: ${u.owners.map((C) => C.name).join(", ")}`,
460
+ "data-chat-room-owners": u.owners.length,
455
461
  children: [
456
- p.owners.slice(0, 4).map((N) => /* @__PURE__ */ e(V, { id: N.id, name: N.name, size: 18, presence: !1 }, N.id)),
457
- p.owners.length > 4 && /* @__PURE__ */ a("span", { className: "flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-slate-200 px-1 text-[9px] font-semibold text-slate-600 dark:bg-muted dark:text-slate-300", children: [
462
+ u.owners.slice(0, 4).map((C) => /* @__PURE__ */ e(Z, { id: C.id, name: C.name, size: 18, presence: !1 }, C.id)),
463
+ u.owners.length > 4 && /* @__PURE__ */ a("span", { className: "flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-slate-200 px-1 text-[9px] font-semibold text-slate-600 dark:bg-muted dark:text-slate-300", children: [
458
464
  "+",
459
- p.owners.length - 4
465
+ u.owners.length - 4
460
466
  ] })
461
467
  ]
462
468
  }
463
469
  ),
464
- v && /* @__PURE__ */ e(
470
+ b && /* @__PURE__ */ e(
465
471
  "button",
466
472
  {
467
473
  type: "button",
468
474
  onClick: () => {
469
- var N;
470
- return (N = s.navigate) == null ? void 0 : N.call(s, v);
475
+ var C;
476
+ return (C = s.navigate) == null ? void 0 : C.call(s, b);
471
477
  },
472
- className: b(
478
+ className: g(
473
479
  "text-[11px] font-medium hover:underline",
474
- p != null && p.owners.length ? "ml-1.5" : "ml-auto",
480
+ u != null && u.owners.length ? "ml-1.5" : "ml-auto",
475
481
  o.accentText
476
482
  ),
477
483
  children: "Open"
@@ -481,12 +487,12 @@ function Ir({ room: n }) {
481
487
  }
482
488
  );
483
489
  }
484
- function jr(n, s) {
490
+ function Gr(n, s) {
485
491
  if (!n) return null;
486
492
  const o = Mt() ?? Intl.DateTimeFormat().resolvedOptions().timeZone, r = /* @__PURE__ */ new Date();
487
493
  let l, i;
488
494
  try {
489
- const c = (f) => new Intl.DateTimeFormat("en-US", { timeZone: f, hour: "numeric", minute: "2-digit" }).format(
495
+ const c = (h) => new Intl.DateTimeFormat("en-US", { timeZone: h, hour: "numeric", minute: "2-digit" }).format(
490
496
  r
491
497
  );
492
498
  l = c(n), i = c(o);
@@ -494,29 +500,29 @@ function jr(n, s) {
494
500
  return null;
495
501
  }
496
502
  if (l === i) return null;
497
- const u = s.split(/\s+/)[0] || s;
498
- return `${l} for ${u}`;
503
+ const d = s.split(/\s+/)[0] || s;
504
+ return `${l} for ${d}`;
499
505
  }
500
- function ia() {
506
+ function ua() {
501
507
  const [n, s] = T(0);
502
508
  return ae(() => {
503
509
  const o = setInterval(() => s((r) => r + 1), 6e4);
504
510
  return () => clearInterval(o);
505
511
  }, []), n;
506
512
  }
507
- function qr({ peerId: n, name: s }) {
508
- ia();
509
- const { state: o, title: r } = la(n), l = Bt(n), i = o === "online" ? "Active now" : o === "offline" ? (() => {
510
- const g = ra(l);
511
- return g ? g.charAt(0).toUpperCase() + g.slice(1) : "Offline";
512
- })() : r, u = jr((l == null ? void 0 : l.timezone) ?? null, s), c = oa(l), f = c ? (l == null ? void 0 : l.delegate) ?? null : null;
513
+ function Qr({ peerId: n, name: s }) {
514
+ ua();
515
+ const { state: o, title: r } = ca(n), l = Bt(n), i = o === "online" ? "Active now" : o === "offline" ? (() => {
516
+ const f = ia(l);
517
+ return f ? f.charAt(0).toUpperCase() + f.slice(1) : "Offline";
518
+ })() : r, d = Gr((l == null ? void 0 : l.timezone) ?? null, s), c = da(l), h = c ? (l == null ? void 0 : l.delegate) ?? null : null;
513
519
  return /* @__PURE__ */ a(
514
520
  "p",
515
521
  {
516
522
  className: "flex min-w-0 items-center gap-1.5 truncate text-[11px] text-slate-500 dark:text-slate-400",
517
523
  "data-chat-dm-peer-line": o,
518
524
  children: [
519
- c && /* @__PURE__ */ a(Ne, { children: [
525
+ c && /* @__PURE__ */ a(Ce, { children: [
520
526
  /* @__PURE__ */ e(
521
527
  "span",
522
528
  {
@@ -525,16 +531,16 @@ function qr({ peerId: n, name: s }) {
525
531
  children: c
526
532
  }
527
533
  ),
528
- f && sr() && /* @__PURE__ */ a(
534
+ h && ir() && /* @__PURE__ */ a(
529
535
  "button",
530
536
  {
531
537
  type: "button",
532
- onClick: () => rr(f.id, f.name),
538
+ onClick: () => cr(h.id, h.name),
533
539
  className: "shrink-0 font-medium text-slate-700 underline decoration-dotted underline-offset-2 hover:text-slate-900 dark:text-slate-200 dark:hover:text-white",
534
- "data-chat-dm-delegate": f.id,
540
+ "data-chat-dm-delegate": h.id,
535
541
  children: [
536
542
  "Message ",
537
- f.name,
543
+ h.name,
538
544
  " instead"
539
545
  ]
540
546
  }
@@ -542,225 +548,225 @@ function qr({ peerId: n, name: s }) {
542
548
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" })
543
549
  ] }),
544
550
  /* @__PURE__ */ e("span", { className: "truncate", children: i }),
545
- u && /* @__PURE__ */ a(Ne, { children: [
551
+ d && /* @__PURE__ */ a(Ce, { children: [
546
552
  /* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
547
- /* @__PURE__ */ e("span", { className: "shrink-0", "data-chat-dm-local-time": !0, title: (l == null ? void 0 : l.timezone) ?? void 0, children: u })
553
+ /* @__PURE__ */ e("span", { className: "shrink-0", "data-chat-dm-local-time": !0, title: (l == null ? void 0 : l.timezone) ?? void 0, children: d })
548
554
  ] })
549
555
  ]
550
556
  }
551
557
  );
552
558
  }
553
- function On({
559
+ function In({
554
560
  room: n,
555
561
  label: s,
556
562
  onBack: o,
557
563
  onOpenSettings: r,
558
564
  renderMessageBody: l,
559
565
  initialUnread: i,
560
- anchor: u = null,
566
+ anchor: d = null,
561
567
  openThread: c = null
562
568
  }) {
563
- var pn, hn, fn, xn, bn, gn, vn, yn, kn, wn;
564
- const f = Ae(), g = ie(), p = Je(), x = f.me, v = xr(n), U = x ? ke(n, x.id) : null, $ = !s.trim() || s.toLowerCase() === n.toLowerCase() || /^dm:/i.test(s), { data: N } = we({
565
- ...ks(p, U),
569
+ var pn, hn, fn, xn, gn, bn, vn, yn, kn, wn;
570
+ const h = Me(), f = ie(), u = Je(), p = h.me, b = Cr(n), U = p ? we(n, p.id) : null, $ = !s.trim() || s.toLowerCase() === n.toLowerCase() || /^dm:/i.test(s), { data: C } = Ne({
571
+ ..._s(u, U),
566
572
  enabled: !!U && $,
567
573
  staleTime: 12e4
568
- }), _ = $ && U ? [N == null ? void 0 : N.first_name, N == null ? void 0 : N.last_name].filter(Boolean).join(" ") || (N == null ? void 0 : N.email) || "Direct message" : s, [P, R] = T(u);
569
- ae(() => R(u), [u]);
570
- const { messages: y, loading: I, hasOlder: A, hasNewer: F, loadOlder: z, loadingOlder: Y } = Bs(
574
+ }), S = $ && U ? [C == null ? void 0 : C.first_name, C == null ? void 0 : C.last_name].filter(Boolean).join(" ") || (C == null ? void 0 : C.email) || "Direct message" : s, [W, M] = T(d);
575
+ ae(() => M(d), [d]);
576
+ const { messages: v, loading: B, hasOlder: R, hasNewer: G, loadOlder: H, loadingOlder: V } = Hs(
571
577
  n,
572
- P
578
+ W
573
579
  );
574
- Ws(n);
575
- const ee = na(n), se = Fs(), te = zs(n), ce = Hs(n.startsWith("dm:") ? n : null), ve = Gs(n), d = Qs(n), L = Ks(n), m = Js(n), Z = !n.startsWith("dm:") && !n.startsWith("ch:") && n !== f.globalRoom && n.includes(":"), H = ta(n, Z), Ce = ur(n, !!H), _e = n.startsWith("ch:"), { data: ue = [] } = we({
580
+ Gs(n);
581
+ const se = ra(n), ee = Qs(), te = Ks(n), ge = Js(n.startsWith("dm:") ? n : null), de = Ys(n), A = Zs(n), w = Vs(n), P = Xs(n), x = !n.startsWith("dm:") && !n.startsWith("ch:") && n !== h.globalRoom && n.includes(":"), j = sa(n, x), _e = fr(n, !!j), Se = n.startsWith("ch:"), { data: ue = [] } = Ne({
576
582
  queryKey: ["chat-read-marks", n],
577
- queryFn: () => p.request(
583
+ queryFn: () => u.request(
578
584
  xe(`/chat/rooms/${encodeURIComponent(n)}/read-marks`)
579
585
  ).then((t) => t.data ?? []).catch(() => []),
580
- enabled: _e,
581
- refetchInterval: _e ? 3e4 : !1,
586
+ enabled: Se,
587
+ refetchInterval: Se ? 3e4 : !1,
582
588
  staleTime: 15e3
583
- }), Me = (t) => ue.filter(
584
- (h) => h.user !== String(t.sender ?? "") && new Date(h.last_read_at).getTime() >= new Date(t.date_created).getTime()
585
- ), be = Rt(), { data: De = [] } = we({
589
+ }), Oe = (t) => ue.filter(
590
+ (m) => m.user !== String(t.sender ?? "") && new Date(m.last_read_at).getTime() >= new Date(t.date_created).getTime()
591
+ ), ve = Rt(), { data: ye = [] } = Ne({
586
592
  queryKey: ["chat-saved"],
587
- queryFn: () => p.request(xe("/chat/saved")).then((t) => t.data ?? []).catch(() => []),
593
+ queryFn: () => u.request(xe("/chat/saved")).then((t) => t.data ?? []).catch(() => []),
588
594
  staleTime: 6e4
589
- }), Be = fe(() => new Set(De.map((t) => t.id)), [De]), w = qe({
590
- mutationFn: (t) => p.request(Ee(`/chat/messages/${t}/save`, {})),
591
- onSuccess: () => void be.invalidateQueries({ queryKey: ["chat-saved"] })
592
- }), [M, j] = T(null), X = qe({
593
- mutationFn: () => p.request(
594
- Ee("/chat/rooms/summary", { room: n })
595
+ }), $e = fe(() => new Set(ye.map((t) => t.id)), [ye]), k = Ee({
596
+ mutationFn: (t) => u.request(Be(`/chat/messages/${t}/save`, {})),
597
+ onSuccess: () => void ve.invalidateQueries({ queryKey: ["chat-saved"] })
598
+ }), [L, q] = T(null), X = Ee({
599
+ mutationFn: () => u.request(
600
+ Be("/chat/rooms/summary", { room: n })
595
601
  ).then((t) => t.data),
596
- onSuccess: (t) => j((t == null ? void 0 : t.summary) ?? "Not enough new messages to summarize."),
597
- onError: () => j("Summary unavailable.")
598
- }), Se = qe({
602
+ onSuccess: (t) => q((t == null ? void 0 : t.summary) ?? "Not enough new messages to summarize."),
603
+ onError: () => q("Summary unavailable.")
604
+ }), Te = Ee({
599
605
  mutationFn: async (t) => {
600
- if (!H || !x) throw new Error("no record");
601
- await p.request(
602
- Ee("/tasks", {
603
- collection: H.collection,
604
- item: String(H.id),
606
+ if (!j || !p) throw new Error("no record");
607
+ await u.request(
608
+ Be("/tasks", {
609
+ collection: j.collection,
610
+ item: String(j.id),
605
611
  title: t.message.replace(/<[^>]*>/g, "").slice(0, 200),
606
- assignee: x.id
612
+ assignee: p.id
607
613
  })
608
614
  );
609
615
  },
610
616
  onSuccess: () => {
611
- H && ys(be, H.collection, H.id), he.success("Task created from message — assigned to you");
617
+ j && Cs(ve, j.collection, j.id), he.success("Task created from message — assigned to you");
612
618
  },
613
619
  onError: () => he.error("Could not create a task")
614
- }), S = qe({
615
- mutationFn: (t) => p.request(Ee(`/chat/messages/${t.id}/to-notes`, {})),
616
- onSuccess: () => he.success(`Copied to the Notes of ${(H == null ? void 0 : H.label) ?? "the record"}`),
620
+ }), _ = Ee({
621
+ mutationFn: (t) => u.request(Be(`/chat/messages/${t.id}/to-notes`, {})),
622
+ onSuccess: () => he.success(`Copied to the Notes of ${(j == null ? void 0 : j.label) ?? "the record"}`),
617
623
  onError: (t) => {
618
- var h;
619
- return he.error(((h = t == null ? void 0 : t.response) == null ? void 0 : h.error) ?? "Could not copy it");
624
+ var m;
625
+ return he.error(((m = t == null ? void 0 : t.response) == null ? void 0 : m.error) ?? "Could not copy it");
620
626
  }
621
- }), E = qe({
622
- mutationFn: (t) => p.request(
623
- Ee(`/chat/messages/${t.messageId}/attach-to-record`, {
627
+ }), I = Ee({
628
+ mutationFn: (t) => u.request(
629
+ Be(`/chat/messages/${t.messageId}/attach-to-record`, {
624
630
  file_id: t.fileId,
625
631
  field: t.field
626
632
  })
627
633
  ),
628
- onSuccess: (t, h) => {
629
- var C;
634
+ onSuccess: (t, m) => {
635
+ var N;
630
636
  return he.success(
631
- `Attached to ${(H == null ? void 0 : H.label) ?? "the record"} — ${((C = Ce.find((G) => G.field === h.field)) == null ? void 0 : C.label) ?? h.field}`
637
+ `Attached to ${(j == null ? void 0 : j.label) ?? "the record"} — ${((N = _e.find((Q) => Q.field === m.field)) == null ? void 0 : N.label) ?? m.field}`
632
638
  );
633
639
  },
634
640
  onError: (t) => {
635
- var h;
641
+ var m;
636
642
  return he.error(
637
- ((h = t == null ? void 0 : t.response) == null ? void 0 : h.error) ?? "Could not attach it"
643
+ ((m = t == null ? void 0 : t.response) == null ? void 0 : m.error) ?? "Could not attach it"
638
644
  );
639
645
  }
640
- }), q = qe({
641
- mutationFn: (t) => p.request(xs(`/chat/messages/${t}`, { no_preview: !0 })),
642
- onSuccess: () => void be.invalidateQueries({ queryKey: ["nvr-chat", n] })
643
- }), ne = Ys(n), Q = Zs(n), { isAdmin: B } = ut(), { setMuted: K, setNotifyMode: ma, setArchived: pa, setStarred: ha, dismissWelcome: fa, leave: xa } = Pt(), { rooms: ba, loading: ga } = Zn(), Ft = ba.find((t) => t.room === n) ?? null, { rooms: va } = Vn(!ga && !Ft), k = Ft ?? va.find((t) => t.room === n) ?? null, ya = ca(k), zt = k != null && k.muted ? "muted" : (k == null ? void 0 : k.notify_mode) === "mentions" ? "mentions" : "all", de = Vs(), [Xe, ka] = T(!1), [et, Ht] = T(""), [wa, mt] = T(null), [Gt, Qt] = T(""), [Na, pt] = T(null), Ca = br(n), [_a, Kt] = T(null), [Jt, Yt] = T(null), [Zt, Oe] = T(null), Vt = Xs(c ? n : null, c), Xt = !!Vt.root && !Vt.root.deleted_at;
646
+ }), E = Ee({
647
+ mutationFn: (t) => u.request(ys(`/chat/messages/${t}`, { no_preview: !0 })),
648
+ onSuccess: () => void ve.invalidateQueries({ queryKey: ["nvr-chat", n] })
649
+ }), ne = er(n), K = tr(n), { isAdmin: F } = ut(), { setMuted: J, setNotifyMode: fa, setArchived: xa, setStarred: ga, dismissWelcome: ba, leave: va } = Pt(), { rooms: ya, loading: ka } = ea(), Ft = ya.find((t) => t.room === n) ?? null, { rooms: wa } = ta(!ka && !Ft), y = Ft ?? wa.find((t) => t.room === n) ?? null, Na = ma(y), zt = y != null && y.muted ? "muted" : (y == null ? void 0 : y.notify_mode) === "mentions" ? "mentions" : "all", ce = nr(), [Xe, Ca] = T(!1), [et, Ht] = T(""), [_a, mt] = T(null), [Gt, Qt] = T(""), [Sa, pt] = T(null), Ta = _r(n), [Ua, Kt] = T(null), [Jt, Yt] = T(null), [Zt, Le] = T(null), Vt = ar(c ? n : null, c), Xt = !!Vt.root && !Vt.root.deleted_at;
644
650
  ae(() => {
645
- c && Xt && Oe(c);
651
+ c && Xt && Le(c);
646
652
  }, [c, Xt]);
647
- const [Sa, en] = T(null), [Ta, tn] = T(null), [ht, We] = T(!1), [Ua, ft] = T(!1), [le, Fe] = T(null), [ze, tt] = T(
648
- u && "around" in u ? u.around : null
649
- ), [nt, xt] = T(null), He = Ss(n, (x == null ? void 0 : x.id) ?? null), nn = oe(null), bt = oe(null), gt = oe(Math.max(0, i ?? 0)), Te = oe(!1), $e = oe(null), an = oe(null), re = oe(!u), Ge = oe(0), Qe = oe(null), vt = oe(0), at = () => {
650
- const t = $e.current;
653
+ const [Da, en] = T(null), [$a, tn] = T(null), [ht, We] = T(!1), [Ra, ft] = T(!1), [le, Fe] = T(null), [ze, tt] = T(
654
+ d && "around" in d ? d.around : null
655
+ ), [nt, xt] = T(null), He = $s(n, (p == null ? void 0 : p.id) ?? null), nn = oe(null), gt = oe(null), bt = oe(Math.max(0, i ?? 0)), Ue = oe(!1), Re = oe(null), an = oe(null), re = oe(!d), Ge = oe(0), Qe = oe(null), vt = oe(0), at = () => {
656
+ const t = Re.current;
651
657
  t && (t.scrollTop = t.scrollHeight);
652
658
  }, yt = (t) => {
653
- var C;
654
- const h = (C = $e.current) == null ? void 0 : C.querySelector(`[data-chat-msg="${t}"]`);
655
- return h ? (h.scrollIntoView({ block: "center" }), re.current = !1, tt(t), !0) : ge.reveal(t) ? (re.current = !1, tt(t), !0) : !1;
659
+ var N;
660
+ const m = (N = Re.current) == null ? void 0 : N.querySelector(`[data-chat-msg="${t}"]`);
661
+ return m ? (m.scrollIntoView({ block: "center" }), re.current = !1, tt(t), !0) : be.reveal(t) ? (re.current = !1, tt(t), !0) : !1;
656
662
  }, sn = (t) => {
657
- We(!1), yt(t) || (Te.current = !1, re.current = !1, tt(t), R({ around: t }));
663
+ We(!1), yt(t) || (Ue.current = !1, re.current = !1, tt(t), M({ around: t }));
658
664
  };
659
665
  ae(() => {
660
666
  if (ze == null) return;
661
667
  const t = setTimeout(() => tt(null), 2400);
662
668
  return () => clearTimeout(t);
663
669
  }, [ze]), ae(() => {
664
- Te.current = !1, Ge.current = 0, Fe(null);
665
- }, [n, P]), ae(() => {
666
- var Re, Ie;
667
- const t = $e.current, h = ((Re = y[0]) == null ? void 0 : Re.id) ?? null;
668
- if (!Te.current && y.length > 0) {
669
- if (Te.current = !0, Ge.current = y.length, Qe.current = h, ze != null && yt(ze)) return;
670
- bt.current && !P ? (bt.current.scrollIntoView({ block: "center" }), re.current = !1) : P || (at(), re.current = !0);
670
+ Ue.current = !1, Ge.current = 0, Fe(null);
671
+ }, [n, W]), ae(() => {
672
+ var Ae, je;
673
+ const t = Re.current, m = ((Ae = v[0]) == null ? void 0 : Ae.id) ?? null;
674
+ if (!Ue.current && v.length > 0) {
675
+ if (Ue.current = !0, Ge.current = v.length, Qe.current = m, ze != null && yt(ze)) return;
676
+ gt.current && !W ? (gt.current.scrollIntoView({ block: "center" }), re.current = !1) : W || (at(), re.current = !0);
671
677
  return;
672
678
  }
673
- if (h !== Qe.current && Qe.current != null && t) {
674
- Qe.current = h, Ge.current = y.length;
679
+ if (m !== Qe.current && Qe.current != null && t) {
680
+ Qe.current = m, Ge.current = v.length;
675
681
  return;
676
682
  }
677
- Qe.current = h;
678
- const C = y.length - Ge.current;
679
- if (Ge.current = y.length, C <= 0) return;
680
- const G = y[y.length - 1], J = !!(G != null && G.sender) && G.sender.toLowerCase() === ((Ie = x == null ? void 0 : x.id) == null ? void 0 : Ie.toLowerCase());
681
- if (re.current || J)
683
+ Qe.current = m;
684
+ const N = v.length - Ge.current;
685
+ if (Ge.current = v.length, N <= 0) return;
686
+ const Q = v[v.length - 1], Y = !!(Q != null && Q.sender) && Q.sender.toLowerCase() === ((je = p == null ? void 0 : p.id) == null ? void 0 : je.toLowerCase());
687
+ if (re.current || Y)
682
688
  at(), re.current = !0, Fe(null);
683
689
  else {
684
- const Ue = y[y.length - C];
685
- Fe((pe) => ({ count: ((pe == null ? void 0 : pe.count) ?? 0) + C, firstId: (pe == null ? void 0 : pe.firstId) ?? Ue.id }));
690
+ const De = v[v.length - N];
691
+ Fe((pe) => ({ count: ((pe == null ? void 0 : pe.count) ?? 0) + N, firstId: (pe == null ? void 0 : pe.firstId) ?? De.id }));
686
692
  }
687
- }, [y]), ae(() => {
693
+ }, [v]), ae(() => {
688
694
  const t = an.current;
689
695
  if (!t || typeof ResizeObserver > "u") return;
690
- const h = new ResizeObserver(() => {
691
- var C;
692
- re.current && at(), vt.current = ((C = $e.current) == null ? void 0 : C.scrollHeight) ?? 0;
696
+ const m = new ResizeObserver(() => {
697
+ var N;
698
+ re.current && at(), vt.current = ((N = Re.current) == null ? void 0 : N.scrollHeight) ?? 0;
693
699
  });
694
- return h.observe(t), () => h.disconnect();
700
+ return m.observe(t), () => m.disconnect();
695
701
  }, []), ae(() => {
696
- var C, G;
697
- const t = y[y.length - 1];
698
- if (!t || !Te.current || ((C = t.sender) == null ? void 0 : C.toLowerCase()) === ((G = x == null ? void 0 : x.id) == null ? void 0 : G.toLowerCase()))
702
+ var N, Q;
703
+ const t = v[v.length - 1];
704
+ if (!t || !Ue.current || ((N = t.sender) == null ? void 0 : N.toLowerCase()) === ((Q = p == null ? void 0 : p.id) == null ? void 0 : Q.toLowerCase()))
699
705
  return;
700
- const h = Date.now() - new Date(t.date_created).getTime();
701
- h > 0 && h < 5 * 6e4 && Math.random() < 0.2 && p.request(Ee("/chat/health/delivery", { ms: h })).catch(() => {
706
+ const m = Date.now() - new Date(t.date_created).getTime();
707
+ m > 0 && m < 5 * 6e4 && Math.random() < 0.2 && u.request(Be("/chat/health/delivery", { ms: m })).catch(() => {
702
708
  });
703
- }, [(pn = y[y.length - 1]) == null ? void 0 : pn.id]), ae(() => {
704
- if (!nt || !de) return;
705
- if (y.some(
706
- (C) => (C.sender_name ?? "").toLowerCase() === de.toLowerCase() && new Date(C.date_created).getTime() >= nt - 5e3
709
+ }, [(pn = v[v.length - 1]) == null ? void 0 : pn.id]), ae(() => {
710
+ if (!nt || !ce) return;
711
+ if (v.some(
712
+ (N) => (N.sender_name ?? "").toLowerCase() === ce.toLowerCase() && new Date(N.date_created).getTime() >= nt - 5e3
707
713
  )) {
708
714
  xt(null);
709
715
  return;
710
716
  }
711
- const h = setTimeout(() => xt(null), 9e4);
712
- return () => clearTimeout(h);
713
- }, [nt, de, y]);
717
+ const m = setTimeout(() => xt(null), 9e4);
718
+ return () => clearTimeout(m);
719
+ }, [nt, ce, v]);
714
720
  const st = fe(() => {
715
721
  const t = /* @__PURE__ */ new Set();
716
- for (const h of y) for (const C of h.attachments ?? []) t.add(C);
722
+ for (const m of v) for (const N of m.attachments ?? []) t.add(N);
717
723
  return [...t];
718
- }, [y]), { data: kt } = we({
724
+ }, [v]), { data: kt } = Ne({
719
725
  queryKey: ["nvr-chat-attachments", st.slice().sort().join("|")],
720
726
  queryFn: async () => {
721
- const t = await p.request(
727
+ const t = await u.request(
722
728
  xe("/files", {
723
729
  filter: JSON.stringify({ id: { _in: st } }),
724
730
  limit: String(st.length),
725
731
  fields: "id,filename_download,title,type,filesize,tags"
726
732
  })
727
733
  );
728
- return new Map((t.data ?? []).map((h) => [h.id, h]));
734
+ return new Map((t.data ?? []).map((m) => [m.id, m]));
729
735
  },
730
736
  enabled: st.length > 0,
731
737
  staleTime: 5 * 6e4
732
738
  });
733
739
  ae(() => {
734
- P || se.mutate(n);
735
- }, [n, y.length, P]);
736
- const Da = (t) => {
737
- if (re.current = !0, P && R(null), de) {
738
- const h = de.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
739
- new RegExp(`@\\[?${h}\\]?\\b`, "i").test(t) && xt(Date.now());
740
+ W || ee.mutate(n);
741
+ }, [n, v.length, W]);
742
+ const Aa = (t) => {
743
+ if (re.current = !0, W && M(null), ce) {
744
+ const m = ce.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
745
+ new RegExp(`@\\[?${m}\\]?\\b`, "i").test(t) && xt(Date.now());
740
746
  }
741
- }, Le = (hn = x == null ? void 0 : x.id) == null ? void 0 : hn.toLowerCase(), me = Xe && et.trim().length > 0, ye = fe(
742
- () => me ? y.filter((t) => t.message.toLowerCase().includes(et.trim().toLowerCase())) : y,
743
- [y, me, et]
744
- ), $a = fe(() => {
747
+ }, Pe = (hn = p == null ? void 0 : p.id) == null ? void 0 : hn.toLowerCase(), me = Xe && et.trim().length > 0, ke = fe(
748
+ () => me ? v.filter((t) => t.message.toLowerCase().includes(et.trim().toLowerCase())) : v,
749
+ [v, me, et]
750
+ ), Ma = fe(() => {
745
751
  var t;
746
752
  if (me) return -1;
747
- for (let h = ye.length - 1; h >= 0; h--)
748
- if (((t = ye[h].sender) == null ? void 0 : t.toLowerCase()) === Le) return h;
753
+ for (let m = ke.length - 1; m >= 0; m--)
754
+ if (((t = ke[m].sender) == null ? void 0 : t.toLowerCase()) === Pe) return m;
749
755
  return -1;
750
- }, [ye, Le, me]), rn = ce ? new Date(ce).getTime() : 0, Pe = Lt().chat_density === "compact" ? "compact" : "comfortable", ln = oe(null), Ra = fe(() => ye.map((t) => t.id), [ye]), ge = pr({
751
- scrollerRef: $e,
756
+ }, [ke, Pe, me]), rn = ge ? new Date(ge).getTime() : 0, Ie = Lt().chat_density === "compact" ? "compact" : "comfortable", ln = oe(null), Oa = fe(() => ke.map((t) => t.id), [ke]), be = gr({
757
+ scrollerRef: Re,
752
758
  listRef: ln,
753
- ids: Ra,
754
- estimate: Pe === "compact" ? 40 : 72,
755
- resetKey: `${n}|${JSON.stringify(P)}|${me ? "search" : ""}`,
759
+ ids: Oa,
760
+ estimate: Ie === "compact" ? 40 : 72,
761
+ resetKey: `${n}|${JSON.stringify(W)}|${me ? "search" : ""}`,
756
762
  pinnedRef: re
757
- }), W = (k == null ? void 0 : k.channel) ?? null, on = !!W && !!x && String(W.created_by ?? "").toUpperCase() === x.id.toUpperCase(), cn = W != null && W.announce && !on && !B ? W.id === Yn ? "Only admins post here. Hover a message and reply in its thread." : "Only the channel owner and admins post here. Hover a message and reply in its thread." : null, dn = x ? ke(n, x.id) : null, Aa = Bt(dn);
758
- ia();
759
- const Ma = dn ? mr(Aa, _, /* @__PURE__ */ new Date()) : null;
760
- er(), ir();
761
- const Oa = !!(W != null && W.welcome_note) && !!(k != null && k.joined) && !(k != null && k.welcome_seen_at) && !W.is_direct, La = (t, h) => t.entity ? /* @__PURE__ */ e(Mn, { token: t.text, url: f.entityUrl(t.entity) }, h) : t.mention ? /* @__PURE__ */ e("span", { className: b("rounded px-0.5 font-semibold", g.accentSoft), children: t.text }, h) : /* @__PURE__ */ e("span", { children: t.text }, h), Pa = (t, h) => t.entity ? /* @__PURE__ */ e(Mn, { token: t.text, url: f.entityUrl(t.entity), mine: !0 }, h) : t.mention ? /* @__PURE__ */ e("span", { className: "rounded bg-black/15 px-0.5 font-semibold", children: t.text }, h) : /* @__PURE__ */ e("span", { children: t.text }, h), un = (t, h = {}) => {
763
+ }), z = (y == null ? void 0 : y.channel) ?? null, on = !!z && !!p && String(z.created_by ?? "").toUpperCase() === p.id.toUpperCase(), cn = z != null && z.announce && !on && !F ? z.id === Xn ? "Only admins post here. Hover a message and reply in its thread." : "Only the channel owner and admins post here. Hover a message and reply in its thread." : null, dn = p ? we(n, p.id) : null, La = Bt(dn);
764
+ ua();
765
+ const Pa = dn ? xr(La, S, /* @__PURE__ */ new Date()) : null;
766
+ sr(), mr();
767
+ const Ia = !!(z != null && z.welcome_note) && !!(y != null && y.joined) && !(y != null && y.welcome_seen_at) && !z.is_direct, ja = (t, m) => t.entity ? /* @__PURE__ */ e(Pn, { token: t.text, url: h.entityUrl(t.entity) }, m) : t.mention ? /* @__PURE__ */ e("span", { className: g("rounded px-0.5 font-semibold", f.accentSoft), children: t.text }, m) : /* @__PURE__ */ e("span", { children: t.text }, m), qa = (t, m) => t.entity ? /* @__PURE__ */ e(Pn, { token: t.text, url: h.entityUrl(t.entity), mine: !0 }, m) : t.mention ? /* @__PURE__ */ e("span", { className: "rounded bg-black/15 px-0.5 font-semibold", children: t.text }, m) : /* @__PURE__ */ e("span", { children: t.text }, m), un = (t, m = {}) => {
762
768
  var Nn, Cn;
763
- const C = ((Nn = t.sender) == null ? void 0 : Nn.toLowerCase()) === Le;
769
+ const N = ((Nn = t.sender) == null ? void 0 : Nn.toLowerCase()) === Pe;
764
770
  if (t.is_system)
765
771
  return /* @__PURE__ */ e(
766
772
  "div",
@@ -777,34 +783,34 @@ function On({
777
783
  ] })
778
784
  }
779
785
  );
780
- const G = h.isLastMine && rn > 0 && new Date(t.date_created).getTime() <= rn, J = !!t.deleted_at, Re = C && !J && Date.now() - new Date(t.date_created).getTime() < 15 * 6e4, Ie = !J && (C || B), Ue = wa === t.id, pe = /* @__PURE__ */ new Map();
786
+ const Q = m.isLastMine && rn > 0 && new Date(t.date_created).getTime() <= rn, Y = !!t.deleted_at, Ae = N && !Y && Date.now() - new Date(t.date_created).getTime() < 15 * 6e4, je = !Y && (N || F), De = _a === t.id, pe = /* @__PURE__ */ new Map();
781
787
  for (const D of t.reactions ?? []) {
782
788
  const O = pe.get(D.emoji) ?? { count: 0, mine: !1, names: [] };
783
- O.count++, ((Cn = D.user) == null ? void 0 : Cn.toLowerCase()) === Le && (O.mine = !0), D.user_name && O.names.push(D.user_name), pe.set(D.emoji, O);
789
+ O.count++, ((Cn = D.user) == null ? void 0 : Cn.toLowerCase()) === Pe && (O.mine = !0), D.user_name && O.names.push(D.user_name), pe.set(D.emoji, O);
784
790
  }
785
- const je = "rounded-full p-0.5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200";
791
+ const qe = "rounded-full p-0.5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200";
786
792
  return /* @__PURE__ */ a(
787
793
  "div",
788
794
  {
789
- className: b(
795
+ className: g(
790
796
  "group/msg flex gap-2 rounded-lg transition-colors",
791
- C && "flex-row-reverse",
797
+ N && "flex-row-reverse",
792
798
  ze === t.id && "bg-nvr-cyan/[0.12]"
793
799
  ),
794
800
  "data-chat-msg": t.id,
795
801
  children: [
796
- !C && /* @__PURE__ */ e(Wn, { userId: t.sender, children: /* @__PURE__ */ e(
802
+ !N && /* @__PURE__ */ e(Hn, { userId: t.sender, children: /* @__PURE__ */ e(
797
803
  "button",
798
804
  {
799
805
  type: "button",
800
806
  className: "h-fit shrink-0 rounded-full",
801
807
  "aria-label": `${t.sender_name ?? "Sender"} — profile`,
802
808
  "data-chat-avatar-card": !0,
803
- children: /* @__PURE__ */ e(V, { id: t.sender, name: t.sender_name, size: Pe === "compact" ? 22 : 26 })
809
+ children: /* @__PURE__ */ e(Z, { id: t.sender, name: t.sender_name, size: Ie === "compact" ? 22 : 26 })
804
810
  }
805
811
  ) }),
806
- /* @__PURE__ */ a("div", { className: b("relative max-w-[78%]", C && "text-right"), children: [
807
- !C && h.showSender !== !1 && /* @__PURE__ */ a("p", { className: "mb-0.5 text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: [
812
+ /* @__PURE__ */ a("div", { className: g("relative max-w-[78%]", N && "text-right"), children: [
813
+ !N && m.showSender !== !1 && /* @__PURE__ */ a("p", { className: "mb-0.5 text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: [
808
814
  t.sender_name ?? "Unknown",
809
815
  t.masquerade_admin_name && /* @__PURE__ */ a(
810
816
  "span",
@@ -819,23 +825,23 @@ function On({
819
825
  }
820
826
  )
821
827
  ] }),
822
- !J && !Ue && /* @__PURE__ */ a(
828
+ !Y && !De && /* @__PURE__ */ a(
823
829
  "div",
824
830
  {
825
- className: b(
831
+ className: g(
826
832
  "absolute -top-3 z-10 hidden items-center gap-0.5 rounded-full border px-1 py-0.5 shadow-sm group-hover/msg:flex",
827
- _a === t.id && "flex",
828
- g.surface,
833
+ Ua === t.id && "flex",
834
+ f.surface,
829
835
  "border-slate-200 dark:border-border",
830
- C ? "right-0" : "left-0"
836
+ N ? "right-0" : "left-0"
831
837
  ),
832
838
  "data-chat-msg-actions": !0,
833
839
  children: [
834
- lr.map((D) => /* @__PURE__ */ e(
840
+ dr.map((D) => /* @__PURE__ */ e(
835
841
  "button",
836
842
  {
837
843
  type: "button",
838
- onClick: () => d.mutate({ messageId: t.id, emoji: D }),
844
+ onClick: () => A.mutate({ messageId: t.id, emoji: D }),
839
845
  className: "rounded-full px-0.5 text-[13px] leading-none transition-transform hover:scale-125",
840
846
  title: `React ${D}`,
841
847
  children: D
@@ -843,25 +849,25 @@ function On({
843
849
  D
844
850
  )),
845
851
  /* @__PURE__ */ e(
846
- cr,
852
+ pr,
847
853
  {
848
854
  label: "More reactions",
849
- className: je,
850
- onPick: (D) => d.mutate({ messageId: t.id, emoji: D }),
855
+ className: qe,
856
+ onPick: (D) => A.mutate({ messageId: t.id, emoji: D }),
851
857
  onOpenChange: (D) => Kt(D ? t.id : null)
852
858
  }
853
859
  ),
854
- !h.inThread && !t.parent_id && /* @__PURE__ */ e(
860
+ !m.inThread && !t.parent_id && /* @__PURE__ */ e(
855
861
  "button",
856
862
  {
857
863
  type: "button",
858
864
  title: "Reply in thread",
859
865
  onClick: () => {
860
- We(!1), Oe(t.id);
866
+ We(!1), Le(t.id);
861
867
  },
862
- className: je,
868
+ className: qe,
863
869
  "data-chat-reply-thread": !0,
864
- children: /* @__PURE__ */ e(ts, { className: "h-3 w-3" })
870
+ children: /* @__PURE__ */ e(rs, { className: "h-3 w-3" })
865
871
  }
866
872
  ),
867
873
  /* @__PURE__ */ e(
@@ -869,32 +875,32 @@ function On({
869
875
  {
870
876
  type: "button",
871
877
  title: "Quote",
872
- onClick: () => h.inThread ? tn(t) : en(t),
873
- className: je,
878
+ onClick: () => m.inThread ? tn(t) : en(t),
879
+ className: qe,
874
880
  "data-chat-quote": !0,
875
- children: /* @__PURE__ */ e(ns, { className: "h-3 w-3" })
881
+ children: /* @__PURE__ */ e(ls, { className: "h-3 w-3" })
876
882
  }
877
883
  ),
878
- H && /* @__PURE__ */ a(Ne, { children: [
884
+ j && /* @__PURE__ */ a(Ce, { children: [
879
885
  /* @__PURE__ */ e(
880
886
  "button",
881
887
  {
882
888
  type: "button",
883
889
  title: "Make a task from this message",
884
- onClick: () => Se.mutate(t),
885
- className: je,
886
- children: /* @__PURE__ */ e(as, { className: "h-3 w-3" })
890
+ onClick: () => Te.mutate(t),
891
+ className: qe,
892
+ children: /* @__PURE__ */ e(os, { className: "h-3 w-3" })
887
893
  }
888
894
  ),
889
895
  t.message && /* @__PURE__ */ e(
890
896
  "button",
891
897
  {
892
898
  type: "button",
893
- title: `Copy into the Notes of ${H.label}`,
894
- onClick: () => S.mutate(t),
895
- className: je,
899
+ title: `Copy into the Notes of ${j.label}`,
900
+ onClick: () => _.mutate(t),
901
+ className: qe,
896
902
  "data-chat-to-notes": !0,
897
- children: /* @__PURE__ */ e(ss, { className: "h-3 w-3" })
903
+ children: /* @__PURE__ */ e(is, { className: "h-3 w-3" })
898
904
  }
899
905
  )
900
906
  ] }),
@@ -902,11 +908,11 @@ function On({
902
908
  "button",
903
909
  {
904
910
  type: "button",
905
- title: L.some((D) => D.id === t.id) ? "Unpin" : "Pin",
906
- onClick: () => m.mutate(t.id),
907
- className: b(
911
+ title: w.some((D) => D.id === t.id) ? "Unpin" : "Pin",
912
+ onClick: () => P.mutate(t.id),
913
+ className: g(
908
914
  "rounded-full p-0.5",
909
- L.some((D) => D.id === t.id) ? g.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
915
+ w.some((D) => D.id === t.id) ? f.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
910
916
  ),
911
917
  children: /* @__PURE__ */ e(St, { className: "h-3 w-3" })
912
918
  }
@@ -915,16 +921,16 @@ function On({
915
921
  "button",
916
922
  {
917
923
  type: "button",
918
- title: Be.has(t.id) ? "Remove from saved" : "Save for later (personal bookmark)",
919
- onClick: () => w.mutate(t.id),
920
- className: b(
924
+ title: $e.has(t.id) ? "Remove from saved" : "Save for later (personal bookmark)",
925
+ onClick: () => k.mutate(t.id),
926
+ className: g(
921
927
  "rounded-full p-0.5",
922
- Be.has(t.id) ? g.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
928
+ $e.has(t.id) ? f.accentText : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-200"
923
929
  ),
924
- children: /* @__PURE__ */ e(rs, { className: "h-3 w-3" })
930
+ children: /* @__PURE__ */ e(cs, { className: "h-3 w-3" })
925
931
  }
926
932
  ),
927
- Re && /* @__PURE__ */ e(
933
+ Ae && /* @__PURE__ */ e(
928
934
  "button",
929
935
  {
930
936
  type: "button",
@@ -932,17 +938,17 @@ function On({
932
938
  onClick: () => {
933
939
  mt(t.id), Qt(t.message), pt(null);
934
940
  },
935
- className: je,
936
- children: /* @__PURE__ */ e(ls, { className: "h-3 w-3" })
941
+ className: qe,
942
+ children: /* @__PURE__ */ e(ds, { className: "h-3 w-3" })
937
943
  }
938
944
  ),
939
- Ie && (Na === t.id ? /* @__PURE__ */ e(
945
+ je && (Sa === t.id ? /* @__PURE__ */ e(
940
946
  "button",
941
947
  {
942
948
  type: "button",
943
949
  title: "Confirm delete",
944
950
  onClick: () => {
945
- Q.mutate(t.id), pt(null);
951
+ K.mutate(t.id), pt(null);
946
952
  },
947
953
  className: "rounded-full px-1 text-[10px] font-semibold text-red-500",
948
954
  children: "Sure?"
@@ -951,39 +957,39 @@ function On({
951
957
  "button",
952
958
  {
953
959
  type: "button",
954
- title: C ? "Delete" : "Delete (admin)",
960
+ title: N ? "Delete" : "Delete (admin)",
955
961
  onClick: () => pt(t.id),
956
962
  className: "rounded-full p-0.5 text-slate-400 hover:text-red-500",
957
- children: /* @__PURE__ */ e(os, { className: "h-3 w-3" })
963
+ children: /* @__PURE__ */ e(us, { className: "h-3 w-3" })
958
964
  }
959
965
  )),
960
966
  /* @__PURE__ */ e(
961
- gr,
967
+ Sr,
962
968
  {
963
969
  messageId: t.id,
964
- actions: vr(Ca, t, Le),
965
- navigate: f.navigate,
970
+ actions: Tr(Ta, t, Pe),
971
+ navigate: h.navigate,
966
972
  onOpenChange: (D) => Kt(D ? t.id : null)
967
973
  }
968
974
  )
969
975
  ]
970
976
  }
971
977
  ),
972
- t.urgent && !J && /* @__PURE__ */ a(
978
+ t.urgent && !Y && /* @__PURE__ */ a(
973
979
  "p",
974
980
  {
975
- className: b(
981
+ className: g(
976
982
  "mb-0.5 flex items-center gap-1 text-[10.5px] font-semibold text-red-600 dark:text-red-400",
977
- C && "justify-end"
983
+ N && "justify-end"
978
984
  ),
979
985
  "data-chat-urgent": !0,
980
986
  children: [
981
- /* @__PURE__ */ e(is, { className: "h-3 w-3" }),
987
+ /* @__PURE__ */ e(ms, { className: "h-3 w-3" }),
982
988
  " Urgent"
983
989
  ]
984
990
  }
985
991
  ),
986
- J ? /* @__PURE__ */ e("div", { className: "inline-block rounded-2xl border border-dashed border-slate-200 px-3 py-1.5 text-left text-[11.5px] italic text-slate-500 dark:border-border", children: "Message removed" }) : Ue ? /* @__PURE__ */ a(
992
+ Y ? /* @__PURE__ */ e("div", { className: "inline-block rounded-2xl border border-dashed border-slate-200 px-3 py-1.5 text-left text-[11.5px] italic text-slate-500 dark:border-border", children: "Message removed" }) : De ? /* @__PURE__ */ a(
987
993
  "form",
988
994
  {
989
995
  className: "flex items-center gap-1",
@@ -1002,9 +1008,9 @@ function On({
1002
1008
  onKeyDown: (D) => {
1003
1009
  D.key === "Escape" && mt(null);
1004
1010
  },
1005
- className: b(
1011
+ className: g(
1006
1012
  "h-8 w-[240px] rounded-lg border px-2 text-[12px] outline-none",
1007
- g.input
1013
+ f.input
1008
1014
  ),
1009
1015
  "aria-label": "Edit message"
1010
1016
  }
@@ -1013,7 +1019,7 @@ function On({
1013
1019
  "button",
1014
1020
  {
1015
1021
  type: "submit",
1016
- className: b("rounded-md px-1.5 py-1 text-[11px] font-medium", g.accentText),
1022
+ className: g("rounded-md px-1.5 py-1 text-[11px] font-medium", f.accentText),
1017
1023
  children: "Save"
1018
1024
  }
1019
1025
  )
@@ -1022,10 +1028,10 @@ function On({
1022
1028
  ) : /* @__PURE__ */ a(
1023
1029
  "div",
1024
1030
  {
1025
- className: b(
1031
+ className: g(
1026
1032
  "inline-block max-w-full rounded-2xl text-left leading-snug",
1027
- Pe === "compact" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[12.5px]",
1028
- C ? b("rounded-br-md", g.bubbleMine) : b("rounded-bl-md", g.bubbleOther),
1033
+ Ie === "compact" ? "px-2.5 py-1 text-[12px]" : "px-3 py-1.5 text-[12.5px]",
1034
+ N ? g("rounded-br-md", f.bubbleMine) : g("rounded-bl-md", f.bubbleOther),
1029
1035
  t.urgent && "ring-2 ring-red-400/70"
1030
1036
  ),
1031
1037
  children: [
@@ -1034,9 +1040,9 @@ function On({
1034
1040
  {
1035
1041
  type: "button",
1036
1042
  onClick: () => sn(t.quote.id),
1037
- className: b(
1043
+ className: g(
1038
1044
  "mb-1 block w-full rounded-md border-l-2 px-2 py-1 text-left text-[11px]",
1039
- C ? "border-white/60 bg-black/10" : "border-slate-400 bg-white/70 dark:border-slate-500 dark:bg-black/20"
1045
+ N ? "border-white/60 bg-black/10" : "border-slate-400 bg-white/70 dark:border-slate-500 dark:bg-black/20"
1040
1046
  ),
1041
1047
  "data-chat-quote-block": !0,
1042
1048
  children: [
@@ -1045,44 +1051,52 @@ function On({
1045
1051
  ]
1046
1052
  }
1047
1053
  ),
1048
- t.message && (l ? l(t, { mine: C }) : /* @__PURE__ */ e(
1049
- yr,
1054
+ t.message && Rn(t.message) && (l ? l(t, { mine: N }) : /* @__PURE__ */ e(
1055
+ Ur,
1050
1056
  {
1051
- text: t.message,
1052
- mine: C,
1053
- renderToken: C ? Pa : La,
1054
- entityPattern: f.entityPattern,
1057
+ text: Rn(t.message),
1058
+ mine: N,
1059
+ renderToken: N ? qa : ja,
1060
+ entityPattern: h.entityPattern,
1055
1061
  timeRefs: t.time_refs,
1056
- navigate: f.navigate
1062
+ navigate: h.navigate
1057
1063
  }
1058
1064
  )),
1059
- t.poll && /* @__PURE__ */ e(wr, { poll: t.poll, room: t.room, mine: C }),
1060
- (t.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: b("flex flex-wrap gap-1.5", t.message && "mt-1.5"), children: (t.attachments ?? []).map((D) => {
1061
- const O = kt == null ? void 0 : kt.get(D), rt = (O == null ? void 0 : O.title) || (O == null ? void 0 : O.filename_download) || "Attachment", wt = p.fileUrl(D), Ia = ((O == null ? void 0 : O.type) ?? "").startsWith("image/"), lt = $r(O == null ? void 0 : O.tags, O == null ? void 0 : O.type), _n = () => Yt({
1065
+ An(t.message) != null && /* @__PURE__ */ e(
1066
+ yr,
1067
+ {
1068
+ id: An(t.message),
1069
+ mine: N,
1070
+ renderAvatar: (D, O) => /* @__PURE__ */ e(Z, { id: D, name: O, size: 18, presence: !1 })
1071
+ }
1072
+ ),
1073
+ t.poll && /* @__PURE__ */ e($r, { poll: t.poll, room: t.room, mine: N }),
1074
+ (t.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: g("flex flex-wrap gap-1.5", t.message && "mt-1.5"), children: (t.attachments ?? []).map((D) => {
1075
+ const O = kt == null ? void 0 : kt.get(D), rt = (O == null ? void 0 : O.title) || (O == null ? void 0 : O.filename_download) || "Attachment", wt = u.fileUrl(D), Ea = ((O == null ? void 0 : O.type) ?? "").startsWith("image/"), lt = jr(O == null ? void 0 : O.tags, O == null ? void 0 : O.type), _n = () => Yt({
1062
1076
  id: D,
1063
1077
  url: wt,
1064
1078
  name: rt,
1065
1079
  type: (O == null ? void 0 : O.type) ?? null,
1066
1080
  size: (O == null ? void 0 : O.filesize) ?? null
1067
- }), ot = H && Ce.length > 0 ? /* @__PURE__ */ e(
1068
- Br,
1081
+ }), ot = j && _e.length > 0 ? /* @__PURE__ */ e(
1082
+ Jr,
1069
1083
  {
1070
- targets: Ce,
1071
- recordLabel: H.label,
1072
- onPick: (ja) => E.mutate({ messageId: t.id, fileId: D, field: ja })
1084
+ targets: _e,
1085
+ recordLabel: j.label,
1086
+ onPick: (Ba) => I.mutate({ messageId: t.id, fileId: D, field: Ba })
1073
1087
  }
1074
1088
  ) : null;
1075
1089
  return lt ? /* @__PURE__ */ e(
1076
- Rr,
1090
+ qr,
1077
1091
  {
1078
1092
  url: wt,
1079
- poster: lt.poster ? p.fileUrl(lt.poster) : null,
1093
+ poster: lt.poster ? u.fileUrl(lt.poster) : null,
1080
1094
  name: rt,
1081
1095
  durationMs: lt.durationMs,
1082
1096
  action: ot
1083
1097
  },
1084
1098
  D
1085
- ) : Ia ? /* @__PURE__ */ a("span", { className: "relative inline-block", children: [
1099
+ ) : Ea ? /* @__PURE__ */ a("span", { className: "relative inline-block", children: [
1086
1100
  /* @__PURE__ */ e(
1087
1101
  "button",
1088
1102
  {
@@ -1107,12 +1121,12 @@ function On({
1107
1121
  {
1108
1122
  type: "button",
1109
1123
  onClick: _n,
1110
- className: b(
1124
+ className: g(
1111
1125
  "inline-flex max-w-[220px] items-center gap-1.5 rounded-lg border px-2 py-1 text-[11.5px]",
1112
- C ? "border-white/30 bg-white/10" : "border-slate-200 bg-white dark:border-border dark:bg-card"
1126
+ N ? "border-white/30 bg-white/10" : "border-slate-200 bg-white dark:border-border dark:bg-card"
1113
1127
  ),
1114
1128
  children: [
1115
- /* @__PURE__ */ e(cs, { className: "h-3 w-3 shrink-0 opacity-60" }),
1129
+ /* @__PURE__ */ e(ps, { className: "h-3 w-3 shrink-0 opacity-60" }),
1116
1130
  /* @__PURE__ */ e("span", { className: "truncate", children: rt })
1117
1131
  ]
1118
1132
  }
@@ -1123,31 +1137,31 @@ function On({
1123
1137
  ]
1124
1138
  }
1125
1139
  ),
1126
- !J && !Ue && t.message && !t.no_preview && /* @__PURE__ */ e("div", { className: b(C && "flex justify-end"), children: /* @__PURE__ */ e(
1127
- kr,
1140
+ !Y && !De && t.message && !t.no_preview && /* @__PURE__ */ e("div", { className: g(N && "flex justify-end"), children: /* @__PURE__ */ e(
1141
+ Dr,
1128
1142
  {
1129
1143
  text: t.message,
1130
- navigate: f.navigate,
1131
- onDismiss: C ? () => q.mutate(t.id) : void 0
1144
+ navigate: h.navigate,
1145
+ onDismiss: N ? () => E.mutate(t.id) : void 0
1132
1146
  }
1133
1147
  ) }),
1134
1148
  pe.size > 0 && /* @__PURE__ */ e(
1135
1149
  "div",
1136
1150
  {
1137
- className: b("mt-0.5 flex flex-wrap gap-1", C && "justify-end"),
1151
+ className: g("mt-0.5 flex flex-wrap gap-1", N && "justify-end"),
1138
1152
  "data-chat-reactions": !0,
1139
1153
  children: [...pe.entries()].map(([D, O]) => /* @__PURE__ */ a(
1140
1154
  "button",
1141
1155
  {
1142
1156
  type: "button",
1143
1157
  title: O.names.join(", "),
1144
- onClick: () => d.mutate({ messageId: t.id, emoji: D }),
1145
- className: b(
1158
+ onClick: () => A.mutate({ messageId: t.id, emoji: D }),
1159
+ className: g(
1146
1160
  "inline-flex items-center gap-0.5 rounded-full border px-1.5 py-px text-[10.5px] leading-tight transition-colors",
1147
- O.mine ? b("font-semibold", g.accentSoft, "border-transparent") : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-slate-300 dark:hover:bg-muted"
1161
+ O.mine ? g("font-semibold", f.accentSoft, "border-transparent") : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-border dark:bg-card dark:text-slate-300 dark:hover:bg-muted"
1148
1162
  ),
1149
1163
  children: [
1150
- /* @__PURE__ */ e(dr, { value: D }),
1164
+ /* @__PURE__ */ e(hr, { value: D }),
1151
1165
  /* @__PURE__ */ e("span", { className: "tabular-nums", children: O.count })
1152
1166
  ]
1153
1167
  },
@@ -1155,39 +1169,39 @@ function On({
1155
1169
  ))
1156
1170
  }
1157
1171
  ),
1158
- !h.inThread && t.thread && t.thread.count > 0 && /* @__PURE__ */ a(
1172
+ !m.inThread && t.thread && t.thread.count > 0 && /* @__PURE__ */ a(
1159
1173
  "button",
1160
1174
  {
1161
1175
  type: "button",
1162
- onClick: () => Oe(t.id),
1163
- className: b(
1176
+ onClick: () => Le(t.id),
1177
+ className: g(
1164
1178
  "mt-1 flex items-center gap-1.5 rounded-md px-1 py-0.5 text-[11px] font-medium hover:bg-slate-100 dark:hover:bg-muted",
1165
- g.accentText,
1166
- C && "ml-auto"
1179
+ f.accentText,
1180
+ N && "ml-auto"
1167
1181
  ),
1168
1182
  "data-chat-thread-summary": t.thread.count,
1169
1183
  children: [
1170
- /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: t.thread.people.slice(0, 3).map((D) => /* @__PURE__ */ e(V, { id: D.id, name: D.name, size: 16, presence: !1 }, D.id)) }),
1184
+ /* @__PURE__ */ e("span", { className: "flex -space-x-1.5", children: t.thread.people.slice(0, 3).map((D) => /* @__PURE__ */ e(Z, { id: D.id, name: D.name, size: 16, presence: !1 }, D.id)) }),
1171
1185
  t.thread.count,
1172
1186
  " ",
1173
1187
  t.thread.count === 1 ? "reply" : "replies",
1174
1188
  t.thread.last_reply_at && /* @__PURE__ */ a("span", { className: "font-normal text-slate-500 dark:text-slate-400", children: [
1175
1189
  "· last ",
1176
- Bn(t.thread.last_reply_at)
1190
+ zn(t.thread.last_reply_at)
1177
1191
  ] })
1178
1192
  ]
1179
1193
  }
1180
1194
  ),
1181
1195
  /* @__PURE__ */ a("p", { className: "mt-0.5 flex items-center justify-end gap-1 text-[10px] text-slate-500 dark:text-slate-400", children: [
1182
- !C && /* @__PURE__ */ e("span", { className: "mr-auto" }),
1196
+ !N && /* @__PURE__ */ e("span", { className: "mr-auto" }),
1183
1197
  t.via_app && /* @__PURE__ */ a(
1184
1198
  "span",
1185
1199
  {
1186
1200
  className: "inline-flex max-w-[16rem] items-center gap-0.5 font-normal",
1187
- "data-tip": `Posted for ${C ? "you" : t.sender_name ?? "this person"} through an app or API key named "${t.via_app}". The name is the app's own, not a person.`,
1201
+ "data-tip": `Posted for ${N ? "you" : t.sender_name ?? "this person"} through an app or API key named "${t.via_app}". The name is the app's own, not a person.`,
1188
1202
  "data-chat-message-via-app": !0,
1189
1203
  children: [
1190
- /* @__PURE__ */ e(ds, { className: "h-3 w-3 shrink-0", "aria-hidden": !0 }),
1204
+ /* @__PURE__ */ e(hs, { className: "h-3 w-3 shrink-0", "aria-hidden": !0 }),
1191
1205
  /* @__PURE__ */ a("span", { className: "truncate", children: [
1192
1206
  "via app · ",
1193
1207
  t.via_app
@@ -1195,25 +1209,25 @@ function On({
1195
1209
  ]
1196
1210
  }
1197
1211
  ),
1198
- t.edited_at && !J && /* @__PURE__ */ e("span", { className: "italic", children: "(edited)" }),
1212
+ t.edited_at && !Y && /* @__PURE__ */ e("span", { className: "italic", children: "(edited)" }),
1199
1213
  new Date(t.date_created).toLocaleTimeString("en-US", {
1200
1214
  hour: "numeric",
1201
1215
  minute: "2-digit"
1202
1216
  }),
1203
- C && _e && !J && (() => {
1217
+ N && Se && !Y && (() => {
1204
1218
  var O;
1205
- const D = Me(t);
1219
+ const D = Oe(t);
1206
1220
  return D.length === 0 ? null : /* @__PURE__ */ e(
1207
- zr,
1221
+ Vr,
1208
1222
  {
1209
1223
  seen: D,
1210
- channelId: ((O = k == null ? void 0 : k.channel) == null ? void 0 : O.id) ?? null,
1224
+ channelId: ((O = y == null ? void 0 : y.channel) == null ? void 0 : O.id) ?? null,
1211
1225
  senderId: String(t.sender ?? "")
1212
1226
  }
1213
1227
  );
1214
1228
  })(),
1215
- h.isLastMine && n.startsWith("dm:") && (G ? /* @__PURE__ */ a("span", { className: b("inline-flex items-center gap-0.5 font-medium", g.accentText), children: [
1216
- /* @__PURE__ */ e(us, { className: "h-3 w-3", strokeWidth: 2.4 }),
1229
+ m.isLastMine && n.startsWith("dm:") && (Q ? /* @__PURE__ */ a("span", { className: g("inline-flex items-center gap-0.5 font-medium", f.accentText), children: [
1230
+ /* @__PURE__ */ e(fs, { className: "h-3 w-3", strokeWidth: 2.4 }),
1217
1231
  " Read"
1218
1232
  ] }) : /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-0.5", children: [
1219
1233
  /* @__PURE__ */ e(At, { className: "h-3 w-3", strokeWidth: 2.2 }),
@@ -1225,19 +1239,19 @@ function On({
1225
1239
  }
1226
1240
  );
1227
1241
  }, mn = (t) => /* @__PURE__ */ e(
1228
- Is,
1242
+ Bs,
1229
1243
  {
1230
1244
  ref: t ? void 0 : nn,
1231
1245
  room: n,
1232
- label: _,
1246
+ label: S,
1233
1247
  parentId: t,
1234
- quote: t ? Ta : Sa,
1248
+ quote: t ? $a : Da,
1235
1249
  onClearQuote: () => t ? tn(null) : en(null),
1236
- onSent: Da,
1250
+ onSent: Aa,
1237
1251
  disabledReason: t ? null : cn,
1238
- quietNote: Ma,
1239
- th: g,
1240
- renderAvatar: (h, C) => /* @__PURE__ */ e(V, { id: h, name: C, size: 22, presence: h !== "__bot__" })
1252
+ quietNote: Pa,
1253
+ th: f,
1254
+ renderAvatar: (m, N) => /* @__PURE__ */ e(Z, { id: m, name: N, size: 22, presence: m !== "__bot__" })
1241
1255
  }
1242
1256
  );
1243
1257
  return /* @__PURE__ */ a(
@@ -1252,11 +1266,11 @@ function On({
1252
1266
  t.currentTarget.contains(t.relatedTarget) || ft(!1);
1253
1267
  },
1254
1268
  onDrop: (t) => {
1255
- var h;
1256
- t.dataTransfer.files.length && (t.preventDefault(), ft(!1), (h = nn.current) == null || h.addFiles([...t.dataTransfer.files]));
1269
+ var m;
1270
+ t.dataTransfer.files.length && (t.preventDefault(), ft(!1), (m = nn.current) == null || m.addFiles([...t.dataTransfer.files]));
1257
1271
  },
1258
1272
  children: [
1259
- Ua && /* @__PURE__ */ e(
1273
+ Ra && /* @__PURE__ */ e(
1260
1274
  "div",
1261
1275
  {
1262
1276
  className: "pointer-events-none absolute inset-2 z-30 flex items-center justify-center rounded-xl border-2 border-dashed border-nvr-cyan bg-white/85 text-[13px] font-semibold text-slate-700 dark:bg-card/90 dark:text-slate-100",
@@ -1264,7 +1278,7 @@ function On({
1264
1278
  children: "Drop to attach to your message"
1265
1279
  }
1266
1280
  ),
1267
- /* @__PURE__ */ a("div", { className: b("flex shrink-0 items-center gap-1.5 border-b px-3 py-2", g.divider), children: [
1281
+ /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-1.5 border-b px-3 py-2", f.divider), children: [
1268
1282
  /* @__PURE__ */ e(
1269
1283
  "button",
1270
1284
  {
@@ -1275,13 +1289,13 @@ function On({
1275
1289
  children: /* @__PURE__ */ e(ct, { className: "h-4 w-4", strokeWidth: 2 })
1276
1290
  }
1277
1291
  ),
1278
- ((k == null ? void 0 : k.kind) === "channel" && !((fn = k.channel) != null && fn.is_direct) || (k == null ? void 0 : k.kind) === "global" && (((xn = k.channel) == null ? void 0 : xn.icon) || ((bn = k.channel) == null ? void 0 : bn.color))) && /* @__PURE__ */ e(Ke, { icon: (gn = k == null ? void 0 : k.channel) == null ? void 0 : gn.icon, color: (vn = k == null ? void 0 : k.channel) == null ? void 0 : vn.color, size: 24 }),
1279
- x && ke(n, x.id) && /* @__PURE__ */ e(Or, { peerId: ke(n, x.id), name: _ }),
1292
+ ((y == null ? void 0 : y.kind) === "channel" && !((fn = y.channel) != null && fn.is_direct) || (y == null ? void 0 : y.kind) === "global" && (((xn = y.channel) == null ? void 0 : xn.icon) || ((gn = y.channel) == null ? void 0 : gn.color))) && /* @__PURE__ */ e(Ke, { icon: (bn = y == null ? void 0 : y.channel) == null ? void 0 : bn.icon, color: (vn = y == null ? void 0 : y.channel) == null ? void 0 : vn.color, size: 24 }),
1293
+ p && we(n, p.id) && /* @__PURE__ */ e(Wr, { peerId: we(n, p.id), name: S }),
1280
1294
  /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
1281
1295
  /* @__PURE__ */ a("p", { className: "flex items-center gap-1 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
1282
- /* @__PURE__ */ e("span", { className: "truncate", children: _ }),
1283
- k && /* @__PURE__ */ e(Nr, { starred: !!k.starred, notify: zt }),
1284
- (W == null ? void 0 : W.announce) && /* @__PURE__ */ e(
1296
+ /* @__PURE__ */ e("span", { className: "truncate", children: S }),
1297
+ y && /* @__PURE__ */ e(Rr, { starred: !!y.starred, notify: zt }),
1298
+ (z == null ? void 0 : z.announce) && /* @__PURE__ */ e(
1285
1299
  "span",
1286
1300
  {
1287
1301
  className: "shrink-0 rounded bg-slate-100 px-1.5 py-px text-[10.5px] font-medium text-slate-600 dark:bg-muted dark:text-slate-300",
@@ -1290,22 +1304,22 @@ function On({
1290
1304
  }
1291
1305
  )
1292
1306
  ] }),
1293
- x && ke(n, x.id) ? /* @__PURE__ */ e(qr, { peerId: ke(n, x.id), name: _ }) : n.startsWith("ch:") ? /* @__PURE__ */ e(
1294
- _r,
1307
+ p && we(n, p.id) ? /* @__PURE__ */ e(Qr, { peerId: we(n, p.id), name: S }) : n.startsWith("ch:") ? /* @__PURE__ */ e(
1308
+ Mr,
1295
1309
  {
1296
1310
  room: n,
1297
- me: ((yn = f.me) == null ? void 0 : yn.id) ?? null,
1298
- renderAvatar: (t, h) => /* @__PURE__ */ e(V, { id: t, name: h, size: 24 })
1311
+ me: ((yn = h.me) == null ? void 0 : yn.id) ?? null,
1312
+ renderAvatar: (t, m) => /* @__PURE__ */ e(Z, { id: t, name: m, size: 24 })
1299
1313
  }
1300
1314
  ) : null
1301
1315
  ] }),
1302
1316
  /* @__PURE__ */ e(
1303
- hr,
1317
+ br,
1304
1318
  {
1305
1319
  room: n,
1306
- roomLabel: _,
1307
- huddle: v,
1308
- renderAvatar: (t, h) => /* @__PURE__ */ e(V, { id: t, name: h, size: 18, presence: !1 })
1320
+ roomLabel: S,
1321
+ huddle: b,
1322
+ renderAvatar: (t, m) => /* @__PURE__ */ e(Z, { id: t, name: m, size: 18, presence: !1 })
1309
1323
  }
1310
1324
  ),
1311
1325
  /* @__PURE__ */ e(
@@ -1313,71 +1327,81 @@ function On({
1313
1327
  {
1314
1328
  type: "button",
1315
1329
  onClick: () => {
1316
- ka((t) => !t), Ht("");
1330
+ Ca((t) => !t), Ht("");
1317
1331
  },
1318
- className: b(Rn, Xe ? g.accentSoft : $n),
1332
+ className: g(On, Xe ? f.accentSoft : Mn),
1319
1333
  "aria-label": "Search in this conversation",
1320
1334
  "aria-pressed": Xe,
1321
1335
  "data-tip": "Search this conversation",
1322
- children: /* @__PURE__ */ e(qn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1336
+ children: /* @__PURE__ */ e(Wn, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1323
1337
  }
1324
1338
  ),
1325
- ((kn = k == null ? void 0 : k.channel) == null ? void 0 : kn.is_direct) && /* @__PURE__ */ e(Hr, { channel: k.channel, onLeft: o }),
1339
+ ((kn = y == null ? void 0 : y.channel) == null ? void 0 : kn.is_direct) && /* @__PURE__ */ e(Xr, { channel: y.channel, onLeft: o }),
1326
1340
  /* @__PURE__ */ e(
1327
1341
  "button",
1328
1342
  {
1329
1343
  type: "button",
1330
1344
  onClick: () => {
1331
- Oe(null), We((t) => !t);
1345
+ Le(null), We((t) => !t);
1332
1346
  },
1333
- className: b(Rn, ht ? g.accentSoft : $n),
1347
+ className: g(On, ht ? f.accentSoft : Mn),
1334
1348
  "aria-label": "Room info — members, pinned, files and links",
1335
1349
  "aria-pressed": ht,
1336
1350
  "data-tip": "Room info — members, pinned, files and links",
1337
1351
  "data-chat-info-button": !0,
1338
- children: /* @__PURE__ */ e(Va, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1352
+ children: /* @__PURE__ */ e(ns, { className: "h-3.5 w-3.5", strokeWidth: 2 })
1339
1353
  }
1340
1354
  ),
1341
1355
  /* @__PURE__ */ e(
1342
- Cr,
1356
+ Ar,
1343
1357
  {
1344
- th: g,
1345
- starred: k ? !!k.starred : void 0,
1346
- onStar: k ? () => ha.mutate({ room: n, starred: !k.starred }) : void 0,
1347
- notify: k ? zt : void 0,
1348
- onNotify: k ? (t) => {
1349
- t === "muted" ? K.mutate({ room: n, muted: !0 }) : (k.muted && K.mutate({ room: n, muted: !1 }), ma.mutate({ room: n, mode: t }));
1358
+ th: f,
1359
+ huddleSchedule: b.enabled ? (t) => /* @__PURE__ */ e(
1360
+ kr,
1361
+ {
1362
+ room: n,
1363
+ me: (p == null ? void 0 : p.id) ?? null,
1364
+ theme: { input: f.input },
1365
+ renderAvatar: (m, N) => /* @__PURE__ */ e(Z, { id: m, name: N, size: 18, presence: !1 }),
1366
+ onDone: t
1367
+ }
1368
+ ) : void 0,
1369
+ starred: y ? !!y.starred : void 0,
1370
+ onStar: y ? () => ga.mutate({ room: n, starred: !y.starred }) : void 0,
1371
+ notify: y ? zt : void 0,
1372
+ onNotify: y ? (t) => {
1373
+ t === "muted" ? J.mutate({ room: n, muted: !0 }) : (y.muted && J.mutate({ room: n, muted: !1 }), fa.mutate({ room: n, mode: t }));
1350
1374
  } : void 0,
1351
1375
  onJump: (t) => {
1352
- Te.current = !1, re.current = !1, R({ date: t });
1376
+ Ue.current = !1, re.current = !1, M({ date: t });
1353
1377
  },
1354
- onOpenRecord: ve ? () => {
1378
+ onOpenRecord: de ? () => {
1355
1379
  var t;
1356
- return (t = f.navigate) == null ? void 0 : t.call(f, ve);
1380
+ return (t = h.navigate) == null ? void 0 : t.call(h, de);
1357
1381
  } : void 0,
1358
- onTeamsCall: n.startsWith("dm:") || (wn = k == null ? void 0 : k.channel) != null && wn.is_direct ? async () => {
1359
- var t, h;
1382
+ onTeamsCall: n.startsWith("dm:") || (wn = y == null ? void 0 : y.channel) != null && wn.is_direct ? async () => {
1383
+ var t, m;
1360
1384
  try {
1361
- let C = [];
1362
- if (n.startsWith("dm:") && x) {
1363
- const G = ke(n, x.id);
1364
- if (G) {
1365
- const J = await p.request(
1366
- xe(`/users/${G}`)
1385
+ let N = [];
1386
+ if (n.startsWith("dm:") && p) {
1387
+ const Q = we(n, p.id);
1388
+ if (Q) {
1389
+ const Y = await u.request(
1390
+ xe(`/users/${Q}`)
1367
1391
  );
1368
- (t = J.data) != null && t.email && (C = [J.data.email]);
1392
+ (t = Y.data) != null && t.email && (N = [Y.data.email]);
1369
1393
  }
1370
- } else (h = k == null ? void 0 : k.channel) != null && h.id && (C = (await p.request(
1394
+ } else (m = y == null ? void 0 : y.channel) != null && m.id && (N = (await u.request(
1371
1395
  xe(
1372
- `/chat/channels/${k.channel.id}/members`
1396
+ `/chat/channels/${y.channel.id}/members`
1373
1397
  )
1374
- )).data.filter((J) => J.email && J.user.toUpperCase() !== (x == null ? void 0 : x.id.toUpperCase())).map((J) => J.email));
1375
- if (C.length === 0) {
1398
+ )).data.filter((Y) => Y.email && Y.user.toUpperCase() !== (p == null ? void 0 : p.id.toUpperCase())).map((Y) => Y.email));
1399
+ if (N.length === 0) {
1376
1400
  he.error("No callable participants found");
1377
1401
  return;
1378
1402
  }
1379
1403
  window.open(
1380
- `https://teams.microsoft.com/l/call/0/0?users=${encodeURIComponent(C.join(","))}`,
1404
+ `https://teams.microsoft.com/l/call/0/0?users=${encodeURIComponent(N.join(","))}`,
1381
1405
  "_blank",
1382
1406
  "noopener"
1383
1407
  );
@@ -1386,12 +1410,12 @@ function On({
1386
1410
  }
1387
1411
  } : void 0,
1388
1412
  onSettings: r,
1389
- archived: !!(k != null && k.archived),
1390
- onArchive: k && ya ? () => pa.mutate(
1391
- { room: n, archived: !k.archived },
1413
+ archived: !!(y != null && y.archived),
1414
+ onArchive: y && Na ? () => xa.mutate(
1415
+ { room: n, archived: !y.archived },
1392
1416
  {
1393
1417
  onSuccess: () => {
1394
- k.archived ? he.success("Moved back to your chats") : (he.success(
1418
+ y.archived ? he.success("Moved back to your chats") : (he.success(
1395
1419
  "Archived for you — others in the conversation still see it",
1396
1420
  {
1397
1421
  description: "Find it under the Archived tab."
@@ -1400,143 +1424,143 @@ function On({
1400
1424
  }
1401
1425
  }
1402
1426
  ) : void 0,
1403
- onLeave: (k == null ? void 0 : k.kind) === "entity" && k.joined ? () => xa.mutate(n, {
1427
+ onLeave: (y == null ? void 0 : y.kind) === "entity" && y.joined ? () => va.mutate(n, {
1404
1428
  onSuccess: () => {
1405
- he.success(`Left ${k.label}`, {
1429
+ he.success(`Left ${y.label}`, {
1406
1430
  description: "Open the record's chat again to rejoin."
1407
1431
  }), o();
1408
1432
  }
1409
1433
  }) : void 0,
1410
- tips: /* @__PURE__ */ e(Pr, { botName: de })
1434
+ tips: /* @__PURE__ */ e(zr, { botName: ce })
1411
1435
  }
1412
1436
  )
1413
1437
  ] }),
1414
1438
  /* @__PURE__ */ e(
1415
- fr,
1439
+ wr,
1416
1440
  {
1417
1441
  room: n,
1418
- me: x,
1419
- huddle: v,
1420
- renderAvatar: (t, h) => /* @__PURE__ */ e(V, { id: t, name: h, size: 18, presence: !1 })
1442
+ me: p,
1443
+ huddle: b,
1444
+ renderAvatar: (t, m) => /* @__PURE__ */ e(Z, { id: t, name: m, size: 18, presence: !1 })
1421
1445
  }
1422
1446
  ),
1423
- Xe && /* @__PURE__ */ e("div", { className: b("shrink-0 border-b px-3 py-1.5", g.divider), children: /* @__PURE__ */ e(
1447
+ Xe && /* @__PURE__ */ e("div", { className: g("shrink-0 border-b px-3 py-1.5", f.divider), children: /* @__PURE__ */ e(
1424
1448
  "input",
1425
1449
  {
1426
1450
  autoFocus: !0,
1427
1451
  value: et,
1428
1452
  onChange: (t) => Ht(t.target.value),
1429
1453
  placeholder: "Search messages…",
1430
- className: b("h-7 w-full rounded-md border px-2 text-[12px] outline-none", g.input),
1454
+ className: g("h-7 w-full rounded-md border px-2 text-[12px] outline-none", f.input),
1431
1455
  "aria-label": "Search messages"
1432
1456
  }
1433
1457
  ) }),
1434
- /* @__PURE__ */ e(Ir, { room: n }),
1435
- W && !W.is_direct && /* @__PURE__ */ e(
1436
- Sr,
1458
+ /* @__PURE__ */ e(Hr, { room: n }),
1459
+ z && !z.is_direct && /* @__PURE__ */ e(
1460
+ Or,
1437
1461
  {
1438
- description: W.description,
1439
- links: W.links,
1440
- th: g,
1441
- navigate: f.navigate
1462
+ description: z.description,
1463
+ links: z.links,
1464
+ th: f,
1465
+ navigate: h.navigate
1442
1466
  }
1443
1467
  ),
1444
- L.length > 0 && /* @__PURE__ */ e("div", { className: b("shrink-0 border-b px-3 py-1", g.divider), "data-chat-pins-strip": !0, children: /* @__PURE__ */ a(
1468
+ w.length > 0 && /* @__PURE__ */ e("div", { className: g("shrink-0 border-b px-3 py-1", f.divider), "data-chat-pins-strip": !0, children: /* @__PURE__ */ a(
1445
1469
  "button",
1446
1470
  {
1447
1471
  type: "button",
1448
1472
  onClick: () => {
1449
- Oe(null), We(!0);
1473
+ Le(null), We(!0);
1450
1474
  },
1451
1475
  className: "flex w-full items-center gap-1.5 text-[11px] font-medium text-slate-500 dark:text-slate-400",
1452
1476
  children: [
1453
1477
  /* @__PURE__ */ e(St, { className: "h-3 w-3", strokeWidth: 2 }),
1454
- L.length,
1478
+ w.length,
1455
1479
  " pinned",
1456
1480
  /* @__PURE__ */ e(ct, { className: "ml-auto h-3 w-3 -rotate-90" })
1457
1481
  ]
1458
1482
  }
1459
1483
  ) }),
1460
- (W == null ? void 0 : W.archive_suggested_at) && W.id !== 0 && (on || B) && /* @__PURE__ */ e(
1461
- Ds,
1484
+ (z == null ? void 0 : z.archive_suggested_at) && z.id !== 0 && (on || F) && /* @__PURE__ */ e(
1485
+ Ms,
1462
1486
  {
1463
- channelId: W.id,
1464
- channelName: _,
1465
- suggestedAt: W.archive_suggested_at
1487
+ channelId: z.id,
1488
+ channelName: S,
1489
+ suggestedAt: z.archive_suggested_at
1466
1490
  }
1467
1491
  ),
1468
- Oa && (W == null ? void 0 : W.welcome_note) && /* @__PURE__ */ e(
1469
- Tr,
1492
+ Ia && (z == null ? void 0 : z.welcome_note) && /* @__PURE__ */ e(
1493
+ Lr,
1470
1494
  {
1471
- note: W.welcome_note,
1472
- channelName: _,
1473
- th: g,
1474
- onDismiss: () => fa.mutate(n)
1495
+ note: z.welcome_note,
1496
+ channelName: S,
1497
+ th: f,
1498
+ onDismiss: () => ba.mutate(n)
1475
1499
  }
1476
1500
  ),
1477
1501
  /* @__PURE__ */ e(
1478
1502
  "div",
1479
1503
  {
1480
- ref: $e,
1504
+ ref: Re,
1481
1505
  onScroll: (t) => {
1482
- const h = t.currentTarget;
1483
- re.current = h.scrollHeight - h.scrollTop - h.clientHeight < 48, vt.current = h.scrollHeight, re.current && le && Fe(null), ge.onScroll(), h.scrollTop < 200 && A && !Y && !me && Te.current && z();
1506
+ const m = t.currentTarget;
1507
+ re.current = m.scrollHeight - m.scrollTop - m.clientHeight < 48, vt.current = m.scrollHeight, re.current && le && Fe(null), be.onScroll(), m.scrollTop < 200 && R && !V && !me && Ue.current && H();
1484
1508
  },
1485
1509
  className: "relative min-h-0 flex-1 overflow-y-auto px-3 py-3 [overflow-anchor:none]",
1486
1510
  "data-chat-messages": !0,
1487
- children: /* @__PURE__ */ a("div", { ref: an, className: Pe === "compact" ? "space-y-1" : "space-y-2.5", children: [
1488
- A && !me && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
1511
+ children: /* @__PURE__ */ a("div", { ref: an, className: Ie === "compact" ? "space-y-1" : "space-y-2.5", children: [
1512
+ R && !me && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
1489
1513
  "button",
1490
1514
  {
1491
1515
  type: "button",
1492
- disabled: Y,
1516
+ disabled: V,
1493
1517
  onClick: () => {
1494
1518
  var t;
1495
- vt.current = ((t = $e.current) == null ? void 0 : t.scrollHeight) ?? 0, z();
1519
+ vt.current = ((t = Re.current) == null ? void 0 : t.scrollHeight) ?? 0, H();
1496
1520
  },
1497
1521
  className: "rounded-full border border-slate-200 px-2.5 py-0.5 text-[11px] font-medium text-slate-600 hover:bg-muted disabled:opacity-50 dark:border-border dark:text-slate-300",
1498
1522
  "data-chat-load-older": !0,
1499
- children: Y ? "Loading…" : "Load earlier messages"
1523
+ children: V ? "Loading…" : "Load earlier messages"
1500
1524
  }
1501
1525
  ) }),
1502
- I ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-500", children: "Loading…" }) : ye.length === 0 && ee.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-500", children: me ? "No messages match." : P ? "Nothing was said around then." : /* @__PURE__ */ a(Ne, { children: [
1526
+ B ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-500", children: "Loading…" }) : ke.length === 0 && se.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-500", children: me ? "No messages match." : W ? "Nothing was said around then." : /* @__PURE__ */ a(Ce, { children: [
1503
1527
  /* @__PURE__ */ e("p", { children: "No messages yet — say hello." }),
1504
1528
  /* @__PURE__ */ a("p", { className: "mt-1 text-[11px]", children: [
1505
1529
  "Tip: @ mentions someone",
1506
- de ? `, @${de} asks the AI` : "",
1530
+ ce ? `, @${ce} asks the AI` : "",
1507
1531
  ", # inserts a record, and a record ID like AB26-12345 becomes a live link."
1508
1532
  ] })
1509
1533
  ] }) }) : /* @__PURE__ */ e(
1510
1534
  "div",
1511
1535
  {
1512
1536
  ref: ln,
1513
- style: ge.windowed ? { paddingTop: ge.padTop, paddingBottom: ge.padBottom } : void 0,
1514
- "data-chat-rows": ge.windowed ? "windowed" : "all",
1515
- children: ye.slice(ge.start, ge.end).map((t, h) => {
1516
- var Ue;
1517
- const C = ge.start + h, G = ye[C - 1], J = C === 0 || G && new Date(G.date_created).toDateString() !== new Date(t.date_created).toDateString(), Re = !me && !P && gt.current > 0 && C === Math.max(0, ye.length - gt.current), Ie = Pe === "compact" && !J && !!G && G.sender === t.sender && !G.is_system && new Date(t.date_created).getTime() - new Date(G.date_created).getTime() < 5 * 6e4;
1537
+ style: be.windowed ? { paddingTop: be.padTop, paddingBottom: be.padBottom } : void 0,
1538
+ "data-chat-rows": be.windowed ? "windowed" : "all",
1539
+ children: ke.slice(be.start, be.end).map((t, m) => {
1540
+ var De;
1541
+ const N = be.start + m, Q = ke[N - 1], Y = N === 0 || Q && new Date(Q.date_created).toDateString() !== new Date(t.date_created).toDateString(), Ae = !me && !W && bt.current > 0 && N === Math.max(0, ke.length - bt.current), je = Ie === "compact" && !Y && !!Q && Q.sender === t.sender && !Q.is_system && new Date(t.date_created).getTime() - new Date(Q.date_created).getTime() < 5 * 6e4;
1518
1542
  return /* @__PURE__ */ a(
1519
1543
  "div",
1520
1544
  {
1521
- ref: ge.rowRef(t.id),
1545
+ ref: be.rowRef(t.id),
1522
1546
  "data-chat-row": t.id,
1523
- className: C > 0 ? Pe === "compact" ? "pt-1" : "pt-2.5" : void 0,
1547
+ className: N > 0 ? Ie === "compact" ? "pt-1" : "pt-2.5" : void 0,
1524
1548
  children: [
1525
- J && /* @__PURE__ */ a("div", { className: "my-2 flex items-center gap-2", children: [
1549
+ Y && /* @__PURE__ */ a("div", { className: "my-2 flex items-center gap-2", children: [
1526
1550
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-slate-100 dark:bg-border" }),
1527
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-slate-500 dark:text-slate-400", children: Lr(t.date_created) }),
1551
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-slate-500 dark:text-slate-400", children: Fr(t.date_created) }),
1528
1552
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-slate-100 dark:bg-border" })
1529
1553
  ] }),
1530
- Re && /* @__PURE__ */ a(
1554
+ Ae && /* @__PURE__ */ a(
1531
1555
  "div",
1532
1556
  {
1533
- ref: bt,
1557
+ ref: gt,
1534
1558
  className: "my-2 flex items-center gap-2",
1535
1559
  "data-chat-unread-divider": !0,
1536
1560
  children: [
1537
1561
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" }),
1538
1562
  /* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-red-600 dark:text-red-400", children: "New messages" }),
1539
- gt.current > 20 && /* @__PURE__ */ e(
1563
+ bt.current > 20 && /* @__PURE__ */ e(
1540
1564
  "button",
1541
1565
  {
1542
1566
  type: "button",
@@ -1550,10 +1574,10 @@ function On({
1550
1574
  ]
1551
1575
  }
1552
1576
  ),
1553
- Re && M && /* @__PURE__ */ e("div", { className: "my-1 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: M }),
1577
+ Ae && L && /* @__PURE__ */ e("div", { className: "my-1 rounded-md border border-nvr-cyan/25 bg-nvr-cyan/5 px-2.5 py-1.5 text-[11.5px] leading-snug text-slate-600 dark:text-slate-300", children: L }),
1554
1578
  un(t, {
1555
- isLastMine: ((Ue = t.sender) == null ? void 0 : Ue.toLowerCase()) === Le && C === $a,
1556
- showSender: !Ie
1579
+ isLastMine: ((De = t.sender) == null ? void 0 : De.toLowerCase()) === Pe && N === Ma,
1580
+ showSender: !je
1557
1581
  })
1558
1582
  ]
1559
1583
  },
@@ -1562,14 +1586,14 @@ function On({
1562
1586
  })
1563
1587
  }
1564
1588
  ),
1565
- !me && !F && /* @__PURE__ */ e(aa, { items: ee, th: g }),
1566
- !me && !F && He.live && de && /* @__PURE__ */ e(
1567
- Ts,
1589
+ !me && !G && /* @__PURE__ */ e(la, { items: se, th: f }),
1590
+ !me && !G && He.live && ce && /* @__PURE__ */ e(
1591
+ Rs,
1568
1592
  {
1569
1593
  live: He.live,
1570
- botName: de,
1571
- bubbleClass: g.bubbleOther,
1572
- accentClass: g.accentText,
1594
+ botName: ce,
1595
+ bubbleClass: f.bubbleOther,
1596
+ accentClass: f.accentText,
1573
1597
  onStop: He.stop,
1574
1598
  onDismiss: He.dismiss
1575
1599
  }
@@ -1577,26 +1601,26 @@ function On({
1577
1601
  ] })
1578
1602
  }
1579
1603
  ),
1580
- (le || F) && /* @__PURE__ */ e("div", { className: "pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-center justify-center", children: /* @__PURE__ */ e(
1604
+ (le || G) && /* @__PURE__ */ e("div", { className: "pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-center justify-center", children: /* @__PURE__ */ e(
1581
1605
  "button",
1582
1606
  {
1583
1607
  type: "button",
1584
1608
  onClick: () => {
1585
- if (F) {
1586
- Te.current = !1, re.current = !0, R(null);
1609
+ if (G) {
1610
+ Ue.current = !1, re.current = !0, M(null);
1587
1611
  return;
1588
1612
  }
1589
1613
  le && !yt(le.firstId) && at(), Fe(null);
1590
1614
  },
1591
- className: b(
1615
+ className: g(
1592
1616
  "pointer-events-auto rounded-full px-3 py-1 text-[11.5px] font-semibold shadow-md",
1593
- g.pill
1617
+ f.pill
1594
1618
  ),
1595
1619
  "data-chat-new-pill": (le == null ? void 0 : le.count) ?? 0,
1596
- children: F ? "Jump to the latest ↓" : `${le == null ? void 0 : le.count} new ${(le == null ? void 0 : le.count) === 1 ? "message" : "messages"} ↓`
1620
+ children: G ? "Jump to the latest ↓" : `${le == null ? void 0 : le.count} new ${(le == null ? void 0 : le.count) === 1 ? "message" : "messages"} ↓`
1597
1621
  }
1598
1622
  ) }),
1599
- /* @__PURE__ */ e("div", { className: "min-h-[18px] shrink-0 px-3.5", children: nt && de && !He.live ? /* @__PURE__ */ a(
1623
+ /* @__PURE__ */ e("div", { className: "min-h-[18px] shrink-0 px-3.5", children: nt && ce && !He.live ? /* @__PURE__ */ a(
1600
1624
  "p",
1601
1625
  {
1602
1626
  className: "flex items-center gap-1.5 text-[11px] italic text-slate-500",
@@ -1607,48 +1631,48 @@ function On({
1607
1631
  /* @__PURE__ */ e("span", { className: "h-1 w-1 animate-bounce rounded-full bg-slate-400 [animation-delay:150ms]" }),
1608
1632
  /* @__PURE__ */ e("span", { className: "h-1 w-1 animate-bounce rounded-full bg-slate-400 [animation-delay:300ms]" })
1609
1633
  ] }),
1610
- de,
1634
+ ce,
1611
1635
  " is thinking…"
1612
1636
  ]
1613
1637
  }
1614
1638
  ) : te.typingText && /* @__PURE__ */ e("p", { className: "text-[11px] italic text-slate-500", children: te.typingText }) }),
1615
- Jt && /* @__PURE__ */ e(Cs, { file: Jt, onClose: () => Yt(null) }),
1639
+ Jt && /* @__PURE__ */ e(Us, { file: Jt, onClose: () => Yt(null) }),
1616
1640
  mn(null),
1617
1641
  Zt != null && /* @__PURE__ */ e(
1618
- Ur,
1642
+ Pr,
1619
1643
  {
1620
1644
  room: n,
1621
1645
  rootId: Zt,
1622
- th: g,
1623
- onClose: () => Oe(null),
1646
+ th: f,
1647
+ onClose: () => Le(null),
1624
1648
  renderRow: (t) => un(t, { inThread: !0 }),
1625
1649
  renderComposer: (t) => mn(t),
1626
- renderOutbox: (t) => /* @__PURE__ */ e(Er, { room: n, parentId: t, th: g })
1650
+ renderOutbox: (t) => /* @__PURE__ */ e(Kr, { room: n, parentId: t, th: f })
1627
1651
  }
1628
1652
  ),
1629
1653
  ht && /* @__PURE__ */ e(
1630
- Dr,
1654
+ Ir,
1631
1655
  {
1632
1656
  room: n,
1633
- label: _,
1634
- th: g,
1635
- pins: L,
1657
+ label: S,
1658
+ th: f,
1659
+ pins: w,
1636
1660
  onClose: () => We(!1),
1637
1661
  onOpenMessage: sn,
1638
- onUnpin: (t) => m.mutate(t),
1639
- navigate: f.navigate,
1640
- renderAvatar: (t, h) => /* @__PURE__ */ e(V, { id: t, name: h, size: 22 })
1662
+ onUnpin: (t) => P.mutate(t),
1663
+ navigate: h.navigate,
1664
+ renderAvatar: (t, m) => /* @__PURE__ */ e(Z, { id: t, name: m, size: 22 })
1641
1665
  }
1642
1666
  )
1643
1667
  ]
1644
1668
  }
1645
1669
  );
1646
1670
  }
1647
- function Er({ room: n, parentId: s, th: o }) {
1648
- const r = na(n, s);
1649
- return /* @__PURE__ */ e(aa, { items: r, th: o });
1671
+ function Kr({ room: n, parentId: s, th: o }) {
1672
+ const r = ra(n, s);
1673
+ return /* @__PURE__ */ e(la, { items: r, th: o });
1650
1674
  }
1651
- function Br({
1675
+ function Jr({
1652
1676
  targets: n,
1653
1677
  recordLabel: s,
1654
1678
  onPick: o
@@ -1663,7 +1687,7 @@ function Br({
1663
1687
  title: `Attach to ${s}`,
1664
1688
  "aria-label": `Attach to ${s}`,
1665
1689
  "data-chat-attach-to-record": !0,
1666
- children: /* @__PURE__ */ e(ps, { className: "h-3 w-3" })
1690
+ children: /* @__PURE__ */ e(gs, { className: "h-3 w-3" })
1667
1691
  }
1668
1692
  ) }),
1669
1693
  /* @__PURE__ */ a(Ve, { align: "end", className: "w-[220px] p-1.5", children: [
@@ -1686,7 +1710,7 @@ function Br({
1686
1710
  ] })
1687
1711
  ] });
1688
1712
  }
1689
- function Ln(n) {
1713
+ function jn(n) {
1690
1714
  return {
1691
1715
  id: n.id,
1692
1716
  visibility: n.visibility,
@@ -1697,36 +1721,36 @@ function Ln(n) {
1697
1721
  color: n.color ?? null
1698
1722
  };
1699
1723
  }
1700
- const Wr = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1724
+ const Yr = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1701
1725
  function Dt(n) {
1702
1726
  const s = typeof n.idle_minutes == "number" ? n.idle_minutes : n.last_active ? Math.floor((Date.now() - new Date(n.last_active).getTime()) / 6e4) : null;
1703
1727
  return s == null || s < 1 ? "Idle" : s < 60 ? `Idle · ${s}m` : `Idle · ${Math.floor(s / 60)}h ${s % 60}m`;
1704
1728
  }
1705
- function Pn(n) {
1729
+ function qn(n) {
1706
1730
  const s = n == null ? void 0 : n.trim();
1707
- return !s || Wr.test(s) ? null : s;
1731
+ return !s || Yr.test(s) ? null : s;
1708
1732
  }
1709
- function Fr(n) {
1733
+ function Zr(n) {
1710
1734
  const s = new Date(n), o = /* @__PURE__ */ new Date(), r = s.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
1711
1735
  return s.toDateString() === o.toDateString() ? r : (o.getTime() - s.getTime()) / 864e5 < 6 ? `${s.toLocaleDateString("en-US", { weekday: "short" })} ${r}` : `${s.toLocaleDateString("en-US", { month: "short", day: "numeric" })}, ${r}`;
1712
1736
  }
1713
- function zr({
1737
+ function Vr({
1714
1738
  seen: n,
1715
1739
  channelId: s,
1716
1740
  senderId: o
1717
1741
  }) {
1718
- const r = ie(), [l, i] = T(!1), { members: u } = It(l ? s : null), c = new Set(n.map((p) => String(p.user).toUpperCase())), f = u.filter((p) => {
1719
- const x = String(p.user).toUpperCase();
1720
- return x !== o.toUpperCase() && !c.has(x);
1721
- }), g = [...n].sort(
1722
- (p, x) => new Date(p.last_read_at).getTime() - new Date(x.last_read_at).getTime()
1742
+ const r = ie(), [l, i] = T(!1), { members: d } = It(l ? s : null), c = new Set(n.map((u) => String(u.user).toUpperCase())), h = d.filter((u) => {
1743
+ const p = String(u.user).toUpperCase();
1744
+ return p !== o.toUpperCase() && !c.has(p);
1745
+ }), f = [...n].sort(
1746
+ (u, p) => new Date(u.last_read_at).getTime() - new Date(p.last_read_at).getTime()
1723
1747
  );
1724
1748
  return /* @__PURE__ */ a(Ye, { open: l, onOpenChange: i, children: [
1725
1749
  /* @__PURE__ */ e(Ze, { asChild: !0, children: /* @__PURE__ */ a(
1726
1750
  "button",
1727
1751
  {
1728
1752
  type: "button",
1729
- className: b(
1753
+ className: g(
1730
1754
  "font-medium underline decoration-dotted underline-offset-2 hover:decoration-solid",
1731
1755
  r.accentText
1732
1756
  ),
@@ -1743,7 +1767,7 @@ function zr({
1743
1767
  {
1744
1768
  align: "end",
1745
1769
  sideOffset: 4,
1746
- className: b("w-[240px] p-0", r.surface),
1770
+ className: g("w-[240px] p-0", r.surface),
1747
1771
  "data-chat-seen-by-panel": !0,
1748
1772
  children: [
1749
1773
  /* @__PURE__ */ a("p", { className: "border-b border-slate-100 px-3 py-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400 dark:border-border", children: [
@@ -1751,29 +1775,29 @@ function zr({
1751
1775
  n.length
1752
1776
  ] }),
1753
1777
  /* @__PURE__ */ a("div", { className: "max-h-[260px] overflow-y-auto py-1", children: [
1754
- g.map((p) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-3 py-1.5", children: [
1755
- /* @__PURE__ */ e(V, { id: p.user, name: p.name || null, size: 22 }),
1756
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: p.name || "Someone" }),
1778
+ f.map((u) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-3 py-1.5", children: [
1779
+ /* @__PURE__ */ e(Z, { id: u.user, name: u.name || null, size: 22 }),
1780
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: u.name || "Someone" }),
1757
1781
  /* @__PURE__ */ e(
1758
1782
  "span",
1759
1783
  {
1760
1784
  className: "shrink-0 text-[10.5px] tabular-nums text-slate-400",
1761
- "data-tip": `Last read the conversation ${new Date(p.last_read_at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}`,
1762
- children: Fr(p.last_read_at)
1785
+ "data-tip": `Last read the conversation ${new Date(u.last_read_at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}`,
1786
+ children: Zr(u.last_read_at)
1763
1787
  }
1764
1788
  )
1765
- ] }, p.user)),
1766
- f.length > 0 && /* @__PURE__ */ a(Ne, { children: [
1789
+ ] }, u.user)),
1790
+ h.length > 0 && /* @__PURE__ */ a(Ce, { children: [
1767
1791
  /* @__PURE__ */ a("p", { className: "px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1768
1792
  "Not seen yet · ",
1769
- f.length
1793
+ h.length
1770
1794
  ] }),
1771
- f.map((p) => {
1772
- const x = [p.first_name, p.last_name].filter(Boolean).join(" ") || p.email || "Someone";
1795
+ h.map((u) => {
1796
+ const p = [u.first_name, u.last_name].filter(Boolean).join(" ") || u.email || "Someone";
1773
1797
  return /* @__PURE__ */ a("div", { className: "flex items-center gap-2 px-3 py-1.5 opacity-70", children: [
1774
- /* @__PURE__ */ e(V, { id: p.user, name: x, size: 22 }),
1775
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-600 dark:text-slate-300", children: x })
1776
- ] }, p.user);
1798
+ /* @__PURE__ */ e(Z, { id: u.user, name: p, size: 22 }),
1799
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-600 dark:text-slate-300", children: p })
1800
+ ] }, u.user);
1777
1801
  })
1778
1802
  ] })
1779
1803
  ] }),
@@ -1783,20 +1807,20 @@ function zr({
1783
1807
  )
1784
1808
  ] });
1785
1809
  }
1786
- function Hr({ channel: n, onLeft: s }) {
1787
- var I;
1788
- const o = ie(), r = Ae(), { isAdmin: l } = ut(), [i, u] = T(!1), { members: c, loading: f } = It(n.id), { addMember: g, removeMember: p } = Jn(n.id), [x, v] = T(""), U = Wt(x, 250), $ = ((I = r.me) == null ? void 0 : I.id.toUpperCase()) ?? "", N = l || !!$ && String(n.created_by ?? "").toUpperCase() === $, { users: _ } = jt(U, i && N && !!x.trim()), P = new Set(c.map((A) => String(A.user).toUpperCase())), R = (A) => [A.first_name, A.last_name].filter(Boolean).join(" ") || A.email || A.user, y = [...c].sort((A, F) => {
1789
- const z = String(A.user).toUpperCase(), Y = String(F.user).toUpperCase();
1790
- return z === $ ? -1 : Y === $ ? 1 : R(A).localeCompare(R(F));
1810
+ function Xr({ channel: n, onLeft: s }) {
1811
+ var B;
1812
+ const o = ie(), r = Me(), { isAdmin: l } = ut(), [i, d] = T(!1), { members: c, loading: h } = It(n.id), { addMember: f, removeMember: u } = Vn(n.id), [p, b] = T(""), U = Wt(p, 250), $ = ((B = r.me) == null ? void 0 : B.id.toUpperCase()) ?? "", C = l || !!$ && String(n.created_by ?? "").toUpperCase() === $, { users: S } = jt(U, i && C && !!p.trim()), W = new Set(c.map((R) => String(R.user).toUpperCase())), M = (R) => [R.first_name, R.last_name].filter(Boolean).join(" ") || R.email || R.user, v = [...c].sort((R, G) => {
1813
+ const H = String(R.user).toUpperCase(), V = String(G.user).toUpperCase();
1814
+ return H === $ ? -1 : V === $ ? 1 : M(R).localeCompare(M(G));
1791
1815
  });
1792
- return /* @__PURE__ */ a(Ye, { open: i, onOpenChange: u, children: [
1816
+ return /* @__PURE__ */ a(Ye, { open: i, onOpenChange: d, children: [
1793
1817
  /* @__PURE__ */ e(Ze, { asChild: !0, children: /* @__PURE__ */ a(
1794
1818
  "button",
1795
1819
  {
1796
1820
  type: "button",
1797
1821
  title: "People in this conversation",
1798
1822
  "aria-label": "People in this conversation",
1799
- className: b(
1823
+ className: g(
1800
1824
  "flex items-center gap-1 rounded-md px-1 py-1 text-[11px] font-medium tabular-nums transition-colors",
1801
1825
  i ? o.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
1802
1826
  ),
@@ -1812,86 +1836,86 @@ function Hr({ channel: n, onLeft: s }) {
1812
1836
  {
1813
1837
  align: "end",
1814
1838
  sideOffset: 6,
1815
- className: b("w-[260px] p-0", o.surface),
1839
+ className: g("w-[260px] p-0", o.surface),
1816
1840
  "data-chat-group-members-panel": !0,
1817
1841
  children: [
1818
- /* @__PURE__ */ e("div", { className: b("border-b px-3 py-2", o.divider), children: /* @__PURE__ */ a("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1842
+ /* @__PURE__ */ e("div", { className: g("border-b px-3 py-2", o.divider), children: /* @__PURE__ */ a("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
1819
1843
  "In this conversation ",
1820
1844
  c.length > 0 && `· ${c.length}`
1821
1845
  ] }) }),
1822
1846
  /* @__PURE__ */ a("div", { className: "max-h-[280px] overflow-y-auto py-1", children: [
1823
- f && /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Loading…" }),
1824
- y.map((A) => {
1825
- const F = String(A.user).toUpperCase(), z = R(A), Y = F === $, ee = String(n.created_by ?? "").toUpperCase() === F;
1847
+ h && /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Loading…" }),
1848
+ v.map((R) => {
1849
+ const G = String(R.user).toUpperCase(), H = M(R), V = G === $, se = String(n.created_by ?? "").toUpperCase() === G;
1826
1850
  return /* @__PURE__ */ a(
1827
1851
  "div",
1828
1852
  {
1829
1853
  className: "group flex items-center gap-2 px-3 py-1.5",
1830
- "data-chat-group-member": A.user,
1854
+ "data-chat-group-member": R.user,
1831
1855
  children: [
1832
- /* @__PURE__ */ e(V, { id: A.user, name: z, size: 26 }),
1856
+ /* @__PURE__ */ e(Z, { id: R.user, name: H, size: 26 }),
1833
1857
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
1834
1858
  /* @__PURE__ */ a("span", { className: "block truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
1835
- z,
1836
- Y && /* @__PURE__ */ e("span", { className: "text-slate-400", children: " (you)" })
1859
+ H,
1860
+ V && /* @__PURE__ */ e("span", { className: "text-slate-400", children: " (you)" })
1837
1861
  ] }),
1838
- ee && /* @__PURE__ */ e("span", { className: "block text-[10.5px] text-slate-400", children: "Started the group" })
1862
+ se && /* @__PURE__ */ e("span", { className: "block text-[10.5px] text-slate-400", children: "Started the group" })
1839
1863
  ] }),
1840
- N && !Y && /* @__PURE__ */ e(
1864
+ C && !V && /* @__PURE__ */ e(
1841
1865
  "button",
1842
1866
  {
1843
1867
  type: "button",
1844
- title: `Remove ${z}`,
1845
- "aria-label": `Remove ${z}`,
1846
- onClick: () => p.mutate(A.user),
1868
+ title: `Remove ${H}`,
1869
+ "aria-label": `Remove ${H}`,
1870
+ onClick: () => u.mutate(R.user),
1847
1871
  className: "rounded p-1 text-slate-400 opacity-0 transition-opacity hover:bg-slate-100 hover:text-red-500 focus:opacity-100 group-hover:opacity-100 dark:hover:bg-muted",
1848
1872
  children: /* @__PURE__ */ e(dt, { className: "h-3 w-3" })
1849
1873
  }
1850
1874
  )
1851
1875
  ]
1852
1876
  },
1853
- A.user
1877
+ R.user
1854
1878
  );
1855
1879
  })
1856
1880
  ] }),
1857
- N && /* @__PURE__ */ a("div", { className: b("border-t px-3 py-2", o.divider), children: [
1881
+ C && /* @__PURE__ */ a("div", { className: g("border-t px-3 py-2", o.divider), children: [
1858
1882
  /* @__PURE__ */ e(
1859
1883
  "input",
1860
1884
  {
1861
- value: x,
1862
- onChange: (A) => v(A.target.value),
1885
+ value: p,
1886
+ onChange: (R) => b(R.target.value),
1863
1887
  placeholder: "Add someone…",
1864
- className: b("h-7 w-full rounded-md px-2 text-[12px] outline-none", o.input),
1888
+ className: g("h-7 w-full rounded-md px-2 text-[12px] outline-none", o.input),
1865
1889
  "data-chat-group-add": !0
1866
1890
  }
1867
1891
  ),
1868
- x.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-36 overflow-y-auto", children: _.filter((A) => !P.has(String(A.id).toUpperCase())).map((A) => {
1869
- const F = [A.first_name, A.last_name].filter(Boolean).join(" ") || A.email || A.id;
1892
+ p.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-36 overflow-y-auto", children: S.filter((R) => !W.has(String(R.id).toUpperCase())).map((R) => {
1893
+ const G = [R.first_name, R.last_name].filter(Boolean).join(" ") || R.email || R.id;
1870
1894
  return /* @__PURE__ */ a(
1871
1895
  "button",
1872
1896
  {
1873
1897
  type: "button",
1874
1898
  onClick: () => {
1875
- g.mutate(A.id), v("");
1899
+ f.mutate(R.id), b("");
1876
1900
  },
1877
1901
  className: "flex w-full items-center gap-2 rounded px-1 py-1 text-left hover:bg-muted",
1878
1902
  children: [
1879
- /* @__PURE__ */ e(V, { id: A.id, name: F, size: 22 }),
1880
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: F })
1903
+ /* @__PURE__ */ e(Z, { id: R.id, name: G, size: 22 }),
1904
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700 dark:text-slate-200", children: G })
1881
1905
  ]
1882
1906
  },
1883
- A.id
1907
+ R.id
1884
1908
  );
1885
1909
  }) })
1886
1910
  ] }),
1887
- $ && P.has($) && /* @__PURE__ */ e("div", { className: b("border-t px-3 py-1.5", o.divider), children: /* @__PURE__ */ e(
1911
+ $ && W.has($) && /* @__PURE__ */ e("div", { className: g("border-t px-3 py-1.5", o.divider), children: /* @__PURE__ */ e(
1888
1912
  "button",
1889
1913
  {
1890
1914
  type: "button",
1891
1915
  onClick: () => {
1892
- p.mutate(r.me.id, {
1916
+ u.mutate(r.me.id, {
1893
1917
  onSuccess: () => {
1894
- u(!1), s();
1918
+ d(!1), s();
1895
1919
  }
1896
1920
  });
1897
1921
  },
@@ -1905,17 +1929,17 @@ function Hr({ channel: n, onLeft: s }) {
1905
1929
  )
1906
1930
  ] });
1907
1931
  }
1908
- function Gr({
1932
+ function el({
1909
1933
  channel: n,
1910
1934
  label: s,
1911
1935
  onBack: o
1912
1936
  }) {
1913
- const r = ie(), l = Ae(), { isAdmin: i } = ut(), u = Kn(), { members: c, loading: f } = It(n.id), { update: g, addMember: p, removeMember: x } = Jn(n.id), [v, U] = T(s), [$, N] = T(n.topic ?? ""), [_, P] = T(n.visibility), [R, y] = T(n.role ?? ""), [I, A] = T({
1937
+ const r = ie(), l = Me(), { isAdmin: i } = ut(), d = Zn(), { members: c, loading: h } = It(n.id), { update: f, addMember: u, removeMember: p } = Vn(n.id), [b, U] = T(s), [$, C] = T(n.topic ?? ""), [S, W] = T(n.visibility), [M, v] = T(n.role ?? ""), [B, R] = T({
1914
1938
  icon: n.icon ?? null,
1915
1939
  color: n.color ?? null
1916
- }), [F, z] = T(""), Y = Wt(F, 250), { users: ee } = jt(Y, _ === "private"), se = n.id === Yn, te = i || !se && !!l.me && String(n.created_by ?? "") === String(l.me.id), ce = new Set(c.map((d) => String(d.user).toUpperCase())), ve = v !== s || $ !== (n.topic ?? "") || _ !== n.visibility || I.icon !== (n.icon ?? null) || I.color !== (n.color ?? null) || _ === "role" && R !== (n.role ?? "");
1940
+ }), [G, H] = T(""), V = Wt(G, 250), { users: se } = jt(V, S === "private"), ee = n.id === Xn, te = i || !ee && !!l.me && String(n.created_by ?? "") === String(l.me.id), ge = new Set(c.map((A) => String(A.user).toUpperCase())), de = b !== s || $ !== (n.topic ?? "") || S !== n.visibility || B.icon !== (n.icon ?? null) || B.color !== (n.color ?? null) || S === "role" && M !== (n.role ?? "");
1917
1941
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-settings": !0, children: [
1918
- /* @__PURE__ */ a("div", { className: b("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", r.divider), children: [
1942
+ /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-2 border-b px-3 py-2.5", r.divider), children: [
1919
1943
  /* @__PURE__ */ e(
1920
1944
  "button",
1921
1945
  {
@@ -1932,21 +1956,21 @@ function Gr({
1932
1956
  ] })
1933
1957
  ] }),
1934
1958
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 space-y-4 overflow-y-auto p-3", children: [
1935
- te ? /* @__PURE__ */ a(Ne, { children: [
1959
+ te ? /* @__PURE__ */ a(Ce, { children: [
1936
1960
  /* @__PURE__ */ a("label", { className: "block", children: [
1937
1961
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Name" }),
1938
1962
  /* @__PURE__ */ e(
1939
1963
  "input",
1940
1964
  {
1941
- value: v,
1942
- onChange: (d) => U(d.target.value),
1943
- className: b("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1965
+ value: b,
1966
+ onChange: (A) => U(A.target.value),
1967
+ className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1944
1968
  }
1945
1969
  )
1946
1970
  ] }),
1947
1971
  !n.is_direct && /* @__PURE__ */ a("div", { className: "flex items-start gap-3", children: [
1948
- /* @__PURE__ */ e(Ke, { icon: I.icon, color: I.color, size: 40 }),
1949
- /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(Fn, { icon: I.icon, color: I.color, onChange: A }) })
1972
+ /* @__PURE__ */ e(Ke, { icon: B.icon, color: B.color, size: 40 }),
1973
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(Gn, { icon: B.icon, color: B.color, onChange: R }) })
1950
1974
  ] }),
1951
1975
  /* @__PURE__ */ a("label", { className: "block", children: [
1952
1976
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Topic" }),
@@ -1954,43 +1978,43 @@ function Gr({
1954
1978
  "input",
1955
1979
  {
1956
1980
  value: $,
1957
- onChange: (d) => N(d.target.value),
1981
+ onChange: (A) => C(A.target.value),
1958
1982
  placeholder: "What this channel is for",
1959
- className: b("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1983
+ className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
1960
1984
  }
1961
1985
  )
1962
1986
  ] }),
1963
- !se && /* @__PURE__ */ a("div", { children: [
1987
+ !ee && /* @__PURE__ */ a("div", { children: [
1964
1988
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Who can see it" }),
1965
1989
  /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: [
1966
1990
  ["open", "Anyone"],
1967
1991
  ["role", "One role"],
1968
1992
  ["private", "Invite only"]
1969
- ].map(([d, L]) => /* @__PURE__ */ e(
1993
+ ].map(([A, w]) => /* @__PURE__ */ e(
1970
1994
  "button",
1971
1995
  {
1972
1996
  type: "button",
1973
- onClick: () => P(d),
1974
- className: b(
1997
+ onClick: () => W(A),
1998
+ className: g(
1975
1999
  "rounded-md px-2 py-1 text-[11.5px] font-medium transition-colors",
1976
- _ === d ? r.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2000
+ S === A ? r.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
1977
2001
  ),
1978
- children: L
2002
+ children: w
1979
2003
  },
1980
- d
2004
+ A
1981
2005
  )) }),
1982
- _ === "role" && /* @__PURE__ */ e(
2006
+ S === "role" && /* @__PURE__ */ e(
1983
2007
  Ot,
1984
2008
  {
1985
- value: R,
1986
- onChange: y,
1987
- className: b(
2009
+ value: M,
2010
+ onChange: v,
2011
+ className: g(
1988
2012
  "mt-2 h-8 w-full rounded-md px-2 text-[12.5px] outline-none",
1989
2013
  r.input
1990
2014
  ),
1991
2015
  options: [
1992
2016
  { value: "", label: "Choose a role…" },
1993
- ...u.map((d) => ({ value: d.id, label: d.name }))
2017
+ ...d.map((A) => ({ value: A.id, label: A.name }))
1994
2018
  ]
1995
2019
  }
1996
2020
  )
@@ -2000,103 +2024,103 @@ function Gr({
2000
2024
  "button",
2001
2025
  {
2002
2026
  type: "button",
2003
- disabled: !ve || g.isPending || _ === "role" && !R,
2004
- onClick: () => g.mutate(
2005
- se ? {
2006
- name: v.trim() || s,
2027
+ disabled: !de || f.isPending || S === "role" && !M,
2028
+ onClick: () => f.mutate(
2029
+ ee ? {
2030
+ name: b.trim() || s,
2007
2031
  topic: $.trim() || null,
2008
- icon: I.icon,
2009
- color: I.color
2032
+ icon: B.icon,
2033
+ color: B.color
2010
2034
  } : {
2011
- name: v.trim() || s,
2035
+ name: b.trim() || s,
2012
2036
  topic: $.trim() || null,
2013
- visibility: _,
2014
- role: _ === "role" ? R : null,
2015
- icon: I.icon,
2016
- color: I.color
2037
+ visibility: S,
2038
+ role: S === "role" ? M : null,
2039
+ icon: B.icon,
2040
+ color: B.color
2017
2041
  }
2018
2042
  ),
2019
- className: b(
2043
+ className: g(
2020
2044
  "rounded-md px-2.5 py-1 text-[12px] font-medium disabled:opacity-40",
2021
2045
  r.action
2022
2046
  ),
2023
- children: g.isPending ? "Saving…" : "Save"
2047
+ children: f.isPending ? "Saving…" : "Save"
2024
2048
  }
2025
2049
  ),
2026
- se ? /* @__PURE__ */ e("span", { className: "ml-auto text-[11px] text-slate-400", children: "Open to everyone · cannot be archived" }) : /* @__PURE__ */ e(
2050
+ ee ? /* @__PURE__ */ e("span", { className: "ml-auto text-[11px] text-slate-400", children: "Open to everyone · cannot be archived" }) : /* @__PURE__ */ e(
2027
2051
  "button",
2028
2052
  {
2029
2053
  type: "button",
2030
- onClick: () => g.mutate({ is_archived: !0 }),
2054
+ onClick: () => f.mutate({ is_archived: !0 }),
2031
2055
  className: "ml-auto rounded-md px-2 py-1 text-[11.5px] font-medium text-red-500 hover:bg-red-50 dark:hover:bg-red-950/40",
2032
2056
  children: "Archive channel"
2033
2057
  }
2034
2058
  )
2035
2059
  ] }),
2036
- g.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: g.error.message }),
2037
- !n.is_direct && /* @__PURE__ */ e($s, { channel: n, th: r, isAdmin: i })
2060
+ f.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: f.error.message }),
2061
+ !n.is_direct && /* @__PURE__ */ e(Os, { channel: n, th: r, isAdmin: i })
2038
2062
  ] }) : /* @__PURE__ */ a("p", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-slate-400", children: [
2039
2063
  n.topic || "No topic set.",
2040
2064
  /* @__PURE__ */ e("br", {}),
2041
- se ? "Everyone in the portal can find and join General." : n.visibility === "private" ? "Invite only — you were added by the channel owner." : n.visibility === "role" ? "Everyone with a particular role can see this channel." : "Anyone in the portal can find and join this channel."
2065
+ ee ? "Everyone in the portal can find and join General." : n.visibility === "private" ? "Invite only — you were added by the channel owner." : n.visibility === "role" ? "Everyone with a particular role can see this channel." : "Anyone in the portal can find and join this channel."
2042
2066
  ] }),
2043
2067
  /* @__PURE__ */ a("div", { children: [
2044
2068
  /* @__PURE__ */ a("p", { className: "mb-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
2045
2069
  "Members ",
2046
2070
  c.length > 0 && `· ${c.length}`
2047
2071
  ] }),
2048
- f && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Loading…" }),
2049
- c.map((d) => {
2050
- const L = [d.first_name, d.last_name].filter(Boolean).join(" ") || d.email || d.user;
2072
+ h && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Loading…" }),
2073
+ c.map((A) => {
2074
+ const w = [A.first_name, A.last_name].filter(Boolean).join(" ") || A.email || A.user;
2051
2075
  return /* @__PURE__ */ a("div", { className: "flex items-center gap-2 rounded-lg px-1 py-1", children: [
2052
- /* @__PURE__ */ e(V, { id: d.user, name: L }),
2053
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: L }),
2076
+ /* @__PURE__ */ e(Z, { id: A.user, name: w }),
2077
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: w }),
2054
2078
  te && /* @__PURE__ */ e(
2055
2079
  "button",
2056
2080
  {
2057
2081
  type: "button",
2058
2082
  title: "Remove from channel",
2059
- onClick: () => x.mutate(d.user),
2083
+ onClick: () => p.mutate(A.user),
2060
2084
  className: "rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-red-500 dark:hover:bg-muted",
2061
2085
  children: /* @__PURE__ */ e(dt, { className: "h-3 w-3" })
2062
2086
  }
2063
2087
  )
2064
- ] }, d.user);
2088
+ ] }, A.user);
2065
2089
  }),
2066
- te && _ === "private" && /* @__PURE__ */ a("div", { className: "mt-2", children: [
2090
+ te && S === "private" && /* @__PURE__ */ a("div", { className: "mt-2", children: [
2067
2091
  /* @__PURE__ */ e(
2068
2092
  "input",
2069
2093
  {
2070
- value: F,
2071
- onChange: (d) => z(d.target.value),
2094
+ value: G,
2095
+ onChange: (A) => H(A.target.value),
2072
2096
  placeholder: "Add someone…",
2073
- className: b("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
2097
+ className: g("h-8 w-full rounded-md px-2 text-[12.5px] outline-none", r.input)
2074
2098
  }
2075
2099
  ),
2076
- F.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-40 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: ee.filter((d) => !ce.has(String(d.id).toUpperCase())).map((d) => {
2077
- const L = [d.first_name, d.last_name].filter(Boolean).join(" ") || d.email || d.id;
2100
+ G.trim() && /* @__PURE__ */ e("div", { className: "mt-1 max-h-40 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: se.filter((A) => !ge.has(String(A.id).toUpperCase())).map((A) => {
2101
+ const w = [A.first_name, A.last_name].filter(Boolean).join(" ") || A.email || A.id;
2078
2102
  return /* @__PURE__ */ a(
2079
2103
  "button",
2080
2104
  {
2081
2105
  type: "button",
2082
2106
  onClick: () => {
2083
- p.mutate(d.id), z("");
2107
+ u.mutate(A.id), H("");
2084
2108
  },
2085
2109
  className: "flex w-full items-center gap-2 px-2 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-muted/50",
2086
2110
  children: [
2087
- /* @__PURE__ */ e(V, { id: d.id, name: L }),
2088
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: L })
2111
+ /* @__PURE__ */ e(Z, { id: A.id, name: w }),
2112
+ /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: w })
2089
2113
  ]
2090
2114
  },
2091
- d.id
2115
+ A.id
2092
2116
  );
2093
2117
  }) }),
2094
2118
  /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] leading-snug text-slate-400", children: "Only members can see an invite-only channel — it is not listed to anyone else." })
2095
2119
  ] }),
2096
- te && !n.is_direct && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(Rs, { channelId: n.id, th: r }) })
2120
+ te && !n.is_direct && /* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(Ls, { channelId: n.id, th: r }) })
2097
2121
  ] }),
2098
- te && !n.is_direct && n.id !== 0 && /* @__PURE__ */ e(Us, { channelId: n.id, border: r.divider }),
2099
- !n.is_direct && /* @__PURE__ */ e(As, { channelId: n.id, th: r })
2122
+ te && !n.is_direct && n.id !== 0 && /* @__PURE__ */ e(As, { channelId: n.id, border: r.divider }),
2123
+ !n.is_direct && /* @__PURE__ */ e(Ps, { channelId: n.id, th: r })
2100
2124
  ] })
2101
2125
  ] });
2102
2126
  }
@@ -2107,7 +2131,7 @@ function Wt(n, s) {
2107
2131
  return () => clearTimeout(l);
2108
2132
  }, [n, s]), o;
2109
2133
  }
2110
- function ca(n) {
2134
+ function ma(n) {
2111
2135
  var s;
2112
2136
  return n ? n.kind === "dm" || n.kind === "entity" || n.kind === "channel" && !!((s = n.channel) != null && s.is_direct) : !1;
2113
2137
  }
@@ -2116,15 +2140,15 @@ const Nt = [
2116
2140
  { value: "unread", label: "Unread first" },
2117
2141
  { value: "alpha", label: "A–Z" }
2118
2142
  ];
2119
- function In(n) {
2143
+ function En(n) {
2120
2144
  var s;
2121
2145
  return (s = n.lastMessage) != null && s.date_created ? new Date(n.lastMessage.date_created).getTime() : 0;
2122
2146
  }
2123
- function Qr(n, s) {
2124
- const o = (i, u) => i.label.localeCompare(u.label), r = (i, u) => In(u) - In(i) || o(i, u), l = [...n];
2125
- return s === "alpha" ? l.sort(o) : s === "unread" ? l.sort((i, u) => +(u.unread > 0) - +(i.unread > 0) || r(i, u)) : l.sort(r);
2147
+ function tl(n, s) {
2148
+ const o = (i, d) => i.label.localeCompare(d.label), r = (i, d) => En(d) - En(i) || o(i, d), l = [...n];
2149
+ return s === "alpha" ? l.sort(o) : s === "unread" ? l.sort((i, d) => +(d.unread > 0) - +(i.unread > 0) || r(i, d)) : l.sort(r);
2126
2150
  }
2127
- function Kr({
2151
+ function nl({
2128
2152
  value: n,
2129
2153
  onChange: s
2130
2154
  }) {
@@ -2138,7 +2162,7 @@ function Kr({
2138
2162
  "aria-label": `Sort rooms: ${l.label}`,
2139
2163
  className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-border dark:text-slate-400 dark:hover:bg-muted",
2140
2164
  "data-chat-sort": n,
2141
- children: /* @__PURE__ */ e(es, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2165
+ children: /* @__PURE__ */ e(ss, { className: "h-3.5 w-3.5", strokeWidth: 2 })
2142
2166
  }
2143
2167
  ) }),
2144
2168
  /* @__PURE__ */ a(Ve, { align: "end", className: "w-44 p-1", children: [
@@ -2162,7 +2186,7 @@ function Kr({
2162
2186
  ] })
2163
2187
  ] });
2164
2188
  }
2165
- function jn({
2189
+ function Bn({
2166
2190
  rooms: n,
2167
2191
  onOpen: s,
2168
2192
  onNewGroup: o,
@@ -2170,50 +2194,50 @@ function jn({
2170
2194
  loading: l = !1,
2171
2195
  onView: i
2172
2196
  }) {
2173
- const u = ie(), c = Ae(), { setMuted: f, leave: g, setArchived: p, setStarred: x } = Pt(), v = Ms(), U = fe(
2197
+ const d = ie(), c = Me(), { setMuted: h, leave: f, setArchived: u, setStarred: p } = Pt(), b = Is(), U = fe(
2174
2198
  () => new Map(
2175
- c.onlineUsers.map((d) => [
2176
- String(d.user_id).toUpperCase(),
2177
- d.is_idle ? "idle" : "online"
2199
+ c.onlineUsers.map((w) => [
2200
+ String(w.user_id).toUpperCase(),
2201
+ w.is_idle ? "idle" : "online"
2178
2202
  ])
2179
2203
  ),
2180
2204
  [c.onlineUsers]
2181
- ), $ = qt(), [N, _] = T(""), P = Wt(N.trim(), 250), { hits: R, loading: y } = Es(P, v.filters), I = P.length >= 2 || v.active, A = fe(() => {
2182
- const d = /* @__PURE__ */ new Map();
2183
- for (const L of R) d.set(L.room, [...d.get(L.room) ?? [], L]);
2184
- return [...d.entries()].sort((L, m) => m[1].length - L[1].length);
2185
- }, [R]), F = n.filter((d) => d.unread > 0 && !d.muted).length, z = or(), Y = fe(() => new Map(n.map((d) => [d.room, d])), [n]), ee = Lt(), se = Qn(), te = ee.chat_sidebar_sort === "unread" || ee.chat_sidebar_sort === "alpha" ? ee.chat_sidebar_sort : "recent", ce = Qr(
2186
- P ? n.filter((d) => d.label.toLowerCase().includes(P.toLowerCase())) : n,
2187
- te
2188
- ), ve = (d) => {
2189
- var L;
2190
- return d.kind === "channel" && ((L = d.channel) == null ? void 0 : L.is_direct);
2205
+ ), $ = qt(), C = Nr(), [S, W] = T(""), M = Wt(S.trim(), 250), { hits: v, loading: B } = zs(M, b.filters), R = M.length >= 2 || b.active, G = fe(() => {
2206
+ const w = /* @__PURE__ */ new Map();
2207
+ for (const P of v) w.set(P.room, [...w.get(P.room) ?? [], P]);
2208
+ return [...w.entries()].sort((P, x) => x[1].length - P[1].length);
2209
+ }, [v]), H = n.filter((w) => w.unread > 0 && !w.muted).length, V = ur(), se = fe(() => new Map(n.map((w) => [w.room, w])), [n]), ee = Lt(), te = Yn(), ge = ee.chat_sidebar_sort === "unread" || ee.chat_sidebar_sort === "alpha" ? ee.chat_sidebar_sort : "recent", de = tl(
2210
+ M ? n.filter((w) => w.label.toLowerCase().includes(M.toLowerCase())) : n,
2211
+ ge
2212
+ ), A = (w) => {
2213
+ var P;
2214
+ return w.kind === "channel" && ((P = w.channel) == null ? void 0 : P.is_direct);
2191
2215
  };
2192
2216
  return /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", "data-chat-room-list": !0, children: [
2193
2217
  /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
2194
2218
  /* @__PURE__ */ e(
2195
2219
  "input",
2196
2220
  {
2197
- value: N,
2198
- onChange: (d) => _(d.target.value),
2221
+ value: S,
2222
+ onChange: (w) => W(w.target.value),
2199
2223
  placeholder: "Search rooms & messages…",
2200
- className: b(
2224
+ className: g(
2201
2225
  "h-7 min-w-0 flex-1 rounded-md border px-2 text-[12px] outline-none",
2202
- u.input
2226
+ d.input
2203
2227
  ),
2204
2228
  "aria-label": "Search rooms and messages",
2205
2229
  "data-chat-global-search": !0
2206
2230
  }
2207
2231
  ),
2208
- !r && /* @__PURE__ */ e(Os, { open: v.open, active: v.active, onClick: () => v.setOpen(!v.open) }),
2232
+ !r && /* @__PURE__ */ e(js, { open: b.open, active: b.active, onClick: () => b.setOpen(!b.open) }),
2209
2233
  /* @__PURE__ */ e(
2210
- Kr,
2234
+ nl,
2211
2235
  {
2212
- value: te,
2213
- onChange: (d) => se.mutate({ chat_sidebar_sort: d === "recent" ? null : d })
2236
+ value: ge,
2237
+ onChange: (w) => te.mutate({ chat_sidebar_sort: w === "recent" ? null : w })
2214
2238
  }
2215
2239
  ),
2216
- !r && /* @__PURE__ */ e(Ls, {}),
2240
+ !r && /* @__PURE__ */ e(qs, {}),
2217
2241
  o && /* @__PURE__ */ e(
2218
2242
  "button",
2219
2243
  {
@@ -2226,8 +2250,8 @@ function jn({
2226
2250
  }
2227
2251
  )
2228
2252
  ] }),
2229
- !r && v.open && /* @__PURE__ */ e(Ps, { filters: v.filters, onChange: v.setFilters, rooms: n, th: u }),
2230
- !r && i && !I && /* @__PURE__ */ a("div", { className: "mb-1 flex flex-wrap gap-1 px-1", "data-chat-view-links": !0, children: [
2253
+ !r && b.open && /* @__PURE__ */ e(Es, { filters: b.filters, onChange: b.setFilters, rooms: n, th: d }),
2254
+ !r && i && !R && /* @__PURE__ */ a("div", { className: "mb-1 flex flex-wrap gap-1 px-1", "data-chat-view-links": !0, children: [
2231
2255
  /* @__PURE__ */ a(
2232
2256
  "button",
2233
2257
  {
@@ -2236,7 +2260,7 @@ function jn({
2236
2260
  className: "inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300",
2237
2261
  "data-chat-view": "mentions",
2238
2262
  children: [
2239
- /* @__PURE__ */ e(Fa, { className: "h-3 w-3" }),
2263
+ /* @__PURE__ */ e(Qa, { className: "h-3 w-3" }),
2240
2264
  " Mentions"
2241
2265
  ]
2242
2266
  }
@@ -2249,77 +2273,77 @@ function jn({
2249
2273
  className: "inline-flex h-6 items-center gap-1 rounded-full border border-slate-200 px-2 text-[11px] text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300",
2250
2274
  "data-chat-view": "scheduled",
2251
2275
  children: [
2252
- /* @__PURE__ */ e(za, { className: "h-3 w-3" }),
2276
+ /* @__PURE__ */ e(Ka, { className: "h-3 w-3" }),
2253
2277
  " Scheduled"
2254
2278
  ]
2255
2279
  }
2256
2280
  ),
2257
- F > 1 && /* @__PURE__ */ a(
2281
+ H > 1 && /* @__PURE__ */ a(
2258
2282
  "button",
2259
2283
  {
2260
2284
  type: "button",
2261
2285
  onClick: () => i("catchup"),
2262
- className: b(
2286
+ className: g(
2263
2287
  "inline-flex h-6 items-center gap-1 rounded-full px-2 text-[11px] font-medium",
2264
- u.accentSoft
2288
+ d.accentSoft
2265
2289
  ),
2266
2290
  "data-chat-view": "catchup",
2267
2291
  children: [
2268
- /* @__PURE__ */ e(Ha, { className: "h-3 w-3" }),
2292
+ /* @__PURE__ */ e(Ja, { className: "h-3 w-3" }),
2269
2293
  " Catch up · ",
2270
- F,
2294
+ H,
2271
2295
  " rooms"
2272
2296
  ]
2273
2297
  }
2274
2298
  )
2275
2299
  ] }),
2276
- I && !r && /* @__PURE__ */ a("div", { className: "mb-1.5", "data-chat-search-results": !0, children: [
2300
+ R && !r && /* @__PURE__ */ a("div", { className: "mb-1.5", "data-chat-search-results": !0, children: [
2277
2301
  /* @__PURE__ */ a("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: [
2278
2302
  "Messages",
2279
- R.length ? ` · ${R.length}` : ""
2303
+ v.length ? ` · ${v.length}` : ""
2280
2304
  ] }),
2281
- y ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "Searching…" }) : R.length === 0 ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "No messages match." }) : A.map(([d, L]) => {
2282
- const m = Y.get(d);
2283
- return /* @__PURE__ */ a("div", { className: "mb-1", "data-chat-search-group": d, children: [
2305
+ B ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "Searching…" }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "px-2.5 py-1 text-[11px] text-slate-400", children: "No messages match." }) : G.map(([w, P]) => {
2306
+ const x = se.get(w);
2307
+ return /* @__PURE__ */ a("div", { className: "mb-1", "data-chat-search-group": w, children: [
2284
2308
  /* @__PURE__ */ a("p", { className: "flex items-center gap-1.5 px-2.5 pb-0.5 pt-1 text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: [
2285
- /* @__PURE__ */ e("span", { className: "truncate", children: (m == null ? void 0 : m.label) ?? d }),
2286
- /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 text-[10px] font-medium tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: L.length })
2309
+ /* @__PURE__ */ e("span", { className: "truncate", children: (x == null ? void 0 : x.label) ?? w }),
2310
+ /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 text-[10px] font-medium tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: P.length })
2287
2311
  ] }),
2288
- L.slice(0, 5).map((Z) => /* @__PURE__ */ a(
2312
+ P.slice(0, 5).map((j) => /* @__PURE__ */ a(
2289
2313
  "button",
2290
2314
  {
2291
2315
  type: "button",
2292
- disabled: !m,
2316
+ disabled: !x,
2293
2317
  onClick: () => {
2294
- m && s(m, { around: Z.parent_id ?? Z.id });
2318
+ x && s(x, { around: j.parent_id ?? j.id });
2295
2319
  },
2296
2320
  className: "flex w-full flex-col gap-0.5 rounded-lg px-2.5 py-1.5 text-left transition-colors hover:bg-slate-50 disabled:cursor-default dark:hover:bg-muted/50",
2297
- "data-chat-search-hit": Z.id,
2321
+ "data-chat-search-hit": j.id,
2298
2322
  children: [
2299
2323
  /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5 text-[10.5px] text-slate-400", children: [
2300
- /* @__PURE__ */ e("span", { className: "truncate", children: Z.sender_name ?? "Someone" }),
2301
- /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: new Date(Z.date_created).toLocaleDateString() })
2324
+ /* @__PURE__ */ e("span", { className: "truncate", children: j.sender_name ?? "Someone" }),
2325
+ /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: new Date(j.date_created).toLocaleDateString() })
2302
2326
  ] }),
2303
- /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] text-slate-700 dark:text-slate-200", children: Z.message })
2327
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] text-slate-700 dark:text-slate-200", children: j.message })
2304
2328
  ]
2305
2329
  },
2306
- Z.id
2330
+ j.id
2307
2331
  )),
2308
- L.length > 5 && m && /* @__PURE__ */ a(
2332
+ P.length > 5 && x && /* @__PURE__ */ a(
2309
2333
  "button",
2310
2334
  {
2311
2335
  type: "button",
2312
- onClick: () => v.setFilters({ ...v.filters, room: d }),
2313
- className: b("px-2.5 py-0.5 text-[11px] font-medium", u.accentText),
2336
+ onClick: () => b.setFilters({ ...b.filters, room: w }),
2337
+ className: g("px-2.5 py-0.5 text-[11px] font-medium", d.accentText),
2314
2338
  children: [
2315
2339
  "All ",
2316
- L.length,
2340
+ P.length,
2317
2341
  " in ",
2318
- m.label
2342
+ x.label
2319
2343
  ]
2320
2344
  }
2321
2345
  )
2322
- ] }, d);
2346
+ ] }, w);
2323
2347
  })
2324
2348
  ] }),
2325
2349
  r && !l && n.length === 0 && /* @__PURE__ */ e("p", { className: "px-3 py-6 text-center text-[12px] leading-relaxed text-slate-400", children: "Nothing archived. Archiving is just for you: the conversation leaves your chat list and stops alerting you, while everyone else in it carries on as before. Archive from a room's header or its row in your chat list; writing in it again brings it back." }),
@@ -2345,9 +2369,9 @@ function jn({
2345
2369
  /* @__PURE__ */ e(
2346
2370
  "span",
2347
2371
  {
2348
- className: b(
2372
+ className: g(
2349
2373
  "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-[13px] font-bold",
2350
- u.accentSoft
2374
+ d.accentSoft
2351
2375
  ),
2352
2376
  children: "@"
2353
2377
  }
@@ -2363,53 +2387,54 @@ function jn({
2363
2387
  }
2364
2388
  ),
2365
2389
  [
2366
- ["Starred", ce.filter((d) => d.starred)],
2390
+ ["Starred", de.filter((w) => w.starred)],
2367
2391
  [
2368
2392
  "Channels",
2369
- ce.filter(
2370
- (d) => !d.starred && (d.kind === "global" || d.kind === "channel") && !ve(d)
2393
+ de.filter(
2394
+ (w) => !w.starred && (w.kind === "global" || w.kind === "channel") && !A(w)
2371
2395
  )
2372
2396
  ],
2373
2397
  [
2374
2398
  "Direct messages",
2375
- ce.filter((d) => !d.starred && (d.kind === "dm" || ve(d)))
2399
+ de.filter((w) => !w.starred && (w.kind === "dm" || A(w)))
2376
2400
  ],
2377
- ["Records", ce.filter((d) => !d.starred && d.kind === "entity")]
2401
+ ["Records", de.filter((w) => !w.starred && w.kind === "entity")]
2378
2402
  ].map(
2379
- ([d, L]) => L.length === 0 ? null : /* @__PURE__ */ a("div", { className: "mb-1.5", children: [
2380
- /* @__PURE__ */ e("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: d }),
2381
- L.map((m) => {
2382
- var Z, H, Ce, _e, ue, Me;
2403
+ ([w, P]) => P.length === 0 ? null : /* @__PURE__ */ a("div", { className: "mb-1.5", children: [
2404
+ /* @__PURE__ */ e("p", { className: "px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400", children: w }),
2405
+ P.map((x) => {
2406
+ var j, _e, Se, ue, Oe, ve;
2383
2407
  return /* @__PURE__ */ a("div", { className: "group/room relative", children: [
2384
2408
  /* @__PURE__ */ a(
2385
2409
  "button",
2386
2410
  {
2387
2411
  type: "button",
2388
- onClick: () => s(m),
2412
+ onClick: () => s(x),
2389
2413
  className: "flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/50",
2390
2414
  children: [
2391
2415
  (() => {
2392
- const be = m.kind === "dm" && c.me ? ke(m.room, c.me.id) : null;
2393
- if (!be) return null;
2394
- const De = U.get(be.toUpperCase()) ?? "offline";
2395
- return /* @__PURE__ */ e("span", { className: "relative shrink-0", "data-chat-room-avatar": De, children: /* @__PURE__ */ e(V, { id: be, name: m.label, size: 32 }) });
2416
+ const ye = x.kind === "dm" && c.me ? we(x.room, c.me.id) : null;
2417
+ if (!ye) return null;
2418
+ const $e = U.get(ye.toUpperCase()) ?? "offline";
2419
+ return /* @__PURE__ */ e("span", { className: "relative shrink-0", "data-chat-room-avatar": $e, children: /* @__PURE__ */ e(Z, { id: ye, name: x.label, size: 32 }) });
2396
2420
  })(),
2397
- m.kind === "channel" && !((Z = m.channel) != null && Z.is_direct) || m.kind === "global" && ((H = m.channel) != null && H.icon || (Ce = m.channel) != null && Ce.color) ? /* @__PURE__ */ e(Ke, { icon: (_e = m.channel) == null ? void 0 : _e.icon, color: (ue = m.channel) == null ? void 0 : ue.color, size: 32 }) : /* @__PURE__ */ e(
2421
+ x.kind === "channel" && !((j = x.channel) != null && j.is_direct) || x.kind === "global" && ((_e = x.channel) != null && _e.icon || (Se = x.channel) != null && Se.color) ? /* @__PURE__ */ e(Ke, { icon: (ue = x.channel) == null ? void 0 : ue.icon, color: (Oe = x.channel) == null ? void 0 : Oe.color, size: 32 }) : /* @__PURE__ */ e(
2398
2422
  "span",
2399
2423
  {
2400
- className: b(
2424
+ className: g(
2401
2425
  "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400",
2402
- m.kind === "dm" && c.me && ke(m.room, c.me.id) && "hidden"
2426
+ x.kind === "dm" && c.me && we(x.room, c.me.id) && "hidden"
2403
2427
  ),
2404
- children: m.kind === "dm" ? /* @__PURE__ */ e(En, { className: "h-4 w-4", strokeWidth: 1.8 }) : (Me = m.channel) != null && Me.is_direct ? /* @__PURE__ */ e(Tt, { className: "h-4 w-4", strokeWidth: 1.8 }) : /* @__PURE__ */ e(_t, { className: "h-4 w-4", strokeWidth: 1.8 })
2428
+ children: x.kind === "dm" ? /* @__PURE__ */ e(Fn, { className: "h-4 w-4", strokeWidth: 1.8 }) : (ve = x.channel) != null && ve.is_direct ? /* @__PURE__ */ e(Tt, { className: "h-4 w-4", strokeWidth: 1.8 }) : /* @__PURE__ */ e(_t, { className: "h-4 w-4", strokeWidth: 1.8 })
2405
2429
  }
2406
2430
  ),
2407
2431
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
2408
2432
  /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5", children: [
2409
- /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: m.label }),
2410
- m.muted && /* @__PURE__ */ e(Sn, { className: "h-3 w-3 shrink-0 text-slate-300", strokeWidth: 2 }),
2411
- z.has(m.room) && /* @__PURE__ */ e(
2412
- Ga,
2433
+ /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: x.label }),
2434
+ x.muted && /* @__PURE__ */ e(Sn, { className: "h-3 w-3 shrink-0 text-slate-300", strokeWidth: 2 }),
2435
+ /* @__PURE__ */ e(vr, { count: C.countFor(x.room), label: x.label }),
2436
+ V.has(x.room) && /* @__PURE__ */ e(
2437
+ Ya,
2413
2438
  {
2414
2439
  className: "h-3 w-3 shrink-0 text-slate-400",
2415
2440
  strokeWidth: 2,
@@ -2419,30 +2444,30 @@ function jn({
2419
2444
  }
2420
2445
  )
2421
2446
  ] }),
2422
- m.lastMessage && /* @__PURE__ */ a("span", { className: "block truncate text-[11px] text-slate-400", children: [
2423
- m.lastMessage.sender_name ? `${m.lastMessage.sender_name}: ` : "",
2424
- m.lastMessage.message
2447
+ x.lastMessage && /* @__PURE__ */ a("span", { className: "block truncate text-[11px] text-slate-400", children: [
2448
+ x.lastMessage.sender_name ? `${x.lastMessage.sender_name}: ` : "",
2449
+ x.lastMessage.message
2425
2450
  ] })
2426
2451
  ] }),
2427
- (m.mentions ?? 0) > 0 && /* @__PURE__ */ e(
2452
+ (x.mentions ?? 0) > 0 && /* @__PURE__ */ e(
2428
2453
  "span",
2429
2454
  {
2430
2455
  className: "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white",
2431
- title: `${m.mentions} mention you`,
2432
- "data-chat-room-mentions": m.mentions,
2456
+ title: `${x.mentions} mention you`,
2457
+ "data-chat-room-mentions": x.mentions,
2433
2458
  children: "@"
2434
2459
  }
2435
2460
  ),
2436
- m.unread > 0 && /* @__PURE__ */ e(
2461
+ x.unread > 0 && /* @__PURE__ */ e(
2437
2462
  "span",
2438
2463
  {
2439
- className: b(
2464
+ className: g(
2440
2465
  "flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[10px] font-bold",
2441
2466
  // A muted room still counts, but quietly — it must not
2442
2467
  // read like something demanding attention.
2443
- m.muted ? "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500" : u.pill
2468
+ x.muted ? "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500" : d.pill
2444
2469
  ),
2445
- children: m.unread > 99 ? "99+" : m.unread
2470
+ children: x.unread > 99 ? "99+" : x.unread
2446
2471
  }
2447
2472
  )
2448
2473
  ]
@@ -2453,97 +2478,97 @@ function jn({
2453
2478
  "button",
2454
2479
  {
2455
2480
  type: "button",
2456
- title: m.starred ? "Unstar" : "Star — keep it at the top",
2457
- "aria-label": m.starred ? `Unstar ${m.label}` : `Star ${m.label}`,
2458
- onClick: () => x.mutate({ room: m.room, starred: !m.starred }),
2481
+ title: x.starred ? "Unstar" : "Star — keep it at the top",
2482
+ "aria-label": x.starred ? `Unstar ${x.label}` : `Star ${x.label}`,
2483
+ onClick: () => p.mutate({ room: x.room, starred: !x.starred }),
2459
2484
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2460
- "data-chat-row-star": m.starred ? "on" : "off",
2485
+ "data-chat-row-star": x.starred ? "on" : "off",
2461
2486
  children: /* @__PURE__ */ e(
2462
- Qa,
2487
+ Za,
2463
2488
  {
2464
- className: b("h-3 w-3", m.starred && "fill-amber-400 text-amber-500")
2489
+ className: g("h-3 w-3", x.starred && "fill-amber-400 text-amber-500")
2465
2490
  }
2466
2491
  )
2467
2492
  }
2468
2493
  ),
2469
- ca(m) && /* @__PURE__ */ e(
2494
+ ma(x) && /* @__PURE__ */ e(
2470
2495
  "button",
2471
2496
  {
2472
2497
  type: "button",
2473
2498
  title: r ? "Unarchive — back to your chats" : "Archive for me — hides it from my list and stops my alerts. Others in the conversation are not affected.",
2474
- "aria-label": r ? `Unarchive ${m.label}` : `Archive ${m.label} for me`,
2475
- onClick: () => p.mutate({ room: m.room, archived: !r }),
2499
+ "aria-label": r ? `Unarchive ${x.label}` : `Archive ${x.label} for me`,
2500
+ onClick: () => u.mutate({ room: x.room, archived: !r }),
2476
2501
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2477
2502
  "data-chat-row-archive": r ? "unarchive" : "archive",
2478
- children: r ? /* @__PURE__ */ e(Ka, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Ja, { className: "h-3 w-3" })
2503
+ children: r ? /* @__PURE__ */ e(Va, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Xa, { className: "h-3 w-3" })
2479
2504
  }
2480
2505
  ),
2481
2506
  /* @__PURE__ */ e(
2482
2507
  "button",
2483
2508
  {
2484
2509
  type: "button",
2485
- title: m.muted ? "Unmute" : "Mute",
2486
- onClick: () => f.mutate({ room: m.room, muted: !m.muted }),
2510
+ title: x.muted ? "Unmute" : "Mute",
2511
+ onClick: () => h.mutate({ room: x.room, muted: !x.muted }),
2487
2512
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2488
- children: m.muted ? /* @__PURE__ */ e(Ya, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Sn, { className: "h-3 w-3" })
2513
+ children: x.muted ? /* @__PURE__ */ e(es, { className: "h-3 w-3" }) : /* @__PURE__ */ e(Sn, { className: "h-3 w-3" })
2489
2514
  }
2490
2515
  ),
2491
- (m.kind === "channel" || m.kind === "global" || m.kind === "entity") && m.joined && /* @__PURE__ */ e(
2516
+ (x.kind === "channel" || x.kind === "global" || x.kind === "entity") && x.joined && /* @__PURE__ */ e(
2492
2517
  "button",
2493
2518
  {
2494
2519
  type: "button",
2495
- title: m.kind === "global" ? "Leave General" : m.kind === "entity" ? "Leave this record's chat — open it from the record again to rejoin" : "Leave channel",
2496
- "aria-label": `Leave ${m.label}`,
2520
+ title: x.kind === "global" ? "Leave General" : x.kind === "entity" ? "Leave this record's chat — open it from the record again to rejoin" : "Leave channel",
2521
+ "aria-label": `Leave ${x.label}`,
2497
2522
  "data-chat-row-leave": !0,
2498
- onClick: () => g.mutate(m.room),
2523
+ onClick: () => f.mutate(x.room),
2499
2524
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100",
2500
- children: /* @__PURE__ */ e(Za, { className: "h-3 w-3" })
2525
+ children: /* @__PURE__ */ e(ts, { className: "h-3 w-3" })
2501
2526
  }
2502
2527
  )
2503
2528
  ] })
2504
- ] }, m.room);
2529
+ ] }, x.room);
2505
2530
  })
2506
- ] }, d)
2531
+ ] }, w)
2507
2532
  )
2508
2533
  ] });
2509
2534
  }
2510
- function Hl({
2535
+ function ro({
2511
2536
  view: n,
2512
2537
  rooms: s,
2513
2538
  onBack: o,
2514
2539
  onOpen: r
2515
2540
  }) {
2516
2541
  const l = ie();
2517
- return n === "mentions" ? /* @__PURE__ */ e(zn, { th: l, onBack: o, onOpen: r }) : n === "scheduled" ? /* @__PURE__ */ e(
2518
- Hn,
2542
+ return n === "mentions" ? /* @__PURE__ */ e(Qn, { th: l, onBack: o, onOpen: r }) : n === "scheduled" ? /* @__PURE__ */ e(
2543
+ Kn,
2519
2544
  {
2520
2545
  th: l,
2521
2546
  onBack: o,
2522
2547
  roomLabel: (i) => {
2523
- var u;
2524
- return ((u = s.find((c) => c.room === i)) == null ? void 0 : u.label) ?? i;
2548
+ var d;
2549
+ return ((d = s.find((c) => c.room === i)) == null ? void 0 : d.label) ?? i;
2525
2550
  }
2526
2551
  }
2527
- ) : /* @__PURE__ */ e(Gn, { rooms: s, th: l, onBack: o, onOpen: r });
2552
+ ) : /* @__PURE__ */ e(Jn, { rooms: s, th: l, onBack: o, onOpen: r });
2528
2553
  }
2529
- function Jr({
2554
+ function al({
2530
2555
  onOpen: n
2531
2556
  }) {
2532
- const s = ie(), [o, r] = T(""), [l, i] = T(!1), [u, c] = T(""), [f, g] = T("open"), [p, x] = T(""), [v, U] = T({
2557
+ const s = ie(), [o, r] = T(""), [l, i] = T(!1), [d, c] = T(""), [h, f] = T("open"), [u, p] = T(""), [b, U] = T({
2533
2558
  icon: null,
2534
2559
  color: null
2535
- }), $ = Kn(), { channels: N, loading: _ } = js(o), { join: P } = Pt(), R = qs();
2560
+ }), $ = Zn(), { channels: C, loading: S } = Ws(o), { join: W } = Pt(), M = Fs();
2536
2561
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col", "data-chat-directory": !0, children: [
2537
2562
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2 p-2", children: [
2538
2563
  /* @__PURE__ */ a("div", { className: "relative flex-1", children: [
2539
- /* @__PURE__ */ e(qn, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
2564
+ /* @__PURE__ */ e(Wn, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
2540
2565
  /* @__PURE__ */ e(
2541
2566
  "input",
2542
2567
  {
2543
2568
  value: o,
2544
- onChange: (y) => r(y.target.value),
2569
+ onChange: (v) => r(v.target.value),
2545
2570
  placeholder: "Search channels…",
2546
- className: b("h-8 w-full rounded-md pl-8 pr-2 text-[12.5px] outline-none", s.input)
2571
+ className: g("h-8 w-full rounded-md pl-8 pr-2 text-[12.5px] outline-none", s.input)
2547
2572
  }
2548
2573
  )
2549
2574
  ] }),
@@ -2551,13 +2576,13 @@ function Jr({
2551
2576
  "button",
2552
2577
  {
2553
2578
  type: "button",
2554
- onClick: () => i((y) => !y),
2555
- className: b(
2579
+ onClick: () => i((v) => !v),
2580
+ className: g(
2556
2581
  "flex h-8 shrink-0 items-center gap-1 rounded-md px-2.5 text-[12px] font-medium",
2557
2582
  s.action
2558
2583
  ),
2559
2584
  children: [
2560
- /* @__PURE__ */ e(qa, { className: "h-3.5 w-3.5" }),
2585
+ /* @__PURE__ */ e(Wa, { className: "h-3.5 w-3.5" }),
2561
2586
  " New"
2562
2587
  ]
2563
2588
  }
@@ -2567,14 +2592,14 @@ function Jr({
2567
2592
  "form",
2568
2593
  {
2569
2594
  className: "flex flex-col gap-2 border-b border-slate-100 p-2 dark:border-border/60",
2570
- onSubmit: (y) => {
2571
- y.preventDefault(), u.trim() && (f === "role" && !p || R.mutate(
2595
+ onSubmit: (v) => {
2596
+ v.preventDefault(), d.trim() && (h === "role" && !u || M.mutate(
2572
2597
  {
2573
- name: u.trim(),
2574
- visibility: f,
2575
- role: f === "role" ? p : null,
2576
- icon: v.icon,
2577
- color: v.color
2598
+ name: d.trim(),
2599
+ visibility: h,
2600
+ role: h === "role" ? u : null,
2601
+ icon: b.icon,
2602
+ color: b.color
2578
2603
  },
2579
2604
  {
2580
2605
  onSuccess: () => {
@@ -2585,73 +2610,73 @@ function Jr({
2585
2610
  },
2586
2611
  children: [
2587
2612
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
2588
- /* @__PURE__ */ e(Ke, { icon: v.icon, color: v.color, size: 32 }),
2613
+ /* @__PURE__ */ e(Ke, { icon: b.icon, color: b.color, size: 32 }),
2589
2614
  /* @__PURE__ */ e(
2590
2615
  "input",
2591
2616
  {
2592
- value: u,
2593
- onChange: (y) => c(y.target.value),
2617
+ value: d,
2618
+ onChange: (v) => c(v.target.value),
2594
2619
  placeholder: "Channel name",
2595
- className: b(
2620
+ className: g(
2596
2621
  "h-8 min-w-0 flex-1 rounded-md px-2 text-[12.5px] outline-none",
2597
2622
  s.input
2598
2623
  )
2599
2624
  }
2600
2625
  )
2601
2626
  ] }),
2602
- /* @__PURE__ */ e(Fn, { icon: v.icon, color: v.color, onChange: U }),
2627
+ /* @__PURE__ */ e(Gn, { icon: b.icon, color: b.color, onChange: U }),
2603
2628
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
2604
2629
  [
2605
2630
  ["open", "Anyone"],
2606
2631
  ["role", "One role"],
2607
2632
  ["private", "Invite only"]
2608
- ].map(([y, I]) => /* @__PURE__ */ e(
2633
+ ].map(([v, B]) => /* @__PURE__ */ e(
2609
2634
  "button",
2610
2635
  {
2611
2636
  type: "button",
2612
- onClick: () => g(y),
2613
- className: b(
2637
+ onClick: () => f(v),
2638
+ className: g(
2614
2639
  "rounded-md px-2 py-1 text-[11.5px] font-medium transition-colors",
2615
- f === y ? s.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2640
+ h === v ? s.accentSoft : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
2616
2641
  ),
2617
- children: I
2642
+ children: B
2618
2643
  },
2619
- y
2644
+ v
2620
2645
  )),
2621
2646
  /* @__PURE__ */ e(
2622
2647
  "button",
2623
2648
  {
2624
2649
  type: "submit",
2625
- disabled: !u.trim() || R.isPending || f === "role" && !p,
2626
- className: b("ml-auto rounded-md px-2.5 py-1 text-[12px] font-medium", s.action),
2627
- children: R.isPending ? "Creating…" : "Create"
2650
+ disabled: !d.trim() || M.isPending || h === "role" && !u,
2651
+ className: g("ml-auto rounded-md px-2.5 py-1 text-[12px] font-medium", s.action),
2652
+ children: M.isPending ? "Creating…" : "Create"
2628
2653
  }
2629
2654
  )
2630
2655
  ] }),
2631
- f === "role" && /* @__PURE__ */ e(
2656
+ h === "role" && /* @__PURE__ */ e(
2632
2657
  Ot,
2633
2658
  {
2634
- value: p,
2635
- onChange: x,
2636
- className: b("h-8 w-auto rounded-md px-2 text-[12.5px] outline-none", s.input),
2659
+ value: u,
2660
+ onChange: p,
2661
+ className: g("h-8 w-auto rounded-md px-2 text-[12.5px] outline-none", s.input),
2637
2662
  options: [
2638
2663
  { value: "", label: "Choose a role…" },
2639
- ...$.map((y) => ({ value: y.id, label: y.name }))
2664
+ ...$.map((v) => ({ value: v.id, label: v.name }))
2640
2665
  ]
2641
2666
  }
2642
2667
  ),
2643
- R.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: R.error.message })
2668
+ M.isError && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-500", children: M.error.message })
2644
2669
  ]
2645
2670
  }
2646
2671
  ),
2647
2672
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [
2648
- _ && /* @__PURE__ */ e("p", { className: "px-2 py-6 text-center text-[12px] text-slate-400", children: "Loading…" }),
2649
- !_ && N.length === 0 && /* @__PURE__ */ a("div", { className: "px-3 py-8 text-center", children: [
2673
+ S && /* @__PURE__ */ e("p", { className: "px-2 py-6 text-center text-[12px] text-slate-400", children: "Loading…" }),
2674
+ !S && C.length === 0 && /* @__PURE__ */ a("div", { className: "px-3 py-8 text-center", children: [
2650
2675
  /* @__PURE__ */ e(_t, { className: "mx-auto h-5 w-5 text-slate-300" }),
2651
2676
  /* @__PURE__ */ e("p", { className: "mt-2 text-[12.5px] font-medium text-slate-600 dark:text-slate-300", children: o ? `No channel matches “${o}”` : "No channels yet" }),
2652
2677
  /* @__PURE__ */ e("p", { className: "mt-1 text-[11.5px] leading-relaxed text-slate-400", children: "Channels and General are shared rooms you join to follow. Record conversations appear on their own once someone posts on a record." })
2653
2678
  ] }),
2654
- N.map((y) => /* @__PURE__ */ a(
2679
+ C.map((v) => /* @__PURE__ */ a(
2655
2680
  "div",
2656
2681
  {
2657
2682
  className: "flex items-center gap-2.5 rounded-lg px-2.5 py-2 hover:bg-slate-50 dark:hover:bg-muted/50",
@@ -2659,21 +2684,21 @@ function Jr({
2659
2684
  /* @__PURE__ */ e(
2660
2685
  Ke,
2661
2686
  {
2662
- icon: y.icon,
2663
- color: y.color,
2687
+ icon: v.icon,
2688
+ color: v.color,
2664
2689
  size: 32,
2665
- fallback: y.visibility === "private" ? Ea : _t
2690
+ fallback: v.visibility === "private" ? Fa : _t
2666
2691
  }
2667
2692
  ),
2668
2693
  /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
2669
- /* @__PURE__ */ e("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: y.name }),
2670
- /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: y.topic || `${y.members} member${y.members === 1 ? "" : "s"}` })
2694
+ /* @__PURE__ */ e("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: v.name }),
2695
+ /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: v.topic || `${v.members} member${v.members === 1 ? "" : "s"}` })
2671
2696
  ] }),
2672
- y.joined ? /* @__PURE__ */ e(
2697
+ v.joined ? /* @__PURE__ */ e(
2673
2698
  "button",
2674
2699
  {
2675
2700
  type: "button",
2676
- onClick: () => n(y.room, y.name, Ln(y)),
2701
+ onClick: () => n(v.room, v.name, jn(v)),
2677
2702
  className: "shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium text-slate-500 hover:bg-slate-100 dark:hover:bg-muted",
2678
2703
  children: "Open"
2679
2704
  }
@@ -2681,28 +2706,28 @@ function Jr({
2681
2706
  "button",
2682
2707
  {
2683
2708
  type: "button",
2684
- onClick: () => P.mutate(y.room, {
2685
- onSuccess: () => n(y.room, y.name, Ln(y))
2709
+ onClick: () => W.mutate(v.room, {
2710
+ onSuccess: () => n(v.room, v.name, jn(v))
2686
2711
  }),
2687
- className: b("shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium", s.action),
2712
+ className: g("shrink-0 rounded-md px-2 py-1 text-[11.5px] font-medium", s.action),
2688
2713
  children: "Join"
2689
2714
  }
2690
2715
  )
2691
2716
  ]
2692
2717
  },
2693
- y.key
2718
+ v.key
2694
2719
  ))
2695
2720
  ] })
2696
2721
  ] });
2697
2722
  }
2698
- function Yr() {
2723
+ function sl() {
2699
2724
  const n = /* @__PURE__ */ new Date();
2700
2725
  return n.setHours(23, 59, 59, 999), n;
2701
2726
  }
2702
- function Zr() {
2703
- const n = Lt(), s = Qn(), [o, r] = T(!1), l = n.presence_override, i = !!l && l.mode === "away" && !(l.until && new Date(l.until).getTime() < Date.now()), u = (f) => {
2727
+ function rl() {
2728
+ const n = Lt(), s = Yn(), [o, r] = T(!1), l = n.presence_override, i = !!l && l.mode === "away" && !(l.until && new Date(l.until).getTime() < Date.now()), d = (h) => {
2704
2729
  s.mutate({
2705
- presence_override: f === "off" ? null : { mode: "away", until: (f == null ? void 0 : f.toISOString()) ?? null }
2730
+ presence_override: h === "off" ? null : { mode: "away", until: (h == null ? void 0 : h.toISOString()) ?? null }
2706
2731
  }), r(!1);
2707
2732
  }, c = i && (l != null && l.until) ? `until ${new Date(l.until).toLocaleString("en-US", {
2708
2733
  weekday: "short",
@@ -2719,7 +2744,7 @@ function Zr() {
2719
2744
  /* @__PURE__ */ e(
2720
2745
  "span",
2721
2746
  {
2722
- className: b(
2747
+ className: g(
2723
2748
  "h-2.5 w-2.5 shrink-0 rounded-full border-2",
2724
2749
  i ? "border-amber-400 bg-white dark:bg-card" : "border-emerald-400 bg-emerald-400"
2725
2750
  ),
@@ -2731,7 +2756,7 @@ function Zr() {
2731
2756
  "button",
2732
2757
  {
2733
2758
  type: "button",
2734
- onClick: () => u("off"),
2759
+ onClick: () => d("off"),
2735
2760
  className: "shrink-0 rounded px-1.5 py-0.5 text-[11px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300",
2736
2761
  "data-chat-appear-away-off": !0,
2737
2762
  children: "Back online"
@@ -2751,18 +2776,18 @@ function Zr() {
2751
2776
  [
2752
2777
  ["1 hour", () => new Date(Date.now() + 36e5)],
2753
2778
  ["4 hours", () => new Date(Date.now() + 4 * 36e5)],
2754
- ["The rest of today", Yr],
2779
+ ["The rest of today", sl],
2755
2780
  ["Until I switch it off", () => null]
2756
- ].map(([f, g]) => /* @__PURE__ */ e(
2781
+ ].map(([h, f]) => /* @__PURE__ */ e(
2757
2782
  "button",
2758
2783
  {
2759
2784
  type: "button",
2760
- onClick: () => u(g()),
2785
+ onClick: () => d(f()),
2761
2786
  className: "flex w-full rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
2762
- "data-chat-appear-away-option": f,
2763
- children: f
2787
+ "data-chat-appear-away-option": h,
2788
+ children: h
2764
2789
  },
2765
- f
2790
+ h
2766
2791
  ))
2767
2792
  ] })
2768
2793
  ] })
@@ -2770,10 +2795,10 @@ function Zr() {
2770
2795
  }
2771
2796
  );
2772
2797
  }
2773
- function Vr({ myStatus: n }) {
2798
+ function ll({ myStatus: n }) {
2774
2799
  const s = ie();
2775
2800
  return /* @__PURE__ */ e(
2776
- ws,
2801
+ Ss,
2777
2802
  {
2778
2803
  status: n ? { text: n.text, emoji: n.emoji } : null,
2779
2804
  theme: { accentSoft: s.accentSoft, input: s.input, action: s.action },
@@ -2781,9 +2806,9 @@ function Vr({ myStatus: n }) {
2781
2806
  }
2782
2807
  );
2783
2808
  }
2784
- function da() {
2785
- var l, i, u;
2786
- const n = Je(), { data: s, isFetched: o } = we({
2809
+ function pa() {
2810
+ var l, i, d;
2811
+ const n = Je(), { data: s, isFetched: o } = Ne({
2787
2812
  queryKey: ["presence-online"],
2788
2813
  queryFn: () => n.request(xe("/presence/online")),
2789
2814
  // Matches the presence heartbeat cadence — the page someone is on should
@@ -2794,27 +2819,27 @@ function da() {
2794
2819
  return {
2795
2820
  byUser: fe(() => {
2796
2821
  const c = /* @__PURE__ */ new Map();
2797
- for (const f of (s == null ? void 0 : s.data) ?? []) c.set(String(f.user_id).toUpperCase(), f);
2822
+ for (const h of (s == null ? void 0 : s.data) ?? []) c.set(String(h.user_id).toUpperCase(), h);
2798
2823
  return c;
2799
2824
  }, [s]),
2800
2825
  fields: ((l = s == null ? void 0 : s.config) == null ? void 0 : l.fields) ?? ["role", "page"],
2801
2826
  adminUrl: ((i = s == null ? void 0 : s.config) == null ? void 0 : i.admin_url) ?? null,
2802
- dimensions: ((u = s == null ? void 0 : s.config) == null ? void 0 : u.dimensions) ?? [],
2827
+ dimensions: ((d = s == null ? void 0 : s.config) == null ? void 0 : d.dimensions) ?? [],
2803
2828
  loaded: o
2804
2829
  };
2805
2830
  }
2806
- function ua(n) {
2831
+ function ha(n) {
2807
2832
  if (!n) return null;
2808
2833
  const s = n.split("/").filter(Boolean);
2809
2834
  if (s.length === 0) return "Home";
2810
2835
  const o = /* @__PURE__ */ new Set(["records", "collections", "p"]), r = s.filter((l) => !o.has(l));
2811
- return r.length === 0 ? "Home" : r.map((l, i) => i === 0 ? l.replace(/[-_]/g, " ").replace(/\b\w/g, (u) => u.toUpperCase()) : l).join(" › ");
2836
+ return r.length === 0 ? "Home" : r.map((l, i) => i === 0 ? l.replace(/[-_]/g, " ").replace(/\b\w/g, (d) => d.toUpperCase()) : l).join(" › ");
2812
2837
  }
2813
- function Xr({
2838
+ function ol({
2814
2839
  onClose: n,
2815
2840
  onCreated: s
2816
2841
  }) {
2817
- const o = ie(), [r, l] = T(""), [i, u] = T(""), [c, f] = T(/* @__PURE__ */ new Map()), { users: g } = jt(r, !0), p = ar(), x = (v) => [v.first_name, v.last_name].filter(Boolean).join(" ") || (v.email ?? "Unknown");
2842
+ const o = ie(), [r, l] = T(""), [i, d] = T(""), [c, h] = T(/* @__PURE__ */ new Map()), { users: f } = jt(r, !0), u = or(), p = (b) => [b.first_name, b.last_name].filter(Boolean).join(" ") || (b.email ?? "Unknown");
2818
2843
  return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-3", "data-chat-group-dialog": !0, children: [
2819
2844
  /* @__PURE__ */ a("div", { className: "mb-2 flex items-center gap-2", children: [
2820
2845
  /* @__PURE__ */ e(
@@ -2829,10 +2854,10 @@ function Xr({
2829
2854
  ),
2830
2855
  /* @__PURE__ */ e("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "New group conversation" })
2831
2856
  ] }),
2832
- c.size > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-1", children: [...c.entries()].map(([v, U]) => /* @__PURE__ */ a(
2857
+ c.size > 0 && /* @__PURE__ */ e("div", { className: "mb-2 flex flex-wrap gap-1", children: [...c.entries()].map(([b, U]) => /* @__PURE__ */ a(
2833
2858
  "span",
2834
2859
  {
2835
- className: b(
2860
+ className: g(
2836
2861
  "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium",
2837
2862
  o.accentSoft
2838
2863
  ),
@@ -2842,9 +2867,9 @@ function Xr({
2842
2867
  "button",
2843
2868
  {
2844
2869
  type: "button",
2845
- onClick: () => f(($) => {
2846
- const N = new Map($);
2847
- return N.delete(v), N;
2870
+ onClick: () => h(($) => {
2871
+ const C = new Map($);
2872
+ return C.delete(b), C;
2848
2873
  }),
2849
2874
  "aria-label": `Remove ${U}`,
2850
2875
  children: /* @__PURE__ */ e(dt, { className: "h-3 w-3" })
@@ -2852,49 +2877,49 @@ function Xr({
2852
2877
  )
2853
2878
  ]
2854
2879
  },
2855
- v
2880
+ b
2856
2881
  )) }),
2857
2882
  /* @__PURE__ */ e(
2858
2883
  "input",
2859
2884
  {
2860
2885
  value: r,
2861
- onChange: (v) => l(v.target.value),
2886
+ onChange: (b) => l(b.target.value),
2862
2887
  placeholder: "Find people…",
2863
- className: b("mb-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none", o.input),
2888
+ className: g("mb-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none", o.input),
2864
2889
  "aria-label": "Find people",
2865
2890
  autoFocus: !0
2866
2891
  }
2867
2892
  ),
2868
- /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto", children: g.map((v) => {
2869
- const U = c.has(v.id);
2893
+ /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto", children: f.map((b) => {
2894
+ const U = c.has(b.id);
2870
2895
  return /* @__PURE__ */ a(
2871
2896
  "button",
2872
2897
  {
2873
2898
  type: "button",
2874
- onClick: () => f(($) => {
2875
- const N = new Map($);
2876
- return U ? N.delete(v.id) : N.set(v.id, x(v)), N;
2899
+ onClick: () => h(($) => {
2900
+ const C = new Map($);
2901
+ return U ? C.delete(b.id) : C.set(b.id, p(b)), C;
2877
2902
  }),
2878
- className: b(
2903
+ className: g(
2879
2904
  "flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[12.5px] transition-colors",
2880
2905
  U ? o.accentSoft : "hover:bg-slate-50 dark:hover:bg-muted/50"
2881
2906
  ),
2882
2907
  children: [
2883
- /* @__PURE__ */ e(V, { id: v.id, name: x(v), size: 22 }),
2884
- /* @__PURE__ */ e("span", { className: "truncate", children: x(v) }),
2908
+ /* @__PURE__ */ e(Z, { id: b.id, name: p(b), size: 22 }),
2909
+ /* @__PURE__ */ e("span", { className: "truncate", children: p(b) }),
2885
2910
  U && /* @__PURE__ */ e(At, { className: "ml-auto h-3.5 w-3.5 shrink-0" })
2886
2911
  ]
2887
2912
  },
2888
- v.id
2913
+ b.id
2889
2914
  );
2890
2915
  }) }),
2891
2916
  /* @__PURE__ */ e(
2892
2917
  "input",
2893
2918
  {
2894
2919
  value: i,
2895
- onChange: (v) => u(v.target.value),
2920
+ onChange: (b) => d(b.target.value),
2896
2921
  placeholder: "Group name (optional)",
2897
- className: b(
2922
+ className: g(
2898
2923
  "mb-2 mt-1.5 h-8 rounded-md border px-2.5 text-[12.5px] outline-none",
2899
2924
  o.input
2900
2925
  ),
@@ -2905,29 +2930,29 @@ function Xr({
2905
2930
  "button",
2906
2931
  {
2907
2932
  type: "button",
2908
- disabled: c.size === 0 || p.isPending,
2909
- onClick: () => p.mutate(
2933
+ disabled: c.size === 0 || u.isPending,
2934
+ onClick: () => u.mutate(
2910
2935
  { user_ids: [...c.keys()], name: i.trim() || void 0 },
2911
- { onSuccess: (v) => s(v.room, v.name) }
2936
+ { onSuccess: (b) => s(b.room, b.name) }
2912
2937
  ),
2913
- className: b(
2938
+ className: g(
2914
2939
  "flex h-9 items-center justify-center rounded-lg text-[12.5px] font-semibold transition-[filter] hover:brightness-110 disabled:opacity-40",
2915
2940
  o.action
2916
2941
  ),
2917
- children: p.isPending ? "Creating…" : `Start conversation${c.size ? ` (${c.size + 1})` : ""}`
2942
+ children: u.isPending ? "Creating…" : `Start conversation${c.size ? ` (${c.size + 1})` : ""}`
2918
2943
  }
2919
2944
  )
2920
2945
  ] });
2921
2946
  }
2922
2947
  const $t = "nvr-chat-pinned", Ct = 400;
2923
- function el() {
2948
+ function il() {
2924
2949
  try {
2925
2950
  return typeof window < "u" && window.localStorage.getItem($t) === "1";
2926
2951
  } catch {
2927
2952
  return !1;
2928
2953
  }
2929
2954
  }
2930
- function tl() {
2955
+ function cl() {
2931
2956
  const n = "(min-width: 1024px)", [s, o] = T(
2932
2957
  () => {
2933
2958
  var r;
@@ -2942,475 +2967,489 @@ function tl() {
2942
2967
  return r.addEventListener("change", l), () => r.removeEventListener("change", l);
2943
2968
  }, []), s;
2944
2969
  }
2945
- function Gl({
2970
+ function lo({
2946
2971
  open: n,
2947
2972
  onClose: s,
2948
2973
  renderMessageBody: o,
2949
2974
  requestedDm: r,
2950
2975
  requestedRoom: l
2951
2976
  }) {
2952
- var Be;
2953
- const i = Ae(), u = ie(), c = i.me, [f, g] = T(el), p = tl(), x = f && p, v = () => {
2954
- const w = !f;
2955
- g(w);
2977
+ var $e;
2978
+ const i = Me(), d = ie(), c = i.me, [h, f] = T(il), u = cl(), p = h && u, b = () => {
2979
+ const k = !h;
2980
+ f(k);
2956
2981
  try {
2957
- w ? window.localStorage.setItem($t, "1") : window.localStorage.removeItem($t);
2982
+ k ? window.localStorage.setItem($t, "1") : window.localStorage.removeItem($t);
2958
2983
  } catch {
2959
2984
  }
2960
2985
  };
2961
2986
  ae(() => {
2962
- if (!n || !x) return;
2963
- const w = document.body, M = w.style.paddingRight;
2964
- w.style.paddingRight = `${Ct}px`, w.dataset.nvrChatPinned = "1";
2965
- const j = document.createElement("style");
2966
- return j.dataset.nvrChatPinnedStyle = "", j.textContent = `body[data-nvr-chat-pinned] [data-sonner-toaster][data-x-position="right"],
2967
- body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Ct}px; }`, document.head.appendChild(j), () => {
2968
- w.style.paddingRight = M, delete w.dataset.nvrChatPinned, j.remove();
2987
+ if (!n || !p) return;
2988
+ const k = document.body, L = k.style.paddingRight;
2989
+ k.style.paddingRight = `${Ct}px`, k.dataset.nvrChatPinned = "1";
2990
+ const q = document.createElement("style");
2991
+ return q.dataset.nvrChatPinnedStyle = "", q.textContent = `body[data-nvr-chat-pinned] [data-sonner-toaster][data-x-position="right"],
2992
+ body[data-nvr-chat-pinned] [data-nvr-dock-aware] { margin-right: ${Ct}px; }`, document.head.appendChild(q), () => {
2993
+ k.style.paddingRight = L, delete k.dataset.nvrChatPinned, q.remove();
2969
2994
  };
2970
- }, [n, x]);
2971
- const [U, $] = T("online"), [N, _] = T(null), [P, R] = T(null), y = (w, M, j) => {
2972
- const X = se.find((Se) => Se.room === w);
2973
- z(!1), _({ room: w, label: (X == null ? void 0 : X.label) ?? M, channel: X == null ? void 0 : X.channel, anchor: j });
2974
- }, [I, A] = T(!1), [F, z] = T(!1), [Y, ee] = T(null), { rooms: se, totalUnread: te } = Zn(), ce = Vn(U === "archived"), ve = (w, M, j) => {
2975
- var Se, S;
2976
- if (!M) return [{ key: "all", label: null, users: w }];
2995
+ }, [n, p]);
2996
+ const [U, $] = T("online"), [C, S] = T(null), [W, M] = T(null), v = (k, L, q) => {
2997
+ const X = ee.find((Te) => Te.room === k);
2998
+ H(!1), S({ room: k, label: (X == null ? void 0 : X.label) ?? L, channel: X == null ? void 0 : X.channel, anchor: q });
2999
+ }, [B, R] = T(!1), [G, H] = T(!1), [V, se] = T(null), { rooms: ee, totalUnread: te } = ea(), ge = ta(U === "archived"), de = (k, L, q) => {
3000
+ var Te, _;
3001
+ if (!L) return [{ key: "all", label: null, users: k }];
2977
3002
  const X = /* @__PURE__ */ new Map();
2978
- for (const E of w) {
2979
- const q = j.get(String(E.user_id).toUpperCase()), ne = M === "__role__" ? [Pn((q == null ? void 0 : q.role_name) ?? E.role_name) || "No role"] : (S = (Se = q == null ? void 0 : q.scopes_by_dimension) == null ? void 0 : Se[M]) != null && S.length ? q.scopes_by_dimension[M] : ["Unassigned"], Q = [...new Set(ne)].sort((B, K) => B.localeCompare(K)).join(", ");
2980
- X.set(Q, [...X.get(Q) ?? [], E]);
3003
+ for (const I of k) {
3004
+ const E = q.get(String(I.user_id).toUpperCase()), ne = L === "__role__" ? [qn((E == null ? void 0 : E.role_name) ?? I.role_name) || "No role"] : (_ = (Te = E == null ? void 0 : E.scopes_by_dimension) == null ? void 0 : Te[L]) != null && _.length ? E.scopes_by_dimension[L] : ["Unassigned"], K = [...new Set(ne)].sort((F, J) => F.localeCompare(J)).join(", ");
3005
+ X.set(K, [...X.get(K) ?? [], I]);
2981
3006
  }
2982
- return [...X.entries()].sort((E, q) => E[0] === "Unassigned" ? 1 : q[0] === "Unassigned" ? -1 : E[0].localeCompare(q[0])).map(([E, q]) => ({ key: E, label: E, users: q }));
2983
- }, [d, L] = T(() => typeof window > "u" ? "" : localStorage.getItem("nvr_chat_group_by") ?? ""), m = da(), Z = m.loaded ? i.onlineUsers.filter((w) => m.byUser.has(String(w.user_id).toUpperCase())) : [], H = fe(
2984
- () => ve(Z, d, m.byUser),
3007
+ return [...X.entries()].sort((I, E) => I[0] === "Unassigned" ? 1 : E[0] === "Unassigned" ? -1 : I[0].localeCompare(E[0])).map(([I, E]) => ({ key: I, label: I, users: E }));
3008
+ }, [A, w] = T(() => typeof window > "u" ? "" : localStorage.getItem("nvr_chat_group_by") ?? ""), P = pa(), x = P.loaded ? i.onlineUsers.filter((k) => P.byUser.has(String(k.user_id).toUpperCase())) : [], j = fe(
3009
+ () => de(x, A, P.byUser),
2985
3010
  // biome-ignore lint/correctness/useExhaustiveDependencies: builder is pure
2986
- [Z, d, m.byUser]
2987
- ), { isAdmin: Ce } = ut(), { navigate: _e } = fs(), ue = (w) => {
2988
- /^https?:\/\//i.test(w) ? window.open(w, "_blank", "noopener") : _e(w);
2989
- }, Me = (w) => {
2990
- c && ($("chat"), _({ room: Ut(c.id, w.user_id), label: w.display_name ?? "Direct message" }));
2991
- }, be = oe(0);
3011
+ [x, A, P.byUser]
3012
+ ), { isAdmin: _e } = ut(), { navigate: Se } = vs(), ue = (k) => {
3013
+ /^https?:\/\//i.test(k) ? window.open(k, "_blank", "noopener") : Se(k);
3014
+ }, Oe = (k) => {
3015
+ c && ($("chat"), S({ room: Ut(c.id, k.user_id), label: k.display_name ?? "Direct message" }));
3016
+ }, ve = oe(0);
2992
3017
  ae(() => {
2993
- !r || !c || r.nonce === be.current || (be.current = r.nonce, $("chat"), z(!1), _({
3018
+ !r || !c || r.nonce === ve.current || (ve.current = r.nonce, $("chat"), H(!1), S({
2994
3019
  room: Ut(c.id, r.userId),
2995
3020
  label: r.name ?? "Direct message"
2996
3021
  }));
2997
3022
  }, [r, c]);
2998
- const De = oe(0);
3023
+ const ye = oe(0);
2999
3024
  return ae(() => {
3000
- !l || l.nonce === De.current || (De.current = l.nonce, $("chat"), z(!1), _({ room: l.room, label: l.label ?? l.room }));
3001
- }, [l]), n ? /* @__PURE__ */ e(
3025
+ !l || l.nonce === ye.current || (ye.current = l.nonce, $("chat"), H(!1), S({ room: l.room, label: l.label ?? l.room }));
3026
+ }, [l]), n ? /* @__PURE__ */ a(
3002
3027
  "div",
3003
3028
  {
3004
- className: x ? (
3029
+ className: p ? (
3005
3030
  // No backdrop: the rest of the page stays usable.
3006
3031
  "pointer-events-none fixed inset-y-0 right-0 z-40"
3007
3032
  ) : "fixed inset-0 z-40 bg-black/40 animate-in fade-in duration-150",
3008
- style: x ? { width: Ct } : void 0,
3009
- onClick: x ? void 0 : s,
3033
+ style: p ? { width: Ct } : void 0,
3034
+ onClick: p ? void 0 : s,
3010
3035
  "data-chat-panel": !0,
3011
3036
  "data-nvr-recording-hide": !0,
3012
- "data-chat-pinned": x ? "1" : void 0,
3013
- children: /* @__PURE__ */ a(
3014
- "aside",
3015
- {
3016
- className: b(
3017
- "pointer-events-auto absolute right-0 top-0 flex h-full w-full flex-col border-l",
3018
- x ? "max-w-none" : "max-w-[400px] shadow-2xl animate-in slide-in-from-right duration-200",
3019
- u.surface,
3020
- "border-slate-200 dark:border-border"
3021
- ),
3022
- onClick: (w) => w.stopPropagation(),
3023
- "aria-label": "Team",
3024
- children: [
3025
- /* @__PURE__ */ a("div", { className: b("flex shrink-0 items-center gap-2 border-b px-3.5 py-2.5", u.divider), children: [
3026
- /* @__PURE__ */ e("div", { className: "flex gap-0.5 rounded-lg border border-slate-200 p-0.5 dark:border-border", children: ["online", "chat", "browse", "archived"].map((w) => /* @__PURE__ */ a(
3027
- "button",
3028
- {
3029
- type: "button",
3030
- onClick: () => $(w),
3031
- className: b(
3032
- "flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors",
3033
- U === w ? u.accentSoft : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
3034
- ),
3035
- children: [
3036
- w === "online" ? `Online · ${Z.length}` : w === "chat" ? "Chat" : w === "browse" ? "Browse" : "Archived",
3037
- w === "chat" && te > 0 && /* @__PURE__ */ e(
3038
- "span",
3039
- {
3040
- className: b(
3041
- "flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold leading-none",
3042
- u.pill
3043
- ),
3044
- title: `${te} unread`,
3045
- children: te > 99 ? "99+" : te
3046
- }
3047
- )
3048
- ]
3049
- },
3050
- w
3051
- )) }),
3052
- /* @__PURE__ */ e(
3053
- "button",
3054
- {
3055
- type: "button",
3056
- onClick: v,
3057
- "aria-pressed": f,
3058
- title: f ? "Unpin — go back to opening chat over the page" : "Pin — keep chat open beside the page while you work",
3059
- "aria-label": f ? "Unpin chat panel" : "Pin chat panel",
3060
- className: b(
3061
- "ml-auto hidden rounded-md p-1.5 transition-colors lg:flex",
3062
- f ? u.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
3063
- ),
3064
- "data-chat-pin": f ? "on" : "off",
3065
- children: f ? /* @__PURE__ */ e(Ba, { className: "h-4 w-4", strokeWidth: 2 }) : /* @__PURE__ */ e(St, { className: "h-4 w-4", strokeWidth: 2 })
3066
- }
3067
- ),
3068
- /* @__PURE__ */ e(
3069
- "button",
3070
- {
3071
- type: "button",
3072
- onClick: s,
3073
- className: "rounded-md p-1.5 text-slate-400 hover:bg-slate-100 hover:text-slate-600 max-lg:ml-auto dark:hover:bg-white/10 dark:hover:text-slate-100",
3074
- "aria-label": "Close panel",
3075
- children: /* @__PURE__ */ e(dt, { className: "h-4 w-4", strokeWidth: 2 })
3076
- }
3077
- )
3078
- ] }),
3079
- U === "online" ? /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", "data-chat-online": !0, children: [
3080
- /* @__PURE__ */ e(
3081
- Vr,
3082
- {
3083
- myStatus: c ? ((Be = m.byUser.get(String(c.id).toUpperCase())) == null ? void 0 : Be.custom_status) ?? null : null
3084
- }
3085
- ),
3086
- /* @__PURE__ */ e(Zr, {}),
3087
- /* @__PURE__ */ e(Ns, {}),
3088
- Z.length > 0 && /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
3089
- /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "Group by" }),
3090
- /* @__PURE__ */ e(
3091
- Ot,
3037
+ "data-chat-pinned": p ? "1" : void 0,
3038
+ children: [
3039
+ /* @__PURE__ */ e($n, {}),
3040
+ /* @__PURE__ */ a(
3041
+ "aside",
3042
+ {
3043
+ className: g(
3044
+ "pointer-events-auto absolute right-0 top-0 flex h-full w-full flex-col border-l",
3045
+ p ? "max-w-none" : "max-w-[400px] shadow-2xl animate-in slide-in-from-right duration-200",
3046
+ d.surface,
3047
+ "border-slate-200 dark:border-border"
3048
+ ),
3049
+ onClick: (k) => k.stopPropagation(),
3050
+ "aria-label": "Team",
3051
+ children: [
3052
+ /* @__PURE__ */ a("div", { className: g("flex shrink-0 items-center gap-2 border-b px-3.5 py-2.5", d.divider), children: [
3053
+ /* @__PURE__ */ e("div", { className: "flex gap-0.5 rounded-lg border border-slate-200 p-0.5 dark:border-border", children: ["online", "chat", "browse", "archived"].map((k) => /* @__PURE__ */ a(
3054
+ "button",
3092
3055
  {
3093
- value: d,
3094
- onChange: (w) => {
3095
- L(w);
3096
- try {
3097
- localStorage.setItem("nvr_chat_group_by", w);
3098
- } catch {
3099
- }
3100
- },
3101
- className: "h-6 w-auto rounded border-slate-200 bg-white px-1.5 py-0.5 text-[11px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300",
3102
- triggerProps: { "data-chat-group-by": "" },
3103
- options: [
3104
- { value: "", label: "No grouping" },
3105
- { value: "__role__", label: "Role" },
3106
- ...m.dimensions.map((w) => ({ value: w.name, label: w.label }))
3056
+ type: "button",
3057
+ onClick: () => $(k),
3058
+ className: g(
3059
+ "flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors",
3060
+ U === k ? d.accentSoft : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"
3061
+ ),
3062
+ children: [
3063
+ k === "online" ? `Online · ${x.length}` : k === "chat" ? "Chat" : k === "browse" ? "Browse" : "Archived",
3064
+ k === "chat" && te > 0 && /* @__PURE__ */ e(
3065
+ "span",
3066
+ {
3067
+ className: g(
3068
+ "flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[9.5px] font-bold leading-none",
3069
+ d.pill
3070
+ ),
3071
+ title: `${te} unread`,
3072
+ children: te > 99 ? "99+" : te
3073
+ }
3074
+ )
3107
3075
  ]
3076
+ },
3077
+ k
3078
+ )) }),
3079
+ /* @__PURE__ */ e(
3080
+ "button",
3081
+ {
3082
+ type: "button",
3083
+ onClick: b,
3084
+ "aria-pressed": h,
3085
+ title: h ? "Unpin — go back to opening chat over the page" : "Pin — keep chat open beside the page while you work",
3086
+ "aria-label": h ? "Unpin chat panel" : "Pin chat panel",
3087
+ className: g(
3088
+ "ml-auto hidden rounded-md p-1.5 transition-colors lg:flex",
3089
+ h ? d.accentSoft : "text-slate-400 hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-slate-100"
3090
+ ),
3091
+ "data-chat-pin": h ? "on" : "off",
3092
+ children: h ? /* @__PURE__ */ e(za, { className: "h-4 w-4", strokeWidth: 2 }) : /* @__PURE__ */ e(St, { className: "h-4 w-4", strokeWidth: 2 })
3093
+ }
3094
+ ),
3095
+ /* @__PURE__ */ e(
3096
+ "button",
3097
+ {
3098
+ type: "button",
3099
+ onClick: s,
3100
+ className: "rounded-md p-1.5 text-slate-400 hover:bg-slate-100 hover:text-slate-600 max-lg:ml-auto dark:hover:bg-white/10 dark:hover:text-slate-100",
3101
+ "aria-label": "Close panel",
3102
+ children: /* @__PURE__ */ e(dt, { className: "h-4 w-4", strokeWidth: 2 })
3108
3103
  }
3109
3104
  )
3110
3105
  ] }),
3111
- Z.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-8 text-center text-[12px] text-slate-400", children: "No one else is online right now." }) : H.map((w) => /* @__PURE__ */ a("div", { "data-chat-online-group": w.key, children: [
3112
- w.label !== null && /* @__PURE__ */ a("div", { className: "sticky top-0 z-[1] flex items-center gap-1.5 bg-white/95 px-2 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 backdrop-blur dark:bg-card/95", children: [
3113
- w.label,
3114
- /* @__PURE__ */ e("span", { className: "font-normal normal-case text-slate-300", children: w.users.length })
3115
- ] }),
3116
- w.users.map((M) => {
3117
- const j = m.byUser.get(String(M.user_id).toUpperCase()), X = (j == null ? void 0 : j.is_idle) ?? M.is_idle, Se = j ?? M;
3118
- return /* @__PURE__ */ a(
3119
- "button",
3106
+ U === "online" ? /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", "data-chat-online": !0, children: [
3107
+ /* @__PURE__ */ e(
3108
+ ll,
3109
+ {
3110
+ myStatus: c ? (($e = P.byUser.get(String(c.id).toUpperCase())) == null ? void 0 : $e.custom_status) ?? null : null
3111
+ }
3112
+ ),
3113
+ /* @__PURE__ */ e(rl, {}),
3114
+ /* @__PURE__ */ e(Ts, {}),
3115
+ x.length > 0 && /* @__PURE__ */ a("div", { className: "mb-1.5 flex items-center gap-1.5 px-1", children: [
3116
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "Group by" }),
3117
+ /* @__PURE__ */ e(
3118
+ Ot,
3120
3119
  {
3121
- type: "button",
3122
- onClick: () => Me(M),
3123
- title: "Send a direct message",
3124
- className: "flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/50",
3125
- children: [
3126
- /* @__PURE__ */ e(V, { id: M.user_id, name: M.display_name }),
3127
- /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
3128
- /* @__PURE__ */ a("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: [
3129
- M.display_name ?? "Unknown user",
3130
- X && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded-full bg-amber-500/10 px-1.5 py-px text-[10px] font-medium text-amber-700 dark:text-amber-400", children: j != null && j.away ? "Away" : Dt(Se) }),
3131
- !X && (j == null ? void 0 : j.stuck) && (() => {
3132
- const S = j.stuck, E = m.fields.includes("page"), q = Tn(
3133
- j.current_path,
3134
- j.app,
3135
- m.adminUrl,
3136
- i.recordUrl,
3137
- typeof window > "u" ? null : window.location.origin
3138
- ), ne = `${Un(S)} — at the keyboard, on the same page, nothing saved for ten minutes${q ? `
3139
- ${Dn(q)}` : ""}`, Q = Un(E ? { ...S, label: null } : S), B = "ml-1.5 rounded-full bg-orange-500/10 px-1.5 py-px text-[10px] font-medium text-orange-700 dark:text-orange-400";
3140
- return q ? (
3141
- // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3142
- /* @__PURE__ */ e(
3120
+ value: A,
3121
+ onChange: (k) => {
3122
+ w(k);
3123
+ try {
3124
+ localStorage.setItem("nvr_chat_group_by", k);
3125
+ } catch {
3126
+ }
3127
+ },
3128
+ className: "h-6 w-auto rounded border-slate-200 bg-white px-1.5 py-0.5 text-[11px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300",
3129
+ triggerProps: { "data-chat-group-by": "" },
3130
+ options: [
3131
+ { value: "", label: "No grouping" },
3132
+ { value: "__role__", label: "Role" },
3133
+ ...P.dimensions.map((k) => ({ value: k.name, label: k.label }))
3134
+ ]
3135
+ }
3136
+ )
3137
+ ] }),
3138
+ x.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-8 text-center text-[12px] text-slate-400", children: "No one else is online right now." }) : j.map((k) => /* @__PURE__ */ a("div", { "data-chat-online-group": k.key, children: [
3139
+ k.label !== null && /* @__PURE__ */ a("div", { className: "sticky top-0 z-[1] flex items-center gap-1.5 bg-white/95 px-2 py-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 backdrop-blur dark:bg-card/95", children: [
3140
+ k.label,
3141
+ /* @__PURE__ */ e("span", { className: "font-normal normal-case text-slate-300", children: k.users.length })
3142
+ ] }),
3143
+ k.users.map((L) => {
3144
+ const q = P.byUser.get(String(L.user_id).toUpperCase()), X = (q == null ? void 0 : q.is_idle) ?? L.is_idle, Te = q ?? L;
3145
+ return /* @__PURE__ */ a(
3146
+ "button",
3147
+ {
3148
+ type: "button",
3149
+ onClick: () => Oe(L),
3150
+ title: "Send a direct message",
3151
+ className: "flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/50",
3152
+ children: [
3153
+ /* @__PURE__ */ e(Z, { id: L.user_id, name: L.display_name }),
3154
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
3155
+ /* @__PURE__ */ a("span", { className: "block truncate text-[13px] font-medium text-slate-800 dark:text-slate-100", children: [
3156
+ L.display_name ?? "Unknown user",
3157
+ X && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded-full bg-amber-500/10 px-1.5 py-px text-[10px] font-medium text-amber-700 dark:text-amber-400", children: q != null && q.away ? "Away" : Dt(Te) }),
3158
+ !X && (q == null ? void 0 : q.stuck) && (() => {
3159
+ const _ = q.stuck, I = P.fields.includes("page"), E = Tn(
3160
+ q.current_path,
3161
+ q.app,
3162
+ P.adminUrl,
3163
+ i.recordUrl,
3164
+ typeof window > "u" ? null : window.location.origin
3165
+ ), ne = `${Un(_)} — at the keyboard, on the same page, nothing saved for ten minutes${E ? `
3166
+ ${Dn(E)}` : ""}`, K = Un(I ? { ..._, label: null } : _), F = "ml-1.5 rounded-full bg-orange-500/10 px-1.5 py-px text-[10px] font-medium text-orange-700 dark:text-orange-400";
3167
+ return E ? (
3168
+ // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3169
+ /* @__PURE__ */ e(
3170
+ "span",
3171
+ {
3172
+ role: "link",
3173
+ tabIndex: 0,
3174
+ className: g(F, "cursor-pointer hover:underline"),
3175
+ "data-chat-stuck": _.minutes,
3176
+ "data-tip": ne,
3177
+ "aria-label": `${K}: open the page`,
3178
+ onClick: (J) => {
3179
+ J.stopPropagation(), ue(E);
3180
+ },
3181
+ onKeyDown: (J) => {
3182
+ (J.key === "Enter" || J.key === " ") && (J.preventDefault(), J.stopPropagation(), ue(E));
3183
+ },
3184
+ children: K
3185
+ }
3186
+ )
3187
+ ) : /* @__PURE__ */ e(
3143
3188
  "span",
3144
3189
  {
3145
- role: "link",
3146
- tabIndex: 0,
3147
- className: b(B, "cursor-pointer hover:underline"),
3148
- "data-chat-stuck": S.minutes,
3190
+ className: F,
3191
+ "data-chat-stuck": _.minutes,
3149
3192
  "data-tip": ne,
3150
- "aria-label": `${Q}: open the page`,
3151
- onClick: (K) => {
3152
- K.stopPropagation(), ue(q);
3153
- },
3154
- onKeyDown: (K) => {
3155
- (K.key === "Enter" || K.key === " ") && (K.preventDefault(), K.stopPropagation(), ue(q));
3156
- },
3157
- children: Q
3193
+ children: K
3194
+ }
3195
+ );
3196
+ })(),
3197
+ (() => {
3198
+ var I;
3199
+ const _ = (I = P.byUser.get(
3200
+ String(L.user_id).toUpperCase()
3201
+ )) == null ? void 0 : I.masquerade;
3202
+ return _ ? /* @__PURE__ */ a(
3203
+ "span",
3204
+ {
3205
+ className: "ml-1.5 rounded-full bg-violet-500/10 px-1.5 py-px text-[10px] font-medium text-violet-700 dark:bg-violet-400/15 dark:text-violet-300",
3206
+ title: `${_.admin_name} is signed in as this person right now`,
3207
+ "data-chat-masquerade": _.admin_id ?? "",
3208
+ children: [
3209
+ _.admin_name,
3210
+ " masquerading"
3211
+ ]
3158
3212
  }
3159
- )
3160
- ) : /* @__PURE__ */ e(
3213
+ ) : null;
3214
+ })()
3215
+ ] }),
3216
+ (() => {
3217
+ const _ = P.byUser.get(String(L.user_id).toUpperCase()), I = _ == null ? void 0 : _.custom_status;
3218
+ return !I && !(_ != null && _.in_huddle) ? null : /* @__PURE__ */ a(
3161
3219
  "span",
3162
3220
  {
3163
- className: B,
3164
- "data-chat-stuck": S.minutes,
3165
- "data-tip": ne,
3166
- children: Q
3221
+ className: "flex items-center gap-1 truncate text-[11px] text-slate-500 dark:text-slate-400",
3222
+ "data-chat-status": !0,
3223
+ children: [
3224
+ (_ == null ? void 0 : _.in_huddle) && /* @__PURE__ */ a(
3225
+ "span",
3226
+ {
3227
+ className: "inline-flex shrink-0 items-center gap-0.5 text-nvr-navy dark:text-nvr-cyan",
3228
+ "data-chat-in-huddle": !0,
3229
+ "data-tip": "In a huddle right now",
3230
+ children: [
3231
+ /* @__PURE__ */ e(Ha, { className: "h-3 w-3", strokeWidth: 2 }),
3232
+ !I && "In a huddle"
3233
+ ]
3234
+ }
3235
+ ),
3236
+ I && /* @__PURE__ */ a("span", { className: "truncate italic", children: [
3237
+ I.emoji ? `${I.emoji} ` : "",
3238
+ I.text
3239
+ ] })
3240
+ ]
3167
3241
  }
3168
3242
  );
3169
3243
  })(),
3170
3244
  (() => {
3171
- var E;
3172
- const S = (E = m.byUser.get(
3173
- String(M.user_id).toUpperCase()
3174
- )) == null ? void 0 : E.masquerade;
3175
- return S ? /* @__PURE__ */ a(
3176
- "span",
3177
- {
3178
- className: "ml-1.5 rounded-full bg-violet-500/10 px-1.5 py-px text-[10px] font-medium text-violet-700 dark:bg-violet-400/15 dark:text-violet-300",
3179
- title: `${S.admin_name} is signed in as this person right now`,
3180
- "data-chat-masquerade": S.admin_id ?? "",
3181
- children: [
3182
- S.admin_name,
3183
- " masquerading"
3184
- ]
3245
+ const _ = P.byUser.get(String(L.user_id).toUpperCase()), I = [];
3246
+ let E = null;
3247
+ for (const K of P.fields)
3248
+ if (K === "role") {
3249
+ const F = qn((_ == null ? void 0 : _.role_name) ?? L.role_name);
3250
+ F && I.push(F);
3251
+ } else if (K === "scopes") {
3252
+ const F = ((_ == null ? void 0 : _.scopes) ?? []).join(", ");
3253
+ F && I.push(F);
3254
+ } else if (K === "page") {
3255
+ const F = (_ == null ? void 0 : _.page) ?? L.page ?? ha((_ == null ? void 0 : _.current_path) ?? L.current_path), J = (_ == null ? void 0 : _.app) ?? L.app;
3256
+ E = (J ? `${F ?? ""}${F ? " · " : ""}${J}`.trim() : F) || null;
3185
3257
  }
3186
- ) : null;
3258
+ const ne = I.join(" · ");
3259
+ return !ne && !E ? /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Online" }) : /* @__PURE__ */ a(Ce, { children: [
3260
+ ne && /* @__PURE__ */ e(
3261
+ "span",
3262
+ {
3263
+ className: "block truncate text-[11px] text-slate-400",
3264
+ "data-chat-online-meta": !0,
3265
+ title: ne,
3266
+ children: ne
3267
+ }
3268
+ ),
3269
+ E && (() => {
3270
+ const K = Tn(
3271
+ _ == null ? void 0 : _.current_path,
3272
+ _ == null ? void 0 : _.app,
3273
+ P.adminUrl,
3274
+ i.recordUrl,
3275
+ typeof window > "u" ? null : window.location.origin
3276
+ ), F = /* @__PURE__ */ a(Ce, { children: [
3277
+ /* @__PURE__ */ e(as, { className: "mt-[2px] h-3 w-3 shrink-0 text-slate-400" }),
3278
+ /* @__PURE__ */ e("span", { className: "line-clamp-2 min-w-0 break-words", children: E })
3279
+ ] });
3280
+ return K ? (
3281
+ // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3282
+ /* @__PURE__ */ e(
3283
+ "span",
3284
+ {
3285
+ role: "link",
3286
+ tabIndex: 0,
3287
+ className: "-mx-1 flex w-fit max-w-full cursor-pointer items-start gap-1 rounded px-1 text-[11px] text-slate-500 hover:bg-slate-100 hover:text-nvr-cyan hover:underline dark:text-slate-300 dark:hover:bg-muted",
3288
+ "data-chat-online-page": !0,
3289
+ "data-chat-online-page-href": K,
3290
+ "data-tip": Dn(K),
3291
+ "aria-label": `${E}: open the page`,
3292
+ onClick: (J) => {
3293
+ J.stopPropagation(), ue(K);
3294
+ },
3295
+ onKeyDown: (J) => {
3296
+ (J.key === "Enter" || J.key === " ") && (J.preventDefault(), J.stopPropagation(), ue(K));
3297
+ },
3298
+ children: F
3299
+ }
3300
+ )
3301
+ ) : /* @__PURE__ */ e(
3302
+ "span",
3303
+ {
3304
+ className: "flex items-start gap-1 text-[11px] text-slate-500 dark:text-slate-300",
3305
+ "data-chat-online-page": !0,
3306
+ "data-tip": (_ == null ? void 0 : _.current_path) ?? E,
3307
+ children: F
3308
+ }
3309
+ );
3310
+ })()
3311
+ ] });
3187
3312
  })()
3188
3313
  ] }),
3189
3314
  (() => {
3190
- var E;
3191
- const S = (E = m.byUser.get(
3192
- String(M.user_id).toUpperCase()
3193
- )) == null ? void 0 : E.custom_status;
3194
- return S ? /* @__PURE__ */ a(
3315
+ var K;
3316
+ const _ = P.byUser.get(String(L.user_id).toUpperCase());
3317
+ if (!_e || !(_ != null && _.recording_id)) return null;
3318
+ const I = ((K = P.adminUrl) == null ? void 0 : K.replace(/\/$/, "")) ?? "", E = !!I && (typeof window > "u" || new URL(I, window.location.origin).origin !== window.location.origin), ne = i.sessionUrl ? i.sessionUrl(_.recording_id, String(L.user_id)) : E ? `${I}/session-replays?recording=${_.recording_id}` : null;
3319
+ return ne ? /* @__PURE__ */ e(
3195
3320
  "span",
3196
3321
  {
3197
- className: "block truncate text-[11px] italic text-slate-500 dark:text-slate-400",
3198
- "data-chat-status": !0,
3199
- children: [
3200
- S.emoji ? `${S.emoji} ` : "",
3201
- S.text
3202
- ]
3322
+ role: "link",
3323
+ tabIndex: 0,
3324
+ title: "Watch this session",
3325
+ onClick: (F) => {
3326
+ F.stopPropagation(), ue(ne);
3327
+ },
3328
+ onKeyDown: (F) => {
3329
+ (F.key === "Enter" || F.key === " ") && (F.stopPropagation(), ue(ne));
3330
+ },
3331
+ className: "shrink-0 rounded p-1 text-slate-300 transition-colors hover:bg-slate-100 hover:text-nvr-cyan dark:hover:bg-muted",
3332
+ children: /* @__PURE__ */ e(Ga, { className: "h-4 w-4", strokeWidth: 1.8 })
3203
3333
  }
3204
3334
  ) : null;
3205
3335
  })(),
3206
- (() => {
3207
- const S = m.byUser.get(String(M.user_id).toUpperCase()), E = [];
3208
- let q = null;
3209
- for (const Q of m.fields)
3210
- if (Q === "role") {
3211
- const B = Pn((S == null ? void 0 : S.role_name) ?? M.role_name);
3212
- B && E.push(B);
3213
- } else if (Q === "scopes") {
3214
- const B = ((S == null ? void 0 : S.scopes) ?? []).join(", ");
3215
- B && E.push(B);
3216
- } else if (Q === "page") {
3217
- const B = (S == null ? void 0 : S.page) ?? M.page ?? ua((S == null ? void 0 : S.current_path) ?? M.current_path), K = (S == null ? void 0 : S.app) ?? M.app;
3218
- q = (K ? `${B ?? ""}${B ? " · " : ""}${K}`.trim() : B) || null;
3219
- }
3220
- const ne = E.join(" · ");
3221
- return !ne && !q ? /* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: "Online" }) : /* @__PURE__ */ a(Ne, { children: [
3222
- ne && /* @__PURE__ */ e(
3223
- "span",
3224
- {
3225
- className: "block truncate text-[11px] text-slate-400",
3226
- "data-chat-online-meta": !0,
3227
- title: ne,
3228
- children: ne
3229
- }
3230
- ),
3231
- q && (() => {
3232
- const Q = Tn(
3233
- S == null ? void 0 : S.current_path,
3234
- S == null ? void 0 : S.app,
3235
- m.adminUrl,
3236
- i.recordUrl,
3237
- typeof window > "u" ? null : window.location.origin
3238
- ), B = /* @__PURE__ */ a(Ne, { children: [
3239
- /* @__PURE__ */ e(Xa, { className: "mt-[2px] h-3 w-3 shrink-0 text-slate-400" }),
3240
- /* @__PURE__ */ e("span", { className: "line-clamp-2 min-w-0 break-words", children: q })
3241
- ] });
3242
- return Q ? (
3243
- // biome-ignore lint/a11y/useSemanticElements: inside the row's DM button, where a nested <a> is invalid
3244
- /* @__PURE__ */ e(
3245
- "span",
3246
- {
3247
- role: "link",
3248
- tabIndex: 0,
3249
- className: "-mx-1 flex w-fit max-w-full cursor-pointer items-start gap-1 rounded px-1 text-[11px] text-slate-500 hover:bg-slate-100 hover:text-nvr-cyan hover:underline dark:text-slate-300 dark:hover:bg-muted",
3250
- "data-chat-online-page": !0,
3251
- "data-chat-online-page-href": Q,
3252
- "data-tip": Dn(Q),
3253
- "aria-label": `${q}: open the page`,
3254
- onClick: (K) => {
3255
- K.stopPropagation(), ue(Q);
3256
- },
3257
- onKeyDown: (K) => {
3258
- (K.key === "Enter" || K.key === " ") && (K.preventDefault(), K.stopPropagation(), ue(Q));
3259
- },
3260
- children: B
3261
- }
3262
- )
3263
- ) : /* @__PURE__ */ e(
3264
- "span",
3265
- {
3266
- className: "flex items-start gap-1 text-[11px] text-slate-500 dark:text-slate-300",
3267
- "data-chat-online-page": !0,
3268
- "data-tip": (S == null ? void 0 : S.current_path) ?? q,
3269
- children: B
3270
- }
3271
- );
3272
- })()
3273
- ] });
3274
- })()
3275
- ] }),
3276
- (() => {
3277
- var Q;
3278
- const S = m.byUser.get(String(M.user_id).toUpperCase());
3279
- if (!Ce || !(S != null && S.recording_id)) return null;
3280
- const E = ((Q = m.adminUrl) == null ? void 0 : Q.replace(/\/$/, "")) ?? "", q = !!E && (typeof window > "u" || new URL(E, window.location.origin).origin !== window.location.origin), ne = i.sessionUrl ? i.sessionUrl(S.recording_id, String(M.user_id)) : q ? `${E}/session-replays?recording=${S.recording_id}` : null;
3281
- return ne ? /* @__PURE__ */ e(
3282
- "span",
3336
+ /* @__PURE__ */ e(
3337
+ Fn,
3283
3338
  {
3284
- role: "link",
3285
- tabIndex: 0,
3286
- title: "Watch this session",
3287
- onClick: (B) => {
3288
- B.stopPropagation(), ue(ne);
3289
- },
3290
- onKeyDown: (B) => {
3291
- (B.key === "Enter" || B.key === " ") && (B.stopPropagation(), ue(ne));
3292
- },
3293
- className: "shrink-0 rounded p-1 text-slate-300 transition-colors hover:bg-slate-100 hover:text-nvr-cyan dark:hover:bg-muted",
3294
- children: /* @__PURE__ */ e(Wa, { className: "h-4 w-4", strokeWidth: 1.8 })
3339
+ className: "h-4 w-4 shrink-0 text-slate-300",
3340
+ strokeWidth: 1.8
3295
3341
  }
3296
- ) : null;
3297
- })(),
3298
- /* @__PURE__ */ e(
3299
- En,
3300
- {
3301
- className: "h-4 w-4 shrink-0 text-slate-300",
3302
- strokeWidth: 1.8
3303
- }
3304
- )
3305
- ]
3306
- },
3307
- M.user_id
3308
- );
3309
- })
3310
- ] }, w.key))
3311
- ] }) : U === "archived" ? Y ? /* @__PURE__ */ e(
3312
- On,
3313
- {
3314
- room: Y.room,
3315
- label: Y.label,
3316
- onBack: () => ee(null),
3317
- renderMessageBody: o
3318
- }
3319
- ) : /* @__PURE__ */ e(
3320
- jn,
3321
- {
3322
- rooms: ce.rooms,
3323
- loading: ce.loading,
3324
- archivedView: !0,
3325
- onOpen: (w) => ee({ room: w.room, label: w.label })
3326
- }
3327
- ) : U === "browse" ? (
3328
- // The tab is checked BEFORE the open room: leaving it last meant
3329
- // switching to Browse with a conversation open kept showing that
3330
- // conversation (or its settings) under the Browse tab.
3331
- /* @__PURE__ */ e(
3332
- Jr,
3342
+ )
3343
+ ]
3344
+ },
3345
+ L.user_id
3346
+ );
3347
+ })
3348
+ ] }, k.key))
3349
+ ] }) : U === "archived" ? V ? /* @__PURE__ */ e(
3350
+ In,
3351
+ {
3352
+ room: V.room,
3353
+ label: V.label,
3354
+ onBack: () => se(null),
3355
+ renderMessageBody: o
3356
+ }
3357
+ ) : /* @__PURE__ */ e(
3358
+ Bn,
3359
+ {
3360
+ rooms: ge.rooms,
3361
+ loading: ge.loading,
3362
+ archivedView: !0,
3363
+ onOpen: (k) => se({ room: k.room, label: k.label })
3364
+ }
3365
+ ) : U === "browse" ? (
3366
+ // The tab is checked BEFORE the open room: leaving it last meant
3367
+ // switching to Browse with a conversation open kept showing that
3368
+ // conversation (or its settings) under the Browse tab.
3369
+ /* @__PURE__ */ e(
3370
+ al,
3371
+ {
3372
+ onOpen: (k, L, q) => {
3373
+ H(!1), S({ room: k, label: L, channel: q }), $("chat");
3374
+ }
3375
+ }
3376
+ )
3377
+ ) : B ? /* @__PURE__ */ e(
3378
+ ol,
3333
3379
  {
3334
- onOpen: (w, M, j) => {
3335
- z(!1), _({ room: w, label: M, channel: j }), $("chat");
3380
+ onClose: () => R(!1),
3381
+ onCreated: (k, L) => {
3382
+ R(!1), S({ room: k, label: L });
3336
3383
  }
3337
3384
  }
3338
- )
3339
- ) : I ? /* @__PURE__ */ e(
3340
- Xr,
3341
- {
3342
- onClose: () => A(!1),
3343
- onCreated: (w, M) => {
3344
- A(!1), _({ room: w, label: M });
3385
+ ) : C && G && C.channel ? /* @__PURE__ */ e(
3386
+ el,
3387
+ {
3388
+ channel: C.channel,
3389
+ label: C.label,
3390
+ onBack: () => H(!1)
3345
3391
  }
3346
- }
3347
- ) : N && F && N.channel ? /* @__PURE__ */ e(
3348
- Gr,
3349
- {
3350
- channel: N.channel,
3351
- label: N.label,
3352
- onBack: () => z(!1)
3353
- }
3354
- ) : N ? /* @__PURE__ */ e(
3355
- On,
3356
- {
3357
- room: N.room,
3358
- label: N.label,
3359
- onOpenSettings: N.channel && !N.channel.is_direct ? () => z(!0) : void 0,
3360
- onBack: () => _(null),
3361
- renderMessageBody: o,
3362
- initialUnread: N.unread,
3363
- anchor: N.anchor ?? null
3364
- }
3365
- ) : P === "mentions" ? /* @__PURE__ */ e(zn, { th: u, onBack: () => R(null), onOpen: y }) : P === "scheduled" ? /* @__PURE__ */ e(
3366
- Hn,
3367
- {
3368
- th: u,
3369
- onBack: () => R(null),
3370
- roomLabel: (w) => {
3371
- var M;
3372
- return ((M = se.find((j) => j.room === w)) == null ? void 0 : M.label) ?? w;
3392
+ ) : C ? /* @__PURE__ */ e(
3393
+ In,
3394
+ {
3395
+ room: C.room,
3396
+ label: C.label,
3397
+ onOpenSettings: C.channel && !C.channel.is_direct ? () => H(!0) : void 0,
3398
+ onBack: () => S(null),
3399
+ renderMessageBody: o,
3400
+ initialUnread: C.unread,
3401
+ anchor: C.anchor ?? null
3373
3402
  }
3374
- }
3375
- ) : P === "catchup" ? /* @__PURE__ */ e(
3376
- Gn,
3377
- {
3378
- rooms: se,
3379
- th: u,
3380
- onBack: () => R(null),
3381
- onOpen: y
3382
- }
3383
- ) : /* @__PURE__ */ e(
3384
- jn,
3385
- {
3386
- rooms: se,
3387
- onOpen: (w, M) => {
3388
- z(!1), _({
3389
- room: w.room,
3390
- label: w.label,
3391
- channel: w.channel,
3392
- unread: w.unread,
3393
- anchor: M
3394
- });
3395
- },
3396
- onNewGroup: () => A(!0),
3397
- onView: R
3398
- }
3399
- )
3400
- ]
3401
- }
3402
- )
3403
+ ) : W === "mentions" ? /* @__PURE__ */ e(Qn, { th: d, onBack: () => M(null), onOpen: v }) : W === "scheduled" ? /* @__PURE__ */ e(
3404
+ Kn,
3405
+ {
3406
+ th: d,
3407
+ onBack: () => M(null),
3408
+ roomLabel: (k) => {
3409
+ var L;
3410
+ return ((L = ee.find((q) => q.room === k)) == null ? void 0 : L.label) ?? k;
3411
+ }
3412
+ }
3413
+ ) : W === "catchup" ? /* @__PURE__ */ e(
3414
+ Jn,
3415
+ {
3416
+ rooms: ee,
3417
+ th: d,
3418
+ onBack: () => M(null),
3419
+ onOpen: v
3420
+ }
3421
+ ) : /* @__PURE__ */ e(
3422
+ Bn,
3423
+ {
3424
+ rooms: ee,
3425
+ onOpen: (k, L) => {
3426
+ H(!1), S({
3427
+ room: k.room,
3428
+ label: k.label,
3429
+ channel: k.channel,
3430
+ unread: k.unread,
3431
+ anchor: L
3432
+ });
3433
+ },
3434
+ onNewGroup: () => R(!0),
3435
+ onView: M
3436
+ }
3437
+ )
3438
+ ]
3439
+ }
3440
+ )
3441
+ ]
3403
3442
  }
3404
- ) : null;
3443
+ ) : /* @__PURE__ */ e($n, {});
3405
3444
  }
3406
3445
  export {
3407
- Zr as ChatAppearAwayRow,
3408
- Jr as ChatChannelBrowser,
3409
- Gr as ChatChannelSettings,
3410
- Gl as ChatPanel,
3411
- zl as ChatProvider,
3412
- jn as ChatRoomList,
3413
- On as ChatRoomView,
3414
- Hl as ChatSideView,
3415
- el as isChatPanelPinned
3446
+ rl as ChatAppearAwayRow,
3447
+ al as ChatChannelBrowser,
3448
+ el as ChatChannelSettings,
3449
+ lo as ChatPanel,
3450
+ so as ChatProvider,
3451
+ Bn as ChatRoomList,
3452
+ In as ChatRoomView,
3453
+ ro as ChatSideView,
3454
+ il as isChatPanelPinned
3416
3455
  };