@linktr.ee/messaging-react 1.18.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as o, Fragment as he } from "react/jsx-runtime";
2
- import k from "classnames";
3
- import O, { createContext as Ve, useContext as We, useCallback as F, useState as _, useRef as H, useEffect as V, useMemo as Ce } from "react";
4
- import { StreamChatService as qe } from "@linktr.ee/messaging-core";
5
- import { Chat as Ze, ChannelList as Ye, DateSeparator as Je, areMessageUIPropsEqual as Qe, useChatContext as Xe, useMessageReminder as Ke, useComponentContext as es, Attachment as ss, EditMessageModal as ts, MessageBlocked as ns, MessageBouncePrompt as rs, MessageDeleted as as, MessageIsThreadReplyInChannelButtonIndicator as ls, MessageRepliesCountButton as os, ReminderNotification as is, StreamedMessageText as cs, messageHasAttachments as ds, messageHasReactions as us, isDateSeparatorMessage as ms, isMessageBlocked as hs, isMessageBounced as fs, MessageBounceModal as gs, Poll as xs, MessageText as Cs, MessageErrorIcon as bs, useMessageContext as Ns, useMessageComposer as vs, useStateStore as ws, MessageInput as ys, useMessageInputContext as ps, useMessageComposerHasSendableData as Es, SimpleAttachmentSelector as Is, QuotedMessagePreview as _s, AttachmentPreviewList as Ss, TextareaComposer as Ms, MessageTimestamp as ks, Channel as Rs, useChannelStateContext as _e, WithComponents as Ds, Window as Ts, MessageList as Fs } from "stream-chat-react";
6
- import { GiftIcon as Ls, XIcon as fe, ArrowUpIcon as Ps, ArrowLeftIcon as be, StarIcon as Ne, DotsThreeIcon as ve, SpinnerGapIcon as oe, SignOutIcon as Os, ProhibitInsetIcon as we, FlagIcon as Us, MagnifyingGlassIcon as Bs, ChatCircleDotsIcon as ye } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as pe } from "stream-chat";
8
- const Se = Ve({
1
+ import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
2
+ import F from "classnames";
3
+ import B, { createContext as We, useContext as qe, useCallback as L, useState as S, useRef as G, useEffect as H, useMemo as be } from "react";
4
+ import { StreamChatService as Ze } from "@linktr.ee/messaging-core";
5
+ import { Chat as Ye, ChannelList as Je, DateSeparator as Qe, areMessageUIPropsEqual as Xe, useChatContext as Ke, useMessageReminder as es, useComponentContext as ss, Attachment as ts, EditMessageModal as ns, MessageBlocked as rs, MessageBouncePrompt as as, MessageDeleted as ls, MessageIsThreadReplyInChannelButtonIndicator as os, MessageRepliesCountButton as is, ReminderNotification as cs, StreamedMessageText as ds, messageHasAttachments as ms, messageHasReactions as us, isDateSeparatorMessage as hs, isMessageBlocked as fs, isMessageBounced as gs, MessageBounceModal as xs, Poll as Cs, MessageText as bs, MessageErrorIcon as Ns, useMessageContext as vs, useMessageComposer as ws, useStateStore as ys, MessageInput as ps, useMessageInputContext as Es, useMessageComposerHasSendableData as Is, SimpleAttachmentSelector as _s, QuotedMessagePreview as Ss, AttachmentPreviewList as Ms, TextareaComposer as ks, MessageTimestamp as Rs, Channel as Ds, useChannelStateContext as Se, WithComponents as Ts, Window as Fs, MessageList as Ls } from "stream-chat-react";
6
+ import { GiftIcon as Ps, XIcon as fe, ArrowUpIcon as Os, ArrowLeftIcon as Ne, StarIcon as ve, DotsThreeIcon as we, SpinnerGapIcon as oe, SignOutIcon as Us, ProhibitInsetIcon as ye, FlagIcon as Bs, MagnifyingGlassIcon as js, ChatCircleDotsIcon as pe } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as Ee } from "stream-chat";
8
+ const Me = We({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,104 +15,104 @@ const Se = Ve({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), de = () => We(Se), vt = ({
18
+ }), de = () => qe(Me), wt = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
- apiKey: a,
23
- capabilities: i = {},
22
+ apiKey: l,
23
+ capabilities: o = {},
24
24
  debug: c = !1
25
25
  }) => {
26
- const r = F(
27
- (d, ...m) => {
28
- c && console.log(`🔥 [MessagingProvider] ${d}`, ...m);
26
+ const r = L(
27
+ (m, ...w) => {
28
+ c && console.log(`🔥 [MessagingProvider] ${m}`, ...w);
29
29
  },
30
30
  [c]
31
31
  );
32
32
  r("🔄 RENDER START", {
33
33
  userId: s == null ? void 0 : s.id,
34
- apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
34
+ apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
35
35
  serviceConfig: !!n,
36
- capabilities: Object.keys(i)
36
+ capabilities: Object.keys(o)
37
37
  });
38
- const [u, f] = _(null), [N, v] = _(null), [h, l] = _(!1), [M, p] = _(!1), [S, g] = _(null), y = H(!1), C = H({
38
+ const [d, x] = S(null), [h, C] = S(null), [N, a] = S(!1), [M, I] = S(!1), [_, f] = S(null), p = G(!1), b = G({
39
39
  userId: s == null ? void 0 : s.id,
40
- apiKey: a,
40
+ apiKey: l,
41
41
  serviceConfig: n,
42
- capabilities: i
43
- }), x = H(0);
44
- x.current++, r("📊 RENDER INFO", {
45
- renderCount: x.current,
46
- currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
42
+ capabilities: o
43
+ }), y = G(0);
44
+ y.current++, r("📊 RENDER INFO", {
45
+ renderCount: y.current,
46
+ currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
- userChanged: C.current.userId !== (s == null ? void 0 : s.id),
49
- apiKeyChanged: C.current.apiKey !== a,
50
- serviceConfigChanged: C.current.serviceConfig !== n,
51
- capabilitiesChanged: C.current.capabilities !== i
48
+ userChanged: b.current.userId !== (s == null ? void 0 : s.id),
49
+ apiKeyChanged: b.current.apiKey !== l,
50
+ serviceConfigChanged: b.current.serviceConfig !== n,
51
+ capabilitiesChanged: b.current.capabilities !== o
52
52
  }
53
- }), C.current = {
53
+ }), b.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
- apiKey: a,
55
+ apiKey: l,
56
56
  serviceConfig: n,
57
- capabilities: i
58
- }, V(() => {
59
- const d = x.current;
57
+ capabilities: o
58
+ }, H(() => {
59
+ const m = y.current;
60
60
  if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
61
- renderCount: d,
62
- apiKey: !!a,
61
+ renderCount: m,
62
+ apiKey: !!l,
63
63
  serviceConfig: !!n,
64
64
  dependencies: {
65
- apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
65
+ apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
66
66
  serviceConfigRef: n,
67
- serviceConfigStable: C.current.serviceConfig === n,
68
- apiKeyStable: C.current.apiKey === a
67
+ serviceConfigStable: b.current.serviceConfig === n,
68
+ apiKeyStable: b.current.apiKey === l
69
69
  }
70
- }), !a || !n) {
70
+ }), !l || !n) {
71
71
  r("⚠️ SERVICE INIT SKIPPED", {
72
- renderCount: d,
72
+ renderCount: m,
73
73
  reason: "Missing apiKey or serviceConfig"
74
74
  });
75
75
  return;
76
76
  }
77
77
  r("🚀 CREATING NEW SERVICE", {
78
- renderCount: d,
79
- apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
80
- serviceConfigChanged: C.current.serviceConfig !== n
78
+ renderCount: m,
79
+ apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
80
+ serviceConfigChanged: b.current.serviceConfig !== n
81
81
  });
82
- const m = new qe({
82
+ const w = new Ze({
83
83
  ...n,
84
- apiKey: a,
84
+ apiKey: l,
85
85
  debug: c
86
86
  });
87
- return f(m), r("✅ SERVICE SET", {
88
- renderCount: d,
89
- serviceInstance: !!m
87
+ return x(w), r("✅ SERVICE SET", {
88
+ renderCount: m,
89
+ serviceInstance: !!w
90
90
  }), () => {
91
91
  r("🧹 SERVICE CLEANUP", {
92
- renderCount: d,
92
+ renderCount: m,
93
93
  reason: "Effect cleanup"
94
- }), m.disconnectUser().catch(console.error);
94
+ }), w.disconnectUser().catch(console.error);
95
95
  };
96
- }, [a, n, c, r]);
97
- const w = H(null);
98
- V(() => {
99
- var m, R;
96
+ }, [l, n, c, r]);
97
+ const u = G(null);
98
+ H(() => {
99
+ var w, v;
100
100
  if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
101
- hasService: !!u,
101
+ hasService: !!d,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: y.current,
105
- isConnected: h,
106
- dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
107
- }), !u || !s) {
104
+ isConnecting: p.current,
105
+ isConnected: N,
106
+ dependencies: { service: !!d, userId: s == null ? void 0 : s.id }
107
+ }), !d || !s) {
108
108
  r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (y.current) {
111
+ if (p.current) {
112
112
  r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((m = w.current) == null ? void 0 : m.serviceId) === u && ((R = w.current) == null ? void 0 : R.userId) === s.id) {
115
+ if (((w = u.current) == null ? void 0 : w.serviceId) === d && ((v = u.current) == null ? void 0 : v.userId) === s.id) {
116
116
  r(
117
117
  "⚠️ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,124 +120,124 @@ const Se = Ve({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- r("🚀 STARTING USER CONNECTION", { userId: s.id }), y.current = !0, p(!0), g(null);
123
+ r("🚀 STARTING USER CONNECTION", { userId: s.id }), p.current = !0, I(!0), f(null);
124
124
  try {
125
125
  r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
- const L = await u.connectUser(s);
127
- v(L), l(!0), w.current = { serviceId: u, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
126
+ const D = await d.connectUser(s);
127
+ C(D), a(!0), u.current = { serviceId: d, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
- clientId: L.userID
129
+ clientId: D.userID
130
130
  });
131
- } catch (L) {
132
- const G = L instanceof Error ? L.message : "Connection failed";
133
- g(G), r("❌ USER CONNECTION ERROR", {
131
+ } catch (D) {
132
+ const P = D instanceof Error ? D.message : "Connection failed";
133
+ f(P), r("❌ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: G
135
+ error: P
136
136
  });
137
137
  } finally {
138
- p(!1), y.current = !1, r("🔄 USER CONNECTION FINISHED", {
138
+ I(!1), p.current = !1, r("🔄 USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
- isConnected: h
140
+ isConnected: N
141
141
  });
142
142
  }
143
143
  })();
144
- }, [u, s, r, h]), V(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
145
- hasService: !!u,
146
- isConnected: h
144
+ }, [d, s, r, N]), H(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
145
+ hasService: !!d,
146
+ isConnected: N
147
147
  }), () => {
148
- u && h ? (r(
148
+ d && N ? (r(
149
149
  "🧹 CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), w.current = null, u.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
152
- hasService: !!u,
153
- isConnected: h
151
+ ), u.current = null, d.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
152
+ hasService: !!d,
153
+ isConnected: N
154
154
  });
155
- }), [u, h, r]);
156
- const D = F(async () => {
155
+ }), [d, N, r]);
156
+ const k = L(async () => {
157
157
  if (r("🔄 REFRESH CONNECTION CALLED", {
158
- hasService: !!u,
158
+ hasService: !!d,
159
159
  hasUser: !!s
160
- }), !u || !s) {
160
+ }), !d || !s) {
161
161
  r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), p(!0);
164
+ r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), I(!0);
165
165
  try {
166
- r("🔌 DISCONNECTING FOR REFRESH"), await u.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
167
- const d = await u.connectUser(s);
168
- v(d), l(!0), g(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
169
- } catch (d) {
170
- const m = d instanceof Error ? d.message : "Refresh failed";
171
- g(m), r("❌ CONNECTION REFRESH ERROR", {
166
+ r("🔌 DISCONNECTING FOR REFRESH"), await d.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
167
+ const m = await d.connectUser(s);
168
+ C(m), a(!0), f(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
169
+ } catch (m) {
170
+ const w = m instanceof Error ? m.message : "Refresh failed";
171
+ f(w), r("❌ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: m
173
+ error: w
174
174
  });
175
175
  } finally {
176
- p(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ I(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [u, s, r]), b = O.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
179
- hasService: !!u,
180
- hasClient: !!N,
181
- isConnected: h,
178
+ }, [d, s, r]), g = B.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
179
+ hasService: !!d,
180
+ hasClient: !!h,
181
+ isConnected: N,
182
182
  isLoading: M,
183
- hasError: !!S,
184
- capabilitiesKeys: Object.keys(i)
183
+ hasError: !!_,
184
+ capabilitiesKeys: Object.keys(o)
185
185
  }), {
186
- service: u,
187
- client: N,
188
- isConnected: h,
186
+ service: d,
187
+ client: h,
188
+ isConnected: N,
189
189
  isLoading: M,
190
- error: S,
191
- capabilities: i,
192
- refreshConnection: D,
190
+ error: _,
191
+ capabilities: o,
192
+ refreshConnection: k,
193
193
  debug: c
194
194
  }), [
195
- u,
196
- N,
195
+ d,
197
196
  h,
197
+ N,
198
198
  M,
199
- S,
200
- i,
201
- D,
199
+ _,
200
+ o,
201
+ k,
202
202
  c,
203
203
  r
204
204
  ]);
