@linktr.ee/messaging-react 1.9.1 → 1.9.3

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