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