@linktr.ee/messaging-react 1.40.2 → 2.0.1-rc-1778656305
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/Card-CAC3fPjy.js +107 -0
- package/dist/Card-CAC3fPjy.js.map +1 -0
- package/dist/Card-DLUBUg_w.js +132 -0
- package/dist/Card-DLUBUg_w.js.map +1 -0
- package/dist/Card-_StSlnYh.js +163 -0
- package/dist/Card-_StSlnYh.js.map +1 -0
- package/dist/LockedThumbnail-p5RsFOug.js +220 -0
- package/dist/LockedThumbnail-p5RsFOug.js.map +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/index-B1h46F9x.js +3092 -0
- package/dist/index-B1h46F9x.js.map +1 -0
- package/dist/index.d.ts +109 -30
- package/dist/index.js +14 -12
- package/package.json +2 -2
- package/src/components/ChannelInfoDialog/ChannelInfoDialog.test.tsx +2 -14
- package/src/components/ChannelInfoDialog/index.tsx +4 -8
- package/src/components/ChannelList/ChannelListContext.tsx +2 -0
- package/src/components/ChannelList/CustomChannelPreview.tsx +14 -3
- package/src/components/ChannelList/index.tsx +9 -1
- package/src/components/ChannelView.test.tsx +11 -0
- package/src/components/ChannelView.tsx +44 -33
- package/src/components/CustomMessage/index.tsx +24 -7
- package/src/components/CustomTypingIndicator/CustomTypingIndicator.stories.tsx +57 -17
- package/src/components/CustomTypingIndicator/CustomTypingIndicator.test.tsx +187 -0
- package/src/components/CustomTypingIndicator/DmAgentContext.ts +3 -0
- package/src/components/CustomTypingIndicator/index.tsx +101 -37
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +230 -89
- package/src/components/LockedAttachment/components/Composer/Card.tsx +221 -0
- package/src/components/LockedAttachment/components/Composer/index.ts +2 -0
- package/src/components/LockedAttachment/components/Received/Card.tsx +191 -0
- package/src/components/LockedAttachment/components/Received/CardActions.tsx +91 -0
- package/src/components/LockedAttachment/components/Received/index.ts +2 -0
- package/src/components/LockedAttachment/components/Sent/Card.tsx +177 -0
- package/src/components/LockedAttachment/components/Sent/index.ts +2 -0
- package/src/components/LockedAttachment/components/_shared/CardBody.tsx +94 -0
- package/src/components/LockedAttachment/components/_shared/GalleryThumbnail.tsx +178 -0
- package/src/components/LockedAttachment/components/_shared/LockBadge.tsx +39 -0
- package/src/components/LockedAttachment/components/_shared/LockedCardShell.tsx +36 -0
- package/src/components/LockedAttachment/components/_shared/LockedThumbnail.tsx +128 -0
- package/src/components/LockedAttachment/index.tsx +43 -12
- package/src/components/LockedAttachment/types.ts +17 -0
- package/src/components/MediaMessage/index.tsx +2 -2
- package/src/components/MessagingShell/index.tsx +4 -4
- package/src/index.ts +18 -2
- package/src/stories/mocks.tsx +2 -9
- package/src/styles.css +7 -0
- package/src/types.ts +11 -1
- package/src/utils/getMessageDisplayText.test.ts +44 -0
- package/src/utils/getMessageDisplayText.ts +27 -0
- package/dist/Card-A0lkei-S.js +0 -138
- package/dist/Card-A0lkei-S.js.map +0 -1
- package/dist/Card-DXoAKkv0.js +0 -127
- package/dist/Card-DXoAKkv0.js.map +0 -1
- package/dist/index-B_PLgcDi.js +0 -2994
- package/dist/index-B_PLgcDi.js.map +0 -1
- package/src/components/LockedAttachment/components/Creator/Card.tsx +0 -210
- package/src/components/LockedAttachment/components/Creator/index.tsx +0 -2
- package/src/components/LockedAttachment/components/Visitor/Card.tsx +0 -155
- package/src/components/LockedAttachment/components/Visitor/CardActions.tsx +0 -62
- package/src/components/LockedAttachment/components/Visitor/LockBadge.tsx +0 -12
- package/src/components/LockedAttachment/components/Visitor/index.ts +0 -2
|
@@ -0,0 +1,3092 @@
|
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import D from "classnames";
|
|
3
|
+
import P, { createContext as Ae, useContext as Fe, useCallback as G, useState as O, useRef as J, useEffect as q, useMemo as pe, Suspense as Oe } from "react";
|
|
4
|
+
import { StreamChatService as Gt } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Vt, ChannelList as Ht, DateSeparator as Yt, useChannelStateContext as oe, useChatContext as Pe, areMessageUIPropsEqual as qt, useMessageReminder as Wt, useComponentContext as vt, Attachment as Xt, EditMessageModal as Zt, MessageBlocked as Jt, MessageBouncePrompt as Kt, MessageDeleted as Qt, MessageIsThreadReplyInChannelButtonIndicator as es, MessageRepliesCountButton as ts, ReminderNotification as ss, StreamedMessageText as ns, messageHasAttachments as as, messageHasReactions as rs, isDateSeparatorMessage as is, isMessageBlocked as os, isMessageBounced as ls, MessageBounceModal as cs, MessageText as it, Poll as ds, MessageErrorIcon as us, useMessageContext as wt, useMessageComposer as ms, useStateStore as hs, MessageInput as fs, useMessageInputContext as gs, useMessageComposerHasSendableData as bs, SimpleAttachmentSelector as ps, QuotedMessagePreview as xs, AttachmentPreviewList as vs, TextareaComposer as ws, MessageTimestamp as Ce, AIStates as Ee, useTypingContext as ys, useAIState as _s, Channel as Ns, WithComponents as Cs, Window as Es, MessageList as Ss } from "stream-chat-react";
|
|
6
|
+
import { StarIcon as Me, GiftIcon as Is, XIcon as yt, SpinnerGapIcon as Se, SignOutIcon as ks, ProhibitInsetIcon as ot, FlagIcon as Ts, FileIcon as _t, ImageIcon as Ms, SpeakerHighIcon as Ds, VideoCameraIcon as Rs, FileMdIcon as Ls, FileTextIcon as As, FileZipIcon as Fs, FilePptIcon as Os, FileCsvIcon as Ps, FileXlsIcon as zs, FileDocIcon as Bs, FilePdfIcon as Us, CircleNotchIcon as Nt, PlayIcon as lt, PauseIcon as $s, LinkIcon as js, DownloadSimpleIcon as Gs, ThumbsUpIcon as Vs, ThumbsDownIcon as Hs, ArrowUpIcon as Ys, SparkleIcon as De, ProhibitIcon as qs, ArrowLeftIcon as ct, CaretRightIcon as dt, DotsThreeIcon as ut } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as mt } from "stream-chat";
|
|
8
|
+
const Ct = Ae({
|
|
9
|
+
service: null,
|
|
10
|
+
client: null,
|
|
11
|
+
isConnected: !1,
|
|
12
|
+
isLoading: !1,
|
|
13
|
+
error: null,
|
|
14
|
+
capabilities: {},
|
|
15
|
+
refreshConnection: async () => {
|
|
16
|
+
},
|
|
17
|
+
debug: !1
|
|
18
|
+
}), ze = () => Fe(Ct), Ca = ({
|
|
19
|
+
children: e,
|
|
20
|
+
user: s,
|
|
21
|
+
serviceConfig: n,
|
|
22
|
+
apiKey: a,
|
|
23
|
+
capabilities: o = {},
|
|
24
|
+
debug: l = !1
|
|
25
|
+
}) => {
|
|
26
|
+
const i = G(
|
|
27
|
+
(k, ...M) => {
|
|
28
|
+
l && console.log(`🔥 [MessagingProvider] ${k}`, ...M);
|
|
29
|
+
},
|
|
30
|
+
[l]
|
|
31
|
+
);
|
|
32
|
+
i("🔄 RENDER START", {
|
|
33
|
+
userId: s == null ? void 0 : s.id,
|
|
34
|
+
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
35
|
+
serviceConfig: !!n,
|
|
36
|
+
capabilities: Object.keys(o)
|
|
37
|
+
});
|
|
38
|
+
const [c, f] = O(null), [g, y] = O(null), [m, h] = O(!1), [r, b] = O(!1), [w, x] = O(null), N = J(!1), p = J({
|
|
39
|
+
userId: s == null ? void 0 : s.id,
|
|
40
|
+
apiKey: a,
|
|
41
|
+
serviceConfig: n,
|
|
42
|
+
capabilities: o
|
|
43
|
+
}), I = J(0);
|
|
44
|
+
I.current++, i("📊 RENDER INFO", {
|
|
45
|
+
renderCount: I.current,
|
|
46
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
|
|
47
|
+
propChanges: {
|
|
48
|
+
userChanged: p.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: p.current.apiKey !== a,
|
|
50
|
+
serviceConfigChanged: p.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: p.current.capabilities !== o
|
|
52
|
+
}
|
|
53
|
+
}), p.current = {
|
|
54
|
+
userId: s == null ? void 0 : s.id,
|
|
55
|
+
apiKey: a,
|
|
56
|
+
serviceConfig: n,
|
|
57
|
+
capabilities: o
|
|
58
|
+
}, q(() => {
|
|
59
|
+
const k = I.current;
|
|
60
|
+
if (i("🔧 SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
+
renderCount: k,
|
|
62
|
+
apiKey: !!a,
|
|
63
|
+
serviceConfig: !!n,
|
|
64
|
+
dependencies: {
|
|
65
|
+
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
66
|
+
serviceConfigRef: n,
|
|
67
|
+
serviceConfigStable: p.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: p.current.apiKey === a
|
|
69
|
+
}
|
|
70
|
+
}), !a || !n) {
|
|
71
|
+
i("⚠️ SERVICE INIT SKIPPED", {
|
|
72
|
+
renderCount: k,
|
|
73
|
+
reason: "Missing apiKey or serviceConfig"
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
i("🚀 CREATING NEW SERVICE", {
|
|
78
|
+
renderCount: k,
|
|
79
|
+
apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
|
|
80
|
+
serviceConfigChanged: p.current.serviceConfig !== n
|
|
81
|
+
});
|
|
82
|
+
const M = new Gt({
|
|
83
|
+
...n,
|
|
84
|
+
apiKey: a,
|
|
85
|
+
debug: l
|
|
86
|
+
});
|
|
87
|
+
return f(M), i("✅ SERVICE SET", {
|
|
88
|
+
renderCount: k,
|
|
89
|
+
serviceInstance: !!M
|
|
90
|
+
}), () => {
|
|
91
|
+
i("🧹 SERVICE CLEANUP", {
|
|
92
|
+
renderCount: k,
|
|
93
|
+
reason: "Effect cleanup"
|
|
94
|
+
}), M.disconnectUser().catch(console.error);
|
|
95
|
+
};
|
|
96
|
+
}, [a, n, l, i]);
|
|
97
|
+
const S = J(null);
|
|
98
|
+
q(() => {
|
|
99
|
+
var M, j;
|
|
100
|
+
if (i("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
+
hasService: !!c,
|
|
102
|
+
hasUser: !!s,
|
|
103
|
+
userId: s == null ? void 0 : s.id,
|
|
104
|
+
isConnecting: N.current,
|
|
105
|
+
isConnected: m,
|
|
106
|
+
dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !c || !s) {
|
|
108
|
+
i("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (N.current) {
|
|
112
|
+
i("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (((M = S.current) == null ? void 0 : M.serviceId) === c && ((j = S.current) == null ? void 0 : j.userId) === s.id) {
|
|
116
|
+
i(
|
|
117
|
+
"⚠️ USER CONNECTION SKIPPED",
|
|
118
|
+
"Already connected this user with this service"
|
|
119
|
+
);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
(async () => {
|
|
123
|
+
i("🚀 STARTING USER CONNECTION", { userId: s.id }), N.current = !0, b(!0), x(null);
|
|
124
|
+
try {
|
|
125
|
+
i("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const _ = await c.connectUser(s);
|
|
127
|
+
y(_), h(!0), S.current = { serviceId: c, userId: s.id }, i("✅ USER CONNECTION SUCCESS", {
|
|
128
|
+
userId: s.id,
|
|
129
|
+
clientId: _.userID
|
|
130
|
+
});
|
|
131
|
+
} catch (_) {
|
|
132
|
+
const L = _ instanceof Error ? _.message : "Connection failed";
|
|
133
|
+
x(L), i("❌ USER CONNECTION ERROR", {
|
|
134
|
+
userId: s.id,
|
|
135
|
+
error: L
|
|
136
|
+
});
|
|
137
|
+
} finally {
|
|
138
|
+
b(!1), N.current = !1, i("🔄 USER CONNECTION FINISHED", {
|
|
139
|
+
userId: s.id,
|
|
140
|
+
isConnected: m
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
})();
|
|
144
|
+
}, [c, s, i, m]), q(() => (i("🔌 CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!c,
|
|
146
|
+
isConnected: m
|
|
147
|
+
}), () => {
|
|
148
|
+
c && m ? (i(
|
|
149
|
+
"🧹 CLEANUP EFFECT TRIGGERED",
|
|
150
|
+
"Cleaning up connection on unmount"
|
|
151
|
+
), S.current = null, c.disconnectUser().catch(console.error)) : i("🔇 CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!c,
|
|
153
|
+
isConnected: m
|
|
154
|
+
});
|
|
155
|
+
}), [c, m, i]);
|
|
156
|
+
const T = G(async () => {
|
|
157
|
+
if (i("🔄 REFRESH CONNECTION CALLED", {
|
|
158
|
+
hasService: !!c,
|
|
159
|
+
hasUser: !!s
|
|
160
|
+
}), !c || !s) {
|
|
161
|
+
i("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
i("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
|
|
165
|
+
try {
|
|
166
|
+
i("🔌 DISCONNECTING FOR REFRESH"), await c.disconnectUser(), i("📞 RECONNECTING FOR REFRESH");
|
|
167
|
+
const k = await c.connectUser(s);
|
|
168
|
+
y(k), h(!0), x(null), i("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (k) {
|
|
170
|
+
const M = k instanceof Error ? k.message : "Refresh failed";
|
|
171
|
+
x(M), i("❌ CONNECTION REFRESH ERROR", {
|
|
172
|
+
userId: s.id,
|
|
173
|
+
error: M
|
|
174
|
+
});
|
|
175
|
+
} finally {
|
|
176
|
+
b(!1), i("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
|
+
}
|
|
178
|
+
}, [c, s, i]), $ = P.useMemo(() => (i("💫 CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!c,
|
|
180
|
+
hasClient: !!g,
|
|
181
|
+
isConnected: m,
|
|
182
|
+
isLoading: r,
|
|
183
|
+
hasError: !!w,
|
|
184
|
+
capabilitiesKeys: Object.keys(o)
|
|
185
|
+
}), {
|
|
186
|
+
service: c,
|
|
187
|
+
client: g,
|
|
188
|
+
isConnected: m,
|
|
189
|
+
isLoading: r,
|
|
190
|
+
error: w,
|
|
191
|
+
capabilities: o,
|
|
192
|
+
refreshConnection: T,
|
|
193
|
+
debug: l
|
|
194
|
+
}), [
|
|
195
|
+
c,
|
|
196
|
+
g,
|
|
197
|
+
m,
|
|
198
|
+
r,
|
|
199
|
+
w,
|
|
200
|
+
o,
|
|
201
|
+
T,
|
|
202
|
+
l,
|
|
203
|
+
i
|
|
204
|
+
]);
|
|
205
|
+
return i("🔄 RENDER END", {
|
|
206
|
+
renderCount: I.current,
|
|
207
|
+
willRenderChat: !!(g && m),
|
|
208
|
+
contextValueReady: !!$
|
|
209
|
+
}), /* @__PURE__ */ t(Ct.Provider, { value: $, children: g && m ? /* @__PURE__ */ t(
|
|
210
|
+
Vt,
|
|
211
|
+
{
|
|
212
|
+
client: g,
|
|
213
|
+
customClasses: {
|
|
214
|
+
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
|
+
},
|
|
216
|
+
children: e
|
|
217
|
+
}
|
|
218
|
+
) : e });
|
|
219
|
+
}, Ws = () => ze();
|
|
220
|
+
function Xs(e) {
|
|
221
|
+
const s = e.state.pending_messages;
|
|
222
|
+
if (s != null && s.length)
|
|
223
|
+
for (const n of s)
|
|
224
|
+
e.state.addMessageSorted(n.message);
|
|
225
|
+
}
|
|
226
|
+
const Et = P.createContext({
|
|
227
|
+
selectedChannel: void 0,
|
|
228
|
+
onChannelSelect: () => {
|
|
229
|
+
},
|
|
230
|
+
debug: !1,
|
|
231
|
+
renderMessagePreview: void 0,
|
|
232
|
+
viewerLanguage: void 0
|
|
233
|
+
}), Zs = Et.Provider, Js = () => P.useContext(Et), St = (e) => {
|
|
234
|
+
var a, o;
|
|
235
|
+
const [s, n] = O(
|
|
236
|
+
!!((o = (a = e == null ? void 0 : e.state) == null ? void 0 : a.membership) != null && o.pinned_at)
|
|
237
|
+
);
|
|
238
|
+
return q(() => {
|
|
239
|
+
var i;
|
|
240
|
+
if (!e) {
|
|
241
|
+
n(!1);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
n(!!((i = e.state.membership) != null && i.pinned_at));
|
|
245
|
+
const l = (c) => {
|
|
246
|
+
var f;
|
|
247
|
+
n(
|
|
248
|
+
c != null && c.member ? !!c.member.pinned_at : !!((f = e.state.membership) != null && f.pinned_at)
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
return e.on("member.updated", l), () => {
|
|
252
|
+
e.off("member.updated", l);
|
|
253
|
+
};
|
|
254
|
+
}, [e]), s;
|
|
255
|
+
}, Ks = (e, s) => {
|
|
256
|
+
const n = new Date(
|
|
257
|
+
Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate())
|
|
258
|
+
), o = new Date(
|
|
259
|
+
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
260
|
+
).getTime() - n.getTime();
|
|
261
|
+
return Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
262
|
+
}, Qs = (e) => {
|
|
263
|
+
const s = /* @__PURE__ */ new Date();
|
|
264
|
+
if (Math.floor((s.getTime() - e.getTime()) / 1e3) < 60)
|
|
265
|
+
return "Just now";
|
|
266
|
+
const a = Ks(e, s);
|
|
267
|
+
return a === 0 ? e.toLocaleTimeString([], {
|
|
268
|
+
hour: "numeric",
|
|
269
|
+
minute: "2-digit",
|
|
270
|
+
hour12: !0
|
|
271
|
+
}) : a === 1 ? "Yesterday" : a < 7 ? `${a}d` : a < 28 ? `${Math.floor(a / 7)}w` : e.toLocaleDateString("en-US", {
|
|
272
|
+
month: "numeric",
|
|
273
|
+
day: "numeric",
|
|
274
|
+
year: "2-digit"
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
function en(e) {
|
|
278
|
+
return (e == null ? void 0 : e.trim().toLowerCase().split(/[-_]/)[0]) || void 0;
|
|
279
|
+
}
|
|
280
|
+
function It({
|
|
281
|
+
message: e,
|
|
282
|
+
viewerLanguage: s
|
|
283
|
+
}) {
|
|
284
|
+
var o;
|
|
285
|
+
const n = e == null ? void 0 : e.text, a = en(s);
|
|
286
|
+
return a ? ((o = e == null ? void 0 : e.i18n) == null ? void 0 : o[`${a}_text`]) ?? n : n;
|
|
287
|
+
}
|
|
288
|
+
const ht = [
|
|
289
|
+
"🍎",
|
|
290
|
+
// Apple
|
|
291
|
+
"🍌",
|
|
292
|
+
// Banana
|
|
293
|
+
"🍇",
|
|
294
|
+
// Grape
|
|
295
|
+
"🍊",
|
|
296
|
+
// Orange
|
|
297
|
+
"🍓",
|
|
298
|
+
// Strawberry
|
|
299
|
+
"🥥",
|
|
300
|
+
// Coconut
|
|
301
|
+
"🍒",
|
|
302
|
+
// Cherry
|
|
303
|
+
"🥭",
|
|
304
|
+
// Mango
|
|
305
|
+
"🍉",
|
|
306
|
+
// Watermelon
|
|
307
|
+
"🍋",
|
|
308
|
+
// Lemon
|
|
309
|
+
"🥝",
|
|
310
|
+
// Kiwi
|
|
311
|
+
"🫒",
|
|
312
|
+
// Olive
|
|
313
|
+
"🍈"
|
|
314
|
+
// Melon
|
|
315
|
+
];
|
|
316
|
+
function tn(e) {
|
|
317
|
+
let s = 0;
|
|
318
|
+
for (let n = 0; n < e.length; n++) {
|
|
319
|
+
const a = e.charCodeAt(n);
|
|
320
|
+
s = (s << 5) - s + a, s = s & s;
|
|
321
|
+
}
|
|
322
|
+
return Math.abs(s);
|
|
323
|
+
}
|
|
324
|
+
function sn(e) {
|
|
325
|
+
const n = tn(e) % ht.length;
|
|
326
|
+
return ht[n];
|
|
327
|
+
}
|
|
328
|
+
const ae = ({
|
|
329
|
+
id: e,
|
|
330
|
+
image: s,
|
|
331
|
+
size: n = 40,
|
|
332
|
+
className: a,
|
|
333
|
+
starred: o = !1,
|
|
334
|
+
shape: l = "squircle",
|
|
335
|
+
dmAgentEnabled: i = !1
|
|
336
|
+
}) => {
|
|
337
|
+
const c = sn(e), g = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", y = n >= 40 ? 2 : 1, m = l === "circle" ? { borderRadius: "50%" } : {
|
|
338
|
+
borderRadius: "33%",
|
|
339
|
+
cornerShape: "superellipse(1.3)"
|
|
340
|
+
}, h = /* @__PURE__ */ t("div", { className: "h-full w-full overflow-hidden", style: m, children: s ? /* @__PURE__ */ t(
|
|
341
|
+
"img",
|
|
342
|
+
{
|
|
343
|
+
src: s,
|
|
344
|
+
alt: "",
|
|
345
|
+
className: "h-full w-full object-cover"
|
|
346
|
+
}
|
|
347
|
+
) : /* @__PURE__ */ t(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
"aria-hidden": "true",
|
|
351
|
+
className: D(
|
|
352
|
+
"avatar-fallback flex h-full w-full items-center justify-center bg-[#E6E5E3] font-semibold select-none transition-colors",
|
|
353
|
+
g
|
|
354
|
+
),
|
|
355
|
+
children: c
|
|
356
|
+
}
|
|
357
|
+
) });
|
|
358
|
+
return /* @__PURE__ */ d(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
className: D(
|
|
362
|
+
"relative flex-shrink-0 !bg-transparent",
|
|
363
|
+
a
|
|
364
|
+
),
|
|
365
|
+
style: {
|
|
366
|
+
"--str-chat__avatar-size": `${n}px`,
|
|
367
|
+
width: `${n}px`,
|
|
368
|
+
height: `${n}px`
|
|
369
|
+
},
|
|
370
|
+
children: [
|
|
371
|
+
o && /* @__PURE__ */ t(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
"aria-hidden": "true",
|
|
375
|
+
className: "absolute -left-1.5 -top-1.5 z-10 flex size-5 items-center justify-center rounded-full bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",
|
|
376
|
+
children: /* @__PURE__ */ t(Me, { className: "size-3 text-yellow-600", weight: "duotone" })
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ t(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
"data-testid": "avatar-ring",
|
|
383
|
+
className: D(
|
|
384
|
+
"h-full w-full",
|
|
385
|
+
"bg-transparent"
|
|
386
|
+
),
|
|
387
|
+
style: {
|
|
388
|
+
...m,
|
|
389
|
+
...i && {
|
|
390
|
+
borderWidth: `${y}px`,
|
|
391
|
+
borderStyle: "solid",
|
|
392
|
+
borderColor: "var(--AI-Gradient, #7F22FE)",
|
|
393
|
+
boxShadow: "inset 0 1px 2px 0 rgba(255, 255, 255, 0.5)"
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
children: h
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
);
|
|
402
|
+
}, nn = ({ size: e = 15 }) => /* @__PURE__ */ t(
|
|
403
|
+
"svg",
|
|
404
|
+
{
|
|
405
|
+
width: e,
|
|
406
|
+
height: e,
|
|
407
|
+
viewBox: "0 0 15 15",
|
|
408
|
+
fill: "none",
|
|
409
|
+
"aria-hidden": "true",
|
|
410
|
+
children: /* @__PURE__ */ t(
|
|
411
|
+
"path",
|
|
412
|
+
{
|
|
413
|
+
d: "M12.003 9a.985.985 0 0 1-.652.934l-3.223 1.191-1.188 3.226a.995.995 0 0 1-1.867 0l-1.195-3.226L.65 9.937a.995.995 0 0 1 0-1.867l3.227-1.195 1.187-3.226a.995.995 0 0 1 1.868 0l1.195 3.226 3.226 1.187a.99.99 0 0 1 .649.938m3-5.83a.52.52 0 0 1-.344.492l-1.702.63-.627 1.703a.525.525 0 0 1-.986 0l-.63-1.704-1.704-.627a.525.525 0 0 1 0-.986l1.703-.63.627-1.704a.526.526 0 0 1 .986 0l.631 1.703 1.704.627a.52.52 0 0 1 .342.495",
|
|
414
|
+
fill: "currentColor",
|
|
415
|
+
fillOpacity: 0.55
|
|
416
|
+
}
|
|
417
|
+
)
|
|
418
|
+
}
|
|
419
|
+
), an = (e) => {
|
|
420
|
+
var s;
|
|
421
|
+
return ((s = e.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
422
|
+
}, rn = (e) => {
|
|
423
|
+
var s;
|
|
424
|
+
return ((s = e.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
425
|
+
}, ve = (e) => {
|
|
426
|
+
var s;
|
|
427
|
+
return ((s = e.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
428
|
+
}, on = (e) => {
|
|
429
|
+
var s;
|
|
430
|
+
return ((s = e.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_ATTACHMENT";
|
|
431
|
+
}, kt = (e) => an(e) || rn(e), ln = (e) => {
|
|
432
|
+
var s;
|
|
433
|
+
return kt(e) && !((s = e.text) != null && s.trim());
|
|
434
|
+
}, Ie = ({
|
|
435
|
+
message: e,
|
|
436
|
+
standalone: s = !1,
|
|
437
|
+
isMyMessage: n = !1,
|
|
438
|
+
hasAttachment: a = !1
|
|
439
|
+
}) => {
|
|
440
|
+
var m;
|
|
441
|
+
const o = kt(e), l = ve(e);
|
|
442
|
+
if (!o && !l)
|
|
443
|
+
return null;
|
|
444
|
+
if (o) {
|
|
445
|
+
const h = (m = e.metadata) == null ? void 0 : m.amount_text;
|
|
446
|
+
if (!h) return null;
|
|
447
|
+
const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", b = s ? `${h} tip` : `Delivered with ${h} tip`;
|
|
448
|
+
return /* @__PURE__ */ d("div", { className: r, children: [
|
|
449
|
+
/* @__PURE__ */ t(Is, { size: s ? 14 : 12 }),
|
|
450
|
+
/* @__PURE__ */ t("span", { children: b })
|
|
451
|
+
] });
|
|
452
|
+
}
|
|
453
|
+
const i = n && a, c = i ? "Sent with AI" : "Sent with DM Agent", f = [
|
|
454
|
+
"message-chatbot-indicator",
|
|
455
|
+
n ? "message-chatbot-indicator--sender" : "message-chatbot-indicator--receiver",
|
|
456
|
+
i ? "message-chatbot-indicator--attachment" : "message-chatbot-indicator--text"
|
|
457
|
+
].join(" "), g = /* @__PURE__ */ t("span", { className: "message-chatbot-indicator__label", children: c }), y = /* @__PURE__ */ t("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ t(nn, { size: i ? 12 : 15 }) });
|
|
458
|
+
return /* @__PURE__ */ t("div", { className: f, "data-testid": "message-chatbot-indicator", children: n && !i ? /* @__PURE__ */ d(de, { children: [
|
|
459
|
+
g,
|
|
460
|
+
y
|
|
461
|
+
] }) : /* @__PURE__ */ d(de, { children: [
|
|
462
|
+
y,
|
|
463
|
+
g
|
|
464
|
+
] }) });
|
|
465
|
+
}, Tt = P.memo(
|
|
466
|
+
({ channel: e, unread: s }) => {
|
|
467
|
+
var $, k, M, j;
|
|
468
|
+
const {
|
|
469
|
+
selectedChannel: n,
|
|
470
|
+
onChannelSelect: a,
|
|
471
|
+
debug: o,
|
|
472
|
+
renderMessagePreview: l,
|
|
473
|
+
viewerLanguage: i
|
|
474
|
+
} = Js(), c = (n == null ? void 0 : n.id) === (e == null ? void 0 : e.id), f = () => {
|
|
475
|
+
e && a(e);
|
|
476
|
+
}, g = (_) => {
|
|
477
|
+
const L = _.key === "Enter" || _.key === " ", v = _.repeat;
|
|
478
|
+
!L || v || (_.preventDefault(), f());
|
|
479
|
+
}, m = Object.values((($ = e == null ? void 0 : e.state) == null ? void 0 : $.members) || {}).find(
|
|
480
|
+
(_) => {
|
|
481
|
+
var L, v;
|
|
482
|
+
return ((L = _.user) == null ? void 0 : L.id) && _.user.id !== ((v = e == null ? void 0 : e._client) == null ? void 0 : v.userID);
|
|
483
|
+
}
|
|
484
|
+
), h = ((k = m == null ? void 0 : m.user) == null ? void 0 : k.name) || "Conversation", r = (M = m == null ? void 0 : m.user) == null ? void 0 : M.image, b = (() => {
|
|
485
|
+
var L;
|
|
486
|
+
const _ = (L = e == null ? void 0 : e.state) == null ? void 0 : L.messages;
|
|
487
|
+
if (_ != null && _.length) {
|
|
488
|
+
for (let v = _.length - 1; v >= 0; v--)
|
|
489
|
+
if (_[v].type !== "system") return _[v];
|
|
490
|
+
}
|
|
491
|
+
})(), x = (() => {
|
|
492
|
+
var A, V;
|
|
493
|
+
const _ = It({
|
|
494
|
+
message: b,
|
|
495
|
+
viewerLanguage: i
|
|
496
|
+
});
|
|
497
|
+
if (_) return _;
|
|
498
|
+
if (((A = b == null ? void 0 : b.metadata) == null ? void 0 : A.custom_type) === "MESSAGE_TIP") return "💵 Sent a tip";
|
|
499
|
+
const v = (V = b == null ? void 0 : b.attachments) == null ? void 0 : V[0];
|
|
500
|
+
return v ? v.og_scrape_url ? v.og_scrape_url : v.type === "image" ? "📷 Sent an image" : v.type === "video" ? "🎥 Sent a video" : v.type === "audio" ? "🎵 Sent audio" : v.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
501
|
+
})(), N = b != null && b.created_at ? Qs(new Date(b.created_at)) : "", p = b ? ve(b) : !1, I = l ? l(b, x) : `${p ? "✨ " : ""}${x}`, S = St(e), T = s ?? 0;
|
|
502
|
+
return o && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
503
|
+
channelId: e == null ? void 0 : e.id,
|
|
504
|
+
isSelected: c,
|
|
505
|
+
participantName: h,
|
|
506
|
+
unreadCount: T,
|
|
507
|
+
hasTimestamp: !!N
|
|
508
|
+
}), /* @__PURE__ */ t(
|
|
509
|
+
"div",
|
|
510
|
+
{
|
|
511
|
+
role: "button",
|
|
512
|
+
tabIndex: 0,
|
|
513
|
+
onClick: f,
|
|
514
|
+
onKeyDown: g,
|
|
515
|
+
className: D(
|
|
516
|
+
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
517
|
+
{
|
|
518
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": c,
|
|
519
|
+
"hover:bg-sand": !c
|
|
520
|
+
}
|
|
521
|
+
),
|
|
522
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
|
|
523
|
+
/* @__PURE__ */ t(
|
|
524
|
+
ae,
|
|
525
|
+
{
|
|
526
|
+
id: ((j = m == null ? void 0 : m.user) == null ? void 0 : j.id) || e.id || "unknown",
|
|
527
|
+
name: h,
|
|
528
|
+
image: r,
|
|
529
|
+
size: 44,
|
|
530
|
+
starred: S,
|
|
531
|
+
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
535
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
|
|
536
|
+
/* @__PURE__ */ d(
|
|
537
|
+
"h3",
|
|
538
|
+
{
|
|
539
|
+
className: D(
|
|
540
|
+
"text-sm font-medium truncate",
|
|
541
|
+
c ? "text-primary" : "text-charcoal"
|
|
542
|
+
),
|
|
543
|
+
children: [
|
|
544
|
+
S && /* @__PURE__ */ t("span", { className: "sr-only", children: "Starred conversation. " }),
|
|
545
|
+
h
|
|
546
|
+
]
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
N && /* @__PURE__ */ t("span", { className: "text-xs text-stone flex-shrink-0", children: N })
|
|
550
|
+
] }),
|
|
551
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
552
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: I }),
|
|
553
|
+
T > 0 && /* @__PURE__ */ t("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: T > 99 ? "99+" : T })
|
|
554
|
+
] })
|
|
555
|
+
] })
|
|
556
|
+
] })
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
Tt.displayName = "CustomChannelPreview";
|
|
562
|
+
const cn = { last_message_at: -1 }, Mt = P.memo(
|
|
563
|
+
({
|
|
564
|
+
onChannelSelect: e,
|
|
565
|
+
selectedChannel: s,
|
|
566
|
+
filters: n,
|
|
567
|
+
allowNewMessagesFromUnfilteredChannels: a = !1,
|
|
568
|
+
onMessageNew: o,
|
|
569
|
+
onAddedToChannel: l,
|
|
570
|
+
channelRenderFilterFn: i,
|
|
571
|
+
sort: c = cn,
|
|
572
|
+
className: f,
|
|
573
|
+
customEmptyStateIndicator: g,
|
|
574
|
+
renderMessagePreview: y,
|
|
575
|
+
viewerLanguage: m
|
|
576
|
+
}) => {
|
|
577
|
+
const h = P.useRef(0);
|
|
578
|
+
h.current++;
|
|
579
|
+
const { debug: r = !1 } = ze(), b = P.useCallback(
|
|
580
|
+
(x) => {
|
|
581
|
+
for (const N of x)
|
|
582
|
+
Xs(N);
|
|
583
|
+
return i ? i(x) : x;
|
|
584
|
+
},
|
|
585
|
+
[i]
|
|
586
|
+
);
|
|
587
|
+
r && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
588
|
+
renderCount: h.current,
|
|
589
|
+
selectedChannelId: s == null ? void 0 : s.id,
|
|
590
|
+
filters: n
|
|
591
|
+
});
|
|
592
|
+
const w = P.useMemo(
|
|
593
|
+
() => ({
|
|
594
|
+
selectedChannel: s,
|
|
595
|
+
onChannelSelect: e,
|
|
596
|
+
debug: r,
|
|
597
|
+
renderMessagePreview: y,
|
|
598
|
+
viewerLanguage: m
|
|
599
|
+
}),
|
|
600
|
+
[
|
|
601
|
+
s,
|
|
602
|
+
e,
|
|
603
|
+
r,
|
|
604
|
+
y,
|
|
605
|
+
m
|
|
606
|
+
]
|
|
607
|
+
);
|
|
608
|
+
return /* @__PURE__ */ t(
|
|
609
|
+
"div",
|
|
610
|
+
{
|
|
611
|
+
className: D(
|
|
612
|
+
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
613
|
+
f
|
|
614
|
+
),
|
|
615
|
+
children: /* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ t(Zs, { value: w, children: /* @__PURE__ */ t(
|
|
616
|
+
Ht,
|
|
617
|
+
{
|
|
618
|
+
filters: n,
|
|
619
|
+
sort: c,
|
|
620
|
+
options: { limit: 30 },
|
|
621
|
+
allowNewMessagesFromUnfilteredChannels: a,
|
|
622
|
+
onMessageNew: o,
|
|
623
|
+
onAddedToChannel: l,
|
|
624
|
+
channelRenderFilterFn: b,
|
|
625
|
+
Preview: Tt,
|
|
626
|
+
EmptyStateIndicator: g
|
|
627
|
+
},
|
|
628
|
+
`${JSON.stringify(n)}:${JSON.stringify(c)}`
|
|
629
|
+
) }) })
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
Mt.displayName = "ChannelList";
|
|
635
|
+
const be = ({
|
|
636
|
+
variant: e = "default",
|
|
637
|
+
className: s,
|
|
638
|
+
children: n,
|
|
639
|
+
...a
|
|
640
|
+
}) => /* @__PURE__ */ t(
|
|
641
|
+
"button",
|
|
642
|
+
{
|
|
643
|
+
type: "button",
|
|
644
|
+
className: D(
|
|
645
|
+
"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
|
|
646
|
+
e === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
647
|
+
s
|
|
648
|
+
),
|
|
649
|
+
...a,
|
|
650
|
+
children: n
|
|
651
|
+
}
|
|
652
|
+
);
|
|
653
|
+
function dn({ label: e, className: s, children: n, ...a }) {
|
|
654
|
+
return /* @__PURE__ */ d(
|
|
655
|
+
"button",
|
|
656
|
+
{
|
|
657
|
+
type: "button",
|
|
658
|
+
className: D(
|
|
659
|
+
"inline-flex items-center justify-center rounded-full transition-colors focus-ring p-2",
|
|
660
|
+
{
|
|
661
|
+
"cursor-not-allowed opacity-50": a.disabled,
|
|
662
|
+
"hover:bg-sand": !a.disabled
|
|
663
|
+
},
|
|
664
|
+
s
|
|
665
|
+
),
|
|
666
|
+
...a,
|
|
667
|
+
children: [
|
|
668
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: e }),
|
|
669
|
+
n
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
function un({ onClick: e }) {
|
|
675
|
+
return /* @__PURE__ */ t(dn, { label: "Close", onClick: e, className: "p-1", children: /* @__PURE__ */ t(yt, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
676
|
+
}
|
|
677
|
+
const mn = ({
|
|
678
|
+
dialogRef: e,
|
|
679
|
+
onClose: s,
|
|
680
|
+
participant: n,
|
|
681
|
+
channel: a,
|
|
682
|
+
followerStatusLabel: o,
|
|
683
|
+
onLeaveConversation: l,
|
|
684
|
+
onBlockParticipant: i,
|
|
685
|
+
showDeleteConversation: c = !0,
|
|
686
|
+
onDeleteConversationClick: f,
|
|
687
|
+
onBlockParticipantClick: g,
|
|
688
|
+
onReportParticipantClick: y,
|
|
689
|
+
customProfileContent: m,
|
|
690
|
+
customChannelActions: h
|
|
691
|
+
}) => {
|
|
692
|
+
var R, z, E, H, Y, te;
|
|
693
|
+
const { service: r, debug: b } = ze(), [w, x] = O(!1), [N, p] = O(!1), [I, S] = O(!1), T = G(async () => {
|
|
694
|
+
var B;
|
|
695
|
+
if (!(!r || !((B = n == null ? void 0 : n.user) != null && B.id)))
|
|
696
|
+
try {
|
|
697
|
+
const C = (await r.getBlockedUsers()).some(
|
|
698
|
+
(U) => {
|
|
699
|
+
var K;
|
|
700
|
+
return U.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
x(C);
|
|
704
|
+
} catch (u) {
|
|
705
|
+
console.error(
|
|
706
|
+
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
707
|
+
u
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
}, [r, (R = n == null ? void 0 : n.user) == null ? void 0 : R.id]);
|
|
711
|
+
q(() => {
|
|
712
|
+
T();
|
|
713
|
+
}, [T]);
|
|
714
|
+
const $ = async () => {
|
|
715
|
+
var B;
|
|
716
|
+
if (!N) {
|
|
717
|
+
f == null || f(), b && console.log("[ChannelInfoDialog] Leave conversation", a.cid), p(!0);
|
|
718
|
+
try {
|
|
719
|
+
const u = ((B = a._client) == null ? void 0 : B.userID) ?? null;
|
|
720
|
+
await a.hide(u, !1), l && await l(a), s();
|
|
721
|
+
} catch (u) {
|
|
722
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", u);
|
|
723
|
+
} finally {
|
|
724
|
+
p(!1);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}, k = async () => {
|
|
728
|
+
var B, u, C;
|
|
729
|
+
if (!(I || !r)) {
|
|
730
|
+
g == null || g(), b && console.log("[ChannelInfoDialog] Block member", (B = n == null ? void 0 : n.user) == null ? void 0 : B.id), S(!0);
|
|
731
|
+
try {
|
|
732
|
+
await r.blockUser((u = n == null ? void 0 : n.user) == null ? void 0 : u.id), i && await i((C = n == null ? void 0 : n.user) == null ? void 0 : C.id), s();
|
|
733
|
+
} catch (U) {
|
|
734
|
+
console.error("[ChannelInfoDialog] Failed to block member", U);
|
|
735
|
+
} finally {
|
|
736
|
+
S(!1);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}, M = async () => {
|
|
740
|
+
var B, u, C;
|
|
741
|
+
if (!(I || !r)) {
|
|
742
|
+
g == null || g(), b && console.log("[ChannelInfoDialog] Unblock member", (B = n == null ? void 0 : n.user) == null ? void 0 : B.id), S(!0);
|
|
743
|
+
try {
|
|
744
|
+
await r.unBlockUser((u = n == null ? void 0 : n.user) == null ? void 0 : u.id), i && await i((C = n == null ? void 0 : n.user) == null ? void 0 : C.id), s();
|
|
745
|
+
} catch (U) {
|
|
746
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", U);
|
|
747
|
+
} finally {
|
|
748
|
+
S(!1);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}, j = () => {
|
|
752
|
+
y == null || y(), s(), window.open(
|
|
753
|
+
"https://linktr.ee/s/about/trust-center/report",
|
|
754
|
+
"_blank",
|
|
755
|
+
"noopener,noreferrer"
|
|
756
|
+
);
|
|
757
|
+
};
|
|
758
|
+
if (!n) return null;
|
|
759
|
+
const _ = ((z = n.user) == null ? void 0 : z.name) || ((E = n.user) == null ? void 0 : E.id) || "Unknown member", L = (H = n.user) == null ? void 0 : H.image, v = (Y = n.user) == null ? void 0 : Y.username, A = v ? `linktr.ee/${v}` : void 0, V = ((te = n.user) == null ? void 0 : te.id) || "unknown";
|
|
760
|
+
return (
|
|
761
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
762
|
+
/* @__PURE__ */ t(
|
|
763
|
+
"dialog",
|
|
764
|
+
{
|
|
765
|
+
ref: e,
|
|
766
|
+
className: "mes-dialog group",
|
|
767
|
+
onClose: s,
|
|
768
|
+
onClick: (B) => {
|
|
769
|
+
B.target === e.current && s();
|
|
770
|
+
},
|
|
771
|
+
children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
|
|
772
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
773
|
+
/* @__PURE__ */ t("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
774
|
+
/* @__PURE__ */ t(un, { onClick: s })
|
|
775
|
+
] }),
|
|
776
|
+
/* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
777
|
+
/* @__PURE__ */ d(
|
|
778
|
+
"div",
|
|
779
|
+
{
|
|
780
|
+
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
781
|
+
style: { backgroundColor: "#FBFAF9" },
|
|
782
|
+
children: [
|
|
783
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
|
|
784
|
+
/* @__PURE__ */ t(
|
|
785
|
+
ae,
|
|
786
|
+
{
|
|
787
|
+
id: V,
|
|
788
|
+
name: _,
|
|
789
|
+
image: L,
|
|
790
|
+
size: 88,
|
|
791
|
+
shape: "circle"
|
|
792
|
+
}
|
|
793
|
+
),
|
|
794
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
795
|
+
/* @__PURE__ */ t("p", { className: "truncate text-base font-semibold text-charcoal", children: _ }),
|
|
796
|
+
A && /* @__PURE__ */ t("p", { className: "truncate text-sm text-[#00000055]", children: A }),
|
|
797
|
+
o && !m && /* @__PURE__ */ t(
|
|
798
|
+
"span",
|
|
799
|
+
{
|
|
800
|
+
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
801
|
+
style: {
|
|
802
|
+
padding: "4px 8px",
|
|
803
|
+
backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
804
|
+
color: o === "Subscribed to you" ? "#008236" : "#78716C",
|
|
805
|
+
lineHeight: "133.333%",
|
|
806
|
+
letterSpacing: "0.21px"
|
|
807
|
+
},
|
|
808
|
+
children: o
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
] })
|
|
812
|
+
] }),
|
|
813
|
+
m && /* @__PURE__ */ t("div", { className: "w-full", children: m })
|
|
814
|
+
]
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
/* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
818
|
+
c && /* @__PURE__ */ t("li", { children: /* @__PURE__ */ d(
|
|
819
|
+
be,
|
|
820
|
+
{
|
|
821
|
+
onClick: $,
|
|
822
|
+
disabled: N,
|
|
823
|
+
"aria-busy": N,
|
|
824
|
+
children: [
|
|
825
|
+
N ? /* @__PURE__ */ t(Se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(ks, { className: "h-5 w-5" }),
|
|
826
|
+
/* @__PURE__ */ t("span", { children: "Delete Conversation" })
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
) }),
|
|
830
|
+
/* @__PURE__ */ t("li", { children: w ? /* @__PURE__ */ d(
|
|
831
|
+
be,
|
|
832
|
+
{
|
|
833
|
+
onClick: M,
|
|
834
|
+
disabled: I,
|
|
835
|
+
"aria-busy": I,
|
|
836
|
+
children: [
|
|
837
|
+
I ? /* @__PURE__ */ t(Se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(ot, { className: "h-5 w-5" }),
|
|
838
|
+
/* @__PURE__ */ t("span", { children: "Unblock" })
|
|
839
|
+
]
|
|
840
|
+
}
|
|
841
|
+
) : /* @__PURE__ */ d(
|
|
842
|
+
be,
|
|
843
|
+
{
|
|
844
|
+
onClick: k,
|
|
845
|
+
disabled: I,
|
|
846
|
+
"aria-busy": I,
|
|
847
|
+
children: [
|
|
848
|
+
I ? /* @__PURE__ */ t(Se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(ot, { className: "h-5 w-5" }),
|
|
849
|
+
/* @__PURE__ */ t("span", { children: "Block" })
|
|
850
|
+
]
|
|
851
|
+
}
|
|
852
|
+
) }),
|
|
853
|
+
/* @__PURE__ */ t("li", { children: /* @__PURE__ */ d(be, { variant: "danger", onClick: j, children: [
|
|
854
|
+
/* @__PURE__ */ t(Ts, { className: "h-5 w-5" }),
|
|
855
|
+
/* @__PURE__ */ t("span", { children: "Report" })
|
|
856
|
+
] }) }),
|
|
857
|
+
h
|
|
858
|
+
] })
|
|
859
|
+
] })
|
|
860
|
+
] })
|
|
861
|
+
}
|
|
862
|
+
)
|
|
863
|
+
);
|
|
864
|
+
}, hn = (e) => /* @__PURE__ */ t(Yt, { ...e, position: "center" }), Re = "vote_up", Le = "vote_down";
|
|
865
|
+
function fn(e) {
|
|
866
|
+
return e != null && e.length ? e.some((s) => s.type === Le) ? "down" : e.some((s) => s.type === Re) ? "up" : null : null;
|
|
867
|
+
}
|
|
868
|
+
function gn(e) {
|
|
869
|
+
const { channel: s } = oe(), { client: n } = Pe("useMessageVote"), a = pe(
|
|
870
|
+
() => fn(e.own_reactions),
|
|
871
|
+
[e.own_reactions]
|
|
872
|
+
), o = G(async () => {
|
|
873
|
+
if (n != null && n.userID)
|
|
874
|
+
try {
|
|
875
|
+
a === "up" ? await s.deleteReaction(e.id, Re) : await s.sendReaction(
|
|
876
|
+
e.id,
|
|
877
|
+
{ type: Re },
|
|
878
|
+
{ enforce_unique: !0, skip_push: !0 }
|
|
879
|
+
);
|
|
880
|
+
} catch {
|
|
881
|
+
}
|
|
882
|
+
}, [s, n == null ? void 0 : n.userID, e.id, a]), l = G(async () => {
|
|
883
|
+
if (n != null && n.userID)
|
|
884
|
+
try {
|
|
885
|
+
a === "down" ? await s.deleteReaction(e.id, Le) : await s.sendReaction(
|
|
886
|
+
e.id,
|
|
887
|
+
{ type: Le },
|
|
888
|
+
{ enforce_unique: !0, skip_push: !0 }
|
|
889
|
+
);
|
|
890
|
+
} catch {
|
|
891
|
+
}
|
|
892
|
+
}, [s, n == null ? void 0 : n.userID, e.id, a]);
|
|
893
|
+
return { selected: a, voteUp: o, voteDown: l };
|
|
894
|
+
}
|
|
895
|
+
const bn = P.lazy(() => import("./Card-DLUBUg_w.js")), pn = P.lazy(() => import("./Card-CAC3fPjy.js")), xn = P.lazy(() => import("./Card-_StSlnYh.js")), Be = () => /* @__PURE__ */ t(
|
|
896
|
+
"div",
|
|
897
|
+
{
|
|
898
|
+
className: "w-[280px] min-h-[200px] animate-pulse rounded-2xl bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_1px_2px_rgba(0,0,0,0.04),0_8px_32px_rgba(0,0,0,0.1)]",
|
|
899
|
+
"aria-hidden": !0
|
|
900
|
+
}
|
|
901
|
+
), vn = (e) => /* @__PURE__ */ t(Oe, { fallback: /* @__PURE__ */ t(Be, {}), children: /* @__PURE__ */ t(bn, { ...e }) }), Dt = (e) => /* @__PURE__ */ t(Oe, { fallback: /* @__PURE__ */ t(Be, {}), children: /* @__PURE__ */ t(pn, { ...e }) }), Rt = (e) => /* @__PURE__ */ t(Oe, { fallback: /* @__PURE__ */ t(Be, {}), children: /* @__PURE__ */ t(xn, { ...e }) }), wn = Dt, yn = Rt, ft = { Composer: vn, Sent: Dt, Received: Rt, Creator: wn, Visitor: yn }, _n = [
|
|
902
|
+
[/pdf/, "pdf"],
|
|
903
|
+
[/wordprocessingml|msword|\.doc/, "doc"],
|
|
904
|
+
[/spreadsheetml|ms-excel|\.xls/, "xls"],
|
|
905
|
+
[/csv/, "csv"],
|
|
906
|
+
[/presentationml|ms-powerpoint|\.ppt/, "ppt"],
|
|
907
|
+
[/zip|x-rar|x-7z|x-tar|x-gzip/, "zip"],
|
|
908
|
+
[/plain|rtf/, "text"],
|
|
909
|
+
[/markdown/, "markdown"]
|
|
910
|
+
];
|
|
911
|
+
function _e(e) {
|
|
912
|
+
return e.startsWith("video/") ? "video" : e.startsWith("audio/") ? "audio" : e.startsWith("image/") ? "image" : "document";
|
|
913
|
+
}
|
|
914
|
+
function Nn(e) {
|
|
915
|
+
const s = _n.find(
|
|
916
|
+
([n]) => n.test(e)
|
|
917
|
+
);
|
|
918
|
+
return s ? s[1] : "generic";
|
|
919
|
+
}
|
|
920
|
+
const Cn = {
|
|
921
|
+
video: Rs,
|
|
922
|
+
audio: Ds,
|
|
923
|
+
image: Ms,
|
|
924
|
+
document: _t
|
|
925
|
+
}, En = {
|
|
926
|
+
pdf: Us,
|
|
927
|
+
doc: Bs,
|
|
928
|
+
xls: zs,
|
|
929
|
+
csv: Ps,
|
|
930
|
+
ppt: Os,
|
|
931
|
+
zip: Fs,
|
|
932
|
+
text: As,
|
|
933
|
+
markdown: Ls,
|
|
934
|
+
generic: _t
|
|
935
|
+
};
|
|
936
|
+
function Sn(e) {
|
|
937
|
+
const s = _e(e);
|
|
938
|
+
return s !== "document" ? Cn[s] : En[Nn(e)];
|
|
939
|
+
}
|
|
940
|
+
function we(e, s) {
|
|
941
|
+
return P.createElement(Sn(e), s);
|
|
942
|
+
}
|
|
943
|
+
const In = (e) => {
|
|
944
|
+
var s, n;
|
|
945
|
+
return "touches" in e ? ((s = e.touches[0]) == null ? void 0 : s.clientX) ?? ((n = e.changedTouches[0]) == null ? void 0 : n.clientX) ?? 0 : e.clientX;
|
|
946
|
+
}, kn = ({
|
|
947
|
+
source: e,
|
|
948
|
+
mimeType: s,
|
|
949
|
+
poster: n,
|
|
950
|
+
autoPlay: a = !1,
|
|
951
|
+
playing: o,
|
|
952
|
+
loop: l = !1,
|
|
953
|
+
controls: i = !0,
|
|
954
|
+
showProgress: c = !1,
|
|
955
|
+
muted: f = !1,
|
|
956
|
+
onContainerClick: g
|
|
957
|
+
}) => {
|
|
958
|
+
const y = _e(s), m = J(null), h = J(null), r = J(null), b = J(o), [w, x] = O(a), [N, p] = O(0), [I, S] = O(!1), [T, $] = O(!1), [k, M] = O(!1), [j, _] = O(!1), [L, v] = O(!0), [A, V] = O(null), R = G(() => {
|
|
959
|
+
M(!1), x(!0);
|
|
960
|
+
}, []), z = G((u) => {
|
|
961
|
+
const C = h.current;
|
|
962
|
+
if (!C) return 0;
|
|
963
|
+
const U = C.getBoundingClientRect();
|
|
964
|
+
return Math.max(
|
|
965
|
+
0,
|
|
966
|
+
Math.min(1, (In(u) - U.left) / U.width)
|
|
967
|
+
);
|
|
968
|
+
}, []), E = G((u) => {
|
|
969
|
+
const C = m.current;
|
|
970
|
+
C && C.duration && (C.currentTime = u * C.duration);
|
|
971
|
+
}, []), H = (u) => {
|
|
972
|
+
u.stopPropagation(), S(!0);
|
|
973
|
+
const C = z(u);
|
|
974
|
+
p(C), E(C);
|
|
975
|
+
};
|
|
976
|
+
q(() => {
|
|
977
|
+
o !== void 0 && o !== b.current && (b.current = o, x(o));
|
|
978
|
+
}, [o]), q(() => {
|
|
979
|
+
if (!w) {
|
|
980
|
+
r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
const u = () => {
|
|
984
|
+
const C = m.current;
|
|
985
|
+
C && C.duration && !I && p(C.currentTime / C.duration), r.current = requestAnimationFrame(u);
|
|
986
|
+
};
|
|
987
|
+
return r.current = requestAnimationFrame(u), () => {
|
|
988
|
+
r.current !== null && cancelAnimationFrame(r.current);
|
|
989
|
+
};
|
|
990
|
+
}, [w, I]), q(() => {
|
|
991
|
+
const u = m.current;
|
|
992
|
+
u && (w ? u.play().catch((C) => {
|
|
993
|
+
x(!1), M(!0);
|
|
994
|
+
}) : u.pause());
|
|
995
|
+
}, [w]), q(() => {
|
|
996
|
+
if (!I) return;
|
|
997
|
+
const u = (U) => p(z(U)), C = (U) => {
|
|
998
|
+
S(!1), E(z(U));
|
|
999
|
+
};
|
|
1000
|
+
return window.addEventListener("mousemove", u), window.addEventListener("mouseup", C), window.addEventListener("touchmove", u, { passive: !0 }), window.addEventListener("touchend", C), () => {
|
|
1001
|
+
window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", C), window.removeEventListener("touchmove", u), window.removeEventListener("touchend", C);
|
|
1002
|
+
};
|
|
1003
|
+
}, [I, z, E]);
|
|
1004
|
+
const Y = A ? { aspectRatio: String(A) } : void 0, te = A ? "" : " aspect-video", B = Math.round(N * 100);
|
|
1005
|
+
return /* @__PURE__ */ d(
|
|
1006
|
+
"div",
|
|
1007
|
+
{
|
|
1008
|
+
role: "button",
|
|
1009
|
+
tabIndex: 0,
|
|
1010
|
+
className: `relative cursor-pointer overflow-hidden bg-black ${te}`,
|
|
1011
|
+
style: Y,
|
|
1012
|
+
onClick: (u) => {
|
|
1013
|
+
if (g) {
|
|
1014
|
+
g(u);
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
k || i && x((C) => !C);
|
|
1018
|
+
},
|
|
1019
|
+
onKeyDown: (u) => {
|
|
1020
|
+
if (!(u.key !== "Enter" && u.key !== " ")) {
|
|
1021
|
+
if (u.preventDefault(), g) {
|
|
1022
|
+
g(u);
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
k || i && x((C) => !C);
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
children: [
|
|
1029
|
+
n && (y === "audio" || L) && /* @__PURE__ */ t(
|
|
1030
|
+
"img",
|
|
1031
|
+
{
|
|
1032
|
+
src: n,
|
|
1033
|
+
alt: "",
|
|
1034
|
+
className: "absolute inset-0 h-full w-full object-cover"
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
!n && (y === "audio" || L) && /* @__PURE__ */ t("div", { className: "absolute inset-0 flex items-center justify-center", children: we(s, {
|
|
1038
|
+
className: "size-12 text-black/20",
|
|
1039
|
+
weight: "regular"
|
|
1040
|
+
}) }),
|
|
1041
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0", children: y === "audio" ? /* @__PURE__ */ t(
|
|
1042
|
+
"audio",
|
|
1043
|
+
{
|
|
1044
|
+
ref: m,
|
|
1045
|
+
src: e,
|
|
1046
|
+
loop: l,
|
|
1047
|
+
muted: f,
|
|
1048
|
+
style: { width: "100%", height: "100%" },
|
|
1049
|
+
onLoadStart: () => _(!0),
|
|
1050
|
+
onCanPlay: () => {
|
|
1051
|
+
_(!1), v(!1);
|
|
1052
|
+
},
|
|
1053
|
+
onWaiting: () => _(!0),
|
|
1054
|
+
onPlay: () => M(!1),
|
|
1055
|
+
onEnded: () => {
|
|
1056
|
+
l || (x(!1), p(0));
|
|
1057
|
+
},
|
|
1058
|
+
children: /* @__PURE__ */ t("track", { kind: "captions" })
|
|
1059
|
+
}
|
|
1060
|
+
) : /* @__PURE__ */ t(
|
|
1061
|
+
"video",
|
|
1062
|
+
{
|
|
1063
|
+
ref: m,
|
|
1064
|
+
src: e,
|
|
1065
|
+
loop: l,
|
|
1066
|
+
muted: f,
|
|
1067
|
+
playsInline: !0,
|
|
1068
|
+
style: { width: "100%", height: "100%" },
|
|
1069
|
+
onLoadStart: () => _(!0),
|
|
1070
|
+
onCanPlay: () => {
|
|
1071
|
+
_(!1), v(!1);
|
|
1072
|
+
},
|
|
1073
|
+
onWaiting: () => _(!0),
|
|
1074
|
+
onPlay: () => M(!1),
|
|
1075
|
+
onLoadedMetadata: () => {
|
|
1076
|
+
const u = m.current;
|
|
1077
|
+
u instanceof HTMLVideoElement && u.videoWidth && u.videoHeight && V(u.videoWidth / u.videoHeight);
|
|
1078
|
+
},
|
|
1079
|
+
onEnded: () => {
|
|
1080
|
+
l || (x(!1), p(0));
|
|
1081
|
+
},
|
|
1082
|
+
children: /* @__PURE__ */ t("track", { kind: "captions" })
|
|
1083
|
+
}
|
|
1084
|
+
) }),
|
|
1085
|
+
j && !k && /* @__PURE__ */ t("div", { className: "absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ t(
|
|
1086
|
+
Nt,
|
|
1087
|
+
{
|
|
1088
|
+
className: "size-8 animate-spin text-white/80",
|
|
1089
|
+
weight: "bold"
|
|
1090
|
+
}
|
|
1091
|
+
) }),
|
|
1092
|
+
k && !i && /* @__PURE__ */ t(
|
|
1093
|
+
"div",
|
|
1094
|
+
{
|
|
1095
|
+
className: "absolute inset-0 z-30 flex cursor-pointer items-center justify-center bg-black/35",
|
|
1096
|
+
role: "button",
|
|
1097
|
+
tabIndex: 0,
|
|
1098
|
+
"aria-label": "Play preview",
|
|
1099
|
+
onClick: (u) => {
|
|
1100
|
+
u.stopPropagation(), R();
|
|
1101
|
+
},
|
|
1102
|
+
onKeyDown: (u) => {
|
|
1103
|
+
u.key !== "Enter" && u.key !== " " || (u.preventDefault(), u.stopPropagation(), R());
|
|
1104
|
+
},
|
|
1105
|
+
children: /* @__PURE__ */ t("span", { className: "flex size-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm", children: /* @__PURE__ */ t(lt, { className: "size-9 translate-x-0.5", weight: "fill" }) })
|
|
1106
|
+
}
|
|
1107
|
+
),
|
|
1108
|
+
c && !i && /* @__PURE__ */ t("div", { className: "absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent", children: /* @__PURE__ */ t(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
role: "slider",
|
|
1112
|
+
"aria-label": "Playback position",
|
|
1113
|
+
"aria-valuenow": B,
|
|
1114
|
+
"aria-valuemin": 0,
|
|
1115
|
+
"aria-valuemax": 100,
|
|
1116
|
+
tabIndex: 0,
|
|
1117
|
+
ref: h,
|
|
1118
|
+
className: "relative flex h-4 w-full cursor-pointer items-center",
|
|
1119
|
+
onMouseDown: H,
|
|
1120
|
+
onTouchStart: H,
|
|
1121
|
+
onClick: (u) => u.stopPropagation(),
|
|
1122
|
+
onKeyDown: (u) => {
|
|
1123
|
+
u.key === "ArrowRight" && E(Math.min(1, N + 0.05)), u.key === "ArrowLeft" && E(Math.max(0, N - 0.05));
|
|
1124
|
+
},
|
|
1125
|
+
children: /* @__PURE__ */ t("div", { className: "w-full overflow-hidden rounded-full bg-white/30 h-1", children: /* @__PURE__ */ t(
|
|
1126
|
+
"div",
|
|
1127
|
+
{
|
|
1128
|
+
className: "h-full rounded-full bg-white",
|
|
1129
|
+
style: { width: `${B}%` }
|
|
1130
|
+
}
|
|
1131
|
+
) })
|
|
1132
|
+
}
|
|
1133
|
+
) }),
|
|
1134
|
+
i && /* @__PURE__ */ d("div", { className: "absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/60 to-transparent px-3 pb-2.5 pt-6 transition-all duration-200", children: [
|
|
1135
|
+
/* @__PURE__ */ t(
|
|
1136
|
+
"button",
|
|
1137
|
+
{
|
|
1138
|
+
type: "button",
|
|
1139
|
+
onClick: (u) => {
|
|
1140
|
+
u.stopPropagation(), x((C) => !C);
|
|
1141
|
+
},
|
|
1142
|
+
className: "shrink-0 text-white",
|
|
1143
|
+
"aria-label": w ? "Pause" : "Play",
|
|
1144
|
+
children: w ? /* @__PURE__ */ t($s, { className: "size-5", weight: "fill" }) : /* @__PURE__ */ t(lt, { className: "size-5 translate-x-px", weight: "fill" })
|
|
1145
|
+
}
|
|
1146
|
+
),
|
|
1147
|
+
/* @__PURE__ */ d(
|
|
1148
|
+
"div",
|
|
1149
|
+
{
|
|
1150
|
+
role: "slider",
|
|
1151
|
+
"aria-label": "Playback position",
|
|
1152
|
+
"aria-valuenow": B,
|
|
1153
|
+
"aria-valuemin": 0,
|
|
1154
|
+
"aria-valuemax": 100,
|
|
1155
|
+
tabIndex: 0,
|
|
1156
|
+
ref: h,
|
|
1157
|
+
className: "relative flex h-4 w-full cursor-pointer items-center",
|
|
1158
|
+
onMouseDown: H,
|
|
1159
|
+
onTouchStart: H,
|
|
1160
|
+
onClick: (u) => u.stopPropagation(),
|
|
1161
|
+
onMouseEnter: () => $(!0),
|
|
1162
|
+
onMouseLeave: () => $(!1),
|
|
1163
|
+
onKeyDown: (u) => {
|
|
1164
|
+
u.key === "ArrowRight" && E(Math.min(1, N + 0.05)), u.key === "ArrowLeft" && E(Math.max(0, N - 0.05));
|
|
1165
|
+
},
|
|
1166
|
+
children: [
|
|
1167
|
+
/* @__PURE__ */ t(
|
|
1168
|
+
"div",
|
|
1169
|
+
{
|
|
1170
|
+
className: `w-full overflow-hidden rounded-full bg-white/30 transition-all duration-200 ${T || I ? "h-1.5" : "h-1"}`,
|
|
1171
|
+
children: /* @__PURE__ */ t(
|
|
1172
|
+
"div",
|
|
1173
|
+
{
|
|
1174
|
+
className: "h-full rounded-full bg-white",
|
|
1175
|
+
style: { width: `${B}%` }
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
}
|
|
1179
|
+
),
|
|
1180
|
+
/* @__PURE__ */ t(
|
|
1181
|
+
"div",
|
|
1182
|
+
{
|
|
1183
|
+
className: `absolute size-3 -translate-x-1/2 rounded-full bg-white shadow transition-[opacity,transform] duration-200 ${T || I ? "scale-100 opacity-100" : "scale-0 opacity-0"}`,
|
|
1184
|
+
style: { left: `${B}%` }
|
|
1185
|
+
}
|
|
1186
|
+
)
|
|
1187
|
+
]
|
|
1188
|
+
}
|
|
1189
|
+
)
|
|
1190
|
+
] })
|
|
1191
|
+
]
|
|
1192
|
+
}
|
|
1193
|
+
);
|
|
1194
|
+
}, gt = (e) => e === "dark" ? "size-12 text-white/20" : "size-12 text-black/20", Tn = (e) => e === "dark" ? "aspect-video overflow-hidden bg-white/10" : "aspect-video overflow-hidden bg-black/5", Lt = ({
|
|
1195
|
+
mimeType: e,
|
|
1196
|
+
sourceUrl: s,
|
|
1197
|
+
thumbnailUrl: n,
|
|
1198
|
+
title: a,
|
|
1199
|
+
variant: o,
|
|
1200
|
+
mediaPlayerProps: l,
|
|
1201
|
+
containedImage: i = !1
|
|
1202
|
+
}) => {
|
|
1203
|
+
const c = _e(e), [f, g] = O(!1);
|
|
1204
|
+
return s && (c === "video" || c === "audio") ? /* @__PURE__ */ t(
|
|
1205
|
+
kn,
|
|
1206
|
+
{
|
|
1207
|
+
source: s,
|
|
1208
|
+
mimeType: e,
|
|
1209
|
+
poster: n,
|
|
1210
|
+
controls: !0,
|
|
1211
|
+
...l
|
|
1212
|
+
}
|
|
1213
|
+
) : s && c === "image" ? i ? /* @__PURE__ */ t("div", { className: "relative aspect-video overflow-hidden bg-black/5", children: /* @__PURE__ */ t(
|
|
1214
|
+
"img",
|
|
1215
|
+
{
|
|
1216
|
+
src: s,
|
|
1217
|
+
alt: a ?? "",
|
|
1218
|
+
className: `absolute inset-0 h-full w-full object-contain transition-opacity duration-300 ${f ? "opacity-100" : "opacity-0"}`,
|
|
1219
|
+
draggable: !1,
|
|
1220
|
+
onLoad: () => g(!0)
|
|
1221
|
+
}
|
|
1222
|
+
) }) : /* @__PURE__ */ t(
|
|
1223
|
+
"img",
|
|
1224
|
+
{
|
|
1225
|
+
src: s,
|
|
1226
|
+
alt: a ?? "",
|
|
1227
|
+
className: "block w-full",
|
|
1228
|
+
draggable: !1
|
|
1229
|
+
}
|
|
1230
|
+
) : s && c === "document" ? n ? i ? /* @__PURE__ */ t("div", { className: "relative aspect-video overflow-hidden bg-black/5", children: /* @__PURE__ */ t(
|
|
1231
|
+
"img",
|
|
1232
|
+
{
|
|
1233
|
+
src: n,
|
|
1234
|
+
alt: a ?? "",
|
|
1235
|
+
className: `absolute inset-0 h-full w-full object-contain transition-opacity duration-300 ${f ? "opacity-100" : "opacity-0"}`,
|
|
1236
|
+
draggable: !1,
|
|
1237
|
+
onLoad: () => g(!0)
|
|
1238
|
+
}
|
|
1239
|
+
) }) : /* @__PURE__ */ t(
|
|
1240
|
+
"img",
|
|
1241
|
+
{
|
|
1242
|
+
src: n,
|
|
1243
|
+
alt: "",
|
|
1244
|
+
className: "block w-full",
|
|
1245
|
+
draggable: !1
|
|
1246
|
+
}
|
|
1247
|
+
) : /* @__PURE__ */ t(
|
|
1248
|
+
"div",
|
|
1249
|
+
{
|
|
1250
|
+
className: `flex aspect-video w-full items-center justify-center ${o === "dark" ? "bg-white/10" : "bg-black/5"}`,
|
|
1251
|
+
children: we(e, {
|
|
1252
|
+
className: gt(o),
|
|
1253
|
+
weight: "regular"
|
|
1254
|
+
})
|
|
1255
|
+
}
|
|
1256
|
+
) : n ? /* @__PURE__ */ t("div", { className: `relative ${Tn(o)}`, children: /* @__PURE__ */ t(
|
|
1257
|
+
"img",
|
|
1258
|
+
{
|
|
1259
|
+
src: n,
|
|
1260
|
+
alt: a ?? "",
|
|
1261
|
+
draggable: !1,
|
|
1262
|
+
className: "absolute inset-0 h-full w-full object-cover"
|
|
1263
|
+
}
|
|
1264
|
+
) }) : /* @__PURE__ */ t(
|
|
1265
|
+
"div",
|
|
1266
|
+
{
|
|
1267
|
+
className: `flex aspect-video w-full items-center justify-center ${o === "dark" ? "bg-white/10" : "bg-black/5"}`,
|
|
1268
|
+
children: we(e, {
|
|
1269
|
+
className: gt(o),
|
|
1270
|
+
weight: "regular"
|
|
1271
|
+
})
|
|
1272
|
+
}
|
|
1273
|
+
);
|
|
1274
|
+
}, At = ({
|
|
1275
|
+
variant: e,
|
|
1276
|
+
thumbnail: s,
|
|
1277
|
+
title: n,
|
|
1278
|
+
placeholderTitle: a = "Attachment title",
|
|
1279
|
+
mimeType: o,
|
|
1280
|
+
detail: l,
|
|
1281
|
+
statusBadge: i,
|
|
1282
|
+
action: c,
|
|
1283
|
+
topLeft: f,
|
|
1284
|
+
topRight: g,
|
|
1285
|
+
rootRef: y,
|
|
1286
|
+
"data-testid": m
|
|
1287
|
+
}) => {
|
|
1288
|
+
const h = e === "dark", r = h ? n ?? a : n ?? "", b = h && !n;
|
|
1289
|
+
return /* @__PURE__ */ d(
|
|
1290
|
+
"div",
|
|
1291
|
+
{
|
|
1292
|
+
ref: y,
|
|
1293
|
+
"data-testid": m,
|
|
1294
|
+
className: D(
|
|
1295
|
+
"relative w-[280px] select-none overflow-hidden rounded-[24px] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",
|
|
1296
|
+
h ? "bg-[#121110]" : "bg-white"
|
|
1297
|
+
),
|
|
1298
|
+
children: [
|
|
1299
|
+
f ? /* @__PURE__ */ t("div", { className: "pointer-events-auto absolute left-3 top-3 z-50", children: f }) : null,
|
|
1300
|
+
g ? /* @__PURE__ */ t("div", { className: "pointer-events-auto absolute right-3 top-3 z-50", children: g }) : null,
|
|
1301
|
+
s,
|
|
1302
|
+
/* @__PURE__ */ d("div", { className: "px-4 pb-3 pt-3", children: [
|
|
1303
|
+
r.trim() !== "" && /* @__PURE__ */ t(
|
|
1304
|
+
"p",
|
|
1305
|
+
{
|
|
1306
|
+
className: D("mb-0.5 truncate text-base font-medium", {
|
|
1307
|
+
"text-black": !h,
|
|
1308
|
+
"text-white/30": h && b,
|
|
1309
|
+
"text-white": h && !b
|
|
1310
|
+
}),
|
|
1311
|
+
children: r
|
|
1312
|
+
}
|
|
1313
|
+
),
|
|
1314
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
1315
|
+
we(o, {
|
|
1316
|
+
className: D(
|
|
1317
|
+
"size-5 shrink-0",
|
|
1318
|
+
h ? "text-white/55" : "text-black/55"
|
|
1319
|
+
),
|
|
1320
|
+
weight: "regular"
|
|
1321
|
+
}),
|
|
1322
|
+
l != null && l !== "" && /* @__PURE__ */ t(
|
|
1323
|
+
"span",
|
|
1324
|
+
{
|
|
1325
|
+
className: D(
|
|
1326
|
+
"text-xs font-medium",
|
|
1327
|
+
h ? "text-white/55" : "text-black/55"
|
|
1328
|
+
),
|
|
1329
|
+
children: l
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
i
|
|
1333
|
+
] }),
|
|
1334
|
+
c
|
|
1335
|
+
] })
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
);
|
|
1339
|
+
};
|
|
1340
|
+
function Ft(e) {
|
|
1341
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
1342
|
+
}
|
|
1343
|
+
function Ue(e) {
|
|
1344
|
+
return `w-[280px] select-none overflow-hidden rounded-[24px] ${e ? "bg-[#121110]" : "bg-[#F3F3F1]"} shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]`;
|
|
1345
|
+
}
|
|
1346
|
+
function Mn(e) {
|
|
1347
|
+
return e ? "bg-white/10" : "bg-black/5";
|
|
1348
|
+
}
|
|
1349
|
+
function Dn(e) {
|
|
1350
|
+
return e ? "text-white" : "text-black";
|
|
1351
|
+
}
|
|
1352
|
+
function Rn(e) {
|
|
1353
|
+
return e ? "text-white/55" : "text-black/55";
|
|
1354
|
+
}
|
|
1355
|
+
function Ln(e) {
|
|
1356
|
+
return e ? "text-white/40" : "text-black/40";
|
|
1357
|
+
}
|
|
1358
|
+
function An(e) {
|
|
1359
|
+
return e ? "text-white/20" : "text-black/20";
|
|
1360
|
+
}
|
|
1361
|
+
const $e = ({ attachment: e, isMyMessage: s }) => {
|
|
1362
|
+
const { title: n, text: a, image_url: o, og_scrape_url: l, title_link: i } = e, c = l ?? i, f = typeof c == "string" && c.trim() !== "" ? c : void 0, g = /* @__PURE__ */ d(P.Fragment, { children: [
|
|
1363
|
+
/* @__PURE__ */ t("div", { className: "p-2", children: o ? /* @__PURE__ */ t(
|
|
1364
|
+
"img",
|
|
1365
|
+
{
|
|
1366
|
+
src: o,
|
|
1367
|
+
alt: n ?? "",
|
|
1368
|
+
className: "aspect-video w-full rounded-[20px] object-cover"
|
|
1369
|
+
}
|
|
1370
|
+
) : /* @__PURE__ */ t(
|
|
1371
|
+
"div",
|
|
1372
|
+
{
|
|
1373
|
+
className: `aspect-video w-full rounded-[20px] ${Mn(s)} flex items-center justify-center`,
|
|
1374
|
+
children: /* @__PURE__ */ t(js, { className: `size-12 ${An(s)}` })
|
|
1375
|
+
}
|
|
1376
|
+
) }),
|
|
1377
|
+
/* @__PURE__ */ d("div", { className: "px-3 pb-3", children: [
|
|
1378
|
+
n && /* @__PURE__ */ t("p", { className: `truncate text-[14px] font-medium leading-5 ${Dn(s)}`, children: n }),
|
|
1379
|
+
a && /* @__PURE__ */ t("p", { className: `truncate text-[12px] leading-4 ${Rn(s)}`, children: a }),
|
|
1380
|
+
f && /* @__PURE__ */ t("p", { className: `mt-1 truncate text-[12px] leading-4 ${Ln(s)}`, children: f })
|
|
1381
|
+
] })
|
|
1382
|
+
] });
|
|
1383
|
+
return f ? /* @__PURE__ */ t("a", { href: f, target: "_blank", rel: "noopener noreferrer", className: "block no-underline", children: g }) : /* @__PURE__ */ t("div", { className: "block", children: g });
|
|
1384
|
+
};
|
|
1385
|
+
function Ot(e) {
|
|
1386
|
+
return e.type === "link" || !!e.og_scrape_url && !e.asset_url;
|
|
1387
|
+
}
|
|
1388
|
+
function je(e) {
|
|
1389
|
+
var s;
|
|
1390
|
+
return (s = e.attachments) == null ? void 0 : s.find(Ot);
|
|
1391
|
+
}
|
|
1392
|
+
async function Fn(e, s) {
|
|
1393
|
+
let n;
|
|
1394
|
+
try {
|
|
1395
|
+
n = s ?? new URL(e).pathname.split("/").pop() ?? "download";
|
|
1396
|
+
} catch {
|
|
1397
|
+
n = s ?? "download";
|
|
1398
|
+
}
|
|
1399
|
+
const a = await fetch(e, { mode: "cors" });
|
|
1400
|
+
if (!a.ok) throw new Error(`HTTP ${a.status}`);
|
|
1401
|
+
const o = await a.blob(), l = URL.createObjectURL(o), i = document.createElement("a");
|
|
1402
|
+
i.href = l, i.download = n, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(l);
|
|
1403
|
+
}
|
|
1404
|
+
const On = ({
|
|
1405
|
+
url: e,
|
|
1406
|
+
filename: s
|
|
1407
|
+
}) => {
|
|
1408
|
+
const [n, a] = O(!1);
|
|
1409
|
+
return /* @__PURE__ */ t(
|
|
1410
|
+
"button",
|
|
1411
|
+
{
|
|
1412
|
+
type: "button",
|
|
1413
|
+
onClick: (l) => {
|
|
1414
|
+
l.stopPropagation();
|
|
1415
|
+
const i = window.open("", "_blank", "noopener,noreferrer");
|
|
1416
|
+
a(!0), Fn(e, s).then(() => {
|
|
1417
|
+
i == null || i.close();
|
|
1418
|
+
}).catch(() => {
|
|
1419
|
+
i && (i.location.href = e);
|
|
1420
|
+
}).finally(() => a(!1));
|
|
1421
|
+
},
|
|
1422
|
+
disabled: n,
|
|
1423
|
+
className: "mt-3 inline-flex h-10 w-full items-center justify-center gap-2 rounded-full bg-[#121110] px-4 text-sm font-medium leading-none text-white hover:bg-[#2a2928] disabled:opacity-70",
|
|
1424
|
+
children: n ? /* @__PURE__ */ t(Nt, { className: "size-4 animate-spin text-white", weight: "bold" }) : /* @__PURE__ */ d(P.Fragment, { children: [
|
|
1425
|
+
/* @__PURE__ */ t(Gs, { className: "size-4 text-white", weight: "bold" }),
|
|
1426
|
+
"Download"
|
|
1427
|
+
] })
|
|
1428
|
+
}
|
|
1429
|
+
);
|
|
1430
|
+
};
|
|
1431
|
+
function Ge(e) {
|
|
1432
|
+
var m, h, r, b;
|
|
1433
|
+
const s = (m = e.attachments) == null ? void 0 : m.find(
|
|
1434
|
+
(w) => w.type === "video" && w.asset_url
|
|
1435
|
+
), n = (h = e.attachments) == null ? void 0 : h.find(
|
|
1436
|
+
(w) => w.type === "image" && w.image_url
|
|
1437
|
+
), a = (r = e.attachments) == null ? void 0 : r.find(
|
|
1438
|
+
(w) => w.type === "audio" && w.asset_url
|
|
1439
|
+
), o = (b = e.attachments) == null ? void 0 : b.find(
|
|
1440
|
+
(w) => w.type === "file" && w.asset_url
|
|
1441
|
+
), l = s ?? n ?? a ?? o, i = (s == null ? void 0 : s.asset_url) ?? (n == null ? void 0 : n.image_url) ?? (a == null ? void 0 : a.asset_url) ?? (o == null ? void 0 : o.asset_url);
|
|
1442
|
+
if (!i) return null;
|
|
1443
|
+
const c = (l == null ? void 0 : l.mime_type) ?? ((l == null ? void 0 : l.type) === "image" ? "image/jpeg" : (l == null ? void 0 : l.type) === "video" ? "video/mp4" : (l == null ? void 0 : l.type) === "audio" ? "audio/mpeg" : "application/octet-stream"), f = l == null ? void 0 : l.title, g = l == null ? void 0 : l.file_size, y = s == null ? void 0 : s.thumb_url;
|
|
1444
|
+
return {
|
|
1445
|
+
resolvedUrl: i,
|
|
1446
|
+
resolvedType: c,
|
|
1447
|
+
title: f,
|
|
1448
|
+
fileSize: g,
|
|
1449
|
+
thumbnailUrl: y
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
const Pt = ({
|
|
1453
|
+
resolvedUrl: e,
|
|
1454
|
+
resolvedType: s,
|
|
1455
|
+
title: n,
|
|
1456
|
+
fileSize: a,
|
|
1457
|
+
thumbnailUrl: o
|
|
1458
|
+
}) => {
|
|
1459
|
+
const l = a !== void 0 ? Ft(a) : void 0;
|
|
1460
|
+
return /* @__PURE__ */ t(
|
|
1461
|
+
At,
|
|
1462
|
+
{
|
|
1463
|
+
variant: "dark",
|
|
1464
|
+
title: n,
|
|
1465
|
+
placeholderTitle: "",
|
|
1466
|
+
mimeType: s,
|
|
1467
|
+
detail: l,
|
|
1468
|
+
thumbnail: /* @__PURE__ */ t(
|
|
1469
|
+
Lt,
|
|
1470
|
+
{
|
|
1471
|
+
mimeType: s,
|
|
1472
|
+
sourceUrl: e,
|
|
1473
|
+
thumbnailUrl: o,
|
|
1474
|
+
title: n,
|
|
1475
|
+
variant: "dark"
|
|
1476
|
+
}
|
|
1477
|
+
)
|
|
1478
|
+
}
|
|
1479
|
+
);
|
|
1480
|
+
}, zt = ({
|
|
1481
|
+
resolvedUrl: e,
|
|
1482
|
+
resolvedType: s,
|
|
1483
|
+
title: n,
|
|
1484
|
+
fileSize: a,
|
|
1485
|
+
thumbnailUrl: o
|
|
1486
|
+
}) => {
|
|
1487
|
+
const l = _e(s), i = a !== void 0 ? Ft(a) : void 0;
|
|
1488
|
+
return /* @__PURE__ */ t(
|
|
1489
|
+
At,
|
|
1490
|
+
{
|
|
1491
|
+
variant: "light",
|
|
1492
|
+
title: n,
|
|
1493
|
+
mimeType: s,
|
|
1494
|
+
detail: i,
|
|
1495
|
+
thumbnail: /* @__PURE__ */ t(
|
|
1496
|
+
Lt,
|
|
1497
|
+
{
|
|
1498
|
+
mimeType: s,
|
|
1499
|
+
sourceUrl: e,
|
|
1500
|
+
thumbnailUrl: o,
|
|
1501
|
+
title: n,
|
|
1502
|
+
variant: "light",
|
|
1503
|
+
containedImage: l === "image" || l === "document"
|
|
1504
|
+
}
|
|
1505
|
+
),
|
|
1506
|
+
action: /* @__PURE__ */ t(On, { url: e, filename: n })
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
}, Pn = ({
|
|
1510
|
+
message: e,
|
|
1511
|
+
isMyMessage: s = !1
|
|
1512
|
+
}) => {
|
|
1513
|
+
const n = je(e), a = Ge(e);
|
|
1514
|
+
return !n && !a ? null : /* @__PURE__ */ d("div", { className: s ? "str-chat__message str-chat__message-simple str-chat__message--me str-chat__message-simple--me" : "str-chat__message str-chat__message-simple str-chat__message--other", children: [
|
|
1515
|
+
!s && e.user && /* @__PURE__ */ t(
|
|
1516
|
+
ae,
|
|
1517
|
+
{
|
|
1518
|
+
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
1519
|
+
id: e.user.id,
|
|
1520
|
+
image: e.user.image,
|
|
1521
|
+
name: e.user.name ?? e.user.id
|
|
1522
|
+
}
|
|
1523
|
+
),
|
|
1524
|
+
/* @__PURE__ */ t(
|
|
1525
|
+
"div",
|
|
1526
|
+
{
|
|
1527
|
+
className: "str-chat__message-inner",
|
|
1528
|
+
style: { marginInlineEnd: 0, marginInlineStart: 0 },
|
|
1529
|
+
children: /* @__PURE__ */ t("div", { className: "str-chat__message-bubble-wrapper", children: /* @__PURE__ */ t(
|
|
1530
|
+
"div",
|
|
1531
|
+
{
|
|
1532
|
+
className: "str-chat__message-bubble",
|
|
1533
|
+
style: { padding: 0, borderRadius: 0, overflow: "visible", background: "transparent" },
|
|
1534
|
+
children: n ? /* @__PURE__ */ t("div", { className: Ue(s), children: /* @__PURE__ */ t($e, { attachment: n, isMyMessage: s }) }) : s ? /* @__PURE__ */ t(Pt, { ...a }) : /* @__PURE__ */ t(zt, { ...a })
|
|
1535
|
+
}
|
|
1536
|
+
) })
|
|
1537
|
+
}
|
|
1538
|
+
)
|
|
1539
|
+
] });
|
|
1540
|
+
}, zn = ({
|
|
1541
|
+
message: e
|
|
1542
|
+
}) => {
|
|
1543
|
+
const s = je(e);
|
|
1544
|
+
if (s)
|
|
1545
|
+
return /* @__PURE__ */ t("div", { className: Ue(!0), children: /* @__PURE__ */ t($e, { attachment: s, isMyMessage: !0 }) });
|
|
1546
|
+
const n = Ge(e);
|
|
1547
|
+
return n ? /* @__PURE__ */ t(Pt, { ...n }) : null;
|
|
1548
|
+
}, Bn = ({
|
|
1549
|
+
message: e
|
|
1550
|
+
}) => {
|
|
1551
|
+
const s = je(e);
|
|
1552
|
+
if (s)
|
|
1553
|
+
return /* @__PURE__ */ t("div", { className: Ue(!1), children: /* @__PURE__ */ t($e, { attachment: s, isMyMessage: !1 }) });
|
|
1554
|
+
const n = Ge(e);
|
|
1555
|
+
return n ? /* @__PURE__ */ t(zt, { ...n }) : null;
|
|
1556
|
+
}, Ea = Object.assign(Pn, {
|
|
1557
|
+
Creator: zn,
|
|
1558
|
+
Visitor: Bn
|
|
1559
|
+
}), Un = {
|
|
1560
|
+
isUnlocking: () => !1
|
|
1561
|
+
}, $n = {
|
|
1562
|
+
LockedAttachment: Un
|
|
1563
|
+
}, Bt = Ae({}), Sa = Bt.Provider;
|
|
1564
|
+
function jn(e) {
|
|
1565
|
+
return Fe(Bt)[e] ?? $n[e];
|
|
1566
|
+
}
|
|
1567
|
+
const Gn = ({
|
|
1568
|
+
selected: e,
|
|
1569
|
+
onVoteUp: s,
|
|
1570
|
+
onVoteDown: n
|
|
1571
|
+
}) => /* @__PURE__ */ d("div", { className: "message-vote-buttons", children: [
|
|
1572
|
+
/* @__PURE__ */ t(
|
|
1573
|
+
"button",
|
|
1574
|
+
{
|
|
1575
|
+
type: "button",
|
|
1576
|
+
className: D("message-vote-button focus-ring", {
|
|
1577
|
+
"message-vote-button--selected": e === "up"
|
|
1578
|
+
}),
|
|
1579
|
+
onClick: s,
|
|
1580
|
+
"aria-label": "Good response",
|
|
1581
|
+
"aria-pressed": e === "up",
|
|
1582
|
+
"data-tooltip": "Good response",
|
|
1583
|
+
children: /* @__PURE__ */ t(Vs, { size: 16, weight: e === "up" ? "fill" : "regular" })
|
|
1584
|
+
}
|
|
1585
|
+
),
|
|
1586
|
+
/* @__PURE__ */ t(
|
|
1587
|
+
"button",
|
|
1588
|
+
{
|
|
1589
|
+
type: "button",
|
|
1590
|
+
className: D("message-vote-button focus-ring", {
|
|
1591
|
+
"message-vote-button--selected": e === "down"
|
|
1592
|
+
}),
|
|
1593
|
+
onClick: n,
|
|
1594
|
+
"aria-label": "Bad response",
|
|
1595
|
+
"aria-pressed": e === "down",
|
|
1596
|
+
"data-tooltip": "Bad response",
|
|
1597
|
+
children: /* @__PURE__ */ t(Hs, { size: 16, weight: e === "down" ? "fill" : "regular" })
|
|
1598
|
+
}
|
|
1599
|
+
)
|
|
1600
|
+
] }), Vn = (e) => {
|
|
1601
|
+
var Ve, He, Ye, qe, We, Xe, Ze, Je, Ke, Qe, et, tt, st, nt;
|
|
1602
|
+
const {
|
|
1603
|
+
additionalMessageInputProps: s,
|
|
1604
|
+
chatbotVotingEnabled: n,
|
|
1605
|
+
editing: a,
|
|
1606
|
+
endOfGroup: o,
|
|
1607
|
+
firstOfGroup: l,
|
|
1608
|
+
groupedByUser: i,
|
|
1609
|
+
handleAction: c,
|
|
1610
|
+
handleOpenThread: f,
|
|
1611
|
+
handleRetry: g,
|
|
1612
|
+
highlighted: y,
|
|
1613
|
+
isMessageAIGenerated: m,
|
|
1614
|
+
isMyMessage: h,
|
|
1615
|
+
message: r,
|
|
1616
|
+
renderText: b,
|
|
1617
|
+
threadList: w,
|
|
1618
|
+
viewerLanguage: x
|
|
1619
|
+
} = e, { client: N } = Pe("CustomMessage"), { channel: p } = oe("CustomMessage"), { isUnlocking: I, onUnlockClick: S, onFetchSource: T, onDownloadClick: $ } = jn("LockedAttachment"), [k, M] = O(!1), j = Wt(r.id), { selected: _, voteUp: L, voteDown: v } = gn(r), {
|
|
1620
|
+
Attachment: A = Xt,
|
|
1621
|
+
EditMessageModal: V = Zt,
|
|
1622
|
+
MessageBlocked: R = Jt,
|
|
1623
|
+
MessageBouncePrompt: z = Kt,
|
|
1624
|
+
MessageDeleted: E = Qt,
|
|
1625
|
+
MessageIsThreadReplyInChannelButtonIndicator: H = es,
|
|
1626
|
+
MessageRepliesCountButton: Y = ts,
|
|
1627
|
+
ReminderNotification: te = ss,
|
|
1628
|
+
StreamedMessageText: B = ns,
|
|
1629
|
+
PinIndicator: u
|
|
1630
|
+
} = vt("CustomMessage"), C = as(r), U = rs(r), K = pe(
|
|
1631
|
+
() => m == null ? void 0 : m(r),
|
|
1632
|
+
[m, r]
|
|
1633
|
+
), W = pe(() => {
|
|
1634
|
+
const ue = r.attachments ?? [], ge = r.shared_location ? [r.shared_location, ...ue] : ue;
|
|
1635
|
+
if (!ve(r)) return ge;
|
|
1636
|
+
const at = ge.filter((rt) => !("type" in rt) || !Ot(rt));
|
|
1637
|
+
return at.length === ge.length ? ge : at;
|
|
1638
|
+
}, [r]), Q = pe(() => {
|
|
1639
|
+
const ue = It({ message: r, viewerLanguage: x });
|
|
1640
|
+
return ue === r.text ? r : { ...r, text: ue };
|
|
1641
|
+
}, [r, x]);
|
|
1642
|
+
if (is(r))
|
|
1643
|
+
return null;
|
|
1644
|
+
if (r.deleted_at || r.type === "deleted")
|
|
1645
|
+
return /* @__PURE__ */ t(E, { message: r });
|
|
1646
|
+
if (os(r))
|
|
1647
|
+
return /* @__PURE__ */ t(R, {});
|
|
1648
|
+
const me = !w && !!r.reply_count, he = !w && r.show_in_channel && r.parent_id, re = r.status === "failed" && ((Ve = r.error) == null ? void 0 : Ve.status) !== 403, ee = ls(r);
|
|
1649
|
+
let se;
|
|
1650
|
+
re ? se = () => g(r) : ee && (se = () => M(!0));
|
|
1651
|
+
const ie = h(), Ne = D(
|
|
1652
|
+
"str-chat__message str-chat__message-simple",
|
|
1653
|
+
`str-chat__message--${r.type}`,
|
|
1654
|
+
`str-chat__message--${r.status}`,
|
|
1655
|
+
ie ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
1656
|
+
r.text ? "str-chat__message--has-text" : "has-no-text",
|
|
1657
|
+
{
|
|
1658
|
+
"str-chat__message--has-attachment": C,
|
|
1659
|
+
"str-chat__message--highlighted": y,
|
|
1660
|
+
"str-chat__message--pinned pinned-message": r.pinned,
|
|
1661
|
+
"str-chat__message--with-reactions": U,
|
|
1662
|
+
"str-chat__message-send-can-be-retried": (r == null ? void 0 : r.status) === "failed" && ((He = r == null ? void 0 : r.error) == null ? void 0 : He.status) !== 403,
|
|
1663
|
+
"str-chat__message-with-thread-link": me || he,
|
|
1664
|
+
"str-chat__virtual-message__wrapper--end": o,
|
|
1665
|
+
"str-chat__virtual-message__wrapper--first": l,
|
|
1666
|
+
"str-chat__virtual-message__wrapper--group": i
|
|
1667
|
+
}
|
|
1668
|
+
), fe = r.poll_id && N.polls.fromState(r.poll_id), le = ln(r), F = ve(r), X = on(r), Z = !!(W != null && W.length && !r.quoted_message), ne = F && ie && Z;
|
|
1669
|
+
return /* @__PURE__ */ d(de, { children: [
|
|
1670
|
+
a && /* @__PURE__ */ t(
|
|
1671
|
+
V,
|
|
1672
|
+
{
|
|
1673
|
+
additionalMessageInputProps: s
|
|
1674
|
+
}
|
|
1675
|
+
),
|
|
1676
|
+
k && /* @__PURE__ */ t(
|
|
1677
|
+
cs,
|
|
1678
|
+
{
|
|
1679
|
+
MessageBouncePrompt: z,
|
|
1680
|
+
onClose: () => M(!1),
|
|
1681
|
+
open: k
|
|
1682
|
+
}
|
|
1683
|
+
),
|
|
1684
|
+
/* @__PURE__ */ d("div", { className: Ne, children: [
|
|
1685
|
+
u && /* @__PURE__ */ t(u, {}),
|
|
1686
|
+
!!j && /* @__PURE__ */ t(te, { reminder: j }),
|
|
1687
|
+
r.user && /* @__PURE__ */ t(
|
|
1688
|
+
ae,
|
|
1689
|
+
{
|
|
1690
|
+
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
1691
|
+
id: r.user.id,
|
|
1692
|
+
image: r.user.image,
|
|
1693
|
+
name: r.user.name || r.user.id,
|
|
1694
|
+
size: F ? 24 : 28,
|
|
1695
|
+
shape: "circle",
|
|
1696
|
+
dmAgentEnabled: F
|
|
1697
|
+
}
|
|
1698
|
+
),
|
|
1699
|
+
/* @__PURE__ */ t(
|
|
1700
|
+
"div",
|
|
1701
|
+
{
|
|
1702
|
+
className: D("str-chat__message-inner", {
|
|
1703
|
+
"str-chat__simple-message--error-failed": re || ee
|
|
1704
|
+
}),
|
|
1705
|
+
"data-testid": "message-inner",
|
|
1706
|
+
onClick: se,
|
|
1707
|
+
onKeyDown: se,
|
|
1708
|
+
role: se ? "button" : void 0,
|
|
1709
|
+
tabIndex: se ? 0 : void 0,
|
|
1710
|
+
style: {
|
|
1711
|
+
// Force margins to 0 to prevent hover layout shift
|
|
1712
|
+
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
1713
|
+
marginInlineEnd: 0,
|
|
1714
|
+
marginInlineStart: 0
|
|
1715
|
+
},
|
|
1716
|
+
children: X ? /* @__PURE__ */ d("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
1717
|
+
ie ? /* @__PURE__ */ t(
|
|
1718
|
+
ft.Sent,
|
|
1719
|
+
{
|
|
1720
|
+
title: (Ye = r.metadata) == null ? void 0 : Ye.attachment_title,
|
|
1721
|
+
mimeType: (qe = r.metadata) == null ? void 0 : qe.attachment_mime_type,
|
|
1722
|
+
thumbnailUrl: (We = r.metadata) == null ? void 0 : We.attachment_thumbnail,
|
|
1723
|
+
amountText: (Xe = r.metadata) == null ? void 0 : Xe.amount_text,
|
|
1724
|
+
detail: (Ze = r.metadata) == null ? void 0 : Ze.attachment_detail,
|
|
1725
|
+
paymentStatus: (Je = r.metadata) == null ? void 0 : Je.payment_status,
|
|
1726
|
+
onPreviewClick: () => S == null ? void 0 : S(r, p),
|
|
1727
|
+
onFetchSource: async () => await (T == null ? void 0 : T(r, p))
|
|
1728
|
+
}
|
|
1729
|
+
) : /* @__PURE__ */ t(
|
|
1730
|
+
ft.Received,
|
|
1731
|
+
{
|
|
1732
|
+
title: (Ke = r.metadata) == null ? void 0 : Ke.attachment_title,
|
|
1733
|
+
mimeType: (Qe = r.metadata) == null ? void 0 : Qe.attachment_mime_type,
|
|
1734
|
+
thumbnailUrl: (et = r.metadata) == null ? void 0 : et.attachment_thumbnail,
|
|
1735
|
+
amountText: (tt = r.metadata) == null ? void 0 : tt.amount_text,
|
|
1736
|
+
detail: (st = r.metadata) == null ? void 0 : st.attachment_detail,
|
|
1737
|
+
paymentStatus: (nt = r.metadata) == null ? void 0 : nt.payment_status,
|
|
1738
|
+
isUnlocking: I(r.id),
|
|
1739
|
+
onUnlockClick: () => S == null ? void 0 : S(r, p),
|
|
1740
|
+
onFetchSource: async () => await (T == null ? void 0 : T(r, p)),
|
|
1741
|
+
onDownloadClick: () => $ == null ? void 0 : $(r, p)
|
|
1742
|
+
}
|
|
1743
|
+
),
|
|
1744
|
+
r.text && /* @__PURE__ */ t("div", { className: "str-chat__message-bubble", children: /* @__PURE__ */ t(
|
|
1745
|
+
it,
|
|
1746
|
+
{
|
|
1747
|
+
message: Q,
|
|
1748
|
+
renderText: b
|
|
1749
|
+
}
|
|
1750
|
+
) })
|
|
1751
|
+
] }) : le ? (
|
|
1752
|
+
/* Tip-only messages render as a standalone bubble */
|
|
1753
|
+
/* @__PURE__ */ t(Ie, { message: r, standalone: !0 })
|
|
1754
|
+
) : /* @__PURE__ */ d("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
1755
|
+
/* @__PURE__ */ d("div", { className: "str-chat__message-bubble", children: [
|
|
1756
|
+
F && !ne && /* @__PURE__ */ t(
|
|
1757
|
+
Ie,
|
|
1758
|
+
{
|
|
1759
|
+
message: r,
|
|
1760
|
+
hasAttachment: Z,
|
|
1761
|
+
isMyMessage: ie
|
|
1762
|
+
}
|
|
1763
|
+
),
|
|
1764
|
+
fe && /* @__PURE__ */ t(ds, { poll: fe }),
|
|
1765
|
+
W != null && W.length && !r.quoted_message ? /* @__PURE__ */ t(
|
|
1766
|
+
A,
|
|
1767
|
+
{
|
|
1768
|
+
actionHandler: c,
|
|
1769
|
+
attachments: W
|
|
1770
|
+
}
|
|
1771
|
+
) : null,
|
|
1772
|
+
K ? /* @__PURE__ */ t(
|
|
1773
|
+
B,
|
|
1774
|
+
{
|
|
1775
|
+
message: Q,
|
|
1776
|
+
renderText: b
|
|
1777
|
+
}
|
|
1778
|
+
) : /* @__PURE__ */ t(
|
|
1779
|
+
it,
|
|
1780
|
+
{
|
|
1781
|
+
message: Q,
|
|
1782
|
+
renderText: b
|
|
1783
|
+
}
|
|
1784
|
+
),
|
|
1785
|
+
/* @__PURE__ */ t(us, {})
|
|
1786
|
+
] }),
|
|
1787
|
+
(!F || ne) && /* @__PURE__ */ t(
|
|
1788
|
+
Ie,
|
|
1789
|
+
{
|
|
1790
|
+
message: r,
|
|
1791
|
+
hasAttachment: Z,
|
|
1792
|
+
isMyMessage: ie
|
|
1793
|
+
}
|
|
1794
|
+
),
|
|
1795
|
+
n && F && /* @__PURE__ */ t(
|
|
1796
|
+
Gn,
|
|
1797
|
+
{
|
|
1798
|
+
selected: _,
|
|
1799
|
+
onVoteUp: L,
|
|
1800
|
+
onVoteDown: v
|
|
1801
|
+
}
|
|
1802
|
+
)
|
|
1803
|
+
] })
|
|
1804
|
+
}
|
|
1805
|
+
),
|
|
1806
|
+
me && /* @__PURE__ */ t(
|
|
1807
|
+
Y,
|
|
1808
|
+
{
|
|
1809
|
+
onClick: f,
|
|
1810
|
+
reply_count: r.reply_count
|
|
1811
|
+
}
|
|
1812
|
+
),
|
|
1813
|
+
he && /* @__PURE__ */ t(H, {})
|
|
1814
|
+
] }, r.id)
|
|
1815
|
+
] });
|
|
1816
|
+
}, Hn = P.memo(
|
|
1817
|
+
Vn,
|
|
1818
|
+
(e, s) => e.chatbotVotingEnabled !== s.chatbotVotingEnabled || e.viewerLanguage !== s.viewerLanguage ? !1 : qt(e, s)
|
|
1819
|
+
), Yn = (e) => {
|
|
1820
|
+
const s = wt("CustomMessage");
|
|
1821
|
+
return /* @__PURE__ */ t(Hn, { ...s, ...e });
|
|
1822
|
+
}, qn = (e) => ({
|
|
1823
|
+
linkPreviews: Array.from(e.previews.values()).filter(
|
|
1824
|
+
(s) => mt.previewIsLoaded(s) || mt.previewIsLoading(s)
|
|
1825
|
+
)
|
|
1826
|
+
}), Wn = ({
|
|
1827
|
+
link: e,
|
|
1828
|
+
onDismiss: s
|
|
1829
|
+
}) => {
|
|
1830
|
+
const { og_scrape_url: n, title: a, image_url: o } = e;
|
|
1831
|
+
return /* @__PURE__ */ d(
|
|
1832
|
+
"a",
|
|
1833
|
+
{
|
|
1834
|
+
href: n,
|
|
1835
|
+
target: "_blank",
|
|
1836
|
+
rel: "noopener noreferrer",
|
|
1837
|
+
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
1838
|
+
children: [
|
|
1839
|
+
o && /* @__PURE__ */ t(
|
|
1840
|
+
"img",
|
|
1841
|
+
{
|
|
1842
|
+
src: o,
|
|
1843
|
+
alt: a || "",
|
|
1844
|
+
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
1845
|
+
}
|
|
1846
|
+
),
|
|
1847
|
+
/* @__PURE__ */ t(
|
|
1848
|
+
"button",
|
|
1849
|
+
{
|
|
1850
|
+
type: "button",
|
|
1851
|
+
onClick: (i) => {
|
|
1852
|
+
i.preventDefault(), s(n);
|
|
1853
|
+
},
|
|
1854
|
+
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl focus-ring",
|
|
1855
|
+
"aria-label": "Close link preview",
|
|
1856
|
+
children: /* @__PURE__ */ t(yt, { className: "size-4 text-black/90" })
|
|
1857
|
+
}
|
|
1858
|
+
),
|
|
1859
|
+
/* @__PURE__ */ d("div", { className: "p-2", children: [
|
|
1860
|
+
a && /* @__PURE__ */ t("div", { className: "text-[14px] font-medium leading-5 text-white", children: a }),
|
|
1861
|
+
/* @__PURE__ */ t("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
1862
|
+
] })
|
|
1863
|
+
]
|
|
1864
|
+
}
|
|
1865
|
+
);
|
|
1866
|
+
}, Xn = () => {
|
|
1867
|
+
const { linkPreviewsManager: e } = ms(), { linkPreviews: s } = hs(
|
|
1868
|
+
e.state,
|
|
1869
|
+
qn
|
|
1870
|
+
), n = (o) => {
|
|
1871
|
+
e.dismissPreview(o);
|
|
1872
|
+
};
|
|
1873
|
+
return s.length > 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ t(
|
|
1874
|
+
Wn,
|
|
1875
|
+
{
|
|
1876
|
+
link: o,
|
|
1877
|
+
onDismiss: n
|
|
1878
|
+
},
|
|
1879
|
+
o.og_scrape_url
|
|
1880
|
+
)) }) : null;
|
|
1881
|
+
}, Zn = ({ sendMessage: e, disabled: s, ...n }) => /* @__PURE__ */ t(
|
|
1882
|
+
"button",
|
|
1883
|
+
{
|
|
1884
|
+
...n,
|
|
1885
|
+
type: "button",
|
|
1886
|
+
"aria-label": "Send",
|
|
1887
|
+
disabled: s,
|
|
1888
|
+
onClick: e,
|
|
1889
|
+
children: /* @__PURE__ */ t(Ys, { weight: "bold", className: "size-4" })
|
|
1890
|
+
}
|
|
1891
|
+
), Jn = () => {
|
|
1892
|
+
var c;
|
|
1893
|
+
const { channel: e } = oe(), s = ((c = e == null ? void 0 : e.data) == null ? void 0 : c.frozen) === !0, { handleSubmit: n } = gs(), { SendButton: a } = vt(
|
|
1894
|
+
"CustomMessageInput"
|
|
1895
|
+
), o = a ?? Zn, l = bs();
|
|
1896
|
+
return /* @__PURE__ */ d(de, { children: [
|
|
1897
|
+
/* @__PURE__ */ t("div", { className: "left-container", children: /* @__PURE__ */ t(ps, {}) }),
|
|
1898
|
+
/* @__PURE__ */ d("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
|
|
1899
|
+
/* @__PURE__ */ t(xs, {}),
|
|
1900
|
+
/* @__PURE__ */ t(Xn, {}),
|
|
1901
|
+
/* @__PURE__ */ t(vs, {}),
|
|
1902
|
+
/* @__PURE__ */ d("div", { className: "flex", children: [
|
|
1903
|
+
/* @__PURE__ */ t("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ t(
|
|
1904
|
+
ws,
|
|
1905
|
+
{
|
|
1906
|
+
"aria-disabled": s || void 0,
|
|
1907
|
+
className: "w-full resize-none outline-none leading-6",
|
|
1908
|
+
autoFocus: !s,
|
|
1909
|
+
maxRows: 4,
|
|
1910
|
+
readOnly: s,
|
|
1911
|
+
tabIndex: s ? -1 : void 0
|
|
1912
|
+
}
|
|
1913
|
+
) }),
|
|
1914
|
+
/* @__PURE__ */ t(
|
|
1915
|
+
o,
|
|
1916
|
+
{
|
|
1917
|
+
sendMessage: n,
|
|
1918
|
+
"aria-label": "Send",
|
|
1919
|
+
className: "str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white focus-ring",
|
|
1920
|
+
"data-testid": "send-button",
|
|
1921
|
+
disabled: s || !l,
|
|
1922
|
+
type: "button"
|
|
1923
|
+
}
|
|
1924
|
+
)
|
|
1925
|
+
] })
|
|
1926
|
+
] })
|
|
1927
|
+
] });
|
|
1928
|
+
}, Kn = ({
|
|
1929
|
+
renderActions: e
|
|
1930
|
+
}) => {
|
|
1931
|
+
var a;
|
|
1932
|
+
const { channel: s } = oe(), n = ((a = s == null ? void 0 : s.data) == null ? void 0 : a.frozen) === !0;
|
|
1933
|
+
return /* @__PURE__ */ d(
|
|
1934
|
+
"div",
|
|
1935
|
+
{
|
|
1936
|
+
inert: n ? "" : void 0,
|
|
1937
|
+
"aria-disabled": n || void 0,
|
|
1938
|
+
className: "message-input flex items-center gap-2 p-4 aria-disabled:opacity-40",
|
|
1939
|
+
children: [
|
|
1940
|
+
e == null ? void 0 : e(),
|
|
1941
|
+
/* @__PURE__ */ t(fs, { Input: Jn })
|
|
1942
|
+
]
|
|
1943
|
+
}
|
|
1944
|
+
);
|
|
1945
|
+
}, Qn = [
|
|
1946
|
+
"SYSTEM_DM_AGENT_PAUSED",
|
|
1947
|
+
"SYSTEM_DM_AGENT_RESUMED"
|
|
1948
|
+
], ea = {
|
|
1949
|
+
SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
|
|
1950
|
+
SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
|
|
1951
|
+
}, ta = [
|
|
1952
|
+
"SYSTEM_AGE_SAFETY_BLOCKED"
|
|
1953
|
+
], sa = {
|
|
1954
|
+
SYSTEM_AGE_SAFETY_BLOCKED: "This user isn’t able to reply because they don’t meet our age safety guidelines."
|
|
1955
|
+
}, ke = "age safety guidelines.", na = "https://linktr.ee/s/about/contact", bt = (e) => Qn.includes(e), aa = (e) => ta.includes(e), ra = (e) => {
|
|
1956
|
+
var a;
|
|
1957
|
+
const s = (a = e.metadata) == null ? void 0 : a.custom_type;
|
|
1958
|
+
if (bt(s))
|
|
1959
|
+
return {
|
|
1960
|
+
kind: "dm-agent",
|
|
1961
|
+
type: s
|
|
1962
|
+
};
|
|
1963
|
+
if (aa(s))
|
|
1964
|
+
return {
|
|
1965
|
+
kind: "age-safety",
|
|
1966
|
+
type: s
|
|
1967
|
+
};
|
|
1968
|
+
const n = e.dm_agent_system_type;
|
|
1969
|
+
if (bt(n))
|
|
1970
|
+
return {
|
|
1971
|
+
kind: "dm-agent",
|
|
1972
|
+
type: n
|
|
1973
|
+
};
|
|
1974
|
+
}, ia = (e) => {
|
|
1975
|
+
const s = e.indexOf(ke);
|
|
1976
|
+
if (s === -1)
|
|
1977
|
+
return e;
|
|
1978
|
+
const n = s + ke.length;
|
|
1979
|
+
return /* @__PURE__ */ d(de, { children: [
|
|
1980
|
+
e.slice(0, s),
|
|
1981
|
+
/* @__PURE__ */ t(
|
|
1982
|
+
"a",
|
|
1983
|
+
{
|
|
1984
|
+
href: na,
|
|
1985
|
+
target: "_blank",
|
|
1986
|
+
rel: "noopener noreferrer",
|
|
1987
|
+
className: "mes-age-safety-system-message__emphasis font-medium text-inherit underline",
|
|
1988
|
+
children: ke
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
e.slice(n)
|
|
1992
|
+
] });
|
|
1993
|
+
}, oa = (e) => {
|
|
1994
|
+
var a, o;
|
|
1995
|
+
const s = e.message.hide_date === !0, n = ra(
|
|
1996
|
+
e.message
|
|
1997
|
+
);
|
|
1998
|
+
if ((n == null ? void 0 : n.kind) === "dm-agent") {
|
|
1999
|
+
const l = ((a = e.message.text) == null ? void 0 : a.trim()) || ea[n.type];
|
|
2000
|
+
return /* @__PURE__ */ d("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
2001
|
+
/* @__PURE__ */ d(
|
|
2002
|
+
"div",
|
|
2003
|
+
{
|
|
2004
|
+
className: "mes-dm-agent-system-message mx-auto mb-2 inline-flex w-fit max-w-[min(100%,480px)] items-center justify-center gap-[10px] rounded-[12px] border border-[rgba(0,0,0,0.08)] p-3 text-[rgba(0,0,0,0.55)]",
|
|
2005
|
+
"data-testid": "dm-agent-system-message",
|
|
2006
|
+
"data-dm-agent-system-type": n.type,
|
|
2007
|
+
children: [
|
|
2008
|
+
/* @__PURE__ */ t(
|
|
2009
|
+
De,
|
|
2010
|
+
{
|
|
2011
|
+
size: 16,
|
|
2012
|
+
weight: "regular",
|
|
2013
|
+
"aria-hidden": !0,
|
|
2014
|
+
className: "mes-dm-agent-system-message__sparkle shrink-0"
|
|
2015
|
+
}
|
|
2016
|
+
),
|
|
2017
|
+
/* @__PURE__ */ t("p", { className: "mes-dm-agent-system-message__text m-0 text-center text-[14px] font-normal leading-5 tracking-[0.21px]", children: l })
|
|
2018
|
+
]
|
|
2019
|
+
}
|
|
2020
|
+
),
|
|
2021
|
+
!s && /* @__PURE__ */ t(Ce, { message: e.message })
|
|
2022
|
+
] });
|
|
2023
|
+
}
|
|
2024
|
+
if ((n == null ? void 0 : n.kind) === "age-safety") {
|
|
2025
|
+
const l = ((o = e.message.text) == null ? void 0 : o.trim()) || sa[n.type];
|
|
2026
|
+
return /* @__PURE__ */ d("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
2027
|
+
/* @__PURE__ */ d(
|
|
2028
|
+
"div",
|
|
2029
|
+
{
|
|
2030
|
+
className: "mes-age-safety-system-message box-border mx-auto mb-2 flex w-full max-w-[329px] items-start justify-center gap-3 rounded-[12px] border border-[var(--border-secondary,rgba(0,0,0,0.08))] bg-[var(--bg-warning-subtle,#fef3c6)] px-2 py-4 pl-5 text-[color:var(--text-warning-on-warning,#894b00)]",
|
|
2031
|
+
"data-testid": "age-safety-system-message",
|
|
2032
|
+
"data-age-safety-system-type": n.type,
|
|
2033
|
+
children: [
|
|
2034
|
+
/* @__PURE__ */ t(
|
|
2035
|
+
qs,
|
|
2036
|
+
{
|
|
2037
|
+
size: 24,
|
|
2038
|
+
weight: "duotone",
|
|
2039
|
+
"aria-hidden": !0,
|
|
2040
|
+
className: "mes-age-safety-system-message__icon shrink-0 text-[color:var(--text-warning-on-warning,#894b00)]",
|
|
2041
|
+
"data-testid": "age-safety-system-message-icon"
|
|
2042
|
+
}
|
|
2043
|
+
),
|
|
2044
|
+
/* @__PURE__ */ t("div", { className: "mes-age-safety-system-message__content min-w-0 flex-[1_0_0]", children: /* @__PURE__ */ t("p", { className: "m-0 text-balance text-left text-[12px] font-normal leading-4 tracking-[0.21px] text-[color:var(--text-warning-on-warning,#894b00)]", children: ia(l) }) })
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
),
|
|
2048
|
+
!s && /* @__PURE__ */ t(Ce, { message: e.message })
|
|
2049
|
+
] });
|
|
2050
|
+
}
|
|
2051
|
+
return /* @__PURE__ */ d("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
2052
|
+
/* @__PURE__ */ d("div", { className: "str-chat__message--system__text", children: [
|
|
2053
|
+
/* @__PURE__ */ t("div", { className: "str-chat__message--system__line" }),
|
|
2054
|
+
/* @__PURE__ */ t("p", { children: e.message.text }),
|
|
2055
|
+
/* @__PURE__ */ t("div", { className: "str-chat__message--system__line" })
|
|
2056
|
+
] }),
|
|
2057
|
+
!s && /* @__PURE__ */ t(Ce, { message: e.message })
|
|
2058
|
+
] });
|
|
2059
|
+
}, Ut = Ae(!1), Te = ({ cx: e, index: s }) => /* @__PURE__ */ t("circle", { cx: e, cy: "4", r: "3.9", fill: "#A0A0A0", children: /* @__PURE__ */ t(
|
|
2060
|
+
"animateTransform",
|
|
2061
|
+
{
|
|
2062
|
+
attributeName: "transform",
|
|
2063
|
+
type: "translate",
|
|
2064
|
+
values: "0 0; 0 -2.25; 0 0;",
|
|
2065
|
+
dur: "900ms",
|
|
2066
|
+
begin: `${120 * s}ms`,
|
|
2067
|
+
repeatCount: "indefinite"
|
|
2068
|
+
}
|
|
2069
|
+
) }), la = /* @__PURE__ */ new Set([
|
|
2070
|
+
Ee.Thinking,
|
|
2071
|
+
Ee.Generating,
|
|
2072
|
+
Ee.ExternalSources
|
|
2073
|
+
]), ca = ({ threadList: e }) => {
|
|
2074
|
+
var b, w;
|
|
2075
|
+
const { channel: s, channelConfig: n, thread: a } = oe(), { client: o } = Pe(), { typing: l = {} } = ys(), { aiState: i } = _s(s), c = Fe(Ut);
|
|
2076
|
+
if (!e && c && la.has(i)) {
|
|
2077
|
+
const x = da(s, (b = o.user) == null ? void 0 : b.id);
|
|
2078
|
+
return /* @__PURE__ */ t(
|
|
2079
|
+
pt,
|
|
2080
|
+
{
|
|
2081
|
+
avatarId: (x == null ? void 0 : x.id) ?? "ai-agent",
|
|
2082
|
+
avatarName: (x == null ? void 0 : x.name) ?? (x == null ? void 0 : x.id) ?? "Agent",
|
|
2083
|
+
avatarImage: x == null ? void 0 : x.image,
|
|
2084
|
+
testId: "typing-indicator-ai"
|
|
2085
|
+
}
|
|
2086
|
+
);
|
|
2087
|
+
}
|
|
2088
|
+
if ((n == null ? void 0 : n.typing_events) === !1)
|
|
2089
|
+
return null;
|
|
2090
|
+
const g = e ? [] : Object.values(l).filter(
|
|
2091
|
+
({ parent_id: x, user: N }) => {
|
|
2092
|
+
var p;
|
|
2093
|
+
return (N == null ? void 0 : N.id) !== ((p = o.user) == null ? void 0 : p.id) && !x;
|
|
2094
|
+
}
|
|
2095
|
+
), y = e ? Object.values(l).filter(
|
|
2096
|
+
({ parent_id: x, user: N }) => {
|
|
2097
|
+
var p;
|
|
2098
|
+
return (N == null ? void 0 : N.id) !== ((p = o.user) == null ? void 0 : p.id) && x === (a == null ? void 0 : a.id);
|
|
2099
|
+
}
|
|
2100
|
+
) : [], m = e ? y : g;
|
|
2101
|
+
if (!m.length)
|
|
2102
|
+
return null;
|
|
2103
|
+
const h = (w = m[0]) == null ? void 0 : w.user, r = h != null && h.id && s.state.members[h.id] ? s.state.members[h.id].user : void 0;
|
|
2104
|
+
return /* @__PURE__ */ t(
|
|
2105
|
+
pt,
|
|
2106
|
+
{
|
|
2107
|
+
avatarId: (h == null ? void 0 : h.id) ?? (r == null ? void 0 : r.id) ?? "typing-user",
|
|
2108
|
+
avatarName: (h == null ? void 0 : h.name) ?? (r == null ? void 0 : r.name) ?? (h == null ? void 0 : h.id) ?? "Typing user",
|
|
2109
|
+
avatarImage: (h == null ? void 0 : h.image) ?? (r == null ? void 0 : r.image),
|
|
2110
|
+
testId: "typing-indicator"
|
|
2111
|
+
}
|
|
2112
|
+
);
|
|
2113
|
+
}, pt = ({
|
|
2114
|
+
avatarId: e,
|
|
2115
|
+
avatarName: s,
|
|
2116
|
+
avatarImage: n,
|
|
2117
|
+
testId: a
|
|
2118
|
+
}) => /* @__PURE__ */ d(
|
|
2119
|
+
"div",
|
|
2120
|
+
{
|
|
2121
|
+
className: "str-chat__typing-indicator !items-end !bg-transparent",
|
|
2122
|
+
"data-testid": a,
|
|
2123
|
+
style: { insetInlineStart: 0, insetInlineEnd: "auto" },
|
|
2124
|
+
children: [
|
|
2125
|
+
/* @__PURE__ */ t("div", { className: "shrink-0", "aria-hidden": "true", children: /* @__PURE__ */ t(
|
|
2126
|
+
ae,
|
|
2127
|
+
{
|
|
2128
|
+
id: e,
|
|
2129
|
+
name: s,
|
|
2130
|
+
image: n ?? void 0,
|
|
2131
|
+
size: 24,
|
|
2132
|
+
shape: "circle"
|
|
2133
|
+
}
|
|
2134
|
+
) }),
|
|
2135
|
+
/* @__PURE__ */ t("div", { className: "px-4 py-3 rounded-lg bg-[#E9EAED] h-12 flex flex-col justify-end", children: /* @__PURE__ */ d(
|
|
2136
|
+
"svg",
|
|
2137
|
+
{
|
|
2138
|
+
"aria-hidden": "true",
|
|
2139
|
+
className: "block overflow-visible mb-[0.2rem]",
|
|
2140
|
+
viewBox: "0 0 32 8",
|
|
2141
|
+
width: "32",
|
|
2142
|
+
height: "8",
|
|
2143
|
+
overflow: "visible",
|
|
2144
|
+
children: [
|
|
2145
|
+
/* @__PURE__ */ t(Te, { cx: "4", index: 0 }),
|
|
2146
|
+
/* @__PURE__ */ t(Te, { cx: "16", index: 1 }),
|
|
2147
|
+
/* @__PURE__ */ t(Te, { cx: "28", index: 2 })
|
|
2148
|
+
]
|
|
2149
|
+
}
|
|
2150
|
+
) })
|
|
2151
|
+
]
|
|
2152
|
+
}
|
|
2153
|
+
);
|
|
2154
|
+
function da(e, s) {
|
|
2155
|
+
var a;
|
|
2156
|
+
const n = ((a = e == null ? void 0 : e.state) == null ? void 0 : a.members) ?? {};
|
|
2157
|
+
for (const o of Object.values(n)) {
|
|
2158
|
+
const l = o == null ? void 0 : o.user;
|
|
2159
|
+
if (l && l.id !== s)
|
|
2160
|
+
return l;
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
const ua = () => null, ma = ({ className: e, message: s }) => /* @__PURE__ */ d(
|
|
2164
|
+
"div",
|
|
2165
|
+
{
|
|
2166
|
+
className: D("flex items-center justify-center h-full", e),
|
|
2167
|
+
children: [
|
|
2168
|
+
/* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
2169
|
+
/* @__PURE__ */ t("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ t(
|
|
2170
|
+
"animateTransform",
|
|
2171
|
+
{
|
|
2172
|
+
attributeName: "transform",
|
|
2173
|
+
dur: "1s",
|
|
2174
|
+
type: "translate",
|
|
2175
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
2176
|
+
repeatCount: "indefinite",
|
|
2177
|
+
begin: "0.1"
|
|
2178
|
+
}
|
|
2179
|
+
) }),
|
|
2180
|
+
/* @__PURE__ */ t("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ t(
|
|
2181
|
+
"animateTransform",
|
|
2182
|
+
{
|
|
2183
|
+
attributeName: "transform",
|
|
2184
|
+
dur: "1s",
|
|
2185
|
+
type: "translate",
|
|
2186
|
+
values: "0 10 ; 0 -10; 0 10",
|
|
2187
|
+
repeatCount: "indefinite",
|
|
2188
|
+
begin: "0.2"
|
|
2189
|
+
}
|
|
2190
|
+
) }),
|
|
2191
|
+
/* @__PURE__ */ t("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ t(
|
|
2192
|
+
"animateTransform",
|
|
2193
|
+
{
|
|
2194
|
+
attributeName: "transform",
|
|
2195
|
+
dur: "1s",
|
|
2196
|
+
type: "translate",
|
|
2197
|
+
values: "0 5 ; 0 -5; 0 5",
|
|
2198
|
+
repeatCount: "indefinite",
|
|
2199
|
+
begin: "0.3"
|
|
2200
|
+
}
|
|
2201
|
+
) })
|
|
2202
|
+
] }),
|
|
2203
|
+
s && /* @__PURE__ */ t("span", { className: "text-stone", children: s })
|
|
2204
|
+
]
|
|
2205
|
+
}
|
|
2206
|
+
), ye = P.memo(() => /* @__PURE__ */ t("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
2207
|
+
/* @__PURE__ */ t(ma, { className: "w-6 h-6" }),
|
|
2208
|
+
/* @__PURE__ */ t("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
2209
|
+
] }) }));
|
|
2210
|
+
ye.displayName = "LoadingState";
|
|
2211
|
+
const ce = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring", xt = "Replies instantly with AI assistant", ha = ({
|
|
2212
|
+
onBack: e,
|
|
2213
|
+
showBackButton: s,
|
|
2214
|
+
onShowInfo: n,
|
|
2215
|
+
canShowInfo: a,
|
|
2216
|
+
showStarButton: o = !1,
|
|
2217
|
+
dmAgentEnabled: l = !1
|
|
2218
|
+
}) => {
|
|
2219
|
+
var h, r, b, w, x;
|
|
2220
|
+
const { channel: i } = oe(), c = P.useMemo(() => Object.values(i.state.members || {}).find(
|
|
2221
|
+
(p) => {
|
|
2222
|
+
var I;
|
|
2223
|
+
return ((I = p.user) == null ? void 0 : I.id) && p.user.id !== i._client.userID;
|
|
2224
|
+
}
|
|
2225
|
+
), [i._client.userID, i.state.members]), f = ((h = c == null ? void 0 : c.user) == null ? void 0 : h.name) || ((r = c == null ? void 0 : c.user) == null ? void 0 : r.id) || "Unknown member", g = (b = c == null ? void 0 : c.user) == null ? void 0 : b.image, y = St(i), m = async () => {
|
|
2226
|
+
try {
|
|
2227
|
+
y ? await i.unpin() : await i.pin();
|
|
2228
|
+
} catch (N) {
|
|
2229
|
+
console.error(
|
|
2230
|
+
"[CustomChannelHeader] Failed to update pinned status:",
|
|
2231
|
+
N
|
|
2232
|
+
);
|
|
2233
|
+
}
|
|
2234
|
+
};
|
|
2235
|
+
return /* @__PURE__ */ d("div", { className: "@container", children: [
|
|
2236
|
+
/* @__PURE__ */ d("div", { className: "grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden", children: [
|
|
2237
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ t(
|
|
2238
|
+
"button",
|
|
2239
|
+
{
|
|
2240
|
+
className: ce,
|
|
2241
|
+
onClick: e || (() => {
|
|
2242
|
+
}),
|
|
2243
|
+
type: "button",
|
|
2244
|
+
"aria-label": "Back to conversations",
|
|
2245
|
+
children: /* @__PURE__ */ t(ct, { className: "size-5 text-black/90" })
|
|
2246
|
+
}
|
|
2247
|
+
) }),
|
|
2248
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
2249
|
+
/* @__PURE__ */ t(
|
|
2250
|
+
ae,
|
|
2251
|
+
{
|
|
2252
|
+
id: ((w = c == null ? void 0 : c.user) == null ? void 0 : w.id) || i.id || "unknown",
|
|
2253
|
+
name: f,
|
|
2254
|
+
image: g,
|
|
2255
|
+
starred: o && y,
|
|
2256
|
+
dmAgentEnabled: l,
|
|
2257
|
+
size: 40
|
|
2258
|
+
}
|
|
2259
|
+
),
|
|
2260
|
+
/* @__PURE__ */ d(
|
|
2261
|
+
"button",
|
|
2262
|
+
{
|
|
2263
|
+
type: "button",
|
|
2264
|
+
onClick: n,
|
|
2265
|
+
className: "flex items-center gap-0.5 rounded-full bg-black/[0.05] px-3 py-1 text-xs font-medium text-black/90 hover:bg-black/[0.08] transition-colors",
|
|
2266
|
+
"aria-label": `View info for ${f}`,
|
|
2267
|
+
children: [
|
|
2268
|
+
f,
|
|
2269
|
+
/* @__PURE__ */ t(dt, { className: "size-3 shrink-0" })
|
|
2270
|
+
]
|
|
2271
|
+
}
|
|
2272
|
+
),
|
|
2273
|
+
l && /* @__PURE__ */ d("div", { className: "flex items-center gap-1 text-[10px] leading-3 text-black/55", children: [
|
|
2274
|
+
/* @__PURE__ */ t(De, { className: "size-3 shrink-0 text-black/55" }),
|
|
2275
|
+
/* @__PURE__ */ t("span", { children: xt })
|
|
2276
|
+
] })
|
|
2277
|
+
] }),
|
|
2278
|
+
/* @__PURE__ */ d("div", { className: "flex justify-end items-center gap-2", children: [
|
|
2279
|
+
o && /* @__PURE__ */ t(
|
|
2280
|
+
"button",
|
|
2281
|
+
{
|
|
2282
|
+
className: ce,
|
|
2283
|
+
onClick: m,
|
|
2284
|
+
type: "button",
|
|
2285
|
+
"aria-label": y ? "Unstar conversation" : "Star conversation",
|
|
2286
|
+
children: /* @__PURE__ */ t(
|
|
2287
|
+
Me,
|
|
2288
|
+
{
|
|
2289
|
+
className: D("size-5", {
|
|
2290
|
+
"text-yellow-600": y,
|
|
2291
|
+
"text-black/90": !y
|
|
2292
|
+
}),
|
|
2293
|
+
weight: y ? "duotone" : "regular"
|
|
2294
|
+
}
|
|
2295
|
+
)
|
|
2296
|
+
}
|
|
2297
|
+
),
|
|
2298
|
+
/* @__PURE__ */ t(
|
|
2299
|
+
"button",
|
|
2300
|
+
{
|
|
2301
|
+
className: ce,
|
|
2302
|
+
onClick: n,
|
|
2303
|
+
type: "button",
|
|
2304
|
+
"aria-label": "Show info",
|
|
2305
|
+
children: /* @__PURE__ */ t(ut, { className: "size-5 text-black/90" })
|
|
2306
|
+
}
|
|
2307
|
+
)
|
|
2308
|
+
] })
|
|
2309
|
+
] }),
|
|
2310
|
+
/* @__PURE__ */ d("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
2311
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
2312
|
+
s && e && /* @__PURE__ */ t(
|
|
2313
|
+
"button",
|
|
2314
|
+
{
|
|
2315
|
+
type: "button",
|
|
2316
|
+
onClick: e,
|
|
2317
|
+
className: ce,
|
|
2318
|
+
"aria-label": "Back to conversations",
|
|
2319
|
+
children: /* @__PURE__ */ t(ct, { className: "size-5 text-black/90" })
|
|
2320
|
+
}
|
|
2321
|
+
),
|
|
2322
|
+
/* @__PURE__ */ t(
|
|
2323
|
+
ae,
|
|
2324
|
+
{
|
|
2325
|
+
id: ((x = c == null ? void 0 : c.user) == null ? void 0 : x.id) || i.id || "unknown",
|
|
2326
|
+
name: f,
|
|
2327
|
+
image: g,
|
|
2328
|
+
starred: o && y,
|
|
2329
|
+
dmAgentEnabled: l,
|
|
2330
|
+
size: 40
|
|
2331
|
+
}
|
|
2332
|
+
),
|
|
2333
|
+
/* @__PURE__ */ d("div", { className: "min-w-0", children: [
|
|
2334
|
+
a ? /* @__PURE__ */ d(
|
|
2335
|
+
"button",
|
|
2336
|
+
{
|
|
2337
|
+
type: "button",
|
|
2338
|
+
onClick: n,
|
|
2339
|
+
className: "flex items-center gap-1 font-medium text-black/90 truncate hover:text-black/70 transition-colors",
|
|
2340
|
+
"aria-label": `View info for ${f}`,
|
|
2341
|
+
children: [
|
|
2342
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: f }),
|
|
2343
|
+
/* @__PURE__ */ t(dt, { className: "size-4 shrink-0" })
|
|
2344
|
+
]
|
|
2345
|
+
}
|
|
2346
|
+
) : /* @__PURE__ */ t("h1", { className: "font-medium text-black/90 truncate", children: f }),
|
|
2347
|
+
l && /* @__PURE__ */ d("div", { className: "mt-0.5 flex items-center gap-1 text-[10px] leading-3 text-black/55", children: [
|
|
2348
|
+
/* @__PURE__ */ t(De, { className: "size-3 shrink-0 text-black/55" }),
|
|
2349
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: xt })
|
|
2350
|
+
] })
|
|
2351
|
+
] })
|
|
2352
|
+
] }),
|
|
2353
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
2354
|
+
o && /* @__PURE__ */ t(
|
|
2355
|
+
"button",
|
|
2356
|
+
{
|
|
2357
|
+
className: ce,
|
|
2358
|
+
onClick: m,
|
|
2359
|
+
type: "button",
|
|
2360
|
+
"aria-label": y ? "Unstar conversation" : "Star conversation",
|
|
2361
|
+
children: /* @__PURE__ */ t(
|
|
2362
|
+
Me,
|
|
2363
|
+
{
|
|
2364
|
+
className: D("size-5", {
|
|
2365
|
+
"text-yellow-600": y,
|
|
2366
|
+
"text-black/90": !y
|
|
2367
|
+
}),
|
|
2368
|
+
weight: y ? "duotone" : "regular"
|
|
2369
|
+
}
|
|
2370
|
+
)
|
|
2371
|
+
}
|
|
2372
|
+
),
|
|
2373
|
+
a && n && /* @__PURE__ */ t(
|
|
2374
|
+
"button",
|
|
2375
|
+
{
|
|
2376
|
+
className: ce,
|
|
2377
|
+
onClick: n,
|
|
2378
|
+
type: "button",
|
|
2379
|
+
"aria-label": "Show info",
|
|
2380
|
+
children: /* @__PURE__ */ t(ut, { className: "size-5 text-black/90" })
|
|
2381
|
+
}
|
|
2382
|
+
)
|
|
2383
|
+
] })
|
|
2384
|
+
] })
|
|
2385
|
+
] });
|
|
2386
|
+
}, fa = ({
|
|
2387
|
+
onBack: e,
|
|
2388
|
+
showBackButton: s,
|
|
2389
|
+
renderMessageInputActions: n,
|
|
2390
|
+
renderConversationFooter: a,
|
|
2391
|
+
onLeaveConversation: o,
|
|
2392
|
+
onBlockParticipant: l,
|
|
2393
|
+
showDeleteConversation: i = !0,
|
|
2394
|
+
onDeleteConversationClick: c,
|
|
2395
|
+
onBlockParticipantClick: f,
|
|
2396
|
+
onReportParticipantClick: g,
|
|
2397
|
+
showStarButton: y = !1,
|
|
2398
|
+
chatbotVotingEnabled: m = !1,
|
|
2399
|
+
renderChannelBanner: h,
|
|
2400
|
+
customProfileContent: r,
|
|
2401
|
+
customChannelActions: b,
|
|
2402
|
+
renderMessage: w,
|
|
2403
|
+
dmAgentEnabled: x = !1,
|
|
2404
|
+
viewerLanguage: N
|
|
2405
|
+
}) => {
|
|
2406
|
+
var A, V;
|
|
2407
|
+
const { channel: p } = oe(), I = J(null), S = P.useMemo(() => Object.values(p.state.members || {}).find(
|
|
2408
|
+
(z) => {
|
|
2409
|
+
var E;
|
|
2410
|
+
return ((E = z.user) == null ? void 0 : E.id) && z.user.id !== p._client.userID;
|
|
2411
|
+
}
|
|
2412
|
+
), [p._client.userID, p.state.members]), T = P.useMemo(() => Object.values(p.state.members || {}).find((z) => {
|
|
2413
|
+
var E;
|
|
2414
|
+
return ((E = z.user) == null ? void 0 : E.id) === p._client.userID;
|
|
2415
|
+
}), [p._client.userID, p.state.members]), $ = ((A = T == null ? void 0 : T.user) == null ? void 0 : A.is_account) ?? (T == null ? void 0 : T.is_account), k = ((V = S == null ? void 0 : S.user) == null ? void 0 : V.is_account) ?? (S == null ? void 0 : S.is_account), M = x && $ === !1 && k === !0, j = P.useMemo(() => {
|
|
2416
|
+
const R = p.data ?? {};
|
|
2417
|
+
if (R.followerStatus)
|
|
2418
|
+
return String(R.followerStatus);
|
|
2419
|
+
if (R.isFollower !== void 0)
|
|
2420
|
+
return R.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
2421
|
+
}, [p.data]), _ = G(() => {
|
|
2422
|
+
var R;
|
|
2423
|
+
(R = I.current) == null || R.showModal();
|
|
2424
|
+
}, []), L = G(() => {
|
|
2425
|
+
var R;
|
|
2426
|
+
(R = I.current) == null || R.close();
|
|
2427
|
+
}, []), v = G(
|
|
2428
|
+
(R) => {
|
|
2429
|
+
const { message: z } = wt("ChannelView"), E = /* @__PURE__ */ t(
|
|
2430
|
+
Yn,
|
|
2431
|
+
{
|
|
2432
|
+
...R,
|
|
2433
|
+
chatbotVotingEnabled: m,
|
|
2434
|
+
viewerLanguage: N
|
|
2435
|
+
}
|
|
2436
|
+
);
|
|
2437
|
+
return !w || !z ? E : w(E, z);
|
|
2438
|
+
},
|
|
2439
|
+
[m, w, N]
|
|
2440
|
+
);
|
|
2441
|
+
return /* @__PURE__ */ d(de, { children: [
|
|
2442
|
+
/* @__PURE__ */ t(Cs, { overrides: { Message: v }, children: /* @__PURE__ */ d(Es, { children: [
|
|
2443
|
+
/* @__PURE__ */ t("div", { className: "p-4", children: /* @__PURE__ */ t(
|
|
2444
|
+
ha,
|
|
2445
|
+
{
|
|
2446
|
+
onBack: e,
|
|
2447
|
+
showBackButton: s,
|
|
2448
|
+
onShowInfo: _,
|
|
2449
|
+
canShowInfo: !!S,
|
|
2450
|
+
showStarButton: y,
|
|
2451
|
+
dmAgentEnabled: M
|
|
2452
|
+
}
|
|
2453
|
+
) }),
|
|
2454
|
+
h == null ? void 0 : h(),
|
|
2455
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ t(
|
|
2456
|
+
Ss,
|
|
2457
|
+
{
|
|
2458
|
+
hideDeletedMessages: !0,
|
|
2459
|
+
hideNewMessageSeparator: !1,
|
|
2460
|
+
messageActions: void 0
|
|
2461
|
+
}
|
|
2462
|
+
) }),
|
|
2463
|
+
a == null ? void 0 : a(p),
|
|
2464
|
+
/* @__PURE__ */ t(
|
|
2465
|
+
Kn,
|
|
2466
|
+
{
|
|
2467
|
+
renderActions: () => n == null ? void 0 : n(p)
|
|
2468
|
+
}
|
|
2469
|
+
)
|
|
2470
|
+
] }) }),
|
|
2471
|
+
/* @__PURE__ */ t(
|
|
2472
|
+
mn,
|
|
2473
|
+
{
|
|
2474
|
+
dialogRef: I,
|
|
2475
|
+
onClose: L,
|
|
2476
|
+
participant: S,
|
|
2477
|
+
channel: p,
|
|
2478
|
+
followerStatusLabel: j,
|
|
2479
|
+
onLeaveConversation: o,
|
|
2480
|
+
onBlockParticipant: l,
|
|
2481
|
+
showDeleteConversation: i,
|
|
2482
|
+
onDeleteConversationClick: c,
|
|
2483
|
+
onBlockParticipantClick: f,
|
|
2484
|
+
onReportParticipantClick: g,
|
|
2485
|
+
customProfileContent: r,
|
|
2486
|
+
customChannelActions: b
|
|
2487
|
+
}
|
|
2488
|
+
)
|
|
2489
|
+
] });
|
|
2490
|
+
}, $t = P.memo(
|
|
2491
|
+
({
|
|
2492
|
+
channel: e,
|
|
2493
|
+
onBack: s,
|
|
2494
|
+
showBackButton: n = !1,
|
|
2495
|
+
renderMessageInputActions: a,
|
|
2496
|
+
renderConversationFooter: o,
|
|
2497
|
+
onLeaveConversation: l,
|
|
2498
|
+
onBlockParticipant: i,
|
|
2499
|
+
className: c,
|
|
2500
|
+
CustomChannelEmptyState: f = ua,
|
|
2501
|
+
showDeleteConversation: g = !0,
|
|
2502
|
+
onDeleteConversationClick: y,
|
|
2503
|
+
onBlockParticipantClick: m,
|
|
2504
|
+
onReportParticipantClick: h,
|
|
2505
|
+
dmAgentEnabled: r,
|
|
2506
|
+
messageMetadata: b,
|
|
2507
|
+
onMessageSent: w,
|
|
2508
|
+
showStarButton: x = !1,
|
|
2509
|
+
chatbotVotingEnabled: N = !1,
|
|
2510
|
+
renderChannelBanner: p,
|
|
2511
|
+
customProfileContent: I,
|
|
2512
|
+
customChannelActions: S,
|
|
2513
|
+
renderMessage: T,
|
|
2514
|
+
sendButton: $,
|
|
2515
|
+
viewerLanguage: k
|
|
2516
|
+
}) => {
|
|
2517
|
+
const M = G(
|
|
2518
|
+
async (j, _, L) => {
|
|
2519
|
+
var E;
|
|
2520
|
+
const v = ((E = e.data) == null ? void 0 : E.chatbot_paused) === !0, A = r && !v, V = {
|
|
2521
|
+
..._,
|
|
2522
|
+
...A && { silent: !0 },
|
|
2523
|
+
...b && {
|
|
2524
|
+
metadata: {
|
|
2525
|
+
..._.metadata ?? {},
|
|
2526
|
+
...b
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}, R = {
|
|
2530
|
+
...L,
|
|
2531
|
+
...A && { skip_push: !0 }
|
|
2532
|
+
}, z = await e.sendMessage(V, R);
|
|
2533
|
+
return w == null || w(z), z;
|
|
2534
|
+
},
|
|
2535
|
+
[e, r, b, w]
|
|
2536
|
+
);
|
|
2537
|
+
return /* @__PURE__ */ t(
|
|
2538
|
+
"div",
|
|
2539
|
+
{
|
|
2540
|
+
className: D(
|
|
2541
|
+
"messaging-channel-view h-full flex flex-col",
|
|
2542
|
+
c
|
|
2543
|
+
),
|
|
2544
|
+
children: /* @__PURE__ */ t(Ut.Provider, { value: r ?? !1, children: /* @__PURE__ */ t(
|
|
2545
|
+
Ns,
|
|
2546
|
+
{
|
|
2547
|
+
channel: e,
|
|
2548
|
+
MessageSystem: oa,
|
|
2549
|
+
EmptyStateIndicator: f,
|
|
2550
|
+
LoadingIndicator: ye,
|
|
2551
|
+
DateSeparator: hn,
|
|
2552
|
+
TypingIndicator: ca,
|
|
2553
|
+
doSendMessageRequest: M,
|
|
2554
|
+
...$ ? { SendButton: $ } : {},
|
|
2555
|
+
children: /* @__PURE__ */ t(
|
|
2556
|
+
fa,
|
|
2557
|
+
{
|
|
2558
|
+
onBack: s,
|
|
2559
|
+
showBackButton: n,
|
|
2560
|
+
renderMessageInputActions: a,
|
|
2561
|
+
renderConversationFooter: o,
|
|
2562
|
+
onLeaveConversation: l,
|
|
2563
|
+
onBlockParticipant: i,
|
|
2564
|
+
CustomChannelEmptyState: f,
|
|
2565
|
+
showDeleteConversation: g,
|
|
2566
|
+
onDeleteConversationClick: y,
|
|
2567
|
+
onBlockParticipantClick: m,
|
|
2568
|
+
onReportParticipantClick: h,
|
|
2569
|
+
showStarButton: x,
|
|
2570
|
+
dmAgentEnabled: r,
|
|
2571
|
+
chatbotVotingEnabled: N,
|
|
2572
|
+
renderChannelBanner: p,
|
|
2573
|
+
customProfileContent: I,
|
|
2574
|
+
customChannelActions: S,
|
|
2575
|
+
renderMessage: T,
|
|
2576
|
+
viewerLanguage: k
|
|
2577
|
+
}
|
|
2578
|
+
)
|
|
2579
|
+
}
|
|
2580
|
+
) })
|
|
2581
|
+
}
|
|
2582
|
+
);
|
|
2583
|
+
}
|
|
2584
|
+
);
|
|
2585
|
+
$t.displayName = "ChannelView";
|
|
2586
|
+
const ga = ({ className: e }) => /* @__PURE__ */ d(
|
|
2587
|
+
"svg",
|
|
2588
|
+
{
|
|
2589
|
+
width: "140",
|
|
2590
|
+
height: "120",
|
|
2591
|
+
viewBox: "44 -2 144 126",
|
|
2592
|
+
fill: "none",
|
|
2593
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2594
|
+
className: e,
|
|
2595
|
+
children: [
|
|
2596
|
+
/* @__PURE__ */ d("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
2597
|
+
/* @__PURE__ */ t(
|
|
2598
|
+
"path",
|
|
2599
|
+
{
|
|
2600
|
+
d: "M123.68 82.1932C123.383 103.675 105.839 121 84.2417 121C77.4724 121 71.0986 119.297 65.5327 116.299L52.5873 119.687L53.8036 106.673C48.1776 99.8701 44.7994 91.1453 44.7994 81.6356C44.7994 59.8965 62.4554 42.2754 84.2374 42.2754C89.1328 42.2754 93.8175 43.1633 98.1413 44.789",
|
|
2601
|
+
fill: "#D7D4CE"
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ t(
|
|
2605
|
+
"path",
|
|
2606
|
+
{
|
|
2607
|
+
d: "M84.2458 86.0364C82.2851 86.0364 80.6957 84.4501 80.6957 82.4933C80.6957 80.5365 82.2851 78.9502 84.2458 78.9502C86.2065 78.9502 87.7959 80.5365 87.7959 82.4933C87.7959 84.4501 86.2065 86.0364 84.2458 86.0364Z",
|
|
2608
|
+
fill: "white"
|
|
2609
|
+
}
|
|
2610
|
+
),
|
|
2611
|
+
/* @__PURE__ */ t(
|
|
2612
|
+
"path",
|
|
2613
|
+
{
|
|
2614
|
+
d: "M68.3044 86.0364C66.3437 86.0364 64.7543 84.4501 64.7543 82.4933C64.7543 80.5365 66.3437 78.9502 68.3044 78.9502C70.2651 78.9502 71.8545 80.5365 71.8545 82.4933C71.8545 84.4501 70.2651 86.0364 68.3044 86.0364Z",
|
|
2615
|
+
fill: "white"
|
|
2616
|
+
}
|
|
2617
|
+
),
|
|
2618
|
+
/* @__PURE__ */ t(
|
|
2619
|
+
"path",
|
|
2620
|
+
{
|
|
2621
|
+
d: "M100.183 86.0364C98.2226 86.0364 96.6332 84.4501 96.6332 82.4933C96.6332 80.5365 98.2226 78.9502 100.183 78.9502C102.144 78.9502 103.733 80.5365 103.733 82.4933C103.733 84.4501 102.144 86.0364 100.183 86.0364Z",
|
|
2622
|
+
fill: "white"
|
|
2623
|
+
}
|
|
2624
|
+
),
|
|
2625
|
+
/* @__PURE__ */ d("g", { filter: "url(#filter0_empty_state)", children: [
|
|
2626
|
+
/* @__PURE__ */ t(
|
|
2627
|
+
"path",
|
|
2628
|
+
{
|
|
2629
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
2630
|
+
fill: "white"
|
|
2631
|
+
}
|
|
2632
|
+
),
|
|
2633
|
+
/* @__PURE__ */ t(
|
|
2634
|
+
"path",
|
|
2635
|
+
{
|
|
2636
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
2637
|
+
stroke: "#D7D4CE",
|
|
2638
|
+
strokeWidth: "2",
|
|
2639
|
+
strokeMiterlimit: "10"
|
|
2640
|
+
}
|
|
2641
|
+
)
|
|
2642
|
+
] }),
|
|
2643
|
+
/* @__PURE__ */ t(
|
|
2644
|
+
"path",
|
|
2645
|
+
{
|
|
2646
|
+
d: "M139.502 45.5431C137.541 45.5431 135.952 43.9568 135.952 42C135.952 40.0432 137.541 38.4569 139.502 38.4569C141.462 38.4569 143.052 40.0432 143.052 42C143.052 43.9568 141.462 45.5431 139.502 45.5431Z",
|
|
2647
|
+
fill: "#D7D4CE"
|
|
2648
|
+
}
|
|
2649
|
+
),
|
|
2650
|
+
/* @__PURE__ */ t(
|
|
2651
|
+
"path",
|
|
2652
|
+
{
|
|
2653
|
+
d: "M123.561 45.5431C121.601 45.5431 120.011 43.9568 120.011 42C120.011 40.0432 121.601 38.4569 123.561 38.4569C125.522 38.4569 127.111 40.0432 127.111 42C127.111 43.9568 125.522 45.5431 123.561 45.5431Z",
|
|
2654
|
+
fill: "#D7D4CE"
|
|
2655
|
+
}
|
|
2656
|
+
),
|
|
2657
|
+
/* @__PURE__ */ t(
|
|
2658
|
+
"path",
|
|
2659
|
+
{
|
|
2660
|
+
d: "M155.439 45.5431C153.478 45.5431 151.889 43.9568 151.889 42C151.889 40.0432 153.478 38.4569 155.439 38.4569C157.4 38.4569 158.989 40.0432 158.989 42C158.989 43.9568 157.4 45.5431 155.439 45.5431Z",
|
|
2661
|
+
fill: "#D7D4CE"
|
|
2662
|
+
}
|
|
2663
|
+
)
|
|
2664
|
+
] }),
|
|
2665
|
+
/* @__PURE__ */ d("defs", { children: [
|
|
2666
|
+
/* @__PURE__ */ d(
|
|
2667
|
+
"filter",
|
|
2668
|
+
{
|
|
2669
|
+
id: "filter0_empty_state",
|
|
2670
|
+
x: "97",
|
|
2671
|
+
y: "-1",
|
|
2672
|
+
width: "89",
|
|
2673
|
+
height: "90",
|
|
2674
|
+
filterUnits: "userSpaceOnUse",
|
|
2675
|
+
colorInterpolationFilters: "sRGB",
|
|
2676
|
+
children: [
|
|
2677
|
+
/* @__PURE__ */ t("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
2678
|
+
/* @__PURE__ */ t(
|
|
2679
|
+
"feColorMatrix",
|
|
2680
|
+
{
|
|
2681
|
+
in: "SourceAlpha",
|
|
2682
|
+
type: "matrix",
|
|
2683
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
2684
|
+
result: "hardAlpha"
|
|
2685
|
+
}
|
|
2686
|
+
),
|
|
2687
|
+
/* @__PURE__ */ t("feOffset", { dx: "4", dy: "4" }),
|
|
2688
|
+
/* @__PURE__ */ t("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
2689
|
+
/* @__PURE__ */ t(
|
|
2690
|
+
"feColorMatrix",
|
|
2691
|
+
{
|
|
2692
|
+
type: "matrix",
|
|
2693
|
+
values: "0 0 0 0 0.8428 0 0 0 0 0.830064 0 0 0 0 0.8095 0 0 0 1 0"
|
|
2694
|
+
}
|
|
2695
|
+
),
|
|
2696
|
+
/* @__PURE__ */ t(
|
|
2697
|
+
"feBlend",
|
|
2698
|
+
{
|
|
2699
|
+
mode: "normal",
|
|
2700
|
+
in2: "BackgroundImageFix",
|
|
2701
|
+
result: "effect1_dropShadow"
|
|
2702
|
+
}
|
|
2703
|
+
),
|
|
2704
|
+
/* @__PURE__ */ t(
|
|
2705
|
+
"feBlend",
|
|
2706
|
+
{
|
|
2707
|
+
mode: "normal",
|
|
2708
|
+
in: "SourceGraphic",
|
|
2709
|
+
in2: "effect1_dropShadow",
|
|
2710
|
+
result: "shape"
|
|
2711
|
+
}
|
|
2712
|
+
)
|
|
2713
|
+
]
|
|
2714
|
+
}
|
|
2715
|
+
),
|
|
2716
|
+
/* @__PURE__ */ t("clipPath", { id: "clip0_empty_state", children: /* @__PURE__ */ t("rect", { width: "233", height: "233", fill: "white" }) })
|
|
2717
|
+
] })
|
|
2718
|
+
]
|
|
2719
|
+
}
|
|
2720
|
+
), jt = P.memo(
|
|
2721
|
+
({ hasChannels: e, channelsLoaded: s }) => /* @__PURE__ */ t("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
|
|
2722
|
+
/* @__PURE__ */ t(ga, {}),
|
|
2723
|
+
s && !e && /* @__PURE__ */ d("div", { className: "mt-8", children: [
|
|
2724
|
+
/* @__PURE__ */ t("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
2725
|
+
/* @__PURE__ */ t("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
2726
|
+
] })
|
|
2727
|
+
] }) })
|
|
2728
|
+
);
|
|
2729
|
+
jt.displayName = "EmptyState";
|
|
2730
|
+
const xe = P.memo(({ message: e, onBack: s }) => /* @__PURE__ */ t("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
|
|
2731
|
+
/* @__PURE__ */ t("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ t("span", { className: "text-4xl", children: "⚠️" }) }),
|
|
2732
|
+
/* @__PURE__ */ t("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
2733
|
+
/* @__PURE__ */ t("p", { className: "text-stone text-sm mb-6", children: e }),
|
|
2734
|
+
s && /* @__PURE__ */ t(
|
|
2735
|
+
"button",
|
|
2736
|
+
{
|
|
2737
|
+
type: "button",
|
|
2738
|
+
onClick: s,
|
|
2739
|
+
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#7f22fe] hover:bg-primary-alt rounded-lg transition-colors focus-ring",
|
|
2740
|
+
children: "Go Back"
|
|
2741
|
+
}
|
|
2742
|
+
)
|
|
2743
|
+
] }) }));
|
|
2744
|
+
xe.displayName = "ErrorState";
|
|
2745
|
+
const Ia = ({
|
|
2746
|
+
capabilities: e = {},
|
|
2747
|
+
className: s,
|
|
2748
|
+
renderMessageInputActions: n,
|
|
2749
|
+
renderConversationFooter: a,
|
|
2750
|
+
onChannelSelect: o,
|
|
2751
|
+
initialParticipantFilter: l,
|
|
2752
|
+
initialParticipantData: i,
|
|
2753
|
+
CustomChannelEmptyState: c,
|
|
2754
|
+
showChannelList: f = !0,
|
|
2755
|
+
filters: g,
|
|
2756
|
+
channelRenderFilterFn: y,
|
|
2757
|
+
channelListCustomEmptyStateIndicator: m,
|
|
2758
|
+
onDeleteConversationClick: h,
|
|
2759
|
+
onBlockParticipantClick: r,
|
|
2760
|
+
onReportParticipantClick: b,
|
|
2761
|
+
dmAgentEnabled: w,
|
|
2762
|
+
messageMetadata: x,
|
|
2763
|
+
onMessageSent: N,
|
|
2764
|
+
showStarButton: p = !1,
|
|
2765
|
+
chatbotVotingEnabled: I = !1,
|
|
2766
|
+
viewerLanguage: S,
|
|
2767
|
+
renderMessagePreview: T,
|
|
2768
|
+
renderChannelBanner: $,
|
|
2769
|
+
customProfileContent: k,
|
|
2770
|
+
customChannelActions: M,
|
|
2771
|
+
renderMessage: j,
|
|
2772
|
+
sendButton: _
|
|
2773
|
+
}) => {
|
|
2774
|
+
const {
|
|
2775
|
+
service: L,
|
|
2776
|
+
client: v,
|
|
2777
|
+
isConnected: A,
|
|
2778
|
+
isLoading: V,
|
|
2779
|
+
error: R,
|
|
2780
|
+
refreshConnection: z,
|
|
2781
|
+
debug: E
|
|
2782
|
+
} = Ws(), [H, Y] = O(null), [te, B] = O(!1), [u, C] = O(!1), [U, K] = O(!1), [W, Q] = O(null), { showDeleteConversation: me = !0 } = e, he = P.useMemo(() => {
|
|
2783
|
+
const F = v == null ? void 0 : v.userID;
|
|
2784
|
+
return {
|
|
2785
|
+
...{
|
|
2786
|
+
type: "messaging",
|
|
2787
|
+
last_message_at: { $exists: !0 },
|
|
2788
|
+
...F && {
|
|
2789
|
+
members: { $in: [F] },
|
|
2790
|
+
hidden: !1
|
|
2791
|
+
}
|
|
2792
|
+
},
|
|
2793
|
+
...g
|
|
2794
|
+
};
|
|
2795
|
+
}, [g, v == null ? void 0 : v.userID]), re = J(null), ee = G(async () => {
|
|
2796
|
+
if (!v || !A) return;
|
|
2797
|
+
const F = v.userID;
|
|
2798
|
+
if (F)
|
|
2799
|
+
try {
|
|
2800
|
+
E && console.log("[MessagingShell] Syncing channels for user:", F);
|
|
2801
|
+
const X = await v.queryChannels(
|
|
2802
|
+
{
|
|
2803
|
+
type: "messaging",
|
|
2804
|
+
members: { $in: [F] }
|
|
2805
|
+
},
|
|
2806
|
+
{},
|
|
2807
|
+
{ limit: 100 }
|
|
2808
|
+
);
|
|
2809
|
+
B(X.length > 0), C(!0), re.current = F, E && console.log("[MessagingShell] Channels synced successfully:", {
|
|
2810
|
+
channelCount: X.length
|
|
2811
|
+
});
|
|
2812
|
+
} catch (X) {
|
|
2813
|
+
console.error("[MessagingShell] Failed to sync channels:", X);
|
|
2814
|
+
}
|
|
2815
|
+
}, [v, A, E]);
|
|
2816
|
+
q(() => {
|
|
2817
|
+
if (!v || !A) return;
|
|
2818
|
+
const F = v.userID;
|
|
2819
|
+
F && re.current !== F && ee();
|
|
2820
|
+
}, [v, A, ee]), q(() => {
|
|
2821
|
+
if (!l || !v || !A) return;
|
|
2822
|
+
(async () => {
|
|
2823
|
+
const X = v.userID;
|
|
2824
|
+
if (X)
|
|
2825
|
+
try {
|
|
2826
|
+
E && console.log(
|
|
2827
|
+
"[MessagingShell] Loading initial conversation with:",
|
|
2828
|
+
l
|
|
2829
|
+
);
|
|
2830
|
+
const Z = await v.queryChannels(
|
|
2831
|
+
{
|
|
2832
|
+
type: "messaging",
|
|
2833
|
+
members: { $eq: [X, l] }
|
|
2834
|
+
},
|
|
2835
|
+
{},
|
|
2836
|
+
{ limit: 1 }
|
|
2837
|
+
);
|
|
2838
|
+
if (Z.length > 0)
|
|
2839
|
+
Y(Z[0]), K(!0), Q(null), o && o(Z[0]), E && console.log(
|
|
2840
|
+
"[MessagingShell] Initial conversation loaded:",
|
|
2841
|
+
Z[0].id
|
|
2842
|
+
);
|
|
2843
|
+
else if (i && L) {
|
|
2844
|
+
E && console.log(
|
|
2845
|
+
"[MessagingShell] No conversation found, creating one for:",
|
|
2846
|
+
i
|
|
2847
|
+
);
|
|
2848
|
+
try {
|
|
2849
|
+
const ne = await L.startChannelWithParticipant({
|
|
2850
|
+
id: i.id,
|
|
2851
|
+
name: i.name,
|
|
2852
|
+
phone: i.phone
|
|
2853
|
+
});
|
|
2854
|
+
Y(ne), K(!0), Q(null), o && o(ne), E && console.log(
|
|
2855
|
+
"[MessagingShell] Channel created and loaded:",
|
|
2856
|
+
ne.id
|
|
2857
|
+
);
|
|
2858
|
+
} catch (ne) {
|
|
2859
|
+
console.error(
|
|
2860
|
+
"[MessagingShell] Failed to create conversation:",
|
|
2861
|
+
ne
|
|
2862
|
+
), Q("Failed to create conversation");
|
|
2863
|
+
}
|
|
2864
|
+
} else
|
|
2865
|
+
Q(
|
|
2866
|
+
"No conversation found with this account"
|
|
2867
|
+
), E && console.log(
|
|
2868
|
+
"[MessagingShell] No conversation found for:",
|
|
2869
|
+
l
|
|
2870
|
+
);
|
|
2871
|
+
} catch (Z) {
|
|
2872
|
+
console.error(
|
|
2873
|
+
"[MessagingShell] Failed to load initial conversation:",
|
|
2874
|
+
Z
|
|
2875
|
+
), Q("Failed to load conversation");
|
|
2876
|
+
}
|
|
2877
|
+
})();
|
|
2878
|
+
}, [
|
|
2879
|
+
l,
|
|
2880
|
+
i,
|
|
2881
|
+
v,
|
|
2882
|
+
A,
|
|
2883
|
+
L,
|
|
2884
|
+
E,
|
|
2885
|
+
o
|
|
2886
|
+
]);
|
|
2887
|
+
const se = G(
|
|
2888
|
+
(F) => {
|
|
2889
|
+
Y(F), o == null || o(F);
|
|
2890
|
+
},
|
|
2891
|
+
[o]
|
|
2892
|
+
), ie = G(() => {
|
|
2893
|
+
U || Y(null);
|
|
2894
|
+
}, [U]), Ne = G(
|
|
2895
|
+
async (F) => {
|
|
2896
|
+
E && console.log("[MessagingShell] Leaving conversation:", F.id), Y(null), K(!1), re.current = null, await ee();
|
|
2897
|
+
},
|
|
2898
|
+
[ee, E]
|
|
2899
|
+
), fe = G(
|
|
2900
|
+
async (F) => {
|
|
2901
|
+
E && console.log("[MessagingShell] Blocking participant:", F), Y(null), K(!1), re.current = null, await ee();
|
|
2902
|
+
},
|
|
2903
|
+
[ee, E]
|
|
2904
|
+
), le = !!H;
|
|
2905
|
+
return V ? /* @__PURE__ */ t("div", { className: D("h-full", s), children: /* @__PURE__ */ t(ye, {}) }) : R ? /* @__PURE__ */ t("div", { className: D("h-full", s), children: /* @__PURE__ */ t(xe, { message: R, onBack: z }) }) : !A || !v ? /* @__PURE__ */ t("div", { className: D("h-full", s), children: /* @__PURE__ */ t(
|
|
2906
|
+
xe,
|
|
2907
|
+
{
|
|
2908
|
+
message: "Not connected to messaging service",
|
|
2909
|
+
onBack: z
|
|
2910
|
+
}
|
|
2911
|
+
) }) : W ? /* @__PURE__ */ t("div", { className: D("h-full", s), children: /* @__PURE__ */ t(xe, { message: W }) }) : /* @__PURE__ */ t(
|
|
2912
|
+
"div",
|
|
2913
|
+
{
|
|
2914
|
+
className: D(
|
|
2915
|
+
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
2916
|
+
s
|
|
2917
|
+
),
|
|
2918
|
+
children: /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
|
|
2919
|
+
/* @__PURE__ */ t(
|
|
2920
|
+
"div",
|
|
2921
|
+
{
|
|
2922
|
+
className: D(
|
|
2923
|
+
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
2924
|
+
{
|
|
2925
|
+
"!hidden": f === !1 || U,
|
|
2926
|
+
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
2927
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": f !== !1 && !U && le,
|
|
2928
|
+
// Show on mobile when no channel selected, use same wide width on desktop
|
|
2929
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": f !== !1 && !U && !le
|
|
2930
|
+
}
|
|
2931
|
+
),
|
|
2932
|
+
children: /* @__PURE__ */ t(
|
|
2933
|
+
Mt,
|
|
2934
|
+
{
|
|
2935
|
+
onChannelSelect: se,
|
|
2936
|
+
selectedChannel: H || void 0,
|
|
2937
|
+
filters: he,
|
|
2938
|
+
channelRenderFilterFn: y,
|
|
2939
|
+
customEmptyStateIndicator: m,
|
|
2940
|
+
renderMessagePreview: T,
|
|
2941
|
+
viewerLanguage: S
|
|
2942
|
+
}
|
|
2943
|
+
)
|
|
2944
|
+
}
|
|
2945
|
+
),
|
|
2946
|
+
/* @__PURE__ */ t(
|
|
2947
|
+
"div",
|
|
2948
|
+
{
|
|
2949
|
+
className: D(
|
|
2950
|
+
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
2951
|
+
{
|
|
2952
|
+
// In direct conversation mode (or waiting for it), always show (full width)
|
|
2953
|
+
flex: U || le || l,
|
|
2954
|
+
// Normal mode: hide on mobile when no channel selected
|
|
2955
|
+
"hidden lg:flex": !U && !le && !l
|
|
2956
|
+
}
|
|
2957
|
+
),
|
|
2958
|
+
children: H ? /* @__PURE__ */ t("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ t(
|
|
2959
|
+
$t,
|
|
2960
|
+
{
|
|
2961
|
+
channel: H,
|
|
2962
|
+
onBack: ie,
|
|
2963
|
+
showBackButton: !U,
|
|
2964
|
+
renderMessageInputActions: n,
|
|
2965
|
+
renderConversationFooter: a,
|
|
2966
|
+
renderChannelBanner: $,
|
|
2967
|
+
onLeaveConversation: Ne,
|
|
2968
|
+
onBlockParticipant: fe,
|
|
2969
|
+
CustomChannelEmptyState: c,
|
|
2970
|
+
showDeleteConversation: me,
|
|
2971
|
+
onDeleteConversationClick: h,
|
|
2972
|
+
onBlockParticipantClick: r,
|
|
2973
|
+
onReportParticipantClick: b,
|
|
2974
|
+
dmAgentEnabled: w,
|
|
2975
|
+
messageMetadata: x,
|
|
2976
|
+
onMessageSent: N,
|
|
2977
|
+
showStarButton: p,
|
|
2978
|
+
chatbotVotingEnabled: I,
|
|
2979
|
+
viewerLanguage: S,
|
|
2980
|
+
customProfileContent: k,
|
|
2981
|
+
customChannelActions: M,
|
|
2982
|
+
renderMessage: j,
|
|
2983
|
+
sendButton: _
|
|
2984
|
+
},
|
|
2985
|
+
H.id
|
|
2986
|
+
) }) : l ? (
|
|
2987
|
+
// Show loading while creating/loading direct conversation channel
|
|
2988
|
+
/* @__PURE__ */ t(ye, {})
|
|
2989
|
+
) : /* @__PURE__ */ t(
|
|
2990
|
+
jt,
|
|
2991
|
+
{
|
|
2992
|
+
hasChannels: te,
|
|
2993
|
+
channelsLoaded: u
|
|
2994
|
+
}
|
|
2995
|
+
)
|
|
2996
|
+
}
|
|
2997
|
+
)
|
|
2998
|
+
] })
|
|
2999
|
+
}
|
|
3000
|
+
);
|
|
3001
|
+
}, ba = ({
|
|
3002
|
+
question: e,
|
|
3003
|
+
onClick: s,
|
|
3004
|
+
loading: n = !1,
|
|
3005
|
+
className: a
|
|
3006
|
+
}) => /* @__PURE__ */ t(
|
|
3007
|
+
"button",
|
|
3008
|
+
{
|
|
3009
|
+
type: "button",
|
|
3010
|
+
onClick: s,
|
|
3011
|
+
disabled: n,
|
|
3012
|
+
style: { backgroundColor: "#E6E5E3" },
|
|
3013
|
+
className: D(
|
|
3014
|
+
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring",
|
|
3015
|
+
{
|
|
3016
|
+
"hover:brightness-95 active:brightness-90": !n,
|
|
3017
|
+
"opacity-50 cursor-not-allowed": n
|
|
3018
|
+
},
|
|
3019
|
+
a
|
|
3020
|
+
),
|
|
3021
|
+
children: e
|
|
3022
|
+
}
|
|
3023
|
+
), ka = ({
|
|
3024
|
+
faqs: e,
|
|
3025
|
+
onFaqClick: s,
|
|
3026
|
+
loadingFaqId: n,
|
|
3027
|
+
headerText: a,
|
|
3028
|
+
className: o,
|
|
3029
|
+
avatarImage: l,
|
|
3030
|
+
avatarName: i
|
|
3031
|
+
}) => {
|
|
3032
|
+
const c = e.filter((f) => f.enabled).sort((f, g) => (f.order ?? 0) - (g.order ?? 0));
|
|
3033
|
+
return c.length === 0 ? null : /* @__PURE__ */ t("div", { className: o, children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
|
|
3034
|
+
(l || i) && /* @__PURE__ */ t("div", { className: "flex-none", children: /* @__PURE__ */ t(
|
|
3035
|
+
ae,
|
|
3036
|
+
{
|
|
3037
|
+
id: i || "account",
|
|
3038
|
+
name: i || "Account",
|
|
3039
|
+
image: l,
|
|
3040
|
+
size: 24,
|
|
3041
|
+
shape: "circle"
|
|
3042
|
+
}
|
|
3043
|
+
) }),
|
|
3044
|
+
/* @__PURE__ */ d(
|
|
3045
|
+
"div",
|
|
3046
|
+
{
|
|
3047
|
+
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
3048
|
+
style: { backgroundColor: "#F1F0EE" },
|
|
3049
|
+
children: [
|
|
3050
|
+
a && /* @__PURE__ */ t("p", { className: "text-md text-charcoal mb-4", children: a }),
|
|
3051
|
+
c.map((f) => /* @__PURE__ */ t(
|
|
3052
|
+
ba,
|
|
3053
|
+
{
|
|
3054
|
+
question: f.question,
|
|
3055
|
+
onClick: () => s(f.id),
|
|
3056
|
+
loading: n === f.id
|
|
3057
|
+
},
|
|
3058
|
+
f.id
|
|
3059
|
+
))
|
|
3060
|
+
]
|
|
3061
|
+
}
|
|
3062
|
+
)
|
|
3063
|
+
] }) });
|
|
3064
|
+
};
|
|
3065
|
+
export {
|
|
3066
|
+
Lt as A,
|
|
3067
|
+
ua as C,
|
|
3068
|
+
ka as F,
|
|
3069
|
+
ft as L,
|
|
3070
|
+
Ea as M,
|
|
3071
|
+
be as a,
|
|
3072
|
+
ae as b,
|
|
3073
|
+
Mt as c,
|
|
3074
|
+
$t as d,
|
|
3075
|
+
Sa as e,
|
|
3076
|
+
ba as f,
|
|
3077
|
+
_e as g,
|
|
3078
|
+
Gn as h,
|
|
3079
|
+
Ca as i,
|
|
3080
|
+
Ia as j,
|
|
3081
|
+
Qs as k,
|
|
3082
|
+
It as l,
|
|
3083
|
+
Ot as m,
|
|
3084
|
+
en as n,
|
|
3085
|
+
je as o,
|
|
3086
|
+
Ge as p,
|
|
3087
|
+
gn as q,
|
|
3088
|
+
we as r,
|
|
3089
|
+
Ws as s,
|
|
3090
|
+
jn as u
|
|
3091
|
+
};
|
|
3092
|
+
//# sourceMappingURL=index-B1h46F9x.js.map
|