@linktr.ee/messaging-react 1.9.2 → 1.10.0-rc-1764218520

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,232 +1,241 @@
1
- import { jsx as e, jsxs as u, Fragment as ue } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as d, Fragment as se } from "react/jsx-runtime";
2
2
  import R from "classnames";
3
- import q, { createContext as ye, useContext as Se, useCallback as M, useState as E, useRef as z, useEffect as $ } from "react";
4
- import { StreamChatService as ke } from "@linktr.ee/messaging-core";
5
- import { Chat as Re, ChannelList as Fe, MessageInput as Te, useMessageInputContext as De, useMessageComposerHasSendableData as pe, SimpleAttachmentSelector as Me, QuotedMessagePreview as Pe, LinkPreviewList as Ue, AttachmentPreviewList as Oe, TextareaComposer as Le, Channel as _e, useChannelStateContext as me, Window as je, MessageList as Ae } from "stream-chat-react";
6
- import { XIcon as fe, ArrowUpIcon as Be, ArrowLeftIcon as oe, DotsThreeIcon as ae, SpinnerGapIcon as ee, SignOutIcon as ze, ProhibitInsetIcon as ie, FlagIcon as $e, MagnifyingGlassIcon as He, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
- const he = ye({
3
+ import Y, { createContext as Re, useContext as Fe, useCallback as P, useState as y, useRef as $, useEffect as H } from "react";
4
+ import { StreamChatService as Te } from "@linktr.ee/messaging-core";
5
+ import { Chat as De, ChannelList as pe, MessageInput as Me, useMessageInputContext as Pe, useMessageComposerHasSendableData as Ue, SimpleAttachmentSelector as Oe, QuotedMessagePreview as Le, LinkPreviewList as _e, AttachmentPreviewList as je, TextareaComposer as Ae, Channel as Be, useChannelStateContext as fe, Window as ze, MessageList as $e } from "stream-chat-react";
6
+ import { XIcon as he, ArrowUpIcon as He, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as Ge, ProhibitInsetIcon as ce, FlagIcon as Ve, MagnifyingGlassIcon as We, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
7
+ const ge = Re({
8
8
  service: null,
9
9
  client: null,
10
10
  isConnected: !1,
11
11
  isLoading: !1,
12
12
  error: null,
13
13
  capabilities: {},
14
+ customization: {},
14
15
  refreshConnection: async () => {
15
16
  },
16
17
  debug: !1
17
- }), se = () => Se(he), gs = ({
18
+ }), ne = () => Fe(ge), bs = ({
18
19
  children: t,
19
20
  user: s,
20
21
  serviceConfig: n,
21
- apiKey: l,
22
- capabilities: o = {},
22
+ apiKey: r,
23
+ capabilities: a = {},
24
+ customization: c = {},
23
25
  debug: i = !1
24
26
  }) => {
25
- const r = M(
26
- (d, ...N) => {
27
- i && console.log(`🔥 [MessagingProvider] ${d}`, ...N);
27
+ const l = P(
28
+ (x, ...D) => {
29
+ i && console.log(`🔥 [MessagingProvider] ${x}`, ...D);
28
30
  },
29
31
  [i]
30
32
  );
31
- r("🔄 RENDER START", {
33
+ l("🔄 RENDER START", {
32
34
  userId: s == null ? void 0 : s.id,
33
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
35
+ apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
34
36
  serviceConfig: !!n,
35
- capabilities: Object.keys(o)
37
+ capabilities: Object.keys(a),
38
+ customization: Object.keys(c)
36
39
  });
37
- const [a, m] = E(null), [x, k] = E(null), [f, h] = E(!1), [I, g] = E(!1), [C, w] = E(null), v = z(!1), y = z({
40
+ const [o, w] = y(null), [I, N] = y(null), [m, S] = y(!1), [g, b] = y(!1), [E, v] = y(null), F = $(!1), C = $({
38
41
  userId: s == null ? void 0 : s.id,
39
- apiKey: l,
42
+ apiKey: r,
40
43
  serviceConfig: n,
41
- capabilities: o
42
- }), S = z(0);
43
- S.current++, r("📊 RENDER INFO", {
44
- renderCount: S.current,
45
- currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
44
+ capabilities: a,
45
+ customization: c
46
+ }), T = $(0);
47
+ T.current++, l("📊 RENDER INFO", {
48
+ renderCount: T.current,
49
+ currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
46
50
  propChanges: {
47
- userChanged: y.current.userId !== (s == null ? void 0 : s.id),
48
- apiKeyChanged: y.current.apiKey !== l,
49
- serviceConfigChanged: y.current.serviceConfig !== n,
50
- capabilitiesChanged: y.current.capabilities !== o
51
+ userChanged: C.current.userId !== (s == null ? void 0 : s.id),
52
+ apiKeyChanged: C.current.apiKey !== r,
53
+ serviceConfigChanged: C.current.serviceConfig !== n,
54
+ capabilitiesChanged: C.current.capabilities !== a,
55
+ customizationChanged: C.current.customization !== c
51
56
  }
52
- }), y.current = {
57
+ }), C.current = {
53
58
  userId: s == null ? void 0 : s.id,
54
- apiKey: l,
59
+ apiKey: r,
55
60
  serviceConfig: n,
56
- capabilities: o
57
- }, $(() => {
58
- const d = S.current;
59
- if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
60
- renderCount: d,
61
- apiKey: !!l,
61
+ capabilities: a,
62
+ customization: c
63
+ }, H(() => {
64
+ const x = T.current;
65
+ if (l("🔧 SERVICE INIT EFFECT TRIGGERED", {
66
+ renderCount: x,
67
+ apiKey: !!r,
62
68
  serviceConfig: !!n,
63
69
  dependencies: {
64
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
70
+ apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
65
71
  serviceConfigRef: n,
66
- serviceConfigStable: y.current.serviceConfig === n,
67
- apiKeyStable: y.current.apiKey === l
72
+ serviceConfigStable: C.current.serviceConfig === n,
73
+ apiKeyStable: C.current.apiKey === r
68
74
  }
69
- }), !l || !n) {
70
- r("⚠️ SERVICE INIT SKIPPED", {
71
- renderCount: d,
75
+ }), !r || !n) {
76
+ l("⚠️ SERVICE INIT SKIPPED", {
77
+ renderCount: x,
72
78
  reason: "Missing apiKey or serviceConfig"
73
79
  });
74
80
  return;
75
81
  }
76
- r("🚀 CREATING NEW SERVICE", {
77
- renderCount: d,
78
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
79
- serviceConfigChanged: y.current.serviceConfig !== n
82
+ l("🚀 CREATING NEW SERVICE", {
83
+ renderCount: x,
84
+ apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
85
+ serviceConfigChanged: C.current.serviceConfig !== n
80
86
  });
81
- const N = new ke({
87
+ const D = new Te({
82
88
  ...n,
83
- apiKey: l,
89
+ apiKey: r,
84
90
  debug: i
85
91
  });
86
- return m(N), r("✅ SERVICE SET", {
87
- renderCount: d,
88
- serviceInstance: !!N
92
+ return w(D), l("✅ SERVICE SET", {
93
+ renderCount: x,
94
+ serviceInstance: !!D
89
95
  }), () => {
90
- r("🧹 SERVICE CLEANUP", {
91
- renderCount: d,
96
+ l("🧹 SERVICE CLEANUP", {
97
+ renderCount: x,
92
98
  reason: "Effect cleanup"
93
- }), N.disconnectUser().catch(console.error);
99
+ }), D.disconnectUser().catch(console.error);
94
100
  };
95
- }, [l, n, i, r]);
96
- const F = z(null);
97
- $(() => {
98
- var N, j;
99
- if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
100
- hasService: !!a,
101
+ }, [r, n, i, l]);
102
+ const p = $(null);
103
+ H(() => {
104
+ var D, q;
105
+ if (l("🔗 USER CONNECTION EFFECT TRIGGERED", {
106
+ hasService: !!o,
101
107
  hasUser: !!s,
102
108
  userId: s == null ? void 0 : s.id,
103
- isConnecting: v.current,
104
- isConnected: f,
105
- dependencies: { service: !!a, userId: s == null ? void 0 : s.id }
106
- }), !a || !s) {
107
- r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
109
+ isConnecting: F.current,
110
+ isConnected: m,
111
+ dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
112
+ }), !o || !s) {
113
+ l("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
108
114
  return;
109
115
  }
110
- if (v.current) {
111
- r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
116
+ if (F.current) {
117
+ l("⚠️ USER CONNECTION SKIPPED", "Already connecting");
112
118
  return;
113
119
  }
114
- if (((N = F.current) == null ? void 0 : N.serviceId) === a && ((j = F.current) == null ? void 0 : j.userId) === s.id) {
115
- r(
120
+ if (((D = p.current) == null ? void 0 : D.serviceId) === o && ((q = p.current) == null ? void 0 : q.userId) === s.id) {
121
+ l(
116
122
  "⚠️ USER CONNECTION SKIPPED",
117
123
  "Already connected this user with this service"
118
124
  );
119
125
  return;
120
126
  }
121
127
  (async () => {
122
- r("🚀 STARTING USER CONNECTION", { userId: s.id }), v.current = !0, g(!0), w(null);
128
+ l("🚀 STARTING USER CONNECTION", { userId: s.id }), F.current = !0, b(!0), v(null);
123
129
  try {
124
- r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
125
- const A = await a.connectUser(s);
126
- k(A), h(!0), F.current = { serviceId: a, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
130
+ l("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
+ const _ = await o.connectUser(s);
132
+ N(_), S(!0), p.current = { serviceId: o, userId: s.id }, l("✅ USER CONNECTION SUCCESS", {
127
133
  userId: s.id,
128
- clientId: A.userID
134
+ clientId: _.userID
129
135
  });
130
- } catch (A) {
131
- const W = A instanceof Error ? A.message : "Connection failed";
132
- w(W), r("❌ USER CONNECTION ERROR", {
136
+ } catch (_) {
137
+ const O = _ instanceof Error ? _.message : "Connection failed";
138
+ v(O), l("❌ USER CONNECTION ERROR", {
133
139
  userId: s.id,
134
- error: W
140
+ error: O
135
141
  });
136
142
  } finally {
137
- g(!1), v.current = !1, r("🔄 USER CONNECTION FINISHED", {
143
+ b(!1), F.current = !1, l("🔄 USER CONNECTION FINISHED", {
138
144
  userId: s.id,
139
- isConnected: f
145
+ isConnected: m
140
146
  });
141
147
  }
142
148
  })();
143
- }, [a, s, r, f]), $(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
144
- hasService: !!a,
145
- isConnected: f
149
+ }, [o, s, l, m]), H(() => (l("🔌 CLEANUP EFFECT REGISTERED", {
150
+ hasService: !!o,
151
+ isConnected: m
146
152
  }), () => {
147
- a && f ? (r(
153
+ o && m ? (l(
148
154
  "🧹 CLEANUP EFFECT TRIGGERED",
149
155
  "Cleaning up connection on unmount"
150
- ), F.current = null, a.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
151
- hasService: !!a,
152
- isConnected: f
156
+ ), p.current = null, o.disconnectUser().catch(console.error)) : l("🔇 CLEANUP EFFECT SKIPPED", {
157
+ hasService: !!o,
158
+ isConnected: m
153
159
  });
154
- }), [a, f, r]);
155
- const D = M(async () => {
156
- if (r("🔄 REFRESH CONNECTION CALLED", {
157
- hasService: !!a,
160
+ }), [o, m, l]);
161
+ const u = P(async () => {
162
+ if (l("🔄 REFRESH CONNECTION CALLED", {
163
+ hasService: !!o,
158
164
  hasUser: !!s
159
- }), !a || !s) {
160
- r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
165
+ }), !o || !s) {
166
+ l("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
161
167
  return;
162
168
  }
163
- r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), g(!0);
169
+ l("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
164
170
  try {
165
- r("🔌 DISCONNECTING FOR REFRESH"), await a.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
166
- const d = await a.connectUser(s);
167
- k(d), h(!0), w(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
168
- } catch (d) {
169
- const N = d instanceof Error ? d.message : "Refresh failed";
170
- w(N), r("❌ CONNECTION REFRESH ERROR", {
171
+ l("🔌 DISCONNECTING FOR REFRESH"), await o.disconnectUser(), l("📞 RECONNECTING FOR REFRESH");
172
+ const x = await o.connectUser(s);
173
+ N(x), S(!0), v(null), l("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
174
+ } catch (x) {
175
+ const D = x instanceof Error ? x.message : "Refresh failed";
176
+ v(D), l("❌ CONNECTION REFRESH ERROR", {
171
177
  userId: s.id,
172
- error: N
178
+ error: D
173
179
  });
174
180
  } finally {
175
- g(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
181
+ b(!1), l("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
176
182
  }
177
- }, [a, s, r]), c = q.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
178
- hasService: !!a,
179
- hasClient: !!x,
180
- isConnected: f,
181
- isLoading: I,
182
- hasError: !!C,
183
- capabilitiesKeys: Object.keys(o)
183
+ }, [o, s, l]), f = Y.useMemo(() => (l("💫 CONTEXT VALUE MEMOIZATION", {
184
+ hasService: !!o,
185
+ hasClient: !!I,
186
+ isConnected: m,
187
+ isLoading: g,
188
+ hasError: !!E,
189
+ capabilitiesKeys: Object.keys(a),
190
+ customizationKeys: Object.keys(c)
184
191
  }), {
185
- service: a,
186
- client: x,
187
- isConnected: f,
188
- isLoading: I,
189
- error: C,
190
- capabilities: o,
191
- refreshConnection: D,
192
+ service: o,
193
+ client: I,
194
+ isConnected: m,
195
+ isLoading: g,
196
+ error: E,
197
+ capabilities: a,
198
+ customization: c,
199
+ refreshConnection: u,
192
200
  debug: i
193
201
  }), [
194
- a,
195
- x,
196
- f,
197
- I,
198
- C,
199
202
  o,
200
- D,
203
+ I,
204
+ m,
205
+ g,
206
+ E,
207
+ a,
208
+ c,
209
+ u,
201
210
  i,
202
- r
211
+ l
203
212
  ]);
204
- return r("🔄 RENDER END", {
205
- renderCount: S.current,
206
- willRenderChat: !!(x && f),
207
- contextValueReady: !!c
208
- }), /* @__PURE__ */ e(he.Provider, { value: c, children: x && f ? /* @__PURE__ */ e(Re, { client: x, children: t }) : t });
209
- }, Ge = () => se(), Ve = (t, s) => {
213
+ return l("🔄 RENDER END", {
214
+ renderCount: T.current,
215
+ willRenderChat: !!(I && m),
216
+ contextValueReady: !!f
217
+ }), /* @__PURE__ */ e(ge.Provider, { value: f, children: I && m ? /* @__PURE__ */ e(De, { client: I, children: t }) : t });
218
+ }, qe = () => ne(), Ye = (t, s) => {
210
219
  const n = new Date(
211
220
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
212
- ), o = new Date(
221
+ ), a = new Date(
213
222
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
214
223
  ).getTime() - n.getTime();
215
- return Math.floor(o / (1e3 * 60 * 60 * 24));
216
- }, We = (t) => {
224
+ return Math.floor(a / (1e3 * 60 * 60 * 24));
225
+ }, Je = (t) => {
217
226
  const s = /* @__PURE__ */ new Date();
218
227
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
219
228
  return "Just now";
220
- const l = Ve(t, s);
221
- return l === 0 ? t.toLocaleTimeString([], {
229
+ const r = Ye(t, s);
230
+ return r === 0 ? t.toLocaleTimeString([], {
222
231
  hour: "numeric",
223
232
  minute: "2-digit"
224
- }) : l === 1 ? "Yesterday" : l < 7 ? `${l}d` : l < 28 ? `${Math.floor(l / 7)}w` : t.toLocaleDateString("en-US", {
233
+ }) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
225
234
  month: "numeric",
226
235
  day: "numeric",
227
236
  year: "2-digit"
228
237
  });
229
- }, de = [
238
+ }, ue = [
230
239
  "🍎",
231
240
  // Apple
232
241
  "🍌",
@@ -254,37 +263,37 @@ const he = ye({
254
263
  "🍈"
255
264
  // Melon
256
265
  ];
257
- function qe(t) {
266
+ function Qe(t) {
258
267
  let s = 0;
259
268
  for (let n = 0; n < t.length; n++) {
260
- const l = t.charCodeAt(n);
261
- s = (s << 5) - s + l, s = s & s;
269
+ const r = t.charCodeAt(n);
270
+ s = (s << 5) - s + r, s = s & s;
262
271
  }
263
272
  return Math.abs(s);
264
273
  }
265
- function Ye(t) {
266
- const n = qe(t) % de.length;
267
- return de[n];
274
+ function Xe(t) {
275
+ const n = Qe(t) % ue.length;
276
+ return ue[n];
268
277
  }
269
- const Y = ({
278
+ const J = ({
270
279
  id: t,
271
280
  image: s,
272
281
  size: n = 40,
273
- className: l,
274
- shape: o = "squircle"
282
+ className: r,
283
+ shape: a = "squircle"
275
284
  }) => {
276
- const i = Ye(t), a = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = o === "circle" ? { borderRadius: "50%" } : {
285
+ const c = Xe(t), l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", o = a === "circle" ? { borderRadius: "50%" } : {
277
286
  borderRadius: "33%",
278
287
  "corner-shape": "superellipse(1.3)"
279
288
  };
280
289
  return /* @__PURE__ */ e(
281
290
  "div",
282
291
  {
283
- className: R("flex-shrink-0 overflow-hidden", l),
292
+ className: R("flex-shrink-0 overflow-hidden", r),
284
293
  style: {
285
294
  width: `${n}px`,
286
295
  height: `${n}px`,
287
- ...m
296
+ ...o
288
297
  },
289
298
  children: s ? /* @__PURE__ */ e(
290
299
  "img",
@@ -299,91 +308,91 @@ const Y = ({
299
308
  "aria-hidden": "true",
300
309
  className: R(
301
310
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
302
- a
311
+ l
303
312
  ),
304
- children: i
313
+ children: c
305
314
  }
306
315
  )
307
316
  }
308
317
  );
309
- }, Je = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: o }) => {
310
- var w, v, y, S, F, D;
311
- const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
318
+ }, Ze = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
319
+ var E, v, F, C, T, p;
320
+ const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), i = () => {
312
321
  t && n(t);
313
- }, m = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
314
- (c) => {
315
- var d, N;
316
- return ((d = c.user) == null ? void 0 : d.id) && c.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
322
+ }, o = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
323
+ (u) => {
324
+ var f, x;
325
+ return ((f = u.user) == null ? void 0 : f.id) && u.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
317
326
  }
318
- ), x = ((v = m == null ? void 0 : m.user) == null ? void 0 : v.name) || "Conversation", k = (y = m == null ? void 0 : m.user) == null ? void 0 : y.image, f = (F = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : F[t.state.messages.length - 1], I = (() => {
319
- var d;
320
- if (f != null && f.text) return f.text;
321
- const c = (d = f == null ? void 0 : f.attachments) == null ? void 0 : d[0];
322
- return c != null && c.asset_url ? c.asset_url : c != null && c.image_url ? c.image_url : c != null && c.og_scrape_url ? c.og_scrape_url : c != null && c.thumb_url ? c.thumb_url : "No messages yet";
323
- })(), g = f != null && f.created_at ? We(new Date(f.created_at)) : "", C = o ?? 0;
324
- return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
327
+ ), w = ((v = o == null ? void 0 : o.user) == null ? void 0 : v.name) || "Conversation", I = (F = o == null ? void 0 : o.user) == null ? void 0 : F.image, N = (T = (C = t == null ? void 0 : t.state) == null ? void 0 : C.messages) == null ? void 0 : T[t.state.messages.length - 1], S = (() => {
328
+ var f;
329
+ if (N != null && N.text) return N.text;
330
+ const u = (f = N == null ? void 0 : N.attachments) == null ? void 0 : f[0];
331
+ return u != null && u.asset_url ? u.asset_url : u != null && u.image_url ? u.image_url : u != null && u.og_scrape_url ? u.og_scrape_url : u != null && u.thumb_url ? u.thumb_url : "No messages yet";
332
+ })(), g = N != null && N.created_at ? Je(new Date(N.created_at)) : "", b = a ?? 0;
333
+ return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
325
334
  channelId: t == null ? void 0 : t.id,
326
- isSelected: i,
327
- participantName: x,
328
- unreadCount: C,
335
+ isSelected: c,
336
+ participantName: w,
337
+ unreadCount: b,
329
338
  hasTimestamp: !!g
330
339
  }), /* @__PURE__ */ e(
331
340
  "button",
332
341
  {
333
342
  type: "button",
334
- onClick: r,
343
+ onClick: i,
335
344
  className: R(
336
345
  "group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
337
346
  {
338
- "bg-primary-alt/10 border-l-4 border-l-primary": i,
339
- "hover:bg-sand": !i
347
+ "bg-primary-alt/10 border-l-4 border-l-primary": c,
348
+ "hover:bg-sand": !c
340
349
  }
341
350
  ),
342
- children: /* @__PURE__ */ u("div", { className: "flex items-start gap-3", children: [
351
+ children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
343
352
  /* @__PURE__ */ e(
344
- Y,
353
+ J,
345
354
  {
346
- id: ((D = m == null ? void 0 : m.user) == null ? void 0 : D.id) || t.id || "unknown",
347
- name: x,
348
- image: k,
355
+ id: ((p = o == null ? void 0 : o.user) == null ? void 0 : p.id) || t.id || "unknown",
356
+ name: w,
357
+ image: I,
349
358
  size: 44,
350
359
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
351
360
  }
352
361
  ),
353
- /* @__PURE__ */ u("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
354
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2", children: [
362
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
363
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
355
364
  /* @__PURE__ */ e(
356
365
  "h3",
357
366
  {
358
367
  className: R(
359
368
  "text-sm font-medium truncate",
360
- i ? "text-primary" : "text-charcoal"
369
+ c ? "text-primary" : "text-charcoal"
361
370
  ),
362
- children: x
371
+ children: w
363
372
  }
364
373
  ),
365
374
  g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
366
375
  ] }),
367
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
368
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: I }),
369
- 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 })
376
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
377
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
378
+ b > 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: b > 99 ? "99+" : b })
370
379
  ] })
371
380
  ] })
372
381
  ] })
373
382
  }
374
383
  );
375
- }, Qe = ({
384
+ }, Ke = ({
376
385
  onChannelSelect: t,
377
386
  selectedChannel: s,
378
387
  filters: n,
379
- className: l,
380
- customEmptyStateIndicator: o
388
+ className: r,
389
+ customEmptyStateIndicator: a
381
390
  }) => {
382
- const i = q.useRef(0);
383
- i.current++;
384
- const { debug: r = !1 } = se();
385
- return r && console.log("📺 [ChannelList] 🔄 RENDER START", {
386
- renderCount: i.current,
391
+ const c = Y.useRef(0);
392
+ c.current++;
393
+ const { debug: i = !1 } = ne();
394
+ return i && console.log("📺 [ChannelList] 🔄 RENDER START", {
395
+ renderCount: c.current,
387
396
  selectedChannelId: s == null ? void 0 : s.id,
388
397
  filters: n
389
398
  }), /* @__PURE__ */ e(
@@ -391,34 +400,34 @@ const Y = ({
391
400
  {
392
401
  className: R(
393
402
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
394
- l
403
+ r
395
404
  ),
396
- children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
397
- renderCount: i.current,
405
+ children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (i && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
406
+ renderCount: c.current,
398
407
  filters: n
399
408
  }), /* @__PURE__ */ e(
400
- Fe,
409
+ pe,
401
410
  {
402
411
  filters: n,
403
412
  sort: { last_message_at: -1 },
404
413
  options: { limit: 30 },
405
- Preview: (a) => {
406
- var m, x;
407
- return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
408
- channelId: (m = a.channel) == null ? void 0 : m.id,
414
+ Preview: (l) => {
415
+ var o, w;
416
+ return i && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
417
+ channelId: (o = l.channel) == null ? void 0 : o.id,
409
418
  selectedChannelId: s == null ? void 0 : s.id,
410
- isSelected: (s == null ? void 0 : s.id) === ((x = a.channel) == null ? void 0 : x.id)
419
+ isSelected: (s == null ? void 0 : s.id) === ((w = l.channel) == null ? void 0 : w.id)
411
420
  }), /* @__PURE__ */ e(
412
- Je,
421
+ Ze,
413
422
  {
414
- ...a,
423
+ ...l,
415
424
  selectedChannel: s,
416
425
  onChannelSelect: t,
417
- debug: r
426
+ debug: i
418
427
  }
419
428
  );
420
429
  },
421
- EmptyStateIndicator: o
430
+ EmptyStateIndicator: a
422
431
  },
423
432
  JSON.stringify(n)
424
433
  )) })
@@ -428,7 +437,7 @@ const Y = ({
428
437
  variant: t = "default",
429
438
  className: s,
430
439
  children: n,
431
- ...l
440
+ ...r
432
441
  }) => /* @__PURE__ */ e(
433
442
  "button",
434
443
  {
@@ -438,24 +447,24 @@ const Y = ({
438
447
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
439
448
  s
440
449
  ),
441
- ...l,
450
+ ...r,
442
451
  children: n
443
452
  }
444
453
  );
445
- function ge({ label: t, className: s, children: n, ...l }) {
446
- return /* @__PURE__ */ u(
454
+ function xe({ label: t, className: s, children: n, ...r }) {
455
+ return /* @__PURE__ */ d(
447
456
  "button",
448
457
  {
449
458
  type: "button",
450
459
  className: R(
451
460
  "rounded-full p-2 transition-colors focus-ring",
452
461
  {
453
- "cursor-not-allowed opacity-50": l.disabled,
454
- "hover:bg-sand": !l.disabled
462
+ "cursor-not-allowed opacity-50": r.disabled,
463
+ "hover:bg-sand": !r.disabled
455
464
  },
456
465
  s
457
466
  ),
458
- ...l,
467
+ ...r,
459
468
  children: [
460
469
  /* @__PURE__ */ e("span", { className: "sr-only", children: t }),
461
470
  n
@@ -463,20 +472,20 @@ function ge({ label: t, className: s, children: n, ...l }) {
463
472
  }
464
473
  );
465
474
  }
466
- function xe({ onClick: t }) {
467
- return /* @__PURE__ */ e(ge, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(fe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
475
+ function Ne({ onClick: t }) {
476
+ return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
468
477
  }
469
- const Xe = () => {
470
- const { handleSubmit: t } = De(), s = pe();
471
- return /* @__PURE__ */ u(ue, { children: [
472
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Me, {}) }),
473
- /* @__PURE__ */ u("div", { className: "central-container w-full p-2 bg-white rounded-lg 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: [
474
- /* @__PURE__ */ e(Pe, {}),
475
- /* @__PURE__ */ e(Ue, {}),
476
- /* @__PURE__ */ e(Oe, {}),
477
- /* @__PURE__ */ u("div", { className: "flex", children: [
478
+ const es = () => {
479
+ const { handleSubmit: t } = Pe(), s = Ue();
480
+ return /* @__PURE__ */ d(se, { children: [
481
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Oe, {}) }),
482
+ /* @__PURE__ */ d("div", { className: "central-container w-full p-2 bg-white rounded-lg 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: [
483
+ /* @__PURE__ */ e(Le, {}),
484
+ /* @__PURE__ */ e(_e, {}),
485
+ /* @__PURE__ */ e(je, {}),
486
+ /* @__PURE__ */ d("div", { className: "flex", children: [
478
487
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4", children: /* @__PURE__ */ e(
479
- Le,
488
+ Ae,
480
489
  {
481
490
  className: "align-middle w-full resize-none outline-none",
482
491
  maxRows: 4
@@ -491,30 +500,30 @@ const Xe = () => {
491
500
  disabled: !s,
492
501
  onClick: t,
493
502
  type: "button",
494
- children: /* @__PURE__ */ e(Be, { className: "size-4" })
503
+ children: /* @__PURE__ */ e(He, { className: "size-4" })
495
504
  }
496
505
  )
497
506
  ] })
498
507
  ] })
499
508
  ] });
500
- }, Ze = ({
509
+ }, ss = ({
501
510
  renderActions: t
502
- }) => /* @__PURE__ */ u("div", { className: "message-input flex items-center gap-2 p-4", children: [
511
+ }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
503
512
  t && (t == null ? void 0 : t()),
504
- /* @__PURE__ */ e(Te, { Input: Xe })
505
- ] }), Ne = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
513
+ /* @__PURE__ */ e(Me, { Input: es })
514
+ ] }), be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
506
515
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet 👀" }),
507
516
  /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
508
- ] }) }), Ke = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
509
- var m, x, k, f, h;
510
- const { channel: o } = me(), i = q.useMemo(() => Object.values(o.state.members || {}).find(
517
+ ] }) }), ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
518
+ var o, w, I, N, m;
519
+ const { channel: a } = fe(), c = Y.useMemo(() => Object.values(a.state.members || {}).find(
511
520
  (g) => {
512
- var C;
513
- return ((C = g.user) == null ? void 0 : C.id) && g.user.id !== o._client.userID;
521
+ var b;
522
+ return ((b = g.user) == null ? void 0 : b.id) && g.user.id !== a._client.userID;
514
523
  }
515
- ), [o._client.userID, o.state.members]), r = ((m = i == null ? void 0 : i.user) == null ? void 0 : m.name) || ((x = i == null ? void 0 : i.user) == null ? void 0 : x.id) || "Unknown member", a = (k = i == null ? void 0 : i.user) == null ? void 0 : k.image;
516
- return /* @__PURE__ */ u("div", { className: "@container", children: [
517
- /* @__PURE__ */ u("div", { className: "flex justify-between items-center @md:hidden", children: [
524
+ ), [a._client.userID, a.state.members]), i = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((w = c == null ? void 0 : c.user) == null ? void 0 : w.id) || "Unknown member", l = (I = c == null ? void 0 : c.user) == null ? void 0 : I.image;
525
+ return /* @__PURE__ */ d("div", { className: "@container", children: [
526
+ /* @__PURE__ */ d("div", { className: "flex justify-between items-center @md:hidden", children: [
518
527
  /* @__PURE__ */ e(
519
528
  "button",
520
529
  {
@@ -524,20 +533,20 @@ const Xe = () => {
524
533
  ),
525
534
  onClick: t || (() => {
526
535
  }),
527
- children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
536
+ children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
528
537
  }
529
538
  ),
530
- /* @__PURE__ */ u("div", { className: "flex flex-col gap-1 items-center", children: [
539
+ /* @__PURE__ */ d("div", { className: "flex flex-col gap-1 items-center", children: [
531
540
  /* @__PURE__ */ e(
532
- Y,
541
+ J,
533
542
  {
534
- id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || o.id || "unknown",
535
- name: r,
536
- image: a,
543
+ id: ((N = c == null ? void 0 : c.user) == null ? void 0 : N.id) || a.id || "unknown",
544
+ name: i,
545
+ image: l,
537
546
  size: 40
538
547
  }
539
548
  ),
540
- /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: r })
549
+ /* @__PURE__ */ e("h1", { className: "text-xs font-medium text-black/90", children: i })
541
550
  ] }),
542
551
  /* @__PURE__ */ e(
543
552
  "button",
@@ -547,12 +556,12 @@ const Xe = () => {
547
556
  ),
548
557
  onClick: n || (() => {
549
558
  }),
550
- children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
559
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
551
560
  }
552
561
  )
553
562
  ] }),
554
- /* @__PURE__ */ u("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
555
- /* @__PURE__ */ u("div", { className: "flex items-center gap-4 min-w-0", children: [
563
+ /* @__PURE__ */ d("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
564
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-4 min-w-0", children: [
556
565
  s && t && /* @__PURE__ */ e(
557
566
  "button",
558
567
  {
@@ -560,106 +569,106 @@ const Xe = () => {
560
569
  onClick: t,
561
570
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
562
571
  "aria-label": "Back to conversations",
563
- children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
572
+ children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
564
573
  }
565
574
  ),
566
575
  /* @__PURE__ */ e(
567
- Y,
576
+ J,
568
577
  {
569
- id: ((h = i == null ? void 0 : i.user) == null ? void 0 : h.id) || o.id || "unknown",
570
- name: r,
571
- image: a,
578
+ id: ((m = c == null ? void 0 : c.user) == null ? void 0 : m.id) || a.id || "unknown",
579
+ name: i,
580
+ image: l,
572
581
  size: 40
573
582
  }
574
583
  ),
575
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: r }) })
584
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: i }) })
576
585
  ] }),
577
- l && n && /* @__PURE__ */ e(
586
+ r && n && /* @__PURE__ */ e(
578
587
  "button",
579
588
  {
580
589
  className: R(
581
590
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
582
591
  ),
583
592
  onClick: n,
584
- children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
593
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
585
594
  }
586
595
  )
587
596
  ] })
588
597
  ] });
589
- }, es = ({
598
+ }, ts = ({
590
599
  isOpen: t,
591
600
  onClose: s,
592
601
  participant: n,
593
- channel: l,
594
- followerStatusLabel: o,
595
- onLeaveConversation: i,
596
- onBlockParticipant: r
602
+ channel: r,
603
+ followerStatusLabel: a,
604
+ onLeaveConversation: c,
605
+ onBlockParticipant: i
597
606
  }) => {
598
- var W, _, G, J, H, V, Q;
599
- const { service: a, debug: m } = se(), x = z(null), [k, f] = E(!1), [h, I] = E(!1), [g, C] = E(!1);
600
- $(() => {
601
- const T = x.current;
602
- T && (t ? T.showModal() : T.close());
607
+ var _, O, W, Q, G, V, X;
608
+ const { service: l, debug: o } = ne(), w = $(null), [I, N] = y(!1), [m, S] = y(!1), [g, b] = y(!1);
609
+ H(() => {
610
+ const k = w.current;
611
+ k && (t ? k.showModal() : k.close());
603
612
  }, [t]);
604
- const w = M(async () => {
605
- var T;
606
- if (!(!a || !((T = n == null ? void 0 : n.user) != null && T.id)))
613
+ const E = P(async () => {
614
+ var k;
615
+ if (!(!l || !((k = n == null ? void 0 : n.user) != null && k.id)))
607
616
  try {
608
- const U = (await a.getBlockedUsers()).some(
609
- (O) => {
610
- var X;
611
- return O.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
617
+ const A = (await l.getBlockedUsers()).some(
618
+ (j) => {
619
+ var B;
620
+ return j.blocked_user_id === ((B = n == null ? void 0 : n.user) == null ? void 0 : B.id);
612
621
  }
613
622
  );
614
- f(U);
615
- } catch (P) {
623
+ N(A);
624
+ } catch (M) {
616
625
  console.error(
617
626
  "[ChannelInfoDialog] Failed to check blocked status:",
618
- P
627
+ M
619
628
  );
620
629
  }
621
- }, [a, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
622
- $(() => {
623
- t && w();
624
- }, [t, w]);
630
+ }, [l, (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id]);
631
+ H(() => {
632
+ t && E();
633
+ }, [t, E]);
625
634
  const v = async () => {
626
- var T;
627
- if (!h) {
628
- m && console.log("[ChannelInfoDialog] Leave conversation", l.cid), I(!0);
635
+ var k;
636
+ if (!m) {
637
+ o && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
629
638
  try {
630
- const P = ((T = l._client) == null ? void 0 : T.userID) ?? null;
631
- await l.hide(P, !1), i && await i(l), s();
632
- } catch (P) {
633
- console.error("[ChannelInfoDialog] Failed to leave conversation", P);
639
+ const M = ((k = r._client) == null ? void 0 : k.userID) ?? null;
640
+ await r.hide(M, !1), c && await c(r), s();
641
+ } catch (M) {
642
+ console.error("[ChannelInfoDialog] Failed to leave conversation", M);
634
643
  } finally {
635
- I(!1);
644
+ S(!1);
636
645
  }
637
646
  }
638
- }, y = async () => {
639
- var T, P, U;
640
- if (!(g || !a)) {
641
- m && console.log("[ChannelInfoDialog] Block member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), C(!0);
647
+ }, F = async () => {
648
+ var k, M, A;
649
+ if (!(g || !l)) {
650
+ o && console.log("[ChannelInfoDialog] Block member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
642
651
  try {
643
- await a.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
644
- } catch (O) {
645
- console.error("[ChannelInfoDialog] Failed to block member", O);
652
+ await l.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
653
+ } catch (j) {
654
+ console.error("[ChannelInfoDialog] Failed to block member", j);
646
655
  } finally {
647
- C(!1);
656
+ b(!1);
648
657
  }
649
658
  }
650
- }, S = async () => {
651
- var T, P, U;
652
- if (!(g || !a)) {
653
- m && console.log("[ChannelInfoDialog] Unblock member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), C(!0);
659
+ }, C = async () => {
660
+ var k, M, A;
661
+ if (!(g || !l)) {
662
+ o && console.log("[ChannelInfoDialog] Unblock member", (k = n == null ? void 0 : n.user) == null ? void 0 : k.id), b(!0);
654
663
  try {
655
- await a.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
656
- } catch (O) {
657
- console.error("[ChannelInfoDialog] Failed to unblock member", O);
664
+ await l.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
665
+ } catch (j) {
666
+ console.error("[ChannelInfoDialog] Failed to unblock member", j);
658
667
  } finally {
659
- C(!1);
668
+ b(!1);
660
669
  }
661
670
  }
662
- }, F = () => {
671
+ }, T = () => {
663
672
  s(), window.open(
664
673
  "https://linktr.ee/s/about/trust-center/report",
665
674
  "_blank",
@@ -667,99 +676,99 @@ const Xe = () => {
667
676
  );
668
677
  };
669
678
  if (!n) return null;
670
- const D = ((_ = n.user) == null ? void 0 : _.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", c = (J = n.user) == null ? void 0 : J.image, d = (H = n.user) == null ? void 0 : H.email, N = (V = n.user) == null ? void 0 : V.username, j = d || (N ? `linktr.ee/${N}` : void 0), A = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
679
+ const p = ((O = n.user) == null ? void 0 : O.name) || ((W = n.user) == null ? void 0 : W.id) || "Unknown member", u = (Q = n.user) == null ? void 0 : Q.image, f = (G = n.user) == null ? void 0 : G.email, x = (V = n.user) == null ? void 0 : V.username, D = f || (x ? `linktr.ee/${x}` : void 0), q = ((X = n.user) == null ? void 0 : X.id) || "unknown";
671
680
  return (
672
681
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
673
682
  /* @__PURE__ */ e(
674
683
  "dialog",
675
684
  {
676
- ref: x,
685
+ ref: w,
677
686
  className: "mes-dialog",
678
687
  onClose: s,
679
- onClick: (T) => {
680
- T.target === x.current && s();
688
+ onClick: (k) => {
689
+ k.target === w.current && s();
681
690
  },
682
- children: /* @__PURE__ */ u("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
683
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
691
+ children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
692
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
684
693
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
685
- /* @__PURE__ */ e(xe, { onClick: s })
694
+ /* @__PURE__ */ e(Ne, { onClick: s })
686
695
  ] }),
687
- /* @__PURE__ */ u("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
696
+ /* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
688
697
  /* @__PURE__ */ e(
689
698
  "div",
690
699
  {
691
700
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
692
701
  style: { backgroundColor: "#FBFAF9" },
693
- children: /* @__PURE__ */ u("div", { className: "flex items-center gap-3 w-full", children: [
702
+ children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
694
703
  /* @__PURE__ */ e(
695
- Y,
704
+ J,
696
705
  {
697
- id: A,
698
- name: D,
699
- image: c,
706
+ id: q,
707
+ name: p,
708
+ image: u,
700
709
  size: 88,
701
710
  shape: "circle"
702
711
  }
703
712
  ),
704
- /* @__PURE__ */ u("div", { className: "flex flex-col min-w-0 flex-1", children: [
705
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: D }),
706
- j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
707
- o && /* @__PURE__ */ e(
713
+ /* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
714
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: p }),
715
+ D && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: D }),
716
+ a && /* @__PURE__ */ e(
708
717
  "span",
709
718
  {
710
719
  className: "mt-1 rounded-full text-xs font-normal w-fit",
711
720
  style: {
712
721
  padding: "4px 8px",
713
- backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
714
- color: o === "Subscribed to you" ? "#008236" : "#78716C",
722
+ backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
723
+ color: a === "Subscribed to you" ? "#008236" : "#78716C",
715
724
  lineHeight: "133.333%",
716
725
  letterSpacing: "0.21px"
717
726
  },
718
- children: o
727
+ children: a
719
728
  }
720
729
  )
721
730
  ] })
722
731
  ] })
723
732
  }
724
733
  ),
725
- /* @__PURE__ */ u("ul", { className: "flex flex-col gap-2 mt-2", children: [
726
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(
734
+ /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
735
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
727
736
  K,
728
737
  {
729
738
  onClick: v,
730
- disabled: h,
731
- "aria-busy": h,
739
+ disabled: m,
740
+ "aria-busy": m,
732
741
  children: [
733
- h ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "h-5 w-5" }),
742
+ m ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ge, { className: "h-5 w-5" }),
734
743
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
735
744
  ]
736
745
  }
737
746
  ) }),
738
- /* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ u(
747
+ /* @__PURE__ */ e("li", { children: I ? /* @__PURE__ */ d(
739
748
  K,
740
749
  {
741
- onClick: S,
750
+ onClick: C,
742
751
  disabled: g,
743
752
  "aria-busy": g,
744
753
  children: [
745
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
754
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
746
755
  /* @__PURE__ */ e("span", { children: "Unblock" })
747
756
  ]
748
757
  }
749
- ) : /* @__PURE__ */ u(
758
+ ) : /* @__PURE__ */ d(
750
759
  K,
751
760
  {
752
- onClick: y,
761
+ onClick: F,
753
762
  disabled: g,
754
763
  "aria-busy": g,
755
764
  children: [
756
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
765
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
757
766
  /* @__PURE__ */ e("span", { children: "Block" })
758
767
  ]
759
768
  }
760
769
  ) }),
761
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(K, { variant: "danger", onClick: F, children: [
762
- /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
770
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: T, children: [
771
+ /* @__PURE__ */ e(Ve, { className: "h-5 w-5" }),
763
772
  /* @__PURE__ */ e("span", { children: "Report" })
764
773
  ] }) })
765
774
  ] })
@@ -768,107 +777,107 @@ const Xe = () => {
768
777
  }
769
778
  )
770
779
  );
771
- }, ss = ({
780
+ }, rs = ({
772
781
  onBack: t,
773
782
  showBackButton: s,
774
783
  renderMessageInputActions: n,
775
- onLeaveConversation: l,
776
- onBlockParticipant: o,
777
- CustomChannelEmptyState: i = Ne
784
+ onLeaveConversation: r,
785
+ onBlockParticipant: a,
786
+ CustomChannelEmptyState: c = be
778
787
  }) => {
779
- var h, I;
780
- const { channel: r } = me(), [a, m] = E(!1), x = (((I = (h = r == null ? void 0 : r.state) == null ? void 0 : h.messages) == null ? void 0 : I.length) ?? 0) > 0, k = q.useMemo(() => Object.values(r.state.members || {}).find(
781
- (C) => {
782
- var w;
783
- return ((w = C.user) == null ? void 0 : w.id) && C.user.id !== r._client.userID;
788
+ var m, S;
789
+ const { channel: i } = fe(), [l, o] = y(!1), w = (((S = (m = i == null ? void 0 : i.state) == null ? void 0 : m.messages) == null ? void 0 : S.length) ?? 0) > 0, I = Y.useMemo(() => Object.values(i.state.members || {}).find(
790
+ (b) => {
791
+ var E;
792
+ return ((E = b.user) == null ? void 0 : E.id) && b.user.id !== i._client.userID;
784
793
  }
785
- ), [r._client.userID, r.state.members]), f = q.useMemo(() => {
786
- const g = r.data ?? {};
794
+ ), [i._client.userID, i.state.members]), N = Y.useMemo(() => {
795
+ const g = i.data ?? {};
787
796
  if (g.followerStatus)
788
797
  return String(g.followerStatus);
789
798
  if (g.isFollower !== void 0)
790
799
  return g.isFollower ? "Subscribed to you" : "Not subscribed";
791
- }, [r.data]);
792
- return /* @__PURE__ */ u(ue, { children: [
793
- /* @__PURE__ */ u(je, { children: [
800
+ }, [i.data]);
801
+ return /* @__PURE__ */ d(se, { children: [
802
+ /* @__PURE__ */ d(ze, { children: [
794
803
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
795
- Ke,
804
+ ns,
796
805
  {
797
806
  onBack: t,
798
807
  showBackButton: s,
799
- onShowInfo: () => m(!0),
800
- canShowInfo: !!k
808
+ onShowInfo: () => o(!0),
809
+ canShowInfo: !!I
801
810
  }
802
811
  ) }),
803
- /* @__PURE__ */ u("div", { className: "flex-1 overflow-hidden relative", children: [
812
+ /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
804
813
  /* @__PURE__ */ e(
805
- Ae,
814
+ $e,
806
815
  {
807
816
  hideDeletedMessages: !0,
808
817
  hideNewMessageSeparator: !1,
809
818
  messageActions: []
810
819
  }
811
820
  ),
812
- !x && i && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(i, {}) })
821
+ !w && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(c, {}) })
813
822
  ] }),
814
823
  /* @__PURE__ */ e(
815
- Ze,
824
+ ss,
816
825
  {
817
- renderActions: () => n == null ? void 0 : n(r)
826
+ renderActions: () => n == null ? void 0 : n(i)
818
827
  }
819
828
  )
820
829
  ] }),
821
830
  /* @__PURE__ */ e(
822
- es,
831
+ ts,
823
832
  {
824
- isOpen: a,
825
- onClose: () => m(!1),
826
- participant: k,
827
- channel: r,
828
- followerStatusLabel: f,
829
- onLeaveConversation: l,
830
- onBlockParticipant: o
833
+ isOpen: l,
834
+ onClose: () => o(!1),
835
+ participant: I,
836
+ channel: i,
837
+ followerStatusLabel: N,
838
+ onLeaveConversation: r,
839
+ onBlockParticipant: a
831
840
  }
832
841
  )
833
842
  ] });
834
- }, ns = ({
843
+ }, ls = ({
835
844
  channel: t,
836
845
  onBack: s,
837
846
  showBackButton: n = !1,
838
- renderMessageInputActions: l,
839
- onLeaveConversation: o,
840
- onBlockParticipant: i,
841
- className: r,
842
- CustomChannelEmptyState: a = Ne
847
+ renderMessageInputActions: r,
848
+ onLeaveConversation: a,
849
+ onBlockParticipant: c,
850
+ className: i,
851
+ CustomChannelEmptyState: l = be
843
852
  }) => /* @__PURE__ */ e(
844
853
  "div",
845
854
  {
846
855
  className: R(
847
856
  "messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
848
- r
857
+ i
849
858
  ),
850
- children: /* @__PURE__ */ e(_e, { channel: t, children: /* @__PURE__ */ e(
851
- ss,
859
+ children: /* @__PURE__ */ e(Be, { channel: t, children: /* @__PURE__ */ e(
860
+ rs,
852
861
  {
853
862
  onBack: s,
854
863
  showBackButton: n,
855
- renderMessageInputActions: l,
856
- onLeaveConversation: o,
857
- onBlockParticipant: i,
858
- CustomChannelEmptyState: a
864
+ renderMessageInputActions: r,
865
+ onLeaveConversation: a,
866
+ onBlockParticipant: c,
867
+ CustomChannelEmptyState: l
859
868
  }
860
869
  ) })
861
870
  }
862
871
  );
863
- function ts({
872
+ function os({
864
873
  searchQuery: t,
865
874
  setSearchQuery: s,
866
875
  placeholder: n
867
876
  }) {
868
- const l = z(null);
869
- return /* @__PURE__ */ u("div", { className: "relative", children: [
877
+ const r = $(null);
878
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
870
879
  /* @__PURE__ */ e(
871
- He,
880
+ We,
872
881
  {
873
882
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
874
883
  weight: "bold"
@@ -877,170 +886,196 @@ function ts({
877
886
  /* @__PURE__ */ e(
878
887
  "input",
879
888
  {
880
- ref: l,
889
+ ref: r,
881
890
  type: "text",
882
891
  placeholder: n,
883
892
  value: t,
884
- onChange: (o) => s(o.target.value),
893
+ onChange: (a) => s(a.target.value),
885
894
  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"
886
895
  }
887
896
  ),
888
897
  t && /* @__PURE__ */ e(
889
- ge,
898
+ xe,
890
899
  {
891
900
  label: "Clear search",
892
901
  onClick: () => {
893
- var o;
894
- s(""), (o = l.current) == null || o.focus();
902
+ var a;
903
+ s(""), (a = r.current) == null || a.focus();
895
904
  },
896
905
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
897
- children: /* @__PURE__ */ e(fe, { className: "h-4 w-4", weight: "bold" })
906
+ children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
898
907
  }
899
908
  )
900
909
  ] });
901
910
  }
902
- const rs = ({
911
+ const as = ({
903
912
  participantSource: t,
904
913
  onSelectParticipant: s,
905
914
  onClose: n,
906
- existingParticipantIds: l = /* @__PURE__ */ new Set(),
907
- participantLabel: o = "participants",
908
- searchPlaceholder: i = "Search participants...",
909
- className: r
915
+ existingParticipantIds: r = /* @__PURE__ */ new Set(),
916
+ participantLabel: a = "participants",
917
+ searchPlaceholder: c = "Search participants...",
918
+ className: i
910
919
  }) => {
911
- const { debug: a } = se(), [m, x] = E(""), [k, f] = E([]), [h, I] = E(!1), [g, C] = E(null), [w, v] = E(
920
+ const { debug: l } = ne(), [o, w] = y(""), [I, N] = y([]), [m, S] = y(!1), [g, b] = y(null), [E, v] = y(
912
921
  null
913
- ), y = z(!1);
914
- $(() => {
922
+ ), F = $(!1);
923
+ H(() => {
915
924
  if (t.loading) {
916
- a && console.log(
925
+ l && console.log(
917
926
  "[ParticipantPicker] Waiting for participant source to finish loading..."
918
927
  );
919
928
  return;
920
929
  }
921
- if (y.current) return;
930
+ if (F.current) return;
922
931
  (async () => {
923
- a && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), C(null);
932
+ l && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), b(null);
924
933
  try {
925
- const d = await t.loadParticipants({
934
+ const f = await t.loadParticipants({
926
935
  search: "",
927
936
  // Load all participants initially
928
937
  limit: 100
929
938
  });
930
- f(d.participants), y.current = !0, a && console.log(
939
+ N(f.participants), F.current = !0, l && console.log(
931
940
  "[ParticipantPicker] Participants loaded successfully:",
932
- d.participants.length
941
+ f.participants.length
933
942
  );
934
- } catch (d) {
935
- const N = d instanceof Error ? d.message : "Failed to load participants";
936
- C(N), console.error("[ParticipantPicker] Failed to load participants:", d);
943
+ } catch (f) {
944
+ const x = f instanceof Error ? f.message : "Failed to load participants";
945
+ b(x), console.error("[ParticipantPicker] Failed to load participants:", f);
937
946
  } finally {
938
- I(!1);
947
+ S(!1);
939
948
  }
940
949
  })();
941
- }, [t.loading, a]);
942
- const S = k.filter((c) => !l.has(c.id)).filter((c) => {
943
- var N;
944
- if (!m) return !0;
945
- const d = m.toLowerCase();
946
- return c.name.toLowerCase().includes(d) || ((N = c.email) == null ? void 0 : N.toLowerCase().includes(d)) || !1;
947
- }), F = M(
948
- async (c) => {
949
- if (!w) {
950
- v(c.id);
950
+ }, [t.loading, l]);
951
+ const C = I.filter((u) => !r.has(u.id)).filter((u) => {
952
+ var x;
953
+ if (!o) return !0;
954
+ const f = o.toLowerCase();
955
+ return u.name.toLowerCase().includes(f) || ((x = u.email) == null ? void 0 : x.toLowerCase().includes(f)) || !1;
956
+ }), T = P(
957
+ async (u) => {
958
+ if (!E) {
959
+ v(u.id);
951
960
  try {
952
- await s(c);
953
- } catch (d) {
954
- console.error("[ParticipantPicker] Failed to start chat:", d), v(null);
961
+ await s(u);
962
+ } catch (f) {
963
+ console.error("[ParticipantPicker] Failed to start chat:", f), v(null);
955
964
  }
956
965
  }
957
966
  },
958
- [s, w]
959
- ), D = (c, d) => {
960
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), F(d));
967
+ [s, E]
968
+ ), p = (u, f) => {
969
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), T(f));
961
970
  };
962
- return /* @__PURE__ */ u("div", { className: R("flex flex-col h-full", r), children: [
963
- /* @__PURE__ */ u("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
964
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-3", children: [
971
+ return /* @__PURE__ */ d("div", { className: R("flex flex-col h-full", i), children: [
972
+ /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
973
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
965
974
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
966
- /* @__PURE__ */ e(xe, { onClick: n })
975
+ /* @__PURE__ */ e(Ne, { onClick: n })
967
976
  ] }),
968
- /* @__PURE__ */ u("p", { className: "text-xs text-stone mb-3", children: [
977
+ /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
969
978
  "Select a ",
970
- o.slice(0, -1),
979
+ a.slice(0, -1),
971
980
  " to start messaging (",
972
- S.length,
981
+ C.length,
973
982
  " available)",
974
- t.totalCount !== void 0 && ` • ${t.totalCount} ${o} total`
983
+ t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
975
984
  ] }),
976
985
  /* @__PURE__ */ e(
977
- ts,
986
+ os,
978
987
  {
979
- searchQuery: m,
980
- setSearchQuery: x,
981
- placeholder: i
988
+ searchQuery: o,
989
+ setSearchQuery: w,
990
+ placeholder: c
982
991
  }
983
992
  )
984
993
  ] }),
985
- g && /* @__PURE__ */ u("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
994
+ g && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
986
995
  "Error loading ",
987
- o,
996
+ a,
988
997
  ": ",
989
998
  g
990
999
  ] }),
991
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: h && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
1000
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && C.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
992
1001
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
993
- /* @__PURE__ */ u("span", { className: "text-sm text-stone", children: [
1002
+ /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
994
1003
  "Loading ",
995
- o,
1004
+ a,
996
1005
  "..."
997
1006
  ] })
998
- ] }) }) : S.length === 0 ? /* @__PURE__ */ u("div", { className: "p-6 text-center", children: [
999
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ce, { className: "h-8 w-8 text-charcoal" }) }),
1000
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${o} found` : k.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1001
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1002
- ] }) : /* @__PURE__ */ u("ul", { className: "space-y-0", children: [
1003
- S.map((c) => {
1004
- const d = c.name || c.email || c.id, N = c.email && c.name ? c.email : c.phone;
1007
+ ] }) }) : C.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
1008
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
1009
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : I.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1010
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : I.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1011
+ ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
1012
+ C.map((u) => {
1013
+ const f = u.name || u.email || u.id, x = u.email && u.name ? u.email : u.phone;
1005
1014
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1006
1015
  "button",
1007
1016
  {
1008
1017
  type: "button",
1009
- onClick: () => F(c),
1010
- onKeyDown: (j) => D(j, c),
1018
+ onClick: () => T(u),
1019
+ onKeyDown: (D) => p(D, u),
1011
1020
  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",
1012
- children: /* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
1013
- /* @__PURE__ */ u("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1021
+ children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
1022
+ /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1014
1023
  /* @__PURE__ */ e(
1015
- Y,
1024
+ J,
1016
1025
  {
1017
- id: c.id,
1018
- name: d,
1019
- image: c.image,
1026
+ id: u.id,
1027
+ name: f,
1028
+ image: u.image,
1020
1029
  size: 40
1021
1030
  }
1022
1031
  ),
1023
- /* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
1024
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
1025
- N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
1032
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
1033
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: f }),
1034
+ x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
1026
1035
  ] })
1027
1036
  ] }),
1028
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === c.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
1037
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === u.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
1029
1038
  ] })
1030
1039
  }
1031
- ) }, c.id);
1040
+ ) }, u.id);
1032
1041
  }),
1033
- h && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
1042
+ m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
1034
1043
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1035
1044
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1036
1045
  ] }) })
1037
1046
  ] }) })
1038
1047
  ] });
1039
- }, ls = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
1048
+ }, is = ({ hasChannels: t, onStartConversation: s, participantLabel: n }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1040
1049
  /* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "💬" }) }),
1041
1050
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
1042
- /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? "Choose a conversation from the list." : "No conversations yet." })
1043
- ] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
1051
+ /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(se, { children: [
1052
+ "Choose a conversation from the list or",
1053
+ " ",
1054
+ s && /* @__PURE__ */ d(me, { onClick: s, children: [
1055
+ "start a new conversation with a ",
1056
+ n.slice(0, -1),
1057
+ "."
1058
+ ] })
1059
+ ] }) : s && /* @__PURE__ */ d(se, { children: [
1060
+ /* @__PURE__ */ d(me, { onClick: s, children: [
1061
+ "Start a new conversation with one of your ",
1062
+ n
1063
+ ] }),
1064
+ " ",
1065
+ "to begin messaging."
1066
+ ] }) })
1067
+ ] }) }), me = ({
1068
+ onClick: t,
1069
+ children: s
1070
+ }) => /* @__PURE__ */ e(
1071
+ "button",
1072
+ {
1073
+ type: "button",
1074
+ onClick: t,
1075
+ className: "inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary",
1076
+ children: s
1077
+ }
1078
+ ), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1044
1079
  /* @__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: "⚠️" }) }),
1045
1080
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1046
1081
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1053,12 +1088,12 @@ const rs = ({
1053
1088
  children: "Go Back"
1054
1089
  }
1055
1090
  )
1056
- ] }) }), os = ({ className: t, message: s }) => /* @__PURE__ */ u(
1091
+ ] }) }), cs = ({ className: t, message: s }) => /* @__PURE__ */ d(
1057
1092
  "div",
1058
1093
  {
1059
1094
  className: R("flex items-center justify-center h-full", t),
1060
1095
  children: [
1061
- /* @__PURE__ */ u("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1096
+ /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1062
1097
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1063
1098
  "animateTransform",
1064
1099
  {
@@ -1096,198 +1131,205 @@ const rs = ({
1096
1131
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1097
1132
  ]
1098
1133
  }
1099
- ), as = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ u("div", { className: "flex items-center", children: [
1100
- /* @__PURE__ */ e(os, { className: "w-6 h-6" }),
1134
+ ), ds = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1135
+ /* @__PURE__ */ e(cs, { className: "w-6 h-6" }),
1101
1136
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1102
- ] }) }), xs = ({
1137
+ ] }) }), vs = ({
1103
1138
  capabilities: t = {},
1104
1139
  className: s,
1105
1140
  renderMessageInputActions: n,
1106
- onChannelSelect: l,
1107
- onParticipantSelect: o,
1108
- initialParticipantFilter: i,
1109
- initialParticipantData: r,
1110
- CustomChannelEmptyState: a,
1111
- showChannelList: m = !0,
1112
- filters: x,
1113
- channelListCustomEmptyStateIndicator: k
1141
+ onChannelSelect: r,
1142
+ onParticipantSelect: a,
1143
+ initialParticipantFilter: c,
1144
+ initialParticipantData: i,
1145
+ CustomChannelEmptyState: l,
1146
+ showChannelList: o = !0,
1147
+ filters: w,
1148
+ channelListCustomEmptyStateIndicator: I
1114
1149
  }) => {
1115
1150
  const {
1116
- service: f,
1117
- client: h,
1118
- isConnected: I,
1151
+ service: N,
1152
+ client: m,
1153
+ isConnected: S,
1119
1154
  isLoading: g,
1120
- error: C,
1121
- refreshConnection: w,
1155
+ error: b,
1156
+ refreshConnection: E,
1122
1157
  debug: v
1123
- } = Ge(), [y, S] = E(null), [F, D] = E(!1), [c, d] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [_, G] = E(!1), [J, H] = E(null), V = z(null), { participantSource: Q, participantLabel: T = "participants" } = t, P = q.useMemo(() => {
1124
- const b = h == null ? void 0 : h.userID;
1158
+ } = qe(), [F, C] = y(null), [T, p] = y(!1), [u, f] = y(!1), [x, D] = y(/* @__PURE__ */ new Set()), [q, _] = y(0), [O, W] = y(!1), [Q, G] = y(null), V = $(null), {
1159
+ showStartConversation: X = !1,
1160
+ participantSource: k,
1161
+ participantLabel: M = "participants"
1162
+ } = t, A = Y.useMemo(() => {
1163
+ const h = m == null ? void 0 : m.userID;
1125
1164
  return {
1126
1165
  ...{
1127
1166
  type: "messaging",
1128
1167
  last_message_at: { $exists: !0 },
1129
- ...b && {
1130
- members: { $in: [b] },
1168
+ ...h && {
1169
+ members: { $in: [h] },
1131
1170
  hidden: !1
1132
1171
  }
1133
1172
  },
1134
- ...x
1173
+ ...w
1135
1174
  };
1136
- }, [x, h == null ? void 0 : h.userID]), U = z(null), O = M(async () => {
1137
- if (!h || !I) return;
1138
- const b = h.userID;
1139
- if (b)
1175
+ }, [w, m == null ? void 0 : m.userID]), j = $(null), B = P(async () => {
1176
+ if (!m || !S) return;
1177
+ const h = m.userID;
1178
+ if (h)
1140
1179
  try {
1141
- v && console.log("[MessagingShell] Syncing channels for user:", b);
1142
- const L = await h.queryChannels(
1180
+ v && console.log("[MessagingShell] Syncing channels for user:", h);
1181
+ const L = await m.queryChannels(
1143
1182
  {
1144
1183
  type: "messaging",
1145
- members: { $in: [b] }
1184
+ members: { $in: [h] }
1146
1185
  },
1147
1186
  {},
1148
1187
  { limit: 100 }
1149
- ), p = /* @__PURE__ */ new Set();
1150
- L.forEach((B) => {
1151
- const Ee = B.state.members;
1152
- Object.values(Ee).forEach((Ie) => {
1153
- var le;
1154
- const te = (le = Ie.user) == null ? void 0 : le.id;
1155
- te && te !== b && p.add(te);
1188
+ ), U = /* @__PURE__ */ new Set();
1189
+ L.forEach((z) => {
1190
+ const Se = z.state.members;
1191
+ Object.values(Se).forEach((ke) => {
1192
+ var oe;
1193
+ const re = (oe = ke.user) == null ? void 0 : oe.id;
1194
+ re && re !== h && U.add(re);
1156
1195
  });
1157
- }), j(p), D(L.length > 0), U.current = b, v && console.log("[MessagingShell] Channels synced successfully:", {
1196
+ }), D(U), p(L.length > 0), j.current = h, v && console.log("[MessagingShell] Channels synced successfully:", {
1158
1197
  channelCount: L.length,
1159
- memberCount: p.size
1198
+ memberCount: U.size
1160
1199
  });
1161
1200
  } catch (L) {
1162
1201
  console.error("[MessagingShell] Failed to sync channels:", L);
1163
1202
  }
1164
- }, [h, I, v]);
1165
- $(() => {
1166
- if (!h || !I) return;
1167
- const b = h.userID;
1168
- b && U.current !== b && O();
1169
- }, [h, I, O]), $(() => {
1170
- if (!i || !h || !I) return;
1203
+ }, [m, S, v]);
1204
+ H(() => {
1205
+ if (!m || !S) return;
1206
+ const h = m.userID;
1207
+ h && j.current !== h && B();
1208
+ }, [m, S, B]), H(() => {
1209
+ if (!c || !m || !S) return;
1171
1210
  (async () => {
1172
- const L = h.userID;
1211
+ const L = m.userID;
1173
1212
  if (L)
1174
1213
  try {
1175
1214
  v && console.log(
1176
1215
  "[MessagingShell] Loading initial conversation with:",
1177
- i
1216
+ c
1178
1217
  );
1179
- const p = await h.queryChannels(
1218
+ const U = await m.queryChannels(
1180
1219
  {
1181
1220
  type: "messaging",
1182
- members: { $eq: [L, i] }
1221
+ members: { $eq: [L, c] }
1183
1222
  },
1184
1223
  {},
1185
1224
  { limit: 1 }
1186
1225
  );
1187
- if (p.length > 0)
1188
- S(p[0]), G(!0), H(null), l && l(p[0]), v && console.log(
1226
+ if (U.length > 0)
1227
+ C(U[0]), W(!0), G(null), r && r(U[0]), v && console.log(
1189
1228
  "[MessagingShell] Initial conversation loaded:",
1190
- p[0].id
1229
+ U[0].id
1191
1230
  );
1192
- else if (r && f) {
1231
+ else if (i && N) {
1193
1232
  v && console.log(
1194
1233
  "[MessagingShell] No conversation found, creating one for:",
1195
- r
1234
+ i
1196
1235
  );
1197
1236
  try {
1198
- const B = await f.startChannelWithParticipant({
1199
- id: r.id,
1200
- name: r.name,
1201
- email: r.email,
1202
- phone: r.phone
1237
+ const z = await N.startChannelWithParticipant({
1238
+ id: i.id,
1239
+ name: i.name,
1240
+ email: i.email,
1241
+ phone: i.phone
1203
1242
  });
1204
- S(B), G(!0), H(null), l && l(B), v && console.log(
1243
+ C(z), W(!0), G(null), r && r(z), v && console.log(
1205
1244
  "[MessagingShell] Channel created and loaded:",
1206
- B.id
1245
+ z.id
1207
1246
  );
1208
- } catch (B) {
1247
+ } catch (z) {
1209
1248
  console.error(
1210
1249
  "[MessagingShell] Failed to create conversation:",
1211
- B
1212
- ), H("Failed to create conversation");
1250
+ z
1251
+ ), G("Failed to create conversation");
1213
1252
  }
1214
1253
  } else
1215
- H(
1254
+ G(
1216
1255
  "No conversation found with this account"
1217
1256
  ), v && console.log(
1218
1257
  "[MessagingShell] No conversation found for:",
1219
- i
1258
+ c
1220
1259
  );
1221
- } catch (p) {
1260
+ } catch (U) {
1222
1261
  console.error(
1223
1262
  "[MessagingShell] Failed to load initial conversation:",
1224
- p
1225
- ), H("Failed to load conversation");
1263
+ U
1264
+ ), G("Failed to load conversation");
1226
1265
  }
1227
1266
  })();
1228
1267
  }, [
1268
+ c,
1229
1269
  i,
1230
- r,
1231
- h,
1232
- I,
1233
- f,
1270
+ m,
1271
+ S,
1272
+ N,
1234
1273
  v,
1235
- l
1274
+ r
1236
1275
  ]);
1237
- const X = M(
1238
- (b) => {
1239
- S(b), l == null || l(b);
1276
+ const ve = P(
1277
+ (h) => {
1278
+ C(h), r == null || r(h);
1240
1279
  },
1241
- [l]
1242
- ), be = M(() => {
1243
- _ || S(null);
1244
- }, [_]), ve = M(
1245
- async (b) => {
1280
+ [r]
1281
+ ), Ce = P(() => {
1282
+ O || C(null);
1283
+ }, [O]), we = P(() => {
1284
+ var h;
1285
+ k && (_((L) => L + 1), f(!0), (h = V.current) == null || h.showModal());
1286
+ }, [k]), Ee = P(
1287
+ async (h) => {
1246
1288
  var L;
1247
- if (f)
1289
+ if (N)
1248
1290
  try {
1249
1291
  v && console.log(
1250
1292
  "[MessagingShell] Starting conversation with:",
1251
- b.id
1293
+ h.id
1252
1294
  );
1253
- const p = await f.startChannelWithParticipant({
1254
- id: b.id,
1255
- name: b.name,
1256
- email: b.email,
1257
- phone: b.phone
1295
+ const U = await N.startChannelWithParticipant({
1296
+ id: h.id,
1297
+ name: h.name,
1298
+ email: h.email,
1299
+ phone: h.phone
1258
1300
  });
1259
1301
  try {
1260
- await p.show();
1261
- } catch (B) {
1262
- console.warn("[MessagingShell] Failed to unhide channel:", B);
1302
+ await U.show();
1303
+ } catch (z) {
1304
+ console.warn("[MessagingShell] Failed to unhide channel:", z);
1263
1305
  }
1264
- S(p), d(!1), (L = V.current) == null || L.close(), o == null || o(b);
1265
- } catch (p) {
1266
- console.error("[MessagingShell] Failed to start conversation:", p);
1306
+ C(U), f(!1), (L = V.current) == null || L.close(), a == null || a(h);
1307
+ } catch (U) {
1308
+ console.error("[MessagingShell] Failed to start conversation:", U);
1267
1309
  }
1268
1310
  },
1269
- [f, o, v]
1270
- ), ne = M(() => {
1271
- var b;
1272
- d(!1), (b = V.current) == null || b.close();
1273
- }, []), Ce = M(
1274
- async (b) => {
1275
- v && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), G(!1), U.current = null, await O();
1311
+ [N, a, v]
1312
+ ), te = P(() => {
1313
+ var h;
1314
+ f(!1), (h = V.current) == null || h.close();
1315
+ }, []), ye = P(
1316
+ async (h) => {
1317
+ v && console.log("[MessagingShell] Leaving conversation:", h.id), C(null), W(!1), j.current = null, await B();
1276
1318
  },
1277
- [O, v]
1278
- ), we = M(
1279
- async (b) => {
1280
- v && console.log("[MessagingShell] Blocking participant:", b), S(null), G(!1), U.current = null, await O();
1319
+ [B, v]
1320
+ ), Ie = P(
1321
+ async (h) => {
1322
+ v && console.log("[MessagingShell] Blocking participant:", h), C(null), W(!1), j.current = null, await B();
1281
1323
  },
1282
- [O, v]
1283
- ), Z = !!y;
1284
- return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(as, {}) }) : C ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: C, onBack: w }) }) : !I || !h ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1285
- re,
1324
+ [B, v]
1325
+ ), Z = !!F;
1326
+ return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ds, {}) }) : b ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: b, onBack: E }) }) : !S || !m ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1327
+ le,
1286
1328
  {
1287
1329
  message: "Not connected to messaging service",
1288
- onBack: w
1330
+ onBack: E
1289
1331
  }
1290
- ) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: J }) }) : /* @__PURE__ */ u(
1332
+ ) }) : Q ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(le, { message: Q }) }) : /* @__PURE__ */ d(
1291
1333
  "div",
1292
1334
  {
1293
1335
  className: R(
@@ -1295,7 +1337,7 @@ const rs = ({
1295
1337
  s
1296
1338
  ),
1297
1339
  children: [
1298
- /* @__PURE__ */ u("div", { className: "flex h-full min-h-0", children: [
1340
+ /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1299
1341
  /* @__PURE__ */ e(
1300
1342
  "div",
1301
1343
  {
@@ -1303,20 +1345,20 @@ const rs = ({
1303
1345
  "messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
1304
1346
  {
1305
1347
  // Explicitly hidden via prop or in direct conversation mode
1306
- "!hidden": m === !1 || _,
1348
+ "!hidden": o === !1 || O,
1307
1349
  // Normal mode: hide on mobile when channel selected, show on desktop
1308
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !_ && Z,
1350
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !O && Z,
1309
1351
  // Normal mode: show when no channel selected
1310
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !_ && !Z
1352
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !O && !Z
1311
1353
  }
1312
1354
  ),
1313
1355
  children: /* @__PURE__ */ e(
1314
- Qe,
1356
+ Ke,
1315
1357
  {
1316
- onChannelSelect: X,
1317
- selectedChannel: y || void 0,
1318
- filters: P,
1319
- customEmptyStateIndicator: k
1358
+ onChannelSelect: ve,
1359
+ selectedChannel: F || void 0,
1360
+ filters: A,
1361
+ customEmptyStateIndicator: I
1320
1362
  }
1321
1363
  )
1322
1364
  }
@@ -1328,59 +1370,66 @@ const rs = ({
1328
1370
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1329
1371
  {
1330
1372
  // In direct conversation mode, always show (full width)
1331
- flex: _ || Z,
1373
+ flex: O || Z,
1332
1374
  // Normal mode: hide on mobile when no channel selected
1333
- "hidden lg:flex": !_ && !Z
1375
+ "hidden lg:flex": !O && !Z
1334
1376
  }
1335
1377
  ),
1336
- children: y ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1337
- ns,
1378
+ children: F ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1379
+ ls,
1338
1380
  {
1339
- channel: y,
1340
- onBack: be,
1341
- showBackButton: !_,
1381
+ channel: F,
1382
+ onBack: Ce,
1383
+ showBackButton: !O,
1342
1384
  renderMessageInputActions: n,
1343
- onLeaveConversation: Ce,
1344
- onBlockParticipant: we,
1345
- CustomChannelEmptyState: a
1385
+ onLeaveConversation: ye,
1386
+ onBlockParticipant: Ie,
1387
+ CustomChannelEmptyState: l
1346
1388
  },
1347
- y.id
1348
- ) }) : /* @__PURE__ */ e(ls, { hasChannels: F })
1389
+ F.id
1390
+ ) }) : /* @__PURE__ */ e(
1391
+ is,
1392
+ {
1393
+ hasChannels: T,
1394
+ onStartConversation: X ? we : void 0,
1395
+ participantLabel: M
1396
+ }
1397
+ )
1349
1398
  }
1350
1399
  )
1351
1400
  ] }),
1352
- Q && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1401
+ k && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1353
1402
  /* @__PURE__ */ e(
1354
1403
  "dialog",
1355
1404
  {
1356
1405
  ref: V,
1357
1406
  className: "mes-dialog",
1358
- onClick: (b) => {
1359
- b.target === V.current && ne();
1407
+ onClick: (h) => {
1408
+ h.target === V.current && te();
1360
1409
  },
1361
- onClose: ne,
1410
+ onClose: te,
1362
1411
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1363
- rs,
1412
+ as,
1364
1413
  {
1365
- participantSource: Q,
1366
- onSelectParticipant: ve,
1367
- onClose: ne,
1368
- existingParticipantIds: N,
1369
- participantLabel: T,
1370
- searchPlaceholder: `Search ${T}...`
1414
+ participantSource: k,
1415
+ onSelectParticipant: Ee,
1416
+ onClose: te,
1417
+ existingParticipantIds: x,
1418
+ participantLabel: M,
1419
+ searchPlaceholder: `Search ${M}...`
1371
1420
  },
1372
- A
1421
+ q
1373
1422
  ) })
1374
1423
  }
1375
1424
  )
1376
1425
  ]
1377
1426
  }
1378
1427
  );
1379
- }, is = ({
1428
+ }, us = ({
1380
1429
  question: t,
1381
1430
  onClick: s,
1382
1431
  loading: n = !1,
1383
- className: l
1432
+ className: r
1384
1433
  }) => /* @__PURE__ */ e(
1385
1434
  "button",
1386
1435
  {
@@ -1394,104 +1443,104 @@ const rs = ({
1394
1443
  "hover:brightness-95 active:brightness-90": !n,
1395
1444
  "opacity-50 cursor-not-allowed": n
1396
1445
  },
1397
- l
1446
+ r
1398
1447
  ),
1399
1448
  children: t
1400
1449
  }
1401
- ), Ns = ({
1450
+ ), Cs = ({
1402
1451
  faqs: t,
1403
1452
  onFaqClick: s,
1404
1453
  loadingFaqId: n,
1405
- headerText: l,
1406
- className: o,
1407
- avatarImage: i,
1408
- avatarName: r
1454
+ headerText: r,
1455
+ className: a,
1456
+ avatarImage: c,
1457
+ avatarName: i
1409
1458
  }) => {
1410
- const a = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
1411
- return a.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", o), children: /* @__PURE__ */ u("div", { className: "flex gap-3 items-end", children: [
1412
- (i || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1413
- Y,
1459
+ const l = t.filter((o) => o.enabled).sort((o, w) => (o.order ?? 0) - (w.order ?? 0));
1460
+ return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", a), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1461
+ (c || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1462
+ J,
1414
1463
  {
1415
- id: r || "account",
1416
- name: r || "Account",
1417
- image: i,
1464
+ id: i || "account",
1465
+ name: i || "Account",
1466
+ image: c,
1418
1467
  size: 24,
1419
1468
  shape: "circle"
1420
1469
  }
1421
1470
  ) }),
1422
- /* @__PURE__ */ u(
1471
+ /* @__PURE__ */ d(
1423
1472
  "div",
1424
1473
  {
1425
1474
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
1426
1475
  style: { backgroundColor: "#F1F0EE" },
1427
1476
  children: [
1428
- l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1429
- a.map((m) => /* @__PURE__ */ e(
1430
- is,
1477
+ r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
1478
+ l.map((o) => /* @__PURE__ */ e(
1479
+ us,
1431
1480
  {
1432
- question: m.question,
1433
- onClick: () => s(m.id),
1434
- loading: n === m.id
1481
+ question: o.question,
1482
+ onClick: () => s(o.id),
1483
+ loading: n === o.id
1435
1484
  },
1436
- m.id
1485
+ o.id
1437
1486
  ))
1438
1487
  ]
1439
1488
  }
1440
1489
  )
1441
1490
  ] }) });
1442
- }, bs = (t, s = {}) => {
1443
- const { initialSearch: n = "", pageSize: l = 20 } = s, [o, i] = E([]), [r, a] = E(!1), [m, x] = E(null), [k, f] = E(n), [h, I] = E(!0), [g, C] = E(), w = M(async (F = !1, D) => {
1444
- if (r) return;
1445
- const c = D !== void 0 ? D : k;
1446
- a(!0), x(null);
1491
+ }, ws = (t, s = {}) => {
1492
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [i, l] = y(!1), [o, w] = y(null), [I, N] = y(n), [m, S] = y(!0), [g, b] = y(), E = P(async (T = !1, p) => {
1493
+ if (i) return;
1494
+ const u = p !== void 0 ? p : I;
1495
+ l(!0), w(null);
1447
1496
  try {
1448
- const d = await t.loadParticipants({
1449
- search: c || void 0,
1450
- limit: l,
1451
- cursor: F ? void 0 : g
1497
+ const f = await t.loadParticipants({
1498
+ search: u || void 0,
1499
+ limit: r,
1500
+ cursor: T ? void 0 : g
1452
1501
  });
1453
- i(
1454
- (N) => F ? d.participants : [...N, ...d.participants]
1455
- ), I(d.hasMore), C(d.nextCursor);
1456
- } catch (d) {
1457
- const N = d instanceof Error ? d.message : "Failed to load participants";
1458
- x(N), console.error("[useParticipants] Load error:", d);
1502
+ c(
1503
+ (x) => T ? f.participants : [...x, ...f.participants]
1504
+ ), S(f.hasMore), b(f.nextCursor);
1505
+ } catch (f) {
1506
+ const x = f instanceof Error ? f.message : "Failed to load participants";
1507
+ w(x), console.error("[useParticipants] Load error:", f);
1459
1508
  } finally {
1460
- a(!1);
1509
+ l(!1);
1461
1510
  }
1462
- }, [t, k, g, l, r]), v = M(() => {
1463
- h && !r && w(!1);
1464
- }, [h, r, w]), y = M((F) => {
1465
- f(F), C(void 0), w(!0, F);
1466
- }, [w]), S = M(() => {
1467
- C(void 0), w(!0);
1468
- }, [w]);
1469
- return $(() => {
1470
- w(!0);
1511
+ }, [t, I, g, r, i]), v = P(() => {
1512
+ m && !i && E(!1);
1513
+ }, [m, i, E]), F = P((T) => {
1514
+ N(T), b(void 0), E(!0, T);
1515
+ }, [E]), C = P(() => {
1516
+ b(void 0), E(!0);
1517
+ }, [E]);
1518
+ return H(() => {
1519
+ E(!0);
1471
1520
  }, [t.loadParticipants]), {
1472
- participants: o,
1473
- loading: r,
1474
- error: m,
1475
- searchQuery: k,
1476
- hasMore: h,
1521
+ participants: a,
1522
+ loading: i,
1523
+ error: o,
1524
+ searchQuery: I,
1525
+ hasMore: m,
1477
1526
  totalCount: t.totalCount,
1478
1527
  loadMore: v,
1479
- search: y,
1480
- refresh: S
1528
+ search: F,
1529
+ refresh: C
1481
1530
  };
1482
1531
  };
1483
1532
  export {
1484
- Y as Avatar,
1485
- Ne as ChannelEmptyState,
1486
- Qe as ChannelList,
1487
- ns as ChannelView,
1488
- Ns as FaqList,
1489
- is as FaqListItem,
1490
- gs as MessagingProvider,
1491
- xs as MessagingShell,
1492
- rs as ParticipantPicker,
1493
- We as formatRelativeTime,
1494
- Ge as useMessaging,
1495
- bs as useParticipants
1533
+ J as Avatar,
1534
+ be as ChannelEmptyState,
1535
+ Ke as ChannelList,
1536
+ ls as ChannelView,
1537
+ Cs as FaqList,
1538
+ us as FaqListItem,
1539
+ bs as MessagingProvider,
1540
+ vs as MessagingShell,
1541
+ as as ParticipantPicker,
1542
+ Je as formatRelativeTime,
1543
+ qe as useMessaging,
1544
+ ws as useParticipants
1496
1545
  };
1497
1546
  //# sourceMappingURL=index.js.map