@linktr.ee/messaging-react 1.11.3 → 1.11.5-rc-1765005296

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as o, Fragment as he } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as i, Fragment as fe } from "react/jsx-runtime";
2
2
  import p from "classnames";
3
- import Z, { createContext as Se, useContext as ke, useCallback as F, useState as E, useRef as z, useEffect as G } from "react";
4
- import { StreamChatService as pe } from "@linktr.ee/messaging-core";
5
- import { Chat as Re, ChannelList as De, useMessageComposer as _e, useStateStore as Me, MessageInput as Fe, useMessageInputContext as Te, useMessageComposerHasSendableData as Pe, SimpleAttachmentSelector as Le, QuotedMessagePreview as Ue, AttachmentPreviewList as Oe, TextareaComposer as je, MessageTimestamp as Ae, Channel as Be, useChannelStateContext as fe, Window as ze, MessageList as Ge } from "stream-chat-react";
6
- import { XIcon as le, ArrowUpIcon as He, ArrowLeftIcon as oe, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as $e, ProhibitInsetIcon as ce, FlagIcon as Ve, MagnifyingGlassIcon as We, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as ue } from "stream-chat";
8
- const ge = Se({
3
+ import L, { createContext as De, useContext as Me, useCallback as M, useState as v, useRef as $, useEffect as G } from "react";
4
+ import { StreamChatService as Fe } from "@linktr.ee/messaging-core";
5
+ import { Chat as Pe, ChannelList as Te, useMessageComposer as Le, useStateStore as Ue, MessageInput as Oe, useMessageInputContext as je, useMessageComposerHasSendableData as Be, SimpleAttachmentSelector as Ae, QuotedMessagePreview as ze, AttachmentPreviewList as $e, TextareaComposer as Ge, MessageTimestamp as He, Channel as Ve, useChannelStateContext as ge, Window as We, MessageList as Ze } from "stream-chat-react";
6
+ import { XIcon as ae, ArrowUpIcon as qe, ArrowLeftIcon as ie, DotsThreeIcon as ce, SpinnerGapIcon as se, SignOutIcon as Ye, ProhibitInsetIcon as de, FlagIcon as Je, MagnifyingGlassIcon as Qe, ChatCircleDotsIcon as ue } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as me } from "stream-chat";
8
+ const xe = De({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,228 +15,228 @@ const ge = Se({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), se = () => ke(ge), Is = ({
18
+ }), ne = () => Me(xe), ks = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
- apiKey: l,
22
+ apiKey: r,
23
23
  capabilities: a = {},
24
- debug: i = !1
24
+ debug: o = !1
25
25
  }) => {
26
- const r = F(
27
- (u, ...N) => {
28
- i && console.log(`🔥 [MessagingProvider] ${u}`, ...N);
26
+ const l = M(
27
+ (u, ...x) => {
28
+ o && console.log(`🔥 [MessagingProvider] ${u}`, ...x);
29
29
  },
30
- [i]
30
+ [o]
31
31
  );
32
- r("🔄 RENDER START", {
32
+ l("🔄 RENDER START", {
33
33
  userId: s == null ? void 0 : s.id,
34
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
34
+ apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(a)
37
37
  });
38
- const [c, m] = E(null), [x, k] = E(null), [h, f] = E(!1), [y, g] = E(!1), [v, w] = E(null), b = z(!1), I = z({
38
+ const [c, m] = v(null), [g, y] = v(null), [h, f] = v(!1), [S, b] = v(!1), [w, E] = v(null), N = $(!1), I = $({
39
39
  userId: s == null ? void 0 : s.id,
40
- apiKey: l,
40
+ apiKey: r,
41
41
  serviceConfig: n,
42
42
  capabilities: a
43
- }), S = z(0);
44
- S.current++, r("📊 RENDER INFO", {
45
- renderCount: S.current,
46
- currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
43
+ }), k = $(0);
44
+ k.current++, l("📊 RENDER INFO", {
45
+ renderCount: k.current,
46
+ currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
48
  userChanged: I.current.userId !== (s == null ? void 0 : s.id),
49
- apiKeyChanged: I.current.apiKey !== l,
49
+ apiKeyChanged: I.current.apiKey !== r,
50
50
  serviceConfigChanged: I.current.serviceConfig !== n,
51
51
  capabilitiesChanged: I.current.capabilities !== a
52
52
  }
53
53
  }), I.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
- apiKey: l,
55
+ apiKey: r,
56
56
  serviceConfig: n,
57
57
  capabilities: a
58
58
  }, G(() => {
59
- const u = S.current;
60
- if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
59
+ const u = k.current;
60
+ if (l("🔧 SERVICE INIT EFFECT TRIGGERED", {
61
61
  renderCount: u,
62
- apiKey: !!l,
62
+ apiKey: !!r,
63
63
  serviceConfig: !!n,
64
64
  dependencies: {
65
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
65
+ apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
66
66
  serviceConfigRef: n,
67
67
  serviceConfigStable: I.current.serviceConfig === n,
68
- apiKeyStable: I.current.apiKey === l
68
+ apiKeyStable: I.current.apiKey === r
69
69
  }
70
- }), !l || !n) {
71
- r("⚠️ SERVICE INIT SKIPPED", {
70
+ }), !r || !n) {
71
+ l("⚠️ SERVICE INIT SKIPPED", {
72
72
  renderCount: u,
73
73
  reason: "Missing apiKey or serviceConfig"
74
74
  });
75
75
  return;
76
76
  }
77
- r("🚀 CREATING NEW SERVICE", {
77
+ l("🚀 CREATING NEW SERVICE", {
78
78
  renderCount: u,
79
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
79
+ apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: I.current.serviceConfig !== n
81
81
  });
82
- const N = new pe({
82
+ const x = new Fe({
83
83
  ...n,
84
- apiKey: l,
85
- debug: i
84
+ apiKey: r,
85
+ debug: o
86
86
  });
87
- return m(N), r("✅ SERVICE SET", {
87
+ return m(x), l("✅ SERVICE SET", {
88
88
  renderCount: u,
89
- serviceInstance: !!N
89
+ serviceInstance: !!x
90
90
  }), () => {
91
- r("🧹 SERVICE CLEANUP", {
91
+ l("🧹 SERVICE CLEANUP", {
92
92
  renderCount: u,
93
93
  reason: "Effect cleanup"
94
- }), N.disconnectUser().catch(console.error);
94
+ }), x.disconnectUser().catch(console.error);
95
95
  };
96
- }, [l, n, i, r]);
97
- const R = z(null);
96
+ }, [r, n, o, l]);
97
+ const R = $(null);
98
98
  G(() => {
99
- var N, j;
100
- if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
99
+ var x, A;
100
+ if (l("🔗 USER CONNECTION EFFECT TRIGGERED", {
101
101
  hasService: !!c,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: b.current,
104
+ isConnecting: N.current,
105
105
  isConnected: h,
106
106
  dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
107
107
  }), !c || !s) {
108
- r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
108
+ l("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (b.current) {
112
- r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
111
+ if (N.current) {
112
+ l("⚠️ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((N = R.current) == null ? void 0 : N.serviceId) === c && ((j = R.current) == null ? void 0 : j.userId) === s.id) {
116
- r(
115
+ if (((x = R.current) == null ? void 0 : x.serviceId) === c && ((A = R.current) == null ? void 0 : A.userId) === s.id) {
116
+ l(
117
117
  "⚠️ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
119
119
  );
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- r("🚀 STARTING USER CONNECTION", { userId: s.id }), b.current = !0, g(!0), w(null);
123
+ l("🚀 STARTING USER CONNECTION", { userId: s.id }), N.current = !0, b(!0), E(null);
124
124
  try {
125
- r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
- const A = await c.connectUser(s);
127
- k(A), f(!0), R.current = { serviceId: c, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
125
+ l("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
+ const z = await c.connectUser(s);
127
+ y(z), f(!0), R.current = { serviceId: c, userId: s.id }, l("✅ USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
- clientId: A.userID
129
+ clientId: z.userID
130
130
  });
131
- } catch (A) {
132
- const W = A instanceof Error ? A.message : "Connection failed";
133
- w(W), r("❌ USER CONNECTION ERROR", {
131
+ } catch (z) {
132
+ const Z = z instanceof Error ? z.message : "Connection failed";
133
+ E(Z), l("❌ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: W
135
+ error: Z
136
136
  });
137
137
  } finally {
138
- g(!1), b.current = !1, r("🔄 USER CONNECTION FINISHED", {
138
+ b(!1), N.current = !1, l("🔄 USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
140
  isConnected: h
141
141
  });
142
142
  }
143
143
  })();
144
- }, [c, s, r, h]), G(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
144
+ }, [c, s, l, h]), G(() => (l("🔌 CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!c,
146
146
  isConnected: h
147
147
  }), () => {
148
- c && h ? (r(
148
+ c && h ? (l(
149
149
  "🧹 CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), R.current = null, c.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
151
+ ), R.current = null, c.disconnectUser().catch(console.error)) : l("🔇 CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!c,
153
153
  isConnected: h
154
154
  });
155
- }), [c, h, r]);
156
- const _ = F(async () => {
157
- if (r("🔄 REFRESH CONNECTION CALLED", {
155
+ }), [c, h, l]);
156
+ const F = M(async () => {
157
+ if (l("🔄 REFRESH CONNECTION CALLED", {
158
158
  hasService: !!c,
159
159
  hasUser: !!s
160
160
  }), !c || !s) {
161
- r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
161
+ l("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), g(!0);
164
+ l("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
165
165
  try {
166
- r("🔌 DISCONNECTING FOR REFRESH"), await c.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
166
+ l("🔌 DISCONNECTING FOR REFRESH"), await c.disconnectUser(), l("📞 RECONNECTING FOR REFRESH");
167
167
  const u = await c.connectUser(s);
168
- k(u), f(!0), w(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
168
+ y(u), f(!0), E(null), l("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
169
169
  } catch (u) {
170
- const N = u instanceof Error ? u.message : "Refresh failed";
171
- w(N), r("❌ CONNECTION REFRESH ERROR", {
170
+ const x = u instanceof Error ? u.message : "Refresh failed";
171
+ E(x), l("❌ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: N
173
+ error: x
174
174
  });
175
175
  } finally {
176
- g(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ b(!1), l("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [c, s, r]), d = Z.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
178
+ }, [c, s, l]), d = L.useMemo(() => (l("💫 CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!c,
180
- hasClient: !!x,
180
+ hasClient: !!g,
181
181
  isConnected: h,
182
- isLoading: y,
183
- hasError: !!v,
182
+ isLoading: S,
183
+ hasError: !!w,
184
184
  capabilitiesKeys: Object.keys(a)
185
185
  }), {
186
186
  service: c,
187
- client: x,
187
+ client: g,
188
188
  isConnected: h,
189
- isLoading: y,
190
- error: v,
189
+ isLoading: S,
190
+ error: w,
191
191
  capabilities: a,
192
- refreshConnection: _,
193
- debug: i
192
+ refreshConnection: F,
193
+ debug: o
194
194
  }), [
195
195
  c,
196
- x,
196
+ g,
197
197
  h,
198
- y,
199
- v,
198
+ S,
199
+ w,
200
200
  a,
201
- _,
202
- i,
203
- r
201
+ F,
202
+ o,
203
+ l
204
204
  ]);
205
- return r("🔄 RENDER END", {
206
- renderCount: S.current,
207
- willRenderChat: !!(x && h),
205
+ return l("🔄 RENDER END", {
206
+ renderCount: k.current,
207
+ willRenderChat: !!(g && h),
208
208
  contextValueReady: !!d
209
- }), /* @__PURE__ */ e(ge.Provider, { value: d, children: x && h ? /* @__PURE__ */ e(
210
- Re,
209
+ }), /* @__PURE__ */ e(xe.Provider, { value: d, children: g && h ? /* @__PURE__ */ e(
210
+ Pe,
211
211
  {
212
- client: x,
212
+ client: g,
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
- }, Ze = () => se(), qe = (t, s) => {
219
+ }, Xe = () => ne(), Ke = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
222
  ), a = new Date(
223
223
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
224
224
  ).getTime() - n.getTime();
225
225
  return Math.floor(a / (1e3 * 60 * 60 * 24));
226
- }, Ye = (t) => {
226
+ }, es = (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 l = qe(t, s);
231
- return l === 0 ? t.toLocaleTimeString([], {
230
+ const r = Ke(t, s);
231
+ return r === 0 ? t.toLocaleTimeString([], {
232
232
  hour: "numeric",
233
233
  minute: "2-digit"
234
- }) : l === 1 ? "Yesterday" : l < 7 ? `${l}d` : l < 28 ? `${Math.floor(l / 7)}w` : t.toLocaleDateString("en-US", {
234
+ }) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
235
235
  month: "numeric",
236
236
  day: "numeric",
237
237
  year: "2-digit"
238
238
  });
239
- }, me = [
239
+ }, he = [
240
240
  "🍎",
241
241
  // Apple
242
242
  "🍌",
@@ -264,33 +264,33 @@ const ge = Se({
264
264
  "🍈"
265
265
  // Melon
266
266
  ];
267
- function Je(t) {
267
+ function ss(t) {
268
268
  let s = 0;
269
269
  for (let n = 0; n < t.length; n++) {
270
- const l = t.charCodeAt(n);
271
- s = (s << 5) - s + l, s = s & s;
270
+ const r = t.charCodeAt(n);
271
+ s = (s << 5) - s + r, s = s & s;
272
272
  }
273
273
  return Math.abs(s);
274
274
  }
275
- function Qe(t) {
276
- const n = Je(t) % me.length;
277
- return me[n];
275
+ function ts(t) {
276
+ const n = ss(t) % he.length;
277
+ return he[n];
278
278
  }
279
279
  const q = ({
280
280
  id: t,
281
281
  image: s,
282
282
  size: n = 40,
283
- className: l,
283
+ className: r,
284
284
  shape: a = "squircle"
285
285
  }) => {
286
- const i = Qe(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = a === "circle" ? { borderRadius: "50%" } : {
286
+ const o = ts(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = a === "circle" ? { borderRadius: "50%" } : {
287
287
  borderRadius: "33%",
288
288
  "corner-shape": "superellipse(1.3)"
289
289
  };
290
290
  return /* @__PURE__ */ e(
291
291
  "div",
292
292
  {
293
- className: p("flex-shrink-0 overflow-hidden", l),
293
+ className: p("flex-shrink-0 overflow-hidden", r),
294
294
  style: {
295
295
  width: `${n}px`,
296
296
  height: `${n}px`,
@@ -311,134 +311,134 @@ const q = ({
311
311
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
312
312
  c
313
313
  ),
314
- children: i
314
+ children: o
315
315
  }
316
316
  )
317
317
  }
318
318
  );
319
- }, Xe = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: a }) => {
320
- var w, b, I, S, R, _;
321
- const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
322
- t && n(t);
323
- }, m = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
324
- (d) => {
325
- var u, N;
326
- return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
327
- }
328
- ), x = ((b = m == null ? void 0 : m.user) == null ? void 0 : b.name) || "Conversation", k = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (R = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : R[t.state.messages.length - 1], y = (() => {
329
- var u;
330
- if (h != null && h.text) return h.text;
331
- const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
332
- return d != null && d.asset_url ? d.asset_url : d != null && d.image_url ? d.image_url : d != null && d.og_scrape_url ? d.og_scrape_url : d != null && d.thumb_url ? d.thumb_url : "No messages yet";
333
- })(), g = h != null && h.created_at ? Ye(new Date(h.created_at)) : "", v = a ?? 0;
334
- return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
335
- channelId: t == null ? void 0 : t.id,
336
- isSelected: i,
337
- participantName: x,
338
- unreadCount: v,
339
- hasTimestamp: !!g
340
- }), /* @__PURE__ */ e(
341
- "button",
342
- {
343
- type: "button",
344
- onClick: r,
345
- className: p(
346
- "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
347
- {
348
- "bg-primary-alt/10 border-l-4 border-l-primary": i,
349
- "hover:bg-sand": !i
350
- }
351
- ),
352
- children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
353
- /* @__PURE__ */ e(
354
- q,
319
+ }, Ce = L.memo(
320
+ ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
321
+ var E, N, I, k, R, F;
322
+ const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
+ t && n(t);
324
+ }, m = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
325
+ (d) => {
326
+ var u, x;
327
+ return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
328
+ }
329
+ ), g = ((N = m == null ? void 0 : m.user) == null ? void 0 : N.name) || "Conversation", y = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (R = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : R[t.state.messages.length - 1], S = (() => {
330
+ var u;
331
+ if (h != null && h.text) return h.text;
332
+ const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
333
+ return d != null && d.asset_url ? d.asset_url : d != null && d.image_url ? d.image_url : d != null && d.og_scrape_url ? d.og_scrape_url : d != null && d.thumb_url ? d.thumb_url : "No messages yet";
334
+ })(), b = h != null && h.created_at ? es(new Date(h.created_at)) : "", w = a ?? 0;
335
+ return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
336
+ channelId: t == null ? void 0 : t.id,
337
+ isSelected: o,
338
+ participantName: g,
339
+ unreadCount: w,
340
+ hasTimestamp: !!b
341
+ }), /* @__PURE__ */ e(
342
+ "button",
343
+ {
344
+ type: "button",
345
+ onClick: l,
346
+ className: p(
347
+ "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
355
348
  {
356
- id: ((_ = m == null ? void 0 : m.user) == null ? void 0 : _.id) || t.id || "unknown",
357
- name: x,
358
- image: k,
359
- size: 44,
360
- className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
349
+ "bg-primary-alt/10 border-l-4 border-l-primary": o,
350
+ "hover:bg-sand": !o
361
351
  }
362
352
  ),
363
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
364
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2", children: [
365
- /* @__PURE__ */ e(
366
- "h3",
367
- {
368
- className: p(
369
- "text-sm font-medium truncate",
370
- i ? "text-primary" : "text-charcoal"
371
- ),
372
- children: x
373
- }
374
- ),
375
- g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
376
- ] }),
377
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
378
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: y }),
379
- v > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: v > 99 ? "99+" : v })
353
+ children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
354
+ /* @__PURE__ */ e(
355
+ q,
356
+ {
357
+ id: ((F = m == null ? void 0 : m.user) == null ? void 0 : F.id) || t.id || "unknown",
358
+ name: g,
359
+ image: y,
360
+ size: 44,
361
+ className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
362
+ }
363
+ ),
364
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
365
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
366
+ /* @__PURE__ */ e(
367
+ "h3",
368
+ {
369
+ className: p(
370
+ "text-sm font-medium truncate",
371
+ o ? "text-primary" : "text-charcoal"
372
+ ),
373
+ children: g
374
+ }
375
+ ),
376
+ b && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: b })
377
+ ] }),
378
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
379
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
380
+ w > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: w > 99 ? "99+" : w })
381
+ ] })
380
382
  ] })
381
383
  ] })
382
- ] })
383
- }
384
- );
385
- }, Ke = ({
386
- onChannelSelect: t,
387
- selectedChannel: s,
388
- filters: n,
389
- className: l,
390
- customEmptyStateIndicator: a
391
- }) => {
392
- const i = Z.useRef(0);
393
- i.current++;
394
- const { debug: r = !1 } = se();
395
- return r && console.log("📺 [ChannelList] 🔄 RENDER START", {
396
- renderCount: i.current,
397
- selectedChannelId: s == null ? void 0 : s.id,
398
- filters: n
399
- }), /* @__PURE__ */ e(
400
- "div",
401
- {
402
- className: p(
403
- "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
404
- l
405
- ),
406
- children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
407
- renderCount: i.current,
408
- filters: n
409
- }), /* @__PURE__ */ e(
410
- De,
411
- {
412
- filters: n,
413
- sort: { last_message_at: -1 },
414
- options: { limit: 30 },
415
- Preview: (c) => {
416
- var m, x;
417
- return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
418
- channelId: (m = c.channel) == null ? void 0 : m.id,
419
- selectedChannelId: s == null ? void 0 : s.id,
420
- isSelected: (s == null ? void 0 : s.id) === ((x = c.channel) == null ? void 0 : x.id)
421
- }), /* @__PURE__ */ e(
422
- Xe,
423
- {
424
- ...c,
425
- selectedChannel: s,
426
- onChannelSelect: t,
427
- debug: r
428
- }
429
- );
384
+ }
385
+ );
386
+ }
387
+ );
388
+ Ce.displayName = "CustomChannelPreview";
389
+ const Ne = L.memo(
390
+ ({
391
+ onChannelSelect: t,
392
+ selectedChannel: s,
393
+ filters: n,
394
+ className: r,
395
+ customEmptyStateIndicator: a
396
+ }) => {
397
+ const o = L.useRef(0);
398
+ o.current++;
399
+ const { debug: l = !1 } = ne();
400
+ l && console.log("📺 [ChannelList] 🔄 RENDER START", {
401
+ renderCount: o.current,
402
+ selectedChannelId: s == null ? void 0 : s.id,
403
+ filters: n
404
+ });
405
+ const c = L.useMemo(() => (g) => /* @__PURE__ */ e(
406
+ Ce,
407
+ {
408
+ ...g,
409
+ selectedChannel: s,
410
+ onChannelSelect: t,
411
+ debug: l
412
+ }
413
+ ), [s, t, l]);
414
+ return /* @__PURE__ */ e(
415
+ "div",
416
+ {
417
+ className: p(
418
+ "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
419
+ r
420
+ ),
421
+ children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
422
+ Te,
423
+ {
424
+ filters: n,
425
+ sort: { last_message_at: -1 },
426
+ options: { limit: 30 },
427
+ Preview: c,
428
+ EmptyStateIndicator: a
430
429
  },
431
- EmptyStateIndicator: a
432
- },
433
- JSON.stringify(n)
434
- )) })
435
- }
436
- );
437
- }, K = ({
430
+ JSON.stringify(n)
431
+ ) })
432
+ }
433
+ );
434
+ }
435
+ );
436
+ Ne.displayName = "ChannelList";
437
+ const ee = ({
438
438
  variant: t = "default",
439
439
  className: s,
440
440
  children: n,
441
- ...l
441
+ ...r
442
442
  }) => /* @__PURE__ */ e(
443
443
  "button",
444
444
  {
@@ -448,24 +448,24 @@ const q = ({
448
448
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
449
449
  s
450
450
  ),
451
- ...l,
451
+ ...r,
452
452
  children: n
453
453
  }
454
454
  );
455
- function xe({ label: t, className: s, children: n, ...l }) {
456
- return /* @__PURE__ */ o(
455
+ function be({ label: t, className: s, children: n, ...r }) {
456
+ return /* @__PURE__ */ i(
457
457
  "button",
458
458
  {
459
459
  type: "button",
460
460
  className: p(
461
461
  "rounded-full p-2 transition-colors focus-ring",
462
462
  {
463
- "cursor-not-allowed opacity-50": l.disabled,
464
- "hover:bg-sand": !l.disabled
463
+ "cursor-not-allowed opacity-50": r.disabled,
464
+ "hover:bg-sand": !r.disabled
465
465
  },
466
466
  s
467
467
  ),
468
- ...l,
468
+ ...r,
469
469
  children: [
470
470
  /* @__PURE__ */ e("span", { className: "sr-only", children: t }),
471
471
  n
@@ -473,19 +473,19 @@ function xe({ label: t, className: s, children: n, ...l }) {
473
473
  }
474
474
  );
475
475
  }
476
- function Ne({ onClick: t }) {
477
- return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(le, { className: "h-5 w-5 text-stone", weight: "bold" }) });
476
+ function ve({ onClick: t }) {
477
+ return /* @__PURE__ */ e(be, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ae, { className: "h-5 w-5 text-stone", weight: "bold" }) });
478
478
  }
479
- const es = (t) => ({
479
+ const ns = (t) => ({
480
480
  linkPreviews: Array.from(t.previews.values()).filter(
481
- (s) => ue.previewIsLoaded(s) || ue.previewIsLoading(s)
481
+ (s) => me.previewIsLoaded(s) || me.previewIsLoading(s)
482
482
  )
483
- }), ss = ({
483
+ }), rs = ({
484
484
  link: t,
485
485
  onDismiss: s
486
486
  }) => {
487
- const { og_scrape_url: n, title: l, image_url: a } = t;
488
- return /* @__PURE__ */ o(
487
+ const { og_scrape_url: n, title: r, image_url: a } = t;
488
+ return /* @__PURE__ */ i(
489
489
  "a",
490
490
  {
491
491
  href: n,
@@ -497,7 +497,7 @@ const es = (t) => ({
497
497
  "img",
498
498
  {
499
499
  src: a,
500
- alt: l || "",
500
+ alt: r || "",
501
501
  className: "h-[148px] w-full rounded-[20px] object-cover"
502
502
  }
503
503
  ),
@@ -505,47 +505,47 @@ const es = (t) => ({
505
505
  "button",
506
506
  {
507
507
  type: "button",
508
- onClick: (r) => {
509
- r.preventDefault(), s(n);
508
+ onClick: (l) => {
509
+ l.preventDefault(), s(n);
510
510
  },
511
511
  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",
512
512
  "aria-label": "Close link preview",
513
- children: /* @__PURE__ */ e(le, { className: "size-4 text-black/90" })
513
+ children: /* @__PURE__ */ e(ae, { className: "size-4 text-black/90" })
514
514
  }
515
515
  ),
516
- /* @__PURE__ */ o("div", { className: "p-2", children: [
517
- l && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: l }),
516
+ /* @__PURE__ */ i("div", { className: "p-2", children: [
517
+ r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
518
518
  /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
519
519
  ] })
520
520
  ]
521
521
  }
522
522
  );
523
- }, ts = () => {
524
- const { linkPreviewsManager: t } = _e(), { linkPreviews: s } = Me(
523
+ }, ls = () => {
524
+ const { linkPreviewsManager: t } = Le(), { linkPreviews: s } = Ue(
525
525
  t.state,
526
- es
526
+ ns
527
527
  ), n = (a) => {
528
528
  t.dismissPreview(a);
529
529
  };
530
530
  return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
531
- ss,
531
+ rs,
532
532
  {
533
533
  link: a,
534
534
  onDismiss: n
535
535
  },
536
536
  a.og_scrape_url
537
537
  )) }) : null;
538
- }, ns = () => {
539
- const { handleSubmit: t } = Te(), s = Pe();
540
- return /* @__PURE__ */ o(he, { children: [
541
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Le, {}) }),
542
- /* @__PURE__ */ o("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
543
- /* @__PURE__ */ e(Ue, {}),
544
- /* @__PURE__ */ e(ts, {}),
545
- /* @__PURE__ */ e(Oe, {}),
546
- /* @__PURE__ */ o("div", { className: "flex", children: [
538
+ }, as = () => {
539
+ const { handleSubmit: t } = je(), s = Be();
540
+ return /* @__PURE__ */ i(fe, { children: [
541
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ae, {}) }),
542
+ /* @__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: [
543
+ /* @__PURE__ */ e(ze, {}),
544
+ /* @__PURE__ */ e(ls, {}),
545
+ /* @__PURE__ */ e($e, {}),
546
+ /* @__PURE__ */ i("div", { className: "flex", children: [
547
547
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
548
- je,
548
+ Ge,
549
549
  {
550
550
  className: "w-full resize-none outline-none leading-6",
551
551
  maxRows: 4
@@ -560,40 +560,37 @@ const es = (t) => ({
560
560
  disabled: !s,
561
561
  onClick: t,
562
562
  type: "button",
563
- children: /* @__PURE__ */ e(He, { className: "size-4" })
563
+ children: /* @__PURE__ */ e(qe, { className: "size-4" })
564
564
  }
565
565
  )
566
566
  ] })
567
567
  ] })
568
568
  ] });
569
- }, rs = ({
569
+ }, os = ({
570
570
  renderActions: t
571
- }) => /* @__PURE__ */ o("div", { className: "message-input flex items-center gap-2 p-4", children: [
571
+ }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
572
572
  t && (t == null ? void 0 : t()),
573
- /* @__PURE__ */ e(Fe, { Input: ns })
574
- ] }), ls = (t) => {
573
+ /* @__PURE__ */ e(Oe, { Input: as })
574
+ ] }), is = (t) => {
575
575
  const s = t.message.hide_date === !0;
576
- return /* @__PURE__ */ o("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
577
- /* @__PURE__ */ o("div", { className: "str-chat__message--system__text", children: [
576
+ return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
577
+ /* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
578
578
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
579
579
  /* @__PURE__ */ e("p", { children: t.message.text }),
580
580
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
581
581
  ] }),
582
- !s && /* @__PURE__ */ e(Ae, { message: t.message })
582
+ !s && /* @__PURE__ */ e(He, { message: t.message })
583
583
  ] });
584
- }, Ce = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "text-center max-w-sm", children: [
585
- /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet 👀" }),
586
- /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
587
- ] }) }), as = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
588
- var m, x, k, h, f;
589
- const { channel: a } = fe(), i = Z.useMemo(() => Object.values(a.state.members || {}).find(
590
- (g) => {
591
- var v;
592
- return ((v = g.user) == null ? void 0 : v.id) && g.user.id !== a._client.userID;
584
+ }, cs = () => null, ds = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
585
+ var m, g, y, h, f;
586
+ const { channel: a } = ge(), o = L.useMemo(() => Object.values(a.state.members || {}).find(
587
+ (b) => {
588
+ var w;
589
+ return ((w = b.user) == null ? void 0 : w.id) && b.user.id !== a._client.userID;
593
590
  }
594
- ), [a._client.userID, a.state.members]), r = ((m = i == null ? void 0 : i.user) == null ? void 0 : m.name) || ((x = i == null ? void 0 : i.user) == null ? void 0 : x.id) || "Unknown member", c = (k = i == null ? void 0 : i.user) == null ? void 0 : k.image;
595
- return /* @__PURE__ */ o("div", { className: "@container", children: [
596
- /* @__PURE__ */ o("div", { className: "flex justify-between items-center @lg:hidden", children: [
591
+ ), [a._client.userID, a.state.members]), l = ((m = o == null ? void 0 : o.user) == null ? void 0 : m.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", c = (y = o == null ? void 0 : o.user) == null ? void 0 : y.image;
592
+ return /* @__PURE__ */ i("div", { className: "@container", children: [
593
+ /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
597
594
  /* @__PURE__ */ e(
598
595
  "button",
599
596
  {
@@ -603,20 +600,20 @@ const es = (t) => ({
603
600
  ),
604
601
  onClick: t || (() => {
605
602
  }),
606
- children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
603
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
607
604
  }
608
605
  ),
609
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center", children: [
606
+ /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
610
607
  /* @__PURE__ */ e(
611
608
  q,
612
609
  {
613
- id: ((h = i == null ? void 0 : i.user) == null ? void 0 : h.id) || a.id || "unknown",
614
- name: r,
610
+ id: ((h = o == null ? void 0 : o.user) == null ? void 0 : h.id) || a.id || "unknown",
611
+ name: l,
615
612
  image: c,
616
613
  size: 40
617
614
  }
618
615
  ),
619
- /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: r })
616
+ /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: l })
620
617
  ] }),
621
618
  /* @__PURE__ */ e(
622
619
  "button",
@@ -626,12 +623,12 @@ const es = (t) => ({
626
623
  ),
627
624
  onClick: n || (() => {
628
625
  }),
629
- children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
626
+ children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
630
627
  }
631
628
  )
632
629
  ] }),
633
- /* @__PURE__ */ o("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
634
- /* @__PURE__ */ o("div", { className: "flex items-center gap-4 min-w-0", children: [
630
+ /* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
631
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
635
632
  s && t && /* @__PURE__ */ e(
636
633
  "button",
637
634
  {
@@ -639,103 +636,103 @@ const es = (t) => ({
639
636
  onClick: t,
640
637
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
641
638
  "aria-label": "Back to conversations",
642
- children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
639
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
643
640
  }
644
641
  ),
645
642
  /* @__PURE__ */ e(
646
643
  q,
647
644
  {
648
- id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || a.id || "unknown",
649
- name: r,
645
+ id: ((f = o == null ? void 0 : o.user) == null ? void 0 : f.id) || a.id || "unknown",
646
+ name: l,
650
647
  image: c,
651
648
  size: 40
652
649
  }
653
650
  ),
654
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: r }) })
651
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: l }) })
655
652
  ] }),
