@linktr.ee/messaging-react 1.0.2 → 1.1.0-rc-1760927977

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