@linktr.ee/messaging-react 1.0.0

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 ADDED
@@ -0,0 +1,1464 @@
1
+ import { jsxs as d, jsx as t, Fragment as oe } from "react/jsx-runtime";
2
+ import * as e from "react";
3
+ import _, { createContext as de, useContext as we, useState as A, useRef as $, useEffect as B, useCallback as H } from "react";
4
+ import L from "classnames";
5
+ import { Chat as Ae, useChatContext as Ze, ChannelList as ve, Channel as Me, Window as pe, MessageList as ye, useChannelStateContext as Ie, MessageInput as Re } from "stream-chat-react";
6
+ import { StreamChatService as Fe } from "@linktr.ee/messaging-core";
7
+ const Le = de({
8
+ color: "currentColor",
9
+ size: "1em",
10
+ weight: "regular",
11
+ mirrored: !1
12
+ }), D = e.forwardRef(
13
+ (n, a) => {
14
+ const {
15
+ alt: l,
16
+ color: o,
17
+ size: c,
18
+ weight: m,
19
+ mirrored: u,
20
+ children: r,
21
+ weights: s,
22
+ ...w
23
+ } = n, {
24
+ color: N = "currentColor",
25
+ size: g,
26
+ weight: i = "regular",
27
+ mirrored: C = !1,
28
+ ...x
29
+ } = e.useContext(Le);
30
+ return /* @__PURE__ */ e.createElement(
31
+ "svg",
32
+ {
33
+ ref: a,
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ width: c ?? g,
36
+ height: c ?? g,
37
+ fill: o ?? N,
38
+ viewBox: "0 0 256 256",
39
+ transform: u || C ? "scale(-1, 1)" : void 0,
40
+ ...x,
41
+ ...w
42
+ },
43
+ !!l && /* @__PURE__ */ e.createElement("title", null, l),
44
+ r,
45
+ s.get(m ?? i)
46
+ );
47
+ }
48
+ );
49
+ D.displayName = "IconBase";
50
+ const Ve = /* @__PURE__ */ new Map([
51
+ [
52
+ "bold",
53
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M232.49,55.51l-32-32a12,12,0,0,0-17,0l-96,96A12,12,0,0,0,84,128v32a12,12,0,0,0,12,12h32a12,12,0,0,0,8.49-3.51l96-96A12,12,0,0,0,232.49,55.51ZM192,49l15,15L196,75,181,60Zm-69,99H108V133l56-56,15,15Zm105-7.43V208a20,20,0,0,1-20,20H48a20,20,0,0,1-20-20V48A20,20,0,0,1,48,28h67.43a12,12,0,0,1,0,24H52V204H204V140.57a12,12,0,0,1,24,0Z" }))
54
+ ],
55
+ [
56
+ "duotone",
57
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M200,88l-72,72H96V128l72-72Z", opacity: "0.2" }), /* @__PURE__ */ e.createElement("path", { d: "M229.66,58.34l-32-32a8,8,0,0,0-11.32,0l-96,96A8,8,0,0,0,88,128v32a8,8,0,0,0,8,8h32a8,8,0,0,0,5.66-2.34l96-96A8,8,0,0,0,229.66,58.34ZM124.69,152H104V131.31l64-64L188.69,88ZM200,76.69,179.31,56,192,43.31,212.69,64ZM224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Z" }))
58
+ ],
59
+ [
60
+ "fill",
61
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Zm5.66-58.34-96,96A8,8,0,0,1,128,168H96a8,8,0,0,1-8-8V128a8,8,0,0,1,2.34-5.66l96-96a8,8,0,0,1,11.32,0l32,32A8,8,0,0,1,229.66,69.66Zm-17-5.66L192,43.31,179.31,56,200,76.69Z" }))
62
+ ],
63
+ [
64
+ "light",
65
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M228.24,59.76l-32-32a6,6,0,0,0-8.48,0l-96,96A6,6,0,0,0,90,128v32a6,6,0,0,0,6,6h32a6,6,0,0,0,4.24-1.76l96-96A6,6,0,0,0,228.24,59.76ZM125.51,154H102V130.49l66-66L191.51,88ZM200,79.51,176.49,56,192,40.49,215.51,64ZM222,128v80a14,14,0,0,1-14,14H48a14,14,0,0,1-14-14V48A14,14,0,0,1,48,34h80a6,6,0,0,1,0,12H48a2,2,0,0,0-2,2V208a2,2,0,0,0,2,2H208a2,2,0,0,0,2-2V128a6,6,0,0,1,12,0Z" }))
66
+ ],
67
+ [
68
+ "regular",
69
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M229.66,58.34l-32-32a8,8,0,0,0-11.32,0l-96,96A8,8,0,0,0,88,128v32a8,8,0,0,0,8,8h32a8,8,0,0,0,5.66-2.34l96-96A8,8,0,0,0,229.66,58.34ZM124.69,152H104V131.31l64-64L188.69,88ZM200,76.69,179.31,56,192,43.31,212.69,64ZM224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Z" }))
70
+ ],
71
+ [
72
+ "thin",
73
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M226.83,61.17l-32-32a4,4,0,0,0-5.66,0l-96,96A4,4,0,0,0,92,128v32a4,4,0,0,0,4,4h32a4,4,0,0,0,2.83-1.17l96-96A4,4,0,0,0,226.83,61.17ZM126.34,156H100V129.66l68-68L194.34,88ZM200,82.34,173.66,56,192,37.66,218.34,64ZM220,128v80a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V48A12,12,0,0,1,48,36h80a4,4,0,0,1,0,8H48a4,4,0,0,0-4,4V208a4,4,0,0,0,4,4H208a4,4,0,0,0,4-4V128a4,4,0,0,1,8,0Z" }))
74
+ ]
75
+ ]), me = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Ve }));
76
+ me.displayName = "NotePencilIcon";
77
+ function J({ label: n, className: a, children: l, ...o }) {
78
+ return /* @__PURE__ */ d(
79
+ "button",
80
+ {
81
+ type: "button",
82
+ className: L(
83
+ "rounded-full p-2 transition-colors focus-ring",
84
+ {
85
+ "cursor-not-allowed opacity-50": o.disabled,
86
+ "hover:bg-sand": !o.disabled
87
+ },
88
+ a
89
+ ),
90
+ ...o,
91
+ children: [
92
+ /* @__PURE__ */ t("span", { className: "sr-only", children: n }),
93
+ l
94
+ ]
95
+ }
96
+ );
97
+ }
98
+ const he = de({
99
+ service: null,
100
+ client: null,
101
+ isConnected: !1,
102
+ isLoading: !1,
103
+ error: null,
104
+ capabilities: {},
105
+ customization: {},
106
+ refreshConnection: async () => {
107
+ },
108
+ debug: !1
109
+ }), K = () => we(he), s1 = ({
110
+ children: n,
111
+ user: a,
112
+ serviceConfig: l,
113
+ apiKey: o,
114
+ capabilities: c = {},
115
+ customization: m = {},
116
+ debug: u = !1
117
+ }) => {
118
+ const r = (b, ...M) => {
119
+ u && console.log(`🔥 [MessagingProvider] ${b}`, ...M);
120
+ };
121
+ r("🔄 RENDER START", {
122
+ userId: a == null ? void 0 : a.id,
123
+ apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
124
+ serviceConfig: !!l,
125
+ capabilities: Object.keys(c),
126
+ customization: Object.keys(m)
127
+ });
128
+ const [s, w] = A(null), [N, g] = A(null), [i, C] = A(!1), [x, p] = A(!1), [Z, V] = A(null), R = $(!1), v = $({ userId: a == null ? void 0 : a.id, apiKey: o, serviceConfig: l, capabilities: c, customization: m }), y = $(0);
129
+ y.current++, r("📊 RENDER INFO", {
130
+ renderCount: y.current,
131
+ currentProps: { userId: a == null ? void 0 : a.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
132
+ propChanges: {
133
+ userChanged: v.current.userId !== (a == null ? void 0 : a.id),
134
+ apiKeyChanged: v.current.apiKey !== o,
135
+ serviceConfigChanged: v.current.serviceConfig !== l,
136
+ capabilitiesChanged: v.current.capabilities !== c,
137
+ customizationChanged: v.current.customization !== m
138
+ }
139
+ }), v.current = { userId: a == null ? void 0 : a.id, apiKey: o, serviceConfig: l, capabilities: c, customization: m }, B(() => {
140
+ const b = y.current;
141
+ if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
142
+ renderCount: b,
143
+ apiKey: !!o,
144
+ serviceConfig: !!l,
145
+ dependencies: {
146
+ apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
147
+ serviceConfigRef: l,
148
+ serviceConfigStable: v.current.serviceConfig === l,
149
+ apiKeyStable: v.current.apiKey === o
150
+ }
151
+ }), !o || !l) {
152
+ r("⚠️ SERVICE INIT SKIPPED", { renderCount: b, reason: "Missing apiKey or serviceConfig" });
153
+ return;
154
+ }
155
+ r("🚀 CREATING NEW SERVICE", {
156
+ renderCount: b,
157
+ apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
158
+ serviceConfigChanged: v.current.serviceConfig !== l
159
+ });
160
+ const M = new Fe({
161
+ ...l,
162
+ apiKey: o,
163
+ debug: u
164
+ });
165
+ return w(M), r("✅ SERVICE SET", { renderCount: b, serviceInstance: !!M }), () => {
166
+ r("🧹 SERVICE CLEANUP", { renderCount: b, reason: "Effect cleanup" }), M.disconnectUser().catch(console.error);
167
+ };
168
+ }, [o, l]);
169
+ const F = $(null);
170
+ B(() => {
171
+ var M, U;
172
+ if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
173
+ hasService: !!s,
174
+ hasUser: !!a,
175
+ userId: a == null ? void 0 : a.id,
176
+ isConnecting: R.current,
177
+ isConnected: i,
178
+ dependencies: { service: !!s, userId: a == null ? void 0 : a.id }
179
+ }), !s || !a) {
180
+ r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
181
+ return;
182
+ }
183
+ if (R.current) {
184
+ r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
185
+ return;
186
+ }
187
+ if (((M = F.current) == null ? void 0 : M.serviceId) === s && ((U = F.current) == null ? void 0 : U.userId) === a.id) {
188
+ r("⚠️ USER CONNECTION SKIPPED", "Already connected this user with this service");
189
+ return;
190
+ }
191
+ (async () => {
192
+ r("🚀 STARTING USER CONNECTION", { userId: a.id }), R.current = !0, p(!0), V(null);
193
+ try {
194
+ r("📞 CALLING SERVICE.CONNECTUSER", { userId: a.id });
195
+ const k = await s.connectUser(a);
196
+ g(k), C(!0), F.current = { serviceId: s, userId: a.id }, r("✅ USER CONNECTION SUCCESS", { userId: a.id, clientId: k.userID });
197
+ } catch (k) {
198
+ const P = k instanceof Error ? k.message : "Connection failed";
199
+ V(P), r("❌ USER CONNECTION ERROR", { userId: a.id, error: P });
200
+ } finally {
201
+ p(!1), R.current = !1, r("🔄 USER CONNECTION FINISHED", { userId: a.id, isConnected: i });
202
+ }
203
+ })();
204
+ }, [s, a]), B(() => (r("🔌 CLEANUP EFFECT REGISTERED", { hasService: !!s, isConnected: i }), () => {
205
+ s && i ? (r("🧹 CLEANUP EFFECT TRIGGERED", "Cleaning up connection on unmount"), F.current = null, s.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", { hasService: !!s, isConnected: i });
206
+ }), [s, i]);
207
+ const f = H(async () => {
208
+ if (r("🔄 REFRESH CONNECTION CALLED", { hasService: !!s, hasUser: !!a }), !s || !a) {
209
+ r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
210
+ return;
211
+ }
212
+ r("🚀 STARTING CONNECTION REFRESH", { userId: a.id }), p(!0);
213
+ try {
214
+ r("🔌 DISCONNECTING FOR REFRESH"), await s.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
215
+ const b = await s.connectUser(a);
216
+ g(b), C(!0), V(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: a.id });
217
+ } catch (b) {
218
+ const M = b instanceof Error ? b.message : "Refresh failed";
219
+ V(M), r("❌ CONNECTION REFRESH ERROR", { userId: a.id, error: M });
220
+ } finally {
221
+ p(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: a.id });
222
+ }
223
+ }, [s, a]), h = _.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
224
+ hasService: !!s,
225
+ hasClient: !!N,
226
+ isConnected: i,
227
+ isLoading: x,
228
+ hasError: !!Z,
229
+ capabilitiesKeys: Object.keys(c),
230
+ customizationKeys: Object.keys(m)
231
+ }), {
232
+ service: s,
233
+ client: N,
234
+ isConnected: i,
235
+ isLoading: x,
236
+ error: Z,
237
+ capabilities: c,
238
+ customization: m,
239
+ refreshConnection: f,
240
+ debug: u
241
+ }), [s, N, i, x, Z, c, m, f, u]);
242
+ return r("🔄 RENDER END", {
243
+ renderCount: y.current,
244
+ willRenderChat: !!(N && i),
245
+ contextValueReady: !!h
246
+ }), /* @__PURE__ */ t(he.Provider, { value: h, children: N && i ? /* @__PURE__ */ t(Ae, { client: N, children: n }) : n });
247
+ };
248
+ function He(n) {
249
+ const a = [
250
+ { bgColor: "bg-primary bg-opacity-20", textColor: "text-primary" },
251
+ // #8129D9 - purple
252
+ { bgColor: "bg-forest bg-opacity-20", textColor: "text-forest" },
253
+ // #254f1a - dark green
254
+ { bgColor: "bg-iris bg-opacity-20", textColor: "text-iris" },
255
+ // #061492 - dark blue
256
+ { bgColor: "bg-shade bg-opacity-20", textColor: "text-shade" },
257
+ // #1e2330 - dark blue-gray
258
+ { bgColor: "bg-dahlia bg-opacity-20", textColor: "text-dahlia" },
259
+ // #502274 - dark purple
260
+ { bgColor: "bg-orchid bg-opacity-20", textColor: "text-orchid" },
261
+ // #d717e7 - magenta
262
+ { bgColor: "bg-currant bg-opacity-20", textColor: "text-currant" },
263
+ // #780016 - dark red
264
+ { bgColor: "bg-apple bg-opacity-20", textColor: "text-apple" },
265
+ // #c41500 - red
266
+ { bgColor: "bg-rose bg-opacity-20", textColor: "text-rose" },
267
+ // #fc3e4b - pink
268
+ { bgColor: "bg-root bg-opacity-20", textColor: "text-root" },
269
+ // #4c2e05 - brown
270
+ { bgColor: "bg-poppy bg-opacity-20", textColor: "text-poppy" },
271
+ // #ff6c02 - orange
272
+ { bgColor: "bg-moss bg-opacity-20", textColor: "text-moss" }
273
+ // #70764d - olive green
274
+ ];
275
+ let l = 0;
276
+ for (let c = 0; c < n.length; c++)
277
+ l = (l << 5) - l + n.charCodeAt(c), l = l & l;
278
+ const o = Math.abs(l) % a.length;
279
+ return a[o];
280
+ }
281
+ const ee = ({
282
+ id: n,
283
+ name: a,
284
+ image: l,
285
+ size: o = 40,
286
+ className: c
287
+ }) => {
288
+ const { bgColor: m, textColor: u } = He(n), r = a.charAt(0).toUpperCase(), w = o < 32 ? "text-xs" : o < 56 ? "text-sm" : "text-lg";
289
+ return /* @__PURE__ */ t(
290
+ "div",
291
+ {
292
+ className: L(
293
+ "flex-shrink-0 overflow-hidden rounded-full",
294
+ c
295
+ ),
296
+ style: { width: `${o}px`, height: `${o}px` },
297
+ children: l ? /* @__PURE__ */ t(
298
+ "img",
299
+ {
300
+ src: l,
301
+ alt: "",
302
+ className: "h-full w-full object-cover aspect-square"
303
+ }
304
+ ) : /* @__PURE__ */ t(
305
+ "div",
306
+ {
307
+ className: L(
308
+ "flex h-full w-full items-center justify-center font-semibold",
309
+ m,
310
+ u,
311
+ w
312
+ ),
313
+ children: r
314
+ }
315
+ )
316
+ }
317
+ );
318
+ }, Se = ({ channel: n, selectedChannel: a, onChannelSelect: l, debug: o = !1, ...c }) => {
319
+ var p, Z, V, R, v, y, F;
320
+ const m = (a == null ? void 0 : a.id) === (n == null ? void 0 : n.id), u = () => {
321
+ n && l(n);
322
+ }, s = Object.values(((p = n == null ? void 0 : n.state) == null ? void 0 : p.members) || {}).find(
323
+ (f) => {
324
+ var h, b;
325
+ return ((h = f.user) == null ? void 0 : h.id) && f.user.id !== ((b = n == null ? void 0 : n._client) == null ? void 0 : b.userID);
326
+ }
327
+ ), w = ((Z = s == null ? void 0 : s.user) == null ? void 0 : Z.name) || "Conversation", N = (V = s == null ? void 0 : s.user) == null ? void 0 : V.image;
328
+ w.charAt(0).toUpperCase();
329
+ const g = (v = (R = n == null ? void 0 : n.state) == null ? void 0 : R.messages) == null ? void 0 : v[n.state.messages.length - 1], i = (g == null ? void 0 : g.text) || "No messages yet", C = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
330
+ hour: "2-digit",
331
+ minute: "2-digit"
332
+ }) : "", x = ((y = n == null ? void 0 : n.state) == null ? void 0 : y.unreadCount) || 0;
333
+ return o && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
334
+ channelId: n == null ? void 0 : n.id,
335
+ isSelected: m,
336
+ participantName: w,
337
+ unread: x,
338
+ hasTimestamp: !!C
339
+ }), /* @__PURE__ */ t(
340
+ "button",
341
+ {
342
+ type: "button",
343
+ onClick: u,
344
+ className: L(
345
+ "w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
346
+ {
347
+ "bg-primary-alt bg-opacity-10 border-l-4 border-l-primary": m,
348
+ "hover:bg-sand": !m
349
+ }
350
+ ),
351
+ children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
352
+ /* @__PURE__ */ t(
353
+ ee,
354
+ {
355
+ id: ((F = s == null ? void 0 : s.user) == null ? void 0 : F.id) || n.id || "unknown",
356
+ name: w,
357
+ image: N,
358
+ size: 44
359
+ }
360
+ ),
361
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
362
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
363
+ /* @__PURE__ */ t(
364
+ "h3",
365
+ {
366
+ className: L(
367
+ "text-sm font-medium truncate",
368
+ m ? "text-primary" : "text-charcoal"
369
+ ),
370
+ children: w
371
+ }
372
+ ),
373
+ C && /* @__PURE__ */ t("span", { className: "text-xs text-stone flex-shrink-0", children: C })
374
+ ] }),
375
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
376
+ /* @__PURE__ */ t("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: i }),
377
+ x > 0 && /* @__PURE__ */ t("span", { className: "bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: x > 99 ? "99+" : x })
378
+ ] })
379
+ ] })
380
+ ] })
381
+ }
382
+ );
383
+ }, ke = ({
384
+ onChannelSelect: n,
385
+ selectedChannel: a,
386
+ showStartConversation: l = !1,
387
+ onStartConversation: o,
388
+ participantLabel: c = "participants",
389
+ className: m
390
+ }) => {
391
+ var N;
392
+ const u = _.useRef(0);
393
+ u.current++;
394
+ const { debug: r = !1 } = K();
395
+ r && console.log("📺 [ChannelList] 🔄 RENDER START", {
396
+ renderCount: u.current,
397
+ selectedChannelId: a == null ? void 0 : a.id,
398
+ showStartConversation: l,
399
+ participantLabel: c
400
+ });
401
+ const { client: s } = Ze();
402
+ r && console.log("📺 [ChannelList] 📡 CHAT CONTEXT", {
403
+ renderCount: u.current,
404
+ hasClient: !!s,
405
+ clientUserId: s == null ? void 0 : s.userID,
406
+ clientConnected: (N = s == null ? void 0 : s.wsConnection) == null ? void 0 : N.isHealthy
407
+ });
408
+ const w = _.useMemo(() => {
409
+ const g = s.userID, i = g ? { type: "messaging", members: { $in: [g] }, hidden: !1 } : { type: "messaging" };
410
+ return r && console.log("📺 [ChannelList] 🔍 FILTERS MEMOIZED", {
411
+ renderCount: u.current,
412
+ userId: g,
413
+ filters: i
414
+ }), i;
415
+ }, [s.userID, r]);
416
+ return /* @__PURE__ */ d("div", { className: L("h-full flex flex-col min-w-0 overflow-hidden", m), children: [
417
+ /* @__PURE__ */ t("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
418
+ /* @__PURE__ */ t("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
419
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: l && o && /* @__PURE__ */ t(
420
+ J,
421
+ {
422
+ label: "Start a new conversation",
423
+ onClick: o,
424
+ className: "inline-flex size-10 items-center justify-center",
425
+ children: /* @__PURE__ */ t(me, { className: "h-5 w-5" })
426
+ }
427
+ ) })
428
+ ] }) }),
429
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
430
+ renderCount: u.current,
431
+ filters: w,
432
+ hasClient: !!s,
433
+ clientUserId: s == null ? void 0 : s.userID
434
+ }), /* @__PURE__ */ t(
435
+ ve,
436
+ {
437
+ filters: w,
438
+ sort: { last_message_at: -1 },
439
+ options: { limit: 30 },
440
+ Preview: (g) => {
441
+ var i, C;
442
+ return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
443
+ channelId: (i = g.channel) == null ? void 0 : i.id,
444
+ selectedChannelId: a == null ? void 0 : a.id,
445
+ isSelected: (a == null ? void 0 : a.id) === ((C = g.channel) == null ? void 0 : C.id)
446
+ }), /* @__PURE__ */ t(
447
+ Se,
448
+ {
449
+ ...g,
450
+ selectedChannel: a,
451
+ onChannelSelect: n,
452
+ debug: r
453
+ }
454
+ );
455
+ }
456
+ }
457
+ )) })
458
+ ] });
459
+ }, Pe = /* @__PURE__ */ new Map([
460
+ [
461
+ "bold",
462
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M40.14,46.88A12,12,0,0,0,36,56V224a12,12,0,0,0,24,0V181.72c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2,14.72,0,30.28-4.94,46.38-18.88A12,12,0,0,0,236,176V56a12,12,0,0,0-19.86-9.07c-24.71,21.41-44.53,13.31-74.82-1.68C113.19,31.27,78.17,13.94,40.14,46.88ZM212,170.26c-22.84,17.13-42.1,9.11-70.68-5C118.16,153.76,90.33,140,60,153.87V61.69c22.84-17.12,42.1-9.12,70.68,5,16.23,8,34.74,17.2,54.8,17.2A63,63,0,0,0,212,78.08Z" }))
463
+ ],
464
+ [
465
+ "duotone",
466
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
467
+ "path",
468
+ {
469
+ d: "M224,56V176c-64,55.43-112-55.43-176,0V56C112,.57,160,111.43,224,56Z",
470
+ opacity: "0.2"
471
+ }
472
+ ), /* @__PURE__ */ e.createElement("path", { d: "M42.76,50A8,8,0,0,0,40,56V224a8,8,0,0,0,16,0V179.77c26.79-21.16,49.87-9.75,76.45,3.41,16.4,8.11,34.06,16.85,53,16.85,13.93,0,28.54-4.75,43.82-18a8,8,0,0,0,2.76-6V56A8,8,0,0,0,218.76,50c-28,24.23-51.72,12.49-79.21-1.12C111.07,34.76,78.78,18.79,42.76,50ZM216,172.25c-26.79,21.16-49.87,9.74-76.45-3.41-25-12.35-52.81-26.13-83.55-8.4V59.79c26.79-21.16,49.87-9.75,76.45,3.4,25,12.35,52.82,26.13,83.55,8.4Z" }))
473
+ ],
474
+ [
475
+ "fill",
476
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M232,56V176a8,8,0,0,1-2.76,6c-15.28,13.23-29.89,18-43.82,18-18.91,0-36.57-8.74-53-16.85C105.87,170,82.79,158.61,56,179.77V224a8,8,0,0,1-16,0V56a8,8,0,0,1,2.77-6h0c36-31.18,68.31-15.21,96.79-1.12C167,62.46,190.79,74.2,218.76,50A8,8,0,0,1,232,56Z" }))
477
+ ],
478
+ [
479
+ "light",
480
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M44.08,51.37A6,6,0,0,0,42,55.9V224a6,6,0,0,0,12,0V178.78c28.08-22.79,51.88-11,79.34,2.57,16.12,8,33.49,16.58,52,16.58,13.57,0,27.76-4.6,42.56-17.42A6,6,0,0,0,230,176V55.9a6,6,0,0,0-9.93-4.54c-29,25.12-53.28,13.09-81.41-.84C110.77,36.71,79,21.16,44.08,51.37ZM218,173.17c-28.08,22.8-51.88,11-79.34-2.58C113.4,158.08,85.09,144.07,54,164V58.72c28.08-22.8,51.88-11,79.34,2.56C158.6,73.79,186.91,87.8,218,67.91Z" }))
481
+ ],
482
+ [
483
+ "regular",
484
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M42.76,50A8,8,0,0,0,40,56V224a8,8,0,0,0,16,0V179.77c26.79-21.16,49.87-9.75,76.45,3.41,16.4,8.11,34.06,16.85,53,16.85,13.93,0,28.54-4.75,43.82-18a8,8,0,0,0,2.76-6V56A8,8,0,0,0,218.76,50c-28,24.23-51.72,12.49-79.21-1.12C111.07,34.76,78.78,18.79,42.76,50ZM216,172.25c-26.79,21.16-49.87,9.74-76.45-3.41-25-12.35-52.81-26.13-83.55-8.4V59.79c26.79-21.16,49.87-9.75,76.45,3.4,25,12.35,52.82,26.13,83.55,8.4Z" }))
485
+ ],
486
+ [
487
+ "thin",
488
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M45.39,53.06a4,4,0,0,0-1.39,3V224a4,4,0,0,0,8,0V177.87c29.41-24.39,55.08-11.69,82.23,1.73,16.5,8.17,33.33,16.5,51.13,16.5,13.14,0,26.81-4.55,41.26-17.06a4,4,0,0,0,1.38-3v-120a4,4,0,0,0-6.62-3c-30,26-56,13.07-83.61-.57C109.07,38.28,79.4,23.62,45.39,53.06ZM220,174.17c-29.41,24.4-55.08,11.7-82.23-1.73-26.82-13.27-54.5-27-85.77-4.66V57.92c29.41-24.4,55.08-11.7,82.23,1.73,26.82,13.27,54.5,27,85.77,4.66Z" }))
489
+ ]
490
+ ]), ue = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Pe }));
491
+ ue.displayName = "FlagIcon";
492
+ const Te = /* @__PURE__ */ new Map([
493
+ [
494
+ "bold",
495
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M168.49,151.51a12,12,0,0,1-17,17l-64-64a12,12,0,0,1,17-17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z" }))
496
+ ],
497
+ [
498
+ "duotone",
499
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z", opacity: "0.2" }), /* @__PURE__ */ e.createElement("path", { d: "M165.66,154.34a8,8,0,0,1-11.32,11.32l-64-64a8,8,0,0,1,11.32-11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z" }))
500
+ ],
501
+ [
502
+ "fill",
503
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,141.66a8,8,0,0,1-11.32,0l-64-64a8,8,0,0,1,11.32-11.32l64,64A8,8,0,0,1,165.66,165.66Z" }))
504
+ ],
505
+ [
506
+ "light",
507
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M164.24,155.76a6,6,0,1,1-8.48,8.48l-64-64a6,6,0,0,1,8.48-8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z" }))
508
+ ],
509
+ [
510
+ "regular",
511
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M165.66,154.34a8,8,0,0,1-11.32,11.32l-64-64a8,8,0,0,1,11.32-11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z" }))
512
+ ],
513
+ [
514
+ "thin",
515
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M162.83,157.17a4,4,0,0,1-5.66,5.66l-64-64a4,4,0,0,1,5.66-5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z" }))
516
+ ]
517
+ ]), ne = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Te }));
518
+ ne.displayName = "ProhibitInsetIcon";
519
+ const De = /* @__PURE__ */ new Map([
520
+ [
521
+ "bold",
522
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z" }))
523
+ ],
524
+ [
525
+ "duotone",
526
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
527
+ "path",
528
+ {
529
+ d: "M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z",
530
+ opacity: "0.2"
531
+ }
532
+ ), /* @__PURE__ */ e.createElement("path", { d: "M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z" }))
533
+ ],
534
+ [
535
+ "fill",
536
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z" }))
537
+ ],
538
+ [
539
+ "light",
540
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z" }))
541
+ ],
542
+ [
543
+ "regular",
544
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z" }))
545
+ ],
546
+ [
547
+ "thin",
548
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z" }))
549
+ ]
550
+ ]), ge = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: De }));
551
+ ge.displayName = "SignOutIcon";
552
+ const Oe = /* @__PURE__ */ new Map([
553
+ [
554
+ "bold",
555
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M140,32V64a12,12,0,0,1-24,0V32a12,12,0,0,1,24,0Zm84,84H192a12,12,0,0,0,0,24h32a12,12,0,0,0,0-24Zm-42.26,48.77a12,12,0,1,0-17,17l22.63,22.63a12,12,0,0,0,17-17ZM128,180a12,12,0,0,0-12,12v32a12,12,0,0,0,24,0V192A12,12,0,0,0,128,180ZM74.26,164.77,51.63,187.4a12,12,0,0,0,17,17l22.63-22.63a12,12,0,1,0-17-17ZM76,128a12,12,0,0,0-12-12H32a12,12,0,0,0,0,24H64A12,12,0,0,0,76,128ZM68.6,51.63a12,12,0,1,0-17,17L74.26,91.23a12,12,0,0,0,17-17Z" }))
556
+ ],
557
+ [
558
+ "duotone",
559
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z", opacity: "0.2" }), /* @__PURE__ */ e.createElement("path", { d: "M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z" }))
560
+ ],
561
+ [
562
+ "fill",
563
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24ZM48,136a8,8,0,0,1,0-16H72a8,8,0,0,1,0,16Zm46.06,37.25-17,17a8,8,0,0,1-11.32-11.32l17-17a8,8,0,0,1,11.31,11.31Zm0-79.19a8,8,0,0,1-11.31,0l-17-17A8,8,0,0,1,77.09,65.77l17,17A8,8,0,0,1,94.06,94.06ZM136,208a8,8,0,0,1-16,0V184a8,8,0,0,1,16,0Zm0-136a8,8,0,0,1-16,0V48a8,8,0,0,1,16,0Zm54.23,118.23a8,8,0,0,1-11.32,0l-17-17a8,8,0,0,1,11.31-11.31l17,17A8,8,0,0,1,190.23,190.23ZM208,136H184a8,8,0,0,1,0-16h24a8,8,0,0,1,0,16Z" }))
564
+ ],
565
+ [
566
+ "light",
567
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M134,32V64a6,6,0,0,1-12,0V32a6,6,0,0,1,12,0Zm90,90H192a6,6,0,0,0,0,12h32a6,6,0,0,0,0-12Zm-46.5,47A6,6,0,0,0,169,177.5l22.63,22.62a6,6,0,0,0,8.48-8.48ZM128,186a6,6,0,0,0-6,6v32a6,6,0,0,0,12,0V192A6,6,0,0,0,128,186ZM78.5,169,55.88,191.64a6,6,0,1,0,8.48,8.48L87,177.5A6,6,0,1,0,78.5,169ZM70,128a6,6,0,0,0-6-6H32a6,6,0,0,0,0,12H64A6,6,0,0,0,70,128ZM64.36,55.88a6,6,0,0,0-8.48,8.48L78.5,87A6,6,0,1,0,87,78.5Z" }))
568
+ ],
569
+ [
570
+ "regular",
571
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z" }))
572
+ ],
573
+ [
574
+ "thin",
575
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M132,32V64a4,4,0,0,1-8,0V32a4,4,0,0,1,8,0Zm92,92H192a4,4,0,0,0,0,8h32a4,4,0,0,0,0-8Zm-47.92,46.43a4,4,0,1,0-5.65,5.65l22.62,22.63a4,4,0,0,0,5.66-5.66ZM128,188a4,4,0,0,0-4,4v32a4,4,0,0,0,8,0V192A4,4,0,0,0,128,188ZM79.92,170.43,57.29,193.05A4,4,0,0,0,63,198.71l22.62-22.63a4,4,0,1,0-5.65-5.65ZM68,128a4,4,0,0,0-4-4H32a4,4,0,0,0,0,8H64A4,4,0,0,0,68,128ZM63,57.29A4,4,0,0,0,57.29,63L79.92,85.57a4,4,0,1,0,5.65-5.65Z" }))
576
+ ]
577
+ ]), W = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Oe }));
578
+ W.displayName = "SpinnerGapIcon";
579
+ const Ue = /* @__PURE__ */ new Map([
580
+ [
581
+ "bold",
582
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z" }))
583
+ ],
584
+ [
585
+ "duotone",
586
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M112,56V200L40,128Z", opacity: "0.2" }), /* @__PURE__ */ e.createElement("path", { d: "M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z" }))
587
+ ],
588
+ [
589
+ "fill",
590
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z" }))
591
+ ],
592
+ [
593
+ "light",
594
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z" }))
595
+ ],
596
+ [
597
+ "regular",
598
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z" }))
599
+ ],
600
+ [
601
+ "thin",
602
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z" }))
603
+ ]
604
+ ]), fe = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Ue }));
605
+ fe.displayName = "ArrowLeftIcon";
606
+ const $e = /* @__PURE__ */ new Map([
607
+ [
608
+ "bold",
609
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z" }))
610
+ ],
611
+ [
612
+ "duotone",
613
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
614
+ "path",
615
+ {
616
+ d: "M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z",
617
+ opacity: "0.2"
618
+ }
619
+ ), /* @__PURE__ */ e.createElement("path", { d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z" }))
620
+ ],
621
+ [
622
+ "fill",
623
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z" }))
624
+ ],
625
+ [
626
+ "light",
627
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z" }))
628
+ ],
629
+ [
630
+ "regular",
631
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z" }))
632
+ ],
633
+ [
634
+ "thin",
635
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z" }))
636
+ ]
637
+ ]), Ee = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: $e }));
638
+ Ee.displayName = "DotsThreeIcon";
639
+ const je = /* @__PURE__ */ new Map([
640
+ [
641
+ "bold",
642
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" }))
643
+ ],
644
+ [
645
+ "duotone",
646
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
647
+ "path",
648
+ {
649
+ d: "M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",
650
+ opacity: "0.2"
651
+ }
652
+ ), /* @__PURE__ */ e.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
653
+ ],
654
+ [
655
+ "fill",
656
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
657
+ ],
658
+ [
659
+ "light",
660
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z" }))
661
+ ],
662
+ [
663
+ "regular",
664
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
665
+ ],
666
+ [
667
+ "thin",
668
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z" }))
669
+ ]
670
+ ]), re = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: je }));
671
+ re.displayName = "XIcon";
672
+ function xe({ onClick: n }) {
673
+ return /* @__PURE__ */ t(J, { label: "Close", onClick: n, className: "p-1", children: /* @__PURE__ */ t(re, { className: "h-5 w-5 text-stone", weight: "bold" }) });
674
+ }
675
+ const Y = ({
676
+ variant: n = "default",
677
+ className: a,
678
+ children: l,
679
+ ...o
680
+ }) => /* @__PURE__ */ t(
681
+ "button",
682
+ {
683
+ type: "button",
684
+ className: L(
685
+ "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",
686
+ n === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
687
+ a
688
+ ),
689
+ ...o,
690
+ children: l
691
+ }
692
+ ), Be = ({ renderActions: n }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
693
+ n && n(),
694
+ /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(Re, { focus: !0, maxRows: 4 }) })
695
+ ] }), Ge = ({ onBack: n, showBackButton: a, onShowInfo: l, canShowInfo: o }) => {
696
+ var s, w, N, g;
697
+ const { channel: c } = Ie(), m = _.useMemo(() => Object.values(c.state.members || {}).find(
698
+ (C) => {
699
+ var x;
700
+ return ((x = C.user) == null ? void 0 : x.id) && C.user.id !== c._client.userID;
701
+ }
702
+ ), [c._client.userID, c.state.members]), u = ((s = m == null ? void 0 : m.user) == null ? void 0 : s.name) || ((w = m == null ? void 0 : m.user) == null ? void 0 : w.id) || "Unknown member", r = (N = m == null ? void 0 : m.user) == null ? void 0 : N.image;
703
+ return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
704
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
705
+ a && n && /* @__PURE__ */ t(
706
+ "button",
707
+ {
708
+ type: "button",
709
+ onClick: n,
710
+ className: "inline-flex items-center justify-center w-8 h-8 rounded-lg hover:bg-sand focus:outline-none focus:ring-2 focus:ring-primary transition-colors lg:hidden",
711
+ "aria-label": "Back to channel list",
712
+ children: /* @__PURE__ */ t(fe, { className: "h-5 w-5 text-stone", weight: "bold" })
713
+ }
714
+ ),
715
+ /* @__PURE__ */ t(
716
+ ee,
717
+ {
718
+ id: ((g = m == null ? void 0 : m.user) == null ? void 0 : g.id) || c.id || "unknown",
719
+ name: u,
720
+ image: r,
721
+ size: 40
722
+ }
723
+ ),
724
+ /* @__PURE__ */ t("div", { className: "min-w-0", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-charcoal truncate", children: u }) })
725
+ ] }),
726
+ o && l && /* @__PURE__ */ t(
727
+ J,
728
+ {
729
+ label: "Chat info",
730
+ onClick: l,
731
+ children: /* @__PURE__ */ t(Ee, { className: "h-6 w-6 text-charcoal", weight: "bold" })
732
+ }
733
+ )
734
+ ] });
735
+ }, _e = ({ isOpen: n, onClose: a, participant: l, channel: o, followerStatusLabel: c, onLeaveConversation: m, onBlockParticipant: u }) => {
736
+ var k, P, X, Q, z, q, G;
737
+ const { service: r, debug: s } = K(), w = $(null), [N, g] = A(!1), [i, C] = A(!1), [x, p] = A(!1);
738
+ B(() => {
739
+ const I = w.current;
740
+ I && (n ? I.showModal() : I.close());
741
+ }, [n]);
742
+ const Z = H(async () => {
743
+ var I;
744
+ if (!(!r || !((I = l == null ? void 0 : l.user) != null && I.id)))
745
+ try {
746
+ const T = (await r.getBlockedUsers()).some(
747
+ (E) => E.blocked_user_id === l.user.id
748
+ );
749
+ g(T);
750
+ } catch (S) {
751
+ console.error("[ChannelInfoDialog] Failed to check blocked status:", S);
752
+ }
753
+ }, [r, (k = l == null ? void 0 : l.user) == null ? void 0 : k.id]);
754
+ B(() => {
755
+ n && Z();
756
+ }, [n, Z]);
757
+ const V = async () => {
758
+ var I;
759
+ if (!i) {
760
+ s && console.log("[ChannelInfoDialog] Leave conversation", o.cid), C(!0);
761
+ try {
762
+ const S = ((I = o._client) == null ? void 0 : I.userID) ?? null;
763
+ await o.hide(S, !1), m && await m(o), a();
764
+ } catch (S) {
765
+ console.error("[ChannelInfoDialog] Failed to leave conversation", S);
766
+ } finally {
767
+ C(!1);
768
+ }
769
+ }
770
+ }, R = async () => {
771
+ var I, S, T;
772
+ if (!(x || !r)) {
773
+ s && console.log("[ChannelInfoDialog] Block member", (I = l == null ? void 0 : l.user) == null ? void 0 : I.id), p(!0);
774
+ try {
775
+ await r.blockUser((S = l == null ? void 0 : l.user) == null ? void 0 : S.id), u && await u((T = l == null ? void 0 : l.user) == null ? void 0 : T.id), a();
776
+ } catch (E) {
777
+ console.error("[ChannelInfoDialog] Failed to block member", E);
778
+ } finally {
779
+ p(!1);
780
+ }
781
+ }
782
+ }, v = async () => {
783
+ var I, S, T;
784
+ if (!(x || !r)) {
785
+ s && console.log("[ChannelInfoDialog] Unblock member", (I = l == null ? void 0 : l.user) == null ? void 0 : I.id), p(!0);
786
+ try {
787
+ await r.unBlockUser((S = l == null ? void 0 : l.user) == null ? void 0 : S.id), u && await u((T = l == null ? void 0 : l.user) == null ? void 0 : T.id), a();
788
+ } catch (E) {
789
+ console.error("[ChannelInfoDialog] Failed to unblock member", E);
790
+ } finally {
791
+ p(!1);
792
+ }
793
+ }
794
+ }, y = () => {
795
+ a(), window.open(
796
+ "https://linktr.ee/s/about/trust-center/report",
797
+ "_blank",
798
+ "noopener,noreferrer"
799
+ );
800
+ };
801
+ if (!l) return null;
802
+ const F = ((P = l.user) == null ? void 0 : P.name) || ((X = l.user) == null ? void 0 : X.id) || "Unknown member", f = (Q = l.user) == null ? void 0 : Q.image, h = (z = l.user) == null ? void 0 : z.email, b = (q = l.user) == null ? void 0 : q.username, M = h || (b ? `linktr.ee/${b}` : void 0), U = ((G = l.user) == null ? void 0 : G.id) || "unknown";
803
+ return /* @__PURE__ */ t(
804
+ "dialog",
805
+ {
806
+ ref: w,
807
+ className: "mes-dialog",
808
+ onClose: a,
809
+ onClick: (I) => {
810
+ I.target === w.current && a();
811
+ },
812
+ children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
813
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
814
+ /* @__PURE__ */ t("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
815
+ /* @__PURE__ */ t(xe, { onClick: a })
816
+ ] }),
817
+ /* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
818
+ /* @__PURE__ */ t("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
819
+ /* @__PURE__ */ t(
820
+ ee,
821
+ {
822
+ id: U,
823
+ name: F,
824
+ image: f,
825
+ size: 64
826
+ }
827
+ ),
828
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
829
+ /* @__PURE__ */ t("p", { className: "truncate text-base font-semibold text-charcoal", children: F }),
830
+ M && /* @__PURE__ */ t("p", { className: "truncate text-sm text-stone", children: M }),
831
+ c && /* @__PURE__ */ t("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: c })
832
+ ] })
833
+ ] }) }),
834
+ /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
835
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ d(
836
+ Y,
837
+ {
838
+ onClick: V,
839
+ disabled: i,
840
+ "aria-busy": i,
841
+ children: [
842
+ i ? /* @__PURE__ */ t(W, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(ge, { className: "h-5 w-5" }),
843
+ /* @__PURE__ */ t("span", { children: "Leave Conversation" })
844
+ ]
845
+ }
846
+ ) }),
847
+ /* @__PURE__ */ t("li", { children: N ? /* @__PURE__ */ d(
848
+ Y,
849
+ {
850
+ onClick: v,
851
+ disabled: x,
852
+ "aria-busy": x,
853
+ children: [
854
+ x ? /* @__PURE__ */ t(W, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(ne, { className: "h-5 w-5" }),
855
+ /* @__PURE__ */ t("span", { children: "Unblock" })
856
+ ]
857
+ }
858
+ ) : /* @__PURE__ */ d(
859
+ Y,
860
+ {
861
+ onClick: R,
862
+ disabled: x,
863
+ "aria-busy": x,
864
+ children: [
865
+ x ? /* @__PURE__ */ t(W, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ t(ne, { className: "h-5 w-5" }),
866
+ /* @__PURE__ */ t("span", { children: "Block" })
867
+ ]
868
+ }
869
+ ) }),
870
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ d(Y, { variant: "danger", onClick: y, children: [
871
+ /* @__PURE__ */ t(ue, { className: "h-5 w-5" }),
872
+ /* @__PURE__ */ t("span", { children: "Report" })
873
+ ] }) })
874
+ ] })
875
+ ] })
876
+ ] })
877
+ }
878
+ );
879
+ }, ze = ({
880
+ channel: n,
881
+ onBack: a,
882
+ showBackButton: l = !1,
883
+ renderMessageInputActions: o,
884
+ onLeaveConversation: c,
885
+ onBlockParticipant: m,
886
+ className: u
887
+ }) => {
888
+ const [r, s] = A(!1), w = _.useMemo(() => Object.values(n.state.members || {}).find(
889
+ (i) => {
890
+ var C;
891
+ return ((C = i.user) == null ? void 0 : C.id) && i.user.id !== n._client.userID;
892
+ }
893
+ ), [n._client.userID, n.state.members]), N = _.useMemo(() => {
894
+ const g = n.data ?? {};
895
+ return g.followerStatus ? String(g.followerStatus) : g.isFollower ? "Subscribed to you" : void 0;
896
+ }, [n.data]);
897
+ return /* @__PURE__ */ d("div", { className: L("h-full flex flex-col", u), children: [
898
+ /* @__PURE__ */ t(Me, { channel: n, children: /* @__PURE__ */ d(pe, { children: [
899
+ /* @__PURE__ */ t("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ t(
900
+ Ge,
901
+ {
902
+ onBack: a,
903
+ showBackButton: l,
904
+ onShowInfo: () => s(!0),
905
+ canShowInfo: !!w
906
+ }
907
+ ) }),
908
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ t(ye, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }) }),
909
+ /* @__PURE__ */ t(
910
+ Be,
911
+ {
912
+ renderActions: () => o == null ? void 0 : o(n)
913
+ }
914
+ )
915
+ ] }) }),
916
+ /* @__PURE__ */ t(
917
+ _e,
918
+ {
919
+ isOpen: r,
920
+ onClose: () => s(!1),
921
+ participant: w,
922
+ channel: n,
923
+ followerStatusLabel: N,
924
+ onLeaveConversation: c,
925
+ onBlockParticipant: m
926
+ }
927
+ )
928
+ ] });
929
+ }, We = /* @__PURE__ */ new Map([
930
+ [
931
+ "bold",
932
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M120,128a16,16,0,1,1-16-16A16,16,0,0,1,120,128Zm32-16a16,16,0,1,0,16,16A16,16,0,0,0,152,112Zm84,16A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z" }))
933
+ ],
934
+ [
935
+ "duotone",
936
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
937
+ "path",
938
+ {
939
+ d: "M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z",
940
+ opacity: "0.2"
941
+ }
942
+ ), /* @__PURE__ */ e.createElement("path", { d: "M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm12-88a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm-44,0a12,12,0,1,1-12-12A12,12,0,0,1,96,128Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,128Z" }))
943
+ ],
944
+ [
945
+ "fill",
946
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24ZM84,140a12,12,0,1,1,12-12A12,12,0,0,1,84,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,172,140Z" }))
947
+ ],
948
+ [
949
+ "light",
950
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM84,118a10,10,0,1,0,10,10A10,10,0,0,0,84,118Zm88,0a10,10,0,1,0,10,10A10,10,0,0,0,172,118Zm58,10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z" }))
951
+ ],
952
+ [
953
+ "regular",
954
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM84,116a12,12,0,1,0,12,12A12,12,0,0,0,84,116Zm88,0a12,12,0,1,0,12,12A12,12,0,0,0,172,116Zm60,12A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z" }))
955
+ ],
956
+ [
957
+ "thin",
958
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-52-8a8,8,0,1,0,8,8A8,8,0,0,0,84,120Zm88,0a8,8,0,1,0,8,8A8,8,0,0,0,172,120Zm56,8A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z" }))
959
+ ]
960
+ ]), le = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: We }));
961
+ le.displayName = "ChatCircleDotsIcon";
962
+ const Xe = /* @__PURE__ */ new Map([
963
+ [
964
+ "bold",
965
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z" }))
966
+ ],
967
+ [
968
+ "duotone",
969
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z", opacity: "0.2" }), /* @__PURE__ */ e.createElement("path", { d: "M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z" }))
970
+ ],
971
+ [
972
+ "fill",
973
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z" }))
974
+ ],
975
+ [
976
+ "light",
977
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z" }))
978
+ ],
979
+ [
980
+ "regular",
981
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z" }))
982
+ ],
983
+ [
984
+ "thin",
985
+ /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("path", { d: "M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z" }))
986
+ ]
987
+ ]), be = e.forwardRef((n, a) => /* @__PURE__ */ e.createElement(D, { ref: a, ...n, weights: Xe }));
988
+ be.displayName = "MagnifyingGlassIcon";
989
+ function Qe({
990
+ searchQuery: n,
991
+ setSearchQuery: a,
992
+ placeholder: l
993
+ }) {
994
+ const o = $(null);
995
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
996
+ /* @__PURE__ */ t(
997
+ be,
998
+ {
999
+ className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
1000
+ weight: "bold"
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ t(
1004
+ "input",
1005
+ {
1006
+ ref: o,
1007
+ type: "text",
1008
+ placeholder: l,
1009
+ value: n,
1010
+ onChange: (c) => a(c.target.value),
1011
+ 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"
1012
+ }
1013
+ ),
1014
+ n && /* @__PURE__ */ t(
1015
+ J,
1016
+ {
1017
+ label: "Clear search",
1018
+ onClick: () => {
1019
+ var c;
1020
+ a(""), (c = o.current) == null || c.focus();
1021
+ },
1022
+ className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1023
+ children: /* @__PURE__ */ t(re, { className: "h-4 w-4", weight: "bold" })
1024
+ }
1025
+ )
1026
+ ] });
1027
+ }
1028
+ const qe = ({
1029
+ participantSource: n,
1030
+ onSelectParticipant: a,
1031
+ onClose: l,
1032
+ existingParticipantIds: o = /* @__PURE__ */ new Set(),
1033
+ participantLabel: c = "participants",
1034
+ searchPlaceholder: m = "Search participants...",
1035
+ className: u
1036
+ }) => {
1037
+ const { debug: r } = K(), [s, w] = A(""), [N, g] = A([]), [i, C] = A(!1), [x, p] = A(null), [Z, V] = A(null), R = $(!1);
1038
+ B(() => {
1039
+ if (n.loading) {
1040
+ r && console.log("[ParticipantPicker] Waiting for participant source to finish loading...");
1041
+ return;
1042
+ }
1043
+ if (R.current) return;
1044
+ (async () => {
1045
+ r && console.log("[ParticipantPicker] Loading initial participants..."), C(!0), p(null);
1046
+ try {
1047
+ const h = await n.loadParticipants({
1048
+ search: "",
1049
+ // Load all participants initially
1050
+ limit: 100
1051
+ });
1052
+ g(h.participants), R.current = !0, r && console.log("[ParticipantPicker] Participants loaded successfully:", h.participants.length);
1053
+ } catch (h) {
1054
+ const b = h instanceof Error ? h.message : "Failed to load participants";
1055
+ p(b), console.error("[ParticipantPicker] Failed to load participants:", h);
1056
+ } finally {
1057
+ C(!1);
1058
+ }
1059
+ })();
1060
+ }, [n.loading, r]);
1061
+ const v = N.filter((f) => !o.has(f.id)).filter((f) => {
1062
+ var b;
1063
+ if (!s) return !0;
1064
+ const h = s.toLowerCase();
1065
+ return f.name.toLowerCase().includes(h) || ((b = f.email) == null ? void 0 : b.toLowerCase().includes(h)) || !1;
1066
+ }), y = H(async (f) => {
1067
+ if (!Z) {
1068
+ V(f.id);
1069
+ try {
1070
+ await a(f);
1071
+ } catch (h) {
1072
+ console.error("[ParticipantPicker] Failed to start chat:", h), V(null);
1073
+ }
1074
+ }
1075
+ }, [a, Z]), F = (f, h) => {
1076
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), y(h));
1077
+ };
1078
+ return /* @__PURE__ */ d("div", { className: L("flex flex-col h-full", u), children: [
1079
+ /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1080
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
1081
+ /* @__PURE__ */ t("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1082
+ /* @__PURE__ */ t(xe, { onClick: l })
1083
+ ] }),
1084
+ /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
1085
+ "Select a ",
1086
+ c.slice(0, -1),
1087
+ " to start messaging (",
1088
+ v.length,
1089
+ " available)",
1090
+ n.totalCount !== void 0 && ` • ${n.totalCount} ${c} total`
1091
+ ] }),
1092
+ /* @__PURE__ */ t(
1093
+ Qe,
1094
+ {
1095
+ searchQuery: s,
1096
+ setSearchQuery: w,
1097
+ placeholder: m
1098
+ }
1099
+ )
1100
+ ] }),
1101
+ x && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1102
+ "Error loading ",
1103
+ c,
1104
+ ": ",
1105
+ x
1106
+ ] }),
1107
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-auto", children: i && v.length === 0 ? /* @__PURE__ */ t("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
1108
+ /* @__PURE__ */ t("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1109
+ /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
1110
+ "Loading ",
1111
+ c,
1112
+ "..."
1113
+ ] })
1114
+ ] }) }) : v.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
1115
+ /* @__PURE__ */ t("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ t(le, { className: "h-8 w-8 text-charcoal" }) }),
1116
+ /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: s ? `No ${c} found` : N.length > 0 ? `Already chatting with all ${c}` : `No ${c} yet` }),
1117
+ /* @__PURE__ */ t("p", { className: "text-xs text-stone", children: s ? "Try a different search term" : N.length > 0 ? `You have existing conversations with all your ${c}` : `${c.charAt(0).toUpperCase() + c.slice(1)} will appear here` })
1118
+ ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
1119
+ v.map((f) => {
1120
+ const h = f.name || f.email || f.id, b = f.email && f.name ? f.email : f.phone;
1121
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1122
+ "button",
1123
+ {
1124
+ type: "button",
1125
+ onClick: () => y(f),
1126
+ onKeyDown: (M) => F(M, f),
1127
+ 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",
1128
+ children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
1129
+ /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1130
+ /* @__PURE__ */ t(
1131
+ ee,
1132
+ {
1133
+ id: f.id,
1134
+ name: h,
1135
+ image: f.image,
1136
+ size: 40
1137
+ }
1138
+ ),
1139
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
1140
+ /* @__PURE__ */ t("h4", { className: "text-sm font-medium text-charcoal truncate", children: h }),
1141
+ b && /* @__PURE__ */ t("p", { className: "text-xs text-stone truncate", children: b })
1142
+ ] })
1143
+ ] }),
1144
+ /* @__PURE__ */ t("div", { className: "flex-shrink-0", children: Z === f.id ? /* @__PURE__ */ t(W, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ t(le, { className: "h-5 w-5 text-stone" }) })
1145
+ ] })
1146
+ }
1147
+ ) }, f.id);
1148
+ }),
1149
+ i && /* @__PURE__ */ t("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
1150
+ /* @__PURE__ */ t("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1151
+ /* @__PURE__ */ t("span", { className: "text-sm text-stone", children: "Loading more..." })
1152
+ ] }) })
1153
+ ] }) })
1154
+ ] });
1155
+ }, Ye = () => K(), Je = ({ hasChannels: n, onStartConversation: a, participantLabel: l }) => /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1156
+ /* @__PURE__ */ t("div", { className: "w-24 h-24 bg-primary-alt bg-opacity-10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ t("span", { className: "text-4xl", children: "💬" }) }),
1157
+ /* @__PURE__ */ t("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
1158
+ /* @__PURE__ */ t("p", { className: "text-stone text-sm mb-6", children: n ? /* @__PURE__ */ d(oe, { children: [
1159
+ "Choose a conversation from the list or",
1160
+ " ",
1161
+ a && /* @__PURE__ */ d(ce, { onClick: a, children: [
1162
+ "start a new conversation with a ",
1163
+ l.slice(0, -1),
1164
+ "."
1165
+ ] })
1166
+ ] }) : a && /* @__PURE__ */ d(oe, { children: [
1167
+ /* @__PURE__ */ d(ce, { onClick: a, children: [
1168
+ "Start a new conversation with one of your ",
1169
+ l
1170
+ ] }),
1171
+ " ",
1172
+ "to begin messaging."
1173
+ ] }) })
1174
+ ] }) }), ce = ({ onClick: n, children: a }) => /* @__PURE__ */ t(
1175
+ "button",
1176
+ {
1177
+ type: "button",
1178
+ onClick: n,
1179
+ 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",
1180
+ children: a
1181
+ }
1182
+ ), Ke = ({ className: n, message: a }) => /* @__PURE__ */ d(
1183
+ "div",
1184
+ {
1185
+ className: L("flex items-center justify-center h-full", n),
1186
+ children: [
1187
+ /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1188
+ /* @__PURE__ */ t("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ t(
1189
+ "animateTransform",
1190
+ {
1191
+ attributeName: "transform",
1192
+ dur: "1s",
1193
+ type: "translate",
1194
+ values: "0 15 ; 0 -15; 0 15",
1195
+ repeatCount: "indefinite",
1196
+ begin: "0.1"
1197
+ }
1198
+ ) }),
1199
+ /* @__PURE__ */ t("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ t(
1200
+ "animateTransform",
1201
+ {
1202
+ attributeName: "transform",
1203
+ dur: "1s",
1204
+ type: "translate",
1205
+ values: "0 10 ; 0 -10; 0 10",
1206
+ repeatCount: "indefinite",
1207
+ begin: "0.2"
1208
+ }
1209
+ ) }),
1210
+ /* @__PURE__ */ t("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ t(
1211
+ "animateTransform",
1212
+ {
1213
+ attributeName: "transform",
1214
+ dur: "1s",
1215
+ type: "translate",
1216
+ values: "0 5 ; 0 -5; 0 5",
1217
+ repeatCount: "indefinite",
1218
+ begin: "0.3"
1219
+ }
1220
+ ) })
1221
+ ] }),
1222
+ a && /* @__PURE__ */ t("span", { className: "text-stone", children: a })
1223
+ ]
1224
+ }
1225
+ ), e1 = () => /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1226
+ /* @__PURE__ */ t(Ke, { className: "w-6 h-6" }),
1227
+ /* @__PURE__ */ t("span", { className: "text-sm text-stone", children: "Loading messages" })
1228
+ ] }) }), ie = ({ error: n, onRetry: a }) => /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-md", children: [
1229
+ /* @__PURE__ */ t("div", { className: "w-24 h-24 bg-danger-alt rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ t("span", { className: "text-4xl", children: "⚠️" }) }),
1230
+ /* @__PURE__ */ t("h2", { className: "text-xl font-semibold text-charcoal mb-3", children: "Connection Error" }),
1231
+ /* @__PURE__ */ t("p", { className: "text-stone text-sm mb-6", children: n }),
1232
+ a && /* @__PURE__ */ t(
1233
+ "button",
1234
+ {
1235
+ type: "button",
1236
+ onClick: a,
1237
+ className: "inline-flex items-center px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary-alt focus:outline-none focus:ring-2 focus:ring-primary transition-colors",
1238
+ children: "Try Again"
1239
+ }
1240
+ )
1241
+ ] }) }), o1 = ({
1242
+ capabilities: n = {},
1243
+ customization: a = {},
1244
+ className: l,
1245
+ renderMessageInputActions: o,
1246
+ onChannelSelect: c,
1247
+ onParticipantSelect: m
1248
+ }) => {
1249
+ const {
1250
+ service: u,
1251
+ client: r,
1252
+ isConnected: s,
1253
+ isLoading: w,
1254
+ error: N,
1255
+ refreshConnection: g,
1256
+ debug: i
1257
+ } = Ye(), [C, x] = A(null), [p, Z] = A(!1), [V, R] = A(!1), [v, y] = A(/* @__PURE__ */ new Set()), [F, f] = A(0), h = $(null), {
1258
+ showStartConversation: b = !1,
1259
+ participantSource: M,
1260
+ participantLabel: U = "participants"
1261
+ } = n, k = $(null), P = H(async () => {
1262
+ if (!r || !s) return;
1263
+ const E = r.userID;
1264
+ if (E)
1265
+ try {
1266
+ i && console.log("[MessagingShell] Syncing channels for user:", E);
1267
+ const O = await r.queryChannels(
1268
+ {
1269
+ type: "messaging",
1270
+ members: { $in: [E] }
1271
+ },
1272
+ {},
1273
+ { limit: 100 }
1274
+ ), j = /* @__PURE__ */ new Set();
1275
+ O.forEach((te) => {
1276
+ const Ne = te.state.members || {};
1277
+ Object.values(Ne).forEach((Ce) => {
1278
+ var se;
1279
+ const ae = (se = Ce.user) == null ? void 0 : se.id;
1280
+ ae && ae !== E && j.add(ae);
1281
+ });
1282
+ }), y(j), Z(O.length > 0), k.current = E, i && console.log("[MessagingShell] Channels synced successfully:", {
1283
+ channelCount: O.length,
1284
+ memberCount: j.size
1285
+ });
1286
+ } catch (O) {
1287
+ console.error("[MessagingShell] Failed to sync channels:", O);
1288
+ }
1289
+ }, [r, s, i]);
1290
+ B(() => {
1291
+ if (!r || !s) return;
1292
+ const E = r.userID;
1293
+ E && k.current !== E && P();
1294
+ }, [r, s, P]);
1295
+ const X = H((E) => {
1296
+ x(E), c == null || c(E);
1297
+ }, [c]), Q = H(() => {
1298
+ x(null);
1299
+ }, []), z = H(() => {
1300
+ var E;
1301
+ M && (f((O) => O + 1), R(!0), (E = h.current) == null || E.showModal());
1302
+ }, [M]), q = H(async (E) => {
1303
+ var O;
1304
+ if (u)
1305
+ try {
1306
+ i && console.log("[MessagingShell] Starting conversation with:", E.id);
1307
+ const j = await u.startChannelWithFollower({
1308
+ id: E.id,
1309
+ name: E.name,
1310
+ email: E.email,
1311
+ phone: E.phone
1312
+ });
1313
+ try {
1314
+ await j.show();
1315
+ } catch (te) {
1316
+ console.warn("[MessagingShell] Failed to unhide channel:", te);
1317
+ }
1318
+ x(j), R(!1), (O = h.current) == null || O.close(), m == null || m(E);
1319
+ } catch (j) {
1320
+ console.error("[MessagingShell] Failed to start conversation:", j);
1321
+ }
1322
+ }, [u, m, i]), G = H(() => {
1323
+ var E;
1324
+ R(!1), (E = h.current) == null || E.close();
1325
+ }, []), I = H(async (E) => {
1326
+ i && console.log("[MessagingShell] Leaving conversation:", E.id), x(null), k.current = null, await P();
1327
+ }, [P, i]), S = H(async (E) => {
1328
+ i && console.log("[MessagingShell] Blocking participant:", E), x(null), k.current = null, await P();
1329
+ }, [P, i]), T = !!C;
1330
+ return w ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(e1, {}) }) : N ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(ie, { error: N, onRetry: g }) }) : !s || !r ? /* @__PURE__ */ t("div", { className: L("h-full", l), children: /* @__PURE__ */ t(
1331
+ ie,
1332
+ {
1333
+ error: "Not connected to messaging service",
1334
+ onRetry: g
1335
+ }
1336
+ ) }) : /* @__PURE__ */ d("div", { className: L("h-full bg-white overflow-hidden", l), children: [
1337
+ /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1338
+ /* @__PURE__ */ t(
1339
+ "div",
1340
+ {
1341
+ className: L(
1342
+ "min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
1343
+ {
1344
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": T,
1345
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": !T
1346
+ }
1347
+ ),
1348
+ children: /* @__PURE__ */ t(
1349
+ ke,
1350
+ {
1351
+ onChannelSelect: X,
1352
+ selectedChannel: C || void 0,
1353
+ showStartConversation: b && !!M,
1354
+ onStartConversation: z,
1355
+ participantLabel: U
1356
+ }
1357
+ )
1358
+ }
1359
+ ),
1360
+ /* @__PURE__ */ t(
1361
+ "div",
1362
+ {
1363
+ className: L("flex-1 flex-col min-w-0 min-h-0", {
1364
+ "hidden lg:flex": !T,
1365
+ flex: T
1366
+ }),
1367
+ children: C ? /* @__PURE__ */ t("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ t(
1368
+ ze,
1369
+ {
1370
+ channel: C,
1371
+ onBack: Q,
1372
+ showBackButton: !0,
1373
+ renderMessageInputActions: o,
1374
+ onLeaveConversation: I,
1375
+ onBlockParticipant: S
1376
+ },
1377
+ C.id
1378
+ ) }) : /* @__PURE__ */ t(
1379
+ Je,
1380
+ {
1381
+ hasChannels: p,
1382
+ onStartConversation: b ? z : void 0,
1383
+ participantLabel: U
1384
+ }
1385
+ )
1386
+ }
1387
+ )
1388
+ ] }),
1389
+ M && /* @__PURE__ */ t(
1390
+ "dialog",
1391
+ {
1392
+ ref: h,
1393
+ className: "mes-dialog",
1394
+ onClick: (E) => {
1395
+ E.target === h.current && G();
1396
+ },
1397
+ onClose: G,
1398
+ children: /* @__PURE__ */ t("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ t(
1399
+ qe,
1400
+ {
1401
+ participantSource: M,
1402
+ onSelectParticipant: q,
1403
+ onClose: G,
1404
+ existingParticipantIds: v,
1405
+ participantLabel: U,
1406
+ searchPlaceholder: `Search ${U}...`
1407
+ },
1408
+ F
1409
+ ) })
1410
+ }
1411
+ )
1412
+ ] });
1413
+ }, c1 = (n, a = {}) => {
1414
+ const { initialSearch: l = "", pageSize: o = 20 } = a, [c, m] = A([]), [u, r] = A(!1), [s, w] = A(null), [N, g] = A(l), [i, C] = A(!0), [x, p] = A(), Z = H(async (y = !1, F) => {
1415
+ if (u) return;
1416
+ const f = F !== void 0 ? F : N;
1417
+ r(!0), w(null);
1418
+ try {
1419
+ const h = await n.loadParticipants({
1420
+ search: f || void 0,
1421
+ limit: o,
1422
+ cursor: y ? void 0 : x
1423
+ });
1424
+ m(
1425
+ (b) => y ? h.participants : [...b, ...h.participants]
1426
+ ), C(h.hasMore), p(h.nextCursor);
1427
+ } catch (h) {
1428
+ const b = h instanceof Error ? h.message : "Failed to load participants";
1429
+ w(b), console.error("[useParticipants] Load error:", h);
1430
+ } finally {
1431
+ r(!1);
1432
+ }
1433
+ }, [n, N, x, o, u]), V = H(() => {
1434
+ i && !u && Z(!1);
1435
+ }, [i, u, Z]), R = H((y) => {
1436
+ g(y), p(void 0), Z(!0, y);
1437
+ }, [Z]), v = H(() => {
1438
+ p(void 0), Z(!0);
1439
+ }, [Z]);
1440
+ return B(() => {
1441
+ Z(!0);
1442
+ }, [n.loadParticipants]), {
1443
+ participants: c,
1444
+ loading: u,
1445
+ error: s,
1446
+ searchQuery: N,
1447
+ hasMore: i,
1448
+ totalCount: n.totalCount,
1449
+ loadMore: V,
1450
+ search: R,
1451
+ refresh: v
1452
+ };
1453
+ };
1454
+ export {
1455
+ ee as Avatar,
1456
+ ke as ChannelList,
1457
+ ze as ChannelView,
1458
+ s1 as MessagingProvider,
1459
+ o1 as MessagingShell,
1460
+ qe as ParticipantPicker,
1461
+ Ye as useMessaging,
1462
+ c1 as useParticipants
1463
+ };
1464
+ //# sourceMappingURL=index.js.map