@linktr.ee/messaging-react 1.8.4 โ†’ 1.8.5

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,9 +1,9 @@
1
- import { jsx as e, jsxs as d, Fragment as le } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as u, Fragment as le } from "react/jsx-runtime";
2
2
  import D from "classnames";
3
- import q, { createContext as Ie, useContext as Se, useCallback as P, useState as C, useRef as G, useEffect as H } from "react";
3
+ import q, { createContext as Ie, useContext as Se, useCallback as P, useState as w, useRef as $, useEffect as G } from "react";
4
4
  import { StreamChatService as Re } from "@linktr.ee/messaging-core";
5
5
  import { Chat as ke, ChannelList as Te, Channel as De, useChannelStateContext as me, Window as Fe, MessageList as Me, MessageInput as Ue } from "stream-chat-react";
6
- import { XIcon as he, ArrowLeftIcon as Pe, DotsThreeIcon as Oe, SpinnerGapIcon as ee, SignOutIcon as pe, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as je, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
6
+ import { XIcon as he, ArrowLeftIcon as Pe, DotsThreeIcon as pe, SpinnerGapIcon as ee, SignOutIcon as Oe, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as je, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
7
  const fe = Ie({
8
8
  service: null,
9
9
  client: null,
@@ -21,29 +21,29 @@ const fe = Ie({
21
21
  serviceConfig: n,
22
22
  apiKey: r,
23
23
  capabilities: a = {},
24
- customization: c = {},
25
- debug: i = !1
24
+ customization: d = {},
25
+ debug: c = !1
26
26
  }) => {
27
27
  const l = P(
28
- (v, ...F) => {
29
- i && console.log(`๐Ÿ”ฅ [MessagingProvider] ${v}`, ...F);
28
+ (b, ...F) => {
29
+ c && console.log(`๐Ÿ”ฅ [MessagingProvider] ${b}`, ...F);
30
30
  },
31
- [i]
31
+ [c]
32
32
  );
33
33
  l("๐Ÿ”„ RENDER START", {
34
34
  userId: s == null ? void 0 : s.id,
35
35
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
36
36
  serviceConfig: !!n,
37
37
  capabilities: Object.keys(a),
38
- customization: Object.keys(c)
38
+ customization: Object.keys(d)
39
39
  });
40
- const [o, E] = C(null), [b, u] = C(null), [f, I] = C(!1), [x, w] = C(!1), [m, k] = C(null), S = G(!1), y = G({
40
+ const [o, E] = w(null), [v, m] = w(null), [g, R] = w(!1), [x, C] = w(!1), [h, k] = w(null), I = $(!1), y = $({
41
41
  userId: s == null ? void 0 : s.id,
42
42
  apiKey: r,
43
43
  serviceConfig: n,
44
44
  capabilities: a,
45
- customization: c
46
- }), T = G(0);
45
+ customization: d
46
+ }), T = $(0);
47
47
  T.current++, l("๐Ÿ“Š RENDER INFO", {
48
48
  renderCount: T.current,
49
49
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
@@ -52,18 +52,18 @@ const fe = Ie({
52
52
  apiKeyChanged: y.current.apiKey !== r,
53
53
  serviceConfigChanged: y.current.serviceConfig !== n,
54
54
  capabilitiesChanged: y.current.capabilities !== a,
55
- customizationChanged: y.current.customization !== c
55
+ customizationChanged: y.current.customization !== d
56
56
  }
57
57
  }), y.current = {
58
58
  userId: s == null ? void 0 : s.id,
59
59
  apiKey: r,
60
60
  serviceConfig: n,
61
61
  capabilities: a,
62
- customization: c
63
- }, H(() => {
64
- const v = T.current;
62
+ customization: d
63
+ }, G(() => {
64
+ const b = T.current;
65
65
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
66
- renderCount: v,
66
+ renderCount: b,
67
67
  apiKey: !!r,
68
68
  serviceConfig: !!n,
69
69
  dependencies: {
@@ -74,46 +74,46 @@ const fe = Ie({
74
74
  }
75
75
  }), !r || !n) {
76
76
  l("โš ๏ธ SERVICE INIT SKIPPED", {
77
- renderCount: v,
77
+ renderCount: b,
78
78
  reason: "Missing apiKey or serviceConfig"
79
79
  });
80
80
  return;
81
81
  }
82
82
  l("๐Ÿš€ CREATING NEW SERVICE", {
83
- renderCount: v,
83
+ renderCount: b,
84
84
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
85
85
  serviceConfigChanged: y.current.serviceConfig !== n
86
86
  });
87
87
  const F = new Re({
88
88
  ...n,
89
89
  apiKey: r,
90
- debug: i
90
+ debug: c
91
91
  });
92
92
  return E(F), l("โœ… SERVICE SET", {
93
- renderCount: v,
93
+ renderCount: b,
94
94
  serviceInstance: !!F
95
95
  }), () => {
96
96
  l("๐Ÿงน SERVICE CLEANUP", {
97
- renderCount: v,
97
+ renderCount: b,
98
98
  reason: "Effect cleanup"
99
99
  }), F.disconnectUser().catch(console.error);
100
100
  };
101
- }, [r, n, i, l]);
102
- const U = G(null);
103
- H(() => {
101
+ }, [r, n, c, l]);
102
+ const U = $(null);
103
+ G(() => {
104
104
  var F, z;
105
105
  if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
106
106
  hasService: !!o,
107
107
  hasUser: !!s,
108
108
  userId: s == null ? void 0 : s.id,
109
- isConnecting: S.current,
110
- isConnected: f,
109
+ isConnecting: I.current,
110
+ isConnected: g,
111
111
  dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
112
112
  }), !o || !s) {
113
113
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
114
114
  return;
115
115
  }
116
- if (S.current) {
116
+ if (I.current) {
117
117
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
118
118
  return;
119
119
  }
@@ -125,40 +125,40 @@ const fe = Ie({
125
125
  return;
126
126
  }
127
127
  (async () => {
128
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), S.current = !0, w(!0), k(null);
128
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), I.current = !0, C(!0), k(null);
129
129
  try {
130
130
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
131
  const M = await o.connectUser(s);
132
- u(M), I(!0), U.current = { serviceId: o, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
132
+ m(M), R(!0), U.current = { serviceId: o, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
133
133
  userId: s.id,
134
134
  clientId: M.userID
135
135
  });
136
136
  } catch (M) {
137
- const A = M instanceof Error ? M.message : "Connection failed";
138
- k(A), l("โŒ USER CONNECTION ERROR", {
137
+ const B = M instanceof Error ? M.message : "Connection failed";
138
+ k(B), l("โŒ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
- error: A
140
+ error: B
141
141
  });
142
142
  } finally {
143
- w(!1), S.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
143
+ C(!1), I.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
144
144
  userId: s.id,
145
- isConnected: f
145
+ isConnected: g
146
146
  });
147
147
  }
148
148
  })();
149
- }, [o, s, l, f]), H(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
149
+ }, [o, s, l, g]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
150
150
  hasService: !!o,
151
- isConnected: f
151
+ isConnected: g
152
152
  }), () => {
153
- o && f ? (l(
153
+ o && g ? (l(
154
154
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
155
155
  "Cleaning up connection on unmount"
156
156
  ), U.current = null, o.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
157
157
  hasService: !!o,
158
- isConnected: f
158
+ isConnected: g
159
159
  });
160
- }), [o, f, l]);
161
- const h = P(async () => {
160
+ }), [o, g, l]);
161
+ const i = P(async () => {
162
162
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
163
163
  hasService: !!o,
164
164
  hasUser: !!s
@@ -166,67 +166,67 @@ const fe = Ie({
166
166
  l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
167
167
  return;
168
168
  }
169
- l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
169
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), C(!0);
170
170
  try {
171
171
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await o.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
172
- const v = await o.connectUser(s);
173
- u(v), I(!0), k(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
- } catch (v) {
175
- const F = v instanceof Error ? v.message : "Refresh failed";
172
+ const b = await o.connectUser(s);
173
+ m(b), R(!0), k(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
+ } catch (b) {
175
+ const F = b instanceof Error ? b.message : "Refresh failed";
176
176
  k(F), l("โŒ CONNECTION REFRESH ERROR", {
177
177
  userId: s.id,
178
178
  error: F
179
179
  });
180
180
  } finally {
181
- w(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
181
+ C(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
182
182
  }
183
- }, [o, s, l]), g = q.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
183
+ }, [o, s, l]), f = q.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
184
184
  hasService: !!o,
185
- hasClient: !!b,
186
- isConnected: f,
185
+ hasClient: !!v,
186
+ isConnected: g,
187
187
  isLoading: x,
188
- hasError: !!m,
188
+ hasError: !!h,
189
189
  capabilitiesKeys: Object.keys(a),
190
- customizationKeys: Object.keys(c)
190
+ customizationKeys: Object.keys(d)
191
191
  }), {
192
192
  service: o,
193
- client: b,
194
- isConnected: f,
193
+ client: v,
194
+ isConnected: g,
195
195
  isLoading: x,
196
- error: m,
196
+ error: h,
197
197
  capabilities: a,
198
- customization: c,
199
- refreshConnection: h,
200
- debug: i
198
+ customization: d,
199
+ refreshConnection: i,
200
+ debug: c
201
201
  }), [
202
202
  o,
203
- b,
204
- f,
203
+ v,
204
+ g,
205
205
  x,
206
- m,
207
- a,
208
- c,
209
206
  h,
207
+ a,
208
+ d,
210
209
  i,
210
+ c,
211
211
  l
212
212
  ]);
