@codingfactory/messenger-client 0.2.17 → 0.2.18
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 +301 -303
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -400,8 +400,8 @@ function He(e, n) {
|
|
|
400
400
|
const i = lo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : i !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, g = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, x = ho(e, n), M = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", _ = (() => {
|
|
401
401
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
402
402
|
return !1;
|
|
403
|
-
const C = n.last_message?.id,
|
|
404
|
-
return !C || !
|
|
403
|
+
const C = n.last_message?.id, v = e.last_message?.id;
|
|
404
|
+
return !C || !v ? !1 : C === v;
|
|
405
405
|
})();
|
|
406
406
|
return {
|
|
407
407
|
...e,
|
|
@@ -673,7 +673,7 @@ const Gt = _i("messaging", {
|
|
|
673
673
|
"conversations"
|
|
674
674
|
), x = g.map((_) => {
|
|
675
675
|
const C = this.conversations.find(
|
|
676
|
-
(
|
|
676
|
+
(v) => v.id === _.id
|
|
677
677
|
);
|
|
678
678
|
return He(_, C);
|
|
679
679
|
});
|
|
@@ -803,7 +803,7 @@ const Gt = _i("messaging", {
|
|
|
803
803
|
..._.handle ? { handle: _.handle } : {}
|
|
804
804
|
}), o != null && (C.reply_to_id = o), c != null && (C.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(C), this._pendingSendIds.add(h);
|
|
805
805
|
try {
|
|
806
|
-
let
|
|
806
|
+
let v;
|
|
807
807
|
const T = {
|
|
808
808
|
body: n || "",
|
|
809
809
|
...o ? { reply_to_id: o } : {},
|
|
@@ -821,26 +821,26 @@ const Gt = _i("messaging", {
|
|
|
821
821
|
};
|
|
822
822
|
})
|
|
823
823
|
);
|
|
824
|
-
|
|
824
|
+
v = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
825
825
|
...T,
|
|
826
826
|
attachments: k
|
|
827
827
|
});
|
|
828
828
|
} else
|
|
829
|
-
|
|
829
|
+
v = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
830
830
|
...T,
|
|
831
831
|
type: "text"
|
|
832
832
|
});
|
|
833
|
-
const w =
|
|
834
|
-
N >= 0 && (
|
|
833
|
+
const w = v.data.data || v.data, f = { ...C, ...w, attachments: w.attachments ?? C.attachments }, m = at(f), b = this.messages[e], N = b.findIndex((k) => k.id === h);
|
|
834
|
+
N >= 0 && (b[N] = m), this._pendingSendIds.delete(h);
|
|
835
835
|
const q = m.id;
|
|
836
836
|
let G = 0;
|
|
837
|
-
for (let k =
|
|
838
|
-
const O =
|
|
839
|
-
O && O.id === q && (G++, G > 1 &&
|
|
837
|
+
for (let k = b.length - 1; k >= 0; k--) {
|
|
838
|
+
const O = b[k];
|
|
839
|
+
O && O.id === q && (G++, G > 1 && b.splice(k, 1));
|
|
840
840
|
}
|
|
841
841
|
return this.updateConversationLastMessage(e, m), m;
|
|
842
|
-
} catch (
|
|
843
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((T) => T.id !== h), this.error = Z(
|
|
842
|
+
} catch (v) {
|
|
843
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((T) => T.id !== h), this.error = Z(v), v;
|
|
844
844
|
}
|
|
845
845
|
},
|
|
846
846
|
async editMessage(e, n, i) {
|
|
@@ -1136,10 +1136,10 @@ const Gt = _i("messaging", {
|
|
|
1136
1136
|
);
|
|
1137
1137
|
(x.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1138
1138
|
try {
|
|
1139
|
-
const _ = await W().get(o), C = he(_.data) && "data" in _.data ? _.data.data : _.data,
|
|
1139
|
+
const _ = await W().get(o), C = he(_.data) && "data" in _.data ? _.data.data : _.data, v = Un(
|
|
1140
1140
|
he(C) ? C.reactions : void 0
|
|
1141
1141
|
);
|
|
1142
|
-
this.updateMessageReactions(e, n,
|
|
1142
|
+
this.updateMessageReactions(e, n, v);
|
|
1143
1143
|
} catch {
|
|
1144
1144
|
}
|
|
1145
1145
|
} catch (g) {
|
|
@@ -1266,7 +1266,7 @@ const Gt = _i("messaging", {
|
|
|
1266
1266
|
function Ya(e) {
|
|
1267
1267
|
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = zt(), g = d !== null, h = 20, x = 250;
|
|
1268
1268
|
let M = 0, _ = null, C = null;
|
|
1269
|
-
const
|
|
1269
|
+
const v = ie(() => i.currentUser?.id), T = () => Xn(e)?.trim() ?? "";
|
|
1270
1270
|
function w() {
|
|
1271
1271
|
_ && (clearTimeout(_), _ = null), M = 0;
|
|
1272
1272
|
}
|
|
@@ -1276,13 +1276,13 @@ function Ya(e) {
|
|
|
1276
1276
|
}, x));
|
|
1277
1277
|
}
|
|
1278
1278
|
function m(y) {
|
|
1279
|
-
if (n.addMessage(y.message), y.message.author_id !==
|
|
1279
|
+
if (n.addMessage(y.message), y.message.author_id !== v.value) {
|
|
1280
1280
|
const I = n.getConversationById(y.conversation_id);
|
|
1281
1281
|
I && (I.unread_count = 0), n.markAsRead(y.conversation_id).catch(() => {
|
|
1282
1282
|
});
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function b(y) {
|
|
1286
1286
|
n.applyParticipantReadState(y);
|
|
1287
1287
|
}
|
|
1288
1288
|
function N(y) {
|
|
@@ -1290,10 +1290,10 @@ function Ya(e) {
|
|
|
1290
1290
|
if (ae >= 0) {
|
|
1291
1291
|
const B = I[ae];
|
|
1292
1292
|
if (!B) return;
|
|
1293
|
-
const
|
|
1294
|
-
y.message.body !== void 0 && (
|
|
1293
|
+
const E = { ...B };
|
|
1294
|
+
y.message.body !== void 0 && (E.body = y.message.body), y.message.edited_at !== void 0 && (E.edited_at = y.message.edited_at), y.message.meta !== void 0 && (E.meta = y.message.meta), I[ae] = E;
|
|
1295
1295
|
const V = n.getConversationById(y.conversation_id);
|
|
1296
|
-
V && V.last_message?.id === y.message.id && (V.last_message =
|
|
1296
|
+
V && V.last_message?.id === y.message.id && (V.last_message = E);
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
1299
|
function q(y) {
|
|
@@ -1313,7 +1313,7 @@ function Ya(e) {
|
|
|
1313
1313
|
);
|
|
1314
1314
|
}
|
|
1315
1315
|
function O(y) {
|
|
1316
|
-
y.removed_user_id ===
|
|
1316
|
+
y.removed_user_id === v.value && (te(), n.deleteConversation(y.conversation_id).catch(() => {
|
|
1317
1317
|
}));
|
|
1318
1318
|
}
|
|
1319
1319
|
function H(y) {
|
|
@@ -1331,7 +1331,7 @@ function Ya(e) {
|
|
|
1331
1331
|
try {
|
|
1332
1332
|
C = Mi(y, {
|
|
1333
1333
|
onMessageSent: m,
|
|
1334
|
-
onMessageRead:
|
|
1334
|
+
onMessageRead: b,
|
|
1335
1335
|
onMessageEdited: N,
|
|
1336
1336
|
onMessageDeleted: q,
|
|
1337
1337
|
onReactionToggled: G,
|
|
@@ -1354,7 +1354,7 @@ function Ya(e) {
|
|
|
1354
1354
|
}
|
|
1355
1355
|
(y === "disconnected" || y === "error") && (w(), H(!1));
|
|
1356
1356
|
});
|
|
1357
|
-
function
|
|
1357
|
+
function te() {
|
|
1358
1358
|
if (w(), !(!o.value || !l.value))
|
|
1359
1359
|
try {
|
|
1360
1360
|
H(!0), c.value = null;
|
|
@@ -1374,12 +1374,12 @@ function Ya(e) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
1376
|
), d !== null && De(() => {
|
|
1377
|
-
w(), me(),
|
|
1377
|
+
w(), me(), te(), typeof window < "u" && window.removeEventListener(We(), J);
|
|
1378
1378
|
}), {
|
|
1379
1379
|
isSubscribed: ie(() => o.value),
|
|
1380
1380
|
error: ie(() => c.value),
|
|
1381
1381
|
subscribe: F,
|
|
1382
|
-
unsubscribe:
|
|
1382
|
+
unsubscribe: te
|
|
1383
1383
|
};
|
|
1384
1384
|
}
|
|
1385
1385
|
const ls = () => () => {
|
|
@@ -1465,7 +1465,7 @@ function Za(e = {}) {
|
|
|
1465
1465
|
...Po,
|
|
1466
1466
|
...e.icons
|
|
1467
1467
|
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), _ = ve(!1);
|
|
1468
|
-
let C = null,
|
|
1468
|
+
let C = null, v = null, T = null, w = null, f = null, m = null, b = null;
|
|
1469
1469
|
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"), O = ie(() => G.value || k.value), H = ie(() => {
|
|
1470
1470
|
switch (l.value) {
|
|
1471
1471
|
case "connecting":
|
|
@@ -1506,9 +1506,9 @@ function Za(e = {}) {
|
|
|
1506
1506
|
}
|
|
1507
1507
|
}), me = async () => {
|
|
1508
1508
|
qn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1509
|
-
},
|
|
1510
|
-
if (
|
|
1511
|
-
const ne = !_.value && V ===
|
|
1509
|
+
}, te = (E, V = l.value) => {
|
|
1510
|
+
if (E !== "connecting" && v && (clearTimeout(v), v = null), E === "disconnected" || E === "error") {
|
|
1511
|
+
const ne = !_.value && V === E, _e = !x.value && (ne || V === "connected" || V === "connecting");
|
|
1512
1512
|
if (M.value = !0, _e) {
|
|
1513
1513
|
h.value = !1, T && clearTimeout(T), T = setTimeout(() => {
|
|
1514
1514
|
T = null, l.value !== "connected" && (h.value = !0);
|
|
@@ -1518,19 +1518,19 @@ function Za(e = {}) {
|
|
|
1518
1518
|
T && (clearTimeout(T), T = null), h.value = !0;
|
|
1519
1519
|
return;
|
|
1520
1520
|
}
|
|
1521
|
-
if (
|
|
1521
|
+
if (E === "connected") {
|
|
1522
1522
|
T && (clearTimeout(T), T = null), h.value = !1, x.value = !1, M.value = !1;
|
|
1523
1523
|
return;
|
|
1524
1524
|
}
|
|
1525
|
-
if (
|
|
1525
|
+
if (E === "connecting") {
|
|
1526
1526
|
if (x.value) {
|
|
1527
1527
|
h.value = !0;
|
|
1528
1528
|
return;
|
|
1529
1529
|
}
|
|
1530
|
-
if (M.value || (h.value = !1),
|
|
1530
|
+
if (M.value || (h.value = !1), v)
|
|
1531
1531
|
return;
|
|
1532
|
-
|
|
1533
|
-
if (
|
|
1532
|
+
v = setTimeout(() => {
|
|
1533
|
+
if (v = null, l.value === "connecting") {
|
|
1534
1534
|
if (jn(o) === "connected") {
|
|
1535
1535
|
y("connected");
|
|
1536
1536
|
return;
|
|
@@ -1539,33 +1539,33 @@ function Za(e = {}) {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
}, 1e4);
|
|
1541
1541
|
}
|
|
1542
|
-
}, y = (
|
|
1542
|
+
}, y = (E) => {
|
|
1543
1543
|
const V = l.value;
|
|
1544
|
-
if (
|
|
1545
|
-
l.value = "disconnected",
|
|
1544
|
+
if (E === "connecting" && x.value) {
|
|
1545
|
+
l.value = "disconnected", te("disconnected", V);
|
|
1546
1546
|
return;
|
|
1547
1547
|
}
|
|
1548
|
-
l.value =
|
|
1548
|
+
l.value = E, E === "connecting" && (V === "disconnected" || V === "error") && g.value === 0 && (g.value = 1), E === "connected" && (d.value = /* @__PURE__ */ new Date(), g.value = 0), te(E, V);
|
|
1549
1549
|
}, I = () => {
|
|
1550
|
-
const
|
|
1551
|
-
if (
|
|
1550
|
+
const E = jn(o), V = l.value;
|
|
1551
|
+
if (E === "connected" && V !== "connected") {
|
|
1552
1552
|
y("connected");
|
|
1553
1553
|
return;
|
|
1554
1554
|
}
|
|
1555
|
-
if (
|
|
1555
|
+
if (E === "connecting" && V !== "connecting") {
|
|
1556
1556
|
y("connecting");
|
|
1557
1557
|
return;
|
|
1558
1558
|
}
|
|
1559
|
-
if ((
|
|
1559
|
+
if ((E === "unavailable" || E === "failed" || E === "disconnected") && V !== "disconnected") {
|
|
1560
1560
|
y("disconnected");
|
|
1561
1561
|
return;
|
|
1562
1562
|
}
|
|
1563
1563
|
const ne = o.getConnectionStatus();
|
|
1564
|
-
!
|
|
1564
|
+
!E && ne === "connected" && V !== "connected" && y("connected");
|
|
1565
1565
|
}, ae = () => {
|
|
1566
|
-
if (f?.unbind &&
|
|
1566
|
+
if (f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = o.getEchoConnection(), b = null, !f?.bind)
|
|
1567
1567
|
return;
|
|
1568
|
-
|
|
1568
|
+
b = {
|
|
1569
1569
|
connected: () => y("connected"),
|
|
1570
1570
|
connecting: () => y("connecting"),
|
|
1571
1571
|
disconnected: () => y("disconnected"),
|
|
@@ -1583,31 +1583,31 @@ function Za(e = {}) {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
(ne === "unavailable" || ne === "failed" || ne === "disconnected") && y("disconnected");
|
|
1585
1585
|
}
|
|
1586
|
-
}, f.bind("connected",
|
|
1587
|
-
const
|
|
1588
|
-
if (
|
|
1586
|
+
}, f.bind("connected", b.connected), f.bind("connecting", b.connecting), f.bind("disconnected", b.disconnected), f.bind("unavailable", b.unavailable), f.bind("error", b.error), f.bind("state_change", b.stateChange);
|
|
1587
|
+
const E = f.state ?? null;
|
|
1588
|
+
if (E === "connected") {
|
|
1589
1589
|
y("connected");
|
|
1590
1590
|
return;
|
|
1591
1591
|
}
|
|
1592
|
-
if (
|
|
1592
|
+
if (E === "connecting") {
|
|
1593
1593
|
y("connecting");
|
|
1594
1594
|
return;
|
|
1595
1595
|
}
|
|
1596
|
-
(
|
|
1596
|
+
(E === "unavailable" || E === "failed" || E === "disconnected") && y("disconnected");
|
|
1597
1597
|
}, B = ie(() => {
|
|
1598
1598
|
if (!d.value || !N.value)
|
|
1599
1599
|
return null;
|
|
1600
|
-
const
|
|
1600
|
+
const E = Date.now() - d.value.getTime(), V = Math.floor(E / 6e4), ne = Math.floor(E % 6e4 / 1e3);
|
|
1601
1601
|
return V > 0 ? `${V}m ${ne}s` : `${ne}s`;
|
|
1602
1602
|
});
|
|
1603
1603
|
return jt(() => {
|
|
1604
|
-
l.value = o.getConnectionStatus(), C = o.onConnectionStatusChange(y), N.value && (d.value = /* @__PURE__ */ new Date()),
|
|
1604
|
+
l.value = o.getConnectionStatus(), C = o.onConnectionStatusChange(y), N.value && (d.value = /* @__PURE__ */ new Date()), te(l.value, l.value), _.value = !0, ae(), m = () => {
|
|
1605
1605
|
ae(), I();
|
|
1606
1606
|
}, window.addEventListener(o.initializedEvent, m), I(), w = setInterval(() => {
|
|
1607
1607
|
I();
|
|
1608
1608
|
}, 3e3);
|
|
1609
1609
|
}), De(() => {
|
|
1610
|
-
C?.(),
|
|
1610
|
+
C?.(), v && (clearTimeout(v), v = null), T && (clearTimeout(T), T = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = null, b = null;
|
|
1611
1611
|
}), {
|
|
1612
1612
|
connectionStatus: ie(() => l.value),
|
|
1613
1613
|
isConnected: N,
|
|
@@ -1717,20 +1717,20 @@ function ec() {
|
|
|
1717
1717
|
Ue.warn("Dropping malformed ConversationMessageSent event", B);
|
|
1718
1718
|
return;
|
|
1719
1719
|
}
|
|
1720
|
-
const
|
|
1721
|
-
if (!V ||
|
|
1722
|
-
e.addMessage(
|
|
1723
|
-
const ne = e.hasDetailSubscription(
|
|
1720
|
+
const E = B, V = n.currentUser?.id;
|
|
1721
|
+
if (!V || E.message.author_id === V) return;
|
|
1722
|
+
e.addMessage(E.message);
|
|
1723
|
+
const ne = e.hasDetailSubscription(E.conversation_id), _e = jo(E.conversation_id);
|
|
1724
1724
|
if (ne || _e) {
|
|
1725
|
-
const U = e.getConversationById(
|
|
1726
|
-
U && (U.unread_count = 0), e.markAsRead(
|
|
1725
|
+
const U = e.getConversationById(E.conversation_id);
|
|
1726
|
+
U && (U.unread_count = 0), e.markAsRead(E.conversation_id).catch(() => {
|
|
1727
1727
|
});
|
|
1728
1728
|
return;
|
|
1729
1729
|
}
|
|
1730
|
-
const
|
|
1731
|
-
if (
|
|
1732
|
-
const U = $o(
|
|
1733
|
-
U ||
|
|
1730
|
+
const A = e.getConversationById(E.conversation_id);
|
|
1731
|
+
if (A) {
|
|
1732
|
+
const U = $o(A);
|
|
1733
|
+
U || A.unread_count++, i(U);
|
|
1734
1734
|
}
|
|
1735
1735
|
}, me = (B) => {
|
|
1736
1736
|
if (!Fi(B)) {
|
|
@@ -1738,61 +1738,61 @@ function ec() {
|
|
|
1738
1738
|
return;
|
|
1739
1739
|
}
|
|
1740
1740
|
e.applyParticipantReadState(B);
|
|
1741
|
-
},
|
|
1741
|
+
}, te = (B) => {
|
|
1742
1742
|
if (!qi(B)) {
|
|
1743
1743
|
Ue.warn("Dropping malformed MessageReactionToggled event", B);
|
|
1744
1744
|
return;
|
|
1745
1745
|
}
|
|
1746
|
-
const
|
|
1747
|
-
e.updateMessageReactions(
|
|
1746
|
+
const E = B;
|
|
1747
|
+
e.updateMessageReactions(E.conversation_id, E.message_id, E.reactions);
|
|
1748
1748
|
}, y = (B) => {
|
|
1749
1749
|
if (!Ni(B)) {
|
|
1750
1750
|
Ue.warn("Dropping malformed ConversationMessageEdited event", B);
|
|
1751
1751
|
return;
|
|
1752
1752
|
}
|
|
1753
|
-
const
|
|
1753
|
+
const E = B, V = e.getMessagesByConversationId(E.conversation_id), ne = V.findIndex((A) => A.id === E.message.id);
|
|
1754
1754
|
if (ne >= 0) {
|
|
1755
|
-
const
|
|
1756
|
-
if (
|
|
1757
|
-
const U = { ...
|
|
1758
|
-
|
|
1755
|
+
const A = V[ne];
|
|
1756
|
+
if (A) {
|
|
1757
|
+
const U = { ...A };
|
|
1758
|
+
E.message.body !== void 0 && (U.body = E.message.body), E.message.edited_at !== void 0 && (U.edited_at = E.message.edited_at), E.message.meta !== void 0 && (U.meta = E.message.meta), V[ne] = U;
|
|
1759
1759
|
}
|
|
1760
1760
|
}
|
|
1761
|
-
const _e = e.getConversationById(
|
|
1762
|
-
_e?.last_message?.id ===
|
|
1761
|
+
const _e = e.getConversationById(E.conversation_id);
|
|
1762
|
+
_e?.last_message?.id === E.message.id && E.message.body !== void 0 && (_e.last_message = {
|
|
1763
1763
|
..._e.last_message,
|
|
1764
|
-
body:
|
|
1764
|
+
body: E.message.body
|
|
1765
1765
|
});
|
|
1766
1766
|
}, I = (B) => {
|
|
1767
1767
|
if (!Di(B)) {
|
|
1768
1768
|
Ue.warn("Dropping malformed ConversationMessageDeleted event", B);
|
|
1769
1769
|
return;
|
|
1770
1770
|
}
|
|
1771
|
-
const
|
|
1772
|
-
e.removeMessage(
|
|
1771
|
+
const E = B;
|
|
1772
|
+
e.removeMessage(E.conversation_id, E.message_id);
|
|
1773
1773
|
}, ae = (B) => {
|
|
1774
1774
|
if (!zi(B)) {
|
|
1775
1775
|
Ue.warn("Dropping malformed ConversationRequestAccepted event", B);
|
|
1776
1776
|
return;
|
|
1777
1777
|
}
|
|
1778
|
-
const
|
|
1778
|
+
const E = B, V = e.getConversationById(E.conversation_id);
|
|
1779
1779
|
V && (V.is_request = !1), e.requests = e.requests.filter(
|
|
1780
|
-
(ne) => ne.id !==
|
|
1780
|
+
(ne) => ne.id !== E.conversation_id
|
|
1781
1781
|
);
|
|
1782
1782
|
};
|
|
1783
|
-
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited", y), F.listen(".ConversationMessageDeleted", I), F.listen(".MessageReactionToggled",
|
|
1783
|
+
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited", y), F.listen(".ConversationMessageDeleted", I), F.listen(".MessageReactionToggled", te), F.listen(".ConversationRequestAccepted", ae), h.set(k, {
|
|
1784
1784
|
channel: F,
|
|
1785
1785
|
bindings: [
|
|
1786
1786
|
{ event: ".ConversationMessageSent", handler: J },
|
|
1787
1787
|
{ event: ".ConversationMessageRead", handler: me },
|
|
1788
1788
|
{ event: ".ConversationMessageEdited", handler: y },
|
|
1789
1789
|
{ event: ".ConversationMessageDeleted", handler: I },
|
|
1790
|
-
{ event: ".MessageReactionToggled", handler:
|
|
1790
|
+
{ event: ".MessageReactionToggled", handler: te },
|
|
1791
1791
|
{ event: ".ConversationRequestAccepted", handler: ae }
|
|
1792
1792
|
]
|
|
1793
1793
|
}), g.add(k), e.registerGlobalConversationSubscription(k);
|
|
1794
1794
|
}
|
|
1795
|
-
function
|
|
1795
|
+
function v() {
|
|
1796
1796
|
const k = Pe();
|
|
1797
1797
|
if (!k) {
|
|
1798
1798
|
_();
|
|
@@ -1854,7 +1854,7 @@ function ec() {
|
|
|
1854
1854
|
function m() {
|
|
1855
1855
|
!Pe() || x || (Ri(w), x = !0);
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function b() {
|
|
1858
1858
|
x && (Pi(), x = !1);
|
|
1859
1859
|
}
|
|
1860
1860
|
const N = Ot(
|
|
@@ -1869,10 +1869,10 @@ function ec() {
|
|
|
1869
1869
|
T();
|
|
1870
1870
|
}
|
|
1871
1871
|
), G = ht((k) => {
|
|
1872
|
-
k === "connected" ? (_(), T(),
|
|
1872
|
+
k === "connected" ? (_(), T(), b(), m(), f()) : (k === "disconnected" || k === "error") && (_(), b());
|
|
1873
1873
|
});
|
|
1874
1874
|
T(), m(), f(), l !== null && De(() => {
|
|
1875
|
-
N(), q(), G(),
|
|
1875
|
+
N(), q(), G(), v(), b();
|
|
1876
1876
|
});
|
|
1877
1877
|
}
|
|
1878
1878
|
function tc() {
|
|
@@ -2009,16 +2009,16 @@ function oa(e, n, i) {
|
|
|
2009
2009
|
function nc() {
|
|
2010
2010
|
const e = Fe()(), n = Ho(), i = ps(), o = ta(n.clientIdStorageKey);
|
|
2011
2011
|
let c = null, l = null, d = !1, g = It(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null, _ = 0;
|
|
2012
|
-
const C = () => Xo(n) ? n.authTokenResolver() !== null : !0,
|
|
2012
|
+
const C = () => Xo(n) ? n.authTokenResolver() !== null : !0, v = () => {
|
|
2013
2013
|
c && (clearInterval(c), c = null);
|
|
2014
2014
|
}, T = () => {
|
|
2015
2015
|
l && (clearTimeout(l), l = null);
|
|
2016
2016
|
}, w = () => {
|
|
2017
|
-
|
|
2017
|
+
v(), c = setInterval(() => {
|
|
2018
2018
|
F();
|
|
2019
2019
|
}, n.heartbeatIntervalMs);
|
|
2020
2020
|
}, f = (I) => {
|
|
2021
|
-
g || console.warn(I), sa(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null,
|
|
2021
|
+
g || console.warn(I), sa(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null, v(), T();
|
|
2022
2022
|
}, m = async (I) => {
|
|
2023
2023
|
if (!(!d || x || g || h) && C() && M !== I)
|
|
2024
2024
|
try {
|
|
@@ -2028,9 +2028,9 @@ function nc() {
|
|
|
2028
2028
|
f("[Presence] Presence updates paused: account is temporarily limited");
|
|
2029
2029
|
return;
|
|
2030
2030
|
}
|
|
2031
|
-
Lt(ae) && (h = !0, d = !1, M = null,
|
|
2031
|
+
Lt(ae) && (h = !0, d = !1, M = null, v(), T());
|
|
2032
2032
|
}
|
|
2033
|
-
},
|
|
2033
|
+
}, b = () => {
|
|
2034
2034
|
T(), !(!d || x || g || h || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
2035
2035
|
l = null, m("idle");
|
|
2036
2036
|
}, n.idleAfterMs));
|
|
@@ -2038,7 +2038,7 @@ function nc() {
|
|
|
2038
2038
|
if (x || !d || g || h || document.visibilityState !== "visible")
|
|
2039
2039
|
return;
|
|
2040
2040
|
const I = Date.now();
|
|
2041
|
-
I - _ < n.activityDebounceMs || (_ = I, m("online"),
|
|
2041
|
+
I - _ < n.activityDebounceMs || (_ = I, m("online"), b());
|
|
2042
2042
|
}, q = () => {
|
|
2043
2043
|
N();
|
|
2044
2044
|
}, G = () => {
|
|
@@ -2054,7 +2054,7 @@ function nc() {
|
|
|
2054
2054
|
user_agent: n.userAgentResolver()
|
|
2055
2055
|
}), ra(n.accountLimitedUntilStorageKey), g = !1, h = !1, d = !0, M = null, "opened";
|
|
2056
2056
|
} catch (I) {
|
|
2057
|
-
return kt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, M = null,
|
|
2057
|
+
return kt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, M = null, v(), T(), "account_suspended") : "failed";
|
|
2058
2058
|
}
|
|
2059
2059
|
}, H = async () => {
|
|
2060
2060
|
for (let I = 0; I < Zo; I += 1)
|
|
@@ -2070,7 +2070,7 @@ function nc() {
|
|
|
2070
2070
|
f("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2071
2071
|
return;
|
|
2072
2072
|
}
|
|
2073
|
-
Lt(I) && (h = !0, d = !1, M = null,
|
|
2073
|
+
Lt(I) && (h = !0, d = !1, M = null, v(), T());
|
|
2074
2074
|
}
|
|
2075
2075
|
}, J = () => {
|
|
2076
2076
|
if (!d)
|
|
@@ -2094,12 +2094,12 @@ function nc() {
|
|
|
2094
2094
|
J();
|
|
2095
2095
|
return;
|
|
2096
2096
|
}
|
|
2097
|
-
d && (w(), m("online"),
|
|
2097
|
+
d && (w(), m("online"), b());
|
|
2098
2098
|
}
|
|
2099
|
-
},
|
|
2099
|
+
}, te = () => {
|
|
2100
2100
|
if (!x) {
|
|
2101
2101
|
if (document.visibilityState === "hidden") {
|
|
2102
|
-
J(),
|
|
2102
|
+
J(), v(), T();
|
|
2103
2103
|
return;
|
|
2104
2104
|
}
|
|
2105
2105
|
if (document.visibilityState === "visible" && !d) {
|
|
@@ -2109,7 +2109,7 @@ function nc() {
|
|
|
2109
2109
|
document.visibilityState === "visible" && d && !g && !h && N();
|
|
2110
2110
|
}
|
|
2111
2111
|
}, y = () => {
|
|
2112
|
-
x || (J(),
|
|
2112
|
+
x || (J(), v(), T());
|
|
2113
2113
|
};
|
|
2114
2114
|
jt(async () => {
|
|
2115
2115
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
@@ -2117,69 +2117,69 @@ function nc() {
|
|
|
2117
2117
|
J();
|
|
2118
2118
|
return;
|
|
2119
2119
|
}
|
|
2120
|
-
d && (w(), m("online"),
|
|
2120
|
+
d && (w(), m("online"), b()), G(), document.addEventListener("visibilitychange", te), window.addEventListener("pagehide", y), window.addEventListener("beforeunload", y);
|
|
2121
2121
|
}
|
|
2122
2122
|
}), De(() => {
|
|
2123
|
-
x = !0, k(), T(),
|
|
2123
|
+
x = !0, k(), T(), v(), J(), document.removeEventListener("visibilitychange", te), window.removeEventListener("pagehide", y), window.removeEventListener("beforeunload", y);
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
const aa = 12e3;
|
|
2127
2127
|
function sc(e) {
|
|
2128
2128
|
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = ve([]), g = /* @__PURE__ */ new Map(), h = zt(), x = h !== null, M = 20, _ = 250;
|
|
2129
|
-
let C = !1,
|
|
2130
|
-
const f = ie(() => i.currentUser?.id), m = () => Xn(e)?.trim() ?? "",
|
|
2131
|
-
const
|
|
2132
|
-
if (
|
|
2133
|
-
return
|
|
2129
|
+
let C = !1, v = null, T = 0, w = null;
|
|
2130
|
+
const f = ie(() => i.currentUser?.id), m = () => Xn(e)?.trim() ?? "", b = () => {
|
|
2131
|
+
const A = l.value?.trim() ?? "";
|
|
2132
|
+
if (A.length > 0)
|
|
2133
|
+
return A;
|
|
2134
2134
|
const U = m();
|
|
2135
2135
|
return U.length > 0 && (l.value = U), U;
|
|
2136
|
-
}, N = (
|
|
2137
|
-
const U = N(
|
|
2136
|
+
}, N = (A) => n.getTypingUsers(A), q = (A) => {
|
|
2137
|
+
const U = N(A);
|
|
2138
2138
|
for (const re of U)
|
|
2139
|
-
n.removeTypingUser(
|
|
2139
|
+
n.removeTypingUser(A, re.id);
|
|
2140
2140
|
d.value = [];
|
|
2141
|
-
}, G = (
|
|
2142
|
-
const U = g.get(
|
|
2143
|
-
U && (clearTimeout(U), g.delete(
|
|
2141
|
+
}, G = (A) => {
|
|
2142
|
+
const U = g.get(A);
|
|
2143
|
+
U && (clearTimeout(U), g.delete(A));
|
|
2144
2144
|
}, k = () => {
|
|
2145
|
-
for (const
|
|
2146
|
-
clearTimeout(
|
|
2145
|
+
for (const A of g.values())
|
|
2146
|
+
clearTimeout(A);
|
|
2147
2147
|
g.clear();
|
|
2148
2148
|
}, O = () => {
|
|
2149
2149
|
w && (clearTimeout(w), w = null), T = 0;
|
|
2150
2150
|
}, H = () => {
|
|
2151
2151
|
!x || o.value || w || T >= M || (w = setTimeout(() => {
|
|
2152
|
-
w = null, T += 1,
|
|
2152
|
+
w = null, T += 1, te();
|
|
2153
2153
|
}, _));
|
|
2154
|
-
}, F = (
|
|
2155
|
-
G(
|
|
2154
|
+
}, F = (A, U) => {
|
|
2155
|
+
G(A);
|
|
2156
2156
|
const re = setTimeout(() => {
|
|
2157
|
-
g.delete(
|
|
2157
|
+
g.delete(A), n.removeTypingUser(U, A), d.value = d.value.filter((fe) => fe.id !== A);
|
|
2158
2158
|
}, aa);
|
|
2159
|
-
g.set(
|
|
2159
|
+
g.set(A, re);
|
|
2160
2160
|
}, J = () => {
|
|
2161
2161
|
C = !0, O();
|
|
2162
|
-
}, me = (
|
|
2162
|
+
}, me = (A) => {
|
|
2163
2163
|
try {
|
|
2164
|
-
|
|
2164
|
+
v && (v(), v = null), v = ki(A, {
|
|
2165
2165
|
onTypingStart: I,
|
|
2166
2166
|
onTypingStop: ae
|
|
2167
|
-
}), O(), o.value = !0, l.value =
|
|
2167
|
+
}), O(), o.value = !0, l.value = A;
|
|
2168
2168
|
} catch (U) {
|
|
2169
2169
|
c.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
|
|
2170
2170
|
}
|
|
2171
|
-
},
|
|
2172
|
-
const
|
|
2173
|
-
if (!(o.value || !
|
|
2171
|
+
}, te = () => {
|
|
2172
|
+
const A = m();
|
|
2173
|
+
if (!(o.value || !A)) {
|
|
2174
2174
|
if (c.value = null, Pe() && Tn() === "connected") {
|
|
2175
|
-
me(
|
|
2175
|
+
me(A);
|
|
2176
2176
|
return;
|
|
2177
2177
|
}
|
|
2178
2178
|
C = !1, Ti().then((U) => {
|
|
2179
2179
|
if (C || o.value || !U)
|
|
2180
2180
|
return;
|
|
2181
2181
|
const re = m();
|
|
2182
|
-
if (re && re ===
|
|
2182
|
+
if (re && re === A && Pe() && Tn() === "connected") {
|
|
2183
2183
|
me(re);
|
|
2184
2184
|
return;
|
|
2185
2185
|
}
|
|
@@ -2187,39 +2187,39 @@ function sc(e) {
|
|
|
2187
2187
|
}), H();
|
|
2188
2188
|
}
|
|
2189
2189
|
}, y = () => {
|
|
2190
|
-
const
|
|
2191
|
-
if (J(), !(!o.value || !
|
|
2190
|
+
const A = l.value;
|
|
2191
|
+
if (J(), !(!o.value || !A))
|
|
2192
2192
|
try {
|
|
2193
|
-
|
|
2193
|
+
v && (v(), v = null), Li(A), k(), q(A), o.value = !1, l.value = null, c.value = null;
|
|
2194
2194
|
} catch (U) {
|
|
2195
2195
|
c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2196
2196
|
}
|
|
2197
2197
|
};
|
|
2198
|
-
function I(
|
|
2199
|
-
if (
|
|
2198
|
+
function I(A) {
|
|
2199
|
+
if (A.user_id === f.value)
|
|
2200
2200
|
return;
|
|
2201
|
-
const U =
|
|
2201
|
+
const U = b();
|
|
2202
2202
|
if (!U)
|
|
2203
2203
|
return;
|
|
2204
2204
|
const re = {
|
|
2205
|
-
id:
|
|
2206
|
-
name:
|
|
2207
|
-
...
|
|
2205
|
+
id: A.user.id,
|
|
2206
|
+
name: A.user.name,
|
|
2207
|
+
...A.user.avatar !== void 0 ? { avatar: A.user.avatar } : {}
|
|
2208
2208
|
};
|
|
2209
|
-
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(U, re), F(
|
|
2209
|
+
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(U, re), F(A.user_id, U);
|
|
2210
2210
|
}
|
|
2211
|
-
function ae(
|
|
2212
|
-
if (
|
|
2211
|
+
function ae(A) {
|
|
2212
|
+
if (A.user_id === f.value)
|
|
2213
2213
|
return;
|
|
2214
|
-
G(
|
|
2215
|
-
const U =
|
|
2216
|
-
U && (d.value = d.value.filter((re) => re.id !==
|
|
2214
|
+
G(A.user_id);
|
|
2215
|
+
const U = b();
|
|
2216
|
+
U && (d.value = d.value.filter((re) => re.id !== A.user_id), n.removeTypingUser(U, A.user_id));
|
|
2217
2217
|
}
|
|
2218
2218
|
const B = ie(() => {
|
|
2219
|
-
const
|
|
2220
|
-
if (!
|
|
2219
|
+
const A = b();
|
|
2220
|
+
if (!A)
|
|
2221
2221
|
return d.value;
|
|
2222
|
-
const U = N(
|
|
2222
|
+
const U = N(A);
|
|
2223
2223
|
if (d.value.length === 0)
|
|
2224
2224
|
return U;
|
|
2225
2225
|
if (U.length === 0)
|
|
@@ -2230,34 +2230,34 @@ function sc(e) {
|
|
|
2230
2230
|
for (const fe of d.value)
|
|
2231
2231
|
re.set(fe.id, fe);
|
|
2232
2232
|
return [...re.values()];
|
|
2233
|
-
}),
|
|
2234
|
-
const
|
|
2235
|
-
if (
|
|
2233
|
+
}), E = ie(() => {
|
|
2234
|
+
const A = B.value;
|
|
2235
|
+
if (A.length === 0)
|
|
2236
2236
|
return "";
|
|
2237
|
-
const U =
|
|
2237
|
+
const U = A[0];
|
|
2238
2238
|
if (!U)
|
|
2239
2239
|
return "";
|
|
2240
|
-
if (
|
|
2240
|
+
if (A.length === 1)
|
|
2241
2241
|
return `${U.name} is typing...`;
|
|
2242
|
-
const re =
|
|
2242
|
+
const re = A[1];
|
|
2243
2243
|
if (!re)
|
|
2244
|
-
return `${
|
|
2245
|
-
if (
|
|
2244
|
+
return `${A.length} people are typing...`;
|
|
2245
|
+
if (A.length === 2)
|
|
2246
2246
|
return `${U.name} and ${re.name} are typing...`;
|
|
2247
|
-
const fe =
|
|
2248
|
-
return fe ?
|
|
2247
|
+
const fe = A[2];
|
|
2248
|
+
return fe ? A.length === 3 ? `${U.name}, ${re.name} and ${fe.name} are typing...` : `${A.length} people are typing...` : `${A.length} people are typing...`;
|
|
2249
2249
|
}), V = ie(() => B.value.length > 0), ne = () => {
|
|
2250
|
-
o.value
|
|
2250
|
+
m() && (v && (v(), v = null), o.value = !1, l.value = null, te());
|
|
2251
2251
|
};
|
|
2252
2252
|
typeof window < "u" && window.addEventListener(We(), ne);
|
|
2253
|
-
const _e = ht((
|
|
2254
|
-
if (
|
|
2255
|
-
o.value ||
|
|
2253
|
+
const _e = ht((A) => {
|
|
2254
|
+
if (A === "connected") {
|
|
2255
|
+
o.value || te();
|
|
2256
2256
|
return;
|
|
2257
2257
|
}
|
|
2258
|
-
if (
|
|
2259
|
-
J(),
|
|
2260
|
-
const U =
|
|
2258
|
+
if (A === "disconnected" || A === "error") {
|
|
2259
|
+
J(), v && (v(), v = null);
|
|
2260
|
+
const U = b();
|
|
2261
2261
|
U && q(U), o.value = !1, l.value = null, k();
|
|
2262
2262
|
}
|
|
2263
2263
|
});
|
|
@@ -2267,9 +2267,9 @@ function sc(e) {
|
|
|
2267
2267
|
isSubscribed: ie(() => o.value),
|
|
2268
2268
|
error: ie(() => c.value),
|
|
2269
2269
|
typingUsers: B,
|
|
2270
|
-
formatTypingIndicator:
|
|
2270
|
+
formatTypingIndicator: E,
|
|
2271
2271
|
hasTypingUsers: V,
|
|
2272
|
-
subscribe:
|
|
2272
|
+
subscribe: te,
|
|
2273
2273
|
unsubscribe: y
|
|
2274
2274
|
};
|
|
2275
2275
|
}
|
|
@@ -3282,18 +3282,18 @@ function va() {
|
|
|
3282
3282
|
(function(i, o, c) {
|
|
3283
3283
|
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3284
3284
|
var w = function(f, m) {
|
|
3285
|
-
return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
3286
|
-
|
|
3287
|
-
} || function(
|
|
3288
|
-
for (var q in N) N.hasOwnProperty(q) && (
|
|
3285
|
+
return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(b, N) {
|
|
3286
|
+
b.__proto__ = N;
|
|
3287
|
+
} || function(b, N) {
|
|
3288
|
+
for (var q in N) N.hasOwnProperty(q) && (b[q] = N[q]);
|
|
3289
3289
|
}, w(f, m);
|
|
3290
3290
|
};
|
|
3291
3291
|
return function(f, m) {
|
|
3292
3292
|
w(f, m);
|
|
3293
|
-
function
|
|
3293
|
+
function b() {
|
|
3294
3294
|
this.constructor = f;
|
|
3295
3295
|
}
|
|
3296
|
-
f.prototype = m === null ? Object.create(m) : (
|
|
3296
|
+
f.prototype = m === null ? Object.create(m) : (b.prototype = m.prototype, new b());
|
|
3297
3297
|
};
|
|
3298
3298
|
})();
|
|
3299
3299
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
@@ -3306,13 +3306,13 @@ function va() {
|
|
|
3306
3306
|
return w.prototype.encodedLength = function(f) {
|
|
3307
3307
|
return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
|
|
3308
3308
|
}, w.prototype.encode = function(f) {
|
|
3309
|
-
for (var m = "",
|
|
3310
|
-
var N = f[
|
|
3309
|
+
for (var m = "", b = 0; b < f.length - 2; b += 3) {
|
|
3310
|
+
var N = f[b] << 16 | f[b + 1] << 8 | f[b + 2];
|
|
3311
3311
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), m += this._encodeByte(N >>> 6 & 63), m += this._encodeByte(N >>> 0 & 63);
|
|
3312
3312
|
}
|
|
3313
|
-
var q = f.length -
|
|
3313
|
+
var q = f.length - b;
|
|
3314
3314
|
if (q > 0) {
|
|
3315
|
-
var N = f[
|
|
3315
|
+
var N = f[b] << 16 | (q === 2 ? f[b + 1] << 8 : 0);
|
|
3316
3316
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), q === 2 ? m += this._encodeByte(N >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
|
|
3317
3317
|
}
|
|
3318
3318
|
return m;
|
|
@@ -3323,9 +3323,9 @@ function va() {
|
|
|
3323
3323
|
}, w.prototype.decode = function(f) {
|
|
3324
3324
|
if (f.length === 0)
|
|
3325
3325
|
return new Uint8Array(0);
|
|
3326
|
-
for (var m = this._getPaddingLength(f),
|
|
3326
|
+
for (var m = this._getPaddingLength(f), b = f.length - m, N = new Uint8Array(this.maxDecodedLength(b)), q = 0, G = 0, k = 0, O = 0, H = 0, F = 0, J = 0; G < b - 4; G += 4)
|
|
3327
3327
|
O = this._decodeChar(f.charCodeAt(G + 0)), H = this._decodeChar(f.charCodeAt(G + 1)), F = this._decodeChar(f.charCodeAt(G + 2)), J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = O << 2 | H >>> 4, N[q++] = H << 4 | F >>> 2, N[q++] = F << 6 | J, k |= O & d, k |= H & d, k |= F & d, k |= J & d;
|
|
3328
|
-
if (G <
|
|
3328
|
+
if (G < b - 1 && (O = this._decodeChar(f.charCodeAt(G)), H = this._decodeChar(f.charCodeAt(G + 1)), N[q++] = O << 2 | H >>> 4, k |= O & d, k |= H & d), G < b - 2 && (F = this._decodeChar(f.charCodeAt(G + 2)), N[q++] = H << 4 | F >>> 2, k |= F & d), G < b - 3 && (J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = F << 6 | J, k |= J & d), k !== 0)
|
|
3329
3329
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3330
3330
|
return N;
|
|
3331
3331
|
}, w.prototype._encodeByte = function(f) {
|
|
@@ -3337,7 +3337,7 @@ function va() {
|
|
|
3337
3337
|
}, w.prototype._getPaddingLength = function(f) {
|
|
3338
3338
|
var m = 0;
|
|
3339
3339
|
if (this._paddingCharacter) {
|
|
3340
|
-
for (var
|
|
3340
|
+
for (var b = f.length - 1; b >= 0 && f[b] === this._paddingCharacter; b--)
|
|
3341
3341
|
m++;
|
|
3342
3342
|
if (f.length < 4 || m > 2)
|
|
3343
3343
|
throw new Error("Base64Coder: incorrect padding");
|
|
@@ -3364,20 +3364,20 @@ function va() {
|
|
|
3364
3364
|
return w !== null && w.apply(this, arguments) || this;
|
|
3365
3365
|
}
|
|
3366
3366
|
return f.prototype._encodeByte = function(m) {
|
|
3367
|
-
var
|
|
3368
|
-
return
|
|
3367
|
+
var b = m;
|
|
3368
|
+
return b += 65, b += 25 - m >>> 8 & 6, b += 51 - m >>> 8 & -75, b += 61 - m >>> 8 & -13, b += 62 - m >>> 8 & 49, String.fromCharCode(b);
|
|
3369
3369
|
}, f.prototype._decodeChar = function(m) {
|
|
3370
|
-
var
|
|
3371
|
-
return
|
|
3370
|
+
var b = d;
|
|
3371
|
+
return b += (44 - m & m - 46) >>> 8 & -d + m - 45 + 62, b += (94 - m & m - 96) >>> 8 & -d + m - 95 + 63, b += (47 - m & m - 58) >>> 8 & -d + m - 48 + 52, b += (64 - m & m - 91) >>> 8 & -d + m - 65 + 0, b += (96 - m & m - 123) >>> 8 & -d + m - 97 + 26, b;
|
|
3372
3372
|
}, f;
|
|
3373
3373
|
})(g)
|
|
3374
3374
|
);
|
|
3375
3375
|
o.URLSafeCoder = _;
|
|
3376
3376
|
var C = new _();
|
|
3377
|
-
function
|
|
3377
|
+
function v(w) {
|
|
3378
3378
|
return C.encode(w);
|
|
3379
3379
|
}
|
|
3380
|
-
o.encodeURLSafe =
|
|
3380
|
+
o.encodeURLSafe = v;
|
|
3381
3381
|
function T(w) {
|
|
3382
3382
|
return C.decode(w);
|
|
3383
3383
|
}
|
|
@@ -3395,23 +3395,23 @@ function va() {
|
|
|
3395
3395
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3396
3396
|
var l = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3397
3397
|
function g(M) {
|
|
3398
|
-
for (var _ = new Uint8Array(h(M)), C = 0,
|
|
3399
|
-
var T = M.charCodeAt(
|
|
3400
|
-
T < 128 ? _[C++] = T : T < 2048 ? (_[C++] = 192 | T >> 6, _[C++] = 128 | T & 63) : T < 55296 ? (_[C++] = 224 | T >> 12, _[C++] = 128 | T >> 6 & 63, _[C++] = 128 | T & 63) : (
|
|
3398
|
+
for (var _ = new Uint8Array(h(M)), C = 0, v = 0; v < M.length; v++) {
|
|
3399
|
+
var T = M.charCodeAt(v);
|
|
3400
|
+
T < 128 ? _[C++] = T : T < 2048 ? (_[C++] = 192 | T >> 6, _[C++] = 128 | T & 63) : T < 55296 ? (_[C++] = 224 | T >> 12, _[C++] = 128 | T >> 6 & 63, _[C++] = 128 | T & 63) : (v++, T = (T & 1023) << 10, T |= M.charCodeAt(v) & 1023, T += 65536, _[C++] = 240 | T >> 18, _[C++] = 128 | T >> 12 & 63, _[C++] = 128 | T >> 6 & 63, _[C++] = 128 | T & 63);
|
|
3401
3401
|
}
|
|
3402
3402
|
return _;
|
|
3403
3403
|
}
|
|
3404
3404
|
o.encode = g;
|
|
3405
3405
|
function h(M) {
|
|
3406
3406
|
for (var _ = 0, C = 0; C < M.length; C++) {
|
|
3407
|
-
var
|
|
3408
|
-
if (
|
|
3407
|
+
var v = M.charCodeAt(C);
|
|
3408
|
+
if (v < 128)
|
|
3409
3409
|
_ += 1;
|
|
3410
|
-
else if (
|
|
3410
|
+
else if (v < 2048)
|
|
3411
3411
|
_ += 2;
|
|
3412
|
-
else if (
|
|
3412
|
+
else if (v < 55296)
|
|
3413
3413
|
_ += 3;
|
|
3414
|
-
else if (
|
|
3414
|
+
else if (v <= 57343) {
|
|
3415
3415
|
if (C >= M.length - 1)
|
|
3416
3416
|
throw new Error(l);
|
|
3417
3417
|
C++, _ += 4;
|
|
@@ -3423,41 +3423,41 @@ function va() {
|
|
|
3423
3423
|
o.encodedLength = h;
|
|
3424
3424
|
function x(M) {
|
|
3425
3425
|
for (var _ = [], C = 0; C < M.length; C++) {
|
|
3426
|
-
var
|
|
3427
|
-
if (
|
|
3426
|
+
var v = M[C];
|
|
3427
|
+
if (v & 128) {
|
|
3428
3428
|
var T = void 0;
|
|
3429
|
-
if (
|
|
3429
|
+
if (v < 224) {
|
|
3430
3430
|
if (C >= M.length)
|
|
3431
3431
|
throw new Error(d);
|
|
3432
3432
|
var w = M[++C];
|
|
3433
3433
|
if ((w & 192) !== 128)
|
|
3434
3434
|
throw new Error(d);
|
|
3435
|
-
|
|
3436
|
-
} else if (
|
|
3435
|
+
v = (v & 31) << 6 | w & 63, T = 128;
|
|
3436
|
+
} else if (v < 240) {
|
|
3437
3437
|
if (C >= M.length - 1)
|
|
3438
3438
|
throw new Error(d);
|
|
3439
3439
|
var w = M[++C], f = M[++C];
|
|
3440
3440
|
if ((w & 192) !== 128 || (f & 192) !== 128)
|
|
3441
3441
|
throw new Error(d);
|
|
3442
|
-
|
|
3443
|
-
} else if (
|
|
3442
|
+
v = (v & 15) << 12 | (w & 63) << 6 | f & 63, T = 2048;
|
|
3443
|
+
} else if (v < 248) {
|
|
3444
3444
|
if (C >= M.length - 2)
|
|
3445
3445
|
throw new Error(d);
|
|
3446
3446
|
var w = M[++C], f = M[++C], m = M[++C];
|
|
3447
3447
|
if ((w & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
|
|
3448
3448
|
throw new Error(d);
|
|
3449
|
-
|
|
3449
|
+
v = (v & 15) << 18 | (w & 63) << 12 | (f & 63) << 6 | m & 63, T = 65536;
|
|
3450
3450
|
} else
|
|
3451
3451
|
throw new Error(d);
|
|
3452
|
-
if (
|
|
3452
|
+
if (v < T || v >= 55296 && v <= 57343)
|
|
3453
3453
|
throw new Error(d);
|
|
3454
|
-
if (
|
|
3455
|
-
if (
|
|
3454
|
+
if (v >= 65536) {
|
|
3455
|
+
if (v > 1114111)
|
|
3456
3456
|
throw new Error(d);
|
|
3457
|
-
|
|
3457
|
+
v -= 65536, _.push(String.fromCharCode(55296 | v >> 10)), v = 56320 | v & 1023;
|
|
3458
3458
|
}
|
|
3459
3459
|
}
|
|
3460
|
-
_.push(String.fromCharCode(
|
|
3460
|
+
_.push(String.fromCharCode(v));
|
|
3461
3461
|
}
|
|
3462
3462
|
return _.join("");
|
|
3463
3463
|
}
|
|
@@ -3531,8 +3531,8 @@ function va() {
|
|
|
3531
3531
|
delete u.loading[t];
|
|
3532
3532
|
for (var Q = function(ce) {
|
|
3533
3533
|
ce || p.cleanup();
|
|
3534
|
-
},
|
|
3535
|
-
z[
|
|
3534
|
+
}, ee = 0; ee < z.length; ee++)
|
|
3535
|
+
z[ee](L, Q);
|
|
3536
3536
|
}
|
|
3537
3537
|
});
|
|
3538
3538
|
p.send(S);
|
|
@@ -3593,7 +3593,7 @@ function va() {
|
|
|
3593
3593
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3594
3594
|
}
|
|
3595
3595
|
}
|
|
3596
|
-
class
|
|
3596
|
+
class b extends Error {
|
|
3597
3597
|
constructor(t) {
|
|
3598
3598
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3599
3599
|
}
|
|
@@ -3663,11 +3663,11 @@ function va() {
|
|
|
3663
3663
|
}, p.send(t), p;
|
|
3664
3664
|
};
|
|
3665
3665
|
function me(r) {
|
|
3666
|
-
return
|
|
3666
|
+
return E(ae(r));
|
|
3667
3667
|
}
|
|
3668
|
-
var
|
|
3668
|
+
var te = String.fromCharCode, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(r) {
|
|
3669
3669
|
var t = r.charCodeAt(0);
|
|
3670
|
-
return t < 128 ? r : t < 2048 ?
|
|
3670
|
+
return t < 128 ? r : t < 2048 ? te(192 | t >>> 6) + te(128 | t & 63) : te(224 | t >>> 12 & 15) + te(128 | t >>> 6 & 63) + te(128 | t & 63);
|
|
3671
3671
|
}, ae = function(r) {
|
|
3672
3672
|
return r.replace(/[^\x00-\x7F]/g, I);
|
|
3673
3673
|
}, B = function(r) {
|
|
@@ -3678,7 +3678,7 @@ function va() {
|
|
|
3678
3678
|
t >= 1 ? "=" : y.charAt(s & 63)
|
|
3679
3679
|
];
|
|
3680
3680
|
return a.join("");
|
|
3681
|
-
},
|
|
3681
|
+
}, E = window.btoa || function(r) {
|
|
3682
3682
|
return r.replace(/[\s\S]{1,3}/g, B);
|
|
3683
3683
|
};
|
|
3684
3684
|
class V {
|
|
@@ -3698,7 +3698,7 @@ function va() {
|
|
|
3698
3698
|
function _e(r) {
|
|
3699
3699
|
window.clearTimeout(r);
|
|
3700
3700
|
}
|
|
3701
|
-
function
|
|
3701
|
+
function A(r) {
|
|
3702
3702
|
window.clearInterval(r);
|
|
3703
3703
|
}
|
|
3704
3704
|
class U extends ne {
|
|
@@ -3710,7 +3710,7 @@ function va() {
|
|
|
3710
3710
|
}
|
|
3711
3711
|
class re extends ne {
|
|
3712
3712
|
constructor(t, s) {
|
|
3713
|
-
super(setInterval,
|
|
3713
|
+
super(setInterval, A, t, function(a) {
|
|
3714
3714
|
return s(), a;
|
|
3715
3715
|
});
|
|
3716
3716
|
}
|
|
@@ -3742,7 +3742,7 @@ function va() {
|
|
|
3742
3742
|
typeof arguments[t] == "string" ? r.push(arguments[t]) : r.push(Ye(arguments[t]));
|
|
3743
3743
|
return r.join(" : ");
|
|
3744
3744
|
}
|
|
3745
|
-
function
|
|
3745
|
+
function R(r, t) {
|
|
3746
3746
|
var s = Array.prototype.indexOf;
|
|
3747
3747
|
if (r === null)
|
|
3748
3748
|
return -1;
|
|
@@ -3892,8 +3892,8 @@ function va() {
|
|
|
3892
3892
|
var p = r.nextAuthCallbackID.toString();
|
|
3893
3893
|
r.nextAuthCallbackID++;
|
|
3894
3894
|
var S = r.getDocument(), L = S.createElement("script");
|
|
3895
|
-
r.auth_callbacks[p] = function(
|
|
3896
|
-
u(null,
|
|
3895
|
+
r.auth_callbacks[p] = function(ee) {
|
|
3896
|
+
u(null, ee);
|
|
3897
3897
|
};
|
|
3898
3898
|
var z = "Pusher.auth_callbacks['" + p + "']";
|
|
3899
3899
|
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
@@ -4226,8 +4226,8 @@ function va() {
|
|
|
4226
4226
|
if (p.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
|
|
4227
4227
|
this.manager.reportDeath();
|
|
4228
4228
|
else if (!Q.wasClean && S) {
|
|
4229
|
-
var
|
|
4230
|
-
|
|
4229
|
+
var ee = ue.now() - S;
|
|
4230
|
+
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4231
4231
|
}
|
|
4232
4232
|
};
|
|
4233
4233
|
return p.bind("open", L), p;
|
|
@@ -4516,22 +4516,22 @@ function va() {
|
|
|
4516
4516
|
});
|
|
4517
4517
|
}
|
|
4518
4518
|
return new (s || (s = Promise))(function(p, S) {
|
|
4519
|
-
function L(
|
|
4519
|
+
function L(ee) {
|
|
4520
4520
|
try {
|
|
4521
|
-
Q(a.next(
|
|
4521
|
+
Q(a.next(ee));
|
|
4522
4522
|
} catch (ce) {
|
|
4523
4523
|
S(ce);
|
|
4524
4524
|
}
|
|
4525
4525
|
}
|
|
4526
|
-
function z(
|
|
4526
|
+
function z(ee) {
|
|
4527
4527
|
try {
|
|
4528
|
-
Q(a.throw(
|
|
4528
|
+
Q(a.throw(ee));
|
|
4529
4529
|
} catch (ce) {
|
|
4530
4530
|
S(ce);
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
4533
|
-
function Q(
|
|
4534
|
-
|
|
4533
|
+
function Q(ee) {
|
|
4534
|
+
ee.done ? p(ee.value) : u(ee.value).then(L, z);
|
|
4535
4535
|
}
|
|
4536
4536
|
Q((a = a.apply(r, t || [])).next());
|
|
4537
4537
|
});
|
|
@@ -5007,15 +5007,15 @@ function va() {
|
|
|
5007
5007
|
failFast: !0
|
|
5008
5008
|
}))) : p++);
|
|
5009
5009
|
}
|
|
5010
|
-
var z = ue.now(), Q = S.pop().connect(t, function
|
|
5011
|
-
ce ? (ln(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t,
|
|
5010
|
+
var z = ue.now(), Q = S.pop().connect(t, function ee(ce, nt) {
|
|
5011
|
+
ce ? (ln(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (gr(a, nt.transport.name, ue.now() - z, p), s(null, nt));
|
|
5012
5012
|
});
|
|
5013
5013
|
return {
|
|
5014
5014
|
abort: function() {
|
|
5015
5015
|
Q.abort();
|
|
5016
5016
|
},
|
|
5017
|
-
forceMinPriority: function(
|
|
5018
|
-
t =
|
|
5017
|
+
forceMinPriority: function(ee) {
|
|
5018
|
+
t = ee, Q && Q.forceMinPriority(ee);
|
|
5019
5019
|
}
|
|
5020
5020
|
};
|
|
5021
5021
|
}
|
|
@@ -5132,11 +5132,11 @@ function va() {
|
|
|
5132
5132
|
}, Q = new un({
|
|
5133
5133
|
minPingDelay: 1e4,
|
|
5134
5134
|
maxPingDelay: r.activityTimeout
|
|
5135
|
-
}),
|
|
5135
|
+
}), ee = new un({
|
|
5136
5136
|
lives: 2,
|
|
5137
5137
|
minPingDelay: 1e4,
|
|
5138
5138
|
maxPingDelay: r.activityTimeout
|
|
5139
|
-
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q), di = u("sockjs", "sockjs", 1, L), gn = u("xhr_streaming", "xhr_streaming", 1, L,
|
|
5139
|
+
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q), di = u("sockjs", "sockjs", 1, L), gn = u("xhr_streaming", "xhr_streaming", 1, L, ee), hi = u("xdr_streaming", "xdr_streaming", 1, L, ee), mn = u("xhr_polling", "xhr_polling", 1, L), fi = u("xdr_polling", "xdr_polling", 1, L), vn = new Le([ce], z), pi = new Le([nt], z), gi = new Le([di], z), bn = new Le([
|
|
5140
5140
|
new ze(je(gn), gn, hi)
|
|
5141
5141
|
], z), yn = new Le([
|
|
5142
5142
|
new ze(je(mn), mn, fi)
|
|
@@ -5169,7 +5169,7 @@ function va() {
|
|
|
5169
5169
|
getRequest: function(r) {
|
|
5170
5170
|
var t = new window.XDomainRequest();
|
|
5171
5171
|
return t.ontimeout = function() {
|
|
5172
|
-
r.emit("error", new
|
|
5172
|
+
r.emit("error", new b()), r.close();
|
|
5173
5173
|
}, t.onerror = function(s) {
|
|
5174
5174
|
r.emit("error", s), r.close();
|
|
5175
5175
|
}, t.onprogress = function() {
|
|
@@ -5551,20 +5551,20 @@ function va() {
|
|
|
5551
5551
|
u.unbind("initialized", S), u.connect();
|
|
5552
5552
|
}, L = function() {
|
|
5553
5553
|
p = Ee.createHandshake(u, function(ce) {
|
|
5554
|
-
a = !0,
|
|
5554
|
+
a = !0, ee(), s(null, ce);
|
|
5555
5555
|
});
|
|
5556
5556
|
}, z = function(ce) {
|
|
5557
|
-
|
|
5557
|
+
ee(), s(ce);
|
|
5558
5558
|
}, Q = function() {
|
|
5559
|
-
|
|
5559
|
+
ee();
|
|
5560
5560
|
var ce;
|
|
5561
5561
|
ce = Ye(u), s(new q(ce));
|
|
5562
|
-
},
|
|
5562
|
+
}, ee = function() {
|
|
5563
5563
|
u.unbind("initialized", S), u.unbind("open", L), u.unbind("error", z), u.unbind("closed", Q);
|
|
5564
5564
|
};
|
|
5565
5565
|
return u.bind("initialized", S), u.bind("open", L), u.bind("error", z), u.bind("closed", Q), u.initialize(), {
|
|
5566
5566
|
abort: () => {
|
|
5567
|
-
a || (
|
|
5567
|
+
a || (ee(), p ? p.close() : u.close());
|
|
5568
5568
|
},
|
|
5569
5569
|
forceMinPriority: (ce) => {
|
|
5570
5570
|
a || this.priority < ce && (p ? p.close() : u.close());
|
|
@@ -5587,7 +5587,7 @@ function va() {
|
|
|
5587
5587
|
var S = $r[s];
|
|
5588
5588
|
if (!S)
|
|
5589
5589
|
throw new k(s);
|
|
5590
|
-
var L = (!r.enabledTransports ||
|
|
5590
|
+
var L = (!r.enabledTransports || R(r.enabledTransports, t) !== -1) && (!r.disabledTransports || R(r.disabledTransports, t) === -1), z;
|
|
5591
5591
|
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new jr(t, a, p ? p.getAssistant(S) : S, u)) : z = Br, z;
|
|
5592
5592
|
}, Br = {
|
|
5593
5593
|
isSupported: function() {
|
|
@@ -6144,68 +6144,68 @@ function Oe(e, n, i, o) {
|
|
|
6144
6144
|
function oc(e) {
|
|
6145
6145
|
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? _a, o = e.bootstrapRefreshSkewMs ?? Sa, c = e.presenceFreshnessTtlMs ?? wa, l = (e.createLogger ?? Kt())("MessengerEcho");
|
|
6146
6146
|
typeof window < "u" && (window.Pusher = ya);
|
|
6147
|
-
let d = null, g = null, h = null, x = null, M = "disconnected", _ = "available", C = null,
|
|
6148
|
-
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (
|
|
6149
|
-
M =
|
|
6147
|
+
let d = null, g = null, h = null, x = null, M = "disconnected", _ = "available", C = null, v = null;
|
|
6148
|
+
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (R) => {
|
|
6149
|
+
M = R;
|
|
6150
6150
|
for (const P of T)
|
|
6151
|
-
P(
|
|
6152
|
-
},
|
|
6153
|
-
_ =
|
|
6151
|
+
P(R);
|
|
6152
|
+
}, b = (R) => {
|
|
6153
|
+
_ = R;
|
|
6154
6154
|
for (const P of w)
|
|
6155
|
-
P(
|
|
6155
|
+
P(R);
|
|
6156
6156
|
}, N = () => {
|
|
6157
|
-
|
|
6158
|
-
}, q = (
|
|
6159
|
-
h !== null && (h.disconnect(), h = null), x = null,
|
|
6157
|
+
v !== null && (clearTimeout(v), v = null);
|
|
6158
|
+
}, q = (R = !0) => {
|
|
6159
|
+
h !== null && (h.disconnect(), h = null), x = null, R && m("disconnected");
|
|
6160
6160
|
}, G = () => {
|
|
6161
|
-
N(), d = null, g = null, C = null,
|
|
6161
|
+
N(), d = null, g = null, C = null, b("available"), q(), f.clear();
|
|
6162
6162
|
}, k = () => {
|
|
6163
6163
|
if (!e.getSourceToken)
|
|
6164
6164
|
return null;
|
|
6165
|
-
const
|
|
6166
|
-
return
|
|
6167
|
-
}, O = (
|
|
6168
|
-
if (
|
|
6165
|
+
const R = e.getSourceToken();
|
|
6166
|
+
return R === null ? (G(), null) : (C !== null && C !== R && (N(), d = null, g = null, b("available"), q()), C = R, R);
|
|
6167
|
+
}, O = (R) => {
|
|
6168
|
+
if (R === null)
|
|
6169
6169
|
return !1;
|
|
6170
|
-
if (
|
|
6171
|
-
return
|
|
6172
|
-
const P = Date.parse(
|
|
6170
|
+
if (R.auth.expiresAt === null)
|
|
6171
|
+
return R.auth.token !== "";
|
|
6172
|
+
const P = Date.parse(R.auth.expiresAt);
|
|
6173
6173
|
return Number.isNaN(P) ? !1 : P - Date.now() > o;
|
|
6174
|
-
}, H = (
|
|
6175
|
-
if (N(),
|
|
6174
|
+
}, H = (R) => {
|
|
6175
|
+
if (N(), R.auth.expiresAt === null)
|
|
6176
6176
|
return;
|
|
6177
|
-
const P = Date.parse(
|
|
6177
|
+
const P = Date.parse(R.auth.expiresAt);
|
|
6178
6178
|
if (Number.isNaN(P))
|
|
6179
6179
|
return;
|
|
6180
6180
|
const D = Math.max(0, P - Date.now() - o);
|
|
6181
|
-
|
|
6181
|
+
v = setTimeout(() => {
|
|
6182
6182
|
J();
|
|
6183
6183
|
}, D);
|
|
6184
|
-
}, F = async (
|
|
6184
|
+
}, F = async (R = !1) => e.getSourceToken && k() === null || !R && _ === "account_suspended" ? null : !R && O(d) ? d : !R && g !== null ? await g : (g = (async () => {
|
|
6185
6185
|
try {
|
|
6186
6186
|
const D = await e.bootstrapClient.get(
|
|
6187
6187
|
i,
|
|
6188
|
-
|
|
6188
|
+
R ? { params: { refresh: 1 } } : void 0
|
|
6189
6189
|
), X = Ra(D.data);
|
|
6190
|
-
return d = X,
|
|
6190
|
+
return d = X, b("available"), H(X), X;
|
|
6191
6191
|
} catch (D) {
|
|
6192
6192
|
if (Ma(D))
|
|
6193
|
-
return d = null, N(),
|
|
6193
|
+
return d = null, N(), b("account_suspended"), q(), m("disconnected"), null;
|
|
6194
6194
|
throw D;
|
|
6195
6195
|
}
|
|
6196
6196
|
})().finally(() => {
|
|
6197
6197
|
g = null;
|
|
6198
6198
|
}), await g), J = async () => {
|
|
6199
|
-
const
|
|
6199
|
+
const R = h !== null;
|
|
6200
6200
|
try {
|
|
6201
|
-
if (await F(!0), !
|
|
6201
|
+
if (await F(!0), !R)
|
|
6202
6202
|
return;
|
|
6203
|
-
q(!1), await
|
|
6203
|
+
q(!1), await te(!0);
|
|
6204
6204
|
} catch (P) {
|
|
6205
6205
|
l.warn("Failed to refresh messenger bootstrap", P);
|
|
6206
6206
|
}
|
|
6207
|
-
}, me = (
|
|
6208
|
-
const P =
|
|
6207
|
+
}, me = (R) => {
|
|
6208
|
+
const P = R.connector?.pusher?.connection;
|
|
6209
6209
|
if (!P) {
|
|
6210
6210
|
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6211
6211
|
return;
|
|
@@ -6232,8 +6232,8 @@ function oc(e) {
|
|
|
6232
6232
|
}
|
|
6233
6233
|
(X === "unavailable" || X === "failed" || X === "disconnected") && m("disconnected");
|
|
6234
6234
|
}), P.state === "connected" && m("connected");
|
|
6235
|
-
},
|
|
6236
|
-
const D = await F(
|
|
6235
|
+
}, te = async (R = !1) => !R && h !== null && O(d) ? h : !R && x !== null ? await x : (x = (async () => {
|
|
6236
|
+
const D = await F(R);
|
|
6237
6237
|
if (D === null)
|
|
6238
6238
|
return null;
|
|
6239
6239
|
h !== null && q(!1);
|
|
@@ -6266,35 +6266,33 @@ function oc(e) {
|
|
|
6266
6266
|
"X-Requested-With": "XMLHttpRequest"
|
|
6267
6267
|
}
|
|
6268
6268
|
});
|
|
6269
|
-
y.interceptors.request.use(async (
|
|
6269
|
+
y.interceptors.request.use(async (R) => {
|
|
6270
6270
|
const P = await F();
|
|
6271
6271
|
if (P === null)
|
|
6272
6272
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6273
|
-
return
|
|
6273
|
+
return R.baseURL = P.service.apiBaseUrl, Vn(R, P.auth.token), R;
|
|
6274
6274
|
}), y.interceptors.response.use(
|
|
6275
|
-
(
|
|
6276
|
-
async (
|
|
6277
|
-
const P =
|
|
6278
|
-
if (
|
|
6275
|
+
(R) => R,
|
|
6276
|
+
async (R) => {
|
|
6277
|
+
const P = R.config;
|
|
6278
|
+
if (R.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6279
6279
|
P._messengerRetry = !0;
|
|
6280
6280
|
const D = await F(!0);
|
|
6281
6281
|
if (D !== null)
|
|
6282
6282
|
return P.baseURL = D.service.apiBaseUrl, Vn(P, D.auth.token), await y(P);
|
|
6283
6283
|
}
|
|
6284
|
-
return Promise.reject(
|
|
6284
|
+
return Promise.reject(R);
|
|
6285
6285
|
}
|
|
6286
6286
|
);
|
|
6287
|
-
const I = () => _ === "account_suspended" ? null : (
|
|
6288
|
-
|
|
6289
|
-
}),
|
|
6290
|
-
|
|
6291
|
-
}),
|
|
6292
|
-
|
|
6293
|
-
}), A = () => d?.auth.tenantId ?? "global", V = (E) => {
|
|
6294
|
-
const P = qt(E.ts)?.getTime() ?? qt(E.last_seen_at)?.getTime() ?? null;
|
|
6287
|
+
const I = () => _ === "account_suspended" ? null : h, ae = (R) => (T.add(R), R(M), () => {
|
|
6288
|
+
T.delete(R);
|
|
6289
|
+
}), B = (R) => (w.add(R), R(_), () => {
|
|
6290
|
+
w.delete(R);
|
|
6291
|
+
}), E = () => d?.auth.tenantId ?? "global", V = (R) => {
|
|
6292
|
+
const P = qt(R.ts)?.getTime() ?? qt(R.last_seen_at)?.getTime() ?? null;
|
|
6295
6293
|
if (P === null)
|
|
6296
6294
|
return !0;
|
|
6297
|
-
const D = `${
|
|
6295
|
+
const D = `${R.tenant_scope ?? "global"}:${R.user_id}`, X = f.get(D);
|
|
6298
6296
|
if (X && P < X.timestampMs)
|
|
6299
6297
|
return !1;
|
|
6300
6298
|
const Y = Date.now();
|
|
@@ -6305,11 +6303,11 @@ function oc(e) {
|
|
|
6305
6303
|
for (const [ge, we] of f.entries())
|
|
6306
6304
|
Y - we.seenAt > c && f.delete(ge);
|
|
6307
6305
|
return !0;
|
|
6308
|
-
}, ne = (
|
|
6306
|
+
}, ne = (R) => {
|
|
6309
6307
|
const P = I();
|
|
6310
6308
|
if (!P || typeof P.join != "function")
|
|
6311
6309
|
return;
|
|
6312
|
-
const D = P.join(`online-users.${
|
|
6310
|
+
const D = P.join(`online-users.${E()}`), X = [
|
|
6313
6311
|
".PresenceStatusChanged",
|
|
6314
6312
|
"PresenceStatusChanged",
|
|
6315
6313
|
".presence.status.changed",
|
|
@@ -6321,17 +6319,17 @@ function oc(e) {
|
|
|
6321
6319
|
];
|
|
6322
6320
|
for (const Y of X)
|
|
6323
6321
|
D.listen(Y, (ge) => {
|
|
6324
|
-
const we = ka(ge,
|
|
6325
|
-
!we || !V(we) ||
|
|
6322
|
+
const we = ka(ge, E());
|
|
6323
|
+
!we || !V(we) || R(we);
|
|
6326
6324
|
});
|
|
6327
6325
|
}, _e = () => {
|
|
6328
|
-
h?.leave(`online-users.${
|
|
6329
|
-
},
|
|
6326
|
+
h?.leave(`online-users.${E()}`);
|
|
6327
|
+
}, A = (R, P) => {
|
|
6330
6328
|
const D = I();
|
|
6331
6329
|
if (!D)
|
|
6332
6330
|
return () => {
|
|
6333
6331
|
};
|
|
6334
|
-
const X = D.private(`conversation.${
|
|
6332
|
+
const X = D.private(`conversation.${R}`), Y = [];
|
|
6335
6333
|
return P.onMessageSent && Y.push({
|
|
6336
6334
|
event: ".ConversationMessageSent",
|
|
6337
6335
|
handler: Oe(X, ".ConversationMessageSent", Na, P.onMessageSent)
|
|
@@ -6358,10 +6356,10 @@ function oc(e) {
|
|
|
6358
6356
|
for (const ge of Y)
|
|
6359
6357
|
X.stopListening(ge.event, ge.handler);
|
|
6360
6358
|
};
|
|
6361
|
-
}, U = (
|
|
6362
|
-
h?.leave(`conversation.${
|
|
6363
|
-
}, re = (
|
|
6364
|
-
const X =
|
|
6359
|
+
}, U = (R) => {
|
|
6360
|
+
h?.leave(`conversation.${R}`);
|
|
6361
|
+
}, re = (R, P, D) => {
|
|
6362
|
+
const X = R.private(`typing-conversation.${P}`), Y = [], ge = [
|
|
6365
6363
|
".TypingStateChanged",
|
|
6366
6364
|
"TypingStateChanged",
|
|
6367
6365
|
".typing.changed",
|
|
@@ -6434,23 +6432,23 @@ function oc(e) {
|
|
|
6434
6432
|
for (const ye of Y)
|
|
6435
6433
|
X.stopListening(ye.event, ye.handler);
|
|
6436
6434
|
};
|
|
6437
|
-
}, fe = (
|
|
6435
|
+
}, fe = (R, P) => {
|
|
6438
6436
|
const D = I();
|
|
6439
6437
|
if (D)
|
|
6440
|
-
return re(D,
|
|
6438
|
+
return re(D, R, P);
|
|
6441
6439
|
let X = !1, Y = null;
|
|
6442
6440
|
return Je().then((ge) => {
|
|
6443
|
-
X || !ge || (Y = re(ge,
|
|
6441
|
+
X || !ge || (Y = re(ge, R, P));
|
|
6444
6442
|
}).catch((ge) => {
|
|
6445
6443
|
l.warn("Failed to defer typing subscription", ge);
|
|
6446
6444
|
}), () => {
|
|
6447
6445
|
X = !0, Y?.();
|
|
6448
6446
|
};
|
|
6449
|
-
}, ue = (
|
|
6450
|
-
h?.leave(`typing-conversation.${
|
|
6447
|
+
}, ue = (R) => {
|
|
6448
|
+
h?.leave(`typing-conversation.${R}`);
|
|
6451
6449
|
}, pe = async () => {
|
|
6452
|
-
|
|
6453
|
-
}, Je = async () => _ === "account_suspended" ? null : await
|
|
6450
|
+
b("available"), q(), await te(!0);
|
|
6451
|
+
}, Je = async () => _ === "account_suspended" ? null : await te();
|
|
6454
6452
|
return {
|
|
6455
6453
|
apiClient: y,
|
|
6456
6454
|
initializedEvent: n,
|
|
@@ -6463,7 +6461,7 @@ function oc(e) {
|
|
|
6463
6461
|
reconnect: pe,
|
|
6464
6462
|
subscribeToPresenceStatus: ne,
|
|
6465
6463
|
unsubscribeFromPresenceStatus: _e,
|
|
6466
|
-
subscribeToConversation:
|
|
6464
|
+
subscribeToConversation: A,
|
|
6467
6465
|
unsubscribeFromConversation: U,
|
|
6468
6466
|
subscribeToTyping: fe,
|
|
6469
6467
|
unsubscribeFromTyping: ue,
|