@linktr.ee/messaging-react 1.6.2 โ†’ 1.6.4-rc-1761883235

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx as e, jsxs as d, Fragment as oe } from "react/jsx-runtime";
2
2
  import D from "classnames";
3
- import X, { createContext as ve, useContext as we, useCallback as U, useState as E, useRef as H, useEffect as G } from "react";
4
- import { StreamChatService as Ee } from "@linktr.ee/messaging-core";
5
- import { Chat as Ie, useChatContext as ye, ChannelList as Se, Channel as Re, useChannelStateContext as ue, Window as ke, MessageList as Te, MessageInput as Pe } from "stream-chat-react";
6
- import { NotePencilIcon as De, XIcon as me, ArrowLeftIcon as Me, DotsThreeIcon as Oe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Fe, MagnifyingGlassIcon as pe, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
- const he = ve({
3
+ import X, { createContext as we, useContext as Ee, useCallback as F, useState as E, useRef as H, useEffect as G } from "react";
4
+ import { StreamChatService as Ie } from "@linktr.ee/messaging-core";
5
+ import { Chat as ye, useChatContext as Se, ChannelList as Re, Channel as ke, useChannelStateContext as me, Window as Te, MessageList as Pe, MessageInput as De } from "stream-chat-react";
6
+ import { NotePencilIcon as Oe, XIcon as he, ArrowLeftIcon as Me, DotsThreeIcon as Fe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Le, MagnifyingGlassIcon as pe, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
+ const fe = we({
8
8
  service: null,
9
9
  client: null,
10
10
  isConnected: !1,
@@ -15,172 +15,172 @@ const he = ve({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), se = () => we(he), ts = ({
18
+ }), se = () => Ee(fe), ls = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
- apiKey: l,
22
+ apiKey: o,
23
23
  capabilities: i = {},
24
24
  customization: c = {},
25
25
  debug: a = !1
26
26
  }) => {
27
- const o = U(
28
- (w, ...M) => {
29
- a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${w}`, ...M);
27
+ const l = F(
28
+ (w, ...O) => {
29
+ a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${w}`, ...O);
30
30
  },
31
31
  [a]
32
32
  );
33
- o("๐Ÿ”„ RENDER START", {
33
+ l("๐Ÿ”„ RENDER START", {
34
34
  userId: s == null ? void 0 : s.id,
35
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
35
+ apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
36
36
  serviceConfig: !!n,
37
37
  capabilities: Object.keys(i),
38
38
  customization: Object.keys(c)
39
39
  });
40
- const [r, b] = E(null), [u, g] = E(null), [m, I] = E(!1), [N, h] = E(!1), [v, S] = E(null), O = H(!1), y = H({
40
+ const [r, b] = E(null), [u, g] = E(null), [m, I] = E(!1), [N, h] = E(!1), [v, S] = E(null), M = H(!1), y = H({
41
41
  userId: s == null ? void 0 : s.id,
42
- apiKey: l,
42
+ apiKey: o,
43
43
  serviceConfig: n,
44
44
  capabilities: i,
45
45
  customization: c
46
46
  }), k = H(0);
47
- k.current++, o("๐Ÿ“Š RENDER INFO", {
47
+ k.current++, l("๐Ÿ“Š RENDER INFO", {
48
48
  renderCount: k.current,
49
- currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
49
+ currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
50
50
  propChanges: {
51
51
  userChanged: y.current.userId !== (s == null ? void 0 : s.id),
52
- apiKeyChanged: y.current.apiKey !== l,
52
+ apiKeyChanged: y.current.apiKey !== o,
53
53
  serviceConfigChanged: y.current.serviceConfig !== n,
54
54
  capabilitiesChanged: y.current.capabilities !== i,
55
55
  customizationChanged: y.current.customization !== c
56
56
  }
57
57
  }), y.current = {
58
58
  userId: s == null ? void 0 : s.id,
59
- apiKey: l,
59
+ apiKey: o,
60
60
  serviceConfig: n,
61
61
  capabilities: i,
62
62
  customization: c
63
63
  }, G(() => {
64
64
  const w = k.current;
65
- if (o("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
65
+ if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
66
66
  renderCount: w,
67
- apiKey: !!l,
67
+ apiKey: !!o,
68
68
  serviceConfig: !!n,
69
69
  dependencies: {
70
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
70
+ apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
71
71
  serviceConfigRef: n,
72
72
  serviceConfigStable: y.current.serviceConfig === n,
73
- apiKeyStable: y.current.apiKey === l
73
+ apiKeyStable: y.current.apiKey === o
74
74
  }
75
- }), !l || !n) {
76
- o("โš ๏ธ SERVICE INIT SKIPPED", {
75
+ }), !o || !n) {
76
+ l("โš ๏ธ SERVICE INIT SKIPPED", {
77
77
  renderCount: w,
78
78
  reason: "Missing apiKey or serviceConfig"
79
79
  });
80
80
  return;
81
81
  }
82
- o("๐Ÿš€ CREATING NEW SERVICE", {
82
+ l("๐Ÿš€ CREATING NEW SERVICE", {
83
83
  renderCount: w,
84
- apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
84
+ apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
85
85
  serviceConfigChanged: y.current.serviceConfig !== n
86
86
  });
87
- const M = new Ee({
87
+ const O = new Ie({
88
88
  ...n,
89
- apiKey: l,
89
+ apiKey: o,
90
90
  debug: a
91
91
  });
92
- return b(M), o("โœ… SERVICE SET", {
92
+ return b(O), l("โœ… SERVICE SET", {
93
93
  renderCount: w,
94
- serviceInstance: !!M
94
+ serviceInstance: !!O
95
95
  }), () => {
96
- o("๐Ÿงน SERVICE CLEANUP", {
96
+ l("๐Ÿงน SERVICE CLEANUP", {
97
97
  renderCount: w,
98
98
  reason: "Effect cleanup"
99
- }), M.disconnectUser().catch(console.error);
99
+ }), O.disconnectUser().catch(console.error);
100
100
  };
101
- }, [l, n, a, o]);
101
+ }, [o, n, a, l]);
102
102
  const T = H(null);
103
103
  G(() => {
104
- var M, p;
105
- if (o("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
104
+ var O, L;
105
+ if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
106
106
  hasService: !!r,
107
107
  hasUser: !!s,
108
108
  userId: s == null ? void 0 : s.id,
109
- isConnecting: O.current,
109
+ isConnecting: M.current,
110
110
  isConnected: m,
111
111
  dependencies: { service: !!r, userId: s == null ? void 0 : s.id }
112
112
  }), !r || !s) {
113
- o("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
113
+ l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
114
114
  return;
115
115
  }
116
- if (O.current) {
117
- o("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
116
+ if (M.current) {
117
+ l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
118
118
  return;
119
119
  }
120
- if (((M = T.current) == null ? void 0 : M.serviceId) === r && ((p = T.current) == null ? void 0 : p.userId) === s.id) {
121
- o(
120
+ if (((O = T.current) == null ? void 0 : O.serviceId) === r && ((L = T.current) == null ? void 0 : L.userId) === s.id) {
121
+ l(
122
122
  "โš ๏ธ USER CONNECTION SKIPPED",
123
123
  "Already connected this user with this service"
124
124
  );
125
125
  return;
126
126
  }
127
127
  (async () => {
128
- o("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), O.current = !0, h(!0), S(null);
128
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), M.current = !0, h(!0), S(null);
129
129
  try {
130
- o("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
- const L = await r.connectUser(s);
132
- g(L), I(!0), T.current = { serviceId: r, userId: s.id }, o("โœ… USER CONNECTION SUCCESS", {
130
+ l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
+ const p = await r.connectUser(s);
132
+ g(p), I(!0), T.current = { serviceId: r, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
133
133
  userId: s.id,
134
- clientId: L.userID
134
+ clientId: p.userID
135
135
  });
136
- } catch (L) {
137
- const $ = L instanceof Error ? L.message : "Connection failed";
138
- S($), o("โŒ USER CONNECTION ERROR", {
136
+ } catch (p) {
137
+ const $ = p instanceof Error ? p.message : "Connection failed";
138
+ S($), l("โŒ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
140
  error: $
141
141
  });
142
142
  } finally {
143
- h(!1), O.current = !1, o("๐Ÿ”„ USER CONNECTION FINISHED", {
143
+ h(!1), M.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
144
144
  userId: s.id,
145
145
  isConnected: m
146
146
  });
147
147
  }
148
148
  })();
149
- }, [r, s, o, m]), G(() => (o("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
149
+ }, [r, s, l, m]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
150
150
  hasService: !!r,
151
151
  isConnected: m
152
152
  }), () => {
153
- r && m ? (o(
153
+ r && m ? (l(
154
154
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
155
155
  "Cleaning up connection on unmount"
156
- ), T.current = null, r.disconnectUser().catch(console.error)) : o("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
156
+ ), T.current = null, r.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
157
157
  hasService: !!r,
158
158
  isConnected: m
159
159
  });
160
- }), [r, m, o]);
161
- const f = U(async () => {
162
- if (o("๐Ÿ”„ REFRESH CONNECTION CALLED", {
160
+ }), [r, m, l]);
161
+ const f = F(async () => {
162
+ if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
163
163
  hasService: !!r,
164
164
  hasUser: !!s
165
165
  }), !r || !s) {
166
- o("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
166
+ l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
167
167
  return;
168
168
  }
169
- o("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), h(!0);
169
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), h(!0);
170
170
  try {
171
- o("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await r.disconnectUser(), o("๐Ÿ“ž RECONNECTING FOR REFRESH");
171
+ l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await r.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
172
172
  const w = await r.connectUser(s);
173
- g(w), I(!0), S(null), o("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
173
+ g(w), I(!0), S(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
174
  } catch (w) {
175
- const M = w instanceof Error ? w.message : "Refresh failed";
176
- S(M), o("โŒ CONNECTION REFRESH ERROR", {
175
+ const O = w instanceof Error ? w.message : "Refresh failed";
176
+ S(O), l("โŒ CONNECTION REFRESH ERROR", {
177
177
  userId: s.id,
178
- error: M
178
+ error: O
179
179
  });
180
180
  } finally {
181
- h(!1), o("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
181
+ h(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
182
182
  }
183
- }, [r, s, o]), x = X.useMemo(() => (o("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
183
+ }, [r, s, l]), x = X.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
184
184
  hasService: !!r,
185
185
  hasClient: !!u,
186
186
  isConnected: m,
@@ -208,15 +208,15 @@ const he = ve({
208
208
  c,
209
209
  f,
210
210
  a,
211
- o
211
+ l
212
212
  ]);
213
- return o("๐Ÿ”„ RENDER END", {
213
+ return l("๐Ÿ”„ RENDER END", {
214
214
  renderCount: k.current,
215
215
  willRenderChat: !!(u && m),
216
216
  contextValueReady: !!x
217
- }), /* @__PURE__ */ e(he.Provider, { value: x, children: u && m ? /* @__PURE__ */ e(Ie, { client: u, children: t }) : t });
218
- }, Le = () => se();
219
- function ne({ label: t, className: s, children: n, ...l }) {
217
+ }), /* @__PURE__ */ e(fe.Provider, { value: x, children: u && m ? /* @__PURE__ */ e(ye, { client: u, children: t }) : t });
218
+ }, je = () => se();
219
+ function ne({ label: t, className: s, children: n, ...o }) {
220
220
  return /* @__PURE__ */ d(
221
221
  "button",
222
222
  {
@@ -224,12 +224,12 @@ function ne({ label: t, className: s, children: n, ...l }) {
224
224
  className: D(
225
225
  "rounded-full p-2 transition-colors focus-ring",
226
226
  {
227
- "cursor-not-allowed opacity-50": l.disabled,
228
- "hover:bg-sand": !l.disabled
227
+ "cursor-not-allowed opacity-50": o.disabled,
228
+ "hover:bg-sand": !o.disabled
229
229
  },
230
230
  s
231
231
  ),
232
- ...l,
232
+ ...o,
233
233
  children: [
234
234
  /* @__PURE__ */ e("span", { className: "sr-only", children: t }),
235
235
  n
@@ -237,59 +237,65 @@ function ne({ label: t, className: s, children: n, ...l }) {
237
237
  }
238
238
  );
239
239
  }
240
- function je(t) {
241
- const s = [
242
- { color: "#8129D9" },
243
- // purple
244
- { color: "#254f1a" },
245
- // dark green
246
- { color: "#061492" },
247
- // dark blue
248
- { color: "#1e2330" },
249
- // dark blue-gray
250
- { color: "#502274" },
251
- // dark purple
252
- { color: "#d717e7" },
253
- // magenta
254
- { color: "#780016" },
255
- // dark red
256
- { color: "#c41500" },
257
- // red
258
- { color: "#fc3e4b" },
259
- // pink
260
- { color: "#4c2e05" },
261
- // brown
262
- { color: "#ff6c02" },
263
- // orange
264
- { color: "#70764d" }
265
- // olive green
266
- ];
267
- let n = 0;
268
- for (let i = 0; i < t.length; i++)
269
- n = (n << 5) - n + t.charCodeAt(i), n = n & n;
270
- const l = Math.abs(n) % s.length;
271
- return s[l];
240
+ const de = [
241
+ "๐ŸŽ",
242
+ // Apple
243
+ "๐ŸŒ",
244
+ // Banana
245
+ "๐Ÿ‡",
246
+ // Grape
247
+ "๐ŸŠ",
248
+ // Orange
249
+ "๐Ÿ“",
250
+ // Strawberry
251
+ "๐Ÿฅฅ",
252
+ // Coconut
253
+ "๐Ÿ’",
254
+ // Cherry
255
+ "๐Ÿฅญ",
256
+ // Mango
257
+ "๐Ÿ‰",
258
+ // Watermelon
259
+ "๐Ÿ‹",
260
+ // Lemon
261
+ "๐Ÿฅ",
262
+ // Kiwi
263
+ "๐Ÿซ’",
264
+ // Olive
265
+ "๐Ÿˆ"
266
+ // Melon
267
+ ];
268
+ function Ae(t) {
269
+ let s = 0;
270
+ for (let n = 0; n < t.length; n++) {
271
+ const o = t.charCodeAt(n);
272
+ s = (s << 5) - s + o, s = s & s;
273
+ }
274
+ return Math.abs(s);
275
+ }
276
+ function Be(t) {
277
+ const n = Ae(t) % de.length;
278
+ return de[n];
272
279
  }
273
- const Y = ({
280
+ const J = ({
274
281
  id: t,
275
- name: s,
276
- image: n,
277
- size: l = 40,
278
- className: i
282
+ image: s,
283
+ size: n = 40,
284
+ className: o
279
285
  }) => {
280
- const { color: c } = je(t), a = s.charAt(0).toUpperCase(), r = l < 32 ? "text-xs" : l < 56 ? "text-sm" : "text-lg";
286
+ const i = Be(t), c = "#FBFAF9", l = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg";
281
287
  return /* @__PURE__ */ e(
282
288
  "div",
283
289
  {
284
290
  className: D(
285
- "flex-shrink-0 overflow-hidden rounded-full",
286
- i
291
+ "flex-shrink-0 overflow-hidden rounded-lg",
292
+ o
287
293
  ),
288
- style: { width: `${l}px`, height: `${l}px` },
289
- children: n ? /* @__PURE__ */ e(
294
+ style: { width: `${n}px`, height: `${n}px` },
295
+ children: s ? /* @__PURE__ */ e(
290
296
  "img",
291
297
  {
292
- src: n,
298
+ src: s,
293
299
  alt: "",
294
300
  className: "h-full w-full object-cover aspect-square"
295
301
  }
@@ -298,20 +304,20 @@ const Y = ({
298
304
  {
299
305
  "aria-hidden": "true",
300
306
  className: D(
301
- "flex h-full w-full items-center justify-center font-semibold",
302
- r
307
+ "flex h-full w-full items-center justify-center font-semibold rounded-sm",
308
+ l
303
309
  ),
304
310
  style: {
305
311
  color: c,
306
- backgroundColor: `color-mix(in srgb, ${c} 20%, transparent)`
312
+ backgroundColor: `color-mix(in srgb, ${c} 60%, solid)`
307
313
  },
308
- children: a
314
+ children: i
309
315
  }
310
316
  )
311
317
  }
312
318
  );
313
- }, Ae = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: i }) => {
314
- var h, v, S, O, y, k;
319
+ }, He = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: o = !1, unread: i }) => {
320
+ var h, v, S, M, y, k;
315
321
  const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), a = () => {
316
322
  t && n(t);
317
323
  }, r = Object.values(((h = t == null ? void 0 : t.state) == null ? void 0 : h.members) || {}).find(
@@ -319,11 +325,11 @@ const Y = ({
319
325
  var f, x;
320
326
  return ((f = T.user) == null ? void 0 : f.id) && T.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
321
327
  }
322
- ), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (y = (O = t == null ? void 0 : t.state) == null ? void 0 : O.messages) == null ? void 0 : y[t.state.messages.length - 1], m = (g == null ? void 0 : g.text) || "No messages yet", I = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
328
+ ), b = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", u = (S = r == null ? void 0 : r.user) == null ? void 0 : S.image, g = (y = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : y[t.state.messages.length - 1], m = (g == null ? void 0 : g.text) || "No messages yet", I = g != null && g.created_at ? new Date(g.created_at).toLocaleTimeString([], {
323
329
  hour: "2-digit",
324
330
  minute: "2-digit"
325
331
  }) : "", N = i ?? 0;
326
- return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
332
+ return o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
327
333
  channelId: t == null ? void 0 : t.id,
328
334
  isSelected: c,
329
335
  participantName: b,
@@ -343,7 +349,7 @@ const Y = ({
343
349
  ),
344
350
  children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
345
351
  /* @__PURE__ */ e(
346
- Y,
352
+ J,
347
353
  {
348
354
  id: ((k = r == null ? void 0 : r.user) == null ? void 0 : k.id) || t.id || "unknown",
349
355
  name: b,
@@ -373,26 +379,26 @@ const Y = ({
373
379
  ] })
374
380
  }
375
381
  );
376
- }, Be = ({
382
+ }, Ge = ({
377
383
  onChannelSelect: t,
378
384
  selectedChannel: s,
379
385
  showStartConversation: n = !1,
380
- onStartConversation: l,
386
+ onStartConversation: o,
381
387
  participantLabel: i = "participants",
382
388
  className: c
383
389
  }) => {
384
390
  var u;
385
391
  const a = X.useRef(0);
386
392
  a.current++;
387
- const { debug: o = !1 } = se();
388
- o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
393
+ const { debug: l = !1 } = se();
394
+ l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
389
395
  renderCount: a.current,
390
396
  selectedChannelId: s == null ? void 0 : s.id,
391
397
  showStartConversation: n,
392
398
  participantLabel: i
393
399
  });
394
- const { client: r } = ye();
395
- o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“ก CHAT CONTEXT", {
400
+ const { client: r } = Se();
401
+ l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“ก CHAT CONTEXT", {
396
402
  renderCount: a.current,
397
403
  hasClient: !!r,
398
404
  clientUserId: r == null ? void 0 : r.userID,
@@ -400,12 +406,12 @@ const Y = ({
400
406
  });
401
407
  const b = X.useMemo(() => {
402
408
  const g = r.userID, m = g ? { type: "messaging", members: { $in: [g] }, hidden: !1 } : { type: "messaging" };
403
- return o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ” FILTERS MEMOIZED", {
409
+ return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ” FILTERS MEMOIZED", {
404
410
  renderCount: a.current,
405
411
  userId: g,
406
412
  filters: m
407
413
  }), m;
408
- }, [r.userID, o]);
414
+ }, [r.userID, l]);
409
415
  return /* @__PURE__ */ d(
410
416
  "div",
411
417
  {
@@ -416,40 +422,40 @@ const Y = ({
416
422
  children: [
417
423
  /* @__PURE__ */ e("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
424
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
419
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n && l && /* @__PURE__ */ e(
425
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n && o && /* @__PURE__ */ e(
420
426
  ne,
421
427
  {
422
428
  label: "Start a new conversation",
423
- onClick: l,
429
+ onClick: o,
424
430
  className: "inline-flex size-10 items-center justify-center",
425
- children: /* @__PURE__ */ e(De, { className: "h-5 w-5" })
431
+ children: /* @__PURE__ */ e(Oe, { className: "h-5 w-5" })
426
432
  }
427
433
  ) })
428
434
  ] }) }),
429
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (o && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
435
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (l && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
430
436
  renderCount: a.current,
431
437
  filters: b,
432
438
  hasClient: !!r,
433
439
  clientUserId: r == null ? void 0 : r.userID
434
440
  }), /* @__PURE__ */ e(
435
- Se,
441
+ Re,
436
442
  {
437
443
  filters: b,
438
444
  sort: { last_message_at: -1 },
439
445
  options: { limit: 30 },
440
446
  Preview: (g) => {
441
447
  var m, I;
442
- return o && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
448
+ return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
443
449
  channelId: (m = g.channel) == null ? void 0 : m.id,
444
450
  selectedChannelId: s == null ? void 0 : s.id,
445
451
  isSelected: (s == null ? void 0 : s.id) === ((I = g.channel) == null ? void 0 : I.id)
446
452
  }), /* @__PURE__ */ e(
447
- Ae,
453
+ He,
448
454
  {
449
455
  ...g,
450
456
  selectedChannel: s,
451
457
  onChannelSelect: t,
452
- debug: o
458
+ debug: l
453
459
  }
454
460
  );
455
461
  }
@@ -462,7 +468,7 @@ const Y = ({
462
468
  variant: t = "default",
463
469
  className: s,
464
470
  children: n,
465
- ...l
471
+ ...o
466
472
  }) => /* @__PURE__ */ e(
467
473
  "button",
468
474
  {
@@ -472,24 +478,24 @@ const Y = ({
472
478
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
473
479
  s
474
480
  ),
475
- ...l,
481
+ ...o,
476
482
  children: n
477
483
  }
478
484
  );
479
- function fe({ onClick: t }) {
480
- return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
485
+ function ge({ onClick: t }) {
486
+ return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-stone", weight: "bold" }) });
481
487
  }
482
- const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
488
+ const $e = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
483
489
  t && t(),
484
- /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Pe, { focus: !0, maxRows: 4 }) })
485
- ] }), Ge = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
490
+ /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(De, { focus: !0, maxRows: 4 }) })
491
+ ] }), _e = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: o }) => {
486
492
  var r, b, u, g;
487
- const { channel: i } = ue(), c = X.useMemo(() => Object.values(i.state.members || {}).find(
493
+ const { channel: i } = me(), c = X.useMemo(() => Object.values(i.state.members || {}).find(
488
494
  (I) => {
489
495
  var N;
490
496
  return ((N = I.user) == null ? void 0 : N.id) && I.user.id !== i._client.userID;
491
497
  }
492
- ), [i._client.userID, i.state.members]), a = ((r = c == null ? void 0 : c.user) == null ? void 0 : r.name) || ((b = c == null ? void 0 : c.user) == null ? void 0 : b.id) || "Unknown member", o = (u = c == null ? void 0 : c.user) == null ? void 0 : u.image;
498
+ ), [i._client.userID, i.state.members]), a = ((r = c == null ? void 0 : c.user) == null ? void 0 : r.name) || ((b = c == null ? void 0 : c.user) == null ? void 0 : b.id) || "Unknown member", l = (u = c == null ? void 0 : c.user) == null ? void 0 : u.image;
493
499
  return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
494
500
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
495
501
  s && t && /* @__PURE__ */ e(
@@ -503,38 +509,38 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
503
509
  }
504
510
  ),
505
511
  /* @__PURE__ */ e(
506
- Y,
512
+ J,
507
513
  {
508
514
  id: ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || i.id || "unknown",
509
515
  name: a,
510
- image: o,
516
+ image: l,
511
517
  size: 40
512
518
  }
513
519
  ),
514
520
  /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: a }) })
515
521
  ] }),
516
- l && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Oe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
522
+ o && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Fe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
517
523
  ] });
518
- }, $e = ({
524
+ }, Ve = ({
519
525
  isOpen: t,
520
526
  onClose: s,
521
527
  participant: n,
522
- channel: l,
528
+ channel: o,
523
529
  followerStatusLabel: i,
524
530
  onLeaveConversation: c,
525
531
  onBlockParticipant: a
526
532
  }) => {
527
- var L, $, _, V, Q, W, z;
528
- const { service: o, debug: r } = se(), b = H(null), [u, g] = E(!1), [m, I] = E(!1), [N, h] = E(!1);
533
+ var p, $, _, V, Q, W, z;
534
+ const { service: l, debug: r } = se(), b = H(null), [u, g] = E(!1), [m, I] = E(!1), [N, h] = E(!1);
529
535
  G(() => {
530
536
  const R = b.current;
531
537
  R && (t ? R.showModal() : R.close());
532
538
  }, [t]);
533
- const v = U(async () => {
539
+ const v = F(async () => {
534
540
  var R;
535
- if (!(!o || !((R = n == null ? void 0 : n.user) != null && R.id)))
541
+ if (!(!l || !((R = n == null ? void 0 : n.user) != null && R.id)))
536
542
  try {
537
- const A = (await o.getBlockedUsers()).some(
543
+ const A = (await l.getBlockedUsers()).some(
538
544
  (q) => {
539
545
  var Z;
540
546
  return q.blocked_user_id === ((Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id);
@@ -547,29 +553,29 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
547
553
  P
548
554
  );
549
555
  }
550
- }, [o, (L = n == null ? void 0 : n.user) == null ? void 0 : L.id]);
556
+ }, [l, (p = n == null ? void 0 : n.user) == null ? void 0 : p.id]);
551
557
  G(() => {
552
558
  t && v();
553
559
  }, [t, v]);
554
560
  const S = async () => {
555
561
  var R;
556
562
  if (!m) {
557
- r && console.log("[ChannelInfoDialog] Leave conversation", l.cid), I(!0);
563
+ r && console.log("[ChannelInfoDialog] Leave conversation", o.cid), I(!0);
558
564
  try {
559
- const P = ((R = l._client) == null ? void 0 : R.userID) ?? null;
560
- await l.hide(P, !1), c && await c(l), s();
565
+ const P = ((R = o._client) == null ? void 0 : R.userID) ?? null;
566
+ await o.hide(P, !1), c && await c(o), s();
561
567
  } catch (P) {
562
568
  console.error("[ChannelInfoDialog] Failed to leave conversation", P);
563
569
  } finally {
564
570
  I(!1);
565
571
  }
566
572
  }
567
- }, O = async () => {
573
+ }, M = async () => {
568
574
  var R, P, A;
569
- if (!(N || !o)) {
575
+ if (!(N || !l)) {
570
576
  r && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
571
577
  try {
572
- await o.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
578
+ await l.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
573
579
  } catch (q) {
574
580
  console.error("[ChannelInfoDialog] Failed to block member", q);
575
581
  } finally {
@@ -578,10 +584,10 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
578
584
  }
579
585
  }, y = async () => {
580
586
  var R, P, A;
581
- if (!(N || !o)) {
587
+ if (!(N || !l)) {
582
588
  r && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
583
589
  try {
584
- await o.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
590
+ await l.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
585
591
  } catch (q) {
586
592
  console.error("[ChannelInfoDialog] Failed to unblock member", q);
587
593
  } finally {
@@ -596,7 +602,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
596
602
  );
597
603
  };
598
604
  if (!n) return null;
599
- const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username, M = x || (w ? `linktr.ee/${w}` : void 0), p = ((z = n.user) == null ? void 0 : z.id) || "unknown";
605
+ const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, x = (Q = n.user) == null ? void 0 : Q.email, w = (W = n.user) == null ? void 0 : W.username, O = x || (w ? `linktr.ee/${w}` : void 0), L = ((z = n.user) == null ? void 0 : z.id) || "unknown";
600
606
  return (
601
607
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
602
608
  /* @__PURE__ */ e(
@@ -611,14 +617,14 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
611
617
  children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
612
618
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
613
619
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
614
- /* @__PURE__ */ e(fe, { onClick: s })
620
+ /* @__PURE__ */ e(ge, { onClick: s })
615
621
  ] }),
616
622
  /* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
617
623
  /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
618
624
  /* @__PURE__ */ e(
619
- Y,
625
+ J,
620
626
  {
621
- id: p,
627
+ id: L,
622
628
  name: T,
623
629
  image: f,
624
630
  size: 64
@@ -626,7 +632,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
626
632
  ),
627
633
  /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
628
634
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
629
- M && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: M }),
635
+ O && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: O }),
630
636
  i && /* @__PURE__ */ e("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: i })
631
637
  ] })
632
638
  ] }) }),