205
205
  return r("🔄 RENDER END", {
206
- renderCount: x.current,
207
- willRenderChat: !!(N && h),
208
- contextValueReady: !!b
209
- }), /* @__PURE__ */ e(Se.Provider, { value: b, children: N && h ? /* @__PURE__ */ e(
210
- Ze,
206
+ renderCount: y.current,
207
+ willRenderChat: !!(h && N),
208
+ contextValueReady: !!g
209
+ }), /* @__PURE__ */ e(Me.Provider, { value: g, children: h && N ? /* @__PURE__ */ e(
210
+ Ye,
211
211
  {
212
- client: N,
212
+ client: h,
213
213
  customClasses: {
214
214
  channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
215
215
  },
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, js = () => de(), As = (t, s) => {
219
+ }, As = () => de(), $s = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
- ), i = new Date(
222
+ ), o = new Date(
223
223
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
224
224
  ).getTime() - n.getTime();
225
- return Math.floor(i / (1e3 * 60 * 60 * 24));
226
- }, $s = (t) => {
225
+ return Math.floor(o / (1e3 * 60 * 60 * 24));
226
+ }, zs = (t) => {
227
227
  const s = /* @__PURE__ */ new Date();
228
228
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
229
229
  return "Just now";
230
- const a = As(t, s);
231
- return a === 0 ? t.toLocaleTimeString([], {
230
+ const l = $s(t, s);
231
+ return l === 0 ? t.toLocaleTimeString([], {
232
232
  hour: "numeric",
233
233
  minute: "2-digit",
234
234
  hour12: !0
235
- }) : a === 1 ? "Yesterday" : a < 7 ? `${a}d` : a < 28 ? `${Math.floor(a / 7)}w` : t.toLocaleDateString("en-US", {
235
+ }) : l === 1 ? "Yesterday" : l < 7 ? `${l}d` : l < 28 ? `${Math.floor(l / 7)}w` : t.toLocaleDateString("en-US", {
236
236
  month: "numeric",
237
237
  day: "numeric",
238
238
  year: "2-digit"
239
239
  });
240
- }, Ee = [
240
+ }, Ie = [
241
241
  "🍎",
242
242
  // Apple
243
243
  "🍌",
@@ -265,37 +265,37 @@ const Se = Ve({
265
265
  "🍈"
266
266
  // Melon
267
267
  ];
268
- function zs(t) {
268
+ function Gs(t) {
269
269
  let s = 0;
270
270
  for (let n = 0; n < t.length; n++) {
271
- const a = t.charCodeAt(n);
272
- s = (s << 5) - s + a, s = s & s;
271
+ const l = t.charCodeAt(n);
272
+ s = (s << 5) - s + l, s = s & s;
273
273
  }
274
274
  return Math.abs(s);
275
275
  }
276
- function Gs(t) {
277
- const n = zs(t) % Ee.length;
278
- return Ee[n];
276
+ function Hs(t) {
277
+ const n = Gs(t) % Ie.length;
278
+ return Ie[n];
279
279
  }
280
- const J = ({
280
+ const X = ({
281
281
  id: t,
282
282
  image: s,
283
283
  size: n = 40,
284
- className: a,
285
- shape: i = "squircle"
284
+ className: l,
285
+ shape: o = "squircle"
286
286
  }) => {
287
- const c = Gs(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = i === "circle" ? { borderRadius: "50%" } : {
287
+ const c = Hs(t), d = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", x = o === "circle" ? { borderRadius: "50%" } : {
288
288
  borderRadius: "33%",
289
289
  "corner-shape": "superellipse(1.3)"
290
290
  };
291
291
  return /* @__PURE__ */ e(
292
292
  "div",
293
293
  {
294
- className: k("flex-shrink-0 overflow-hidden", a),
294
+ className: F("flex-shrink-0 overflow-hidden", l),
295
295
  style: {
296
296
  width: `${n}px`,
297
297
  height: `${n}px`,
298
- ...f
298
+ ...x
299
299
  },
300
300
  children: s ? /* @__PURE__ */ e(
301
301
  "img",
@@ -308,119 +308,123 @@ const J = ({
308
308
  "div",
309
309
  {
310
310
  "aria-hidden": "true",
311
- className: k(
311
+ className: F(
312
312
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
313
- u
313
+ d
314
314
  ),
315
315
  children: c
316
316
  }
317
317
  )
318
318
  }
319
319
  );
320
- }, Hs = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
320
+ }, Vs = () => /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 10 10", fill: "none", children: /* @__PURE__ */ e(
321
321
  "path",
322
322
  {
323
323
  d: "M10.003 5a.705.705 0 0 1-.469.67L6.7 6.7 5.67 9.535a.715.715 0 0 1-1.34 0L3.3 6.7.466 5.67a.715.715 0 0 1 0-1.34L3.3 3.3 4.33.466a.715.715 0 0 1 1.34 0L6.7 3.3l2.834 1.03a.705.705 0 0 1 .469.67",
324
324
  fill: "currentColor"
325
325
  }
326
- ) }), Vs = (t) => {
326
+ ) }), Ws = (t) => {
327
327
  var s;
328
328
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
329
- }, Ws = (t) => {
329
+ }, qs = (t) => {
330
330
  var s;
331
331
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
332
- }, Me = (t) => {
332
+ }, ke = (t) => {
333
333
  var s;
334
334
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
335
- }, ke = (t) => Vs(t) || Ws(t), qs = (t) => {
335
+ }, Re = (t) => Ws(t) || qs(t), Zs = (t) => {
336
336
  var s;
337
- return ke(t) && !((s = t.text) != null && s.trim());
338
- }, Ie = ({
337
+ return Re(t) && !((s = t.text) != null && s.trim());
338
+ }, _e = ({
339
339
  message: t,
340
340
  standalone: s = !1
341
341
  }) => {
342
- var i;
343
- const n = ke(t), a = Me(t);
344
- if (!n && !a)
342
+ var o;
343
+ const n = Re(t), l = ke(t);
344
+ if (!n && !l)
345
345
  return null;
346
346
  if (n) {
347
- const c = (i = t.metadata) == null ? void 0 : i.amount_text;
347
+ const c = (o = t.metadata) == null ? void 0 : o.amount_text;
348
348
  if (!c) return null;
349
- const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", u = s ? `${c} tip` : `Delivered with ${c} tip`;
350
- return /* @__PURE__ */ o("div", { className: r, children: [
351
- /* @__PURE__ */ e(Ls, { size: s ? 14 : 12 }),
352
- /* @__PURE__ */ e("span", { children: u })
349
+ const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", d = s ? `${c} tip` : `Delivered with ${c} tip`;
350
+ return /* @__PURE__ */ i("div", { className: r, children: [
351
+ /* @__PURE__ */ e(Ps, { size: s ? 14 : 12 }),
352
+ /* @__PURE__ */ e("span", { children: d })
353
353
  ] });
354
354
  }
355
- return /* @__PURE__ */ o("div", { className: "message-tag message-tag--chatbot", children: [
356
- /* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Hs, {}) }),
355
+ return /* @__PURE__ */ i("div", { className: "message-tag message-tag--chatbot", children: [
356
+ /* @__PURE__ */ e("span", { className: "message-tag__icon", style: { marginTop: -1 }, children: /* @__PURE__ */ e(Vs, {}) }),
357
357
  /* @__PURE__ */ e("span", { className: "message-tag__label", children: "Chatbot" })
358
358
  ] });
359
- }, Re = O.memo(
360
- ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: a = !1, unread: i }) => {
361
- var y, C, x, w, D, b;
362
- const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
359
+ }, De = B.memo(
360
+ ({
361
+ channel: t,
362
+ selectedChannel: s,
363
+ onChannelSelect: n,
364
+ debug: l = !1,
365
+ unread: o,
366
+ renderMessagePreview: c
367
+ }) => {
368
+ var y, u, k, g, m, w;
369
+ const r = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
363
370
  t && n(t);
364
- }, f = Object.values(((y = t == null ? void 0 : t.state) == null ? void 0 : y.members) || {}).find(
365
- (d) => {
366
- var m, R;
367
- return ((m = d.user) == null ? void 0 : m.id) && d.user.id !== ((R = t == null ? void 0 : t._client) == null ? void 0 : R.userID);
371
+ }, h = Object.values(((y = t == null ? void 0 : t.state) == null ? void 0 : y.members) || {}).find(
372
+ (v) => {
373
+ var D, P;
374
+ return ((D = v.user) == null ? void 0 : D.id) && v.user.id !== ((P = t == null ? void 0 : t._client) == null ? void 0 : P.userID);
368
375
  }
369
- ), N = ((C = f == null ? void 0 : f.user) == null ? void 0 : C.name) || "Conversation", v = (x = f == null ? void 0 : f.user) == null ? void 0 : x.image, h = (D = (w = t == null ? void 0 : t.state) == null ? void 0 : w.messages) == null ? void 0 : D[t.state.messages.length - 1], M = (() => {
370
- var m;
371
- if (h != null && h.text) return h.text;
372
- const d = (m = h == null ? void 0 : h.attachments) == null ? void 0 : m[0];
373
- return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "📷 Sent an image" : d.type === "video" ? "🎥 Sent a video" : d.type === "audio" ? "🎵 Sent audio" : d.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
374
- })(), p = h != null && h.created_at ? $s(new Date(h.created_at)) : "", S = h ? Me(h) : !1, g = i ?? 0;
375
- return a && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
376
+ ), C = ((u = h == null ? void 0 : h.user) == null ? void 0 : u.name) || "Conversation", N = (k = h == null ? void 0 : h.user) == null ? void 0 : k.image, a = (m = (g = t == null ? void 0 : t.state) == null ? void 0 : g.messages) == null ? void 0 : m[t.state.messages.length - 1], I = (() => {
377
+ var D;
378
+ if (a != null && a.text) return a.text;
379
+ const v = (D = a == null ? void 0 : a.attachments) == null ? void 0 : D[0];
380
+ return v ? v.og_scrape_url ? v.og_scrape_url : v.type === "image" ? "📷 Sent an image" : v.type === "video" ? "🎥 Sent a video" : v.type === "audio" ? "🎵 Sent audio" : v.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
381
+ })(), _ = a != null && a.created_at ? zs(new Date(a.created_at)) : "", f = a ? ke(a) : !1, p = c ? c(a, I) : `${f ? "✨ " : ""}${I}`, b = o ?? 0;
382
+ return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
376
383
  channelId: t == null ? void 0 : t.id,
377
- isSelected: c,
378
- participantName: N,
379
- unreadCount: g,
380
- hasTimestamp: !!p
384
+ isSelected: r,
385
+ participantName: C,
386
+ unreadCount: b,
387
+ hasTimestamp: !!_
381
388
  }), /* @__PURE__ */ e(
382
389
  "button",
383
390
  {
384
391
  type: "button",
385
- onClick: r,
386
- className: k(
392
+ onClick: d,
393
+ className: F(
387
394
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
388
395
  {
389
- "bg-primary-alt/10 border-l-4 border-l-primary": c,
390
- "hover:bg-sand": !c
396
+ "bg-primary-alt/10 border-l-4 border-l-primary": r,
397
+ "hover:bg-sand": !r
391
398
  }
392
399
  ),
393
- children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
400
+ children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
394
401
  /* @__PURE__ */ e(
395
- J,
402
+ X,
396
403
  {
397
- id: ((b = f == null ? void 0 : f.user) == null ? void 0 : b.id) || t.id || "unknown",
398
- name: N,
399
- image: v,
404
+ id: ((w = h == null ? void 0 : h.user) == null ? void 0 : w.id) || t.id || "unknown",
405
+ name: C,
406
+ image: N,
400
407
  size: 44,
401
408
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
402
409
  }
403
410
  ),
404
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
405
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2", children: [
411
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
412
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
406
413
  /* @__PURE__ */ e(
407
414
  "h3",
408
415
  {
409
- className: k(
416
+ className: F(
410
417
  "text-sm font-medium truncate",
411
- c ? "text-primary" : "text-charcoal"
418
+ r ? "text-primary" : "text-charcoal"
412
419
  ),
413
- children: N
420
+ children: C
414
421
  }
415
422
  ),
416
- p && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: p })
423
+ _ && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: _ })
417
424
  ] }),
418
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
419
- /* @__PURE__ */ o("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: [
420
- S && " ",
421
- M
422
- ] }),
423
- g > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: g > 99 ? "99+" : g })
425
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
426
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: p }),
427
+ b > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: b > 99 ? "99+" : b })
424
428
  ] })
425
429
  ] })
426
430
  ] })
@@ -428,47 +432,49 @@ const J = ({
428
432
  );
429
433
  }
430
434
  );
