@linktr.ee/messaging-react 1.22.2 → 1.23.0-rc-1772427007

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 i, Fragment as ce } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
2
2
  import R from "classnames";
3
- import A, { createContext as tt, useContext as st, useCallback as P, useState as _, useRef as q, useEffect as Y, useMemo as ye } from "react";
4
- import { StreamChatService as nt } from "@linktr.ee/messaging-core";
5
- import { Chat as at, ChannelList as rt, DateSeparator as ot, useChannelStateContext as Ie, useChatContext as Be, areMessageUIPropsEqual as lt, useMessageReminder as it, useComponentContext as ct, Attachment as dt, EditMessageModal as ut, MessageBlocked as mt, MessageBouncePrompt as ht, MessageDeleted as ft, MessageIsThreadReplyInChannelButtonIndicator as gt, MessageRepliesCountButton as xt, ReminderNotification as bt, StreamedMessageText as Ct, messageHasAttachments as Nt, messageHasReactions as vt, isDateSeparatorMessage as wt, isMessageBlocked as pt, isMessageBounced as yt, MessageBounceModal as Et, Poll as _t, MessageText as It, MessageErrorIcon as St, useMessageContext as Mt, useMessageComposer as kt, useStateStore as Dt, MessageInput as Tt, useMessageInputContext as Rt, useMessageComposerHasSendableData as Lt, SimpleAttachmentSelector as Pt, QuotedMessagePreview as Ut, AttachmentPreviewList as Ft, TextareaComposer as Ot, MessageTimestamp as De, Channel as At, WithComponents as Bt, Window as $t, MessageList as jt } from "stream-chat-react";
6
- import { GiftIcon as Gt, XIcon as Se, ArrowUpIcon as Ht, SparkleIcon as zt, ArrowLeftIcon as Te, StarIcon as Re, DotsThreeIcon as Le, SpinnerGapIcon as xe, SignOutIcon as Vt, ProhibitInsetIcon as Pe, FlagIcon as Wt, MagnifyingGlassIcon as qt, ChatCircleDotsIcon as Ue } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as Fe } from "stream-chat";
8
- const $e = tt({
3
+ import O, { createContext as ut, useContext as mt, useCallback as F, useState as I, useRef as z, useEffect as X, useMemo as ke } from "react";
4
+ import { StreamChatService as ht } from "@linktr.ee/messaging-core";
5
+ import { Chat as ft, ChannelList as gt, DateSeparator as bt, useChannelStateContext as Re, useChatContext as qe, areMessageUIPropsEqual as xt, useMessageReminder as Ct, useComponentContext as Nt, Attachment as vt, EditMessageModal as yt, MessageBlocked as wt, MessageBouncePrompt as pt, MessageDeleted as Et, MessageIsThreadReplyInChannelButtonIndicator as _t, MessageRepliesCountButton as It, ReminderNotification as St, StreamedMessageText as Mt, messageHasAttachments as kt, messageHasReactions as Dt, isDateSeparatorMessage as Tt, isMessageBlocked as Rt, isMessageBounced as Lt, MessageBounceModal as Ft, Poll as At, MessageText as Ut, MessageErrorIcon as Pt, useMessageContext as Ot, useMessageComposer as Bt, useStateStore as $t, MessageInput as jt, useMessageInputContext as Gt, useMessageComposerHasSendableData as Ht, SimpleAttachmentSelector as zt, QuotedMessagePreview as Vt, AttachmentPreviewList as qt, TextareaComposer as Wt, MessageTimestamp as Ue, Channel as Yt, WithComponents as Zt, Window as Xt, MessageList as Qt } from "stream-chat-react";
6
+ import { GiftIcon as Jt, XIcon as Le, ArrowUpIcon as Kt, SparkleIcon as es, ArrowLeftIcon as Pe, StarIcon as Oe, DotsThreeIcon as Be, SpinnerGapIcon as ve, SignOutIcon as ts, ProhibitInsetIcon as $e, FlagIcon as ss, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as je } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as Ge } from "stream-chat";
8
+ const We = ut({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,96 +15,96 @@ const $e = tt({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), Ne = () => st($e), Os = ({
18
+ }), Ee = () => mt(We), Ks = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
- apiKey: r,
22
+ apiKey: a,
23
23
  capabilities: l = {},
24
- debug: u = !1
24
+ debug: c = !1
25
25
  }) => {
26
- const o = P(
27
- (c, ...d) => {
28
- u && console.log(`🔥 [MessagingProvider] ${c}`, ...d);
26
+ const o = F(
27
+ (d, ...m) => {
28
+ c && console.log(`🔥 [MessagingProvider] ${d}`, ...m);
29
29
  },
30
- [u]
30
+ [c]
31
31
  );
32
32
  o("🔄 RENDER START", {
33
33
  userId: s == null ? void 0 : s.id,
34
- apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
34
+ apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(l)
37
37
  });
38
- const [m, x] = _(null), [g, C] = _(null), [b, w] = _(!1), [a, y] = _(!1), [I, v] = _(null), S = q(!1), N = q({
38
+ const [u, g] = I(null), [f, C] = I(null), [x, v] = I(!1), [r, y] = I(!1), [E, w] = I(null), S = z(!1), N = z({
39
39
  userId: s == null ? void 0 : s.id,
40
- apiKey: r,
40
+ apiKey: a,
41
41
  serviceConfig: n,
42
42
  capabilities: l
43
- }), h = q(0);
43
+ }), h = z(0);
44
44
  h.current++, o("📊 RENDER INFO", {
45
45
  renderCount: h.current,
46
- currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
46
+ currentProps: { userId: s == null ? void 0 : s.id, apiKey: (a == null ? void 0 : a.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
48
  userChanged: N.current.userId !== (s == null ? void 0 : s.id),
49
- apiKeyChanged: N.current.apiKey !== r,
49
+ apiKeyChanged: N.current.apiKey !== a,
50
50
  serviceConfigChanged: N.current.serviceConfig !== n,
51
51
  capabilitiesChanged: N.current.capabilities !== l
52
52
  }
53
53
  }), N.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
- apiKey: r,
55
+ apiKey: a,
56
56
  serviceConfig: n,
57
57
  capabilities: l
58
- }, Y(() => {
59
- const c = h.current;
58
+ }, X(() => {
59
+ const d = h.current;
60
60
  if (o("🔧 SERVICE INIT EFFECT TRIGGERED", {
61
- renderCount: c,
62
- apiKey: !!r,
61
+ renderCount: d,
62
+ apiKey: !!a,
63
63
  serviceConfig: !!n,
64
64
  dependencies: {
65
- apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
65
+ apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
66
66
  serviceConfigRef: n,
67
67
  serviceConfigStable: N.current.serviceConfig === n,
68
- apiKeyStable: N.current.apiKey === r
68
+ apiKeyStable: N.current.apiKey === a
69
69
  }
70
- }), !r || !n) {
70
+ }), !a || !n) {
71
71
  o("⚠️ SERVICE INIT SKIPPED", {
72
- renderCount: c,
72
+ renderCount: d,
73
73
  reason: "Missing apiKey or serviceConfig"
74
74
  });
75
75
  return;
76
76
  }
77
77
  o("🚀 CREATING NEW SERVICE", {
78
- renderCount: c,
79
- apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
78
+ renderCount: d,
79
+ apiKey: (a == null ? void 0 : a.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: N.current.serviceConfig !== n
81
81
  });
82
- const d = new nt({
82
+ const m = new ht({
83
83
  ...n,
84
- apiKey: r,
85
- debug: u
84
+ apiKey: a,
85
+ debug: c
86
86
  });
87
- return x(d), o("✅ SERVICE SET", {
88
- renderCount: c,
89
- serviceInstance: !!d
87
+ return g(m), o("✅ SERVICE SET", {
88
+ renderCount: d,
89
+ serviceInstance: !!m
90
90
  }), () => {
91
91
  o("🧹 SERVICE CLEANUP", {
92
- renderCount: c,
92
+ renderCount: d,
93
93
  reason: "Effect cleanup"
94
- }), d.disconnectUser().catch(console.error);
94
+ }), m.disconnectUser().catch(console.error);
95
95
  };
96
- }, [r, n, u, o]);
97
- const p = q(null);
98
- Y(() => {
99
- var d, M;
96
+ }, [a, n, c, o]);
97
+ const p = z(null);
98
+ X(() => {
99
+ var m, M;
100
100
  if (o("🔗 USER CONNECTION EFFECT TRIGGERED", {
101
- hasService: !!m,
101
+ hasService: !!u,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
104
  isConnecting: S.current,
105
- isConnected: b,
106
- dependencies: { service: !!m, userId: s == null ? void 0 : s.id }
107
- }), !m || !s) {
105
+ isConnected: x,
106
+ dependencies: { service: !!u, userId: s == null ? void 0 : s.id }
107
+ }), !u || !s) {
108
108
  o("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
@@ -112,7 +112,7 @@ const $e = tt({
112
112
  o("⚠️ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((d = p.current) == null ? void 0 : d.serviceId) === m && ((M = p.current) == null ? void 0 : M.userId) === s.id) {
115
+ if (((m = p.current) == null ? void 0 : m.serviceId) === u && ((M = p.current) == null ? void 0 : M.userId) === s.id) {
116
116
  o(
117
117
  "⚠️ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,124 +120,124 @@ const $e = tt({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- o("🚀 STARTING USER CONNECTION", { userId: s.id }), S.current = !0, y(!0), v(null);
123
+ o("🚀 STARTING USER CONNECTION", { userId: s.id }), S.current = !0, y(!0), w(null);
124
124
  try {
125
125
  o("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
- const k = await m.connectUser(s);
127
- C(k), w(!0), p.current = { serviceId: m, userId: s.id }, o("✅ USER CONNECTION SUCCESS", {
126
+ const k = await u.connectUser(s);
127
+ C(k), v(!0), p.current = { serviceId: u, userId: s.id }, o("✅ USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: k.userID
130
130
  });
131
131
  } catch (k) {
132
132
  const B = k instanceof Error ? k.message : "Connection failed";
133
- v(B), o("❌ USER CONNECTION ERROR", {
133
+ w(B), o("❌ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
135
  error: B
136
136
  });
137
137
  } finally {
138
138
  y(!1), S.current = !1, o("🔄 USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
- isConnected: b
140
+ isConnected: x
141
141
  });
142
142
  }
143
143
  })();
144
- }, [m, s, o, b]), Y(() => (o("🔌 CLEANUP EFFECT REGISTERED", {
145
- hasService: !!m,
146
- isConnected: b
144
+ }, [u, s, o, x]), X(() => (o("🔌 CLEANUP EFFECT REGISTERED", {
145
+ hasService: !!u,
146
+ isConnected: x
147
147
  }), () => {
148
- m && b ? (o(
148
+ u && x ? (o(
149
149
  "🧹 CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), p.current = null, m.disconnectUser().catch(console.error)) : o("🔇 CLEANUP EFFECT SKIPPED", {
152
- hasService: !!m,
153
- isConnected: b
151
+ ), p.current = null, u.disconnectUser().catch(console.error)) : o("🔇 CLEANUP EFFECT SKIPPED", {
152
+ hasService: !!u,
153
+ isConnected: x
154
154
  });
155
- }), [m, b, o]);
156
- const T = P(async () => {
155
+ }), [u, x, o]);
156
+ const T = F(async () => {
157
157
  if (o("🔄 REFRESH CONNECTION CALLED", {
158
- hasService: !!m,
158
+ hasService: !!u,
159
159
  hasUser: !!s
160
- }), !m || !s) {
160
+ }), !u || !s) {
161
161
  o("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
164
  o("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), y(!0);
165
165
  try {
166
- o("🔌 DISCONNECTING FOR REFRESH"), await m.disconnectUser(), o("📞 RECONNECTING FOR REFRESH");
167
- const c = await m.connectUser(s);
168
- C(c), w(!0), v(null), o("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
169
- } catch (c) {
170
- const d = c instanceof Error ? c.message : "Refresh failed";
171
- v(d), o("❌ CONNECTION REFRESH ERROR", {
166
+ o("🔌 DISCONNECTING FOR REFRESH"), await u.disconnectUser(), o("📞 RECONNECTING FOR REFRESH");
167
+ const d = await u.connectUser(s);
168
+ C(d), v(!0), w(null), o("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
169
+ } catch (d) {
170
+ const m = d instanceof Error ? d.message : "Refresh failed";
171
+ w(m), o("❌ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: d
173
+ error: m
174
174
  });
175
175
  } finally {
176
176
  y(!1), o("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [m, s, o]), f = A.useMemo(() => (o("💫 CONTEXT VALUE MEMOIZATION", {
179
- hasService: !!m,
180
- hasClient: !!g,
181
- isConnected: b,
182
- isLoading: a,
183
- hasError: !!I,
178
+ }, [u, s, o]), b = O.useMemo(() => (o("💫 CONTEXT VALUE MEMOIZATION", {
179
+ hasService: !!u,
180
+ hasClient: !!f,
181
+ isConnected: x,
182
+ isLoading: r,
183
+ hasError: !!E,
184
184
  capabilitiesKeys: Object.keys(l)
185
185
  }), {
186
- service: m,
187
- client: g,
188
- isConnected: b,
189
- isLoading: a,
190
- error: I,
186
+ service: u,
187
+ client: f,
188
+ isConnected: x,
189
+ isLoading: r,
190
+ error: E,
191
191
  capabilities: l,
192
192
  refreshConnection: T,
193
- debug: u
193
+ debug: c
194
194
  }), [
195
- m,
196
- g,
197
- b,
198
- a,
199
- I,
195
+ u,
196
+ f,
197
+ x,
198
+ r,
199
+ E,
200
200
  l,
201
201
  T,
202
- u,
202
+ c,
203
203
  o
204
204
  ]);
205
205
  return o("🔄 RENDER END", {
206
206
  renderCount: h.current,
207
- willRenderChat: !!(g && b),
208
- contextValueReady: !!f
209
- }), /* @__PURE__ */ e($e.Provider, { value: f, children: g && b ? /* @__PURE__ */ e(
210
- at,
207
+ willRenderChat: !!(f && x),
208
+ contextValueReady: !!b
209
+ }), /* @__PURE__ */ e(We.Provider, { value: b, children: f && x ? /* @__PURE__ */ e(
210
+ ft,
211
211
  {
212
- client: g,
212
+ client: f,
213
213
  customClasses: {
214
214
  channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
215
215
  },
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, Yt = () => Ne(), Zt = (t, s) => {
219
+ }, rs = () => Ee(), as = (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
- }, Jt = (t) => {
226
+ }, os = (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 = Zt(t, s);
231
- return r === 0 ? t.toLocaleTimeString([], {
230
+ const a = as(t, s);
231
+ return a === 0 ? t.toLocaleTimeString([], {
232
232
  hour: "numeric",
233
233
  minute: "2-digit",
234
234
  hour12: !0
235
- }) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
235
+ }) : a === 1 ? "Yesterday" : a < 7 ? `${a}d` : a < 28 ? `${Math.floor(a / 7)}w` : t.toLocaleDateString("en-US", {
236
236
  month: "numeric",
237
237
  day: "numeric",
238
238
  year: "2-digit"
239
239
  });
240
- }, Oe = [
240
+ }, He = [
241
241
  "🍎",
242
242
  // Apple
243
243
  "🍌",
@@ -265,37 +265,37 @@ const $e = tt({
265
265
  "🍈"
266
266
  // Melon
267
267
  ];
268
- function Qt(t) {
268
+ function ls(t) {
269
269
  let s = 0;
270
270
  for (let n = 0; n < t.length; n++) {
271
- const r = t.charCodeAt(n);
272
- s = (s << 5) - s + r, s = s & s;
271
+ const a = t.charCodeAt(n);
272
+ s = (s << 5) - s + a, s = s & s;
273
273
  }
274
274
  return Math.abs(s);
275
275
  }
276
- function Xt(t) {
277
- const n = Qt(t) % Oe.length;
278
- return Oe[n];
276
+ function is(t) {
277
+ const n = ls(t) % He.length;
278
+ return He[n];
279
279
  }
280
- const ee = ({
280
+ const ne = ({
281
281
  id: t,
282
282
  image: s,
283
283
  size: n = 40,
284
- className: r,
284
+ className: a,
285
285
  shape: l = "squircle"
286
286
  }) => {
287
- const u = Xt(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", x = l === "circle" ? { borderRadius: "50%" } : {
287
+ const c = is(t), u = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", g = 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: R("flex-shrink-0 overflow-hidden", r),
294
+ className: R("flex-shrink-0 overflow-hidden", a),
295
295
  style: {
296
296
  width: `${n}px`,
297
297
  height: `${n}px`,
298
- ...x
298
+ ...g
299
299
  },
300
300
  children: s ? /* @__PURE__ */ e(
301
301
  "img",
@@ -310,14 +310,14 @@ const ee = ({
310
310
  "aria-hidden": "true",
311
311
  className: R(
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
- children: u
315
+ children: c
316
316
  }
317
317
  )
318
318
  }
319
319
  );
320
- }, Kt = ({ size: t = 15 }) => /* @__PURE__ */ e(
320
+ }, cs = ({ size: t = 15 }) => /* @__PURE__ */ e(
321
321
  "svg",
322
322
  {
323
323
  width: t,
@@ -334,95 +334,95 @@ const ee = ({
334
334
  }
335
335
  )
336
336
  }
337
- ), es = (t) => {
337
+ ), ds = (t) => {
338
338
  var s;
339
339
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
340
- }, ts = (t) => {
340
+ }, us = (t) => {
341
341
  var s;
342
342
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
343
- }, Me = (t) => {
343
+ }, Fe = (t) => {
344
344
  var s;
345
345
  return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
346
- }, je = (t) => es(t) || ts(t), ss = (t) => {
346
+ }, Ye = (t) => ds(t) || us(t), ms = (t) => {
347
347
  var s;
348
- return je(t) && !((s = t.text) != null && s.trim());
349
- }, pe = ({
348
+ return Ye(t) && !((s = t.text) != null && s.trim());
349
+ }, Se = ({
350
350
  message: t,
351
351
  standalone: s = !1,
352
352
  isMyMessage: n = !1,
353
- hasAttachment: r = !1
353
+ hasAttachment: a = !1
354
354
  }) => {
355
- var b;
356
- const l = je(t), u = Me(t);
357
- if (!l && !u)
355
+ var x;
356
+ const l = Ye(t), c = Fe(t);
357
+ if (!l && !c)
358
358
  return null;
359
359
  if (l) {
360
- const w = (b = t.metadata) == null ? void 0 : b.amount_text;
361
- if (!w) return null;
362
- const a = s ? "message-tip-standalone" : "message-tag message-tag--tip", y = s ? `${w} tip` : `Delivered with ${w} tip`;
363
- return /* @__PURE__ */ i("div", { className: a, children: [
364
- /* @__PURE__ */ e(Gt, { size: s ? 14 : 12 }),
360
+ const v = (x = t.metadata) == null ? void 0 : x.amount_text;
361
+ if (!v) return null;
362
+ const r = s ? "message-tip-standalone" : "message-tag message-tag--tip", y = s ? `${v} tip` : `Delivered with ${v} tip`;
363
+ return /* @__PURE__ */ i("div", { className: r, children: [
364
+ /* @__PURE__ */ e(Jt, { size: s ? 14 : 12 }),
365
365
  /* @__PURE__ */ e("span", { children: y })
366
366
  ] });
367
367
  }
368
- const o = n && r, m = o ? "Sent with AI" : "Sent with DM Agent", x = [
368
+ const o = n && a, u = o ? "Sent with AI" : "Sent with DM Agent", g = [
369
369
  "message-chatbot-indicator",
370
370
  n ? "message-chatbot-indicator--sender" : "message-chatbot-indicator--receiver",
371
371
  o ? "message-chatbot-indicator--attachment" : "message-chatbot-indicator--text"
372
- ].join(" "), g = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: m }), C = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(Kt, { size: o ? 12 : 15 }) });
373
- return /* @__PURE__ */ e("div", { className: x, "data-testid": "message-chatbot-indicator", children: n && !o ? /* @__PURE__ */ i(ce, { children: [
374
- g,
372
+ ].join(" "), f = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: u }), C = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(cs, { size: o ? 12 : 15 }) });
373
+ return /* @__PURE__ */ e("div", { className: g, "data-testid": "message-chatbot-indicator", children: n && !o ? /* @__PURE__ */ i(he, { children: [
374
+ f,
375
375
  C
376
- ] }) : /* @__PURE__ */ i(ce, { children: [
376
+ ] }) : /* @__PURE__ */ i(he, { children: [
377
377
  C,
378
- g
378
+ f
379
379
  ] }) });
380
- }, Ge = A.memo(
380
+ }, Ze = O.memo(
381
381
  ({
382
382
  channel: t,
383
383
  selectedChannel: s,
384
384
  onChannelSelect: n,
385
- debug: r = !1,
385
+ debug: a = !1,
386
386
  unread: l,
387
- renderMessagePreview: u
387
+ renderMessagePreview: c
388
388
  }) => {
389
- var p, T, f, c;
390
- const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), m = () => {
389
+ var p, T, b, d;
390
+ const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), u = () => {
391
391
  t && n(t);
392
- }, x = (d) => {
393
- const M = d.key === "Enter" || d.key === " ", k = d.repeat;
394
- !M || k || (d.preventDefault(), m());
392
+ }, g = (m) => {
393
+ const M = m.key === "Enter" || m.key === " ", k = m.repeat;
394
+ !M || k || (m.preventDefault(), u());
395
395
  }, C = Object.values(((p = t == null ? void 0 : t.state) == null ? void 0 : p.members) || {}).find(
396
- (d) => {
396
+ (m) => {
397
397
  var M, k;
398
- return ((M = d.user) == null ? void 0 : M.id) && d.user.id !== ((k = t == null ? void 0 : t._client) == null ? void 0 : k.userID);
398
+ return ((M = m.user) == null ? void 0 : M.id) && m.user.id !== ((k = t == null ? void 0 : t._client) == null ? void 0 : k.userID);
399
399
  }
400
- ), b = ((T = C == null ? void 0 : C.user) == null ? void 0 : T.name) || "Conversation", w = (f = C == null ? void 0 : C.user) == null ? void 0 : f.image, a = (() => {
400
+ ), x = ((T = C == null ? void 0 : C.user) == null ? void 0 : T.name) || "Conversation", v = (b = C == null ? void 0 : C.user) == null ? void 0 : b.image, r = (() => {
401
401
  var M;
402
- const d = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages;
403
- if (d != null && d.length) {
404
- for (let k = d.length - 1; k >= 0; k--)
405
- if (d[k].type !== "system") return d[k];
402
+ const m = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages;
403
+ if (m != null && m.length) {
404
+ for (let k = m.length - 1; k >= 0; k--)
405
+ if (m[k].type !== "system") return m[k];
406
406
  }
407
- })(), I = (() => {
407
+ })(), E = (() => {
408
408
  var M;
409
- if (a != null && a.text) return a.text;
410
- const d = (M = a == null ? void 0 : a.attachments) == null ? void 0 : M[0];
411
- return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "📷 Sent an image" : d.type === "video" ? "🎥 Sent a video" : d.type === "audio" ? "🎵 Sent audio" : d.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
412
- })(), v = a != null && a.created_at ? Jt(new Date(a.created_at)) : "", S = a ? Me(a) : !1, N = u ? u(a, I) : `${S ? "✨ " : ""}${I}`, h = l ?? 0;
413
- return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
409
+ if (r != null && r.text) return r.text;
410
+ const m = (M = r == null ? void 0 : r.attachments) == null ? void 0 : M[0];
411
+ return m ? m.og_scrape_url ? m.og_scrape_url : m.type === "image" ? "📷 Sent an image" : m.type === "video" ? "🎥 Sent a video" : m.type === "audio" ? "🎵 Sent audio" : m.type === "file" ? "📎 Sent a file" : "📎 Sent an attachment" : "No messages yet";
412
+ })(), w = r != null && r.created_at ? os(new Date(r.created_at)) : "", S = r ? Fe(r) : !1, N = c ? c(r, E) : `${S ? "✨ " : ""}${E}`, h = l ?? 0;
413
+ return a && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
414
414
  channelId: t == null ? void 0 : t.id,
415
415
  isSelected: o,
416
- participantName: b,
416
+ participantName: x,
417
417
  unreadCount: h,
418
- hasTimestamp: !!v
418
+ hasTimestamp: !!w
419
419
  }), /* @__PURE__ */ e(
420
420
  "div",
421
421
  {
422
422
  role: "button",
423
423
  tabIndex: 0,
424
- onClick: m,
425
- onKeyDown: x,
424
+ onClick: u,
425
+ onKeyDown: g,
426
426
  className: R(
427
427
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
428
428
  {
@@ -432,11 +432,11 @@ const ee = ({
432
432
  ),
433
433
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
434
434
  /* @__PURE__ */ e(
435
- ee,
435
+ ne,
436
436
  {
437
- id: ((c = C == null ? void 0 : C.user) == null ? void 0 : c.id) || t.id || "unknown",
438
- name: b,
439
- image: w,
437
+ id: ((d = C == null ? void 0 : C.user) == null ? void 0 : d.id) || t.id || "unknown",
438
+ name: x,
439
+ image: v,
440
440
  size: 44,
441
441
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
442
442
  }
@@ -450,10 +450,10 @@ const ee = ({
450
450
  "text-sm font-medium truncate",
451
451
  o ? "text-primary" : "text-charcoal"
452
452
  ),
453
- children: b
453
+ children: x
454
454
  }
455
455
  ),
456
- v && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: v })
456
+ w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
457
457
  ] }),
458
458
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
459
459
  /* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: N }),
@@ -465,48 +465,48 @@ const ee = ({
465
465
  );
466
466
  }
467
467
  );
468
- Ge.displayName = "CustomChannelPreview";
469
- const He = A.memo(
468
+ Ze.displayName = "CustomChannelPreview";
469
+ const Xe = O.memo(
470
470
  ({
471
471
  onChannelSelect: t,
472
472
  selectedChannel: s,
473
473
  filters: n,
474
- className: r,
474
+ className: a,
475
475
  customEmptyStateIndicator: l,
476
- renderMessagePreview: u
476
+ renderMessagePreview: c
477
477
  }) => {
478
- const o = A.useRef(0);
478
+ const o = O.useRef(0);
479
479
  o.current++;
480
- const { debug: m = !1 } = Ne();
481
- m && console.log("📺 [ChannelList] 🔄 RENDER START", {
480
+ const { debug: u = !1 } = Ee();
481
+ u && console.log("📺 [ChannelList] 🔄 RENDER START", {
482
482
  renderCount: o.current,
483
483
  selectedChannelId: s == null ? void 0 : s.id,
484
484
  filters: n
485
485
  });
486
- const x = A.useMemo(() => (C) => /* @__PURE__ */ e(
487
- Ge,
486
+ const g = O.useMemo(() => (C) => /* @__PURE__ */ e(
487
+ Ze,
488
488
  {
489
489
  ...C,
490
490
  selectedChannel: s,
491
491
  onChannelSelect: t,
492
- debug: m,
493
- renderMessagePreview: u
492
+ debug: u,
493
+ renderMessagePreview: c
494
494
  }
495
- ), [s, t, m, u]);
495
+ ), [s, t, u, c]);
496
496
  return /* @__PURE__ */ e(
497
497
  "div",
498
498
  {
499
499
  className: R(
500
500
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
501
- r
501
+ a
502
502
  ),
503
503
  children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
504
- rt,
504
+ gt,
505
505
  {
506
506
  filters: n,
507
507
  sort: { last_message_at: -1 },
508
508
  options: { limit: 30 },
509
- Preview: x,
509
+ Preview: g,
510
510
  EmptyStateIndicator: l
511
511
  },
512
512
  JSON.stringify(n)
@@ -515,12 +515,12 @@ const He = A.memo(
515
515
  );
516
516
  }
517
517
  );
518
- He.displayName = "ChannelList";
519
- const ge = ({
518
+ Xe.displayName = "ChannelList";
519
+ const Ne = ({
520
520
  variant: t = "default",
521
521
  className: s,
522
522
  children: n,
523
- ...r
523
+ ...a
524
524
  }) => /* @__PURE__ */ e(
525
525
  "button",
526
526
  {
@@ -530,11 +530,11 @@ const ge = ({
530
530
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
531
531
  s
532
532
  ),
533
- ...r,
533
+ ...a,
534
534
  children: n
535
535
  }
536
536
  );
537
- function ze({ label: t, className: s, children: n, ...r }) {
537
+ function Qe({ label: t, className: s, children: n, ...a }) {
538
538
  return /* @__PURE__ */ i(
539
539
  "button",
540
540
  {
@@ -542,12 +542,12 @@ function ze({ label: t, className: s, children: n, ...r }) {
542
542
  className: R(
543
543
  "rounded-full p-2 transition-colors focus-ring",
544
544
  {
545
- "cursor-not-allowed opacity-50": r.disabled,
546
- "hover:bg-sand": !r.disabled
545
+ "cursor-not-allowed opacity-50": a.disabled,
546
+ "hover:bg-sand": !a.disabled
547
547
  },
548
548
  s
549
549
  ),
550
- ...r,
550
+ ...a,
551
551
  children: [
552
552
  /* @__PURE__ */ e("span", { className: "sr-only", children: t }),
553
553
  n
@@ -555,41 +555,41 @@ function ze({ label: t, className: s, children: n, ...r }) {
555
555
  }
556
556
  );
557
557
  }
558
- function Ve({ onClick: t }) {
559
- return /* @__PURE__ */ e(ze, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Se, { className: "h-5 w-5 text-stone", weight: "bold" }) });
558
+ function Je({ onClick: t }) {
559
+ return /* @__PURE__ */ e(Qe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Le, { className: "h-5 w-5 text-stone", weight: "bold" }) });
560
560
  }
561
- const ns = (t) => /* @__PURE__ */ e(ot, { ...t, position: "center" }), Ee = "vote_up", _e = "vote_down";
562
- function as(t) {
563
- return t != null && t.length ? t.some((s) => s.type === _e) ? "down" : t.some((s) => s.type === Ee) ? "up" : null : null;
561
+ const hs = (t) => /* @__PURE__ */ e(bt, { ...t, position: "center" }), De = "vote_up", Te = "vote_down";
562
+ function fs(t) {
563
+ return t != null && t.length ? t.some((s) => s.type === Te) ? "down" : t.some((s) => s.type === De) ? "up" : null : null;
564
564
  }
565
- function rs(t) {
566
- const { channel: s } = Ie(), { client: n } = Be("useMessageVote"), r = ye(
567
- () => as(t.own_reactions),
565
+ function gs(t) {
566
+ const { channel: s } = Re(), { client: n } = qe("useMessageVote"), a = ke(
567
+ () => fs(t.own_reactions),
568
568
  [t.own_reactions]
569
- ), l = P(async () => {
569
+ ), l = F(async () => {
570
570
  if (n != null && n.userID)
571
571
  try {
572
- r === "up" ? await s.deleteReaction(t.id, Ee) : await s.sendReaction(
572
+ a === "up" ? await s.deleteReaction(t.id, De) : await s.sendReaction(
573
573
  t.id,
574
- { type: Ee },
574
+ { type: De },
575
575
  { enforce_unique: !0, skip_push: !0 }
576
576
  );
577
577
  } catch {
578
578
  }
579
- }, [s, n == null ? void 0 : n.userID, t.id, r]), u = P(async () => {
579
+ }, [s, n == null ? void 0 : n.userID, t.id, a]), c = F(async () => {
580
580
  if (n != null && n.userID)
581
581
  try {
582
- r === "down" ? await s.deleteReaction(t.id, _e) : await s.sendReaction(
582
+ a === "down" ? await s.deleteReaction(t.id, Te) : await s.sendReaction(
583
583
  t.id,
584
- { type: _e },
584
+ { type: Te },
585
585
  { enforce_unique: !0, skip_push: !0 }
586
586
  );
587
587
  } catch {
588
588
  }
589
- }, [s, n == null ? void 0 : n.userID, t.id, r]);
590
- return { selected: r, voteUp: l, voteDown: u };
589
+ }, [s, n == null ? void 0 : n.userID, t.id, a]);
590
+ return { selected: a, voteUp: l, voteDown: c };
591
591
  }
592
- const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
592
+ const bs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
593
593
  "path",
594
594
  {
595
595
  d: "M4.667 7.333l2.666-6A1.333 1.333 0 018.667 2v2.667a.667.667 0 00.666.666h3.764a1.334 1.334 0 011.192 1.93l-2.333 4.666a1.333 1.333 0 01-1.193.738H4.667m0-5.334v5.334m0-5.334H2.667a1.333 1.333 0 00-1.334 1.334v2.666a1.333 1.333 0 001.334 1.334h2",
@@ -599,7 +599,7 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
599
599
  strokeLinejoin: "round",
600
600
  fill: t ? "currentColor" : "none"
601
601
  }
602
- ) }), ls = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
602
+ ) }), xs = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
603
603
  "path",
604
604
  {
605
605
  d: "M11.333 8.667l-2.666 6A1.333 1.333 0 017.333 14v-2.667a.667.667 0 00-.666-.666H2.903a1.334 1.334 0 01-1.192-1.93l2.333-4.666a1.333 1.333 0 011.193-.738h6.096m0 5.334V3.333m0 5.334h2a1.333 1.333 0 001.334-1.334V4.667a1.333 1.333 0 00-1.334-1.334h-2",
@@ -609,7 +609,7 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
609
609
  strokeLinejoin: "round",
610
610
  fill: t ? "currentColor" : "none"
611
611
  }
612
- ) }), is = ({
612
+ ) }), Cs = ({
613
613
  selected: t,
614
614
  onVoteUp: s,
615
615
  onVoteDown: n
@@ -622,7 +622,7 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
622
622
  onClick: s,
623
623
  "aria-label": "Helpful",
624
624
  "aria-pressed": t === "up",
625
- children: /* @__PURE__ */ e(os, { filled: t === "up" })
625
+ children: /* @__PURE__ */ e(bs, { filled: t === "up" })
626
626
  }
627
627
  ),
628
628
  /* @__PURE__ */ e(
@@ -633,104 +633,104 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
633
633
  onClick: n,
634
634
  "aria-label": "Not helpful",
635
635
  "aria-pressed": t === "down",
636
- children: /* @__PURE__ */ e(ls, { filled: t === "down" })
636
+ children: /* @__PURE__ */ e(xs, { filled: t === "down" })
637
637
  }
638
638
  )
639
- ] }), cs = (t) => {
640
- var me, K;
639
+ ] }), Ns = (t) => {
640
+ var be, te;
641
641
  const {
642
642
  additionalMessageInputProps: s,
643
643
  chatbotVotingEnabled: n,
644
- editing: r,
644
+ editing: a,
645
645
  endOfGroup: l,
646
- firstOfGroup: u,
646
+ firstOfGroup: c,
647
647
  groupedByUser: o,
648
- handleAction: m,
649
- handleOpenThread: x,
650
- handleRetry: g,
648
+ handleAction: u,
649
+ handleOpenThread: g,
650
+ handleRetry: f,
651
651
  highlighted: C,
652
- isMessageAIGenerated: b,
653
- isMyMessage: w,
654
- message: a,
652
+ isMessageAIGenerated: x,
653
+ isMyMessage: v,
654
+ message: r,
655
655
  renderText: y,
656
- threadList: I
657
- } = t, { client: v } = Be("CustomMessage"), [S, N] = _(!1), h = it(a.id), { selected: p, voteUp: T, voteDown: f } = rs(a), {
658
- Attachment: c = dt,
659
- EditMessageModal: d = ut,
660
- MessageBlocked: M = mt,
661
- MessageBouncePrompt: k = ht,
662
- MessageDeleted: B = ft,
663
- MessageIsThreadReplyInChannelButtonIndicator: D = gt,
664
- MessageRepliesCountButton: W = xt,
665
- ReminderNotification: z = bt,
666
- StreamedMessageText: te = Ct,
656
+ threadList: E
657
+ } = t, { client: w } = qe("CustomMessage"), [S, N] = I(!1), h = Ct(r.id), { selected: p, voteUp: T, voteDown: b } = gs(r), {
658
+ Attachment: d = vt,
659
+ EditMessageModal: m = yt,
660
+ MessageBlocked: M = wt,
661
+ MessageBouncePrompt: k = pt,
662
+ MessageDeleted: B = Et,
663
+ MessageIsThreadReplyInChannelButtonIndicator: D = _t,
664
+ MessageRepliesCountButton: Y = It,
665
+ ReminderNotification: V = St,
666
+ StreamedMessageText: re = Mt,
667
667
  PinIndicator: J
668
- } = ct("CustomMessage"), se = Nt(a), ne = vt(a), ie = ye(
669
- () => b == null ? void 0 : b(a),
670
- [b, a]
671
- ), $ = ye(
672
- () => !a.shared_location && !a.attachments ? [] : a.shared_location ? [a.shared_location, ...a.attachments ?? []] : a.attachments,
673
- [a]
668
+ } = Nt("CustomMessage"), ae = kt(r), oe = Dt(r), me = ke(
669
+ () => x == null ? void 0 : x(r),
670
+ [x, r]
671
+ ), $ = ke(
672
+ () => !r.shared_location && !r.attachments ? [] : r.shared_location ? [r.shared_location, ...r.attachments ?? []] : r.attachments,
673
+ [r]
674
674
  );
675
- if (wt(a))
675
+ if (Tt(r))
676
676
  return null;
677
- if (a.deleted_at || a.type === "deleted")
678
- return /* @__PURE__ */ e(B, { message: a });
679
- if (pt(a))
677
+ if (r.deleted_at || r.type === "deleted")
678
+ return /* @__PURE__ */ e(B, { message: r });
679
+ if (Rt(r))
680
680
  return /* @__PURE__ */ e(M, {});
681
- const Q = !I && !!a.reply_count, U = !I && a.show_in_channel && a.parent_id, F = a.status === "failed" && ((me = a.error) == null ? void 0 : me.status) !== 403, V = yt(a);
681
+ const K = !E && !!r.reply_count, A = !E && r.show_in_channel && r.parent_id, U = r.status === "failed" && ((be = r.error) == null ? void 0 : be.status) !== 403, q = Lt(r);
682
682
  let L;
683
- F ? L = () => g(a) : V && (L = () => N(!0));
684
- const G = w(), de = R(
683
+ U ? L = () => f(r) : q && (L = () => N(!0));
684
+ const G = v(), fe = R(
685
685
  "str-chat__message str-chat__message-simple",
686
- `str-chat__message--${a.type}`,
687
- `str-chat__message--${a.status}`,
686
+ `str-chat__message--${r.type}`,
687
+ `str-chat__message--${r.status}`,
688
688
  G ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
689
- a.text ? "str-chat__message--has-text" : "has-no-text",
689
+ r.text ? "str-chat__message--has-text" : "has-no-text",
690
690
  {
691
- "str-chat__message--has-attachment": se,
691
+ "str-chat__message--has-attachment": ae,
692
692
  "str-chat__message--highlighted": C,
693
- "str-chat__message--pinned pinned-message": a.pinned,
694
- "str-chat__message--with-reactions": ne,
695
- "str-chat__message-send-can-be-retried": (a == null ? void 0 : a.status) === "failed" && ((K = a == null ? void 0 : a.error) == null ? void 0 : K.status) !== 403,
696
- "str-chat__message-with-thread-link": Q || U,
693
+ "str-chat__message--pinned pinned-message": r.pinned,
694
+ "str-chat__message--with-reactions": oe,
695
+ "str-chat__message-send-can-be-retried": (r == null ? void 0 : r.status) === "failed" && ((te = r == null ? void 0 : r.error) == null ? void 0 : te.status) !== 403,
696
+ "str-chat__message-with-thread-link": K || A,
697
697
  "str-chat__virtual-message__wrapper--end": l,
698
- "str-chat__virtual-message__wrapper--first": u,
698
+ "str-chat__virtual-message__wrapper--first": c,
699
699
  "str-chat__virtual-message__wrapper--group": o
700
700
  }
701
- ), Z = a.poll_id && v.polls.fromState(a.poll_id), ae = ss(a), X = Me(a), re = !!($ != null && $.length && !a.quoted_message), ue = X && G && re;
702
- return /* @__PURE__ */ i(ce, { children: [
703
- r && /* @__PURE__ */ e(
704
- d,
701
+ ), Q = r.poll_id && w.polls.fromState(r.poll_id), le = ms(r), ee = Fe(r), ie = !!($ != null && $.length && !r.quoted_message), ge = ee && G && ie;
702
+ return /* @__PURE__ */ i(he, { children: [
703
+ a && /* @__PURE__ */ e(
704
+ m,
705
705
  {
706
706
  additionalMessageInputProps: s
707
707
  }
708
708
  ),
709
709
  S && /* @__PURE__ */ e(
710
- Et,
710
+ Ft,
711
711
  {
712
712
  MessageBouncePrompt: k,
713
713
  onClose: () => N(!1),
714
714
  open: S
715
715
  }
716
716
  ),
717
- /* @__PURE__ */ i("div", { className: de, children: [
717
+ /* @__PURE__ */ i("div", { className: fe, children: [
718
718
  J && /* @__PURE__ */ e(J, {}),
719
- !!h && /* @__PURE__ */ e(z, { reminder: h }),
720
- a.user && /* @__PURE__ */ e(
721
- ee,
719
+ !!h && /* @__PURE__ */ e(V, { reminder: h }),
720
+ r.user && /* @__PURE__ */ e(
721
+ ne,
722
722
  {
723
723
  className: "str-chat__avatar str-chat__message-sender-avatar",
724
- id: a.user.id,
725
- image: a.user.image,
726
- name: a.user.name || a.user.id
724
+ id: r.user.id,
725
+ image: r.user.image,
726
+ name: r.user.name || r.user.id
727
727
  }
728
728
  ),
729
729
  /* @__PURE__ */ e(
730
730
  "div",
731
731
  {
732
732
  className: R("str-chat__message-inner", {
733
- "str-chat__simple-message--error-failed": F || V
733
+ "str-chat__simple-message--error-failed": U || q
734
734
  }),
735
735
  "data-testid": "message-inner",
736
736
  onClick: L,
@@ -743,80 +743,80 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
743
743
  marginInlineEnd: 0,
744
744
  marginInlineStart: 0
745
745
  },
746
- children: ae ? (
746
+ children: le ? (
747
747
  /* Tip-only messages render as a standalone bubble */
748
- /* @__PURE__ */ e(pe, { message: a, standalone: !0 })
748
+ /* @__PURE__ */ e(Se, { message: r, standalone: !0 })
749
749
  ) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
750
750
  /* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
751
- X && !ue && /* @__PURE__ */ e(
752
- pe,
751
+ ee && !ge && /* @__PURE__ */ e(
752
+ Se,
753
753
  {
754
- message: a,
755
- hasAttachment: re,
754
+ message: r,
755
+ hasAttachment: ie,
756
756
  isMyMessage: G
757
757
  }
758
758
  ),
759
- Z && /* @__PURE__ */ e(_t, { poll: Z }),
760
- $ != null && $.length && !a.quoted_message ? /* @__PURE__ */ e(
761
- c,
759
+ Q && /* @__PURE__ */ e(At, { poll: Q }),
760
+ $ != null && $.length && !r.quoted_message ? /* @__PURE__ */ e(
761
+ d,
762
762
  {
763
- actionHandler: m,
763
+ actionHandler: u,
764
764
  attachments: $
765
765
  }
766
766
  ) : null,
767
- ie ? /* @__PURE__ */ e(
768
- te,
767
+ me ? /* @__PURE__ */ e(
768
+ re,
769
769
  {
770
- message: a,
770
+ message: r,
771
771
  renderText: y
772
772
  }
773
- ) : /* @__PURE__ */ e(It, { message: a, renderText: y }),
774
- /* @__PURE__ */ e(St, {})
773
+ ) : /* @__PURE__ */ e(Ut, { message: r, renderText: y }),
774
+ /* @__PURE__ */ e(Pt, {})
775
775
  ] }),
776
- (!X || ue) && /* @__PURE__ */ e(
777
- pe,
776
+ (!ee || ge) && /* @__PURE__ */ e(
777
+ Se,
778
778
  {
779
- message: a,
780
- hasAttachment: re,
779
+ message: r,
780
+ hasAttachment: ie,
781
781
  isMyMessage: G
782
782
  }
783
783
  ),
784
- n && X && /* @__PURE__ */ e(
785
- is,
784
+ n && ee && /* @__PURE__ */ e(
785
+ Cs,
786
786
  {
787
787
  selected: p,
788
788
  onVoteUp: T,
789
- onVoteDown: f
789
+ onVoteDown: b
790
790
  }
791
791
  )
792
792
  ] })
793
793
  }
794
794
  ),
795
- Q && /* @__PURE__ */ e(
796
- W,
795
+ K && /* @__PURE__ */ e(
796
+ Y,
797
797
  {
798
- onClick: x,
799
- reply_count: a.reply_count
798
+ onClick: g,
799
+ reply_count: r.reply_count
800
800
  }
801
801
  ),
802
- U && /* @__PURE__ */ e(D, {})
803
- ] }, a.id)
802
+ A && /* @__PURE__ */ e(D, {})
803
+ ] }, r.id)
804
804
  ] });
805
- }, ds = A.memo(
806
- cs,
807
- lt
808
- ), us = (t) => {
809
- const s = Mt("CustomMessage");
810
- return /* @__PURE__ */ e(ds, { ...s, ...t });
811
- }, ms = (t) => ({
805
+ }, vs = O.memo(
806
+ Ns,
807
+ xt
808
+ ), ys = (t) => {
809
+ const s = Ot("CustomMessage");
810
+ return /* @__PURE__ */ e(vs, { ...s, ...t });
811
+ }, ws = (t) => ({
812
812
  linkPreviews: Array.from(t.previews.values()).filter(
813
- (s) => Fe.previewIsLoaded(s) || Fe.previewIsLoading(s)
813
+ (s) => Ge.previewIsLoaded(s) || Ge.previewIsLoading(s)
814
814
  )
815
- }), hs = ({
815
+ }), ps = ({
816
816
  link: t,
817
817
  onDismiss: s
818
818
  }) => {
819
- const { og_scrape_url: n, title: r, image_url: l } = t;
819
+ const { og_scrape_url: n, title: a, image_url: l } = t;
820
820
  return /* @__PURE__ */ i(
821
821
  "a",
822
822
  {
@@ -829,7 +829,7 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
829
829
  "img",
830
830
  {
831
831
  src: l,
832
- alt: r || "",
832
+ alt: a || "",
833
833
  className: "h-[148px] w-full rounded-[20px] object-cover"
834
834
  }
835
835
  ),
@@ -842,42 +842,42 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
842
842
  },
843
843
  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",
844
844
  "aria-label": "Close link preview",
845
- children: /* @__PURE__ */ e(Se, { className: "size-4 text-black/90" })
845
+ children: /* @__PURE__ */ e(Le, { className: "size-4 text-black/90" })
846
846
  }
847
847
  ),
848
848
  /* @__PURE__ */ i("div", { className: "p-2", children: [
849
- r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
849
+ a && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: a }),
850
850
  /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
851
851
  ] })
852
852
  ]
853
853
  }
854
854
  );
855
- }, fs = () => {
856
- const { linkPreviewsManager: t } = kt(), { linkPreviews: s } = Dt(
855
+ }, Es = () => {
856
+ const { linkPreviewsManager: t } = Bt(), { linkPreviews: s } = $t(
857
857
  t.state,
858
- ms
858
+ ws
859
859
  ), n = (l) => {
860
860
  t.dismissPreview(l);
861
861
  };
862
862
  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(
863
- hs,
863
+ ps,
864
864
  {
865
865
  link: l,
866
866
  onDismiss: n
867
867
  },
868
868
  l.og_scrape_url
869
869
  )) }) : null;
870
- }, gs = () => {
871
- const { handleSubmit: t } = Rt(), s = Lt();
872
- return /* @__PURE__ */ i(ce, { children: [
873
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Pt, {}) }),
870
+ }, _s = () => {
871
+ const { handleSubmit: t } = Gt(), s = Ht();
872
+ return /* @__PURE__ */ i(he, { children: [
873
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(zt, {}) }),
874
874
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
875
- /* @__PURE__ */ e(Ut, {}),
876
- /* @__PURE__ */ e(fs, {}),
877
- /* @__PURE__ */ e(Ft, {}),
875
+ /* @__PURE__ */ e(Vt, {}),
876
+ /* @__PURE__ */ e(Es, {}),
877
+ /* @__PURE__ */ e(qt, {}),
878
878
  /* @__PURE__ */ i("div", { className: "flex", children: [
879
879
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
880
- Ot,
880
+ Wt,
881
881
  {
882
882
  className: "w-full resize-none outline-none leading-6",
883
883
  autoFocus: !0,
@@ -893,36 +893,36 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
893
893
  disabled: !s,
894
894
  onClick: t,
895
895
  type: "button",
896
- children: /* @__PURE__ */ e(Ht, { className: "size-4" })
896
+ children: /* @__PURE__ */ e(Kt, { className: "size-4" })
897
897
  }
898
898
  )
899
899
  ] })
900
900
  ] })
901
901
  ] });
902
- }, xs = ({
902
+ }, Is = ({
903
903
  renderActions: t
904
904
  }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
905
905
  t && (t == null ? void 0 : t()),
906
- /* @__PURE__ */ e(Tt, { Input: gs })
907
- ] }), bs = [
906
+ /* @__PURE__ */ e(jt, { Input: _s })
907
+ ] }), Ss = [
908
908
  "SYSTEM_DM_AGENT_PAUSED",
909
909
  "SYSTEM_DM_AGENT_RESUMED"
910
- ], Cs = {
910
+ ], Ms = {
911
911
  SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
912
912
  SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
913
- }, Ae = (t) => bs.includes(t), Ns = (t) => {
914
- var r;
915
- const s = (r = t.metadata) == null ? void 0 : r.custom_type;
916
- if (Ae(s))
913
+ }, ze = (t) => Ss.includes(t), ks = (t) => {
914
+ var a;
915
+ const s = (a = t.metadata) == null ? void 0 : a.custom_type;
916
+ if (ze(s))
917
917
  return s;
918
918
  const n = t.dm_agent_system_type;
919
- if (Ae(n))
919
+ if (ze(n))
920
920
  return n;
921
- }, vs = (t) => {
922
- var r;
923
- const s = t.message.hide_date === !0, n = Ns(t.message);
921
+ }, Ds = (t) => {
922
+ var a;
923
+ const s = t.message.hide_date === !0, n = ks(t.message);
924
924
  if (n) {
925
- const l = ((r = t.message.text) == null ? void 0 : r.trim()) || Cs[n];
925
+ const l = ((a = t.message.text) == null ? void 0 : a.trim()) || Ms[n];
926
926
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
927
927
  /* @__PURE__ */ i(
928
928
  "div",
@@ -932,7 +932,7 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
932
932
  "data-dm-agent-system-type": n,
933
933
  children: [
934
934
  /* @__PURE__ */ e(
935
- zt,
935
+ es,
936
936
  {
937
937
  size: 16,
938
938
  weight: "regular",
@@ -944,7 +944,7 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
944
944
  ]
945
945
  }
946
946
  ),
947
- !s && /* @__PURE__ */ e(De, { message: t.message })
947
+ !s && /* @__PURE__ */ e(Ue, { message: t.message })
948
948
  ] });
949
949
  }
950
950
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
@@ -953,9 +953,9 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
953
953
  /* @__PURE__ */ e("p", { children: t.message.text }),
954
954
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
955
955
  ] }),
956
- !s && /* @__PURE__ */ e(De, { message: t.message })
956
+ !s && /* @__PURE__ */ e(Ue, { message: t.message })
957
957
  ] });
958
- }, ws = () => null, ps = ({ className: t, message: s }) => /* @__PURE__ */ i(
958
+ }, Ts = () => null, Rs = ({ className: t, message: s }) => /* @__PURE__ */ i(
959
959
  "div",
960
960
  {
961
961
  className: R("flex items-center justify-center h-full", t),
@@ -998,41 +998,41 @@ const os = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "1
998
998
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
999
999
  ]
1000
1000
  }
1001
- ), Ce = A.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1002
- /* @__PURE__ */ e(ps, { className: "w-6 h-6" }),
1001
+ ), we = O.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1002
+ /* @__PURE__ */ e(Rs, { className: "w-6 h-6" }),
1003
1003
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1004
1004
  ] }) }));