656
- l && n && /* @__PURE__ */ e(
653
+ r && n && /* @__PURE__ */ e(
657
654
  "button",
658
655
  {
659
656
  className: p(
660
657
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
661
658
  ),
662
659
  onClick: n,
663
- children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
660
+ children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
664
661
  }
665
662
  )
666
663
  ] })
667
664
  ] });
668
- }, os = ({
665
+ }, us = ({
669
666
  isOpen: t,
670
667
  onClose: s,
671
668
  participant: n,
672
- channel: l,
669
+ channel: r,
673
670
  followerStatusLabel: a,
674
- onLeaveConversation: i,
675
- onBlockParticipant: r
671
+ onLeaveConversation: o,
672
+ onBlockParticipant: l
676
673
  }) => {
677
- var W, O, $, Y, H, V, J;
678
- const { service: c, debug: m } = se(), x = z(null), [k, h] = E(!1), [f, y] = E(!1), [g, v] = E(!1);
674
+ var Z, B, V, Y, H, W, J;
675
+ const { service: c, debug: m } = ne(), g = $(null), [y, h] = v(!1), [f, S] = v(!1), [b, w] = v(!1);
679
676
  G(() => {
680
- const D = x.current;
681
- D && (t ? D.showModal() : D.close());
677
+ const _ = g.current;
678
+ _ && (t ? _.showModal() : _.close());
682
679
  }, [t]);
683
- const w = F(async () => {
684
- var D;
685
- if (!(!c || !((D = n == null ? void 0 : n.user) != null && D.id)))
680
+ const E = M(async () => {
681
+ var _;
682
+ if (!(!c || !((_ = n == null ? void 0 : n.user) != null && _.id)))
686
683
  try {
687
- const P = (await c.getBlockedUsers()).some(
688
- (L) => {
684
+ const U = (await c.getBlockedUsers()).some(
685
+ (O) => {
689
686
  var Q;
690
- return L.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
687
+ return O.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
691
688
  }
692
689
  );
693
- h(P);
694
- } catch (T) {
690
+ h(U);
691
+ } catch (P) {
695
692
  console.error(
696
693
  "[ChannelInfoDialog] Failed to check blocked status:",
697
- T
694
+ P
698
695
  );
699
696
  }
700
- }, [c, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
697
+ }, [c, (Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id]);
701
698
  G(() => {
702
- t && w();
703
- }, [t, w]);
704
- const b = async () => {
705
- var D;
699
+ t && E();
700
+ }, [t, E]);
701
+ const N = async () => {
702
+ var _;
706
703
  if (!f) {
707
- m && console.log("[ChannelInfoDialog] Leave conversation", l.cid), y(!0);
704
+ m && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
708
705
  try {
709
- const T = ((D = l._client) == null ? void 0 : D.userID) ?? null;
710
- await l.hide(T, !1), i && await i(l), s();
711
- } catch (T) {
712
- console.error("[ChannelInfoDialog] Failed to leave conversation", T);
706
+ const P = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
707
+ await r.hide(P, !1), o && await o(r), s();
708
+ } catch (P) {
709
+ console.error("[ChannelInfoDialog] Failed to leave conversation", P);
713
710
  } finally {
714
- y(!1);
711
+ S(!1);
715
712
  }
716
713
  }
717
714
  }, I = async () => {
718
- var D, T, P;
719
- if (!(g || !c)) {
720
- m && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), v(!0);
715
+ var _, P, U;
716
+ if (!(b || !c)) {
717
+ m && console.log("[ChannelInfoDialog] Block member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), w(!0);
721
718
  try {
722
- await c.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
723
- } catch (L) {
724
- console.error("[ChannelInfoDialog] Failed to block member", L);
719
+ await c.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
720
+ } catch (O) {
721
+ console.error("[ChannelInfoDialog] Failed to block member", O);
725
722
  } finally {
726
- v(!1);
723
+ w(!1);
727
724
  }
728
725
  }
729
- }, S = async () => {
730
- var D, T, P;
731
- if (!(g || !c)) {
732
- m && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), v(!0);
726
+ }, k = async () => {
727
+ var _, P, U;
728
+ if (!(b || !c)) {
729
+ m && console.log("[ChannelInfoDialog] Unblock member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), w(!0);
733
730
  try {
734
- await c.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), r && await r((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
735
- } catch (L) {
736
- console.error("[ChannelInfoDialog] Failed to unblock member", L);
731
+ await c.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
732
+ } catch (O) {
733
+ console.error("[ChannelInfoDialog] Failed to unblock member", O);
737
734
  } finally {
738
- v(!1);
735
+ w(!1);
739
736
  }
740
737
  }
741
738
  }, R = () => {
@@ -746,43 +743,43 @@ const es = (t) => ({
746
743
  );
747
744
  };
748
745
  if (!n) return null;
749
- const _ = ((O = n.user) == null ? void 0 : O.name) || (($ = n.user) == null ? void 0 : $.id) || "Unknown member", d = (Y = n.user) == null ? void 0 : Y.image, u = (H = n.user) == null ? void 0 : H.email, N = (V = n.user) == null ? void 0 : V.username, j = u || (N ? `linktr.ee/${N}` : void 0), A = ((J = n.user) == null ? void 0 : J.id) || "unknown";
746
+ const F = ((B = n.user) == null ? void 0 : B.name) || ((V = n.user) == null ? void 0 : V.id) || "Unknown member", d = (Y = n.user) == null ? void 0 : Y.image, u = (H = n.user) == null ? void 0 : H.email, x = (W = n.user) == null ? void 0 : W.username, A = u || (x ? `linktr.ee/${x}` : void 0), z = ((J = n.user) == null ? void 0 : J.id) || "unknown";
750
747
  return (
751
748
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
752
749
  /* @__PURE__ */ e(
753
750
  "dialog",
754
751
  {
755
- ref: x,
752
+ ref: g,
756
753
  className: "mes-dialog group",
757
754
  onClose: s,
758
- onClick: (D) => {
759
- D.target === x.current && s();
755
+ onClick: (_) => {
756
+ _.target === g.current && s();
760
757
  },
761
- children: /* @__PURE__ */ o("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
762
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
758
+ 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: [
759
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
763
760
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
764
- /* @__PURE__ */ e(Ne, { onClick: s })
761
+ /* @__PURE__ */ e(ve, { onClick: s })
765
762
  ] }),
766
- /* @__PURE__ */ o("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
763
+ /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
767
764
  /* @__PURE__ */ e(
768
765
  "div",
769
766
  {
770
767
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
771
768
  style: { backgroundColor: "#FBFAF9" },
772
- children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3 w-full", children: [
769
+ children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
773
770
  /* @__PURE__ */ e(
774
771
  q,
775
772
  {
776
- id: A,
777
- name: _,
773
+ id: z,
774
+ name: F,
778
775
  image: d,
779
776
  size: 88,
780
777
  shape: "circle"
781
778
  }
782
779
  ),
783
- /* @__PURE__ */ o("div", { className: "flex flex-col min-w-0 flex-1", children: [
784
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: _ }),
785
- j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
780
+ /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
781
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: F }),
782
+ A && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: A }),
786
783
  a && /* @__PURE__ */ e(
787
784
  "span",
788
785
  {
@@ -801,44 +798,44 @@ const es = (t) => ({
801
798
  ] })
802
799
  }
803
800
  ),
804
- /* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
805
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
806
- K,
801
+ /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
802
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
803
+ ee,
807
804
  {
808
- onClick: b,
805
+ onClick: N,
809
806
  disabled: f,
810
807
  "aria-busy": f,
811
808
  children: [
812
- f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
809
+ f ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ye, { className: "h-5 w-5" }),
813
810
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
814
811
  ]
815
812
  }
816
813
  ) }),
817
- /* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ o(
818
- K,
814
+ /* @__PURE__ */ e("li", { children: y ? /* @__PURE__ */ i(
815
+ ee,
819
816
  {
820
- onClick: S,
821
- disabled: g,
822
- "aria-busy": g,
817
+ onClick: k,
818
+ disabled: b,
819
+ "aria-busy": b,
823
820
  children: [
824
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
821
+ b ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5" }),
825
822
  /* @__PURE__ */ e("span", { children: "Unblock" })
826
823
  ]
827
824
  }
828
- ) : /* @__PURE__ */ o(
829
- K,
825
+ ) : /* @__PURE__ */ i(
826
+ ee,
830
827
  {
831
828
  onClick: I,
832
- disabled: g,
833
- "aria-busy": g,
829
+ disabled: b,
830
+ "aria-busy": b,
834
831
  children: [
835
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
832
+ b ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5" }),
836
833
  /* @__PURE__ */ e("span", { children: "Block" })
837
834
  ]
838
835
  }
839
836
  ) }),
840
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(K, { variant: "danger", onClick: R, children: [
841
- /* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
837
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ee, { variant: "danger", onClick: R, children: [
838
+ /* @__PURE__ */ e(Je, { className: "h-5 w-5" }),
842
839
  /* @__PURE__ */ e("span", { children: "Report" })
843
840
  ] }) })
844
841
  ] })
@@ -847,107 +844,113 @@ const es = (t) => ({
847
844
  }
848
845
  )
849
846
  );
850
- }, is = ({
847
+ }, ms = ({
851
848
  onBack: t,
852
849
  showBackButton: s,
853
850
  renderMessageInputActions: n,
854
- onLeaveConversation: l,
855
- onBlockParticipant: a,
856
- CustomChannelEmptyState: i = Ce
851
+ onLeaveConversation: r,
852
+ onBlockParticipant: a
857
853
  }) => {
858
- var f, y;
859
- const { channel: r } = fe(), [c, m] = E(!1), x = (((y = (f = r == null ? void 0 : r.state) == null ? void 0 : f.messages) == null ? void 0 : y.length) ?? 0) > 0, k = Z.useMemo(() => Object.values(r.state.members || {}).find(
860
- (v) => {
861
- var w;
862
- return ((w = v.user) == null ? void 0 : w.id) && v.user.id !== r._client.userID;
854
+ const { channel: o } = ge(), [l, c] = v(!1), m = L.useMemo(() => Object.values(o.state.members || {}).find(
855
+ (h) => {
856
+ var f;
857
+ return ((f = h.user) == null ? void 0 : f.id) && h.user.id !== o._client.userID;
863
858
  }
864
- ), [r._client.userID, r.state.members]), h = Z.useMemo(() => {
865
- const g = r.data ?? {};
866
- if (g.followerStatus)
867
- return String(g.followerStatus);
868
- if (g.isFollower !== void 0)
869
- return g.isFollower ? "Subscribed to you" : "Not subscribed";
870
- }, [r.data]);
871
- return /* @__PURE__ */ o(he, { children: [
872
- /* @__PURE__ */ o(ze, { children: [
859
+ ), [o._client.userID, o.state.members]), g = L.useMemo(() => {
860
+ const y = o.data ?? {};
861
+ if (y.followerStatus)
862
+ return String(y.followerStatus);
863
+ if (y.isFollower !== void 0)
864
+ return y.isFollower ? "Subscribed to you" : "Not subscribed";
865
+ }, [o.data]);
866
+ return /* @__PURE__ */ i(fe, { children: [
867
+ /* @__PURE__ */ i(We, { children: [
873
868
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
874
- as,
869
+ ds,
875
870
  {
876
871
  onBack: t,
877
872
  showBackButton: s,
878
- onShowInfo: () => m(!0),
879
- canShowInfo: !!k
873
+ onShowInfo: () => c(!0),
874
+ canShowInfo: !!m
875
+ }
876
+ ) }),
877
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
878
+ Ze,
879
+ {
880
+ hideDeletedMessages: !0,
881
+ hideNewMessageSeparator: !1,
882
+ messageActions: []
880
883
  }
881
884
  ) }),
882
- /* @__PURE__ */ o("div", { className: "flex-1 overflow-hidden relative", children: [
883
- /* @__PURE__ */ e(
884
- Ge,
885
- {
886
- hideDeletedMessages: !0,
887
- hideNewMessageSeparator: !1,
888
- messageActions: []
889
- }
890
- ),
891
- !x && i && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(i, {}) })
892
- ] }),
893
885
  /* @__PURE__ */ e(
894
- rs,
886
+ os,
895
887
  {
896
- renderActions: () => n == null ? void 0 : n(r)
888
+ renderActions: () => n == null ? void 0 : n(o)
897
889
  }
898
890
  )
899
891
  ] }),
900
892
  /* @__PURE__ */ e(
901
- os,
893
+ us,
902
894
  {
903
- isOpen: c,
904
- onClose: () => m(!1),
905
- participant: k,
906
- channel: r,
907
- followerStatusLabel: h,
908
- onLeaveConversation: l,
895
+ isOpen: l,
896
+ onClose: () => c(!1),
897
+ participant: m,
898
+ channel: o,
899
+ followerStatusLabel: g,
900
+ onLeaveConversation: r,
909
901
  onBlockParticipant: a
910
902
  }
911
903
  )
912
904
  ] });
913
- }, cs = ({
914
- channel: t,
915
- onBack: s,
916
- showBackButton: n = !1,
917
- renderMessageInputActions: l,
918
- onLeaveConversation: a,
919
- onBlockParticipant: i,
920
- className: r,
921
- CustomChannelEmptyState: c = Ce
922
- }) => /* @__PURE__ */ e(
923
- "div",
924
- {
925
- className: p(
926
- "messaging-channel-view h-full flex flex-col",
927
- r
928
- ),
929
- children: /* @__PURE__ */ e(Be, { channel: t, MessageSystem: ls, children: /* @__PURE__ */ e(
930
- is,
931
- {
932
- onBack: s,
933
- showBackButton: n,
934
- renderMessageInputActions: l,
935
- onLeaveConversation: a,
936
- onBlockParticipant: i,
937
- CustomChannelEmptyState: c
938
- }
939
- ) })
940
- }
905
+ }, we = L.memo(
906
+ ({
907
+ channel: t,
908
+ onBack: s,
909
+ showBackButton: n = !1,
910
+ renderMessageInputActions: r,
911
+ onLeaveConversation: a,
912
+ onBlockParticipant: o,
913
+ className: l,
914
+ CustomChannelEmptyState: c = cs
915
+ }) => /* @__PURE__ */ e(
916
+ "div",
917
+ {
918
+ className: p(
919
+ "messaging-channel-view h-full flex flex-col",
920
+ l
921
+ ),
922
+ children: /* @__PURE__ */ e(
923
+ Ve,
924
+ {
925
+ channel: t,
926
+ MessageSystem: is,
927
+ EmptyStateIndicator: c,
928
+ children: /* @__PURE__ */ e(
929
+ ms,
930
+ {
931
+ onBack: s,
932
+ showBackButton: n,
933
+ renderMessageInputActions: r,
934
+ onLeaveConversation: a,
935
+ onBlockParticipant: o,
936
+ CustomChannelEmptyState: c
937
+ }
938
+ )
939
+ }
940
+ )
941
+ }
942
+ )
941
943
  );
942
- function ds({
944
+ we.displayName = "ChannelView";
945
+ function hs({
943
946
  searchQuery: t,
944
947
  setSearchQuery: s,
945
948
  placeholder: n
946
949
  }) {
947
- const l = z(null);
948
- return /* @__PURE__ */ o("div", { className: "relative", children: [
950
+ const r = $(null);
951
+ return /* @__PURE__ */ i("div", { className: "relative", children: [
949
952
  /* @__PURE__ */ e(
950
- We,
953
+ Qe,
951
954
  {
952
955
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
953
956
  weight: "bold"
@@ -956,7 +959,7 @@ function ds({
956
959
  /* @__PURE__ */ e(
957
960
  "input",
958
961
  {
959
- ref: l,
962
+ ref: r,
960
963
  type: "text",
961
964
  placeholder: n,
962
965
  value: t,
@@ -965,31 +968,31 @@ function ds({
965
968
  }
966
969
  ),
967
970
  t && /* @__PURE__ */ e(
968
- xe,
971
+ be,
969
972
  {
970
973
  label: "Clear search",
971
974
  onClick: () => {
972
975
  var a;
973
- s(""), (a = l.current) == null || a.focus();
976
+ s(""), (a = r.current) == null || a.focus();
974
977
  },
975
978
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
976
- children: /* @__PURE__ */ e(le, { className: "h-4 w-4", weight: "bold" })
979
+ children: /* @__PURE__ */ e(ae, { className: "h-4 w-4", weight: "bold" })
977
980
  }
978
981
  )
979
982
  ] });
980
983
  }
981
- const us = ({
984
+ const fs = ({
982
985
  participantSource: t,
983
986
  onSelectParticipant: s,
984
987
  onClose: n,
985
- existingParticipantIds: l = /* @__PURE__ */ new Set(),
988
+ existingParticipantIds: r = /* @__PURE__ */ new Set(),
986
989
  participantLabel: a = "participants",
987
- searchPlaceholder: i = "Search participants...",
988
- className: r
990
+ searchPlaceholder: o = "Search participants...",
991
+ className: l
989
992
  }) => {
990
- const { debug: c } = se(), [m, x] = E(""), [k, h] = E([]), [f, y] = E(!1), [g, v] = E(null), [w, b] = E(
993
+ const { debug: c } = ne(), [m, g] = v(""), [y, h] = v([]), [f, S] = v(!1), [b, w] = v(null), [E, N] = v(
991
994
  null
992
- ), I = z(!1);
995
+ ), I = $(!1);
993
996
  G(() => {
994
997
  if (t.loading) {
995
998
  c && console.log(
@@ -999,7 +1002,7 @@ const us = ({
999
1002
  }
1000
1003
  if (I.current) return;
1001
1004
  (async () => {
1002
- c && console.log("[ParticipantPicker] Loading initial participants..."), y(!0), v(null);
1005
+ c && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), w(null);
1003
1006
  try {
1004
1007
  const u = await t.loadParticipants({
1005
1008
  search: "",
@@ -1011,85 +1014,85 @@ const us = ({
1011
1014
  u.participants.length
1012
1015
  );
1013
1016
  } catch (u) {
1014
- const N = u instanceof Error ? u.message : "Failed to load participants";
1015
- v(N), console.error("[ParticipantPicker] Failed to load participants:", u);
1017
+ const x = u instanceof Error ? u.message : "Failed to load participants";
1018
+ w(x), console.error("[ParticipantPicker] Failed to load participants:", u);
1016
1019
  } finally {
1017
- y(!1);
1020
+ S(!1);
1018
1021
  }
1019
1022
  })();
1020
1023
  }, [t.loading, c]);
1021
- const S = k.filter((d) => !l.has(d.id)).filter((d) => {
1022
- var N;
1024
+ const k = y.filter((d) => !r.has(d.id)).filter((d) => {
1025
+ var x;
1023
1026
  if (!m) return !0;
1024
1027
  const u = m.toLowerCase();
1025
- return d.name.toLowerCase().includes(u) || ((N = d.email) == null ? void 0 : N.toLowerCase().includes(u)) || !1;
1026
- }), R = F(
1028
+ return d.name.toLowerCase().includes(u) || ((x = d.email) == null ? void 0 : x.toLowerCase().includes(u)) || !1;
1029
+ }), R = M(
1027
1030
  async (d) => {
1028
- if (!w) {
1029
- b(d.id);
1031
+ if (!E) {
1032
+ N(d.id);
1030
1033
  try {
1031
1034
  await s(d);
1032
1035
  } catch (u) {
1033
- console.error("[ParticipantPicker] Failed to start chat:", u), b(null);
1036
+ console.error("[ParticipantPicker] Failed to start chat:", u), N(null);
1034
1037
  }
1035
1038
  }
1036
1039
  },
1037
- [s, w]
1038
- ), _ = (d, u) => {
1040
+ [s, E]
1041
+ ), F = (d, u) => {
1039
1042
  (d.key === "Enter" || d.key === " ") && (d.preventDefault(), R(u));
1040
1043
  };
1041
- return /* @__PURE__ */ o("div", { className: p("flex flex-col h-full", r), children: [
1042
- /* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1043
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-3", children: [
1044
+ return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
1045
+ /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1046
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1044
1047
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1045
- /* @__PURE__ */ e(Ne, { onClick: n })
1048
+ /* @__PURE__ */ e(ve, { onClick: n })
1046
1049
  ] }),
1047
- /* @__PURE__ */ o("p", { className: "text-xs text-stone mb-3", children: [
1050
+ /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1048
1051
  "Select a ",
1049
1052
  a.slice(0, -1),
1050
1053
  " to start messaging (",
1051
- S.length,
1054
+ k.length,
1052
1055
  " available)",
1053
1056
  t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
1054
1057
  ] }),
1055
1058
  /* @__PURE__ */ e(
1056
- ds,
1059
+ hs,
1057
1060
  {
1058
1061
  searchQuery: m,
1059
- setSearchQuery: x,
1060
- placeholder: i
1062
+ setSearchQuery: g,
1063
+ placeholder: o
1061
1064
  }
1062
1065
  )
1063
1066
  ] }),
1064
- g && /* @__PURE__ */ o("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1067
+ b && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1065
1068
  "Error loading ",
1066
1069
  a,
1067
1070
  ": ",
1068
- g
1071
+ b
1069
1072
  ] }),
1070
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
1073
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && k.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: [
1071
1074
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1072
- /* @__PURE__ */ o("span", { className: "text-sm text-stone", children: [
1075
+ /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1073
1076
  "Loading ",
1074
1077
  a,
1075
1078
  "..."
1076
1079
  ] })
1077
- ] }) }) : S.length === 0 ? /* @__PURE__ */ o("div", { className: "p-6 text-center", children: [
1078
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
1079
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${a} found` : k.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1080
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1081
- ] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
1082
- S.map((d) => {
1083
- const u = d.name || d.email || d.id, N = d.email && d.name ? d.email : d.phone;
1080
+ ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1081
+ /* @__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" }) }),
1082
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${a} found` : y.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1083
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : y.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1084
+ ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1085
+ k.map((d) => {
1086
+ const u = d.name || d.email || d.id, x = d.email && d.name ? d.email : d.phone;
1084
1087
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1085
1088
  "button",
1086
1089
  {
1087
1090
  type: "button",
1088
1091
  onClick: () => R(d),
1089
- onKeyDown: (j) => _(j, d),
1092
+ onKeyDown: (A) => F(A, d),
1090
1093
  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",
1091
- children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
1092
- /* @__PURE__ */ o("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1094
+ children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1095
+ /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1093
1096
  /* @__PURE__ */ e(
1094
1097
  q,
1095
1098
  {
@@ -1099,23 +1102,23 @@ const us = ({
1099
1102
  size: 40
1100
1103
  }
1101
1104
  ),
1102
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
1105
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1103
1106
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1104
- N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
1107
+ x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
1105
1108
  ] })
1106
1109
  ] }),
1107
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === d.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
1110
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === d.id ? /* @__PURE__ */ e(se, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone" }) })
1108
1111
  ] })
1109
1112
  }
1110
1113
  ) }, d.id);
1111
1114
  }),
1112
- f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
1115
+ f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1113
1116
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1114
1117
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1115
1118
  ] }) })
1116
1119
  ] }) })
1117
1120
  ] });
