@codingfactory/messenger-client 0.2.26 → 0.2.28
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 +424 -412
- package/dist/stores/messaging.d.ts +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as be, getCurrentInstance as qt, computed as se, watch as
|
|
1
|
+
import { ref as be, getCurrentInstance as qt, computed as se, watch as at, onUnmounted as qe, toValue as ss, onMounted as zt } from "vue";
|
|
2
2
|
import { defineStore as Oi, storeToRefs as Fi } from "pinia";
|
|
3
3
|
import jt, { isAxiosError as Di, AxiosHeaders as Tn } from "axios";
|
|
4
4
|
import { isAxiosError as vc } from "axios";
|
|
@@ -29,7 +29,7 @@ const rs = () => () => {
|
|
|
29
29
|
unsubscribeFromConversation: us,
|
|
30
30
|
subscribeToTyping: hs,
|
|
31
31
|
unsubscribeFromTyping: ls
|
|
32
|
-
},
|
|
32
|
+
}, Ke = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ps = async () => H.waitForEcho(), gs = () => H.getConnectionStatus(), En = () => gs(), Ut = () => H.getAccessState(), dt = (e) => H.onConnectionStatusChange(e), qi = (e) => H.onAccessStateChange(e), zi = async () => {
|
|
33
33
|
await H.reconnect();
|
|
34
34
|
}, ji = (e) => H.subscribeToPresenceStatus(e), $i = () => H.unsubscribeFromPresenceStatus(), Hi = (e, n) => H.subscribeToConversation(e, n), Bi = (e) => H.unsubscribeFromConversation(e), Vi = (e, n) => H.subscribeToTyping(e, n), Xi = (e) => H.unsubscribeFromTyping(e);
|
|
35
35
|
function Wi(e) {
|
|
@@ -131,7 +131,7 @@ function _s(e) {
|
|
|
131
131
|
function He(e) {
|
|
132
132
|
return !_s(e) || !("data" in e) ? e : e.data;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function st(e, n) {
|
|
135
135
|
const r = e[n];
|
|
136
136
|
if (typeof r != "string")
|
|
137
137
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
@@ -160,15 +160,15 @@ function Ot(e) {
|
|
|
160
160
|
if (!_s(e))
|
|
161
161
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
162
162
|
return {
|
|
163
|
-
id:
|
|
164
|
-
name:
|
|
163
|
+
id: st(e, "id"),
|
|
164
|
+
name: st(e, "name"),
|
|
165
165
|
color: An(e, "color"),
|
|
166
166
|
icon: An(e, "icon"),
|
|
167
167
|
sort_order: At(e, "sort_order"),
|
|
168
168
|
conversation_count: At(e, "conversation_count"),
|
|
169
169
|
unread_count: At(e, "unread_count"),
|
|
170
|
-
created_at:
|
|
171
|
-
updated_at:
|
|
170
|
+
created_at: st(e, "created_at"),
|
|
171
|
+
updated_at: st(e, "updated_at")
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
function ho(e) {
|
|
@@ -351,7 +351,7 @@ function Po(e) {
|
|
|
351
351
|
...r ? { handle: r } : {}
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function ct(e) {
|
|
355
355
|
const n = e.shared_post, r = e.author, o = n && typeof n == "object" ? {
|
|
356
356
|
id: n.id ?? "",
|
|
357
357
|
title: n.title ?? "",
|
|
@@ -378,7 +378,7 @@ function Mo(e) {
|
|
|
378
378
|
const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
379
379
|
if (n.length === 0 || r.length === 0 || o.length === 0)
|
|
380
380
|
return;
|
|
381
|
-
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = ue(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "",
|
|
381
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = ue(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", R = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
|
|
382
382
|
return {
|
|
383
383
|
id: n,
|
|
384
384
|
title: r,
|
|
@@ -389,8 +389,8 @@ function Mo(e) {
|
|
|
389
389
|
author: {
|
|
390
390
|
id: f,
|
|
391
391
|
name: h,
|
|
392
|
-
...
|
|
393
|
-
...
|
|
392
|
+
...R ? { avatar: R } : {},
|
|
393
|
+
...C ? { handle: C } : {}
|
|
394
394
|
}
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
@@ -449,11 +449,11 @@ function Lo(e, n) {
|
|
|
449
449
|
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 : n?.folder_id;
|
|
450
450
|
}
|
|
451
451
|
function Be(e, n) {
|
|
452
|
-
const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ?
|
|
452
|
+
const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? ct(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = 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, R = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
|
|
453
453
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
454
454
|
return !1;
|
|
455
|
-
const
|
|
456
|
-
return !
|
|
455
|
+
const E = n.last_message?.id, b = e.last_message?.id;
|
|
456
|
+
return !E || !b ? !1 : E === b;
|
|
457
457
|
})();
|
|
458
458
|
return {
|
|
459
459
|
...e,
|
|
@@ -463,8 +463,8 @@ function Be(e, n) {
|
|
|
463
463
|
muted_until: r,
|
|
464
464
|
is_pinned: f,
|
|
465
465
|
is_archived: h,
|
|
466
|
-
folder_id:
|
|
467
|
-
created_at:
|
|
466
|
+
folder_id: R,
|
|
467
|
+
created_at: C,
|
|
468
468
|
...c ? { last_message: c } : {},
|
|
469
469
|
...u ? { last_message_at: u } : {}
|
|
470
470
|
};
|
|
@@ -517,7 +517,7 @@ function Oo(e, n) {
|
|
|
517
517
|
if (!(typeof o != "string" || o.length === 0))
|
|
518
518
|
return o;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function rt(e, n) {
|
|
521
521
|
const r = ue(e) ? e : {}, o = r.data ?? e;
|
|
522
522
|
let c = [];
|
|
523
523
|
return Array.isArray(o) ? c = o : ue(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
|
|
@@ -629,13 +629,13 @@ async function zn(e) {
|
|
|
629
629
|
} : c;
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function We(e, n) {
|
|
633
633
|
if (e.is_pinned !== n.is_pinned)
|
|
634
634
|
return e.is_pinned ? -1 : 1;
|
|
635
635
|
const r = e.last_message_at ?? e.created_at, c = (n.last_message_at ?? n.created_at).localeCompare(r);
|
|
636
636
|
return c !== 0 ? c : e.id.localeCompare(n.id);
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function it(e, n) {
|
|
639
639
|
return [n, ...e.filter((r) => r.id !== n.id)];
|
|
640
640
|
}
|
|
641
641
|
function Ve(e) {
|
|
@@ -680,7 +680,7 @@ function Mt(e) {
|
|
|
680
680
|
r.is_request === !0 && n.set(r.id, r);
|
|
681
681
|
for (const r of e.conversations)
|
|
682
682
|
r.is_request === !0 && n.set(r.id, r);
|
|
683
|
-
return Array.from(n.values()).sort(
|
|
683
|
+
return Array.from(n.values()).sort(We);
|
|
684
684
|
}
|
|
685
685
|
const Kt = Oi("messaging", {
|
|
686
686
|
state: () => ({
|
|
@@ -703,7 +703,8 @@ const Kt = Oi("messaging", {
|
|
|
703
703
|
backgroundPollTransientFailureCount: 0,
|
|
704
704
|
_pendingSendIds: /* @__PURE__ */ new Set(),
|
|
705
705
|
_activeDetailSubscriptions: /* @__PURE__ */ new Set(),
|
|
706
|
-
_activeGlobalConversationSubscriptions: /* @__PURE__ */ new Set()
|
|
706
|
+
_activeGlobalConversationSubscriptions: /* @__PURE__ */ new Set(),
|
|
707
|
+
activeListFilter: void 0
|
|
707
708
|
}),
|
|
708
709
|
getters: {
|
|
709
710
|
getConversationById: (e) => (n) => {
|
|
@@ -821,18 +822,18 @@ const Kt = Oi("messaging", {
|
|
|
821
822
|
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), xn();
|
|
822
823
|
const c = o?.includePresence ?? !0, u = {};
|
|
823
824
|
c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
|
|
824
|
-
const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } =
|
|
825
|
+
const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = rt(
|
|
825
826
|
d.data,
|
|
826
827
|
"conversations"
|
|
827
|
-
),
|
|
828
|
+
), R = f.map((E) => {
|
|
828
829
|
const b = this.conversations.find(
|
|
829
|
-
(
|
|
830
|
+
(A) => A.id === E.id
|
|
830
831
|
);
|
|
831
|
-
return Be(
|
|
832
|
-
}),
|
|
833
|
-
e ? this.conversations.push(...
|
|
832
|
+
return Be(E, b);
|
|
833
|
+
}), C = await zn(R);
|
|
834
|
+
e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
834
835
|
const v = {
|
|
835
|
-
data:
|
|
836
|
+
data: C,
|
|
836
837
|
has_more: !!h
|
|
837
838
|
};
|
|
838
839
|
return h !== void 0 && (v.next_cursor = h), v;
|
|
@@ -846,7 +847,7 @@ const Kt = Oi("messaging", {
|
|
|
846
847
|
if (Date.now() < this.backgroundPollRetryAfterUntil)
|
|
847
848
|
return !1;
|
|
848
849
|
try {
|
|
849
|
-
return await this.fetchConversations(void 0,
|
|
850
|
+
return await this.fetchConversations(void 0, this.activeListFilter, void 0, {
|
|
850
851
|
background: !0,
|
|
851
852
|
includePresence: !1
|
|
852
853
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
@@ -884,12 +885,12 @@ const Kt = Oi("messaging", {
|
|
|
884
885
|
filter: "requests"
|
|
885
886
|
};
|
|
886
887
|
e && (n.cursor = e);
|
|
887
|
-
const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } =
|
|
888
|
+
const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = rt(
|
|
888
889
|
r.data,
|
|
889
890
|
"conversations"
|
|
890
891
|
), u = o.map((h) => {
|
|
891
|
-
const
|
|
892
|
-
return Be(h,
|
|
892
|
+
const R = this.requests.find((C) => C.id === h.id);
|
|
893
|
+
return Be(h, R);
|
|
893
894
|
}), d = await zn(u);
|
|
894
895
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
895
896
|
const f = {
|
|
@@ -917,23 +918,23 @@ const Kt = Oi("messaging", {
|
|
|
917
918
|
throw v;
|
|
918
919
|
o += 1, await kn(Co(v));
|
|
919
920
|
}
|
|
920
|
-
const { items: u, nextCursor: d } =
|
|
921
|
+
const { items: u, nextCursor: d } = rt(
|
|
921
922
|
c.data,
|
|
922
923
|
"messages"
|
|
923
|
-
), f = u.map(
|
|
924
|
+
), f = u.map(ct), h = [...f].reverse();
|
|
924
925
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
925
|
-
const v = this.conversations.find((
|
|
926
|
+
const v = this.conversations.find((E) => E.id === e) ?? this.requests.find((E) => E.id === e);
|
|
926
927
|
return v ? !v.last_message || !v.last_message_at : !1;
|
|
927
928
|
})()) {
|
|
928
929
|
const v = this.messages[e]?.at(-1);
|
|
929
930
|
v && this.updateConversationLastMessage(e, v);
|
|
930
931
|
}
|
|
931
932
|
d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
932
|
-
const
|
|
933
|
+
const C = {
|
|
933
934
|
data: f,
|
|
934
935
|
has_more: !!d
|
|
935
936
|
};
|
|
936
|
-
return d !== void 0 && (
|
|
937
|
+
return d !== void 0 && (C.next_cursor = d), C;
|
|
937
938
|
} catch (r) {
|
|
938
939
|
throw this.error = Y(r), r;
|
|
939
940
|
} finally {
|
|
@@ -941,31 +942,31 @@ const Kt = Oi("messaging", {
|
|
|
941
942
|
}
|
|
942
943
|
},
|
|
943
944
|
async sendMessage(e, n, r, o, c, u, d) {
|
|
944
|
-
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`,
|
|
945
|
+
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, R = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = Mo(d), v = f.currentUser, E = {
|
|
945
946
|
id: h,
|
|
946
947
|
conversation_id: e,
|
|
947
948
|
author_id: v?.id || "",
|
|
948
949
|
body: n || "",
|
|
949
950
|
attachments: [],
|
|
950
|
-
meta:
|
|
951
|
-
...
|
|
951
|
+
meta: R ? { shared_post_id: R } : {},
|
|
952
|
+
...C ? { shared_post: C } : {},
|
|
952
953
|
is_deleted: !1,
|
|
953
954
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
954
955
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
955
956
|
};
|
|
956
|
-
v && (
|
|
957
|
+
v && (E.author = {
|
|
957
958
|
id: v.id,
|
|
958
959
|
name: v.name,
|
|
959
960
|
...v.avatar ? { avatar: v.avatar } : {},
|
|
960
961
|
...v.handle ? { handle: v.handle } : {}
|
|
961
|
-
}), o != null && (
|
|
962
|
+
}), o != null && (E.reply_to_id = o), c != null && (E.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(E), this._pendingSendIds.add(h);
|
|
962
963
|
try {
|
|
963
964
|
let b;
|
|
964
|
-
const
|
|
965
|
+
const A = {
|
|
965
966
|
body: n || "",
|
|
966
967
|
...o ? { reply_to_id: o } : {},
|
|
967
|
-
...
|
|
968
|
-
...
|
|
968
|
+
...R ? { shared_post_id: R } : {},
|
|
969
|
+
...C ? { shared_post_preview: C } : {}
|
|
969
970
|
};
|
|
970
971
|
if (r && r.length > 0) {
|
|
971
972
|
const W = await Promise.all(
|
|
@@ -979,15 +980,15 @@ const Kt = Oi("messaging", {
|
|
|
979
980
|
})
|
|
980
981
|
);
|
|
981
982
|
b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
982
|
-
...
|
|
983
|
+
...A,
|
|
983
984
|
attachments: W
|
|
984
985
|
});
|
|
985
986
|
} else
|
|
986
987
|
b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
987
|
-
...
|
|
988
|
+
...A,
|
|
988
989
|
type: "text"
|
|
989
990
|
});
|
|
990
|
-
const
|
|
991
|
+
const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = ct(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
|
|
991
992
|
O >= 0 && (y[O] = m), this._pendingSendIds.delete(h);
|
|
992
993
|
const z = m.id;
|
|
993
994
|
let J = 0;
|
|
@@ -997,7 +998,7 @@ const Kt = Oi("messaging", {
|
|
|
997
998
|
}
|
|
998
999
|
return this.updateConversationLastMessage(e, m), m;
|
|
999
1000
|
} catch (b) {
|
|
1000
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((
|
|
1001
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Y(b), b;
|
|
1001
1002
|
}
|
|
1002
1003
|
},
|
|
1003
1004
|
async editMessage(e, n, r) {
|
|
@@ -1131,17 +1132,19 @@ const Kt = Oi("messaging", {
|
|
|
1131
1132
|
}
|
|
1132
1133
|
},
|
|
1133
1134
|
async pinConversation(e, n) {
|
|
1135
|
+
const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
|
|
1136
|
+
r && (r.is_pinned = n), this.conversations.sort(We);
|
|
1134
1137
|
try {
|
|
1135
1138
|
await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
1136
|
-
|
|
1137
|
-
r && (r.is_pinned =
|
|
1138
|
-
} catch (r) {
|
|
1139
|
-
throw this.error = Y(r), r;
|
|
1139
|
+
} catch (c) {
|
|
1140
|
+
throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(We)), this.error = Y(c), c;
|
|
1140
1141
|
}
|
|
1141
1142
|
},
|
|
1142
1143
|
async archiveConversation(e, n) {
|
|
1143
1144
|
try {
|
|
1144
|
-
await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n })
|
|
1145
|
+
await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
|
|
1146
|
+
const r = this.conversations.find((o) => o.id === e);
|
|
1147
|
+
r && (r.is_archived = n);
|
|
1145
1148
|
} catch (r) {
|
|
1146
1149
|
throw this.error = Y(r), r;
|
|
1147
1150
|
}
|
|
@@ -1163,7 +1166,7 @@ const Kt = Oi("messaging", {
|
|
|
1163
1166
|
if (!Fn(c))
|
|
1164
1167
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1165
1168
|
let u = Dn(c) && Jt(c, e) ? Be(c) : await this.fetchConversation(c.id);
|
|
1166
|
-
return u = await qn(u, e), u.is_request === !0 ? (this.requests =
|
|
1169
|
+
return u = await qn(u, e), u.is_request === !0 ? (this.requests = it(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = it(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
|
|
1167
1170
|
} catch (r) {
|
|
1168
1171
|
throw this.error = Y(r), r;
|
|
1169
1172
|
}
|
|
@@ -1177,7 +1180,7 @@ const Kt = Oi("messaging", {
|
|
|
1177
1180
|
if (!Fn(o))
|
|
1178
1181
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1179
1182
|
const c = Dn(o) ? o : await this.fetchConversation(o.id);
|
|
1180
|
-
return this.conversations =
|
|
1183
|
+
return this.conversations = it(this.conversations, c), c;
|
|
1181
1184
|
} catch (r) {
|
|
1182
1185
|
throw this.error = Y(r), r;
|
|
1183
1186
|
}
|
|
@@ -1225,27 +1228,36 @@ const Kt = Oi("messaging", {
|
|
|
1225
1228
|
if (!n)
|
|
1226
1229
|
return;
|
|
1227
1230
|
this.messages[n] || (this.messages[n] = []);
|
|
1228
|
-
const r =
|
|
1229
|
-
if (o.find((
|
|
1231
|
+
const r = ct({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1232
|
+
if (o.find((R) => R.id === r.id))
|
|
1230
1233
|
return;
|
|
1231
1234
|
const u = ke()();
|
|
1232
1235
|
if (r.author_id === u.currentUser?.id) {
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1236
|
+
const R = o.findIndex((C) => C.id.startsWith("temp-"));
|
|
1237
|
+
if (R >= 0) {
|
|
1238
|
+
const C = o[R]?.id ?? "";
|
|
1239
|
+
this.messages[n] = [
|
|
1240
|
+
...o.slice(0, R),
|
|
1241
|
+
r,
|
|
1242
|
+
...o.slice(R + 1)
|
|
1243
|
+
], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
|
|
1237
1244
|
return;
|
|
1238
1245
|
}
|
|
1239
1246
|
}
|
|
1240
1247
|
const d = r.created_at;
|
|
1241
1248
|
let f = o.length;
|
|
1242
|
-
for (let
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1249
|
+
for (let R = o.length - 1; R >= 0; R--) {
|
|
1250
|
+
const C = o[R];
|
|
1251
|
+
if (C && C.created_at <= d)
|
|
1245
1252
|
break;
|
|
1246
|
-
f =
|
|
1253
|
+
f = R;
|
|
1247
1254
|
}
|
|
1248
|
-
|
|
1255
|
+
const h = f === o.length;
|
|
1256
|
+
this.messages[n] = [
|
|
1257
|
+
...o.slice(0, f),
|
|
1258
|
+
r,
|
|
1259
|
+
...o.slice(f)
|
|
1260
|
+
], h && this.updateConversationLastMessage(n, r);
|
|
1249
1261
|
},
|
|
1250
1262
|
updateMessage(e) {
|
|
1251
1263
|
const n = this.messages[e.conversation_id] || [], r = n.findIndex((o) => o.id === e.id);
|
|
@@ -1253,8 +1265,8 @@ const Kt = Oi("messaging", {
|
|
|
1253
1265
|
},
|
|
1254
1266
|
removeMessage(e, n) {
|
|
1255
1267
|
const r = (h) => {
|
|
1256
|
-
const
|
|
1257
|
-
return delete
|
|
1268
|
+
const R = { ...h, is_deleted: !0 };
|
|
1269
|
+
return delete R.body, R;
|
|
1258
1270
|
};
|
|
1259
1271
|
let o = null;
|
|
1260
1272
|
const c = this.conversations.find((h) => h.id === e);
|
|
@@ -1288,13 +1300,13 @@ const Kt = Oi("messaging", {
|
|
|
1288
1300
|
throw v;
|
|
1289
1301
|
f = await X().post(o, c);
|
|
1290
1302
|
}
|
|
1291
|
-
const h = ue(f.data) && "data" in f.data ? f.data.data : f.data,
|
|
1303
|
+
const h = ue(f.data) && "data" in f.data ? f.data.data : f.data, R = On(
|
|
1292
1304
|
ue(h) ? h.reactions : void 0
|
|
1293
1305
|
);
|
|
1294
|
-
(
|
|
1306
|
+
(R.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, R);
|
|
1295
1307
|
try {
|
|
1296
|
-
const v = await X().get(o),
|
|
1297
|
-
ue(
|
|
1308
|
+
const v = await X().get(o), E = ue(v.data) && "data" in v.data ? v.data.data : v.data, b = On(
|
|
1309
|
+
ue(E) ? E.reactions : void 0
|
|
1298
1310
|
);
|
|
1299
1311
|
this.updateMessageReactions(e, n, b);
|
|
1300
1312
|
} catch {
|
|
@@ -1323,10 +1335,10 @@ const Kt = Oi("messaging", {
|
|
|
1323
1335
|
if (!f) return;
|
|
1324
1336
|
const h = { ...f };
|
|
1325
1337
|
r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), u[d] = h;
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1338
|
+
const R = this.conversations.find((v) => v.id === e);
|
|
1339
|
+
R?.last_message?.id === n && (R.last_message = h);
|
|
1340
|
+
const C = this.requests.find((v) => v.id === e);
|
|
1341
|
+
C?.last_message?.id === n && (C.last_message = h);
|
|
1330
1342
|
},
|
|
1331
1343
|
addTypingUser(e, n) {
|
|
1332
1344
|
const r = this.typingUsers[e] ?? [];
|
|
@@ -1340,7 +1352,7 @@ const Kt = Oi("messaging", {
|
|
|
1340
1352
|
const d = u.find((f) => f.id === e);
|
|
1341
1353
|
return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
|
|
1342
1354
|
}, o = r(this.conversations), c = r(this.requests);
|
|
1343
|
-
o && this.conversations.sort(
|
|
1355
|
+
o && this.conversations.sort(We), c && this.requests.sort(We);
|
|
1344
1356
|
},
|
|
1345
1357
|
updatePresenceForUser(e, n, r) {
|
|
1346
1358
|
const o = n === "online" || n === "idle" || n === "dnd", c = (u) => {
|
|
@@ -1373,7 +1385,7 @@ const Kt = Oi("messaging", {
|
|
|
1373
1385
|
is_archived: n.is_archived ?? !1,
|
|
1374
1386
|
is_muted: n.is_muted ?? !1
|
|
1375
1387
|
});
|
|
1376
|
-
this.conversations =
|
|
1388
|
+
this.conversations = it(this.conversations, r);
|
|
1377
1389
|
} catch (n) {
|
|
1378
1390
|
throw this.error = Y(n), n;
|
|
1379
1391
|
}
|
|
@@ -1392,7 +1404,7 @@ const Kt = Oi("messaging", {
|
|
|
1392
1404
|
n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
|
|
1393
1405
|
const c = await X().get("/v1/messaging/conversations", {
|
|
1394
1406
|
params: o
|
|
1395
|
-
}), { items: u } =
|
|
1407
|
+
}), { items: u } = rt(
|
|
1396
1408
|
c.data,
|
|
1397
1409
|
"conversations"
|
|
1398
1410
|
);
|
|
@@ -1452,16 +1464,16 @@ const Kt = Oi("messaging", {
|
|
|
1452
1464
|
}
|
|
1453
1465
|
});
|
|
1454
1466
|
function oc(e) {
|
|
1455
|
-
const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = qt(), f = d !== null, h = 20,
|
|
1456
|
-
let
|
|
1457
|
-
const b = se(() => r.currentUser?.id),
|
|
1458
|
-
function
|
|
1459
|
-
v && (clearTimeout(v), v = null),
|
|
1467
|
+
const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = qt(), f = d !== null, h = 20, R = 250;
|
|
1468
|
+
let C = 0, v = null, E = null;
|
|
1469
|
+
const b = se(() => r.currentUser?.id), A = () => ss(e)?.trim() ?? "";
|
|
1470
|
+
function w() {
|
|
1471
|
+
v && (clearTimeout(v), v = null), C = 0;
|
|
1460
1472
|
}
|
|
1461
1473
|
function p() {
|
|
1462
|
-
!f || o.value || v ||
|
|
1463
|
-
v = null,
|
|
1464
|
-
},
|
|
1474
|
+
!f || o.value || v || C >= h || (v = setTimeout(() => {
|
|
1475
|
+
v = null, C += 1, I();
|
|
1476
|
+
}, R));
|
|
1465
1477
|
}
|
|
1466
1478
|
function m(_) {
|
|
1467
1479
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
@@ -1504,10 +1516,10 @@ function oc(e) {
|
|
|
1504
1516
|
}
|
|
1505
1517
|
function k(_) {
|
|
1506
1518
|
const L = u.value;
|
|
1507
|
-
|
|
1519
|
+
E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Bi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
|
|
1508
1520
|
}
|
|
1509
1521
|
function I() {
|
|
1510
|
-
const _ =
|
|
1522
|
+
const _ = A();
|
|
1511
1523
|
if (!(o.value || !_)) {
|
|
1512
1524
|
if (!Ae()) {
|
|
1513
1525
|
p();
|
|
@@ -1515,7 +1527,7 @@ function oc(e) {
|
|
|
1515
1527
|
}
|
|
1516
1528
|
c.value = null;
|
|
1517
1529
|
try {
|
|
1518
|
-
|
|
1530
|
+
E = Hi(_, {
|
|
1519
1531
|
onMessageSent: m,
|
|
1520
1532
|
onMessageRead: y,
|
|
1521
1533
|
onMessageEdited: O,
|
|
@@ -1523,7 +1535,7 @@ function oc(e) {
|
|
|
1523
1535
|
onReactionToggled: J,
|
|
1524
1536
|
onRequestAccepted: W,
|
|
1525
1537
|
onParticipantRemoved: te
|
|
1526
|
-
}), o.value = !0, u.value = _, n.registerDetailSubscription(_),
|
|
1538
|
+
}), o.value = !0, u.value = _, n.registerDetailSubscription(_), w();
|
|
1527
1539
|
} catch (L) {
|
|
1528
1540
|
c.value = L instanceof Error ? L.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", L);
|
|
1529
1541
|
}
|
|
@@ -1532,27 +1544,27 @@ function oc(e) {
|
|
|
1532
1544
|
function K() {
|
|
1533
1545
|
o.value || I();
|
|
1534
1546
|
}
|
|
1535
|
-
typeof window < "u" && window.addEventListener(
|
|
1547
|
+
typeof window < "u" && window.addEventListener(Ke(), K);
|
|
1536
1548
|
const V = dt((_) => {
|
|
1537
1549
|
if (_ === "connected") {
|
|
1538
1550
|
o.value || I();
|
|
1539
1551
|
return;
|
|
1540
1552
|
}
|
|
1541
|
-
(_ === "disconnected" || _ === "error") && (
|
|
1553
|
+
(_ === "disconnected" || _ === "error") && (w(), k(!1));
|
|
1542
1554
|
});
|
|
1543
1555
|
function G() {
|
|
1544
|
-
if (
|
|
1556
|
+
if (w(), !(!o.value || !u.value))
|
|
1545
1557
|
try {
|
|
1546
1558
|
k(!0), c.value = null;
|
|
1547
1559
|
} catch (_) {
|
|
1548
1560
|
c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1549
1561
|
}
|
|
1550
1562
|
}
|
|
1551
|
-
return
|
|
1552
|
-
() =>
|
|
1563
|
+
return at(
|
|
1564
|
+
() => A(),
|
|
1553
1565
|
(_, L) => {
|
|
1554
1566
|
if (_ !== L) {
|
|
1555
|
-
if (
|
|
1567
|
+
if (w(), o.value && k(!0), !_) {
|
|
1556
1568
|
c.value = null;
|
|
1557
1569
|
return;
|
|
1558
1570
|
}
|
|
@@ -1560,7 +1572,7 @@ function oc(e) {
|
|
|
1560
1572
|
}
|
|
1561
1573
|
}
|
|
1562
1574
|
), d !== null && qe(() => {
|
|
1563
|
-
|
|
1575
|
+
w(), V(), G(), typeof window < "u" && window.removeEventListener(Ke(), K);
|
|
1564
1576
|
}), {
|
|
1565
1577
|
isSubscribed: se(() => o.value),
|
|
1566
1578
|
error: se(() => c.value),
|
|
@@ -1630,7 +1642,7 @@ function Bn(e) {
|
|
|
1630
1642
|
}
|
|
1631
1643
|
function Qo(e) {
|
|
1632
1644
|
return e === "messenger" ? {
|
|
1633
|
-
initializedEvent:
|
|
1645
|
+
initializedEvent: Ke(),
|
|
1634
1646
|
getConnectionStatus: gs,
|
|
1635
1647
|
onConnectionStatusChange: dt,
|
|
1636
1648
|
reconnect: zi,
|
|
@@ -1650,8 +1662,8 @@ function ac(e = {}) {
|
|
|
1650
1662
|
const o = Qo(e.source ?? "app"), c = {
|
|
1651
1663
|
...Ko,
|
|
1652
1664
|
...e.icons
|
|
1653
|
-
}, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1),
|
|
1654
|
-
let
|
|
1665
|
+
}, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), R = be(!1), C = be(!1), v = be(!1);
|
|
1666
|
+
let E = null, b = null, A = null, w = null, p = null, m = null, y = null;
|
|
1655
1667
|
const O = se(() => u.value === "connected"), z = se(() => u.value === "connecting"), J = se(() => u.value === "disconnected"), W = se(() => u.value === "error"), te = se(() => J.value || W.value), k = se(() => {
|
|
1656
1668
|
switch (u.value) {
|
|
1657
1669
|
case "connecting":
|
|
@@ -1694,26 +1706,26 @@ function ac(e = {}) {
|
|
|
1694
1706
|
Hn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1695
1707
|
}, G = (B, D = u.value) => {
|
|
1696
1708
|
if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
|
|
1697
|
-
const q = !v.value && D === B, _e = !
|
|
1698
|
-
if (
|
|
1699
|
-
h.value = !1,
|
|
1700
|
-
|
|
1709
|
+
const q = !v.value && D === B, _e = !R.value && (q || D === "connected" || D === "connecting");
|
|
1710
|
+
if (C.value = !0, _e) {
|
|
1711
|
+
h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
|
|
1712
|
+
A = null, u.value !== "connected" && (h.value = !0);
|
|
1701
1713
|
}, 5e3);
|
|
1702
1714
|
return;
|
|
1703
1715
|
}
|
|
1704
|
-
|
|
1716
|
+
A && (clearTimeout(A), A = null), h.value = !0;
|
|
1705
1717
|
return;
|
|
1706
1718
|
}
|
|
1707
1719
|
if (B === "connected") {
|
|
1708
|
-
|
|
1720
|
+
A && (clearTimeout(A), A = null), h.value = !1, R.value = !1, C.value = !1;
|
|
1709
1721
|
return;
|
|
1710
1722
|
}
|
|
1711
1723
|
if (B === "connecting") {
|
|
1712
|
-
if (
|
|
1724
|
+
if (A && (clearTimeout(A), A = null), R.value) {
|
|
1713
1725
|
h.value = !0;
|
|
1714
1726
|
return;
|
|
1715
1727
|
}
|
|
1716
|
-
if (
|
|
1728
|
+
if (C.value || (h.value = !1), b)
|
|
1717
1729
|
return;
|
|
1718
1730
|
b = setTimeout(() => {
|
|
1719
1731
|
if (b = null, u.value === "connecting") {
|
|
@@ -1721,13 +1733,13 @@ function ac(e = {}) {
|
|
|
1721
1733
|
_("connected");
|
|
1722
1734
|
return;
|
|
1723
1735
|
}
|
|
1724
|
-
|
|
1736
|
+
R.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1725
1737
|
}
|
|
1726
1738
|
}, 1e4);
|
|
1727
1739
|
}
|
|
1728
1740
|
}, _ = (B) => {
|
|
1729
1741
|
const D = u.value;
|
|
1730
|
-
if (B === "connecting" &&
|
|
1742
|
+
if (B === "connecting" && R.value) {
|
|
1731
1743
|
u.value = "disconnected", G("disconnected", D);
|
|
1732
1744
|
return;
|
|
1733
1745
|
}
|
|
@@ -1787,13 +1799,13 @@ function ac(e = {}) {
|
|
|
1787
1799
|
return D > 0 ? `${D}m ${q}s` : `${q}s`;
|
|
1788
1800
|
});
|
|
1789
1801
|
return zt(() => {
|
|
1790
|
-
u.value = o.getConnectionStatus(),
|
|
1802
|
+
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, fe(), m = () => {
|
|
1791
1803
|
fe(), L();
|
|
1792
|
-
}, window.addEventListener(o.initializedEvent, m), L(),
|
|
1804
|
+
}, window.addEventListener(o.initializedEvent, m), L(), w = setInterval(() => {
|
|
1793
1805
|
L();
|
|
1794
1806
|
}, 3e3);
|
|
1795
1807
|
}), qe(() => {
|
|
1796
|
-
|
|
1808
|
+
E?.(), b && (clearTimeout(b), b = null), A && (clearTimeout(A), A = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
|
|
1797
1809
|
}), {
|
|
1798
1810
|
connectionStatus: se(() => u.value),
|
|
1799
1811
|
isConnected: O,
|
|
@@ -1825,18 +1837,18 @@ function ea() {
|
|
|
1825
1837
|
}
|
|
1826
1838
|
const Me = Yt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1827
1839
|
function cc() {
|
|
1828
|
-
const e = Kt(), n = ke()(), r = Yo(), o = Bt(), c = Ni(), u = qt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(),
|
|
1829
|
-
let
|
|
1840
|
+
const e = Kt(), n = ke()(), r = Yo(), o = Bt(), c = Ni(), u = qt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map();
|
|
1841
|
+
let C = !1;
|
|
1830
1842
|
function v(k) {
|
|
1831
|
-
const I =
|
|
1832
|
-
if (I && (
|
|
1843
|
+
const I = R.get(k);
|
|
1844
|
+
if (I && (R.delete(k), typeof I.channel.stopListening == "function"))
|
|
1833
1845
|
for (const K of I.bindings)
|
|
1834
1846
|
try {
|
|
1835
1847
|
I.channel.stopListening(K.event, K.handler);
|
|
1836
1848
|
} catch {
|
|
1837
1849
|
}
|
|
1838
1850
|
}
|
|
1839
|
-
function
|
|
1851
|
+
function E() {
|
|
1840
1852
|
for (const k of h)
|
|
1841
1853
|
v(k), e.unregisterGlobalConversationSubscription(k);
|
|
1842
1854
|
h.clear();
|
|
@@ -1909,7 +1921,7 @@ function cc() {
|
|
|
1909
1921
|
(M) => M.id !== q.conversation_id
|
|
1910
1922
|
);
|
|
1911
1923
|
};
|
|
1912
|
-
V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", fe), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B),
|
|
1924
|
+
V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", fe), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), R.set(k, {
|
|
1913
1925
|
channel: V,
|
|
1914
1926
|
bindings: [
|
|
1915
1927
|
{ event: ".ConversationMessageSent", handler: G },
|
|
@@ -1921,10 +1933,10 @@ function cc() {
|
|
|
1921
1933
|
]
|
|
1922
1934
|
}), h.add(k), e.registerGlobalConversationSubscription(k);
|
|
1923
1935
|
}
|
|
1924
|
-
function
|
|
1936
|
+
function A() {
|
|
1925
1937
|
const k = Ae();
|
|
1926
1938
|
if (!k) {
|
|
1927
|
-
|
|
1939
|
+
E();
|
|
1928
1940
|
return;
|
|
1929
1941
|
}
|
|
1930
1942
|
for (const I of h) {
|
|
@@ -1937,7 +1949,7 @@ function cc() {
|
|
|
1937
1949
|
}
|
|
1938
1950
|
h.clear();
|
|
1939
1951
|
}
|
|
1940
|
-
function
|
|
1952
|
+
function w() {
|
|
1941
1953
|
const k = Ae();
|
|
1942
1954
|
if (!k) return;
|
|
1943
1955
|
const I = (() => {
|
|
@@ -1987,37 +1999,37 @@ function cc() {
|
|
|
1987
1999
|
}
|
|
1988
2000
|
}
|
|
1989
2001
|
function y() {
|
|
1990
|
-
!Ae() ||
|
|
2002
|
+
!Ae() || C || (ji(p), C = !0);
|
|
1991
2003
|
}
|
|
1992
2004
|
function O() {
|
|
1993
|
-
|
|
2005
|
+
C && ($i(), C = !1);
|
|
1994
2006
|
}
|
|
1995
|
-
const z =
|
|
2007
|
+
const z = at(
|
|
1996
2008
|
d,
|
|
1997
2009
|
() => {
|
|
1998
|
-
|
|
2010
|
+
w();
|
|
1999
2011
|
},
|
|
2000
2012
|
{ deep: !1, immediate: !0 }
|
|
2001
|
-
), J =
|
|
2013
|
+
), J = at(
|
|
2002
2014
|
f,
|
|
2003
2015
|
() => {
|
|
2004
|
-
|
|
2016
|
+
w();
|
|
2005
2017
|
},
|
|
2006
2018
|
{ deep: !1, immediate: !0 }
|
|
2007
|
-
), W =
|
|
2019
|
+
), W = at(
|
|
2008
2020
|
() => c.fullPath,
|
|
2009
2021
|
() => {
|
|
2010
|
-
|
|
2022
|
+
w();
|
|
2011
2023
|
}
|
|
2012
2024
|
), te = dt((k) => {
|
|
2013
|
-
k === "connected" ? (
|
|
2025
|
+
k === "connected" ? (E(), w(), O(), y(), m()) : (k === "disconnected" || k === "error") && (E(), O());
|
|
2014
2026
|
});
|
|
2015
|
-
|
|
2016
|
-
k && (
|
|
2027
|
+
w(), y(), m(), Ae() || ps().then((k) => {
|
|
2028
|
+
k && (E(), w(), O(), y(), m());
|
|
2017
2029
|
}).catch((k) => {
|
|
2018
2030
|
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
2019
2031
|
}), u !== null && qe(() => {
|
|
2020
|
-
z(), J(), W(), te(),
|
|
2032
|
+
z(), J(), W(), te(), A(), O();
|
|
2021
2033
|
});
|
|
2022
2034
|
}
|
|
2023
2035
|
function uc() {
|
|
@@ -2065,14 +2077,14 @@ function ca(e) {
|
|
|
2065
2077
|
return e.authTokenResolver !== ks;
|
|
2066
2078
|
}
|
|
2067
2079
|
const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
|
|
2068
|
-
function
|
|
2080
|
+
function Ge(e) {
|
|
2069
2081
|
return typeof e == "object" && e !== null;
|
|
2070
2082
|
}
|
|
2071
2083
|
function Ls(e) {
|
|
2072
|
-
if (!
|
|
2084
|
+
if (!Ge(e))
|
|
2073
2085
|
return null;
|
|
2074
2086
|
const n = e.response;
|
|
2075
|
-
if (!
|
|
2087
|
+
if (!Ge(n))
|
|
2076
2088
|
return null;
|
|
2077
2089
|
const r = n.status;
|
|
2078
2090
|
if (typeof r == "number")
|
|
@@ -2084,13 +2096,13 @@ function Ls(e) {
|
|
|
2084
2096
|
return null;
|
|
2085
2097
|
}
|
|
2086
2098
|
function Is(e) {
|
|
2087
|
-
if (!
|
|
2099
|
+
if (!Ge(e))
|
|
2088
2100
|
return null;
|
|
2089
2101
|
const n = e.response;
|
|
2090
|
-
if (!
|
|
2102
|
+
if (!Ge(n))
|
|
2091
2103
|
return null;
|
|
2092
2104
|
const r = n.data;
|
|
2093
|
-
return
|
|
2105
|
+
return Ge(r) && typeof r.code == "string" ? r.code : null;
|
|
2094
2106
|
}
|
|
2095
2107
|
function kt(e) {
|
|
2096
2108
|
const n = Ls(e), r = Is(e);
|
|
@@ -2100,32 +2112,32 @@ function xt(e) {
|
|
|
2100
2112
|
const n = Ls(e), r = Is(e);
|
|
2101
2113
|
return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2102
2114
|
}
|
|
2103
|
-
function
|
|
2115
|
+
function Qe() {
|
|
2104
2116
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
2105
2117
|
}
|
|
2106
2118
|
function va(e) {
|
|
2107
|
-
const n =
|
|
2119
|
+
const n = Qe(), r = n?.getItem(e);
|
|
2108
2120
|
if (r)
|
|
2109
2121
|
return r;
|
|
2110
2122
|
const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
2111
2123
|
return n?.setItem(e, o), o;
|
|
2112
2124
|
}
|
|
2113
2125
|
function ba(e) {
|
|
2114
|
-
const n =
|
|
2126
|
+
const n = Qe(), r = n?.getItem(e);
|
|
2115
2127
|
if (!r)
|
|
2116
2128
|
return null;
|
|
2117
2129
|
const o = Number.parseInt(r, 10);
|
|
2118
2130
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
2119
2131
|
}
|
|
2120
2132
|
function Lt(e, n = Date.now()) {
|
|
2121
|
-
const r =
|
|
2133
|
+
const r = Qe(), o = ba(e);
|
|
2122
2134
|
return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
|
|
2123
2135
|
}
|
|
2124
2136
|
function ya(e, n = Date.now()) {
|
|
2125
|
-
|
|
2137
|
+
Qe()?.setItem(e, String(n + ma));
|
|
2126
2138
|
}
|
|
2127
2139
|
function _a(e) {
|
|
2128
|
-
|
|
2140
|
+
Qe()?.removeItem(e);
|
|
2129
2141
|
}
|
|
2130
2142
|
function Sa(e) {
|
|
2131
2143
|
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
@@ -2174,34 +2186,34 @@ function Ta(e, n, r) {
|
|
|
2174
2186
|
}
|
|
2175
2187
|
function lc() {
|
|
2176
2188
|
const e = ke()(), n = ia(), r = Bt(), o = va(n.clientIdStorageKey);
|
|
2177
|
-
let c = null, u = null, d = !1, f = Lt(n.accountLimitedUntilStorageKey), h = !1,
|
|
2178
|
-
const
|
|
2189
|
+
let c = null, u = null, d = !1, f = Lt(n.accountLimitedUntilStorageKey), h = !1, R = !1, C = null, v = 0;
|
|
2190
|
+
const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2179
2191
|
c && (clearInterval(c), c = null);
|
|
2180
|
-
},
|
|
2192
|
+
}, A = () => {
|
|
2181
2193
|
u && (clearTimeout(u), u = null);
|
|
2182
|
-
},
|
|
2194
|
+
}, w = () => {
|
|
2183
2195
|
b(), c = setInterval(() => {
|
|
2184
2196
|
I();
|
|
2185
2197
|
}, n.heartbeatIntervalMs);
|
|
2186
2198
|
}, p = (L) => {
|
|
2187
|
-
f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1,
|
|
2199
|
+
f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
|
|
2188
2200
|
}, m = async (L) => {
|
|
2189
|
-
if (!(!d ||
|
|
2201
|
+
if (!(!d || R || f || h) && E() && C !== L)
|
|
2190
2202
|
try {
|
|
2191
|
-
await r.patch(n.statusUrl, { status: L }),
|
|
2203
|
+
await r.patch(n.statusUrl, { status: L }), C = L;
|
|
2192
2204
|
} catch (fe) {
|
|
2193
2205
|
if (kt(fe)) {
|
|
2194
2206
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2195
2207
|
return;
|
|
2196
2208
|
}
|
|
2197
|
-
xt(fe) && (h = !0, d = !1,
|
|
2209
|
+
xt(fe) && (h = !0, d = !1, C = null, b(), A());
|
|
2198
2210
|
}
|
|
2199
2211
|
}, y = () => {
|
|
2200
|
-
|
|
2212
|
+
A(), !(!d || R || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
2201
2213
|
u = null, m("idle");
|
|
2202
2214
|
}, n.idleAfterMs));
|
|
2203
2215
|
}, O = () => {
|
|
2204
|
-
if (
|
|
2216
|
+
if (R || !d || f || h || document.visibilityState !== "visible")
|
|
2205
2217
|
return;
|
|
2206
2218
|
const L = Date.now();
|
|
2207
2219
|
L - v < n.activityDebounceMs || (v = L, m("online"), y());
|
|
@@ -2218,9 +2230,9 @@ function lc() {
|
|
|
2218
2230
|
return await r.post(n.sessionOpenUrl, {
|
|
2219
2231
|
client_id: o,
|
|
2220
2232
|
user_agent: n.userAgentResolver()
|
|
2221
|
-
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0,
|
|
2233
|
+
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
|
|
2222
2234
|
} catch (L) {
|
|
2223
|
-
return kt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : xt(L) ? (h = !0, d = !1,
|
|
2235
|
+
return kt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : xt(L) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
|
|
2224
2236
|
}
|
|
2225
2237
|
}, k = async () => {
|
|
2226
2238
|
for (let L = 0; L < ga; L += 1)
|
|
@@ -2228,7 +2240,7 @@ function lc() {
|
|
|
2228
2240
|
return;
|
|
2229
2241
|
console.warn("[Presence] Failed to open session");
|
|
2230
2242
|
}, I = async () => {
|
|
2231
|
-
if (d &&
|
|
2243
|
+
if (d && E())
|
|
2232
2244
|
try {
|
|
2233
2245
|
await r.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2234
2246
|
} catch (L) {
|
|
@@ -2236,12 +2248,12 @@ function lc() {
|
|
|
2236
2248
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2237
2249
|
return;
|
|
2238
2250
|
}
|
|
2239
|
-
xt(L) && (h = !0, d = !1,
|
|
2251
|
+
xt(L) && (h = !0, d = !1, C = null, b(), A());
|
|
2240
2252
|
}
|
|
2241
2253
|
}, K = () => {
|
|
2242
2254
|
if (!d)
|
|
2243
2255
|
return;
|
|
2244
|
-
d = !1,
|
|
2256
|
+
d = !1, C = null, A();
|
|
2245
2257
|
const L = Ta(
|
|
2246
2258
|
n.sessionCloseUrl,
|
|
2247
2259
|
o,
|
|
@@ -2255,17 +2267,17 @@ function lc() {
|
|
|
2255
2267
|
r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2256
2268
|
});
|
|
2257
2269
|
}, V = async () => {
|
|
2258
|
-
if (!
|
|
2259
|
-
if (await k(),
|
|
2270
|
+
if (!R) {
|
|
2271
|
+
if (await k(), R) {
|
|
2260
2272
|
K();
|
|
2261
2273
|
return;
|
|
2262
2274
|
}
|
|
2263
|
-
d && (
|
|
2275
|
+
d && (w(), m("online"), y());
|
|
2264
2276
|
}
|
|
2265
2277
|
}, G = () => {
|
|
2266
|
-
if (!
|
|
2278
|
+
if (!R) {
|
|
2267
2279
|
if (document.visibilityState === "hidden") {
|
|
2268
|
-
K(), b(),
|
|
2280
|
+
K(), b(), A();
|
|
2269
2281
|
return;
|
|
2270
2282
|
}
|
|
2271
2283
|
if (document.visibilityState === "visible" && !d) {
|
|
@@ -2275,24 +2287,24 @@ function lc() {
|
|
|
2275
2287
|
document.visibilityState === "visible" && d && !f && !h && O();
|
|
2276
2288
|
}
|
|
2277
2289
|
}, _ = () => {
|
|
2278
|
-
|
|
2290
|
+
R || (K(), b(), A());
|
|
2279
2291
|
};
|
|
2280
2292
|
zt(async () => {
|
|
2281
2293
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2282
|
-
if (await k(),
|
|
2294
|
+
if (await k(), R) {
|
|
2283
2295
|
K();
|
|
2284
2296
|
return;
|
|
2285
2297
|
}
|
|
2286
|
-
d && (
|
|
2298
|
+
d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2287
2299
|
}
|
|
2288
2300
|
}), qe(() => {
|
|
2289
|
-
|
|
2301
|
+
R = !0, W(), A(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2290
2302
|
});
|
|
2291
2303
|
}
|
|
2292
2304
|
const Ea = 12e3;
|
|
2293
2305
|
function dc(e) {
|
|
2294
|
-
const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = qt(),
|
|
2295
|
-
let
|
|
2306
|
+
const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = qt(), R = h !== null, C = 20, v = 250;
|
|
2307
|
+
let E = !1, b = null, A = 0, w = null;
|
|
2296
2308
|
const p = se(() => r.currentUser?.id), m = () => ss(e)?.trim() ?? "", y = () => {
|
|
2297
2309
|
const M = u.value?.trim() ?? "";
|
|
2298
2310
|
if (M.length > 0)
|
|
@@ -2312,10 +2324,10 @@ function dc(e) {
|
|
|
2312
2324
|
clearTimeout(M);
|
|
2313
2325
|
f.clear();
|
|
2314
2326
|
}, te = () => {
|
|
2315
|
-
|
|
2327
|
+
w && (clearTimeout(w), w = null), A = 0;
|
|
2316
2328
|
}, k = () => {
|
|
2317
|
-
!
|
|
2318
|
-
|
|
2329
|
+
!R || o.value || w || A >= C || (w = setTimeout(() => {
|
|
2330
|
+
w = null, A += 1, G();
|
|
2319
2331
|
}, v));
|
|
2320
2332
|
}, I = (M, F) => {
|
|
2321
2333
|
J(M);
|
|
@@ -2324,7 +2336,7 @@ function dc(e) {
|
|
|
2324
2336
|
}, Ea);
|
|
2325
2337
|
f.set(M, Z);
|
|
2326
2338
|
}, K = () => {
|
|
2327
|
-
|
|
2339
|
+
E = !0, te();
|
|
2328
2340
|
}, V = (M) => {
|
|
2329
2341
|
try {
|
|
2330
2342
|
b && (b(), b = null), b = Vi(M, {
|
|
@@ -2341,8 +2353,8 @@ function dc(e) {
|
|
|
2341
2353
|
V(M);
|
|
2342
2354
|
return;
|
|
2343
2355
|
}
|
|
2344
|
-
|
|
2345
|
-
if (
|
|
2356
|
+
E = !1, ps().then((F) => {
|
|
2357
|
+
if (E || o.value || !F)
|
|
2346
2358
|
return;
|
|
2347
2359
|
const Z = m();
|
|
2348
2360
|
if (Z && Z === M && Ae() && En() === "connected") {
|
|
@@ -2415,7 +2427,7 @@ function dc(e) {
|
|
|
2415
2427
|
}), D = se(() => Se.value.length > 0), q = () => {
|
|
2416
2428
|
m() && (b && (b(), b = null), o.value = !1, u.value = null, G());
|
|
2417
2429
|
};
|
|
2418
|
-
typeof window < "u" && window.addEventListener(
|
|
2430
|
+
typeof window < "u" && window.addEventListener(Ke(), q);
|
|
2419
2431
|
const _e = dt((M) => {
|
|
2420
2432
|
if (M === "connected") {
|
|
2421
2433
|
o.value || G();
|
|
@@ -2428,7 +2440,7 @@ function dc(e) {
|
|
|
2428
2440
|
}
|
|
2429
2441
|
});
|
|
2430
2442
|
return h !== null && qe(() => {
|
|
2431
|
-
K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(
|
|
2443
|
+
K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(Ke(), q);
|
|
2432
2444
|
}), {
|
|
2433
2445
|
isSubscribed: se(() => o.value),
|
|
2434
2446
|
error: se(() => c.value),
|
|
@@ -2896,7 +2908,7 @@ qs._defaultOptions = {
|
|
|
2896
2908
|
namespace: "App.Events"
|
|
2897
2909
|
};
|
|
2898
2910
|
let nn = qs;
|
|
2899
|
-
class
|
|
2911
|
+
class ot extends nn {
|
|
2900
2912
|
constructor() {
|
|
2901
2913
|
super(...arguments), this.channels = {};
|
|
2902
2914
|
}
|
|
@@ -3247,14 +3259,14 @@ class Ia {
|
|
|
3247
3259
|
*/
|
|
3248
3260
|
connect() {
|
|
3249
3261
|
if (this.options.broadcaster === "reverb")
|
|
3250
|
-
this.connector = new
|
|
3262
|
+
this.connector = new ot({
|
|
3251
3263
|
...this.options,
|
|
3252
3264
|
cluster: ""
|
|
3253
3265
|
});
|
|
3254
3266
|
else if (this.options.broadcaster === "pusher")
|
|
3255
|
-
this.connector = new
|
|
3267
|
+
this.connector = new ot(this.options);
|
|
3256
3268
|
else if (this.options.broadcaster === "ably")
|
|
3257
|
-
this.connector = new
|
|
3269
|
+
this.connector = new ot({
|
|
3258
3270
|
...this.options,
|
|
3259
3271
|
cluster: "",
|
|
3260
3272
|
broadcaster: "pusher"
|
|
@@ -3326,7 +3338,7 @@ class Ia {
|
|
|
3326
3338
|
);
|
|
3327
3339
|
}
|
|
3328
3340
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3329
|
-
return n instanceof
|
|
3341
|
+
return n instanceof ot || n instanceof Xn;
|
|
3330
3342
|
}
|
|
3331
3343
|
/**
|
|
3332
3344
|
* Get the Socket ID for the connection.
|
|
@@ -3422,8 +3434,8 @@ function Oa() {
|
|
|
3422
3434
|
}, c.t = function(u, d) {
|
|
3423
3435
|
if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
|
|
3424
3436
|
var f = /* @__PURE__ */ Object.create(null);
|
|
3425
|
-
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(
|
|
3426
|
-
return u[
|
|
3437
|
+
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(R) {
|
|
3438
|
+
return u[R];
|
|
3427
3439
|
}).bind(null, h));
|
|
3428
3440
|
return f;
|
|
3429
3441
|
}, c.n = function(u) {
|
|
@@ -3447,15 +3459,15 @@ function Oa() {
|
|
|
3447
3459
|
/***/
|
|
3448
3460
|
(function(r, o, c) {
|
|
3449
3461
|
var u = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3450
|
-
var
|
|
3451
|
-
return
|
|
3462
|
+
var w = function(p, m) {
|
|
3463
|
+
return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, O) {
|
|
3452
3464
|
y.__proto__ = O;
|
|
3453
3465
|
} || function(y, O) {
|
|
3454
3466
|
for (var z in O) O.hasOwnProperty(z) && (y[z] = O[z]);
|
|
3455
|
-
},
|
|
3467
|
+
}, w(p, m);
|
|
3456
3468
|
};
|
|
3457
3469
|
return function(p, m) {
|
|
3458
|
-
|
|
3470
|
+
w(p, m);
|
|
3459
3471
|
function y() {
|
|
3460
3472
|
this.constructor = p;
|
|
3461
3473
|
}
|
|
@@ -3466,12 +3478,12 @@ function Oa() {
|
|
|
3466
3478
|
var d = 256, f = (
|
|
3467
3479
|
/** @class */
|
|
3468
3480
|
(function() {
|
|
3469
|
-
function
|
|
3481
|
+
function w(p) {
|
|
3470
3482
|
p === void 0 && (p = "="), this._paddingCharacter = p;
|
|
3471
3483
|
}
|
|
3472
|
-
return
|
|
3484
|
+
return w.prototype.encodedLength = function(p) {
|
|
3473
3485
|
return this._paddingCharacter ? (p + 2) / 3 * 4 | 0 : (p * 8 + 5) / 6 | 0;
|
|
3474
|
-
},
|
|
3486
|
+
}, w.prototype.encode = function(p) {
|
|
3475
3487
|
for (var m = "", y = 0; y < p.length - 2; y += 3) {
|
|
3476
3488
|
var O = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
|
|
3477
3489
|
m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), m += this._encodeByte(O >>> 6 & 63), m += this._encodeByte(O >>> 0 & 63);
|
|
@@ -3482,11 +3494,11 @@ function Oa() {
|
|
|
3482
3494
|
m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), z === 2 ? m += this._encodeByte(O >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
|
|
3483
3495
|
}
|
|
3484
3496
|
return m;
|
|
3485
|
-
},
|
|
3497
|
+
}, w.prototype.maxDecodedLength = function(p) {
|
|
3486
3498
|
return this._paddingCharacter ? p / 4 * 3 | 0 : (p * 6 + 7) / 8 | 0;
|
|
3487
|
-
},
|
|
3499
|
+
}, w.prototype.decodedLength = function(p) {
|
|
3488
3500
|
return this.maxDecodedLength(p.length - this._getPaddingLength(p));
|
|
3489
|
-
},
|
|
3501
|
+
}, w.prototype.decode = function(p) {
|
|
3490
3502
|
if (p.length === 0)
|
|
3491
3503
|
return new Uint8Array(0);
|
|
3492
3504
|
for (var m = this._getPaddingLength(p), y = p.length - m, O = new Uint8Array(this.maxDecodedLength(y)), z = 0, J = 0, W = 0, te = 0, k = 0, I = 0, K = 0; J < y - 4; J += 4)
|
|
@@ -3494,13 +3506,13 @@ function Oa() {
|
|
|
3494
3506
|
if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), O[z++] = te << 2 | k >>> 4, W |= te & d, W |= k & d), J < y - 2 && (I = this._decodeChar(p.charCodeAt(J + 2)), O[z++] = k << 4 | I >>> 2, W |= I & d), J < y - 3 && (K = this._decodeChar(p.charCodeAt(J + 3)), O[z++] = I << 6 | K, W |= K & d), W !== 0)
|
|
3495
3507
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3496
3508
|
return O;
|
|
3497
|
-
},
|
|
3509
|
+
}, w.prototype._encodeByte = function(p) {
|
|
3498
3510
|
var m = p;
|
|
3499
3511
|
return m += 65, m += 25 - p >>> 8 & 6, m += 51 - p >>> 8 & -75, m += 61 - p >>> 8 & -15, m += 62 - p >>> 8 & 3, String.fromCharCode(m);
|
|
3500
|
-
},
|
|
3512
|
+
}, w.prototype._decodeChar = function(p) {
|
|
3501
3513
|
var m = d;
|
|
3502
3514
|
return m += (42 - p & p - 44) >>> 8 & -d + p - 43 + 62, m += (46 - p & p - 48) >>> 8 & -d + p - 47 + 63, m += (47 - p & p - 58) >>> 8 & -d + p - 48 + 52, m += (64 - p & p - 91) >>> 8 & -d + p - 65 + 0, m += (96 - p & p - 123) >>> 8 & -d + p - 97 + 26, m;
|
|
3503
|
-
},
|
|
3515
|
+
}, w.prototype._getPaddingLength = function(p) {
|
|
3504
3516
|
var m = 0;
|
|
3505
3517
|
if (this._paddingCharacter) {
|
|
3506
3518
|
for (var y = p.length - 1; y >= 0 && p[y] === this._paddingCharacter; y--)
|
|
@@ -3509,25 +3521,25 @@ function Oa() {
|
|
|
3509
3521
|
throw new Error("Base64Coder: incorrect padding");
|
|
3510
3522
|
}
|
|
3511
3523
|
return m;
|
|
3512
|
-
},
|
|
3524
|
+
}, w;
|
|
3513
3525
|
})()
|
|
3514
3526
|
);
|
|
3515
3527
|
o.Coder = f;
|
|
3516
3528
|
var h = new f();
|
|
3517
|
-
function
|
|
3518
|
-
return h.encode(
|
|
3529
|
+
function R(w) {
|
|
3530
|
+
return h.encode(w);
|
|
3519
3531
|
}
|
|
3520
|
-
o.encode =
|
|
3521
|
-
function
|
|
3522
|
-
return h.decode(
|
|
3532
|
+
o.encode = R;
|
|
3533
|
+
function C(w) {
|
|
3534
|
+
return h.decode(w);
|
|
3523
3535
|
}
|
|
3524
|
-
o.decode =
|
|
3536
|
+
o.decode = C;
|
|
3525
3537
|
var v = (
|
|
3526
3538
|
/** @class */
|
|
3527
|
-
(function(
|
|
3528
|
-
u(p,
|
|
3539
|
+
(function(w) {
|
|
3540
|
+
u(p, w);
|
|
3529
3541
|
function p() {
|
|
3530
|
-
return
|
|
3542
|
+
return w !== null && w.apply(this, arguments) || this;
|
|
3531
3543
|
}
|
|
3532
3544
|
return p.prototype._encodeByte = function(m) {
|
|
3533
3545
|
var y = m;
|
|
@@ -3539,20 +3551,20 @@ function Oa() {
|
|
|
3539
3551
|
})(f)
|
|
3540
3552
|
);
|
|
3541
3553
|
o.URLSafeCoder = v;
|
|
3542
|
-
var
|
|
3543
|
-
function b(
|
|
3544
|
-
return
|
|
3554
|
+
var E = new v();
|
|
3555
|
+
function b(w) {
|
|
3556
|
+
return E.encode(w);
|
|
3545
3557
|
}
|
|
3546
3558
|
o.encodeURLSafe = b;
|
|
3547
|
-
function
|
|
3548
|
-
return
|
|
3559
|
+
function A(w) {
|
|
3560
|
+
return E.decode(w);
|
|
3549
3561
|
}
|
|
3550
|
-
o.decodeURLSafe =
|
|
3551
|
-
return h.encodedLength(
|
|
3552
|
-
}, o.maxDecodedLength = function(
|
|
3553
|
-
return h.maxDecodedLength(
|
|
3554
|
-
}, o.decodedLength = function(
|
|
3555
|
-
return h.decodedLength(
|
|
3562
|
+
o.decodeURLSafe = A, o.encodedLength = function(w) {
|
|
3563
|
+
return h.encodedLength(w);
|
|
3564
|
+
}, o.maxDecodedLength = function(w) {
|
|
3565
|
+
return h.maxDecodedLength(w);
|
|
3566
|
+
}, o.decodedLength = function(w) {
|
|
3567
|
+
return h.decodedLength(w);
|
|
3556
3568
|
};
|
|
3557
3569
|
}),
|
|
3558
3570
|
/* 1 */
|
|
@@ -3560,17 +3572,17 @@ function Oa() {
|
|
|
3560
3572
|
(function(r, o, c) {
|
|
3561
3573
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3562
3574
|
var u = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3563
|
-
function f(
|
|
3564
|
-
for (var v = new Uint8Array(h(
|
|
3565
|
-
var
|
|
3566
|
-
|
|
3575
|
+
function f(C) {
|
|
3576
|
+
for (var v = new Uint8Array(h(C)), E = 0, b = 0; b < C.length; b++) {
|
|
3577
|
+
var A = C.charCodeAt(b);
|
|
3578
|
+
A < 128 ? v[E++] = A : A < 2048 ? (v[E++] = 192 | A >> 6, v[E++] = 128 | A & 63) : A < 55296 ? (v[E++] = 224 | A >> 12, v[E++] = 128 | A >> 6 & 63, v[E++] = 128 | A & 63) : (b++, A = (A & 1023) << 10, A |= C.charCodeAt(b) & 1023, A += 65536, v[E++] = 240 | A >> 18, v[E++] = 128 | A >> 12 & 63, v[E++] = 128 | A >> 6 & 63, v[E++] = 128 | A & 63);
|
|
3567
3579
|
}
|
|
3568
3580
|
return v;
|
|
3569
3581
|
}
|
|
3570
3582
|
o.encode = f;
|
|
3571
|
-
function h(
|
|
3572
|
-
for (var v = 0,
|
|
3573
|
-
var b =
|
|
3583
|
+
function h(C) {
|
|
3584
|
+
for (var v = 0, E = 0; E < C.length; E++) {
|
|
3585
|
+
var b = C.charCodeAt(E);
|
|
3574
3586
|
if (b < 128)
|
|
3575
3587
|
v += 1;
|
|
3576
3588
|
else if (b < 2048)
|
|
@@ -3578,44 +3590,44 @@ function Oa() {
|
|
|
3578
3590
|
else if (b < 55296)
|
|
3579
3591
|
v += 3;
|
|
3580
3592
|
else if (b <= 57343) {
|
|
3581
|
-
if (
|
|
3593
|
+
if (E >= C.length - 1)
|
|
3582
3594
|
throw new Error(u);
|
|
3583
|
-
|
|
3595
|
+
E++, v += 4;
|
|
3584
3596
|
} else
|
|
3585
3597
|
throw new Error(u);
|
|
3586
3598
|
}
|
|
3587
3599
|
return v;
|
|
3588
3600
|
}
|
|
3589
3601
|
o.encodedLength = h;
|
|
3590
|
-
function
|
|
3591
|
-
for (var v = [],
|
|
3592
|
-
var b =
|
|
3602
|
+
function R(C) {
|
|
3603
|
+
for (var v = [], E = 0; E < C.length; E++) {
|
|
3604
|
+
var b = C[E];
|
|
3593
3605
|
if (b & 128) {
|
|
3594
|
-
var
|
|
3606
|
+
var A = void 0;
|
|
3595
3607
|
if (b < 224) {
|
|
3596
|
-
if (
|
|
3608
|
+
if (E >= C.length)
|
|
3597
3609
|
throw new Error(d);
|
|
3598
|
-
var
|
|
3599
|
-
if ((
|
|
3610
|
+
var w = C[++E];
|
|
3611
|
+
if ((w & 192) !== 128)
|
|
3600
3612
|
throw new Error(d);
|
|
3601
|
-
b = (b & 31) << 6 |
|
|
3613
|
+
b = (b & 31) << 6 | w & 63, A = 128;
|
|
3602
3614
|
} else if (b < 240) {
|
|
3603
|
-
if (
|
|
3615
|
+
if (E >= C.length - 1)
|
|
3604
3616
|
throw new Error(d);
|
|
3605
|
-
var
|
|
3606
|
-
if ((
|
|
3617
|
+
var w = C[++E], p = C[++E];
|
|
3618
|
+
if ((w & 192) !== 128 || (p & 192) !== 128)
|
|
3607
3619
|
throw new Error(d);
|
|
3608
|
-
b = (b & 15) << 12 | (
|
|
3620
|
+
b = (b & 15) << 12 | (w & 63) << 6 | p & 63, A = 2048;
|
|
3609
3621
|
} else if (b < 248) {
|
|
3610
|
-
if (
|
|
3622
|
+
if (E >= C.length - 2)
|
|
3611
3623
|
throw new Error(d);
|
|
3612
|
-
var
|
|
3613
|
-
if ((
|
|
3624
|
+
var w = C[++E], p = C[++E], m = C[++E];
|
|
3625
|
+
if ((w & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
|
|
3614
3626
|
throw new Error(d);
|
|
3615
|
-
b = (b & 15) << 18 | (
|
|
3627
|
+
b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63, A = 65536;
|
|
3616
3628
|
} else
|
|
3617
3629
|
throw new Error(d);
|
|
3618
|
-
if (b <
|
|
3630
|
+
if (b < A || b >= 55296 && b <= 57343)
|
|
3619
3631
|
throw new Error(d);
|
|
3620
3632
|
if (b >= 65536) {
|
|
3621
3633
|
if (b > 1114111)
|
|
@@ -3627,7 +3639,7 @@ function Oa() {
|
|
|
3627
3639
|
}
|
|
3628
3640
|
return v.join("");
|
|
3629
3641
|
}
|
|
3630
|
-
o.decode =
|
|
3642
|
+
o.decode = R;
|
|
3631
3643
|
}),
|
|
3632
3644
|
/* 2 */
|
|
3633
3645
|
/***/
|
|
@@ -3681,7 +3693,7 @@ function Oa() {
|
|
|
3681
3693
|
cdn_https: "https://js.pusher.com",
|
|
3682
3694
|
dependency_suffix: ""
|
|
3683
3695
|
}, h = f;
|
|
3684
|
-
class
|
|
3696
|
+
class R {
|
|
3685
3697
|
constructor(t) {
|
|
3686
3698
|
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3687
3699
|
}
|
|
@@ -3712,14 +3724,14 @@ function Oa() {
|
|
|
3712
3724
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3713
3725
|
}
|
|
3714
3726
|
}
|
|
3715
|
-
var
|
|
3727
|
+
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new R({
|
|
3716
3728
|
cdn_http: h.cdn_http,
|
|
3717
3729
|
cdn_https: h.cdn_https,
|
|
3718
3730
|
version: h.VERSION,
|
|
3719
3731
|
suffix: h.dependency_suffix,
|
|
3720
|
-
receivers:
|
|
3732
|
+
receivers: C
|
|
3721
3733
|
});
|
|
3722
|
-
const
|
|
3734
|
+
const E = {
|
|
3723
3735
|
baseUrl: "https://pusher.com",
|
|
3724
3736
|
urls: {
|
|
3725
3737
|
authenticationEndpoint: {
|
|
@@ -3739,16 +3751,16 @@ function Oa() {
|
|
|
3739
3751
|
}
|
|
3740
3752
|
}
|
|
3741
3753
|
};
|
|
3742
|
-
var
|
|
3743
|
-
const t = "See:", s =
|
|
3754
|
+
var A = { buildLogSuffix: function(i) {
|
|
3755
|
+
const t = "See:", s = E.urls[i];
|
|
3744
3756
|
if (!s)
|
|
3745
3757
|
return "";
|
|
3746
3758
|
let a;
|
|
3747
|
-
return s.fullUrl ? a = s.fullUrl : s.path && (a =
|
|
3748
|
-
} },
|
|
3759
|
+
return s.fullUrl ? a = s.fullUrl : s.path && (a = E.baseUrl + s.path), a ? `${t} ${a}` : "";
|
|
3760
|
+
} }, w;
|
|
3749
3761
|
(function(i) {
|
|
3750
3762
|
i.UserAuthentication = "user-authentication", i.ChannelAuthorization = "channel-authorization";
|
|
3751
|
-
})(
|
|
3763
|
+
})(w || (w = {}));
|
|
3752
3764
|
class p extends Error {
|
|
3753
3765
|
constructor(t) {
|
|
3754
3766
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -3817,11 +3829,11 @@ function Oa() {
|
|
|
3817
3829
|
} else {
|
|
3818
3830
|
let x = "";
|
|
3819
3831
|
switch (a) {
|
|
3820
|
-
case
|
|
3821
|
-
x =
|
|
3832
|
+
case w.UserAuthentication:
|
|
3833
|
+
x = A.buildLogSuffix("authenticationEndpoint");
|
|
3822
3834
|
break;
|
|
3823
|
-
case
|
|
3824
|
-
x = `Clients must be authorized to join private or presence channels. ${
|
|
3835
|
+
case w.ChannelAuthorization:
|
|
3836
|
+
x = `Clients must be authorized to join private or presence channels. ${A.buildLogSuffix("authorizationEndpoint")}`;
|
|
3825
3837
|
break;
|
|
3826
3838
|
}
|
|
3827
3839
|
l(new k(g.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${g.status} from ${s.endpoint}. ${x}`), null);
|
|
@@ -3905,7 +3917,7 @@ function Oa() {
|
|
|
3905
3917
|
}
|
|
3906
3918
|
function ht() {
|
|
3907
3919
|
for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3908
|
-
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(
|
|
3920
|
+
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Ye(arguments[t]));
|
|
3909
3921
|
return i.join(" : ");
|
|
3910
3922
|
}
|
|
3911
3923
|
function ze(i, t) {
|
|
@@ -3919,19 +3931,19 @@ function Oa() {
|
|
|
3919
3931
|
return a;
|
|
3920
3932
|
return -1;
|
|
3921
3933
|
}
|
|
3922
|
-
function
|
|
3934
|
+
function T(i, t) {
|
|
3923
3935
|
for (var s in i)
|
|
3924
3936
|
Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
|
|
3925
3937
|
}
|
|
3926
|
-
function
|
|
3938
|
+
function P(i) {
|
|
3927
3939
|
var t = [];
|
|
3928
|
-
return
|
|
3940
|
+
return T(i, function(s, a) {
|
|
3929
3941
|
t.push(a);
|
|
3930
3942
|
}), t;
|
|
3931
3943
|
}
|
|
3932
3944
|
function N(i) {
|
|
3933
3945
|
var t = [];
|
|
3934
|
-
return
|
|
3946
|
+
return T(i, function(s) {
|
|
3935
3947
|
t.push(s);
|
|
3936
3948
|
}), t;
|
|
3937
3949
|
}
|
|
@@ -3946,7 +3958,7 @@ function Oa() {
|
|
|
3946
3958
|
}
|
|
3947
3959
|
function re(i, t) {
|
|
3948
3960
|
var s = {};
|
|
3949
|
-
return
|
|
3961
|
+
return T(i, function(a, l) {
|
|
3950
3962
|
s[l] = t(a);
|
|
3951
3963
|
}), s;
|
|
3952
3964
|
}
|
|
@@ -3960,13 +3972,13 @@ function Oa() {
|
|
|
3960
3972
|
}
|
|
3961
3973
|
function Re(i, t) {
|
|
3962
3974
|
var s = {};
|
|
3963
|
-
return
|
|
3975
|
+
return T(i, function(a, l) {
|
|
3964
3976
|
(t && t(a, l, i, s) || a) && (s[l] = a);
|
|
3965
3977
|
}), s;
|
|
3966
3978
|
}
|
|
3967
3979
|
function Le(i) {
|
|
3968
3980
|
var t = [];
|
|
3969
|
-
return
|
|
3981
|
+
return T(i, function(s, a) {
|
|
3970
3982
|
t.push([a, s]);
|
|
3971
3983
|
}), t;
|
|
3972
3984
|
}
|
|
@@ -3984,7 +3996,7 @@ function Oa() {
|
|
|
3984
3996
|
}
|
|
3985
3997
|
function ve(i) {
|
|
3986
3998
|
return re(i, function(t) {
|
|
3987
|
-
return typeof t == "object" && (t =
|
|
3999
|
+
return typeof t == "object" && (t = Ye(t)), encodeURIComponent(V(t.toString()));
|
|
3988
4000
|
});
|
|
3989
4001
|
}
|
|
3990
4002
|
function js(i) {
|
|
@@ -4020,7 +4032,7 @@ function Oa() {
|
|
|
4020
4032
|
}
|
|
4021
4033
|
})(i, "$");
|
|
4022
4034
|
}
|
|
4023
|
-
function
|
|
4035
|
+
function Ye(i) {
|
|
4024
4036
|
try {
|
|
4025
4037
|
return JSON.stringify(i);
|
|
4026
4038
|
} catch {
|
|
@@ -4156,7 +4168,7 @@ function Oa() {
|
|
|
4156
4168
|
this._callbacks = {};
|
|
4157
4169
|
return;
|
|
4158
4170
|
}
|
|
4159
|
-
var l = t ? [gt(t)] :
|
|
4171
|
+
var l = t ? [gt(t)] : P(this._callbacks);
|
|
4160
4172
|
s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
|
|
4161
4173
|
}
|
|
4162
4174
|
removeCallback(t, s, a) {
|
|
@@ -4331,7 +4343,7 @@ function Oa() {
|
|
|
4331
4343
|
ws: nr,
|
|
4332
4344
|
xhr_streaming: sr,
|
|
4333
4345
|
xhr_polling: rr
|
|
4334
|
-
},
|
|
4346
|
+
}, Ze = ir, or = new De({
|
|
4335
4347
|
file: "sockjs",
|
|
4336
4348
|
urls: Zs,
|
|
4337
4349
|
handlesActivityChecks: !0,
|
|
@@ -4361,8 +4373,8 @@ function Oa() {
|
|
|
4361
4373
|
return t;
|
|
4362
4374
|
}
|
|
4363
4375
|
}, ar = new De(me({}, rn, cn)), cr = new De(me({}, on, cn));
|
|
4364
|
-
|
|
4365
|
-
var ur =
|
|
4376
|
+
Ze.xdr_streaming = ar, Ze.xdr_polling = cr, Ze.sockjs = or;
|
|
4377
|
+
var ur = Ze;
|
|
4366
4378
|
class lr extends Te {
|
|
4367
4379
|
constructor() {
|
|
4368
4380
|
super();
|
|
@@ -4518,11 +4530,11 @@ function Oa() {
|
|
|
4518
4530
|
s(), a && a.code && this.handleCloseEvent(a), this.transport = null, this.emit("closed");
|
|
4519
4531
|
}
|
|
4520
4532
|
}, s = () => {
|
|
4521
|
-
|
|
4533
|
+
T(t, (a, l) => {
|
|
4522
4534
|
this.transport.unbind(l, a);
|
|
4523
4535
|
});
|
|
4524
4536
|
};
|
|
4525
|
-
|
|
4537
|
+
T(t, (a, l) => {
|
|
4526
4538
|
this.transport.bind(l, a);
|
|
4527
4539
|
});
|
|
4528
4540
|
}
|
|
@@ -4586,7 +4598,7 @@ function Oa() {
|
|
|
4586
4598
|
if (t.indexOf("client-") !== 0)
|
|
4587
4599
|
throw new p("Event '" + t + "' does not start with 'client-'");
|
|
4588
4600
|
if (!this.subscribed) {
|
|
4589
|
-
var a =
|
|
4601
|
+
var a = A.buildLogSuffix("triggeringClientEvents");
|
|
4590
4602
|
ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4591
4603
|
}
|
|
4592
4604
|
return this.pusher.send_event(t, s, this.name);
|
|
@@ -4654,7 +4666,7 @@ function Oa() {
|
|
|
4654
4666
|
} : null;
|
|
4655
4667
|
}
|
|
4656
4668
|
each(t) {
|
|
4657
|
-
|
|
4669
|
+
T(this.members, (s, a) => {
|
|
4658
4670
|
t(this.get(a));
|
|
4659
4671
|
});
|
|
4660
4672
|
}
|
|
@@ -4715,7 +4727,7 @@ function Oa() {
|
|
|
4715
4727
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4716
4728
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4717
4729
|
else {
|
|
4718
|
-
let S =
|
|
4730
|
+
let S = A.buildLogSuffix("authorizationEndpoint");
|
|
4719
4731
|
ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4720
4732
|
return;
|
|
4721
4733
|
}
|
|
@@ -5006,7 +5018,7 @@ function Oa() {
|
|
|
5006
5018
|
return delete this.channels[t], s;
|
|
5007
5019
|
}
|
|
5008
5020
|
disconnect() {
|
|
5009
|
-
|
|
5021
|
+
T(this.channels, function(t) {
|
|
5010
5022
|
t.disconnect();
|
|
5011
5023
|
});
|
|
5012
5024
|
}
|
|
@@ -5015,7 +5027,7 @@ function Oa() {
|
|
|
5015
5027
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5016
5028
|
if (t.config.nacl)
|
|
5017
5029
|
return Ee.createEncryptedChannel(i, t, t.config.nacl);
|
|
5018
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
5030
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = A.buildLogSuffix("encryptedChannelSupport");
|
|
5019
5031
|
throw new J(`${s}. ${a}`);
|
|
5020
5032
|
} else {
|
|
5021
5033
|
if (i.indexOf("private-") === 0)
|
|
@@ -5173,8 +5185,8 @@ function Oa() {
|
|
|
5173
5185
|
failFast: !0
|
|
5174
5186
|
}))) : g++);
|
|
5175
5187
|
}
|
|
5176
|
-
var j = le.now(), Q = S.pop().connect(t, function ee(ce,
|
|
5177
|
-
ce ? (dn(a), S.length > 0 ? (j = le.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (kr(a,
|
|
5188
|
+
var j = le.now(), Q = S.pop().connect(t, function ee(ce, nt) {
|
|
5189
|
+
ce ? (dn(a), S.length > 0 ? (j = le.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (kr(a, nt.transport.name, le.now() - j, g), s(null, nt));
|
|
5178
5190
|
});
|
|
5179
5191
|
return {
|
|
5180
5192
|
abort: function() {
|
|
@@ -5205,7 +5217,7 @@ function Oa() {
|
|
|
5205
5217
|
var l = $.getLocalStorage();
|
|
5206
5218
|
if (l)
|
|
5207
5219
|
try {
|
|
5208
|
-
l[_t(i)] =
|
|
5220
|
+
l[_t(i)] = Ye({
|
|
5209
5221
|
timestamp: le.now(),
|
|
5210
5222
|
transport: t,
|
|
5211
5223
|
latency: s,
|
|
@@ -5222,7 +5234,7 @@ function Oa() {
|
|
|
5222
5234
|
} catch {
|
|
5223
5235
|
}
|
|
5224
5236
|
}
|
|
5225
|
-
class
|
|
5237
|
+
class et {
|
|
5226
5238
|
constructor(t, { delay: s }) {
|
|
5227
5239
|
this.strategy = t, this.options = { delay: s };
|
|
5228
5240
|
}
|
|
@@ -5302,23 +5314,23 @@ function Oa() {
|
|
|
5302
5314
|
lives: 2,
|
|
5303
5315
|
minPingDelay: 1e4,
|
|
5304
5316
|
maxPingDelay: i.activityTimeout
|
|
5305
|
-
}), ce = l("ws", "ws", 3, g, Q),
|
|
5317
|
+
}), ce = l("ws", "ws", 3, g, Q), nt = l("wss", "ws", 3, S, Q), Ai = l("sockjs", "sockjs", 1, x), mn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Ri = l("xdr_streaming", "xdr_streaming", 1, x, ee), vn = l("xhr_polling", "xhr_polling", 1, x), Pi = l("xdr_polling", "xdr_polling", 1, x), bn = new Ue([ce], j), Mi = new Ue([nt], j), ki = new Ue([Ai], j), yn = new Ue([
|
|
5306
5318
|
new je($e(mn), mn, Ri)
|
|
5307
5319
|
], j), _n = new Ue([
|
|
5308
5320
|
new je($e(vn), vn, Pi)
|
|
5309
5321
|
], j), Sn = new Ue([
|
|
5310
5322
|
new je($e(yn), new yt([
|
|
5311
5323
|
yn,
|
|
5312
|
-
new
|
|
5324
|
+
new et(_n, { delay: 4e3 })
|
|
5313
5325
|
]), _n)
|
|
5314
5326
|
], j), Tt = new je($e(Sn), Sn, ki), Et;
|
|
5315
5327
|
return t.useTLS ? Et = new yt([
|
|
5316
5328
|
bn,
|
|
5317
|
-
new
|
|
5329
|
+
new et(Tt, { delay: 2e3 })
|
|
5318
5330
|
]) : Et = new yt([
|
|
5319
5331
|
bn,
|
|
5320
|
-
new
|
|
5321
|
-
new
|
|
5332
|
+
new et(Mi, { delay: 2e3 }),
|
|
5333
|
+
new et(Tt, { delay: 5e3 })
|
|
5322
5334
|
]), new Pr(new xr(new je($e(ce), Et, Tt)), a, {
|
|
5323
5335
|
ttl: 18e5,
|
|
5324
5336
|
timeline: t.timeline,
|
|
@@ -5567,7 +5579,7 @@ function Oa() {
|
|
|
5567
5579
|
nextAuthCallbackID: 1,
|
|
5568
5580
|
auth_callbacks: {},
|
|
5569
5581
|
ScriptReceivers: d,
|
|
5570
|
-
DependenciesReceivers:
|
|
5582
|
+
DependenciesReceivers: C,
|
|
5571
5583
|
getDefaultStrategy: Ir,
|
|
5572
5584
|
Transports: ur,
|
|
5573
5585
|
transportConnectionInitializer: Ur,
|
|
@@ -5660,7 +5672,7 @@ function Oa() {
|
|
|
5660
5672
|
(function(i) {
|
|
5661
5673
|
i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
|
|
5662
5674
|
})(Ct || (Ct = {}));
|
|
5663
|
-
var
|
|
5675
|
+
var tt = Ct;
|
|
5664
5676
|
class ti {
|
|
5665
5677
|
constructor(t, s, a) {
|
|
5666
5678
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
@@ -5669,13 +5681,13 @@ function Oa() {
|
|
|
5669
5681
|
t <= this.options.level && (this.events.push(me({}, s, { timestamp: le.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5670
5682
|
}
|
|
5671
5683
|
error(t) {
|
|
5672
|
-
this.log(
|
|
5684
|
+
this.log(tt.ERROR, t);
|
|
5673
5685
|
}
|
|
5674
5686
|
info(t) {
|
|
5675
|
-
this.log(
|
|
5687
|
+
this.log(tt.INFO, t);
|
|
5676
5688
|
}
|
|
5677
5689
|
debug(t) {
|
|
5678
|
-
this.log(
|
|
5690
|
+
this.log(tt.DEBUG, t);
|
|
5679
5691
|
}
|
|
5680
5692
|
isEmpty() {
|
|
5681
5693
|
return this.events.length === 0;
|
|
@@ -5724,7 +5736,7 @@ function Oa() {
|
|
|
5724
5736
|
}, Q = function() {
|
|
5725
5737
|
ee();
|
|
5726
5738
|
var ce;
|
|
5727
|
-
ce =
|
|
5739
|
+
ce = Ye(l), s(new z(ce));
|
|
5728
5740
|
}, ee = function() {
|
|
5729
5741
|
l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", j), l.unbind("closed", Q);
|
|
5730
5742
|
};
|
|
@@ -5795,7 +5807,7 @@ function Oa() {
|
|
|
5795
5807
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5796
5808
|
return (t, s) => {
|
|
5797
5809
|
const a = ai(t, i);
|
|
5798
|
-
$.getAuthorizers()[i.transport]($, a, i,
|
|
5810
|
+
$.getAuthorizers()[i.transport]($, a, i, w.UserAuthentication, s);
|
|
5799
5811
|
};
|
|
5800
5812
|
};
|
|
5801
5813
|
const ui = (i, t) => {
|
|
@@ -5815,7 +5827,7 @@ function Oa() {
|
|
|
5815
5827
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5816
5828
|
return (t, s) => {
|
|
5817
5829
|
const a = ui(t, i);
|
|
5818
|
-
$.getAuthorizers()[i.transport]($, a, i,
|
|
5830
|
+
$.getAuthorizers()[i.transport]($, a, i, w.ChannelAuthorization, s);
|
|
5819
5831
|
};
|
|
5820
5832
|
};
|
|
5821
5833
|
const di = (i, t, s) => {
|
|
@@ -5979,7 +5991,7 @@ function Oa() {
|
|
|
5979
5991
|
ge.instances[t].connect();
|
|
5980
5992
|
}
|
|
5981
5993
|
static getClientFeatures() {
|
|
5982
|
-
return
|
|
5994
|
+
return P(Re({ ws: $.Transports.ws }, function(t) {
|
|
5983
5995
|
return t.isSupported({});
|
|
5984
5996
|
}));
|
|
5985
5997
|
}
|
|
@@ -5989,7 +6001,7 @@ function Oa() {
|
|
|
5989
6001
|
features: ge.getClientFeatures(),
|
|
5990
6002
|
params: this.config.timelineParams || {},
|
|
5991
6003
|
limit: 50,
|
|
5992
|
-
level:
|
|
6004
|
+
level: tt.INFO,
|
|
5993
6005
|
version: h.VERSION
|
|
5994
6006
|
}), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
|
|
5995
6007
|
host: this.config.statsHost,
|
|
@@ -6194,7 +6206,7 @@ function Gn(e, n) {
|
|
|
6194
6206
|
"X-Requested-With": "XMLHttpRequest"
|
|
6195
6207
|
}), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
6196
6208
|
}
|
|
6197
|
-
function
|
|
6209
|
+
function Je(e, n, r) {
|
|
6198
6210
|
const o = e[n];
|
|
6199
6211
|
if (typeof o == "string" && o.trim() !== "")
|
|
6200
6212
|
return o;
|
|
@@ -6210,14 +6222,14 @@ function Ga(e) {
|
|
|
6210
6222
|
function Ja(e, n) {
|
|
6211
6223
|
if (!ie(e))
|
|
6212
6224
|
return null;
|
|
6213
|
-
const r =
|
|
6225
|
+
const r = Je(e, "user_id", "userId"), o = Ga(e.status);
|
|
6214
6226
|
if (!r || !o)
|
|
6215
6227
|
return null;
|
|
6216
6228
|
const c = {
|
|
6217
6229
|
user_id: r,
|
|
6218
|
-
tenant_scope:
|
|
6230
|
+
tenant_scope: Je(e, "tenant_scope", "tenantScope") ?? n,
|
|
6219
6231
|
status: o,
|
|
6220
|
-
ts:
|
|
6232
|
+
ts: Je(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6221
6233
|
}, u = e.tenant_id ?? e.tenantId;
|
|
6222
6234
|
typeof u == "string" ? c.tenant_id = u : u === null && (c.tenant_id = null);
|
|
6223
6235
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
@@ -6226,7 +6238,7 @@ function Ja(e, n) {
|
|
|
6226
6238
|
function Jn(e) {
|
|
6227
6239
|
if (!ie(e))
|
|
6228
6240
|
return null;
|
|
6229
|
-
const n =
|
|
6241
|
+
const n = Je(e, "user_id", "userId"), r = Je(e, "conversation_id", "conversationId");
|
|
6230
6242
|
if (!n || !r)
|
|
6231
6243
|
return null;
|
|
6232
6244
|
const o = e.user, c = ie(o) ? {
|
|
@@ -6280,48 +6292,48 @@ function Fe(e, n, r, o) {
|
|
|
6280
6292
|
function pc(e) {
|
|
6281
6293
|
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Yt())("MessengerEcho");
|
|
6282
6294
|
typeof window < "u" && (window.Pusher = Da);
|
|
6283
|
-
let d = null, f = null, h = null,
|
|
6284
|
-
const
|
|
6285
|
-
|
|
6286
|
-
for (const
|
|
6287
|
-
|
|
6288
|
-
}, y = (
|
|
6289
|
-
v =
|
|
6290
|
-
for (const
|
|
6291
|
-
|
|
6295
|
+
let d = null, f = null, h = null, R = null, C = "disconnected", v = "available", E = null, b = null;
|
|
6296
|
+
const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
|
|
6297
|
+
C = T;
|
|
6298
|
+
for (const P of A)
|
|
6299
|
+
P(T);
|
|
6300
|
+
}, y = (T) => {
|
|
6301
|
+
v = T;
|
|
6302
|
+
for (const P of w)
|
|
6303
|
+
P(T);
|
|
6292
6304
|
}, O = () => {
|
|
6293
6305
|
b !== null && (clearTimeout(b), b = null);
|
|
6294
|
-
}, z = (
|
|
6295
|
-
h !== null && (h.disconnect(), h = null),
|
|
6306
|
+
}, z = (T = !0) => {
|
|
6307
|
+
h !== null && (h.disconnect(), h = null), R = null, T && m("disconnected");
|
|
6296
6308
|
}, J = () => {
|
|
6297
|
-
O(), d = null, f = null,
|
|
6309
|
+
O(), d = null, f = null, E = null, y("available"), z(), p.clear();
|
|
6298
6310
|
}, W = () => {
|
|
6299
6311
|
if (!e.getSourceToken)
|
|
6300
6312
|
return null;
|
|
6301
|
-
const
|
|
6302
|
-
return
|
|
6303
|
-
}, te = (
|
|
6304
|
-
if (
|
|
6313
|
+
const T = e.getSourceToken();
|
|
6314
|
+
return T === null ? (J(), null) : (E !== null && E !== T && (O(), d = null, f = null, y("available"), z()), E = T, T);
|
|
6315
|
+
}, te = (T) => {
|
|
6316
|
+
if (T === null)
|
|
6305
6317
|
return !1;
|
|
6306
|
-
if (
|
|
6307
|
-
return
|
|
6308
|
-
const
|
|
6309
|
-
return Number.isNaN(
|
|
6310
|
-
}, k = (
|
|
6311
|
-
if (O(),
|
|
6318
|
+
if (T.auth.expiresAt === null)
|
|
6319
|
+
return T.auth.token !== "";
|
|
6320
|
+
const P = Date.parse(T.auth.expiresAt);
|
|
6321
|
+
return Number.isNaN(P) ? !1 : P - Date.now() > o;
|
|
6322
|
+
}, k = (T) => {
|
|
6323
|
+
if (O(), T.auth.expiresAt === null)
|
|
6312
6324
|
return;
|
|
6313
|
-
const
|
|
6314
|
-
if (Number.isNaN(
|
|
6325
|
+
const P = Date.parse(T.auth.expiresAt);
|
|
6326
|
+
if (Number.isNaN(P))
|
|
6315
6327
|
return;
|
|
6316
|
-
const N = Math.max(0,
|
|
6328
|
+
const N = Math.max(0, P - Date.now() - o);
|
|
6317
6329
|
b = setTimeout(() => {
|
|
6318
6330
|
K();
|
|
6319
6331
|
}, N);
|
|
6320
|
-
}, I = async (
|
|
6332
|
+
}, I = async (T = !1) => e.getSourceToken && W() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
|
|
6321
6333
|
try {
|
|
6322
6334
|
const N = await e.bootstrapClient.get(
|
|
6323
6335
|
r,
|
|
6324
|
-
|
|
6336
|
+
T ? { params: { refresh: 1 } } : void 0
|
|
6325
6337
|
), U = Va(N.data);
|
|
6326
6338
|
return d = U, y("available"), k(U), U;
|
|
6327
6339
|
} catch (N) {
|
|
@@ -6332,32 +6344,32 @@ function pc(e) {
|
|
|
6332
6344
|
})().finally(() => {
|
|
6333
6345
|
f = null;
|
|
6334
6346
|
}), await f), K = async () => {
|
|
6335
|
-
const
|
|
6347
|
+
const T = h !== null;
|
|
6336
6348
|
try {
|
|
6337
|
-
if (await I(!0), !
|
|
6349
|
+
if (await I(!0), !T)
|
|
6338
6350
|
return;
|
|
6339
6351
|
z(!1), await G(!0);
|
|
6340
|
-
} catch (
|
|
6341
|
-
u.warn("Failed to refresh messenger bootstrap",
|
|
6352
|
+
} catch (P) {
|
|
6353
|
+
u.warn("Failed to refresh messenger bootstrap", P);
|
|
6342
6354
|
}
|
|
6343
|
-
}, V = (
|
|
6344
|
-
const
|
|
6345
|
-
if (!
|
|
6355
|
+
}, V = (T) => {
|
|
6356
|
+
const P = T.connector?.pusher?.connection;
|
|
6357
|
+
if (!P) {
|
|
6346
6358
|
u.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6347
6359
|
return;
|
|
6348
6360
|
}
|
|
6349
|
-
|
|
6361
|
+
P.bind("connecting", () => {
|
|
6350
6362
|
m("connecting");
|
|
6351
|
-
}),
|
|
6363
|
+
}), P.bind("connected", () => {
|
|
6352
6364
|
m("connected");
|
|
6353
|
-
}),
|
|
6365
|
+
}), P.bind("disconnected", () => {
|
|
6354
6366
|
m("disconnected");
|
|
6355
|
-
}),
|
|
6367
|
+
}), P.bind("unavailable", () => {
|
|
6356
6368
|
m("disconnected");
|
|
6357
|
-
}),
|
|
6369
|
+
}), P.bind("error", () => {
|
|
6358
6370
|
m("error");
|
|
6359
|
-
}),
|
|
6360
|
-
const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current :
|
|
6371
|
+
}), P.bind("state_change", (N) => {
|
|
6372
|
+
const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : P.state;
|
|
6361
6373
|
if (U === "connected") {
|
|
6362
6374
|
m("connected");
|
|
6363
6375
|
return;
|
|
@@ -6367,9 +6379,9 @@ function pc(e) {
|
|
|
6367
6379
|
return;
|
|
6368
6380
|
}
|
|
6369
6381
|
(U === "unavailable" || U === "failed" || U === "disconnected") && m("disconnected");
|
|
6370
|
-
}),
|
|
6371
|
-
}, G = async (
|
|
6372
|
-
const N = await I(
|
|
6382
|
+
}), P.state === "connected" && m("connected");
|
|
6383
|
+
}, G = async (T = !1) => !T && h !== null && te(d) ? h : !T && R !== null ? await R : (R = (async () => {
|
|
6384
|
+
const N = await I(T);
|
|
6373
6385
|
if (N === null)
|
|
6374
6386
|
return null;
|
|
6375
6387
|
h !== null && z(!1);
|
|
@@ -6393,8 +6405,8 @@ function pc(e) {
|
|
|
6393
6405
|
};
|
|
6394
6406
|
return N.service.reverb.path && (ne.wsPath = N.service.reverb.path), h = new Ia(ne), V(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6395
6407
|
})().finally(() => {
|
|
6396
|
-
|
|
6397
|
-
}), await
|
|
6408
|
+
R = null;
|
|
6409
|
+
}), await R), _ = jt.create({
|
|
6398
6410
|
timeout: e.requestTimeoutMs ?? za,
|
|
6399
6411
|
withCredentials: !1,
|
|
6400
6412
|
headers: {
|
|
@@ -6402,48 +6414,48 @@ function pc(e) {
|
|
|
6402
6414
|
"X-Requested-With": "XMLHttpRequest"
|
|
6403
6415
|
}
|
|
6404
6416
|
});
|
|
6405
|
-
_.interceptors.request.use(async (
|
|
6406
|
-
const
|
|
6407
|
-
if (
|
|
6417
|
+
_.interceptors.request.use(async (T) => {
|
|
6418
|
+
const P = await I();
|
|
6419
|
+
if (P === null)
|
|
6408
6420
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6409
|
-
return
|
|
6421
|
+
return T.baseURL = P.service.apiBaseUrl, Gn(T, P.auth.token), T;
|
|
6410
6422
|
}), _.interceptors.response.use(
|
|
6411
|
-
(
|
|
6412
|
-
async (
|
|
6413
|
-
const
|
|
6414
|
-
if (
|
|
6415
|
-
|
|
6423
|
+
(T) => T,
|
|
6424
|
+
async (T) => {
|
|
6425
|
+
const P = T.config;
|
|
6426
|
+
if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6427
|
+
P._messengerRetry = !0;
|
|
6416
6428
|
const N = await I(!0);
|
|
6417
6429
|
if (N !== null)
|
|
6418
|
-
return
|
|
6430
|
+
return P.baseURL = N.service.apiBaseUrl, Gn(P, N.auth.token), await _(P);
|
|
6419
6431
|
}
|
|
6420
|
-
return Promise.reject(
|
|
6432
|
+
return Promise.reject(T);
|
|
6421
6433
|
}
|
|
6422
6434
|
);
|
|
6423
|
-
const L = () => v === "account_suspended" ? null : h, fe = (
|
|
6424
|
-
|
|
6425
|
-
}), Se = (
|
|
6426
|
-
|
|
6427
|
-
}), B = () => d?.auth.tenantId ?? "global", D = (
|
|
6428
|
-
const
|
|
6429
|
-
if (
|
|
6435
|
+
const L = () => v === "account_suspended" ? null : h, fe = (T) => (A.add(T), T(C), () => {
|
|
6436
|
+
A.delete(T);
|
|
6437
|
+
}), Se = (T) => (w.add(T), T(v), () => {
|
|
6438
|
+
w.delete(T);
|
|
6439
|
+
}), B = () => d?.auth.tenantId ?? "global", D = (T) => {
|
|
6440
|
+
const P = Ft(T.ts)?.getTime() ?? Ft(T.last_seen_at)?.getTime() ?? null;
|
|
6441
|
+
if (P === null)
|
|
6430
6442
|
return !0;
|
|
6431
|
-
const N = `${
|
|
6432
|
-
if (U &&
|
|
6443
|
+
const N = `${T.tenant_scope ?? "global"}:${T.user_id}`, U = p.get(N);
|
|
6444
|
+
if (U && P < U.timestampMs)
|
|
6433
6445
|
return !1;
|
|
6434
6446
|
const ne = Date.now();
|
|
6435
6447
|
p.set(N, {
|
|
6436
|
-
timestampMs:
|
|
6448
|
+
timestampMs: P,
|
|
6437
6449
|
seenAt: ne
|
|
6438
6450
|
});
|
|
6439
6451
|
for (const [re, de] of p.entries())
|
|
6440
6452
|
ne - de.seenAt > c && p.delete(re);
|
|
6441
6453
|
return !0;
|
|
6442
|
-
}, q = (
|
|
6443
|
-
const
|
|
6444
|
-
if (!
|
|
6454
|
+
}, q = (T) => {
|
|
6455
|
+
const P = L();
|
|
6456
|
+
if (!P || typeof P.join != "function")
|
|
6445
6457
|
return;
|
|
6446
|
-
const N =
|
|
6458
|
+
const N = P.join(`online-users.${B()}`), U = [
|
|
6447
6459
|
".PresenceStatusChanged",
|
|
6448
6460
|
"PresenceStatusChanged",
|
|
6449
6461
|
".presence.status.changed",
|
|
@@ -6456,12 +6468,12 @@ function pc(e) {
|
|
|
6456
6468
|
for (const ne of U)
|
|
6457
6469
|
N.listen(ne, (re) => {
|
|
6458
6470
|
const de = Ja(re, B());
|
|
6459
|
-
!de || !D(de) ||
|
|
6471
|
+
!de || !D(de) || T(de);
|
|
6460
6472
|
});
|
|
6461
6473
|
}, _e = () => {
|
|
6462
6474
|
h?.leave(`online-users.${B()}`);
|
|
6463
6475
|
};
|
|
6464
|
-
function M(
|
|
6476
|
+
function M(T, P) {
|
|
6465
6477
|
const N = [];
|
|
6466
6478
|
function U(ne, re, de) {
|
|
6467
6479
|
if (!de)
|
|
@@ -6469,52 +6481,52 @@ function pc(e) {
|
|
|
6469
6481
|
const Re = (Le) => {
|
|
6470
6482
|
re(Le) && de(Le);
|
|
6471
6483
|
};
|
|
6472
|
-
|
|
6484
|
+
T.bind(ne, Re), N.push({ event: ne, handler: Re });
|
|
6473
6485
|
}
|
|
6474
|
-
return U("ConversationMessageSent", Kn,
|
|
6486
|
+
return U("ConversationMessageSent", Kn, P.onMessageSent), U("ConversationMessageRead", Qn, P.onMessageRead), U("ConversationMessageEdited", Yn, P.onMessageEdited), U("ConversationMessageDeleted", Zn, P.onMessageDeleted), U("MessageReactionToggled", es, P.onReactionToggled), U("ConversationRequestAccepted", ts, P.onRequestAccepted), U("ConversationParticipantRemoved", ns, P.onParticipantRemoved), () => {
|
|
6475
6487
|
for (const ne of N)
|
|
6476
|
-
|
|
6488
|
+
T.unbind(ne.event, ne.handler);
|
|
6477
6489
|
};
|
|
6478
6490
|
}
|
|
6479
|
-
const F = (
|
|
6491
|
+
const F = (T, P) => {
|
|
6480
6492
|
const N = L();
|
|
6481
6493
|
if (!N)
|
|
6482
6494
|
return () => {
|
|
6483
6495
|
};
|
|
6484
|
-
const U = N.private(`conversation.${
|
|
6496
|
+
const U = N.private(`conversation.${T}`), ne = U.subscription;
|
|
6485
6497
|
if (ne)
|
|
6486
|
-
return M(ne,
|
|
6498
|
+
return M(ne, P);
|
|
6487
6499
|
const re = [];
|
|
6488
|
-
return
|
|
6500
|
+
return P.onMessageSent && re.push({
|
|
6489
6501
|
event: ".ConversationMessageSent",
|
|
6490
|
-
handler: Fe(U, ".ConversationMessageSent", Kn,
|
|
6491
|
-
}),
|
|
6502
|
+
handler: Fe(U, ".ConversationMessageSent", Kn, P.onMessageSent)
|
|
6503
|
+
}), P.onMessageRead && re.push({
|
|
6492
6504
|
event: ".ConversationMessageRead",
|
|
6493
|
-
handler: Fe(U, ".ConversationMessageRead", Qn,
|
|
6494
|
-
}),
|
|
6505
|
+
handler: Fe(U, ".ConversationMessageRead", Qn, P.onMessageRead)
|
|
6506
|
+
}), P.onMessageEdited && re.push({
|
|
6495
6507
|
event: ".ConversationMessageEdited",
|
|
6496
|
-
handler: Fe(U, ".ConversationMessageEdited", Yn,
|
|
6497
|
-
}),
|
|
6508
|
+
handler: Fe(U, ".ConversationMessageEdited", Yn, P.onMessageEdited)
|
|
6509
|
+
}), P.onMessageDeleted && re.push({
|
|
6498
6510
|
event: ".ConversationMessageDeleted",
|
|
6499
|
-
handler: Fe(U, ".ConversationMessageDeleted", Zn,
|
|
6500
|
-
}),
|
|
6511
|
+
handler: Fe(U, ".ConversationMessageDeleted", Zn, P.onMessageDeleted)
|
|
6512
|
+
}), P.onReactionToggled && re.push({
|
|
6501
6513
|
event: ".MessageReactionToggled",
|
|
6502
|
-
handler: Fe(U, ".MessageReactionToggled", es,
|
|
6503
|
-
}),
|
|
6514
|
+
handler: Fe(U, ".MessageReactionToggled", es, P.onReactionToggled)
|
|
6515
|
+
}), P.onRequestAccepted && re.push({
|
|
6504
6516
|
event: ".ConversationRequestAccepted",
|
|
6505
|
-
handler: Fe(U, ".ConversationRequestAccepted", ts,
|
|
6506
|
-
}),
|
|
6517
|
+
handler: Fe(U, ".ConversationRequestAccepted", ts, P.onRequestAccepted)
|
|
6518
|
+
}), P.onParticipantRemoved && re.push({
|
|
6507
6519
|
event: ".ConversationParticipantRemoved",
|
|
6508
|
-
handler: Fe(U, ".ConversationParticipantRemoved", ns,
|
|
6520
|
+
handler: Fe(U, ".ConversationParticipantRemoved", ns, P.onParticipantRemoved)
|
|
6509
6521
|
}), () => {
|
|
6510
6522
|
if (typeof U.stopListening == "function")
|
|
6511
6523
|
for (const de of re)
|
|
6512
6524
|
U.stopListening(de.event, de.handler);
|
|
6513
6525
|
};
|
|
6514
|
-
}, Z = (
|
|
6515
|
-
h?.leave(`conversation.${
|
|
6516
|
-
}, oe = (
|
|
6517
|
-
const U =
|
|
6526
|
+
}, Z = (T) => {
|
|
6527
|
+
h?.leave(`conversation.${T}`);
|
|
6528
|
+
}, oe = (T, P, N) => {
|
|
6529
|
+
const U = T.private(`typing-conversation.${P}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), re = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), de = U.subscription;
|
|
6518
6530
|
if (de) {
|
|
6519
6531
|
const we = (pe) => {
|
|
6520
6532
|
const ve = Jn(pe);
|
|
@@ -6569,20 +6581,20 @@ function pc(e) {
|
|
|
6569
6581
|
for (const we of Re)
|
|
6570
6582
|
U.stopListening(we.event, we.handler);
|
|
6571
6583
|
};
|
|
6572
|
-
}, le = (
|
|
6584
|
+
}, le = (T, P) => {
|
|
6573
6585
|
const N = L();
|
|
6574
6586
|
if (N)
|
|
6575
|
-
return oe(N,
|
|
6587
|
+
return oe(N, T, P);
|
|
6576
6588
|
let U = !1, ne = null;
|
|
6577
6589
|
return ze().then((re) => {
|
|
6578
|
-
U || !re || (ne = oe(re,
|
|
6590
|
+
U || !re || (ne = oe(re, T, P));
|
|
6579
6591
|
}).catch((re) => {
|
|
6580
6592
|
u.warn("Failed to defer typing subscription", re);
|
|
6581
6593
|
}), () => {
|
|
6582
6594
|
U = !0, ne?.();
|
|
6583
6595
|
};
|
|
6584
|
-
}, me = (
|
|
6585
|
-
h?.leave(`typing-conversation.${
|
|
6596
|
+
}, me = (T) => {
|
|
6597
|
+
h?.leave(`typing-conversation.${T}`);
|
|
6586
6598
|
}, ht = async () => {
|
|
6587
6599
|
y("available"), z(), await G(!0);
|
|
6588
6600
|
}, ze = async () => v === "account_suspended" ? null : await G();
|
|
@@ -6591,7 +6603,7 @@ function pc(e) {
|
|
|
6591
6603
|
initializedEvent: n,
|
|
6592
6604
|
getEcho: L,
|
|
6593
6605
|
waitForEcho: ze,
|
|
6594
|
-
getConnectionStatus: () =>
|
|
6606
|
+
getConnectionStatus: () => C,
|
|
6595
6607
|
getAccessState: () => v,
|
|
6596
6608
|
onConnectionStatusChange: fe,
|
|
6597
6609
|
onAccessStateChange: Se,
|
|
@@ -6614,7 +6626,7 @@ export {
|
|
|
6614
6626
|
En as getConnectionStatus,
|
|
6615
6627
|
Ae as getEcho,
|
|
6616
6628
|
gs as getEchoConnectionStatus,
|
|
6617
|
-
|
|
6629
|
+
Ke as getEchoInitializedEvent,
|
|
6618
6630
|
Y as getErrorMessage,
|
|
6619
6631
|
Yt as getLoggerFactory,
|
|
6620
6632
|
Bt as getMainApi,
|