1005
- Ce.displayName = "LoadingState";
1006
- const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150", ys = ({
1005
+ we.displayName = "LoadingState";
1006
+ const ue = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150", Ls = ({
1007
1007
  onBack: t,
1008
1008
  showBackButton: s,
1009
1009
  onShowInfo: n,
1010
- canShowInfo: r,
1010
+ canShowInfo: a,
1011
1011
  showStarButton: l = !1
1012
1012
  }) => {
1013
- var w, a, y, I, v, S;
1014
- const { channel: u } = Ie(), o = A.useMemo(() => Object.values(u.state.members || {}).find(
1013
+ var v, r, y, E, w, S;
1014
+ const { channel: c } = Re(), o = O.useMemo(() => Object.values(c.state.members || {}).find(
1015
1015
  (h) => {
1016
1016
  var p;
1017
- return ((p = h.user) == null ? void 0 : p.id) && h.user.id !== u._client.userID;
1017
+ return ((p = h.user) == null ? void 0 : p.id) && h.user.id !== c._client.userID;
1018
1018
  }
1019
- ), [u._client.userID, u.state.members]), m = ((w = o == null ? void 0 : o.user) == null ? void 0 : w.name) || ((a = o == null ? void 0 : o.user) == null ? void 0 : a.id) || "Unknown member", x = (y = o == null ? void 0 : o.user) == null ? void 0 : y.image, [g, C] = _(
1020
- !!((I = u.state.membership) != null && I.pinned_at)
1019
+ ), [c._client.userID, c.state.members]), u = ((v = o == null ? void 0 : o.user) == null ? void 0 : v.name) || ((r = o == null ? void 0 : o.user) == null ? void 0 : r.id) || "Unknown member", g = (y = o == null ? void 0 : o.user) == null ? void 0 : y.image, [f, C] = I(
1020
+ !!((E = c.state.membership) != null && E.pinned_at)
1021
1021
  );
1022
- Y(() => {
1022
+ X(() => {
1023
1023
  const N = (h) => {
1024
1024
  var p;
1025
1025
  C(
1026
- h != null && h.member ? !!h.member.pinned_at : !!((p = u.state.membership) != null && p.pinned_at)
1026
+ h != null && h.member ? !!h.member.pinned_at : !!((p = c.state.membership) != null && p.pinned_at)
1027
1027
  );
1028
1028
  };
1029
- return u.on("member.updated", N), () => {
1030
- u.off("member.updated", N);
1029
+ return c.on("member.updated", N), () => {
1030
+ c.off("member.updated", N);
1031
1031
  };
1032
- }, [u]);
1033
- const b = async () => {
1032
+ }, [c]);
1033
+ const x = async () => {
1034
1034
  try {
1035
- g ? await u.unpin() : await u.pin();
1035
+ f ? await c.unpin() : await c.pin();
1036
1036
  } catch (N) {
1037
1037
  console.error(
1038
1038
  "[CustomChannelHeader] Failed to update pinned status:",
@@ -1045,42 +1045,42 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1045
1045
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ e(
1046
1046
  "button",
1047
1047
  {
1048
- className: le,
1048
+ className: ue,
1049
1049
  onClick: t || (() => {
1050
1050
  }),
1051
1051
  type: "button",
1052
1052
  "aria-label": "Back to conversations",
1053
- children: /* @__PURE__ */ e(Te, { className: "size-5 text-black/90" })
1053
+ children: /* @__PURE__ */ e(Pe, { className: "size-5 text-black/90" })
1054
1054
  }
1055
1055
  ) }),
1056
1056
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
1057
1057
  /* @__PURE__ */ e(
1058
- ee,
1058
+ ne,
1059
1059
  {
1060
- id: ((v = o == null ? void 0 : o.user) == null ? void 0 : v.id) || u.id || "unknown",
1061
- name: m,
1062
- image: x,
1060
+ id: ((w = o == null ? void 0 : o.user) == null ? void 0 : w.id) || c.id || "unknown",
1061
+ name: u,
1062
+ image: g,
1063
1063
  size: 40
1064
1064
  }
1065
1065
  ),
1066
- /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: m })
1066
+ /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: u })
1067
1067
  ] }),
