@linktr.ee/messaging-react 4.4.0-rc-1787552892 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AttachmentCard-BqwWgqvi.js +369 -0
- package/dist/AttachmentCard-BqwWgqvi.js.map +1 -0
- package/dist/AttachmentCard-DUrgGRsq.cjs +2 -0
- package/dist/AttachmentCard-DUrgGRsq.cjs.map +1 -0
- package/dist/Card-BIbqWagz.cjs +2 -0
- package/dist/Card-BIbqWagz.cjs.map +1 -0
- package/dist/Card-C7uLQbYz.js +105 -0
- package/dist/Card-C7uLQbYz.js.map +1 -0
- package/dist/Card-Ds1FMcUj.cjs +2 -0
- package/dist/Card-Ds1FMcUj.cjs.map +1 -0
- package/dist/Card-f51K6V7Y.js +498 -0
- package/dist/Card-f51K6V7Y.js.map +1 -0
- package/dist/LoadingDots-BSk_UeS0.cjs +2 -0
- package/dist/LoadingDots-BSk_UeS0.cjs.map +1 -0
- package/dist/LoadingDots-B_WiXBeQ.js +73 -0
- package/dist/LoadingDots-B_WiXBeQ.js.map +1 -0
- package/dist/assets/index.css +2 -1
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3925 -38
- package/dist/index.js.map +1 -1
- package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
- package/dist/testing.cjs +2 -2
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +106 -118
- package/dist/testing.js.map +1 -1
- package/package.json +5 -5
- package/src/components/MessageAttachment/_shared/MediaStackGrid.test.tsx +28 -0
- package/src/components/MessageAttachment/_shared/MediaStackGrid.tsx +22 -14
- package/dist/Card-Be81K6su.cjs +0 -2
- package/dist/Card-Be81K6su.cjs.map +0 -1
- package/dist/Card-BzvDr-pU.js +0 -112
- package/dist/Card-BzvDr-pU.js.map +0 -1
- package/dist/Card-ChcosZir.js +0 -1034
- package/dist/Card-ChcosZir.js.map +0 -1
- package/dist/Card-KU88ECCR.cjs +0 -2
- package/dist/Card-KU88ECCR.cjs.map +0 -1
- package/dist/PurchaseStatusBadge-BmqAQEV9.cjs +0 -2
- package/dist/PurchaseStatusBadge-BmqAQEV9.cjs.map +0 -1
- package/dist/PurchaseStatusBadge-D1RRsubZ.js +0 -59
- package/dist/PurchaseStatusBadge-D1RRsubZ.js.map +0 -1
- package/dist/index-Dg235rZT.js +0 -5364
- package/dist/index-Dg235rZT.js.map +0 -1
- package/dist/index-WEbnLVHC.cjs +0 -3
- package/dist/index-WEbnLVHC.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,38 +1,3925 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a } from "./AttachmentCard-BqwWgqvi.js";
|
|
2
|
+
import o, { Suspense as s, createContext as c, useCallback as l, useContext as u, useEffect as d, useId as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
3
|
+
import { StreamChatService as g } from "@linktr.ee/messaging-core";
|
|
4
|
+
import { LinkPreviewsManager as _, StreamChat as v } from "stream-chat";
|
|
5
|
+
import { AIStates as y, Attachment as b, AttachmentPreviewList as x, Channel as S, ChannelList as C, Chat as w, DateSeparator as T, EditMessageModal as E, InfiniteScroll as D, MessageBlocked as O, MessageBounceModal as k, MessageBouncePrompt as A, MessageDeleted as j, MessageErrorIcon as M, MessageInput as N, MessageIsThreadReplyInChannelButtonIndicator as P, MessageList as F, MessageRepliesCountButton as I, MessageStatus as L, MessageText as R, MessageTimestamp as z, Poll as ee, QuotedMessagePreview as te, ReminderNotification as ne, StreamedMessageText as re, TextareaComposer as ie, Window as B, WithComponents as ae, areMessageUIPropsEqual as oe, isDateSeparatorMessage as se, isMessageBlocked as ce, isMessageBounced as le, messageHasAttachments as ue, messageHasReactions as de, useAIState as fe, useActiveAudioPlayer as pe, useChannelStateContext as V, useChatContext as me, useComponentContext as he, useMessageComposer as ge, useMessageComposerHasSendableData as _e, useMessageContext as H, useMessageInputContext as ve, useMessageReminder as ye, useStateStore as be, useTypingContext as xe } from "stream-chat-react";
|
|
6
|
+
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
7
|
+
import { MESSAGE_CUSTOM_TYPE as K, OFFICIAL_SENDER_USER_ID as q, isAgeSafetySystemType as Se, isDmAgentSystemType as Ce, isOfficialChannel as we, resolveRichCardImagePresentation as Te, selectEnabledFaqs as J } from "@linktr.ee/messaging-taxonomy";
|
|
8
|
+
import Y from "classnames";
|
|
9
|
+
import { ArrowLeftIcon as Ee, ArrowUpIcon as De, CaretLeftIcon as Oe, CaretRightIcon as ke, ChecksIcon as Ae, CircleNotchIcon as je, CurrencyDollarIcon as X, DotsThreeIcon as Z, DownloadSimpleIcon as Me, FlagIcon as Ne, GiftIcon as Pe, MegaphoneIcon as Fe, PencilSimpleIcon as Ie, PlayIcon as Le, ProhibitIcon as Re, ProhibitInsetIcon as ze, SignOutIcon as Be, SparkleIcon as Ve, SpinnerGapIcon as He, StarIcon as Ue, TrashSimpleIcon as We, VideoCameraIcon as Ge, WarningCircleIcon as Ke, XIcon as qe } from "@phosphor-icons/react";
|
|
10
|
+
import { DefaultDropdownActionButton as Je, MessageActions as Ye } from "stream-chat-react/experimental";
|
|
11
|
+
//#region src/logging/index.tsx
|
|
12
|
+
var Xe = {
|
|
13
|
+
debug: (e, ...t) => console.log(e, ...t),
|
|
14
|
+
info: (e, ...t) => console.log(e, ...t),
|
|
15
|
+
warn: (e, ...t) => console.warn(e, ...t),
|
|
16
|
+
error: (e, ...t) => console.error(e, ...t)
|
|
17
|
+
}, Ze = (e) => ({
|
|
18
|
+
debug: e?.debug ?? Xe.debug,
|
|
19
|
+
info: e?.info ?? Xe.info,
|
|
20
|
+
warn: e?.warn ?? Xe.warn,
|
|
21
|
+
error: e?.error ?? Xe.error
|
|
22
|
+
}), Qe = c(Xe), $e = ({ logger: e, children: t }) => {
|
|
23
|
+
let n = p(() => Ze(e), [e]);
|
|
24
|
+
return /* @__PURE__ */ W(Qe.Provider, {
|
|
25
|
+
value: n,
|
|
26
|
+
children: t
|
|
27
|
+
});
|
|
28
|
+
}, et = () => u(Qe), tt = c({
|
|
29
|
+
service: null,
|
|
30
|
+
client: null,
|
|
31
|
+
isConnected: !1,
|
|
32
|
+
isLoading: !1,
|
|
33
|
+
error: null,
|
|
34
|
+
capabilities: {},
|
|
35
|
+
refreshConnection: async () => {},
|
|
36
|
+
debug: !1
|
|
37
|
+
}), nt = () => u(tt), rt = ({ children: e, user: t, serviceConfig: n, apiKey: r, capabilities: i = {}, debug: a = !1, client: s, logger: c }) => {
|
|
38
|
+
let u = l((e, ...t) => {
|
|
39
|
+
a && console.log(`🔥 [MessagingProvider] ${e}`, ...t);
|
|
40
|
+
}, [a]);
|
|
41
|
+
u("🔄 RENDER START", {
|
|
42
|
+
userId: t?.id,
|
|
43
|
+
apiKey: r?.substring(0, 8) + "...",
|
|
44
|
+
serviceConfig: !!n,
|
|
45
|
+
capabilities: Object.keys(i)
|
|
46
|
+
});
|
|
47
|
+
let [f, p] = h(null), [_, y] = h(null), [b, x] = h(!1), [S, C] = h(!1), [T, E] = h(null), D = m(!1), O = m(null), k = m(n);
|
|
48
|
+
k.current = n;
|
|
49
|
+
let A = m(a);
|
|
50
|
+
A.current = a;
|
|
51
|
+
let j = m(c);
|
|
52
|
+
j.current = c;
|
|
53
|
+
let M = m({
|
|
54
|
+
userId: t?.id,
|
|
55
|
+
apiKey: r,
|
|
56
|
+
serviceConfig: n,
|
|
57
|
+
capabilities: i
|
|
58
|
+
}), N = m(0);
|
|
59
|
+
N.current++, u("📊 RENDER INFO", {
|
|
60
|
+
renderCount: N.current,
|
|
61
|
+
currentProps: {
|
|
62
|
+
userId: t?.id,
|
|
63
|
+
apiKey: r?.substring(0, 8) + "..."
|
|
64
|
+
},
|
|
65
|
+
propChanges: {
|
|
66
|
+
userChanged: M.current.userId !== t?.id,
|
|
67
|
+
apiKeyChanged: M.current.apiKey !== r,
|
|
68
|
+
serviceConfigChanged: M.current.serviceConfig !== n,
|
|
69
|
+
capabilitiesChanged: M.current.capabilities !== i
|
|
70
|
+
}
|
|
71
|
+
}), M.current = {
|
|
72
|
+
userId: t?.id,
|
|
73
|
+
apiKey: r,
|
|
74
|
+
serviceConfig: n,
|
|
75
|
+
capabilities: i
|
|
76
|
+
};
|
|
77
|
+
let P = m(null);
|
|
78
|
+
!s && r && P.current?.apiKey !== r && (P.current = {
|
|
79
|
+
apiKey: r,
|
|
80
|
+
client: new v(r)
|
|
81
|
+
});
|
|
82
|
+
let F = s || (r ? P.current?.client ?? null : null);
|
|
83
|
+
d(() => {
|
|
84
|
+
let e = N.current, t = k.current;
|
|
85
|
+
if (s) {
|
|
86
|
+
O.current = null, p(null), y(null), x(!1), E(null), C(!1);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!r || !F || !t) {
|
|
90
|
+
u("⚠️ SERVICE INIT SKIPPED", {
|
|
91
|
+
renderCount: e,
|
|
92
|
+
reason: "Missing apiKey, client, or serviceConfig"
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
u("🚀 CREATING SERVICE", {
|
|
97
|
+
renderCount: e,
|
|
98
|
+
apiKey: r?.substring(0, 8) + "..."
|
|
99
|
+
});
|
|
100
|
+
let n = new g({
|
|
101
|
+
...t,
|
|
102
|
+
apiKey: r,
|
|
103
|
+
debug: A.current,
|
|
104
|
+
client: F,
|
|
105
|
+
...t.logger || !j.current ? {} : { logger: Ze(j.current) }
|
|
106
|
+
});
|
|
107
|
+
O.current = n, p(n), u("✅ SERVICE SET", {
|
|
108
|
+
renderCount: e,
|
|
109
|
+
serviceInstance: !!n
|
|
110
|
+
});
|
|
111
|
+
}, [
|
|
112
|
+
r,
|
|
113
|
+
F,
|
|
114
|
+
s
|
|
115
|
+
]);
|
|
116
|
+
let I = m(null);
|
|
117
|
+
d(() => {
|
|
118
|
+
if (u("🔗 USER CONNECTION EFFECT TRIGGERED", {
|
|
119
|
+
hasService: !!f,
|
|
120
|
+
hasUser: !!t,
|
|
121
|
+
userId: t?.id,
|
|
122
|
+
isConnecting: D.current,
|
|
123
|
+
isConnected: b,
|
|
124
|
+
dependencies: {
|
|
125
|
+
service: !!f,
|
|
126
|
+
userId: t?.id
|
|
127
|
+
}
|
|
128
|
+
}), !s) {
|
|
129
|
+
if (!f || !t) {
|
|
130
|
+
u("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (D.current) {
|
|
134
|
+
u("⚠️ USER CONNECTION SKIPPED", "Already connecting");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (I.current?.serviceId === f && I.current?.userId === t.id) {
|
|
138
|
+
u("⚠️ USER CONNECTION SKIPPED", "Already connected this user with this service");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
(async () => {
|
|
142
|
+
u("🚀 STARTING USER CONNECTION", { userId: t.id }), D.current = !0, C(!0), E(null);
|
|
143
|
+
try {
|
|
144
|
+
u("📞 CALLING SERVICE.CONNECTUSER", { userId: t.id });
|
|
145
|
+
let e = await f.connectUser(t);
|
|
146
|
+
y(e), x(!0), I.current = {
|
|
147
|
+
serviceId: f,
|
|
148
|
+
userId: t.id
|
|
149
|
+
}, u("✅ USER CONNECTION SUCCESS", {
|
|
150
|
+
userId: t.id,
|
|
151
|
+
clientId: e.userID
|
|
152
|
+
});
|
|
153
|
+
} catch (e) {
|
|
154
|
+
let n = e instanceof Error ? e.message : "Connection failed";
|
|
155
|
+
E(n), u("❌ USER CONNECTION ERROR", {
|
|
156
|
+
userId: t.id,
|
|
157
|
+
error: n
|
|
158
|
+
});
|
|
159
|
+
} finally {
|
|
160
|
+
C(!1), D.current = !1, u("🔄 USER CONNECTION FINISHED", {
|
|
161
|
+
userId: t.id,
|
|
162
|
+
isConnected: b
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
}
|
|
167
|
+
}, [
|
|
168
|
+
f,
|
|
169
|
+
t,
|
|
170
|
+
u,
|
|
171
|
+
b,
|
|
172
|
+
s
|
|
173
|
+
]), d(() => {
|
|
174
|
+
let e = F;
|
|
175
|
+
return () => {
|
|
176
|
+
e && (I.current = null, O.current?.disconnectUser().catch(console.error));
|
|
177
|
+
};
|
|
178
|
+
}, [F]);
|
|
179
|
+
let L = l(async () => {
|
|
180
|
+
if (u("🔄 REFRESH CONNECTION CALLED", {
|
|
181
|
+
hasService: !!f,
|
|
182
|
+
hasUser: !!t
|
|
183
|
+
}), !s) {
|
|
184
|
+
if (!f || !t) {
|
|
185
|
+
u("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
u("🚀 STARTING CONNECTION REFRESH", { userId: t.id }), C(!0);
|
|
189
|
+
try {
|
|
190
|
+
u("🔌 DISCONNECTING FOR REFRESH"), await f.disconnectUser(), u("📞 RECONNECTING FOR REFRESH");
|
|
191
|
+
let e = await f.connectUser(t);
|
|
192
|
+
y(e), x(!0), E(null), u("✅ CONNECTION REFRESH SUCCESS", { userId: t.id });
|
|
193
|
+
} catch (e) {
|
|
194
|
+
let n = e instanceof Error ? e.message : "Refresh failed";
|
|
195
|
+
E(n), u("❌ CONNECTION REFRESH ERROR", {
|
|
196
|
+
userId: t.id,
|
|
197
|
+
error: n
|
|
198
|
+
});
|
|
199
|
+
} finally {
|
|
200
|
+
C(!1), u("🔄 CONNECTION REFRESH FINISHED", { userId: t.id });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, [
|
|
204
|
+
f,
|
|
205
|
+
t,
|
|
206
|
+
u,
|
|
207
|
+
s
|
|
208
|
+
]), R = o.useMemo(() => (u("💫 CONTEXT VALUE MEMOIZATION", {
|
|
209
|
+
hasService: !!f,
|
|
210
|
+
hasClient: !!_,
|
|
211
|
+
isConnected: b,
|
|
212
|
+
isLoading: S,
|
|
213
|
+
hasError: !!T,
|
|
214
|
+
capabilitiesKeys: Object.keys(i)
|
|
215
|
+
}), {
|
|
216
|
+
service: s ? null : f,
|
|
217
|
+
client: s ?? _,
|
|
218
|
+
isConnected: s ? !0 : b,
|
|
219
|
+
isLoading: !s && S,
|
|
220
|
+
error: s ? null : T,
|
|
221
|
+
capabilities: i,
|
|
222
|
+
refreshConnection: L,
|
|
223
|
+
debug: a
|
|
224
|
+
}), [
|
|
225
|
+
f,
|
|
226
|
+
_,
|
|
227
|
+
s,
|
|
228
|
+
b,
|
|
229
|
+
S,
|
|
230
|
+
T,
|
|
231
|
+
i,
|
|
232
|
+
L,
|
|
233
|
+
a,
|
|
234
|
+
u
|
|
235
|
+
]);
|
|
236
|
+
return u("🔄 RENDER END", {
|
|
237
|
+
renderCount: N.current,
|
|
238
|
+
willRenderChat: !!F,
|
|
239
|
+
contextValueReady: !!R
|
|
240
|
+
}), /* @__PURE__ */ W($e, {
|
|
241
|
+
logger: c,
|
|
242
|
+
children: /* @__PURE__ */ W(tt.Provider, {
|
|
243
|
+
value: R,
|
|
244
|
+
children: F ? /* @__PURE__ */ W(w, {
|
|
245
|
+
client: F,
|
|
246
|
+
customClasses: { channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]" },
|
|
247
|
+
children: e
|
|
248
|
+
}) : e
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}, it = () => nt(), at = (e) => {
|
|
252
|
+
let [t, n] = h(!!e?.state?.membership?.pinned_at);
|
|
253
|
+
return d(() => {
|
|
254
|
+
if (!e) {
|
|
255
|
+
n(!1);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
n(!!e.state.membership?.pinned_at);
|
|
259
|
+
let t = (t) => {
|
|
260
|
+
n(t?.member ? !!t.member.pinned_at : !!e.state.membership?.pinned_at);
|
|
261
|
+
};
|
|
262
|
+
return e.on("member.updated", t), () => {
|
|
263
|
+
e.off("member.updated", t);
|
|
264
|
+
};
|
|
265
|
+
}, [e]), t;
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/utils/resolveConversationParticipant.ts
|
|
269
|
+
function ot(e, t, n) {
|
|
270
|
+
let r = Object.values(e || {});
|
|
271
|
+
if (we(n)) {
|
|
272
|
+
let e = r.find((e) => e.user?.id === q);
|
|
273
|
+
if (e) return e;
|
|
274
|
+
}
|
|
275
|
+
return r.find((e) => e.user?.id && e.user.id !== t);
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/utils/resolveParticipantDisplayName.ts
|
|
279
|
+
var st = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
280
|
+
function ct(e) {
|
|
281
|
+
return st.test(e.trim());
|
|
282
|
+
}
|
|
283
|
+
function lt(e, t) {
|
|
284
|
+
let n = e?.trim();
|
|
285
|
+
return !n || t && n === t || t && n === `Follower ${t}` ? !1 : !ct(n);
|
|
286
|
+
}
|
|
287
|
+
function ut(e) {
|
|
288
|
+
return lt(e?.name, e?.id) ? e.name.trim() : lt(e?.username, e?.id) ? e.username.trim() : "Unknown member";
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/components/Avatar/getAvatarEmoji.ts
|
|
292
|
+
var dt = [
|
|
293
|
+
{
|
|
294
|
+
emoji: "🍎",
|
|
295
|
+
bgColor: "#FFD1DD"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
emoji: "🍌",
|
|
299
|
+
bgColor: "#FFF1C9"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
emoji: "🍇",
|
|
303
|
+
bgColor: "#E6D9FF"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
emoji: "🍊",
|
|
307
|
+
bgColor: "#D6F4FF"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
emoji: "🍓",
|
|
311
|
+
bgColor: "#FFE0AE"
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
emoji: "🥥",
|
|
315
|
+
bgColor: "#F7E7D8"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
emoji: "🍒",
|
|
319
|
+
bgColor: "#DFF4D8"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
emoji: "🥭",
|
|
323
|
+
bgColor: "#FFD8C2"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
emoji: "🍉",
|
|
327
|
+
bgColor: "#D6EBFF"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
emoji: "🍋",
|
|
331
|
+
bgColor: "#CAEEB5"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
emoji: "🥝",
|
|
335
|
+
bgColor: "#FFE7C7"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
emoji: "🫒",
|
|
339
|
+
bgColor: "#F6E3B4"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
emoji: "🍈",
|
|
343
|
+
bgColor: "#D9F7E1"
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
function ft(e) {
|
|
347
|
+
let t = 0;
|
|
348
|
+
for (let n = 0; n < e.length; n++) {
|
|
349
|
+
let r = e.charCodeAt(n);
|
|
350
|
+
t = (t << 5) - t + r, t &= t;
|
|
351
|
+
}
|
|
352
|
+
return Math.abs(t);
|
|
353
|
+
}
|
|
354
|
+
function pt(e) {
|
|
355
|
+
return dt[ft(e) % dt.length];
|
|
356
|
+
}
|
|
357
|
+
function mt(e) {
|
|
358
|
+
return pt(e).emoji;
|
|
359
|
+
}
|
|
360
|
+
function ht(e) {
|
|
361
|
+
return pt(e).bgColor;
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/components/Avatar/index.tsx
|
|
365
|
+
var gt = ({ id: e, image: t, size: n = 40, className: r, starred: i = !1, shape: a = "squircle", dmAgentEnabled: o = !1 }) => {
|
|
366
|
+
let s = mt(e), c = ht(e), l = n < 32 ? Math.round(n * .45) : n < 56 ? 14 : n < 120 ? 18 : 36, u = n >= 40 ? 2 : 1, d = a === "circle" ? { borderRadius: "50%" } : { borderRadius: "1rem" }, f = /* @__PURE__ */ W("div", {
|
|
367
|
+
className: "h-full w-full overflow-hidden",
|
|
368
|
+
style: d,
|
|
369
|
+
children: t ? /* @__PURE__ */ W("img", {
|
|
370
|
+
src: t,
|
|
371
|
+
alt: "",
|
|
372
|
+
className: "h-full w-full object-cover"
|
|
373
|
+
}) : /* @__PURE__ */ W("div", {
|
|
374
|
+
"aria-hidden": "true",
|
|
375
|
+
className: Y("avatar-fallback flex h-full w-full items-center justify-center font-semibold select-none transition-colors"),
|
|
376
|
+
style: {
|
|
377
|
+
fontSize: l,
|
|
378
|
+
lineHeight: 1
|
|
379
|
+
},
|
|
380
|
+
children: s
|
|
381
|
+
})
|
|
382
|
+
});
|
|
383
|
+
return /* @__PURE__ */ G("div", {
|
|
384
|
+
className: Y("relative flex-shrink-0", r),
|
|
385
|
+
style: {
|
|
386
|
+
"--str-chat__avatar-size": `${n}px`,
|
|
387
|
+
width: `${n}px`,
|
|
388
|
+
height: `${n}px`,
|
|
389
|
+
backgroundColor: t ? void 0 : c,
|
|
390
|
+
...d
|
|
391
|
+
},
|
|
392
|
+
children: [i && /* @__PURE__ */ W("div", {
|
|
393
|
+
"aria-hidden": "true",
|
|
394
|
+
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)]",
|
|
395
|
+
children: /* @__PURE__ */ W(Ue, {
|
|
396
|
+
className: "size-3 text-yellow-600",
|
|
397
|
+
weight: "duotone"
|
|
398
|
+
})
|
|
399
|
+
}), /* @__PURE__ */ W("div", {
|
|
400
|
+
"data-testid": "avatar-ring",
|
|
401
|
+
className: Y("h-full w-full", "bg-transparent"),
|
|
402
|
+
style: {
|
|
403
|
+
...d,
|
|
404
|
+
...o && {
|
|
405
|
+
borderWidth: `${u}px`,
|
|
406
|
+
borderStyle: "solid",
|
|
407
|
+
borderColor: "var(--AI-Gradient, #7F22FE)",
|
|
408
|
+
boxShadow: "inset 0 1px 2px 0 rgba(255, 255, 255, 0.5)"
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
children: f
|
|
412
|
+
})]
|
|
413
|
+
});
|
|
414
|
+
}, _t = "https://linktr.ee/s/about/trust-center/report", vt = ({ channel: e, participant: t, showBlockParticipant: n = !0, enabled: r = !0, onLeaveConversation: i, onBlockParticipant: a, onDeleteConversationClick: o, onBlockParticipantClick: s, onReportParticipantClick: c, onActionComplete: l, logLabel: u = "useChannelModerationActions" }) => {
|
|
415
|
+
let { service: f, debug: p } = nt(), m = t?.user?.id, g = !!(r && n && f && m), [_, v] = h(!1), [y, b] = h(null), [x, S] = h(!1), [C, w] = h(!1), T = g && (y?.participantId !== m || y?.service !== f);
|
|
416
|
+
return d(() => {
|
|
417
|
+
if (!g || !f || !m) {
|
|
418
|
+
v(!1), b(null);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
let e = !1;
|
|
422
|
+
return (async () => {
|
|
423
|
+
try {
|
|
424
|
+
let t = await f.getBlockedUsers();
|
|
425
|
+
if (e) return;
|
|
426
|
+
v(t.some((e) => e.blocked_user_id === m));
|
|
427
|
+
} catch (t) {
|
|
428
|
+
e || console.error(`[${u}] Failed to check blocked status:`, t);
|
|
429
|
+
} finally {
|
|
430
|
+
e || b({
|
|
431
|
+
participantId: m,
|
|
432
|
+
service: f
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
})(), () => {
|
|
436
|
+
e = !0;
|
|
437
|
+
};
|
|
438
|
+
}, [
|
|
439
|
+
g,
|
|
440
|
+
f,
|
|
441
|
+
m,
|
|
442
|
+
u
|
|
443
|
+
]), {
|
|
444
|
+
isParticipantBlocked: _,
|
|
445
|
+
isCheckingBlockedStatus: T,
|
|
446
|
+
isLeaving: x,
|
|
447
|
+
isUpdatingBlockStatus: C,
|
|
448
|
+
handleLeaveConversation: async () => {
|
|
449
|
+
if (!x) {
|
|
450
|
+
o?.(), p && console.log(`[${u}] Leave conversation`, e.cid), S(!0);
|
|
451
|
+
try {
|
|
452
|
+
let t = e._client?.userID ?? null;
|
|
453
|
+
await e.hide(t, !1), i && await i(e), l?.();
|
|
454
|
+
} catch (e) {
|
|
455
|
+
console.error(`[${u}] Failed to leave conversation`, e);
|
|
456
|
+
} finally {
|
|
457
|
+
S(!1);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
handleBlockUser: async () => {
|
|
462
|
+
if (!(C || !f)) {
|
|
463
|
+
s?.(), p && console.log(`[${u}] Block member`, t?.user?.id), w(!0);
|
|
464
|
+
try {
|
|
465
|
+
await f.blockUser(t?.user?.id), a && await a(t?.user?.id), l?.();
|
|
466
|
+
} catch (e) {
|
|
467
|
+
console.error(`[${u}] Failed to block member`, e);
|
|
468
|
+
} finally {
|
|
469
|
+
w(!1);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
handleUnblockUser: async () => {
|
|
474
|
+
if (!(C || !f)) {
|
|
475
|
+
s?.(), p && console.log(`[${u}] Unblock member`, t?.user?.id), w(!0);
|
|
476
|
+
try {
|
|
477
|
+
await f.unBlockUser(t?.user?.id), a && await a(t?.user?.id), l?.();
|
|
478
|
+
} catch (e) {
|
|
479
|
+
console.error(`[${u}] Failed to unblock member`, e);
|
|
480
|
+
} finally {
|
|
481
|
+
w(!1);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
handleReportUser: () => {
|
|
486
|
+
c?.(), l?.(), window.open(_t, "_blank", "noopener,noreferrer");
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
}, yt = ({ variant: e = "default", className: t, children: n, ...r }) => /* @__PURE__ */ W("button", {
|
|
490
|
+
type: "button",
|
|
491
|
+
className: Y("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", e === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand", t),
|
|
492
|
+
...r,
|
|
493
|
+
children: n
|
|
494
|
+
}), bt = ({ channel: e, participant: t, showDeleteConversation: n = !0, showBlockParticipant: r = !0, showReportParticipant: i = !0, onLeaveConversation: a, onBlockParticipant: o, onDeleteConversationClick: s, onBlockParticipantClick: c, onReportParticipantClick: u, customChannelActions: p, triggerClassName: g }) => {
|
|
495
|
+
let [_, v] = h(!1), y = m(null), b = f(), { isParticipantBlocked: x, isCheckingBlockedStatus: S, isLeaving: C, isUpdatingBlockStatus: w, handleLeaveConversation: T, handleBlockUser: E, handleUnblockUser: D, handleReportUser: O } = vt({
|
|
496
|
+
channel: e,
|
|
497
|
+
participant: t,
|
|
498
|
+
showBlockParticipant: r,
|
|
499
|
+
enabled: _,
|
|
500
|
+
onLeaveConversation: a,
|
|
501
|
+
onBlockParticipant: o,
|
|
502
|
+
onDeleteConversationClick: s,
|
|
503
|
+
onBlockParticipantClick: c,
|
|
504
|
+
onReportParticipantClick: u,
|
|
505
|
+
onActionComplete: l(() => v(!1), []),
|
|
506
|
+
logLabel: "ChannelActionsMenu"
|
|
507
|
+
});
|
|
508
|
+
return d(() => {
|
|
509
|
+
if (!_) return;
|
|
510
|
+
let e = (e) => {
|
|
511
|
+
y.current && !y.current.contains(e.target) && v(!1);
|
|
512
|
+
}, t = (e) => {
|
|
513
|
+
e.key === "Escape" && v(!1);
|
|
514
|
+
};
|
|
515
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
516
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
517
|
+
};
|
|
518
|
+
}, [_]), !t || !(n || r || i || p) ? null : /* @__PURE__ */ G("div", {
|
|
519
|
+
ref: y,
|
|
520
|
+
className: "relative",
|
|
521
|
+
children: [/* @__PURE__ */ G("button", {
|
|
522
|
+
className: g,
|
|
523
|
+
type: "button",
|
|
524
|
+
"aria-haspopup": "true",
|
|
525
|
+
"aria-expanded": _,
|
|
526
|
+
"aria-controls": _ ? b : void 0,
|
|
527
|
+
onClick: () => v((e) => !e),
|
|
528
|
+
children: [/* @__PURE__ */ W(Z, { className: "size-5 text-black/90" }), /* @__PURE__ */ W("span", {
|
|
529
|
+
className: "sr-only",
|
|
530
|
+
children: "More options"
|
|
531
|
+
})]
|
|
532
|
+
}), _ && /* @__PURE__ */ W("div", {
|
|
533
|
+
id: b,
|
|
534
|
+
"aria-label": "Conversation options",
|
|
535
|
+
className: Y("absolute right-0 top-full z-50 mt-2 w-56 overflow-hidden", "rounded-lg border border-sand bg-white p-1 shadow-max-elevation-light"),
|
|
536
|
+
children: /* @__PURE__ */ G("ul", {
|
|
537
|
+
className: "flex flex-col gap-1",
|
|
538
|
+
children: [
|
|
539
|
+
n && /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G(yt, {
|
|
540
|
+
onClick: T,
|
|
541
|
+
disabled: C,
|
|
542
|
+
"aria-busy": C,
|
|
543
|
+
children: [C ? /* @__PURE__ */ W(He, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ W(Be, { className: "h-5 w-5" }), /* @__PURE__ */ W("span", { children: "Delete Conversation" })]
|
|
544
|
+
}) }),
|
|
545
|
+
r && /* @__PURE__ */ W("li", { children: S ? /* @__PURE__ */ G(yt, {
|
|
546
|
+
disabled: !0,
|
|
547
|
+
"aria-busy": !0,
|
|
548
|
+
children: [/* @__PURE__ */ W(He, { className: "h-5 w-5 animate-spin" }), /* @__PURE__ */ W("span", { children: "Block" })]
|
|
549
|
+
}) : x ? /* @__PURE__ */ G(yt, {
|
|
550
|
+
onClick: D,
|
|
551
|
+
disabled: w,
|
|
552
|
+
"aria-busy": w,
|
|
553
|
+
children: [w ? /* @__PURE__ */ W(He, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ W(ze, { className: "h-5 w-5" }), /* @__PURE__ */ W("span", { children: "Unblock" })]
|
|
554
|
+
}) : /* @__PURE__ */ G(yt, {
|
|
555
|
+
onClick: E,
|
|
556
|
+
disabled: w,
|
|
557
|
+
"aria-busy": w,
|
|
558
|
+
children: [w ? /* @__PURE__ */ W(He, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ W(ze, { className: "h-5 w-5" }), /* @__PURE__ */ W("span", { children: "Block" })]
|
|
559
|
+
}) }),
|
|
560
|
+
i && /* @__PURE__ */ W("li", { children: /* @__PURE__ */ G(yt, {
|
|
561
|
+
variant: "danger",
|
|
562
|
+
onClick: O,
|
|
563
|
+
children: [/* @__PURE__ */ W(Ne, { className: "h-5 w-5" }), /* @__PURE__ */ W("span", { children: "Report" })]
|
|
564
|
+
}) }),
|
|
565
|
+
p
|
|
566
|
+
]
|
|
567
|
+
})
|
|
568
|
+
})]
|
|
569
|
+
});
|
|
570
|
+
}, xt = "flex size-10 flex-shrink-0 items-center justify-center rounded-full bg-white/65 shadow-[0px_4px_8px_0px_rgba(0,0,0,0.06),0px_0px_0px_1px_rgba(0,0,0,0.04)] backdrop-blur-[40px] transition-filter duration-150 hover:brightness-95 aria-expanded:brightness-95 focus-ring", St = "CUSTOMER_PAID", Ct = (e) => typeof e == "string" && e.trim().replace(/[\s-]+/g, "_").toUpperCase() === St, wt = ({ className: e, onBack: t, showBackButton: n, showStarButton: r = !1, onLeaveConversation: i, onBlockParticipant: a, showDeleteConversation: s = !0, showBlockParticipant: c = !0, showReportParticipant: l = !0, onDeleteConversationClick: u, onBlockParticipantClick: d, onReportParticipantClick: f, customChannelActions: p, renderChannelActions: m, showChannelInfo: h = !0, onParticipantNameClick: g }) => {
|
|
571
|
+
let { channel: _ } = V(), { client: v } = me(), y = o.useMemo(() => ot(_.state?.members, v?.userID, _.type), [
|
|
572
|
+
_.state?.members,
|
|
573
|
+
v?.userID,
|
|
574
|
+
_.type
|
|
575
|
+
]), b = ut(y?.user), x = y?.user?.image, S = at(_), C = Ct(_.data?.customer_tag) && y?.is_follower === !0, w = r && S, T = C || w || !!g, E = async () => {
|
|
576
|
+
try {
|
|
577
|
+
S ? await _.unpin() : await _.pin();
|
|
578
|
+
} catch (e) {
|
|
579
|
+
console.error("[ChannelHeaderRedesign] Failed to update pinned status:", e);
|
|
580
|
+
}
|
|
581
|
+
}, D = /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(gt, {
|
|
582
|
+
id: y?.user?.id || _.id || "unknown",
|
|
583
|
+
name: b,
|
|
584
|
+
image: x,
|
|
585
|
+
shape: "circle",
|
|
586
|
+
size: 48,
|
|
587
|
+
className: "-mb-2"
|
|
588
|
+
}), /* @__PURE__ */ W("span", {
|
|
589
|
+
className: Y("relative z-10 flex max-w-full flex-col items-center justify-center rounded-full border border-white/10 bg-white/65 py-1.5 shadow-[0px_0px_0px_0px_rgba(0,0,0,0.04),0px_1px_2px_0px_rgba(0,0,0,0.04),0px_8px_32px_0px_rgba(0,0,0,0.1)] backdrop-blur-[2px] transition-filter duration-150 group-hover:brightness-95", T ? "pl-3 pr-2" : "px-3"),
|
|
590
|
+
children: /* @__PURE__ */ G("span", {
|
|
591
|
+
className: "flex max-w-full items-center justify-center",
|
|
592
|
+
children: [/* @__PURE__ */ W("span", {
|
|
593
|
+
className: "min-w-0 truncate text-sm font-bold leading-[1.43] tracking-[0.28px] text-black/90",
|
|
594
|
+
children: b
|
|
595
|
+
}), T && /* @__PURE__ */ G("span", {
|
|
596
|
+
className: "ml-2 flex gap-1",
|
|
597
|
+
children: [
|
|
598
|
+
C && /* @__PURE__ */ W("span", {
|
|
599
|
+
"aria-label": "Paid customer",
|
|
600
|
+
className: "flex size-4 shrink-0 items-center justify-center rounded-full bg-[#34C759] text-white",
|
|
601
|
+
children: /* @__PURE__ */ W(X, {
|
|
602
|
+
className: "size-2.5",
|
|
603
|
+
weight: "bold"
|
|
604
|
+
})
|
|
605
|
+
}),
|
|
606
|
+
w && /* @__PURE__ */ W("span", {
|
|
607
|
+
className: "messaging-header-star-badge flex overflow-hidden",
|
|
608
|
+
children: /* @__PURE__ */ W("span", {
|
|
609
|
+
"aria-label": "Starred conversation",
|
|
610
|
+
className: "flex size-4 shrink-0 items-center justify-center rounded-full bg-[#FFD60A] text-white",
|
|
611
|
+
children: /* @__PURE__ */ W(Ue, {
|
|
612
|
+
className: "size-2.5",
|
|
613
|
+
weight: "fill"
|
|
614
|
+
})
|
|
615
|
+
})
|
|
616
|
+
}),
|
|
617
|
+
g && /* @__PURE__ */ W(ke, {
|
|
618
|
+
"aria-hidden": "true",
|
|
619
|
+
className: "size-4 shrink-0 text-black/65",
|
|
620
|
+
weight: "bold"
|
|
621
|
+
})
|
|
622
|
+
]
|
|
623
|
+
})]
|
|
624
|
+
})
|
|
625
|
+
})] });
|
|
626
|
+
return /* @__PURE__ */ W("div", {
|
|
627
|
+
className: Y("@container bg-[linear-gradient(180deg,#FBFAF9_0%,rgba(251,250,249,0.92)_58%,rgba(251,250,249,0)_100%)]", e),
|
|
628
|
+
children: /* @__PURE__ */ G("div", {
|
|
629
|
+
className: "grid min-h-[100px] grid-cols-[minmax(40px,1fr)_auto_minmax(40px,1fr)] items-start pb-2 pt-5 @lg:min-h-[104px] @lg:pt-6",
|
|
630
|
+
children: [
|
|
631
|
+
/* @__PURE__ */ W("div", {
|
|
632
|
+
className: "flex items-start",
|
|
633
|
+
children: n && /* @__PURE__ */ W("button", {
|
|
634
|
+
className: Y(xt, "messaging-channel-view-back-button-mobile messaging-channel-view-back-button-desktop"),
|
|
635
|
+
onClick: t || (() => {}),
|
|
636
|
+
type: "button",
|
|
637
|
+
"aria-label": "Back to conversations",
|
|
638
|
+
children: /* @__PURE__ */ W(Ee, { className: "size-5 text-black/90" })
|
|
639
|
+
})
|
|
640
|
+
}),
|
|
641
|
+
/* @__PURE__ */ W("div", {
|
|
642
|
+
className: "flex min-w-0 justify-center",
|
|
643
|
+
"data-dd-privacy": "mask",
|
|
644
|
+
children: g ? /* @__PURE__ */ W("button", {
|
|
645
|
+
type: "button",
|
|
646
|
+
onClick: g,
|
|
647
|
+
"aria-label": `View details for ${b}`,
|
|
648
|
+
className: "group flex min-w-0 max-w-full appearance-none flex-col items-center border-0 bg-transparent px-2 focus-ring focus-visible:outline-none",
|
|
649
|
+
children: D
|
|
650
|
+
}) : /* @__PURE__ */ W("div", {
|
|
651
|
+
className: "flex min-w-0 max-w-full flex-col items-center px-2",
|
|
652
|
+
children: D
|
|
653
|
+
})
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ G("div", {
|
|
656
|
+
className: "flex items-start justify-end gap-2",
|
|
657
|
+
children: [r && /* @__PURE__ */ W("button", {
|
|
658
|
+
className: xt,
|
|
659
|
+
onClick: E,
|
|
660
|
+
type: "button",
|
|
661
|
+
"aria-pressed": S,
|
|
662
|
+
"aria-label": S ? "Unstar conversation" : "Star conversation",
|
|
663
|
+
children: /* @__PURE__ */ W(Ue, {
|
|
664
|
+
className: Y("size-5", {
|
|
665
|
+
"text-[#FFD60A]": S,
|
|
666
|
+
"text-black/90": !S
|
|
667
|
+
}),
|
|
668
|
+
weight: S ? "fill" : "regular"
|
|
669
|
+
})
|
|
670
|
+
}), h && (m === void 0 ? /* @__PURE__ */ W(bt, {
|
|
671
|
+
channel: _,
|
|
672
|
+
participant: y,
|
|
673
|
+
showDeleteConversation: s,
|
|
674
|
+
showBlockParticipant: c,
|
|
675
|
+
showReportParticipant: l,
|
|
676
|
+
onLeaveConversation: i,
|
|
677
|
+
onBlockParticipant: a,
|
|
678
|
+
onDeleteConversationClick: u,
|
|
679
|
+
onBlockParticipantClick: d,
|
|
680
|
+
onReportParticipantClick: f,
|
|
681
|
+
customChannelActions: p,
|
|
682
|
+
triggerClassName: xt
|
|
683
|
+
}) : m)]
|
|
684
|
+
})
|
|
685
|
+
]
|
|
686
|
+
})
|
|
687
|
+
});
|
|
688
|
+
}, Tt = (e) => /* @__PURE__ */ W(T, {
|
|
689
|
+
...e,
|
|
690
|
+
position: "center"
|
|
691
|
+
});
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/utils/getMessageDisplayText.ts
|
|
694
|
+
function Et(e) {
|
|
695
|
+
return e?.trim().toLowerCase().split(/[-_]/)[0] || void 0;
|
|
696
|
+
}
|
|
697
|
+
function Dt({ message: e, viewerLanguage: t }) {
|
|
698
|
+
let n = e?.text, r = Et(t);
|
|
699
|
+
return r ? e?.i18n?.[`${r}_text`] ?? n : n;
|
|
700
|
+
}
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/components/MediaMessage/index.tsx
|
|
703
|
+
function Ot(e) {
|
|
704
|
+
return e.type === "link" || !!e.og_scrape_url?.trim() && !e.asset_url;
|
|
705
|
+
}
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/components/CustomMessage/context.tsx
|
|
708
|
+
var kt = { LockedAttachment: { isUnlocking: () => !1 } }, At = c({}), jt = At.Provider;
|
|
709
|
+
function Mt(e) {
|
|
710
|
+
return u(At)[e] ?? kt[e];
|
|
711
|
+
}
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region src/components/CustomMessage/LockedAttachment/index.tsx
|
|
714
|
+
var Nt = o.lazy(() => import("./Card-C7uLQbYz.js")), Pt = o.lazy(() => import("./Card-f51K6V7Y.js")), Ft = () => /* @__PURE__ */ W("div", {
|
|
715
|
+
className: "w-[280px] min-h-[200px] animate-pulse rounded-md 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)]",
|
|
716
|
+
"aria-hidden": !0
|
|
717
|
+
}), It = (e) => /* @__PURE__ */ W(s, {
|
|
718
|
+
fallback: /* @__PURE__ */ W(Ft, {}),
|
|
719
|
+
children: e.contentType === "text" ? /* @__PURE__ */ W(Nt, { ...e }) : /* @__PURE__ */ W(Pt, { ...e })
|
|
720
|
+
}), Lt = ({ size: e = 15 }) => /* @__PURE__ */ W("svg", {
|
|
721
|
+
width: e,
|
|
722
|
+
height: e,
|
|
723
|
+
viewBox: "0 0 15 15",
|
|
724
|
+
fill: "none",
|
|
725
|
+
"aria-hidden": "true",
|
|
726
|
+
children: /* @__PURE__ */ W("path", {
|
|
727
|
+
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",
|
|
728
|
+
fill: "currentColor",
|
|
729
|
+
fillOpacity: .55
|
|
730
|
+
})
|
|
731
|
+
}), Rt = (e) => e.metadata?.custom_type === K.PAID, zt = (e) => e.metadata?.custom_type === K.CHATBOT, Bt = (e) => e.metadata?.custom_type === K.ATTACHMENT, Vt = (e) => Bt(e) && e.metadata?.attachment_content_type === "text", Ht = (e) => Bt(e) && e.metadata?.attachment_content_type !== "text", Ut = (e) => Rt(e) && !!e.metadata?.amount_text, Wt = ({ message: e, isMyMessage: t = !1, hasAttachment: n = !1 }) => {
|
|
732
|
+
let r = Rt(e), i = zt(e);
|
|
733
|
+
if (!r && !i) return null;
|
|
734
|
+
if (r) {
|
|
735
|
+
let t = e.metadata?.amount_text;
|
|
736
|
+
return t ? /* @__PURE__ */ G("div", {
|
|
737
|
+
className: "message-tag--paid inline-flex items-center gap-1 text-[12px] font-medium leading-[2] text-[#016630]",
|
|
738
|
+
children: [/* @__PURE__ */ W(Pe, { size: 12 }), /* @__PURE__ */ G("span", { children: [
|
|
739
|
+
"Delivered with ",
|
|
740
|
+
t,
|
|
741
|
+
" message"
|
|
742
|
+
] })]
|
|
743
|
+
}) : null;
|
|
744
|
+
}
|
|
745
|
+
let a = t && n, o = a ? "Sent with AI" : "Sent by AI Assistant", s = a ? "justify-end gap-2 text-black/30" : t ? "w-full justify-start gap-1.5 mt-3 px-4 text-white/55" : "w-full justify-start gap-1.5 mt-3 px-4 text-black/30", c = /* @__PURE__ */ W("span", {
|
|
746
|
+
className: "text-left",
|
|
747
|
+
children: o
|
|
748
|
+
}), l = /* @__PURE__ */ W("span", {
|
|
749
|
+
className: "inline-flex items-center leading-none",
|
|
750
|
+
children: /* @__PURE__ */ W(Lt, { size: a ? 12 : 15 })
|
|
751
|
+
});
|
|
752
|
+
return /* @__PURE__ */ W("div", {
|
|
753
|
+
className: `inline-flex items-center text-[10px] font-normal leading-4 tracking-[0.2px] ${s}`,
|
|
754
|
+
"data-testid": "message-chatbot-indicator",
|
|
755
|
+
children: t && !a ? /* @__PURE__ */ G(U, { children: [c, l] }) : /* @__PURE__ */ G(U, { children: [l, c] })
|
|
756
|
+
});
|
|
757
|
+
}, Gt = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='23' fill='none'%3E%3Cpath fill='black' d='M0 0H15C15 10.1934 15.859 15.2345 19.168 21.4893C19.527 22.168 19.039 22.9917 18.274 22.9178C5.176 21.6506 0.32 6.0737 0 0Z'/%3E%3C/svg%3E\") no-repeat center / 100% 100%", Kt = {
|
|
758
|
+
me: "var(--str-chat__own-message-bubble-background-color, #1e2330)",
|
|
759
|
+
other: "var(--str-chat__message-bubble-background-color, #f1f0ee)"
|
|
760
|
+
}, qt = ({ side: e }) => /* @__PURE__ */ W("span", {
|
|
761
|
+
"aria-hidden": "true",
|
|
762
|
+
className: "pointer-events-none absolute bottom-0 z-[-1] h-[1.4375rem] w-5",
|
|
763
|
+
style: {
|
|
764
|
+
insetInlineEnd: e === "me" ? "calc(-1 * 0.3125rem)" : void 0,
|
|
765
|
+
insetInlineStart: e === "other" ? "calc(-1 * 0.3125rem)" : void 0,
|
|
766
|
+
transform: e === "other" ? "scaleX(-1)" : void 0,
|
|
767
|
+
transformOrigin: "center",
|
|
768
|
+
backgroundColor: Kt[e],
|
|
769
|
+
WebkitMask: Gt,
|
|
770
|
+
mask: Gt
|
|
771
|
+
}
|
|
772
|
+
}), Jt = c(void 0), Yt = (e) => {
|
|
773
|
+
let t = e.metadata?.outbound_id;
|
|
774
|
+
return typeof t == "string" ? t : void 0;
|
|
775
|
+
}, Xt = (e, t) => {
|
|
776
|
+
if (!t || !e?.length) return;
|
|
777
|
+
let n = /* @__PURE__ */ new Set(), r;
|
|
778
|
+
for (let i of e) {
|
|
779
|
+
let e = Yt(i);
|
|
780
|
+
if (!e || n.has(e)) continue;
|
|
781
|
+
n.add(e);
|
|
782
|
+
let a = t(e);
|
|
783
|
+
a && (r ??= {}, r[e] = {
|
|
784
|
+
id: a.id,
|
|
785
|
+
...a.name === void 0 ? {} : { name: a.name }
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
return r;
|
|
789
|
+
}, Zt = (e, t) => {
|
|
790
|
+
if (e === t) return !0;
|
|
791
|
+
if (!e || !t) return !1;
|
|
792
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
793
|
+
return n.length === r.length && n.every((n) => e[n].id === t[n]?.id && e[n].name === t[n]?.name);
|
|
794
|
+
}, Qt = (e, t) => {
|
|
795
|
+
let n = Xt(e, t), [r, i] = h(n);
|
|
796
|
+
return Zt(r, n) ? r : (i(n), n);
|
|
797
|
+
}, $t = (e) => e.metadata?.custom_type === K.TIP, en = ({ message: e }) => {
|
|
798
|
+
let t = e.metadata?.amount_text;
|
|
799
|
+
return t ? /* @__PURE__ */ G("div", {
|
|
800
|
+
className: "message-tip-pill inline-flex items-end gap-0.5 max-w-[520px] rounded-[1.5rem] bg-[#43e660] px-4 py-3 text-white",
|
|
801
|
+
children: [/* @__PURE__ */ W("span", {
|
|
802
|
+
className: "flex h-5 items-center text-[20px] leading-none",
|
|
803
|
+
"aria-hidden": "true",
|
|
804
|
+
children: "🎁"
|
|
805
|
+
}), /* @__PURE__ */ G("span", {
|
|
806
|
+
className: "text-[14px] font-bold leading-[1.43] tracking-[0.28px] text-[rgba(4,4,3,0.9)]",
|
|
807
|
+
children: [t, " tip!"]
|
|
808
|
+
})]
|
|
809
|
+
}) : null;
|
|
810
|
+
}, tn = () => {
|
|
811
|
+
let { message: e } = H("SentMessageDeliveryStatus"), { messages: t } = V("SentMessageDeliveryStatus"), n = (() => {
|
|
812
|
+
if (t) for (let e = t.length - 1; e >= 0; --e) {
|
|
813
|
+
let n = t[e];
|
|
814
|
+
if (n.type !== "system" && n.type !== "ephemeral" && n.type !== "deleted") return n.id;
|
|
815
|
+
}
|
|
816
|
+
})();
|
|
817
|
+
return e.id === n;
|
|
818
|
+
}, nn = () => tn() ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(Ae, {
|
|
819
|
+
weight: "bold",
|
|
820
|
+
"aria-hidden": "true"
|
|
821
|
+
}), /* @__PURE__ */ W("span", {
|
|
822
|
+
"data-testid": "sent-message-delivery-status",
|
|
823
|
+
children: "Delivered"
|
|
824
|
+
})] }) : null, rn = () => tn() ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(je, {
|
|
825
|
+
className: "sent-message-status__spinner animate-spin",
|
|
826
|
+
weight: "bold",
|
|
827
|
+
"aria-hidden": "true"
|
|
828
|
+
}), /* @__PURE__ */ W("span", {
|
|
829
|
+
"data-testid": "sent-message-sending-status",
|
|
830
|
+
children: "Sending"
|
|
831
|
+
})] }) : null, an = ({ outbound: e, onOutboundClick: t }) => {
|
|
832
|
+
let n = e.name || "Broadcast", r = /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("span", {
|
|
833
|
+
className: "sent-message-outbound-badge",
|
|
834
|
+
"aria-hidden": "true",
|
|
835
|
+
children: /* @__PURE__ */ W(Fe, { weight: "fill" })
|
|
836
|
+
}), /* @__PURE__ */ W("span", {
|
|
837
|
+
className: Y("sent-message-outbound-name", { "underline [text-decoration-skip-ink:auto]": !!t }),
|
|
838
|
+
"data-testid": "sent-message-outbound-status",
|
|
839
|
+
children: n
|
|
840
|
+
})] });
|
|
841
|
+
return t ? /* @__PURE__ */ W("button", {
|
|
842
|
+
type: "button",
|
|
843
|
+
className: "inline-flex cursor-pointer items-center gap-1 border-0 bg-transparent p-0 text-inherit [font:inherit]",
|
|
844
|
+
"aria-label": `View broadcast ${n}`,
|
|
845
|
+
onClick: () => t(e),
|
|
846
|
+
children: r
|
|
847
|
+
}) : r;
|
|
848
|
+
}, on = () => /* @__PURE__ */ G("span", {
|
|
849
|
+
className: "str-chat__message-status sent-message-status--failed",
|
|
850
|
+
children: [/* @__PURE__ */ W(Ke, {
|
|
851
|
+
weight: "bold",
|
|
852
|
+
"aria-hidden": "true"
|
|
853
|
+
}), /* @__PURE__ */ W("span", {
|
|
854
|
+
"data-testid": "sent-message-failed-status",
|
|
855
|
+
children: "Failed to send"
|
|
856
|
+
})]
|
|
857
|
+
}), sn = ({ onOutboundClick: e, resolvedOutbound: t }) => {
|
|
858
|
+
let { isMyMessage: n, message: r, threadList: i } = H("SentMessageDeliveryStatus"), a = n(), o = tn();
|
|
859
|
+
if (i) return null;
|
|
860
|
+
if (r.status === "failed" && a && r.type !== "error") return /* @__PURE__ */ W(on, {});
|
|
861
|
+
if (!a) return null;
|
|
862
|
+
let s = r.metadata?.outbound_id, c = r.status !== "sending" && r.status !== "failed" && s && t ? /* @__PURE__ */ W(an, {
|
|
863
|
+
outbound: t,
|
|
864
|
+
onOutboundClick: e
|
|
865
|
+
}) : null, l = Ut(r) ? null : /* @__PURE__ */ W(L, {
|
|
866
|
+
MessageSentStatus: nn,
|
|
867
|
+
MessageDeliveredStatus: nn,
|
|
868
|
+
MessageReadStatus: nn,
|
|
869
|
+
MessageSendingStatus: $t(r) ? nn : rn
|
|
870
|
+
});
|
|
871
|
+
return c ? /* @__PURE__ */ G("span", {
|
|
872
|
+
className: "sent-message-status-row",
|
|
873
|
+
children: [
|
|
874
|
+
l,
|
|
875
|
+
l && o && /* @__PURE__ */ W("span", {
|
|
876
|
+
className: "sent-message-outbound-separator",
|
|
877
|
+
"aria-hidden": "true",
|
|
878
|
+
children: "•"
|
|
879
|
+
}),
|
|
880
|
+
c
|
|
881
|
+
]
|
|
882
|
+
}) : l;
|
|
883
|
+
}, cn = /^([a-z][a-z0-9+.-]*):/i, ln = /* @__PURE__ */ new Set([
|
|
884
|
+
"http",
|
|
885
|
+
"https",
|
|
886
|
+
"mailto",
|
|
887
|
+
"tel",
|
|
888
|
+
"sms"
|
|
889
|
+
]);
|
|
890
|
+
function un(e) {
|
|
891
|
+
if (typeof e != "string") return;
|
|
892
|
+
let t = e.trim();
|
|
893
|
+
if (t === "") return;
|
|
894
|
+
let n = cn.exec(t);
|
|
895
|
+
if (n) {
|
|
896
|
+
let e = n[1].toLowerCase();
|
|
897
|
+
return ln.has(e) ? t : void 0;
|
|
898
|
+
}
|
|
899
|
+
return t.startsWith("//") || t.startsWith("/") ? t : `https://${t}`;
|
|
900
|
+
}
|
|
901
|
+
//#endregion
|
|
902
|
+
//#region src/components/LinkAttachment/components/_shared/CardCta.tsx
|
|
903
|
+
var dn = {
|
|
904
|
+
dark: {
|
|
905
|
+
primary: "bg-white text-[#121110] hover:bg-white/90",
|
|
906
|
+
secondary: "bg-white/15 text-white hover:bg-white/25"
|
|
907
|
+
},
|
|
908
|
+
light: {
|
|
909
|
+
primary: "bg-[#121110] text-white hover:bg-[#2a2928]",
|
|
910
|
+
secondary: "bg-black/[0.06] text-[#121110] hover:bg-black/10"
|
|
911
|
+
}
|
|
912
|
+
}, fn = ({ variant: e, cta: t, fullWidth: n = !0, standalone: r = !1 }) => {
|
|
913
|
+
let i = t.variant ?? "primary", a = Y("inline-flex h-10 items-center justify-center rounded-full px-4 text-sm font-medium leading-none transition-colors", n ? "w-full" : "min-w-0", !r && "mt-2", dn[e][i]), o = n ? t.label : /* @__PURE__ */ W("span", {
|
|
914
|
+
className: "min-w-0 truncate",
|
|
915
|
+
children: t.label
|
|
916
|
+
}), s = un(t.href);
|
|
917
|
+
return s ? /* @__PURE__ */ W("a", {
|
|
918
|
+
href: s,
|
|
919
|
+
target: "_blank",
|
|
920
|
+
rel: "noopener noreferrer",
|
|
921
|
+
onClick: (e) => {
|
|
922
|
+
e.stopPropagation(), t.onClick?.();
|
|
923
|
+
},
|
|
924
|
+
className: `${a} no-underline`,
|
|
925
|
+
children: o
|
|
926
|
+
}) : /* @__PURE__ */ W("button", {
|
|
927
|
+
type: "button",
|
|
928
|
+
onClick: (e) => {
|
|
929
|
+
e.stopPropagation(), t.onClick?.();
|
|
930
|
+
},
|
|
931
|
+
className: a,
|
|
932
|
+
children: o
|
|
933
|
+
});
|
|
934
|
+
}, pn = {
|
|
935
|
+
dark: "text-white",
|
|
936
|
+
light: "text-black/90"
|
|
937
|
+
}, mn = "text-white/30", hn = {
|
|
938
|
+
dark: "text-white/55",
|
|
939
|
+
light: "text-black/55"
|
|
940
|
+
}, gn = {
|
|
941
|
+
dark: "bg-white/25",
|
|
942
|
+
light: "bg-black/15"
|
|
943
|
+
}, _n = ({ variant: e, ctaSurface: t, chinTextColor: n, title: r, placeholderTitle: i, description: a, descriptionLines: o = 1, url: s, appIcon: c, cta: l, trailingAction: u, isLoading: d = !1 }) => {
|
|
944
|
+
let f = e === "dark", p = r ?? (f ? i : void 0) ?? "", m = p.trim() !== "", h = a != null && a.trim() !== "", g = typeof s == "string" ? s.trim() : "", _ = g !== "", v = l != null;
|
|
945
|
+
if (!d && !m && !h && !_ && !v) return null;
|
|
946
|
+
let y = Y("line-clamp-2 text-[14px] font-medium leading-5 tracking-[0.28px]", n == null && (f && !r ? mn : pn[e])), b = Y("truncate text-[12px] leading-4 tracking-[0.24px]", n == null && hn[e]), x = Y("text-[12px] leading-4 tracking-[0.24px]", o <= 1 && "truncate", n == null && hn[e]);
|
|
947
|
+
if (d) {
|
|
948
|
+
let t = Y("animate-pulse rounded", gn[e]);
|
|
949
|
+
return /* @__PURE__ */ W("div", {
|
|
950
|
+
className: "shrink-0 px-4 py-3",
|
|
951
|
+
children: /* @__PURE__ */ G("div", {
|
|
952
|
+
className: "flex min-w-0 flex-col gap-[2px]",
|
|
953
|
+
children: [/* @__PURE__ */ W("div", {
|
|
954
|
+
className: Y("h-5 w-3/4", t),
|
|
955
|
+
"aria-hidden": !0
|
|
956
|
+
}), /* @__PURE__ */ W("div", {
|
|
957
|
+
className: Y("h-4 w-1/2", t),
|
|
958
|
+
"aria-hidden": !0
|
|
959
|
+
})]
|
|
960
|
+
})
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
let S = n ? { color: n } : void 0, C = o > 1 ? {
|
|
964
|
+
...S,
|
|
965
|
+
display: "-webkit-box",
|
|
966
|
+
WebkitBoxOrient: "vertical",
|
|
967
|
+
WebkitLineClamp: o,
|
|
968
|
+
overflow: "hidden"
|
|
969
|
+
} : S;
|
|
970
|
+
return /* @__PURE__ */ G("div", {
|
|
971
|
+
className: "shrink-0 px-4 py-3",
|
|
972
|
+
children: [/* @__PURE__ */ G("div", {
|
|
973
|
+
className: "flex items-end gap-3",
|
|
974
|
+
children: [/* @__PURE__ */ G("div", {
|
|
975
|
+
className: "flex min-w-0 flex-1 flex-col gap-[2px]",
|
|
976
|
+
children: [
|
|
977
|
+
m && /* @__PURE__ */ G("div", {
|
|
978
|
+
className: "flex min-w-0 items-center gap-2",
|
|
979
|
+
children: [c ? /* @__PURE__ */ W("span", {
|
|
980
|
+
className: "shrink-0",
|
|
981
|
+
children: c
|
|
982
|
+
}) : null, /* @__PURE__ */ W("p", {
|
|
983
|
+
className: Y("min-w-0", y),
|
|
984
|
+
style: S,
|
|
985
|
+
children: p
|
|
986
|
+
})]
|
|
987
|
+
}),
|
|
988
|
+
h && /* @__PURE__ */ W("p", {
|
|
989
|
+
className: x,
|
|
990
|
+
style: C,
|
|
991
|
+
children: a
|
|
992
|
+
}),
|
|
993
|
+
!v && _ && /* @__PURE__ */ W("p", {
|
|
994
|
+
className: b,
|
|
995
|
+
style: S,
|
|
996
|
+
"data-testid": "link-attachment-url",
|
|
997
|
+
children: g
|
|
998
|
+
})
|
|
999
|
+
]
|
|
1000
|
+
}), u && /* @__PURE__ */ W("div", {
|
|
1001
|
+
className: "shrink-0",
|
|
1002
|
+
children: u
|
|
1003
|
+
})]
|
|
1004
|
+
}), l && /* @__PURE__ */ W(fn, {
|
|
1005
|
+
variant: t ?? e,
|
|
1006
|
+
cta: l
|
|
1007
|
+
})]
|
|
1008
|
+
});
|
|
1009
|
+
}, vn = "Loading link preview", yn = Y("relative w-[var(--lt-msg-card-width,290px)] max-w-full select-none overflow-hidden", "rounded-[20px]"), bn = "flex h-[250px] flex-col", xn = ({ variant: e, children: t, href: n, onClick: r, ariaLabel: i, rootRef: a, topRight: o, bgClassName: s, accentHex: c, fixedHeight: l = !1, busy: u = !1, "data-testid": d }) => {
|
|
1010
|
+
let f = Y("messaging-link-card", yn, l ? bn : "block", s ?? (e === "dark" ? "bg-[#1e2330]" : "bg-[#f1f0ee]"), n != null || r != null ? "cursor-pointer no-underline focus-ring" : null), p = u ? {
|
|
1011
|
+
role: "status",
|
|
1012
|
+
"aria-busy": !0,
|
|
1013
|
+
"aria-label": vn
|
|
1014
|
+
} : void 0, m = c ? { "--accent": c } : void 0, h = o ? /* @__PURE__ */ W("div", {
|
|
1015
|
+
className: "pointer-events-auto absolute right-3 top-3 z-10",
|
|
1016
|
+
children: o
|
|
1017
|
+
}) : null;
|
|
1018
|
+
return n ? /* @__PURE__ */ G("a", {
|
|
1019
|
+
ref: a,
|
|
1020
|
+
href: n,
|
|
1021
|
+
target: "_blank",
|
|
1022
|
+
rel: "noopener noreferrer",
|
|
1023
|
+
onClick: r,
|
|
1024
|
+
"data-testid": d,
|
|
1025
|
+
"data-variant": e,
|
|
1026
|
+
className: f,
|
|
1027
|
+
style: m,
|
|
1028
|
+
...p,
|
|
1029
|
+
children: [t, h]
|
|
1030
|
+
}) : r ? /* @__PURE__ */ G("button", {
|
|
1031
|
+
ref: a,
|
|
1032
|
+
type: "button",
|
|
1033
|
+
onClick: r,
|
|
1034
|
+
"aria-label": i,
|
|
1035
|
+
"data-testid": d,
|
|
1036
|
+
"data-variant": e,
|
|
1037
|
+
className: Y(f, "text-left"),
|
|
1038
|
+
style: m,
|
|
1039
|
+
...p,
|
|
1040
|
+
children: [t, h]
|
|
1041
|
+
}) : /* @__PURE__ */ G("div", {
|
|
1042
|
+
ref: a,
|
|
1043
|
+
"data-testid": d,
|
|
1044
|
+
"data-variant": e,
|
|
1045
|
+
className: f,
|
|
1046
|
+
style: m,
|
|
1047
|
+
...p,
|
|
1048
|
+
children: [t, h]
|
|
1049
|
+
});
|
|
1050
|
+
}, Sn = {
|
|
1051
|
+
dark: "bg-white/10",
|
|
1052
|
+
light: "bg-black/5"
|
|
1053
|
+
}, Cn = {
|
|
1054
|
+
dark: "size-16 text-white/25",
|
|
1055
|
+
light: "size-16 text-black/25"
|
|
1056
|
+
}, wn = (e, n) => !!n && !!e && t(e) === "audio", Tn = (e, n) => {
|
|
1057
|
+
if (!n || !e) return !1;
|
|
1058
|
+
let r = t(e);
|
|
1059
|
+
return r === "video" || r === "audio";
|
|
1060
|
+
}, En = "bg-[#F2F3F4]", Dn = ({ variant: r, thumbnailUrl: i, sourceUrl: o, title: s, mimeType: c = "image/*", topLeft: l, topRight: u, isLoading: d = !1, onImageError: f }) => {
|
|
1061
|
+
let p = t(c), m = !!o && p === "video", h = a(i);
|
|
1062
|
+
return !d && wn(c, o) ? /* @__PURE__ */ W("div", {
|
|
1063
|
+
className: "p-3",
|
|
1064
|
+
children: /* @__PURE__ */ W("audio", {
|
|
1065
|
+
...e,
|
|
1066
|
+
src: o,
|
|
1067
|
+
controls: !0,
|
|
1068
|
+
preload: "metadata",
|
|
1069
|
+
className: "block w-full",
|
|
1070
|
+
children: /* @__PURE__ */ W("track", { kind: "captions" })
|
|
1071
|
+
})
|
|
1072
|
+
}) : /* @__PURE__ */ G("div", {
|
|
1073
|
+
className: Y("relative min-h-0 w-full flex-1 overflow-hidden", m && "bg-black"),
|
|
1074
|
+
children: [
|
|
1075
|
+
d ? /* @__PURE__ */ W("div", {
|
|
1076
|
+
className: Y("h-full w-full animate-pulse", Sn[r]),
|
|
1077
|
+
"aria-hidden": !0
|
|
1078
|
+
}) : m ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("video", {
|
|
1079
|
+
src: o,
|
|
1080
|
+
poster: h,
|
|
1081
|
+
controls: !0,
|
|
1082
|
+
playsInline: !0,
|
|
1083
|
+
preload: "metadata",
|
|
1084
|
+
className: "absolute inset-0 h-full w-full object-contain",
|
|
1085
|
+
children: /* @__PURE__ */ W("track", { kind: "captions" })
|
|
1086
|
+
}), h && f ? /* @__PURE__ */ W("img", {
|
|
1087
|
+
src: h,
|
|
1088
|
+
alt: "",
|
|
1089
|
+
"aria-hidden": !0,
|
|
1090
|
+
onError: f,
|
|
1091
|
+
className: "hidden"
|
|
1092
|
+
}) : null] }) : i ? /* @__PURE__ */ W("img", {
|
|
1093
|
+
src: h ?? i,
|
|
1094
|
+
alt: s ?? "",
|
|
1095
|
+
draggable: !1,
|
|
1096
|
+
loading: "lazy",
|
|
1097
|
+
decoding: "async",
|
|
1098
|
+
onError: f,
|
|
1099
|
+
className: "absolute inset-0 h-full w-full object-cover"
|
|
1100
|
+
}) : /* @__PURE__ */ W("div", {
|
|
1101
|
+
className: Y("flex h-full w-full items-center justify-center", Sn[r]),
|
|
1102
|
+
children: n(c, {
|
|
1103
|
+
className: Cn[r],
|
|
1104
|
+
weight: "regular"
|
|
1105
|
+
})
|
|
1106
|
+
}),
|
|
1107
|
+
l ? /* @__PURE__ */ W("div", {
|
|
1108
|
+
className: "pointer-events-auto absolute left-3 top-3 z-10",
|
|
1109
|
+
children: l
|
|
1110
|
+
}) : null,
|
|
1111
|
+
u ? /* @__PURE__ */ W("div", {
|
|
1112
|
+
className: "pointer-events-auto absolute right-3 top-3 z-10",
|
|
1113
|
+
children: u
|
|
1114
|
+
}) : null
|
|
1115
|
+
]
|
|
1116
|
+
});
|
|
1117
|
+
}, On = /^#?(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
1118
|
+
function kn(e) {
|
|
1119
|
+
let t = e.trim();
|
|
1120
|
+
return t.startsWith("#") ? t : `#${t}`;
|
|
1121
|
+
}
|
|
1122
|
+
//#endregion
|
|
1123
|
+
//#region src/components/LinkAttachment/components/_shared/useChinPalette.ts
|
|
1124
|
+
var An = "#FFFFFF", jn = "#040403", Mn = {
|
|
1125
|
+
dark: An,
|
|
1126
|
+
light: jn
|
|
1127
|
+
};
|
|
1128
|
+
function Nn({ variant: e, accentColor: t, status: n = "ready", layout: r = "featured", thumbnailUrl: i, mimeType: a, sourceUrl: s }) {
|
|
1129
|
+
let [c, l] = o.useState(!1);
|
|
1130
|
+
o.useEffect(() => {
|
|
1131
|
+
l(!1);
|
|
1132
|
+
}, [i]);
|
|
1133
|
+
let u = o.useCallback(() => {
|
|
1134
|
+
l(!0);
|
|
1135
|
+
}, []), d = wn(a, s), f = r === "featured" && i && !d && !c && n === "ready" && t != null && On.test(t.trim()) ? kn(t) : void 0, p = d ? jn : Mn[e];
|
|
1136
|
+
return {
|
|
1137
|
+
thumbnailUrl: c ? void 0 : i,
|
|
1138
|
+
accentHex: f,
|
|
1139
|
+
chinTextColor: p,
|
|
1140
|
+
surface: d ? "light" : e,
|
|
1141
|
+
isLoading: n === "loading",
|
|
1142
|
+
onImageError: u
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region src/components/LinkAttachment/components/Composer/Card.tsx
|
|
1147
|
+
var Pn = "flex size-6 items-center justify-center rounded-full bg-[#121110] text-white focus-ring", Fn = "relative before:absolute before:-inset-[10px] before:content-['']", In = ({ title: e, placeholderTitle: t, description: n, descriptionLines: r, url: i, mimeType: a, thumbnailUrl: o, sourceUrl: s, layout: c = "featured", appIcon: l, cta: u, accentColor: d, status: f = "ready", onDismiss: p, onEditClick: m, dismissLabel: h = "Dismiss attachment" }) => {
|
|
1148
|
+
let g = c === "classic", _ = wn(a, s), v = Nn({
|
|
1149
|
+
variant: "dark",
|
|
1150
|
+
accentColor: d,
|
|
1151
|
+
status: f,
|
|
1152
|
+
layout: c,
|
|
1153
|
+
thumbnailUrl: o,
|
|
1154
|
+
mimeType: a,
|
|
1155
|
+
sourceUrl: s
|
|
1156
|
+
}), y = p ? /* @__PURE__ */ W("button", {
|
|
1157
|
+
type: "button",
|
|
1158
|
+
onClick: p,
|
|
1159
|
+
"aria-label": h,
|
|
1160
|
+
className: Y(Pn, !_ && Fn),
|
|
1161
|
+
children: /* @__PURE__ */ W(qe, {
|
|
1162
|
+
className: "size-3",
|
|
1163
|
+
weight: "bold"
|
|
1164
|
+
})
|
|
1165
|
+
}) : void 0, b = m ? /* @__PURE__ */ W("button", {
|
|
1166
|
+
type: "button",
|
|
1167
|
+
onClick: m,
|
|
1168
|
+
"aria-label": "Edit attachment",
|
|
1169
|
+
className: "flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/15",
|
|
1170
|
+
children: /* @__PURE__ */ W(Ie, {
|
|
1171
|
+
className: "size-5",
|
|
1172
|
+
weight: "regular"
|
|
1173
|
+
})
|
|
1174
|
+
}) : void 0;
|
|
1175
|
+
return _ && !v.isLoading ? /* @__PURE__ */ W(xn, {
|
|
1176
|
+
variant: "dark",
|
|
1177
|
+
bgClassName: En,
|
|
1178
|
+
children: /* @__PURE__ */ G("div", {
|
|
1179
|
+
className: "flex items-center gap-2 pr-3",
|
|
1180
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1181
|
+
className: "min-w-0 flex-1",
|
|
1182
|
+
children: /* @__PURE__ */ W(Dn, {
|
|
1183
|
+
variant: "dark",
|
|
1184
|
+
sourceUrl: s,
|
|
1185
|
+
title: e,
|
|
1186
|
+
mimeType: a
|
|
1187
|
+
})
|
|
1188
|
+
}), y && /* @__PURE__ */ W("div", {
|
|
1189
|
+
className: "shrink-0",
|
|
1190
|
+
children: y
|
|
1191
|
+
})]
|
|
1192
|
+
})
|
|
1193
|
+
}) : /* @__PURE__ */ G(xn, {
|
|
1194
|
+
variant: "dark",
|
|
1195
|
+
fixedHeight: !g,
|
|
1196
|
+
accentHex: v.accentHex,
|
|
1197
|
+
busy: v.isLoading,
|
|
1198
|
+
topRight: g ? y : void 0,
|
|
1199
|
+
children: [!g && /* @__PURE__ */ W(Dn, {
|
|
1200
|
+
variant: "dark",
|
|
1201
|
+
thumbnailUrl: v.thumbnailUrl,
|
|
1202
|
+
sourceUrl: s,
|
|
1203
|
+
title: e,
|
|
1204
|
+
mimeType: a,
|
|
1205
|
+
topRight: y,
|
|
1206
|
+
isLoading: v.isLoading,
|
|
1207
|
+
onImageError: v.onImageError
|
|
1208
|
+
}), /* @__PURE__ */ W(_n, {
|
|
1209
|
+
chinTextColor: v.chinTextColor,
|
|
1210
|
+
variant: "dark",
|
|
1211
|
+
ctaSurface: v.surface,
|
|
1212
|
+
title: e,
|
|
1213
|
+
placeholderTitle: t,
|
|
1214
|
+
description: n,
|
|
1215
|
+
descriptionLines: r,
|
|
1216
|
+
url: i,
|
|
1217
|
+
appIcon: l,
|
|
1218
|
+
cta: u,
|
|
1219
|
+
trailingAction: b,
|
|
1220
|
+
isLoading: v.isLoading
|
|
1221
|
+
})]
|
|
1222
|
+
});
|
|
1223
|
+
}, Ln = ({ accentHex: e, side: t, visible: n, children: r }) => n ? /* @__PURE__ */ G("div", {
|
|
1224
|
+
className: "relative isolate w-fit",
|
|
1225
|
+
children: [r, /* @__PURE__ */ W("span", {
|
|
1226
|
+
"aria-hidden": !0,
|
|
1227
|
+
"data-testid": "link-card-tail",
|
|
1228
|
+
"data-variant": t === "sender" ? "dark" : "light",
|
|
1229
|
+
style: e ? { "--accent": e } : void 0,
|
|
1230
|
+
className: Y("messaging-link-card-tail", t === "receiver" && "messaging-link-card-tail--received")
|
|
1231
|
+
})]
|
|
1232
|
+
}) : /* @__PURE__ */ W(U, { children: r }), Rn = {
|
|
1233
|
+
Composer: In,
|
|
1234
|
+
Sent: ({ title: e, placeholderTitle: t, description: n, descriptionLines: r, url: i, mimeType: a, thumbnailUrl: o, sourceUrl: s, layout: c = "featured", appIcon: l, cta: u, accentColor: d, status: f = "ready", onClick: p, groupPosition: m = "single" }) => {
|
|
1235
|
+
let h = Tn(a, s), g = un(i), _ = u == null && g != null && !h ? g : void 0, v = u == null && !h && _ != null ? p : void 0, y = f !== "loading" && wn(a, s), b = Nn({
|
|
1236
|
+
variant: "dark",
|
|
1237
|
+
accentColor: d,
|
|
1238
|
+
status: f,
|
|
1239
|
+
layout: c,
|
|
1240
|
+
thumbnailUrl: o,
|
|
1241
|
+
mimeType: a,
|
|
1242
|
+
sourceUrl: s
|
|
1243
|
+
});
|
|
1244
|
+
return /* @__PURE__ */ W(Ln, {
|
|
1245
|
+
accentHex: b.accentHex,
|
|
1246
|
+
side: "sender",
|
|
1247
|
+
visible: !y && (m === "single" || m === "end"),
|
|
1248
|
+
children: /* @__PURE__ */ G(xn, {
|
|
1249
|
+
variant: "dark",
|
|
1250
|
+
href: _,
|
|
1251
|
+
onClick: v,
|
|
1252
|
+
fixedHeight: c === "featured" && !y,
|
|
1253
|
+
accentHex: b.accentHex,
|
|
1254
|
+
busy: b.isLoading,
|
|
1255
|
+
bgClassName: y ? En : void 0,
|
|
1256
|
+
children: [c === "featured" && /* @__PURE__ */ W(Dn, {
|
|
1257
|
+
variant: "dark",
|
|
1258
|
+
thumbnailUrl: b.thumbnailUrl,
|
|
1259
|
+
sourceUrl: s,
|
|
1260
|
+
title: e,
|
|
1261
|
+
mimeType: a,
|
|
1262
|
+
isLoading: b.isLoading,
|
|
1263
|
+
onImageError: b.onImageError
|
|
1264
|
+
}), /* @__PURE__ */ W(_n, {
|
|
1265
|
+
chinTextColor: b.chinTextColor,
|
|
1266
|
+
variant: "dark",
|
|
1267
|
+
ctaSurface: b.surface,
|
|
1268
|
+
title: e,
|
|
1269
|
+
placeholderTitle: t,
|
|
1270
|
+
description: n,
|
|
1271
|
+
descriptionLines: r,
|
|
1272
|
+
url: i,
|
|
1273
|
+
appIcon: l,
|
|
1274
|
+
cta: u,
|
|
1275
|
+
isLoading: b.isLoading
|
|
1276
|
+
})]
|
|
1277
|
+
})
|
|
1278
|
+
});
|
|
1279
|
+
},
|
|
1280
|
+
Received: ({ title: e, description: t, descriptionLines: n, url: r, mimeType: i, thumbnailUrl: a, sourceUrl: o, layout: s = "featured", appIcon: c, cta: l, accentColor: u, status: d = "ready", onClick: f, groupPosition: p = "single" }) => {
|
|
1281
|
+
let m = Tn(i, o), h = un(r), g = l == null && h != null && !m ? h : void 0, _ = l == null && !m ? f : void 0, v = d !== "loading" && wn(i, o) ? En : void 0, y = l && f ? {
|
|
1282
|
+
...l,
|
|
1283
|
+
onClick: () => {
|
|
1284
|
+
f(), l.onClick?.();
|
|
1285
|
+
}
|
|
1286
|
+
} : l, b = Nn({
|
|
1287
|
+
variant: "light",
|
|
1288
|
+
accentColor: u,
|
|
1289
|
+
status: d,
|
|
1290
|
+
layout: s,
|
|
1291
|
+
thumbnailUrl: a,
|
|
1292
|
+
mimeType: i,
|
|
1293
|
+
sourceUrl: o
|
|
1294
|
+
});
|
|
1295
|
+
return /* @__PURE__ */ W(Ln, {
|
|
1296
|
+
accentHex: b.accentHex,
|
|
1297
|
+
side: "receiver",
|
|
1298
|
+
visible: v == null && (p === "single" || p === "end"),
|
|
1299
|
+
children: /* @__PURE__ */ G(xn, {
|
|
1300
|
+
variant: "light",
|
|
1301
|
+
href: g,
|
|
1302
|
+
onClick: _,
|
|
1303
|
+
ariaLabel: e ?? "Open attachment preview",
|
|
1304
|
+
fixedHeight: s === "featured" && v == null,
|
|
1305
|
+
accentHex: b.accentHex,
|
|
1306
|
+
busy: b.isLoading,
|
|
1307
|
+
bgClassName: v,
|
|
1308
|
+
"data-testid": "link-attachment",
|
|
1309
|
+
children: [s === "featured" && /* @__PURE__ */ W(Dn, {
|
|
1310
|
+
variant: "light",
|
|
1311
|
+
thumbnailUrl: b.thumbnailUrl,
|
|
1312
|
+
sourceUrl: o,
|
|
1313
|
+
title: e,
|
|
1314
|
+
mimeType: i,
|
|
1315
|
+
isLoading: b.isLoading,
|
|
1316
|
+
onImageError: b.onImageError
|
|
1317
|
+
}), /* @__PURE__ */ W(_n, {
|
|
1318
|
+
chinTextColor: b.chinTextColor,
|
|
1319
|
+
variant: "light",
|
|
1320
|
+
ctaSurface: b.surface,
|
|
1321
|
+
title: e,
|
|
1322
|
+
description: t,
|
|
1323
|
+
descriptionLines: n,
|
|
1324
|
+
url: r,
|
|
1325
|
+
appIcon: c,
|
|
1326
|
+
cta: y,
|
|
1327
|
+
isLoading: b.isLoading
|
|
1328
|
+
})]
|
|
1329
|
+
})
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
}, zn = {
|
|
1333
|
+
dark: "bg-[#1e2330]",
|
|
1334
|
+
light: "bg-[#f2f1ef]"
|
|
1335
|
+
}, Bn = {
|
|
1336
|
+
dark: "text-white",
|
|
1337
|
+
light: "text-[#000000]"
|
|
1338
|
+
}, Vn = {
|
|
1339
|
+
dark: "border-white/[0.08]",
|
|
1340
|
+
light: "border-black/[0.08]"
|
|
1341
|
+
}, Hn = (e) => e === "dark" ? "sender" : "receiver", Un = {
|
|
1342
|
+
sender: {
|
|
1343
|
+
single: "rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[18px]",
|
|
1344
|
+
first: "rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[4px]",
|
|
1345
|
+
middle: "rounded-tl-[18px] rounded-tr-[4px] rounded-bl-[18px] rounded-br-[4px]",
|
|
1346
|
+
end: "rounded-tl-[18px] rounded-tr-[4px] rounded-bl-[18px] rounded-br-[18px]"
|
|
1347
|
+
},
|
|
1348
|
+
receiver: {
|
|
1349
|
+
single: "rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[18px]",
|
|
1350
|
+
first: "rounded-tl-[18px] rounded-tr-[18px] rounded-bl-[4px] rounded-br-[18px]",
|
|
1351
|
+
middle: "rounded-tl-[4px] rounded-tr-[18px] rounded-bl-[4px] rounded-br-[18px]",
|
|
1352
|
+
end: "rounded-tl-[4px] rounded-tr-[18px] rounded-bl-[18px] rounded-br-[18px]"
|
|
1353
|
+
}
|
|
1354
|
+
}, Wn = ({ variant: e, text: t, bordered: n = !0, groupPosition: r = "single", widthClassName: i = "w-[280px]", paddingClassName: a = "px-2 py-2", radiusClassName: o, className: s, children: c, "data-testid": l }) => {
|
|
1355
|
+
let u = t != null && t !== "", d = o ?? Un[Hn(e)][r];
|
|
1356
|
+
return /* @__PURE__ */ G("div", {
|
|
1357
|
+
"data-testid": l,
|
|
1358
|
+
"data-group-position": r,
|
|
1359
|
+
className: Y("relative", i, "overflow-hidden", a, u && "pb-0", d, zn[e], Bn[e], n && "border", n && Vn[e], s),
|
|
1360
|
+
children: [c, u ? /* @__PURE__ */ W("p", {
|
|
1361
|
+
className: Y("whitespace-pre-wrap break-words leading-snug hyphens-manual", "pb-2 pt-2", "px-2"),
|
|
1362
|
+
children: t
|
|
1363
|
+
}) : null]
|
|
1364
|
+
});
|
|
1365
|
+
}, Gn = ({ onClick: e, variant: t = "overlay", ariaLabel: n = "Dismiss attachment" }) => /* @__PURE__ */ W("button", {
|
|
1366
|
+
type: "button",
|
|
1367
|
+
onClick: (t) => {
|
|
1368
|
+
t.stopPropagation(), e();
|
|
1369
|
+
},
|
|
1370
|
+
"aria-label": n,
|
|
1371
|
+
className: Y("flex size-6 items-center justify-center rounded-full text-white", t === "overlay" ? "bg-[#121110]/85 backdrop-blur" : "bg-white/15 hover:bg-white/25"),
|
|
1372
|
+
children: /* @__PURE__ */ W(qe, {
|
|
1373
|
+
className: "size-3",
|
|
1374
|
+
weight: "bold"
|
|
1375
|
+
})
|
|
1376
|
+
}), Kn = (e) => e === "received" ? "light" : "dark", qn = ({ firstOfGroup: e, endOfGroup: t, groupedByUser: n }) => !n || e && t ? "single" : e ? "first" : t ? "end" : "middle", Jn = ({ src: e, mimeType: t, filename: n, items: r }) => r && r.length > 0 ? r : e ? [{
|
|
1377
|
+
src: e,
|
|
1378
|
+
mimeType: t,
|
|
1379
|
+
filename: n
|
|
1380
|
+
}] : [], Yn = ({ item: t, preload: n, trailingAction: r }) => /* @__PURE__ */ G("div", {
|
|
1381
|
+
className: "flex items-center gap-2",
|
|
1382
|
+
children: [/* @__PURE__ */ W("audio", {
|
|
1383
|
+
...e,
|
|
1384
|
+
src: t.src,
|
|
1385
|
+
controls: !0,
|
|
1386
|
+
preload: t.preload ?? n,
|
|
1387
|
+
className: "block min-w-0 flex-1",
|
|
1388
|
+
children: t.mimeType ? /* @__PURE__ */ W("source", {
|
|
1389
|
+
src: t.src,
|
|
1390
|
+
type: t.mimeType
|
|
1391
|
+
}) : null
|
|
1392
|
+
}), r ?? null]
|
|
1393
|
+
}), Xn = ({ state: e, src: t, mimeType: n, filename: r, items: i, text: a, groupPosition: o, preload: s, onDismiss: c }) => {
|
|
1394
|
+
let l = Kn(e), u = e === "composer" && !!c, d = Jn({
|
|
1395
|
+
src: t,
|
|
1396
|
+
mimeType: n,
|
|
1397
|
+
filename: r,
|
|
1398
|
+
items: i
|
|
1399
|
+
});
|
|
1400
|
+
if (d.length === 0) return null;
|
|
1401
|
+
let f = s ?? (d.length > 1 ? "none" : "metadata");
|
|
1402
|
+
return /* @__PURE__ */ W(Wn, {
|
|
1403
|
+
variant: l,
|
|
1404
|
+
text: a,
|
|
1405
|
+
groupPosition: o,
|
|
1406
|
+
"data-testid": "audio-attachment",
|
|
1407
|
+
children: /* @__PURE__ */ W("div", {
|
|
1408
|
+
className: "flex flex-col gap-2",
|
|
1409
|
+
children: d.map((e, t) => /* @__PURE__ */ W(Yn, {
|
|
1410
|
+
item: e,
|
|
1411
|
+
preload: f,
|
|
1412
|
+
trailingAction: u && t === 0 ? /* @__PURE__ */ W(Gn, {
|
|
1413
|
+
onClick: c,
|
|
1414
|
+
variant: "inline"
|
|
1415
|
+
}) : void 0
|
|
1416
|
+
}, `${e.src}-${t}`))
|
|
1417
|
+
})
|
|
1418
|
+
});
|
|
1419
|
+
}, Zn = {
|
|
1420
|
+
Composer: (e) => /* @__PURE__ */ W(Xn, {
|
|
1421
|
+
...e,
|
|
1422
|
+
state: "composer"
|
|
1423
|
+
}),
|
|
1424
|
+
Sent: (e) => /* @__PURE__ */ W(Xn, {
|
|
1425
|
+
...e,
|
|
1426
|
+
state: "sent"
|
|
1427
|
+
}),
|
|
1428
|
+
Received: (e) => /* @__PURE__ */ W(Xn, {
|
|
1429
|
+
...e,
|
|
1430
|
+
state: "received"
|
|
1431
|
+
})
|
|
1432
|
+
};
|
|
1433
|
+
//#endregion
|
|
1434
|
+
//#region src/components/MessageAttachment/_shared/fileMeta.ts
|
|
1435
|
+
function Qn(e) {
|
|
1436
|
+
return !Number.isFinite(e) || e < 0 ? "" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : e < 1073741824 ? `${(e / 1048576).toFixed(2)} MB` : `${(e / 1073741824).toFixed(2)} GB`;
|
|
1437
|
+
}
|
|
1438
|
+
var $n = {
|
|
1439
|
+
pdf: "PDF",
|
|
1440
|
+
doc: "DOC",
|
|
1441
|
+
xls: "XLS",
|
|
1442
|
+
csv: "CSV",
|
|
1443
|
+
ppt: "PPT",
|
|
1444
|
+
zip: "ZIP",
|
|
1445
|
+
text: "TXT",
|
|
1446
|
+
markdown: "MD"
|
|
1447
|
+
};
|
|
1448
|
+
function er(e, n) {
|
|
1449
|
+
if (n) {
|
|
1450
|
+
let e = n.lastIndexOf(".");
|
|
1451
|
+
if (e > 0 && e < n.length - 1) {
|
|
1452
|
+
let t = n.slice(e + 1);
|
|
1453
|
+
if (t && t.length <= 5) return t.toUpperCase();
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
if (!e) return;
|
|
1457
|
+
if (t(e) === "document") {
|
|
1458
|
+
let t = $n[i(e)];
|
|
1459
|
+
if (t) return t;
|
|
1460
|
+
if (e === "application/octet-stream") return;
|
|
1461
|
+
}
|
|
1462
|
+
let r = e.split("/")[1];
|
|
1463
|
+
if (!(!r || r === "*")) return r.toUpperCase();
|
|
1464
|
+
}
|
|
1465
|
+
function tr(e, t, n) {
|
|
1466
|
+
return [er(e, t), typeof n == "number" && n > 0 ? Qn(n) : void 0].filter(Boolean).join(" · ") || void 0;
|
|
1467
|
+
}
|
|
1468
|
+
function Q(e) {
|
|
1469
|
+
try {
|
|
1470
|
+
let t = new URL(e).pathname.split("/").pop();
|
|
1471
|
+
return t && t.length > 0 ? decodeURIComponent(t) : "download";
|
|
1472
|
+
} catch {
|
|
1473
|
+
return "download";
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
//#endregion
|
|
1477
|
+
//#region src/components/MessageAttachment/_shared/CompactDocumentRow.tsx
|
|
1478
|
+
var nr = {
|
|
1479
|
+
dark: "text-white/55",
|
|
1480
|
+
light: "text-black/65"
|
|
1481
|
+
}, rr = {
|
|
1482
|
+
dark: "bg-white/10",
|
|
1483
|
+
light: "bg-black/5"
|
|
1484
|
+
}, ir = {
|
|
1485
|
+
dark: "text-white/85",
|
|
1486
|
+
light: "text-black/85"
|
|
1487
|
+
}, ar = ({ variant: e, filename: t, title: r, mimeType: i = "application/octet-stream", fileSize: a, onActivate: o, activateLabel: s, trailingAction: c }) => {
|
|
1488
|
+
let l = r ?? t ?? "File", u = tr(i, t, a), d = /* @__PURE__ */ W("div", {
|
|
1489
|
+
className: Y("flex size-10 shrink-0 items-center justify-center rounded-sm", rr[e]),
|
|
1490
|
+
"aria-hidden": !0,
|
|
1491
|
+
children: n(i, {
|
|
1492
|
+
className: Y("size-6", ir[e]),
|
|
1493
|
+
weight: "regular"
|
|
1494
|
+
})
|
|
1495
|
+
}), f = /* @__PURE__ */ G("div", {
|
|
1496
|
+
className: "flex min-w-0 flex-1 flex-col text-left",
|
|
1497
|
+
children: [/* @__PURE__ */ W("p", {
|
|
1498
|
+
className: "truncate font-medium leading-snug",
|
|
1499
|
+
children: l
|
|
1500
|
+
}), u ? /* @__PURE__ */ W("p", {
|
|
1501
|
+
className: Y("truncate text-xs leading-4", nr[e]),
|
|
1502
|
+
children: u
|
|
1503
|
+
}) : null]
|
|
1504
|
+
}), p = o ? /* @__PURE__ */ G("button", {
|
|
1505
|
+
type: "button",
|
|
1506
|
+
onClick: o,
|
|
1507
|
+
"aria-label": s,
|
|
1508
|
+
className: Y("flex min-w-0 flex-1 items-center gap-3 rounded-sm text-left transition-colors", e === "dark" ? "hover:bg-white/[0.04]" : "hover:bg-black/[0.04]"),
|
|
1509
|
+
children: [d, f]
|
|
1510
|
+
}) : /* @__PURE__ */ G(U, { children: [d, f] });
|
|
1511
|
+
return /* @__PURE__ */ G("div", {
|
|
1512
|
+
className: "flex items-center gap-3 px-3 py-2",
|
|
1513
|
+
children: [p, c ? /* @__PURE__ */ W("div", {
|
|
1514
|
+
className: "shrink-0",
|
|
1515
|
+
children: c
|
|
1516
|
+
}) : null]
|
|
1517
|
+
});
|
|
1518
|
+
};
|
|
1519
|
+
//#endregion
|
|
1520
|
+
//#region src/components/MessageAttachment/_shared/triggerDownload.ts
|
|
1521
|
+
async function or(e, t) {
|
|
1522
|
+
let n = t ?? Q(e);
|
|
1523
|
+
try {
|
|
1524
|
+
let t = await fetch(e, { mode: "cors" });
|
|
1525
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
1526
|
+
let r = await t.blob(), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
1527
|
+
a.href = i, a.download = n, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
1528
|
+
} catch {
|
|
1529
|
+
if (!window.open(e, "_blank", "noopener,noreferrer")) {
|
|
1530
|
+
let t = document.createElement("a");
|
|
1531
|
+
t.href = e, t.download = n, t.target = "_blank", t.rel = "noopener noreferrer", t.style.display = "none", document.body.appendChild(t), t.click(), document.body.removeChild(t);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
//#endregion
|
|
1536
|
+
//#region src/components/MessageAttachment/File/index.tsx
|
|
1537
|
+
var sr = ({ src: e, filename: t, fileSize: n, mimeType: r, title: i, items: a }) => a && a.length > 0 ? a : e ? [{
|
|
1538
|
+
src: e,
|
|
1539
|
+
filename: t,
|
|
1540
|
+
fileSize: n,
|
|
1541
|
+
mimeType: r,
|
|
1542
|
+
title: i
|
|
1543
|
+
}] : [], cr = ({ variant: e, item: t, index: n, onActivate: r, trailingAction: i }) => {
|
|
1544
|
+
let a = t.filename ?? Q(t.src);
|
|
1545
|
+
return /* @__PURE__ */ W(ar, {
|
|
1546
|
+
variant: e,
|
|
1547
|
+
filename: a,
|
|
1548
|
+
title: t.title,
|
|
1549
|
+
mimeType: t.mimeType ?? "application/octet-stream",
|
|
1550
|
+
fileSize: t.fileSize,
|
|
1551
|
+
onActivate: () => r(n),
|
|
1552
|
+
activateLabel: `Download ${a}`,
|
|
1553
|
+
trailingAction: i
|
|
1554
|
+
});
|
|
1555
|
+
}, lr = ({ state: e, src: t, filename: n, fileSize: r, mimeType: i, title: a, items: o, text: s, groupPosition: c, onClick: l, onDismiss: u }) => {
|
|
1556
|
+
let d = Kn(e), f = e === "composer" && !!u, p = sr({
|
|
1557
|
+
src: t,
|
|
1558
|
+
filename: n,
|
|
1559
|
+
fileSize: r,
|
|
1560
|
+
mimeType: i,
|
|
1561
|
+
title: a,
|
|
1562
|
+
items: o
|
|
1563
|
+
}), m = (e) => {
|
|
1564
|
+
if (l?.(e) === !1) return;
|
|
1565
|
+
let t = p[e];
|
|
1566
|
+
if (!t) return;
|
|
1567
|
+
let n = t.filename ?? Q(t.src);
|
|
1568
|
+
or(t.src, n);
|
|
1569
|
+
};
|
|
1570
|
+
if (p.length === 0) return null;
|
|
1571
|
+
let h = /* @__PURE__ */ W("span", {
|
|
1572
|
+
className: Y("flex size-8 items-center justify-center rounded-full", d === "dark" ? "text-white/70" : "text-black/70"),
|
|
1573
|
+
"aria-hidden": !0,
|
|
1574
|
+
children: /* @__PURE__ */ W(Me, {
|
|
1575
|
+
className: "size-5",
|
|
1576
|
+
weight: "bold"
|
|
1577
|
+
})
|
|
1578
|
+
});
|
|
1579
|
+
return /* @__PURE__ */ W(Wn, {
|
|
1580
|
+
variant: d,
|
|
1581
|
+
text: s,
|
|
1582
|
+
groupPosition: c,
|
|
1583
|
+
"data-testid": "file-attachment",
|
|
1584
|
+
children: /* @__PURE__ */ W("div", {
|
|
1585
|
+
className: "flex flex-col gap-2",
|
|
1586
|
+
children: p.map((e, t) => /* @__PURE__ */ W(cr, {
|
|
1587
|
+
variant: d,
|
|
1588
|
+
item: e,
|
|
1589
|
+
index: t,
|
|
1590
|
+
onActivate: m,
|
|
1591
|
+
trailingAction: f && t === 0 ? /* @__PURE__ */ W(Gn, {
|
|
1592
|
+
onClick: u,
|
|
1593
|
+
variant: "inline"
|
|
1594
|
+
}) : h
|
|
1595
|
+
}, `${e.src}-${t}`))
|
|
1596
|
+
})
|
|
1597
|
+
});
|
|
1598
|
+
}, ur = {
|
|
1599
|
+
Composer: (e) => /* @__PURE__ */ W(lr, {
|
|
1600
|
+
...e,
|
|
1601
|
+
state: "composer"
|
|
1602
|
+
}),
|
|
1603
|
+
Sent: (e) => /* @__PURE__ */ W(lr, {
|
|
1604
|
+
...e,
|
|
1605
|
+
state: "sent"
|
|
1606
|
+
}),
|
|
1607
|
+
Received: (e) => /* @__PURE__ */ W(lr, {
|
|
1608
|
+
...e,
|
|
1609
|
+
state: "received"
|
|
1610
|
+
})
|
|
1611
|
+
}, dr = "inline-flex size-10 items-center justify-center rounded-full border-0 bg-white/[0.12] p-0 text-white transition-colors duration-150 ease-[ease] hover:bg-white/[0.22] focus-visible:bg-white/[0.22] focus-visible:outline-none disabled:cursor-default disabled:opacity-40", fr = "absolute top-1/2 z-[1] inline-flex size-12 -translate-y-1/2 items-center justify-center rounded-full border-0 bg-white/[0.12] p-0 text-white transition-colors duration-150 ease-[ease] hover:bg-white/[0.22] focus-visible:bg-white/[0.22] focus-visible:outline-none", pr = ({ onPrev: e, onNext: t, prevLabel: n = "Previous", nextLabel: r = "Next" }) => /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("button", {
|
|
1612
|
+
type: "button",
|
|
1613
|
+
onClick: e,
|
|
1614
|
+
"aria-label": n,
|
|
1615
|
+
className: `${fr} left-4`,
|
|
1616
|
+
children: /* @__PURE__ */ W(Oe, {
|
|
1617
|
+
size: 20,
|
|
1618
|
+
weight: "bold",
|
|
1619
|
+
"aria-hidden": !0
|
|
1620
|
+
})
|
|
1621
|
+
}), /* @__PURE__ */ W("button", {
|
|
1622
|
+
type: "button",
|
|
1623
|
+
onClick: t,
|
|
1624
|
+
"aria-label": r,
|
|
1625
|
+
className: `${fr} right-4`,
|
|
1626
|
+
children: /* @__PURE__ */ W(ke, {
|
|
1627
|
+
size: 20,
|
|
1628
|
+
weight: "bold",
|
|
1629
|
+
"aria-hidden": !0
|
|
1630
|
+
})
|
|
1631
|
+
})] }), mr = ({ url: e, filename: t, variant: n = "pill", label: r = "Download", iconOnly: i, tone: a = "dark", onTriggered: o }) => {
|
|
1632
|
+
let [s, c] = h(!1), u = l((n) => {
|
|
1633
|
+
n.stopPropagation(), !s && (c(!0), or(e, t).catch(() => {}).finally(() => {
|
|
1634
|
+
c(!1), o?.();
|
|
1635
|
+
}));
|
|
1636
|
+
}, [
|
|
1637
|
+
s,
|
|
1638
|
+
e,
|
|
1639
|
+
t,
|
|
1640
|
+
o
|
|
1641
|
+
]), d = i ?? n !== "pill", f = {
|
|
1642
|
+
className: Y(n === "pill" ? "size-4" : "size-5", "shrink-0"),
|
|
1643
|
+
weight: "bold"
|
|
1644
|
+
};
|
|
1645
|
+
return n === "inline" ? /* @__PURE__ */ W("button", {
|
|
1646
|
+
type: "button",
|
|
1647
|
+
onClick: u,
|
|
1648
|
+
disabled: s,
|
|
1649
|
+
"aria-label": r,
|
|
1650
|
+
className: Y("flex size-8 shrink-0 items-center justify-center rounded-full transition-colors disabled:opacity-70", {
|
|
1651
|
+
dark: "text-white/70 hover:bg-white/[0.08] hover:text-white",
|
|
1652
|
+
light: "text-black/70 hover:bg-black/[0.08] hover:text-black"
|
|
1653
|
+
}[a]),
|
|
1654
|
+
children: s ? /* @__PURE__ */ W(je, {
|
|
1655
|
+
className: "size-4 animate-spin",
|
|
1656
|
+
weight: "bold",
|
|
1657
|
+
"aria-hidden": !0
|
|
1658
|
+
}) : /* @__PURE__ */ W(Me, {
|
|
1659
|
+
className: "size-5 shrink-0",
|
|
1660
|
+
weight: "bold",
|
|
1661
|
+
"aria-hidden": !0
|
|
1662
|
+
})
|
|
1663
|
+
}) : n === "viewer" ? /* @__PURE__ */ W("button", {
|
|
1664
|
+
type: "button",
|
|
1665
|
+
onClick: u,
|
|
1666
|
+
disabled: s,
|
|
1667
|
+
"aria-label": r,
|
|
1668
|
+
className: dr,
|
|
1669
|
+
children: W(s ? je : Me, {
|
|
1670
|
+
size: 20,
|
|
1671
|
+
weight: "bold",
|
|
1672
|
+
"aria-hidden": !0
|
|
1673
|
+
})
|
|
1674
|
+
}) : /* @__PURE__ */ G("button", {
|
|
1675
|
+
type: "button",
|
|
1676
|
+
onClick: u,
|
|
1677
|
+
disabled: s,
|
|
1678
|
+
"aria-label": d ? r : void 0,
|
|
1679
|
+
className: Y("mt-3 inline-flex h-10 w-full items-center justify-center gap-2 rounded-full px-4 text-sm font-medium leading-none transition-colors disabled:opacity-70", a === "dark" ? "bg-[#121110] text-white hover:bg-[#2a2928]" : "bg-white text-[#121110] hover:bg-white/90"),
|
|
1680
|
+
children: [s ? /* @__PURE__ */ W(je, {
|
|
1681
|
+
className: "size-4 animate-spin",
|
|
1682
|
+
weight: "bold",
|
|
1683
|
+
"aria-hidden": !0
|
|
1684
|
+
}) : /* @__PURE__ */ W(Me, {
|
|
1685
|
+
...f,
|
|
1686
|
+
"aria-hidden": !0
|
|
1687
|
+
}), d ? null : r]
|
|
1688
|
+
});
|
|
1689
|
+
}, hr = (e, t, n) => Math.min(Math.max(e, t), n), gr = ({ length: e, initialIndex: t, open: n }) => {
|
|
1690
|
+
let r = hr(t, 0, Math.max(e - 1, 0)), [i, a] = h(r);
|
|
1691
|
+
d(() => {
|
|
1692
|
+
n && a(hr(t, 0, Math.max(e - 1, 0)));
|
|
1693
|
+
}, [
|
|
1694
|
+
n,
|
|
1695
|
+
t,
|
|
1696
|
+
e
|
|
1697
|
+
]), d(() => {
|
|
1698
|
+
a((t) => hr(t, 0, Math.max(e - 1, 0)));
|
|
1699
|
+
}, [e]);
|
|
1700
|
+
let o = l(() => {
|
|
1701
|
+
e <= 1 || a((t) => t <= 0 ? e - 1 : t - 1);
|
|
1702
|
+
}, [e]), s = l(() => {
|
|
1703
|
+
e <= 1 || a((t) => t >= e - 1 ? 0 : t + 1);
|
|
1704
|
+
}, [e]);
|
|
1705
|
+
return d(() => {
|
|
1706
|
+
if (!n || e <= 1) return;
|
|
1707
|
+
let t = (e) => {
|
|
1708
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
1709
|
+
let t = document.activeElement;
|
|
1710
|
+
t && (t.tagName === "VIDEO" || t.tagName === "AUDIO") || (e.preventDefault(), e.key === "ArrowLeft" ? o() : s());
|
|
1711
|
+
};
|
|
1712
|
+
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1713
|
+
}, [
|
|
1714
|
+
n,
|
|
1715
|
+
e,
|
|
1716
|
+
o,
|
|
1717
|
+
s
|
|
1718
|
+
]), {
|
|
1719
|
+
index: i,
|
|
1720
|
+
prev: o,
|
|
1721
|
+
next: s
|
|
1722
|
+
};
|
|
1723
|
+
}, _r = ({ open: e, onClose: t, ariaLabel: n, counter: r, actions: i, children: a, "data-testid": o }) => {
|
|
1724
|
+
let s = m(null), c = m(null);
|
|
1725
|
+
return d(() => {
|
|
1726
|
+
let t = s.current;
|
|
1727
|
+
if (t) {
|
|
1728
|
+
if (e) {
|
|
1729
|
+
if (!t.open) {
|
|
1730
|
+
if (typeof t.showModal == "function") try {
|
|
1731
|
+
t.showModal();
|
|
1732
|
+
} catch {
|
|
1733
|
+
t.setAttribute("open", "");
|
|
1734
|
+
}
|
|
1735
|
+
else t.setAttribute("open", "");
|
|
1736
|
+
}
|
|
1737
|
+
let e = typeof document < "u" ? document.activeElement : null;
|
|
1738
|
+
return c.current?.focus(), () => {
|
|
1739
|
+
if (t.open) {
|
|
1740
|
+
if (typeof t.close == "function") try {
|
|
1741
|
+
t.close();
|
|
1742
|
+
} catch {
|
|
1743
|
+
t.removeAttribute("open");
|
|
1744
|
+
}
|
|
1745
|
+
else t.removeAttribute("open");
|
|
1746
|
+
}
|
|
1747
|
+
e && document.body.contains(e) && e.focus();
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
if (t.open) {
|
|
1751
|
+
if (typeof t.close == "function") try {
|
|
1752
|
+
t.close();
|
|
1753
|
+
} catch {
|
|
1754
|
+
t.removeAttribute("open");
|
|
1755
|
+
}
|
|
1756
|
+
else t.removeAttribute("open");
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}, [e]), /* @__PURE__ */ G("dialog", {
|
|
1760
|
+
ref: s,
|
|
1761
|
+
className: "mes-media-viewer",
|
|
1762
|
+
"aria-label": n ?? "Attachment viewer",
|
|
1763
|
+
"data-testid": o,
|
|
1764
|
+
onClose: () => {
|
|
1765
|
+
t();
|
|
1766
|
+
},
|
|
1767
|
+
onClick: (e) => {
|
|
1768
|
+
e.target === s.current && t();
|
|
1769
|
+
},
|
|
1770
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1771
|
+
className: "pointer-events-none absolute inset-x-3 top-3 z-[1] flex items-center justify-between gap-3",
|
|
1772
|
+
children: [r ? /* @__PURE__ */ W("span", {
|
|
1773
|
+
className: "pointer-events-auto inline-flex items-center rounded-full bg-white/[0.12] px-3 py-1.5 text-[13px] font-medium leading-none tabular-nums text-white",
|
|
1774
|
+
children: r
|
|
1775
|
+
}) : null, /* @__PURE__ */ G("div", {
|
|
1776
|
+
className: "pointer-events-auto ml-auto inline-flex items-center gap-2",
|
|
1777
|
+
children: [i, /* @__PURE__ */ W("button", {
|
|
1778
|
+
ref: c,
|
|
1779
|
+
type: "button",
|
|
1780
|
+
onClick: t,
|
|
1781
|
+
"aria-label": "Close viewer",
|
|
1782
|
+
className: dr,
|
|
1783
|
+
children: /* @__PURE__ */ W(qe, {
|
|
1784
|
+
size: 20,
|
|
1785
|
+
weight: "bold",
|
|
1786
|
+
"aria-hidden": !0
|
|
1787
|
+
})
|
|
1788
|
+
})]
|
|
1789
|
+
})]
|
|
1790
|
+
}), /* @__PURE__ */ W("div", {
|
|
1791
|
+
className: "box-border flex h-full w-full items-center justify-center px-6 py-16",
|
|
1792
|
+
children: a
|
|
1793
|
+
})]
|
|
1794
|
+
});
|
|
1795
|
+
}, vr = ({ open: e, items: t, initialIndex: n = 0, onClose: r }) => {
|
|
1796
|
+
let { index: i, prev: a, next: o } = gr({
|
|
1797
|
+
length: t.length,
|
|
1798
|
+
initialIndex: n,
|
|
1799
|
+
open: e
|
|
1800
|
+
}), s = t[i], c = p(() => s?.filename ?? (s ? Q(s.src) : "image"), [s]);
|
|
1801
|
+
return s ? /* @__PURE__ */ G(_r, {
|
|
1802
|
+
open: e,
|
|
1803
|
+
onClose: r,
|
|
1804
|
+
ariaLabel: c,
|
|
1805
|
+
counter: t.length > 1 ? `${i + 1} / ${t.length}` : void 0,
|
|
1806
|
+
actions: /* @__PURE__ */ W(mr, {
|
|
1807
|
+
url: s.src,
|
|
1808
|
+
filename: c,
|
|
1809
|
+
variant: "viewer",
|
|
1810
|
+
label: `Download ${c}`
|
|
1811
|
+
}),
|
|
1812
|
+
"data-testid": "image-viewer",
|
|
1813
|
+
children: [e ? /* @__PURE__ */ W("img", {
|
|
1814
|
+
src: s.src,
|
|
1815
|
+
alt: s.alt ?? c,
|
|
1816
|
+
draggable: !1,
|
|
1817
|
+
decoding: "async",
|
|
1818
|
+
className: "block h-auto max-h-[calc(100dvh-128px)] w-auto max-w-[min(96vw,1400px)] select-none object-contain"
|
|
1819
|
+
}, `${i}:${s.src}`) : null, t.length > 1 ? /* @__PURE__ */ W(pr, {
|
|
1820
|
+
onPrev: a,
|
|
1821
|
+
onNext: o,
|
|
1822
|
+
prevLabel: "Previous image",
|
|
1823
|
+
nextLabel: "Next image"
|
|
1824
|
+
}) : null]
|
|
1825
|
+
}) : null;
|
|
1826
|
+
}, yr = "relative block size-full overflow-hidden bg-black/5 outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] focus-visible:after:ring-2 focus-visible:after:ring-inset focus-visible:after:ring-white/80 focus-visible:after:ring-offset-2 focus-visible:after:ring-offset-black", br = {
|
|
1827
|
+
1: ["rounded-[18px]"],
|
|
1828
|
+
2: ["rounded-l-[18px]", "rounded-r-[18px]"],
|
|
1829
|
+
3: [
|
|
1830
|
+
"rounded-l-[18px]",
|
|
1831
|
+
"rounded-tr-[18px]",
|
|
1832
|
+
"rounded-br-[18px]"
|
|
1833
|
+
],
|
|
1834
|
+
4: [
|
|
1835
|
+
"rounded-tl-[18px]",
|
|
1836
|
+
"rounded-tr-[18px]",
|
|
1837
|
+
"rounded-bl-[18px]",
|
|
1838
|
+
"rounded-br-[18px]"
|
|
1839
|
+
]
|
|
1840
|
+
}, xr = "--mes-single-width-cap", Sr = "[--mes-single-width-cap:309px] sm:[--mes-single-width-cap:326px]", Cr = 436, wr = ({ tiles: e, onTileActivate: t, maxVisible: n = 4, singleAspectRatio: r, className: i }) => {
|
|
1841
|
+
let a = e.length;
|
|
1842
|
+
if (a === 0) return null;
|
|
1843
|
+
let o = e.slice(0, Math.min(a, n)), s = a - o.length, c = s > 0 ? /* @__PURE__ */ G("div", {
|
|
1844
|
+
"aria-hidden": !0,
|
|
1845
|
+
className: "absolute inset-0 flex items-center justify-center bg-[#040403]/50 text-2xl font-bold leading-[28px] tracking-[-0.24px] text-white",
|
|
1846
|
+
children: ["+", s]
|
|
1847
|
+
}) : null, l = (e, n, r) => {
|
|
1848
|
+
let i = Y(yr, "h-full w-full", br[o.length]?.[n]);
|
|
1849
|
+
return t ? /* @__PURE__ */ G("button", {
|
|
1850
|
+
type: "button",
|
|
1851
|
+
onClick: () => t(n),
|
|
1852
|
+
"aria-label": e.ariaLabel ?? `Open media ${n + 1}`,
|
|
1853
|
+
className: Y(i, e.cursorClassName ?? "cursor-zoom-in"),
|
|
1854
|
+
children: [e.content, r]
|
|
1855
|
+
}, n) : /* @__PURE__ */ G("div", {
|
|
1856
|
+
className: i,
|
|
1857
|
+
children: [e.content, r]
|
|
1858
|
+
}, n);
|
|
1859
|
+
}, u;
|
|
1860
|
+
return r && (u = {
|
|
1861
|
+
aspectRatio: r,
|
|
1862
|
+
width: `min(var(${xr}), ${Math.round(Cr * r * 100) / 100}px)`,
|
|
1863
|
+
maxWidth: "100%"
|
|
1864
|
+
}), o.length === 1 ? /* @__PURE__ */ W("div", {
|
|
1865
|
+
className: Y(r ? Sr : "aspect-square w-full", i),
|
|
1866
|
+
style: u,
|
|
1867
|
+
children: l(o[0], 0, c)
|
|
1868
|
+
}) : o.length === 2 ? /* @__PURE__ */ W("div", {
|
|
1869
|
+
className: Y("grid aspect-[16/9] w-full grid-cols-2 gap-0.5", i),
|
|
1870
|
+
children: o.map((e, t) => l(e, t, t === o.length - 1 ? c : null))
|
|
1871
|
+
}) : o.length === 3 ? /* @__PURE__ */ G("div", {
|
|
1872
|
+
className: Y("grid aspect-[4/3] w-full grid-cols-2 grid-rows-2 gap-0.5", i),
|
|
1873
|
+
children: [
|
|
1874
|
+
/* @__PURE__ */ W("div", {
|
|
1875
|
+
className: "row-span-2",
|
|
1876
|
+
children: l(o[0], 0)
|
|
1877
|
+
}),
|
|
1878
|
+
l(o[1], 1),
|
|
1879
|
+
l(o[2], 2, c)
|
|
1880
|
+
]
|
|
1881
|
+
}) : /* @__PURE__ */ W("div", {
|
|
1882
|
+
className: Y("grid aspect-[379/286] w-full grid-cols-2 grid-rows-2 gap-0.5", i),
|
|
1883
|
+
children: o.map((e, t) => {
|
|
1884
|
+
let n = s > 0 && t === o.length - 1;
|
|
1885
|
+
return l(e, t, n ? c : null);
|
|
1886
|
+
})
|
|
1887
|
+
});
|
|
1888
|
+
}, Tr = ({ src: e, suppliedRatio: t, fallbackRatio: n }) => {
|
|
1889
|
+
let [r, i] = o.useState(), a = o.useCallback((t) => {
|
|
1890
|
+
if (!t || t.naturalWidth <= 0 || t.naturalHeight <= 0 || e === void 0) return;
|
|
1891
|
+
let n = t.naturalWidth / t.naturalHeight;
|
|
1892
|
+
i((t) => t && t.src === e && t.ratio === n ? t : {
|
|
1893
|
+
src: e,
|
|
1894
|
+
ratio: n
|
|
1895
|
+
});
|
|
1896
|
+
}, [e]), s = o.useCallback((e) => a(e.currentTarget), [a]), c = r && r.src === e ? r.ratio : void 0;
|
|
1897
|
+
return {
|
|
1898
|
+
ratio: t ?? c ?? n,
|
|
1899
|
+
imgRef: a,
|
|
1900
|
+
onLoad: s
|
|
1901
|
+
};
|
|
1902
|
+
}, Er = (e) => {
|
|
1903
|
+
let [t, n] = h(!1), [r, i] = h(0);
|
|
1904
|
+
return {
|
|
1905
|
+
viewerOpen: t,
|
|
1906
|
+
viewerIndex: r,
|
|
1907
|
+
handleActivate: l((t) => {
|
|
1908
|
+
e?.(t) !== !1 && (i(t), n(!0));
|
|
1909
|
+
}, [e]),
|
|
1910
|
+
closeViewer: l(() => n(!1), [])
|
|
1911
|
+
};
|
|
1912
|
+
}, Dr = ({ item: e, index: t, totalCount: n, fallbackLoading: r, imgRef: i, onLoad: o }) => ({
|
|
1913
|
+
ariaLabel: `Open image ${t + 1} of ${n}`,
|
|
1914
|
+
content: /* @__PURE__ */ W("img", {
|
|
1915
|
+
ref: i,
|
|
1916
|
+
src: a(e.src) ?? e.src,
|
|
1917
|
+
alt: e.alt ?? "",
|
|
1918
|
+
width: e.width,
|
|
1919
|
+
height: e.height,
|
|
1920
|
+
draggable: !1,
|
|
1921
|
+
loading: e.loading ?? r,
|
|
1922
|
+
decoding: "async",
|
|
1923
|
+
onLoad: o,
|
|
1924
|
+
className: "absolute inset-0 size-full object-cover"
|
|
1925
|
+
})
|
|
1926
|
+
}), Or = ({ src: e, alt: t, items: n }) => n && n.length > 0 ? n : e ? [{
|
|
1927
|
+
src: e,
|
|
1928
|
+
alt: t
|
|
1929
|
+
}] : [], kr = (e, t) => e.map((n, r) => ({
|
|
1930
|
+
src: n.src,
|
|
1931
|
+
alt: n.alt,
|
|
1932
|
+
filename: t && e.length === 1 ? t : t ? `${t} (${r + 1})` : void 0
|
|
1933
|
+
})), Ar = ({ src: e, alt: t, filename: n, loading: r = "lazy", onClick: i, onDismiss: o }) => {
|
|
1934
|
+
let { viewerOpen: s, viewerIndex: c, handleActivate: l, closeViewer: u } = Er(i);
|
|
1935
|
+
return /* @__PURE__ */ G("div", {
|
|
1936
|
+
className: "relative w-fit",
|
|
1937
|
+
children: [
|
|
1938
|
+
/* @__PURE__ */ W("button", {
|
|
1939
|
+
type: "button",
|
|
1940
|
+
onClick: () => l(0),
|
|
1941
|
+
"aria-label": "Open image",
|
|
1942
|
+
className: "block size-[280px] cursor-zoom-in overflow-hidden rounded-md outline-none focus-visible:ring-2 focus-visible:ring-black/40",
|
|
1943
|
+
children: /* @__PURE__ */ W("img", {
|
|
1944
|
+
src: a(e) ?? e,
|
|
1945
|
+
alt: t ?? "",
|
|
1946
|
+
draggable: !1,
|
|
1947
|
+
loading: r,
|
|
1948
|
+
decoding: "async",
|
|
1949
|
+
className: "size-full object-cover"
|
|
1950
|
+
})
|
|
1951
|
+
}),
|
|
1952
|
+
o ? /* @__PURE__ */ W("div", {
|
|
1953
|
+
className: "absolute right-2 top-2 z-10",
|
|
1954
|
+
children: /* @__PURE__ */ W(Gn, { onClick: o })
|
|
1955
|
+
}) : null,
|
|
1956
|
+
/* @__PURE__ */ W(vr, {
|
|
1957
|
+
open: s,
|
|
1958
|
+
items: kr([{
|
|
1959
|
+
src: e,
|
|
1960
|
+
alt: t
|
|
1961
|
+
}], n),
|
|
1962
|
+
initialIndex: c,
|
|
1963
|
+
onClose: u
|
|
1964
|
+
})
|
|
1965
|
+
]
|
|
1966
|
+
});
|
|
1967
|
+
}, jr = 326 / 246, Mr = ({ state: e, src: t, alt: n, filename: r, items: i, text: a, groupPosition: o, loading: s = "lazy", onClick: c }) => {
|
|
1968
|
+
let l = Or({
|
|
1969
|
+
src: t,
|
|
1970
|
+
alt: n,
|
|
1971
|
+
items: i
|
|
1972
|
+
}), u = Kn(e), { viewerOpen: d, viewerIndex: f, handleActivate: p, closeViewer: m } = Er(c), h = l.length === 1, g = h ? l[0] : void 0, _ = Tr({
|
|
1973
|
+
src: g?.src,
|
|
1974
|
+
suppliedRatio: g?.width && g?.height ? g.width / g.height : void 0,
|
|
1975
|
+
fallbackRatio: jr
|
|
1976
|
+
});
|
|
1977
|
+
if (l.length === 0) return null;
|
|
1978
|
+
let v = l.map((e, t) => Dr({
|
|
1979
|
+
item: e,
|
|
1980
|
+
index: t,
|
|
1981
|
+
totalCount: l.length,
|
|
1982
|
+
fallbackLoading: s,
|
|
1983
|
+
imgRef: h ? _.imgRef : void 0,
|
|
1984
|
+
onLoad: h ? _.onLoad : void 0
|
|
1985
|
+
}));
|
|
1986
|
+
return /* @__PURE__ */ G(Wn, {
|
|
1987
|
+
variant: u,
|
|
1988
|
+
text: a,
|
|
1989
|
+
groupPosition: o,
|
|
1990
|
+
bordered: !1,
|
|
1991
|
+
widthClassName: h ? "w-fit max-w-[min(100%,313px)] sm:max-w-[min(100%,330px)]" : "w-[383px] max-w-full",
|
|
1992
|
+
paddingClassName: "p-0.5",
|
|
1993
|
+
radiusClassName: "rounded-[20px]",
|
|
1994
|
+
"data-testid": "image-attachment",
|
|
1995
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1996
|
+
className: "relative",
|
|
1997
|
+
children: /* @__PURE__ */ W(wr, {
|
|
1998
|
+
tiles: v,
|
|
1999
|
+
onTileActivate: p,
|
|
2000
|
+
singleAspectRatio: h ? _.ratio : void 0
|
|
2001
|
+
})
|
|
2002
|
+
}), /* @__PURE__ */ W(vr, {
|
|
2003
|
+
open: d,
|
|
2004
|
+
items: kr(l, r),
|
|
2005
|
+
initialIndex: f,
|
|
2006
|
+
onClose: m
|
|
2007
|
+
})]
|
|
2008
|
+
});
|
|
2009
|
+
}, Nr = {
|
|
2010
|
+
Composer: (e) => /* @__PURE__ */ W(Ar, { ...e }),
|
|
2011
|
+
Sent: (e) => /* @__PURE__ */ W(Mr, {
|
|
2012
|
+
...e,
|
|
2013
|
+
state: "sent"
|
|
2014
|
+
}),
|
|
2015
|
+
Received: (e) => /* @__PURE__ */ W(Mr, {
|
|
2016
|
+
...e,
|
|
2017
|
+
state: "received"
|
|
2018
|
+
})
|
|
2019
|
+
}, Pr = ({ open: e, items: t, initialIndex: n = 0, onClose: r }) => {
|
|
2020
|
+
let { index: i, prev: a, next: o } = gr({
|
|
2021
|
+
length: t.length,
|
|
2022
|
+
initialIndex: n,
|
|
2023
|
+
open: e
|
|
2024
|
+
}), s = t[i], c = p(() => s?.filename ?? (s ? Q(s.src) : "document"), [s]), l = p(() => s ? Fr(s.src) : void 0, [s]);
|
|
2025
|
+
return !s || !l ? null : /* @__PURE__ */ G(_r, {
|
|
2026
|
+
open: e,
|
|
2027
|
+
onClose: r,
|
|
2028
|
+
ariaLabel: c,
|
|
2029
|
+
counter: t.length > 1 ? `${i + 1} / ${t.length}` : void 0,
|
|
2030
|
+
"data-testid": "pdf-viewer",
|
|
2031
|
+
children: [/* @__PURE__ */ W("iframe", {
|
|
2032
|
+
src: l,
|
|
2033
|
+
title: c,
|
|
2034
|
+
className: "block h-[calc(100dvh-128px)] w-[min(96vw,1400px)] border-0 bg-white",
|
|
2035
|
+
sandbox: "allow-scripts allow-forms allow-popups allow-downloads"
|
|
2036
|
+
}, `${i}:${s.src}`), t.length > 1 ? /* @__PURE__ */ W(pr, {
|
|
2037
|
+
onPrev: a,
|
|
2038
|
+
onNext: o,
|
|
2039
|
+
prevLabel: "Previous document",
|
|
2040
|
+
nextLabel: "Next document"
|
|
2041
|
+
}) : null]
|
|
2042
|
+
});
|
|
2043
|
+
}, Fr = (e) => {
|
|
2044
|
+
let t = e.indexOf("#"), n = t === -1 ? e : e.slice(0, t), r = t === -1 ? "" : e.slice(t + 1), i = new URLSearchParams(r);
|
|
2045
|
+
return i.has("toolbar") || i.set("toolbar", "0"), i.has("navpanes") || i.set("navpanes", "0"), `${n}#${i.toString()}`;
|
|
2046
|
+
}, Ir = ({ src: e, filename: t, fileSize: n, title: r, items: i }) => i && i.length > 0 ? i : e ? [{
|
|
2047
|
+
src: e,
|
|
2048
|
+
filename: t,
|
|
2049
|
+
fileSize: n,
|
|
2050
|
+
title: r
|
|
2051
|
+
}] : [], Lr = ({ variant: e, item: t, index: n, onActivate: r, trailingAction: i }) => {
|
|
2052
|
+
let a = t.filename ?? Q(t.src);
|
|
2053
|
+
return /* @__PURE__ */ W(ar, {
|
|
2054
|
+
variant: e,
|
|
2055
|
+
filename: a,
|
|
2056
|
+
title: t.title,
|
|
2057
|
+
mimeType: "application/pdf",
|
|
2058
|
+
fileSize: t.fileSize,
|
|
2059
|
+
onActivate: () => r(n),
|
|
2060
|
+
activateLabel: `Open ${a}`,
|
|
2061
|
+
trailingAction: i
|
|
2062
|
+
});
|
|
2063
|
+
}, Rr = ({ state: e, src: t, filename: n, fileSize: r, title: i, items: a, text: o, groupPosition: s, onClick: c, onDismiss: l }) => {
|
|
2064
|
+
let u = Kn(e), d = Ir({
|
|
2065
|
+
src: t,
|
|
2066
|
+
filename: n,
|
|
2067
|
+
fileSize: r,
|
|
2068
|
+
title: i,
|
|
2069
|
+
items: a
|
|
2070
|
+
}), { viewerOpen: f, viewerIndex: p, handleActivate: m, closeViewer: h } = Er(c), g = e === "composer" && !!l;
|
|
2071
|
+
if (d.length === 0) return null;
|
|
2072
|
+
let _ = d.map((e) => ({
|
|
2073
|
+
src: e.src,
|
|
2074
|
+
filename: e.filename ?? Q(e.src)
|
|
2075
|
+
}));
|
|
2076
|
+
return /* @__PURE__ */ G(Wn, {
|
|
2077
|
+
variant: u,
|
|
2078
|
+
text: o,
|
|
2079
|
+
groupPosition: s,
|
|
2080
|
+
"data-testid": "pdf-attachment",
|
|
2081
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2082
|
+
className: "flex flex-col gap-2",
|
|
2083
|
+
children: d.map((t, n) => {
|
|
2084
|
+
let r = t.filename ?? Q(t.src), i = g && n === 0 ? /* @__PURE__ */ W(Gn, {
|
|
2085
|
+
onClick: l,
|
|
2086
|
+
variant: "inline"
|
|
2087
|
+
}) : e === "composer" ? void 0 : /* @__PURE__ */ W(mr, {
|
|
2088
|
+
url: t.src,
|
|
2089
|
+
filename: r,
|
|
2090
|
+
variant: "inline",
|
|
2091
|
+
label: `Download ${r}`,
|
|
2092
|
+
tone: u
|
|
2093
|
+
});
|
|
2094
|
+
return /* @__PURE__ */ W(Lr, {
|
|
2095
|
+
variant: u,
|
|
2096
|
+
item: t,
|
|
2097
|
+
index: n,
|
|
2098
|
+
onActivate: m,
|
|
2099
|
+
trailingAction: i
|
|
2100
|
+
}, `${t.src}-${n}`);
|
|
2101
|
+
})
|
|
2102
|
+
}), /* @__PURE__ */ W(Pr, {
|
|
2103
|
+
open: f,
|
|
2104
|
+
items: _,
|
|
2105
|
+
initialIndex: p,
|
|
2106
|
+
onClose: h
|
|
2107
|
+
})]
|
|
2108
|
+
});
|
|
2109
|
+
}, zr = {
|
|
2110
|
+
Composer: (e) => /* @__PURE__ */ W(Rr, {
|
|
2111
|
+
...e,
|
|
2112
|
+
state: "composer"
|
|
2113
|
+
}),
|
|
2114
|
+
Sent: (e) => /* @__PURE__ */ W(Rr, {
|
|
2115
|
+
...e,
|
|
2116
|
+
state: "sent"
|
|
2117
|
+
}),
|
|
2118
|
+
Received: (e) => /* @__PURE__ */ W(Rr, {
|
|
2119
|
+
...e,
|
|
2120
|
+
state: "received"
|
|
2121
|
+
})
|
|
2122
|
+
}, Br = 150, Vr = ({ open: e, items: t, initialIndex: n = 0, onClose: i }) => {
|
|
2123
|
+
let { index: a, prev: o, next: s } = gr({
|
|
2124
|
+
length: t.length,
|
|
2125
|
+
initialIndex: n,
|
|
2126
|
+
open: e
|
|
2127
|
+
}), c = m(null), l = pe();
|
|
2128
|
+
d(() => {
|
|
2129
|
+
e && (l?.pause(), r(c.current));
|
|
2130
|
+
}, [e, l]);
|
|
2131
|
+
let [u, f] = h(e);
|
|
2132
|
+
e && !u && f(!0), d(() => {
|
|
2133
|
+
if (e || !u) return;
|
|
2134
|
+
c.current?.pause();
|
|
2135
|
+
let t = window.setTimeout(() => f(!1), Br);
|
|
2136
|
+
return () => window.clearTimeout(t);
|
|
2137
|
+
}, [e, u]);
|
|
2138
|
+
let g = t[a], _ = p(() => g?.filename ?? (g ? Q(g.src) : "video"), [g]);
|
|
2139
|
+
return g ? /* @__PURE__ */ G(_r, {
|
|
2140
|
+
open: e,
|
|
2141
|
+
onClose: i,
|
|
2142
|
+
ariaLabel: _,
|
|
2143
|
+
counter: t.length > 1 ? `${a + 1} / ${t.length}` : void 0,
|
|
2144
|
+
"data-testid": "video-viewer",
|
|
2145
|
+
children: [u ? /* @__PURE__ */ W("video", {
|
|
2146
|
+
ref: c,
|
|
2147
|
+
src: g.src,
|
|
2148
|
+
poster: g.poster,
|
|
2149
|
+
controls: !0,
|
|
2150
|
+
autoPlay: !0,
|
|
2151
|
+
muted: !0,
|
|
2152
|
+
playsInline: !0,
|
|
2153
|
+
preload: g.preload ?? "metadata",
|
|
2154
|
+
className: "block h-auto max-h-[calc(100dvh-128px)] w-auto max-w-[min(96vw,1400px)] bg-black",
|
|
2155
|
+
children: g.mimeType ? /* @__PURE__ */ W("source", {
|
|
2156
|
+
src: g.src,
|
|
2157
|
+
type: g.mimeType
|
|
2158
|
+
}) : null
|
|
2159
|
+
}, `${a}:${g.src}`) : null, t.length > 1 ? /* @__PURE__ */ W(pr, {
|
|
2160
|
+
onPrev: o,
|
|
2161
|
+
onNext: s,
|
|
2162
|
+
prevLabel: "Previous video",
|
|
2163
|
+
nextLabel: "Next video"
|
|
2164
|
+
}) : null]
|
|
2165
|
+
}) : null;
|
|
2166
|
+
}, Hr = 1, Ur = 4 / 5, Wr = 16 / 9, Gr = () => /* @__PURE__ */ W("div", {
|
|
2167
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
|
2168
|
+
children: /* @__PURE__ */ W("span", {
|
|
2169
|
+
className: "flex size-12 items-center justify-center rounded-full bg-black/25 text-white backdrop-blur-[20px]",
|
|
2170
|
+
children: /* @__PURE__ */ W(Le, {
|
|
2171
|
+
className: "size-6",
|
|
2172
|
+
weight: "fill",
|
|
2173
|
+
"aria-hidden": !0
|
|
2174
|
+
})
|
|
2175
|
+
})
|
|
2176
|
+
}), Kr = ({ item: e, index: t, showPlayBadge: n = !0, imgRef: r, onLoad: i }) => /* @__PURE__ */ G("div", {
|
|
2177
|
+
className: "absolute inset-0 size-full bg-[#0d0d0d]",
|
|
2178
|
+
children: [e.poster ? /* @__PURE__ */ W("img", {
|
|
2179
|
+
ref: r,
|
|
2180
|
+
src: e.poster,
|
|
2181
|
+
alt: `Video ${t + 1} thumbnail`,
|
|
2182
|
+
draggable: !1,
|
|
2183
|
+
loading: "lazy",
|
|
2184
|
+
decoding: "async",
|
|
2185
|
+
onLoad: i,
|
|
2186
|
+
className: "absolute inset-0 size-full object-cover"
|
|
2187
|
+
}) : /* @__PURE__ */ W("div", {
|
|
2188
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
2189
|
+
children: /* @__PURE__ */ W(Ge, {
|
|
2190
|
+
className: "size-16 text-white/30",
|
|
2191
|
+
weight: "regular",
|
|
2192
|
+
"aria-hidden": !0
|
|
2193
|
+
})
|
|
2194
|
+
}), n ? /* @__PURE__ */ W(Gr, {}) : null]
|
|
2195
|
+
}), qr = ({ item: e, index: t, totalCount: n, isOverflowTile: r, imgRef: i, onLoad: a }) => ({
|
|
2196
|
+
ariaLabel: `Play video ${t + 1} of ${n}`,
|
|
2197
|
+
cursorClassName: "cursor-pointer",
|
|
2198
|
+
content: /* @__PURE__ */ W(Kr, {
|
|
2199
|
+
item: e,
|
|
2200
|
+
index: t,
|
|
2201
|
+
showPlayBadge: !r,
|
|
2202
|
+
imgRef: i,
|
|
2203
|
+
onLoad: a
|
|
2204
|
+
})
|
|
2205
|
+
}), Jr = ({ src: e, poster: t, mimeType: n, preload: r, naturalAspectRatio: i, items: a }) => a && a.length > 0 ? r ? a.map((e) => ({
|
|
2206
|
+
...e,
|
|
2207
|
+
preload: e.preload ?? r
|
|
2208
|
+
})) : a : e ? [{
|
|
2209
|
+
src: e,
|
|
2210
|
+
poster: t,
|
|
2211
|
+
mimeType: n,
|
|
2212
|
+
preload: r,
|
|
2213
|
+
naturalAspectRatio: i
|
|
2214
|
+
}] : [], Yr = (e, t) => e.map((n, r) => ({
|
|
2215
|
+
src: n.src,
|
|
2216
|
+
poster: n.poster,
|
|
2217
|
+
mimeType: n.mimeType,
|
|
2218
|
+
preload: n.preload,
|
|
2219
|
+
filename: t && e.length === 1 ? t : t ? `${t} (${r + 1})` : void 0
|
|
2220
|
+
})), Xr = ({ src: e, poster: t, mimeType: n, filename: r, preload: i, onClick: a, onDismiss: o }) => {
|
|
2221
|
+
let { viewerOpen: s, viewerIndex: c, handleActivate: l, closeViewer: u } = Er(a);
|
|
2222
|
+
return /* @__PURE__ */ G("div", {
|
|
2223
|
+
className: "relative w-fit",
|
|
2224
|
+
children: [
|
|
2225
|
+
/* @__PURE__ */ W("button", {
|
|
2226
|
+
type: "button",
|
|
2227
|
+
onClick: () => l(0),
|
|
2228
|
+
"aria-label": "Play video",
|
|
2229
|
+
className: "relative block size-[280px] cursor-pointer overflow-hidden rounded-md outline-none focus-visible:ring-2 focus-visible:ring-black/40",
|
|
2230
|
+
children: /* @__PURE__ */ W(Kr, {
|
|
2231
|
+
item: {
|
|
2232
|
+
src: e,
|
|
2233
|
+
poster: t,
|
|
2234
|
+
mimeType: n
|
|
2235
|
+
},
|
|
2236
|
+
index: 0
|
|
2237
|
+
})
|
|
2238
|
+
}),
|
|
2239
|
+
o ? /* @__PURE__ */ W("div", {
|
|
2240
|
+
className: "absolute right-2 top-2 z-10",
|
|
2241
|
+
children: /* @__PURE__ */ W(Gn, { onClick: o })
|
|
2242
|
+
}) : null,
|
|
2243
|
+
/* @__PURE__ */ W(Vr, {
|
|
2244
|
+
open: s,
|
|
2245
|
+
items: Yr([{
|
|
2246
|
+
src: e,
|
|
2247
|
+
poster: t,
|
|
2248
|
+
mimeType: n,
|
|
2249
|
+
preload: i
|
|
2250
|
+
}], r),
|
|
2251
|
+
initialIndex: c,
|
|
2252
|
+
onClose: u
|
|
2253
|
+
})
|
|
2254
|
+
]
|
|
2255
|
+
});
|
|
2256
|
+
}, Zr = ({ state: e, src: t, poster: n, mimeType: r, filename: i, items: a, text: o, groupPosition: s, preload: c, naturalAspectRatio: l, onClick: u }) => {
|
|
2257
|
+
let d = Jr({
|
|
2258
|
+
src: t,
|
|
2259
|
+
poster: n,
|
|
2260
|
+
mimeType: r,
|
|
2261
|
+
preload: c,
|
|
2262
|
+
naturalAspectRatio: l,
|
|
2263
|
+
items: a
|
|
2264
|
+
}), f = Kn(e), { viewerOpen: p, viewerIndex: m, handleActivate: h, closeViewer: g } = Er(u), _ = d.length === 1, v = _ ? d[0] : void 0, y = Tr({
|
|
2265
|
+
src: v?.poster,
|
|
2266
|
+
suppliedRatio: v?.naturalAspectRatio,
|
|
2267
|
+
fallbackRatio: Hr
|
|
2268
|
+
});
|
|
2269
|
+
if (d.length === 0) return null;
|
|
2270
|
+
let b = d.length > 4 ? 3 : -1, x = d.map((e, t) => qr({
|
|
2271
|
+
item: e,
|
|
2272
|
+
index: t,
|
|
2273
|
+
totalCount: d.length,
|
|
2274
|
+
isOverflowTile: t === b,
|
|
2275
|
+
imgRef: _ ? y.imgRef : void 0,
|
|
2276
|
+
onLoad: _ ? y.onLoad : void 0
|
|
2277
|
+
})), S = Math.min(Math.max(y.ratio, Ur), Wr);
|
|
2278
|
+
return /* @__PURE__ */ G(Wn, {
|
|
2279
|
+
variant: f,
|
|
2280
|
+
text: o,
|
|
2281
|
+
groupPosition: s,
|
|
2282
|
+
bordered: !1,
|
|
2283
|
+
widthClassName: _ ? "w-fit max-w-[313px] sm:max-w-[330px]" : "w-[383px] max-w-full",
|
|
2284
|
+
paddingClassName: "p-0.5",
|
|
2285
|
+
radiusClassName: s && s !== "single" ? void 0 : "rounded-[20px]",
|
|
2286
|
+
"data-testid": "video-attachment",
|
|
2287
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2288
|
+
className: "relative",
|
|
2289
|
+
children: /* @__PURE__ */ W(wr, {
|
|
2290
|
+
tiles: x,
|
|
2291
|
+
onTileActivate: h,
|
|
2292
|
+
singleAspectRatio: _ ? S : void 0
|
|
2293
|
+
})
|
|
2294
|
+
}), /* @__PURE__ */ W(Vr, {
|
|
2295
|
+
open: p,
|
|
2296
|
+
items: Yr(d, i),
|
|
2297
|
+
initialIndex: m,
|
|
2298
|
+
onClose: g
|
|
2299
|
+
})]
|
|
2300
|
+
});
|
|
2301
|
+
}, Qr = {
|
|
2302
|
+
Image: Nr,
|
|
2303
|
+
Video: {
|
|
2304
|
+
Composer: (e) => /* @__PURE__ */ W(Xr, { ...e }),
|
|
2305
|
+
Sent: (e) => /* @__PURE__ */ W(Zr, {
|
|
2306
|
+
...e,
|
|
2307
|
+
state: "sent"
|
|
2308
|
+
}),
|
|
2309
|
+
Received: (e) => /* @__PURE__ */ W(Zr, {
|
|
2310
|
+
...e,
|
|
2311
|
+
state: "received"
|
|
2312
|
+
})
|
|
2313
|
+
},
|
|
2314
|
+
Audio: Zn,
|
|
2315
|
+
Pdf: zr,
|
|
2316
|
+
File: ur
|
|
2317
|
+
};
|
|
2318
|
+
//#endregion
|
|
2319
|
+
//#region src/components/CustomMessage/StreamAttachmentMessage.tsx
|
|
2320
|
+
function $(e) {
|
|
2321
|
+
return e?.trim() || void 0;
|
|
2322
|
+
}
|
|
2323
|
+
function $r(e) {
|
|
2324
|
+
let { original_width: t, original_height: n } = e;
|
|
2325
|
+
if (typeof t == "number" && typeof n == "number" && !(!Number.isFinite(t) || !Number.isFinite(n)) && !(t <= 0 || n <= 0)) return t / n;
|
|
2326
|
+
}
|
|
2327
|
+
function ei(e) {
|
|
2328
|
+
return e.trim().replace(/^https?:\/\//i, "").replace(/\/+$/, "").toLowerCase();
|
|
2329
|
+
}
|
|
2330
|
+
function ti(e, t) {
|
|
2331
|
+
if (!e?.trim() || !t?.trim()) return !1;
|
|
2332
|
+
let n = ei(e), r = ei(t);
|
|
2333
|
+
if (n === r) return !0;
|
|
2334
|
+
if (!n.includes(r)) return !1;
|
|
2335
|
+
let i = n.split(r).join("");
|
|
2336
|
+
return !/[^\p{P}\p{Z}\p{C}]/u.test(i);
|
|
2337
|
+
}
|
|
2338
|
+
function ni(e) {
|
|
2339
|
+
let t = $(e.og_scrape_url) ?? $(e.title_link), n = $(e.image_url) ?? $(e.thumb_url), r = $(e.asset_url), i = $(e.mime_type);
|
|
2340
|
+
return {
|
|
2341
|
+
title: $(e.title),
|
|
2342
|
+
description: $(e.text),
|
|
2343
|
+
url: t,
|
|
2344
|
+
thumbnailUrl: a(n),
|
|
2345
|
+
sourceUrl: r,
|
|
2346
|
+
layout: n || Tn(i, r) ? "featured" : "classic",
|
|
2347
|
+
mimeType: i,
|
|
2348
|
+
accentColor: $(e.accent_color),
|
|
2349
|
+
status: "ready"
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
function ri(e) {
|
|
2353
|
+
return Ot(e) ? null : e.type === "image" ? e.image_url || e.asset_url ? "image" : null : e.type === "video" && e.asset_url ? "video" : e.type === "audio" && e.asset_url ? "audio" : e.type === "file" && e.asset_url ? e.mime_type === "application/pdf" ? "pdf" : e.mime_type?.startsWith("audio/") ? "audio" : "file" : null;
|
|
2354
|
+
}
|
|
2355
|
+
function ii(e) {
|
|
2356
|
+
if (!e?.length) return [];
|
|
2357
|
+
let t = [], n = (e, n) => {
|
|
2358
|
+
let r = t[t.length - 1];
|
|
2359
|
+
if (r?.type === "media" && r.kind === e) {
|
|
2360
|
+
r.attachments.push(n);
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
2363
|
+
t.push({
|
|
2364
|
+
type: "media",
|
|
2365
|
+
kind: e,
|
|
2366
|
+
attachments: [n]
|
|
2367
|
+
});
|
|
2368
|
+
}, r = (e) => {
|
|
2369
|
+
let n = t[t.length - 1];
|
|
2370
|
+
if (n?.type === "link") {
|
|
2371
|
+
n.attachments.push(e);
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
t.push({
|
|
2375
|
+
type: "link",
|
|
2376
|
+
attachments: [e]
|
|
2377
|
+
});
|
|
2378
|
+
};
|
|
2379
|
+
for (let t of e) {
|
|
2380
|
+
if (Ot(t)) {
|
|
2381
|
+
r(t);
|
|
2382
|
+
continue;
|
|
2383
|
+
}
|
|
2384
|
+
let e = ri(t);
|
|
2385
|
+
e && n(e, t);
|
|
2386
|
+
}
|
|
2387
|
+
return t;
|
|
2388
|
+
}
|
|
2389
|
+
function ai(e) {
|
|
2390
|
+
return e.filter((e) => e.type === "media").length;
|
|
2391
|
+
}
|
|
2392
|
+
function oi(e, t, n) {
|
|
2393
|
+
return t <= 1 ? n : e === 0 ? "first" : e === t - 1 ? "end" : "middle";
|
|
2394
|
+
}
|
|
2395
|
+
function si(e) {
|
|
2396
|
+
return $(e.image_url) ?? $(e.asset_url) ?? "";
|
|
2397
|
+
}
|
|
2398
|
+
function ci(e) {
|
|
2399
|
+
switch (e) {
|
|
2400
|
+
case "image": return Qr.Image;
|
|
2401
|
+
case "video": return Qr.Video;
|
|
2402
|
+
case "audio": return Qr.Audio;
|
|
2403
|
+
case "pdf": return Qr.Pdf;
|
|
2404
|
+
default: return Qr.File;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
function li(e, t) {
|
|
2408
|
+
switch (e) {
|
|
2409
|
+
case "image": return {
|
|
2410
|
+
src: si(t),
|
|
2411
|
+
alt: $(t.title)
|
|
2412
|
+
};
|
|
2413
|
+
case "video": return {
|
|
2414
|
+
src: $(t.asset_url) ?? "",
|
|
2415
|
+
poster: a(t.thumb_url),
|
|
2416
|
+
mimeType: $(t.mime_type),
|
|
2417
|
+
naturalAspectRatio: $r(t)
|
|
2418
|
+
};
|
|
2419
|
+
case "audio": return {
|
|
2420
|
+
src: $(t.asset_url) ?? "",
|
|
2421
|
+
mimeType: $(t.mime_type) ?? "audio/mpeg",
|
|
2422
|
+
filename: $(t.title)
|
|
2423
|
+
};
|
|
2424
|
+
case "pdf": return {
|
|
2425
|
+
src: $(t.asset_url) ?? "",
|
|
2426
|
+
filename: $(t.title),
|
|
2427
|
+
fileSize: t.file_size
|
|
2428
|
+
};
|
|
2429
|
+
case "file": return {
|
|
2430
|
+
src: $(t.asset_url) ?? "",
|
|
2431
|
+
filename: $(t.title),
|
|
2432
|
+
fileSize: t.file_size,
|
|
2433
|
+
mimeType: $(t.mime_type) ?? "application/octet-stream"
|
|
2434
|
+
};
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
function ui(e, t) {
|
|
2438
|
+
if (t.length > 1) return { items: t.map((t) => li(e, t)) };
|
|
2439
|
+
let n = t[0];
|
|
2440
|
+
return n ? li(e, n) : {};
|
|
2441
|
+
}
|
|
2442
|
+
function di({ groupPosition: e, isMyMessage: t, segment: n }) {
|
|
2443
|
+
let r = ci(n.kind), i = {
|
|
2444
|
+
...ui(n.kind, n.attachments),
|
|
2445
|
+
groupPosition: e
|
|
2446
|
+
};
|
|
2447
|
+
return W(t ? r.Sent : r.Received, { ...i });
|
|
2448
|
+
}
|
|
2449
|
+
var fi = ({ groupPosition: e, isMyMessage: t, message: n, renderText: r }) => {
|
|
2450
|
+
let i = ii(n.attachments);
|
|
2451
|
+
if (i.length === 0) return null;
|
|
2452
|
+
let a = ai(i), o = n.text?.trim(), s = i.find((e) => e.type === "link"), c = s?.type === "link" ? ni(s.attachments[0] ?? {}).url : void 0, l = o && ti(o, c) ? void 0 : o, u = 0, d = [], f = l ? "middle" : e, p = e === "single" || e === "end", m = (e, n, r) => {
|
|
2453
|
+
let i = t ? Rn.Sent : Rn.Received;
|
|
2454
|
+
d.push(/* @__PURE__ */ W(i, {
|
|
2455
|
+
...ni(e),
|
|
2456
|
+
groupPosition: r ? f : "middle"
|
|
2457
|
+
}, n));
|
|
2458
|
+
}, h = (n, r) => {
|
|
2459
|
+
let i = oi(u, a, e);
|
|
2460
|
+
u += 1, d.push(/* @__PURE__ */ W(di, {
|
|
2461
|
+
groupPosition: i,
|
|
2462
|
+
isMyMessage: t,
|
|
2463
|
+
segment: n
|
|
2464
|
+
}, r));
|
|
2465
|
+
};
|
|
2466
|
+
return i.forEach((e, t) => {
|
|
2467
|
+
let n = t === i.length - 1;
|
|
2468
|
+
if (e.type === "link") {
|
|
2469
|
+
e.attachments.forEach((r, i) => {
|
|
2470
|
+
m(r, `link-${t}-${i}`, n && i === e.attachments.length - 1);
|
|
2471
|
+
});
|
|
2472
|
+
return;
|
|
2473
|
+
}
|
|
2474
|
+
h(e, `media-${t}`);
|
|
2475
|
+
}), /* @__PURE__ */ G("div", {
|
|
2476
|
+
className: "str-chat__message-bubble-wrapper",
|
|
2477
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2478
|
+
className: "str-chat__message-bubble",
|
|
2479
|
+
"data-attachment-bubble": "true",
|
|
2480
|
+
style: {
|
|
2481
|
+
background: "transparent",
|
|
2482
|
+
borderRadius: 0,
|
|
2483
|
+
overflow: "visible",
|
|
2484
|
+
padding: 0
|
|
2485
|
+
},
|
|
2486
|
+
children: [d, !l && /* @__PURE__ */ W(M, {})]
|
|
2487
|
+
}), l ? /* @__PURE__ */ G("div", {
|
|
2488
|
+
className: Y("str-chat__message-bubble", { "relative isolate": p }),
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ W(R, {
|
|
2491
|
+
message: n,
|
|
2492
|
+
renderText: r
|
|
2493
|
+
}),
|
|
2494
|
+
/* @__PURE__ */ W(M, {}),
|
|
2495
|
+
p && /* @__PURE__ */ W(qt, { side: t ? "me" : "other" })
|
|
2496
|
+
]
|
|
2497
|
+
}) : null]
|
|
2498
|
+
});
|
|
2499
|
+
}, pi = o.memo((e) => {
|
|
2500
|
+
let { additionalMessageInputProps: t, editing: n, endOfGroup: r, firstOfGroup: i, groupStyles: a, groupedByUser: o, handleAction: s, handleOpenThread: c, handleRetry: l, highlighted: u, isMessageAIGenerated: d, isMyMessage: f, message: m, renderText: g, threadList: _, viewerLanguage: v, onOutboundClick: y, resolvedOutbound: x } = e, { client: S } = me("CustomMessage"), { channel: C } = V("CustomMessage"), { isUnlocking: w, onUnlockClick: T, onFetchSource: D, onDownloadClick: N } = Mt("LockedAttachment"), [F, L] = h(!1), z = ye(m.id), { Attachment: te = b, EditMessageModal: ie = E, MessageActions: B, MessageBlocked: ae = O, MessageBouncePrompt: oe = A, MessageDeleted: fe = j, MessageIsThreadReplyInChannelButtonIndicator: pe = P, MessageRepliesCountButton: ge = I, ReminderNotification: _e = ne, StreamedMessageText: H = re, PinIndicator: ve } = he("CustomMessage"), be = ue(m), xe = de(m), K = p(() => d?.(m), [d, m]), q = p(() => {
|
|
2501
|
+
let e = m.attachments ?? [], t = m.shared_location ? [m.shared_location, ...e] : e;
|
|
2502
|
+
if (!zt(m)) return t;
|
|
2503
|
+
let n = t.filter((e) => !("type" in e) || !Ot(e));
|
|
2504
|
+
return n.length === t.length ? t : n;
|
|
2505
|
+
}, [m]), Se = p(() => ii(q), [q]), Ce = p(() => {
|
|
2506
|
+
let e = Dt({
|
|
2507
|
+
message: m,
|
|
2508
|
+
viewerLanguage: v
|
|
2509
|
+
});
|
|
2510
|
+
return e === m.text ? m : {
|
|
2511
|
+
...m,
|
|
2512
|
+
text: e
|
|
2513
|
+
};
|
|
2514
|
+
}, [m, v]), we = Se.length > 0, Te = Se.reduce((e, t) => e + t.attachments.length, 0) === (q?.length ?? 0), J = a?.[0] ?? "", Ee = J === "top" ? "first" : J === "middle" ? "middle" : J === "bottom" ? "end" : "single", De = J === "single" || J === "bottom";
|
|
2515
|
+
if (se(m)) return null;
|
|
2516
|
+
if (m.deleted_at || m.type === "deleted") return /* @__PURE__ */ W(fe, { message: m });
|
|
2517
|
+
if (ce(m)) return /* @__PURE__ */ W(ae, {});
|
|
2518
|
+
let Oe = !_ && !!m.reply_count, ke = !_ && m.show_in_channel && m.parent_id, Ae = m.status === "failed" && m.error?.status !== 403, je = le(m), X;
|
|
2519
|
+
Ae ? X = () => l(m) : je && (X = () => L(!0));
|
|
2520
|
+
let Z = f(), Me = Y("str-chat__message str-chat__message-simple", `str-chat__message--${m.type}`, `str-chat__message--${m.status}`, Z ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other", m.text ? "str-chat__message--has-text" : "has-no-text", {
|
|
2521
|
+
"str-chat__message--has-attachment": be,
|
|
2522
|
+
"str-chat__message--highlighted": u,
|
|
2523
|
+
"str-chat__message--pinned pinned-message": m.pinned,
|
|
2524
|
+
"str-chat__message--with-reactions": xe,
|
|
2525
|
+
"str-chat__message-send-can-be-retried": m?.status === "failed" && m?.error?.status !== 403,
|
|
2526
|
+
"str-chat__message-with-thread-link": Oe || ke,
|
|
2527
|
+
"str-chat__virtual-message__wrapper--end": r,
|
|
2528
|
+
"str-chat__virtual-message__wrapper--first": i,
|
|
2529
|
+
"str-chat__virtual-message__wrapper--group": o
|
|
2530
|
+
}), Ne = m.poll_id && S.polls.fromState(m.poll_id), Pe = $t(m), Fe = zt(m), Ie = Bt(m), Le = !!(q?.length && !m.quoted_message), Re = Fe && Z && Le, ze = we && Te && !m.quoted_message && !Ne && !K && !Fe, Be = {
|
|
2531
|
+
contentType: "text",
|
|
2532
|
+
amountText: m.metadata?.amount_text,
|
|
2533
|
+
paymentStatus: m.metadata?.payment_status,
|
|
2534
|
+
renderedText: m.text && /* @__PURE__ */ W(R, {
|
|
2535
|
+
message: Ce,
|
|
2536
|
+
renderText: g
|
|
2537
|
+
})
|
|
2538
|
+
}, Ve = {
|
|
2539
|
+
contentType: "media",
|
|
2540
|
+
title: m.metadata?.attachment_title,
|
|
2541
|
+
mimeType: m.metadata?.attachment_mime_type,
|
|
2542
|
+
thumbnailUrl: m.metadata?.attachment_thumbnail,
|
|
2543
|
+
amountText: m.metadata?.amount_text,
|
|
2544
|
+
detail: m.metadata?.attachment_detail,
|
|
2545
|
+
paymentStatus: m.metadata?.payment_status,
|
|
2546
|
+
onFetchSource: D ? () => D(m, C) : void 0
|
|
2547
|
+
}, He = /* @__PURE__ */ G("div", {
|
|
2548
|
+
className: Y("str-chat__message-bubble", { "relative isolate": De }),
|
|
2549
|
+
children: [/* @__PURE__ */ W(R, {
|
|
2550
|
+
message: Ce,
|
|
2551
|
+
renderText: g
|
|
2552
|
+
}), De && /* @__PURE__ */ W(qt, { side: Z ? "me" : "other" })]
|
|
2553
|
+
});
|
|
2554
|
+
return /* @__PURE__ */ G(U, { children: [
|
|
2555
|
+
n && /* @__PURE__ */ W(ie, { additionalMessageInputProps: t }),
|
|
2556
|
+
F && /* @__PURE__ */ W(k, {
|
|
2557
|
+
MessageBouncePrompt: oe,
|
|
2558
|
+
onClose: () => L(!1),
|
|
2559
|
+
open: F
|
|
2560
|
+
}),
|
|
2561
|
+
/* @__PURE__ */ G("div", {
|
|
2562
|
+
className: Me,
|
|
2563
|
+
"data-message-id": m.id,
|
|
2564
|
+
"data-dd-privacy": "mask",
|
|
2565
|
+
children: [
|
|
2566
|
+
ve && /* @__PURE__ */ W(ve, {}),
|
|
2567
|
+
!!z && /* @__PURE__ */ W(_e, { reminder: z }),
|
|
2568
|
+
m.user && /* @__PURE__ */ W(gt, {
|
|
2569
|
+
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
2570
|
+
id: m.user.id,
|
|
2571
|
+
image: m.user.image,
|
|
2572
|
+
name: m.user.name || m.user.id,
|
|
2573
|
+
size: 24,
|
|
2574
|
+
shape: "circle",
|
|
2575
|
+
dmAgentEnabled: Fe
|
|
2576
|
+
}),
|
|
2577
|
+
/* @__PURE__ */ W("div", {
|
|
2578
|
+
className: Y("str-chat__message-inner", { "str-chat__simple-message--error-failed": Ae || je }),
|
|
2579
|
+
"data-testid": "message-inner",
|
|
2580
|
+
onClick: X,
|
|
2581
|
+
onKeyDown: X,
|
|
2582
|
+
role: X ? "button" : void 0,
|
|
2583
|
+
tabIndex: X ? 0 : void 0,
|
|
2584
|
+
style: {
|
|
2585
|
+
marginInlineEnd: 0,
|
|
2586
|
+
marginInlineStart: 0
|
|
2587
|
+
},
|
|
2588
|
+
children: Pe ? /* @__PURE__ */ G("div", {
|
|
2589
|
+
className: "str-chat__message-bubble-wrapper message-tip-wrapper",
|
|
2590
|
+
children: [/* @__PURE__ */ W(en, { message: m }), m.text?.trim() && He]
|
|
2591
|
+
}) : Vt(m) ? /* @__PURE__ */ W("div", {
|
|
2592
|
+
className: "str-chat__message-bubble-wrapper",
|
|
2593
|
+
children: /* @__PURE__ */ G("div", {
|
|
2594
|
+
className: "flex items-center gap-2",
|
|
2595
|
+
children: [
|
|
2596
|
+
Z && B && /* @__PURE__ */ W(B, {}),
|
|
2597
|
+
Z ? /* @__PURE__ */ W(It, {
|
|
2598
|
+
...Be,
|
|
2599
|
+
isMine: !0
|
|
2600
|
+
}) : /* @__PURE__ */ W(It, {
|
|
2601
|
+
...Be,
|
|
2602
|
+
isMine: !1,
|
|
2603
|
+
isUnlocking: w(m.id),
|
|
2604
|
+
onUnlockClick: () => T?.(m, C)
|
|
2605
|
+
}),
|
|
2606
|
+
!Z && B && /* @__PURE__ */ W(B, {})
|
|
2607
|
+
]
|
|
2608
|
+
})
|
|
2609
|
+
}) : Ht(m) ? /* @__PURE__ */ G("div", {
|
|
2610
|
+
className: "str-chat__message-bubble-wrapper message-locked-attachment-wrapper",
|
|
2611
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2612
|
+
className: "flex items-center gap-2",
|
|
2613
|
+
children: [
|
|
2614
|
+
Z && B && /* @__PURE__ */ W(B, {}),
|
|
2615
|
+
Z ? /* @__PURE__ */ W(It, {
|
|
2616
|
+
...Ve,
|
|
2617
|
+
isMine: !0,
|
|
2618
|
+
onPreviewClick: () => T ? T(m, C) : void 0
|
|
2619
|
+
}) : /* @__PURE__ */ W(It, {
|
|
2620
|
+
...Ve,
|
|
2621
|
+
isMine: !1,
|
|
2622
|
+
isUnlocking: w(m.id),
|
|
2623
|
+
onUnlockClick: () => T ? T(m, C) : void 0,
|
|
2624
|
+
onDownloadClick: () => N ? N(m, C) : void 0
|
|
2625
|
+
}),
|
|
2626
|
+
!Z && B && /* @__PURE__ */ W(B, {})
|
|
2627
|
+
]
|
|
2628
|
+
}), m.text && He]
|
|
2629
|
+
}) : ze ? /* @__PURE__ */ W(fi, {
|
|
2630
|
+
groupPosition: Ee,
|
|
2631
|
+
isMyMessage: Z,
|
|
2632
|
+
message: {
|
|
2633
|
+
...Ce,
|
|
2634
|
+
attachments: q,
|
|
2635
|
+
i18n: void 0
|
|
2636
|
+
},
|
|
2637
|
+
renderText: g
|
|
2638
|
+
}) : /* @__PURE__ */ W("div", {
|
|
2639
|
+
className: "str-chat__message-bubble-wrapper",
|
|
2640
|
+
children: /* @__PURE__ */ G("div", {
|
|
2641
|
+
className: Y("str-chat__message-bubble", { "relative isolate": De }),
|
|
2642
|
+
children: [
|
|
2643
|
+
Fe && !Re && /* @__PURE__ */ W(Wt, {
|
|
2644
|
+
message: m,
|
|
2645
|
+
hasAttachment: Le,
|
|
2646
|
+
isMyMessage: Z
|
|
2647
|
+
}),
|
|
2648
|
+
Ne && /* @__PURE__ */ W(ee, { poll: Ne }),
|
|
2649
|
+
q?.length && !m.quoted_message ? /* @__PURE__ */ W(te, {
|
|
2650
|
+
actionHandler: s,
|
|
2651
|
+
attachments: q
|
|
2652
|
+
}) : null,
|
|
2653
|
+
W(K ? H : R, {
|
|
2654
|
+
message: Ce,
|
|
2655
|
+
renderText: g
|
|
2656
|
+
}),
|
|
2657
|
+
/* @__PURE__ */ W(M, {}),
|
|
2658
|
+
De && /* @__PURE__ */ W(qt, { side: Z ? "me" : "other" })
|
|
2659
|
+
]
|
|
2660
|
+
})
|
|
2661
|
+
})
|
|
2662
|
+
}),
|
|
2663
|
+
!Ie && !Pe && /* @__PURE__ */ W("div", {
|
|
2664
|
+
className: "str-chat__message-footer",
|
|
2665
|
+
children: (!Fe || Re) && /* @__PURE__ */ W(Wt, {
|
|
2666
|
+
message: m,
|
|
2667
|
+
hasAttachment: Le,
|
|
2668
|
+
isMyMessage: Z
|
|
2669
|
+
})
|
|
2670
|
+
}),
|
|
2671
|
+
/* @__PURE__ */ W(sn, {
|
|
2672
|
+
onOutboundClick: y,
|
|
2673
|
+
resolvedOutbound: x
|
|
2674
|
+
}),
|
|
2675
|
+
Oe && /* @__PURE__ */ W(ge, {
|
|
2676
|
+
onClick: c,
|
|
2677
|
+
reply_count: m.reply_count
|
|
2678
|
+
}),
|
|
2679
|
+
ke && /* @__PURE__ */ W(pe, {})
|
|
2680
|
+
]
|
|
2681
|
+
}, m.id)
|
|
2682
|
+
] });
|
|
2683
|
+
}, (e, t) => e.viewerLanguage !== t.viewerLanguage || e.onOutboundClick !== t.onOutboundClick || e.resolvedOutbound?.id !== t.resolvedOutbound?.id || e.resolvedOutbound?.name !== t.resolvedOutbound?.name ? !1 : oe(e, t)), mi = (e) => {
|
|
2684
|
+
let t = H("CustomMessage"), n = u(Jt), r = t.message.metadata?.outbound_id, i = typeof r == "string" ? n?.[r] : void 0;
|
|
2685
|
+
return /* @__PURE__ */ W(pi, {
|
|
2686
|
+
...t,
|
|
2687
|
+
...e,
|
|
2688
|
+
resolvedOutbound: i
|
|
2689
|
+
});
|
|
2690
|
+
}, hi = () => {
|
|
2691
|
+
let { handleDelete: e, message: t } = H("CustomMessageActions");
|
|
2692
|
+
return t.metadata?.payment_status === "paid" ? null : /* @__PURE__ */ W(Je, {
|
|
2693
|
+
onClick: e,
|
|
2694
|
+
"aria-label": "Delete",
|
|
2695
|
+
title: "Delete",
|
|
2696
|
+
className: "bg-marble rounded-full p-2 hover:bg-sand transition-all",
|
|
2697
|
+
children: /* @__PURE__ */ W(We, {
|
|
2698
|
+
size: 16,
|
|
2699
|
+
weight: "light",
|
|
2700
|
+
"aria-hidden": !0
|
|
2701
|
+
})
|
|
2702
|
+
});
|
|
2703
|
+
}, gi = () => {
|
|
2704
|
+
let { handleFlag: e } = H("CustomMessageActions");
|
|
2705
|
+
return /* @__PURE__ */ W(Je, {
|
|
2706
|
+
onClick: e,
|
|
2707
|
+
"aria-label": "Report",
|
|
2708
|
+
title: "Report",
|
|
2709
|
+
className: "bg-marble rounded-full p-2 hover:bg-sand transition-all",
|
|
2710
|
+
children: /* @__PURE__ */ W(Ne, {
|
|
2711
|
+
size: 16,
|
|
2712
|
+
weight: "light",
|
|
2713
|
+
"aria-hidden": !0
|
|
2714
|
+
})
|
|
2715
|
+
});
|
|
2716
|
+
}, _i = () => {
|
|
2717
|
+
let { message: e } = H("CustomMessageActions");
|
|
2718
|
+
return e.metadata?.custom_type === K.ATTACHMENT ? /* @__PURE__ */ W(Ye, { messageActionSet: [{
|
|
2719
|
+
Component: hi,
|
|
2720
|
+
placement: "quick",
|
|
2721
|
+
type: "delete"
|
|
2722
|
+
}, {
|
|
2723
|
+
Component: gi,
|
|
2724
|
+
placement: "quick",
|
|
2725
|
+
type: "flag"
|
|
2726
|
+
}] }) : null;
|
|
2727
|
+
}, vi = (e) => ({ linkPreviews: Array.from(e.previews.values()).filter((e) => _.previewIsLoaded(e) || _.previewIsLoading(e)) }), yi = () => {
|
|
2728
|
+
let { linkPreviewsManager: e } = ge(), { linkPreviews: t } = be(e.state, vi), n = (t) => {
|
|
2729
|
+
e.dismissPreview(t);
|
|
2730
|
+
};
|
|
2731
|
+
return t.length > 0 ? /* @__PURE__ */ W("div", {
|
|
2732
|
+
className: "messaging-link-preview-list flex flex-col items-stretch w-full gap-2",
|
|
2733
|
+
children: t.map((e) => {
|
|
2734
|
+
let t = _.previewIsLoading(e);
|
|
2735
|
+
return /* @__PURE__ */ W(Rn.Composer, {
|
|
2736
|
+
title: e.title,
|
|
2737
|
+
url: e.og_scrape_url,
|
|
2738
|
+
thumbnailUrl: e.image_url,
|
|
2739
|
+
layout: t || e.image_url ? "featured" : "classic",
|
|
2740
|
+
status: t ? "loading" : "ready",
|
|
2741
|
+
onDismiss: () => n(e.og_scrape_url)
|
|
2742
|
+
}, e.og_scrape_url);
|
|
2743
|
+
})
|
|
2744
|
+
}) : null;
|
|
2745
|
+
}, bi = o.createContext(!1), xi = 200, Si = () => u(bi), Ci = ({ sendMessage: e, disabled: t, ...n }) => /* @__PURE__ */ W("button", {
|
|
2746
|
+
...n,
|
|
2747
|
+
type: "button",
|
|
2748
|
+
"aria-label": "Send",
|
|
2749
|
+
disabled: t,
|
|
2750
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
2751
|
+
onClick: e,
|
|
2752
|
+
children: /* @__PURE__ */ W(De, {
|
|
2753
|
+
weight: "bold",
|
|
2754
|
+
className: "size-4"
|
|
2755
|
+
})
|
|
2756
|
+
}), wi = () => {
|
|
2757
|
+
let e = u(bi), { handleSubmit: t } = ve(), n = _e(), r = e || !n, { SendButton: i = Ci, AttachmentPreviewList: a = x } = he("CustomMessageInput"), s = o.useRef(null);
|
|
2758
|
+
return o.useEffect(() => {
|
|
2759
|
+
let e = s.current;
|
|
2760
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
2761
|
+
let t = new ResizeObserver(() => {
|
|
2762
|
+
e.contains(document.activeElement) && (e.scrollTop = e.scrollHeight);
|
|
2763
|
+
});
|
|
2764
|
+
return t.observe(e), () => t.disconnect();
|
|
2765
|
+
}, []), o.useEffect(() => {
|
|
2766
|
+
let e = s.current;
|
|
2767
|
+
if (!e) return;
|
|
2768
|
+
let t = (e) => {
|
|
2769
|
+
Array.from(e.clipboardData?.items ?? []).some((e) => e.kind === "file") || e.stopPropagation();
|
|
2770
|
+
};
|
|
2771
|
+
return e.addEventListener("paste", t), () => e.removeEventListener("paste", t);
|
|
2772
|
+
}, []), /* @__PURE__ */ G("div", {
|
|
2773
|
+
ref: s,
|
|
2774
|
+
className: "central-container flex flex-col min-w-0 w-full max-h-[calc(var(--messaging-surface-height,100dvh)*0.5)] overflow-y-auto overscroll-contain 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)] [&>:not(.messaging-composer-previews):not(.messaging-composer-row)]:p-2",
|
|
2775
|
+
"data-dd-privacy": "mask",
|
|
2776
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2777
|
+
className: "messaging-composer-previews empty:hidden flex flex-col gap-2 px-2 pt-2",
|
|
2778
|
+
children: [
|
|
2779
|
+
/* @__PURE__ */ W(te, {}),
|
|
2780
|
+
/* @__PURE__ */ W(yi, {}),
|
|
2781
|
+
/* @__PURE__ */ W(a, {})
|
|
2782
|
+
]
|
|
2783
|
+
}), /* @__PURE__ */ G("div", {
|
|
2784
|
+
className: "messaging-composer-row flex items-start",
|
|
2785
|
+
children: [/* @__PURE__ */ W(ie, {
|
|
2786
|
+
"aria-disabled": e || void 0,
|
|
2787
|
+
containerClassName: "min-w-0 flex-1 leading-[0]",
|
|
2788
|
+
className: "w-full resize-none overflow-hidden bg-transparent py-3.5 pl-4 pr-4 outline-none leading-5 placeholder:text-black/30 text-sm",
|
|
2789
|
+
autoFocus: !e,
|
|
2790
|
+
enterKeyHint: "send",
|
|
2791
|
+
maxRows: Infinity,
|
|
2792
|
+
readOnly: e,
|
|
2793
|
+
tabIndex: e ? -1 : void 0
|
|
2794
|
+
}), /* @__PURE__ */ W("div", {
|
|
2795
|
+
className: "sticky bottom-2 mt-auto mb-2 mr-2 shrink-0 pt-2",
|
|
2796
|
+
children: /* @__PURE__ */ W(i, {
|
|
2797
|
+
sendMessage: t,
|
|
2798
|
+
"aria-label": "Send",
|
|
2799
|
+
className: "str-chat__send-button relative flex justify-center items-center rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white focus-ring before:absolute before:-inset-2 before:content-['']",
|
|
2800
|
+
"data-testid": "send-button",
|
|
2801
|
+
disabled: r,
|
|
2802
|
+
type: "button"
|
|
2803
|
+
})
|
|
2804
|
+
})]
|
|
2805
|
+
})]
|
|
2806
|
+
});
|
|
2807
|
+
}, Ti = () => /* @__PURE__ */ G("div", {
|
|
2808
|
+
className: "messaging-composer-backdrop",
|
|
2809
|
+
"aria-hidden": "true",
|
|
2810
|
+
children: [
|
|
2811
|
+
/* @__PURE__ */ W("div", { className: "messaging-composer-backdrop-blur" }),
|
|
2812
|
+
/* @__PURE__ */ W("div", { className: "messaging-composer-backdrop-blur" }),
|
|
2813
|
+
/* @__PURE__ */ W("div", { className: "messaging-composer-backdrop-blur" }),
|
|
2814
|
+
/* @__PURE__ */ W("div", { className: "messaging-composer-backdrop-blur" }),
|
|
2815
|
+
/* @__PURE__ */ W("div", { className: "messaging-composer-backdrop-blur" }),
|
|
2816
|
+
/* @__PURE__ */ W("div", { className: "messaging-composer-backdrop-gradient" })
|
|
2817
|
+
]
|
|
2818
|
+
}), Ei = ({ renderActions: e, renderHeader: t, renderFooter: n, disabled: r = !1, disabledReason: i, composerInput: a }) => {
|
|
2819
|
+
let { channel: s } = V(), c = s?.data?.frozen === !0, l = !!a, u = o.useRef(null);
|
|
2820
|
+
return o.useEffect(() => {
|
|
2821
|
+
if (!l) return;
|
|
2822
|
+
let e = u.current, t = e?.parentElement;
|
|
2823
|
+
if (!e || !t) return;
|
|
2824
|
+
let n = e.offsetHeight, r = () => {
|
|
2825
|
+
let r = e.offsetHeight, i = r > n;
|
|
2826
|
+
n = r;
|
|
2827
|
+
let a = Array.from(t.querySelectorAll(".str-chat__list")).find((e) => e.scrollHeight > e.clientHeight) ?? null, o = a ? a.scrollHeight - a.scrollTop - a.clientHeight < xi : !1;
|
|
2828
|
+
t.style.setProperty("--messaging-composer-height", `${r}px`), i && o && a && (a.scrollTop = a.scrollHeight);
|
|
2829
|
+
};
|
|
2830
|
+
if (r(), typeof ResizeObserver > "u") return;
|
|
2831
|
+
let i = new ResizeObserver(r);
|
|
2832
|
+
return i.observe(e), () => {
|
|
2833
|
+
i.disconnect(), t.style.removeProperty("--messaging-composer-height");
|
|
2834
|
+
};
|
|
2835
|
+
}, [l]), r ? l ? /* @__PURE__ */ G("div", {
|
|
2836
|
+
ref: u,
|
|
2837
|
+
className: "messaging-composer-chrome messaging-composer-chrome--floating",
|
|
2838
|
+
children: [/* @__PURE__ */ W(Ti, {}), /* @__PURE__ */ G("div", {
|
|
2839
|
+
className: "relative z-10 flex flex-col",
|
|
2840
|
+
children: [
|
|
2841
|
+
t?.(),
|
|
2842
|
+
/* @__PURE__ */ W("div", {
|
|
2843
|
+
className: "messaging-composer-locked-panel flex w-full flex-col items-center justify-center gap-3 px-6 py-4",
|
|
2844
|
+
children: i ? /* @__PURE__ */ W("p", {
|
|
2845
|
+
className: "max-w-[345px] text-center text-xs font-normal leading-[1.3] tracking-[0.12px] text-black/40",
|
|
2846
|
+
children: i
|
|
2847
|
+
}) : null
|
|
2848
|
+
}),
|
|
2849
|
+
n?.()
|
|
2850
|
+
]
|
|
2851
|
+
})]
|
|
2852
|
+
}) : /* @__PURE__ */ G(U, { children: [
|
|
2853
|
+
t?.(),
|
|
2854
|
+
/* @__PURE__ */ W("div", {
|
|
2855
|
+
className: "messaging-composer-locked-panel flex w-full flex-col items-center justify-center gap-3 px-6 py-4",
|
|
2856
|
+
children: i ? /* @__PURE__ */ W("p", {
|
|
2857
|
+
className: "max-w-[345px] text-center text-xs font-normal leading-[1.3] tracking-[0.12px] text-black/40",
|
|
2858
|
+
children: i
|
|
2859
|
+
}) : null
|
|
2860
|
+
}),
|
|
2861
|
+
n?.()
|
|
2862
|
+
] }) : l ? /* @__PURE__ */ G("div", {
|
|
2863
|
+
ref: u,
|
|
2864
|
+
className: "messaging-composer-chrome messaging-composer-chrome--floating",
|
|
2865
|
+
children: [/* @__PURE__ */ W(Ti, {}), /* @__PURE__ */ G("div", {
|
|
2866
|
+
className: "relative z-10 flex min-h-0 flex-col",
|
|
2867
|
+
children: [t?.(), /* @__PURE__ */ G("div", {
|
|
2868
|
+
className: "flex min-h-0 flex-col gap-4 p-3 pb-5 md:p-5",
|
|
2869
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2870
|
+
inert: c ? "" : void 0,
|
|
2871
|
+
"aria-disabled": c || void 0,
|
|
2872
|
+
className: "message-input flex min-h-0 items-end gap-4 aria-disabled:opacity-40",
|
|
2873
|
+
children: [e && /* @__PURE__ */ W("div", {
|
|
2874
|
+
className: "flex h-12 shrink-0 items-center justify-center",
|
|
2875
|
+
children: e()
|
|
2876
|
+
}), /* @__PURE__ */ W(bi.Provider, {
|
|
2877
|
+
value: c,
|
|
2878
|
+
children: /* @__PURE__ */ W(N, { Input: a ?? wi })
|
|
2879
|
+
})]
|
|
2880
|
+
}), n?.()]
|
|
2881
|
+
})]
|
|
2882
|
+
})]
|
|
2883
|
+
}) : /* @__PURE__ */ G("div", {
|
|
2884
|
+
className: "flex min-h-0 flex-col gap-4 p-4",
|
|
2885
|
+
children: [
|
|
2886
|
+
t?.(),
|
|
2887
|
+
/* @__PURE__ */ G("div", {
|
|
2888
|
+
inert: c ? "" : void 0,
|
|
2889
|
+
"aria-disabled": c || void 0,
|
|
2890
|
+
className: "message-input flex min-h-0 items-end gap-4 aria-disabled:opacity-40",
|
|
2891
|
+
children: [e && /* @__PURE__ */ W("div", {
|
|
2892
|
+
className: "flex h-12 shrink-0 items-center justify-center",
|
|
2893
|
+
children: e()
|
|
2894
|
+
}), /* @__PURE__ */ W(bi.Provider, {
|
|
2895
|
+
value: c,
|
|
2896
|
+
children: /* @__PURE__ */ W(N, { Input: wi })
|
|
2897
|
+
})]
|
|
2898
|
+
}),
|
|
2899
|
+
n?.()
|
|
2900
|
+
]
|
|
2901
|
+
});
|
|
2902
|
+
}, Di = {
|
|
2903
|
+
SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
|
|
2904
|
+
SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
|
|
2905
|
+
}, Oi = ["SYSTEM_AGE_SAFETY_BLOCKED"], ki = { SYSTEM_AGE_SAFETY_BLOCKED: "This user isn’t able to reply because they don’t meet our age safety guidelines." }, Ai = "age safety guidelines.", ji = "https://linktr.ee/s/about/contact", Mi = (e) => Oi.includes(e), Ni = (e) => Mi(e.metadata?.custom_type), Pi = (e) => {
|
|
2906
|
+
let t = e.metadata?.custom_type;
|
|
2907
|
+
if (Ce(t)) return {
|
|
2908
|
+
kind: "dm-agent",
|
|
2909
|
+
type: t
|
|
2910
|
+
};
|
|
2911
|
+
if (Se(t)) return {
|
|
2912
|
+
kind: "age-safety",
|
|
2913
|
+
type: t
|
|
2914
|
+
};
|
|
2915
|
+
let n = e.dm_agent_system_type;
|
|
2916
|
+
if (Ce(n)) return {
|
|
2917
|
+
kind: "dm-agent",
|
|
2918
|
+
type: n
|
|
2919
|
+
};
|
|
2920
|
+
}, Fi = (e) => {
|
|
2921
|
+
let t = e.indexOf(Ai);
|
|
2922
|
+
if (t === -1) return e;
|
|
2923
|
+
let n = t + 22;
|
|
2924
|
+
return /* @__PURE__ */ G(U, { children: [
|
|
2925
|
+
e.slice(0, t),
|
|
2926
|
+
/* @__PURE__ */ W("a", {
|
|
2927
|
+
href: ji,
|
|
2928
|
+
target: "_blank",
|
|
2929
|
+
rel: "noopener noreferrer",
|
|
2930
|
+
className: "mes-age-safety-system-message__emphasis font-medium text-inherit underline",
|
|
2931
|
+
children: Ai
|
|
2932
|
+
}),
|
|
2933
|
+
e.slice(n)
|
|
2934
|
+
] });
|
|
2935
|
+
}, Ii = (e) => {
|
|
2936
|
+
let t = !Ni(e.message), n = Pi(e.message);
|
|
2937
|
+
if (n?.kind === "dm-agent") {
|
|
2938
|
+
let r = e.message.text?.trim() || Di[n.type];
|
|
2939
|
+
return /* @__PURE__ */ G("div", {
|
|
2940
|
+
className: "str-chat__message--system",
|
|
2941
|
+
"data-testid": "message-system",
|
|
2942
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2943
|
+
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)]",
|
|
2944
|
+
"data-testid": "dm-agent-system-message",
|
|
2945
|
+
"data-dm-agent-system-type": n.type,
|
|
2946
|
+
children: [/* @__PURE__ */ W(Ve, {
|
|
2947
|
+
size: 16,
|
|
2948
|
+
weight: "regular",
|
|
2949
|
+
"aria-hidden": !0,
|
|
2950
|
+
className: "mes-dm-agent-system-message__sparkle shrink-0"
|
|
2951
|
+
}), /* @__PURE__ */ W("p", {
|
|
2952
|
+
className: "mes-dm-agent-system-message__text m-0 text-center text-[14px] font-normal leading-5 tracking-[0.21px]",
|
|
2953
|
+
children: r
|
|
2954
|
+
})]
|
|
2955
|
+
}), !t && /* @__PURE__ */ W(z, { message: e.message })]
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
if (n?.kind === "age-safety") {
|
|
2959
|
+
let r = e.message.text?.trim() || ki[n.type];
|
|
2960
|
+
return /* @__PURE__ */ G("div", {
|
|
2961
|
+
className: "str-chat__message--system",
|
|
2962
|
+
"data-testid": "message-system",
|
|
2963
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2964
|
+
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)]",
|
|
2965
|
+
"data-testid": "age-safety-system-message",
|
|
2966
|
+
"data-age-safety-system-type": n.type,
|
|
2967
|
+
children: [/* @__PURE__ */ W(Re, {
|
|
2968
|
+
size: 24,
|
|
2969
|
+
weight: "duotone",
|
|
2970
|
+
"aria-hidden": !0,
|
|
2971
|
+
className: "mes-age-safety-system-message__icon shrink-0 text-[color:var(--text-warning-on-warning,#894b00)]",
|
|
2972
|
+
"data-testid": "age-safety-system-message-icon"
|
|
2973
|
+
}), /* @__PURE__ */ W("div", {
|
|
2974
|
+
className: "mes-age-safety-system-message__content min-w-0 flex-[1_0_0]",
|
|
2975
|
+
children: /* @__PURE__ */ W("p", {
|
|
2976
|
+
className: "m-0 text-balance text-left text-[12px] font-normal leading-4 tracking-[0.21px] text-[color:var(--text-warning-on-warning,#894b00)]",
|
|
2977
|
+
children: Fi(r)
|
|
2978
|
+
})
|
|
2979
|
+
})]
|
|
2980
|
+
}), !t && /* @__PURE__ */ W(z, { message: e.message })]
|
|
2981
|
+
});
|
|
2982
|
+
}
|
|
2983
|
+
return /* @__PURE__ */ G("div", {
|
|
2984
|
+
className: "str-chat__message--system",
|
|
2985
|
+
"data-testid": "message-system",
|
|
2986
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2987
|
+
className: "str-chat__message--system__text",
|
|
2988
|
+
children: [
|
|
2989
|
+
/* @__PURE__ */ W("div", { className: "str-chat__message--system__line" }),
|
|
2990
|
+
/* @__PURE__ */ W("p", { children: e.message.text }),
|
|
2991
|
+
/* @__PURE__ */ W("div", { className: "str-chat__message--system__line" })
|
|
2992
|
+
]
|
|
2993
|
+
}), !t && /* @__PURE__ */ W(z, { message: e.message })]
|
|
2994
|
+
});
|
|
2995
|
+
}, Li = c(!1), Ri = ({ cx: e, index: t }) => /* @__PURE__ */ W("circle", {
|
|
2996
|
+
cx: e,
|
|
2997
|
+
cy: "6.15",
|
|
2998
|
+
r: "3.9",
|
|
2999
|
+
fill: "#A0A0A0",
|
|
3000
|
+
children: /* @__PURE__ */ W("animateTransform", {
|
|
3001
|
+
attributeName: "transform",
|
|
3002
|
+
type: "translate",
|
|
3003
|
+
values: "0 0; 0 -2.25; 0 0;",
|
|
3004
|
+
dur: "900ms",
|
|
3005
|
+
begin: `${120 * t}ms`,
|
|
3006
|
+
repeatCount: "indefinite"
|
|
3007
|
+
})
|
|
3008
|
+
}), zi = /* @__PURE__ */ new Set([
|
|
3009
|
+
y.Thinking,
|
|
3010
|
+
y.Generating,
|
|
3011
|
+
y.ExternalSources
|
|
3012
|
+
]), Bi = ({ threadList: e }) => {
|
|
3013
|
+
let { channel: t, channelConfig: n, thread: r } = V(), { client: i } = me(), { typing: a = {} } = xe(), { aiState: o } = fe(t), s = u(Li);
|
|
3014
|
+
if (!e && s && zi.has(o)) {
|
|
3015
|
+
let e = Hi(t, i.user?.id);
|
|
3016
|
+
return /* @__PURE__ */ W(Vi, {
|
|
3017
|
+
avatarId: e?.id ?? "ai-agent",
|
|
3018
|
+
avatarName: e?.name ?? e?.id ?? "Agent",
|
|
3019
|
+
avatarImage: e?.image,
|
|
3020
|
+
testId: "typing-indicator-ai"
|
|
3021
|
+
});
|
|
3022
|
+
}
|
|
3023
|
+
if (n?.typing_events === !1) return null;
|
|
3024
|
+
let c = e ? [] : Object.values(a).filter(({ parent_id: e, user: t }) => t?.id !== i.user?.id && !e), l = e ? Object.values(a).filter(({ parent_id: e, user: t }) => t?.id !== i.user?.id && e === r?.id) : [], d = e ? l : c;
|
|
3025
|
+
if (!d.length) return null;
|
|
3026
|
+
let f = d[0]?.user, p = f?.id && t.state.members[f.id] ? t.state.members[f.id].user : void 0;
|
|
3027
|
+
return /* @__PURE__ */ W(Vi, {
|
|
3028
|
+
avatarId: f?.id ?? p?.id ?? "typing-user",
|
|
3029
|
+
avatarName: f?.name ?? p?.name ?? f?.id ?? "Typing user",
|
|
3030
|
+
avatarImage: f?.image ?? p?.image,
|
|
3031
|
+
testId: "typing-indicator"
|
|
3032
|
+
});
|
|
3033
|
+
}, Vi = ({ avatarId: e, avatarName: t, avatarImage: n, testId: r }) => /* @__PURE__ */ W("div", {
|
|
3034
|
+
className: "str-chat__li str-chat__li--single str-chat__typing-indicator !static",
|
|
3035
|
+
"data-testid": r,
|
|
3036
|
+
style: { marginBottom: "var(--messaging-channel-input-spacer-height, 80px)" },
|
|
3037
|
+
children: /* @__PURE__ */ G("div", {
|
|
3038
|
+
className: "str-chat__message str-chat__message-simple str-chat__message--regular str-chat__message--received str-chat__message--other str-chat__message--has-text",
|
|
3039
|
+
children: [/* @__PURE__ */ W(gt, {
|
|
3040
|
+
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
3041
|
+
id: e,
|
|
3042
|
+
name: t,
|
|
3043
|
+
image: n ?? void 0,
|
|
3044
|
+
size: 24,
|
|
3045
|
+
shape: "circle"
|
|
3046
|
+
}), /* @__PURE__ */ W("div", {
|
|
3047
|
+
className: "str-chat__message-inner mx-0",
|
|
3048
|
+
children: /* @__PURE__ */ W("div", {
|
|
3049
|
+
className: "str-chat__message-bubble-wrapper",
|
|
3050
|
+
children: /* @__PURE__ */ G("div", {
|
|
3051
|
+
className: "str-chat__message-bubble relative isolate",
|
|
3052
|
+
children: [/* @__PURE__ */ W("div", {
|
|
3053
|
+
className: "str-chat__message-text min-h-11 flex items-center",
|
|
3054
|
+
children: /* @__PURE__ */ W("div", {
|
|
3055
|
+
className: "str-chat__message-text-inner str-chat__message-simple-text-inner",
|
|
3056
|
+
children: /* @__PURE__ */ G("svg", {
|
|
3057
|
+
"aria-hidden": "true",
|
|
3058
|
+
className: "block overflow-visible",
|
|
3059
|
+
viewBox: "0 0 32 12.3",
|
|
3060
|
+
width: "32",
|
|
3061
|
+
height: "13",
|
|
3062
|
+
overflow: "visible",
|
|
3063
|
+
children: [
|
|
3064
|
+
/* @__PURE__ */ W(Ri, {
|
|
3065
|
+
cx: "4",
|
|
3066
|
+
index: 0
|
|
3067
|
+
}),
|
|
3068
|
+
/* @__PURE__ */ W(Ri, {
|
|
3069
|
+
cx: "16",
|
|
3070
|
+
index: 1
|
|
3071
|
+
}),
|
|
3072
|
+
/* @__PURE__ */ W(Ri, {
|
|
3073
|
+
cx: "28",
|
|
3074
|
+
index: 2
|
|
3075
|
+
})
|
|
3076
|
+
]
|
|
3077
|
+
})
|
|
3078
|
+
})
|
|
3079
|
+
}), /* @__PURE__ */ W(qt, { side: "other" })]
|
|
3080
|
+
})
|
|
3081
|
+
})
|
|
3082
|
+
})]
|
|
3083
|
+
})
|
|
3084
|
+
});
|
|
3085
|
+
function Hi(e, t) {
|
|
3086
|
+
let n = e?.state?.members ?? {};
|
|
3087
|
+
for (let e of Object.values(n)) {
|
|
3088
|
+
let n = e?.user;
|
|
3089
|
+
if (n && n.id !== t) return n;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
//#endregion
|
|
3093
|
+
//#region src/components/MessagingShell/ChannelEmptyState.tsx
|
|
3094
|
+
var Ui = () => null, Wi = ({ className: e, message: t }) => /* @__PURE__ */ G("div", {
|
|
3095
|
+
className: Y("flex items-center justify-center h-full", e),
|
|
3096
|
+
children: [/* @__PURE__ */ G("svg", {
|
|
3097
|
+
viewBox: "0 0 100 100",
|
|
3098
|
+
className: "size-8 fill-pebble",
|
|
3099
|
+
stroke: "none",
|
|
3100
|
+
children: [
|
|
3101
|
+
/* @__PURE__ */ W("circle", {
|
|
3102
|
+
cx: "6",
|
|
3103
|
+
cy: "50",
|
|
3104
|
+
r: "6",
|
|
3105
|
+
children: /* @__PURE__ */ W("animateTransform", {
|
|
3106
|
+
attributeName: "transform",
|
|
3107
|
+
dur: "1s",
|
|
3108
|
+
type: "translate",
|
|
3109
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
3110
|
+
repeatCount: "indefinite",
|
|
3111
|
+
begin: "0.1"
|
|
3112
|
+
})
|
|
3113
|
+
}),
|
|
3114
|
+
/* @__PURE__ */ W("circle", {
|
|
3115
|
+
cx: "30",
|
|
3116
|
+
cy: "50",
|
|
3117
|
+
r: "6",
|
|
3118
|
+
children: /* @__PURE__ */ W("animateTransform", {
|
|
3119
|
+
attributeName: "transform",
|
|
3120
|
+
dur: "1s",
|
|
3121
|
+
type: "translate",
|
|
3122
|
+
values: "0 10 ; 0 -10; 0 10",
|
|
3123
|
+
repeatCount: "indefinite",
|
|
3124
|
+
begin: "0.2"
|
|
3125
|
+
})
|
|
3126
|
+
}),
|
|
3127
|
+
/* @__PURE__ */ W("circle", {
|
|
3128
|
+
cx: "54",
|
|
3129
|
+
cy: "50",
|
|
3130
|
+
r: "6",
|
|
3131
|
+
children: /* @__PURE__ */ W("animateTransform", {
|
|
3132
|
+
attributeName: "transform",
|
|
3133
|
+
dur: "1s",
|
|
3134
|
+
type: "translate",
|
|
3135
|
+
values: "0 5 ; 0 -5; 0 5",
|
|
3136
|
+
repeatCount: "indefinite",
|
|
3137
|
+
begin: "0.3"
|
|
3138
|
+
})
|
|
3139
|
+
})
|
|
3140
|
+
]
|
|
3141
|
+
}), t && /* @__PURE__ */ W("span", {
|
|
3142
|
+
className: "text-stone",
|
|
3143
|
+
children: t
|
|
3144
|
+
})]
|
|
3145
|
+
}), Gi = o.memo(() => /* @__PURE__ */ W("div", {
|
|
3146
|
+
className: "messaging-loading-state flex items-center justify-center h-full",
|
|
3147
|
+
children: /* @__PURE__ */ G("div", {
|
|
3148
|
+
className: "flex items-center",
|
|
3149
|
+
children: [/* @__PURE__ */ W(Wi, { className: "w-6 h-6" }), /* @__PURE__ */ W("span", {
|
|
3150
|
+
className: "text-sm text-stone",
|
|
3151
|
+
children: "Loading messages"
|
|
3152
|
+
})]
|
|
3153
|
+
})
|
|
3154
|
+
}));
|
|
3155
|
+
Gi.displayName = "LoadingState";
|
|
3156
|
+
//#endregion
|
|
3157
|
+
//#region src/components/ChannelView.tsx
|
|
3158
|
+
var Ki = ({ onBack: e, showBackButton: t, renderMessageInputActions: n, renderMessageInputFooter: r, renderConversationFooter: i, onLeaveConversation: a, onBlockParticipant: s, showDeleteConversation: c = !0, onDeleteConversationClick: u, onBlockParticipantClick: f, onReportParticipantClick: p, showBlockParticipant: h = !0, showReportParticipant: g = !0, composerDisabled: _ = !1, composerDisabledReason: v, showStarButton: y = !1, renderChannelBanner: b, customChannelActions: x, renderChannelActions: S, renderMessage: C, viewerLanguage: w, showChannelInfo: T = !0, onParticipantNameClick: E, onOutboundClick: D, resolveOutbound: O, composerInput: k }) => {
|
|
3159
|
+
let { channel: A, messages: j } = V(), M = m(D);
|
|
3160
|
+
d(() => {
|
|
3161
|
+
M.current = D;
|
|
3162
|
+
}, [D]);
|
|
3163
|
+
let N = l((e) => {
|
|
3164
|
+
M.current?.(e);
|
|
3165
|
+
}, []), P = D ? N : void 0, I = Qt(j, O), L = A.state.messages.some((e) => e.type !== "deleted"), R = b ? /* @__PURE__ */ W(o.Fragment, { children: b() }, "lt-channel-banner") : null, z = /* @__PURE__ */ W(wt, {
|
|
3166
|
+
className: "-mx-[var(--str-chat\\_\\_spacing-2)] px-[var(--str-chat\\_\\_spacing-2)] md:-mx-[min(var(--str-chat\\_\\_spacing-10),4%)] md:px-[min(var(--str-chat\\_\\_spacing-10),4%)]",
|
|
3167
|
+
onBack: e,
|
|
3168
|
+
showBackButton: t,
|
|
3169
|
+
showChannelInfo: T,
|
|
3170
|
+
showStarButton: y,
|
|
3171
|
+
onLeaveConversation: a,
|
|
3172
|
+
onBlockParticipant: s,
|
|
3173
|
+
showDeleteConversation: c,
|
|
3174
|
+
showBlockParticipant: h,
|
|
3175
|
+
showReportParticipant: g,
|
|
3176
|
+
onDeleteConversationClick: u,
|
|
3177
|
+
onBlockParticipantClick: f,
|
|
3178
|
+
onReportParticipantClick: p,
|
|
3179
|
+
customChannelActions: x,
|
|
3180
|
+
renderChannelActions: S,
|
|
3181
|
+
onParticipantNameClick: E
|
|
3182
|
+
}), ee = l((e) => {
|
|
3183
|
+
let { message: t } = H("ChannelView"), n = /* @__PURE__ */ W(mi, {
|
|
3184
|
+
...e,
|
|
3185
|
+
viewerLanguage: w,
|
|
3186
|
+
onOutboundClick: P
|
|
3187
|
+
});
|
|
3188
|
+
return !C || !t ? n : C(n, t);
|
|
3189
|
+
}, [
|
|
3190
|
+
P,
|
|
3191
|
+
C,
|
|
3192
|
+
w
|
|
3193
|
+
]);
|
|
3194
|
+
return /* @__PURE__ */ W(Jt.Provider, {
|
|
3195
|
+
value: I,
|
|
3196
|
+
children: /* @__PURE__ */ W(ae, {
|
|
3197
|
+
overrides: {
|
|
3198
|
+
Message: ee,
|
|
3199
|
+
MessageActions: _i,
|
|
3200
|
+
UnreadMessagesNotification: () => null,
|
|
3201
|
+
UnreadMessagesSeparator: () => null
|
|
3202
|
+
},
|
|
3203
|
+
children: /* @__PURE__ */ W(B, { children: k ? /* @__PURE__ */ G("div", {
|
|
3204
|
+
className: "messaging-channel-layout relative flex min-h-0 flex-1 flex-col",
|
|
3205
|
+
children: [/* @__PURE__ */ G("div", {
|
|
3206
|
+
className: "messaging-channel-message-list messaging-channel-message-list--floating relative min-h-0 flex-1 overflow-hidden",
|
|
3207
|
+
children: [!L && /* @__PURE__ */ W("div", {
|
|
3208
|
+
className: "str-chat__list",
|
|
3209
|
+
children: /* @__PURE__ */ G("div", {
|
|
3210
|
+
className: "str-chat__message-list-scroll",
|
|
3211
|
+
children: [z, R]
|
|
3212
|
+
})
|
|
3213
|
+
}), /* @__PURE__ */ W(F, {
|
|
3214
|
+
head: L ? /* @__PURE__ */ G("div", {
|
|
3215
|
+
className: "sticky top-0 z-10",
|
|
3216
|
+
children: [z, R]
|
|
3217
|
+
}) : void 0,
|
|
3218
|
+
hideDeletedMessages: !0,
|
|
3219
|
+
hideNewMessageSeparator: !1
|
|
3220
|
+
})]
|
|
3221
|
+
}, "lt-channel-message-list"), /* @__PURE__ */ W(Ei, {
|
|
3222
|
+
...n && { renderActions: () => n?.(A) },
|
|
3223
|
+
...i && { renderHeader: () => i(A) },
|
|
3224
|
+
renderFooter: () => r?.(A),
|
|
3225
|
+
disabled: _,
|
|
3226
|
+
disabledReason: v,
|
|
3227
|
+
composerInput: k
|
|
3228
|
+
}, "lt-channel-message-input")]
|
|
3229
|
+
}) : /* @__PURE__ */ G(U, { children: [
|
|
3230
|
+
/* @__PURE__ */ G("div", {
|
|
3231
|
+
className: "flex-1 overflow-hidden relative",
|
|
3232
|
+
children: [!L && /* @__PURE__ */ W("div", {
|
|
3233
|
+
className: "str-chat__list",
|
|
3234
|
+
children: /* @__PURE__ */ G("div", {
|
|
3235
|
+
className: "str-chat__message-list-scroll",
|
|
3236
|
+
children: [z, R]
|
|
3237
|
+
})
|
|
3238
|
+
}), /* @__PURE__ */ W(F, {
|
|
3239
|
+
head: L ? /* @__PURE__ */ G("div", {
|
|
3240
|
+
className: "sticky top-0 z-10",
|
|
3241
|
+
children: [z, R]
|
|
3242
|
+
}) : void 0,
|
|
3243
|
+
hideDeletedMessages: !0,
|
|
3244
|
+
hideNewMessageSeparator: !1
|
|
3245
|
+
})]
|
|
3246
|
+
}, "lt-channel-message-list"),
|
|
3247
|
+
i ? /* @__PURE__ */ W(o.Fragment, { children: i(A) }, "lt-channel-conversation-footer") : null,
|
|
3248
|
+
/* @__PURE__ */ W(Ei, {
|
|
3249
|
+
...n && { renderActions: () => n?.(A) },
|
|
3250
|
+
renderFooter: () => r?.(A),
|
|
3251
|
+
disabled: _,
|
|
3252
|
+
disabledReason: v,
|
|
3253
|
+
composerInput: k
|
|
3254
|
+
}, "lt-channel-message-input")
|
|
3255
|
+
] }) })
|
|
3256
|
+
})
|
|
3257
|
+
});
|
|
3258
|
+
}, qi = o.memo(({ channel: e, onBack: t, showBackButton: n = !1, renderMessageInputActions: r, renderMessageInputFooter: i, renderConversationFooter: a, onLeaveConversation: o, onBlockParticipant: s, className: c, CustomChannelEmptyState: u = Ui, showDeleteConversation: f = !0, onDeleteConversationClick: p, onBlockParticipantClick: h, onReportParticipantClick: g, showBlockParticipant: _ = !0, showReportParticipant: v = !0, composerDisabled: y = !1, composerDisabledReason: b, dmAgentEnabled: x, messageMetadata: C, onMessageSent: w, showStarButton: T = !1, renderChannelBanner: E, customChannelActions: D, renderChannelActions: O, renderMessage: k, onMessageLinkClick: A, sendButton: j, attachmentPreviewList: M, viewerLanguage: N, showChannelInfo: P = !0, onParticipantNameClick: F, onOutboundClick: I, resolveOutbound: L, composerInput: R }) => {
|
|
3259
|
+
let z = l(async (t, n, r) => {
|
|
3260
|
+
let i = e.data?.chatbot_paused === !0, a = x && !i, o = {
|
|
3261
|
+
...n,
|
|
3262
|
+
...a && { silent: !0 },
|
|
3263
|
+
...C && { metadata: {
|
|
3264
|
+
...n.metadata ?? {},
|
|
3265
|
+
...C
|
|
3266
|
+
} }
|
|
3267
|
+
}, s = {
|
|
3268
|
+
...r,
|
|
3269
|
+
...a && { skip_push: !0 }
|
|
3270
|
+
}, c = await e.sendMessage(o, s);
|
|
3271
|
+
return w?.(c), c;
|
|
3272
|
+
}, [
|
|
3273
|
+
e,
|
|
3274
|
+
x,
|
|
3275
|
+
C,
|
|
3276
|
+
w
|
|
3277
|
+
]), ee = m(null);
|
|
3278
|
+
d(() => {
|
|
3279
|
+
if (!A) return;
|
|
3280
|
+
let t = ee.current;
|
|
3281
|
+
if (!t) return;
|
|
3282
|
+
let n = (t) => {
|
|
3283
|
+
let n = t.target?.closest("a[href]"), r = n?.getAttribute("href");
|
|
3284
|
+
if (!r) return;
|
|
3285
|
+
let i = (n?.closest("[data-message-id]"))?.getAttribute("data-message-id");
|
|
3286
|
+
A(r, i ? e.state.messages.find((e) => e.id === i) : void 0);
|
|
3287
|
+
};
|
|
3288
|
+
return t.addEventListener("click", n), () => t.removeEventListener("click", n);
|
|
3289
|
+
}, [A, e]);
|
|
3290
|
+
let te = we(e.type) ? { "--lt-msg-card-width": "368px" } : void 0;
|
|
3291
|
+
return /* @__PURE__ */ W("div", {
|
|
3292
|
+
ref: ee,
|
|
3293
|
+
className: Y("messaging-channel-view h-full flex flex-col", c),
|
|
3294
|
+
style: te,
|
|
3295
|
+
children: /* @__PURE__ */ W(Li.Provider, {
|
|
3296
|
+
value: x ?? !1,
|
|
3297
|
+
children: /* @__PURE__ */ W(S, {
|
|
3298
|
+
channel: e,
|
|
3299
|
+
MessageSystem: Ii,
|
|
3300
|
+
EmptyStateIndicator: u,
|
|
3301
|
+
LoadingIndicator: Gi,
|
|
3302
|
+
DateSeparator: Tt,
|
|
3303
|
+
TypingIndicator: Bi,
|
|
3304
|
+
doSendMessageRequest: z,
|
|
3305
|
+
...j ? { SendButton: j } : {},
|
|
3306
|
+
...M ? { AttachmentPreviewList: M } : {},
|
|
3307
|
+
children: /* @__PURE__ */ W(Ki, {
|
|
3308
|
+
onBack: t,
|
|
3309
|
+
showBackButton: n,
|
|
3310
|
+
renderMessageInputActions: r,
|
|
3311
|
+
renderMessageInputFooter: i,
|
|
3312
|
+
renderConversationFooter: a,
|
|
3313
|
+
onLeaveConversation: o,
|
|
3314
|
+
onBlockParticipant: s,
|
|
3315
|
+
CustomChannelEmptyState: u,
|
|
3316
|
+
showDeleteConversation: f,
|
|
3317
|
+
onDeleteConversationClick: p,
|
|
3318
|
+
onBlockParticipantClick: h,
|
|
3319
|
+
onReportParticipantClick: g,
|
|
3320
|
+
showBlockParticipant: _,
|
|
3321
|
+
showReportParticipant: v,
|
|
3322
|
+
composerDisabled: y,
|
|
3323
|
+
composerDisabledReason: b,
|
|
3324
|
+
showStarButton: T,
|
|
3325
|
+
renderChannelBanner: E,
|
|
3326
|
+
customChannelActions: D,
|
|
3327
|
+
renderChannelActions: O,
|
|
3328
|
+
renderMessage: k,
|
|
3329
|
+
viewerLanguage: N,
|
|
3330
|
+
showChannelInfo: P,
|
|
3331
|
+
onParticipantNameClick: F,
|
|
3332
|
+
onOutboundClick: I,
|
|
3333
|
+
resolveOutbound: L,
|
|
3334
|
+
composerInput: R
|
|
3335
|
+
})
|
|
3336
|
+
})
|
|
3337
|
+
})
|
|
3338
|
+
});
|
|
3339
|
+
});
|
|
3340
|
+
qi.displayName = "ChannelView";
|
|
3341
|
+
//#endregion
|
|
3342
|
+
//#region src/components/MessagingShell/ErrorState.tsx
|
|
3343
|
+
var Ji = o.memo(({ message: e, onBack: t }) => /* @__PURE__ */ W("div", {
|
|
3344
|
+
className: "messaging-error-state flex items-center justify-center h-full p-8",
|
|
3345
|
+
children: /* @__PURE__ */ G("div", {
|
|
3346
|
+
className: "text-center max-w-sm",
|
|
3347
|
+
children: [
|
|
3348
|
+
/* @__PURE__ */ W("div", {
|
|
3349
|
+
className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6",
|
|
3350
|
+
children: /* @__PURE__ */ W("span", {
|
|
3351
|
+
className: "text-4xl",
|
|
3352
|
+
children: "⚠️"
|
|
3353
|
+
})
|
|
3354
|
+
}),
|
|
3355
|
+
/* @__PURE__ */ W("h2", {
|
|
3356
|
+
className: "font-semibold text-charcoal mb-2",
|
|
3357
|
+
children: "Oops!"
|
|
3358
|
+
}),
|
|
3359
|
+
/* @__PURE__ */ W("p", {
|
|
3360
|
+
className: "text-stone text-sm mb-6",
|
|
3361
|
+
children: e
|
|
3362
|
+
}),
|
|
3363
|
+
t && /* @__PURE__ */ W("button", {
|
|
3364
|
+
type: "button",
|
|
3365
|
+
onClick: t,
|
|
3366
|
+
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",
|
|
3367
|
+
children: "Go Back"
|
|
3368
|
+
})
|
|
3369
|
+
]
|
|
3370
|
+
})
|
|
3371
|
+
}));
|
|
3372
|
+
Ji.displayName = "ErrorState";
|
|
3373
|
+
//#endregion
|
|
3374
|
+
//#region src/components/MessagingShell/index.tsx
|
|
3375
|
+
var Yi = ({ capabilities: e = {}, renderMessageInputActions: t, renderConversationFooter: n, onChannelSelect: r, onExitConversation: i, initialParticipantFilter: a, initialParticipantData: o, CustomChannelEmptyState: s, onBlockParticipantClick: c, onReportParticipantClick: u, dmAgentEnabled: f, onMessageSent: p, viewerLanguage: g, renderChannelBanner: _, customChannelActions: v, renderChannelActions: y, onParticipantNameClick: b, onOutboundClick: x, resolveOutbound: S, renderMessage: C, onMessageLinkClick: w, showChannelInfo: T, composerInput: E, attachmentPreviewList: D }) => {
|
|
3376
|
+
let { client: O, isConnected: k, isLoading: A, error: j, refreshConnection: M, service: N, debug: P } = it(), [F, I] = h(null), [L, R] = h(null), [z, ee] = h(!1), { showDeleteConversation: te = !0 } = e, ne = m(o);
|
|
3377
|
+
ne.current = o;
|
|
3378
|
+
let re = m(r);
|
|
3379
|
+
re.current = r;
|
|
3380
|
+
let ie = m(null), B = m(null);
|
|
3381
|
+
d(() => {
|
|
3382
|
+
B.current = F;
|
|
3383
|
+
}, [F]), d(() => {
|
|
3384
|
+
if (!O || !k) return;
|
|
3385
|
+
let e = O.userID;
|
|
3386
|
+
if (!e) return;
|
|
3387
|
+
let t = `${e}::${a}`;
|
|
3388
|
+
if (ie.current === t) return;
|
|
3389
|
+
ie.current = t;
|
|
3390
|
+
let n = () => {
|
|
3391
|
+
ie.current === t && (ie.current = null);
|
|
3392
|
+
};
|
|
3393
|
+
(async () => {
|
|
3394
|
+
try {
|
|
3395
|
+
P && console.log("[MessagingShell] Loading initial conversation with:", a);
|
|
3396
|
+
let t = await O.queryChannels({
|
|
3397
|
+
type: "messaging",
|
|
3398
|
+
members: { $eq: [e, a] }
|
|
3399
|
+
}, {}, { limit: 1 });
|
|
3400
|
+
if (t.length > 0) {
|
|
3401
|
+
I(t[0]), R(null), re.current?.(t[0]), P && console.log("[MessagingShell] Initial conversation loaded:", t[0].id);
|
|
3402
|
+
return;
|
|
3403
|
+
}
|
|
3404
|
+
let r = ne.current;
|
|
3405
|
+
if (!r || !N) {
|
|
3406
|
+
n(), R("No conversation found with this account"), P && console.log("[MessagingShell] No conversation found for:", a);
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3409
|
+
try {
|
|
3410
|
+
let e = await N.startChannelWithParticipant({
|
|
3411
|
+
id: r.id,
|
|
3412
|
+
name: r.name,
|
|
3413
|
+
phone: r.phone
|
|
3414
|
+
});
|
|
3415
|
+
I(e), R(null), re.current?.(e), P && console.log("[MessagingShell] Channel created and loaded:", e.id);
|
|
3416
|
+
} catch (e) {
|
|
3417
|
+
console.error("[MessagingShell] Failed to create conversation:", e), n(), R("Failed to create conversation");
|
|
3418
|
+
}
|
|
3419
|
+
} catch (e) {
|
|
3420
|
+
console.error("[MessagingShell] Failed to load initial conversation:", e), n(), B.current || R("Failed to load conversation");
|
|
3421
|
+
}
|
|
3422
|
+
})();
|
|
3423
|
+
}, [
|
|
3424
|
+
a,
|
|
3425
|
+
O,
|
|
3426
|
+
k,
|
|
3427
|
+
N,
|
|
3428
|
+
P
|
|
3429
|
+
]);
|
|
3430
|
+
let ae = m(i);
|
|
3431
|
+
ae.current = i;
|
|
3432
|
+
let oe = l(() => {
|
|
3433
|
+
I(null), ee(!0), ae.current?.();
|
|
3434
|
+
}, []);
|
|
3435
|
+
return A ? /* @__PURE__ */ W(Gi, {}) : j ? /* @__PURE__ */ W(Ji, {
|
|
3436
|
+
message: j,
|
|
3437
|
+
onBack: M
|
|
3438
|
+
}) : !k || !O ? /* @__PURE__ */ W(Ji, {
|
|
3439
|
+
message: "Not connected to messaging service",
|
|
3440
|
+
onBack: M
|
|
3441
|
+
}) : L ? /* @__PURE__ */ W(Ji, { message: L }) : z && !F ? /* @__PURE__ */ W(Ji, { message: "Conversation ended" }) : F ? /* @__PURE__ */ W("div", {
|
|
3442
|
+
className: "messaging-shell h-full bg-background-primary overflow-hidden",
|
|
3443
|
+
children: /* @__PURE__ */ W("div", {
|
|
3444
|
+
className: "flex h-full min-h-0 flex-col",
|
|
3445
|
+
children: /* @__PURE__ */ W(qi, {
|
|
3446
|
+
channel: F,
|
|
3447
|
+
renderMessageInputActions: t,
|
|
3448
|
+
renderConversationFooter: n,
|
|
3449
|
+
renderChannelBanner: _,
|
|
3450
|
+
onLeaveConversation: oe,
|
|
3451
|
+
onBlockParticipant: oe,
|
|
3452
|
+
CustomChannelEmptyState: s,
|
|
3453
|
+
showDeleteConversation: te,
|
|
3454
|
+
onBlockParticipantClick: c,
|
|
3455
|
+
onReportParticipantClick: u,
|
|
3456
|
+
dmAgentEnabled: f,
|
|
3457
|
+
onMessageSent: p,
|
|
3458
|
+
viewerLanguage: g,
|
|
3459
|
+
customChannelActions: v,
|
|
3460
|
+
renderChannelActions: y,
|
|
3461
|
+
onParticipantNameClick: b,
|
|
3462
|
+
onOutboundClick: x,
|
|
3463
|
+
resolveOutbound: S,
|
|
3464
|
+
renderMessage: C,
|
|
3465
|
+
onMessageLinkClick: w,
|
|
3466
|
+
showChannelInfo: T,
|
|
3467
|
+
composerInput: E,
|
|
3468
|
+
attachmentPreviewList: D
|
|
3469
|
+
}, F.id)
|
|
3470
|
+
})
|
|
3471
|
+
}) : /* @__PURE__ */ W(Gi, {});
|
|
3472
|
+
};
|
|
3473
|
+
//#endregion
|
|
3474
|
+
//#region src/hooks/useRestorePendingMessages.ts
|
|
3475
|
+
function Xi(e) {
|
|
3476
|
+
let t = e.state.pending_messages;
|
|
3477
|
+
if (t?.length) for (let n of t) e.state.addMessageSorted(n.message);
|
|
3478
|
+
}
|
|
3479
|
+
//#endregion
|
|
3480
|
+
//#region src/components/ChannelList/ChannelListContext.tsx
|
|
3481
|
+
var Zi = o.createContext({
|
|
3482
|
+
selectedChannel: void 0,
|
|
3483
|
+
onChannelSelect: () => {},
|
|
3484
|
+
debug: !1,
|
|
3485
|
+
renderMessagePreview: void 0,
|
|
3486
|
+
channelPreview: void 0,
|
|
3487
|
+
viewerLanguage: void 0
|
|
3488
|
+
}), Qi = Zi.Provider, $i = () => o.useContext(Zi), ea = (e, t) => {
|
|
3489
|
+
let n = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()), r = Date.UTC(t.getFullYear(), t.getMonth(), t.getDate());
|
|
3490
|
+
return Math.floor((r - n) / 864e5);
|
|
3491
|
+
}, ta = (e) => {
|
|
3492
|
+
let t = /* @__PURE__ */ new Date();
|
|
3493
|
+
if (Math.floor((t.getTime() - e.getTime()) / 1e3) < 60) return "Just now";
|
|
3494
|
+
let n = ea(e, t);
|
|
3495
|
+
return n === 0 ? e.toLocaleTimeString([], {
|
|
3496
|
+
hour: "numeric",
|
|
3497
|
+
minute: "2-digit",
|
|
3498
|
+
hour12: !0
|
|
3499
|
+
}) : n === 1 ? "Yesterday" : n < 7 ? e.toLocaleDateString(void 0, { weekday: "short" }) : e.getFullYear() === t.getFullYear() ? e.toLocaleDateString(void 0, {
|
|
3500
|
+
month: "short",
|
|
3501
|
+
day: "numeric"
|
|
3502
|
+
}) : e.toLocaleDateString(void 0, {
|
|
3503
|
+
month: "short",
|
|
3504
|
+
day: "numeric",
|
|
3505
|
+
year: "numeric"
|
|
3506
|
+
});
|
|
3507
|
+
}, na = o.memo((e) => {
|
|
3508
|
+
let { channel: t, unread: n } = e, { selectedChannel: r, onChannelSelect: i, debug: a, channelPreview: o, renderMessagePreview: s, viewerLanguage: c } = $i(), { client: l } = me(), u = r?.id === t?.id, d = at(t);
|
|
3509
|
+
if (o) return /* @__PURE__ */ W(o, {
|
|
3510
|
+
...e,
|
|
3511
|
+
active: u,
|
|
3512
|
+
selectedChannel: r,
|
|
3513
|
+
onChannelSelect: i,
|
|
3514
|
+
viewerLanguage: c
|
|
3515
|
+
});
|
|
3516
|
+
let f = () => {
|
|
3517
|
+
t && i(t);
|
|
3518
|
+
}, p = (e) => {
|
|
3519
|
+
let t = e.key === "Enter" || e.key === " ", n = e.repeat;
|
|
3520
|
+
!t || n || (e.preventDefault(), f());
|
|
3521
|
+
}, m = ot(t?.state?.members, l?.userID, t?.type), h = ut(m?.user), g = m?.user?.image, _ = (() => {
|
|
3522
|
+
let e = t?.state?.messages;
|
|
3523
|
+
if (e?.length) {
|
|
3524
|
+
for (let t = e.length - 1; t >= 0; t--) if (e[t].type !== "system") return e[t];
|
|
3525
|
+
}
|
|
3526
|
+
})(), v = (() => {
|
|
3527
|
+
let e = Dt({
|
|
3528
|
+
message: _,
|
|
3529
|
+
viewerLanguage: c
|
|
3530
|
+
}), { custom_type: t, attachment_content_type: n } = _?.metadata || {};
|
|
3531
|
+
if (t === K.TIP) return e || "Sent a tip";
|
|
3532
|
+
if (t === K.PAID) return e || "Sent a message";
|
|
3533
|
+
if (t === K.ATTACHMENT) {
|
|
3534
|
+
if (n === "text") return "🔒 Sent a locked message";
|
|
3535
|
+
if (n === "media") return "🔒 Sent a locked attachment";
|
|
3536
|
+
}
|
|
3537
|
+
if (e) return e;
|
|
3538
|
+
let r = _?.attachments?.[0];
|
|
3539
|
+
return r ? r.og_scrape_url ? r.og_scrape_url : r.type === "image" ? "📷 Sent an image" : r.type === "video" ? "🎥 Sent a video" : r.type === "audio" ? "🎵 Sent audio" : r.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
|
|
3540
|
+
})(), y = _?.created_at ? ta(new Date(_.created_at)) : "", b = _ ? zt(_) : !1, x = s ? s(_, v) : `${b ? "✨ " : ""}${v}`, S = n ?? 0;
|
|
3541
|
+
return a && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
|
|
3542
|
+
channelId: t?.id,
|
|
3543
|
+
isSelected: u,
|
|
3544
|
+
participantName: h,
|
|
3545
|
+
unreadCount: S,
|
|
3546
|
+
hasTimestamp: !!y
|
|
3547
|
+
}), /* @__PURE__ */ W("div", {
|
|
3548
|
+
role: "button",
|
|
3549
|
+
tabIndex: 0,
|
|
3550
|
+
onClick: f,
|
|
3551
|
+
onKeyDown: p,
|
|
3552
|
+
className: Y("group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring rounded-[12px] [&+&]:mt-2", {
|
|
3553
|
+
"bg-black/[0.04]": u,
|
|
3554
|
+
"hover:bg-black/[0.02]": !u
|
|
3555
|
+
}),
|
|
3556
|
+
"data-dd-privacy": "mask",
|
|
3557
|
+
children: /* @__PURE__ */ G("div", {
|
|
3558
|
+
className: "flex items-start gap-4",
|
|
3559
|
+
children: [/* @__PURE__ */ W(gt, {
|
|
3560
|
+
id: m?.user?.id || t.id || "unknown",
|
|
3561
|
+
name: h,
|
|
3562
|
+
image: g,
|
|
3563
|
+
size: 48,
|
|
3564
|
+
starred: d
|
|
3565
|
+
}), /* @__PURE__ */ G("div", {
|
|
3566
|
+
className: "flex-1 min-w-0 flex flex-col gap-1",
|
|
3567
|
+
children: [/* @__PURE__ */ G("div", {
|
|
3568
|
+
className: "flex items-center justify-between gap-2",
|
|
3569
|
+
children: [/* @__PURE__ */ G("h3", {
|
|
3570
|
+
className: Y("text-sm font-medium truncate text-[#191918]"),
|
|
3571
|
+
children: [d && /* @__PURE__ */ W("span", {
|
|
3572
|
+
className: "sr-only",
|
|
3573
|
+
children: "Starred conversation. "
|
|
3574
|
+
}), h]
|
|
3575
|
+
}), y && /* @__PURE__ */ W("span", {
|
|
3576
|
+
className: "text-xs text-[#717070] flex-shrink-0",
|
|
3577
|
+
children: y
|
|
3578
|
+
})]
|
|
3579
|
+
}), /* @__PURE__ */ G("div", {
|
|
3580
|
+
className: "flex items-center justify-between gap-2 min-w-0",
|
|
3581
|
+
children: [/* @__PURE__ */ W("p", {
|
|
3582
|
+
className: "text-sm text-[#717070] flex-1 line-clamp-1",
|
|
3583
|
+
children: x
|
|
3584
|
+
}), S > 0 && /* @__PURE__ */ W("span", {
|
|
3585
|
+
className: "bg-[#7f22fe] text-white text-[10px] rounded-full h-4 flex items-center justify-center p-1 min-w-4 text-center flex-shrink-0",
|
|
3586
|
+
children: S > 99 ? "99+" : S
|
|
3587
|
+
})]
|
|
3588
|
+
})]
|
|
3589
|
+
})]
|
|
3590
|
+
})
|
|
3591
|
+
});
|
|
3592
|
+
});
|
|
3593
|
+
na.displayName = "CustomChannelPreview";
|
|
3594
|
+
//#endregion
|
|
3595
|
+
//#region src/components/ChannelList/index.tsx
|
|
3596
|
+
var ra = { last_message_at: -1 }, ia = o.memo(({ onChannelSelect: e, selectedChannel: t, filters: n, allowNewMessagesFromUnfilteredChannels: r = !1, channelRenderFilterFn: i, sort: a = ra, className: s, customEmptyStateIndicator: c, channelListPaginator: l = D, channelPreview: u, renderMessagePreview: d, viewerLanguage: f, lockChannelOrder: p, onMessageNewHandler: m, onMessageNew: h, onChannelVisible: g, onAddedToChannel: _, onChannelUpdated: v }) => {
|
|
3597
|
+
let y = o.useRef(0);
|
|
3598
|
+
y.current++;
|
|
3599
|
+
let { debug: b = !1 } = nt(), x = o.useCallback((e) => {
|
|
3600
|
+
for (let t of e) Xi(t);
|
|
3601
|
+
return i ? i(e) : e;
|
|
3602
|
+
}, [i]);
|
|
3603
|
+
b && console.log("📺 [ChannelList] 🔄 RENDER START", {
|
|
3604
|
+
renderCount: y.current,
|
|
3605
|
+
selectedChannelId: t?.id,
|
|
3606
|
+
filters: n
|
|
3607
|
+
});
|
|
3608
|
+
let S = o.useMemo(() => ({
|
|
3609
|
+
selectedChannel: t,
|
|
3610
|
+
onChannelSelect: e,
|
|
3611
|
+
debug: b,
|
|
3612
|
+
channelPreview: u,
|
|
3613
|
+
renderMessagePreview: d,
|
|
3614
|
+
viewerLanguage: f
|
|
3615
|
+
}), [
|
|
3616
|
+
t,
|
|
3617
|
+
e,
|
|
3618
|
+
b,
|
|
3619
|
+
u,
|
|
3620
|
+
d,
|
|
3621
|
+
f
|
|
3622
|
+
]);
|
|
3623
|
+
return /* @__PURE__ */ W("div", {
|
|
3624
|
+
className: Y("messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden", s),
|
|
3625
|
+
children: /* @__PURE__ */ W("div", {
|
|
3626
|
+
className: "flex-1 overflow-hidden min-w-0",
|
|
3627
|
+
children: /* @__PURE__ */ W(Qi, {
|
|
3628
|
+
value: S,
|
|
3629
|
+
children: /* @__PURE__ */ W(C, {
|
|
3630
|
+
filters: n,
|
|
3631
|
+
sort: a,
|
|
3632
|
+
options: { limit: 30 },
|
|
3633
|
+
allowNewMessagesFromUnfilteredChannels: r,
|
|
3634
|
+
channelRenderFilterFn: x,
|
|
3635
|
+
lockChannelOrder: p,
|
|
3636
|
+
onMessageNewHandler: m,
|
|
3637
|
+
onMessageNew: h,
|
|
3638
|
+
onChannelVisible: g,
|
|
3639
|
+
onAddedToChannel: _,
|
|
3640
|
+
onChannelUpdated: v,
|
|
3641
|
+
Paginator: l,
|
|
3642
|
+
Preview: na,
|
|
3643
|
+
EmptyStateIndicator: c
|
|
3644
|
+
}, `${JSON.stringify(n)}:${JSON.stringify(a)}`)
|
|
3645
|
+
})
|
|
3646
|
+
})
|
|
3647
|
+
});
|
|
3648
|
+
});
|
|
3649
|
+
ia.displayName = "ChannelList";
|
|
3650
|
+
//#endregion
|
|
3651
|
+
//#region src/components/RichCard/RichCardBody.tsx
|
|
3652
|
+
var aa = "line-clamp-2 text-[14px] font-medium leading-5 tracking-[0.28px] [text-wrap:balance]", oa = "text-[12px] leading-4 tracking-[0.24px] [text-wrap:pretty]", sa = ({ surface: e, actions: t, layout: n }) => {
|
|
3653
|
+
if (t == null || t.length === 0) return null;
|
|
3654
|
+
let r = n === "stacked";
|
|
3655
|
+
return /* @__PURE__ */ W("div", {
|
|
3656
|
+
className: Y("flex gap-2", r ? "mt-3 flex-col" : "min-w-0 max-w-[60%] flex-row flex-wrap justify-end"),
|
|
3657
|
+
children: t.map((t, n) => /* @__PURE__ */ W(fn, {
|
|
3658
|
+
variant: e,
|
|
3659
|
+
cta: t,
|
|
3660
|
+
fullWidth: r,
|
|
3661
|
+
standalone: !0
|
|
3662
|
+
}, `${t.label}-${n}`))
|
|
3663
|
+
});
|
|
3664
|
+
}, ca = ({ ctaSurface: e, chinTextColor: t, title: n, subtitle: r, subtitleLines: i = 3, appIcon: a, actions: o }) => {
|
|
3665
|
+
let s = n != null && n.trim() !== "", c = r != null && r.trim() !== "", l = o != null && o.length > 0;
|
|
3666
|
+
if (!s && !c && !l) return null;
|
|
3667
|
+
let u = { color: t }, d = i > 1 ? {
|
|
3668
|
+
...u,
|
|
3669
|
+
display: "-webkit-box",
|
|
3670
|
+
WebkitBoxOrient: "vertical",
|
|
3671
|
+
WebkitLineClamp: i,
|
|
3672
|
+
overflow: "hidden"
|
|
3673
|
+
} : u, f = l && (o?.[0]?.variant ?? "primary") === "secondary", p = /* @__PURE__ */ G("div", {
|
|
3674
|
+
className: "flex min-w-0 flex-1 flex-col gap-[2px]",
|
|
3675
|
+
children: [s && /* @__PURE__ */ G("div", {
|
|
3676
|
+
className: "flex min-w-0 items-center gap-2",
|
|
3677
|
+
children: [a ? /* @__PURE__ */ W("span", {
|
|
3678
|
+
className: "shrink-0",
|
|
3679
|
+
children: a
|
|
3680
|
+
}) : null, /* @__PURE__ */ W("p", {
|
|
3681
|
+
className: Y("min-w-0", aa),
|
|
3682
|
+
style: u,
|
|
3683
|
+
children: n
|
|
3684
|
+
})]
|
|
3685
|
+
}), c && /* @__PURE__ */ W("p", {
|
|
3686
|
+
className: Y(oa, i > 1 && "whitespace-pre-line", i <= 1 && "truncate"),
|
|
3687
|
+
style: d,
|
|
3688
|
+
children: r
|
|
3689
|
+
})]
|
|
3690
|
+
});
|
|
3691
|
+
return /* @__PURE__ */ W("div", {
|
|
3692
|
+
className: "shrink-0 px-4 py-3",
|
|
3693
|
+
children: f ? /* @__PURE__ */ G("div", {
|
|
3694
|
+
className: "flex items-center justify-between gap-3",
|
|
3695
|
+
children: [p, /* @__PURE__ */ W(sa, {
|
|
3696
|
+
surface: e,
|
|
3697
|
+
actions: o,
|
|
3698
|
+
layout: "row"
|
|
3699
|
+
})]
|
|
3700
|
+
}) : /* @__PURE__ */ G(U, { children: [p, /* @__PURE__ */ W(sa, {
|
|
3701
|
+
surface: e,
|
|
3702
|
+
actions: o,
|
|
3703
|
+
layout: "stacked"
|
|
3704
|
+
})] })
|
|
3705
|
+
});
|
|
3706
|
+
}, la = {
|
|
3707
|
+
dark: "bg-white/[0.06]",
|
|
3708
|
+
light: "bg-black/[0.04]"
|
|
3709
|
+
}, ua = {
|
|
3710
|
+
1: [0],
|
|
3711
|
+
2: [-10, 10],
|
|
3712
|
+
3: [
|
|
3713
|
+
-13,
|
|
3714
|
+
0,
|
|
3715
|
+
13
|
|
3716
|
+
]
|
|
3717
|
+
}, da = {
|
|
3718
|
+
1: [0],
|
|
3719
|
+
2: [-26, 26],
|
|
3720
|
+
3: [
|
|
3721
|
+
-40,
|
|
3722
|
+
0,
|
|
3723
|
+
40
|
|
3724
|
+
]
|
|
3725
|
+
}, fa = {
|
|
3726
|
+
1: [0],
|
|
3727
|
+
2: [0, 1],
|
|
3728
|
+
3: [
|
|
3729
|
+
1,
|
|
3730
|
+
3,
|
|
3731
|
+
2
|
|
3732
|
+
]
|
|
3733
|
+
}, pa = {
|
|
3734
|
+
1: [1],
|
|
3735
|
+
2: [1, 1],
|
|
3736
|
+
3: [
|
|
3737
|
+
1,
|
|
3738
|
+
1.08,
|
|
3739
|
+
1
|
|
3740
|
+
]
|
|
3741
|
+
}, ma = ({ variant: e, images: t }) => {
|
|
3742
|
+
let [n, r] = o.useState({}), i = t.join("\n"), [s, c] = o.useState(i);
|
|
3743
|
+
i !== s && (c(i), r({}));
|
|
3744
|
+
let l = t.slice(0, 3).map((e, t) => ({
|
|
3745
|
+
src: e,
|
|
3746
|
+
index: t
|
|
3747
|
+
})).filter(({ index: e }) => !n[e]), u = l.length >= 3 ? 3 : l.length === 2 ? 2 : 1, d = ua[u], f = da[u], p = fa[u], m = pa[u];
|
|
3748
|
+
return /* @__PURE__ */ W("div", {
|
|
3749
|
+
className: Y("relative flex min-h-0 w-full flex-1 items-center justify-center overflow-hidden", la[e]),
|
|
3750
|
+
children: l.map(({ src: e, index: t }, n) => /* @__PURE__ */ W("img", {
|
|
3751
|
+
src: a(e) ?? e,
|
|
3752
|
+
alt: "",
|
|
3753
|
+
draggable: !1,
|
|
3754
|
+
loading: "lazy",
|
|
3755
|
+
decoding: "async",
|
|
3756
|
+
onError: () => r((e) => ({
|
|
3757
|
+
...e,
|
|
3758
|
+
[t]: !0
|
|
3759
|
+
})),
|
|
3760
|
+
className: "absolute left-1/2 top-1/2 w-[62%] aspect-[3/2] rounded-[12px] bg-[#ffffff] object-cover shadow-md",
|
|
3761
|
+
style: {
|
|
3762
|
+
transform: `translate(-50%, -50%) translateX(${f[n]}px) rotate(${d[n]}deg) scale(${m[n]})`,
|
|
3763
|
+
zIndex: p[n]
|
|
3764
|
+
}
|
|
3765
|
+
}, `${e}-${t}`))
|
|
3766
|
+
});
|
|
3767
|
+
}, ha = "flex h-[180px] w-full shrink-0 flex-col overflow-hidden", ga = ({ variant: e, presentation: t, images: n, title: r, heroUrl: i, onHeroError: a }) => /* @__PURE__ */ W("div", {
|
|
3768
|
+
className: ha,
|
|
3769
|
+
children: t === "fan" ? /* @__PURE__ */ W(ma, {
|
|
3770
|
+
variant: e,
|
|
3771
|
+
images: n
|
|
3772
|
+
}) : /* @__PURE__ */ W(Dn, {
|
|
3773
|
+
variant: e,
|
|
3774
|
+
thumbnailUrl: i,
|
|
3775
|
+
title: r,
|
|
3776
|
+
mimeType: "image/*",
|
|
3777
|
+
onImageError: a
|
|
3778
|
+
})
|
|
3779
|
+
}), _a = ({ variant: e, title: t, subtitle: n, subtitleLines: r, images: i = [], imagePresentation: a, actions: o, appIcon: s, accentColor: c, groupPosition: l = "single" }) => {
|
|
3780
|
+
let u = Te({
|
|
3781
|
+
imagePresentation: a,
|
|
3782
|
+
images: i
|
|
3783
|
+
}), d = i.length > 0, f = d && u === "hero", p = Nn({
|
|
3784
|
+
variant: e,
|
|
3785
|
+
accentColor: c,
|
|
3786
|
+
layout: "featured",
|
|
3787
|
+
thumbnailUrl: f ? i[0] : void 0
|
|
3788
|
+
}), m = l === "single" || l === "end";
|
|
3789
|
+
return /* @__PURE__ */ W(Ln, {
|
|
3790
|
+
accentHex: p.accentHex,
|
|
3791
|
+
side: e === "dark" ? "sender" : "receiver",
|
|
3792
|
+
visible: m,
|
|
3793
|
+
children: /* @__PURE__ */ G(xn, {
|
|
3794
|
+
variant: e,
|
|
3795
|
+
accentHex: p.accentHex,
|
|
3796
|
+
"data-testid": "rich-card",
|
|
3797
|
+
children: [d && /* @__PURE__ */ W(ga, {
|
|
3798
|
+
variant: e,
|
|
3799
|
+
presentation: u,
|
|
3800
|
+
images: i,
|
|
3801
|
+
title: t,
|
|
3802
|
+
heroUrl: f ? p.thumbnailUrl : void 0,
|
|
3803
|
+
onHeroError: p.onImageError
|
|
3804
|
+
}), /* @__PURE__ */ W(ca, {
|
|
3805
|
+
ctaSurface: p.surface,
|
|
3806
|
+
chinTextColor: p.chinTextColor,
|
|
3807
|
+
title: t,
|
|
3808
|
+
subtitle: n,
|
|
3809
|
+
subtitleLines: r,
|
|
3810
|
+
appIcon: s,
|
|
3811
|
+
actions: o
|
|
3812
|
+
})]
|
|
3813
|
+
})
|
|
3814
|
+
});
|
|
3815
|
+
}, va = {
|
|
3816
|
+
Sent: (e) => /* @__PURE__ */ W(_a, {
|
|
3817
|
+
...e,
|
|
3818
|
+
variant: "dark"
|
|
3819
|
+
}),
|
|
3820
|
+
Received: (e) => /* @__PURE__ */ W(_a, {
|
|
3821
|
+
...e,
|
|
3822
|
+
variant: "light"
|
|
3823
|
+
})
|
|
3824
|
+
}, ya = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='23' fill='none'%3E%3Cpath fill='black' d='M0 0H15C15 10.1934 15.859 15.2345 19.168 21.4893C19.527 22.168 19.039 22.9917 18.274 22.9178C5.176 21.6506 0.32 6.0737 0 0Z'/%3E%3C/svg%3E\") no-repeat center / 100% 100%", ba = {
|
|
3825
|
+
sent: "var(--str-chat__own-message-bubble-background-color, #1e2330)",
|
|
3826
|
+
received: "var(--str-chat__message-bubble-background-color, #f1f0ee)"
|
|
3827
|
+
}, xa = ({ variant: e }) => /* @__PURE__ */ W("span", {
|
|
3828
|
+
"aria-hidden": "true",
|
|
3829
|
+
className: "pointer-events-none absolute bottom-0 z-[-1] h-[1.4375rem] w-5",
|
|
3830
|
+
style: {
|
|
3831
|
+
insetInlineEnd: e === "sent" ? "calc(-1 * 0.25rem)" : void 0,
|
|
3832
|
+
insetInlineStart: e === "received" ? "calc(-1 * 0.25rem)" : void 0,
|
|
3833
|
+
transform: e === "received" ? "scaleX(-1)" : void 0,
|
|
3834
|
+
transformOrigin: "center",
|
|
3835
|
+
backgroundColor: ba[e],
|
|
3836
|
+
WebkitMask: ya,
|
|
3837
|
+
mask: ya
|
|
3838
|
+
}
|
|
3839
|
+
}), Sa = {
|
|
3840
|
+
sent: {
|
|
3841
|
+
backgroundColor: "var(--str-chat__own-message-bubble-background-color, #1e2330)",
|
|
3842
|
+
color: "var(--str-chat__own-message-bubble-color, #fff)"
|
|
3843
|
+
},
|
|
3844
|
+
received: {
|
|
3845
|
+
backgroundColor: "var(--str-chat__message-bubble-background-color, #f1f0ee)",
|
|
3846
|
+
color: "var(--str-chat__message-bubble-color, #000000)"
|
|
3847
|
+
}
|
|
3848
|
+
}, Ca = ({ variant: e, text: t, tail: n = !0, header: r, className: i }) => /* @__PURE__ */ G("div", {
|
|
3849
|
+
"data-dd-privacy": "mask",
|
|
3850
|
+
className: Y("relative px-4 py-3", "text-[0.875rem] leading-[1.3125rem] tracking-[0.14px]", i),
|
|
3851
|
+
style: {
|
|
3852
|
+
...Sa[e],
|
|
3853
|
+
borderRadius: "var(--str-chat__message-bubble-border-radius, 1.5rem)",
|
|
3854
|
+
isolation: "isolate"
|
|
3855
|
+
},
|
|
3856
|
+
children: [
|
|
3857
|
+
r != null && /* @__PURE__ */ W("div", {
|
|
3858
|
+
className: "mb-1 font-medium",
|
|
3859
|
+
"data-testid": "message-bubble-header",
|
|
3860
|
+
children: r
|
|
3861
|
+
}),
|
|
3862
|
+
/* @__PURE__ */ W("p", {
|
|
3863
|
+
className: "m-0 whitespace-pre-wrap break-words hyphens-manual",
|
|
3864
|
+
children: t
|
|
3865
|
+
}),
|
|
3866
|
+
n && /* @__PURE__ */ W(xa, { variant: e })
|
|
3867
|
+
]
|
|
3868
|
+
}), wa = {
|
|
3869
|
+
Sent: ({ text: e, tail: t, className: n }) => /* @__PURE__ */ W(Ca, {
|
|
3870
|
+
variant: "sent",
|
|
3871
|
+
text: e,
|
|
3872
|
+
tail: t,
|
|
3873
|
+
className: n
|
|
3874
|
+
}),
|
|
3875
|
+
Received: ({ text: e, tail: t, header: n, className: r }) => /* @__PURE__ */ W(Ca, {
|
|
3876
|
+
variant: "received",
|
|
3877
|
+
text: e,
|
|
3878
|
+
tail: t,
|
|
3879
|
+
header: n,
|
|
3880
|
+
className: r
|
|
3881
|
+
})
|
|
3882
|
+
}, Ta = ({ question: e, onClick: t, loading: n = !1, className: r }) => /* @__PURE__ */ W("button", {
|
|
3883
|
+
type: "button",
|
|
3884
|
+
onClick: t,
|
|
3885
|
+
disabled: n,
|
|
3886
|
+
style: { backgroundColor: "#E6E5E3" },
|
|
3887
|
+
className: Y("w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring", {
|
|
3888
|
+
"hover:brightness-95 active:brightness-90": !n,
|
|
3889
|
+
"opacity-50 cursor-not-allowed": n
|
|
3890
|
+
}, r),
|
|
3891
|
+
children: e
|
|
3892
|
+
}), Ea = ({ faqs: e, onFaqClick: t, loadingFaqId: n, headerText: r, className: i, avatarImage: a, avatarName: o }) => {
|
|
3893
|
+
let s = J(e);
|
|
3894
|
+
return s.length === 0 ? null : /* @__PURE__ */ W("div", {
|
|
3895
|
+
className: i,
|
|
3896
|
+
children: /* @__PURE__ */ G("div", {
|
|
3897
|
+
className: "flex gap-3 items-end",
|
|
3898
|
+
children: [(a || o) && /* @__PURE__ */ W("div", {
|
|
3899
|
+
className: "flex-none",
|
|
3900
|
+
children: /* @__PURE__ */ W(gt, {
|
|
3901
|
+
id: o || "account",
|
|
3902
|
+
name: o || "Account",
|
|
3903
|
+
image: a,
|
|
3904
|
+
size: 24,
|
|
3905
|
+
shape: "circle"
|
|
3906
|
+
})
|
|
3907
|
+
}), /* @__PURE__ */ G("div", {
|
|
3908
|
+
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
3909
|
+
style: { backgroundColor: "#F1F0EE" },
|
|
3910
|
+
children: [r && /* @__PURE__ */ W("p", {
|
|
3911
|
+
className: "text-md text-charcoal mb-4",
|
|
3912
|
+
children: r
|
|
3913
|
+
}), s.map((e) => /* @__PURE__ */ W(Ta, {
|
|
3914
|
+
question: e.question,
|
|
3915
|
+
onClick: () => t(e.id),
|
|
3916
|
+
loading: n === e.id
|
|
3917
|
+
}, e.id))]
|
|
3918
|
+
})]
|
|
3919
|
+
})
|
|
3920
|
+
});
|
|
3921
|
+
};
|
|
3922
|
+
//#endregion
|
|
3923
|
+
export { yt as ActionButton, gt as Avatar, Ui as ChannelEmptyState, ia as ChannelList, qi as ChannelView, jt as CustomMessageProvider, Ea as FaqList, Ta as FaqListItem, Rn as LinkAttachment, It as LockedAttachment, Qr as MessageAttachment, wa as MessageBubble, $e as MessagingLoggerProvider, rt as MessagingProvider, Yi as MessagingShell, va as RichCard, en as TipMessage, tr as buildCompactMetaLabel, Qn as formatFileSize, ta as formatRelativeTime, er as getFileExtensionLabel, Dt as getMessageDisplayText, Ot as isLinkAttachment, $t as isTipMessage, ct as isUuidLike, qn as messageAttachmentGroupPositionFromStream, Et as normalizeLanguageCode, a as optimizeMessagingAttachmentUrl, ot as resolveConversationParticipant, ut as resolveParticipantDisplayName, Si as useComposerLocked, Mt as useCustomMessage, it as useMessaging, et as useMessagingLogger };
|
|
3924
|
+
|
|
3925
|
+
//# sourceMappingURL=index.js.map
|