1118
- }, ms = ({ className: t }) => /* @__PURE__ */ o(
1121
+ }, gs = ({ className: t }) => /* @__PURE__ */ i(
1119
1122
  "svg",
1120
1123
  {
1121
1124
  width: "140",
@@ -1125,7 +1128,7 @@ const us = ({
1125
1128
  xmlns: "http://www.w3.org/2000/svg",
1126
1129
  className: t,
1127
1130
  children: [
1128
- /* @__PURE__ */ o("g", { clipPath: "url(#clip0_empty_state)", children: [
1131
+ /* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
1129
1132
  /* @__PURE__ */ e(
1130
1133
  "path",
1131
1134
  {
@@ -1154,7 +1157,7 @@ const us = ({
1154
1157
  fill: "white"
1155
1158
  }
1156
1159
  ),
1157
- /* @__PURE__ */ o("g", { filter: "url(#filter0_empty_state)", children: [
1160
+ /* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
1158
1161
  /* @__PURE__ */ e(
1159
1162
  "path",
1160
1163
  {
@@ -1194,8 +1197,8 @@ const us = ({
1194
1197
  }
1195
1198
  )
1196
1199
  ] }),
1197
- /* @__PURE__ */ o("defs", { children: [
1198
- /* @__PURE__ */ o(
1200
+ /* @__PURE__ */ i("defs", { children: [
1201
+ /* @__PURE__ */ i(
1199
1202
  "filter",
1200
1203
  {
1201
1204
  id: "filter0_empty_state",
@@ -1249,13 +1252,17 @@ const us = ({
1249
1252
  ] })
1250
1253
  ]
1251
1254
  }
1252
- ), hs = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1253
- /* @__PURE__ */ e(ms, {}),
1254
- !t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
1255
- /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1256
- /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1257
- ] })
1258
- ] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ o("div", { className: "text-center max-w-sm", children: [
1255
+ ), ye = L.memo(
1256
+ ({ hasChannels: t }) => /* @__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: [
1257
+ /* @__PURE__ */ e(gs, {}),
1258
+ !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1259
+ /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1260
+ /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1261
+ ] })
1262
+ ] }) })
1263
+ );
1264
+ ye.displayName = "EmptyState";
1265
+ const te = L.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: [
1259
1266
  /* @__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: "⚠️" }) }),
1260
1267
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1261
1268
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1268,12 +1275,14 @@ const us = ({
1268
1275
  children: "Go Back"
1269
1276
  }
1270
1277
  )
1271
- ] }) }), fs = ({ className: t, message: s }) => /* @__PURE__ */ o(
1278
+ ] }) }));
1279
+ te.displayName = "ErrorState";
1280
+ const xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
1272
1281
  "div",
1273
1282
  {
1274
1283
  className: p("flex items-center justify-center h-full", t),
1275
1284
  children: [
1276
- /* @__PURE__ */ o("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1285
+ /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1277
1286
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1278
1287
  "animateTransform",
1279
1288
  {
@@ -1311,31 +1320,33 @@ const us = ({
1311
1320
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1312
1321
  ]
1313
1322
  }
1314
- ), gs = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ o("div", { className: "flex items-center", children: [
1315
- /* @__PURE__ */ e(fs, { className: "w-6 h-6" }),
1323
+ ), Ee = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1324
+ /* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
1316
1325
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1317
- ] }) }), Ss = ({
1326
+ ] }) }));
1327
+ Ee.displayName = "LoadingState";
1328
+ const Ss = ({
1318
1329
  capabilities: t = {},
1319
1330
  className: s,
1320
1331
  renderMessageInputActions: n,
1321
- onChannelSelect: l,
1332
+ onChannelSelect: r,
1322
1333
  onParticipantSelect: a,
1323
- initialParticipantFilter: i,
1324
- initialParticipantData: r,
1334
+ initialParticipantFilter: o,
1335
+ initialParticipantData: l,
1325
1336
  CustomChannelEmptyState: c,
1326
1337
  showChannelList: m = !0,
1327
- filters: x,
1328
- channelListCustomEmptyStateIndicator: k
1338
+ filters: g,
1339
+ channelListCustomEmptyStateIndicator: y
1329
1340
  }) => {
1330
1341
  const {
1331
1342
  service: h,
1332
1343
  client: f,
1333
- isConnected: y,
1334
- isLoading: g,
1335
- error: v,
1336
- refreshConnection: w,
1337
- debug: b
1338
- } = Ze(), [I, S] = E(null), [R, _] = E(!1), [d, u] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [O, $] = E(!1), [Y, H] = E(null), V = z(null), { participantSource: J, participantLabel: D = "participants" } = t, T = Z.useMemo(() => {
1344
+ isConnected: S,
1345
+ isLoading: b,
1346
+ error: w,
1347
+ refreshConnection: E,
1348
+ debug: N
1349
+ } = Xe(), [I, k] = v(null), [R, F] = v(!1), [d, u] = v(!1), [x, A] = v(/* @__PURE__ */ new Set()), [z, Z] = v(0), [B, V] = v(!1), [Y, H] = v(null), W = $(null), { participantSource: J, participantLabel: _ = "participants" } = t, P = L.useMemo(() => {
1339
1350
  const C = f == null ? void 0 : f.userID;
1340
1351
  return {
1341
1352
  ...{
@@ -1346,163 +1357,168 @@ const us = ({
1346
1357
  hidden: !1
1347
1358
  }
1348
1359
  },
1349
- ...x
1360
+ ...g
1350
1361
  };
1351
- }, [x, f == null ? void 0 : f.userID]), P = z(null), L = F(async () => {
1352
- if (!f || !y) return;
1362
+ }, [g, f == null ? void 0 : f.userID]), U = $(null), O = M(async () => {
1363
+ if (!f || !S) return;
1353
1364
  const C = f.userID;
1354
1365
  if (C)
1355
1366
  try {
1356
- b && console.log("[MessagingShell] Syncing channels for user:", C);
1357
- const U = await f.queryChannels(
1367
+ N && console.log("[MessagingShell] Syncing channels for user:", C);
1368
+ const j = await f.queryChannels(
1358
1369
  {
1359
1370
  type: "messaging",
1360
1371
  members: { $in: [C] }
1361
1372
  },
1362
1373
  {},
1363
1374
  { limit: 100 }
1364
- ), M = /* @__PURE__ */ new Set();
1365
- U.forEach((B) => {
1366
- const ye = B.state.members;
1367
- Object.values(ye).forEach((Ie) => {
1368
- var ae;
1369
- const ne = (ae = Ie.user) == null ? void 0 : ae.id;
1370
- ne && ne !== C && M.add(ne);
1375
+ ), D = /* @__PURE__ */ new Set();
1376
+ j.forEach((T) => {
1377
+ const re = T.state.members;
1378
+ Object.values(re).forEach((_e) => {
1379
+ var oe;
1380
+ const le = (oe = _e.user) == null ? void 0 : oe.id;
1381
+ le && le !== C && D.add(le);
1371
1382
  });
1372
- }), j(M), _(U.length > 0), P.current = C, b && console.log("[MessagingShell] Channels synced successfully:", {
1373
- channelCount: U.length,
1374
- memberCount: M.size
1383
+ }), A((T) => T.size === D.size && [...T].every((re) => D.has(re)) ? T : D), F(j.length > 0), U.current = C, N && console.log("[MessagingShell] Channels synced successfully:", {
1384
+ channelCount: j.length,
1385
+ memberCount: D.size
1375
1386
  });
1376
- } catch (U) {
1377
- console.error("[MessagingShell] Failed to sync channels:", U);
1387
+ } catch (j) {
1388
+ console.error("[MessagingShell] Failed to sync channels:", j);
1378
1389
  }
1379
- }, [f, y, b]);
1390
+ }, [f, S, N]);
1380
1391
  G(() => {
1381
- if (!f || !y) return;
1392
+ if (!f || !S) return;
1382
1393
  const C = f.userID;
1383
- C && P.current !== C && L();
1384
- }, [f, y, L]), G(() => {
1385
- if (!i || !f || !y) return;
1394
+ C && U.current !== C && O();
1395
+ }, [f, S, O]), G(() => {
1396
+ if (!o || !f || !S) return;
1386
1397
  (async () => {
1387
- const U = f.userID;
1388
- if (U)
1398
+ const j = f.userID;
1399
+ if (j)
1389
1400
  try {
1390
- b && console.log(
1401
+ N && console.log(
1391
1402
  "[MessagingShell] Loading initial conversation with:",
1392
- i
1403
+ o
1393
1404
  );
1394
- const M = await f.queryChannels(
1405
+ const D = await f.queryChannels(
1395
1406
  {
1396
1407
  type: "messaging",
1397
- members: { $eq: [U, i] }
1408
+ members: { $eq: [j, o] }
1398
1409
  },
1399
1410
  {},
1400
1411
  { limit: 1 }
1401
1412
  );
1402
- if (M.length > 0)
1403
- S(M[0]), $(!0), H(null), l && l(M[0]), b && console.log(
1413
+ if (D.length > 0)
1414
+ k(D[0]), V(!0), H(null), r && r(D[0]), N && console.log(
1404
1415
  "[MessagingShell] Initial conversation loaded:",
1405
- M[0].id
1416
+ D[0].id
1406
1417
  );
1407
- else if (r && h) {
1408
- b && console.log(
1418
+ else if (l && h) {
1419
+ N && console.log(
1409
1420
  "[MessagingShell] No conversation found, creating one for:",
1410
- r
1421
+ l
1411
1422
  );
1412
1423
  try {
1413
- const B = await h.startChannelWithParticipant({
1414
- id: r.id,
1415
- name: r.name,
1416
- email: r.email,
1417
- phone: r.phone
1424
+ const T = await h.startChannelWithParticipant({
1425
+ id: l.id,
1426
+ name: l.name,
1427
+ email: l.email,
1428
+ phone: l.phone
1418
1429
  });
1419
- S(B), $(!0), H(null), l && l(B), b && console.log(
1430
+ k(T), V(!0), H(null), r && r(T), N && console.log(
1420
1431
  "[MessagingShell] Channel created and loaded:",
1421
- B.id
1432
+ T.id
1422
1433
  );
1423
- } catch (B) {
1434
+ } catch (T) {
1424
1435
  console.error(
1425
1436
  "[MessagingShell] Failed to create conversation:",
1426
- B
1437
+ T
1427
1438
  ), H("Failed to create conversation");
1428
1439
  }
1429
1440
  } else
1430
1441
  H(
1431
1442
  "No conversation found with this account"
1432
- ), b && console.log(
1443
+ ), N && console.log(
1433
1444
  "[MessagingShell] No conversation found for:",
1434
- i
1445
+ o
1435
1446
  );
1436
- } catch (M) {
1447
+ } catch (D) {
1437
1448
  console.error(
1438
1449
  "[MessagingShell] Failed to load initial conversation:",
1439
- M
1450
+ D
1440
1451
  ), H("Failed to load conversation");
1441
1452
  }
1442
1453
  })();
1443
1454
  }, [
1444
- i,
1445
- r,
1455
+ o,
1456
+ l,
1446
1457
  f,
1447
- y,
1458
+ S,
1448
1459
  h,
1449
- b,
1450
- l
1460
+ N,
1461
+ r
1451
1462
  ]);
1452
- const Q = F(
1463
+ const Q = M(
1453
1464
  (C) => {
1454
- S(C), l == null || l(C);
1465
+ k(C), r == null || r(C);
1455
1466
  },
1456
- [l]
1457
- ), be = F(() => {
1458
- O || S(null);
1459
- }, [O]), ve = F(
1467
+ [r]
1468
+ ), Ie = M(() => {
1469
+ B || k(null);
1470
+ }, [B]), ke = M(
1460
1471
  async (C) => {
1461
- var U;
1472
+ var j;
1462
1473
  if (h)
1463
1474
  try {
1464
- b && console.log(
1475
+ N && console.log(
1465
1476
  "[MessagingShell] Starting conversation with:",
1466
1477
  C.id
1467
1478
  );
1468
- const M = await h.startChannelWithParticipant({
1479
+ const D = await h.startChannelWithParticipant({
1469
1480
  id: C.id,
1470
1481
  name: C.name,
1471
1482
  email: C.email,
1472
1483
  phone: C.phone
1473
1484
  });
1474
1485
  try {
1475
- await M.show();
1476
- } catch (B) {
1477
- console.warn("[MessagingShell] Failed to unhide channel:", B);
1486
+ await D.show();
1487
+ } catch (T) {
1488
+ console.warn("[MessagingShell] Failed to unhide channel:", T);
1478
1489
  }
1479
- S(M), u(!1), (U = V.current) == null || U.close(), a == null || a(C);
1480
- } catch (M) {
1481
- console.error("[MessagingShell] Failed to start conversation:", M);
1490
+ k(D), u(!1), (j = W.current) == null || j.close(), a == null || a(C);
1491
+ } catch (D) {
1492
+ console.error("[MessagingShell] Failed to start conversation:", D);
1482
1493
  }
1483
1494
  },
1484
- [h, a, b]
1485
- ), te = F(() => {
1495
+ [h, a, N]
1496
+ ), X = M(() => {
1486
1497
  var C;
1487
- u(!1), (C = V.current) == null || C.close();
1488
- }, []), we = F(
1498
+ u(!1), (C = W.current) == null || C.close();
1499
+ }, []), Se = M(
1500
+ (C) => {
1501
+ C.target === W.current && X();
1502
+ },
1503
+ [X]
1504
+ ), pe = M(
1489
1505
  async (C) => {
1490
- b && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), $(!1), P.current = null, await L();
1506
+ N && console.log("[MessagingShell] Leaving conversation:", C.id), k(null), V(!1), U.current = null, await O();
1491
1507
  },
1492
- [L, b]
1493
- ), Ee = F(
1508
+ [O, N]
1509
+ ), Re = M(
1494
1510
  async (C) => {
1495
- b && console.log("[MessagingShell] Blocking participant:", C), S(null), $(!1), P.current = null, await L();
1511
+ N && console.log("[MessagingShell] Blocking participant:", C), k(null), V(!1), U.current = null, await O();
1496
1512
  },
1497
- [L, b]
1498
- ), X = !!I;
1499
- return g ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(gs, {}) }) : v ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(re, { message: v, onBack: w }) }) : !y || !f ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1500
- re,
1513
+ [O, N]
1514
+ ), K = !!I;
1515
+ return b ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(Ee, {}) }) : w ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(te, { message: w, onBack: E }) }) : !S || !f ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1516
+ te,
1501
1517
  {
1502
1518
  message: "Not connected to messaging service",
1503
- onBack: w
1519
+ onBack: E
1504
1520
  }
1505
- ) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(re, { message: Y }) }) : /* @__PURE__ */ o(
1521
+ ) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(te, { message: Y }) }) : /* @__PURE__ */ i(
1506
1522
  "div",
1507
1523
  {
1508
1524
  className: p(
@@ -1510,7 +1526,7 @@ const us = ({
1510
1526
  s
1511
1527
  ),
1512
1528
  children: [
1513
- /* @__PURE__ */ o("div", { className: "flex h-full min-h-0", children: [
1529
+ /* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
1514
1530
  /* @__PURE__ */ e(
1515
1531
  "div",
1516
1532
  {
@@ -1518,20 +1534,20 @@ const us = ({
1518
1534
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1519
1535
  {
1520
1536
  // Explicitly hidden via prop or in direct conversation mode
1521
- "!hidden": m === !1 || O,
1537
+ "!hidden": m === !1 || B,
1522
1538
  // Normal mode: hide on mobile when channel selected, show on desktop
1523
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !O && X,
1539
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !B && K,
1524
1540
  // Normal mode: show when no channel selected
1525
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !O && !X
1541
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !B && !K
1526
1542
  }
1527
1543
  ),
1528
1544
  children: /* @__PURE__ */ e(
1529
- Ke,
1545
+ Ne,
1530
1546
  {
1531
1547
  onChannelSelect: Q,
1532
1548
  selectedChannel: I || void 0,
1533
- filters: T,
1534
- customEmptyStateIndicator: k
1549
+ filters: P,
1550
+ customEmptyStateIndicator: y
1535
1551
  }
1536
1552
  )
1537
1553
  }
@@ -1543,24 +1559,24 @@ const us = ({
1543
1559
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1544
1560
  {
1545
1561
  // In direct conversation mode, always show (full width)
1546
- flex: O || X,
1562
+ flex: B || K,
1547
1563
  // Normal mode: hide on mobile when no channel selected
1548
- "hidden lg:flex": !O && !X
1564
+ "hidden lg:flex": !B && !K
1549
1565
  }
1550
1566
  ),
1551
1567
  children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1552
- cs,
1568
+ we,
1553
1569
  {
1554
1570
  channel: I,
1555
- onBack: be,
1556
- showBackButton: !O,
1571
+ onBack: Ie,
1572
+ showBackButton: !B,
1557
1573
  renderMessageInputActions: n,
1558
- onLeaveConversation: we,
1559
- onBlockParticipant: Ee,
1574
+ onLeaveConversation: pe,
1575
+ onBlockParticipant: Re,
1560
1576
  CustomChannelEmptyState: c
1561
1577
  },
1562
1578
  I.id
1563
- ) }) : /* @__PURE__ */ e(hs, { hasChannels: R })
1579
+ ) }) : /* @__PURE__ */ e(ye, { hasChannels: R })
1564
1580
  }
1565
1581
  )
1566
1582
  ] }),
@@ -1568,34 +1584,32 @@ const us = ({
1568
1584
  /* @__PURE__ */ e(
1569
1585
  "dialog",
1570
1586
  {
1571
- ref: V,
1587
+ ref: W,
1572
1588
  className: "mes-dialog",
1573
- onClick: (C) => {
1574
- C.target === V.current && te();
1575
- },
1576
- onClose: te,
1589
+ onClick: Se,
1590
+ onClose: X,
1577
1591
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1578
- us,
1592
+ fs,
1579
1593
  {
1580
1594
  participantSource: J,
1581
- onSelectParticipant: ve,
1582
- onClose: te,
1583
- existingParticipantIds: N,
1584
- participantLabel: D,
1585
- searchPlaceholder: `Search ${D}...`
1595
+ onSelectParticipant: ke,
1596
+ onClose: X,
1597
+ existingParticipantIds: x,
1598
+ participantLabel: _,
1599
+ searchPlaceholder: `Search ${_}...`
1586
1600
  },
1587
- A
1601
+ z
1588
1602
  ) })
1589
1603
  }
1590
1604
  )
1591
1605
  ]
1592
1606
  }
1593
1607
  );
1594
- }, xs = ({
1608
+ }, Cs = ({
1595
1609
  question: t,
1596
1610
  onClick: s,
1597
1611
  loading: n = !1,
1598
- className: l
1612
+ className: r
1599
1613
  }) => /* @__PURE__ */ e(
1600
1614
  "button",
1601
1615
  {
@@ -1609,40 +1623,40 @@ const us = ({
1609
1623
  "hover:brightness-95 active:brightness-90": !n,
1610
1624
  "opacity-50 cursor-not-allowed": n
1611
1625
  },
1612
- l
1626
+ r
1613
1627
  ),
1614
1628
  children: t
1615
1629
  }
1616
- ), ks = ({
1630
+ ), ps = ({
1617
1631
  faqs: t,
1618
1632
  onFaqClick: s,
1619
1633
  loadingFaqId: n,
1620
- headerText: l,
1634
+ headerText: r,
1621
1635
  className: a,
1622
- avatarImage: i,
1623
- avatarName: r
1636
+ avatarImage: o,
1637
+ avatarName: l
1624
1638
  }) => {
1625
- const c = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
1626
- return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
1627
- (i || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1639
+ const c = t.filter((m) => m.enabled).sort((m, g) => (m.order ?? 0) - (g.order ?? 0));
1640
+ return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1641
+ (o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1628
1642
  q,
1629
1643
  {
1630
- id: r || "account",
1631
- name: r || "Account",
1632
- image: i,
1644
+ id: l || "account",
1645
+ name: l || "Account",
1646
+ image: o,
1633
1647
  size: 24,
1634
1648
  shape: "circle"
1635
1649
  }
1636
1650
  ) }),
1637
- /* @__PURE__ */ o(
1651
+ /* @__PURE__ */ i(
1638
1652
  "div",
1639
1653
  {
1640
1654
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
1641
1655
  style: { backgroundColor: "#F1F0EE" },
1642
1656
  children: [
1643
- l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1657
+ r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
1644
1658
  c.map((m) => /* @__PURE__ */ e(
1645
- xs,
1659
+ Cs,
1646
1660
  {
1647
1661
  question: m.question,
1648
1662
  onClick: () => s(m.id),
@@ -1654,59 +1668,59 @@ const us = ({
1654
1668
  }
1655
1669
  )
1656
1670
  ] }) });
1657
- }, ps = (t, s = {}) => {
1658
- const { initialSearch: n = "", pageSize: l = 20 } = s, [a, i] = E([]), [r, c] = E(!1), [m, x] = E(null), [k, h] = E(n), [f, y] = E(!0), [g, v] = E(), w = F(async (R = !1, _) => {
1659
- if (r) return;
1660
- const d = _ !== void 0 ? _ : k;
1661
- c(!0), x(null);
1671
+ }, Rs = (t, s = {}) => {
1672
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = v([]), [l, c] = v(!1), [m, g] = v(null), [y, h] = v(n), [f, S] = v(!0), [b, w] = v(), E = M(async (R = !1, F) => {
1673
+ if (l) return;
1674
+ const d = F !== void 0 ? F : y;
1675
+ c(!0), g(null);
1662
1676
  try {
1663
1677
  const u = await t.loadParticipants({
1664
1678
  search: d || void 0,
1665
- limit: l,
1666
- cursor: R ? void 0 : g
1679
+ limit: r,
1680
+ cursor: R ? void 0 : b
1667
1681
  });
1668
- i(
1669
- (N) => R ? u.participants : [...N, ...u.participants]
1670
- ), y(u.hasMore), v(u.nextCursor);
1682
+ o(
1683
+ (x) => R ? u.participants : [...x, ...u.participants]
1684
+ ), S(u.hasMore), w(u.nextCursor);
1671
1685
  } catch (u) {
1672
- const N = u instanceof Error ? u.message : "Failed to load participants";
1673
- x(N), console.error("[useParticipants] Load error:", u);
1686
+ const x = u instanceof Error ? u.message : "Failed to load participants";
1687
+ g(x), console.error("[useParticipants] Load error:", u);
1674
1688
  } finally {
1675
1689
  c(!1);
1676
1690
  }
1677
- }, [t, k, g, l, r]), b = F(() => {
1678
- f && !r && w(!1);
1679
- }, [f, r, w]), I = F((R) => {
1680
- h(R), v(void 0), w(!0, R);
1681
- }, [w]), S = F(() => {
1682
- v(void 0), w(!0);
1683
- }, [w]);
1691
+ }, [t, y, b, r, l]), N = M(() => {
1692
+ f && !l && E(!1);
1693
+ }, [f, l, E]), I = M((R) => {
1694
+ h(R), w(void 0), E(!0, R);
1695
+ }, [E]), k = M(() => {
1696
+ w(void 0), E(!0);
1697
+ }, [E]);
1684
1698
  return G(() => {
1685
- w(!0);
1699
+ E(!0);
1686
1700
  }, [t.loadParticipants]), {
1687
1701
  participants: a,
1688
- loading: r,
1702
+ loading: l,
1689
1703
  error: m,
1690
- searchQuery: k,
1704
+ searchQuery: y,
1691
1705
  hasMore: f,
1692
1706
  totalCount: t.totalCount,
1693
- loadMore: b,
1707
+ loadMore: N,
1694
1708
  search: I,
1695
- refresh: S
1709
+ refresh: k
1696
1710
  };
1697
1711
  };
1698
1712
  export {
1699
1713
  q as Avatar,
1700
- Ce as ChannelEmptyState,
1701
- Ke as ChannelList,
1702
- cs as ChannelView,
1703
- ks as FaqList,
1704
- xs as FaqListItem,
1705
- Is as MessagingProvider,
1714
+ cs as ChannelEmptyState,
1715
+ Ne as ChannelList,
1716
+ we as ChannelView,
1717
+ ps as FaqList,
1718
+ Cs as FaqListItem,
1719
+ ks as MessagingProvider,
1706
1720
  Ss as MessagingShell,
1707
- us as ParticipantPicker,
1708
- Ye as formatRelativeTime,
1709
- Ze as useMessaging,
1710
- ps as useParticipants
1721
+ fs as ParticipantPicker,
1722
+ es as formatRelativeTime,
1723
+ Xe as useMessaging,
1724
+ Rs as useParticipants
1711
1725
  };
1712
1726
  //# sourceMappingURL=index.js.map