@linktr.ee/messaging-react 1.40.1 → 1.40.2

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