1068
1068
  /* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-2", children: [
1069
1069
  l && /* @__PURE__ */ e(
1070
1070
  "button",
1071
1071
  {
1072
- className: le,
1073
- onClick: b,
1072
+ className: ue,
1073
+ onClick: x,
1074
1074
  type: "button",
1075
- "aria-label": g ? "Unstar conversation" : "Star conversation",
1075
+ "aria-label": f ? "Unstar conversation" : "Star conversation",
1076
1076
  children: /* @__PURE__ */ e(
1077
- Re,
1077
+ Oe,
1078
1078
  {
1079
1079
  className: R("size-5", {
1080
- "text-yellow-600": g,
1081
- "text-black/90": !g
1080
+ "text-yellow-600": f,
1081
+ "text-black/90": !f
1082
1082
  }),
1083
- weight: g ? "duotone" : "regular"
1083
+ weight: f ? "duotone" : "regular"
1084
1084
  }
1085
1085
  )
1086
1086
  }
@@ -1088,11 +1088,11 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1088
1088
  /* @__PURE__ */ e(
1089
1089
  "button",
1090
1090
  {
1091
- className: le,
1091
+ className: ue,
1092
1092
  onClick: n,
1093
1093
  type: "button",
1094
1094
  "aria-label": "Show info",
1095
- children: /* @__PURE__ */ e(Le, { className: "size-5 text-black/90" })
1095
+ children: /* @__PURE__ */ e(Be, { className: "size-5 text-black/90" })
1096
1096
  }
1097
1097
  )
1098
1098
  ] })
