@linktr.ee/messaging-react 1.12.8-rc-1766058614 โ†’ 1.12.8-rc-1766060382

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,8 +1,8 @@
1
1
  import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
2
- import R from "classnames";
3
- import U, { createContext as ye, useContext as Ee, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
2
+ import M from "classnames";
3
+ import P, { createContext as ye, useContext as Ee, useCallback as _, useState as S, useRef as z, useEffect as G } from "react";
4
4
  import { StreamChatService as $e } from "@linktr.ee/messaging-core";
5
- import { Chat as Ge, ChannelList as He, useMessageComposer as Ie, useStateStore as Ve, MessageInput as We, useMessageInputContext as Ze, useMessageComposerHasSendableData as qe, useChannelStateContext as ue, SimpleAttachmentSelector as Ye, QuotedMessagePreview as Je, AttachmentPreviewList as Qe, TextareaComposer as Xe, MessageTimestamp as Ke, Channel as es, Window as ss, MessageList as ts } from "stream-chat-react";
5
+ import { Chat as Ge, ChannelList as He, useMessageComposer as Ie, useStateStore as Ve, MessageInput as We, useMessageInputContext as qe, useMessageComposerHasSendableData as Ze, useChannelStateContext as me, SimpleAttachmentSelector as Ye, QuotedMessagePreview as Qe, AttachmentPreviewList as Je, TextareaComposer as Xe, MessageTimestamp as Ke, Channel as es, Window as ss, MessageList as ts } from "stream-chat-react";
6
6
  import { XIcon as oe, ArrowUpIcon as ns, ArrowLeftIcon as ge, DotsThreeIcon as xe, SpinnerGapIcon as re, SignOutIcon as rs, ProhibitInsetIcon as be, FlagIcon as ls, MagnifyingGlassIcon as as, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
7
  import { LinkPreviewsManager as Ce } from "stream-chat";
8
8
  const Se = ye({
@@ -23,9 +23,9 @@ const Se = ye({
23
23
  capabilities: a = {},
24
24
  debug: o = !1
25
25
  }) => {
26
- const l = D(
27
- (u, ...x) => {
28
- o && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...x);
26
+ const l = _(
27
+ (h, ...x) => {
28
+ o && console.log(`๐Ÿ”ฅ [MessagingProvider] ${h}`, ...x);
29
29
  },
30
30
  [o]
31
31
  );
@@ -35,14 +35,14 @@ const Se = ye({
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(a)
37
37
  });
38
- const [m, f] = y(null), [g, E] = y(null), [d, N] = y(!1), [w, S] = y(!1), [I, C] = y(null), h = z(!1), b = z({
38
+ const [m, f] = S(null), [g, y] = S(null), [u, p] = S(!1), [v, N] = S(!1), [I, C] = S(null), d = z(!1), b = z({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
42
42
  capabilities: a
43
- }), p = z(0);
44
- p.current++, l("๐Ÿ“Š RENDER INFO", {
45
- renderCount: p.current,
43
+ }), k = z(0);
44
+ k.current++, l("๐Ÿ“Š RENDER INFO", {
45
+ renderCount: k.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: b.current.userId !== (s == null ? void 0 : s.id),
@@ -56,9 +56,9 @@ const Se = ye({
56
56
  serviceConfig: n,
57
57
  capabilities: a
58
58
  }, G(() => {
59
- const u = p.current;
59
+ const h = k.current;
60
60
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
61
- renderCount: u,
61
+ renderCount: h,
62
62
  apiKey: !!r,
63
63
  serviceConfig: !!n,
64
64
  dependencies: {
@@ -69,13 +69,13 @@ const Se = ye({
69
69
  }
70
70
  }), !r || !n) {
71
71
  l("โš ๏ธ SERVICE INIT SKIPPED", {
72
- renderCount: u,
72
+ renderCount: h,
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: h,
79
79
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: b.current.serviceConfig !== n
81
81
  });
@@ -85,34 +85,34 @@ const Se = ye({
85
85
  debug: o
86
86
  });
87
87
  return f(x), l("โœ… SERVICE SET", {
88
- renderCount: u,
88
+ renderCount: h,
89
89
  serviceInstance: !!x
90
90
  }), () => {
91
91
  l("๐Ÿงน SERVICE CLEANUP", {
92
- renderCount: u,
92
+ renderCount: h,
93
93
  reason: "Effect cleanup"
94
94
  }), x.disconnectUser().catch(console.error);
95
95
  };
96
96
  }, [r, n, o, l]);
97
- const k = z(null);
97
+ const E = z(null);
98
98
  G(() => {
99
99
  var x, B;
100
100
  if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
101
101
  hasService: !!m,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: h.current,
105
- isConnected: d,
104
+ isConnecting: d.current,
105
+ isConnected: u,
106
106
  dependencies: { service: !!m, userId: s == null ? void 0 : s.id }
107
107
  }), !m || !s) {
108
108
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (h.current) {
111
+ if (d.current) {
112
112
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((x = k.current) == null ? void 0 : x.serviceId) === m && ((B = k.current) == null ? void 0 : B.userId) === s.id) {
115
+ if (((x = E.current) == null ? void 0 : x.serviceId) === m && ((B = E.current) == null ? void 0 : B.userId) === s.id) {
116
116
  l(
117
117
  "โš ๏ธ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,11 +120,11 @@ const Se = ye({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), h.current = !0, S(!0), C(null);
123
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), d.current = !0, N(!0), C(null);
124
124
  try {
125
125
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
126
  const A = await m.connectUser(s);
127
- E(A), N(!0), k.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
127
+ y(A), p(!0), E.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: A.userID
130
130
  });
@@ -135,25 +135,25 @@ const Se = ye({
135
135
  error: H
136
136
  });
137
137
  } finally {
138
- S(!1), h.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ N(!1), d.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
- isConnected: d
140
+ isConnected: u
141
141
  });
142
142
  }
143
143
  })();
144
- }, [m, s, l, d]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [m, s, l, u]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!m,
146
- isConnected: d
146
+ isConnected: u
147
147
  }), () => {
148
- m && d ? (l(
148
+ m && u ? (l(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), k.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
+ ), E.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!m,
153
- isConnected: d
153
+ isConnected: u
154
154
  });
155
- }), [m, d, l]);
156
- const T = D(async () => {
155
+ }), [m, u, l]);
156
+ const T = _(async () => {
157
157
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!m,
159
159
  hasUser: !!s
@@ -161,32 +161,32 @@ const Se = ye({
161
161
  l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), S(!0);
164
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), N(!0);
165
165
  try {
166
166
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await m.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
- const u = await m.connectUser(s);
168
- E(u), N(!0), C(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
- } catch (u) {
170
- const x = u instanceof Error ? u.message : "Refresh failed";
167
+ const h = await m.connectUser(s);
168
+ y(h), p(!0), C(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
+ } catch (h) {
170
+ const x = h instanceof Error ? h.message : "Refresh failed";
171
171
  C(x), l("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
173
  error: x
174
174
  });
175
175
  } finally {
176
- S(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ N(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [m, s, l]), c = U.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [m, s, l]), c = P.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!m,
180
180
  hasClient: !!g,
181
- isConnected: d,
182
- isLoading: w,
181
+ isConnected: u,
182
+ isLoading: v,
183
183
  hasError: !!I,
184
184
  capabilitiesKeys: Object.keys(a)
185
185
  }), {
186
186
  service: m,
187
187
  client: g,
188
- isConnected: d,
189
- isLoading: w,
188
+ isConnected: u,
189
+ isLoading: v,
190
190
  error: I,
191
191
  capabilities: a,
192
192
  refreshConnection: T,
@@ -194,8 +194,8 @@ const Se = ye({
194
194
  }), [
195
195
  m,
196
196
  g,
197
- d,
198
- w,
197
+ u,
198
+ v,
199
199
  I,
200
200
  a,
201
201
  T,
@@ -203,10 +203,10 @@ const Se = ye({
203
203
  l
204
204
  ]);
205
205
  return l("๐Ÿ”„ RENDER END", {
206
- renderCount: p.current,
207
- willRenderChat: !!(g && d),
206
+ renderCount: k.current,
207
+ willRenderChat: !!(g && u),
208
208
  contextValueReady: !!c
209
- }), /* @__PURE__ */ e(Se.Provider, { value: c, children: g && d ? /* @__PURE__ */ e(
209
+ }), /* @__PURE__ */ e(Se.Provider, { value: c, children: g && u ? /* @__PURE__ */ e(
210
210
  Ge,
211
211
  {
212
212
  client: g,
@@ -273,25 +273,25 @@ function ds(t) {
273
273
  }
274
274
  return Math.abs(s);
275
275
  }
276
- function ms(t) {
276
+ function us(t) {
277
277
  const n = ds(t) % ve.length;
278
278
  return ve[n];
279
279
  }
280
- const Z = ({
280
+ const q = ({
281
281
  id: t,
282
282
  image: s,
283
283
  size: n = 40,
284
284
  className: r,
285
285
  shape: a = "squircle"
286
286
  }) => {
287
- const o = ms(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = a === "circle" ? { borderRadius: "50%" } : {
287
+ const o = us(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = a === "circle" ? { borderRadius: "50%" } : {
288
288
  borderRadius: "33%",
289
289
  "corner-shape": "superellipse(1.3)"
290
290
  };
291
291
  return /* @__PURE__ */ e(
292
292
  "div",
293
293
  {
294
- className: R("flex-shrink-0 overflow-hidden", r),
294
+ className: M("flex-shrink-0 overflow-hidden", r),
295
295
  style: {
296
296
  width: `${n}px`,
297
297
  height: `${n}px`,
@@ -308,7 +308,7 @@ const Z = ({
308
308
  "div",
309
309
  {
310
310
  "aria-hidden": "true",
311
- className: R(
311
+ className: M(
312
312
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
313
313
  m
314
314
  ),
@@ -317,34 +317,34 @@ const Z = ({
317
317
  )
318
318
  }
319
319
  );
320
- }, pe = U.memo(
320
+ }, pe = P.memo(
321
321
  ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
322
- var C, h, b, p, k, T;
322
+ var C, d, b, k, E, T;
323
323
  const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
324
324
  t && n(t);
325
325
  }, f = Object.values(((C = t == null ? void 0 : t.state) == null ? void 0 : C.members) || {}).find(
326
326
  (c) => {
327
- var u, x;
328
- return ((u = c.user) == null ? void 0 : u.id) && c.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
327
+ var h, x;
328
+ return ((h = c.user) == null ? void 0 : h.id) && c.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
329
329
  }
330
- ), g = ((h = f == null ? void 0 : f.user) == null ? void 0 : h.name) || "Conversation", E = (b = f == null ? void 0 : f.user) == null ? void 0 : b.image, d = (k = (p = t == null ? void 0 : t.state) == null ? void 0 : p.messages) == null ? void 0 : k[t.state.messages.length - 1], w = (() => {
331
- var u;
332
- if (d != null && d.text) return d.text;
333
- const c = (u = d == null ? void 0 : d.attachments) == null ? void 0 : u[0];
330
+ ), g = ((d = f == null ? void 0 : f.user) == null ? void 0 : d.name) || "Conversation", y = (b = f == null ? void 0 : f.user) == null ? void 0 : b.image, u = (E = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : E[t.state.messages.length - 1], v = (() => {
331
+ var h;
332
+ if (u != null && u.text) return u.text;
333
+ const c = (h = u == null ? void 0 : u.attachments) == null ? void 0 : h[0];
334
334
  return c ? c.og_scrape_url ? c.og_scrape_url : c.type === "image" ? "๐Ÿ“ท Sent an image" : c.type === "video" ? "๐ŸŽฅ Sent a video" : c.type === "audio" ? "๐ŸŽต Sent audio" : c.type === "file" ? "๐Ÿ“Ž Sent a file" : "๐Ÿ“Ž Sent an attachment" : "No messages yet";
335
- })(), S = d != null && d.created_at ? cs(new Date(d.created_at)) : "", I = a ?? 0;
335
+ })(), N = u != null && u.created_at ? cs(new Date(u.created_at)) : "", I = a ?? 0;
336
336
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
337
337
  channelId: t == null ? void 0 : t.id,
338
338
  isSelected: o,
339
339
  participantName: g,
340
340
  unreadCount: I,
341
- hasTimestamp: !!S
341
+ hasTimestamp: !!N
342
342
  }), /* @__PURE__ */ e(
343
343
  "button",
344
344
  {
345
345
  type: "button",
346
346
  onClick: l,
347
- className: R(
347
+ className: M(
348
348
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
349
349
  {
350
350
  "bg-primary-alt/10 border-l-4 border-l-primary": o,
@@ -353,11 +353,11 @@ const Z = ({
353
353
  ),
354
354
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
355
355
  /* @__PURE__ */ e(
356
- Z,
356
+ q,
357
357
  {
358
358
  id: ((T = f == null ? void 0 : f.user) == null ? void 0 : T.id) || t.id || "unknown",
359
359
  name: g,
360
- image: E,
360
+ image: y,
361
361
  size: 44,
362
362
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
363
363
  }
@@ -367,17 +367,17 @@ const Z = ({
367
367
  /* @__PURE__ */ e(
368
368
  "h3",
369
369
  {
370
- className: R(
370
+ className: M(
371
371
  "text-sm font-medium truncate",
372
372
  o ? "text-primary" : "text-charcoal"
373
373
  ),
374
374
  children: g
375
375
  }
376
376
  ),
377
- S && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: S })
377
+ N && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: N })
378
378
  ] }),
379
379
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
380
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: w }),
380
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: v }),
381
381
  I > 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: I > 99 ? "99+" : I })
382
382
  ] })
383
383
  ] })
@@ -387,7 +387,7 @@ const Z = ({
387
387
  }
388
388
  );
389
389
  pe.displayName = "CustomChannelPreview";
390
- const ke = U.memo(
390
+ const ke = P.memo(
391
391
  ({
392
392
  onChannelSelect: t,
393
393
  selectedChannel: s,
@@ -395,7 +395,7 @@ const ke = U.memo(
395
395
  className: r,
396
396
  customEmptyStateIndicator: a
397
397
  }) => {
398
- const o = U.useRef(0);
398
+ const o = P.useRef(0);
399
399
  o.current++;
400
400
  const { debug: l = !1 } = ie();
401
401
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
@@ -403,7 +403,7 @@ const ke = U.memo(
403
403
  selectedChannelId: s == null ? void 0 : s.id,
404
404
  filters: n
405
405
  });
406
- const m = U.useMemo(() => (g) => /* @__PURE__ */ e(
406
+ const m = P.useMemo(() => (g) => /* @__PURE__ */ e(
407
407
  pe,
408
408
  {
409
409
  ...g,
@@ -415,7 +415,7 @@ const ke = U.memo(
415
415
  return /* @__PURE__ */ e(
416
416
  "div",
417
417
  {
418
- className: R(
418
+ className: M(
419
419
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
420
420
  r
421
421
  ),
@@ -444,7 +444,7 @@ const ne = ({
444
444
  "button",
445
445
  {
446
446
  type: "button",
447
- className: R(
447
+ className: M(
448
448
  "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",
449
449
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
450
450
  s
@@ -453,12 +453,12 @@ const ne = ({
453
453
  children: n
454
454
  }
455
455
  );
456
- function Re({ label: t, className: s, children: n, ...r }) {
456
+ function _e({ label: t, className: s, children: n, ...r }) {
457
457
  return /* @__PURE__ */ i(
458
458
  "button",
459
459
  {
460
460
  type: "button",
461
- className: R(
461
+ className: M(
462
462
  "rounded-full p-2 transition-colors focus-ring",
463
463
  {
464
464
  "cursor-not-allowed opacity-50": r.disabled,
@@ -474,10 +474,10 @@ function Re({ label: t, className: s, children: n, ...r }) {
474
474
  }
475
475
  );
476
476
  }
477
- function De({ onClick: t }) {
478
- return /* @__PURE__ */ e(Re, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
477
+ function Me({ onClick: t }) {
478
+ return /* @__PURE__ */ e(_e, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
479
479
  }
480
- const us = (t) => ({
480
+ const ms = (t) => ({
481
481
  linkPreviews: Array.from(t.previews.values()).filter(
482
482
  (s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
483
483
  )
@@ -524,7 +524,7 @@ const us = (t) => ({
524
524
  }, fs = () => {
525
525
  const { linkPreviewsManager: t } = Ie(), { linkPreviews: s } = Ve(
526
526
  t.state,
527
- us
527
+ ms
528
528
  ), n = (a) => {
529
529
  t.dismissPreview(a);
530
530
  };
@@ -536,9 +536,12 @@ const us = (t) => ({
536
536
  },
537
537
  a.og_scrape_url
538
538
  )) }) : null;
539
- }, _e = ye(
539
+ }, gs = (t) => {
540
+ const { localMetadata: s, ...n } = t;
541
+ return n;
542
+ }, Re = ye(
540
543
  {}
541
- ), gs = ({ attachment: t, onRemove: s }) => /* @__PURE__ */ i("div", { className: "relative w-full block rounded-[24px] bg-[#121110] p-2 mb-4", children: [
544
+ ), xs = ({ attachment: t, onRemove: s }) => /* @__PURE__ */ i("div", { className: "relative w-full block rounded-[24px] bg-[#121110] p-2 mb-4", children: [
542
545
  t.thumb_url && /* @__PURE__ */ e(
543
546
  "img",
544
547
  {
@@ -561,25 +564,51 @@ const us = (t) => ({
561
564
  t.title && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: t.title }),
562
565
  t.title_link && /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55 truncate", children: t.title_link })
563
566
  ] })
564
- ] }), xs = () => {
565
- const { handleSubmit: t } = Ze(), s = qe(), { channel: n } = ue(), r = Ie(), { pendingAttachment: a, onClearPendingAttachment: o } = Ee(
566
- _e
567
- ), [l, m] = y(!1), f = (s || !!a) && !l, g = D(
568
- (d) => {
569
- if (d.key === "Enter" && !d.shiftKey && a) {
570
- if (d.preventDefault(), d.stopPropagation(), l) return;
567
+ ] }), bs = () => {
568
+ const { handleSubmit: t } = qe(), s = Ze(), { channel: n } = me(), r = Ie(), { pendingAttachment: a, onClearPendingAttachment: o } = Ee(
569
+ Re
570
+ ), [l, m] = S(!1), f = (s || !!a) && !l, g = _(() => {
571
+ var b, k;
572
+ const v = ((b = r.textComposer.text) == null ? void 0 : b.trim()) || "", N = r.attachmentManager.successfulUploads.map(
573
+ gs
574
+ ), I = Array.from(
575
+ r.linkPreviewsManager.previews.values()
576
+ ).filter((E) => E.status === "loaded").map((E) => ({
577
+ type: "link",
578
+ og_scrape_url: E.og_scrape_url,
579
+ title: E.title,
580
+ text: E.text,
581
+ image_url: E.image_url,
582
+ thumb_url: E.thumb_url,
583
+ author_name: E.author_name
584
+ })), C = [
585
+ ...a ? [a] : [],
586
+ ...N,
587
+ ...I
588
+ ], d = (k = r.quotedMessage) == null ? void 0 : k.id;
589
+ return {
590
+ text: v,
591
+ attachments: C,
592
+ ...d && { quoted_message_id: d }
593
+ };
594
+ }, [r, a]), y = _(() => {
595
+ r.textComposer.setText(""), r.attachmentManager.removeAttachments(
596
+ r.attachmentManager.attachments.map(
597
+ (v) => v.localMetadata.id
598
+ )
599
+ ), r.setQuotedMessage(null), o == null || o();
600
+ }, [r, o]), u = _(
601
+ (v) => {
602
+ if (v.key === "Enter" && !v.shiftKey && a) {
603
+ if (v.preventDefault(), v.stopPropagation(), l) return;
571
604
  (async () => {
572
- var N;
573
605
  if (a && n) {
574
606
  m(!0);
575
607
  try {
576
- const w = ((N = r.textComposer.text) == null ? void 0 : N.trim()) || "";
577
- await n.sendMessage({
578
- text: w,
579
- attachments: [a]
580
- }), r.textComposer.setText(""), o == null || o();
581
- } catch (w) {
582
- console.error("Failed to send message with attachment:", w);
608
+ const N = g();
609
+ await n.sendMessage(N), y();
610
+ } catch (N) {
611
+ console.error("Failed to send message with attachment:", N);
583
612
  } finally {
584
613
  m(!1);
585
614
  }
@@ -587,56 +616,46 @@ const us = (t) => ({
587
616
  })();
588
617
  }
589
618
  },
590
- [
591
- n,
592
- l,
593
- r.textComposer,
594
- o,
595
- a
596
- ]
597
- ), E = D(
598
- async (d) => {
599
- var N;
619
+ [g, n, y, l, a]
620
+ ), p = _(
621
+ async (v) => {
600
622
  if (!l)
601
623
  if (a && n) {
602
624
  m(!0);
603
625
  try {
604
- const w = ((N = r.textComposer.text) == null ? void 0 : N.trim()) || "";
605
- await n.sendMessage({
606
- text: w,
607
- attachments: [a]
608
- }), r.textComposer.setText(""), o == null || o();
609
- } catch (w) {
610
- console.error("Failed to send message with attachment:", w);
626
+ const N = g();
627
+ await n.sendMessage(N), y();
628
+ } catch (N) {
629
+ console.error("Failed to send message with attachment:", N);
611
630
  } finally {
612
631
  m(!1);
613
632
  }
614
633
  } else
615
- await t(d);
634
+ await t(v);
616
635
  },
617
636
  [
637
+ g,
618
638
  n,
639
+ y,
619
640
  t,
620
641
  l,
621
- r.textComposer,
622
- o,
623
642
  a
624
643
  ]
625
644
  );
626
645
  return /* @__PURE__ */ i(we, { children: [
627
646
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ye, {}) }),
628
647
  /* @__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: [
629
- /* @__PURE__ */ e(Je, {}),
630
- /* @__PURE__ */ e(fs, {}),
631
648
  /* @__PURE__ */ e(Qe, {}),
649
+ /* @__PURE__ */ e(fs, {}),
650
+ /* @__PURE__ */ e(Je, {}),
632
651
  a && o && /* @__PURE__ */ e(
633
- gs,
652
+ xs,
634
653
  {
635
654
  attachment: a,
636
655
  onRemove: o
637
656
  }
638
657
  ),
639
- /* @__PURE__ */ i("div", { className: "flex", onKeyDownCapture: g, children: [
658
+ /* @__PURE__ */ i("div", { className: "flex", onKeyDownCapture: u, children: [
640
659
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
641
660
  Xe,
642
661
  {
@@ -651,7 +670,7 @@ const us = (t) => ({
651
670
  className: "str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white",
652
671
  "data-testid": "send-button",
653
672
  disabled: !f,
654
- onClick: E,
673
+ onClick: p,
655
674
  type: "button",
656
675
  children: /* @__PURE__ */ e(ns, { className: "size-4" })
657
676
  }
@@ -659,20 +678,20 @@ const us = (t) => ({
659
678
  ] })
660
679
  ] })
661
680
  ] });
662
- }, bs = ({
681
+ }, Ns = ({
663
682
  renderActions: t,
664
683
  pendingAttachment: s,
665
684
  onClearPendingAttachment: n
666
685
  }) => /* @__PURE__ */ e(
667
- _e.Provider,
686
+ Re.Provider,
668
687
  {
669
688
  value: { pendingAttachment: s, onClearPendingAttachment: n },
670
689
  children: /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
671
690
  t && (t == null ? void 0 : t()),
672
- /* @__PURE__ */ e(We, { Input: xs })
691
+ /* @__PURE__ */ e(We, { Input: bs })
673
692
  ] })
674
693
  }
675
- ), Ns = (t) => {
694
+ ), Cs = (t) => {
676
695
  const s = t.message.hide_date === !0;
677
696
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
678
697
  /* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
@@ -682,10 +701,10 @@ const us = (t) => ({
682
701
  ] }),
683
702
  !s && /* @__PURE__ */ e(Ke, { message: t.message })
684
703
  ] });
685
- }, Cs = () => null, vs = ({ className: t, message: s }) => /* @__PURE__ */ i(
704
+ }, vs = () => null, ws = ({ className: t, message: s }) => /* @__PURE__ */ i(
686
705
  "div",
687
706
  {
688
- className: R("flex items-center justify-center h-full", t),
707
+ className: M("flex items-center justify-center h-full", t),
689
708
  children: [
690
709
  /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
691
710
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
@@ -725,25 +744,25 @@ const us = (t) => ({
725
744
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
726
745
  ]
727
746
  }
728
- ), ae = U.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
729
- /* @__PURE__ */ e(vs, { className: "w-6 h-6" }),
747
+ ), ae = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
748
+ /* @__PURE__ */ e(ws, { className: "w-6 h-6" }),
730
749
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
731
750
  ] }) }));
732
751
  ae.displayName = "LoadingState";
733
- const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
734
- var f, g, E, d, N;
735
- const { channel: a } = ue(), o = U.useMemo(() => Object.values(a.state.members || {}).find(
736
- (S) => {
752
+ const ys = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
753
+ var f, g, y, u, p;
754
+ const { channel: a } = me(), o = P.useMemo(() => Object.values(a.state.members || {}).find(
755
+ (N) => {
737
756
  var I;
738
- return ((I = S.user) == null ? void 0 : I.id) && S.user.id !== a._client.userID;
757
+ return ((I = N.user) == null ? void 0 : I.id) && N.user.id !== a._client.userID;
739
758
  }
740
- ), [a._client.userID, a.state.members]), l = ((f = o == null ? void 0 : o.user) == null ? void 0 : f.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", m = (E = o == null ? void 0 : o.user) == null ? void 0 : E.image;
759
+ ), [a._client.userID, a.state.members]), l = ((f = o == null ? void 0 : o.user) == null ? void 0 : f.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", m = (y = o == null ? void 0 : o.user) == null ? void 0 : y.image;
741
760
  return /* @__PURE__ */ i("div", { className: "@container", children: [
742
761
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
743
762
  /* @__PURE__ */ e(
744
763
  "button",
745
764
  {
746
- className: R(
765
+ className: M(
747
766
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
748
767
  !s && "invisible"
749
768
  ),
@@ -756,9 +775,9 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
756
775
  ),
757
776
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
758
777
  /* @__PURE__ */ e(
759
- Z,
778
+ q,
760
779
  {
761
- id: ((d = o == null ? void 0 : o.user) == null ? void 0 : d.id) || a.id || "unknown",
780
+ id: ((u = o == null ? void 0 : o.user) == null ? void 0 : u.id) || a.id || "unknown",
762
781
  name: l,
763
782
  image: m,
764
783
  size: 40
@@ -769,7 +788,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
769
788
  /* @__PURE__ */ e(
770
789
  "button",
771
790
  {
772
- className: R(
791
+ className: M(
773
792
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
774
793
  ),
775
794
  onClick: n,
@@ -792,9 +811,9 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
792
811
  }
793
812
  ),
794
813
  /* @__PURE__ */ e(
795
- Z,
814
+ q,
796
815
  {
797
- id: ((N = o == null ? void 0 : o.user) == null ? void 0 : N.id) || a.id || "unknown",
816
+ id: ((p = o == null ? void 0 : o.user) == null ? void 0 : p.id) || a.id || "unknown",
798
817
  name: l,
799
818
  image: m,
800
819
  size: 40
@@ -805,7 +824,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
805
824
  r && n && /* @__PURE__ */ e(
806
825
  "button",
807
826
  {
808
- className: R(
827
+ className: M(
809
828
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
810
829
  ),
811
830
  onClick: n,
@@ -814,7 +833,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
814
833
  )
815
834
  ] })
816
835
  ] });
817
- }, ys = ({
836
+ }, Es = ({
818
837
  dialogRef: t,
819
838
  onClose: s,
820
839
  participant: n,
@@ -825,49 +844,49 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
825
844
  showDeleteConversation: m = !0,
826
845
  onDeleteConversationClick: f,
827
846
  onBlockParticipantClick: g,
828
- onReportParticipantClick: E
847
+ onReportParticipantClick: y
829
848
  }) => {
830
- var q, Q, X, K, ce, j, V;
831
- const { service: d, debug: N } = ie(), [w, S] = y(!1), [I, C] = y(!1), [h, b] = y(!1), p = D(async () => {
849
+ var Z, J, X, K, ce, j, V;
850
+ const { service: u, debug: p } = ie(), [v, N] = S(!1), [I, C] = S(!1), [d, b] = S(!1), k = _(async () => {
832
851
  var F;
833
- if (!(!d || !((F = n == null ? void 0 : n.user) != null && F.id)))
852
+ if (!(!u || !((F = n == null ? void 0 : n.user) != null && F.id)))
834
853
  try {
835
- const P = (await d.getBlockedUsers()).some(
854
+ const U = (await u.getBlockedUsers()).some(
836
855
  ($) => {
837
856
  var Y;
838
857
  return $.blocked_user_id === ((Y = n == null ? void 0 : n.user) == null ? void 0 : Y.id);
839
858
  }
840
859
  );
841
- S(P);
842
- } catch (_) {
860
+ N(U);
861
+ } catch (R) {
843
862
  console.error(
844
863
  "[ChannelInfoDialog] Failed to check blocked status:",
845
- _
864
+ R
846
865
  );
847
866
  }
848
- }, [d, (q = n == null ? void 0 : n.user) == null ? void 0 : q.id]);
867
+ }, [u, (Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id]);
849
868
  G(() => {
850
- p();
851
- }, [p]);
852
- const k = async () => {
869
+ k();
870
+ }, [k]);
871
+ const E = async () => {
853
872
  var F;
854
873
  if (!I) {
855
- f == null || f(), N && console.log("[ChannelInfoDialog] Leave conversation", r.cid), C(!0);
874
+ f == null || f(), p && console.log("[ChannelInfoDialog] Leave conversation", r.cid), C(!0);
856
875
  try {
857
- const _ = ((F = r._client) == null ? void 0 : F.userID) ?? null;
858
- await r.hide(_, !1), o && await o(r), s();
859
- } catch (_) {
860
- console.error("[ChannelInfoDialog] Failed to leave conversation", _);
876
+ const R = ((F = r._client) == null ? void 0 : F.userID) ?? null;
877
+ await r.hide(R, !1), o && await o(r), s();
878
+ } catch (R) {
879
+ console.error("[ChannelInfoDialog] Failed to leave conversation", R);
861
880
  } finally {
862
881
  C(!1);
863
882
  }
864
883
  }
865
884
  }, T = async () => {
866
- var F, _, P;
867
- if (!(h || !d)) {
868
- g == null || g(), N && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
885
+ var F, R, U;
886
+ if (!(d || !u)) {
887
+ g == null || g(), p && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
869
888
  try {
870
- await d.blockUser((_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), l && await l((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
889
+ await u.blockUser((R = n == null ? void 0 : n.user) == null ? void 0 : R.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
871
890
  } catch ($) {
872
891
  console.error("[ChannelInfoDialog] Failed to block member", $);
873
892
  } finally {
@@ -875,26 +894,26 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
875
894
  }
876
895
  }
877
896
  }, c = async () => {
878
- var F, _, P;
879
- if (!(h || !d)) {
880
- g == null || g(), N && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
897
+ var F, R, U;
898
+ if (!(d || !u)) {
899
+ g == null || g(), p && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
881
900
  try {
882
- await d.unBlockUser((_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), l && await l((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
901
+ await u.unBlockUser((R = n == null ? void 0 : n.user) == null ? void 0 : R.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
883
902
  } catch ($) {
884
903
  console.error("[ChannelInfoDialog] Failed to unblock member", $);
885
904
  } finally {
886
905
  b(!1);
887
906
  }
888
907
  }
889
- }, u = () => {
890
- E == null || E(), s(), window.open(
908
+ }, h = () => {
909
+ y == null || y(), s(), window.open(
891
910
  "https://linktr.ee/s/about/trust-center/report",
892
911
  "_blank",
893
912
  "noopener,noreferrer"
894
913
  );
895
914
  };
896
915
  if (!n) return null;
897
- const x = ((Q = n.user) == null ? void 0 : Q.name) || ((X = n.user) == null ? void 0 : X.id) || "Unknown member", B = (K = n.user) == null ? void 0 : K.image, A = (ce = n.user) == null ? void 0 : ce.email, H = (j = n.user) == null ? void 0 : j.username, J = A || (H ? `linktr.ee/${H}` : void 0), he = ((V = n.user) == null ? void 0 : V.id) || "unknown";
916
+ const x = ((J = n.user) == null ? void 0 : J.name) || ((X = n.user) == null ? void 0 : X.id) || "Unknown member", B = (K = n.user) == null ? void 0 : K.image, A = (ce = n.user) == null ? void 0 : ce.email, H = (j = n.user) == null ? void 0 : j.username, Q = A || (H ? `linktr.ee/${H}` : void 0), he = ((V = n.user) == null ? void 0 : V.id) || "unknown";
898
917
  return (
899
918
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
900
919
  /* @__PURE__ */ e(
@@ -909,7 +928,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
909
928
  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: [
910
929
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
911
930
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
912
- /* @__PURE__ */ e(De, { onClick: s })
931
+ /* @__PURE__ */ e(Me, { onClick: s })
913
932
  ] }),
914
933
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
915
934
  /* @__PURE__ */ e(
@@ -919,7 +938,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
919
938
  style: { backgroundColor: "#FBFAF9" },
920
939
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
921
940
  /* @__PURE__ */ e(
922
- Z,
941
+ q,
923
942
  {
924
943
  id: he,
925
944
  name: x,
@@ -930,7 +949,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
930
949
  ),
931
950
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
932
951
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: x }),
933
- J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
952
+ Q && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Q }),
934
953
  a && /* @__PURE__ */ e(
935
954
  "span",
936
955
  {
@@ -953,7 +972,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
953
972
  m && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
954
973
  ne,
955
974
  {
956
- onClick: k,
975
+ onClick: E,
957
976
  disabled: I,
958
977
  "aria-busy": I,
959
978
  children: [
@@ -962,14 +981,14 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
962
981
  ]
963
982
  }
964
983
  ) }),
965
- /* @__PURE__ */ e("li", { children: w ? /* @__PURE__ */ i(
984
+ /* @__PURE__ */ e("li", { children: v ? /* @__PURE__ */ i(
966
985
  ne,
967
986
  {
968
987
  onClick: c,
969
- disabled: h,
970
- "aria-busy": h,
988
+ disabled: d,
989
+ "aria-busy": d,
971
990
  children: [
972
- h ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
991
+ d ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
973
992
  /* @__PURE__ */ e("span", { children: "Unblock" })
974
993
  ]
975
994
  }
@@ -977,15 +996,15 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
977
996
  ne,
978
997
  {
979
998
  onClick: T,
980
- disabled: h,
981
- "aria-busy": h,
999
+ disabled: d,
1000
+ "aria-busy": d,
982
1001
  children: [
983
- h ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
1002
+ d ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
984
1003
  /* @__PURE__ */ e("span", { children: "Block" })
985
1004
  ]
986
1005
  }
987
1006
  ) }),
988
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ne, { variant: "danger", onClick: u, children: [
1007
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ne, { variant: "danger", onClick: h, children: [
989
1008
  /* @__PURE__ */ e(ls, { className: "h-5 w-5" }),
990
1009
  /* @__PURE__ */ e("span", { children: "Report" })
991
1010
  ] }) })
@@ -995,7 +1014,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
995
1014
  }
996
1015
  )
997
1016
  );
998
- }, Es = ({
1017
+ }, Is = ({
999
1018
  onBack: t,
1000
1019
  showBackButton: s,
1001
1020
  renderMessageInputActions: n,
@@ -1006,35 +1025,35 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1006
1025
  onBlockParticipantClick: m,
1007
1026
  onReportParticipantClick: f,
1008
1027
  pendingAttachment: g,
1009
- onClearPendingAttachment: E
1028
+ onClearPendingAttachment: y
1010
1029
  }) => {
1011
- const { channel: d } = ue(), N = z(null), w = U.useMemo(() => Object.values(d.state.members || {}).find(
1030
+ const { channel: u } = me(), p = z(null), v = P.useMemo(() => Object.values(u.state.members || {}).find(
1012
1031
  (b) => {
1013
- var p;
1014
- return ((p = b.user) == null ? void 0 : p.id) && b.user.id !== d._client.userID;
1032
+ var k;
1033
+ return ((k = b.user) == null ? void 0 : k.id) && b.user.id !== u._client.userID;
1015
1034
  }
1016
- ), [d._client.userID, d.state.members]), S = U.useMemo(() => {
1017
- const h = d.data ?? {};
1018
- if (h.followerStatus)
1019
- return String(h.followerStatus);
1020
- if (h.isFollower !== void 0)
1021
- return h.isFollower ? "Subscribed to you" : "Not subscribed";
1022
- }, [d.data]), I = D(() => {
1023
- var h;
1024
- (h = N.current) == null || h.showModal();
1025
- }, []), C = D(() => {
1026
- var h;
1027
- (h = N.current) == null || h.close();
1035
+ ), [u._client.userID, u.state.members]), N = P.useMemo(() => {
1036
+ const d = u.data ?? {};
1037
+ if (d.followerStatus)
1038
+ return String(d.followerStatus);
1039
+ if (d.isFollower !== void 0)
1040
+ return d.isFollower ? "Subscribed to you" : "Not subscribed";
1041
+ }, [u.data]), I = _(() => {
1042
+ var d;
1043
+ (d = p.current) == null || d.showModal();
1044
+ }, []), C = _(() => {
1045
+ var d;
1046
+ (d = p.current) == null || d.close();
1028
1047
  }, []);
1029
1048
  return /* @__PURE__ */ i(we, { children: [
1030
1049
  /* @__PURE__ */ i(ss, { children: [
1031
1050
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
1032
- ws,
1051
+ ys,
1033
1052
  {
1034
1053
  onBack: t,
1035
1054
  showBackButton: s,
1036
1055
  onShowInfo: I,
1037
- canShowInfo: !!w
1056
+ canShowInfo: !!v
1038
1057
  }
1039
1058
  ) }),
1040
1059
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
@@ -1046,22 +1065,22 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1046
1065
  }
1047
1066
  ) }),
1048
1067
  /* @__PURE__ */ e(
1049
- bs,
1068
+ Ns,
1050
1069
  {
1051
- renderActions: () => n == null ? void 0 : n(d),
1070
+ renderActions: () => n == null ? void 0 : n(u),
1052
1071
  pendingAttachment: g,
1053
- onClearPendingAttachment: E
1072
+ onClearPendingAttachment: y
1054
1073
  }
1055
1074
  )
1056
1075
  ] }),
1057
1076
  /* @__PURE__ */ e(
1058
- ys,
1077
+ Es,
1059
1078
  {
1060
- dialogRef: N,
1079
+ dialogRef: p,
1061
1080
  onClose: C,
1062
- participant: w,
1063
- channel: d,
1064
- followerStatusLabel: S,
1081
+ participant: v,
1082
+ channel: u,
1083
+ followerStatusLabel: N,
1065
1084
  onLeaveConversation: r,
1066
1085
  onBlockParticipant: a,
1067
1086
  showDeleteConversation: o,
@@ -1071,7 +1090,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1071
1090
  }
1072
1091
  )
1073
1092
  ] });
1074
- }, Me = U.memo(
1093
+ }, De = P.memo(
1075
1094
  ({
1076
1095
  channel: t,
1077
1096
  onBack: s,
@@ -1080,17 +1099,17 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1080
1099
  onLeaveConversation: a,
1081
1100
  onBlockParticipant: o,
1082
1101
  className: l,
1083
- CustomChannelEmptyState: m = Cs,
1102
+ CustomChannelEmptyState: m = vs,
1084
1103
  showDeleteConversation: f = !0,
1085
1104
  onDeleteConversationClick: g,
1086
- onBlockParticipantClick: E,
1087
- onReportParticipantClick: d,
1088
- pendingAttachment: N,
1089
- onClearPendingAttachment: w
1105
+ onBlockParticipantClick: y,
1106
+ onReportParticipantClick: u,
1107
+ pendingAttachment: p,
1108
+ onClearPendingAttachment: v
1090
1109
  }) => /* @__PURE__ */ e(
1091
1110
  "div",
1092
1111
  {
1093
- className: R(
1112
+ className: M(
1094
1113
  "messaging-channel-view h-full flex flex-col",
1095
1114
  l
1096
1115
  ),
@@ -1098,11 +1117,11 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1098
1117
  es,
1099
1118
  {
1100
1119
  channel: t,
1101
- MessageSystem: Ns,
1120
+ MessageSystem: Cs,
1102
1121
  EmptyStateIndicator: m,
1103
1122
  LoadingIndicator: ae,
1104
1123
  children: /* @__PURE__ */ e(
1105
- Es,
1124
+ Is,
1106
1125
  {
1107
1126
  onBack: s,
1108
1127
  showBackButton: n,
@@ -1112,10 +1131,10 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1112
1131
  CustomChannelEmptyState: m,
1113
1132
  showDeleteConversation: f,
1114
1133
  onDeleteConversationClick: g,
1115
- onBlockParticipantClick: E,
1116
- onReportParticipantClick: d,
1117
- pendingAttachment: N,
1118
- onClearPendingAttachment: w
1134
+ onBlockParticipantClick: y,
1135
+ onReportParticipantClick: u,
1136
+ pendingAttachment: p,
1137
+ onClearPendingAttachment: v
1119
1138
  }
1120
1139
  )
1121
1140
  }
@@ -1123,8 +1142,8 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1123
1142
  }
1124
1143
  )
1125
1144
  );
1126
- Me.displayName = "ChannelView";
1127
- function Is({
1145
+ De.displayName = "ChannelView";
1146
+ function Ss({
1128
1147
  searchQuery: t,
1129
1148
  setSearchQuery: s,
1130
1149
  placeholder: n
@@ -1150,7 +1169,7 @@ function Is({
1150
1169
  }
1151
1170
  ),
1152
1171
  t && /* @__PURE__ */ e(
1153
- Re,
1172
+ _e,
1154
1173
  {
1155
1174
  label: "Clear search",
1156
1175
  onClick: () => {
@@ -1163,7 +1182,7 @@ function Is({
1163
1182
  )
1164
1183
  ] });
1165
1184
  }
1166
- const Ss = ({
1185
+ const ps = ({
1167
1186
  participantSource: t,
1168
1187
  onSelectParticipant: s,
1169
1188
  onClose: n,
@@ -1172,7 +1191,7 @@ const Ss = ({
1172
1191
  searchPlaceholder: o = "Search participants...",
1173
1192
  className: l
1174
1193
  }) => {
1175
- const { debug: m } = ie(), [f, g] = y(""), [E, d] = y([]), [N, w] = y(!1), [S, I] = y(null), [C, h] = y(
1194
+ const { debug: m } = ie(), [f, g] = S(""), [y, u] = S([]), [p, v] = S(!1), [N, I] = S(null), [C, d] = S(
1176
1195
  null
1177
1196
  ), b = z(!1);
1178
1197
  G(() => {
@@ -1184,61 +1203,61 @@ const Ss = ({
1184
1203
  }
1185
1204
  if (b.current) return;
1186
1205
  (async () => {
1187
- m && console.log("[ParticipantPicker] Loading initial participants..."), w(!0), I(null);
1206
+ m && console.log("[ParticipantPicker] Loading initial participants..."), v(!0), I(null);
1188
1207
  try {
1189
- const u = await t.loadParticipants({
1208
+ const h = await t.loadParticipants({
1190
1209
  search: "",
1191
1210
  // Load all participants initially
1192
1211
  limit: 100
1193
1212
  });
1194
- d(u.participants), b.current = !0, m && console.log(
1213
+ u(h.participants), b.current = !0, m && console.log(
1195
1214
  "[ParticipantPicker] Participants loaded successfully:",
1196
- u.participants.length
1215
+ h.participants.length
1197
1216
  );
1198
- } catch (u) {
1199
- const x = u instanceof Error ? u.message : "Failed to load participants";
1200
- I(x), console.error("[ParticipantPicker] Failed to load participants:", u);
1217
+ } catch (h) {
1218
+ const x = h instanceof Error ? h.message : "Failed to load participants";
1219
+ I(x), console.error("[ParticipantPicker] Failed to load participants:", h);
1201
1220
  } finally {
1202
- w(!1);
1221
+ v(!1);
1203
1222
  }
1204
1223
  })();
1205
1224
  }, [t.loading, m]);
1206
- const p = E.filter((c) => !r.has(c.id)).filter((c) => {
1225
+ const k = y.filter((c) => !r.has(c.id)).filter((c) => {
1207
1226
  var x;
1208
1227
  if (!f) return !0;
1209
- const u = f.toLowerCase();
1210
- return c.name.toLowerCase().includes(u) || ((x = c.email) == null ? void 0 : x.toLowerCase().includes(u)) || !1;
1211
- }), k = D(
1228
+ const h = f.toLowerCase();
1229
+ return c.name.toLowerCase().includes(h) || ((x = c.email) == null ? void 0 : x.toLowerCase().includes(h)) || !1;
1230
+ }), E = _(
1212
1231
  async (c) => {
1213
1232
  if (!C) {
1214
- h(c.id);
1233
+ d(c.id);
1215
1234
  try {
1216
1235
  await s(c);
1217
- } catch (u) {
1218
- console.error("[ParticipantPicker] Failed to start chat:", u), h(null);
1236
+ } catch (h) {
1237
+ console.error("[ParticipantPicker] Failed to start chat:", h), d(null);
1219
1238
  }
1220
1239
  }
1221
1240
  },
1222
1241
  [s, C]
1223
- ), T = (c, u) => {
1224
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), k(u));
1242
+ ), T = (c, h) => {
1243
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), E(h));
1225
1244
  };
1226
- return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", l), children: [
1245
+ return /* @__PURE__ */ i("div", { className: M("flex flex-col h-full", l), children: [
1227
1246
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1228
1247
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1229
1248
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1230
- /* @__PURE__ */ e(De, { onClick: n })
1249
+ /* @__PURE__ */ e(Me, { onClick: n })
1231
1250
  ] }),
1232
1251
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1233
1252
  "Select a ",
1234
1253
  a.slice(0, -1),
1235
1254
  " to start messaging (",
1236
- p.length,
1255
+ k.length,
1237
1256
  " available)",
1238
1257
  t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${a} total`
1239
1258
  ] }),
1240
1259
  /* @__PURE__ */ e(
1241
- Is,
1260
+ Ss,
1242
1261
  {
1243
1262
  searchQuery: f,
1244
1263
  setSearchQuery: g,
@@ -1246,46 +1265,46 @@ const Ss = ({
1246
1265
  }
1247
1266
  )
1248
1267
  ] }),
1249
- S && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1268
+ N && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1250
1269
  "Error loading ",
1251
1270
  a,
1252
1271
  ": ",
1253
- S
1272
+ N
1254
1273
  ] }),
1255
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: N && 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: [
1274
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: p && k.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1256
1275
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1257
1276
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1258
1277
  "Loading ",
1259
1278
  a,
1260
1279
  "..."
1261
1280
  ] })
1262
- ] }) }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1281
+ ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1263
1282
  /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ne, { className: "h-8 w-8 text-charcoal" }) }),
1264
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${a} found` : E.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1265
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : E.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1283
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${a} found` : y.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1284
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : y.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1266
1285
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1267
- p.map((c) => {
1268
- const u = c.name || c.email || c.id, x = c.email && c.name ? c.email : c.phone;
1286
+ k.map((c) => {
1287
+ const h = c.name || c.email || c.id, x = c.email && c.name ? c.email : c.phone;
1269
1288
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1270
1289
  "button",
1271
1290
  {
1272
1291
  type: "button",
1273
- onClick: () => k(c),
1292
+ onClick: () => E(c),
1274
1293
  onKeyDown: (B) => T(B, c),
1275
1294
  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",
1276
1295
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1277
1296
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1278
1297
  /* @__PURE__ */ e(
1279
- Z,
1298
+ q,
1280
1299
  {
1281
1300
  id: c.id,
1282
- name: u,
1301
+ name: h,
1283
1302
  image: c.image,
1284
1303
  size: 40
1285
1304
  }
1286
1305
  ),
1287
1306
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1288
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1307
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: h }),
1289
1308
  x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
1290
1309
  ] })
1291
1310
  ] }),
@@ -1294,13 +1313,13 @@ const Ss = ({
1294
1313
  }
1295
1314
  ) }, c.id);
1296
1315
  }),
1297
- N && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1316
+ p && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1298
1317
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1299
1318
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1300
1319
  ] }) })
1301
1320
  ] }) })
1302
1321
  ] });
1303
- }, ps = ({ className: t }) => /* @__PURE__ */ i(
1322
+ }, ks = ({ className: t }) => /* @__PURE__ */ i(
1304
1323
  "svg",
1305
1324
  {
1306
1325
  width: "140",
@@ -1434,9 +1453,9 @@ const Ss = ({
1434
1453
  ] })
1435
1454
  ]
1436
1455
  }
1437
- ), Fe = U.memo(
1456
+ ), Fe = P.memo(
1438
1457
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1439
- /* @__PURE__ */ e(ps, {}),
1458
+ /* @__PURE__ */ e(ks, {}),
1440
1459
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1441
1460
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1442
1461
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
@@ -1444,7 +1463,7 @@ const Ss = ({
1444
1463
  ] }) })
1445
1464
  );
1446
1465
  Fe.displayName = "EmptyState";
1447
- const le = U.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: [
1466
+ const le = P.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: [
1448
1467
  /* @__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: "โš ๏ธ" }) }),
1449
1468
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1450
1469
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1459,7 +1478,7 @@ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1459
1478
  )
1460
1479
  ] }) }));
1461
1480
  le.displayName = "ErrorState";
1462
- const Ps = ({
1481
+ const Os = ({
1463
1482
  capabilities: t = {},
1464
1483
  className: s,
1465
1484
  renderMessageInputActions: n,
@@ -1470,82 +1489,82 @@ const Ps = ({
1470
1489
  CustomChannelEmptyState: m,
1471
1490
  showChannelList: f = !0,
1472
1491
  filters: g,
1473
- channelListCustomEmptyStateIndicator: E,
1474
- onDeleteConversationClick: d,
1475
- onBlockParticipantClick: N,
1476
- onReportParticipantClick: w,
1477
- pendingAttachment: S,
1492
+ channelListCustomEmptyStateIndicator: y,
1493
+ onDeleteConversationClick: u,
1494
+ onBlockParticipantClick: p,
1495
+ onReportParticipantClick: v,
1496
+ pendingAttachment: N,
1478
1497
  onClearPendingAttachment: I
1479
1498
  }) => {
1480
1499
  const {
1481
1500
  service: C,
1482
- client: h,
1501
+ client: d,
1483
1502
  isConnected: b,
1484
- isLoading: p,
1485
- error: k,
1503
+ isLoading: k,
1504
+ error: E,
1486
1505
  refreshConnection: T,
1487
1506
  debug: c
1488
- } = os(), [u, x] = y(null), [B, A] = y(!1), [H, J] = y(!1), [he, q] = y(!1), [Q, X] = y(/* @__PURE__ */ new Set()), [K, ce] = y(0), [j, V] = y(!1), [F, _] = y(null), P = z(null), {
1507
+ } = os(), [h, x] = S(null), [B, A] = S(!1), [H, Q] = S(!1), [he, Z] = S(!1), [J, X] = S(/* @__PURE__ */ new Set()), [K, ce] = S(0), [j, V] = S(!1), [F, R] = S(null), U = z(null), {
1489
1508
  participantSource: $,
1490
1509
  participantLabel: Y = "participants",
1491
1510
  showDeleteConversation: Te = !0
1492
- } = t, Le = U.useMemo(() => {
1493
- const v = h == null ? void 0 : h.userID;
1511
+ } = t, Le = P.useMemo(() => {
1512
+ const w = d == null ? void 0 : d.userID;
1494
1513
  return {
1495
1514
  ...{
1496
1515
  type: "messaging",
1497
1516
  last_message_at: { $exists: !0 },
1498
- ...v && {
1499
- members: { $in: [v] },
1517
+ ...w && {
1518
+ members: { $in: [w] },
1500
1519
  hidden: !1
1501
1520
  }
1502
1521
  },
1503
1522
  ...g
1504
1523
  };
1505
- }, [g, h == null ? void 0 : h.userID]), ee = z(null), W = D(async () => {
1506
- if (!h || !b) return;
1507
- const v = h.userID;
1508
- if (v)
1524
+ }, [g, d == null ? void 0 : d.userID]), ee = z(null), W = _(async () => {
1525
+ if (!d || !b) return;
1526
+ const w = d.userID;
1527
+ if (w)
1509
1528
  try {
1510
- c && console.log("[MessagingShell] Syncing channels for user:", v);
1511
- const O = await h.queryChannels(
1529
+ c && console.log("[MessagingShell] Syncing channels for user:", w);
1530
+ const O = await d.queryChannels(
1512
1531
  {
1513
1532
  type: "messaging",
1514
- members: { $in: [v] }
1533
+ members: { $in: [w] }
1515
1534
  },
1516
1535
  {},
1517
1536
  { limit: 100 }
1518
- ), M = /* @__PURE__ */ new Set();
1537
+ ), D = /* @__PURE__ */ new Set();
1519
1538
  O.forEach((L) => {
1520
1539
  const de = L.state.members;
1521
1540
  Object.values(de).forEach((Be) => {
1522
1541
  var fe;
1523
- const me = (fe = Be.user) == null ? void 0 : fe.id;
1524
- me && me !== v && M.add(me);
1542
+ const ue = (fe = Be.user) == null ? void 0 : fe.id;
1543
+ ue && ue !== w && D.add(ue);
1525
1544
  });
1526
- }), X((L) => L.size === M.size && [...L].every((de) => M.has(de)) ? L : M), A(O.length > 0), J(!0), ee.current = v, c && console.log("[MessagingShell] Channels synced successfully:", {
1545
+ }), X((L) => L.size === D.size && [...L].every((de) => D.has(de)) ? L : D), A(O.length > 0), Q(!0), ee.current = w, c && console.log("[MessagingShell] Channels synced successfully:", {
1527
1546
  channelCount: O.length,
1528
- memberCount: M.size
1547
+ memberCount: D.size
1529
1548
  });
1530
1549
  } catch (O) {
1531
1550
  console.error("[MessagingShell] Failed to sync channels:", O);
1532
1551
  }
1533
- }, [h, b, c]);
1552
+ }, [d, b, c]);
1534
1553
  G(() => {
1535
- if (!h || !b) return;
1536
- const v = h.userID;
1537
- v && ee.current !== v && W();
1538
- }, [h, b, W]), G(() => {
1539
- if (!o || !h || !b) return;
1554
+ if (!d || !b) return;
1555
+ const w = d.userID;
1556
+ w && ee.current !== w && W();
1557
+ }, [d, b, W]), G(() => {
1558
+ if (!o || !d || !b) return;
1540
1559
  (async () => {
1541
- const O = h.userID;
1560
+ const O = d.userID;
1542
1561
  if (O)
1543
1562
  try {
1544
1563
  c && console.log(
1545
1564
  "[MessagingShell] Loading initial conversation with:",
1546
1565
  o
1547
1566
  );
1548
- const M = await h.queryChannels(
1567
+ const D = await d.queryChannels(
1549
1568
  {
1550
1569
  type: "messaging",
1551
1570
  members: { $eq: [O, o] }
@@ -1553,10 +1572,10 @@ const Ps = ({
1553
1572
  {},
1554
1573
  { limit: 1 }
1555
1574
  );
1556
- if (M.length > 0)
1557
- x(M[0]), V(!0), _(null), r && r(M[0]), c && console.log(
1575
+ if (D.length > 0)
1576
+ x(D[0]), V(!0), R(null), r && r(D[0]), c && console.log(
1558
1577
  "[MessagingShell] Initial conversation loaded:",
1559
- M[0].id
1578
+ D[0].id
1560
1579
  );
1561
1580
  else if (l && C) {
1562
1581
  c && console.log(
@@ -1570,7 +1589,7 @@ const Ps = ({
1570
1589
  email: l.email,
1571
1590
  phone: l.phone
1572
1591
  });
1573
- x(L), V(!0), _(null), r && r(L), c && console.log(
1592
+ x(L), V(!0), R(null), r && r(L), c && console.log(
1574
1593
  "[MessagingShell] Channel created and loaded:",
1575
1594
  L.id
1576
1595
  );
@@ -1578,93 +1597,93 @@ const Ps = ({
1578
1597
  console.error(
1579
1598
  "[MessagingShell] Failed to create conversation:",
1580
1599
  L
1581
- ), _("Failed to create conversation");
1600
+ ), R("Failed to create conversation");
1582
1601
  }
1583
1602
  } else
1584
- _(
1603
+ R(
1585
1604
  "No conversation found with this account"
1586
1605
  ), c && console.log(
1587
1606
  "[MessagingShell] No conversation found for:",
1588
1607
  o
1589
1608
  );
1590
- } catch (M) {
1609
+ } catch (D) {
1591
1610
  console.error(
1592
1611
  "[MessagingShell] Failed to load initial conversation:",
1593
- M
1594
- ), _("Failed to load conversation");
1612
+ D
1613
+ ), R("Failed to load conversation");
1595
1614
  }
1596
1615
  })();
1597
1616
  }, [
1598
1617
  o,
1599
1618
  l,
1600
- h,
1619
+ d,
1601
1620
  b,
1602
1621
  C,
1603
1622
  c,
1604
1623
  r
1605
1624
  ]);
1606
- const Ue = D(
1607
- (v) => {
1608
- x(v), r == null || r(v);
1625
+ const Pe = _(
1626
+ (w) => {
1627
+ x(w), r == null || r(w);
1609
1628
  },
1610
1629
  [r]
1611
- ), Pe = D(() => {
1630
+ ), Ue = _(() => {
1612
1631
  j || x(null);
1613
- }, [j]), Oe = D(
1614
- async (v) => {
1632
+ }, [j]), Oe = _(
1633
+ async (w) => {
1615
1634
  var O;
1616
1635
  if (C)
1617
1636
  try {
1618
1637
  c && console.log(
1619
1638
  "[MessagingShell] Starting conversation with:",
1620
- v.id
1639
+ w.id
1621
1640
  );
1622
- const M = await C.startChannelWithParticipant({
1623
- id: v.id,
1624
- name: v.name,
1625
- email: v.email,
1626
- phone: v.phone
1641
+ const D = await C.startChannelWithParticipant({
1642
+ id: w.id,
1643
+ name: w.name,
1644
+ email: w.email,
1645
+ phone: w.phone
1627
1646
  });
1628
1647
  try {
1629
- await M.show();
1648
+ await D.show();
1630
1649
  } catch (L) {
1631
1650
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1632
1651
  }
1633
- x(M), q(!1), (O = P.current) == null || O.close(), a == null || a(v);
1634
- } catch (M) {
1635
- console.error("[MessagingShell] Failed to start conversation:", M);
1652
+ x(D), Z(!1), (O = U.current) == null || O.close(), a == null || a(w);
1653
+ } catch (D) {
1654
+ console.error("[MessagingShell] Failed to start conversation:", D);
1636
1655
  }
1637
1656
  },
1638
1657
  [C, a, c]
1639
- ), se = D(() => {
1640
- var v;
1641
- q(!1), (v = P.current) == null || v.close();
1642
- }, []), je = D(
1643
- (v) => {
1644
- v.target === P.current && se();
1658
+ ), se = _(() => {
1659
+ var w;
1660
+ Z(!1), (w = U.current) == null || w.close();
1661
+ }, []), je = _(
1662
+ (w) => {
1663
+ w.target === U.current && se();
1645
1664
  },
1646
1665
  [se]
1647
- ), Ae = D(
1648
- async (v) => {
1649
- c && console.log("[MessagingShell] Leaving conversation:", v.id), x(null), V(!1), ee.current = null, await W();
1666
+ ), Ae = _(
1667
+ async (w) => {
1668
+ c && console.log("[MessagingShell] Leaving conversation:", w.id), x(null), V(!1), ee.current = null, await W();
1650
1669
  },
1651
1670
  [W, c]
1652
- ), ze = D(
1653
- async (v) => {
1654
- c && console.log("[MessagingShell] Blocking participant:", v), x(null), V(!1), ee.current = null, await W();
1671
+ ), ze = _(
1672
+ async (w) => {
1673
+ c && console.log("[MessagingShell] Blocking participant:", w), x(null), V(!1), ee.current = null, await W();
1655
1674
  },
1656
1675
  [W, c]
1657
- ), te = !!u;
1658
- return p ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : k ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: k, onBack: T }) }) : !b || !h ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1676
+ ), te = !!h;
1677
+ return k ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : E ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(le, { message: E, onBack: T }) }) : !b || !d ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(
1659
1678
  le,
1660
1679
  {
1661
1680
  message: "Not connected to messaging service",
1662
1681
  onBack: T
1663
1682
  }
1664
- ) }) : F ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */ i(
1683
+ ) }) : F ? /* @__PURE__ */ e("div", { className: M("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */ i(
1665
1684
  "div",
1666
1685
  {
1667
- className: R(
1686
+ className: M(
1668
1687
  "messaging-shell h-full bg-background-primary overflow-hidden",
1669
1688
  s
1670
1689
  ),
@@ -1673,7 +1692,7 @@ const Ps = ({
1673
1692
  /* @__PURE__ */ e(
1674
1693
  "div",
1675
1694
  {
1676
- className: R(
1695
+ className: M(
1677
1696
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1678
1697
  {
1679
1698
  "!hidden": f === !1 || j,
@@ -1686,10 +1705,10 @@ const Ps = ({
1686
1705
  children: /* @__PURE__ */ e(
1687
1706
  ke,
1688
1707
  {
1689
- onChannelSelect: Ue,
1690
- selectedChannel: u || void 0,
1708
+ onChannelSelect: Pe,
1709
+ selectedChannel: h || void 0,
1691
1710
  filters: Le,
1692
- customEmptyStateIndicator: E
1711
+ customEmptyStateIndicator: y
1693
1712
  }
1694
1713
  )
1695
1714
  }
@@ -1697,7 +1716,7 @@ const Ps = ({
1697
1716
  /* @__PURE__ */ e(
1698
1717
  "div",
1699
1718
  {
1700
- className: R(
1719
+ className: M(
1701
1720
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1702
1721
  {
1703
1722
  // In direct conversation mode (or waiting for it), always show (full width)
@@ -1706,24 +1725,24 @@ const Ps = ({
1706
1725
  "hidden lg:flex": !j && !te && !o
1707
1726
  }
1708
1727
  ),
1709
- children: u ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1710
- Me,
1728
+ children: h ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1729
+ De,
1711
1730
  {
1712
- channel: u,
1713
- onBack: Pe,
1731
+ channel: h,
1732
+ onBack: Ue,
1714
1733
  showBackButton: !j,
1715
1734
  renderMessageInputActions: n,
1716
1735
  onLeaveConversation: Ae,
1717
1736
  onBlockParticipant: ze,
1718
1737
  CustomChannelEmptyState: m,
1719
1738
  showDeleteConversation: Te,
1720
- onDeleteConversationClick: d,
1721
- onBlockParticipantClick: N,
1722
- onReportParticipantClick: w,
1723
- pendingAttachment: S,
1739
+ onDeleteConversationClick: u,
1740
+ onBlockParticipantClick: p,
1741
+ onReportParticipantClick: v,
1742
+ pendingAttachment: N,
1724
1743
  onClearPendingAttachment: I
1725
1744
  },
1726
- u.id
1745
+ h.id
1727
1746
  ) }) : o ? (
1728
1747
  // Show loading while creating/loading direct conversation channel
1729
1748
  /* @__PURE__ */ e(ae, {})
@@ -1741,17 +1760,17 @@ const Ps = ({
1741
1760
  /* @__PURE__ */ e(
1742
1761
  "dialog",
1743
1762
  {
1744
- ref: P,
1763
+ ref: U,
1745
1764
  className: "mes-dialog",
1746
1765
  onClick: je,
1747
1766
  onClose: se,
1748
1767
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1749
- Ss,
1768
+ ps,
1750
1769
  {
1751
1770
  participantSource: $,
1752
1771
  onSelectParticipant: Oe,
1753
1772
  onClose: se,
1754
- existingParticipantIds: Q,
1773
+ existingParticipantIds: J,
1755
1774
  participantLabel: Y,
1756
1775
  searchPlaceholder: `Search ${Y}...`
1757
1776
  },
@@ -1762,7 +1781,7 @@ const Ps = ({
1762
1781
  ]
1763
1782
  }
1764
1783
  );
1765
- }, ks = ({
1784
+ }, _s = ({
1766
1785
  question: t,
1767
1786
  onClick: s,
1768
1787
  loading: n = !1,
@@ -1774,7 +1793,7 @@ const Ps = ({
1774
1793
  onClick: s,
1775
1794
  disabled: n,
1776
1795
  style: { backgroundColor: "#E6E5E3" },
1777
- className: R(
1796
+ className: M(
1778
1797
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1779
1798
  {
1780
1799
  "hover:brightness-95 active:brightness-90": !n,
@@ -1784,7 +1803,7 @@ const Ps = ({
1784
1803
  ),
1785
1804
  children: t
1786
1805
  }
1787
- ), Os = ({
1806
+ ), js = ({
1788
1807
  faqs: t,
1789
1808
  onFaqClick: s,
1790
1809
  loadingFaqId: n,
@@ -1796,7 +1815,7 @@ const Ps = ({
1796
1815
  const m = t.filter((f) => f.enabled).sort((f, g) => (f.order ?? 0) - (g.order ?? 0));
1797
1816
  return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1798
1817
  (o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1799
- Z,
1818
+ q,
1800
1819
  {
1801
1820
  id: l || "account",
1802
1821
  name: l || "Account",
@@ -1813,7 +1832,7 @@ const Ps = ({
1813
1832
  children: [
1814
1833
  r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
1815
1834
  m.map((f) => /* @__PURE__ */ e(
1816
- ks,
1835
+ _s,
1817
1836
  {
1818
1837
  question: f.question,
1819
1838
  onClick: () => s(f.id),
@@ -1825,31 +1844,31 @@ const Ps = ({
1825
1844
  }
1826
1845
  )
1827
1846
  ] }) });
1828
- }, js = (t, s = {}) => {
1829
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = y([]), [l, m] = y(!1), [f, g] = y(null), [E, d] = y(n), [N, w] = y(!0), [S, I] = y(), C = D(async (k = !1, T) => {
1847
+ }, As = (t, s = {}) => {
1848
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = S([]), [l, m] = S(!1), [f, g] = S(null), [y, u] = S(n), [p, v] = S(!0), [N, I] = S(), C = _(async (E = !1, T) => {
1830
1849
  if (l) return;
1831
- const c = T !== void 0 ? T : E;
1850
+ const c = T !== void 0 ? T : y;
1832
1851
  m(!0), g(null);
1833
1852
  try {
1834
- const u = await t.loadParticipants({
1853
+ const h = await t.loadParticipants({
1835
1854
  search: c || void 0,
1836
1855
  limit: r,
1837
- cursor: k ? void 0 : S
1856
+ cursor: E ? void 0 : N
1838
1857
  });
1839
1858
  o(
1840
- (x) => k ? u.participants : [...x, ...u.participants]
1841
- ), w(u.hasMore), I(u.nextCursor);
1842
- } catch (u) {
1843
- const x = u instanceof Error ? u.message : "Failed to load participants";
1844
- g(x), console.error("[useParticipants] Load error:", u);
1859
+ (x) => E ? h.participants : [...x, ...h.participants]
1860
+ ), v(h.hasMore), I(h.nextCursor);
1861
+ } catch (h) {
1862
+ const x = h instanceof Error ? h.message : "Failed to load participants";
1863
+ g(x), console.error("[useParticipants] Load error:", h);
1845
1864
  } finally {
1846
1865
  m(!1);
1847
1866
  }
1848
- }, [t, E, S, r, l]), h = D(() => {
1849
- N && !l && C(!1);
1850
- }, [N, l, C]), b = D((k) => {
1851
- d(k), I(void 0), C(!0, k);
1852
- }, [C]), p = D(() => {
1867
+ }, [t, y, N, r, l]), d = _(() => {
1868
+ p && !l && C(!1);
1869
+ }, [p, l, C]), b = _((E) => {
1870
+ u(E), I(void 0), C(!0, E);
1871
+ }, [C]), k = _(() => {
1853
1872
  I(void 0), C(!0);
1854
1873
  }, [C]);
1855
1874
  return G(() => {
@@ -1858,26 +1877,26 @@ const Ps = ({
1858
1877
  participants: a,
1859
1878
  loading: l,
1860
1879
  error: f,
1861
- searchQuery: E,
1862
- hasMore: N,
1880
+ searchQuery: y,
1881
+ hasMore: p,
1863
1882
  totalCount: t.totalCount,
1864
- loadMore: h,
1883
+ loadMore: d,
1865
1884
  search: b,
1866
- refresh: p
1885
+ refresh: k
1867
1886
  };
1868
1887
  };
1869
1888
  export {
1870
- Z as Avatar,
1871
- Cs as ChannelEmptyState,
1889
+ q as Avatar,
1890
+ vs as ChannelEmptyState,
1872
1891
  ke as ChannelList,
1873
- Me as ChannelView,
1874
- Os as FaqList,
1875
- ks as FaqListItem,
1892
+ De as ChannelView,
1893
+ js as FaqList,
1894
+ _s as FaqListItem,
1876
1895
  Us as MessagingProvider,
1877
- Ps as MessagingShell,
1878
- Ss as ParticipantPicker,
1896
+ Os as MessagingShell,
1897
+ ps as ParticipantPicker,
1879
1898
  cs as formatRelativeTime,
1880
1899
  os as useMessaging,
1881
- js as useParticipants
1900
+ As as useParticipants
1882
1901
  };
1883
1902
  //# sourceMappingURL=index.js.map