@codingfactory/messenger-client 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +383 -364
- package/dist/types/messaging.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as N, getCurrentInstance as
|
|
1
|
+
import { ref as N, getCurrentInstance as Us, computed as C, watch as We, onUnmounted as Nt, toValue as or, onMounted as Yt, nextTick as ct, defineComponent as ot, openBlock as m, createElementBlock as b, normalizeStyle as at, normalizeClass as xe, createElementVNode as c, toDisplayString as Q, useAttrs as Qa, onBeforeUnmount as Fs, Fragment as ze, mergeProps as lr, unref as Lt, renderList as ut, withModifiers as Ve, createCommentVNode as Y, createTextVNode as yt, withKeys as Dt, createVNode as $e, createBlock as it, Teleport as ss, resolveDynamicComponent as cr, withCtx as rt, Transition as Wt, renderSlot as Vn, createStaticVNode as eo, withDirectives as un, vModelText as dn, TransitionGroup as to } from "vue";
|
|
2
2
|
import { defineStore as ur, storeToRefs as no } from "pinia";
|
|
3
|
-
import
|
|
3
|
+
import Ns, { isAxiosError as so, AxiosHeaders as bi } from "axios";
|
|
4
4
|
import { isAxiosError as Jg } from "axios";
|
|
5
|
-
import { useRoute as dr, useRouter as
|
|
5
|
+
import { useRoute as dr, useRouter as is } from "vue-router";
|
|
6
6
|
import { isToday as hr, isYesterday as fr, format as cn, isSameDay as io, parseISO as Kn } from "date-fns";
|
|
7
7
|
const mr = () => () => {
|
|
8
8
|
}, pr = () => () => {
|
|
@@ -30,7 +30,7 @@ const mr = () => () => {
|
|
|
30
30
|
unsubscribeFromConversation: yr,
|
|
31
31
|
subscribeToTyping: Cr,
|
|
32
32
|
unsubscribeFromTyping: _r
|
|
33
|
-
}, Pn = () => Ue.ECHO_INITIALIZED_EVENT, Zt = () => Ue.getEcho(), Sr = async () => Ue.waitForEcho(), Tr = () => Ue.getConnectionStatus(), yi = () => Tr(),
|
|
33
|
+
}, Pn = () => Ue.ECHO_INITIALIZED_EVENT, Zt = () => Ue.getEcho(), Sr = async () => Ue.waitForEcho(), Tr = () => Ue.getConnectionStatus(), yi = () => Tr(), Rs = () => Ue.getAccessState(), rs = (e) => Ue.onConnectionStatusChange(e), ro = (e) => Ue.onAccessStateChange(e), ao = async () => {
|
|
34
34
|
await Ue.reconnect();
|
|
35
35
|
}, oo = (e) => Ue.subscribeToPresenceStatus(e), lo = () => Ue.unsubscribeFromPresenceStatus(), co = (e, t) => Ue.subscribeToConversation(e, t), uo = (e) => Ue.unsubscribeFromConversation(e), ho = (e, t) => Ue.subscribeToTyping(e, t), fo = (e) => Ue.unsubscribeFromTyping(e);
|
|
36
36
|
function mo(e) {
|
|
@@ -60,27 +60,27 @@ function _o(e) {
|
|
|
60
60
|
function wo(e) {
|
|
61
61
|
return an(e) && typeof e.conversation_id == "string";
|
|
62
62
|
}
|
|
63
|
-
const Mr =
|
|
64
|
-
let
|
|
63
|
+
const Mr = Ns;
|
|
64
|
+
let zs = Mr;
|
|
65
65
|
function Fe() {
|
|
66
|
-
return
|
|
66
|
+
return zs;
|
|
67
67
|
}
|
|
68
68
|
function Co(e) {
|
|
69
|
-
|
|
69
|
+
zs = e;
|
|
70
70
|
}
|
|
71
71
|
function ko() {
|
|
72
|
-
|
|
72
|
+
zs = Mr;
|
|
73
73
|
}
|
|
74
|
-
const xr =
|
|
75
|
-
let
|
|
76
|
-
function
|
|
77
|
-
return
|
|
74
|
+
const xr = Ns;
|
|
75
|
+
let js = xr;
|
|
76
|
+
function Jn() {
|
|
77
|
+
return js;
|
|
78
78
|
}
|
|
79
79
|
function So(e) {
|
|
80
|
-
|
|
80
|
+
js = e;
|
|
81
81
|
}
|
|
82
82
|
function To() {
|
|
83
|
-
|
|
83
|
+
js = xr;
|
|
84
84
|
}
|
|
85
85
|
const Er = {
|
|
86
86
|
currentUser: null
|
|
@@ -146,7 +146,7 @@ function _i(e, t) {
|
|
|
146
146
|
throw new Error(`Invalid messaging folder payload: ${t} must be a string or null`);
|
|
147
147
|
return n;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function _s(e, t) {
|
|
150
150
|
const n = e[t];
|
|
151
151
|
if (typeof n == "number" && Number.isFinite(n))
|
|
152
152
|
return n;
|
|
@@ -157,7 +157,7 @@ function ys(e, t) {
|
|
|
157
157
|
}
|
|
158
158
|
throw new Error(`Invalid messaging folder payload: missing numeric ${t}`);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Ps(e) {
|
|
161
161
|
if (!$r(e))
|
|
162
162
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
163
163
|
return {
|
|
@@ -165,9 +165,9 @@ function Rs(e) {
|
|
|
165
165
|
name: Wn(e, "name"),
|
|
166
166
|
color: _i(e, "color"),
|
|
167
167
|
icon: _i(e, "icon"),
|
|
168
|
-
sort_order:
|
|
169
|
-
conversation_count:
|
|
170
|
-
unread_count:
|
|
168
|
+
sort_order: _s(e, "sort_order"),
|
|
169
|
+
conversation_count: _s(e, "conversation_count"),
|
|
170
|
+
unread_count: _s(e, "unread_count"),
|
|
171
171
|
created_at: Wn(e, "created_at"),
|
|
172
172
|
updated_at: Wn(e, "updated_at")
|
|
173
173
|
};
|
|
@@ -175,7 +175,7 @@ function Rs(e) {
|
|
|
175
175
|
function Po(e) {
|
|
176
176
|
if (!Array.isArray(e))
|
|
177
177
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
178
|
-
return e.map((t) =>
|
|
178
|
+
return e.map((t) => Ps(t));
|
|
179
179
|
}
|
|
180
180
|
function wi(e) {
|
|
181
181
|
if (!Ro(e))
|
|
@@ -189,11 +189,11 @@ const sn = {
|
|
|
189
189
|
},
|
|
190
190
|
async createFolder(e) {
|
|
191
191
|
const t = await Fe().post("/v1/messaging/folders", e);
|
|
192
|
-
return
|
|
192
|
+
return Ps(wn(t.data));
|
|
193
193
|
},
|
|
194
194
|
async updateFolder(e, t) {
|
|
195
195
|
const n = await Fe().patch(`/v1/messaging/folders/${e}`, t);
|
|
196
|
-
return
|
|
196
|
+
return Ps(wn(n.data));
|
|
197
197
|
},
|
|
198
198
|
async deleteFolder(e) {
|
|
199
199
|
await Fe().delete(`/v1/messaging/folders/${e}`);
|
|
@@ -230,28 +230,28 @@ function Rr(e) {
|
|
|
230
230
|
const t = e.trim();
|
|
231
231
|
return t.length > 0 ? t : null;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function Is(e) {
|
|
234
234
|
const t = Rr(e);
|
|
235
235
|
if (t === null)
|
|
236
236
|
return null;
|
|
237
237
|
const n = t.includes("T") ? t : t.replace(" ", "T"), i = /(?:Z|[+-]\d{2}:\d{2})$/i.test(n) ? n : `${n}Z`, o = new Date(i);
|
|
238
238
|
return Number.isNaN(o.getTime()) ? null : o;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Zn(e, t, n = {}) {
|
|
241
241
|
if (e === null)
|
|
242
242
|
return null;
|
|
243
243
|
if (e === "offline")
|
|
244
244
|
return "offline";
|
|
245
|
-
const i =
|
|
245
|
+
const i = Is(t);
|
|
246
246
|
if (i === null)
|
|
247
247
|
return e;
|
|
248
248
|
const o = n.now ?? Date.now(), l = n.staleAfterMs ?? Io;
|
|
249
249
|
return o - i.getTime() > l ? "offline" : e;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Qn(e, t = {}) {
|
|
252
252
|
const n = Rr(e?.last_seen_at), i = Oo(e?.status);
|
|
253
253
|
return {
|
|
254
|
-
status:
|
|
254
|
+
status: Zn(i, n, t),
|
|
255
255
|
lastSeenAt: n
|
|
256
256
|
};
|
|
257
257
|
}
|
|
@@ -298,7 +298,7 @@ const Ci = 1e3, Hs = 4e3, No = 12e4, zo = 300, jo = 1, Bo = 1600, Vs = (e) => {
|
|
|
298
298
|
}, Ti = () => ({
|
|
299
299
|
data: [],
|
|
300
300
|
has_more: !1
|
|
301
|
-
}), Mi = () =>
|
|
301
|
+
}), Mi = () => Rs() === "account_suspended", Vo = (e) => {
|
|
302
302
|
if (!gt(e))
|
|
303
303
|
return !1;
|
|
304
304
|
const n = (gt(e.data) ? e.data : e).throttled;
|
|
@@ -413,14 +413,14 @@ function Jo(e) {
|
|
|
413
413
|
} : {}
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function ws(e) {
|
|
417
417
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
418
418
|
}
|
|
419
419
|
function xi(e) {
|
|
420
420
|
if (!(typeof e != "string" || e.length === 0))
|
|
421
421
|
return e;
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function Ls(e) {
|
|
424
424
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
425
425
|
}
|
|
426
426
|
function Zo(e, t = []) {
|
|
@@ -461,7 +461,7 @@ function Zo(e, t = []) {
|
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
function Qo(e, t) {
|
|
464
|
-
return Object.prototype.hasOwnProperty.call(e, "muted_until") ?
|
|
464
|
+
return Object.prototype.hasOwnProperty.call(e, "muted_until") ? ws(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? ws(e.me.muted_until) : ws(t?.muted_until);
|
|
465
465
|
}
|
|
466
466
|
function el(e, t) {
|
|
467
467
|
return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : t?.folder_id;
|
|
@@ -490,7 +490,7 @@ function Cn(e, t) {
|
|
|
490
490
|
function tl(e) {
|
|
491
491
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Cs(e) {
|
|
494
494
|
return tl(e) ? 0 : e.unread_count || 0;
|
|
495
495
|
}
|
|
496
496
|
function Ei(e, t) {
|
|
@@ -498,10 +498,10 @@ function Ei(e, t) {
|
|
|
498
498
|
if (Array.isArray(n))
|
|
499
499
|
for (let i = n.length - 1; i >= 0; i -= 1) {
|
|
500
500
|
const o = n[i]?.id;
|
|
501
|
-
if (
|
|
501
|
+
if (Ls(o))
|
|
502
502
|
return o;
|
|
503
503
|
}
|
|
504
|
-
return
|
|
504
|
+
return Ls(e.last_message?.id) ? e.last_message.id : null;
|
|
505
505
|
}
|
|
506
506
|
function gt(e) {
|
|
507
507
|
return typeof e == "object" && e !== null;
|
|
@@ -588,23 +588,26 @@ async function rl(e) {
|
|
|
588
588
|
return (await Or([e])).get(e) ?? null;
|
|
589
589
|
}
|
|
590
590
|
async function Or(e) {
|
|
591
|
-
const t = Array.from(new Set(e.filter((
|
|
591
|
+
const t = Array.from(new Set(e.filter((i) => i.length > 0)));
|
|
592
592
|
if (t.length === 0)
|
|
593
593
|
return /* @__PURE__ */ new Map();
|
|
594
|
+
const n = { ids: t.join(",") };
|
|
594
595
|
try {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
596
|
+
let i = null;
|
|
597
|
+
try {
|
|
598
|
+
i = await Jn().get("/v1/messenger/identity/resolve", { params: n });
|
|
599
|
+
} catch {
|
|
600
|
+
i = await Jn().get("/v1/identity/users/by-ids", { params: n });
|
|
601
|
+
}
|
|
602
|
+
const o = il(i.data), l = /* @__PURE__ */ new Map();
|
|
603
|
+
for (const u of o)
|
|
604
|
+
t.includes(u.id) && l.set(u.id, {
|
|
605
|
+
id: u.id,
|
|
606
|
+
name: u.name,
|
|
607
|
+
...u.avatar ? { avatar: u.avatar } : {},
|
|
608
|
+
...u.handle ? { handle: u.handle } : {}
|
|
606
609
|
});
|
|
607
|
-
return
|
|
610
|
+
return l;
|
|
608
611
|
} catch {
|
|
609
612
|
return /* @__PURE__ */ new Map();
|
|
610
613
|
}
|
|
@@ -692,7 +695,7 @@ function ol(e, t, n) {
|
|
|
692
695
|
});
|
|
693
696
|
return i ? o : e;
|
|
694
697
|
}
|
|
695
|
-
function
|
|
698
|
+
function ks(e) {
|
|
696
699
|
const t = /* @__PURE__ */ new Map();
|
|
697
700
|
for (const n of e.requests)
|
|
698
701
|
n.is_request === !0 && t.set(n.id, n);
|
|
@@ -731,18 +734,18 @@ const Gt = ur("messaging", {
|
|
|
731
734
|
},
|
|
732
735
|
getMessagesByConversationId: (e) => (t) => e.messages[t] || [],
|
|
733
736
|
getTypingUsers: (e) => (t) => e.typingUsers[t] || [],
|
|
734
|
-
unreadConversationsCount: (e) => e.conversations.filter((t) =>
|
|
735
|
-
unreadCount: (e) => e.conversations.reduce((t, n) => t +
|
|
736
|
-
totalUnreadCount: (e) => e.conversations.reduce((t, n) => t +
|
|
737
|
+
unreadConversationsCount: (e) => e.conversations.filter((t) => Cs(t) > 0).length,
|
|
738
|
+
unreadCount: (e) => e.conversations.reduce((t, n) => t + Cs(n), 0),
|
|
739
|
+
totalUnreadCount: (e) => e.conversations.reduce((t, n) => t + Cs(n), 0),
|
|
737
740
|
sortedFolders: (e) => Sn(e.folders),
|
|
738
741
|
folderById: (e) => (t) => e.folders.find((n) => n.id === t),
|
|
739
742
|
conversationsInFolder: (e) => (t) => e.conversations.filter((n) => n.folder_id === t),
|
|
740
743
|
hasMoreMessages: (e) => (t) => e.conversationHasMore[t] ?? !1,
|
|
741
744
|
isLoadingMessages: (e) => (t) => e.loadingMessages[t] ?? !1,
|
|
742
745
|
// Message request getters
|
|
743
|
-
requestConversations: (e) =>
|
|
744
|
-
requestCount: (e) =>
|
|
745
|
-
unreadRequestCount: (e) =>
|
|
746
|
+
requestConversations: (e) => ks(e),
|
|
747
|
+
requestCount: (e) => ks(e).length,
|
|
748
|
+
unreadRequestCount: (e) => ks(e).filter((t) => t.unread_count > 0).length
|
|
746
749
|
},
|
|
747
750
|
actions: {
|
|
748
751
|
normalizeFolderAssignmentsState() {
|
|
@@ -1064,7 +1067,7 @@ const Gt = ur("messaging", {
|
|
|
1064
1067
|
return null;
|
|
1065
1068
|
for (let l = o.length - 1; l >= 0; l -= 1) {
|
|
1066
1069
|
const u = o[l]?.id;
|
|
1067
|
-
if (
|
|
1070
|
+
if (Ls(u))
|
|
1068
1071
|
return u;
|
|
1069
1072
|
}
|
|
1070
1073
|
return null;
|
|
@@ -1117,13 +1120,24 @@ const Gt = ur("messaging", {
|
|
|
1117
1120
|
throw this.error = Ke(i), i;
|
|
1118
1121
|
},
|
|
1119
1122
|
async sendTyping(e, t = "start") {
|
|
1123
|
+
const n = {
|
|
1124
|
+
_messengerSuppressAuthInvalidation: !0
|
|
1125
|
+
};
|
|
1120
1126
|
try {
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1127
|
+
const i = await Fe().post(
|
|
1128
|
+
`/v1/messaging/conversations/${e}/typing`,
|
|
1129
|
+
{ state: t },
|
|
1130
|
+
n
|
|
1131
|
+
);
|
|
1132
|
+
if (t !== "start" || !Vo(i.data))
|
|
1123
1133
|
return;
|
|
1124
|
-
await Si(Bo), await Fe().post(
|
|
1125
|
-
|
|
1126
|
-
|
|
1134
|
+
await Si(Bo), await Fe().post(
|
|
1135
|
+
`/v1/messaging/conversations/${e}/typing`,
|
|
1136
|
+
{ state: t },
|
|
1137
|
+
n
|
|
1138
|
+
);
|
|
1139
|
+
} catch (i) {
|
|
1140
|
+
console.warn("Failed to send typing indicator:", i);
|
|
1127
1141
|
}
|
|
1128
1142
|
},
|
|
1129
1143
|
async muteConversation(e, t) {
|
|
@@ -1405,7 +1419,7 @@ const Gt = ur("messaging", {
|
|
|
1405
1419
|
params: { ids: t }
|
|
1406
1420
|
}), i = n.data?.data?.items ?? n.data?.items ?? [];
|
|
1407
1421
|
for (const o of i) {
|
|
1408
|
-
const l =
|
|
1422
|
+
const l = Qn(o);
|
|
1409
1423
|
l.status !== null && this.updatePresenceForUser(o.id, l.status, l.lastSeenAt, "snapshot");
|
|
1410
1424
|
}
|
|
1411
1425
|
},
|
|
@@ -1498,7 +1512,7 @@ const Gt = ur("messaging", {
|
|
|
1498
1512
|
}
|
|
1499
1513
|
});
|
|
1500
1514
|
function ll(e) {
|
|
1501
|
-
const t = Gt(), n = It()(), i = N(!1), o = N(null), l = N(null), u =
|
|
1515
|
+
const t = Gt(), n = It()(), i = N(!1), o = N(null), l = N(null), u = Us(), p = u !== null, h = 20, w = 250;
|
|
1502
1516
|
let y = 0, k = null, x = null;
|
|
1503
1517
|
const M = C(() => n.currentUser?.id), $ = () => or(e)?.trim() ?? "";
|
|
1504
1518
|
function R() {
|
|
@@ -1579,7 +1593,7 @@ function ll(e) {
|
|
|
1579
1593
|
i.value || q();
|
|
1580
1594
|
}
|
|
1581
1595
|
typeof window < "u" && window.addEventListener(Pn(), K);
|
|
1582
|
-
const ve =
|
|
1596
|
+
const ve = rs((U) => {
|
|
1583
1597
|
if (U === "connected") {
|
|
1584
1598
|
i.value || q();
|
|
1585
1599
|
return;
|
|
@@ -1678,7 +1692,7 @@ function _l(e) {
|
|
|
1678
1692
|
return e === "messenger" ? {
|
|
1679
1693
|
initializedEvent: Pn(),
|
|
1680
1694
|
getConnectionStatus: Tr,
|
|
1681
|
-
onConnectionStatusChange:
|
|
1695
|
+
onConnectionStatusChange: rs,
|
|
1682
1696
|
reconnect: ao,
|
|
1683
1697
|
getEchoConnection: () => Fi(Zt())
|
|
1684
1698
|
} : {
|
|
@@ -1871,7 +1885,7 @@ function kl() {
|
|
|
1871
1885
|
}
|
|
1872
1886
|
const rn = Xs()("GlobalMessaging"), Sl = 25, Tl = 3e4, Ml = (e) => e.replace(/\/+$/, ""), xl = (e) => Ml(window.location.pathname) === `/messages/${e}`, El = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1873
1887
|
function Ig() {
|
|
1874
|
-
const e = Gt(), t = It()(), n = wl(), i =
|
|
1888
|
+
const e = Gt(), t = It()(), n = wl(), i = Jn(), o = dr(), l = Us(), { conversations: u, requestConversations: p } = no(e), h = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
|
|
1875
1889
|
let y = !1;
|
|
1876
1890
|
function k(q) {
|
|
1877
1891
|
const K = w.get(q);
|
|
@@ -2029,7 +2043,7 @@ function Ig() {
|
|
|
2029
2043
|
M(ce.id);
|
|
2030
2044
|
}
|
|
2031
2045
|
function A(q) {
|
|
2032
|
-
const K =
|
|
2046
|
+
const K = Qn({
|
|
2033
2047
|
status: q.status,
|
|
2034
2048
|
last_seen_at: q.last_seen_at ?? q.ts ?? null
|
|
2035
2049
|
});
|
|
@@ -2050,7 +2064,7 @@ function Ig() {
|
|
|
2050
2064
|
params: { ids: q }
|
|
2051
2065
|
}), ve = K.data?.data?.items ?? K.data?.items ?? [];
|
|
2052
2066
|
for (const ce of ve) {
|
|
2053
|
-
const U =
|
|
2067
|
+
const U = Qn(ce);
|
|
2054
2068
|
U.status !== null && e.updatePresenceForUser(ce.id, U.status, U.lastSeenAt, "snapshot");
|
|
2055
2069
|
}
|
|
2056
2070
|
} catch (K) {
|
|
@@ -2086,7 +2100,7 @@ function Ig() {
|
|
|
2086
2100
|
() => {
|
|
2087
2101
|
R();
|
|
2088
2102
|
}
|
|
2089
|
-
), ne =
|
|
2103
|
+
), ne = rs((q) => {
|
|
2090
2104
|
q === "connected" ? (x(), R(), ae(), L(), I()) : (q === "disconnected" || q === "error") && (x(), ae());
|
|
2091
2105
|
});
|
|
2092
2106
|
R(), L(), I();
|
|
@@ -2102,10 +2116,10 @@ function Ig() {
|
|
|
2102
2116
|
});
|
|
2103
2117
|
}
|
|
2104
2118
|
function Lg() {
|
|
2105
|
-
const e = N(
|
|
2119
|
+
const e = N(Rs());
|
|
2106
2120
|
let t = null;
|
|
2107
2121
|
return Yt(() => {
|
|
2108
|
-
e.value =
|
|
2122
|
+
e.value = Rs(), t = ro((n) => {
|
|
2109
2123
|
e.value = n;
|
|
2110
2124
|
});
|
|
2111
2125
|
}), Nt(() => {
|
|
@@ -2129,18 +2143,18 @@ const zr = () => null, jr = {
|
|
|
2129
2143
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
2130
2144
|
authTokenResolver: zr
|
|
2131
2145
|
};
|
|
2132
|
-
let
|
|
2146
|
+
let es = { ...jr };
|
|
2133
2147
|
function Al() {
|
|
2134
|
-
return
|
|
2148
|
+
return es;
|
|
2135
2149
|
}
|
|
2136
2150
|
function $l(e) {
|
|
2137
|
-
|
|
2138
|
-
...
|
|
2151
|
+
es = {
|
|
2152
|
+
...es,
|
|
2139
2153
|
...e
|
|
2140
2154
|
};
|
|
2141
2155
|
}
|
|
2142
2156
|
function Rl() {
|
|
2143
|
-
|
|
2157
|
+
es = { ...jr };
|
|
2144
2158
|
}
|
|
2145
2159
|
function Pl(e) {
|
|
2146
2160
|
return e.authTokenResolver !== zr;
|
|
@@ -2173,11 +2187,11 @@ function qr(e) {
|
|
|
2173
2187
|
const n = t.data;
|
|
2174
2188
|
return An(n) && typeof n.code == "string" ? n.code : null;
|
|
2175
2189
|
}
|
|
2176
|
-
function
|
|
2190
|
+
function Ss(e) {
|
|
2177
2191
|
const t = Br(e), n = qr(e);
|
|
2178
2192
|
return t === Il && n === Dl || t === Ol && n === Fl;
|
|
2179
2193
|
}
|
|
2180
|
-
function
|
|
2194
|
+
function Ts(e) {
|
|
2181
2195
|
const t = Br(e), n = qr(e);
|
|
2182
2196
|
return t === Ll && n === Ul ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2183
2197
|
}
|
|
@@ -2198,7 +2212,7 @@ function Bl(e) {
|
|
|
2198
2212
|
const i = Number.parseInt(n, 10);
|
|
2199
2213
|
return Number.isFinite(i) ? i : (t?.removeItem(e), null);
|
|
2200
2214
|
}
|
|
2201
|
-
function
|
|
2215
|
+
function Ms(e, t = Date.now()) {
|
|
2202
2216
|
const n = In(), i = Bl(e);
|
|
2203
2217
|
return i === null ? !1 : i <= t ? (n?.removeItem(e), !1) : !0;
|
|
2204
2218
|
}
|
|
@@ -2254,8 +2268,8 @@ function Xl(e, t, n) {
|
|
|
2254
2268
|
}
|
|
2255
2269
|
}
|
|
2256
2270
|
function Og() {
|
|
2257
|
-
const e = It()(), t = Al(), n =
|
|
2258
|
-
let o = null, l = null, u = !1, p =
|
|
2271
|
+
const e = It()(), t = Al(), n = Jn(), i = jl(t.clientIdStorageKey);
|
|
2272
|
+
let o = null, l = null, u = !1, p = Ms(t.accountLimitedUntilStorageKey), h = !1, w = !1, y = null, k = 0;
|
|
2259
2273
|
const x = () => Pl(t) ? t.authTokenResolver() !== null : !0, M = () => {
|
|
2260
2274
|
o && (clearInterval(o), o = null);
|
|
2261
2275
|
}, $ = () => {
|
|
@@ -2271,11 +2285,11 @@ function Og() {
|
|
|
2271
2285
|
try {
|
|
2272
2286
|
await n.patch(t.statusUrl, { status: H }), y = H;
|
|
2273
2287
|
} catch (ge) {
|
|
2274
|
-
if (
|
|
2288
|
+
if (Ss(ge)) {
|
|
2275
2289
|
A("[Presence] Presence updates paused: account is temporarily limited");
|
|
2276
2290
|
return;
|
|
2277
2291
|
}
|
|
2278
|
-
|
|
2292
|
+
Ts(ge) && (h = !0, u = !1, y = null, M(), $());
|
|
2279
2293
|
}
|
|
2280
2294
|
}, L = () => {
|
|
2281
2295
|
$(), !(!u || w || p || h || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
@@ -2293,7 +2307,7 @@ function Og() {
|
|
|
2293
2307
|
}, O = () => {
|
|
2294
2308
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", de), document.removeEventListener("keydown", de), document.removeEventListener("touchstart", de), window.removeEventListener("focus", de));
|
|
2295
2309
|
}, ne = async () => {
|
|
2296
|
-
if (
|
|
2310
|
+
if (Ms(t.accountLimitedUntilStorageKey))
|
|
2297
2311
|
return p = !0, "account_limited";
|
|
2298
2312
|
try {
|
|
2299
2313
|
return await n.post(t.sessionOpenUrl, {
|
|
@@ -2301,7 +2315,7 @@ function Og() {
|
|
|
2301
2315
|
user_agent: t.userAgentResolver()
|
|
2302
2316
|
}), Hl(t.accountLimitedUntilStorageKey), p = !1, h = !1, u = !0, y = null, "opened";
|
|
2303
2317
|
} catch (H) {
|
|
2304
|
-
return
|
|
2318
|
+
return Ss(H) ? (A("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Ts(H) ? (h = !0, u = !1, y = null, M(), $(), "account_suspended") : "failed";
|
|
2305
2319
|
}
|
|
2306
2320
|
}, ie = async () => {
|
|
2307
2321
|
for (let H = 0; H < Nl; H += 1)
|
|
@@ -2313,11 +2327,11 @@ function Og() {
|
|
|
2313
2327
|
try {
|
|
2314
2328
|
await n.post(t.sessionHeartbeatUrl, { client_id: i });
|
|
2315
2329
|
} catch (H) {
|
|
2316
|
-
if (
|
|
2330
|
+
if (Ss(H)) {
|
|
2317
2331
|
A("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2318
2332
|
return;
|
|
2319
2333
|
}
|
|
2320
|
-
|
|
2334
|
+
Ts(H) && (h = !0, u = !1, y = null, M(), $());
|
|
2321
2335
|
}
|
|
2322
2336
|
}, K = () => {
|
|
2323
2337
|
if (!u)
|
|
@@ -2350,7 +2364,7 @@ function Og() {
|
|
|
2350
2364
|
return;
|
|
2351
2365
|
}
|
|
2352
2366
|
if (document.visibilityState === "visible" && !u) {
|
|
2353
|
-
p =
|
|
2367
|
+
p = Ms(t.accountLimitedUntilStorageKey), !p && !h && ve();
|
|
2354
2368
|
return;
|
|
2355
2369
|
}
|
|
2356
2370
|
document.visibilityState === "visible" && u && !p && !h && ae();
|
|
@@ -2372,7 +2386,7 @@ function Og() {
|
|
|
2372
2386
|
}
|
|
2373
2387
|
const Kl = 12e3;
|
|
2374
2388
|
function Yl(e) {
|
|
2375
|
-
const t = Gt(), n = It()(), i = N(!1), o = N(null), l = N(null), u = N([]), p = /* @__PURE__ */ new Map(), h =
|
|
2389
|
+
const t = Gt(), n = It()(), i = N(!1), o = N(null), l = N(null), u = N([]), p = /* @__PURE__ */ new Map(), h = Us(), w = h !== null, y = 20, k = 250;
|
|
2376
2390
|
let x = !1, M = null, $ = 0, R = null;
|
|
2377
2391
|
const A = C(() => n.currentUser?.id), I = () => or(e)?.trim() ?? "", L = () => {
|
|
2378
2392
|
const f = l.value?.trim() ?? "";
|
|
@@ -2497,7 +2511,7 @@ function Yl(e) {
|
|
|
2497
2511
|
I() && (M && (M(), M = null), i.value = !1, l.value = null, ce());
|
|
2498
2512
|
};
|
|
2499
2513
|
typeof window < "u" && window.addEventListener(Pn(), P);
|
|
2500
|
-
const v =
|
|
2514
|
+
const v = rs((f) => {
|
|
2501
2515
|
if (f === "connected") {
|
|
2502
2516
|
i.value || ce();
|
|
2503
2517
|
return;
|
|
@@ -2733,15 +2747,15 @@ function zi(e) {
|
|
|
2733
2747
|
const Wr = {
|
|
2734
2748
|
messagesRoute: "/messages"
|
|
2735
2749
|
};
|
|
2736
|
-
let
|
|
2750
|
+
let ts = { ...Wr };
|
|
2737
2751
|
function Tn() {
|
|
2738
|
-
return
|
|
2752
|
+
return ts;
|
|
2739
2753
|
}
|
|
2740
2754
|
function pc(e) {
|
|
2741
|
-
|
|
2755
|
+
ts = { ...ts, ...e };
|
|
2742
2756
|
}
|
|
2743
2757
|
function vc() {
|
|
2744
|
-
|
|
2758
|
+
ts = { ...Wr };
|
|
2745
2759
|
}
|
|
2746
2760
|
function Dg(e) {
|
|
2747
2761
|
e.apiClient && Co(e.apiClient), e.mainApiClient && So(e.mainApiClient), e.authStore && Mo(e.authStore), e.mediaApi && Ao(e.mediaApi), e.createLogger && gl(e.createLogger), e.playMessageNotification && Cl(e.playMessageNotification), e.echo && mo(e.echo), e.mainEcho && ml(e.mainEcho), e.presence && $l(e.presence), e.toast && tc(e.toast), e.terms && sc(e.terms), e.moderation && rc(e.moderation), e.getToken && lc(e.getToken), e.normalizeMediaUrl && dc(e.normalizeMediaUrl), e.resolveVideoPlaybackUrl && hc(e.resolveVideoPlaybackUrl), e.widget && pc(e.widget);
|
|
@@ -3067,7 +3081,7 @@ class _c extends Yr {
|
|
|
3067
3081
|
), this;
|
|
3068
3082
|
}
|
|
3069
3083
|
}
|
|
3070
|
-
class
|
|
3084
|
+
class ns extends ni {
|
|
3071
3085
|
/**
|
|
3072
3086
|
* Subscribe to a channel.
|
|
3073
3087
|
*/
|
|
@@ -3115,7 +3129,7 @@ class ts extends ni {
|
|
|
3115
3129
|
return this;
|
|
3116
3130
|
}
|
|
3117
3131
|
}
|
|
3118
|
-
class Jr extends
|
|
3132
|
+
class Jr extends ns {
|
|
3119
3133
|
/**
|
|
3120
3134
|
* Send a whisper event to other clients in the channel.
|
|
3121
3135
|
*/
|
|
@@ -3123,7 +3137,7 @@ class Jr extends ts {
|
|
|
3123
3137
|
return this;
|
|
3124
3138
|
}
|
|
3125
3139
|
}
|
|
3126
|
-
class wc extends
|
|
3140
|
+
class wc extends ns {
|
|
3127
3141
|
/**
|
|
3128
3142
|
* Send a whisper event to other clients in the channel.
|
|
3129
3143
|
*/
|
|
@@ -3472,13 +3486,13 @@ class ji extends ii {
|
|
|
3472
3486
|
* Listen for an event on a channel instance.
|
|
3473
3487
|
*/
|
|
3474
3488
|
listen(t, n, i) {
|
|
3475
|
-
return new
|
|
3489
|
+
return new ns();
|
|
3476
3490
|
}
|
|
3477
3491
|
/**
|
|
3478
3492
|
* Get a channel instance by name.
|
|
3479
3493
|
*/
|
|
3480
3494
|
channel(t) {
|
|
3481
|
-
return new
|
|
3495
|
+
return new ns();
|
|
3482
3496
|
}
|
|
3483
3497
|
/**
|
|
3484
3498
|
* Get a private channel instance by name.
|
|
@@ -3694,7 +3708,7 @@ class Sc {
|
|
|
3694
3708
|
function Tc(e) {
|
|
3695
3709
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3696
3710
|
}
|
|
3697
|
-
var
|
|
3711
|
+
var xs = { exports: {} };
|
|
3698
3712
|
var Bi;
|
|
3699
3713
|
function Mc() {
|
|
3700
3714
|
return Bi || (Bi = 1, (function(e, t) {
|
|
@@ -4243,7 +4257,7 @@ function Mc() {
|
|
|
4243
4257
|
for (var d = 0; d < a.length; d++)
|
|
4244
4258
|
s.call(r || window, a[d], d, a);
|
|
4245
4259
|
}
|
|
4246
|
-
function
|
|
4260
|
+
function ee(a, s) {
|
|
4247
4261
|
for (var r = [], d = 0; d < a.length; d++)
|
|
4248
4262
|
r.push(s(a[d], d, a, r));
|
|
4249
4263
|
return r;
|
|
@@ -4294,7 +4308,7 @@ function Mc() {
|
|
|
4294
4308
|
function Ie(a) {
|
|
4295
4309
|
var s = we(a, function(d) {
|
|
4296
4310
|
return d !== void 0;
|
|
4297
|
-
}), r =
|
|
4311
|
+
}), r = ee(Pe(z(s)), Se.method("join", "=")).join("&");
|
|
4298
4312
|
return r;
|
|
4299
4313
|
}
|
|
4300
4314
|
function Ne(a) {
|
|
@@ -4354,7 +4368,7 @@ function Mc() {
|
|
|
4354
4368
|
}
|
|
4355
4369
|
log(s, ...r) {
|
|
4356
4370
|
var d = ft.apply(this, arguments);
|
|
4357
|
-
|
|
4371
|
+
gs.log ? gs.log(d) : gs.logToConsole && s.bind(this)(d);
|
|
4358
4372
|
}
|
|
4359
4373
|
}
|
|
4360
4374
|
var Te = new Re(), zt = function(a, s, r, d, g) {
|
|
@@ -4509,7 +4523,7 @@ function Mc() {
|
|
|
4509
4523
|
return this;
|
|
4510
4524
|
}
|
|
4511
4525
|
}
|
|
4512
|
-
class
|
|
4526
|
+
class te extends se {
|
|
4513
4527
|
constructor(s, r, d, g, W) {
|
|
4514
4528
|
super(), this.initialize = De.transportConnectionInitializer, this.hooks = s, this.name = r, this.priority = d, this.key = g, this.options = W, this.state = "new", this.timeline = W.timeline, this.activityTimeout = W.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4515
4529
|
}
|
|
@@ -4596,7 +4610,7 @@ function Mc() {
|
|
|
4596
4610
|
return this.hooks.isSupported(s);
|
|
4597
4611
|
}
|
|
4598
4612
|
createConnection(s, r, d, g) {
|
|
4599
|
-
return new
|
|
4613
|
+
return new te(this.hooks, s, r, d, g);
|
|
4600
4614
|
}
|
|
4601
4615
|
}
|
|
4602
4616
|
var Qe = new je({
|
|
@@ -4947,7 +4961,7 @@ function Mc() {
|
|
|
4947
4961
|
}, r);
|
|
4948
4962
|
}
|
|
4949
4963
|
}
|
|
4950
|
-
class
|
|
4964
|
+
class os {
|
|
4951
4965
|
constructor() {
|
|
4952
4966
|
this.reset();
|
|
4953
4967
|
}
|
|
@@ -4979,7 +4993,7 @@ function Mc() {
|
|
|
4979
4993
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4980
4994
|
}
|
|
4981
4995
|
}
|
|
4982
|
-
var
|
|
4996
|
+
var ls = function(a, s, r, d) {
|
|
4983
4997
|
function g(W) {
|
|
4984
4998
|
return W instanceof r ? W : new r(function(fe) {
|
|
4985
4999
|
fe(W);
|
|
@@ -5008,10 +5022,10 @@ function Mc() {
|
|
|
5008
5022
|
};
|
|
5009
5023
|
class Ln extends fn {
|
|
5010
5024
|
constructor(s, r) {
|
|
5011
|
-
super(s, r), this.members = new
|
|
5025
|
+
super(s, r), this.members = new os();
|
|
5012
5026
|
}
|
|
5013
5027
|
authorize(s, r) {
|
|
5014
|
-
super.authorize(s, (d, g) =>
|
|
5028
|
+
super.authorize(s, (d, g) => ls(this, void 0, void 0, function* () {
|
|
5015
5029
|
if (!d)
|
|
5016
5030
|
if (g = g, g.channel_data != null) {
|
|
5017
5031
|
var W = JSON.parse(g.channel_data);
|
|
@@ -5136,7 +5150,7 @@ function Mc() {
|
|
|
5136
5150
|
}
|
|
5137
5151
|
}
|
|
5138
5152
|
}
|
|
5139
|
-
class
|
|
5153
|
+
class cs extends se {
|
|
5140
5154
|
constructor(s, r) {
|
|
5141
5155
|
super(), this.state = "initialized", this.connection = null, this.key = s, this.options = r, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
5142
5156
|
var d = De.getNetwork();
|
|
@@ -5292,12 +5306,12 @@ function Mc() {
|
|
|
5292
5306
|
return this.state === "connecting" || this.state === "connected";
|
|
5293
5307
|
}
|
|
5294
5308
|
}
|
|
5295
|
-
class
|
|
5309
|
+
class us {
|
|
5296
5310
|
constructor() {
|
|
5297
5311
|
this.channels = {};
|
|
5298
5312
|
}
|
|
5299
5313
|
add(s, r) {
|
|
5300
|
-
return this.channels[s] || (this.channels[s] =
|
|
5314
|
+
return this.channels[s] || (this.channels[s] = ds(s, r)), this.channels[s];
|
|
5301
5315
|
}
|
|
5302
5316
|
all() {
|
|
5303
5317
|
return dt(this.channels);
|
|
@@ -5315,7 +5329,7 @@ function Mc() {
|
|
|
5315
5329
|
});
|
|
5316
5330
|
}
|
|
5317
5331
|
}
|
|
5318
|
-
function
|
|
5332
|
+
function ds(a, s) {
|
|
5319
5333
|
if (a.indexOf("private-encrypted-") === 0) {
|
|
5320
5334
|
if (s.config.nacl)
|
|
5321
5335
|
return Bt.createEncryptedChannel(a, s, s.config.nacl);
|
|
@@ -5331,12 +5345,12 @@ function Mc() {
|
|
|
5331
5345
|
return Bt.createChannel(a, s);
|
|
5332
5346
|
}
|
|
5333
5347
|
}
|
|
5334
|
-
var
|
|
5348
|
+
var hs = {
|
|
5335
5349
|
createChannels() {
|
|
5336
|
-
return new
|
|
5350
|
+
return new us();
|
|
5337
5351
|
},
|
|
5338
5352
|
createConnectionManager(a, s) {
|
|
5339
|
-
return new
|
|
5353
|
+
return new cs(a, s);
|
|
5340
5354
|
},
|
|
5341
5355
|
createChannel(a, s) {
|
|
5342
5356
|
return new Xt(a, s);
|
|
@@ -5359,7 +5373,7 @@ function Mc() {
|
|
|
5359
5373
|
createAssistantToTheTransportManager(a, s, r) {
|
|
5360
5374
|
return new B(a, s, r);
|
|
5361
5375
|
}
|
|
5362
|
-
}, Bt =
|
|
5376
|
+
}, Bt = hs;
|
|
5363
5377
|
class mn {
|
|
5364
5378
|
constructor(s) {
|
|
5365
5379
|
this.options = s || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
@@ -5424,7 +5438,7 @@ function Mc() {
|
|
|
5424
5438
|
return yn(this.strategies, s, function(d, g) {
|
|
5425
5439
|
return function(W, fe) {
|
|
5426
5440
|
if (g[d].error = W, W) {
|
|
5427
|
-
|
|
5441
|
+
fs(g) && r(!0);
|
|
5428
5442
|
return;
|
|
5429
5443
|
}
|
|
5430
5444
|
Ze(g, function(Me) {
|
|
@@ -5435,7 +5449,7 @@ function Mc() {
|
|
|
5435
5449
|
}
|
|
5436
5450
|
}
|
|
5437
5451
|
function yn(a, s, r) {
|
|
5438
|
-
var d =
|
|
5452
|
+
var d = ee(a, function(g, W, fe, Me) {
|
|
5439
5453
|
return g.connect(s, r(W, Me));
|
|
5440
5454
|
});
|
|
5441
5455
|
return {
|
|
@@ -5449,7 +5463,7 @@ function Mc() {
|
|
|
5449
5463
|
}
|
|
5450
5464
|
};
|
|
5451
5465
|
}
|
|
5452
|
-
function
|
|
5466
|
+
function fs(a) {
|
|
5453
5467
|
return j(a, function(s) {
|
|
5454
5468
|
return !!s.error;
|
|
5455
5469
|
});
|
|
@@ -5457,7 +5471,7 @@ function Mc() {
|
|
|
5457
5471
|
function Un(a) {
|
|
5458
5472
|
!a.error && !a.aborted && (a.abort(), a.aborted = !0);
|
|
5459
5473
|
}
|
|
5460
|
-
class
|
|
5474
|
+
class ms {
|
|
5461
5475
|
constructor(s, r, d) {
|
|
5462
5476
|
this.strategy = s, this.transports = r, this.ttl = d.ttl || 1800 * 1e3, this.usingTLS = d.useTLS, this.timeline = d.timeline;
|
|
5463
5477
|
}
|
|
@@ -5478,7 +5492,7 @@ function Mc() {
|
|
|
5478
5492
|
}))) : W++);
|
|
5479
5493
|
}
|
|
5480
5494
|
var Oe = Se.now(), Xe = fe.pop().connect(s, function Je(vt, Hn) {
|
|
5481
|
-
vt ? (Nn(d), fe.length > 0 ? (Oe = Se.now(), Xe = fe.pop().connect(s, Je)) : r(vt)) : (
|
|
5495
|
+
vt ? (Nn(d), fe.length > 0 ? (Oe = Se.now(), Xe = fe.pop().connect(s, Je)) : r(vt)) : (ps(d, Hn.transport.name, Se.now() - Oe, W), r(null, Hn));
|
|
5482
5496
|
});
|
|
5483
5497
|
return {
|
|
5484
5498
|
abort: function() {
|
|
@@ -5505,7 +5519,7 @@ function Mc() {
|
|
|
5505
5519
|
}
|
|
5506
5520
|
return null;
|
|
5507
5521
|
}
|
|
5508
|
-
function
|
|
5522
|
+
function ps(a, s, r, d) {
|
|
5509
5523
|
var g = De.getLocalStorage();
|
|
5510
5524
|
if (g)
|
|
5511
5525
|
try {
|
|
@@ -5615,15 +5629,15 @@ function Mc() {
|
|
|
5615
5629
|
fi,
|
|
5616
5630
|
new vn(mi, { delay: 4e3 })
|
|
5617
5631
|
]), mi)
|
|
5618
|
-
], Oe),
|
|
5619
|
-
return s.useTLS ?
|
|
5632
|
+
], Oe), bs = new tn(Kt(pi), pi, Xa), ys;
|
|
5633
|
+
return s.useTLS ? ys = new pn([
|
|
5620
5634
|
hi,
|
|
5621
|
-
new vn(
|
|
5622
|
-
]) :
|
|
5635
|
+
new vn(bs, { delay: 2e3 })
|
|
5636
|
+
]) : ys = new pn([
|
|
5623
5637
|
hi,
|
|
5624
5638
|
new vn(Ga, { delay: 2e3 }),
|
|
5625
|
-
new vn(
|
|
5626
|
-
]), new
|
|
5639
|
+
new vn(bs, { delay: 5e3 })
|
|
5640
|
+
]), new ms(new zn(new tn(Kt(vt), ys, bs)), d, {
|
|
5627
5641
|
ttl: 18e5,
|
|
5628
5642
|
timeline: s.timeline,
|
|
5629
5643
|
useTLS: s.useTLS
|
|
@@ -5960,11 +5974,11 @@ function Mc() {
|
|
|
5960
5974
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5961
5975
|
}() * a);
|
|
5962
5976
|
}
|
|
5963
|
-
}, De = ba,
|
|
5977
|
+
}, De = ba, vs;
|
|
5964
5978
|
(function(a) {
|
|
5965
5979
|
a[a.ERROR = 3] = "ERROR", a[a.INFO = 6] = "INFO", a[a.DEBUG = 7] = "DEBUG";
|
|
5966
|
-
})(
|
|
5967
|
-
var qn =
|
|
5980
|
+
})(vs || (vs = {}));
|
|
5981
|
+
var qn = vs;
|
|
5968
5982
|
class ya {
|
|
5969
5983
|
constructor(s, r, d) {
|
|
5970
5984
|
this.key = s, this.session = r, this.events = [], this.options = d || {}, this.sent = 0, this.uniqueID = 0;
|
|
@@ -6380,7 +6394,7 @@ function Mc() {
|
|
|
6380
6394
|
}
|
|
6381
6395
|
}
|
|
6382
6396
|
Et.instances = [], Et.isReady = !1, Et.logToConsole = !1, Et.Runtime = De, Et.ScriptReceivers = De.ScriptReceivers, Et.DependenciesReceivers = De.DependenciesReceivers, Et.auth_callbacks = De.auth_callbacks;
|
|
6383
|
-
var
|
|
6397
|
+
var gs = i.default = Et;
|
|
6384
6398
|
function qa(a) {
|
|
6385
6399
|
if (a == null)
|
|
6386
6400
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
@@ -6391,7 +6405,7 @@ function Mc() {
|
|
|
6391
6405
|
])
|
|
6392
6406
|
);
|
|
6393
6407
|
});
|
|
6394
|
-
})(
|
|
6408
|
+
})(xs)), xs.exports;
|
|
6395
6409
|
}
|
|
6396
6410
|
var xc = Mc();
|
|
6397
6411
|
const Ec = /* @__PURE__ */ Tc(xc), Ac = "/v1/messenger/bootstrap", $c = 3e4, Rc = 3e4, Pc = 5 * 6e4;
|
|
@@ -6599,18 +6613,18 @@ function Fg(e) {
|
|
|
6599
6613
|
const t = e.initializedEvent ?? "messenger-client:echo-initialized", n = e.bootstrapEndpoint ?? Ac, i = e.bootstrapRefreshSkewMs ?? $c, o = e.presenceFreshnessTtlMs ?? Pc, l = (e.createLogger ?? Xs())("MessengerEcho");
|
|
6600
6614
|
typeof window < "u" && (window.Pusher = Ec);
|
|
6601
6615
|
let u = null, p = null, h = null, w = null, y = "disconnected", k = "available", x = null, M = null, $ = !1;
|
|
6602
|
-
const R = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map(), L = (
|
|
6603
|
-
y =
|
|
6616
|
+
const R = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map(), L = (ee) => {
|
|
6617
|
+
y = ee;
|
|
6604
6618
|
for (const J of R)
|
|
6605
|
-
J(
|
|
6606
|
-
}, ae = (
|
|
6607
|
-
k =
|
|
6619
|
+
J(ee);
|
|
6620
|
+
}, ae = (ee) => {
|
|
6621
|
+
k = ee;
|
|
6608
6622
|
for (const J of A)
|
|
6609
|
-
J(
|
|
6623
|
+
J(ee);
|
|
6610
6624
|
}, de = () => {
|
|
6611
6625
|
M !== null && (clearTimeout(M), M = null);
|
|
6612
|
-
}, E = (
|
|
6613
|
-
h !== null && (h.disconnect(), h = null), w = null,
|
|
6626
|
+
}, E = (ee = !0) => {
|
|
6627
|
+
h !== null && (h.disconnect(), h = null), w = null, ee && L("disconnected");
|
|
6614
6628
|
}, O = () => {
|
|
6615
6629
|
de(), u = null, p = null, x = null, ae("available"), E(), I.clear();
|
|
6616
6630
|
};
|
|
@@ -6625,43 +6639,43 @@ function Fg(e) {
|
|
|
6625
6639
|
}
|
|
6626
6640
|
if (typeof window > "u")
|
|
6627
6641
|
return;
|
|
6628
|
-
const
|
|
6629
|
-
typeof
|
|
6642
|
+
const ee = e.buildLoginRedirectUrl?.();
|
|
6643
|
+
typeof ee == "string" && ee.trim() !== "" && window.location.assign(ee);
|
|
6630
6644
|
}
|
|
6631
6645
|
const ie = () => {
|
|
6632
6646
|
if (!e.getSourceToken)
|
|
6633
6647
|
return null;
|
|
6634
|
-
const
|
|
6635
|
-
return
|
|
6636
|
-
}, q = (
|
|
6637
|
-
if (zc(
|
|
6648
|
+
const ee = e.getSourceToken();
|
|
6649
|
+
return ee === null ? (x !== null || u !== null ? ne() : O(), null) : (x !== null && x !== ee && ($ = !1, de(), u = null, p = null, ae("available"), E()), x = ee, ee);
|
|
6650
|
+
}, q = (ee) => {
|
|
6651
|
+
if (zc(ee.service.apiBaseUrl)) {
|
|
6638
6652
|
const J = ie();
|
|
6639
6653
|
if (J !== null)
|
|
6640
6654
|
return J;
|
|
6641
6655
|
}
|
|
6642
|
-
return
|
|
6643
|
-
}, K = (
|
|
6644
|
-
if (
|
|
6656
|
+
return ee.auth.token;
|
|
6657
|
+
}, K = (ee) => {
|
|
6658
|
+
if (ee === null)
|
|
6645
6659
|
return !1;
|
|
6646
|
-
if (
|
|
6647
|
-
return
|
|
6648
|
-
const J = Date.parse(
|
|
6660
|
+
if (ee.auth.expiresAt === null)
|
|
6661
|
+
return ee.auth.token !== "";
|
|
6662
|
+
const J = Date.parse(ee.auth.expiresAt);
|
|
6649
6663
|
return Number.isNaN(J) ? !1 : J - Date.now() > i;
|
|
6650
|
-
}, ve = (
|
|
6651
|
-
if (de(),
|
|
6664
|
+
}, ve = (ee) => {
|
|
6665
|
+
if (de(), ee.auth.expiresAt === null)
|
|
6652
6666
|
return;
|
|
6653
|
-
const J = Date.parse(
|
|
6667
|
+
const J = Date.parse(ee.auth.expiresAt);
|
|
6654
6668
|
if (Number.isNaN(J))
|
|
6655
6669
|
return;
|
|
6656
6670
|
const he = Math.max(0, J - Date.now() - i);
|
|
6657
6671
|
M = setTimeout(() => {
|
|
6658
6672
|
U();
|
|
6659
6673
|
}, he);
|
|
6660
|
-
}, ce = async (
|
|
6674
|
+
}, ce = async (ee = !1) => e.getSourceToken && ie() === null || !ee && k === "account_suspended" ? null : !ee && K(u) ? u : !ee && p !== null ? await p : (p = (async () => {
|
|
6661
6675
|
try {
|
|
6662
6676
|
const he = await e.bootstrapClient.get(
|
|
6663
6677
|
n,
|
|
6664
|
-
|
|
6678
|
+
ee ? { params: { refresh: 1 } } : void 0
|
|
6665
6679
|
), we = Dc(he.data);
|
|
6666
6680
|
return $ = !1, u = we, ae("available"), ve(we), we;
|
|
6667
6681
|
} catch (he) {
|
|
@@ -6674,16 +6688,16 @@ function Fg(e) {
|
|
|
6674
6688
|
})().finally(() => {
|
|
6675
6689
|
p = null;
|
|
6676
6690
|
}), await p), U = async () => {
|
|
6677
|
-
const
|
|
6691
|
+
const ee = h !== null;
|
|
6678
6692
|
try {
|
|
6679
|
-
if (await ce(!0), !
|
|
6693
|
+
if (await ce(!0), !ee)
|
|
6680
6694
|
return;
|
|
6681
6695
|
E(!1), await ge(!0);
|
|
6682
6696
|
} catch (J) {
|
|
6683
6697
|
l.warn("Failed to refresh messenger bootstrap", J);
|
|
6684
6698
|
}
|
|
6685
|
-
}, H = (
|
|
6686
|
-
const J =
|
|
6699
|
+
}, H = (ee) => {
|
|
6700
|
+
const J = ee.connector?.pusher?.connection;
|
|
6687
6701
|
if (!J) {
|
|
6688
6702
|
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6689
6703
|
return;
|
|
@@ -6710,8 +6724,8 @@ function Fg(e) {
|
|
|
6710
6724
|
}
|
|
6711
6725
|
(we === "unavailable" || we === "failed" || we === "disconnected") && L("disconnected");
|
|
6712
6726
|
}), J.state === "connected" && L("connected");
|
|
6713
|
-
}, ge = async (
|
|
6714
|
-
const he = await ce(
|
|
6727
|
+
}, ge = async (ee = !1) => !ee && h !== null && K(u) ? h : !ee && w !== null ? await w : (w = (async () => {
|
|
6728
|
+
const he = await ce(ee);
|
|
6715
6729
|
if (he === null)
|
|
6716
6730
|
return null;
|
|
6717
6731
|
h !== null && E(!1);
|
|
@@ -6736,7 +6750,7 @@ function Fg(e) {
|
|
|
6736
6750
|
return he.service.reverb.path && (Pe.wsPath = he.service.reverb.path), h = new Sc(Pe), H(h), L("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(t)), h;
|
|
6737
6751
|
})().finally(() => {
|
|
6738
6752
|
w = null;
|
|
6739
|
-
}), await w), pe =
|
|
6753
|
+
}), await w), pe = Ns.create({
|
|
6740
6754
|
timeout: e.requestTimeoutMs ?? Rc,
|
|
6741
6755
|
withCredentials: !1,
|
|
6742
6756
|
headers: {
|
|
@@ -6744,33 +6758,38 @@ function Fg(e) {
|
|
|
6744
6758
|
"X-Requested-With": "XMLHttpRequest"
|
|
6745
6759
|
}
|
|
6746
6760
|
});
|
|
6747
|
-
pe.interceptors.request.use(async (
|
|
6761
|
+
pe.interceptors.request.use(async (ee) => {
|
|
6748
6762
|
const J = await ce();
|
|
6749
6763
|
if (J === null)
|
|
6750
6764
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6751
|
-
return
|
|
6765
|
+
return ee.baseURL = J.service.apiBaseUrl, qi(ee, q(J)), ee;
|
|
6752
6766
|
}), pe.interceptors.response.use(
|
|
6753
|
-
(
|
|
6754
|
-
async (
|
|
6755
|
-
const J =
|
|
6756
|
-
if (
|
|
6767
|
+
(ee) => ee,
|
|
6768
|
+
async (ee) => {
|
|
6769
|
+
const J = ee.config;
|
|
6770
|
+
if (ee.response?.status === 401 && J && J._messengerRetry !== !0) {
|
|
6757
6771
|
J._messengerRetry = !0;
|
|
6758
6772
|
const he = await ce(!0);
|
|
6759
6773
|
if (he !== null)
|
|
6760
6774
|
return J.baseURL = he.service.apiBaseUrl, qi(J, q(he)), await pe(J);
|
|
6761
6775
|
}
|
|
6762
|
-
|
|
6776
|
+
if (ee.response?.status === 401) {
|
|
6777
|
+
if (J?._messengerSuppressAuthInvalidation === !0)
|
|
6778
|
+
return Promise.reject(ee);
|
|
6779
|
+
ne();
|
|
6780
|
+
}
|
|
6781
|
+
return Promise.reject(ee);
|
|
6763
6782
|
}
|
|
6764
6783
|
);
|
|
6765
|
-
const V = () => k === "account_suspended" ? null : h, G = (
|
|
6766
|
-
R.delete(
|
|
6767
|
-
}), P = (
|
|
6768
|
-
A.delete(
|
|
6769
|
-
}), v = () => u?.auth.tenantId ?? "global", f = (
|
|
6770
|
-
const J =
|
|
6784
|
+
const V = () => k === "account_suspended" ? null : h, G = (ee) => (R.add(ee), ee(y), () => {
|
|
6785
|
+
R.delete(ee);
|
|
6786
|
+
}), P = (ee) => (A.add(ee), ee(k), () => {
|
|
6787
|
+
A.delete(ee);
|
|
6788
|
+
}), v = () => u?.auth.tenantId ?? "global", f = (ee) => {
|
|
6789
|
+
const J = Is(ee.ts)?.getTime() ?? Is(ee.last_seen_at)?.getTime() ?? null;
|
|
6771
6790
|
if (J === null)
|
|
6772
6791
|
return !0;
|
|
6773
|
-
const he = `${
|
|
6792
|
+
const he = `${ee.tenant_scope ?? "global"}:${ee.user_id}`, we = I.get(he);
|
|
6774
6793
|
if (we && J < we.timestampMs)
|
|
6775
6794
|
return !1;
|
|
6776
6795
|
const Pe = Date.now();
|
|
@@ -6781,7 +6800,7 @@ function Fg(e) {
|
|
|
6781
6800
|
for (const [X, j] of I.entries())
|
|
6782
6801
|
Pe - j.seenAt > o && I.delete(X);
|
|
6783
6802
|
return !0;
|
|
6784
|
-
}, T = (
|
|
6803
|
+
}, T = (ee) => {
|
|
6785
6804
|
const J = V();
|
|
6786
6805
|
if (!J || typeof J.join != "function")
|
|
6787
6806
|
return;
|
|
@@ -6798,12 +6817,12 @@ function Fg(e) {
|
|
|
6798
6817
|
for (const Pe of we)
|
|
6799
6818
|
he.listen(Pe, (X) => {
|
|
6800
6819
|
const j = Bc(X, v());
|
|
6801
|
-
!j || !f(j) ||
|
|
6820
|
+
!j || !f(j) || ee(j);
|
|
6802
6821
|
});
|
|
6803
6822
|
}, re = () => {
|
|
6804
6823
|
h?.leave(`online-users.${v()}`);
|
|
6805
6824
|
};
|
|
6806
|
-
function Ce(
|
|
6825
|
+
function Ce(ee, J) {
|
|
6807
6826
|
const he = [];
|
|
6808
6827
|
function we(Pe, X, j) {
|
|
6809
6828
|
if (!j)
|
|
@@ -6811,19 +6830,19 @@ function Fg(e) {
|
|
|
6811
6830
|
const z = (Ie) => {
|
|
6812
6831
|
X(Ie) && j(Ie);
|
|
6813
6832
|
};
|
|
6814
|
-
|
|
6833
|
+
ee.bind(Pe, z), he.push({ event: Pe, handler: z });
|
|
6815
6834
|
}
|
|
6816
6835
|
return we("ConversationMessageSent", Vi, J.onMessageSent), we("ConversationMessageRead", Wi, J.onMessageRead), we("ConversationMessageEdited", Gi, J.onMessageEdited), we("ConversationMessageDeleted", Xi, J.onMessageDeleted), we("MessageReactionToggled", Ki, J.onReactionToggled), we("ConversationRequestAccepted", Yi, J.onRequestAccepted), we("ConversationParticipantRemoved", Ji, J.onParticipantRemoved), () => {
|
|
6817
6836
|
for (const Pe of he)
|
|
6818
|
-
|
|
6837
|
+
ee.unbind(Pe.event, Pe.handler);
|
|
6819
6838
|
};
|
|
6820
6839
|
}
|
|
6821
|
-
const Se = (
|
|
6840
|
+
const Se = (ee, J) => {
|
|
6822
6841
|
const he = V();
|
|
6823
6842
|
if (!he)
|
|
6824
6843
|
return () => {
|
|
6825
6844
|
};
|
|
6826
|
-
const we = he.private(`conversation.${
|
|
6845
|
+
const we = he.private(`conversation.${ee}`), Pe = we.subscription;
|
|
6827
6846
|
if (Pe)
|
|
6828
6847
|
return Ce(Pe, J);
|
|
6829
6848
|
const X = [];
|
|
@@ -6853,18 +6872,18 @@ function Fg(e) {
|
|
|
6853
6872
|
for (const j of X)
|
|
6854
6873
|
we.stopListening(j.event, j.handler);
|
|
6855
6874
|
};
|
|
6856
|
-
}, ye = (
|
|
6857
|
-
h?.leave(`conversation.${
|
|
6858
|
-
}, ft = (
|
|
6875
|
+
}, ye = (ee) => {
|
|
6876
|
+
h?.leave(`conversation.${ee}`);
|
|
6877
|
+
}, ft = (ee, J, he) => {
|
|
6859
6878
|
if (J.subscription)
|
|
6860
6879
|
return J.subscription;
|
|
6861
|
-
const we =
|
|
6880
|
+
const we = ee.connector?.pusher;
|
|
6862
6881
|
if (!we || typeof we.channel != "function")
|
|
6863
6882
|
return null;
|
|
6864
6883
|
const Pe = he.startsWith("private-") ? he : `private-${he}`;
|
|
6865
6884
|
return we.channel(Pe) ?? null;
|
|
6866
|
-
}, nt = (
|
|
6867
|
-
const we = `typing-conversation.${J}`, Pe =
|
|
6885
|
+
}, nt = (ee, J, he) => {
|
|
6886
|
+
const we = `typing-conversation.${J}`, Pe = ee.private(we), X = /* @__PURE__ */ new Set(["start", "typing"]), j = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), z = ft(ee, Pe, we);
|
|
6868
6887
|
if (z) {
|
|
6869
6888
|
const _e = (Re) => {
|
|
6870
6889
|
const Te = Hi(Re);
|
|
@@ -6919,13 +6938,13 @@ function Fg(e) {
|
|
|
6919
6938
|
for (const _e of Ie)
|
|
6920
6939
|
Pe.stopListening(_e.event, _e.handler);
|
|
6921
6940
|
};
|
|
6922
|
-
}, Ye = (
|
|
6941
|
+
}, Ye = (ee, J) => {
|
|
6923
6942
|
const he = V();
|
|
6924
6943
|
if (he)
|
|
6925
|
-
return nt(he,
|
|
6944
|
+
return nt(he, ee, J);
|
|
6926
6945
|
let we = !1, Pe = null;
|
|
6927
6946
|
const X = (z) => {
|
|
6928
|
-
we || z && (Pe = nt(z,
|
|
6947
|
+
we || z && (Pe = nt(z, ee, J), typeof window < "u" && window.removeEventListener(t, j));
|
|
6929
6948
|
}, j = () => {
|
|
6930
6949
|
X(V());
|
|
6931
6950
|
};
|
|
@@ -6934,8 +6953,8 @@ function Fg(e) {
|
|
|
6934
6953
|
}), () => {
|
|
6935
6954
|
we = !0, typeof window < "u" && window.removeEventListener(t, j), Pe?.();
|
|
6936
6955
|
};
|
|
6937
|
-
}, mt = (
|
|
6938
|
-
h?.leave(`typing-conversation.${
|
|
6956
|
+
}, mt = (ee) => {
|
|
6957
|
+
h?.leave(`typing-conversation.${ee}`);
|
|
6939
6958
|
}, dt = async () => {
|
|
6940
6959
|
ae("available"), E(), await ge(!0);
|
|
6941
6960
|
}, Ze = async () => k === "account_suspended" ? null : await ge();
|
|
@@ -6958,11 +6977,11 @@ function Fg(e) {
|
|
|
6958
6977
|
clearRuntime: O
|
|
6959
6978
|
};
|
|
6960
6979
|
}
|
|
6961
|
-
const
|
|
6980
|
+
const Es = 3, ea = ur("chatWidget", {
|
|
6962
6981
|
state: () => ({
|
|
6963
6982
|
panelOpen: !1,
|
|
6964
6983
|
openWindows: [],
|
|
6965
|
-
maxWindows:
|
|
6984
|
+
maxWindows: Es
|
|
6966
6985
|
}),
|
|
6967
6986
|
getters: {
|
|
6968
6987
|
isWindowOpen: (e) => (t) => e.openWindows.some((n) => n.conversationId === t),
|
|
@@ -6981,7 +7000,7 @@ const xs = 3, ea = ur("chatWidget", {
|
|
|
6981
7000
|
this.panelOpen = !1;
|
|
6982
7001
|
},
|
|
6983
7002
|
setMaxWindows(e) {
|
|
6984
|
-
const t = Number.isFinite(e) ? Math.max(1, Math.min(
|
|
7003
|
+
const t = Number.isFinite(e) ? Math.max(1, Math.min(Es, Math.floor(e))) : Es;
|
|
6985
7004
|
for (this.maxWindows = t; this.openWindows.length > this.maxWindows; )
|
|
6986
7005
|
this.openWindows.shift();
|
|
6987
7006
|
},
|
|
@@ -7044,13 +7063,13 @@ function Xc(e) {
|
|
|
7044
7063
|
const t = e.replace(/\s+/g, "");
|
|
7045
7064
|
return t.length === 0 ? !1 : new RegExp("^(?:\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Regional_Indicator}{2}|\\uD83C[\\uDFF4][\\uDB40][\\uDC60-\\uDC7F]{1,6}|\\p{Emoji}\\u200D\\p{Emoji})+$", "u").test(t);
|
|
7046
7065
|
}
|
|
7047
|
-
function
|
|
7066
|
+
function Os(e) {
|
|
7048
7067
|
return Kn(e);
|
|
7049
7068
|
}
|
|
7050
7069
|
function Kc(e, t) {
|
|
7051
7070
|
return io(
|
|
7052
|
-
|
|
7053
|
-
|
|
7071
|
+
Os(e.created_at),
|
|
7072
|
+
Os(t.created_at)
|
|
7054
7073
|
);
|
|
7055
7074
|
}
|
|
7056
7075
|
function Yc(e, t) {
|
|
@@ -7063,7 +7082,7 @@ function Yc(e, t) {
|
|
|
7063
7082
|
return i ? !Kc(i, n) : !0;
|
|
7064
7083
|
}
|
|
7065
7084
|
function Jc(e) {
|
|
7066
|
-
const t =
|
|
7085
|
+
const t = Os(e.created_at);
|
|
7067
7086
|
if (hr(t))
|
|
7068
7087
|
return "Today";
|
|
7069
7088
|
if (fr(t))
|
|
@@ -7080,7 +7099,7 @@ const Ng = (e, t, n, i) => {
|
|
|
7080
7099
|
}, Qc = (e) => {
|
|
7081
7100
|
const t = e.scrollHeight ?? 0, n = e.clientHeight ?? 0;
|
|
7082
7101
|
return Math.max(0, t - e.scrollTop - n);
|
|
7083
|
-
},
|
|
7102
|
+
}, As = (e, t = 72) => Qc(e) <= t, eu = (e, t, n = 80, i = "smooth") => {
|
|
7084
7103
|
if (typeof e.scrollTo == "function") {
|
|
7085
7104
|
e.scrollTo({ top: t, behavior: i }), setTimeout(() => {
|
|
7086
7105
|
Math.abs(e.scrollTop - t) > 1 && (e.scrollTop = t);
|
|
@@ -7088,10 +7107,10 @@ const Ng = (e, t, n, i) => {
|
|
|
7088
7107
|
return;
|
|
7089
7108
|
}
|
|
7090
7109
|
e.scrollTop = t;
|
|
7091
|
-
},
|
|
7092
|
-
|
|
7110
|
+
}, as = /* @__PURE__ */ new Map(), tu = (e) => as.get(e) ?? 0, nu = (e) => as.has(e), Zi = (e, t) => {
|
|
7111
|
+
as.set(e, Math.max(0, t));
|
|
7093
7112
|
}, zg = (e) => {
|
|
7094
|
-
|
|
7113
|
+
as.delete(e);
|
|
7095
7114
|
}, su = (e, t, n) => {
|
|
7096
7115
|
if (!e || e.unread_count <= 0 || t.length === 0)
|
|
7097
7116
|
return null;
|
|
@@ -7116,7 +7135,7 @@ function ru() {
|
|
|
7116
7135
|
function au(e) {
|
|
7117
7136
|
return typeof e == "function";
|
|
7118
7137
|
}
|
|
7119
|
-
function
|
|
7138
|
+
function Ds(e, t) {
|
|
7120
7139
|
if (!e) return;
|
|
7121
7140
|
const n = Array.isArray(e) ? e : [e];
|
|
7122
7141
|
for (const i of n)
|
|
@@ -7136,10 +7155,10 @@ function Os(e, t) {
|
|
|
7136
7155
|
function ou() {
|
|
7137
7156
|
const e = {
|
|
7138
7157
|
fromTo(t, n, i, o) {
|
|
7139
|
-
return
|
|
7158
|
+
return Ds(t, i), e;
|
|
7140
7159
|
},
|
|
7141
7160
|
to(t, n, i) {
|
|
7142
|
-
return
|
|
7161
|
+
return Ds(t, n), e;
|
|
7143
7162
|
}
|
|
7144
7163
|
};
|
|
7145
7164
|
return e;
|
|
@@ -7149,7 +7168,7 @@ function lu() {
|
|
|
7149
7168
|
return {
|
|
7150
7169
|
shouldAnimate: e !== null,
|
|
7151
7170
|
set(n, i) {
|
|
7152
|
-
e ? e.set(n, i) :
|
|
7171
|
+
e ? e.set(n, i) : Ds(n, i);
|
|
7153
7172
|
},
|
|
7154
7173
|
timeline() {
|
|
7155
7174
|
return e ? e.timeline() : ou();
|
|
@@ -7945,7 +7964,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
7945
7964
|
)?.focus()) : document.removeEventListener("keydown", H);
|
|
7946
7965
|
}), We(k, (v) => {
|
|
7947
7966
|
L(v);
|
|
7948
|
-
}, { immediate: !0 }),
|
|
7967
|
+
}, { immediate: !0 }), Fs(() => {
|
|
7949
7968
|
document.removeEventListener("keydown", H);
|
|
7950
7969
|
for (const [v] of w)
|
|
7951
7970
|
R(v);
|
|
@@ -8047,7 +8066,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8047
8066
|
])
|
|
8048
8067
|
], 42, Lu))), 128))
|
|
8049
8068
|
], 16, Tu),
|
|
8050
|
-
(m(), it(
|
|
8069
|
+
(m(), it(ss, { to: "body" }, [
|
|
8051
8070
|
i.value ? (m(), b("div", {
|
|
8052
8071
|
key: 0,
|
|
8053
8072
|
ref_key: "lightboxOverlayRef",
|
|
@@ -8254,7 +8273,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8254
8273
|
},
|
|
8255
8274
|
emits: ["edit", "delete", "copy", "retry", "react", "reply", "scroll-to-message"],
|
|
8256
8275
|
setup(e, { emit: t }) {
|
|
8257
|
-
const n = e, i = t, o = It()(), l =
|
|
8276
|
+
const n = e, i = t, o = It()(), l = is(), { term: u } = Vr(), p = ri(), h = N(!1), w = N(!1), y = N(""), k = N(!1), x = N(!1), M = N(!0), $ = N(null), R = N(null), A = N(null), I = N(null), L = N(null), ae = /* @__PURE__ */ new Map(), de = N(null), E = N(null);
|
|
8258
8277
|
let O, ne, ie = null, q = 0, K = 0, ve = !1;
|
|
8259
8278
|
const ce = [
|
|
8260
8279
|
{ type: "heart", emoji: "❤️", label: "heart" },
|
|
@@ -8333,7 +8352,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8333
8352
|
}), mt = C(() => {
|
|
8334
8353
|
const S = Kn(n.message.created_at);
|
|
8335
8354
|
return cn(S, "EEEE, MMM d, yyyy h:mm a");
|
|
8336
|
-
}), dt = C(() => x.value && !n.isLastInGroup && !n.message.is_deleted), Ze = C(() => n.message.id.startsWith("temp-") ? "sending" : n.isReadByOther ? "read" : "sent"),
|
|
8355
|
+
}), dt = C(() => x.value && !n.isLastInGroup && !n.message.is_deleted), Ze = C(() => n.message.id.startsWith("temp-") ? "sending" : n.isReadByOther ? "read" : "sent"), ee = C(() => {
|
|
8337
8356
|
if (!n.isOwnMessage || n.message.is_deleted) return !1;
|
|
8338
8357
|
const S = Date.now() - new Date(n.message.created_at).getTime(), Z = 900 * 1e3;
|
|
8339
8358
|
return S < Z;
|
|
@@ -8404,14 +8423,14 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8404
8423
|
clearTimeout(O);
|
|
8405
8424
|
}, se = () => {
|
|
8406
8425
|
ie = null, q = 0, K = 0;
|
|
8407
|
-
},
|
|
8426
|
+
}, te = (S, Z, Ae) => {
|
|
8408
8427
|
ue(), ie = Ae, q = S, K = Z, O = setTimeout(() => {
|
|
8409
8428
|
se(), ve = !0, me();
|
|
8410
8429
|
}, Yd);
|
|
8411
8430
|
}, je = () => {
|
|
8412
8431
|
ue(), se();
|
|
8413
8432
|
}, Qe = (S, Z) => Math.hypot(S - q, Z - K) > Jd, st = (S) => {
|
|
8414
|
-
S.pointerType === "mouse" || jt(S.target) ||
|
|
8433
|
+
S.pointerType === "mouse" || jt(S.target) || te(S.clientX, S.clientY, S.pointerId);
|
|
8415
8434
|
}, $t = (S) => {
|
|
8416
8435
|
S.pointerId === ie && Qe(S.clientX, S.clientY) && je();
|
|
8417
8436
|
}, Rt = (S) => {
|
|
@@ -8522,7 +8541,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8522
8541
|
},
|
|
8523
8542
|
{ deep: !0 }
|
|
8524
8543
|
);
|
|
8525
|
-
const
|
|
8544
|
+
const os = (S) => {
|
|
8526
8545
|
if (ue(), S.touches.length !== 1 || jt(S.target)) {
|
|
8527
8546
|
se();
|
|
8528
8547
|
return;
|
|
@@ -8532,8 +8551,8 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8532
8551
|
se();
|
|
8533
8552
|
return;
|
|
8534
8553
|
}
|
|
8535
|
-
|
|
8536
|
-
},
|
|
8554
|
+
te(Z.clientX, Z.clientY, null);
|
|
8555
|
+
}, ls = (S) => {
|
|
8537
8556
|
if (S.touches.length !== 1) {
|
|
8538
8557
|
je();
|
|
8539
8558
|
return;
|
|
@@ -8556,13 +8575,13 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8556
8575
|
function Dn() {
|
|
8557
8576
|
B(), i("reply", n.message.id);
|
|
8558
8577
|
}
|
|
8559
|
-
const
|
|
8578
|
+
const cs = () => {
|
|
8560
8579
|
D();
|
|
8561
|
-
}, cs = () => {
|
|
8562
|
-
_();
|
|
8563
8580
|
}, us = () => {
|
|
8564
|
-
|
|
8581
|
+
_();
|
|
8565
8582
|
}, ds = () => {
|
|
8583
|
+
D();
|
|
8584
|
+
}, hs = () => {
|
|
8566
8585
|
window.setTimeout(() => {
|
|
8567
8586
|
if (!k.value)
|
|
8568
8587
|
return;
|
|
@@ -8605,7 +8624,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8605
8624
|
handler: () => {
|
|
8606
8625
|
Xt();
|
|
8607
8626
|
}
|
|
8608
|
-
}),
|
|
8627
|
+
}), ee.value && S.push({
|
|
8609
8628
|
text: "Edit",
|
|
8610
8629
|
icon: "createOutline",
|
|
8611
8630
|
handler: () => {
|
|
@@ -8635,7 +8654,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8635
8654
|
B(), y.value = n.message.body || "", h.value = !0;
|
|
8636
8655
|
}, yn = () => {
|
|
8637
8656
|
h.value = !1, y.value = "";
|
|
8638
|
-
},
|
|
8657
|
+
}, fs = () => {
|
|
8639
8658
|
const S = y.value.trim();
|
|
8640
8659
|
if (!S || S === n.message.body) {
|
|
8641
8660
|
yn();
|
|
@@ -8650,7 +8669,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8650
8669
|
} catch {
|
|
8651
8670
|
}
|
|
8652
8671
|
}
|
|
8653
|
-
},
|
|
8672
|
+
}, ms = () => {
|
|
8654
8673
|
const S = qe.value;
|
|
8655
8674
|
S && l.push(S);
|
|
8656
8675
|
}, _n = () => {
|
|
@@ -8660,7 +8679,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8660
8679
|
S && l.push(S);
|
|
8661
8680
|
}, Fn = () => {
|
|
8662
8681
|
B(), w.value = !0;
|
|
8663
|
-
},
|
|
8682
|
+
}, ps = () => {
|
|
8664
8683
|
w.value = !1;
|
|
8665
8684
|
}, Nn = () => {
|
|
8666
8685
|
w.value = !1, vn();
|
|
@@ -8792,10 +8811,10 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8792
8811
|
"aria-label": `React with ${Ae.label}`,
|
|
8793
8812
|
onPointerdown: Z[0] || (Z[0] = Ve(() => {
|
|
8794
8813
|
}, ["stop"])),
|
|
8795
|
-
onMouseenter:
|
|
8796
|
-
onMouseleave:
|
|
8797
|
-
onFocus:
|
|
8798
|
-
onBlur:
|
|
8814
|
+
onMouseenter: cs,
|
|
8815
|
+
onMouseleave: us,
|
|
8816
|
+
onFocus: ds,
|
|
8817
|
+
onBlur: hs,
|
|
8799
8818
|
onKeydown: Dt(Ve(B, ["prevent"]), ["esc"]),
|
|
8800
8819
|
onClick: Ve((bt) => fn(Ae.type, bt), ["stop"])
|
|
8801
8820
|
}, Q(Ae.emoji), 41, ud)), 64))
|
|
@@ -8827,8 +8846,8 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8827
8846
|
role: "button",
|
|
8828
8847
|
"aria-label": "Message actions",
|
|
8829
8848
|
onContextmenu: Ve(Jt, ["prevent"]),
|
|
8830
|
-
onTouchstart:
|
|
8831
|
-
onTouchmove:
|
|
8849
|
+
onTouchstart: os,
|
|
8850
|
+
onTouchmove: ls,
|
|
8832
8851
|
onTouchend: Ln,
|
|
8833
8852
|
onTouchcancel: Ln,
|
|
8834
8853
|
onMouseenter: On,
|
|
@@ -8878,7 +8897,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
8878
8897
|
class: xe(["shared-post-embed", e.isOwnMessage ? "shared-post-embed--own" : "shared-post-embed--other"]),
|
|
8879
8898
|
"data-testid": `card-shared-post-${e.message.id}`,
|
|
8880
8899
|
"aria-label": `View shared ${Re.value}`,
|
|
8881
|
-
onClick:
|
|
8900
|
+
onClick: ms
|
|
8882
8901
|
}, [
|
|
8883
8902
|
c("div", wd, [
|
|
8884
8903
|
zt.value ? (m(), b("img", {
|
|
@@ -9030,7 +9049,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9030
9049
|
class: "w-3.5 h-3.5"
|
|
9031
9050
|
})
|
|
9032
9051
|
], 8, jd)),
|
|
9033
|
-
|
|
9052
|
+
ee.value ? (m(), b("button", {
|
|
9034
9053
|
key: 2,
|
|
9035
9054
|
type: "button",
|
|
9036
9055
|
class: "msg-action-btn",
|
|
@@ -9102,7 +9121,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9102
9121
|
class: "px-4 py-2 text-sm font-medium text-white rounded-lg transition-all disabled:opacity-40 disabled:cursor-not-allowed edit-modal-save",
|
|
9103
9122
|
"data-testid": "btn-save-edit",
|
|
9104
9123
|
"aria-label": "Save edited message",
|
|
9105
|
-
onClick:
|
|
9124
|
+
onClick: fs
|
|
9106
9125
|
}, " Save ", 8, Gd)
|
|
9107
9126
|
])
|
|
9108
9127
|
])
|
|
@@ -9126,7 +9145,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9126
9145
|
class: "px-4 py-2 text-sm font-medium rounded-lg transition-colors edit-modal-cancel",
|
|
9127
9146
|
"data-testid": "btn-cancel-delete",
|
|
9128
9147
|
"aria-label": "Cancel deleting message",
|
|
9129
|
-
onClick:
|
|
9148
|
+
onClick: ps
|
|
9130
9149
|
}, " Cancel "),
|
|
9131
9150
|
c("button", {
|
|
9132
9151
|
class: "px-4 py-2 text-sm font-medium text-white rounded-lg transition-all edit-modal-save",
|
|
@@ -9457,13 +9476,13 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9457
9476
|
U = null, ne.value = !1;
|
|
9458
9477
|
}, 260));
|
|
9459
9478
|
}), We(() => i.disabled, (_) => {
|
|
9460
|
-
_ && (Ge(),
|
|
9479
|
+
_ && (Ge(), ee());
|
|
9461
9480
|
}), We(() => i.replyToMessage, async (_, B) => {
|
|
9462
9481
|
_ !== B && (dt(), !(_ === null || i.disabled || R.value) && (Ge(), await X()));
|
|
9463
9482
|
});
|
|
9464
9483
|
const dt = () => {
|
|
9465
9484
|
L.value = !1, ae.value = "";
|
|
9466
|
-
}, Ze = (_) => _ === null ? !1 : Array.from(_.types).includes("Files"),
|
|
9485
|
+
}, Ze = (_) => _ === null ? !1 : Array.from(_.types).includes("Files"), ee = () => {
|
|
9467
9486
|
H = 0, O.value = !1;
|
|
9468
9487
|
}, J = (_) => {
|
|
9469
9488
|
const B = _.target;
|
|
@@ -9536,12 +9555,12 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9536
9555
|
Ze(_.dataTransfer) && (_.preventDefault(), H = Math.max(0, H - 1), H === 0 && (O.value = !1));
|
|
9537
9556
|
}, zt = async (_) => {
|
|
9538
9557
|
if (i.disabled || R.value || !Ze(_.dataTransfer)) {
|
|
9539
|
-
|
|
9558
|
+
ee();
|
|
9540
9559
|
return;
|
|
9541
9560
|
}
|
|
9542
9561
|
_.preventDefault();
|
|
9543
9562
|
const B = Array.from(_.dataTransfer?.files ?? []);
|
|
9544
|
-
|
|
9563
|
+
ee(), B.length !== 0 && await Pt(B);
|
|
9545
9564
|
}, Ge = () => {
|
|
9546
9565
|
I.value = !1;
|
|
9547
9566
|
}, pt = C(() => {
|
|
@@ -9595,8 +9614,8 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9595
9614
|
attributes: !0,
|
|
9596
9615
|
attributeFilter: ["class", "style", "aria-hidden", "hidden"]
|
|
9597
9616
|
}));
|
|
9598
|
-
}),
|
|
9599
|
-
v(), Ge(), ge(), G(),
|
|
9617
|
+
}), Fs(() => {
|
|
9618
|
+
v(), Ge(), ge(), G(), ee(), p.value?.removeEventListener("dragenter", _e), p.value?.removeEventListener("dragover", Re), p.value?.removeEventListener("dragleave", Te), p.value?.removeEventListener("drop", zt), st && (st.dismiss().catch(() => {
|
|
9600
9619
|
}), st = null), document.removeEventListener("pointerdown", qe, !0), document.removeEventListener("mousedown", qe, !0), document.removeEventListener("touchstart", qe, !0), document.removeEventListener("click", qe, !0), document.removeEventListener("keydown", wt), he?.removeEventListener("input", Ie), he?.removeEventListener("paste", Ne), kt?.disconnect(), kt = null, he = null, q.cleanup();
|
|
9601
9620
|
});
|
|
9602
9621
|
const xt = (_) => {
|
|
@@ -9626,7 +9645,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9626
9645
|
_ - ve > Oh && (l("typing"), ve = _), P(), K = setTimeout(() => {
|
|
9627
9646
|
K = null, l("stop-typing");
|
|
9628
9647
|
}, Dh);
|
|
9629
|
-
},
|
|
9648
|
+
}, te = () => {
|
|
9630
9649
|
R.value || i.disabled || (z(), re.value ? je() : (M.value = "👍", ct(() => {
|
|
9631
9650
|
je();
|
|
9632
9651
|
})));
|
|
@@ -9840,7 +9859,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9840
9859
|
class: "send-failed-retry-btn",
|
|
9841
9860
|
"data-testid": "btn-retry-send",
|
|
9842
9861
|
"aria-label": "Retry sending message",
|
|
9843
|
-
onClick:
|
|
9862
|
+
onClick: te
|
|
9844
9863
|
}, " Retry "),
|
|
9845
9864
|
c("button", {
|
|
9846
9865
|
type: "button",
|
|
@@ -9921,7 +9940,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9921
9940
|
}, [
|
|
9922
9941
|
$e(He, { name: "happyOutline" })
|
|
9923
9942
|
], 8, Ih),
|
|
9924
|
-
(m(), it(
|
|
9943
|
+
(m(), it(ss, { to: "body" }, [
|
|
9925
9944
|
I.value ? (m(), b("button", {
|
|
9926
9945
|
key: 0,
|
|
9927
9946
|
type: "button",
|
|
@@ -9955,7 +9974,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
9955
9974
|
disabled: R.value || e.disabled,
|
|
9956
9975
|
"data-testid": Ye.value,
|
|
9957
9976
|
"aria-label": re.value ? "Send message" : R.value ? "Uploading..." : "Send a like",
|
|
9958
|
-
onClick:
|
|
9977
|
+
onClick: te
|
|
9959
9978
|
}, [
|
|
9960
9979
|
$e(He, {
|
|
9961
9980
|
name: Se.value,
|
|
@@ -10033,7 +10052,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10033
10052
|
class: "chat-window__jump-latest-badge",
|
|
10034
10053
|
"data-testid": "badge-chat-window-jump-count",
|
|
10035
10054
|
"aria-hidden": "true"
|
|
10036
|
-
}, ff = ["data-testid"],
|
|
10055
|
+
}, ff = ["data-testid"], $s = 84, mf = 300 * 1e3, pf = 600 * 1e3, vf = /* @__PURE__ */ ot({
|
|
10037
10056
|
__name: "ChatWindow",
|
|
10038
10057
|
props: {
|
|
10039
10058
|
conversationId: {},
|
|
@@ -10084,7 +10103,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10084
10103
|
}), re = C(() => qe(v.value)), Ce = C(() => {
|
|
10085
10104
|
const D = H.value;
|
|
10086
10105
|
if (!D || D.type !== "dm") return !1;
|
|
10087
|
-
const le =
|
|
10106
|
+
const le = Zn(
|
|
10088
10107
|
D.other_presence_status ?? null,
|
|
10089
10108
|
D.other_last_seen_at ?? null
|
|
10090
10109
|
);
|
|
@@ -10132,7 +10151,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10132
10151
|
}
|
|
10133
10152
|
return be;
|
|
10134
10153
|
}), mt = C(() => n.hasMoreMessages(t.conversationId)), dt = C(() => n.typingUsers[t.conversationId] ?? []), Ze = C(() => o.currentUser?.id), {
|
|
10135
|
-
clearVisibleTypingUsers:
|
|
10154
|
+
clearVisibleTypingUsers: ee,
|
|
10136
10155
|
hasVisibleTypingUsers: J,
|
|
10137
10156
|
visibleTypingUsers: he
|
|
10138
10157
|
} = Ql({
|
|
@@ -10235,12 +10254,12 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10235
10254
|
const D = h.value;
|
|
10236
10255
|
if (!(D instanceof HTMLElement))
|
|
10237
10256
|
return;
|
|
10238
|
-
const le =
|
|
10257
|
+
const le = As(D, $s);
|
|
10239
10258
|
E.value = le, O.value = !le, Zi(ce.value, D.scrollTop), le && ((H.value?.unread_count ?? 0) > 0 || ie.value !== null || ne.value > 0) && (ie.value = null, ne.value = 0, O.value = !1, lt());
|
|
10240
10259
|
}
|
|
10241
10260
|
function kt(D = !1) {
|
|
10242
10261
|
if (h.value) {
|
|
10243
|
-
if (!D && !
|
|
10262
|
+
if (!D && !As(h.value, $s)) {
|
|
10244
10263
|
E.value = !1, O.value = !0;
|
|
10245
10264
|
return;
|
|
10246
10265
|
}
|
|
@@ -10315,17 +10334,17 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10315
10334
|
} : null;
|
|
10316
10335
|
_ && ($.value = null);
|
|
10317
10336
|
try {
|
|
10318
|
-
await n.sendMessage(t.conversationId, be, le, B, me), M.value = "",
|
|
10337
|
+
await n.sendMessage(t.conversationId, be, le, B, me), M.value = "", te(), await ct(), kt(!0), lt();
|
|
10319
10338
|
} catch (Ee) {
|
|
10320
10339
|
throw _ && ($.value = _), Ee;
|
|
10321
10340
|
}
|
|
10322
10341
|
}
|
|
10323
10342
|
function se() {
|
|
10324
10343
|
K || (K = !0, n.sendTyping(t.conversationId, "start")), q && clearTimeout(q), q = setTimeout(() => {
|
|
10325
|
-
|
|
10344
|
+
te();
|
|
10326
10345
|
}, 3e3);
|
|
10327
10346
|
}
|
|
10328
|
-
function
|
|
10347
|
+
function te() {
|
|
10329
10348
|
q && (clearTimeout(q), q = null), K && (n.sendTyping(t.conversationId, "stop"), K = !1);
|
|
10330
10349
|
}
|
|
10331
10350
|
async function je() {
|
|
@@ -10431,7 +10450,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10431
10450
|
(D, le) => {
|
|
10432
10451
|
if (t.minimized || !D || D === le)
|
|
10433
10452
|
return;
|
|
10434
|
-
const be = h.value instanceof HTMLElement &&
|
|
10453
|
+
const be = h.value instanceof HTMLElement && As(h.value, $s);
|
|
10435
10454
|
if (!E.value || !be) {
|
|
10436
10455
|
E.value = !1;
|
|
10437
10456
|
const _ = ye.value.at(-1);
|
|
@@ -10452,7 +10471,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10452
10471
|
), Yt(() => {
|
|
10453
10472
|
Array.isArray(n.messages[t.conversationId]) && X(), l(), u(), Be(), _e.setupInfiniteObserver(), t.minimized || lt();
|
|
10454
10473
|
}), Nt(() => {
|
|
10455
|
-
|
|
10474
|
+
ee(), ae.value = [], te(), p(), _e.destroyInfiniteObserver(), U.cleanup();
|
|
10456
10475
|
}), (D, le) => (m(), b("div", {
|
|
10457
10476
|
class: xe(["chat-window", {
|
|
10458
10477
|
"chat-window--minimized": e.minimized
|
|
@@ -10715,7 +10734,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10715
10734
|
"on-send": ue,
|
|
10716
10735
|
"on-cancel-reply": Pt,
|
|
10717
10736
|
onTyping: se,
|
|
10718
|
-
onStopTyping:
|
|
10737
|
+
onStopTyping: te
|
|
10719
10738
|
}, null, 8, ["message", "conversation-id", "input-test-id", "attach-button-test-id", "send-button-test-id", "reply-to-message", "participant-names"])
|
|
10720
10739
|
], 512)
|
|
10721
10740
|
], 64))
|
|
@@ -10752,7 +10771,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10752
10771
|
}, Ff = /* @__PURE__ */ ot({
|
|
10753
10772
|
__name: "ChatWidget",
|
|
10754
10773
|
setup(e) {
|
|
10755
|
-
const t = dr(), n =
|
|
10774
|
+
const t = dr(), n = is();
|
|
10756
10775
|
function i() {
|
|
10757
10776
|
try {
|
|
10758
10777
|
return t.path ?? "";
|
|
@@ -10885,7 +10904,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
10885
10904
|
v && l.closeAllWindows();
|
|
10886
10905
|
}, { immediate: !0 }), We(R, (v) => {
|
|
10887
10906
|
v <= 0 || l.setMaxWindows(v);
|
|
10888
|
-
}, { immediate: !0 }), (v, f) => (m(), it(
|
|
10907
|
+
}, { immediate: !0 }), (v, f) => (m(), it(ss, { to: "body" }, [
|
|
10889
10908
|
$.value ? (m(), b("button", {
|
|
10890
10909
|
key: 0,
|
|
10891
10910
|
"data-testid": "chat-widget-button",
|
|
@@ -11136,7 +11155,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11136
11155
|
document.addEventListener("keydown", p);
|
|
11137
11156
|
}), Nt(() => {
|
|
11138
11157
|
document.removeEventListener("keydown", p), document.body.style.overflow = "";
|
|
11139
|
-
}), (h, w) => (m(), it(
|
|
11158
|
+
}), (h, w) => (m(), it(ss, { to: "body" }, [
|
|
11140
11159
|
$e(Wt, { name: "messenger-modal" }, {
|
|
11141
11160
|
default: rt(() => [
|
|
11142
11161
|
o.value ? (m(), b("div", {
|
|
@@ -11409,7 +11428,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11409
11428
|
oe ? "Unpin conversation" : "Pin conversation"
|
|
11410
11429
|
),
|
|
11411
11430
|
handler: () => {
|
|
11412
|
-
|
|
11431
|
+
ee();
|
|
11413
11432
|
}
|
|
11414
11433
|
},
|
|
11415
11434
|
{
|
|
@@ -11570,7 +11589,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11570
11589
|
cssClass: "conversation-folder-sheet"
|
|
11571
11590
|
});
|
|
11572
11591
|
Ce(ke), ye(q), await ke.present();
|
|
11573
|
-
},
|
|
11592
|
+
}, ee = async () => {
|
|
11574
11593
|
try {
|
|
11575
11594
|
await o.pinConversation(n.conversation.id, !n.conversation.is_pinned);
|
|
11576
11595
|
} catch {
|
|
@@ -11755,7 +11774,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11755
11774
|
}, ue = C(() => {
|
|
11756
11775
|
const F = zt.value;
|
|
11757
11776
|
return At[jt(F) % At.length] ?? rr;
|
|
11758
|
-
}), se = (F) => At[jt(F) % At.length] ?? rr,
|
|
11777
|
+
}), se = (F) => At[jt(F) % At.length] ?? rr, te = C(() => (n.conversation.participants ?? []).filter((oe) => oe.user_id !== u.value?.id).slice(0, 2)), je = C(() => o.getTypingUsers(n.conversation.id)), Qe = C(() => st(je.value)), st = (F) => {
|
|
11759
11778
|
if (F.length === 1) {
|
|
11760
11779
|
const oe = F.at(0)?.name;
|
|
11761
11780
|
return oe ? `${oe} is typing...` : "Someone is typing...";
|
|
@@ -11806,7 +11825,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11806
11825
|
(F, oe) => {
|
|
11807
11826
|
F !== oe && (ce(), K());
|
|
11808
11827
|
}
|
|
11809
|
-
),
|
|
11828
|
+
), Fs(() => {
|
|
11810
11829
|
I !== null && (clearTimeout(I), I = null), E !== null && (clearTimeout(E), E = null), O !== null && (clearTimeout(O), O = null), ne !== null && (clearTimeout(ne), ne = null), T();
|
|
11811
11830
|
}), (F, oe) => (m(), b("button", {
|
|
11812
11831
|
type: "button",
|
|
@@ -11840,7 +11859,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
11840
11859
|
style: at({ backgroundColor: ue.value })
|
|
11841
11860
|
}, Q(xt.value), 5))
|
|
11842
11861
|
], 64)) : (m(), b("div", Jf, [
|
|
11843
|
-
(m(!0), b(ze, null, ut(
|
|
11862
|
+
(m(!0), b(ze, null, ut(te.value, (ke, Le) => (m(), b(ze, {
|
|
11844
11863
|
key: ke.user_id
|
|
11845
11864
|
}, [
|
|
11846
11865
|
ke.user?.avatar ? (m(), b("img", {
|
|
@@ -12157,7 +12176,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12157
12176
|
},
|
|
12158
12177
|
emits: ["close"],
|
|
12159
12178
|
setup(e, { emit: t }) {
|
|
12160
|
-
const n = e, i = t, o = Gt(), l = It()(), u =
|
|
12179
|
+
const n = e, i = t, o = Gt(), l = It()(), u = is(), p = C(() => l.user?.id ?? ""), h = C(() => n.conversation?.type === "group"), w = C(() => n.conversation?.participants ?? []), y = N({}), k = N(Date.now());
|
|
12161
12180
|
let x = null, M = null;
|
|
12162
12181
|
const $ = () => {
|
|
12163
12182
|
M !== null && (clearInterval(M), M = null);
|
|
@@ -12173,9 +12192,9 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12173
12192
|
try {
|
|
12174
12193
|
const se = await Fe().get("/v1/presence/users", {
|
|
12175
12194
|
params: { ids: ue }
|
|
12176
|
-
}),
|
|
12177
|
-
for (const Qe of
|
|
12178
|
-
const st =
|
|
12195
|
+
}), te = se.data?.data?.items ?? se.data?.items ?? [], je = {};
|
|
12196
|
+
for (const Qe of te) {
|
|
12197
|
+
const st = Qn(Qe);
|
|
12179
12198
|
je[Qe.id] = {
|
|
12180
12199
|
status: st.status ?? "offline",
|
|
12181
12200
|
lastSeenAt: st.lastSeenAt
|
|
@@ -12187,7 +12206,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12187
12206
|
}, L = (ue) => {
|
|
12188
12207
|
if (ue === p.value) return "online";
|
|
12189
12208
|
const se = y.value[ue];
|
|
12190
|
-
return se ?
|
|
12209
|
+
return se ? Zn(se.status, se.lastSeenAt, {
|
|
12191
12210
|
now: k.value
|
|
12192
12211
|
}) ?? "offline" : "offline";
|
|
12193
12212
|
}, ae = (ue) => {
|
|
@@ -12203,7 +12222,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12203
12222
|
}
|
|
12204
12223
|
}, de = (ue) => ae(L(ue)), E = C(() => {
|
|
12205
12224
|
const ue = ve.value?.user_id;
|
|
12206
|
-
return ue && y.value[ue] ? L(ue) :
|
|
12225
|
+
return ue && y.value[ue] ? L(ue) : Zn(
|
|
12207
12226
|
n.conversation?.other_presence_status ?? null,
|
|
12208
12227
|
n.conversation?.other_last_seen_at ?? null,
|
|
12209
12228
|
{
|
|
@@ -12221,15 +12240,15 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12221
12240
|
const se = ue.user?.handle?.trim();
|
|
12222
12241
|
if (se)
|
|
12223
12242
|
return se;
|
|
12224
|
-
const
|
|
12225
|
-
return
|
|
12243
|
+
const te = ue.user?.id ?? ue.user_id;
|
|
12244
|
+
return te.trim().length > 0 ? te : null;
|
|
12226
12245
|
}), U = C(() => `View ${ve.value?.user?.name ?? "user"}'s profile`), H = C(() => h.value ? n.conversation?.title || "Group Chat" : ve.value?.user?.name || "Unknown User"), ge = async () => {
|
|
12227
12246
|
const ue = ce.value;
|
|
12228
12247
|
ue && (i("close"), await u.push(`/profile/${ue}`));
|
|
12229
12248
|
}, pe = async (ue) => {
|
|
12230
|
-
const
|
|
12231
|
-
!
|
|
12232
|
-
}, V = C(() => [...w.value].sort((se,
|
|
12249
|
+
const te = ue.user?.handle?.trim() || ue.user?.id || ue.user_id;
|
|
12250
|
+
!te || te.trim().length === 0 || (i("close"), await u.push(`/profile/${te}`));
|
|
12251
|
+
}, V = C(() => [...w.value].sort((se, te) => se.user_id === p.value ? -1 : te.user_id === p.value ? 1 : se.role === "admin" && te.role !== "admin" ? -1 : se.role !== "admin" && te.role === "admin" ? 1 : (se.user?.name ?? "").localeCompare(te.user?.name ?? ""))), G = N(null), P = N(null), v = N(""), f = C(() => G.value === "remove-member" ? "Remove Member" : G.value === "delete-conversation" ? "Delete Conversation" : "Leave Group"), T = C(() => G.value === "remove-member" ? `Remove ${v.value || "this member"} from the group?` : G.value === "delete-conversation" ? "Delete this conversation from your inbox? This action cannot be undone." : "Are you sure you want to leave this group? You won't be able to see its messages anymore."), re = C(() => G.value === "remove-member" ? "Remove" : G.value === "delete-conversation" ? "Delete" : "Leave"), Ce = C(() => G.value === "remove-member" ? `Confirm removal of ${v.value || "member"}` : G.value === "delete-conversation" ? "Confirm deleting conversation" : "Confirm leaving group"), Se = () => {
|
|
12233
12252
|
G.value = null, P.value = null, v.value = "";
|
|
12234
12253
|
}, ye = () => {
|
|
12235
12254
|
if (G.value === "remove-member" && P.value) {
|
|
@@ -12265,8 +12284,8 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12265
12284
|
"#6366f1"
|
|
12266
12285
|
], nt = (ue) => {
|
|
12267
12286
|
let se = 0;
|
|
12268
|
-
for (let
|
|
12269
|
-
const je = ue.charCodeAt(
|
|
12287
|
+
for (let te = 0; te < ue.length; te++) {
|
|
12288
|
+
const je = ue.charCodeAt(te);
|
|
12270
12289
|
se = (se << 5) - se + je, se |= 0;
|
|
12271
12290
|
}
|
|
12272
12291
|
return Math.abs(se);
|
|
@@ -12276,19 +12295,19 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12276
12295
|
return se.length >= 2 ? ((se[0]?.[0] ?? "") + (se[se.length - 1]?.[0] ?? "")).toUpperCase() : ue.substring(0, 2).toUpperCase();
|
|
12277
12296
|
}, dt = C(
|
|
12278
12297
|
() => w.value.filter((ue) => ue.user_id !== p.value).slice(0, 3)
|
|
12279
|
-
), Ze = (ue) => ["cim-avatar--first", "cim-avatar--second", "cim-avatar--third"][ue] ?? "",
|
|
12280
|
-
J.value = n.conversation?.title ?? "",
|
|
12298
|
+
), Ze = (ue) => ["cim-avatar--first", "cim-avatar--second", "cim-avatar--third"][ue] ?? "", ee = N(!1), J = N(""), he = N(null), we = () => {
|
|
12299
|
+
J.value = n.conversation?.title ?? "", ee.value = !0, ct(() => {
|
|
12281
12300
|
he.value?.focus(), he.value?.select();
|
|
12282
12301
|
});
|
|
12283
12302
|
}, Pe = () => {
|
|
12284
|
-
|
|
12303
|
+
ee.value = !1;
|
|
12285
12304
|
}, X = async () => {
|
|
12286
12305
|
if (!(!n.conversation || !J.value.trim()))
|
|
12287
12306
|
try {
|
|
12288
12307
|
await o.updateConversationTitle(
|
|
12289
12308
|
n.conversation.id,
|
|
12290
12309
|
J.value.trim()
|
|
12291
|
-
),
|
|
12310
|
+
), ee.value = !1, et("Group name updated", "success");
|
|
12292
12311
|
} catch {
|
|
12293
12312
|
et("Failed to update group name", "error");
|
|
12294
12313
|
}
|
|
@@ -12343,10 +12362,10 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12343
12362
|
});
|
|
12344
12363
|
const Ct = async (ue) => {
|
|
12345
12364
|
try {
|
|
12346
|
-
const
|
|
12365
|
+
const te = (await Fe().get("/v1/search", {
|
|
12347
12366
|
params: { q: ue, type: "user", limit: 20 }
|
|
12348
12367
|
})).data?.data ?? [], je = new Set(w.value.map((Qe) => Qe.user_id));
|
|
12349
|
-
Mt.value =
|
|
12368
|
+
Mt.value = te.map((Qe) => {
|
|
12350
12369
|
const st = Qe.id || "", $t = Qe.doc && !Array.isArray(Qe.doc) ? Qe.doc : null, Rt = Qe.author_name || $t?.name || "Unknown", Pt = Qe.author_handle || $t?.handle, qt = Qe.author_avatar || $t?.avatar, F = { id: st, name: Rt };
|
|
12351
12370
|
return Pt && (F.handle = Pt), qt && (F.avatar = qt), F;
|
|
12352
12371
|
}).filter((Qe) => !je.has(Qe.id) && Qe.id !== p.value);
|
|
@@ -12356,7 +12375,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12356
12375
|
Ut.value = !1;
|
|
12357
12376
|
}
|
|
12358
12377
|
}, kt = (ue) => {
|
|
12359
|
-
const se = qe.value.findIndex((
|
|
12378
|
+
const se = qe.value.findIndex((te) => te.id === ue.id);
|
|
12360
12379
|
se >= 0 ? qe.value.splice(se, 1) : qe.value.push(ue);
|
|
12361
12380
|
}, xt = (ue) => {
|
|
12362
12381
|
qe.value = qe.value.filter((se) => se.id !== ue);
|
|
@@ -12380,7 +12399,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12380
12399
|
}), We(() => n.isOpen, (ue) => {
|
|
12381
12400
|
ue ? (A(), I(), $(), M = setInterval(() => {
|
|
12382
12401
|
I();
|
|
12383
|
-
}, Up)) : (R(), $(),
|
|
12402
|
+
}, Up)) : (R(), $(), ee.value = !1, Ge.value = !1, Se(), pt.value = "", Mt.value = [], qe.value = [], y.value = {});
|
|
12384
12403
|
}, { immediate: !0 }), (ue, se) => (m(), b(ze, null, [
|
|
12385
12404
|
$e(hn, {
|
|
12386
12405
|
"model-value": e.isOpen,
|
|
@@ -12390,27 +12409,27 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12390
12409
|
"show-cancel": !1,
|
|
12391
12410
|
"data-test-id": "modal-conversation-info",
|
|
12392
12411
|
class: "conversation-info-modal",
|
|
12393
|
-
"onUpdate:modelValue": se[2] || (se[2] = (
|
|
12394
|
-
|
|
12412
|
+
"onUpdate:modelValue": se[2] || (se[2] = (te) => {
|
|
12413
|
+
te || ue.$emit("close");
|
|
12395
12414
|
}),
|
|
12396
|
-
onClose: se[3] || (se[3] = (
|
|
12415
|
+
onClose: se[3] || (se[3] = (te) => ue.$emit("close"))
|
|
12397
12416
|
}, {
|
|
12398
12417
|
body: rt(() => [
|
|
12399
12418
|
c("div", Im, [
|
|
12400
12419
|
h.value ? (m(), b("div", Lm, [
|
|
12401
|
-
(m(!0), b(ze, null, ut(dt.value, (
|
|
12402
|
-
key:
|
|
12420
|
+
(m(!0), b(ze, null, ut(dt.value, (te, je) => (m(), b(ze, {
|
|
12421
|
+
key: te.user_id
|
|
12403
12422
|
}, [
|
|
12404
|
-
|
|
12423
|
+
te.user?.avatar ? (m(), b("img", {
|
|
12405
12424
|
key: 0,
|
|
12406
|
-
src:
|
|
12407
|
-
alt:
|
|
12425
|
+
src: te.user.avatar,
|
|
12426
|
+
alt: te.user.name || "User",
|
|
12408
12427
|
class: xe(["cim-profile__avatar-img", Ze(je)])
|
|
12409
12428
|
}, null, 10, Om)) : (m(), b("div", {
|
|
12410
12429
|
key: 1,
|
|
12411
12430
|
class: xe(["cim-profile__avatar-initials", Ze(je)]),
|
|
12412
|
-
style: at({ backgroundColor: Ye(
|
|
12413
|
-
}, Q(mt(
|
|
12431
|
+
style: at({ backgroundColor: Ye(te.user_id) })
|
|
12432
|
+
}, Q(mt(te.user?.name)), 7))
|
|
12414
12433
|
], 64))), 128))
|
|
12415
12434
|
])) : (m(), b("div", Dm, [
|
|
12416
12435
|
ve.value?.user?.avatar ? (m(), b("img", {
|
|
@@ -12425,11 +12444,11 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12425
12444
|
}, Q(mt(ve.value?.user?.name)), 5))
|
|
12426
12445
|
])),
|
|
12427
12446
|
c("div", Fm, [
|
|
12428
|
-
h.value &&
|
|
12447
|
+
h.value && ee.value ? (m(), b(ze, { key: 0 }, [
|
|
12429
12448
|
un(c("input", {
|
|
12430
12449
|
ref_key: "titleInput",
|
|
12431
12450
|
ref: he,
|
|
12432
|
-
"onUpdate:modelValue": se[0] || (se[0] = (
|
|
12451
|
+
"onUpdate:modelValue": se[0] || (se[0] = (te) => J.value = te),
|
|
12433
12452
|
class: "cim-profile__name-input",
|
|
12434
12453
|
"data-testid": "input-edit-group-title",
|
|
12435
12454
|
"aria-label": "Edit group name",
|
|
@@ -12502,7 +12521,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12502
12521
|
class: "cim-add-btn",
|
|
12503
12522
|
"data-testid": "btn-add-members",
|
|
12504
12523
|
"aria-label": "Add members",
|
|
12505
|
-
onClick: se[1] || (se[1] = (
|
|
12524
|
+
onClick: se[1] || (se[1] = (te) => Ge.value = !0)
|
|
12506
12525
|
}, [...se[9] || (se[9] = [
|
|
12507
12526
|
c("svg", {
|
|
12508
12527
|
width: "16",
|
|
@@ -12536,51 +12555,51 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12536
12555
|
])])) : Y("", !0)
|
|
12537
12556
|
]),
|
|
12538
12557
|
c("div", Xm, [
|
|
12539
|
-
(m(!0), b(ze, null, ut(V.value, (
|
|
12540
|
-
key:
|
|
12541
|
-
class: xe(["cim-member", { "cim-member--clickable":
|
|
12542
|
-
"data-testid": `member-${
|
|
12543
|
-
role:
|
|
12544
|
-
tabindex:
|
|
12545
|
-
"aria-label":
|
|
12546
|
-
onClick: (je) =>
|
|
12558
|
+
(m(!0), b(ze, null, ut(V.value, (te) => (m(), b("div", {
|
|
12559
|
+
key: te.user_id,
|
|
12560
|
+
class: xe(["cim-member", { "cim-member--clickable": te.user_id !== p.value }]),
|
|
12561
|
+
"data-testid": `member-${te.user_id}`,
|
|
12562
|
+
role: te.user_id !== p.value ? "button" : void 0,
|
|
12563
|
+
tabindex: te.user_id !== p.value ? 0 : void 0,
|
|
12564
|
+
"aria-label": te.user_id !== p.value ? `View ${te.user?.name || "member"}'s profile` : void 0,
|
|
12565
|
+
onClick: (je) => te.user_id !== p.value ? pe(te) : void 0,
|
|
12547
12566
|
onKeydown: [
|
|
12548
|
-
Dt((je) =>
|
|
12549
|
-
Dt(Ve((je) =>
|
|
12567
|
+
Dt((je) => te.user_id !== p.value ? pe(te) : void 0, ["enter"]),
|
|
12568
|
+
Dt(Ve((je) => te.user_id !== p.value ? pe(te) : void 0, ["prevent"]), ["space"])
|
|
12550
12569
|
]
|
|
12551
12570
|
}, [
|
|
12552
12571
|
c("div", Ym, [
|
|
12553
|
-
|
|
12572
|
+
te.user?.avatar ? (m(), b("img", {
|
|
12554
12573
|
key: 0,
|
|
12555
|
-
src:
|
|
12556
|
-
alt:
|
|
12574
|
+
src: te.user.avatar,
|
|
12575
|
+
alt: te.user.name || "User",
|
|
12557
12576
|
class: "cim-member__avatar-img"
|
|
12558
12577
|
}, null, 8, Jm)) : (m(), b("div", {
|
|
12559
12578
|
key: 1,
|
|
12560
12579
|
class: "cim-member__avatar-initials",
|
|
12561
|
-
style: at({ backgroundColor: Ye(
|
|
12562
|
-
}, Q(mt(
|
|
12563
|
-
L(
|
|
12580
|
+
style: at({ backgroundColor: Ye(te.user_id) })
|
|
12581
|
+
}, Q(mt(te.user?.name)), 5)),
|
|
12582
|
+
L(te.user_id) !== "offline" ? (m(), b("span", {
|
|
12564
12583
|
key: 2,
|
|
12565
|
-
class: xe(["cim-member__presence", `cim-member__presence--${L(
|
|
12566
|
-
"data-testid": `presence-${
|
|
12567
|
-
"aria-label": de(
|
|
12584
|
+
class: xe(["cim-member__presence", `cim-member__presence--${L(te.user_id)}`]),
|
|
12585
|
+
"data-testid": `presence-${te.user_id}`,
|
|
12586
|
+
"aria-label": de(te.user_id)
|
|
12568
12587
|
}, null, 10, Zm)) : Y("", !0)
|
|
12569
12588
|
]),
|
|
12570
12589
|
c("div", Qm, [
|
|
12571
12590
|
c("div", ep, [
|
|
12572
|
-
c("span", tp, Q(
|
|
12573
|
-
|
|
12574
|
-
|
|
12591
|
+
c("span", tp, Q(te.user?.name || "Unknown User"), 1),
|
|
12592
|
+
te.user_id === p.value ? (m(), b("span", np, " You ")) : Y("", !0),
|
|
12593
|
+
te.role === "admin" ? (m(), b("span", sp, " Admin ")) : Y("", !0)
|
|
12575
12594
|
]),
|
|
12576
|
-
|
|
12595
|
+
te.user?.handle ? (m(), b("span", ip, " @" + Q(te.user.handle), 1)) : Y("", !0)
|
|
12577
12596
|
]),
|
|
12578
|
-
K.value &&
|
|
12597
|
+
K.value && te.user_id !== p.value ? (m(), b("button", {
|
|
12579
12598
|
key: 0,
|
|
12580
12599
|
class: "cim-remove-btn",
|
|
12581
|
-
"data-testid": n.isOpen ? `btn-remove-member-${
|
|
12582
|
-
"aria-label": `Remove ${
|
|
12583
|
-
onClick: (je) => j(
|
|
12600
|
+
"data-testid": n.isOpen ? `btn-remove-member-${te.user_id}` : void 0,
|
|
12601
|
+
"aria-label": `Remove ${te.user?.name || "member"}`,
|
|
12602
|
+
onClick: (je) => j(te)
|
|
12584
12603
|
}, [...se[11] || (se[11] = [
|
|
12585
12604
|
c("svg", {
|
|
12586
12605
|
width: "16",
|
|
@@ -12701,13 +12720,13 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12701
12720
|
}, 8, ["model-value", "title"]),
|
|
12702
12721
|
$e(hn, {
|
|
12703
12722
|
modelValue: Ge.value,
|
|
12704
|
-
"onUpdate:modelValue": se[6] || (se[6] = (
|
|
12723
|
+
"onUpdate:modelValue": se[6] || (se[6] = (te) => Ge.value = te),
|
|
12705
12724
|
title: "Add Members",
|
|
12706
12725
|
size: "md",
|
|
12707
12726
|
"show-confirm": !1,
|
|
12708
12727
|
"show-cancel": !1,
|
|
12709
12728
|
"data-test-id": "modal-add-members",
|
|
12710
|
-
onClose: se[7] || (se[7] = (
|
|
12729
|
+
onClose: se[7] || (se[7] = (te) => Ge.value = !1)
|
|
12711
12730
|
}, {
|
|
12712
12731
|
header: rt(() => [
|
|
12713
12732
|
c("div", wp, [
|
|
@@ -12715,7 +12734,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12715
12734
|
class: "cim-header__close",
|
|
12716
12735
|
"data-testid": "btn-close-add-members",
|
|
12717
12736
|
"aria-label": "Close add members",
|
|
12718
|
-
onClick: se[4] || (se[4] = (
|
|
12737
|
+
onClick: se[4] || (se[4] = (te) => Ge.value = !1)
|
|
12719
12738
|
}, [...se[16] || (se[16] = [
|
|
12720
12739
|
c("svg", {
|
|
12721
12740
|
width: "20",
|
|
@@ -12742,7 +12761,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12742
12761
|
body: rt(() => [
|
|
12743
12762
|
c("div", kp, [
|
|
12744
12763
|
un(c("input", {
|
|
12745
|
-
"onUpdate:modelValue": se[5] || (se[5] = (
|
|
12764
|
+
"onUpdate:modelValue": se[5] || (se[5] = (te) => pt.value = te),
|
|
12746
12765
|
type: "text",
|
|
12747
12766
|
class: "cim-search__input",
|
|
12748
12767
|
placeholder: "Search users...",
|
|
@@ -12753,14 +12772,14 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12753
12772
|
])
|
|
12754
12773
|
]),
|
|
12755
12774
|
qe.value.length > 0 ? (m(), b("div", Sp, [
|
|
12756
|
-
(m(!0), b(ze, null, ut(qe.value, (
|
|
12757
|
-
key:
|
|
12775
|
+
(m(!0), b(ze, null, ut(qe.value, (te) => (m(), b("button", {
|
|
12776
|
+
key: te.id,
|
|
12758
12777
|
class: "cim-chip",
|
|
12759
|
-
"data-testid": `chip-new-member-${
|
|
12760
|
-
"aria-label": `Remove ${
|
|
12761
|
-
onClick: (je) => xt(
|
|
12778
|
+
"data-testid": `chip-new-member-${te.id}`,
|
|
12779
|
+
"aria-label": `Remove ${te.name}`,
|
|
12780
|
+
onClick: (je) => xt(te.id)
|
|
12762
12781
|
}, [
|
|
12763
|
-
yt(Q(
|
|
12782
|
+
yt(Q(te.name) + " ", 1),
|
|
12764
12783
|
se[18] || (se[18] = c("svg", {
|
|
12765
12784
|
width: "12",
|
|
12766
12785
|
height: "12",
|
|
@@ -12775,30 +12794,30 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12775
12794
|
], 8, Tp))), 128))
|
|
12776
12795
|
])) : Y("", !0),
|
|
12777
12796
|
Ut.value ? (m(), b("div", Mp, " Searching... ")) : Mt.value.length > 0 ? (m(), b("div", xp, [
|
|
12778
|
-
(m(!0), b(ze, null, ut(Mt.value, (
|
|
12779
|
-
key:
|
|
12797
|
+
(m(!0), b(ze, null, ut(Mt.value, (te) => (m(), b("button", {
|
|
12798
|
+
key: te.id,
|
|
12780
12799
|
class: "cim-result",
|
|
12781
|
-
"data-testid": `item-add-member-${
|
|
12782
|
-
"aria-label": `${At(
|
|
12783
|
-
onClick: (je) => kt(
|
|
12800
|
+
"data-testid": `item-add-member-${te.id}`,
|
|
12801
|
+
"aria-label": `${At(te.id) ? "Deselect" : "Select"} ${te.name}`,
|
|
12802
|
+
onClick: (je) => kt(te)
|
|
12784
12803
|
}, [
|
|
12785
12804
|
c("div", Ap, [
|
|
12786
|
-
|
|
12805
|
+
te.avatar ? (m(), b("img", {
|
|
12787
12806
|
key: 0,
|
|
12788
|
-
src:
|
|
12789
|
-
alt:
|
|
12807
|
+
src: te.avatar,
|
|
12808
|
+
alt: te.name,
|
|
12790
12809
|
class: "cim-result__avatar-img"
|
|
12791
12810
|
}, null, 8, $p)) : (m(), b("div", {
|
|
12792
12811
|
key: 1,
|
|
12793
12812
|
class: "cim-result__avatar-initials",
|
|
12794
|
-
style: at({ backgroundColor: Ye(
|
|
12795
|
-
}, Q(mt(
|
|
12813
|
+
style: at({ backgroundColor: Ye(te.id) })
|
|
12814
|
+
}, Q(mt(te.name)), 5))
|
|
12796
12815
|
]),
|
|
12797
12816
|
c("div", Rp, [
|
|
12798
|
-
c("span", Pp, Q(
|
|
12799
|
-
|
|
12817
|
+
c("span", Pp, Q(te.name), 1),
|
|
12818
|
+
te.handle ? (m(), b("span", Ip, "@" + Q(te.handle), 1)) : Y("", !0)
|
|
12800
12819
|
]),
|
|
12801
|
-
At(
|
|
12820
|
+
At(te.id) ? (m(), b("svg", Lp, [...se[19] || (se[19] = [
|
|
12802
12821
|
c("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
12803
12822
|
])])) : Y("", !0)
|
|
12804
12823
|
], 8, Ep))), 128))
|
|
@@ -12880,7 +12899,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
12880
12899
|
let p = !1, h = null;
|
|
12881
12900
|
const w = N("dm"), y = N(""), k = N(""), x = N([]), M = N([]), $ = N([]), R = N(!1), A = N(!1), I = N(!1), L = N(""), ae = N(null), de = N(!1), E = N(!1), O = N(/* @__PURE__ */ new Map());
|
|
12882
12901
|
let ne = null;
|
|
12883
|
-
const ie =
|
|
12902
|
+
const ie = is(), q = Gt(), K = It()(), ve = [
|
|
12884
12903
|
"#6366f1",
|
|
12885
12904
|
"#8b5cf6",
|
|
12886
12905
|
"#a855f7",
|
|
@@ -13021,7 +13040,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
13021
13040
|
}
|
|
13022
13041
|
}
|
|
13023
13042
|
function nt(X) {
|
|
13024
|
-
J(X) ?
|
|
13043
|
+
J(X) ? ee(X) : Ze(X);
|
|
13025
13044
|
}
|
|
13026
13045
|
function Ye(X, j) {
|
|
13027
13046
|
return j === "nobody" ? "This user has disabled direct messages." : !X && j === "followers" ? "This user only accepts messages from their followers." : null;
|
|
@@ -13066,7 +13085,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
13066
13085
|
} else J(X) || (x.value = [...x.value, X]);
|
|
13067
13086
|
w.value === "group" && o.value?.focus();
|
|
13068
13087
|
}
|
|
13069
|
-
function
|
|
13088
|
+
function ee(X) {
|
|
13070
13089
|
x.value = x.value.filter((j) => j.id !== X.id), w.value === "dm" && (ae.value = null);
|
|
13071
13090
|
}
|
|
13072
13091
|
function J(X) {
|
|
@@ -13244,7 +13263,7 @@ const Su = new ku(), Tu = ["data-testid"], Mu = ["data-testid"], xu = ["data-tes
|
|
|
13244
13263
|
class: "ncm-chip",
|
|
13245
13264
|
"data-testid": `chip-selected-user-${z.id}`,
|
|
13246
13265
|
"aria-label": `Remove ${z.name}`,
|
|
13247
|
-
onClick: (Ie) =>
|
|
13266
|
+
onClick: (Ie) => ee(z)
|
|
13248
13267
|
}, [
|
|
13249
13268
|
c("div", {
|
|
13250
13269
|
class: "ncm-chip__avatar",
|
|
@@ -14233,12 +14252,12 @@ export {
|
|
|
14233
14252
|
Pn as getEchoInitializedEvent,
|
|
14234
14253
|
Ke as getErrorMessage,
|
|
14235
14254
|
Xs as getLoggerFactory,
|
|
14236
|
-
|
|
14255
|
+
Jn as getMainApi,
|
|
14237
14256
|
ul as getMainEcho,
|
|
14238
14257
|
dl as getMainEchoConnectionStatus,
|
|
14239
14258
|
cl as getMainEchoInitializedEvent,
|
|
14240
14259
|
Eo as getMediaApi,
|
|
14241
|
-
|
|
14260
|
+
Rs as getMessagingAccessState,
|
|
14242
14261
|
Al as getPresenceRuntimeConfig,
|
|
14243
14262
|
tu as getSavedScrollTop,
|
|
14244
14263
|
uc as getToken,
|
|
@@ -14251,7 +14270,7 @@ export {
|
|
|
14251
14270
|
Xc as isEmojiOnly,
|
|
14252
14271
|
$g as isError,
|
|
14253
14272
|
Kc as isSameMessageDay,
|
|
14254
|
-
|
|
14273
|
+
As as isScrollNearBottom,
|
|
14255
14274
|
yo as isValidMessageDeletedEvent,
|
|
14256
14275
|
bo as isValidMessageEditedEvent,
|
|
14257
14276
|
go as isValidMessageReadEvent,
|
|
@@ -14262,10 +14281,10 @@ export {
|
|
|
14262
14281
|
mc as normalizeMediaUrl,
|
|
14263
14282
|
Oo as normalizePresenceStatus,
|
|
14264
14283
|
Rr as normalizePresenceTimestamp,
|
|
14265
|
-
|
|
14284
|
+
rs as onConnectionStatusChange,
|
|
14266
14285
|
hl as onMainEchoConnectionStatusChange,
|
|
14267
14286
|
ro as onMessagingAccessStateChange,
|
|
14268
|
-
|
|
14287
|
+
Is as parsePresenceTimestamp,
|
|
14269
14288
|
ao as reconnectEcho,
|
|
14270
14289
|
fl as reconnectMainEcho,
|
|
14271
14290
|
po as resetEchoRuntimeConfig,
|
|
@@ -14284,9 +14303,9 @@ export {
|
|
|
14284
14303
|
cc as resetTokenProvider,
|
|
14285
14304
|
vc as resetWidgetConfig,
|
|
14286
14305
|
su as resolveFirstUnreadMessageId,
|
|
14287
|
-
|
|
14306
|
+
Zn as resolveFreshPresenceStatus,
|
|
14288
14307
|
zi as resolveMessageVideoPlaybackUrl,
|
|
14289
|
-
|
|
14308
|
+
Qn as resolvePresenceSnapshot,
|
|
14290
14309
|
eu as scrollElementTo,
|
|
14291
14310
|
mo as setEchoRuntimeConfig,
|
|
14292
14311
|
gl as setLoggerFactory,
|