@linktr.ee/messaging-react 1.12.2-rc-1765326466 โ†’ 1.12.2-rc-1765340127

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,10 +1,10 @@
1
- import { jsx as e, jsxs as i, Fragment as ve } from "react/jsx-runtime";
2
- import p from "classnames";
3
- import P, { createContext as Ue, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
1
+ import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
2
+ import k from "classnames";
3
+ import O, { createContext as Ue, useContext as Pe, useCallback as _, useState as E, useRef as z, useEffect as $ } from "react";
4
4
  import { StreamChatService as je } from "@linktr.ee/messaging-core";
5
- import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as $e, MessageInput as Ge, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as we, Window as Xe, MessageList as Ke } from "stream-chat-react";
5
+ import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as Ge, MessageInput as $e, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as ve, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
6
  import { XIcon as ue, ArrowUpIcon as es, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as xe, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as be } from "stream-chat";
7
+ import { LinkPreviewsManager as Ce } from "stream-chat";
8
8
  const ye = Ue({
9
9
  service: null,
10
10
  client: null,
@@ -15,17 +15,17 @@ const ye = Ue({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), ae = () => Oe(ye), Ms = ({
18
+ }), oe = () => Pe(ye), _s = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: r,
23
- capabilities: a = {},
23
+ capabilities: o = {},
24
24
  debug: d = !1
25
25
  }) => {
26
- const l = D(
27
- (u, ...b) => {
28
- d && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...b);
26
+ const l = _(
27
+ (u, ...C) => {
28
+ d && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...C);
29
29
  },
30
30
  [d]
31
31
  );
@@ -33,30 +33,30 @@ const ye = Ue({
33
33
  userId: s == null ? void 0 : s.id,
34
34
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
35
35
  serviceConfig: !!n,
36
- capabilities: Object.keys(a)
36
+ capabilities: Object.keys(o)
37
37
  });
38
- const [m, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [M, v] = y(!1), [c, N] = y(null), E = z(!1), I = z({
38
+ const [m, h] = E(null), [g, v] = E(null), [f, S] = E(!1), [R, w] = E(!1), [c, x] = E(null), y = z(!1), I = z({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
42
- capabilities: a
43
- }), k = z(0);
44
- k.current++, l("๐Ÿ“Š RENDER INFO", {
45
- renderCount: k.current,
42
+ capabilities: o
43
+ }), M = z(0);
44
+ M.current++, l("๐Ÿ“Š RENDER INFO", {
45
+ renderCount: M.current,
46
46
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
48
  userChanged: I.current.userId !== (s == null ? void 0 : s.id),
49
49
  apiKeyChanged: I.current.apiKey !== r,
50
50
  serviceConfigChanged: I.current.serviceConfig !== n,
51
- capabilitiesChanged: I.current.capabilities !== a
51
+ capabilitiesChanged: I.current.capabilities !== o
52
52
  }
53
53
  }), I.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
55
  apiKey: r,
56
56
  serviceConfig: n,
57
- capabilities: a
58
- }, G(() => {
59
- const u = k.current;
57
+ capabilities: o
58
+ }, $(() => {
59
+ const u = M.current;
60
60
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
61
61
  renderCount: u,
62
62
  apiKey: !!r,
@@ -79,40 +79,40 @@ const ye = Ue({
79
79
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: I.current.serviceConfig !== n
81
81
  });
82
- const b = new je({
82
+ const C = new je({
83
83
  ...n,
84
84
  apiKey: r,
85
85
  debug: d
86
86
  });
87
- return h(b), l("โœ… SERVICE SET", {
87
+ return h(C), l("โœ… SERVICE SET", {
88
88
  renderCount: u,
89
- serviceInstance: !!b
89
+ serviceInstance: !!C
90
90
  }), () => {
91
91
  l("๐Ÿงน SERVICE CLEANUP", {
92
92
  renderCount: u,
93
93
  reason: "Effect cleanup"
94
- }), b.disconnectUser().catch(console.error);
94
+ }), C.disconnectUser().catch(console.error);
95
95
  };
96
96
  }, [r, n, d, l]);
97
- const x = z(null);
98
- G(() => {
99
- var b, B;
97
+ const N = z(null);
98
+ $(() => {
99
+ var C, 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: E.current,
104
+ isConnecting: y.current,
105
105
  isConnected: f,
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 (E.current) {
111
+ if (y.current) {
112
112
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((b = x.current) == null ? void 0 : b.serviceId) === m && ((B = x.current) == null ? void 0 : B.userId) === s.id) {
115
+ if (((C = N.current) == null ? void 0 : C.serviceId) === m && ((B = N.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,40 +120,40 @@ const ye = Ue({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, v(!0), N(null);
123
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), y.current = !0, w(!0), x(null);
124
124
  try {
125
125
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
126
  const j = await m.connectUser(s);
127
- w(j), S(!0), x.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
127
+ v(j), S(!0), N.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: j.userID
130
130
  });
131
131
  } catch (j) {
132
- const W = j instanceof Error ? j.message : "Connection failed";
133
- N(W), l("โŒ USER CONNECTION ERROR", {
132
+ const Z = j instanceof Error ? j.message : "Connection failed";
133
+ x(Z), l("โŒ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: W
135
+ error: Z
136
136
  });
137
137
  } finally {
138
- v(!1), E.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ w(!1), y.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
140
  isConnected: f
141
141
  });
142
142
  }
143
143
  })();
144
- }, [m, s, l, f]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [m, s, l, f]), $(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!m,
146
146
  isConnected: f
147
147
  }), () => {
148
148
  m && f ? (l(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), x.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
+ ), N.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!m,
153
153
  isConnected: f
154
154
  });
155
155
  }), [m, f, l]);
156
- const R = D(async () => {
156
+ const p = _(async () => {
157
157
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!m,
159
159
  hasUser: !!s
@@ -161,52 +161,52 @@ const ye = Ue({
161
161
  l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
164
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
165
165
  try {
166
166
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await m.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
167
  const u = await m.connectUser(s);
168
- w(u), S(!0), N(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
168
+ v(u), S(!0), x(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
169
  } catch (u) {
170
- const b = u instanceof Error ? u.message : "Refresh failed";
171
- N(b), l("โŒ CONNECTION REFRESH ERROR", {
170
+ const C = u instanceof Error ? u.message : "Refresh failed";
171
+ x(C), l("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: b
173
+ error: C
174
174
  });
175
175
  } finally {
176
- v(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ w(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [m, s, l]), o = P.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [m, s, l]), a = O.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!m,
180
180
  hasClient: !!g,
181
181
  isConnected: f,
182
- isLoading: M,
182
+ isLoading: R,
183
183
  hasError: !!c,
184
- capabilitiesKeys: Object.keys(a)
184
+ capabilitiesKeys: Object.keys(o)
185
185
  }), {
186
186
  service: m,
187
187
  client: g,
188
188
  isConnected: f,
189
- isLoading: M,
189
+ isLoading: R,
190
190
  error: c,
191
- capabilities: a,
192
- refreshConnection: R,
191
+ capabilities: o,
192
+ refreshConnection: p,
193
193
  debug: d
194
194
  }), [
195
195
  m,
196
196
  g,
197
197
  f,
198
- M,
199
- c,
200
- a,
201
198
  R,
199
+ c,
200
+ o,
201
+ p,
202
202
  d,
203
203
  l
204
204
  ]);
205
205
  return l("๐Ÿ”„ RENDER END", {
206
- renderCount: k.current,
206
+ renderCount: M.current,
207
207
  willRenderChat: !!(g && f),
208
- contextValueReady: !!o
209
- }), /* @__PURE__ */ e(ye.Provider, { value: o, children: g && f ? /* @__PURE__ */ e(
208
+ contextValueReady: !!a
209
+ }), /* @__PURE__ */ e(ye.Provider, { value: a, children: g && f ? /* @__PURE__ */ e(
210
210
  Ae,
211
211
  {
212
212
  client: g,
@@ -216,14 +216,14 @@ const ye = Ue({
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, rs = () => ae(), ls = (t, s) => {
219
+ }, rs = () => oe(), ls = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
- ), a = new Date(
222
+ ), o = new Date(
223
223
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
224
224
  ).getTime() - n.getTime();
225
- return Math.floor(a / (1e3 * 60 * 60 * 24));
226
- }, as = (t) => {
225
+ return Math.floor(o / (1e3 * 60 * 60 * 24));
226
+ }, os = (t) => {
227
227
  const s = /* @__PURE__ */ new Date();
228
228
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
229
229
  return "Just now";
@@ -236,7 +236,7 @@ const ye = Ue({
236
236
  day: "numeric",
237
237
  year: "2-digit"
238
238
  });
239
- }, Ce = [
239
+ }, be = [
240
240
  "๐ŸŽ",
241
241
  // Apple
242
242
  "๐ŸŒ",
@@ -264,7 +264,7 @@ const ye = Ue({
264
264
  "๐Ÿˆ"
265
265
  // Melon
266
266
  ];
267
- function os(t) {
267
+ function as(t) {
268
268
  let s = 0;
269
269
  for (let n = 0; n < t.length; n++) {
270
270
  const r = t.charCodeAt(n);
@@ -273,24 +273,24 @@ function os(t) {
273
273
  return Math.abs(s);
274
274
  }
275
275
  function is(t) {
276
- const n = os(t) % Ce.length;
277
- return Ce[n];
276
+ const n = as(t) % be.length;
277
+ return be[n];
278
278
  }
279
- const q = ({
279
+ const Y = ({
280
280
  id: t,
281
281
  image: s,
282
282
  size: n = 40,
283
283
  className: r,
284
- shape: a = "squircle"
284
+ shape: o = "squircle"
285
285
  }) => {
286
- const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
286
+ const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = o === "circle" ? { borderRadius: "50%" } : {
287
287
  borderRadius: "33%",
288
288
  "corner-shape": "superellipse(1.3)"
289
289
  };
290
290
  return /* @__PURE__ */ e(
291
291
  "div",
292
292
  {
293
- className: p("flex-shrink-0 overflow-hidden", r),
293
+ className: k("flex-shrink-0 overflow-hidden", r),
294
294
  style: {
295
295
  width: `${n}px`,
296
296
  height: `${n}px`,
@@ -307,7 +307,7 @@ const q = ({
307
307
  "div",
308
308
  {
309
309
  "aria-hidden": "true",
310
- className: p(
310
+ className: k(
311
311
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
312
312
  m
313
313
  ),
@@ -316,34 +316,34 @@ const q = ({
316
316
  )
317
317
  }
318
318
  );
319
- }, Ee = P.memo(
320
- ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
321
- var N, E, I, k, x, R;
319
+ }, Ee = O.memo(
320
+ ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
321
+ var x, y, I, M, N, p;
322
322
  const d = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
323
  t && n(t);
324
- }, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
325
- (o) => {
326
- var u, b;
327
- return ((u = o.user) == null ? void 0 : u.id) && o.user.id !== ((b = t == null ? void 0 : t._client) == null ? void 0 : b.userID);
324
+ }, h = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
325
+ (a) => {
326
+ var u, C;
327
+ return ((u = a.user) == null ? void 0 : u.id) && a.user.id !== ((C = t == null ? void 0 : t._client) == null ? void 0 : C.userID);
328
328
  }
329
- ), g = ((E = h == null ? void 0 : h.user) == null ? void 0 : E.name) || "Conversation", w = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (x = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : x[t.state.messages.length - 1], M = (() => {
329
+ ), g = ((y = h == null ? void 0 : h.user) == null ? void 0 : y.name) || "Conversation", v = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (N = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : N[t.state.messages.length - 1], R = (() => {
330
330
  var u;
331
331
  if (f != null && f.text) return f.text;
332
- const o = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
- return o != null && o.asset_url ? o.asset_url : o != null && o.image_url ? o.image_url : o != null && o.og_scrape_url ? o.og_scrape_url : o != null && o.thumb_url ? o.thumb_url : "No messages yet";
334
- })(), v = f != null && f.created_at ? as(new Date(f.created_at)) : "", c = a ?? 0;
332
+ const a = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
+ return a != null && a.asset_url ? a.asset_url : a != null && a.image_url ? a.image_url : a != null && a.og_scrape_url ? a.og_scrape_url : a != null && a.thumb_url ? a.thumb_url : "No messages yet";
334
+ })(), w = f != null && f.created_at ? os(new Date(f.created_at)) : "", c = o ?? 0;
335
335
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
336
336
  channelId: t == null ? void 0 : t.id,
337
337
  isSelected: d,
338
338
  participantName: g,
339
339
  unreadCount: c,
340
- hasTimestamp: !!v
340
+ hasTimestamp: !!w
341
341
  }), /* @__PURE__ */ e(
342
342
  "button",
343
343
  {
344
344
  type: "button",
345
345
  onClick: l,
346
- className: p(
346
+ className: k(
347
347
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
348
348
  {
349
349
  "bg-primary-alt/10 border-l-4 border-l-primary": d,
@@ -352,11 +352,11 @@ const q = ({
352
352
  ),
353
353
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
354
354
  /* @__PURE__ */ e(
355
- q,
355
+ Y,
356
356
  {
357
- id: ((R = h == null ? void 0 : h.user) == null ? void 0 : R.id) || t.id || "unknown",
357
+ id: ((p = h == null ? void 0 : h.user) == null ? void 0 : p.id) || t.id || "unknown",
358
358
  name: g,
359
- image: w,
359
+ image: v,
360
360
  size: 44,
361
361
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
362
362
  }
@@ -366,17 +366,17 @@ const q = ({
366
366
  /* @__PURE__ */ e(
367
367
  "h3",
368
368
  {
369
- className: p(
369
+ className: k(
370
370
  "text-sm font-medium truncate",
371
371
  d ? "text-primary" : "text-charcoal"
372
372
  ),
373
373
  children: g
374
374
  }
375
375
  ),
376
- v && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: v })
376
+ w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
377
377
  ] }),
378
378
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
379
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: M }),
379
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
380
380
  c > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: c > 99 ? "99+" : c })
381
381
  ] })
382
382
  ] })
@@ -386,23 +386,23 @@ const q = ({
386
386
  }
387
387
  );
388
388
  Ee.displayName = "CustomChannelPreview";
389
- const Ie = P.memo(
389
+ const Ie = O.memo(
390
390
  ({
391
391
  onChannelSelect: t,
392
392
  selectedChannel: s,
393
393
  filters: n,
394
394
  className: r,
395
- customEmptyStateIndicator: a
395
+ customEmptyStateIndicator: o
396
396
  }) => {
397
- const d = P.useRef(0);
397
+ const d = O.useRef(0);
398
398
  d.current++;
399
- const { debug: l = !1 } = ae();
399
+ const { debug: l = !1 } = oe();
400
400
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
401
401
  renderCount: d.current,
402
402
  selectedChannelId: s == null ? void 0 : s.id,
403
403
  filters: n
404
404
  });
405
- const m = P.useMemo(() => (g) => /* @__PURE__ */ e(
405
+ const m = O.useMemo(() => (g) => /* @__PURE__ */ e(
406
406
  Ee,
407
407
  {
408
408
  ...g,
@@ -414,7 +414,7 @@ const Ie = P.memo(
414
414
  return /* @__PURE__ */ e(
415
415
  "div",
416
416
  {
417
- className: p(
417
+ className: k(
418
418
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
419
419
  r
420
420
  ),
@@ -425,7 +425,7 @@ const Ie = P.memo(
425
425
  sort: { last_message_at: -1 },
426
426
  options: { limit: 30 },
427
427
  Preview: m,
428
- EmptyStateIndicator: a
428
+ EmptyStateIndicator: o
429
429
  },
430
430
  JSON.stringify(n)
431
431
  ) })
@@ -443,7 +443,7 @@ const ne = ({
443
443
  "button",
444
444
  {
445
445
  type: "button",
446
- className: p(
446
+ className: k(
447
447
  "flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
448
448
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
449
449
  s
@@ -457,7 +457,7 @@ function Se({ label: t, className: s, children: n, ...r }) {
457
457
  "button",
458
458
  {
459
459
  type: "button",
460
- className: p(
460
+ className: k(
461
461
  "rounded-full p-2 transition-colors focus-ring",
462
462
  {
463
463
  "cursor-not-allowed opacity-50": r.disabled,
@@ -478,13 +478,13 @@ function pe({ onClick: t }) {
478
478
  }
479
479
  const cs = (t) => ({
480
480
  linkPreviews: Array.from(t.previews.values()).filter(
481
- (s) => be.previewIsLoaded(s) || be.previewIsLoading(s)
481
+ (s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
482
482
  )
483
483
  }), ds = ({
484
484
  link: t,
485
485
  onDismiss: s
486
486
  }) => {
487
- const { og_scrape_url: n, title: r, image_url: a } = t;
487
+ const { og_scrape_url: n, title: r, image_url: o } = t;
488
488
  return /* @__PURE__ */ i(
489
489
  "a",
490
490
  {
@@ -493,10 +493,10 @@ const cs = (t) => ({
493
493
  rel: "noopener noreferrer",
494
494
  className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
495
495
  children: [
496
- a && /* @__PURE__ */ e(
496
+ o && /* @__PURE__ */ e(
497
497
  "img",
498
498
  {
499
- src: a,
499
+ src: o,
500
500
  alt: r || "",
501
501
  className: "h-[148px] w-full rounded-[20px] object-cover"
502
502
  }
@@ -521,23 +521,23 @@ const cs = (t) => ({
521
521
  }
522
522
  );
523
523
  }, us = () => {
524
- const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = $e(
524
+ const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = Ge(
525
525
  t.state,
526
526
  cs
527
- ), n = (a) => {
528
- t.dismissPreview(a);
527
+ ), n = (o) => {
528
+ t.dismissPreview(o);
529
529
  };
530
- return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
530
+ return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
531
531
  ds,
532
532
  {
533
- link: a,
533
+ link: o,
534
534
  onDismiss: n
535
535
  },
536
- a.og_scrape_url
536
+ o.og_scrape_url
537
537
  )) }) : null;
538
538
  }, ms = () => {
539
539
  const { handleSubmit: t } = He(), s = Ve();
540
- return /* @__PURE__ */ i(ve, { children: [
540
+ return /* @__PURE__ */ i(we, { children: [
541
541
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(We, {}) }),
542
542
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
543
543
  /* @__PURE__ */ e(Ze, {}),
@@ -570,7 +570,7 @@ const cs = (t) => ({
570
570
  renderActions: t
571
571
  }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
572
572
  t && (t == null ? void 0 : t()),
573
- /* @__PURE__ */ e(Ge, { Input: ms })
573
+ /* @__PURE__ */ e($e, { Input: ms })
574
574
  ] }), fs = (t) => {
575
575
  const s = t.message.hide_date === !0;
576
576
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
@@ -581,10 +581,10 @@ const cs = (t) => ({
581
581
  ] }),
582
582
  !s && /* @__PURE__ */ e(Je, { message: t.message })
583
583
  ] });
584
- }, gs = () => null, xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
584
+ }, gs = () => (console.log("[ChannelEmptyState] render - returning NULL"), null), xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
585
585
  "div",
586
586
  {
587
- className: p("flex items-center justify-center h-full", t),
587
+ className: k("flex items-center justify-center h-full", t),
588
588
  children: [
589
589
  /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
590
590
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
@@ -624,25 +624,25 @@ const cs = (t) => ({
624
624
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
625
625
  ]
626
626
  }
627
- ), me = 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: [
627
+ ), me = O.memo(() => (console.log("[LoadingState] render - showing loading spinner"), /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
628
628
  /* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
629
629
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
630
- ] }) }));
630
+ ] }) })));
631
631
  me.displayName = "LoadingState";
632
632
  const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
633
- var h, g, w, f, S;
634
- const { channel: a } = we(), d = P.useMemo(() => Object.values(a.state.members || {}).find(
635
- (v) => {
633
+ var h, g, v, f, S;
634
+ const { channel: o } = ve(), d = O.useMemo(() => Object.values(o.state.members || {}).find(
635
+ (w) => {
636
636
  var c;
637
- return ((c = v.user) == null ? void 0 : c.id) && v.user.id !== a._client.userID;
637
+ return ((c = w.user) == null ? void 0 : c.id) && w.user.id !== o._client.userID;
638
638
  }
639
- ), [a._client.userID, a.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (w = d == null ? void 0 : d.user) == null ? void 0 : w.image;
639
+ ), [o._client.userID, o.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (v = d == null ? void 0 : d.user) == null ? void 0 : v.image;
640
640
  return /* @__PURE__ */ i("div", { className: "@container", children: [
641
641
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
642
642
  /* @__PURE__ */ e(
643
643
  "button",
644
644
  {
645
- className: p(
645
+ className: k(
646
646
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
647
647
  !s && "invisible"
648
648
  ),
@@ -655,9 +655,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
655
655
  ),
656
656
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
657
657
  /* @__PURE__ */ e(
658
- q,
658
+ Y,
659
659
  {
660
- id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || a.id || "unknown",
660
+ id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || o.id || "unknown",
661
661
  name: l,
662
662
  image: m,
663
663
  size: 40
@@ -668,7 +668,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
668
668
  /* @__PURE__ */ e(
669
669
  "button",
670
670
  {
671
- className: p(
671
+ className: k(
672
672
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
673
673
  ),
674
674
  onClick: n,
@@ -691,9 +691,9 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
691
691
  }
692
692
  ),
693
693
  /* @__PURE__ */ e(
694
- q,
694
+ Y,
695
695
  {
696
- id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || a.id || "unknown",
696
+ id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || o.id || "unknown",
697
697
  name: l,
698
698
  image: m,
699
699
  size: 40
@@ -704,7 +704,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
704
704
  r && n && /* @__PURE__ */ e(
705
705
  "button",
706
706
  {
707
- className: p(
707
+ className: k(
708
708
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
709
709
  ),
710
710
  onClick: n,
@@ -713,31 +713,31 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
713
713
  )
714
714
  ] })
715
715
  ] });
716
- }, bs = ({
716
+ }, Cs = ({
717
717
  dialogRef: t,
718
718
  onClose: s,
719
719
  participant: n,
720
720
  channel: r,
721
- followerStatusLabel: a,
721
+ followerStatusLabel: o,
722
722
  onLeaveConversation: d,
723
723
  onBlockParticipant: l,
724
724
  showDeleteConversation: m = !0,
725
725
  onDeleteConversationClick: h,
726
726
  onBlockParticipantClick: g,
727
- onReportParticipantClick: w
727
+ onReportParticipantClick: v
728
728
  }) => {
729
- var Q, X, ie, O, H, J, $;
730
- const { service: f, debug: S } = ae(), [M, v] = y(!1), [c, N] = y(!1), [E, I] = y(!1), k = D(async () => {
731
- var _;
732
- if (!(!f || !((_ = n == null ? void 0 : n.user) != null && _.id)))
729
+ var Q, X, ie, U, H, V, G;
730
+ const { service: f, debug: S } = oe(), [R, w] = E(!1), [c, x] = E(!1), [y, I] = E(!1), M = _(async () => {
731
+ var D;
732
+ if (!(!f || !((D = n == null ? void 0 : n.user) != null && D.id)))
733
733
  try {
734
734
  const A = (await f.getBlockedUsers()).some(
735
- (V) => {
735
+ (W) => {
736
736
  var K;
737
- return V.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
737
+ return W.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
738
738
  }
739
739
  );
740
- v(A);
740
+ w(A);
741
741
  } catch (T) {
742
742
  console.error(
743
743
  "[ChannelInfoDialog] Failed to check blocked status:",
@@ -745,55 +745,55 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
745
745
  );
746
746
  }
747
747
  }, [f, (Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id]);
748
- G(() => {
749
- k();
750
- }, [k]);
751
- const x = async () => {
752
- var _;
748
+ $(() => {
749
+ M();
750
+ }, [M]);
751
+ const N = async () => {
752
+ var D;
753
753
  if (!c) {
754
- h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
754
+ h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), x(!0);
755
755
  try {
756
- const T = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
756
+ const T = ((D = r._client) == null ? void 0 : D.userID) ?? null;
757
757
  await r.hide(T, !1), d && await d(r), s();
758
758
  } catch (T) {
759
759
  console.error("[ChannelInfoDialog] Failed to leave conversation", T);
760
760
  } finally {
761
- N(!1);
761
+ x(!1);
762
762
  }
763
763
  }
764
- }, R = async () => {
765
- var _, T, A;
766
- if (!(E || !f)) {
767
- g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), I(!0);
764
+ }, p = async () => {
765
+ var D, T, A;
766
+ if (!(y || !f)) {
767
+ g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
768
768
  try {
769
769
  await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
770
- } catch (V) {
771
- console.error("[ChannelInfoDialog] Failed to block member", V);
770
+ } catch (W) {
771
+ console.error("[ChannelInfoDialog] Failed to block member", W);
772
772
  } finally {
773
773
  I(!1);
774
774
  }
775
775
  }
776
- }, o = async () => {
777
- var _, T, A;
778
- if (!(E || !f)) {
779
- g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), I(!0);
776
+ }, a = async () => {
777
+ var D, T, A;
778
+ if (!(y || !f)) {
779
+ g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
780
780
  try {
781
781
  await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
782
- } catch (V) {
783
- console.error("[ChannelInfoDialog] Failed to unblock member", V);
782
+ } catch (W) {
783
+ console.error("[ChannelInfoDialog] Failed to unblock member", W);
784
784
  } finally {
785
785
  I(!1);
786
786
  }
787
787
  }
788
788
  }, u = () => {
789
- w == null || w(), s(), window.open(
789
+ v == null || v(), s(), window.open(
790
790
  "https://linktr.ee/s/about/trust-center/report",
791
791
  "_blank",
792
792
  "noopener,noreferrer"
793
793
  );
794
794
  };
795
795
  if (!n) return null;
796
- const b = ((X = n.user) == null ? void 0 : X.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (O = n.user) == null ? void 0 : O.image, j = (H = n.user) == null ? void 0 : H.email, W = (J = n.user) == null ? void 0 : J.username, Y = j || (W ? `linktr.ee/${W}` : void 0), oe = (($ = n.user) == null ? void 0 : $.id) || "unknown";
796
+ const C = ((X = n.user) == null ? void 0 : X.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (U = n.user) == null ? void 0 : U.image, j = (H = n.user) == null ? void 0 : H.email, Z = (V = n.user) == null ? void 0 : V.username, J = j || (Z ? `linktr.ee/${Z}` : void 0), ae = ((G = n.user) == null ? void 0 : G.id) || "unknown";
797
797
  return (
798
798
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
799
799
  /* @__PURE__ */ e(
@@ -802,8 +802,8 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
802
802
  ref: t,
803
803
  className: "mes-dialog group",
804
804
  onClose: s,
805
- onClick: (_) => {
806
- _.target === t.current && s();
805
+ onClick: (D) => {
806
+ D.target === t.current && s();
807
807
  },
808
808
  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: [
809
809
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
@@ -818,30 +818,30 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
818
818
  style: { backgroundColor: "#FBFAF9" },
819
819
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
820
820
  /* @__PURE__ */ e(
821
- q,
821
+ Y,
822
822
  {
823
- id: oe,
824
- name: b,
823
+ id: ae,
824
+ name: C,
825
825
  image: B,
826
826
  size: 88,
827
827
  shape: "circle"
828
828
  }
829
829
  ),
830
830
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
831
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: b }),
832
- Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
833
- a && /* @__PURE__ */ e(
831
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: C }),
832
+ J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
833
+ o && /* @__PURE__ */ e(
834
834
  "span",
835
835
  {
836
836
  className: "mt-1 rounded-full text-xs font-normal w-fit",
837
837
  style: {
838
838
  padding: "4px 8px",
839
- backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
840
- color: a === "Subscribed to you" ? "#008236" : "#78716C",
839
+ backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
840
+ color: o === "Subscribed to you" ? "#008236" : "#78716C",
841
841
  lineHeight: "133.333%",
842
842
  letterSpacing: "0.21px"
843
843
  },
844
- children: a
844
+ children: o
845
845
  }
846
846
  )
847
847
  ] })
@@ -852,7 +852,7 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
852
852
  m && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
853
853
  ne,
854
854
  {
855
- onClick: x,
855
+ onClick: N,
856
856
  disabled: c,
857
857
  "aria-busy": c,
858
858
  children: [
@@ -861,25 +861,25 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
861
861
  ]
862
862
  }
863
863
  ) }),
864
- /* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ i(
864
+ /* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
865
865
  ne,
866
866
  {
867
- onClick: o,
868
- disabled: E,
869
- "aria-busy": E,
867
+ onClick: a,
868
+ disabled: y,
869
+ "aria-busy": y,
870
870
  children: [
871
- E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
871
+ y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
872
872
  /* @__PURE__ */ e("span", { children: "Unblock" })
873
873
  ]
874
874
  }
875
875
  ) : /* @__PURE__ */ i(
876
876
  ne,
877
877
  {
878
- onClick: R,
879
- disabled: E,
880
- "aria-busy": E,
878
+ onClick: p,
879
+ disabled: y,
880
+ "aria-busy": y,
881
881
  children: [
882
- E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
882
+ y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
883
883
  /* @__PURE__ */ e("span", { children: "Block" })
884
884
  ]
885
885
  }
@@ -894,43 +894,43 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
894
894
  }
895
895
  )
896
896
  );
897
- }, Cs = ({
897
+ }, bs = ({
898
898
  onBack: t,
899
899
  showBackButton: s,
900
900
  renderMessageInputActions: n,
901
901
  onLeaveConversation: r,
902
- onBlockParticipant: a,
902
+ onBlockParticipant: o,
903
903
  showDeleteConversation: d = !0,
904
904
  onDeleteConversationClick: l,
905
905
  onBlockParticipantClick: m,
906
906
  onReportParticipantClick: h
907
907
  }) => {
908
- const { channel: g } = we(), w = z(null), f = P.useMemo(() => Object.values(g.state.members || {}).find(
909
- (N) => {
910
- var E;
911
- return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== g._client.userID;
908
+ const { channel: g } = ve(), v = z(null), f = O.useMemo(() => Object.values(g.state.members || {}).find(
909
+ (x) => {
910
+ var y;
911
+ return ((y = x.user) == null ? void 0 : y.id) && x.user.id !== g._client.userID;
912
912
  }
913
- ), [g._client.userID, g.state.members]), S = P.useMemo(() => {
913
+ ), [g._client.userID, g.state.members]), S = O.useMemo(() => {
914
914
  const c = g.data ?? {};
915
915
  if (c.followerStatus)
916
916
  return String(c.followerStatus);
917
917
  if (c.isFollower !== void 0)
918
918
  return c.isFollower ? "Subscribed to you" : "Not subscribed";
919
- }, [g.data]), M = D(() => {
919
+ }, [g.data]), R = _(() => {
920
920
  var c;
921
- (c = w.current) == null || c.showModal();
922
- }, []), v = D(() => {
921
+ (c = v.current) == null || c.showModal();
922
+ }, []), w = _(() => {
923
923
  var c;
924
- (c = w.current) == null || c.close();
924
+ (c = v.current) == null || c.close();
925
925
  }, []);
926
- return /* @__PURE__ */ i(ve, { children: [
926
+ return /* @__PURE__ */ i(we, { children: [
927
927
  /* @__PURE__ */ i(Xe, { children: [
928
928
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
929
929
  Ns,
930
930
  {
931
931
  onBack: t,
932
932
  showBackButton: s,
933
- onShowInfo: M,
933
+ onShowInfo: R,
934
934
  canShowInfo: !!f
935
935
  }
936
936
  ) }),
@@ -950,15 +950,15 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
950
950
  )
951
951
  ] }),
952
952
  /* @__PURE__ */ e(
953
- bs,
953
+ Cs,
954
954
  {
955
- dialogRef: w,
956
- onClose: v,
955
+ dialogRef: v,
956
+ onClose: w,
957
957
  participant: f,
958
958
  channel: g,
959
959
  followerStatusLabel: S,
960
960
  onLeaveConversation: r,
961
- onBlockParticipant: a,
961
+ onBlockParticipant: o,
962
962
  showDeleteConversation: d,
963
963
  onDeleteConversationClick: l,
964
964
  onBlockParticipantClick: m,
@@ -966,56 +966,63 @@ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
966
966
  }
967
967
  )
968
968
  ] });
969
- }, ke = P.memo(
969
+ }, ke = O.memo(
970
970
  ({
971
971
  channel: t,
972
972
  onBack: s,
973
973
  showBackButton: n = !1,
974
974
  renderMessageInputActions: r,
975
- onLeaveConversation: a,
975
+ onLeaveConversation: o,
976
976
  onBlockParticipant: d,
977
977
  className: l,
978
978
  CustomChannelEmptyState: m = gs,
979
979
  showDeleteConversation: h = !0,
980
980
  onDeleteConversationClick: g,
981
- onBlockParticipantClick: w,
981
+ onBlockParticipantClick: v,
982
982
  onReportParticipantClick: f
983
- }) => /* @__PURE__ */ e(
984
- "div",
985
- {
986
- className: p(
987
- "messaging-channel-view h-full flex flex-col",
988
- l
989
- ),
990
- children: /* @__PURE__ */ e(
991
- Qe,
992
- {
993
- channel: t,
994
- MessageSystem: fs,
995
- EmptyStateIndicator: m,
996
- LoadingIndicator: me,
997
- children: /* @__PURE__ */ e(
998
- Cs,
999
- {
1000
- onBack: s,
1001
- showBackButton: n,
1002
- renderMessageInputActions: r,
1003
- onLeaveConversation: a,
1004
- onBlockParticipant: d,
1005
- CustomChannelEmptyState: m,
1006
- showDeleteConversation: h,
1007
- onDeleteConversationClick: g,
1008
- onBlockParticipantClick: w,
1009
- onReportParticipantClick: f
1010
- }
1011
- )
1012
- }
1013
- )
1014
- }
1015
- )
983
+ }) => {
984
+ var S, R;
985
+ return console.log("[ChannelView] render", {
986
+ channelId: t.id,
987
+ channelInitialized: t.initialized,
988
+ messageCount: (R = (S = t.state) == null ? void 0 : S.messages) == null ? void 0 : R.length
989
+ }), /* @__PURE__ */ e(
990
+ "div",
991
+ {
992
+ className: k(
993
+ "messaging-channel-view h-full flex flex-col",
994
+ l
995
+ ),
996
+ children: /* @__PURE__ */ e(
997
+ Qe,
998
+ {
999
+ channel: t,
1000
+ MessageSystem: fs,
1001
+ EmptyStateIndicator: m,
1002
+ LoadingIndicator: me,
1003
+ children: /* @__PURE__ */ e(
1004
+ bs,
1005
+ {
1006
+ onBack: s,
1007
+ showBackButton: n,
1008
+ renderMessageInputActions: r,
1009
+ onLeaveConversation: o,
1010
+ onBlockParticipant: d,
1011
+ CustomChannelEmptyState: m,
1012
+ showDeleteConversation: h,
1013
+ onDeleteConversationClick: g,
1014
+ onBlockParticipantClick: v,
1015
+ onReportParticipantClick: f
1016
+ }
1017
+ )
1018
+ }
1019
+ )
1020
+ }
1021
+ );
1022
+ }
1016
1023
  );
1017
1024
  ke.displayName = "ChannelView";
1018
- function vs({
1025
+ function ws({
1019
1026
  searchQuery: t,
1020
1027
  setSearchQuery: s,
1021
1028
  placeholder: n
@@ -1036,7 +1043,7 @@ function vs({
1036
1043
  type: "text",
1037
1044
  placeholder: n,
1038
1045
  value: t,
1039
- onChange: (a) => s(a.target.value),
1046
+ onChange: (o) => s(o.target.value),
1040
1047
  className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
1041
1048
  }
1042
1049
  ),
@@ -1045,8 +1052,8 @@ function vs({
1045
1052
  {
1046
1053
  label: "Clear search",
1047
1054
  onClick: () => {
1048
- var a;
1049
- s(""), (a = r.current) == null || a.focus();
1055
+ var o;
1056
+ s(""), (o = r.current) == null || o.focus();
1050
1057
  },
1051
1058
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1052
1059
  children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
@@ -1054,19 +1061,19 @@ function vs({
1054
1061
  )
1055
1062
  ] });
1056
1063
  }
1057
- const ws = ({
1064
+ const vs = ({
1058
1065
  participantSource: t,
1059
1066
  onSelectParticipant: s,
1060
1067
  onClose: n,
1061
1068
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
1062
- participantLabel: a = "participants",
1069
+ participantLabel: o = "participants",
1063
1070
  searchPlaceholder: d = "Search participants...",
1064
1071
  className: l
1065
1072
  }) => {
1066
- const { debug: m } = ae(), [h, g] = y(""), [w, f] = y([]), [S, M] = y(!1), [v, c] = y(null), [N, E] = y(
1073
+ const { debug: m } = oe(), [h, g] = E(""), [v, f] = E([]), [S, R] = E(!1), [w, c] = E(null), [x, y] = E(
1067
1074
  null
1068
1075
  ), I = z(!1);
1069
- G(() => {
1076
+ $(() => {
1070
1077
  if (t.loading) {
1071
1078
  m && console.log(
1072
1079
  "[ParticipantPicker] Waiting for participant source to finish loading..."
@@ -1075,7 +1082,7 @@ const ws = ({
1075
1082
  }
1076
1083
  if (I.current) return;
1077
1084
  (async () => {
1078
- m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), c(null);
1085
+ m && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), c(null);
1079
1086
  try {
1080
1087
  const u = await t.loadParticipants({
1081
1088
  search: "",
@@ -1087,34 +1094,34 @@ const ws = ({
1087
1094
  u.participants.length
1088
1095
  );
1089
1096
  } catch (u) {
1090
- const b = u instanceof Error ? u.message : "Failed to load participants";
1091
- c(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1097
+ const C = u instanceof Error ? u.message : "Failed to load participants";
1098
+ c(C), console.error("[ParticipantPicker] Failed to load participants:", u);
1092
1099
  } finally {
1093
- M(!1);
1100
+ R(!1);
1094
1101
  }
1095
1102
  })();
1096
1103
  }, [t.loading, m]);
1097
- const k = w.filter((o) => !r.has(o.id)).filter((o) => {
1098
- var b;
1104
+ const M = v.filter((a) => !r.has(a.id)).filter((a) => {
1105
+ var C;
1099
1106
  if (!h) return !0;
1100
1107
  const u = h.toLowerCase();
1101
- return o.name.toLowerCase().includes(u) || ((b = o.email) == null ? void 0 : b.toLowerCase().includes(u)) || !1;
1102
- }), x = D(
1103
- async (o) => {
1104
- if (!N) {
1105
- E(o.id);
1108
+ return a.name.toLowerCase().includes(u) || ((C = a.email) == null ? void 0 : C.toLowerCase().includes(u)) || !1;
1109
+ }), N = _(
1110
+ async (a) => {
1111
+ if (!x) {
1112
+ y(a.id);
1106
1113
  try {
1107
- await s(o);
1114
+ await s(a);
1108
1115
  } catch (u) {
1109
- console.error("[ParticipantPicker] Failed to start chat:", u), E(null);
1116
+ console.error("[ParticipantPicker] Failed to start chat:", u), y(null);
1110
1117
  }
1111
1118
  }
1112
1119
  },
1113
- [s, N]
1114
- ), R = (o, u) => {
1115
- (o.key === "Enter" || o.key === " ") && (o.preventDefault(), x(u));
1120
+ [s, x]
1121
+ ), p = (a, u) => {
1122
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), N(u));
1116
1123
  };
1117
- return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
1124
+ return /* @__PURE__ */ i("div", { className: k("flex flex-col h-full", l), children: [
1118
1125
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1119
1126
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1120
1127
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
@@ -1122,14 +1129,14 @@ const ws = ({
1122
1129
  ] }),
1123
1130
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1124
1131
  "Select a ",
1125
- a.slice(0, -1),
1132
+ o.slice(0, -1),
1126
1133
  " to start messaging (",
1127
- k.length,
1134
+ M.length,
1128
1135
  " available)",
1129
- t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${a} total`
1136
+ t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${o} total`
1130
1137
  ] }),
1131
1138
  /* @__PURE__ */ e(
1132
- vs,
1139
+ ws,
1133
1140
  {
1134
1141
  searchQuery: h,
1135
1142
  setSearchQuery: g,
@@ -1137,53 +1144,53 @@ const ws = ({
1137
1144
  }
1138
1145
  )
1139
1146
  ] }),
1140
- v && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1147
+ w && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1141
1148
  "Error loading ",
1142
- a,
1149
+ o,
1143
1150
  ": ",
1144
- v
1151
+ w
1145
1152
  ] }),
1146
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && 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: [
1153
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && M.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: [
1147
1154
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1148
1155
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1149
1156
  "Loading ",
1150
- a,
1157
+ o,
1151
1158
  "..."
1152
1159
  ] })
1153
- ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1160
+ ] }) }) : M.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1154
1161
  /* @__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" }) }),
1155
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : w.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1156
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1162
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${o} found` : v.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1163
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1157
1164
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1158
- k.map((o) => {
1159
- const u = o.name || o.email || o.id, b = o.email && o.name ? o.email : o.phone;
1165
+ M.map((a) => {
1166
+ const u = a.name || a.email || a.id, C = a.email && a.name ? a.email : a.phone;
1160
1167
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1161
1168
  "button",
1162
1169
  {
1163
1170
  type: "button",
1164
- onClick: () => x(o),
1165
- onKeyDown: (B) => R(B, o),
1171
+ onClick: () => N(a),
1172
+ onKeyDown: (B) => p(B, a),
1166
1173
  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",
1167
1174
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1168
1175
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1169
1176
  /* @__PURE__ */ e(
1170
- q,
1177
+ Y,
1171
1178
  {
1172
- id: o.id,
1179
+ id: a.id,
1173
1180
  name: u,
1174
- image: o.image,
1181
+ image: a.image,
1175
1182
  size: 40
1176
1183
  }
1177
1184
  ),
1178
1185
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1179
1186
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1180
- b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
1187
+ C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
1181
1188
  ] })
1182
1189
  ] }),
1183
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === o.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1190
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: x === a.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1184
1191
  ] })
1185
1192
  }
1186
- ) }, o.id);
1193
+ ) }, a.id);
1187
1194
  }),
1188
1195
  S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1189
1196
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
@@ -1325,7 +1332,7 @@ const ws = ({
1325
1332
  ] })
1326
1333
  ]
1327
1334
  }
1328
- ), Re = P.memo(
1335
+ ), Re = O.memo(
1329
1336
  ({ 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: [
1330
1337
  /* @__PURE__ */ e(ys, {}),
1331
1338
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
@@ -1335,7 +1342,7 @@ const ws = ({
1335
1342
  ] }) })
1336
1343
  );
1337
1344
  Re.displayName = "EmptyState";
1338
- 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: [
1345
+ const le = O.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: [
1339
1346
  /* @__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: "โš ๏ธ" }) }),
1340
1347
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1341
1348
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1355,111 +1362,111 @@ const Fs = ({
1355
1362
  className: s,
1356
1363
  renderMessageInputActions: n,
1357
1364
  onChannelSelect: r,
1358
- onParticipantSelect: a,
1365
+ onParticipantSelect: o,
1359
1366
  initialParticipantFilter: d,
1360
1367
  initialParticipantData: l,
1361
1368
  CustomChannelEmptyState: m,
1362
1369
  showChannelList: h = !0,
1363
1370
  filters: g,
1364
- channelListCustomEmptyStateIndicator: w,
1371
+ channelListCustomEmptyStateIndicator: v,
1365
1372
  onDeleteConversationClick: f,
1366
1373
  onBlockParticipantClick: S,
1367
- onReportParticipantClick: M
1374
+ onReportParticipantClick: R
1368
1375
  }) => {
1369
1376
  const {
1370
- service: v,
1377
+ service: w,
1371
1378
  client: c,
1372
- isConnected: N,
1373
- isLoading: E,
1379
+ isConnected: x,
1380
+ isLoading: y,
1374
1381
  error: I,
1375
- refreshConnection: k,
1376
- debug: x
1377
- } = rs(), [R, o] = y(null), [u, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [oe, Q] = y(/* @__PURE__ */ new Set()), [X, ie] = y(0), [O, H] = y(!1), [J, $] = y(null), _ = z(null), {
1382
+ refreshConnection: M,
1383
+ debug: N
1384
+ } = rs(), [p, a] = E(null), [u, C] = E(!1), [B, j] = E(!1), [Z, J] = E(!1), [ae, Q] = E(/* @__PURE__ */ new Set()), [X, ie] = E(0), [U, H] = E(!1), [V, G] = E(null), D = z(null), {
1378
1385
  participantSource: T,
1379
1386
  participantLabel: A = "participants",
1380
- showDeleteConversation: V = !0
1381
- } = t, K = P.useMemo(() => {
1382
- const C = c == null ? void 0 : c.userID;
1387
+ showDeleteConversation: W = !0
1388
+ } = t, K = O.useMemo(() => {
1389
+ const b = c == null ? void 0 : c.userID;
1383
1390
  return {
1384
1391
  ...{
1385
1392
  type: "messaging",
1386
1393
  last_message_at: { $exists: !0 },
1387
- ...C && {
1388
- members: { $in: [C] },
1394
+ ...b && {
1395
+ members: { $in: [b] },
1389
1396
  hidden: !1
1390
1397
  }
1391
1398
  },
1392
1399
  ...g
1393
1400
  };
1394
- }, [g, c == null ? void 0 : c.userID]), ee = z(null), Z = D(async () => {
1395
- if (!c || !N) return;
1396
- const C = c.userID;
1397
- if (C)
1401
+ }, [g, c == null ? void 0 : c.userID]), ee = z(null), q = _(async () => {
1402
+ if (!c || !x) return;
1403
+ const b = c.userID;
1404
+ if (b)
1398
1405
  try {
1399
- x && console.log("[MessagingShell] Syncing channels for user:", C);
1400
- const U = await c.queryChannels(
1406
+ N && console.log("[MessagingShell] Syncing channels for user:", b);
1407
+ const P = await c.queryChannels(
1401
1408
  {
1402
1409
  type: "messaging",
1403
- members: { $in: [C] }
1410
+ members: { $in: [b] }
1404
1411
  },
1405
1412
  {},
1406
1413
  { limit: 100 }
1407
1414
  ), F = /* @__PURE__ */ new Set();
1408
- U.forEach((L) => {
1415
+ P.forEach((L) => {
1409
1416
  const ce = L.state.members;
1410
- Object.values(ce).forEach((Pe) => {
1417
+ Object.values(ce).forEach((Oe) => {
1411
1418
  var he;
1412
- const de = (he = Pe.user) == null ? void 0 : he.id;
1413
- de && de !== C && F.add(de);
1419
+ const de = (he = Oe.user) == null ? void 0 : he.id;
1420
+ de && de !== b && F.add(de);
1414
1421
  });
1415
- }), Q((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), b(U.length > 0), j(!0), ee.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
1416
- channelCount: U.length,
1422
+ }), Q((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), C(P.length > 0), j(!0), ee.current = b, N && console.log("[MessagingShell] Channels synced successfully:", {
1423
+ channelCount: P.length,
1417
1424
  memberCount: F.size
1418
1425
  });
1419
- } catch (U) {
1420
- console.error("[MessagingShell] Failed to sync channels:", U);
1426
+ } catch (P) {
1427
+ console.error("[MessagingShell] Failed to sync channels:", P);
1421
1428
  }
1422
- }, [c, N, x]);
1423
- G(() => {
1424
- if (!c || !N) return;
1425
- const C = c.userID;
1426
- C && ee.current !== C && Z();
1427
- }, [c, N, Z]), G(() => {
1428
- if (!d || !c || !N) return;
1429
+ }, [c, x, N]);
1430
+ $(() => {
1431
+ if (!c || !x) return;
1432
+ const b = c.userID;
1433
+ b && ee.current !== b && q();
1434
+ }, [c, x, q]), $(() => {
1435
+ if (!d || !c || !x) return;
1429
1436
  (async () => {
1430
- const U = c.userID;
1431
- if (U)
1437
+ const P = c.userID;
1438
+ if (P)
1432
1439
  try {
1433
- x && console.log(
1440
+ N && console.log(
1434
1441
  "[MessagingShell] Loading initial conversation with:",
1435
1442
  d
1436
1443
  );
1437
1444
  const F = await c.queryChannels(
1438
1445
  {
1439
1446
  type: "messaging",
1440
- members: { $eq: [U, d] }
1447
+ members: { $eq: [P, d] }
1441
1448
  },
1442
1449
  {},
1443
1450
  { limit: 1 }
1444
1451
  );
1445
1452
  if (F.length > 0)
1446
- o(F[0]), H(!0), $(null), r && r(F[0]), x && console.log(
1453
+ a(F[0]), H(!0), G(null), r && r(F[0]), N && console.log(
1447
1454
  "[MessagingShell] Initial conversation loaded:",
1448
1455
  F[0].id
1449
1456
  );
1450
- else if (l && v) {
1451
- x && console.log(
1457
+ else if (l && w) {
1458
+ N && console.log(
1452
1459
  "[MessagingShell] No conversation found, creating one for:",
1453
1460
  l
1454
1461
  );
1455
1462
  try {
1456
- const L = await v.startChannelWithParticipant({
1463
+ const L = await w.startChannelWithParticipant({
1457
1464
  id: l.id,
1458
1465
  name: l.name,
1459
1466
  email: l.email,
1460
1467
  phone: l.phone
1461
1468
  });
1462
- o(L), H(!0), $(null), r && r(L), x && console.log(
1469
+ a(L), H(!0), G(null), r && r(L), N && console.log(
1463
1470
  "[MessagingShell] Channel created and loaded:",
1464
1471
  L.id
1465
1472
  );
@@ -1467,12 +1474,12 @@ const Fs = ({
1467
1474
  console.error(
1468
1475
  "[MessagingShell] Failed to create conversation:",
1469
1476
  L
1470
- ), $("Failed to create conversation");
1477
+ ), G("Failed to create conversation");
1471
1478
  }
1472
1479
  } else
1473
- $(
1480
+ G(
1474
1481
  "No conversation found with this account"
1475
- ), x && console.log(
1482
+ ), N && console.log(
1476
1483
  "[MessagingShell] No conversation found for:",
1477
1484
  d
1478
1485
  );
@@ -1480,80 +1487,88 @@ const Fs = ({
1480
1487
  console.error(
1481
1488
  "[MessagingShell] Failed to load initial conversation:",
1482
1489
  F
1483
- ), $("Failed to load conversation");
1490
+ ), G("Failed to load conversation");
1484
1491
  }
1485
1492
  })();
1486
1493
  }, [
1487
1494
  d,
1488
1495
  l,
1489
1496
  c,
1490
- N,
1491
- v,
1492
1497
  x,
1498
+ w,
1499
+ N,
1493
1500
  r
1494
1501
  ]);
1495
- const _e = D(
1496
- (C) => {
1497
- o(C), r == null || r(C);
1502
+ const Me = _(
1503
+ (b) => {
1504
+ a(b), r == null || r(b);
1498
1505
  },
1499
1506
  [r]
1500
- ), De = D(() => {
1501
- O || o(null);
1502
- }, [O]), Me = D(
1503
- async (C) => {
1504
- var U;
1505
- if (v)
1507
+ ), De = _(() => {
1508
+ U || a(null);
1509
+ }, [U]), _e = _(
1510
+ async (b) => {
1511
+ var P;
1512
+ if (w)
1506
1513
  try {
1507
- x && console.log(
1514
+ N && console.log(
1508
1515
  "[MessagingShell] Starting conversation with:",
1509
- C.id
1516
+ b.id
1510
1517
  );
1511
- const F = await v.startChannelWithParticipant({
1512
- id: C.id,
1513
- name: C.name,
1514
- email: C.email,
1515
- phone: C.phone
1518
+ const F = await w.startChannelWithParticipant({
1519
+ id: b.id,
1520
+ name: b.name,
1521
+ email: b.email,
1522
+ phone: b.phone
1516
1523
  });
1517
1524
  try {
1518
1525
  await F.show();
1519
1526
  } catch (L) {
1520
1527
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1521
1528
  }
1522
- o(F), Y(!1), (U = _.current) == null || U.close(), a == null || a(C);
1529
+ a(F), J(!1), (P = D.current) == null || P.close(), o == null || o(b);
1523
1530
  } catch (F) {
1524
1531
  console.error("[MessagingShell] Failed to start conversation:", F);
1525
1532
  }
1526
1533
  },
1527
- [v, a, x]
1528
- ), se = D(() => {
1529
- var C;
1530
- Y(!1), (C = _.current) == null || C.close();
1531
- }, []), Fe = D(
1532
- (C) => {
1533
- C.target === _.current && se();
1534
+ [w, o, N]
1535
+ ), se = _(() => {
1536
+ var b;
1537
+ J(!1), (b = D.current) == null || b.close();
1538
+ }, []), Fe = _(
1539
+ (b) => {
1540
+ b.target === D.current && se();
1534
1541
  },
1535
1542
  [se]
1536
- ), Te = D(
1537
- async (C) => {
1538
- x && console.log("[MessagingShell] Leaving conversation:", C.id), o(null), H(!1), ee.current = null, await Z();
1543
+ ), Te = _(
1544
+ async (b) => {
1545
+ N && console.log("[MessagingShell] Leaving conversation:", b.id), a(null), H(!1), ee.current = null, await q();
1539
1546
  },
1540
- [Z, x]
1541
- ), Le = D(
1542
- async (C) => {
1543
- x && console.log("[MessagingShell] Blocking participant:", C), o(null), H(!1), ee.current = null, await Z();
1547
+ [q, N]
1548
+ ), Le = _(
1549
+ async (b) => {
1550
+ N && console.log("[MessagingShell] Blocking participant:", b), a(null), H(!1), ee.current = null, await q();
1544
1551
  },
1545
- [Z, x]
1546
- ), te = !!R;
1547
- return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(me, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !c ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1552
+ [q, N]
1553
+ ), te = !!p;
1554
+ return console.log("[MessagingShell] render", {
1555
+ isLoading: y,
1556
+ error: I,
1557
+ isConnected: x,
1558
+ hasClient: !!c,
1559
+ directConversationError: V,
1560
+ selectedChannelId: p == null ? void 0 : p.id,
1561
+ directConversationMode: U
1562
+ }), y ? (console.log("[MessagingShell] showing LOADING state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(me, {}) })) : I ? (console.log("[MessagingShell] showing ERROR state:", I), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: M }) })) : !x || !c ? (console.log("[MessagingShell] showing NOT CONNECTED state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
1548
1563
  le,
1549
1564
  {
1550
1565
  message: "Not connected to messaging service",
1551
- onBack: k
1566
+ onBack: M
1552
1567
  }
1553
- ) }) : J ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: J }) }) : /* @__PURE__ */ i(
1568
+ ) })) : V ? (console.log("[MessagingShell] showing DIRECT CONVERSATION ERROR:", V), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: V }) })) : (console.log("[MessagingShell] rendering main UI with ChannelView"), /* @__PURE__ */ i(
1554
1569
  "div",
1555
1570
  {
1556
- className: p(
1571
+ className: k(
1557
1572
  "messaging-shell h-full bg-background-secondary overflow-hidden",
1558
1573
  s
1559
1574
  ),
@@ -1562,23 +1577,23 @@ const Fs = ({
1562
1577
  /* @__PURE__ */ e(
1563
1578
  "div",
1564
1579
  {
1565
- className: p(
1580
+ className: k(
1566
1581
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1567
1582
  {
1568
- "!hidden": h === !1 || O,
1583
+ "!hidden": h === !1 || U,
1569
1584
  // Hide on mobile when channel selected, show on desktop with consistent narrow width
1570
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && te,
1585
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && te,
1571
1586
  // Show on mobile when no channel selected, use same narrow width on desktop
1572
- "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && !te
1587
+ "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && !te
1573
1588
  }
1574
1589
  ),
1575
1590
  children: /* @__PURE__ */ e(
1576
1591
  Ie,
1577
1592
  {
1578
- onChannelSelect: _e,
1579
- selectedChannel: R || void 0,
1593
+ onChannelSelect: Me,
1594
+ selectedChannel: p || void 0,
1580
1595
  filters: K,
1581
- customEmptyStateIndicator: w
1596
+ customEmptyStateIndicator: v
1582
1597
  }
1583
1598
  )
1584
1599
  }
@@ -1586,31 +1601,31 @@ const Fs = ({
1586
1601
  /* @__PURE__ */ e(
1587
1602
  "div",
1588
1603
  {
1589
- className: p(
1604
+ className: k(
1590
1605
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1591
1606
  {
1592
1607
  // In direct conversation mode, always show (full width)
1593
- flex: O || te,
1608
+ flex: U || te,
1594
1609
  // Normal mode: hide on mobile when no channel selected
1595
- "hidden lg:flex": !O && !te
1610
+ "hidden lg:flex": !U && !te
1596
1611
  }
1597
1612
  ),
1598
- children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1613
+ children: p ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1599
1614
  ke,
1600
1615
  {
1601
- channel: R,
1616
+ channel: p,
1602
1617
  onBack: De,
1603
- showBackButton: !O,
1618
+ showBackButton: !U,
1604
1619
  renderMessageInputActions: n,
1605
1620
  onLeaveConversation: Te,
1606
1621
  onBlockParticipant: Le,
1607
1622
  CustomChannelEmptyState: m,
1608
- showDeleteConversation: V,
1623
+ showDeleteConversation: W,
1609
1624
  onDeleteConversationClick: f,
1610
1625
  onBlockParticipantClick: S,
1611
- onReportParticipantClick: M
1626
+ onReportParticipantClick: R
1612
1627
  },
1613
- R.id
1628
+ p.id
1614
1629
  ) }) : /* @__PURE__ */ e(
1615
1630
  Re,
1616
1631
  {
@@ -1625,17 +1640,17 @@ const Fs = ({
1625
1640
  /* @__PURE__ */ e(
1626
1641
  "dialog",
1627
1642
  {
1628
- ref: _,
1643
+ ref: D,
1629
1644
  className: "mes-dialog",
1630
1645
  onClick: Fe,
1631
1646
  onClose: se,
1632
1647
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1633
- ws,
1648
+ vs,
1634
1649
  {
1635
1650
  participantSource: T,
1636
- onSelectParticipant: Me,
1651
+ onSelectParticipant: _e,
1637
1652
  onClose: se,
1638
- existingParticipantIds: oe,
1653
+ existingParticipantIds: ae,
1639
1654
  participantLabel: A,
1640
1655
  searchPlaceholder: `Search ${A}...`
1641
1656
  },
@@ -1645,7 +1660,7 @@ const Fs = ({
1645
1660
  )
1646
1661
  ]
1647
1662
  }
1648
- );
1663
+ ));
1649
1664
  }, Es = ({
1650
1665
  question: t,
1651
1666
  onClick: s,
@@ -1658,7 +1673,7 @@ const Fs = ({
1658
1673
  onClick: s,
1659
1674
  disabled: n,
1660
1675
  style: { backgroundColor: "#E6E5E3" },
1661
- className: p(
1676
+ className: k(
1662
1677
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1663
1678
  {
1664
1679
  "hover:brightness-95 active:brightness-90": !n,
@@ -1673,14 +1688,14 @@ const Fs = ({
1673
1688
  onFaqClick: s,
1674
1689
  loadingFaqId: n,
1675
1690
  headerText: r,
1676
- className: a,
1691
+ className: o,
1677
1692
  avatarImage: d,
1678
1693
  avatarName: l
1679
1694
  }) => {
1680
1695
  const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
1681
- return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1696
+ return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1682
1697
  (d || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1683
- q,
1698
+ Y,
1684
1699
  {
1685
1700
  id: l || "account",
1686
1701
  name: l || "Account",
@@ -1710,57 +1725,57 @@ const Fs = ({
1710
1725
  )
1711
1726
  ] }) });
1712
1727
  }, Ls = (t, s = {}) => {
1713
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, d] = y([]), [l, m] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, M] = y(!0), [v, c] = y(), N = D(async (x = !1, R) => {
1728
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [o, d] = E([]), [l, m] = E(!1), [h, g] = E(null), [v, f] = E(n), [S, R] = E(!0), [w, c] = E(), x = _(async (N = !1, p) => {
1714
1729
  if (l) return;
1715
- const o = R !== void 0 ? R : w;
1730
+ const a = p !== void 0 ? p : v;
1716
1731
  m(!0), g(null);
1717
1732
  try {
1718
1733
  const u = await t.loadParticipants({
1719
- search: o || void 0,
1734
+ search: a || void 0,
1720
1735
  limit: r,
1721
- cursor: x ? void 0 : v
1736
+ cursor: N ? void 0 : w
1722
1737
  });
1723
1738
  d(
1724
- (b) => x ? u.participants : [...b, ...u.participants]
1725
- ), M(u.hasMore), c(u.nextCursor);
1739
+ (C) => N ? u.participants : [...C, ...u.participants]
1740
+ ), R(u.hasMore), c(u.nextCursor);
1726
1741
  } catch (u) {
1727
- const b = u instanceof Error ? u.message : "Failed to load participants";
1728
- g(b), console.error("[useParticipants] Load error:", u);
1742
+ const C = u instanceof Error ? u.message : "Failed to load participants";
1743
+ g(C), console.error("[useParticipants] Load error:", u);
1729
1744
  } finally {
1730
1745
  m(!1);
1731
1746
  }
1732
- }, [t, w, v, r, l]), E = D(() => {
1733
- S && !l && N(!1);
1734
- }, [S, l, N]), I = D((x) => {
1735
- f(x), c(void 0), N(!0, x);
1736
- }, [N]), k = D(() => {
1737
- c(void 0), N(!0);
1738
- }, [N]);
1739
- return G(() => {
1740
- N(!0);
1747
+ }, [t, v, w, r, l]), y = _(() => {
1748
+ S && !l && x(!1);
1749
+ }, [S, l, x]), I = _((N) => {
1750
+ f(N), c(void 0), x(!0, N);
1751
+ }, [x]), M = _(() => {
1752
+ c(void 0), x(!0);
1753
+ }, [x]);
1754
+ return $(() => {
1755
+ x(!0);
1741
1756
  }, [t.loadParticipants]), {
1742
- participants: a,
1757
+ participants: o,
1743
1758
  loading: l,
1744
1759
  error: h,
1745
- searchQuery: w,
1760
+ searchQuery: v,
1746
1761
  hasMore: S,
1747
1762
  totalCount: t.totalCount,
1748
- loadMore: E,
1763
+ loadMore: y,
1749
1764
  search: I,
1750
- refresh: k
1765
+ refresh: M
1751
1766
  };
1752
1767
  };
1753
1768
  export {
1754
- q as Avatar,
1769
+ Y as Avatar,
1755
1770
  gs as ChannelEmptyState,
1756
1771
  Ie as ChannelList,
1757
1772
  ke as ChannelView,
1758
1773
  Ts as FaqList,
1759
1774
  Es as FaqListItem,
1760
- Ms as MessagingProvider,
1775
+ _s as MessagingProvider,
1761
1776
  Fs as MessagingShell,
1762
- ws as ParticipantPicker,
1763
- as as formatRelativeTime,
1777
+ vs as ParticipantPicker,
1778
+ os as formatRelativeTime,
1764
1779
  rs as useMessaging,
1765
1780
  Ls as useParticipants
1766
1781
  };