@linktr.ee/messaging-react 1.17.0 → 1.17.1

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