@linktr.ee/messaging-react 1.11.4 โ†’ 1.11.5-rc-1765008275

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