@@ -1104,129 +1104,129 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1104
1104
  {
1105
1105
  type: "button",
1106
1106
  onClick: t,
1107
- className: le,
1107
+ className: ue,
1108
1108
  "aria-label": "Back to conversations",
1109
- children: /* @__PURE__ */ e(Te, { className: "size-5 text-black/90" })
1109
+ children: /* @__PURE__ */ e(Pe, { className: "size-5 text-black/90" })
1110
1110
  }
1111
1111
  ),
1112
1112
  /* @__PURE__ */ e(
1113
- ee,
1113
+ ne,
1114
1114
  {
1115
- id: ((S = o == null ? void 0 : o.user) == null ? void 0 : S.id) || u.id || "unknown",
1116
- name: m,
1117
- image: x,
1115
+ id: ((S = o == null ? void 0 : o.user) == null ? void 0 : S.id) || c.id || "unknown",
1116
+ name: u,
1117
+ image: g,
1118
1118
  size: 40
1119
1119
  }
1120
1120
  ),
1121
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: m }) })
1121
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: u }) })
1122
1122
  ] }),
1123
1123
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
1124
1124
  l && /* @__PURE__ */ e(
1125
1125
  "button",
1126
1126
  {
1127
- className: le,
1128
- onClick: b,
1127
+ className: ue,
1128
+ onClick: x,
1129
1129
  type: "button",
1130
- "aria-label": g ? "Unstar conversation" : "Star conversation",
1130
+ "aria-label": f ? "Unstar conversation" : "Star conversation",
1131
1131
  children: /* @__PURE__ */ e(
1132
- Re,
1132
+ Oe,
1133
1133
  {
1134
1134
  className: R("size-5", {
1135
- "text-yellow-600": g,
1136
- "text-black/90": !g
1135
+ "text-yellow-600": f,
1136
+ "text-black/90": !f
1137
1137
  }),
1138
- weight: g ? "duotone" : "regular"
1138
+ weight: f ? "duotone" : "regular"
1139
1139
  }
1140
1140
  )
1141
1141
  }
1142
1142
  ),