431
- Re.displayName = "CustomChannelPreview";
432
- const De = O.memo(
435
+ De.displayName = "CustomChannelPreview";
436
+ const Te = B.memo(
433
437
  ({
434
438
  onChannelSelect: t,
435
439
  selectedChannel: s,
436
440
  filters: n,
437
- className: a,
438
- customEmptyStateIndicator: i
441
+ className: l,
442
+ customEmptyStateIndicator: o,
443
+ renderMessagePreview: c
439
444
  }) => {
440
- const c = O.useRef(0);
441
- c.current++;
442
- const { debug: r = !1 } = de();
443
- r && console.log("📺 [ChannelList] 🔄 RENDER START", {
444
- renderCount: c.current,
445
+ const r = B.useRef(0);
446
+ r.current++;
447
+ const { debug: d = !1 } = de();
448
+ d && console.log("📺 [ChannelList] 🔄 RENDER START", {
449
+ renderCount: r.current,
445
450
  selectedChannelId: s == null ? void 0 : s.id,
446
451
  filters: n
447
452
  });
448
- const u = O.useMemo(() => (N) => /* @__PURE__ */ e(
449
- Re,
453
+ const x = B.useMemo(() => (C) => /* @__PURE__ */ e(
454
+ De,
450
455
  {
451
- ...N,
456
+ ...C,
452
457
  selectedChannel: s,
453
458
  onChannelSelect: t,
454
- debug: r
459
+ debug: d,
460
+ renderMessagePreview: c
455
461
  }
456
- ), [s, t, r]);
462
+ ), [s, t, d, c]);
457
463
  return /* @__PURE__ */ e(
458
464
  "div",
459
465
  {
460
- className: k(
466
+ className: F(
461
467
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
462
- a
468
+ l
463
469
  ),
464
470
  children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
465
- Ye,
471
+ Je,
466
472
  {
467
473
  filters: n,
468
474
  sort: { last_message_at: -1 },
469
475
  options: { limit: 30 },
470
- Preview: u,
471
- EmptyStateIndicator: i
476
+ Preview: x,
477
+ EmptyStateIndicator: o
472
478
  },
473
479
  JSON.stringify(n)
474
480
  ) })
@@ -476,39 +482,39 @@ const De = O.memo(
476
482
  );
477
483
  }
478
484
  );
479
- De.displayName = "ChannelList";
485
+ Te.displayName = "ChannelList";
480
486
  const le = ({
481
487
  variant: t = "default",
482
488
  className: s,
483
489
  children: n,
484
- ...a
490
+ ...l
485
491
  }) => /* @__PURE__ */ e(
486
492
  "button",
487
493
  {
488
494
  type: "button",
489
- className: k(
495
+ className: F(
490
496
  "flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
491
497
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
492
498
  s
493
499
  ),
494
- ...a,
500
+ ...l,
495
501
  children: n
496
502
  }
497
503
  );
498
- function Te({ label: t, className: s, children: n, ...a }) {
499
- return /* @__PURE__ */ o(
504
+ function Fe({ label: t, className: s, children: n, ...l }) {
505
+ return /* @__PURE__ */ i(
500
506
  "button",
501
507
  {
502
508
  type: "button",
503
- className: k(
509
+ className: F(
504
510
  "rounded-full p-2 transition-colors focus-ring",
505
511
  {
506
- "cursor-not-allowed opacity-50": a.disabled,
507
- "hover:bg-sand": !a.disabled
512
+ "cursor-not-allowed opacity-50": l.disabled,
513
+ "hover:bg-sand": !l.disabled
508
514
  },
509
515
  s
510
516
  ),
511
- ...a,
517
+ ...l,
512
518
  children: [
513
519
  /* @__PURE__ */ e("span", { className: "sr-only", children: t }),
514
520
  n
@@ -516,167 +522,167 @@ function Te({ label: t, className: s, children: n, ...a }) {
516
522
  }
517
523
  );
518
524
  }
519
- function Fe({ onClick: t }) {
520
- return /* @__PURE__ */ e(Te, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(fe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
525
+ function Le({ onClick: t }) {
526
+ return /* @__PURE__ */ e(Fe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(fe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
521
527
  }
522
- const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t) => {
523
- var z, te;
528
+ const Ys = (t) => /* @__PURE__ */ e(Qe, { ...t, position: "center" }), Js = (t) => {
529
+ var $, Q;
524
530
  const {
525
531
  additionalMessageInputProps: s,
526
532
  editing: n,
527
- endOfGroup: a,
528
- firstOfGroup: i,
533
+ endOfGroup: l,
534
+ firstOfGroup: o,
529
535
  groupedByUser: c,
530
536
  handleAction: r,
531
- handleOpenThread: u,
532
- handleRetry: f,
533
- highlighted: N,
534
- isMessageAIGenerated: v,
535
- isMyMessage: h,
536
- message: l,
537
+ handleOpenThread: d,
538
+ handleRetry: x,
539
+ highlighted: h,
540
+ isMessageAIGenerated: C,
541
+ isMyMessage: N,
542
+ message: a,
537
543
  renderText: M,
538
- threadList: p
539
- } = t, { client: S } = Xe("CustomMessage"), [g, y] = _(!1), C = Ke(l.id), {
540
- Attachment: x = ss,
541
- EditMessageModal: w = ts,
542
- MessageBlocked: D = ns,
543
- MessageBouncePrompt: b = rs,
544
- MessageDeleted: d = as,
545
- MessageIsThreadReplyInChannelButtonIndicator: m = ls,
546
- MessageRepliesCountButton: R = os,
547
- ReminderNotification: L = is,
548
- StreamedMessageText: G = cs,
549
- PinIndicator: W
550
- } = es("CustomMessage"), ee = ds(l), Q = us(l), se = Ce(
551
- () => v == null ? void 0 : v(l),
552
- [v, l]
553
- ), $ = Ce(
554
- () => !l.shared_location && !l.attachments ? [] : l.shared_location ? [l.shared_location, ...l.attachments ?? []] : l.attachments,
555
- [l]
544
+ threadList: I
545
+ } = t, { client: _ } = Ke("CustomMessage"), [f, p] = S(!1), b = es(a.id), {
546
+ Attachment: y = ts,
547
+ EditMessageModal: u = ns,
548
+ MessageBlocked: k = rs,
549
+ MessageBouncePrompt: g = as,
550
+ MessageDeleted: m = ls,
551
+ MessageIsThreadReplyInChannelButtonIndicator: w = os,
552
+ MessageRepliesCountButton: v = is,
553
+ ReminderNotification: D = cs,
554
+ StreamedMessageText: P = ds,
555
+ PinIndicator: q
556
+ } = ss("CustomMessage"), te = ms(a), K = us(a), ee = be(
557
+ () => C == null ? void 0 : C(a),
558
+ [C, a]
559
+ ), V = be(
560
+ () => !a.shared_location && !a.attachments ? [] : a.shared_location ? [a.shared_location, ...a.attachments ?? []] : a.attachments,
561
+ [a]
556
562
  );
557
- if (ms(l))
563
+ if (hs(a))
558
564
  return null;
559
- if (l.deleted_at || l.type === "deleted")
560
- return /* @__PURE__ */ e(d, { message: l });
561
- if (hs(l))
562
- return /* @__PURE__ */ e(D, {});
563
- const q = !p && !!l.reply_count, Z = !p && l.show_in_channel && l.parent_id, Y = l.status === "failed" && ((z = l.error) == null ? void 0 : z.status) !== 403, X = fs(l);
564
- let I;
565
- Y ? I = () => f(l) : X && (I = () => y(!0));
566
- const T = k(
565
+ if (a.deleted_at || a.type === "deleted")
566
+ return /* @__PURE__ */ e(m, { message: a });
567
+ if (fs(a))
568
+ return /* @__PURE__ */ e(k, {});
569
+ const W = !I && !!a.reply_count, Z = !I && a.show_in_channel && a.parent_id, Y = a.status === "failed" && (($ = a.error) == null ? void 0 : $.status) !== 403, J = gs(a);
570
+ let T;
571
+ Y ? T = () => x(a) : J && (T = () => p(!0));
572
+ const R = F(
567
573
  "str-chat__message str-chat__message-simple",
568
- `str-chat__message--${l.type}`,
569
- `str-chat__message--${l.status}`,
570
- h() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
571
- l.text ? "str-chat__message--has-text" : "has-no-text",
574
+ `str-chat__message--${a.type}`,
575
+ `str-chat__message--${a.status}`,
576
+ N() ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
577
+ a.text ? "str-chat__message--has-text" : "has-no-text",
572
578
  {
573
- "str-chat__message--has-attachment": ee,
574
- "str-chat__message--highlighted": N,
575
- "str-chat__message--pinned pinned-message": l.pinned,
576
- "str-chat__message--with-reactions": Q,
577
- "str-chat__message-send-can-be-retried": (l == null ? void 0 : l.status) === "failed" && ((te = l == null ? void 0 : l.error) == null ? void 0 : te.status) !== 403,
578
- "str-chat__message-with-thread-link": q || Z,
579
- "str-chat__virtual-message__wrapper--end": a,
580
- "str-chat__virtual-message__wrapper--first": i,
579
+ "str-chat__message--has-attachment": te,
580
+ "str-chat__message--highlighted": h,
581
+ "str-chat__message--pinned pinned-message": a.pinned,
582
+ "str-chat__message--with-reactions": K,
583
+ "str-chat__message-send-can-be-retried": (a == null ? void 0 : a.status) === "failed" && ((Q = a == null ? void 0 : a.error) == null ? void 0 : Q.status) !== 403,
584
+ "str-chat__message-with-thread-link": W || Z,
585
+ "str-chat__virtual-message__wrapper--end": l,
586
+ "str-chat__virtual-message__wrapper--first": o,
581
587
  "str-chat__virtual-message__wrapper--group": c
582
588
  }
583
- ), U = l.poll_id && S.polls.fromState(l.poll_id), B = qs(l);
584
- return /* @__PURE__ */ o(he, { children: [
589
+ ), U = a.poll_id && _.polls.fromState(a.poll_id), z = Zs(a);
590
+ return /* @__PURE__ */ i(he, { children: [
585
591
  n && /* @__PURE__ */ e(
586
- w,
592
+ u,
587
593
  {
588
594
  additionalMessageInputProps: s
589
595
  }
590
596
  ),
591
- g && /* @__PURE__ */ e(
592
- gs,
597
+ f && /* @__PURE__ */ e(
598
+ xs,
593
599
  {
594
- MessageBouncePrompt: b,
595
- onClose: () => y(!1),
596
- open: g
600
+ MessageBouncePrompt: g,
601
+ onClose: () => p(!1),
602
+ open: f
597
603
  }
598
604
  ),
599
- /* @__PURE__ */ o("div", { className: T, children: [
600
- W && /* @__PURE__ */ e(W, {}),
601
- !!C && /* @__PURE__ */ e(L, { reminder: C }),
602
- l.user && /* @__PURE__ */ e(
603
- J,
605
+ /* @__PURE__ */ i("div", { className: R, children: [
606
+ q && /* @__PURE__ */ e(q, {}),
607
+ !!b && /* @__PURE__ */ e(D, { reminder: b }),
608
+ a.user && /* @__PURE__ */ e(
609
+ X,
604
610
  {
605
611
  className: "str-chat__avatar str-chat__message-sender-avatar",
606
- id: l.user.id,
607
- image: l.user.image,
608
- name: l.user.name || l.user.id
612
+ id: a.user.id,
613
+ image: a.user.image,
614
+ name: a.user.name || a.user.id
609
615
  }
610
616
  ),
611
617
  /* @__PURE__ */ e(
612
618
  "div",
613
619
  {
614
- className: k("str-chat__message-inner", {
615
- "str-chat__simple-message--error-failed": Y || X
620
+ className: F("str-chat__message-inner", {
621
+ "str-chat__simple-message--error-failed": Y || J
616
622
  }),
617
623
  "data-testid": "message-inner",
618
- onClick: I,
619
- onKeyDown: I,
620
- role: I ? "button" : void 0,
621
- tabIndex: I ? 0 : void 0,
624
+ onClick: T,
625
+ onKeyDown: T,
626
+ role: T ? "button" : void 0,
627
+ tabIndex: T ? 0 : void 0,
622
628
  style: {
623
629
  // Force margins to 0 to prevent hover layout shift
624
630
  // Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
625
631
  marginInlineEnd: 0,
626
632
  marginInlineStart: 0
627
633
  },
628
- children: B ? (
634
+ children: z ? (
629
635
  /* Tip-only messages render as a standalone bubble */
630
- /* @__PURE__ */ e(Ie, { message: l, standalone: !0 })
631
- ) : /* @__PURE__ */ o("div", { className: "str-chat__message-bubble-wrapper", children: [
632
- /* @__PURE__ */ o("div", { className: "str-chat__message-bubble", children: [
633
- U && /* @__PURE__ */ e(xs, { poll: U }),
634
- $ != null && $.length && !l.quoted_message ? /* @__PURE__ */ e(
635
- x,
636
+ /* @__PURE__ */ e(_e, { message: a, standalone: !0 })
637
+ ) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
638
+ /* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
639
+ U && /* @__PURE__ */ e(Cs, { poll: U }),
640
+ V != null && V.length && !a.quoted_message ? /* @__PURE__ */ e(
641
+ y,
636
642
  {
637
643
  actionHandler: r,
638
- attachments: $
644
+ attachments: V
639
645
  }
640
646
  ) : null,
641
- se ? /* @__PURE__ */ e(
642
- G,
647
+ ee ? /* @__PURE__ */ e(
648
+ P,
643
649
  {
644
- message: l,
650
+ message: a,
645
651
  renderText: M
646
652
  }
647
- ) : /* @__PURE__ */ e(Cs, { message: l, renderText: M }),
648
- /* @__PURE__ */ e(bs, {})
653
+ ) : /* @__PURE__ */ e(bs, { message: a, renderText: M }),
654
+ /* @__PURE__ */ e(Ns, {})
649
655
  ] }),
650
- /* @__PURE__ */ e(Ie, { message: l })
656
+ /* @__PURE__ */ e(_e, { message: a })
651
657
  ] })
652
658
  }
653
659
  ),
654
- q && /* @__PURE__ */ e(
655
- R,
660
+ W && /* @__PURE__ */ e(
661
+ v,
656
662
  {
657
- onClick: u,
658
- reply_count: l.reply_count
663
+ onClick: d,
664
+ reply_count: a.reply_count
659
665
  }
660
666
  ),
661
- Z && /* @__PURE__ */ e(m, {})
662
- ] }, l.id)
667
+ Z && /* @__PURE__ */ e(w, {})
668
+ ] }, a.id)
663
669
  ] });
664
- }, Js = O.memo(
665
- Ys,
666
- Qe
667
- ), Qs = (t) => {
668
- const s = Ns("CustomMessage");
669
- return /* @__PURE__ */ e(Js, { ...s, ...t });
670
- }, Xs = (t) => ({
670
+ }, Qs = B.memo(
671
+ Js,
672
+ Xe
673
+ ), Xs = (t) => {
674
+ const s = vs("CustomMessage");
675
+ return /* @__PURE__ */ e(Qs, { ...s, ...t });
676
+ }, Ks = (t) => ({
671
677
  linkPreviews: Array.from(t.previews.values()).filter(
672
- (s) => pe.previewIsLoaded(s) || pe.previewIsLoading(s)
678
+ (s) => Ee.previewIsLoaded(s) || Ee.previewIsLoading(s)
673
679
  )
674
- }), Ks = ({
680
+ }), et = ({
675
681
  link: t,
676
682
  onDismiss: s
677
683
  }) => {
678
- const { og_scrape_url: n, title: a, image_url: i } = t;
679
- return /* @__PURE__ */ o(
684
+ const { og_scrape_url: n, title: l, image_url: o } = t;
685
+ return /* @__PURE__ */ i(
680
686
  "a",
681
687
  {
682
688
  href: n,
@@ -684,11 +690,11 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
684
690
  rel: "noopener noreferrer",
685
691
  className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
686
692
  children: [
687
- i && /* @__PURE__ */ e(
693
+ o && /* @__PURE__ */ e(
688
694
  "img",
689
695
  {
690
- src: i,
691
- alt: a || "",
696
+ src: o,
697
+ alt: l || "",
692
698
  className: "h-[148px] w-full rounded-[20px] object-cover"
693
699
  }
694
700
  ),
@@ -704,39 +710,39 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
704
710
  children: /* @__PURE__ */ e(fe, { className: "size-4 text-black/90" })
705
711
  }
706
712
  ),
707
- /* @__PURE__ */ o("div", { className: "p-2", children: [
708
- a && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: a }),
713
+ /* @__PURE__ */ i("div", { className: "p-2", children: [
714
+ l && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: l }),
709
715
  /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
710
716
  ] })
711
717
  ]
712
718
  }
713
719
  );
714
- }, et = () => {
715
- const { linkPreviewsManager: t } = vs(), { linkPreviews: s } = ws(
720
+ }, st = () => {
721
+ const { linkPreviewsManager: t } = ws(), { linkPreviews: s } = ys(
716
722
  t.state,
717
- Xs
718
- ), n = (i) => {
719
- t.dismissPreview(i);
723
+ Ks
724
+ ), n = (o) => {
725
+ t.dismissPreview(o);
720
726
  };
721
- return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((i) => /* @__PURE__ */ e(
722
- Ks,
727
+ 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(
728
+ et,
723
729
  {
724
- link: i,
730
+ link: o,
725
731
  onDismiss: n
726
732
  },
727
- i.og_scrape_url
733
+ o.og_scrape_url
728
734
  )) }) : null;
729
- }, st = () => {
730
- const { handleSubmit: t } = ps(), s = Es();
731
- return /* @__PURE__ */ o(he, { children: [
732
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Is, {}) }),
733
- /* @__PURE__ */ o("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: [
734
- /* @__PURE__ */ e(_s, {}),
735
- /* @__PURE__ */ e(et, {}),
735
+ }, tt = () => {
736
+ const { handleSubmit: t } = Es(), s = Is();
737
+ return /* @__PURE__ */ i(he, { children: [
738
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(_s, {}) }),
739
+ /* @__PURE__ */ i("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: [
736
740
  /* @__PURE__ */ e(Ss, {}),
737
- /* @__PURE__ */ o("div", { className: "flex", children: [
741
+ /* @__PURE__ */ e(st, {}),
742
+ /* @__PURE__ */ e(Ms, {}),
743
+ /* @__PURE__ */ i("div", { className: "flex", children: [
738
744
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
739
- Ms,
745
+ ks,
740
746
  {
741
747
  className: "w-full resize-none outline-none leading-6",
742
748
  autoFocus: !0,
@@ -752,33 +758,33 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
752
758
  disabled: !s,
753
759
  onClick: t,
754
760
  type: "button",
755
- children: /* @__PURE__ */ e(Ps, { className: "size-4" })
761
+ children: /* @__PURE__ */ e(Os, { className: "size-4" })
756
762
  }
757
763
  )
758
764
  ] })
759
765
  ] })
760
766
  ] });
761
- }, tt = ({
767
+ }, nt = ({
762
768
  renderActions: t
763
- }) => /* @__PURE__ */ o("div", { className: "message-input flex items-center gap-2 p-4", children: [
769
+ }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
764
770
  t && (t == null ? void 0 : t()),
765
- /* @__PURE__ */ e(ys, { Input: st })
766
- ] }), nt = (t) => {
771
+ /* @__PURE__ */ e(ps, { Input: tt })
772
+ ] }), rt = (t) => {
767
773
  const s = t.message.hide_date === !0;
768
- return /* @__PURE__ */ o("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
769
- /* @__PURE__ */ o("div", { className: "str-chat__message--system__text", children: [
774
+ return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
775
+ /* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
770
776
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
771
777
  /* @__PURE__ */ e("p", { children: t.message.text }),
772
778
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
773
779
  ] }),
774
- !s && /* @__PURE__ */ e(ks, { message: t.message })
780
+ !s && /* @__PURE__ */ e(Rs, { message: t.message })
775
781
  ] });
776
- }, rt = () => null, at = ({ className: t, message: s }) => /* @__PURE__ */ o(
782
+ }, at = () => null, lt = ({ className: t, message: s }) => /* @__PURE__ */ i(
777
783
  "div",
778
784
  {
779
- className: k("flex items-center justify-center h-full", t),
785
+ className: F("flex items-center justify-center h-full", t),
780
786
  children: [
781
- /* @__PURE__ */ o("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
787
+ /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
782
788
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
783
789
  "animateTransform",
784
790
  {
@@ -816,88 +822,88 @@ const Zs = (t) => /* @__PURE__ */ e(Je, { ...t, position: "center" }), Ys = (t)
816
822
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
817
823
  ]
818
824
  }
819
- ), ce = O.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ o("div", { className: "flex items-center", children: [
820
- /* @__PURE__ */ e(at, { className: "w-6 h-6" }),
825
+ ), ce = B.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
826
+ /* @__PURE__ */ e(lt, { className: "w-6 h-6" }),
821
827
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
822
828
  ] }) }));
823
829
  ce.displayName = "LoadingState";
824
- const lt = ({
830
+ const ot = ({
825
831
  onBack: t,
826
832
  showBackButton: s,
827
833
  onShowInfo: n,
828
- canShowInfo: a,
829
- showStarButton: i = !1
834
+ canShowInfo: l,
835
+ showStarButton: o = !1
830
836
  }) => {
831
- var l, M, p, S, g, y;
832
- const { channel: c } = _e(), r = O.useMemo(() => Object.values(c.state.members || {}).find(
833
- (x) => {
834
- var w;
835
- return ((w = x.user) == null ? void 0 : w.id) && x.user.id !== c._client.userID;
837
+ var a, M, I, _, f, p;
838
+ const { channel: c } = Se(), r = B.useMemo(() => Object.values(c.state.members || {}).find(
839
+ (y) => {
840
+ var u;
841
+ return ((u = y.user) == null ? void 0 : u.id) && y.user.id !== c._client.userID;
836
842
  }
837
- ), [c._client.userID, c.state.members]), u = ((l = r == null ? void 0 : r.user) == null ? void 0 : l.name) || ((M = r == null ? void 0 : r.user) == null ? void 0 : M.id) || "Unknown member", f = (p = r == null ? void 0 : r.user) == null ? void 0 : p.image, [N, v] = _(
838
- !!((S = c.state.membership) != null && S.pinned_at)
843
+ ), [c._client.userID, c.state.members]), d = ((a = r == null ? void 0 : r.user) == null ? void 0 : a.name) || ((M = r == null ? void 0 : r.user) == null ? void 0 : M.id) || "Unknown member", x = (I = r == null ? void 0 : r.user) == null ? void 0 : I.image, [h, C] = S(
844
+ !!((_ = c.state.membership) != null && _.pinned_at)
839
845
  );
840
- V(() => {
841
- const C = (x) => {
842
- var w;
843
- v(
844
- x != null && x.member ? !!x.member.pinned_at : !!((w = c.state.membership) != null && w.pinned_at)
846
+ H(() => {
847
+ const b = (y) => {
848
+ var u;
849
+ C(
850
+ y != null && y.member ? !!y.member.pinned_at : !!((u = c.state.membership) != null && u.pinned_at)
845
851
  );
846
852
  };
847
- return c.on("member.updated", C), () => {
848
- c.off("member.updated", C);
853
+ return c.on("member.updated", b), () => {
854
+ c.off("member.updated", b);
849
855
  };
850
856
  }, [c]);
851
- const h = async () => {
857
+ const N = async () => {
852
858
  try {
853
- N ? await c.unpin() : await c.pin();
854
- } catch (C) {
859
+ h ? await c.unpin() : await c.pin();
860
+ } catch (b) {
855
861
  console.error(
856
862
  "[CustomChannelHeader] Failed to update pinned status:",
857
- C
863
+ b
858
864
  );
859
865
  }
860
866
  };
861
- return /* @__PURE__ */ o("div", { className: "@container", children: [
862
- /* @__PURE__ */ o("div", { className: "grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden", children: [
867
+ return /* @__PURE__ */ i("div", { className: "@container", children: [
868
+ /* @__PURE__ */ i("div", { className: "grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden", children: [
863
869
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ e(
864
870
  "button",
865
871
  {
866
- className: k(
872
+ className: F(
867
873
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
868
874
  ),
869
875
  onClick: t || (() => {
870
876
  }),
871
877
  type: "button",
872
878
  "aria-label": "Back to conversations",
873
- children: /* @__PURE__ */ e(be, { className: "size-5 text-black/90" })
879
+ children: /* @__PURE__ */ e(Ne, { className: "size-5 text-black/90" })
874
880
  }
875
881
  ) }),
876
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center", children: [
882
+ /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
877
883
  /* @__PURE__ */ e(
878
- J,
884
+ X,
879
885
  {
880
- id: ((g = r == null ? void 0 : r.user) == null ? void 0 : g.id) || c.id || "unknown",
881
- name: u,
882
- image: f,
886
+ id: ((f = r == null ? void 0 : r.user) == null ? void 0 : f.id) || c.id || "unknown",
887
+ name: d,
888
+ image: x,
883
889
  size: 40
884
890
  }
885
891
  ),
886
- /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: u })
892
+ /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: d })
887
893
  ] }),
888
- /* @__PURE__ */ o("div", { className: "flex justify-end items-center gap-2", children: [
889
- i && /* @__PURE__ */ e(
894
+ /* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-2", children: [
895
+ o && /* @__PURE__ */ e(
890
896
  "button",
891
897
  {
892
898
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
893
- onClick: h,
899
+ onClick: N,
894
900
  type: "button",
895
- "aria-label": N ? "Unstar conversation" : "Star conversation",
901
+ "aria-label": h ? "Unstar conversation" : "Star conversation",
896
902
  children: /* @__PURE__ */ e(
897
- Ne,
903
+ ve,
898
904
  {
899
905
  className: "size-5 text-black/90",
900
- weight: N ? "fill" : "regular"
906
+ weight: h ? "fill" : "regular"
901
907
  }
902
908
  )
903
909
  }
@@ -909,13 +915,13 @@ const lt = ({
909
915
  onClick: n,
910
916
  type: "button",
911
917
  "aria-label": "Show info",
912
- children: /* @__PURE__ */ e(ve, { className: "size-5 text-black/90" })
918
+ children: /* @__PURE__ */ e(we, { className: "size-5 text-black/90" })
913
919
  }
914
920
  )
915
921
  ] })
916
922
  ] }),
917
- /* @__PURE__ */ o("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
918
- /* @__PURE__ */ o("div", { className: "flex items-center gap-4 min-w-0", children: [
923
+ /* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
924
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
919
925
  s && t && /* @__PURE__ */ e(
920
926
  "button",
921
927
  {
@@ -923,131 +929,131 @@ const lt = ({
923
929
  onClick: t,
924
930
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
925
931
  "aria-label": "Back to conversations",
926
- children: /* @__PURE__ */ e(be, { className: "size-5 text-black/90" })
932
+ children: /* @__PURE__ */ e(Ne, { className: "size-5 text-black/90" })
927
933
  }
928
934
  ),
929
935
  /* @__PURE__ */ e(
930
- J,
936
+ X,
931
937
  {
932
- id: ((y = r == null ? void 0 : r.user) == null ? void 0 : y.id) || c.id || "unknown",
933
- name: u,
934
- image: f,
938
+ id: ((p = r == null ? void 0 : r.user) == null ? void 0 : p.id) || c.id || "unknown",
939
+ name: d,
940
+ image: x,
935
941
  size: 40
936
942
  }
937
943
  ),
938
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: u }) })
944
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: d }) })
939
945
  ] }),
940
- /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
941
- i && /* @__PURE__ */ e(
946
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
947
+ o && /* @__PURE__ */ e(
942
948
  "button",
943
949
  {
944
950
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
945
- onClick: h,
951
+ onClick: N,
946
952
  type: "button",
947
- "aria-label": N ? "Unstar conversation" : "Star conversation",
953
+ "aria-label": h ? "Unstar conversation" : "Star conversation",
948
954
  children: /* @__PURE__ */ e(
949
- Ne,
955
+ ve,
950
956
  {
951
957
  className: "size-5 text-black/90",
952
- weight: N ? "fill" : "regular"
958
+ weight: h ? "fill" : "regular"
953
959
  }
954
960
  )
955
961
  }
956
962
  ),
957
- a && n && /* @__PURE__ */ e(
963
+ l && n && /* @__PURE__ */ e(
958
964
  "button",
959
965
  {
960
966
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
961
967
  onClick: n,
962
968
  type: "button",
963
969
  "aria-label": "Show info",
964
- children: /* @__PURE__ */ e(ve, { className: "size-5 text-black/90" })
970
+ children: /* @__PURE__ */ e(we, { className: "size-5 text-black/90" })
965
971
  }
966
972
  )
967
973
  ] })
968
974
  ] })
969
975
  ] });
970
- }, ot = ({
976
+ }, it = ({
971
977
  dialogRef: t,
972
978
  onClose: s,
973
979
  participant: n,
974
- channel: a,
975
- followerStatusLabel: i,
980
+ channel: l,
981
+ followerStatusLabel: o,
976
982
  onLeaveConversation: c,
977
983
  onBlockParticipant: r,
978
- showDeleteConversation: u = !0,
979
- onDeleteConversationClick: f,
980
- onBlockParticipantClick: N,
981
- onReportParticipantClick: v
984
+ showDeleteConversation: d = !0,
985
+ onDeleteConversationClick: x,
986
+ onBlockParticipantClick: h,
987
+ onReportParticipantClick: C
982
988
  }) => {
983
- var Q, se, $, q, Z, Y, X;
984
- const { service: h, debug: l } = de(), [M, p] = _(!1), [S, g] = _(!1), [y, C] = _(!1), x = F(async () => {
985
- var I;
986
- if (!(!h || !((I = n == null ? void 0 : n.user) != null && I.id)))
989
+ var K, ee, V, W, Z, Y, J;
990
+ const { service: N, debug: a } = de(), [M, I] = S(!1), [_, f] = S(!1), [p, b] = S(!1), y = L(async () => {
991
+ var T;
992
+ if (!(!N || !((T = n == null ? void 0 : n.user) != null && T.id)))
987
993
  try {
988
- const U = (await h.getBlockedUsers()).some(
989
- (B) => {
990
- var z;
991
- return B.blocked_user_id === ((z = n == null ? void 0 : n.user) == null ? void 0 : z.id);
994
+ const U = (await N.getBlockedUsers()).some(
995
+ (z) => {
996
+ var $;
997
+ return z.blocked_user_id === (($ = n == null ? void 0 : n.user) == null ? void 0 : $.id);
992
998
  }
993
999
  );
994
- p(U);
995
- } catch (T) {
1000
+ I(U);
1001
+ } catch (R) {
996
1002
  console.error(
997
1003
  "[ChannelInfoDialog] Failed to check blocked status:",
998
- T
1004
+ R
999
1005
  );
1000
1006
  }
1001
- }, [h, (Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id]);
1002
- V(() => {
1003
- x();
1004
- }, [x]);
1005
- const w = async () => {
1006
- var I;
1007
- if (!S) {
1008
- f == null || f(), l && console.log("[ChannelInfoDialog] Leave conversation", a.cid), g(!0);
1007
+ }, [N, (K = n == null ? void 0 : n.user) == null ? void 0 : K.id]);
1008
+ H(() => {
1009
+ y();
1010
+ }, [y]);
1011
+ const u = async () => {
1012
+ var T;
1013
+ if (!_) {
1014
+ x == null || x(), a && console.log("[ChannelInfoDialog] Leave conversation", l.cid), f(!0);
1009
1015
  try {
1010
- const T = ((I = a._client) == null ? void 0 : I.userID) ?? null;
1011
- await a.hide(T, !1), c && await c(a), s();
1012
- } catch (T) {
1013
- console.error("[ChannelInfoDialog] Failed to leave conversation", T);
1016
+ const R = ((T = l._client) == null ? void 0 : T.userID) ?? null;
1017
+ await l.hide(R, !1), c && await c(l), s();
1018
+ } catch (R) {
1019
+ console.error("[ChannelInfoDialog] Failed to leave conversation", R);
1014
1020
  } finally {
1015
- g(!1);
1021
+ f(!1);
1016
1022
  }
1017
1023
  }
1018
- }, D = async () => {
1019
- var I, T, U;
1020
- if (!(y || !h)) {
1021
- N == null || N(), l && console.log("[ChannelInfoDialog] Block member", (I = n == null ? void 0 : n.user) == null ? void 0 : I.id), C(!0);
1024
+ }, k = async () => {
1025
+ var T, R, U;
1026
+ if (!(p || !N)) {
1027
+ h == null || h(), a && console.log("[ChannelInfoDialog] Block member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), b(!0);
1022
1028
  try {
1023
- await h.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
1024
- } catch (B) {
1025
- console.error("[ChannelInfoDialog] Failed to block member", B);
1029
+ await N.blockUser((R = n == null ? void 0 : n.user) == null ? void 0 : R.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
1030
+ } catch (z) {
1031
+ console.error("[ChannelInfoDialog] Failed to block member", z);
1026
1032
  } finally {
1027
- C(!1);
1033
+ b(!1);
1028
1034
  }
1029
1035
  }
1030
- }, b = async () => {
1031
- var I, T, U;
1032
- if (!(y || !h)) {
1033
- N == null || N(), l && console.log("[ChannelInfoDialog] Unblock member", (I = n == null ? void 0 : n.user) == null ? void 0 : I.id), C(!0);
1036
+ }, g = async () => {
1037
+ var T, R, U;
1038
+ if (!(p || !N)) {
1039
+ h == null || h(), a && console.log("[ChannelInfoDialog] Unblock member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), b(!0);
1034
1040
  try {
1035
- await h.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
1036
- } catch (B) {
1037
- console.error("[ChannelInfoDialog] Failed to unblock member", B);
1041
+ await N.unBlockUser((R = n == null ? void 0 : n.user) == null ? void 0 : R.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
1042
+ } catch (z) {
1043
+ console.error("[ChannelInfoDialog] Failed to unblock member", z);
1038
1044
  } finally {
1039
- C(!1);
1045
+ b(!1);
1040
1046
  }
1041
1047
  }
1042
- }, d = () => {
1043
- v == null || v(), s(), window.open(
1048
+ }, m = () => {
1049
+ C == null || C(), s(), window.open(
1044
1050
  "https://linktr.ee/s/about/trust-center/report",
1045
1051
  "_blank",
1046
1052
  "noopener,noreferrer"
1047
1053
  );
1048
1054
  };
1049
1055
  if (!n) return null;
1050
- const m = ((se = n.user) == null ? void 0 : se.name) || (($ = n.user) == null ? void 0 : $.id) || "Unknown member", R = (q = n.user) == null ? void 0 : q.image, L = (Z = n.user) == null ? void 0 : Z.email, G = (Y = n.user) == null ? void 0 : Y.username, W = L || (G ? `linktr.ee/${G}` : void 0), ee = ((X = n.user) == null ? void 0 : X.id) || "unknown";
1056
+ const w = ((ee = n.user) == null ? void 0 : ee.name) || ((V = n.user) == null ? void 0 : V.id) || "Unknown member", v = (W = n.user) == null ? void 0 : W.image, D = (Z = n.user) == null ? void 0 : Z.email, P = (Y = n.user) == null ? void 0 : Y.username, q = D || (P ? `linktr.ee/${P}` : void 0), te = ((J = n.user) == null ? void 0 : J.id) || "unknown";
1051
1057
  return (
1052
1058
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1053
1059
  /* @__PURE__ */ e(
@@ -1056,90 +1062,90 @@ const lt = ({
1056
1062
  ref: t,
1057
1063
  className: "mes-dialog group",
1058
1064
  onClose: s,
1059
- onClick: (I) => {
1060
- I.target === t.current && s();
1065
+ onClick: (T) => {
1066
+ T.target === t.current && s();
1061
1067
  },
1062
- children: /* @__PURE__ */ o("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: [
1063
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
1068
+ children: /* @__PURE__ */ i("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: [
1069
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
1064
1070
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
1065
- /* @__PURE__ */ e(Fe, { onClick: s })
1071
+ /* @__PURE__ */ e(Le, { onClick: s })
1066
1072
  ] }),
1067
- /* @__PURE__ */ o("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
1073
+ /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
1068
1074
  /* @__PURE__ */ e(
1069
1075
  "div",
1070
1076
  {
1071
1077
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
1072
1078
  style: { backgroundColor: "#FBFAF9" },
1073
- children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3 w-full", children: [
1079
+ children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
1074
1080
  /* @__PURE__ */ e(
1075
- J,
1081
+ X,
1076
1082
  {
1077
- id: ee,
1078
- name: m,
1079
- image: R,
1083
+ id: te,
1084
+ name: w,
1085
+ image: v,
1080
1086
  size: 88,
1081
1087
  shape: "circle"
1082
1088
  }
1083
1089
  ),
1084
- /* @__PURE__ */ o("div", { className: "flex flex-col min-w-0 flex-1", children: [
1085
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: m }),
1086
- W && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: W }),
1087
- i && /* @__PURE__ */ e(
1090
+ /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
1091
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: w }),
1092
+ q && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: q }),
1093
+ o && /* @__PURE__ */ e(
1088
1094
  "span",
1089
1095
  {
1090
1096
  className: "mt-1 rounded-full text-xs font-normal w-fit",
1091
1097
  style: {
1092
1098
  padding: "4px 8px",
1093
- backgroundColor: i === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
1094
- color: i === "Subscribed to you" ? "#008236" : "#78716C",
1099
+ backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
1100
+ color: o === "Subscribed to you" ? "#008236" : "#78716C",
1095
1101
  lineHeight: "133.333%",
1096
1102
  letterSpacing: "0.21px"
1097
1103
  },
1098
- children: i
1104
+ children: o
1099
1105
  }
1100
1106
  )
1101
1107
  ] })
1102
1108
  ] })
1103
1109
  }
1104
1110
  ),
1105
- /* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
1106
- u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
1111
+ /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
1112
+ d && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
1107
1113
  le,
1108
1114
  {
1109
- onClick: w,
1110
- disabled: S,
1111
- "aria-busy": S,
1115
+ onClick: u,
1116
+ disabled: _,
1117
+ "aria-busy": _,
1112
1118
  children: [
1113
- S ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Os, { className: "h-5 w-5" }),
1119
+ _ ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Us, { className: "h-5 w-5" }),
1114
1120
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
1115
1121
  ]
1116
1122
  }
1117
1123
  ) }),
1118
- /* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ o(
1124
+ /* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ i(
1119
1125
  le,
1120
1126
  {
1121
- onClick: b,
1122
- disabled: y,
1123
- "aria-busy": y,
1127
+ onClick: g,
1128
+ disabled: p,
1129
+ "aria-busy": p,
1124
1130
  children: [
1125
- y ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(we, { className: "h-5 w-5" }),
1131
+ p ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ye, { className: "h-5 w-5" }),
1126
1132
  /* @__PURE__ */ e("span", { children: "Unblock" })
1127
1133
  ]
1128
1134
  }
1129
- ) : /* @__PURE__ */ o(
1135
+ ) : /* @__PURE__ */ i(
1130
1136
  le,
1131
1137
  {
1132
- onClick: D,
1133
- disabled: y,
1134
- "aria-busy": y,
1138
+ onClick: k,
1139
+ disabled: p,
1140
+ "aria-busy": p,
1135
1141
  children: [
1136
- y ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(we, { className: "h-5 w-5" }),
1142
+ p ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ye, { className: "h-5 w-5" }),
1137
1143
  /* @__PURE__ */ e("span", { children: "Block" })
1138
1144
  ]
1139
1145
  }
1140
1146
  ) }),
1141
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(le, { variant: "danger", onClick: d, children: [
1142
- /* @__PURE__ */ e(Us, { className: "h-5 w-5" }),
1147
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(le, { variant: "danger", onClick: m, children: [
1148
+ /* @__PURE__ */ e(Bs, { className: "h-5 w-5" }),
1143
1149
  /* @__PURE__ */ e("span", { children: "Report" })
1144
1150
  ] }) })
1145
1151
  ] })
@@ -1148,56 +1154,56 @@ const lt = ({
1148
1154
  }
1149
1155
  )
1150
1156
  );
1151
- }, it = ({
1157
+ }, ct = ({
1152
1158
  onBack: t,
1153
1159
  showBackButton: s,
1154
1160
  renderMessageInputActions: n,
1155
- onLeaveConversation: a,
1156
- onBlockParticipant: i,
1161
+ onLeaveConversation: l,
1162
+ onBlockParticipant: o,
1157
1163
  showDeleteConversation: c = !0,
1158
1164
  onDeleteConversationClick: r,
1159
- onBlockParticipantClick: u,
1160
- onReportParticipantClick: f,
1161
- showStarButton: N = !1
1165
+ onBlockParticipantClick: d,
1166
+ onReportParticipantClick: x,
1167
+ showStarButton: h = !1
1162
1168
  }) => {
1163
- const { channel: v } = _e(), h = H(null), l = O.useMemo(() => Object.values(v.state.members || {}).find(
1164
- (y) => {
1165
- var C;
1166
- return ((C = y.user) == null ? void 0 : C.id) && y.user.id !== v._client.userID;
1169
+ const { channel: C } = Se(), N = G(null), a = B.useMemo(() => Object.values(C.state.members || {}).find(
1170
+ (p) => {
1171
+ var b;
1172
+ return ((b = p.user) == null ? void 0 : b.id) && p.user.id !== C._client.userID;
1167
1173
  }
1168
- ), [v._client.userID, v.state.members]), M = O.useMemo(() => {
1169
- const g = v.data ?? {};
1170
- if (g.followerStatus)
1171
- return String(g.followerStatus);
1172
- if (g.isFollower !== void 0)
1173
- return g.isFollower ? "Subscribed to you" : "Not subscribed";
1174
- }, [v.data]), p = F(() => {
1175
- var g;
1176
- (g = h.current) == null || g.showModal();
1177
- }, []), S = F(() => {
1178
- var g;
1179
- (g = h.current) == null || g.close();
1174
+ ), [C._client.userID, C.state.members]), M = B.useMemo(() => {
1175
+ const f = C.data ?? {};
1176
+ if (f.followerStatus)
1177
+ return String(f.followerStatus);
1178
+ if (f.isFollower !== void 0)
1179
+ return f.isFollower ? "Subscribed to you" : "Not subscribed";
1180
+ }, [C.data]), I = L(() => {
1181
+ var f;
1182
+ (f = N.current) == null || f.showModal();
1183
+ }, []), _ = L(() => {
1184
+ var f;
1185
+ (f = N.current) == null || f.close();
1180
1186
  }, []);
1181
- return /* @__PURE__ */ o(he, { children: [
1187
+ return /* @__PURE__ */ i(he, { children: [
1182
1188
  /* @__PURE__ */ e(
1183
- Ds,
1189
+ Ts,
1184
1190
  {
1185
1191
  overrides: {
1186
- Message: (g) => /* @__PURE__ */ e(Qs, { ...g })
1192
+ Message: (f) => /* @__PURE__ */ e(Xs, { ...f })
1187
1193
  },
1188
- children: /* @__PURE__ */ o(Ts, { children: [
1194
+ children: /* @__PURE__ */ i(Fs, { children: [
1189
1195
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
1190
- lt,
1196
+ ot,
1191
1197
  {
1192
1198
  onBack: t,
1193
1199
  showBackButton: s,
1194
- onShowInfo: p,
1195
- canShowInfo: !!l,
1196
- showStarButton: N
1200
+ onShowInfo: I,
1201
+ canShowInfo: !!a,
1202
+ showStarButton: h
1197
1203
  }
1198
1204
  ) }),
1199
1205
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
1200
- Fs,
1206
+ Ls,
1201
1207
  {
1202
1208
  hideDeletedMessages: !0,
1203
1209
  hideNewMessageSeparator: !1,
@@ -1205,100 +1211,100 @@ const lt = ({
1205
1211
  }
1206
1212
  ) }),
1207
1213
  /* @__PURE__ */ e(
1208
- tt,
1214
+ nt,
1209
1215
  {
1210
- renderActions: () => n == null ? void 0 : n(v)
1216
+ renderActions: () => n == null ? void 0 : n(C)
1211
1217
  }
1212
1218
  )
1213
1219
  ] })
1214
1220
  }
1215
1221
  ),
1216
1222
  /* @__PURE__ */ e(
1217
- ot,
1223
+ it,
1218
1224
  {
1219
- dialogRef: h,
1220
- onClose: S,
1221
- participant: l,
1222
- channel: v,
1225
+ dialogRef: N,
1226
+ onClose: _,
1227
+ participant: a,
1228
+ channel: C,
1223
1229
  followerStatusLabel: M,
1224
- onLeaveConversation: a,
1225
- onBlockParticipant: i,
1230
+ onLeaveConversation: l,
1231
+ onBlockParticipant: o,
1226
1232
  showDeleteConversation: c,
1227
1233
  onDeleteConversationClick: r,
1228
- onBlockParticipantClick: u,
1229
- onReportParticipantClick: f
1234
+ onBlockParticipantClick: d,
1235
+ onReportParticipantClick: x
1230
1236
  }
1231
1237
  )
1232
1238
  ] });
1233
- }, Le = O.memo(
1239
+ }, Pe = B.memo(
1234
1240
  ({
1235
1241
  channel: t,
1236
1242
  onBack: s,
1237
1243
  showBackButton: n = !1,
1238
- renderMessageInputActions: a,
1239
- onLeaveConversation: i,
1244
+ renderMessageInputActions: l,
1245
+ onLeaveConversation: o,
1240
1246
  onBlockParticipant: c,
1241
1247
  className: r,
1242
- CustomChannelEmptyState: u = rt,
1243
- showDeleteConversation: f = !0,
1244
- onDeleteConversationClick: N,
1245
- onBlockParticipantClick: v,
1246
- onReportParticipantClick: h,
1247
- dmAgentEnabled: l,
1248
+ CustomChannelEmptyState: d = at,
1249
+ showDeleteConversation: x = !0,
1250
+ onDeleteConversationClick: h,
1251
+ onBlockParticipantClick: C,
1252
+ onReportParticipantClick: N,
1253
+ dmAgentEnabled: a,
1248
1254
  messageMetadata: M,
1249
- onMessageSent: p,
1250
- showStarButton: S = !1
1255
+ onMessageSent: I,
1256
+ showStarButton: _ = !1
1251
1257
  }) => {
1252
- const g = F(
1253
- async (y, C, x) => {
1254
- var R;
1255
- const w = ((R = t.data) == null ? void 0 : R.chatbot_paused) === !0, D = l && !w, b = {
1256
- ...C,
1257
- ...D && { silent: !0 },
1258
+ const f = L(
1259
+ async (p, b, y) => {
1260
+ var v;
1261
+ const u = ((v = t.data) == null ? void 0 : v.chatbot_paused) === !0, k = a && !u, g = {
1262
+ ...b,
1263
+ ...k && { silent: !0 },
1258
1264
  ...M && {
1259
1265
  metadata: {
1260
- ...C.metadata ?? {},
1266
+ ...b.metadata ?? {},
1261
1267
  ...M
1262
1268
  }
1263
1269
  }
1264
- }, d = {
1265
- ...x,
1266
- ...D && { skip_push: !0 }
1267
- }, m = await t.sendMessage(b, d);
1268
- return p == null || p(m), m;
1270
+ }, m = {
1271
+ ...y,
1272
+ ...k && { skip_push: !0 }
1273
+ }, w = await t.sendMessage(g, m);
1274
+ return I == null || I(w), w;
1269
1275
  },
1270
- [t, l, M, p]
1276
+ [t, a, M, I]
1271
1277
  );
1272
1278
  return /* @__PURE__ */ e(
1273
1279
  "div",
1274
1280
  {
1275
- className: k(
1281
+ className: F(
1276
1282
  "messaging-channel-view h-full flex flex-col",
1277
1283
  r
1278
1284
  ),
1279
1285
  children: /* @__PURE__ */ e(
1280
- Rs,
1286
+ Ds,
1281
1287
  {
1282
1288
  channel: t,
1283
- MessageSystem: nt,
1284
- EmptyStateIndicator: u,
1289
+ MessageSystem: rt,
1290
+ EmptyStateIndicator: d,
1285
1291
  LoadingIndicator: ce,
1286
- DateSeparator: Zs,
1287
- doSendMessageRequest: g,
1292
+ DateSeparator: Ys,
1293
+ doSendMessageRequest: f,
1288
1294
  children: /* @__PURE__ */ e(
1289
- it,
1295
+ ct,
1290
1296
  {
1291
1297
  onBack: s,
1292
1298
  showBackButton: n,
1293
- renderMessageInputActions: a,
1294
- onLeaveConversation: i,
1299
+ renderMessageInputActions: l,
1300
+ onLeaveConversation: o,
1295
1301
  onBlockParticipant: c,
1296
- CustomChannelEmptyState: u,
1297
- showDeleteConversation: f,
1298
- onDeleteConversationClick: N,
1299
- onBlockParticipantClick: v,
1300
- onReportParticipantClick: h,
1301
- showStarButton: S
1302
+ CustomChannelEmptyState: d,
1303
+ showDeleteConversation: x,
1304
+ onDeleteConversationClick: h,
1305
+ onBlockParticipantClick: C,
1306
+ onReportParticipantClick: N,
1307
+ showStarButton: _
1302
1308
  }
1303
1309
  )
1304
1310
  }
@@ -1307,16 +1313,16 @@ const lt = ({
1307
1313
  );
1308
1314
  }
1309
1315
  );
1310
- Le.displayName = "ChannelView";
1311
- function ct({
1316
+ Pe.displayName = "ChannelView";
1317
+ function dt({
1312
1318
  searchQuery: t,
1313
1319
  setSearchQuery: s,
1314
1320
  placeholder: n
1315
1321
  }) {
1316
- const a = H(null);
1317
- return /* @__PURE__ */ o("div", { className: "relative", children: [
1322
+ const l = G(null);
1323
+ return /* @__PURE__ */ i("div", { className: "relative", children: [
1318
1324
  /* @__PURE__ */ e(
1319
- Bs,
1325
+ js,
1320
1326
  {
1321
1327
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
1322
1328
  weight: "bold"
@@ -1325,21 +1331,21 @@ function ct({
1325
1331
  /* @__PURE__ */ e(
1326
1332
  "input",
1327
1333
  {
1328
- ref: a,
1334
+ ref: l,
1329
1335
  type: "text",
1330
1336
  placeholder: n,
1331
1337
  value: t,
1332
- onChange: (i) => s(i.target.value),
1338
+ onChange: (o) => s(o.target.value),
1333
1339
  className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
1334
1340
  }
1335
1341
  ),
1336
1342
  t && /* @__PURE__ */ e(
1337
- Te,
1343
+ Fe,
1338
1344
  {
1339
1345
  label: "Clear search",
1340
1346
  onClick: () => {
1341
- var i;
1342
- s(""), (i = a.current) == null || i.focus();
1347
+ var o;
1348
+ s(""), (o = l.current) == null || o.focus();
1343
1349
  },
1344
1350
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1345
1351
  children: /* @__PURE__ */ e(fe, { className: "h-4 w-4", weight: "bold" })
@@ -1347,144 +1353,144 @@ function ct({
1347
1353
  )
1348
1354
  ] });
1349
1355
  }
1350
- const dt = ({
1356
+ const mt = ({
1351
1357
  participantSource: t,
1352
1358
  onSelectParticipant: s,
1353
1359
  onClose: n,
1354
- existingParticipantIds: a = /* @__PURE__ */ new Set(),
1355
- participantLabel: i = "participants",
1360
+ existingParticipantIds: l = /* @__PURE__ */ new Set(),
1361
+ participantLabel: o = "participants",
1356
1362
  searchPlaceholder: c = "Search participants...",
1357
1363
  className: r
1358
1364
  }) => {
1359
- const { debug: u } = de(), [f, N] = _(""), [v, h] = _([]), [l, M] = _(!1), [p, S] = _(null), [g, y] = _(
1365
+ const { debug: d } = de(), [x, h] = S(""), [C, N] = S([]), [a, M] = S(!1), [I, _] = S(null), [f, p] = S(
1360
1366
  null
1361
- ), C = H(!1);
1362
- V(() => {
1367
+ ), b = G(!1);
1368
+ H(() => {
1363
1369
  if (t.loading) {
1364
- u && console.log(
1370
+ d && console.log(
1365
1371
  "[ParticipantPicker] Waiting for participant source to finish loading..."
1366
1372
  );
1367
1373
  return;
1368
1374
  }
1369
- if (C.current) return;
1375
+ if (b.current) return;
1370
1376
  (async () => {
1371
- u && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), S(null);
1377
+ d && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), _(null);
1372
1378
  try {
1373
- const d = await t.loadParticipants({
1379
+ const m = await t.loadParticipants({
1374
1380
  search: "",
1375
1381
  // Load all participants initially
1376
1382
  limit: 100
1377
1383
  });
1378
- h(d.participants), C.current = !0, u && console.log(
1384
+ N(m.participants), b.current = !0, d && console.log(
1379
1385
  "[ParticipantPicker] Participants loaded successfully:",
1380
- d.participants.length
1386
+ m.participants.length
1381
1387
  );
1382
- } catch (d) {
1383
- const m = d instanceof Error ? d.message : "Failed to load participants";
1384
- S(m), console.error("[ParticipantPicker] Failed to load participants:", d);
1388
+ } catch (m) {
1389
+ const w = m instanceof Error ? m.message : "Failed to load participants";
1390
+ _(w), console.error("[ParticipantPicker] Failed to load participants:", m);
1385
1391
  } finally {
1386
1392
  M(!1);
1387
1393
  }
1388
1394
  })();
1389
- }, [t.loading, u]);
1390
- const x = v.filter((b) => !a.has(b.id)).filter((b) => {
1391
- var m;
1392
- if (!f) return !0;
1393
- const d = f.toLowerCase();
1394
- return b.name.toLowerCase().includes(d) || ((m = b.email) == null ? void 0 : m.toLowerCase().includes(d)) || !1;
1395
- }), w = F(
1396
- async (b) => {
1397
- if (!g) {
1398
- y(b.id);
1395
+ }, [t.loading, d]);
1396
+ const y = C.filter((g) => !l.has(g.id)).filter((g) => {
1397
+ var w;
1398
+ if (!x) return !0;
1399
+ const m = x.toLowerCase();
1400
+ return g.name.toLowerCase().includes(m) || ((w = g.email) == null ? void 0 : w.toLowerCase().includes(m)) || !1;
1401
+ }), u = L(
1402
+ async (g) => {
1403
+ if (!f) {
1404
+ p(g.id);
1399
1405
  try {
1400
- await s(b);
1401
- } catch (d) {
1402
- console.error("[ParticipantPicker] Failed to start chat:", d), y(null);
1406
+ await s(g);
1407
+ } catch (m) {
1408
+ console.error("[ParticipantPicker] Failed to start chat:", m), p(null);
1403
1409
  }
1404
1410
  }
1405
1411
  },
1406
- [s, g]
1407
- ), D = (b, d) => {
1408
- (b.key === "Enter" || b.key === " ") && (b.preventDefault(), w(d));
1412
+ [s, f]
1413
+ ), k = (g, m) => {
1414
+ (g.key === "Enter" || g.key === " ") && (g.preventDefault(), u(m));
1409
1415
  };
1410
- return /* @__PURE__ */ o("div", { className: k("flex flex-col h-full", r), children: [
1411
- /* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1412
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-3", children: [
1416
+ return /* @__PURE__ */ i("div", { className: F("flex flex-col h-full", r), children: [
1417
+ /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1418
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1413
1419
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1414
- /* @__PURE__ */ e(Fe, { onClick: n })
1420
+ /* @__PURE__ */ e(Le, { onClick: n })
1415
1421
  ] }),
1416
- /* @__PURE__ */ o("p", { className: "text-xs text-stone mb-3", children: [
1422
+ /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1417
1423
  "Select a ",
1418
- i.slice(0, -1),
1424
+ o.slice(0, -1),
1419
1425
  " to start messaging (",
1420
- x.length,
1426
+ y.length,
1421
1427
  " available)",
1422
- t.totalCount !== void 0 && ` • ${t.totalCount} ${i} total`
1428
+ t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
1423
1429
  ] }),
1424
1430
  /* @__PURE__ */ e(
1425
- ct,
1431
+ dt,
1426
1432
  {
1427
- searchQuery: f,
1428
- setSearchQuery: N,
1433
+ searchQuery: x,
1434
+ setSearchQuery: h,
1429
1435
  placeholder: c
1430
1436
  }
1431
1437
  )
1432
1438
  ] }),
1433
- p && /* @__PURE__ */ o("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1439
+ I && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1434
1440
  "Error loading ",
1435
- i,
1441
+ o,
1436
1442
  ": ",
1437
- p
1443
+ I
1438
1444
  ] }),
1439
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: l && x.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
1445
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: a && y.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1440
1446
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1441
- /* @__PURE__ */ o("span", { className: "text-sm text-stone", children: [
1447
+ /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1442
1448
  "Loading ",
1443
- i,
1449
+ o,
1444
1450
  "..."
1445
1451
  ] })
1446
- ] }) }) : x.length === 0 ? /* @__PURE__ */ o("div", { className: "p-6 text-center", children: [
1447
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ye, { className: "h-8 w-8 text-charcoal" }) }),
1448
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${i} found` : v.length > 0 ? `Already chatting with all ${i}` : `No ${i} yet` }),
1449
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${i}` : `${i.charAt(0).toUpperCase() + i.slice(1)} will appear here` })
1450
- ] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
1451
- x.map((b) => {
1452
- const d = b.name || b.email || b.id, m = b.email && b.name ? b.email : b.phone;
1452
+ ] }) }) : y.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1453
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(pe, { className: "h-8 w-8 text-charcoal" }) }),
1454
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: x ? `No ${o} found` : C.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1455
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: x ? "Try a different search term" : C.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1456
+ ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1457
+ y.map((g) => {
1458
+ const m = g.name || g.email || g.id, w = g.email && g.name ? g.email : g.phone;
1453
1459
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1454
1460
  "button",
1455
1461
  {
1456
1462
  type: "button",
1457
- onClick: () => w(b),
1458
- onKeyDown: (R) => D(R, b),
1463
+ onClick: () => u(g),
1464
+ onKeyDown: (v) => k(v, g),
1459
1465
  className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
1460
- children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
1461
- /* @__PURE__ */ o("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1466
+ children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1467
+ /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1462
1468
  /* @__PURE__ */ e(
1463
- J,
1469
+ X,
1464
1470
  {
1465
- id: b.id,
1466
- name: d,
1467
- image: b.image,
1471
+ id: g.id,
1472
+ name: m,
1473
+ image: g.image,
1468
1474
  size: 40
1469
1475
  }
1470
1476
  ),
1471
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
1472
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
1473
- m && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: m })
1477
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1478
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
1479
+ w && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: w })
1474
1480
  ] })
1475
1481
  ] }),
1476
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g === b.id ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ye, { className: "h-5 w-5 text-stone" }) })
1482
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: f === g.id ? /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(pe, { className: "h-5 w-5 text-stone" }) })
1477
1483
  ] })
1478
1484
  }
1479
- ) }, b.id);
1485
+ ) }, g.id);
1480
1486
  }),
1481
- l && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
1487
+ a && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1482
1488
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1483
1489
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1484
1490
  ] }) })
1485
1491
  ] }) })
1486
1492
  ] });