213
213
  return l("๐Ÿ”„ RENDER END", {
214
214
  renderCount: T.current,
215
- willRenderChat: !!(b && f),
216
- contextValueReady: !!g
217
- }), /* @__PURE__ */ e(fe.Provider, { value: g, children: b && f ? /* @__PURE__ */ e(ke, { client: b, children: t }) : t });
218
- }, Be = () => se(), Ae = (t, s) => {
215
+ willRenderChat: !!(v && g),
216
+ contextValueReady: !!f
217
+ }), /* @__PURE__ */ e(fe.Provider, { value: f, children: v && g ? /* @__PURE__ */ e(ke, { client: v, children: t }) : t });
218
+ }, _e = () => se(), Be = (t, s) => {
219
219
  const n = new Date(
220
220
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
221
221
  ), a = new Date(
222
222
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
223
223
  ).getTime() - n.getTime();
224
224
  return Math.floor(a / (1e3 * 60 * 60 * 24));
225
- }, $e = (t) => {
225
+ }, Ae = (t) => {
226
226
  const s = /* @__PURE__ */ new Date();
227
227
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
228
228
  return "Just now";
229
- const r = Ae(t, s);
229
+ const r = Be(t, s);
230
230
  return r === 0 ? t.toLocaleTimeString([], {
231
231
  hour: "numeric",
232
232
  minute: "2-digit"
@@ -263,7 +263,7 @@ const fe = Ie({
263
263
  "๐Ÿˆ"
264
264
  // Melon
265
265
  ];
266
- function Ge(t) {
266
+ function $e(t) {
267
267
  let s = 0;
268
268
  for (let n = 0; n < t.length; n++) {
269
269
  const r = t.charCodeAt(n);
@@ -271,8 +271,8 @@ function Ge(t) {
271
271
  }
272
272
  return Math.abs(s);
273
273
  }
274
- function He(t) {
275
- const n = Ge(t) % de.length;
274
+ function Ge(t) {
275
+ const n = $e(t) % de.length;
276
276
  return de[n];
277
277
  }
278
278
  const J = ({
@@ -281,7 +281,7 @@ const J = ({
281
281
  size: n = 40,
282
282
  className: r
283
283
  }) => {
284
- const a = He(t), i = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
284
+ const a = Ge(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
285
285
  return /* @__PURE__ */ e(
286
286
  "div",
287
287
  {
@@ -306,69 +306,74 @@ const J = ({
306
306
  "aria-hidden": "true",
307
307
  className: D(
308
308
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
309
- i
309
+ c
310
310
  ),
311
311
  children: a
312
312
  }
313
313
  )
314
314
  }
315
315
  );
316
- }, _e = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
317
- var w, m, k, S, y, T;
318
- const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
316
+ }, He = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
317
+ var h, k, I, y, T, U;
318
+ const d = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), c = () => {
319
319
  t && n(t);
320
- }, o = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
321
- (U) => {
322
- var h, g;
323
- return ((h = U.user) == null ? void 0 : h.id) && U.user.id !== ((g = t == null ? void 0 : t._client) == null ? void 0 : g.userID);
320
+ }, o = Object.values(((h = t == null ? void 0 : t.state) == null ? void 0 : h.members) || {}).find(
321
+ (i) => {
322
+ var f, b;
323
+ return ((f = i.user) == null ? void 0 : f.id) && i.user.id !== ((b = t == null ? void 0 : t._client) == null ? void 0 : b.userID);
324
324
  }
325
- ), E = ((m = o == null ? void 0 : o.user) == null ? void 0 : m.name) || "Conversation", b = (k = o == null ? void 0 : o.user) == null ? void 0 : k.image, u = (y = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : y[t.state.messages.length - 1], f = (u == null ? void 0 : u.text) || "No messages yet", I = u != null && u.created_at ? $e(new Date(u.created_at)) : "", x = a ?? 0;
325
+ ), E = ((k = o == null ? void 0 : o.user) == null ? void 0 : k.name) || "Conversation", v = (I = o == null ? void 0 : o.user) == null ? void 0 : I.image, m = (T = (y = t == null ? void 0 : t.state) == null ? void 0 : y.messages) == null ? void 0 : T[t.state.messages.length - 1], R = (() => {
326
+ var f;
327
+ if (m != null && m.text) return m.text;
328
+ const i = (f = m == null ? void 0 : m.attachments) == null ? void 0 : f[0];
329
+ return i != null && i.asset_url ? i.asset_url : i != null && i.image_url ? i.image_url : i != null && i.og_scrape_url ? i.og_scrape_url : i != null && i.thumb_url ? i.thumb_url : "No messages yet";
330
+ })(), x = m != null && m.created_at ? Ae(new Date(m.created_at)) : "", C = a ?? 0;
326
331
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
327
332
  channelId: t == null ? void 0 : t.id,
328
- isSelected: c,
333
+ isSelected: d,
329
334
  participantName: E,
330
- unreadCount: x,
331
- hasTimestamp: !!I
335
+ unreadCount: C,
336
+ hasTimestamp: !!x
332
337
  }), /* @__PURE__ */ e(
333
338
  "button",
334
339
  {
335
340
  type: "button",
336
- onClick: i,
341
+ onClick: c,
337
342
  className: D(
338
343
  "group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
339
344
  {
340
- "bg-primary-alt/10 border-l-4 border-l-primary": c,
341
- "hover:bg-sand": !c
345
+ "bg-primary-alt/10 border-l-4 border-l-primary": d,
346
+ "hover:bg-sand": !d
342
347
  }
343
348
  ),
344
- children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
349
+ children: /* @__PURE__ */ u("div", { className: "flex items-start gap-3", children: [
345
350
  /* @__PURE__ */ e(
346
351
  J,
347
352
  {
348
- id: ((T = o == null ? void 0 : o.user) == null ? void 0 : T.id) || t.id || "unknown",
353
+ id: ((U = o == null ? void 0 : o.user) == null ? void 0 : U.id) || t.id || "unknown",
349
354
  name: E,
350
- image: b,
355
+ image: v,
351
356
  size: 44,
352
357
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
353
358
  }
354
359
  ),
355
- /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
356
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
360
+ /* @__PURE__ */ u("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
361
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2", children: [
357
362
  /* @__PURE__ */ e(
358
363
  "h3",
359
364
  {
360
365
  className: D(
361
366
  "text-sm font-medium truncate",
362
- c ? "text-primary" : "text-charcoal"
367
+ d ? "text-primary" : "text-charcoal"
363
368
  ),
364
369
  children: E
365
370
  }
366
371
  ),
367
- I && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: I })
372
+ x && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: x })
368
373
  ] }),
369
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
370
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: f }),
371
- x > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: x > 99 ? "99+" : x })
374
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
375
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
376
+ C > 0 && /* @__PURE__ */ e("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: C > 99 ? "99+" : C })
372
377
  ] })