1143
- r && n && /* @__PURE__ */ e(
1143
+ a && n && /* @__PURE__ */ e(
1144
1144
  "button",
1145
1145
  {
1146
- className: le,
1146
+ className: ue,
1147
1147
  onClick: n,
1148
1148
  type: "button",
1149
1149
  "aria-label": "Show info",
1150
- children: /* @__PURE__ */ e(Le, { className: "size-5 text-black/90" })
1150
+ children: /* @__PURE__ */ e(Be, { className: "size-5 text-black/90" })
1151
1151
  }
1152
1152
  )
1153
1153
  ] })
1154
1154
  ] })
1155
1155
  ] });
1156
- }, Es = ({
1156
+ }, Fs = ({
1157
1157
  dialogRef: t,
1158
1158
  onClose: s,
1159
1159
  participant: n,
1160
- channel: r,
1160
+ channel: a,
1161
1161
  followerStatusLabel: l,
1162
- onLeaveConversation: u,
1162
+ onLeaveConversation: c,
1163
1163
  onBlockParticipant: o,
1164
- showDeleteConversation: m = !0,
1165
- onDeleteConversationClick: x,
1166
- onBlockParticipantClick: g,
1164
+ showDeleteConversation: u = !0,
1165
+ onDeleteConversationClick: g,
1166
+ onBlockParticipantClick: f,
1167
1167
  onReportParticipantClick: C,
1168
- customChannelActions: b
1168
+ customChannelActions: x
1169
1169
  }) => {
1170
- var te, J, se, ne, ie, $, Q;
1171
- const { service: w, debug: a } = Ne(), [y, I] = _(!1), [v, S] = _(!1), [N, h] = _(!1), p = P(async () => {
1172
- var U;
1173
- if (!(!w || !((U = n == null ? void 0 : n.user) != null && U.id)))
1170
+ var re, J, ae, oe, me, $, K;
1171
+ const { service: v, debug: r } = Ee(), [y, E] = I(!1), [w, S] = I(!1), [N, h] = I(!1), p = F(async () => {
1172
+ var A;
1173
+ if (!(!v || !((A = n == null ? void 0 : n.user) != null && A.id)))
1174
1174
  try {
1175
- const V = (await w.getBlockedUsers()).some(
1175
+ const q = (await v.getBlockedUsers()).some(
1176
1176
  (L) => {
1177
1177
  var G;
1178
1178
  return L.blocked_user_id === ((G = n == null ? void 0 : n.user) == null ? void 0 : G.id);
1179
1179
  }
1180
1180
  );
1181
- I(V);
1182
- } catch (F) {
1181
+ E(q);
1182
+ } catch (U) {
1183
1183
  console.error(
1184
1184
  "[ChannelInfoDialog] Failed to check blocked status:",
1185
- F
1185
+ U
1186
1186
  );
1187
1187
  }
1188
- }, [w, (te = n == null ? void 0 : n.user) == null ? void 0 : te.id]);
1189
- Y(() => {
1188
+ }, [v, (re = n == null ? void 0 : n.user) == null ? void 0 : re.id]);
1189
+ X(() => {
1190
1190
  p();
1191
1191
  }, [p]);
1192
1192
  const T = async () => {
1193
- var U;
1194
- if (!v) {
1195
- x == null || x(), a && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
1193
+ var A;
1194
+ if (!w) {
1195
+ g == null || g(), r && console.log("[ChannelInfoDialog] Leave conversation", a.cid), S(!0);
1196
1196
  try {
1197
- const F = ((U = r._client) == null ? void 0 : U.userID) ?? null;
1198
- await r.hide(F, !1), u && await u(r), s();
1199
- } catch (F) {
1200
- console.error("[ChannelInfoDialog] Failed to leave conversation", F);
1197
+ const U = ((A = a._client) == null ? void 0 : A.userID) ?? null;
1198
+ await a.hide(U, !1), c && await c(a), s();
1199
+ } catch (U) {
1200
+ console.error("[ChannelInfoDialog] Failed to leave conversation", U);
1201
1201
  } finally {
1202
1202
  S(!1);
1203
1203
  }
1204
1204
  }
1205
- }, f = async () => {
1206
- var U, F, V;
1207
- if (!(N || !w)) {
1208
- g == null || g(), a && console.log("[ChannelInfoDialog] Block member", (U = n == null ? void 0 : n.user) == null ? void 0 : U.id), h(!0);
1205
+ }, b = async () => {
1206
+ var A, U, q;
1207
+ if (!(N || !v)) {
1208
+ f == null || f(), r && console.log("[ChannelInfoDialog] Block member", (A = n == null ? void 0 : n.user) == null ? void 0 : A.id), h(!0);
1209
1209
  try {
1210
- await w.blockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), o && await o((V = n == null ? void 0 : n.user) == null ? void 0 : V.id), s();
1210
+ await v.blockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), o && await o((q = n == null ? void 0 : n.user) == null ? void 0 : q.id), s();
1211
1211
  } catch (L) {
1212
1212
  console.error("[ChannelInfoDialog] Failed to block member", L);
1213
1213
  } finally {
1214
1214
  h(!1);
1215
1215
  }
1216
1216
  }
1217
- }, c = async () => {
1218
- var U, F, V;
1219
- if (!(N || !w)) {
1220
- g == null || g(), a && console.log("[ChannelInfoDialog] Unblock member", (U = n == null ? void 0 : n.user) == null ? void 0 : U.id), h(!0);
1217
+ }, d = async () => {
1218
+ var A, U, q;
1219
+ if (!(N || !v)) {
1220
+ f == null || f(), r && console.log("[ChannelInfoDialog] Unblock member", (A = n == null ? void 0 : n.user) == null ? void 0 : A.id), h(!0);
1221
1221
  try {
1222
- await w.unBlockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), o && await o((V = n == null ? void 0 : n.user) == null ? void 0 : V.id), s();
1222
+ await v.unBlockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), o && await o((q = n == null ? void 0 : n.user) == null ? void 0 : q.id), s();
1223
1223
  } catch (L) {
1224
1224
  console.error("[ChannelInfoDialog] Failed to unblock member", L);
1225
1225
  } finally {
1226
1226
  h(!1);
1227
1227
  }
1228
1228
  }
1229
- }, d = () => {
1229
+ }, m = () => {
1230
1230
  C == null || C(), s(), window.open(
1231
1231
  "https://linktr.ee/s/about/trust-center/report",
1232
1232
  "_blank",
@@ -1234,7 +1234,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1234
1234
  );
1235
1235
  };
1236
1236
  if (!n) return null;
1237
- const M = ((J = n.user) == null ? void 0 : J.name) || ((se = n.user) == null ? void 0 : se.id) || "Unknown member", k = (ne = n.user) == null ? void 0 : ne.image, B = (ie = n.user) == null ? void 0 : ie.email, D = ($ = n.user) == null ? void 0 : $.username, W = B || (D ? `linktr.ee/${D}` : void 0), z = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
1237
+ const M = ((J = n.user) == null ? void 0 : J.name) || ((ae = n.user) == null ? void 0 : ae.id) || "Unknown member", k = (oe = n.user) == null ? void 0 : oe.image, B = (me = n.user) == null ? void 0 : me.email, D = ($ = n.user) == null ? void 0 : $.username, Y = B || (D ? `linktr.ee/${D}` : void 0), V = ((K = n.user) == null ? void 0 : K.id) || "unknown";
1238
1238
  return (
1239
1239
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1240
1240
  /* @__PURE__ */ e(
@@ -1243,13 +1243,13 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1243
1243
  ref: t,
1244
1244
  className: "mes-dialog group",
1245
1245
  onClose: s,
1246
- onClick: (U) => {
1247
- U.target === t.current && s();
1246
+ onClick: (A) => {
1247
+ A.target === t.current && s();
1248
1248
  },
1249
1249
  children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
1250
1250
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
1251
1251
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
1252
- /* @__PURE__ */ e(Ve, { onClick: s })
1252
+ /* @__PURE__ */ e(Je, { onClick: s })
1253
1253
  ] }),
1254
1254
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
1255
1255
  /* @__PURE__ */ e(
@@ -1259,9 +1259,9 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1259
1259
  style: { backgroundColor: "#FBFAF9" },
1260
1260
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
1261
1261
  /* @__PURE__ */ e(
1262
- ee,
1262
+ ne,
1263
1263
  {
1264
- id: z,
1264
+ id: V,
1265
1265
  name: M,
1266
1266
  image: k,
1267
1267
  size: 88,
@@ -1270,7 +1270,7 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1270
1270
  ),
1271
1271
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
1272
1272
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: M }),
1273
- W && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: W }),
1273
+ Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
1274
1274
  l && /* @__PURE__ */ e(
1275
1275
  "span",
1276
1276
  {
@@ -1290,106 +1290,106 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1290
1290
  }
1291
1291
  ),
1292
1292
  /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
1293
- m && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
1294
- ge,
1293
+ u && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
1294
+ Ne,
1295
1295
  {
1296
1296
  onClick: T,
1297
- disabled: v,
1298
- "aria-busy": v,
1297
+ disabled: w,
1298
+ "aria-busy": w,
1299
1299
  children: [
1300
- v ? /* @__PURE__ */ e(xe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Vt, { className: "h-5 w-5" }),
1300
+ w ? /* @__PURE__ */ e(ve, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ts, { className: "h-5 w-5" }),
1301
1301
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
1302
1302
  ]
1303
1303
  }
1304
1304
  ) }),
1305
1305
  /* @__PURE__ */ e("li", { children: y ? /* @__PURE__ */ i(
1306
- ge,
1306
+ Ne,
1307
1307
  {
1308
- onClick: c,
1308
+ onClick: d,
1309
1309
  disabled: N,
1310
1310
  "aria-busy": N,
1311
1311
  children: [
1312
- N ? /* @__PURE__ */ e(xe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Pe, { className: "h-5 w-5" }),
1312
+ N ? /* @__PURE__ */ e(ve, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
1313
1313
  /* @__PURE__ */ e("span", { children: "Unblock" })
1314
1314
  ]
1315
1315
  }
1316
1316
  ) : /* @__PURE__ */ i(
1317
- ge,
1317
+ Ne,
1318
1318
  {
1319
- onClick: f,
1319
+ onClick: b,
1320
1320
  disabled: N,
1321
1321
  "aria-busy": N,
1322
1322
  children: [
1323
- N ? /* @__PURE__ */ e(xe, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Pe, { className: "h-5 w-5" }),
1323
+ N ? /* @__PURE__ */ e(ve, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
1324
1324
  /* @__PURE__ */ e("span", { children: "Block" })
1325
1325
  ]
1326
1326
  }
1327
1327
  ) }),
1328
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ge, { variant: "danger", onClick: d, children: [
1329
- /* @__PURE__ */ e(Wt, { className: "h-5 w-5" }),
1328
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(Ne, { variant: "danger", onClick: m, children: [
1329
+ /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
1330
1330
  /* @__PURE__ */ e("span", { children: "Report" })
1331
1331
  ] }) }),
1332
- b
1332
+ x
1333
1333
  ] })
1334
1334
  ] })
1335
1335
  ] })
1336
1336
  }
1337
1337
  )
1338
1338
  );
