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