373
378
  ] })
374
379
  ] })
@@ -382,8 +387,8 @@ const J = ({
382
387
  }) => {
383
388
  const a = q.useRef(0);
384
389
  a.current++;
385
- const { debug: c = !1 } = se();
386
- return c && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
390
+ const { debug: d = !1 } = se();
391
+ return d && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
387
392
  renderCount: a.current,
388
393
  selectedChannelId: s == null ? void 0 : s.id,
389
394
  filters: n
@@ -394,7 +399,7 @@ const J = ({
394
399
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
395
400
  r
396
401
  ),
397
- children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (c && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
402
+ children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (d && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
398
403
  renderCount: a.current,
399
404
  filters: n
400
405
  }), /* @__PURE__ */ e(
@@ -403,19 +408,19 @@ const J = ({
403
408
  filters: n,
404
409
  sort: { last_message_at: -1 },
405
410
  options: { limit: 30 },
406
- Preview: (i) => {
411
+ Preview: (c) => {
407
412
  var l, o;
408
- return c && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
409
- channelId: (l = i.channel) == null ? void 0 : l.id,
413
+ return d && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
414
+ channelId: (l = c.channel) == null ? void 0 : l.id,
410
415
  selectedChannelId: s == null ? void 0 : s.id,
411
- isSelected: (s == null ? void 0 : s.id) === ((o = i.channel) == null ? void 0 : o.id)
416
+ isSelected: (s == null ? void 0 : s.id) === ((o = c.channel) == null ? void 0 : o.id)
412
417
  }), /* @__PURE__ */ e(
413
- _e,
418
+ He,
414
419
  {
415
- ...i,
420
+ ...c,
416
421
  selectedChannel: s,
417
422
  onChannelSelect: t,
418
- debug: c
423
+ debug: d
419
424
  }
420
425
  );
421
426
  }
@@ -443,7 +448,7 @@ const J = ({
443
448
  }
444
449
  );
445
450
  function oe({ label: t, className: s, children: n, ...r }) {
446
- return /* @__PURE__ */ d(
451
+ return /* @__PURE__ */ u(
447
452
  "button",
448
453
  {
449
454
  type: "button",
@@ -466,22 +471,22 @@ function oe({ label: t, className: s, children: n, ...r }) {
466
471
  function ge({ onClick: t }) {
467
472
  return /* @__PURE__ */ e(oe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
468
473
  }
469
- const xe = () => /* @__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: [
474
+ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
470
475
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet ๐Ÿ‘€" }),
471
476
  /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
472
- ] }) }), We = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
477
+ ] }) }), We = ({ renderActions: t }) => /* @__PURE__ */ u("div", { className: "message-input flex items-center gap-2 p-4", children: [
473
478
  t && t(),
474
479
  /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Ue, { focus: !0, maxRows: 4 }) })
475
480
  ] }), ze = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
476
- var o, E, b, u;
477
- const { channel: a } = me(), c = q.useMemo(() => Object.values(a.state.members || {}).find(
478
- (I) => {
481
+ var o, E, v, m;
482
+ const { channel: a } = me(), d = q.useMemo(() => Object.values(a.state.members || {}).find(
483
+ (R) => {
479
484
  var x;
480
- return ((x = I.user) == null ? void 0 : x.id) && I.user.id !== a._client.userID;
485
+ return ((x = R.user) == null ? void 0 : x.id) && R.user.id !== a._client.userID;
481
486
  }
482
- ), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((E = c == null ? void 0 : c.user) == null ? void 0 : E.id) || "Unknown member", l = (b = c == null ? void 0 : c.user) == null ? void 0 : b.image;
483
- return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
484
- /* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
487
+ ), [a._client.userID, a.state.members]), c = ((o = d == null ? void 0 : d.user) == null ? void 0 : o.name) || ((E = d == null ? void 0 : d.user) == null ? void 0 : E.id) || "Unknown member", l = (v = d == null ? void 0 : d.user) == null ? void 0 : v.image;
488
+ return /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
489
+ /* @__PURE__ */ u("div", { className: "flex items-center gap-3 min-w-0", children: [
485
490
  s && t && /* @__PURE__ */ e(
486
491
  "button",
487
492
  {
@@ -495,15 +500,15 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
495
500
  /* @__PURE__ */ e(
496
501
  J,
497
502
  {
498
- id: ((u = c == null ? void 0 : c.user) == null ? void 0 : u.id) || a.id || "unknown",
499
- name: i,
503
+ id: ((m = d == null ? void 0 : d.user) == null ? void 0 : m.id) || a.id || "unknown",
504
+ name: c,
500
505
  image: l,
501
506
  size: 40
502
507
  }
503
508
  ),
504
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: i }) })
509
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: c }) })
505
510
  ] }),
506
- r && n && /* @__PURE__ */ e(oe, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Oe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
511
+ r && n && /* @__PURE__ */ e(oe, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(pe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
507
512
  ] });
508
513
  }, qe = ({
509
514
  isOpen: t,
@@ -511,71 +516,71 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
511
516
  participant: n,
512
517
  channel: r,
513
518
  followerStatusLabel: a,
514
- onLeaveConversation: c,
515
- onBlockParticipant: i
519
+ onLeaveConversation: d,
520
+ onBlockParticipant: c
516
521
  }) => {
517
- var M, A, Y, _, V, Q, W;
518
- const { service: l, debug: o } = se(), E = G(null), [b, u] = C(!1), [f, I] = C(!1), [x, w] = C(!1);
519
- H(() => {
520
- const R = E.current;
521
- R && (t ? R.showModal() : R.close());
522
+ var M, B, Y, H, V, Q, W;
523
+ const { service: l, debug: o } = se(), E = $(null), [v, m] = w(!1), [g, R] = w(!1), [x, C] = w(!1);
524
+ G(() => {
525
+ const S = E.current;
526
+ S && (t ? S.showModal() : S.close());
522
527
  }, [t]);
523
- const m = P(async () => {
524
- var R;
525
- if (!(!l || !((R = n == null ? void 0 : n.user) != null && R.id)))
528
+ const h = P(async () => {
529
+ var S;
530
+ if (!(!l || !((S = n == null ? void 0 : n.user) != null && S.id)))
526
531
  try {
527
532
  const j = (await l.getBlockedUsers()).some(
528
- (B) => {
533
+ (_) => {
529
534
  var X;
530
- return B.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
535
+ return _.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
531
536
  }
532
537
  );
533
- u(j);
534
- } catch (p) {
538
+ m(j);
539
+ } catch (O) {
535
540
  console.error(
536
541
  "[ChannelInfoDialog] Failed to check blocked status:",
537
- p
542
+ O
538
543
  );
539
544
  }
540
545
  }, [l, (M = n == null ? void 0 : n.user) == null ? void 0 : M.id]);
541
- H(() => {
542
- t && m();
543
- }, [t, m]);
546
+ G(() => {
547
+ t && h();
548
+ }, [t, h]);
544
549
  const k = async () => {
545
- var R;
546
- if (!f) {
547
- o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), I(!0);
550
+ var S;
551
+ if (!g) {
552
+ o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), R(!0);
548
553
  try {
549
- const p = ((R = r._client) == null ? void 0 : R.userID) ?? null;
550
- await r.hide(p, !1), c && await c(r), s();
551
- } catch (p) {
552
- console.error("[ChannelInfoDialog] Failed to leave conversation", p);
554
+ const O = ((S = r._client) == null ? void 0 : S.userID) ?? null;
555
+ await r.hide(O, !1), d && await d(r), s();
556
+ } catch (O) {
557
+ console.error("[ChannelInfoDialog] Failed to leave conversation", O);
553
558
  } finally {
554
- I(!1);
559
+ R(!1);
555
560
  }
556
561
  }
557
- }, S = async () => {
558
- var R, p, j;
562
+ }, I = async () => {
563
+ var S, O, j;
559
564
  if (!(x || !l)) {
560
- o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), w(!0);
565
+ o && console.log("[ChannelInfoDialog] Block member", (S = n == null ? void 0 : n.user) == null ? void 0 : S.id), C(!0);
561
566
  try {
562
- await l.blockUser((p = n == null ? void 0 : n.user) == null ? void 0 : p.id), i && await i((j = n == null ? void 0 : n.user) == null ? void 0 : j.id), s();
563
- } catch (B) {
564
- console.error("[ChannelInfoDialog] Failed to block member", B);
567
+ await l.blockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), c && await c((j = n == null ? void 0 : n.user) == null ? void 0 : j.id), s();
568
+ } catch (_) {
569
+ console.error("[ChannelInfoDialog] Failed to block member", _);
565
570
  } finally {
566
- w(!1);
571
+ C(!1);
567
572
  }
568
573
  }
569
574
  }, y = async () => {
570
- var R, p, j;
575
+ var S, O, j;
571
576
  if (!(x || !l)) {
572
- o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), w(!0);
577
+ o && console.log("[ChannelInfoDialog] Unblock member", (S = n == null ? void 0 : n.user) == null ? void 0 : S.id), C(!0);
573
578
  try {
574
- await l.unBlockUser((p = n == null ? void 0 : n.user) == null ? void 0 : p.id), i && await i((j = n == null ? void 0 : n.user) == null ? void 0 : j.id), s();
575
- } catch (B) {
576
- console.error("[ChannelInfoDialog] Failed to unblock member", B);
579
+ await l.unBlockUser((O = n == null ? void 0 : n.user) == null ? void 0 : O.id), c && await c((j = n == null ? void 0 : n.user) == null ? void 0 : j.id), s();
580
+ } catch (_) {
581
+ console.error("[ChannelInfoDialog] Failed to unblock member", _);
577
582
  } finally {
578
- w(!1);
583
+ C(!1);
579
584
  }
580
585
  }
581
586
  }, T = () => {
@@ -586,7 +591,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
586
591
  );
587
592
  };
588
593
  if (!n) return null;
589
- const U = ((A = n.user) == null ? void 0 : A.name) || ((Y = n.user) == null ? void 0 : Y.id) || "Unknown member", h = (_ = n.user) == null ? void 0 : _.image, g = (V = n.user) == null ? void 0 : V.email, v = (Q = n.user) == null ? void 0 : Q.username, F = g || (v ? `linktr.ee/${v}` : void 0), z = ((W = n.user) == null ? void 0 : W.id) || "unknown";
594
+ const U = ((B = n.user) == null ? void 0 : B.name) || ((Y = n.user) == null ? void 0 : Y.id) || "Unknown member", i = (H = n.user) == null ? void 0 : H.image, f = (V = n.user) == null ? void 0 : V.email, b = (Q = n.user) == null ? void 0 : Q.username, F = f || (b ? `linktr.ee/${b}` : void 0), z = ((W = n.user) == null ? void 0 : W.id) || "unknown";
590
595
  return (
591
596
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
592
597
  /* @__PURE__ */ e(
@@ -595,32 +600,32 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
595
600
  ref: E,
596
601
  className: "mes-dialog",
597
602
  onClose: s,
598
- onClick: (R) => {
599
- R.target === E.current && s();
603
+ onClick: (S) => {
604
+ S.target === E.current && s();
600
605
  },
601
- children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
602
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
606
+ children: /* @__PURE__ */ u("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
607
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
603
608
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
604
609
  /* @__PURE__ */ e(ge, { onClick: s })
605
610
  ] }),
606
- /* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
611
+ /* @__PURE__ */ u("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
607
612
  /* @__PURE__ */ e(
608
613
  "div",
609
614
  {
610
615
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
611
616
  style: { backgroundColor: "#FBFAF9" },
612
- children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
617
+ children: /* @__PURE__ */ u("div", { className: "flex items-center gap-3 w-full", children: [
613
618
  /* @__PURE__ */ e(
614
619
  J,
615
620
  {
616
621
  id: z,
617
622
  name: U,
618
- image: h,
623
+ image: i,
619
624
  size: 88,
620
625
  className: "!rounded-full"
621
626
  }
622
627
  ),
623
- /* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
628
+ /* @__PURE__ */ u("div", { className: "flex flex-col min-w-0 flex-1", children: [
624
629
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: U }),
625
630
  F && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: F }),
626
631
  a && /* @__PURE__ */ e(
@@ -641,20 +646,20 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
641
646
  ] })
642
647
  }
643
648
  ),
644
- /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
645
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
649
+ /* @__PURE__ */ u("ul", { className: "flex flex-col gap-2 mt-2", children: [
650
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(
646
651
  K,
647
652
  {
648
653
  onClick: k,
649
- disabled: f,
650
- "aria-busy": f,
654
+ disabled: g,
655
+ "aria-busy": g,
651
656
  children: [
652
- f ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(pe, { className: "h-5 w-5" }),
657
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Oe, { className: "h-5 w-5" }),
653
658
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
654
659
  ]
655
660
  }
656
661
  ) }),
657
- /* @__PURE__ */ e("li", { children: b ? /* @__PURE__ */ d(
662
+ /* @__PURE__ */ e("li", { children: v ? /* @__PURE__ */ u(
658
663
  K,
659
664
  {
660
665
  onClick: y,
@@ -665,10 +670,10 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
665
670
  /* @__PURE__ */ e("span", { children: "Unblock" })
666
671
  ]
667
672
  }
668
- ) : /* @__PURE__ */ d(
673
+ ) : /* @__PURE__ */ u(
669
674
  K,
670
675
  {
671
- onClick: S,
676
+ onClick: I,
672
677
  disabled: x,
673
678
  "aria-busy": x,
674
679
  children: [
@@ -677,7 +682,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
677
682
  ]
678
683
  }
679
684
  ) }),
680
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: T, children: [
685
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(K, { variant: "danger", onClick: T, children: [
681
686
  /* @__PURE__ */ e(Le, { className: "h-5 w-5" }),
682
687
  /* @__PURE__ */ e("span", { children: "Report" })
683
688
  ] }) })
@@ -693,40 +698,40 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
693
698
  renderMessageInputActions: n,
694
699
  onLeaveConversation: r,
695
700
  onBlockParticipant: a,
696
- CustomChannelEmptyState: c = xe
701
+ CustomChannelEmptyState: d = xe
697
702
  }) => {
698
- var f, I;
699
- const { channel: i } = me(), [l, o] = C(!1), E = (((I = (f = i == null ? void 0 : i.state) == null ? void 0 : f.messages) == null ? void 0 : I.length) ?? 0) > 0, b = q.useMemo(() => Object.values(i.state.members || {}).find(
700
- (w) => {
701
- var m;
702
- return ((m = w.user) == null ? void 0 : m.id) && w.user.id !== i._client.userID;
703
+ var g, R;
704
+ const { channel: c } = me(), [l, o] = w(!1), E = (((R = (g = c == null ? void 0 : c.state) == null ? void 0 : g.messages) == null ? void 0 : R.length) ?? 0) > 0, v = q.useMemo(() => Object.values(c.state.members || {}).find(
705
+ (C) => {
706
+ var h;
707
+ return ((h = C.user) == null ? void 0 : h.id) && C.user.id !== c._client.userID;
703
708
  }
704
- ), [i._client.userID, i.state.members]), u = q.useMemo(() => {
705
- const x = i.data ?? {};
709
+ ), [c._client.userID, c.state.members]), m = q.useMemo(() => {
710
+ const x = c.data ?? {};
706
711
  if (x.followerStatus)
707
712
  return String(x.followerStatus);
708
713
  if (x.isFollower !== void 0)
709
714
  return x.isFollower ? "Subscribed to you" : "Not subscribed";
710
- }, [i.data]);
711
- return /* @__PURE__ */ d(le, { children: [
712
- /* @__PURE__ */ d(Fe, { children: [
715
+ }, [c.data]);
716
+ return /* @__PURE__ */ u(le, { children: [
717
+ /* @__PURE__ */ u(Fe, { children: [
713
718
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
714
719
  ze,
715
720
  {
716
721
  onBack: t,
717
722
  showBackButton: s,
718
723
  onShowInfo: () => o(!0),
719
- canShowInfo: !!b
724
+ canShowInfo: !!v
720
725
  }
721
726
  ) }),
722
- /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
727
+ /* @__PURE__ */ u("div", { className: "flex-1 overflow-hidden relative", children: [
723
728
  /* @__PURE__ */ e(Me, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
724
- !E && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full bg-white", children: /* @__PURE__ */ e(c, {}) })
729
+ !E && d && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full bg-white", children: /* @__PURE__ */ e(d, {}) })
725
730
  ] }),
726
731
  /* @__PURE__ */ e(
727
732
  We,
728
733
  {
729
- renderActions: () => n == null ? void 0 : n(i)
734
+ renderActions: () => n == null ? void 0 : n(c)
730
735
  }
731
736
  )
732
737
  ] }),
@@ -735,9 +740,9 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
735
740
  {
736
741
  isOpen: l,
737
742
  onClose: () => o(!1),
738
- participant: b,
739
- channel: i,
740
- followerStatusLabel: u,
743
+ participant: v,
744
+ channel: c,
745
+ followerStatusLabel: m,
741
746
  onLeaveConversation: r,
742
747
  onBlockParticipant: a
743
748
  }
@@ -749,15 +754,15 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
749
754
  showBackButton: n = !1,
750
755
  renderMessageInputActions: r,
751
756
  onLeaveConversation: a,
752
- onBlockParticipant: c,
753
- className: i,
757
+ onBlockParticipant: d,
758
+ className: c,
754
759
  CustomChannelEmptyState: l = xe
755
760
  }) => /* @__PURE__ */ e(
756
761
  "div",
757
762
  {
758
763
  className: D(
759
764
  "messaging-channel-view h-full flex flex-col",
760
- i
765
+ c
761
766
  ),
762
767
  children: /* @__PURE__ */ e(De, { channel: t, children: /* @__PURE__ */ e(
763
768
  Ye,
@@ -766,7 +771,7 @@ const xe = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-
766
771
  showBackButton: n,
767
772
  renderMessageInputActions: r,
768
773
  onLeaveConversation: a,
769
- onBlockParticipant: c,
774
+ onBlockParticipant: d,
770
775
  CustomChannelEmptyState: l
771
776
  }
772
777
  ) })
@@ -777,8 +782,8 @@ function Qe({
777
782
  setSearchQuery: s,
778
783
  placeholder: n
779
784
  }) {
780
- const r = G(null);
781
- return /* @__PURE__ */ d("div", { className: "relative", children: [
785
+ const r = $(null);
786
+ return /* @__PURE__ */ u("div", { className: "relative", children: [
782
787
  /* @__PURE__ */ e(
783
788
  je,
784
789
  {
@@ -817,67 +822,67 @@ const Xe = ({
817
822
  onClose: n,
818
823
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
819
824
  participantLabel: a = "participants",
820
- searchPlaceholder: c = "Search participants...",
821
- className: i
825
+ searchPlaceholder: d = "Search participants...",
826
+ className: c
822
827
  }) => {
823
- const { debug: l } = se(), [o, E] = C(""), [b, u] = C([]), [f, I] = C(!1), [x, w] = C(null), [m, k] = C(
828
+ const { debug: l } = se(), [o, E] = w(""), [v, m] = w([]), [g, R] = w(!1), [x, C] = w(null), [h, k] = w(
824
829
  null
825
- ), S = G(!1);
826
- H(() => {
830
+ ), I = $(!1);
831
+ G(() => {
827
832
  if (t.loading) {
828
833
  l && console.log(
829
834
  "[ParticipantPicker] Waiting for participant source to finish loading..."
830
835
  );
831
836
  return;
832
837
  }
833
- if (S.current) return;
838
+ if (I.current) return;
834
839
  (async () => {
835
- l && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), w(null);
840
+ l && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), C(null);
836
841
  try {
837
- const g = await t.loadParticipants({
842
+ const f = await t.loadParticipants({
838
843
  search: "",
839
844
  // Load all participants initially
840
845
  limit: 100
841
846
  });
842
- u(g.participants), S.current = !0, l && console.log(
847
+ m(f.participants), I.current = !0, l && console.log(
843
848
  "[ParticipantPicker] Participants loaded successfully:",
844
- g.participants.length
849
+ f.participants.length
845
850
  );
846
- } catch (g) {
847
- const v = g instanceof Error ? g.message : "Failed to load participants";
848
- w(v), console.error("[ParticipantPicker] Failed to load participants:", g);
851
+ } catch (f) {
852
+ const b = f instanceof Error ? f.message : "Failed to load participants";
853
+ C(b), console.error("[ParticipantPicker] Failed to load participants:", f);
849
854
  } finally {
850
- I(!1);
855
+ R(!1);
851
856
  }
852
857
  })();
853
858
  }, [t.loading, l]);
854
- const y = b.filter((h) => !r.has(h.id)).filter((h) => {
855
- var v;
859
+ const y = v.filter((i) => !r.has(i.id)).filter((i) => {
860
+ var b;
856
861
  if (!o) return !0;
857
- const g = o.toLowerCase();
858
- return h.name.toLowerCase().includes(g) || ((v = h.email) == null ? void 0 : v.toLowerCase().includes(g)) || !1;
862
+ const f = o.toLowerCase();
863
+ return i.name.toLowerCase().includes(f) || ((b = i.email) == null ? void 0 : b.toLowerCase().includes(f)) || !1;
859
864
  }), T = P(
860
- async (h) => {
861
- if (!m) {
862
- k(h.id);
865
+ async (i) => {
866
+ if (!h) {
867
+ k(i.id);
863
868
  try {
864
- await s(h);
865
- } catch (g) {
866
- console.error("[ParticipantPicker] Failed to start chat:", g), k(null);
869
+ await s(i);
870
+ } catch (f) {
871
+ console.error("[ParticipantPicker] Failed to start chat:", f), k(null);
867
872
  }
868
873
  }
869
874
  },
870
- [s, m]
871
- ), U = (h, g) => {
872
- (h.key === "Enter" || h.key === " ") && (h.preventDefault(), T(g));
875
+ [s, h]
876
+ ), U = (i, f) => {
877
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), T(f));
873
878
  };
874
- return /* @__PURE__ */ d("div", { className: D("flex flex-col h-full", i), children: [
875
- /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
876
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
879
+ return /* @__PURE__ */ u("div", { className: D("flex flex-col h-full", c), children: [
880
+ /* @__PURE__ */ u("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
881
+ /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-3", children: [
877
882
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
878
883
  /* @__PURE__ */ e(ge, { onClick: n })
879
884
  ] }),
880
- /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
885
+ /* @__PURE__ */ u("p", { className: "text-xs text-stone mb-3", children: [
881
886
  "Select a ",
882
887
  a.slice(0, -1),
883
888
  " to start messaging (",
@@ -890,77 +895,77 @@ const Xe = ({
890
895
  {
891
896
  searchQuery: o,
892
897
  setSearchQuery: E,
893
- placeholder: c
898
+ placeholder: d
894
899
  }
895
900
  )
896
901
  ] }),
897
- x && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
902
+ x && /* @__PURE__ */ u("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
898
903
  "Error loading ",
899
904
  a,
900
905
  ": ",
901
906
  x
902
907
  ] }),
903
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && y.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: [
908
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: g && y.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
904
909
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
905
- /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
910
+ /* @__PURE__ */ u("span", { className: "text-sm text-stone", children: [
906
911
  "Loading ",
907
912
  a,
908
913
  "..."
909
914
  ] })
910
- ] }) }) : y.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
915
+ ] }) }) : y.length === 0 ? /* @__PURE__ */ u("div", { className: "p-6 text-center", children: [
911
916
  /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ce, { className: "h-8 w-8 text-charcoal" }) }),
912
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : b.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
913
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : b.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
914
- ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
915
- y.map((h) => {
916
- const g = h.name || h.email || h.id, v = h.email && h.name ? h.email : h.phone;
917
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : v.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
918
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
919
+ ] }) : /* @__PURE__ */ u("ul", { className: "space-y-0", children: [
920
+ y.map((i) => {
921
+ const f = i.name || i.email || i.id, b = i.email && i.name ? i.email : i.phone;
917
922
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
918
923
  "button",
919
924
  {
920
925
  type: "button",
921
- onClick: () => T(h),
922
- onKeyDown: (F) => U(F, h),
926
+ onClick: () => T(i),
927
+ onKeyDown: (F) => U(F, i),
923
928
  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",
924
- children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
925
- /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
929
+ children: /* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
930
+ /* @__PURE__ */ u("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
926
931
  /* @__PURE__ */ e(
927
932
  J,
928
933
  {
929
- id: h.id,
930
- name: g,
931
- image: h.image,
934
+ id: i.id,
935
+ name: f,
936
+ image: i.image,
932
937
  size: 40
933
938
  }
934
939
  ),
935
- /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
936
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: g }),
937
- v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
940
+ /* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
941
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: f }),
942
+ b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
938
943
  ] })
939
944
  ] }),
940
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: m === h.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
945
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: h === i.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
941
946
  ] })
942
947
  }
943
- ) }, h.id);
948
+ ) }, i.id);
944
949
  }),
945
- f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
950
+ g && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
946
951
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
947
952
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
948
953
  ] }) })
949
954
  ] }) })
950
955
  ] });
951
- }, Ze = ({ 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: [
956
+ }, Ze = ({ 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__ */ u("div", { className: "text-center max-w-sm", children: [
952
957
  /* @__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: "๐Ÿ’ฌ" }) }),
953
958
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
954
- /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(le, { children: [
959
+ /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ u(le, { children: [
955
960
  "Choose a conversation from the list or",
956
961
  " ",
957
- s && /* @__PURE__ */ d(ue, { onClick: s, children: [
962
+ s && /* @__PURE__ */ u(ue, { onClick: s, children: [
958
963
  "start a new conversation with a ",
959
964
  n.slice(0, -1),
960
965
  "."
961
966
  ] })
962
- ] }) : s && /* @__PURE__ */ d(le, { children: [
963
- /* @__PURE__ */ d(ue, { onClick: s, children: [
967
+ ] }) : s && /* @__PURE__ */ u(le, { children: [
968
+ /* @__PURE__ */ u(ue, { onClick: s, children: [
964
969
  "Start a new conversation with one of your ",
965
970
  n
966
971
  ] }),
@@ -978,7 +983,7 @@ const Xe = ({
978
983
  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",
979
984
  children: s
980
985
  }
981
- ), 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: [
986
+ ), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
982
987
  /* @__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: "โš ๏ธ" }) }),
983
988
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
984
989
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -991,12 +996,12 @@ const Xe = ({
991
996
  children: "Go Back"
992
997
  }
993
998
  )
994
- ] }) }), Ke = ({ className: t, message: s }) => /* @__PURE__ */ d(
999
+ ] }) }), Ke = ({ className: t, message: s }) => /* @__PURE__ */ u(
995
1000
  "div",
996
1001
  {
997
1002
  className: D("flex items-center justify-center h-full", t),
998
1003
  children: [
999
- /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1004
+ /* @__PURE__ */ u("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1000
1005
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1001
1006
  "animateTransform",
1002
1007
  {
@@ -1034,7 +1039,7 @@ const Xe = ({
1034
1039
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1035
1040
  ]
1036
1041
  }
1037
- ), es = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1042
+ ), es = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ u("div", { className: "flex items-center", children: [
1038
1043
  /* @__PURE__ */ e(Ke, { className: "w-6 h-6" }),
1039
1044
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1040
1045
  ] }) }), cs = ({
@@ -1043,26 +1048,26 @@ const Xe = ({
1043
1048
  renderMessageInputActions: n,
1044
1049
  onChannelSelect: r,
1045
1050
  onParticipantSelect: a,
1046
- initialParticipantFilter: c,
1047
- initialParticipantData: i,
1051
+ initialParticipantFilter: d,
1052
+ initialParticipantData: c,
1048
1053
  CustomChannelEmptyState: l,
1049
1054
  showChannelList: o = !0,
1050
1055
  filters: E
1051
1056
  }) => {
1052
1057
  const {
1053
- service: b,
1054
- client: u,
1055
- isConnected: f,
1056
- isLoading: I,
1058
+ service: v,
1059
+ client: m,
1060
+ isConnected: g,
1061
+ isLoading: R,
1057
1062
  error: x,
1058
- refreshConnection: w,
1059
- debug: m
1060
- } = Be(), [k, S] = C(null), [y, T] = C(!1), [U, h] = C(!1), [g, v] = C(/* @__PURE__ */ new Set()), [F, z] = C(0), [M, A] = C(!1), [Y, _] = C(null), V = G(null), {
1063
+ refreshConnection: C,
1064
+ debug: h
1065
+ } = _e(), [k, I] = w(null), [y, T] = w(!1), [U, i] = w(!1), [f, b] = w(/* @__PURE__ */ new Set()), [F, z] = w(0), [M, B] = w(!1), [Y, H] = w(null), V = $(null), {
1061
1066
  showStartConversation: Q = !1,
1062
1067
  participantSource: W,
1063
- participantLabel: R = "participants"
1064
- } = t, p = q.useMemo(() => {
1065
- const N = u == null ? void 0 : u.userID;
1068
+ participantLabel: S = "participants"
1069
+ } = t, O = q.useMemo(() => {
1070
+ const N = m == null ? void 0 : m.userID;
1066
1071
  return {
1067
1072
  ...{
1068
1073
  type: "messaging",
@@ -1074,164 +1079,164 @@ const Xe = ({
1074
1079
  },
1075
1080
  ...E
1076
1081
  };
1077
- }, [E, u == null ? void 0 : u.userID]), j = G(null), B = P(async () => {
1078
- if (!u || !f) return;
1079
- const N = u.userID;
1082
+ }, [E, m == null ? void 0 : m.userID]), j = $(null), _ = P(async () => {
1083
+ if (!m || !g) return;
1084
+ const N = m.userID;
1080
1085
  if (N)
1081
1086
  try {
1082
- m && console.log("[MessagingShell] Syncing channels for user:", N);
1083
- const L = await u.queryChannels(
1087
+ h && console.log("[MessagingShell] Syncing channels for user:", N);
1088
+ const L = await m.queryChannels(
1084
1089
  {
1085
1090
  type: "messaging",
1086
1091
  members: { $in: [N] }
1087
1092
  },
1088
1093
  {},
1089
1094
  { limit: 100 }
1090
- ), O = /* @__PURE__ */ new Set();
1091
- L.forEach(($) => {
1092
- const Ee = $.state.members;
1095
+ ), p = /* @__PURE__ */ new Set();
1096
+ L.forEach((A) => {
1097
+ const Ee = A.state.members;
1093
1098
  Object.values(Ee).forEach((ye) => {
1094
1099
  var ae;
1095
1100
  const te = (ae = ye.user) == null ? void 0 : ae.id;
1096
- te && te !== N && O.add(te);
1101
+ te && te !== N && p.add(te);
1097
1102
  });
1098
- }), v(O), T(L.length > 0), j.current = N, m && console.log("[MessagingShell] Channels synced successfully:", {
1103
+ }), b(p), T(L.length > 0), j.current = N, h && console.log("[MessagingShell] Channels synced successfully:", {
1099
1104
  channelCount: L.length,
1100
- memberCount: O.size
1105
+ memberCount: p.size
1101
1106
  });
1102
1107
  } catch (L) {
1103
1108
  console.error("[MessagingShell] Failed to sync channels:", L);
1104
1109
  }
1105
- }, [u, f, m]);
1106
- H(() => {
1107
- if (!u || !f) return;
1108
- const N = u.userID;
1109
- N && j.current !== N && B();
1110
- }, [u, f, B]), H(() => {
1111
- if (!c || !u || !f) return;
1110
+ }, [m, g, h]);
1111
+ G(() => {
1112
+ if (!m || !g) return;
1113
+ const N = m.userID;
1114
+ N && j.current !== N && _();
1115
+ }, [m, g, _]), G(() => {
1116
+ if (!d || !m || !g) return;
1112
1117
  (async () => {
1113
- const L = u.userID;
1118
+ const L = m.userID;
1114
1119
  if (L)
1115
1120
  try {
1116
- m && console.log(
1121
+ h && console.log(
1117
1122
  "[MessagingShell] Loading initial conversation with:",
1118
- c
1123
+ d
1119
1124
  );
1120
- const O = await u.queryChannels(
1125
+ const p = await m.queryChannels(
1121
1126
  {
1122
1127
  type: "messaging",
1123
- members: { $eq: [L, c] }
1128
+ members: { $eq: [L, d] }
1124
1129
  },
1125
1130
  {},
1126
1131
  { limit: 1 }
1127
1132
  );
1128
- if (O.length > 0)
1129
- S(O[0]), A(!0), _(null), r && r(O[0]), m && console.log(
1133
+ if (p.length > 0)
1134
+ I(p[0]), B(!0), H(null), r && r(p[0]), h && console.log(
1130
1135
  "[MessagingShell] Initial conversation loaded:",
1131
- O[0].id
1136
+ p[0].id
1132
1137
  );
1133
- else if (i && b) {
1134
- m && console.log(
1138
+ else if (c && v) {
1139
+ h && console.log(
1135
1140
  "[MessagingShell] No conversation found, creating one for:",
1136
- i
1141
+ c
1137
1142
  );
1138
1143
  try {
1139
- const $ = await b.startChannelWithParticipant({
1140
- id: i.id,
1141
- name: i.name,
1142
- email: i.email,
1143
- phone: i.phone
1144
+ const A = await v.startChannelWithParticipant({
1145
+ id: c.id,
1146
+ name: c.name,
1147
+ email: c.email,
1148
+ phone: c.phone
1144
1149
  });
1145
- S($), A(!0), _(null), r && r($), m && console.log(
1150
+ I(A), B(!0), H(null), r && r(A), h && console.log(
1146
1151
  "[MessagingShell] Channel created and loaded:",
1147
- $.id
1152
+ A.id
1148
1153
  );
1149
- } catch ($) {
1154
+ } catch (A) {
1150
1155
  console.error(
1151
1156
  "[MessagingShell] Failed to create conversation:",
1152
- $
1153
- ), _("Failed to create conversation");
1157
+ A
1158
+ ), H("Failed to create conversation");
1154
1159
  }
1155
1160
  } else
1156
- _(
1161
+ H(
1157
1162
  "No conversation found with this account"
1158
- ), m && console.log(
1163
+ ), h && console.log(
1159
1164
  "[MessagingShell] No conversation found for:",
1160
- c
1165
+ d
1161
1166
  );
1162
- } catch (O) {
1167
+ } catch (p) {
1163
1168
  console.error(
1164
1169
  "[MessagingShell] Failed to load initial conversation:",
1165
- O
1166
- ), _("Failed to load conversation");
1170
+ p
1171
+ ), H("Failed to load conversation");
1167
1172
  }
1168
1173
  })();
1169
1174
  }, [
1175
+ d,
1170
1176
  c,
1171
- i,
1172
- u,
1173
- f,
1174
- b,
1175
1177
  m,
1178
+ g,
1179
+ v,
1180
+ h,
1176
1181
  r
1177
1182
  ]);
1178
1183
  const X = P(
1179
1184
  (N) => {
1180
- S(N), r == null || r(N);
1185
+ I(N), r == null || r(N);
1181
1186
  },
1182
1187
  [r]
1183
1188
  ), Ne = P(() => {
1184
- M || S(null);
1189
+ M || I(null);
1185
1190
  }, [M]), be = P(() => {
1186
1191
  var N;
1187
- W && (z((L) => L + 1), h(!0), (N = V.current) == null || N.showModal());
1192
+ W && (z((L) => L + 1), i(!0), (N = V.current) == null || N.showModal());
1188
1193
  }, [W]), ve = P(
1189
1194
  async (N) => {
1190
1195
  var L;
1191
- if (b)
1196
+ if (v)
1192
1197
  try {
1193
- m && console.log(
1198
+ h && console.log(
1194
1199
  "[MessagingShell] Starting conversation with:",
1195
1200
  N.id
1196
1201
  );
1197
- const O = await b.startChannelWithParticipant({
1202
+ const p = await v.startChannelWithParticipant({
1198
1203
  id: N.id,
1199
1204
  name: N.name,
1200
1205
  email: N.email,
1201
1206
  phone: N.phone
1202
1207
  });
1203
1208
  try {
1204
- await O.show();
1205
- } catch ($) {
1206
- console.warn("[MessagingShell] Failed to unhide channel:", $);
1209
+ await p.show();
1210
+ } catch (A) {
1211
+ console.warn("[MessagingShell] Failed to unhide channel:", A);
1207
1212
  }
1208
- S(O), h(!1), (L = V.current) == null || L.close(), a == null || a(N);
1209
- } catch (O) {
1210
- console.error("[MessagingShell] Failed to start conversation:", O);
1213
+ I(p), i(!1), (L = V.current) == null || L.close(), a == null || a(N);
1214
+ } catch (p) {
1215
+ console.error("[MessagingShell] Failed to start conversation:", p);
1211
1216
  }
1212
1217
  },
1213
- [b, a, m]
1218
+ [v, a, h]
1214
1219
  ), ne = P(() => {
1215
1220
  var N;
1216
- h(!1), (N = V.current) == null || N.close();
1221
+ i(!1), (N = V.current) == null || N.close();
1217
1222
  }, []), Ce = P(
1218
1223
  async (N) => {
1219
- m && console.log("[MessagingShell] Leaving conversation:", N.id), S(null), A(!1), j.current = null, await B();
1224
+ h && console.log("[MessagingShell] Leaving conversation:", N.id), I(null), B(!1), j.current = null, await _();
1220
1225
  },
1221
- [B, m]
1226
+ [_, h]
1222
1227
  ), we = P(
1223
1228
  async (N) => {
1224
- m && console.log("[MessagingShell] Blocking participant:", N), S(null), A(!1), j.current = null, await B();
1229
+ h && console.log("[MessagingShell] Blocking participant:", N), I(null), B(!1), j.current = null, await _();
1225
1230
  },
1226
- [B, m]
1231
+ [_, h]
1227
1232
  ), Z = !!k;
1228
- return I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(es, {}) }) : x ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(re, { message: x, onBack: w }) }) : !f || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1233
+ return R ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(es, {}) }) : x ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(re, { message: x, onBack: C }) }) : !g || !m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1229
1234
  re,
1230
1235
  {
1231
1236
  message: "Not connected to messaging service",
1232
- onBack: w
1237
+ onBack: C
1233
1238
  }
1234
- ) }) : Y ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(re, { message: Y }) }) : /* @__PURE__ */ d(
1239
+ ) }) : Y ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(re, { message: Y }) }) : /* @__PURE__ */ u(
1235
1240
  "div",
1236
1241
  {
1237
1242
  className: D(
@@ -1239,7 +1244,7 @@ const Xe = ({
1239
1244
  s
1240
1245
  ),
1241
1246
  children: [
1242
- /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1247
+ /* @__PURE__ */ u("div", { className: "flex h-full min-h-0", children: [
1243
1248
  /* @__PURE__ */ e(
1244
1249
  "div",
1245
1250
  {
@@ -1259,7 +1264,7 @@ const Xe = ({
1259
1264
  {
1260
1265
  onChannelSelect: X,
1261
1266
  selectedChannel: k || void 0,
1262
- filters: p
1267
+ filters: O
1263
1268
  }
1264
1269
  )
1265
1270
  }
@@ -1293,7 +1298,7 @@ const Xe = ({
1293
1298
  {
1294
1299
  hasChannels: y,
1295
1300
  onStartConversation: Q ? be : void 0,
1296
- participantLabel: R
1301
+ participantLabel: S
1297
1302
  }
1298
1303
  )
1299
1304
  }
@@ -1315,9 +1320,9 @@ const Xe = ({
1315
1320
  participantSource: W,
1316
1321
  onSelectParticipant: ve,
1317
1322
  onClose: ne,
1318
- existingParticipantIds: g,
1319
- participantLabel: R,
1320
- searchPlaceholder: `Search ${R}...`
1323
+ existingParticipantIds: f,
1324
+ participantLabel: S,
1325
+ searchPlaceholder: `Search ${S}...`
1321
1326
  },
1322
1327
  F
1323
1328
  ) })
@@ -1354,21 +1359,21 @@ const Xe = ({
1354
1359
  loadingFaqId: n,
1355
1360
  headerText: r,
1356
1361
  className: a,
1357
- avatarImage: c,
1358
- avatarName: i
1362
+ avatarImage: d,
1363
+ avatarName: c
1359
1364
  }) => {
1360
1365
  const l = t.filter((o) => o.enabled).sort((o, E) => (o.order ?? 0) - (E.order ?? 0));
1361
- return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1362
- (c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1366
+ return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", a), children: /* @__PURE__ */ u("div", { className: "flex gap-3 items-end", children: [
1367
+ (d || c) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1363
1368
  J,
1364
1369
  {
1365
- id: i || "account",
1366
- name: i || "Account",
1367
- image: c,
1370
+ id: c || "account",
1371
+ name: c || "Account",
1372
+ image: d,
1368
1373
  size: 24
1369
1374
  }
1370
1375
  ) }),
1371
- /* @__PURE__ */ d(
1376
+ /* @__PURE__ */ u(
1372
1377
  "div",
1373
1378
  {
1374
1379
  className: "flex-1 rounded-lg p-4 space-y-3",
@@ -1389,43 +1394,43 @@ const Xe = ({
1389
1394
  )
1390
1395
  ] }) });
1391
1396
  }, us = (t, s = {}) => {
1392
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = C([]), [i, l] = C(!1), [o, E] = C(null), [b, u] = C(n), [f, I] = C(!0), [x, w] = C(), m = P(async (T = !1, U) => {
1393
- if (i) return;
1394
- const h = U !== void 0 ? U : b;
1397
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, d] = w([]), [c, l] = w(!1), [o, E] = w(null), [v, m] = w(n), [g, R] = w(!0), [x, C] = w(), h = P(async (T = !1, U) => {
1398
+ if (c) return;
1399
+ const i = U !== void 0 ? U : v;
1395
1400
  l(!0), E(null);
1396
1401
  try {
1397
- const g = await t.loadParticipants({
1398
- search: h || void 0,
1402
+ const f = await t.loadParticipants({
1403
+ search: i || void 0,
1399
1404
  limit: r,
1400
1405
  cursor: T ? void 0 : x
1401
1406
  });
1402
- c(
1403
- (v) => T ? g.participants : [...v, ...g.participants]
1404
- ), I(g.hasMore), w(g.nextCursor);
1405
- } catch (g) {
1406
- const v = g instanceof Error ? g.message : "Failed to load participants";
1407
- E(v), console.error("[useParticipants] Load error:", g);
1407
+ d(
1408
+ (b) => T ? f.participants : [...b, ...f.participants]
1409
+ ), R(f.hasMore), C(f.nextCursor);
1410
+ } catch (f) {
1411
+ const b = f instanceof Error ? f.message : "Failed to load participants";
1412
+ E(b), console.error("[useParticipants] Load error:", f);
1408
1413
  } finally {
1409
1414
  l(!1);
1410
1415
  }
1411
- }, [t, b, x, r, i]), k = P(() => {
1412
- f && !i && m(!1);
1413
- }, [f, i, m]), S = P((T) => {
1414
- u(T), w(void 0), m(!0, T);
1415
- }, [m]), y = P(() => {
1416
- w(void 0), m(!0);
1417
- }, [m]);
1418
- return H(() => {
1419
- m(!0);
1416
+ }, [t, v, x, r, c]), k = P(() => {
1417
+ g && !c && h(!1);
1418
+ }, [g, c, h]), I = P((T) => {
1419
+ m(T), C(void 0), h(!0, T);
1420
+ }, [h]), y = P(() => {
1421
+ C(void 0), h(!0);
1422
+ }, [h]);
1423
+ return G(() => {
1424
+ h(!0);
1420
1425
  }, [t.loadParticipants]), {
1421
1426
  participants: a,
1422
- loading: i,
1427
+ loading: c,
1423
1428
  error: o,
1424
- searchQuery: b,
1425
- hasMore: f,
1429
+ searchQuery: v,
1430
+ hasMore: g,
1426
1431
  totalCount: t.totalCount,
1427
1432
  loadMore: k,
1428
- search: S,
1433
+ search: I,
1429
1434
  refresh: y
1430
1435
  };
1431
1436
  };
@@ -1439,8 +1444,8 @@ export {
1439
1444
  is as MessagingProvider,
1440
1445
  cs as MessagingShell,
1441
1446
  Xe as ParticipantPicker,
1442
- $e as formatRelativeTime,
1443
- Be as useMessaging,
1447
+ Ae as formatRelativeTime,
1448
+ _e as useMessaging,
1444
1449
  us as useParticipants
1445
1450
  };
1446
1451
  //# sourceMappingURL=index.js.map