1339
- }, _s = ({
1339
+ }, As = ({
1340
1340
  onBack: t,
1341
1341
  showBackButton: s,
1342
1342
  renderMessageInputActions: n,
1343
- onLeaveConversation: r,
1343
+ onLeaveConversation: a,
1344
1344
  onBlockParticipant: l,
1345
- showDeleteConversation: u = !0,
1345
+ showDeleteConversation: c = !0,
1346
1346
  onDeleteConversationClick: o,
1347
- onBlockParticipantClick: m,
1348
- onReportParticipantClick: x,
1349
- showStarButton: g = !1,
1347
+ onBlockParticipantClick: u,
1348
+ onReportParticipantClick: g,
1349
+ showStarButton: f = !1,
1350
1350
  chatbotVotingEnabled: C = !1,
1351
- renderChannelBanner: b,
1352
- customChannelActions: w
1351
+ renderChannelBanner: x,
1352
+ customChannelActions: v
1353
1353
  }) => {
1354
- const { channel: a } = Ie(), y = q(null), I = A.useMemo(() => Object.values(a.state.members || {}).find(
1354
+ const { channel: r } = Re(), y = z(null), E = O.useMemo(() => Object.values(r.state.members || {}).find(
1355
1355
  (p) => {
1356
1356
  var T;
1357
- return ((T = p.user) == null ? void 0 : T.id) && p.user.id !== a._client.userID;
1357
+ return ((T = p.user) == null ? void 0 : T.id) && p.user.id !== r._client.userID;
1358
1358
  }
1359
- ), [a._client.userID, a.state.members]), v = A.useMemo(() => {
1360
- const h = a.data ?? {};
1359
+ ), [r._client.userID, r.state.members]), w = O.useMemo(() => {
1360
+ const h = r.data ?? {};
1361
1361
  if (h.followerStatus)
1362
1362
  return String(h.followerStatus);
1363
1363
  if (h.isFollower !== void 0)
1364
1364
  return h.isFollower ? "Subscribed to you" : "Not subscribed";
1365
- }, [a.data]), S = P(() => {
1365
+ }, [r.data]), S = F(() => {
1366
1366
  var h;
1367
1367
  (h = y.current) == null || h.showModal();
1368
- }, []), N = P(() => {
1368
+ }, []), N = F(() => {
1369
1369
  var h;
1370
1370
  (h = y.current) == null || h.close();
1371
1371
  }, []);
1372
- return /* @__PURE__ */ i(ce, { children: [
1372
+ return /* @__PURE__ */ i(he, { children: [
1373
1373
  /* @__PURE__ */ e(
1374
- Bt,
1374
+ Zt,
1375
1375
  {
1376
1376
  overrides: {
1377
- Message: (h) => /* @__PURE__ */ e(us, { ...h, chatbotVotingEnabled: C })
1377
+ Message: (h) => /* @__PURE__ */ e(ys, { ...h, chatbotVotingEnabled: C })
1378
1378
  },
1379
- children: /* @__PURE__ */ i($t, { children: [
1379
+ children: /* @__PURE__ */ i(Xt, { children: [
1380
1380
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
1381
- ys,
1381
+ Ls,
1382
1382
  {
1383
1383
  onBack: t,
1384
1384
  showBackButton: s,
1385
1385
  onShowInfo: S,
1386
- canShowInfo: !!I,
1387
- showStarButton: g
1386
+ canShowInfo: !!E,
1387
+ showStarButton: f
1388
1388
  }
1389
1389
  ) }),
1390
- b == null ? void 0 : b(),
1390
+ x == null ? void 0 : x(),
1391
1391
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
1392
- jt,
1392
+ Qt,
1393
1393
  {
1394
1394
  hideDeletedMessages: !0,
1395
1395
  hideNewMessageSeparator: !1,
@@ -1397,73 +1397,73 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1397
1397
  }
1398
1398
  ) }),
1399
1399
  /* @__PURE__ */ e(
1400
- xs,
1400
+ Is,
1401
1401
  {
1402
- renderActions: () => n == null ? void 0 : n(a)
1402
+ renderActions: () => n == null ? void 0 : n(r)
1403
1403
  }
1404
1404
  )
1405
1405
  ] })
1406
1406
  }
1407
1407
  ),
1408
1408
  /* @__PURE__ */ e(
1409
- Es,
1409
+ Fs,
1410
1410
  {
1411
1411
  dialogRef: y,
1412
1412
  onClose: N,
1413
- participant: I,
1414
- channel: a,
1415
- followerStatusLabel: v,
1416
- onLeaveConversation: r,
1413
+ participant: E,
1414
+ channel: r,
1415
+ followerStatusLabel: w,
1416
+ onLeaveConversation: a,
1417
1417
  onBlockParticipant: l,
1418
- showDeleteConversation: u,
1418
+ showDeleteConversation: c,
1419
1419
  onDeleteConversationClick: o,
1420
- onBlockParticipantClick: m,
1421
- onReportParticipantClick: x,
1422
- customChannelActions: w
1420
+ onBlockParticipantClick: u,
1421
+ onReportParticipantClick: g,
1422
+ customChannelActions: v
1423
1423
  }
1424
1424
  )
1425
1425
  ] });
1426
- }, We = A.memo(
1426
+ }, Ke = O.memo(
1427
1427
  ({
1428
1428
  channel: t,
1429
1429
  onBack: s,
1430
1430
  showBackButton: n = !1,
1431
- renderMessageInputActions: r,
1431
+ renderMessageInputActions: a,
1432
1432
  onLeaveConversation: l,
1433
- onBlockParticipant: u,
1433
+ onBlockParticipant: c,
1434
1434
  className: o,
1435
- CustomChannelEmptyState: m = ws,
1436
- showDeleteConversation: x = !0,
1437
- onDeleteConversationClick: g,
1435
+ CustomChannelEmptyState: u = Ts,
1436
+ showDeleteConversation: g = !0,
1437
+ onDeleteConversationClick: f,
1438
1438
  onBlockParticipantClick: C,
1439
- onReportParticipantClick: b,
1440
- dmAgentEnabled: w,
1441
- messageMetadata: a,
1439
+ onReportParticipantClick: x,
1440
+ dmAgentEnabled: v,
1441
+ messageMetadata: r,
1442
1442
  onMessageSent: y,
1443
- showStarButton: I = !1,
1444
- chatbotVotingEnabled: v = !1,
1443
+ showStarButton: E = !1,
1444
+ chatbotVotingEnabled: w = !1,
1445
1445
  renderChannelBanner: S,
1446
1446
  customChannelActions: N
1447
1447
  }) => {
1448
- const h = P(
1449
- async (p, T, f) => {
1448
+ const h = F(
1449
+ async (p, T, b) => {
1450
1450
  var D;
1451
- const c = ((D = t.data) == null ? void 0 : D.chatbot_paused) === !0, d = w && !c, M = {
1451
+ const d = ((D = t.data) == null ? void 0 : D.chatbot_paused) === !0, m = v && !d, M = {
1452
1452
  ...T,
1453
- ...d && { silent: !0 },
1454
- ...a && {
1453
+ ...m && { silent: !0 },
1454
+ ...r && {
1455
1455
  metadata: {
1456
1456
  ...T.metadata ?? {},
1457
- ...a
1457
+ ...r
1458
1458
  }
1459
1459
  }
1460
1460
  }, k = {
1461
- ...f,
1462
- ...d && { skip_push: !0 }
1461
+ ...b,
1462
+ ...m && { skip_push: !0 }
1463
1463
  }, B = await t.sendMessage(M, k);
1464
1464
  return y == null || y(B), B;
1465
1465
  },
1466
- [t, w, a, y]
1466
+ [t, v, r, y]
1467
1467
  );
1468
1468
  return /* @__PURE__ */ e(
1469
1469
  "div",
@@ -1473,29 +1473,29 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1473
1473
  o
1474
1474
  ),
1475
1475
  children: /* @__PURE__ */ e(
1476
- At,
1476
+ Yt,
1477
1477
  {
1478
1478
  channel: t,
1479
- MessageSystem: vs,
1480
- EmptyStateIndicator: m,
1481
- LoadingIndicator: Ce,
1482
- DateSeparator: ns,
1479
+ MessageSystem: Ds,
1480
+ EmptyStateIndicator: u,
1481
+ LoadingIndicator: we,
1482
+ DateSeparator: hs,
1483
1483
  doSendMessageRequest: h,
1484
1484
  children: /* @__PURE__ */ e(
1485
- _s,
1485
+ As,
1486
1486
  {
1487
1487
  onBack: s,
1488
1488
  showBackButton: n,
1489
- renderMessageInputActions: r,
1489
+ renderMessageInputActions: a,
1490
1490
  onLeaveConversation: l,
1491
- onBlockParticipant: u,
1492
- CustomChannelEmptyState: m,
1493
- showDeleteConversation: x,
1494
- onDeleteConversationClick: g,
1491
+ onBlockParticipant: c,
1492
+ CustomChannelEmptyState: u,
1493
+ showDeleteConversation: g,
1494
+ onDeleteConversationClick: f,
1495
1495
  onBlockParticipantClick: C,
1496
- onReportParticipantClick: b,
1497
- showStarButton: I,
1498
- chatbotVotingEnabled: v,
1496
+ onReportParticipantClick: x,
1497
+ showStarButton: E,
1498
+ chatbotVotingEnabled: w,
1499
1499
  renderChannelBanner: S,
1500
1500
  customChannelActions: N
1501
1501
  }
@@ -1506,16 +1506,16 @@ const le = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-cent
1506
1506
  );
1507
1507
  }
1508
1508
  );
1509
- We.displayName = "ChannelView";
1510
- function Is({
1509
+ Ke.displayName = "ChannelView";
1510
+ function Us({
1511
1511
  searchQuery: t,
1512
1512
  setSearchQuery: s,
1513
1513
  placeholder: n
1514
1514
  }) {
1515
- const r = q(null);
1515
+ const a = z(null);
1516
1516
  return /* @__PURE__ */ i("div", { className: "relative", children: [
1517
1517
  /* @__PURE__ */ e(
1518
- qt,
1518
+ ns,
1519
1519
  {
1520
1520
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
1521
1521
  weight: "bold"
@@ -1524,7 +1524,7 @@ function Is({
1524
1524
  /* @__PURE__ */ e(
1525
1525
  "input",
1526
1526
  {
1527
- ref: r,
1527
+ ref: a,
1528
1528
  type: "text",
1529
1529
  placeholder: n,
1530
1530
  value: t,
@@ -1533,84 +1533,84 @@ function Is({
1533
1533
  }
1534
1534
  ),
1535
1535
  t && /* @__PURE__ */ e(
1536
- ze,
1536
+ Qe,
1537
1537
  {
1538
1538
  label: "Clear search",
1539
1539
  onClick: () => {
1540
1540
  var l;
1541
- s(""), (l = r.current) == null || l.focus();
1541
+ s(""), (l = a.current) == null || l.focus();
1542
1542
  },
1543
1543
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1544
- children: /* @__PURE__ */ e(Se, { className: "h-4 w-4", weight: "bold" })
1544
+ children: /* @__PURE__ */ e(Le, { className: "h-4 w-4", weight: "bold" })
1545
1545
  }
1546
1546
  )
1547
1547
  ] });
1548
1548
  }
1549
- const Ss = ({
1549
+ const Ps = ({
1550
1550
  participantSource: t,
1551
1551
  onSelectParticipant: s,
1552
1552
  onClose: n,
1553
- existingParticipantIds: r = /* @__PURE__ */ new Set(),
1553
+ existingParticipantIds: a = /* @__PURE__ */ new Set(),
1554
1554
  participantLabel: l = "participants",
1555
- searchPlaceholder: u = "Search participants...",
1555
+ searchPlaceholder: c = "Search participants...",
1556
1556
  className: o
1557
1557
  }) => {
1558
- const { debug: m } = Ne(), [x, g] = _(""), [C, b] = _([]), [w, a] = _(!1), [y, I] = _(null), [v, S] = _(
1558
+ const { debug: u } = Ee(), [g, f] = I(""), [C, x] = I([]), [v, r] = I(!1), [y, E] = I(null), [w, S] = I(
1559
1559
  null
1560
- ), N = q(!1);
1561
- Y(() => {
1560
+ ), N = z(!1);
1561
+ X(() => {
1562
1562
  if (t.loading) {
1563
- m && console.log(
1563
+ u && console.log(
1564
1564
  "[ParticipantPicker] Waiting for participant source to finish loading..."
1565
1565
  );
1566
1566
  return;
1567
1567
  }
1568
1568
  if (N.current) return;
1569
1569
  (async () => {
1570
- m && console.log("[ParticipantPicker] Loading initial participants..."), a(!0), I(null);
1570
+ u && console.log("[ParticipantPicker] Loading initial participants..."), r(!0), E(null);
1571
1571
  try {
1572
- const c = await t.loadParticipants({
1572
+ const d = await t.loadParticipants({
1573
1573
  search: "",
1574
1574
  // Load all participants initially
1575
1575
  limit: 100
1576
1576
  });
1577
- b(c.participants), N.current = !0, m && console.log(
1577
+ x(d.participants), N.current = !0, u && console.log(
1578
1578
  "[ParticipantPicker] Participants loaded successfully:",
1579
- c.participants.length
1579
+ d.participants.length
1580
1580
  );
1581
- } catch (c) {
1582
- const d = c instanceof Error ? c.message : "Failed to load participants";
1583
- I(d), console.error("[ParticipantPicker] Failed to load participants:", c);
1581
+ } catch (d) {
1582
+ const m = d instanceof Error ? d.message : "Failed to load participants";
1583
+ E(m), console.error("[ParticipantPicker] Failed to load participants:", d);
1584
1584
  } finally {
1585
- a(!1);
1585
+ r(!1);
1586
1586
  }
1587
1587
  })();
1588
- }, [t.loading, m]);
1589
- const h = C.filter((f) => !r.has(f.id)).filter((f) => {
1590
- var d;
1591
- if (!x) return !0;
1592
- const c = x.toLowerCase();
1593
- return f.name.toLowerCase().includes(c) || ((d = f.email) == null ? void 0 : d.toLowerCase().includes(c)) || !1;
1594
- }), p = P(
1595
- async (f) => {
1596
- if (!v) {
1597
- S(f.id);
1588
+ }, [t.loading, u]);
1589
+ const h = C.filter((b) => !a.has(b.id)).filter((b) => {
1590
+ var m;
1591
+ if (!g) return !0;
1592
+ const d = g.toLowerCase();
1593
+ return b.name.toLowerCase().includes(d) || ((m = b.email) == null ? void 0 : m.toLowerCase().includes(d)) || !1;
1594
+ }), p = F(
1595
+ async (b) => {
1596
+ if (!w) {
1597
+ S(b.id);
1598
1598
  try {
1599
- await s(f);
1600
- } catch (c) {
1601
- console.error("[ParticipantPicker] Failed to start chat:", c), S(null);
1599
+ await s(b);
1600
+ } catch (d) {
1601
+ console.error("[ParticipantPicker] Failed to start chat:", d), S(null);
1602
1602
  }
1603
1603
  }
1604
1604
  },
1605
- [s, v]
1606
- ), T = (f, c) => {
1607
- (f.key === "Enter" || f.key === " ") && (f.preventDefault(), p(c));
1605
+ [s, w]
1606
+ ), T = (b, d) => {
1607
+ (b.key === "Enter" || b.key === " ") && (b.preventDefault(), p(d));
1608
1608
  };
1609
1609
  return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", o), children: [
1610
1610
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1611
1611
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1612
1612
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1613
- /* @__PURE__ */ e(Ve, { onClick: n })
1613
+ /* @__PURE__ */ e(Je, { onClick: n })
1614
1614
  ] }),
1615
1615
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1616
1616
  "Select a ",
@@ -1621,11 +1621,11 @@ const Ss = ({
1621
1621
  t.totalCount !== void 0 && ` • ${t.totalCount} ${l} total`
1622
1622
  ] }),
1623
1623
  /* @__PURE__ */ e(
1624
- Is,
1624
+ Us,
1625
1625
  {
1626
- searchQuery: x,
1627
- setSearchQuery: g,
1628
- placeholder: u
1626
+ searchQuery: g,
1627
+ setSearchQuery: f,
1628
+ placeholder: c
1629
1629
  }
1630
1630
  )
1631
1631
  ] }),
@@ -1635,7 +1635,7 @@ const Ss = ({
1635
1635
  ": ",
1636
1636
  y
1637
1637
  ] }),
1638
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: w && h.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1638
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: v && h.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1639
1639
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1640
1640
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1641
1641
  "Loading ",
@@ -1643,47 +1643,47 @@ const Ss = ({
1643
1643
  "..."
1644
1644
  ] })
1645
1645
  ] }) }) : h.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1646
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ue, { className: "h-8 w-8 text-charcoal" }) }),
1647
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: x ? `No ${l} found` : C.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
1648
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: x ? "Try a different search term" : C.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
1646
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(je, { className: "h-8 w-8 text-charcoal" }) }),
1647
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: g ? `No ${l} found` : C.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
1648
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: g ? "Try a different search term" : C.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
1649
1649
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1650
- h.map((f) => {
1651
- const c = f.name || f.email || f.id, d = f.email && f.name ? f.email : f.phone;
1650
+ h.map((b) => {
1651
+ const d = b.name || b.email || b.id, m = b.email && b.name ? b.email : b.phone;
1652
1652
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1653
1653
  "button",
1654
1654
  {
1655
1655
  type: "button",
1656
- onClick: () => p(f),
1657
- onKeyDown: (M) => T(M, f),
1656
+ onClick: () => p(b),
1657
+ onKeyDown: (M) => T(M, b),
1658
1658
  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",
1659
1659
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1660
1660
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1661
1661
  /* @__PURE__ */ e(
1662
- ee,
1662
+ ne,
1663
1663
  {
1664
- id: f.id,
1665
- name: c,
1666
- image: f.image,
1664
+ id: b.id,
1665
+ name: d,
1666
+ image: b.image,
1667
1667
  size: 40
1668
1668
  }
1669
1669
  ),
1670
1670
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1671
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: c }),
1672
- d && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: d })
1671
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
1672
+ m && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: m })
1673
1673
  ] })
1674
1674
  ] }),
1675
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: v === f.id ? /* @__PURE__ */ e(xe, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ue, { className: "h-5 w-5 text-stone" }) })
1675
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === b.id ? /* @__PURE__ */ e(ve, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(je, { className: "h-5 w-5 text-stone" }) })
1676
1676
  ] })
1677
1677
  }
1678
- ) }, f.id);
1678
+ ) }, b.id);
1679
1679
  }),
1680
- w && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1680
+ v && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1681
1681
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1682
1682
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1683
1683
  ] }) })
1684
1684
  ] }) })
1685
1685
  ] });
1686
- }, Ms = ({ className: t }) => /* @__PURE__ */ i(
1686
+ }, Os = ({ className: t }) => /* @__PURE__ */ i(
1687
1687
  "svg",
1688
1688
  {
1689
1689
  width: "140",
@@ -1817,17 +1817,17 @@ const Ss = ({
1817
1817
  ] })
1818
1818
  ]
1819
1819
  }
1820
- ), qe = A.memo(
1820
+ ), et = O.memo(
1821
1821
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1822
- /* @__PURE__ */ e(Ms, {}),
1822
+ /* @__PURE__ */ e(Os, {}),
1823
1823
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1824
1824
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1825
1825
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1826
1826
  ] })