1487
- }, ut = ({ className: t }) => /* @__PURE__ */ o(
1493
+ }, ut = ({ className: t }) => /* @__PURE__ */ i(
1488
1494
  "svg",
1489
1495
  {
1490
1496
  width: "140",
@@ -1494,7 +1500,7 @@ const dt = ({
1494
1500
  xmlns: "http://www.w3.org/2000/svg",
1495
1501
  className: t,
1496
1502
  children: [
1497
- /* @__PURE__ */ o("g", { clipPath: "url(#clip0_empty_state)", children: [
1503
+ /* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
1498
1504
  /* @__PURE__ */ e(
1499
1505
  "path",
1500
1506
  {
@@ -1523,7 +1529,7 @@ const dt = ({
1523
1529
  fill: "white"
1524
1530
  }
1525
1531
  ),
1526
- /* @__PURE__ */ o("g", { filter: "url(#filter0_empty_state)", children: [
1532
+ /* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
1527
1533
  /* @__PURE__ */ e(
1528
1534
  "path",
1529
1535
  {
@@ -1563,8 +1569,8 @@ const dt = ({
1563
1569
  }
1564
1570
  )
1565
1571
  ] }),
1566
- /* @__PURE__ */ o("defs", { children: [
1567
- /* @__PURE__ */ o(
1572
+ /* @__PURE__ */ i("defs", { children: [
1573
+ /* @__PURE__ */ i(
1568
1574
  "filter",
1569
1575
  {
1570
1576
  id: "filter0_empty_state",
@@ -1618,17 +1624,17 @@ const dt = ({
1618
1624
  ] })
1619
1625
  ]
1620
1626
  }
1621
- ), Pe = O.memo(
1622
- ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1627
+ ), Oe = B.memo(
1628
+ ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1623
1629
  /* @__PURE__ */ e(ut, {}),
1624
- s && !t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
1630
+ s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1625
1631
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1626
1632
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1627
1633
  ] })
1628
1634
  ] }) })
1629
1635
  );
1630
- Pe.displayName = "EmptyState";
1631
- const ie = O.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ o("div", { className: "text-center max-w-sm", children: [
1636
+ Oe.displayName = "EmptyState";
1637
+ const ie = B.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1632
1638
  /* @__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: "⚠️" }) }),
1633
1639
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1634
1640
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1643,40 +1649,41 @@ const ie = O.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1643
1649
  )
1644
1650
  ] }) }));
1645
1651
  ie.displayName = "ErrorState";
1646
- const wt = ({
1652
+ const yt = ({
1647
1653
  capabilities: t = {},
1648
1654
  className: s,
1649
1655
  renderMessageInputActions: n,
1650
- onChannelSelect: a,
1651
- onParticipantSelect: i,
1656
+ onChannelSelect: l,
1657
+ onParticipantSelect: o,
1652
1658
  initialParticipantFilter: c,
1653
1659
  initialParticipantData: r,
1654
- CustomChannelEmptyState: u,
1655
- showChannelList: f = !0,
1656
- filters: N,
1657
- channelListCustomEmptyStateIndicator: v,
1658
- onDeleteConversationClick: h,
1659
- onBlockParticipantClick: l,
1660
+ CustomChannelEmptyState: d,
1661
+ showChannelList: x = !0,
1662
+ filters: h,
1663
+ channelListCustomEmptyStateIndicator: C,
1664
+ onDeleteConversationClick: N,
1665
+ onBlockParticipantClick: a,
1660
1666
  onReportParticipantClick: M,
1661
- dmAgentEnabled: p,
1662
- messageMetadata: S,
1663
- onMessageSent: g,
1664
- showStarButton: y = !1
1667
+ dmAgentEnabled: I,
1668
+ messageMetadata: _,
1669
+ onMessageSent: f,
1670
+ showStarButton: p = !1,
1671
+ renderMessagePreview: b
1665
1672
  }) => {
1666
1673
  const {
1667
- service: C,
1668
- client: x,
1669
- isConnected: w,
1670
- isLoading: D,
1671
- error: b,
1672
- refreshConnection: d,
1673
- debug: m
1674
- } = js(), [R, L] = _(null), [G, W] = _(!1), [ee, Q] = _(!1), [se, $] = _(!1), [q, Z] = _(/* @__PURE__ */ new Set()), [Y, X] = _(0), [I, T] = _(!1), [U, B] = _(null), z = H(null), {
1675
- participantSource: te,
1676
- participantLabel: ge = "participants",
1677
- showDeleteConversation: Oe = !0
1678
- } = t, Ue = O.useMemo(() => {
1679
- const E = x == null ? void 0 : x.userID;
1674
+ service: y,
1675
+ client: u,
1676
+ isConnected: k,
1677
+ isLoading: g,
1678
+ error: m,
1679
+ refreshConnection: w,
1680
+ debug: v
1681
+ } = As(), [D, P] = S(null), [q, te] = S(!1), [K, ee] = S(!1), [V, W] = S(!1), [Z, Y] = S(/* @__PURE__ */ new Set()), [J, T] = S(0), [R, U] = S(!1), [z, $] = S(null), Q = G(null), {
1682
+ participantSource: ge,
1683
+ participantLabel: xe = "participants",
1684
+ showDeleteConversation: Ue = !0
1685
+ } = t, Be = B.useMemo(() => {
1686
+ const E = u == null ? void 0 : u.userID;
1680
1687
  return {
1681
1688
  ...{
1682
1689
  type: "messaging",
@@ -1686,52 +1693,52 @@ const wt = ({
1686
1693
  hidden: !1
1687
1694
  }
1688
1695
  },
1689
- ...N
1696
+ ...h
1690
1697
  };
1691
- }, [N, x == null ? void 0 : x.userID]), ne = H(null), K = F(async () => {
1692
- if (!x || !w) return;
1693
- const E = x.userID;
1698
+ }, [h, u == null ? void 0 : u.userID]), ne = G(null), se = L(async () => {
1699
+ if (!u || !k) return;
1700
+ const E = u.userID;
1694
1701
  if (E)
1695
1702
  try {
1696
- m && console.log("[MessagingShell] Syncing channels for user:", E);
1697
- const A = await x.queryChannels(
1703
+ v && console.log("[MessagingShell] Syncing channels for user:", E);
1704
+ const A = await u.queryChannels(
1698
1705
  {
1699
1706
  type: "messaging",
1700
1707
  members: { $in: [E] }
1701
1708
  },
1702
1709
  {},
1703
1710
  { limit: 100 }
1704
- ), P = /* @__PURE__ */ new Set();
1711
+ ), O = /* @__PURE__ */ new Set();
1705
1712
  A.forEach((j) => {
1706
- const ue = j.state.members;
1707
- Object.values(ue).forEach((He) => {
1708
- var xe;
1709
- const me = (xe = He.user) == null ? void 0 : xe.id;
1710
- me && me !== E && P.add(me);
1713
+ const me = j.state.members;
1714
+ Object.values(me).forEach((Ve) => {
1715
+ var Ce;
1716
+ const ue = (Ce = Ve.user) == null ? void 0 : Ce.id;
1717
+ ue && ue !== E && O.add(ue);
1711
1718
  });
1712
- }), Z((j) => j.size === P.size && [...j].every((ue) => P.has(ue)) ? j : P), W(A.length > 0), Q(!0), ne.current = E, m && console.log("[MessagingShell] Channels synced successfully:", {
1719
+ }), Y((j) => j.size === O.size && [...j].every((me) => O.has(me)) ? j : O), te(A.length > 0), ee(!0), ne.current = E, v && console.log("[MessagingShell] Channels synced successfully:", {
1713
1720
  channelCount: A.length,
1714
- memberCount: P.size
1721
+ memberCount: O.size
1715
1722
  });
1716
1723
  } catch (A) {
1717
1724
  console.error("[MessagingShell] Failed to sync channels:", A);
1718
1725
  }
1719
- }, [x, w, m]);
1720
- V(() => {
1721
- if (!x || !w) return;
1722
- const E = x.userID;
1723
- E && ne.current !== E && K();
1724
- }, [x, w, K]), V(() => {
1725
- if (!c || !x || !w) return;
1726
+ }, [u, k, v]);
1727
+ H(() => {
1728
+ if (!u || !k) return;
1729
+ const E = u.userID;
1730
+ E && ne.current !== E && se();
1731
+ }, [u, k, se]), H(() => {
1732
+ if (!c || !u || !k) return;
1726
1733
  (async () => {
1727
- const A = x.userID;
1734
+ const A = u.userID;
1728
1735
  if (A)
1729
1736
  try {
1730
- m && console.log(
1737
+ v && console.log(
1731
1738
  "[MessagingShell] Loading initial conversation with:",
1732
1739
  c
1733
1740
  );
1734
- const P = await x.queryChannels(
1741
+ const O = await u.queryChannels(
1735
1742
  {
1736
1743
  type: "messaging",
1737
1744
  members: { $eq: [A, c] }
@@ -1739,24 +1746,24 @@ const wt = ({
1739
1746
  {},
1740
1747
  { limit: 1 }
1741
1748
  );
1742
- if (P.length > 0)
1743
- L(P[0]), T(!0), B(null), a && a(P[0]), m && console.log(
1749
+ if (O.length > 0)
1750
+ P(O[0]), U(!0), $(null), l && l(O[0]), v && console.log(
1744
1751
  "[MessagingShell] Initial conversation loaded:",
1745
- P[0].id
1752
+ O[0].id
1746
1753
  );
1747
- else if (r && C) {
1748
- m && console.log(
1754
+ else if (r && y) {
1755
+ v && console.log(
1749
1756
  "[MessagingShell] No conversation found, creating one for:",
1750
1757
  r
1751
1758
  );
1752
1759
  try {
1753
- const j = await C.startChannelWithParticipant({
1760
+ const j = await y.startChannelWithParticipant({
1754
1761
  id: r.id,
1755
1762
  name: r.name,
1756
1763
  email: r.email,
1757
1764
  phone: r.phone
1758
1765
  });
1759
- L(j), T(!0), B(null), a && a(j), m && console.log(
1766
+ P(j), U(!0), $(null), l && l(j), v && console.log(
1760
1767
  "[MessagingShell] Channel created and loaded:",
1761
1768
  j.id
1762
1769
  );
@@ -1764,118 +1771,119 @@ const wt = ({
1764
1771
  console.error(
1765
1772
  "[MessagingShell] Failed to create conversation:",
1766
1773
  j
1767
- ), B("Failed to create conversation");
1774
+ ), $("Failed to create conversation");
1768
1775
  }
1769
1776
  } else
1770
- B(
1777
+ $(
1771
1778
  "No conversation found with this account"
1772
- ), m && console.log(
1779
+ ), v && console.log(
1773
1780
  "[MessagingShell] No conversation found for:",
1774
1781
  c
1775
1782
  );
1776
- } catch (P) {
1783
+ } catch (O) {
1777
1784
  console.error(
1778
1785
  "[MessagingShell] Failed to load initial conversation:",
1779
- P
1780
- ), B("Failed to load conversation");
1786
+ O
1787
+ ), $("Failed to load conversation");
1781
1788
  }
1782
1789
  })();
1783
1790
  }, [
1784
1791
  c,
1785
1792
  r,
1786
- x,
1787
- w,
1788
- C,
1789
- m,
1790
- a
1793
+ u,
1794
+ k,
1795
+ y,
1796
+ v,
1797
+ l
1791
1798
  ]);
1792
- const Be = F(
1799
+ const je = L(
1793
1800
  (E) => {
1794
- L(E), a == null || a(E);
1801
+ P(E), l == null || l(E);
1795
1802
  },
1796
- [a]
1797
- ), je = F(() => {
1798
- I || L(null);
1799
- }, [I]), Ae = F(
1803
+ [l]
1804
+ ), Ae = L(() => {
1805
+ R || P(null);
1806
+ }, [R]), $e = L(
1800
1807
  async (E) => {
1801
1808
  var A;
1802
- if (C)
1809
+ if (y)
1803
1810
  try {
1804
- m && console.log(
1811
+ v && console.log(
1805
1812
  "[MessagingShell] Starting conversation with:",
1806
1813
  E.id
1807
1814
  );
1808
- const P = await C.startChannelWithParticipant({
1815
+ const O = await y.startChannelWithParticipant({
1809
1816
  id: E.id,
1810
1817
  name: E.name,
1811
1818
  email: E.email,
1812
1819
  phone: E.phone
1813
1820
  });
1814
1821
  try {
1815
- await P.show();
1822
+ await O.show();
1816
1823
  } catch (j) {
1817
1824
  console.warn("[MessagingShell] Failed to unhide channel:", j);
1818
1825
  }
1819
- L(P), $(!1), (A = z.current) == null || A.close(), i == null || i(E);
1820
- } catch (P) {
1821
- console.error("[MessagingShell] Failed to start conversation:", P);
1826
+ P(O), W(!1), (A = Q.current) == null || A.close(), o == null || o(E);
1827
+ } catch (O) {
1828
+ console.error("[MessagingShell] Failed to start conversation:", O);
1822
1829
  }
1823
1830
  },
1824
- [C, i, m]
1825
- ), re = F(() => {
1831
+ [y, o, v]
1832
+ ), re = L(() => {
1826
1833
  var E;
1827
- $(!1), (E = z.current) == null || E.close();
1828
- }, []), $e = F(
1834
+ W(!1), (E = Q.current) == null || E.close();
1835
+ }, []), ze = L(
1829
1836
  (E) => {
1830
- E.target === z.current && re();
1837
+ E.target === Q.current && re();
1831
1838
  },
1832
1839
  [re]
1833
- ), ze = F(
1840
+ ), Ge = L(
1834
1841
  async (E) => {
1835
- m && console.log("[MessagingShell] Leaving conversation:", E.id), L(null), T(!1), ne.current = null, await K();
1842
+ v && console.log("[MessagingShell] Leaving conversation:", E.id), P(null), U(!1), ne.current = null, await se();
1836
1843
  },
1837
- [K, m]
1838
- ), Ge = F(
1844
+ [se, v]
1845
+ ), He = L(
1839
1846
  async (E) => {
1840
- m && console.log("[MessagingShell] Blocking participant:", E), L(null), T(!1), ne.current = null, await K();
1847
+ v && console.log("[MessagingShell] Blocking participant:", E), P(null), U(!1), ne.current = null, await se();
1841
1848
  },
1842
- [K, m]
1843
- ), ae = !!R;
1844
- return D ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) : b ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ie, { message: b, onBack: d }) }) : !w || !x ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
1849
+ [se, v]
1850
+ ), ae = !!D;
1851
+ return g ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(ce, {}) }) : m ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(ie, { message: m, onBack: w }) }) : !k || !u ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(
1845
1852
  ie,
1846
1853
  {
1847
1854
  message: "Not connected to messaging service",
1848
- onBack: d
1855
+ onBack: w
1849
1856
  }
1850
- ) }) : U ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ie, { message: U }) }) : /* @__PURE__ */ o(
1857
+ ) }) : z ? /* @__PURE__ */ e("div", { className: F("h-full", s), children: /* @__PURE__ */ e(ie, { message: z }) }) : /* @__PURE__ */ i(
1851
1858
  "div",
1852
1859
  {
1853
- className: k(
1860
+ className: F(
1854
1861
  "messaging-shell h-full bg-background-primary overflow-hidden",
1855
1862
  s
1856
1863
  ),
1857
1864
  children: [
1858
- /* @__PURE__ */ o("div", { className: "flex h-full min-h-0", children: [
1865
+ /* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
1859
1866
  /* @__PURE__ */ e(
1860
1867
  "div",
1861
1868
  {
1862
- className: k(
1869
+ className: F(
1863
1870
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1864
1871
  {
1865
- "!hidden": f === !1 || I,
1872
+ "!hidden": x === !1 || R,
1866
1873
  // Hide on mobile when channel selected, show on desktop with consistent wide width
1867
- "hidden lg:flex lg:flex-1 lg:max-w-2xl": f !== !1 && !I && ae,
1874
+ "hidden lg:flex lg:flex-1 lg:max-w-2xl": x !== !1 && !R && ae,
1868
1875
  // Show on mobile when no channel selected, use same wide width on desktop
1869
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": f !== !1 && !I && !ae
1876
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": x !== !1 && !R && !ae
1870
1877
  }
1871
1878
  ),
1872
1879
  children: /* @__PURE__ */ e(
1873
- De,
1880
+ Te,
1874
1881
  {
1875
- onChannelSelect: Be,
1876
- selectedChannel: R || void 0,
1877
- filters: Ue,
1878
- customEmptyStateIndicator: v
1882
+ onChannelSelect: je,
1883
+ selectedChannel: D || void 0,
1884
+ filters: Be,
1885
+ customEmptyStateIndicator: C,
1886
+ renderMessagePreview: b
1879
1887
  }
1880
1888
  )
1881
1889
  }
@@ -1883,78 +1891,78 @@ const wt = ({
1883
1891
  /* @__PURE__ */ e(
1884
1892
  "div",
1885
1893
  {
1886
- className: k(
1894
+ className: F(
1887
1895
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1888
1896
  {
1889
1897
  // In direct conversation mode (or waiting for it), always show (full width)
1890
- flex: I || ae || c,
1898
+ flex: R || ae || c,
1891
1899
  // Normal mode: hide on mobile when no channel selected
1892
- "hidden lg:flex": !I && !ae && !c
1900
+ "hidden lg:flex": !R && !ae && !c
1893
1901
  }
1894
1902
  ),
1895
- children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1896
- Le,
1903
+ children: D ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1904
+ Pe,
1897
1905
  {
1898
- channel: R,
1899
- onBack: je,
1900
- showBackButton: !I,
1906
+ channel: D,
1907
+ onBack: Ae,
1908
+ showBackButton: !R,
1901
1909
  renderMessageInputActions: n,
1902
- onLeaveConversation: ze,
1903
- onBlockParticipant: Ge,
1904
- CustomChannelEmptyState: u,
1905
- showDeleteConversation: Oe,
1906
- onDeleteConversationClick: h,
1907
- onBlockParticipantClick: l,
1910
+ onLeaveConversation: Ge,
1911
+ onBlockParticipant: He,
1912
+ CustomChannelEmptyState: d,
1913
+ showDeleteConversation: Ue,
1914
+ onDeleteConversationClick: N,
1915
+ onBlockParticipantClick: a,
1908
1916
  onReportParticipantClick: M,
1909
- dmAgentEnabled: p,
1910
- messageMetadata: S,
1911
- onMessageSent: g,
1912
- showStarButton: y
1917
+ dmAgentEnabled: I,
1918
+ messageMetadata: _,
1919
+ onMessageSent: f,
1920
+ showStarButton: p
1913
1921
  },
1914
- R.id
1922
+ D.id
1915
1923
  ) }) : c ? (
1916
1924
  // Show loading while creating/loading direct conversation channel
1917
1925
  /* @__PURE__ */ e(ce, {})
1918
1926
  ) : /* @__PURE__ */ e(
1919
- Pe,
1927
+ Oe,
1920
1928
  {
1921
- hasChannels: G,
1922
- channelsLoaded: ee
1929
+ hasChannels: q,
1930
+ channelsLoaded: K
1923
1931
  }
1924
1932
  )
1925
1933
  }
1926
1934
  )
1927
1935
  ] }),
1928
- te && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1936
+ ge && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1929
1937
  /* @__PURE__ */ e(
1930
1938
  "dialog",
1931
1939
  {
1932
- ref: z,
1940
+ ref: Q,
1933
1941
  className: "mes-dialog",
1934
- onClick: $e,
1942
+ onClick: ze,
1935
1943
  onClose: re,
1936
1944
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1937
- dt,
1945
+ mt,
1938
1946
  {
1939
- participantSource: te,
1940
- onSelectParticipant: Ae,
1947
+ participantSource: ge,
1948
+ onSelectParticipant: $e,
1941
1949
  onClose: re,
1942
- existingParticipantIds: q,
1943
- participantLabel: ge,
1944
- searchPlaceholder: `Search ${ge}...`
1950
+ existingParticipantIds: Z,
1951
+ participantLabel: xe,
1952
+ searchPlaceholder: `Search ${xe}...`
1945
1953
  },
1946
- Y
1954
+ J
1947
1955
  ) })
1948
1956
  }
1949
1957
  )
1950
1958
  ]
1951
1959
  }
1952
1960
  );
1953
- }, mt = ({
1961
+ }, ht = ({
1954
1962
  question: t,
1955
1963
  onClick: s,
1956
1964
  loading: n = !1,
1957
- className: a
1965
+ className: l
1958
1966
  }) => /* @__PURE__ */ e(
1959
1967
  "button",
1960
1968
  {
@@ -1962,29 +1970,29 @@ const wt = ({
1962
1970
  onClick: s,
1963
1971
  disabled: n,
1964
1972
  style: { backgroundColor: "#E6E5E3" },
1965
- className: k(
1973
+ className: F(
1966
1974
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1967
1975
  {
1968
1976
  "hover:brightness-95 active:brightness-90": !n,
1969
1977
  "opacity-50 cursor-not-allowed": n
1970
1978
  },
1971
- a
1979
+ l
1972
1980
  ),
1973
1981
  children: t
1974
1982
  }
1975
- ), yt = ({
1983
+ ), pt = ({
1976
1984
  faqs: t,
1977
1985
  onFaqClick: s,
1978
1986
  loadingFaqId: n,
1979
- headerText: a,
1980
- className: i,
1987
+ headerText: l,
1988
+ className: o,
1981
1989
  avatarImage: c,
1982
1990
  avatarName: r
1983
1991
  }) => {
1984
- const u = t.filter((f) => f.enabled).sort((f, N) => (f.order ?? 0) - (N.order ?? 0));
1985
- return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: i, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
1992
+ const d = t.filter((x) => x.enabled).sort((x, h) => (x.order ?? 0) - (h.order ?? 0));
1993
+ return d.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1986
1994
  (c || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1987
- J,
1995
+ X,
1988
1996
  {
1989
1997
  id: r || "account",
1990
1998
  name: r || "Account",
@@ -1993,79 +2001,79 @@ const wt = ({
1993
2001
  shape: "circle"
1994
2002
  }
1995
2003
  ) }),
1996
- /* @__PURE__ */ o(
2004
+ /* @__PURE__ */ i(
1997
2005
  "div",
1998
2006
  {
1999
2007
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
2000
2008
  style: { backgroundColor: "#F1F0EE" },
2001
2009
  children: [
2002
- a && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: a }),
2003
- u.map((f) => /* @__PURE__ */ e(
2004
- mt,
2010
+ l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
2011
+ d.map((x) => /* @__PURE__ */ e(
2012
+ ht,
2005
2013
  {
2006
- question: f.question,
2007
- onClick: () => s(f.id),
2008
- loading: n === f.id
2014
+ question: x.question,
2015
+ onClick: () => s(x.id),
2016
+ loading: n === x.id
2009
2017
  },
2010
- f.id
2018
+ x.id
2011
2019
  ))
2012
2020
  ]
2013
2021
  }
2014
2022
  )
2015
2023
  ] }) });
2016
- }, pt = (t, s = {}) => {
2017
- const { initialSearch: n = "", pageSize: a = 20 } = s, [i, c] = _([]), [r, u] = _(!1), [f, N] = _(null), [v, h] = _(n), [l, M] = _(!0), [p, S] = _(), g = F(async (w = !1, D) => {
2024
+ }, Et = (t, s = {}) => {
2025
+ const { initialSearch: n = "", pageSize: l = 20 } = s, [o, c] = S([]), [r, d] = S(!1), [x, h] = S(null), [C, N] = S(n), [a, M] = S(!0), [I, _] = S(), f = L(async (u = !1, k) => {
2018
2026
  if (r) return;
2019
- const b = D !== void 0 ? D : v;
2020
- u(!0), N(null);
2027
+ const g = k !== void 0 ? k : C;
2028
+ d(!0), h(null);
2021
2029
  try {
2022
- const d = await t.loadParticipants({
2023
- search: b || void 0,
2024
- limit: a,
2025
- cursor: w ? void 0 : p
2030
+ const m = await t.loadParticipants({
2031
+ search: g || void 0,
2032
+ limit: l,
2033
+ cursor: u ? void 0 : I
2026
2034
  });
2027
2035
  c(
2028
- (m) => w ? d.participants : [...m, ...d.participants]
2029
- ), M(d.hasMore), S(d.nextCursor);
2030
- } catch (d) {
2031
- const m = d instanceof Error ? d.message : "Failed to load participants";
2032
- N(m), console.error("[useParticipants] Load error:", d);
2036
+ (w) => u ? m.participants : [...w, ...m.participants]
2037
+ ), M(m.hasMore), _(m.nextCursor);
2038
+ } catch (m) {
2039
+ const w = m instanceof Error ? m.message : "Failed to load participants";
2040
+ h(w), console.error("[useParticipants] Load error:", m);
2033
2041
  } finally {
2034
- u(!1);
2042
+ d(!1);
2035
2043
  }
2036
- }, [t, v, p, a, r]), y = F(() => {
2037
- l && !r && g(!1);
2038
- }, [l, r, g]), C = F((w) => {
2039
- h(w), S(void 0), g(!0, w);
2040
- }, [g]), x = F(() => {
2041
- S(void 0), g(!0);
2042
- }, [g]);
2043
- return V(() => {
2044
- g(!0);
2044
+ }, [t, C, I, l, r]), p = L(() => {
2045
+ a && !r && f(!1);
2046
+ }, [a, r, f]), b = L((u) => {
2047
+ N(u), _(void 0), f(!0, u);
2048
+ }, [f]), y = L(() => {
2049
+ _(void 0), f(!0);
2050
+ }, [f]);
2051
+ return H(() => {
2052
+ f(!0);
2045
2053
  }, [t.loadParticipants]), {
2046
- participants: i,
2054
+ participants: o,
2047
2055
  loading: r,
2048
- error: f,
2049
- searchQuery: v,
2050
- hasMore: l,
2056
+ error: x,
2057
+ searchQuery: C,
2058
+ hasMore: a,
2051
2059
  totalCount: t.totalCount,
2052
- loadMore: y,
2053
- search: C,
2054
- refresh: x
2060
+ loadMore: p,
2061
+ search: b,
2062
+ refresh: y
2055
2063
  };
2056
2064
  };
2057
2065
  export {
2058
- J as Avatar,
2059
- rt as ChannelEmptyState,
2060
- De as ChannelList,
2061
- Le as ChannelView,
2062
- yt as FaqList,
2063
- mt as FaqListItem,
2064
- vt as MessagingProvider,
2065
- wt as MessagingShell,
2066
- dt as ParticipantPicker,
2067
- $s as formatRelativeTime,
2068
- js as useMessaging,
2069
- pt as useParticipants
2066
+ X as Avatar,
2067
+ at as ChannelEmptyState,
2068
+ Te as ChannelList,
2069
+ Pe as ChannelView,
2070
+ pt as FaqList,
2071
+ ht as FaqListItem,
2072
+ wt as MessagingProvider,
2073
+ yt as MessagingShell,
2074
+ mt as ParticipantPicker,
2075
+ zs as formatRelativeTime,
2076
+ As as useMessaging,
2077
+ Et as useParticipants
2070
2078
  };
2071
2079
  //# sourceMappingURL=index.js.map