@@ -657,7 +663,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
657
663
  ) : /* @__PURE__ */ d(
658
664
  K,
659
665
  {
660
- onClick: O,
666
+ onClick: M,
661
667
  disabled: N,
662
668
  "aria-busy": N,
663
669
  children: [
@@ -667,7 +673,7 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
667
673
  }
668
674
  ) }),
669
675
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: k, children: [
670
- /* @__PURE__ */ e(Fe, { className: "h-5 w-5" }),
676
+ /* @__PURE__ */ e(Le, { className: "h-5 w-5" }),
671
677
  /* @__PURE__ */ e("span", { children: "Report" })
672
678
  ] }) })
673
679
  ] })
@@ -676,16 +682,16 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
676
682
  }
677
683
  )
678
684
  );
679
- }, _e = ({
685
+ }, We = ({
680
686
  onBack: t,
681
687
  showBackButton: s,
682
688
  renderMessageInputActions: n,
683
- onLeaveConversation: l,
689
+ onLeaveConversation: o,
684
690
  onBlockParticipant: i,
685
691
  CustomChannelEmptyState: c
686
692
  }) => {
687
693
  var m, I;
688
- const { channel: a } = ue(), [o, r] = E(!1), b = (((I = (m = a == null ? void 0 : a.state) == null ? void 0 : m.messages) == null ? void 0 : I.length) ?? 0) > 0, u = X.useMemo(() => Object.values(a.state.members || {}).find(
694
+ const { channel: a } = me(), [l, r] = E(!1), b = (((I = (m = a == null ? void 0 : a.state) == null ? void 0 : m.messages) == null ? void 0 : I.length) ?? 0) > 0, u = X.useMemo(() => Object.values(a.state.members || {}).find(
689
695
  (h) => {
690
696
  var v;
691
697
  return ((v = h.user) == null ? void 0 : v.id) && h.user.id !== a._client.userID;
@@ -695,9 +701,9 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
695
701
  return N.followerStatus ? String(N.followerStatus) : N.isFollower ? "Subscribed to you" : void 0;
696
702
  }, [a.data]);
697
703
  return /* @__PURE__ */ d(oe, { children: [
698
- /* @__PURE__ */ d(ke, { children: [
704
+ /* @__PURE__ */ d(Te, { children: [
699
705
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
700
- Ge,
706
+ _e,
701
707
  {
702
708
  onBack: t,
703
709
  showBackButton: s,
@@ -706,38 +712,38 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
706
712
  }
707
713
  ) }),
708
714
  /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
709
- /* @__PURE__ */ e(Te, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
715
+ /* @__PURE__ */ e(Pe, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
710
716
  !b && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex bg-white", children: /* @__PURE__ */ e(c, {}) })
711
717
  ] }),
712
718
  /* @__PURE__ */ e(
713
- He,
719
+ $e,
714
720
  {
715
721
  renderActions: () => n == null ? void 0 : n(a)
716
722
  }
717
723
  )
718
724
  ] }),
719
725
  /* @__PURE__ */ e(
720
- $e,
726
+ Ve,
721
727
  {
722
- isOpen: o,
728
+ isOpen: l,
723
729
  onClose: () => r(!1),
724
730
  participant: u,
725
731
  channel: a,
726
732
  followerStatusLabel: g,
727
- onLeaveConversation: l,
733
+ onLeaveConversation: o,
728
734
  onBlockParticipant: i
729
735
  }
730
736
  )
731
737
  ] });
732
- }, Ve = ({
738
+ }, ze = ({
733
739
  channel: t,
734
740
  onBack: s,
735
741
  showBackButton: n = !1,
736
- renderMessageInputActions: l,
742
+ renderMessageInputActions: o,
737
743
  onLeaveConversation: i,
738
744
  onBlockParticipant: c,
739
745
  className: a,
740
- CustomChannelEmptyState: o
746
+ CustomChannelEmptyState: l
741
747
  }) => /* @__PURE__ */ e(
742
748
  "div",
743
749
  {
@@ -745,25 +751,25 @@ const He = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "mess
745
751
  "messaging-channel-view h-full flex flex-col",
746
752
  a
747
753
  ),
748
- children: /* @__PURE__ */ e(Re, { channel: t, children: /* @__PURE__ */ e(
749
- _e,
754
+ children: /* @__PURE__ */ e(ke, { channel: t, children: /* @__PURE__ */ e(
755
+ We,
750
756
  {
751
757
  onBack: s,
752
758
  showBackButton: n,
753
- renderMessageInputActions: l,
759
+ renderMessageInputActions: o,
754
760
  onLeaveConversation: i,
755
761
  onBlockParticipant: c,
756
- CustomChannelEmptyState: o
762
+ CustomChannelEmptyState: l
757
763
  }
758
764
  ) })
759
765
  }
760
766
  );
761
- function We({
767
+ function qe({
762
768
  searchQuery: t,
763
769
  setSearchQuery: s,
764
770
  placeholder: n
765
771
  }) {
766
- const l = H(null);
772
+ const o = H(null);
767
773
  return /* @__PURE__ */ d("div", { className: "relative", children: [
768
774
  /* @__PURE__ */ e(
769
775
  pe,
@@ -775,7 +781,7 @@ function We({
775
781
  /* @__PURE__ */ e(
776
782
  "input",
777
783
  {
778
- ref: l,
784
+ ref: o,
779
785
  type: "text",
780
786
  placeholder: n,
781
787
  value: t,
@@ -789,43 +795,43 @@ function We({
789
795
  label: "Clear search",
790
796
  onClick: () => {
791
797
  var i;
792
- s(""), (i = l.current) == null || i.focus();
798
+ s(""), (i = o.current) == null || i.focus();
793
799
  },
794
800
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
795
- children: /* @__PURE__ */ e(me, { className: "h-4 w-4", weight: "bold" })
801
+ children: /* @__PURE__ */ e(he, { className: "h-4 w-4", weight: "bold" })
796
802
  }
797
803
  )
798
804
  ] });
799
805
  }
800
- const ze = ({
806
+ const Xe = ({
801
807
  participantSource: t,
802
808
  onSelectParticipant: s,
803
809
  onClose: n,
804
- existingParticipantIds: l = /* @__PURE__ */ new Set(),
810
+ existingParticipantIds: o = /* @__PURE__ */ new Set(),
805
811
  participantLabel: i = "participants",
806
812
  searchPlaceholder: c = "Search participants...",
807
813
  className: a
808
814
  }) => {
809
- const { debug: o } = se(), [r, b] = E(""), [u, g] = E([]), [m, I] = E(!1), [N, h] = E(null), [v, S] = E(
815
+ const { debug: l } = se(), [r, b] = E(""), [u, g] = E([]), [m, I] = E(!1), [N, h] = E(null), [v, S] = E(
810
816
  null
811
- ), O = H(!1);
817
+ ), M = H(!1);
812
818
  G(() => {
813
819
  if (t.loading) {
814
- o && console.log(
820
+ l && console.log(
815
821
  "[ParticipantPicker] Waiting for participant source to finish loading..."
816
822
  );
817
823
  return;
818
824
  }
819
- if (O.current) return;
825
+ if (M.current) return;
820
826
  (async () => {
821
- o && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), h(null);
827
+ l && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), h(null);
822
828
  try {
823
829
  const x = await t.loadParticipants({
824
830
  search: "",
825
831
  // Load all participants initially
826
832
  limit: 100
827
833
  });
828
- g(x.participants), O.current = !0, o && console.log(
834
+ g(x.participants), M.current = !0, l && console.log(
829
835
  "[ParticipantPicker] Participants loaded successfully:",
830
836
  x.participants.length
831
837
  );
@@ -836,13 +842,13 @@ const ze = ({
836
842
  I(!1);
837
843
  }
838
844
  })();
839
- }, [t.loading, o]);
840
- const y = u.filter((f) => !l.has(f.id)).filter((f) => {
845
+ }, [t.loading, l]);
846
+ const y = u.filter((f) => !o.has(f.id)).filter((f) => {
841
847
  var w;
842
848
  if (!r) return !0;
843
849
  const x = r.toLowerCase();
844
850
  return f.name.toLowerCase().includes(x) || ((w = f.email) == null ? void 0 : w.toLowerCase().includes(x)) || !1;
845
- }), k = U(
851
+ }), k = F(
846
852
  async (f) => {
847
853
  if (!v) {
848
854
  S(f.id);
@@ -861,7 +867,7 @@ const ze = ({
861
867
  /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
862
868
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
863
869
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
864
- /* @__PURE__ */ e(fe, { onClick: n })
870
+ /* @__PURE__ */ e(ge, { onClick: n })
865
871
  ] }),
866
872
  /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
867
873
  "Select a ",
@@ -872,7 +878,7 @@ const ze = ({
872
878
  t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${i} total`
873
879
  ] }),
874
880
  /* @__PURE__ */ e(
875
- We,
881
+ qe,
876
882
  {
877
883
  searchQuery: r,
878
884
  setSearchQuery: b,
@@ -905,12 +911,12 @@ const ze = ({
905
911
  {
906
912
  type: "button",
907
913
  onClick: () => k(f),
908
- onKeyDown: (M) => T(M, f),
914
+ onKeyDown: (O) => T(O, f),
909
915
  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",
910
916
  children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
911
917
  /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
912
918
  /* @__PURE__ */ e(
913
- Y,
919
+ J,
914
920
  {
915
921
  id: f.id,
916
922
  name: x,
@@ -934,26 +940,26 @@ const ze = ({
934
940
  ] }) })
935
941
  ] }) })
936
942
  ] });
937
- }, qe = ({ 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: [
943
+ }, Qe = ({ 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: [
938
944
  /* @__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: "๐Ÿ’ฌ" }) }),
939
945
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
940
946
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(oe, { children: [
941
947
  "Choose a conversation from the list or",
942
948
  " ",
943
- s && /* @__PURE__ */ d(de, { onClick: s, children: [
949
+ s && /* @__PURE__ */ d(ue, { onClick: s, children: [
944
950
  "start a new conversation with a ",
945
951
  n.slice(0, -1),
946
952
  "."
947
953
  ] })
948
954
  ] }) : s && /* @__PURE__ */ d(oe, { children: [
949
- /* @__PURE__ */ d(de, { onClick: s, children: [
955
+ /* @__PURE__ */ d(ue, { onClick: s, children: [
950
956
  "Start a new conversation with one of your ",
951
957
  n
952
958
  ] }),
953
959
  " ",
954
960
  "to begin messaging."
955
961
  ] }) })
956
- ] }) }), de = ({
962
+ ] }) }), ue = ({
957
963
  onClick: t,
958
964
  children: s
959
965
  }) => /* @__PURE__ */ e(
@@ -977,7 +983,7 @@ const ze = ({
977
983
  children: "Go Back"
978
984
  }
979
985
  )
980
- ] }) }), Xe = ({ className: t, message: s }) => /* @__PURE__ */ d(
986
+ ] }) }), Ze = ({ className: t, message: s }) => /* @__PURE__ */ d(
981
987
  "div",
982
988
  {
983
989
  className: D("flex items-center justify-center h-full", t),
@@ -1020,18 +1026,18 @@ const ze = ({
1020
1026
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1021
1027
  ]
1022
1028
  }
1023
- ), Qe = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1024
- /* @__PURE__ */ e(Xe, { className: "w-6 h-6" }),
1029
+ ), Je = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1030
+ /* @__PURE__ */ e(Ze, { className: "w-6 h-6" }),
1025
1031
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1026
- ] }) }), rs = ({
1032
+ ] }) }), os = ({
1027
1033
  capabilities: t = {},
1028
1034
  className: s,
1029
1035
  renderMessageInputActions: n,
1030
- onChannelSelect: l,
1036
+ onChannelSelect: o,
1031
1037
  onParticipantSelect: i,
1032
1038
  initialParticipantFilter: c,
1033
1039
  initialParticipantData: a,
1034
- CustomChannelEmptyState: o,
1040
+ CustomChannelEmptyState: l,
1035
1041
  showChannelList: r = !0
1036
1042
  }) => {
1037
1043
  const {
@@ -1042,11 +1048,11 @@ const ze = ({
1042
1048
  error: I,
1043
1049
  refreshConnection: N,
1044
1050
  debug: h
1045
- } = Le(), [v, S] = E(null), [O, y] = E(!1), [k, T] = E(!1), [f, x] = E(/* @__PURE__ */ new Set()), [w, M] = E(0), [p, L] = E(!1), [$, _] = E(null), V = H(null), {
1051
+ } = je(), [v, S] = E(null), [M, y] = E(!1), [k, T] = E(!1), [f, x] = E(/* @__PURE__ */ new Set()), [w, O] = E(0), [L, p] = E(!1), [$, _] = E(null), V = H(null), {
1046
1052
  showStartConversation: Q = !1,
1047
1053
  participantSource: W,
1048
1054
  participantLabel: z = "participants"
1049
- } = t, R = H(null), P = U(async () => {
1055
+ } = t, R = H(null), P = F(async () => {
1050
1056
  if (!u || !g) return;
1051
1057
  const C = u.userID;
1052
1058
  if (C)
@@ -1059,17 +1065,17 @@ const ze = ({
1059
1065
  },
1060
1066
  {},
1061
1067
  { limit: 100 }
1062
- ), F = /* @__PURE__ */ new Set();
1068
+ ), U = /* @__PURE__ */ new Set();
1063
1069
  j.forEach((B) => {
1064
- const be = B.state.members;
1065
- Object.values(be).forEach((Ce) => {
1070
+ const Ce = B.state.members;
1071
+ Object.values(Ce).forEach((ve) => {
1066
1072
  var ae;
1067
- const re = (ae = Ce.user) == null ? void 0 : ae.id;
1068
- re && re !== C && F.add(re);
1073
+ const re = (ae = ve.user) == null ? void 0 : ae.id;
1074
+ re && re !== C && U.add(re);
1069
1075
  });
1070
- }), x(F), y(j.length > 0), R.current = C, h && console.log("[MessagingShell] Channels synced successfully:", {
1076
+ }), x(U), y(j.length > 0), R.current = C, h && console.log("[MessagingShell] Channels synced successfully:", {
1071
1077
  channelCount: j.length,
1072
- memberCount: F.size
1078
+ memberCount: U.size
1073
1079
  });
1074
1080
  } catch (j) {
1075
1081
  console.error("[MessagingShell] Failed to sync channels:", j);
@@ -1089,7 +1095,7 @@ const ze = ({
1089
1095
  "[MessagingShell] Loading initial conversation with:",
1090
1096
  c
1091
1097
  );
1092
- const F = await u.queryChannels(
1098
+ const U = await u.queryChannels(
1093
1099
  {
1094
1100
  type: "messaging",
1095
1101
  members: { $eq: [j, c] }
@@ -1097,10 +1103,10 @@ const ze = ({
1097
1103
  {},
1098
1104
  { limit: 1 }
1099
1105
  );
1100
- if (F.length > 0)
1101
- S(F[0]), L(!0), _(null), l && l(F[0]), h && console.log(
1106
+ if (U.length > 0)
1107
+ S(U[0]), p(!0), _(null), o && o(U[0]), h && console.log(
1102
1108
  "[MessagingShell] Initial conversation loaded:",
1103
- F[0].id
1109
+ U[0].id
1104
1110
  );
1105
1111
  else if (a && b) {
1106
1112
  h && console.log(
@@ -1114,7 +1120,7 @@ const ze = ({
1114
1120
  email: a.email,
1115
1121
  phone: a.phone
1116
1122
  });
1117
- S(B), L(!0), _(null), l && l(B), h && console.log(
1123
+ S(B), p(!0), _(null), o && o(B), h && console.log(
1118
1124
  "[MessagingShell] Channel created and loaded:",
1119
1125
  B.id
1120
1126
  );
@@ -1131,10 +1137,10 @@ const ze = ({
1131
1137
  "[MessagingShell] No conversation found for:",
1132
1138
  c
1133
1139
  );
1134
- } catch (F) {
1140
+ } catch (U) {
1135
1141
  console.error(
1136
1142
  "[MessagingShell] Failed to load initial conversation:",
1137
- F
1143
+ U
1138
1144
  ), _("Failed to load conversation");
1139
1145
  }
1140
1146
  })();
@@ -1145,19 +1151,19 @@ const ze = ({
1145
1151
  g,
1146
1152
  b,
1147
1153
  h,
1148
- l
1154
+ o
1149
1155
  ]);
1150
- const A = U(
1156
+ const A = F(
1151
1157
  (C) => {
1152
- S(C), l == null || l(C);
1158
+ S(C), o == null || o(C);
1153
1159
  },
1154
- [l]
1155
- ), q = U(() => {
1156
- p || S(null);
1157
- }, [p]), Z = U(() => {
1160
+ [o]
1161
+ ), q = F(() => {
1162
+ L || S(null);
1163
+ }, [L]), Z = F(() => {
1158
1164
  var C;
1159
- W && (M((j) => j + 1), T(!0), (C = V.current) == null || C.showModal());
1160
- }, [W]), ge = U(
1165
+ W && (O((j) => j + 1), T(!0), (C = V.current) == null || C.showModal());
1166
+ }, [W]), xe = F(
1161
1167
  async (C) => {
1162
1168
  var j;
1163
1169
  if (b)
@@ -1166,38 +1172,38 @@ const ze = ({
1166
1172
  "[MessagingShell] Starting conversation with:",
1167
1173
  C.id
1168
1174
  );
1169
- const F = await b.startChannelWithParticipant({
1175
+ const U = await b.startChannelWithParticipant({
1170
1176
  id: C.id,
1171
1177
  name: C.name,
1172
1178
  email: C.email,
1173
1179
  phone: C.phone
1174
1180
  });
1175
1181
  try {
1176
- await F.show();
1182
+ await U.show();
1177
1183
  } catch (B) {
1178
1184
  console.warn("[MessagingShell] Failed to unhide channel:", B);
1179
1185
  }
1180
- S(F), T(!1), (j = V.current) == null || j.close(), i == null || i(C);
1181
- } catch (F) {
1182
- console.error("[MessagingShell] Failed to start conversation:", F);
1186
+ S(U), T(!1), (j = V.current) == null || j.close(), i == null || i(C);
1187
+ } catch (U) {
1188
+ console.error("[MessagingShell] Failed to start conversation:", U);
1183
1189
  }
1184
1190
  },
1185
1191
  [b, i, h]
1186
- ), te = U(() => {
1192
+ ), te = F(() => {
1187
1193
  var C;
1188
1194
  T(!1), (C = V.current) == null || C.close();
1189
- }, []), xe = U(
1195
+ }, []), Ne = F(
1190
1196
  async (C) => {
1191
- h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), L(!1), R.current = null, await P();
1197
+ h && console.log("[MessagingShell] Leaving conversation:", C.id), S(null), p(!1), R.current = null, await P();
1192
1198
  },
1193
1199
  [P, h]
1194
- ), Ne = U(
1200
+ ), be = F(
1195
1201
  async (C) => {
1196
- h && console.log("[MessagingShell] Blocking participant:", C), S(null), L(!1), R.current = null, await P();
1202
+ h && console.log("[MessagingShell] Blocking participant:", C), S(null), p(!1), R.current = null, await P();
1197
1203
  },
1198
1204
  [P, h]
1199
- ), J = !!v;
1200
- return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Qe, {}) }) : I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: N }) }) : !g || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1205
+ ), Y = !!v;
1206
+ return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Je, {}) }) : I ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: N }) }) : !g || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1201
1207
  le,
1202
1208
  {
1203
1209
  message: "Not connected to messaging service",
@@ -1219,15 +1225,15 @@ const ze = ({
1219
1225
  "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",
1220
1226
  {
1221
1227
  // Explicitly hidden via prop or in direct conversation mode
1222
- "!hidden": r === !1 || p,
1228
+ "!hidden": r === !1 || L,
1223
1229
  // Normal mode: hide on mobile when channel selected, show on desktop
1224
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !p && J,
1230
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": r !== !1 && !L && Y,
1225
1231
  // Normal mode: show when no channel selected
1226
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !p && !J
1232
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": r !== !1 && !L && !Y
1227
1233
  }
1228
1234
  ),
1229
1235
  children: /* @__PURE__ */ e(
1230
- Be,
1236
+ Ge,
1231
1237
  {
1232
1238
  onChannelSelect: A,
1233
1239
  selectedChannel: v || void 0,
@@ -1245,27 +1251,27 @@ const ze = ({
1245
1251
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1246
1252
  {
1247
1253
  // In direct conversation mode, always show (full width)
1248
- flex: p || J,
1254
+ flex: L || Y,
1249
1255
  // Normal mode: hide on mobile when no channel selected
1250
- "hidden lg:flex": !p && !J
1256
+ "hidden lg:flex": !L && !Y
1251
1257
  }
1252
1258
  ),
1253
1259
  children: v ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1254
- Ve,
1260
+ ze,
1255
1261
  {
1256
1262
  channel: v,
1257
1263
  onBack: q,
1258
- showBackButton: !p,
1264
+ showBackButton: !L,
1259
1265
  renderMessageInputActions: n,
1260
- onLeaveConversation: xe,
1261
- onBlockParticipant: Ne,
1262
- CustomChannelEmptyState: o
1266
+ onLeaveConversation: Ne,
1267
+ onBlockParticipant: be,
1268
+ CustomChannelEmptyState: l
1263
1269
  },
1264
1270
  v.id
1265
1271
  ) }) : /* @__PURE__ */ e(
1266
- qe,
1272
+ Qe,
1267
1273
  {
1268
- hasChannels: O,
1274
+ hasChannels: M,
1269
1275
  onStartConversation: Q ? Z : void 0,
1270
1276
  participantLabel: z
1271
1277
  }
@@ -1284,10 +1290,10 @@ const ze = ({
1284
1290
  },
1285
1291
  onClose: te,
1286
1292
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1287
- ze,
1293
+ Xe,
1288
1294
  {
1289
1295
  participantSource: W,
1290
- onSelectParticipant: ge,
1296
+ onSelectParticipant: xe,
1291
1297
  onClose: te,
1292
1298
  existingParticipantIds: f,
1293
1299
  participantLabel: z,
@@ -1300,11 +1306,11 @@ const ze = ({
1300
1306
  ]
1301
1307
  }
1302
1308
  );
1303
- }, Ze = ({
1309
+ }, Ye = ({
1304
1310
  question: t,
1305
1311
  onClick: s,
1306
1312
  loading: n = !1,
1307
- className: l
1313
+ className: o
1308
1314
  }) => /* @__PURE__ */ e(
1309
1315
  "button",
1310
1316
  {
@@ -1318,23 +1324,23 @@ const ze = ({
1318
1324
  "hover:brightness-95 active:brightness-90": !n,
1319
1325
  "opacity-50 cursor-not-allowed": n
1320
1326
  },
1321
- l
1327
+ o
1322
1328
  ),
1323
1329
  children: t
1324
1330
  }
1325
- ), ls = ({
1331
+ ), as = ({
1326
1332
  faqs: t,
1327
1333
  onFaqClick: s,
1328
1334
  loadingFaqId: n,
1329
- headerText: l,
1335
+ headerText: o,
1330
1336
  className: i,
1331
1337
  avatarImage: c,
1332
1338
  avatarName: a
1333
1339
  }) => {
1334
- const o = t.filter((r) => r.enabled).sort((r, b) => (r.order ?? 0) - (b.order ?? 0));
1335
- return o.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", i), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1340
+ const l = t.filter((r) => r.enabled).sort((r, b) => (r.order ?? 0) - (b.order ?? 0));
1341
+ return l.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", i), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1336
1342
  (c || a) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1337
- Y,
1343
+ J,
1338
1344
  {
1339
1345
  id: a || "account",
1340
1346
  name: a || "Account",
@@ -1348,9 +1354,9 @@ const ze = ({
1348
1354
  className: "flex-1 rounded-lg p-4 space-y-3",
1349
1355
  style: { backgroundColor: "#F1F0EE" },
1350
1356
  children: [
1351
- l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1352
- o.map((r) => /* @__PURE__ */ e(
1353
- Ze,
1357
+ o && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: o }),
1358
+ l.map((r) => /* @__PURE__ */ e(
1359
+ Ye,
1354
1360
  {
1355
1361
  question: r.question,
1356
1362
  onClick: () => s(r.id),
@@ -1362,15 +1368,15 @@ const ze = ({
1362
1368
  }
1363
1369
  )
1364
1370
  ] }) });
1365
- }, os = (t, s = {}) => {
1366
- const { initialSearch: n = "", pageSize: l = 20 } = s, [i, c] = E([]), [a, o] = E(!1), [r, b] = E(null), [u, g] = E(n), [m, I] = E(!0), [N, h] = E(), v = U(async (k = !1, T) => {
1371
+ }, is = (t, s = {}) => {
1372
+ const { initialSearch: n = "", pageSize: o = 20 } = s, [i, c] = E([]), [a, l] = E(!1), [r, b] = E(null), [u, g] = E(n), [m, I] = E(!0), [N, h] = E(), v = F(async (k = !1, T) => {
1367
1373
  if (a) return;
1368
1374
  const f = T !== void 0 ? T : u;
1369
- o(!0), b(null);
1375
+ l(!0), b(null);
1370
1376
  try {
1371
1377
  const x = await t.loadParticipants({
1372
1378
  search: f || void 0,
1373
- limit: l,
1379
+ limit: o,
1374
1380
  cursor: k ? void 0 : N
1375
1381
  });
1376
1382
  c(
@@ -1380,13 +1386,13 @@ const ze = ({
1380
1386
  const w = x instanceof Error ? x.message : "Failed to load participants";
1381
1387
  b(w), console.error("[useParticipants] Load error:", x);
1382
1388
  } finally {
1383
- o(!1);
1389
+ l(!1);
1384
1390
  }
1385
- }, [t, u, N, l, a]), S = U(() => {
1391
+ }, [t, u, N, o, a]), S = F(() => {
1386
1392
  m && !a && v(!1);
1387
- }, [m, a, v]), O = U((k) => {
1393
+ }, [m, a, v]), M = F((k) => {
1388
1394
  g(k), h(void 0), v(!0, k);
1389
- }, [v]), y = U(() => {
1395
+ }, [v]), y = F(() => {
1390
1396
  h(void 0), v(!0);
1391
1397
  }, [v]);
1392
1398
  return G(() => {
@@ -1399,20 +1405,20 @@ const ze = ({
1399
1405
  hasMore: m,
1400
1406
  totalCount: t.totalCount,
1401
1407
  loadMore: S,
1402
- search: O,
1408
+ search: M,
1403
1409
  refresh: y
1404
1410
  };
1405
1411
  };
1406
1412
  export {
1407
- Y as Avatar,
1408
- Be as ChannelList,
1409
- Ve as ChannelView,
1410
- ls as FaqList,
1411
- Ze as FaqListItem,
1412
- ts as MessagingProvider,
1413
- rs as MessagingShell,
1414
- ze as ParticipantPicker,
1415
- Le as useMessaging,
1416
- os as useParticipants
1413
+ J as Avatar,
1414
+ Ge as ChannelList,
1415
+ ze as ChannelView,
1416
+ as as FaqList,
1417
+ Ye as FaqListItem,
1418
+ ls as MessagingProvider,
1419
+ os as MessagingShell,
1420
+ Xe as ParticipantPicker,
1421
+ je as useMessaging,
1422
+ is as useParticipants
1417
1423
  };
1418
1424
  //# sourceMappingURL=index.js.map