1827
1827
  ] }) })
1828
1828
  );
1829
- qe.displayName = "EmptyState";
1830
- const be = A.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1829
+ et.displayName = "EmptyState";
1830
+ const ye = O.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1831
1831
  /* @__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: "⚠️" }) }),
1832
1832
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1833
1833
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1841,25 +1841,111 @@ const be = A.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1841
1841
  }
1842
1842
  )
1843
1843
  ] }) }));
1844
- be.displayName = "ErrorState";
1845
- const As = ({
1844
+ ye.displayName = "ErrorState";
1845
+ const Bs = 2, $s = 300, Me = 1e4, js = async (t) => await new Promise((s) => setTimeout(s, t)), Ve = (t, s) => {
1846
+ if (!t) return;
1847
+ const n = Object.entries(t).find(
1848
+ ([a]) => a.toLowerCase() === s.toLowerCase()
1849
+ );
1850
+ return n ? n[1] : void 0;
1851
+ }, pe = (t) => {
1852
+ const s = Number(t);
1853
+ return Number.isFinite(s) ? s : null;
1854
+ }, tt = (t) => {
1855
+ if (!t || typeof t != "object") return null;
1856
+ const s = t.response;
1857
+ return !s || typeof s != "object" ? null : s;
1858
+ }, Gs = (t) => {
1859
+ const s = tt(t);
1860
+ if ((s == null ? void 0 : s.status) === 429) return !0;
1861
+ if (t && typeof t == "object") {
1862
+ if (pe(t.code) === 9 || pe(t.status) === 429) return !0;
1863
+ const l = t.message;
1864
+ if (typeof l == "string") {
1865
+ const c = l.toLowerCase();
1866
+ if (c.includes("too many requests") || c.includes("rate limit"))
1867
+ return !0;
1868
+ }
1869
+ }
1870
+ return !1;
1871
+ }, Hs = (t, s, n = Date.now()) => {
1872
+ var f;
1873
+ const a = (f = tt(t)) == null ? void 0 : f.headers, l = Ve(a, "retry-after"), c = pe(
1874
+ Array.isArray(l) ? l[0] : l
1875
+ );
1876
+ if (c !== null && c >= 0)
1877
+ return Math.min(Math.round(c * 1e3), Me);
1878
+ const o = Ve(a, "x-ratelimit-reset"), u = pe(
1879
+ Array.isArray(o) ? o[0] : o
1880
+ );
1881
+ if (u !== null && u > 0) {
1882
+ const C = Math.round(u * 1e3 - n);
1883
+ return Math.min(Math.max(C, 0), Me);
1884
+ }
1885
+ const g = $s * 2 ** s;
1886
+ return Math.min(g, Me);
1887
+ }, zs = ({
1888
+ client: t,
1889
+ maxRetries: s = Bs,
1890
+ wait: n = js,
1891
+ now: a = Date.now,
1892
+ onRetry: l
1893
+ }) => {
1894
+ const c = /* @__PURE__ */ new Map();
1895
+ return { query: async ({
1896
+ requestKey: u,
1897
+ filters: g,
1898
+ sort: f = {},
1899
+ options: C = {}
1900
+ }) => {
1901
+ const x = c.get(u);
1902
+ if (x)
1903
+ return await x;
1904
+ const v = (async () => {
1905
+ for (let r = 0; ; r += 1)
1906
+ try {
1907
+ return await t.queryChannels(g, f, C);
1908
+ } catch (y) {
1909
+ if (!Gs(y) || r >= s)
1910
+ throw y;
1911
+ const E = Hs(
1912
+ y,
1913
+ r,
1914
+ a()
1915
+ );
1916
+ l == null || l({
1917
+ requestKey: u,
1918
+ attempt: r + 1,
1919
+ delayMs: E,
1920
+ error: y
1921
+ }), await n(E);
1922
+ }
1923
+ })();
1924
+ c.set(u, v);
1925
+ try {
1926
+ return await v;
1927
+ } finally {
1928
+ c.delete(u);
1929
+ }
1930
+ } };
1931
+ }, en = ({
1846
1932
  capabilities: t = {},
1847
1933
  className: s,
1848
1934
  renderMessageInputActions: n,
1849
- onChannelSelect: r,
1935
+ onChannelSelect: a,
1850
1936
  onParticipantSelect: l,
1851
- initialParticipantFilter: u,
1937
+ initialParticipantFilter: c,
1852
1938
  initialParticipantData: o,
1853
- CustomChannelEmptyState: m,
1854
- showChannelList: x = !0,
1855
- filters: g,
1939
+ CustomChannelEmptyState: u,
1940
+ showChannelList: g = !0,
1941
+ filters: f,
1856
1942
  channelListCustomEmptyStateIndicator: C,
1857
- onDeleteConversationClick: b,
1858
- onBlockParticipantClick: w,
1859
- onReportParticipantClick: a,
1943
+ onDeleteConversationClick: x,
1944
+ onBlockParticipantClick: v,
1945
+ onReportParticipantClick: r,
1860
1946
  dmAgentEnabled: y,
1861
- messageMetadata: I,
1862
- onMessageSent: v,
1947
+ messageMetadata: E,
1948
+ onMessageSent: w,
1863
1949
  showStarButton: S = !1,
1864
1950
  chatbotVotingEnabled: N = !1,
1865
1951
  renderMessagePreview: h,
@@ -1867,190 +1953,209 @@ const As = ({
1867
1953
  customChannelActions: T
1868
1954
  }) => {
1869
1955
  const {
1870
- service: f,
1871
- client: c,
1872
- isConnected: d,
1956
+ service: b,
1957
+ client: d,
1958
+ isConnected: m,
1873
1959
  isLoading: M,
1874
1960
  error: k,
1875
1961
  refreshConnection: B,
1876
1962
  debug: D
1877
- } = Yt(), [W, z] = _(null), [te, J] = _(!1), [se, ne] = _(!1), [ie, $] = _(!1), [Q, U] = _(/* @__PURE__ */ new Set()), [F, V] = _(0), [L, G] = _(!1), [de, Z] = _(null), ae = q(null), {
1878
- participantSource: X,
1879
- participantLabel: re = "participants",
1880
- showDeleteConversation: ue = !0
1881
- } = t, me = A.useMemo(() => {
1882
- const E = c == null ? void 0 : c.userID;
1963
+ } = rs(), [Y, V] = I(null), [re, J] = I(!1), [ae, oe] = I(!1), [me, $] = I(!1), [K, A] = I(/* @__PURE__ */ new Set()), [U, q] = I(0), [L, G] = I(!1), [fe, Q] = I(null), le = z(null), {
1964
+ participantSource: ee,
1965
+ participantLabel: ie = "participants",
1966
+ showDeleteConversation: ge = !0
1967
+ } = t, be = O.useMemo(() => {
1968
+ const _ = d == null ? void 0 : d.userID;
1883
1969
  return {
1884
1970
  ...{
1885
1971
  type: "messaging",
1886
1972
  last_message_at: { $exists: !0 },
1887
- ...E && {
1888
- members: { $in: [E] },
1973
+ ..._ && {
1974
+ members: { $in: [_] },
1889
1975
  hidden: !1
1890
1976
  }
1891
1977
  },
1892
- ...g
1978
+ ...f
1893
1979
  };
1894
- }, [g, c == null ? void 0 : c.userID]), K = q(null), oe = P(async () => {
1895
- if (!c || !d) return;
1896
- const E = c.userID;
1897
- if (E)
1898
- try {
1899
- D && console.log("[MessagingShell] Syncing channels for user:", E);
1900
- const H = await c.queryChannels(
1901
- {
1902
- type: "messaging",
1903
- members: { $in: [E] }
1904
- },
1905
- {},
1906
- { limit: 100 }
1907
- ), O = /* @__PURE__ */ new Set();
1908
- H.forEach((j) => {
1909
- const ve = j.state.members;
1910
- Object.values(ve).forEach((et) => {
1911
- var ke;
1912
- const we = (ke = et.user) == null ? void 0 : ke.id;
1913
- we && we !== E && O.add(we);
1980
+ }, [f, d == null ? void 0 : d.userID]), te = z(null), st = z(0), se = z(a), nt = z(D);
1981
+ X(() => {
1982
+ se.current = a;
1983
+ }, [a]);
1984
+ const ce = O.useMemo(() => d ? zs({
1985
+ client: d,
1986
+ onRetry: ({ requestKey: _, attempt: P, delayMs: j, error: Z }) => {
1987
+ nt.current && console.warn("[MessagingShell] queryChannels rate limited; retrying", {
1988
+ requestKey: _,
1989
+ attempt: P,
1990
+ delayMs: j,
1991
+ error: Z
1992
+ });
1993
+ }
1994
+ }) : null, [d]), de = F(
1995
+ async ({ forceFresh: _ = !1 } = {}) => {
1996
+ if (!d || !m || !ce) return;
1997
+ const P = d.userID;
1998
+ if (P)
1999
+ try {
2000
+ D && console.log("[MessagingShell] Syncing channels for user:", P);
2001
+ const j = _ ? `sync:${P}:refresh:${st.current++}` : `sync:${P}`, Z = await ce.query({
2002
+ requestKey: j,
2003
+ filters: {
2004
+ type: "messaging",
2005
+ members: { $in: [P] }
2006
+ },
2007
+ options: { limit: 100 }
2008
+ }), H = /* @__PURE__ */ new Set();
2009
+ Z.forEach((W) => {
2010
+ const _e = W.state.members;
2011
+ Object.values(_e).forEach((dt) => {
2012
+ var Ae;
2013
+ const Ie = (Ae = dt.user) == null ? void 0 : Ae.id;
2014
+ Ie && Ie !== P && H.add(Ie);
2015
+ });
2016
+ }), A((W) => W.size === H.size && [...W].every((_e) => H.has(_e)) ? W : H), J(Z.length > 0), oe(!0), te.current = P, D && console.log("[MessagingShell] Channels synced successfully:", {
2017
+ channelCount: Z.length,
2018
+ memberCount: H.size
1914
2019
  });
1915
- }), U((j) => j.size === O.size && [...j].every((ve) => O.has(ve)) ? j : O), J(H.length > 0), ne(!0), K.current = E, D && console.log("[MessagingShell] Channels synced successfully:", {
1916
- channelCount: H.length,
1917
- memberCount: O.size
1918
- });
1919
- } catch (H) {
1920
- console.error("[MessagingShell] Failed to sync channels:", H);
1921
- }
1922
- }, [c, d, D]);
1923
- Y(() => {
1924
- if (!c || !d) return;
1925
- const E = c.userID;
1926
- E && K.current !== E && oe();
1927
- }, [c, d, oe]), Y(() => {
1928
- if (!u || !c || !d) return;
2020
+ } catch (j) {
2021
+ console.error("[MessagingShell] Failed to sync channels:", j);
2022
+ }
2023
+ },
2024
+ [d, m, D, ce]
2025
+ );
2026
+ X(() => {
2027
+ if (!d || !m) return;
2028
+ const _ = d.userID;
2029
+ _ && te.current !== _ && de();
2030
+ }, [d, m, de]), X(() => {
2031
+ if (!c || !d || !m || !ce)
2032
+ return;
1929
2033
  (async () => {
1930
- const H = c.userID;
1931
- if (H)
2034
+ var j, Z;
2035
+ const P = d.userID;
2036
+ if (P)
1932
2037
  try {
1933
2038
  D && console.log(
1934
2039
  "[MessagingShell] Loading initial conversation with:",
1935
- u
2040
+ c
1936
2041
  );
1937
- const O = await c.queryChannels(
1938
- {
2042
+ const H = await ce.query({
2043
+ requestKey: `direct:${P}:${c}`,
2044
+ filters: {
1939
2045
  type: "messaging",
1940
- members: { $eq: [H, u] }
2046
+ members: { $eq: [P, c] }
1941
2047
  },
1942
- {},
1943
- { limit: 1 }
1944
- );
1945
- if (O.length > 0)
1946
- z(O[0]), G(!0), Z(null), r && r(O[0]), D && console.log(
2048
+ options: { limit: 1 }
2049
+ });
2050
+ if (H.length > 0)
2051
+ V(H[0]), G(!0), Q(null), (j = se.current) == null || j.call(se, H[0]), D && console.log(
1947
2052
  "[MessagingShell] Initial conversation loaded:",
1948
- O[0].id
2053
+ H[0].id
1949
2054
  );
1950
- else if (o && f) {
2055
+ else if (o && b) {
1951
2056
  D && console.log(
1952
2057
  "[MessagingShell] No conversation found, creating one for:",
1953
2058
  o
1954
2059
  );
1955
2060
  try {
1956
- const j = await f.startChannelWithParticipant({
2061
+ const W = await b.startChannelWithParticipant({
1957
2062
  id: o.id,
1958
2063
  name: o.name,
1959
2064
  email: o.email,
1960
2065
  phone: o.phone
1961
2066
  });
1962
- z(j), G(!0), Z(null), r && r(j), D && console.log(
2067
+ V(W), G(!0), Q(null), (Z = se.current) == null || Z.call(se, W), D && console.log(
1963
2068
  "[MessagingShell] Channel created and loaded:",
1964
- j.id
2069
+ W.id
1965
2070
  );
1966
- } catch (j) {
2071
+ } catch (W) {
1967
2072
  console.error(
1968
2073
  "[MessagingShell] Failed to create conversation:",
1969
- j
1970
- ), Z("Failed to create conversation");
2074
+ W
2075
+ ), Q("Failed to create conversation");
1971
2076
  }
1972
2077
  } else
1973
- Z(
2078
+ Q(
1974
2079
  "No conversation found with this account"
1975
2080
  ), D && console.log(
1976
2081
  "[MessagingShell] No conversation found for:",
1977
- u
2082
+ c
1978
2083
  );
1979
- } catch (O) {
2084
+ } catch (H) {
1980
2085
  console.error(
1981
2086
  "[MessagingShell] Failed to load initial conversation:",
1982
- O
1983
- ), Z("Failed to load conversation");
2087
+ H
2088
+ ), Q("Failed to load conversation");
1984
2089
  }
1985
2090
  })();
1986
2091
  }, [
1987
- u,
1988
- o,
1989
2092
  c,
2093
+ o,
1990
2094
  d,
1991
- f,
2095
+ m,
2096
+ b,
1992
2097
  D,
1993
- r
2098
+ ce
1994
2099
  ]);
1995
- const Ye = P(
1996
- (E) => {
1997
- z(E), r == null || r(E);
2100
+ const rt = F(
2101
+ (_) => {
2102
+ V(_), a == null || a(_);
1998
2103
  },
1999
- [r]
2000
- ), Ze = P(() => {
2001
- L || z(null);
2002
- }, [L]), Je = P(
2003
- async (E) => {
2004
- var H;
2005
- if (f)
2104
+ [a]
2105
+ ), at = F(() => {
2106
+ L || V(null);
2107
+ }, [L]), ot = F(
2108
+ async (_) => {
2109
+ var P;
2110
+ if (b)
2006
2111
  try {
2007
2112
  D && console.log(
2008
2113
  "[MessagingShell] Starting conversation with:",
2009
- E.id
2114
+ _.id
2010
2115
  );
2011
- const O = await f.startChannelWithParticipant({
2012
- id: E.id,
2013
- name: E.name,
2014
- email: E.email,
2015
- phone: E.phone
2116
+ const j = await b.startChannelWithParticipant({
2117
+ id: _.id,
2118
+ name: _.name,
2119
+ email: _.email,
2120
+ phone: _.phone
2016
2121
  });
2017
2122
  try {
2018
- await O.show();
2019
- } catch (j) {
2020
- console.warn("[MessagingShell] Failed to unhide channel:", j);
2123
+ await j.show();
2124
+ } catch (Z) {
2125
+ console.warn("[MessagingShell] Failed to unhide channel:", Z);
2021
2126
  }
2022
- z(O), $(!1), (H = ae.current) == null || H.close(), l == null || l(E);
2023
- } catch (O) {
2024
- console.error("[MessagingShell] Failed to start conversation:", O);
2127
+ V(j), $(!1), (P = le.current) == null || P.close(), l == null || l(_);
2128
+ } catch (j) {
2129
+ console.error("[MessagingShell] Failed to start conversation:", j);
2025
2130
  }
2026
2131
  },
2027
- [f, l, D]
2028
- ), he = P(() => {
2029
- var E;
2030
- $(!1), (E = ae.current) == null || E.close();
2031
- }, []), Qe = P(
2032
- (E) => {
2033
- E.target === ae.current && he();
2132
+ [b, l, D]
2133
+ ), xe = F(() => {
2134
+ var _;
2135
+ $(!1), (_ = le.current) == null || _.close();
2136
+ }, []), lt = F(
2137
+ (_) => {
2138
+ _.target === le.current && xe();
2034
2139
  },
2035
- [he]
2036
- ), Xe = P(
2037
- async (E) => {
2038
- D && console.log("[MessagingShell] Leaving conversation:", E.id), z(null), G(!1), K.current = null, await oe();
2140
+ [xe]
2141
+ ), it = F(
2142
+ async (_) => {
2143
+ D && console.log("[MessagingShell] Leaving conversation:", _.id), V(null), G(!1), te.current = null, await de({ forceFresh: !0 });
2039
2144
  },
2040
- [oe, D]
2041
- ), Ke = P(
2042
- async (E) => {
2043
- D && console.log("[MessagingShell] Blocking participant:", E), z(null), G(!1), K.current = null, await oe();
2145
+ [de, D]
2146
+ ), ct = F(
2147
+ async (_) => {
2148
+ D && console.log("[MessagingShell] Blocking participant:", _), V(null), G(!1), te.current = null, await de({ forceFresh: !0 });
2044
2149
  },
2045
- [oe, D]
2046
- ), fe = !!W;
2047
- return M ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(Ce, {}) }) : k ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(be, { message: k, onBack: B }) }) : !d || !c ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
2048
- be,
2150
+ [de, D]
2151
+ ), Ce = !!Y;
2152
+ return M ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(we, {}) }) : k ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ye, { message: k, onBack: B }) }) : !m || !d ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
2153
+ ye,
2049
2154
  {
2050
2155
  message: "Not connected to messaging service",
2051
2156
  onBack: B
2052
2157
  }
2053
- ) }) : de ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(be, { message: de }) }) : /* @__PURE__ */ i(
2158
+ ) }) : fe ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ye, { message: fe }) }) : /* @__PURE__ */ i(
2054
2159
  "div",
2055
2160
  {
2056
2161
  className: R(
@@ -2065,19 +2170,19 @@ const As = ({
2065
2170
  className: R(
2066
2171
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
2067
2172
  {
2068
- "!hidden": x === !1 || L,
2173
+ "!hidden": g === !1 || L,
2069
2174
  // Hide on mobile when channel selected, show on desktop with consistent wide width
2070
- "hidden lg:flex lg:flex-1 lg:max-w-2xl": x !== !1 && !L && fe,
2175
+ "hidden lg:flex lg:flex-1 lg:max-w-2xl": g !== !1 && !L && Ce,
2071
2176
  // Show on mobile when no channel selected, use same wide width on desktop
2072
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": x !== !1 && !L && !fe
2177
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": g !== !1 && !L && !Ce
2073
2178
  }
2074
2179
  ),
2075
2180
  children: /* @__PURE__ */ e(
2076
- He,
2181
+ Xe,
2077
2182
  {
2078
- onChannelSelect: Ye,
2079
- selectedChannel: W || void 0,
2080
- filters: me,
2183
+ onChannelSelect: rt,
2184
+ selectedChannel: Y || void 0,
2185
+ filters: be,
2081
2186
  customEmptyStateIndicator: C,
2082
2187
  renderMessagePreview: h
2083
2188
  }
@@ -2091,77 +2196,77 @@ const As = ({
2091
2196
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
2092
2197
  {
2093
2198
  // In direct conversation mode (or waiting for it), always show (full width)
2094
- flex: L || fe || u,
2199
+ flex: L || Ce || c,
2095
2200
  // Normal mode: hide on mobile when no channel selected
2096
- "hidden lg:flex": !L && !fe && !u
2201
+ "hidden lg:flex": !L && !Ce && !c
2097
2202
  }
2098
2203
  ),
2099
- children: W ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
2100
- We,
2204
+ children: Y ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
2205
+ Ke,
2101
2206
  {
2102
- channel: W,
2103
- onBack: Ze,
2207
+ channel: Y,
2208
+ onBack: at,
2104
2209
  showBackButton: !L,
2105
2210
  renderMessageInputActions: n,
2106
2211
  renderChannelBanner: p,
2107
- onLeaveConversation: Xe,
2108
- onBlockParticipant: Ke,
2109
- CustomChannelEmptyState: m,
2110
- showDeleteConversation: ue,
2111
- onDeleteConversationClick: b,
2112
- onBlockParticipantClick: w,
2113
- onReportParticipantClick: a,
2212
+ onLeaveConversation: it,
2213
+ onBlockParticipant: ct,
2214
+ CustomChannelEmptyState: u,
2215
+ showDeleteConversation: ge,
2216
+ onDeleteConversationClick: x,
2217
+ onBlockParticipantClick: v,
2218
+ onReportParticipantClick: r,
2114
2219
  dmAgentEnabled: y,
2115
- messageMetadata: I,
2116
- onMessageSent: v,
2220
+ messageMetadata: E,
2221
+ onMessageSent: w,
2117
2222
  showStarButton: S,
2118
2223
  chatbotVotingEnabled: N,
2119
2224
  customChannelActions: T
2120
2225
  },
2121
- W.id
2122
- ) }) : u ? (
2226
+ Y.id
2227
+ ) }) : c ? (
2123
2228
  // Show loading while creating/loading direct conversation channel
2124
- /* @__PURE__ */ e(Ce, {})
2229
+ /* @__PURE__ */ e(we, {})
2125
2230
  ) : /* @__PURE__ */ e(
2126
- qe,
2231
+ et,
2127
2232
  {
2128
- hasChannels: te,
2129
- channelsLoaded: se
2233
+ hasChannels: re,
2234
+ channelsLoaded: ae
2130
2235
  }
2131
2236
  )
2132
2237
  }
2133
2238
  )
2134
2239
  ] }),
2135
- X && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
2240
+ ee && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
2136
2241
  /* @__PURE__ */ e(
2137
2242
  "dialog",
2138
2243
  {
2139
- ref: ae,
2244
+ ref: le,
2140
2245
  className: "mes-dialog",
2141
- onClick: Qe,
2142
- onClose: he,
2246
+ onClick: lt,
2247
+ onClose: xe,
2143
2248
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
2144
- Ss,
2249
+ Ps,
2145
2250
  {
2146
- participantSource: X,
2147
- onSelectParticipant: Je,
2148
- onClose: he,
2149
- existingParticipantIds: Q,
2150
- participantLabel: re,
2151
- searchPlaceholder: `Search ${re}...`
2251
+ participantSource: ee,
2252
+ onSelectParticipant: ot,
2253
+ onClose: xe,
2254
+ existingParticipantIds: K,
2255
+ participantLabel: ie,
2256
+ searchPlaceholder: `Search ${ie}...`
2152
2257
  },
2153
- F
2258
+ U
2154
2259
  ) })
2155
2260
  }
2156
2261
  )
2157
2262
  ]
2158
2263
  }
2159
2264
  );
2160
- }, ks = ({
2265
+ }, Vs = ({
2161
2266
  question: t,
2162
2267
  onClick: s,
2163
2268
  loading: n = !1,
2164
- className: r
2269
+ className: a
2165
2270
  }) => /* @__PURE__ */ e(
2166
2271
  "button",
2167
2272
  {
@@ -2175,27 +2280,27 @@ const As = ({
2175
2280
  "hover:brightness-95 active:brightness-90": !n,
2176
2281
  "opacity-50 cursor-not-allowed": n
2177
2282
  },
2178
- r
2283
+ a
2179
2284
  ),
2180
2285
  children: t
2181
2286
  }
2182
- ), Bs = ({
2287
+ ), tn = ({
2183
2288
  faqs: t,
2184
2289
  onFaqClick: s,
2185
2290
  loadingFaqId: n,
2186
- headerText: r,
2291
+ headerText: a,
2187
2292
  className: l,
2188
- avatarImage: u,
2293
+ avatarImage: c,
2189
2294
  avatarName: o
2190
2295
  }) => {
2191
- const m = t.filter((x) => x.enabled).sort((x, g) => (x.order ?? 0) - (g.order ?? 0));
2192
- return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
2193
- (u || o) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
2194
- ee,
2296
+ const u = t.filter((g) => g.enabled).sort((g, f) => (g.order ?? 0) - (f.order ?? 0));
2297
+ return u.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
2298
+ (c || o) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
2299
+ ne,
2195
2300
  {
2196
2301
  id: o || "account",
2197
2302
  name: o || "Account",
2198
- image: u,
2303
+ image: c,
2199
2304
  size: 24,
2200
2305
  shape: "circle"
2201
2306
  }
@@ -2206,55 +2311,55 @@ const As = ({
2206
2311
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
2207
2312
  style: { backgroundColor: "#F1F0EE" },
2208
2313
  children: [
2209
- r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
2210
- m.map((x) => /* @__PURE__ */ e(
2211
- ks,
2314
+ a && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: a }),
2315
+ u.map((g) => /* @__PURE__ */ e(
2316
+ Vs,
2212
2317
  {
2213
- question: x.question,
2214
- onClick: () => s(x.id),
2215
- loading: n === x.id
2318
+ question: g.question,
2319
+ onClick: () => s(g.id),
2320
+ loading: n === g.id
2216
2321
  },
2217
- x.id
2322
+ g.id
2218
2323
  ))
2219
2324
  ]
2220
2325
  }
2221
2326
  )
2222
2327
  ] }) });
2223
- }, $s = (t, s = {}) => {
2224
- const { initialSearch: n = "", pageSize: r = 20 } = s, [l, u] = _([]), [o, m] = _(!1), [x, g] = _(null), [C, b] = _(n), [w, a] = _(!0), [y, I] = _(), v = P(async (p = !1, T) => {
2328
+ }, sn = (t, s = {}) => {
2329
+ const { initialSearch: n = "", pageSize: a = 20 } = s, [l, c] = I([]), [o, u] = I(!1), [g, f] = I(null), [C, x] = I(n), [v, r] = I(!0), [y, E] = I(), w = F(async (p = !1, T) => {
2225
2330
  if (o) return;
2226
- const f = T !== void 0 ? T : C;
2227
- m(!0), g(null);
2331
+ const b = T !== void 0 ? T : C;
2332
+ u(!0), f(null);
2228
2333
  try {
2229
- const c = await t.loadParticipants({
2230
- search: f || void 0,
2231
- limit: r,
2334
+ const d = await t.loadParticipants({
2335
+ search: b || void 0,
2336
+ limit: a,
2232
2337
  cursor: p ? void 0 : y
2233
2338
  });
2234
- u(
2235
- (d) => p ? c.participants : [...d, ...c.participants]
2236
- ), a(c.hasMore), I(c.nextCursor);
2237
- } catch (c) {
2238
- const d = c instanceof Error ? c.message : "Failed to load participants";
2239
- g(d), console.error("[useParticipants] Load error:", c);
2339
+ c(
2340
+ (m) => p ? d.participants : [...m, ...d.participants]
2341
+ ), r(d.hasMore), E(d.nextCursor);
2342
+ } catch (d) {
2343
+ const m = d instanceof Error ? d.message : "Failed to load participants";
2344
+ f(m), console.error("[useParticipants] Load error:", d);
2240
2345
  } finally {
2241
- m(!1);
2346
+ u(!1);
2242
2347
  }
2243
- }, [t, C, y, r, o]), S = P(() => {
2244
- w && !o && v(!1);
2245
- }, [w, o, v]), N = P((p) => {
2246
- b(p), I(void 0), v(!0, p);
2247
- }, [v]), h = P(() => {
2248
- I(void 0), v(!0);
2249
- }, [v]);
2250
- return Y(() => {
2251
- v(!0);
2348
+ }, [t, C, y, a, o]), S = F(() => {
2349
+ v && !o && w(!1);
2350
+ }, [v, o, w]), N = F((p) => {
2351
+ x(p), E(void 0), w(!0, p);
2352
+ }, [w]), h = F(() => {
2353
+ E(void 0), w(!0);
2354
+ }, [w]);
2355
+ return X(() => {
2356
+ w(!0);
2252
2357
  }, [t.loadParticipants]), {
2253
2358
  participants: l,
2254
2359
  loading: o,
2255
- error: x,
2360
+ error: g,
2256
2361
  searchQuery: C,
2257
- hasMore: w,
2362
+ hasMore: v,
2258
2363
  totalCount: t.totalCount,
2259
2364
  loadMore: S,
2260
2365
  search: N,
@@ -2262,20 +2367,20 @@ const As = ({
2262
2367
  };
2263
2368
  };
2264
2369
  export {
2265
- ge as ActionButton,
2266
- ee as Avatar,
2267
- ws as ChannelEmptyState,
2268
- He as ChannelList,
2269
- We as ChannelView,
2270
- Bs as FaqList,
2271
- ks as FaqListItem,
2272
- is as MessageVoteButtons,
2273
- Os as MessagingProvider,
2274
- As as MessagingShell,
2275
- Ss as ParticipantPicker,
2276
- Jt as formatRelativeTime,
2277
- rs as useMessageVote,
2278
- Yt as useMessaging,
2279
- $s as useParticipants
2370
+ Ne as ActionButton,
2371
+ ne as Avatar,
2372
+ Ts as ChannelEmptyState,
2373
+ Xe as ChannelList,
2374
+ Ke as ChannelView,
2375
+ tn as FaqList,
2376
+ Vs as FaqListItem,
2377
+ Cs as MessageVoteButtons,
2378
+ Ks as MessagingProvider,
2379
+ en as MessagingShell,
2380
+ Ps as ParticipantPicker,
2381
+ os as formatRelativeTime,
2382
+ gs as useMessageVote,
2383
+ rs as useMessaging,
2384
+ sn as useParticipants
2280
2385
  };
2281
2386
  //# sourceMappingURL=index.js.map