@codingfactory/messenger-client 0.2.17 → 0.2.19
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 +626 -624
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ref as ve, getCurrentInstance as zt, computed as ie, watch as Ot, onUnmounted as De, toValue as Xn, onMounted as jt } from "vue";
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import $t, { isAxiosError as
|
|
2
|
+
import { defineStore as Si, storeToRefs as Ci } from "pinia";
|
|
3
|
+
import $t, { isAxiosError as wi, AxiosHeaders as wn } from "axios";
|
|
4
4
|
import { isAxiosError as uc } from "axios";
|
|
5
|
-
import { useRoute as
|
|
5
|
+
import { useRoute as Ti } from "vue-router";
|
|
6
6
|
const Wn = () => () => {
|
|
7
7
|
}, Gn = () => () => {
|
|
8
8
|
}, Jn = async () => {
|
|
@@ -29,7 +29,7 @@ const Wn = () => () => {
|
|
|
29
29
|
unsubscribeFromConversation: Yn,
|
|
30
30
|
subscribeToTyping: ts,
|
|
31
31
|
unsubscribeFromTyping: Zn
|
|
32
|
-
}, We = () => $.ECHO_INITIALIZED_EVENT,
|
|
32
|
+
}, We = () => $.ECHO_INITIALIZED_EVENT, Ae = () => $.getEcho(), ss = async () => $.waitForEcho(), rs = () => $.getConnectionStatus(), Tn = () => rs(), Ft = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), Ei = (e) => $.onAccessStateChange(e), Ai = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
34
|
}, Ri = (e) => $.subscribeToPresenceStatus(e), Pi = () => $.unsubscribeFromPresenceStatus(), Mi = (e, n) => $.subscribeToConversation(e, n), xi = (e) => $.unsubscribeFromConversation(e), ki = (e, n) => $.subscribeToTyping(e, n), Li = (e) => $.unsubscribeFromTyping(e);
|
|
35
35
|
function Ii(e) {
|
|
@@ -38,29 +38,29 @@ function Ii(e) {
|
|
|
38
38
|
function Ui() {
|
|
39
39
|
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = ns, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = Wn, $.onAccessStateChange = Gn, $.reconnect = Jn, $.subscribeToPresenceStatus = Kn, $.unsubscribeFromPresenceStatus = Qn, $.subscribeToConversation = es, $.unsubscribeFromConversation = Yn, $.subscribeToTyping = ts, $.unsubscribeFromTyping = Zn;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function xe(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
44
|
function Oi(e) {
|
|
45
|
-
return
|
|
45
|
+
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
46
46
|
}
|
|
47
47
|
function Fi(e) {
|
|
48
|
-
return
|
|
48
|
+
return xe(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
49
49
|
}
|
|
50
50
|
function Ni(e) {
|
|
51
|
-
return
|
|
51
|
+
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string";
|
|
52
52
|
}
|
|
53
53
|
function Di(e) {
|
|
54
|
-
return
|
|
54
|
+
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
56
|
function qi(e) {
|
|
57
|
-
return
|
|
57
|
+
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
58
58
|
}
|
|
59
59
|
function zi(e) {
|
|
60
|
-
return
|
|
60
|
+
return xe(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let Ht =
|
|
62
|
+
const is = $t;
|
|
63
|
+
let Ht = is;
|
|
64
64
|
function W() {
|
|
65
65
|
return Ht;
|
|
66
66
|
}
|
|
@@ -68,12 +68,12 @@ function ji(e) {
|
|
|
68
68
|
Ht = e;
|
|
69
69
|
}
|
|
70
70
|
function $i() {
|
|
71
|
-
Ht =
|
|
71
|
+
Ht = is;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const os = {
|
|
74
74
|
currentUser: null
|
|
75
75
|
};
|
|
76
|
-
let Bt = () =>
|
|
76
|
+
let Bt = () => os;
|
|
77
77
|
function Fe() {
|
|
78
78
|
return Bt;
|
|
79
79
|
}
|
|
@@ -81,10 +81,10 @@ function Hi(e) {
|
|
|
81
81
|
Bt = e;
|
|
82
82
|
}
|
|
83
83
|
function Bi() {
|
|
84
|
-
Bt = () =>
|
|
84
|
+
Bt = () => os;
|
|
85
85
|
}
|
|
86
86
|
function Z(e) {
|
|
87
|
-
if (
|
|
87
|
+
if (wi(e)) {
|
|
88
88
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
89
89
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
90
90
|
}
|
|
@@ -96,12 +96,12 @@ function Ka(e) {
|
|
|
96
96
|
function Qa(e) {
|
|
97
97
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const as = {
|
|
100
100
|
async uploadImage() {
|
|
101
101
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
let Vt =
|
|
104
|
+
let Vt = as;
|
|
105
105
|
function Vi() {
|
|
106
106
|
return Vt;
|
|
107
107
|
}
|
|
@@ -109,16 +109,16 @@ function Xi(e) {
|
|
|
109
109
|
Vt = e;
|
|
110
110
|
}
|
|
111
111
|
function Wi() {
|
|
112
|
-
Vt =
|
|
112
|
+
Vt = as;
|
|
113
113
|
}
|
|
114
114
|
function Gi(e) {
|
|
115
115
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function cs(e) {
|
|
118
118
|
return typeof e == "object" && e !== null;
|
|
119
119
|
}
|
|
120
120
|
function $e(e) {
|
|
121
|
-
return !
|
|
121
|
+
return !cs(e) || !("data" in e) ? e : e.data;
|
|
122
122
|
}
|
|
123
123
|
function st(e, n) {
|
|
124
124
|
const i = e[n];
|
|
@@ -146,7 +146,7 @@ function Rt(e, n) {
|
|
|
146
146
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
147
147
|
}
|
|
148
148
|
function Nt(e) {
|
|
149
|
-
if (!
|
|
149
|
+
if (!cs(e))
|
|
150
150
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
151
151
|
return {
|
|
152
152
|
id: st(e, "id"),
|
|
@@ -170,7 +170,7 @@ function An(e) {
|
|
|
170
170
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
171
171
|
return e;
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const Pe = {
|
|
174
174
|
async fetchFolders() {
|
|
175
175
|
const e = await W().get("/v1/messaging/folders");
|
|
176
176
|
return Ji($e(e.data));
|
|
@@ -210,10 +210,10 @@ const Re = {
|
|
|
210
210
|
if (Number.isFinite(n))
|
|
211
211
|
return n;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
213
|
+
}, us = (e) => typeof e == "number" && e >= 500 && e < 600, Pn = (e) => {
|
|
214
214
|
const i = Wt(e.response?.status);
|
|
215
|
-
return i === void 0 ? !0 : i === 429 ||
|
|
216
|
-
},
|
|
215
|
+
return i === void 0 ? !0 : i === 429 || us(i);
|
|
216
|
+
}, ls = (e) => {
|
|
217
217
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
218
218
|
return Math.max(Rn, e * 1e3);
|
|
219
219
|
if (typeof e == "string") {
|
|
@@ -227,7 +227,7 @@ const Re = {
|
|
|
227
227
|
return Math.min(Ki, o);
|
|
228
228
|
}, to = (e) => {
|
|
229
229
|
const n = e;
|
|
230
|
-
return Wt(n.response?.status) === 429 ?
|
|
230
|
+
return Wt(n.response?.status) === 429 ? ls(n.response?.headers?.["retry-after"]) : Qi;
|
|
231
231
|
}, Mn = async (e) => {
|
|
232
232
|
await new Promise((n) => {
|
|
233
233
|
setTimeout(n, e);
|
|
@@ -397,7 +397,7 @@ function ho(e, n) {
|
|
|
397
397
|
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;
|
|
398
398
|
}
|
|
399
399
|
function He(e, n) {
|
|
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 ?? "",
|
|
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 ?? "", y = (() => {
|
|
401
401
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
402
402
|
return !1;
|
|
403
403
|
const C = n.last_message?.id, b = e.last_message?.id;
|
|
@@ -405,7 +405,7 @@ function He(e, n) {
|
|
|
405
405
|
})();
|
|
406
406
|
return {
|
|
407
407
|
...e,
|
|
408
|
-
unread_count: o ||
|
|
408
|
+
unread_count: o || y ? 0 : d,
|
|
409
409
|
participants: uo(e.participants, n?.participants),
|
|
410
410
|
is_muted: o,
|
|
411
411
|
muted_until: i,
|
|
@@ -532,7 +532,7 @@ function xt(e) {
|
|
|
532
532
|
i.is_request === !0 && n.set(i.id, i);
|
|
533
533
|
return Array.from(n.values()).sort(ct);
|
|
534
534
|
}
|
|
535
|
-
const Gt =
|
|
535
|
+
const Gt = Si("messaging", {
|
|
536
536
|
state: () => ({
|
|
537
537
|
conversations: [],
|
|
538
538
|
requests: [],
|
|
@@ -581,7 +581,7 @@ const Gt = _i("messaging", {
|
|
|
581
581
|
},
|
|
582
582
|
async fetchFolders() {
|
|
583
583
|
try {
|
|
584
|
-
const e = await
|
|
584
|
+
const e = await Pe.fetchFolders();
|
|
585
585
|
return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
586
586
|
} catch (e) {
|
|
587
587
|
throw this.error = Z(e), e;
|
|
@@ -589,7 +589,7 @@ const Gt = _i("messaging", {
|
|
|
589
589
|
},
|
|
590
590
|
async createFolder(e) {
|
|
591
591
|
try {
|
|
592
|
-
const n = await
|
|
592
|
+
const n = await Pe.createFolder(e);
|
|
593
593
|
return this.folders = Be([...this.folders, n]), n;
|
|
594
594
|
} catch (n) {
|
|
595
595
|
throw this.error = Z(n), n;
|
|
@@ -597,7 +597,7 @@ const Gt = _i("messaging", {
|
|
|
597
597
|
},
|
|
598
598
|
async updateFolder(e, n) {
|
|
599
599
|
try {
|
|
600
|
-
const i = await
|
|
600
|
+
const i = await Pe.updateFolder(e, n);
|
|
601
601
|
return this.folders = Be(
|
|
602
602
|
this.folders.map((o) => o.id === e ? i : o)
|
|
603
603
|
), i;
|
|
@@ -607,14 +607,14 @@ const Gt = _i("messaging", {
|
|
|
607
607
|
},
|
|
608
608
|
async deleteFolder(e) {
|
|
609
609
|
try {
|
|
610
|
-
await
|
|
610
|
+
await Pe.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
611
611
|
} catch (n) {
|
|
612
612
|
throw this.error = Z(n), n;
|
|
613
613
|
}
|
|
614
614
|
},
|
|
615
615
|
async reorderFolders(e) {
|
|
616
616
|
try {
|
|
617
|
-
await
|
|
617
|
+
await Pe.reorderFolders(e);
|
|
618
618
|
const n = new Map(this.folders.map((c) => [c.id, c])), i = [];
|
|
619
619
|
for (const c of e) {
|
|
620
620
|
const l = n.get(c);
|
|
@@ -636,7 +636,7 @@ const Gt = _i("messaging", {
|
|
|
636
636
|
},
|
|
637
637
|
async assignToFolder(e, n) {
|
|
638
638
|
try {
|
|
639
|
-
const i = await
|
|
639
|
+
const i = await Pe.assignFolder(e, n), o = this.conversations.find(
|
|
640
640
|
(d) => d.id === e
|
|
641
641
|
) ?? this.requests.find(
|
|
642
642
|
(d) => d.id === e
|
|
@@ -671,11 +671,11 @@ const Gt = _i("messaging", {
|
|
|
671
671
|
const d = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: h } = rt(
|
|
672
672
|
d.data,
|
|
673
673
|
"conversations"
|
|
674
|
-
), x = g.map((
|
|
674
|
+
), x = g.map((y) => {
|
|
675
675
|
const C = this.conversations.find(
|
|
676
|
-
(b) => b.id ===
|
|
676
|
+
(b) => b.id === y.id
|
|
677
677
|
);
|
|
678
|
-
return He(
|
|
678
|
+
return He(y, C);
|
|
679
679
|
});
|
|
680
680
|
e ? this.conversations.push(...x) : this.conversations = x, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
681
681
|
const M = {
|
|
@@ -699,7 +699,7 @@ const Gt = _i("messaging", {
|
|
|
699
699
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
700
700
|
} catch (e) {
|
|
701
701
|
const n = e, i = Wt(n.response?.status);
|
|
702
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
702
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + ls(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || us(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + eo(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Xt, !1));
|
|
703
703
|
}
|
|
704
704
|
},
|
|
705
705
|
async fetchConversation(e) {
|
|
@@ -755,21 +755,21 @@ const Gt = _i("messaging", {
|
|
|
755
755
|
try {
|
|
756
756
|
c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
757
757
|
break;
|
|
758
|
-
} catch (
|
|
759
|
-
if (!(o < Yi && Pn(
|
|
760
|
-
throw
|
|
761
|
-
o += 1, await Mn(to(
|
|
758
|
+
} catch (y) {
|
|
759
|
+
if (!(o < Yi && Pn(y)))
|
|
760
|
+
throw y;
|
|
761
|
+
o += 1, await Mn(to(y));
|
|
762
762
|
}
|
|
763
763
|
const { items: l, nextCursor: d } = rt(
|
|
764
764
|
c.data,
|
|
765
765
|
"messages"
|
|
766
766
|
), g = l.map(at), h = [...g].reverse();
|
|
767
767
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
768
|
-
const
|
|
769
|
-
return
|
|
768
|
+
const y = this.conversations.find((C) => C.id === e) ?? this.requests.find((C) => C.id === e);
|
|
769
|
+
return y ? !y.last_message || !y.last_message_at : !1;
|
|
770
770
|
})()) {
|
|
771
|
-
const
|
|
772
|
-
|
|
771
|
+
const y = this.messages[e]?.at(-1);
|
|
772
|
+
y && this.updateConversationLastMessage(e, y);
|
|
773
773
|
}
|
|
774
774
|
d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
775
775
|
const M = {
|
|
@@ -784,10 +784,10 @@ const Gt = _i("messaging", {
|
|
|
784
784
|
}
|
|
785
785
|
},
|
|
786
786
|
async sendMessage(e, n, i, o, c, l, d) {
|
|
787
|
-
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = co(d),
|
|
787
|
+
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = co(d), y = g.currentUser, C = {
|
|
788
788
|
id: h,
|
|
789
789
|
conversation_id: e,
|
|
790
|
-
author_id:
|
|
790
|
+
author_id: y?.id || "",
|
|
791
791
|
body: n || "",
|
|
792
792
|
attachments: [],
|
|
793
793
|
meta: x ? { shared_post_id: x } : {},
|
|
@@ -796,11 +796,11 @@ const Gt = _i("messaging", {
|
|
|
796
796
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
797
797
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
798
798
|
};
|
|
799
|
-
|
|
800
|
-
id:
|
|
801
|
-
name:
|
|
802
|
-
...
|
|
803
|
-
...
|
|
799
|
+
y && (C.author = {
|
|
800
|
+
id: y.id,
|
|
801
|
+
name: y.name,
|
|
802
|
+
...y.avatar ? { avatar: y.avatar } : {},
|
|
803
|
+
...y.handle ? { handle: y.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
806
|
let b;
|
|
@@ -1126,9 +1126,9 @@ const Gt = _i("messaging", {
|
|
|
1126
1126
|
let g;
|
|
1127
1127
|
try {
|
|
1128
1128
|
g = await W().post(o, c);
|
|
1129
|
-
} catch (
|
|
1130
|
-
if (!po(
|
|
1131
|
-
throw
|
|
1129
|
+
} catch (y) {
|
|
1130
|
+
if (!po(y))
|
|
1131
|
+
throw y;
|
|
1132
1132
|
g = await W().post(o, c);
|
|
1133
1133
|
}
|
|
1134
1134
|
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x = Un(
|
|
@@ -1136,7 +1136,7 @@ const Gt = _i("messaging", {
|
|
|
1136
1136
|
);
|
|
1137
1137
|
(x.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1138
1138
|
try {
|
|
1139
|
-
const
|
|
1139
|
+
const y = await W().get(o), C = he(y.data) && "data" in y.data ? y.data.data : y.data, b = Un(
|
|
1140
1140
|
he(C) ? C.reactions : void 0
|
|
1141
1141
|
);
|
|
1142
1142
|
this.updateMessageReactions(e, n, b);
|
|
@@ -1177,7 +1177,7 @@ const Gt = _i("messaging", {
|
|
|
1177
1177
|
},
|
|
1178
1178
|
async acceptRequest(e) {
|
|
1179
1179
|
try {
|
|
1180
|
-
const n = await
|
|
1180
|
+
const n = await Pe.acceptRequest(e);
|
|
1181
1181
|
this.requests = this.requests.filter((o) => o.id !== e);
|
|
1182
1182
|
const i = He({
|
|
1183
1183
|
...n,
|
|
@@ -1192,7 +1192,7 @@ const Gt = _i("messaging", {
|
|
|
1192
1192
|
},
|
|
1193
1193
|
async declineRequest(e) {
|
|
1194
1194
|
try {
|
|
1195
|
-
await
|
|
1195
|
+
await Pe.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1196
1196
|
} catch (n) {
|
|
1197
1197
|
throw this.error = Z(n), n;
|
|
1198
1198
|
}
|
|
@@ -1265,71 +1265,71 @@ const Gt = _i("messaging", {
|
|
|
1265
1265
|
});
|
|
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
|
-
let M = 0,
|
|
1268
|
+
let M = 0, y = null, C = null;
|
|
1269
1269
|
const b = ie(() => i.currentUser?.id), T = () => Xn(e)?.trim() ?? "";
|
|
1270
1270
|
function w() {
|
|
1271
|
-
|
|
1271
|
+
y && (clearTimeout(y), y = null), M = 0;
|
|
1272
1272
|
}
|
|
1273
1273
|
function f() {
|
|
1274
|
-
!g || o.value ||
|
|
1275
|
-
|
|
1274
|
+
!g || o.value || y || M >= h || (y = setTimeout(() => {
|
|
1275
|
+
y = null, M += 1, F();
|
|
1276
1276
|
}, x));
|
|
1277
1277
|
}
|
|
1278
|
-
function m(
|
|
1279
|
-
if (n.addMessage(
|
|
1280
|
-
const I = n.getConversationById(
|
|
1281
|
-
I && (I.unread_count = 0), n.markAsRead(
|
|
1278
|
+
function m(_) {
|
|
1279
|
+
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
1280
|
+
const I = n.getConversationById(_.conversation_id);
|
|
1281
|
+
I && (I.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
|
|
1282
1282
|
});
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
function v(
|
|
1286
|
-
n.applyParticipantReadState(
|
|
1285
|
+
function v(_) {
|
|
1286
|
+
n.applyParticipantReadState(_);
|
|
1287
1287
|
}
|
|
1288
|
-
function N(
|
|
1289
|
-
const I = n.getMessagesByConversationId(
|
|
1288
|
+
function N(_) {
|
|
1289
|
+
const I = n.getMessagesByConversationId(_.conversation_id), ae = I.findIndex((B) => B.id === _.message.id);
|
|
1290
1290
|
if (ae >= 0) {
|
|
1291
1291
|
const B = I[ae];
|
|
1292
1292
|
if (!B) return;
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1295
|
-
const V = n.getConversationById(
|
|
1296
|
-
V && V.last_message?.id ===
|
|
1293
|
+
const E = { ...B };
|
|
1294
|
+
_.message.body !== void 0 && (E.body = _.message.body), _.message.edited_at !== void 0 && (E.edited_at = _.message.edited_at), _.message.meta !== void 0 && (E.meta = _.message.meta), I[ae] = E;
|
|
1295
|
+
const V = n.getConversationById(_.conversation_id);
|
|
1296
|
+
V && V.last_message?.id === _.message.id && (V.last_message = E);
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
|
-
function q(
|
|
1300
|
-
n.removeMessage(
|
|
1299
|
+
function q(_) {
|
|
1300
|
+
n.removeMessage(_.conversation_id, _.message_id);
|
|
1301
1301
|
}
|
|
1302
|
-
function G(
|
|
1302
|
+
function G(_) {
|
|
1303
1303
|
n.updateMessageReactions(
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1304
|
+
_.conversation_id,
|
|
1305
|
+
_.message_id,
|
|
1306
|
+
_.reactions
|
|
1307
1307
|
);
|
|
1308
1308
|
}
|
|
1309
|
-
function k(
|
|
1310
|
-
const I = n.getConversationById(
|
|
1309
|
+
function k(_) {
|
|
1310
|
+
const I = n.getConversationById(_.conversation_id);
|
|
1311
1311
|
I && (I.is_request = !1), n.requests = n.requests.filter(
|
|
1312
|
-
(ae) => ae.id !==
|
|
1312
|
+
(ae) => ae.id !== _.conversation_id
|
|
1313
1313
|
);
|
|
1314
1314
|
}
|
|
1315
|
-
function O(
|
|
1316
|
-
|
|
1315
|
+
function O(_) {
|
|
1316
|
+
_.removed_user_id === b.value && (te(), n.deleteConversation(_.conversation_id).catch(() => {
|
|
1317
1317
|
}));
|
|
1318
1318
|
}
|
|
1319
|
-
function H(
|
|
1319
|
+
function H(_) {
|
|
1320
1320
|
const I = l.value;
|
|
1321
|
-
C && (C(), C = null), I && (
|
|
1321
|
+
C && (C(), C = null), I && (_ && !n.hasGlobalConversationSubscription(I) && xi(I), n.unregisterDetailSubscription(I), l.value = null), o.value = !1;
|
|
1322
1322
|
}
|
|
1323
1323
|
function F() {
|
|
1324
|
-
const
|
|
1325
|
-
if (!(o.value || !
|
|
1326
|
-
if (!
|
|
1324
|
+
const _ = T();
|
|
1325
|
+
if (!(o.value || !_)) {
|
|
1326
|
+
if (!Ae()) {
|
|
1327
1327
|
f();
|
|
1328
1328
|
return;
|
|
1329
1329
|
}
|
|
1330
1330
|
c.value = null;
|
|
1331
1331
|
try {
|
|
1332
|
-
C = Mi(
|
|
1332
|
+
C = Mi(_, {
|
|
1333
1333
|
onMessageSent: m,
|
|
1334
1334
|
onMessageRead: v,
|
|
1335
1335
|
onMessageEdited: N,
|
|
@@ -1337,7 +1337,7 @@ function Ya(e) {
|
|
|
1337
1337
|
onReactionToggled: G,
|
|
1338
1338
|
onRequestAccepted: k,
|
|
1339
1339
|
onParticipantRemoved: O
|
|
1340
|
-
}), o.value = !0, l.value =
|
|
1340
|
+
}), o.value = !0, l.value = _, n.registerDetailSubscription(_), w();
|
|
1341
1341
|
} catch (I) {
|
|
1342
1342
|
c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
|
|
1343
1343
|
}
|
|
@@ -1347,26 +1347,26 @@ function Ya(e) {
|
|
|
1347
1347
|
o.value || F();
|
|
1348
1348
|
}
|
|
1349
1349
|
typeof window < "u" && window.addEventListener(We(), J);
|
|
1350
|
-
const me = ht((
|
|
1351
|
-
if (
|
|
1350
|
+
const me = ht((_) => {
|
|
1351
|
+
if (_ === "connected") {
|
|
1352
1352
|
o.value || F();
|
|
1353
1353
|
return;
|
|
1354
1354
|
}
|
|
1355
|
-
(
|
|
1355
|
+
(_ === "disconnected" || _ === "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;
|
|
1361
|
-
} catch (
|
|
1362
|
-
c.value =
|
|
1361
|
+
} catch (_) {
|
|
1362
|
+
c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1363
1363
|
}
|
|
1364
1364
|
}
|
|
1365
1365
|
return Ot(
|
|
1366
1366
|
() => T(),
|
|
1367
|
-
(
|
|
1368
|
-
if (
|
|
1369
|
-
if (w(), o.value && H(!0), !
|
|
1367
|
+
(_, I) => {
|
|
1368
|
+
if (_ !== I) {
|
|
1369
|
+
if (w(), o.value && H(!0), !_) {
|
|
1370
1370
|
c.value = null;
|
|
1371
1371
|
return;
|
|
1372
1372
|
}
|
|
@@ -1374,22 +1374,22 @@ 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
|
-
const
|
|
1386
|
-
},
|
|
1385
|
+
const ds = () => () => {
|
|
1386
|
+
}, hs = async () => {
|
|
1387
1387
|
}, be = {
|
|
1388
1388
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1389
1389
|
getEcho: () => null,
|
|
1390
1390
|
getConnectionStatus: () => "disconnected",
|
|
1391
|
-
onConnectionStatusChange:
|
|
1392
|
-
reconnect:
|
|
1391
|
+
onConnectionStatusChange: ds,
|
|
1392
|
+
reconnect: hs
|
|
1393
1393
|
};
|
|
1394
1394
|
function bo() {
|
|
1395
1395
|
return be.initializedEvent;
|
|
@@ -1410,7 +1410,7 @@ function wo(e) {
|
|
|
1410
1410
|
e.initializedEvent && (be.initializedEvent = e.initializedEvent), e.getEcho && (be.getEcho = e.getEcho), e.getConnectionStatus && (be.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (be.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (be.reconnect = e.reconnect);
|
|
1411
1411
|
}
|
|
1412
1412
|
function To() {
|
|
1413
|
-
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange =
|
|
1413
|
+
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange = ds, be.reconnect = hs;
|
|
1414
1414
|
}
|
|
1415
1415
|
const Eo = {
|
|
1416
1416
|
debug: () => {
|
|
@@ -1421,8 +1421,8 @@ const Eo = {
|
|
|
1421
1421
|
},
|
|
1422
1422
|
error: () => {
|
|
1423
1423
|
}
|
|
1424
|
-
},
|
|
1425
|
-
let Jt =
|
|
1424
|
+
}, fs = () => Eo;
|
|
1425
|
+
let Jt = fs;
|
|
1426
1426
|
function Kt() {
|
|
1427
1427
|
return Jt;
|
|
1428
1428
|
}
|
|
@@ -1430,7 +1430,7 @@ function Ao(e) {
|
|
|
1430
1430
|
Jt = e;
|
|
1431
1431
|
}
|
|
1432
1432
|
function Ro() {
|
|
1433
|
-
Jt =
|
|
1433
|
+
Jt = fs;
|
|
1434
1434
|
}
|
|
1435
1435
|
const Po = {
|
|
1436
1436
|
connected: "",
|
|
@@ -1445,10 +1445,10 @@ function zn(e) {
|
|
|
1445
1445
|
function Mo(e) {
|
|
1446
1446
|
return e === "messenger" ? {
|
|
1447
1447
|
initializedEvent: We(),
|
|
1448
|
-
getConnectionStatus:
|
|
1448
|
+
getConnectionStatus: rs,
|
|
1449
1449
|
onConnectionStatusChange: ht,
|
|
1450
1450
|
reconnect: Ai,
|
|
1451
|
-
getEchoConnection: () => zn(
|
|
1451
|
+
getEchoConnection: () => zn(Ae())
|
|
1452
1452
|
} : {
|
|
1453
1453
|
initializedEvent: bo(),
|
|
1454
1454
|
getConnectionStatus: _o,
|
|
@@ -1464,7 +1464,7 @@ function Za(e = {}) {
|
|
|
1464
1464
|
const o = Mo(e.source ?? "app"), c = {
|
|
1465
1465
|
...Po,
|
|
1466
1466
|
...e.icons
|
|
1467
|
-
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1),
|
|
1467
|
+
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), y = ve(!1);
|
|
1468
1468
|
let C = null, b = null, T = null, w = null, f = null, m = null, v = 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) {
|
|
@@ -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 = !
|
|
1509
|
+
}, te = (E, V = l.value) => {
|
|
1510
|
+
if (E !== "connecting" && b && (clearTimeout(b), b = null), E === "disconnected" || E === "error") {
|
|
1511
|
+
const ne = !y.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,11 +1518,11 @@ 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;
|
|
@@ -1532,76 +1532,76 @@ function Za(e = {}) {
|
|
|
1532
1532
|
b = setTimeout(() => {
|
|
1533
1533
|
if (b = null, l.value === "connecting") {
|
|
1534
1534
|
if (jn(o) === "connected") {
|
|
1535
|
-
|
|
1535
|
+
_("connected");
|
|
1536
1536
|
return;
|
|
1537
1537
|
}
|
|
1538
|
-
x.value = !0, qn.warn("Still connecting after 10s, treating as disconnected"),
|
|
1538
|
+
x.value = !0, qn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), g.value += 1, o.reconnect();
|
|
1539
1539
|
}
|
|
1540
1540
|
}, 1e4);
|
|
1541
1541
|
}
|
|
1542
|
-
},
|
|
1542
|
+
}, _ = (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 (
|
|
1552
|
-
|
|
1550
|
+
const E = jn(o), V = l.value;
|
|
1551
|
+
if (E === "connected" && V !== "connected") {
|
|
1552
|
+
_("connected");
|
|
1553
1553
|
return;
|
|
1554
1554
|
}
|
|
1555
|
-
if (
|
|
1556
|
-
|
|
1555
|
+
if (E === "connecting" && V !== "connecting") {
|
|
1556
|
+
_("connecting");
|
|
1557
1557
|
return;
|
|
1558
1558
|
}
|
|
1559
|
-
if ((
|
|
1560
|
-
|
|
1559
|
+
if ((E === "unavailable" || E === "failed" || E === "disconnected") && V !== "disconnected") {
|
|
1560
|
+
_("disconnected");
|
|
1561
1561
|
return;
|
|
1562
1562
|
}
|
|
1563
1563
|
const ne = o.getConnectionStatus();
|
|
1564
|
-
!
|
|
1564
|
+
!E && ne === "connected" && V !== "connected" && _("connected");
|
|
1565
1565
|
}, ae = () => {
|
|
1566
1566
|
if (f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = o.getEchoConnection(), v = null, !f?.bind)
|
|
1567
1567
|
return;
|
|
1568
1568
|
v = {
|
|
1569
|
-
connected: () =>
|
|
1570
|
-
connecting: () =>
|
|
1571
|
-
disconnected: () =>
|
|
1572
|
-
unavailable: () =>
|
|
1573
|
-
error: () =>
|
|
1569
|
+
connected: () => _("connected"),
|
|
1570
|
+
connecting: () => _("connecting"),
|
|
1571
|
+
disconnected: () => _("disconnected"),
|
|
1572
|
+
unavailable: () => _("disconnected"),
|
|
1573
|
+
error: () => _("error"),
|
|
1574
1574
|
stateChange: (V) => {
|
|
1575
1575
|
const ne = V?.current;
|
|
1576
1576
|
if (ne === "connected") {
|
|
1577
|
-
|
|
1577
|
+
_("connected");
|
|
1578
1578
|
return;
|
|
1579
1579
|
}
|
|
1580
1580
|
if (ne === "connecting") {
|
|
1581
|
-
|
|
1581
|
+
_("connecting");
|
|
1582
1582
|
return;
|
|
1583
1583
|
}
|
|
1584
|
-
(ne === "unavailable" || ne === "failed" || ne === "disconnected") &&
|
|
1584
|
+
(ne === "unavailable" || ne === "failed" || ne === "disconnected") && _("disconnected");
|
|
1585
1585
|
}
|
|
1586
1586
|
}, f.bind("connected", v.connected), f.bind("connecting", v.connecting), f.bind("disconnected", v.disconnected), f.bind("unavailable", v.unavailable), f.bind("error", v.error), f.bind("state_change", v.stateChange);
|
|
1587
|
-
const
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1587
|
+
const E = f.state ?? null;
|
|
1588
|
+
if (E === "connected") {
|
|
1589
|
+
_("connected");
|
|
1590
1590
|
return;
|
|
1591
1591
|
}
|
|
1592
|
-
if (
|
|
1593
|
-
|
|
1592
|
+
if (E === "connecting") {
|
|
1593
|
+
_("connecting");
|
|
1594
1594
|
return;
|
|
1595
1595
|
}
|
|
1596
|
-
(
|
|
1596
|
+
(E === "unavailable" || E === "failed" || E === "disconnected") && _("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(
|
|
1604
|
+
l.value = o.getConnectionStatus(), C = o.onConnectionStatusChange(_), N.value && (d.value = /* @__PURE__ */ new Date()), te(l.value, l.value), y.value = !0, ae(), m = () => {
|
|
1605
1605
|
ae(), I();
|
|
1606
1606
|
}, window.addEventListener(o.initializedEvent, m), I(), w = setInterval(() => {
|
|
1607
1607
|
I();
|
|
@@ -1625,16 +1625,16 @@ function Za(e = {}) {
|
|
|
1625
1625
|
reconnect: me
|
|
1626
1626
|
};
|
|
1627
1627
|
}
|
|
1628
|
-
const
|
|
1629
|
-
let Qt =
|
|
1630
|
-
function
|
|
1628
|
+
const ps = $t;
|
|
1629
|
+
let Qt = ps;
|
|
1630
|
+
function gs() {
|
|
1631
1631
|
return Qt;
|
|
1632
1632
|
}
|
|
1633
1633
|
function xo(e) {
|
|
1634
1634
|
Qt = e;
|
|
1635
1635
|
}
|
|
1636
1636
|
function ko() {
|
|
1637
|
-
Qt =
|
|
1637
|
+
Qt = ps;
|
|
1638
1638
|
}
|
|
1639
1639
|
const Lo = 6e4;
|
|
1640
1640
|
function Io(e) {
|
|
@@ -1646,14 +1646,14 @@ function Uo(e) {
|
|
|
1646
1646
|
const n = e.trim().toLowerCase();
|
|
1647
1647
|
return Io(n) ? n : null;
|
|
1648
1648
|
}
|
|
1649
|
-
function
|
|
1649
|
+
function ms(e) {
|
|
1650
1650
|
if (typeof e != "string")
|
|
1651
1651
|
return null;
|
|
1652
1652
|
const n = e.trim();
|
|
1653
1653
|
return n.length > 0 ? n : null;
|
|
1654
1654
|
}
|
|
1655
1655
|
function qt(e) {
|
|
1656
|
-
const n =
|
|
1656
|
+
const n = ms(e);
|
|
1657
1657
|
if (n === null)
|
|
1658
1658
|
return null;
|
|
1659
1659
|
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, c = new Date(o);
|
|
@@ -1671,15 +1671,15 @@ function Oo(e, n, i = {}) {
|
|
|
1671
1671
|
return c - o.getTime() > l ? "offline" : e;
|
|
1672
1672
|
}
|
|
1673
1673
|
function $n(e, n = {}) {
|
|
1674
|
-
const i =
|
|
1674
|
+
const i = ms(e?.last_seen_at), o = Uo(e?.status);
|
|
1675
1675
|
return {
|
|
1676
1676
|
status: Oo(o, i, n),
|
|
1677
1677
|
lastSeenAt: i
|
|
1678
1678
|
};
|
|
1679
1679
|
}
|
|
1680
|
-
const
|
|
1680
|
+
const vs = () => {
|
|
1681
1681
|
};
|
|
1682
|
-
let Yt =
|
|
1682
|
+
let Yt = vs;
|
|
1683
1683
|
function Fo() {
|
|
1684
1684
|
return Yt;
|
|
1685
1685
|
}
|
|
@@ -1687,11 +1687,11 @@ function No(e) {
|
|
|
1687
1687
|
Yt = e;
|
|
1688
1688
|
}
|
|
1689
1689
|
function Do() {
|
|
1690
|
-
Yt =
|
|
1690
|
+
Yt = vs;
|
|
1691
1691
|
}
|
|
1692
|
-
const
|
|
1692
|
+
const Me = Kt()("GlobalMessaging"), qo = 3, zo = (e) => e.replace(/\/+$/, ""), jo = (e) => zo(window.location.pathname) === `/messages/${e}`, $o = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1693
1693
|
function ec() {
|
|
1694
|
-
const e = Gt(), n = Fe()(), i = Fo(), o =
|
|
1694
|
+
const e = Gt(), n = Fe()(), i = Fo(), o = gs(), c = Ti(), l = zt(), { conversations: d } = Ci(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
|
|
1695
1695
|
let x = !1;
|
|
1696
1696
|
function M(k) {
|
|
1697
1697
|
const O = h.get(k);
|
|
@@ -1702,100 +1702,100 @@ function ec() {
|
|
|
1702
1702
|
} catch {
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
|
-
function
|
|
1705
|
+
function y() {
|
|
1706
1706
|
for (const k of g)
|
|
1707
1707
|
M(k), e.unregisterGlobalConversationSubscription(k);
|
|
1708
1708
|
g.clear();
|
|
1709
1709
|
}
|
|
1710
1710
|
function C(k) {
|
|
1711
|
-
const O =
|
|
1711
|
+
const O = Ae();
|
|
1712
1712
|
if (!O || g.has(k)) return;
|
|
1713
1713
|
const H = `conversation.${k}`;
|
|
1714
1714
|
M(k);
|
|
1715
1715
|
const F = O.private(H), J = (B) => {
|
|
1716
1716
|
if (!Oi(B)) {
|
|
1717
|
-
|
|
1717
|
+
Me.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)) {
|
|
1737
|
-
|
|
1737
|
+
Me.warn("Dropping malformed ConversationMessageRead event", B);
|
|
1738
1738
|
return;
|
|
1739
1739
|
}
|
|
1740
1740
|
e.applyParticipantReadState(B);
|
|
1741
|
-
},
|
|
1741
|
+
}, te = (B) => {
|
|
1742
1742
|
if (!qi(B)) {
|
|
1743
|
-
|
|
1743
|
+
Me.warn("Dropping malformed MessageReactionToggled event", B);
|
|
1744
1744
|
return;
|
|
1745
1745
|
}
|
|
1746
|
-
const
|
|
1747
|
-
e.updateMessageReactions(
|
|
1748
|
-
},
|
|
1746
|
+
const E = B;
|
|
1747
|
+
e.updateMessageReactions(E.conversation_id, E.message_id, E.reactions);
|
|
1748
|
+
}, _ = (B) => {
|
|
1749
1749
|
if (!Ni(B)) {
|
|
1750
|
-
|
|
1750
|
+
Me.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
|
+
Me.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
|
+
Me.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",
|
|
1783
|
+
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited", _), 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
|
-
{ event: ".ConversationMessageEdited", handler:
|
|
1788
|
+
{ event: ".ConversationMessageEdited", handler: _ },
|
|
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
1795
|
function b() {
|
|
1796
|
-
const k =
|
|
1796
|
+
const k = Ae();
|
|
1797
1797
|
if (!k) {
|
|
1798
|
-
|
|
1798
|
+
y();
|
|
1799
1799
|
return;
|
|
1800
1800
|
}
|
|
1801
1801
|
for (const O of g) {
|
|
@@ -1809,7 +1809,7 @@ function ec() {
|
|
|
1809
1809
|
g.clear();
|
|
1810
1810
|
}
|
|
1811
1811
|
function T() {
|
|
1812
|
-
const k =
|
|
1812
|
+
const k = Ae();
|
|
1813
1813
|
if (!k) return;
|
|
1814
1814
|
const O = e.conversations.slice(0, qo), H = new Set(O.map((F) => F.id));
|
|
1815
1815
|
for (const F of g)
|
|
@@ -1848,11 +1848,11 @@ function ec() {
|
|
|
1848
1848
|
J.status !== null && e.updatePresenceForUser(F.id, J.status, J.lastSeenAt);
|
|
1849
1849
|
}
|
|
1850
1850
|
} catch (O) {
|
|
1851
|
-
|
|
1851
|
+
Me.warn("Failed to refresh messaging presence snapshot", O);
|
|
1852
1852
|
}
|
|
1853
1853
|
}
|
|
1854
1854
|
function m() {
|
|
1855
|
-
!
|
|
1855
|
+
!Ae() || x || (Ri(w), x = !0);
|
|
1856
1856
|
}
|
|
1857
1857
|
function v() {
|
|
1858
1858
|
x && (Pi(), x = !1);
|
|
@@ -1869,9 +1869,13 @@ function ec() {
|
|
|
1869
1869
|
T();
|
|
1870
1870
|
}
|
|
1871
1871
|
), G = ht((k) => {
|
|
1872
|
-
k === "connected" ? (
|
|
1872
|
+
k === "connected" ? (y(), T(), v(), m(), f()) : (k === "disconnected" || k === "error") && (y(), v());
|
|
1873
1873
|
});
|
|
1874
|
-
T(), m(), f(),
|
|
1874
|
+
T(), m(), f(), Ae() || ss().then((k) => {
|
|
1875
|
+
k && (y(), T(), v(), m(), f());
|
|
1876
|
+
}).catch((k) => {
|
|
1877
|
+
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
1878
|
+
}), l !== null && De(() => {
|
|
1875
1879
|
N(), q(), G(), b(), v();
|
|
1876
1880
|
});
|
|
1877
1881
|
}
|
|
@@ -1890,7 +1894,7 @@ function tc() {
|
|
|
1890
1894
|
isSuspended: ie(() => e.value === "account_suspended")
|
|
1891
1895
|
};
|
|
1892
1896
|
}
|
|
1893
|
-
const
|
|
1897
|
+
const bs = () => null, ys = {
|
|
1894
1898
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
1895
1899
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
1896
1900
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -1901,9 +1905,9 @@ const vs = () => null, bs = {
|
|
|
1901
1905
|
activityDebounceMs: 5e3,
|
|
1902
1906
|
heartbeatIntervalMs: 3e4,
|
|
1903
1907
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
1904
|
-
authTokenResolver:
|
|
1908
|
+
authTokenResolver: bs
|
|
1905
1909
|
};
|
|
1906
|
-
let lt = { ...
|
|
1910
|
+
let lt = { ...ys };
|
|
1907
1911
|
function Ho() {
|
|
1908
1912
|
return lt;
|
|
1909
1913
|
}
|
|
@@ -1914,16 +1918,16 @@ function Bo(e) {
|
|
|
1914
1918
|
};
|
|
1915
1919
|
}
|
|
1916
1920
|
function Vo() {
|
|
1917
|
-
lt = { ...
|
|
1921
|
+
lt = { ...ys };
|
|
1918
1922
|
}
|
|
1919
1923
|
function Xo(e) {
|
|
1920
|
-
return e.authTokenResolver !==
|
|
1924
|
+
return e.authTokenResolver !== bs;
|
|
1921
1925
|
}
|
|
1922
1926
|
const Wo = 429, Go = 403, Jo = 423, Ko = "ACCOUNT_LIMITED", Qo = "ACCOUNT_SUSPENDED", Yo = "ACCOUNT_WRITE_TIMEOUT", Zo = 2, ea = 5 * 6e4;
|
|
1923
1927
|
function Xe(e) {
|
|
1924
1928
|
return typeof e == "object" && e !== null;
|
|
1925
1929
|
}
|
|
1926
|
-
function
|
|
1930
|
+
function _s(e) {
|
|
1927
1931
|
if (!Xe(e))
|
|
1928
1932
|
return null;
|
|
1929
1933
|
const n = e.response;
|
|
@@ -1938,7 +1942,7 @@ function ys(e) {
|
|
|
1938
1942
|
}
|
|
1939
1943
|
return null;
|
|
1940
1944
|
}
|
|
1941
|
-
function
|
|
1945
|
+
function Ss(e) {
|
|
1942
1946
|
if (!Xe(e))
|
|
1943
1947
|
return null;
|
|
1944
1948
|
const n = e.response;
|
|
@@ -1948,11 +1952,11 @@ function _s(e) {
|
|
|
1948
1952
|
return Xe(i) && typeof i.code == "string" ? i.code : null;
|
|
1949
1953
|
}
|
|
1950
1954
|
function kt(e) {
|
|
1951
|
-
const n =
|
|
1955
|
+
const n = _s(e), i = Ss(e);
|
|
1952
1956
|
return n === Wo && i === Ko || n === Jo && i === Yo;
|
|
1953
1957
|
}
|
|
1954
1958
|
function Lt(e) {
|
|
1955
|
-
const n =
|
|
1959
|
+
const n = _s(e), i = Ss(e);
|
|
1956
1960
|
return n === Go && i === Qo ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
1957
1961
|
}
|
|
1958
1962
|
function Ge() {
|
|
@@ -2007,8 +2011,8 @@ function oa(e, n, i) {
|
|
|
2007
2011
|
}
|
|
2008
2012
|
}
|
|
2009
2013
|
function nc() {
|
|
2010
|
-
const e = Fe()(), n = Ho(), i =
|
|
2011
|
-
let c = null, l = null, d = !1, g = It(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null,
|
|
2014
|
+
const e = Fe()(), n = Ho(), i = gs(), o = ta(n.clientIdStorageKey);
|
|
2015
|
+
let c = null, l = null, d = !1, g = It(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null, y = 0;
|
|
2012
2016
|
const C = () => Xo(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2013
2017
|
c && (clearInterval(c), c = null);
|
|
2014
2018
|
}, T = () => {
|
|
@@ -2038,7 +2042,7 @@ function nc() {
|
|
|
2038
2042
|
if (x || !d || g || h || document.visibilityState !== "visible")
|
|
2039
2043
|
return;
|
|
2040
2044
|
const I = Date.now();
|
|
2041
|
-
I -
|
|
2045
|
+
I - y < n.activityDebounceMs || (y = I, m("online"), v());
|
|
2042
2046
|
}, q = () => {
|
|
2043
2047
|
N();
|
|
2044
2048
|
}, G = () => {
|
|
@@ -2096,7 +2100,7 @@ function nc() {
|
|
|
2096
2100
|
}
|
|
2097
2101
|
d && (w(), m("online"), v());
|
|
2098
2102
|
}
|
|
2099
|
-
},
|
|
2103
|
+
}, te = () => {
|
|
2100
2104
|
if (!x) {
|
|
2101
2105
|
if (document.visibilityState === "hidden") {
|
|
2102
2106
|
J(), b(), T();
|
|
@@ -2108,7 +2112,7 @@ function nc() {
|
|
|
2108
2112
|
}
|
|
2109
2113
|
document.visibilityState === "visible" && d && !g && !h && N();
|
|
2110
2114
|
}
|
|
2111
|
-
},
|
|
2115
|
+
}, _ = () => {
|
|
2112
2116
|
x || (J(), b(), T());
|
|
2113
2117
|
};
|
|
2114
2118
|
jt(async () => {
|
|
@@ -2117,109 +2121,109 @@ function nc() {
|
|
|
2117
2121
|
J();
|
|
2118
2122
|
return;
|
|
2119
2123
|
}
|
|
2120
|
-
d && (w(), m("online"), v()), G(), document.addEventListener("visibilitychange",
|
|
2124
|
+
d && (w(), m("online"), v()), G(), document.addEventListener("visibilitychange", te), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2121
2125
|
}
|
|
2122
2126
|
}), De(() => {
|
|
2123
|
-
x = !0, k(), T(), b(), J(), document.removeEventListener("visibilitychange",
|
|
2127
|
+
x = !0, k(), T(), b(), J(), document.removeEventListener("visibilitychange", te), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2124
2128
|
});
|
|
2125
2129
|
}
|
|
2126
2130
|
const aa = 12e3;
|
|
2127
2131
|
function sc(e) {
|
|
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,
|
|
2132
|
+
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, y = 250;
|
|
2129
2133
|
let C = !1, b = null, T = 0, w = null;
|
|
2130
2134
|
const f = ie(() => i.currentUser?.id), m = () => Xn(e)?.trim() ?? "", v = () => {
|
|
2131
|
-
const
|
|
2132
|
-
if (
|
|
2133
|
-
return
|
|
2135
|
+
const A = l.value?.trim() ?? "";
|
|
2136
|
+
if (A.length > 0)
|
|
2137
|
+
return A;
|
|
2134
2138
|
const U = m();
|
|
2135
2139
|
return U.length > 0 && (l.value = U), U;
|
|
2136
|
-
}, N = (
|
|
2137
|
-
const U = N(
|
|
2140
|
+
}, N = (A) => n.getTypingUsers(A), q = (A) => {
|
|
2141
|
+
const U = N(A);
|
|
2138
2142
|
for (const re of U)
|
|
2139
|
-
n.removeTypingUser(
|
|
2143
|
+
n.removeTypingUser(A, re.id);
|
|
2140
2144
|
d.value = [];
|
|
2141
|
-
}, G = (
|
|
2142
|
-
const U = g.get(
|
|
2143
|
-
U && (clearTimeout(U), g.delete(
|
|
2145
|
+
}, G = (A) => {
|
|
2146
|
+
const U = g.get(A);
|
|
2147
|
+
U && (clearTimeout(U), g.delete(A));
|
|
2144
2148
|
}, k = () => {
|
|
2145
|
-
for (const
|
|
2146
|
-
clearTimeout(
|
|
2149
|
+
for (const A of g.values())
|
|
2150
|
+
clearTimeout(A);
|
|
2147
2151
|
g.clear();
|
|
2148
2152
|
}, O = () => {
|
|
2149
2153
|
w && (clearTimeout(w), w = null), T = 0;
|
|
2150
2154
|
}, H = () => {
|
|
2151
2155
|
!x || o.value || w || T >= M || (w = setTimeout(() => {
|
|
2152
|
-
w = null, T += 1,
|
|
2153
|
-
},
|
|
2154
|
-
}, F = (
|
|
2155
|
-
G(
|
|
2156
|
+
w = null, T += 1, te();
|
|
2157
|
+
}, y));
|
|
2158
|
+
}, F = (A, U) => {
|
|
2159
|
+
G(A);
|
|
2156
2160
|
const re = setTimeout(() => {
|
|
2157
|
-
g.delete(
|
|
2161
|
+
g.delete(A), n.removeTypingUser(U, A), d.value = d.value.filter((fe) => fe.id !== A);
|
|
2158
2162
|
}, aa);
|
|
2159
|
-
g.set(
|
|
2163
|
+
g.set(A, re);
|
|
2160
2164
|
}, J = () => {
|
|
2161
2165
|
C = !0, O();
|
|
2162
|
-
}, me = (
|
|
2166
|
+
}, me = (A) => {
|
|
2163
2167
|
try {
|
|
2164
|
-
b && (b(), b = null), b = ki(
|
|
2168
|
+
b && (b(), b = null), b = ki(A, {
|
|
2165
2169
|
onTypingStart: I,
|
|
2166
2170
|
onTypingStop: ae
|
|
2167
|
-
}), O(), o.value = !0, l.value =
|
|
2171
|
+
}), O(), o.value = !0, l.value = A;
|
|
2168
2172
|
} catch (U) {
|
|
2169
2173
|
c.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
|
|
2170
2174
|
}
|
|
2171
|
-
},
|
|
2172
|
-
const
|
|
2173
|
-
if (!(o.value || !
|
|
2174
|
-
if (c.value = null,
|
|
2175
|
-
me(
|
|
2175
|
+
}, te = () => {
|
|
2176
|
+
const A = m();
|
|
2177
|
+
if (!(o.value || !A)) {
|
|
2178
|
+
if (c.value = null, Ae() && Tn() === "connected") {
|
|
2179
|
+
me(A);
|
|
2176
2180
|
return;
|
|
2177
2181
|
}
|
|
2178
|
-
C = !1,
|
|
2182
|
+
C = !1, ss().then((U) => {
|
|
2179
2183
|
if (C || o.value || !U)
|
|
2180
2184
|
return;
|
|
2181
2185
|
const re = m();
|
|
2182
|
-
if (re && re ===
|
|
2186
|
+
if (re && re === A && Ae() && Tn() === "connected") {
|
|
2183
2187
|
me(re);
|
|
2184
2188
|
return;
|
|
2185
2189
|
}
|
|
2186
2190
|
H();
|
|
2187
2191
|
}), H();
|
|
2188
2192
|
}
|
|
2189
|
-
},
|
|
2190
|
-
const
|
|
2191
|
-
if (J(), !(!o.value || !
|
|
2193
|
+
}, _ = () => {
|
|
2194
|
+
const A = l.value;
|
|
2195
|
+
if (J(), !(!o.value || !A))
|
|
2192
2196
|
try {
|
|
2193
|
-
b && (b(), b = null), Li(
|
|
2197
|
+
b && (b(), b = null), Li(A), k(), q(A), o.value = !1, l.value = null, c.value = null;
|
|
2194
2198
|
} catch (U) {
|
|
2195
2199
|
c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2196
2200
|
}
|
|
2197
2201
|
};
|
|
2198
|
-
function I(
|
|
2199
|
-
if (
|
|
2202
|
+
function I(A) {
|
|
2203
|
+
if (A.user_id === f.value)
|
|
2200
2204
|
return;
|
|
2201
2205
|
const U = v();
|
|
2202
2206
|
if (!U)
|
|
2203
2207
|
return;
|
|
2204
2208
|
const re = {
|
|
2205
|
-
id:
|
|
2206
|
-
name:
|
|
2207
|
-
...
|
|
2209
|
+
id: A.user.id,
|
|
2210
|
+
name: A.user.name,
|
|
2211
|
+
...A.user.avatar !== void 0 ? { avatar: A.user.avatar } : {}
|
|
2208
2212
|
};
|
|
2209
|
-
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(U, re), F(
|
|
2213
|
+
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(U, re), F(A.user_id, U);
|
|
2210
2214
|
}
|
|
2211
|
-
function ae(
|
|
2212
|
-
if (
|
|
2215
|
+
function ae(A) {
|
|
2216
|
+
if (A.user_id === f.value)
|
|
2213
2217
|
return;
|
|
2214
|
-
G(
|
|
2218
|
+
G(A.user_id);
|
|
2215
2219
|
const U = v();
|
|
2216
|
-
U && (d.value = d.value.filter((re) => re.id !==
|
|
2220
|
+
U && (d.value = d.value.filter((re) => re.id !== A.user_id), n.removeTypingUser(U, A.user_id));
|
|
2217
2221
|
}
|
|
2218
2222
|
const B = ie(() => {
|
|
2219
|
-
const
|
|
2220
|
-
if (!
|
|
2223
|
+
const A = v();
|
|
2224
|
+
if (!A)
|
|
2221
2225
|
return d.value;
|
|
2222
|
-
const U = N(
|
|
2226
|
+
const U = N(A);
|
|
2223
2227
|
if (d.value.length === 0)
|
|
2224
2228
|
return U;
|
|
2225
2229
|
if (U.length === 0)
|
|
@@ -2230,47 +2234,47 @@ function sc(e) {
|
|
|
2230
2234
|
for (const fe of d.value)
|
|
2231
2235
|
re.set(fe.id, fe);
|
|
2232
2236
|
return [...re.values()];
|
|
2233
|
-
}),
|
|
2234
|
-
const
|
|
2235
|
-
if (
|
|
2237
|
+
}), E = ie(() => {
|
|
2238
|
+
const A = B.value;
|
|
2239
|
+
if (A.length === 0)
|
|
2236
2240
|
return "";
|
|
2237
|
-
const U =
|
|
2241
|
+
const U = A[0];
|
|
2238
2242
|
if (!U)
|
|
2239
2243
|
return "";
|
|
2240
|
-
if (
|
|
2244
|
+
if (A.length === 1)
|
|
2241
2245
|
return `${U.name} is typing...`;
|
|
2242
|
-
const re =
|
|
2246
|
+
const re = A[1];
|
|
2243
2247
|
if (!re)
|
|
2244
|
-
return `${
|
|
2245
|
-
if (
|
|
2248
|
+
return `${A.length} people are typing...`;
|
|
2249
|
+
if (A.length === 2)
|
|
2246
2250
|
return `${U.name} and ${re.name} are typing...`;
|
|
2247
|
-
const fe =
|
|
2248
|
-
return fe ?
|
|
2251
|
+
const fe = A[2];
|
|
2252
|
+
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
2253
|
}), V = ie(() => B.value.length > 0), ne = () => {
|
|
2250
|
-
o.value
|
|
2254
|
+
m() && (b && (b(), b = null), o.value = !1, l.value = null, te());
|
|
2251
2255
|
};
|
|
2252
2256
|
typeof window < "u" && window.addEventListener(We(), ne);
|
|
2253
|
-
const _e = ht((
|
|
2254
|
-
if (
|
|
2255
|
-
o.value ||
|
|
2257
|
+
const _e = ht((A) => {
|
|
2258
|
+
if (A === "connected") {
|
|
2259
|
+
o.value || te();
|
|
2256
2260
|
return;
|
|
2257
2261
|
}
|
|
2258
|
-
if (
|
|
2262
|
+
if (A === "disconnected" || A === "error") {
|
|
2259
2263
|
J(), b && (b(), b = null);
|
|
2260
2264
|
const U = v();
|
|
2261
2265
|
U && q(U), o.value = !1, l.value = null, k();
|
|
2262
2266
|
}
|
|
2263
2267
|
});
|
|
2264
2268
|
return h !== null && De(() => {
|
|
2265
|
-
J(), _e(), k(),
|
|
2269
|
+
J(), _e(), k(), _(), typeof window < "u" && window.removeEventListener(We(), ne);
|
|
2266
2270
|
}), {
|
|
2267
2271
|
isSubscribed: ie(() => o.value),
|
|
2268
2272
|
error: ie(() => c.value),
|
|
2269
2273
|
typingUsers: B,
|
|
2270
|
-
formatTypingIndicator:
|
|
2274
|
+
formatTypingIndicator: E,
|
|
2271
2275
|
hasTypingUsers: V,
|
|
2272
|
-
subscribe:
|
|
2273
|
-
unsubscribe:
|
|
2276
|
+
subscribe: te,
|
|
2277
|
+
unsubscribe: _
|
|
2274
2278
|
};
|
|
2275
2279
|
}
|
|
2276
2280
|
function rc(e) {
|
|
@@ -2308,7 +2312,7 @@ class Zt {
|
|
|
2308
2312
|
return this.stopListening(".client-" + n, i);
|
|
2309
2313
|
}
|
|
2310
2314
|
}
|
|
2311
|
-
class
|
|
2315
|
+
class Cs {
|
|
2312
2316
|
/**
|
|
2313
2317
|
* Create a new class instance.
|
|
2314
2318
|
*/
|
|
@@ -2342,7 +2346,7 @@ class en extends Zt {
|
|
|
2342
2346
|
* Create a new class instance.
|
|
2343
2347
|
*/
|
|
2344
2348
|
constructor(n, i, o) {
|
|
2345
|
-
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2349
|
+
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new Cs(this.options.namespace), this.subscribe();
|
|
2346
2350
|
}
|
|
2347
2351
|
/**
|
|
2348
2352
|
* Subscribe to a Pusher channel.
|
|
@@ -2414,7 +2418,7 @@ class en extends Zt {
|
|
|
2414
2418
|
return this.subscription.bind(n, i), this;
|
|
2415
2419
|
}
|
|
2416
2420
|
}
|
|
2417
|
-
class
|
|
2421
|
+
class ws extends en {
|
|
2418
2422
|
/**
|
|
2419
2423
|
* Send a whisper event to other clients in the channel.
|
|
2420
2424
|
*/
|
|
@@ -2436,7 +2440,7 @@ class ua extends en {
|
|
|
2436
2440
|
), this;
|
|
2437
2441
|
}
|
|
2438
2442
|
}
|
|
2439
|
-
class la extends
|
|
2443
|
+
class la extends ws {
|
|
2440
2444
|
/**
|
|
2441
2445
|
* Register a callback to be called anytime the member list changes.
|
|
2442
2446
|
*/
|
|
@@ -2471,12 +2475,12 @@ class la extends Cs {
|
|
|
2471
2475
|
}), this;
|
|
2472
2476
|
}
|
|
2473
2477
|
}
|
|
2474
|
-
class
|
|
2478
|
+
class Ts extends Zt {
|
|
2475
2479
|
/**
|
|
2476
2480
|
* Create a new class instance.
|
|
2477
2481
|
*/
|
|
2478
2482
|
constructor(n, i, o) {
|
|
2479
|
-
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2483
|
+
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new Cs(this.options.namespace), this.subscribe();
|
|
2480
2484
|
}
|
|
2481
2485
|
/**
|
|
2482
2486
|
* Subscribe to a Socket.io channel.
|
|
@@ -2547,7 +2551,7 @@ class ws extends Zt {
|
|
|
2547
2551
|
)), (!i || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2548
2552
|
}
|
|
2549
2553
|
}
|
|
2550
|
-
class
|
|
2554
|
+
class Es extends Ts {
|
|
2551
2555
|
/**
|
|
2552
2556
|
* Send a whisper event to other clients in the channel.
|
|
2553
2557
|
*/
|
|
@@ -2559,7 +2563,7 @@ class Ts extends ws {
|
|
|
2559
2563
|
}), this;
|
|
2560
2564
|
}
|
|
2561
2565
|
}
|
|
2562
|
-
class da extends
|
|
2566
|
+
class da extends Es {
|
|
2563
2567
|
/**
|
|
2564
2568
|
* Register a callback to be called anytime the member list changes.
|
|
2565
2569
|
*/
|
|
@@ -2645,7 +2649,7 @@ class dt extends Zt {
|
|
|
2645
2649
|
return this;
|
|
2646
2650
|
}
|
|
2647
2651
|
}
|
|
2648
|
-
class
|
|
2652
|
+
class As extends dt {
|
|
2649
2653
|
/**
|
|
2650
2654
|
* Send a whisper event to other clients in the channel.
|
|
2651
2655
|
*/
|
|
@@ -2661,7 +2665,7 @@ class ha extends dt {
|
|
|
2661
2665
|
return this;
|
|
2662
2666
|
}
|
|
2663
2667
|
}
|
|
2664
|
-
class fa extends
|
|
2668
|
+
class fa extends As {
|
|
2665
2669
|
/**
|
|
2666
2670
|
* Register a callback to be called anytime the member list changes.
|
|
2667
2671
|
*/
|
|
@@ -2687,7 +2691,7 @@ class fa extends Es {
|
|
|
2687
2691
|
return this;
|
|
2688
2692
|
}
|
|
2689
2693
|
}
|
|
2690
|
-
const
|
|
2694
|
+
const Rs = class Ps {
|
|
2691
2695
|
/**
|
|
2692
2696
|
* Create a new class instance.
|
|
2693
2697
|
*/
|
|
@@ -2699,7 +2703,7 @@ const As = class Rs {
|
|
|
2699
2703
|
*/
|
|
2700
2704
|
setOptions(n) {
|
|
2701
2705
|
this.options = {
|
|
2702
|
-
...
|
|
2706
|
+
...Ps._defaultOptions,
|
|
2703
2707
|
...n,
|
|
2704
2708
|
broadcaster: n.broadcaster
|
|
2705
2709
|
};
|
|
@@ -2714,7 +2718,7 @@ const As = class Rs {
|
|
|
2714
2718
|
return typeof window < "u" && (n = window.Laravel) != null && n.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((i = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : i.getAttribute("content")) ?? null : null;
|
|
2715
2719
|
}
|
|
2716
2720
|
};
|
|
2717
|
-
|
|
2721
|
+
Rs._defaultOptions = {
|
|
2718
2722
|
auth: {
|
|
2719
2723
|
headers: {}
|
|
2720
2724
|
},
|
|
@@ -2729,7 +2733,7 @@ As._defaultOptions = {
|
|
|
2729
2733
|
key: null,
|
|
2730
2734
|
namespace: "App.Events"
|
|
2731
2735
|
};
|
|
2732
|
-
let tn =
|
|
2736
|
+
let tn = Rs;
|
|
2733
2737
|
class ot extends tn {
|
|
2734
2738
|
constructor() {
|
|
2735
2739
|
super(...arguments), this.channels = {};
|
|
@@ -2778,7 +2782,7 @@ class ot extends tn {
|
|
|
2778
2782
|
* Get a private channel instance by name.
|
|
2779
2783
|
*/
|
|
2780
2784
|
privateChannel(n) {
|
|
2781
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2785
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new ws(
|
|
2782
2786
|
this.pusher,
|
|
2783
2787
|
"private-" + n,
|
|
2784
2788
|
this.options
|
|
@@ -2907,7 +2911,7 @@ class pa extends tn {
|
|
|
2907
2911
|
* Get a channel instance by name.
|
|
2908
2912
|
*/
|
|
2909
2913
|
channel(n) {
|
|
2910
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2914
|
+
return this.channels[n] || (this.channels[n] = new Ts(
|
|
2911
2915
|
this.socket,
|
|
2912
2916
|
n,
|
|
2913
2917
|
this.options
|
|
@@ -2917,7 +2921,7 @@ class pa extends tn {
|
|
|
2917
2921
|
* Get a private channel instance by name.
|
|
2918
2922
|
*/
|
|
2919
2923
|
privateChannel(n) {
|
|
2920
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2924
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Es(
|
|
2921
2925
|
this.socket,
|
|
2922
2926
|
"private-" + n,
|
|
2923
2927
|
this.options
|
|
@@ -3014,7 +3018,7 @@ class Hn extends tn {
|
|
|
3014
3018
|
* Get a private channel instance by name.
|
|
3015
3019
|
*/
|
|
3016
3020
|
privateChannel(n) {
|
|
3017
|
-
return new
|
|
3021
|
+
return new As();
|
|
3018
3022
|
}
|
|
3019
3023
|
/**
|
|
3020
3024
|
* Get a private encrypted channel instance by name.
|
|
@@ -3356,7 +3360,7 @@ function va() {
|
|
|
3356
3360
|
return h.decode(w);
|
|
3357
3361
|
}
|
|
3358
3362
|
o.decode = M;
|
|
3359
|
-
var
|
|
3363
|
+
var y = (
|
|
3360
3364
|
/** @class */
|
|
3361
3365
|
(function(w) {
|
|
3362
3366
|
l(f, w);
|
|
@@ -3372,8 +3376,8 @@ function va() {
|
|
|
3372
3376
|
}, f;
|
|
3373
3377
|
})(g)
|
|
3374
3378
|
);
|
|
3375
|
-
o.URLSafeCoder =
|
|
3376
|
-
var C = new
|
|
3379
|
+
o.URLSafeCoder = y;
|
|
3380
|
+
var C = new y();
|
|
3377
3381
|
function b(w) {
|
|
3378
3382
|
return C.encode(w);
|
|
3379
3383
|
}
|
|
@@ -3395,34 +3399,34 @@ function va() {
|
|
|
3395
3399
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3396
3400
|
var l = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3397
3401
|
function g(M) {
|
|
3398
|
-
for (var
|
|
3402
|
+
for (var y = new Uint8Array(h(M)), C = 0, b = 0; b < M.length; b++) {
|
|
3399
3403
|
var T = M.charCodeAt(b);
|
|
3400
|
-
T < 128 ?
|
|
3404
|
+
T < 128 ? y[C++] = T : T < 2048 ? (y[C++] = 192 | T >> 6, y[C++] = 128 | T & 63) : T < 55296 ? (y[C++] = 224 | T >> 12, y[C++] = 128 | T >> 6 & 63, y[C++] = 128 | T & 63) : (b++, T = (T & 1023) << 10, T |= M.charCodeAt(b) & 1023, T += 65536, y[C++] = 240 | T >> 18, y[C++] = 128 | T >> 12 & 63, y[C++] = 128 | T >> 6 & 63, y[C++] = 128 | T & 63);
|
|
3401
3405
|
}
|
|
3402
|
-
return
|
|
3406
|
+
return y;
|
|
3403
3407
|
}
|
|
3404
3408
|
o.encode = g;
|
|
3405
3409
|
function h(M) {
|
|
3406
|
-
for (var
|
|
3410
|
+
for (var y = 0, C = 0; C < M.length; C++) {
|
|
3407
3411
|
var b = M.charCodeAt(C);
|
|
3408
3412
|
if (b < 128)
|
|
3409
|
-
|
|
3413
|
+
y += 1;
|
|
3410
3414
|
else if (b < 2048)
|
|
3411
|
-
|
|
3415
|
+
y += 2;
|
|
3412
3416
|
else if (b < 55296)
|
|
3413
|
-
|
|
3417
|
+
y += 3;
|
|
3414
3418
|
else if (b <= 57343) {
|
|
3415
3419
|
if (C >= M.length - 1)
|
|
3416
3420
|
throw new Error(l);
|
|
3417
|
-
C++,
|
|
3421
|
+
C++, y += 4;
|
|
3418
3422
|
} else
|
|
3419
3423
|
throw new Error(l);
|
|
3420
3424
|
}
|
|
3421
|
-
return
|
|
3425
|
+
return y;
|
|
3422
3426
|
}
|
|
3423
3427
|
o.encodedLength = h;
|
|
3424
3428
|
function x(M) {
|
|
3425
|
-
for (var
|
|
3429
|
+
for (var y = [], C = 0; C < M.length; C++) {
|
|
3426
3430
|
var b = M[C];
|
|
3427
3431
|
if (b & 128) {
|
|
3428
3432
|
var T = void 0;
|
|
@@ -3454,12 +3458,12 @@ function va() {
|
|
|
3454
3458
|
if (b >= 65536) {
|
|
3455
3459
|
if (b > 1114111)
|
|
3456
3460
|
throw new Error(d);
|
|
3457
|
-
b -= 65536,
|
|
3461
|
+
b -= 65536, y.push(String.fromCharCode(55296 | b >> 10)), b = 56320 | b & 1023;
|
|
3458
3462
|
}
|
|
3459
3463
|
}
|
|
3460
|
-
|
|
3464
|
+
y.push(String.fromCharCode(b));
|
|
3461
3465
|
}
|
|
3462
|
-
return
|
|
3466
|
+
return y.join("");
|
|
3463
3467
|
}
|
|
3464
3468
|
o.decode = x;
|
|
3465
3469
|
}),
|
|
@@ -3531,8 +3535,8 @@ function va() {
|
|
|
3531
3535
|
delete u.loading[t];
|
|
3532
3536
|
for (var Q = function(ce) {
|
|
3533
3537
|
ce || p.cleanup();
|
|
3534
|
-
},
|
|
3535
|
-
z[
|
|
3538
|
+
}, ee = 0; ee < z.length; ee++)
|
|
3539
|
+
z[ee](L, Q);
|
|
3536
3540
|
}
|
|
3537
3541
|
});
|
|
3538
3542
|
p.send(S);
|
|
@@ -3546,7 +3550,7 @@ function va() {
|
|
|
3546
3550
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3547
3551
|
}
|
|
3548
3552
|
}
|
|
3549
|
-
var M = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"),
|
|
3553
|
+
var M = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), y = new x({
|
|
3550
3554
|
cdn_http: h.cdn_http,
|
|
3551
3555
|
cdn_https: h.cdn_https,
|
|
3552
3556
|
version: h.VERSION,
|
|
@@ -3663,22 +3667,22 @@ function va() {
|
|
|
3663
3667
|
}, p.send(t), p;
|
|
3664
3668
|
};
|
|
3665
3669
|
function me(r) {
|
|
3666
|
-
return
|
|
3670
|
+
return E(ae(r));
|
|
3667
3671
|
}
|
|
3668
|
-
var
|
|
3672
|
+
var te = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(r) {
|
|
3669
3673
|
var t = r.charCodeAt(0);
|
|
3670
|
-
return t < 128 ? r : t < 2048 ?
|
|
3674
|
+
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
3675
|
}, ae = function(r) {
|
|
3672
3676
|
return r.replace(/[^\x00-\x7F]/g, I);
|
|
3673
3677
|
}, B = function(r) {
|
|
3674
3678
|
var t = [0, 2, 1][r.length % 3], s = r.charCodeAt(0) << 16 | (r.length > 1 ? r.charCodeAt(1) : 0) << 8 | (r.length > 2 ? r.charCodeAt(2) : 0), a = [
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
t >= 2 ? "=" :
|
|
3678
|
-
t >= 1 ? "=" :
|
|
3679
|
+
_.charAt(s >>> 18),
|
|
3680
|
+
_.charAt(s >>> 12 & 63),
|
|
3681
|
+
t >= 2 ? "=" : _.charAt(s >>> 6 & 63),
|
|
3682
|
+
t >= 1 ? "=" : _.charAt(s & 63)
|
|
3679
3683
|
];
|
|
3680
3684
|
return a.join("");
|
|
3681
|
-
},
|
|
3685
|
+
}, E = window.btoa || function(r) {
|
|
3682
3686
|
return r.replace(/[\s\S]{1,3}/g, B);
|
|
3683
3687
|
};
|
|
3684
3688
|
class V {
|
|
@@ -3698,7 +3702,7 @@ function va() {
|
|
|
3698
3702
|
function _e(r) {
|
|
3699
3703
|
window.clearTimeout(r);
|
|
3700
3704
|
}
|
|
3701
|
-
function
|
|
3705
|
+
function A(r) {
|
|
3702
3706
|
window.clearInterval(r);
|
|
3703
3707
|
}
|
|
3704
3708
|
class U extends ne {
|
|
@@ -3710,7 +3714,7 @@ function va() {
|
|
|
3710
3714
|
}
|
|
3711
3715
|
class re extends ne {
|
|
3712
3716
|
constructor(t, s) {
|
|
3713
|
-
super(setInterval,
|
|
3717
|
+
super(setInterval, A, t, function(a) {
|
|
3714
3718
|
return s(), a;
|
|
3715
3719
|
});
|
|
3716
3720
|
}
|
|
@@ -3742,7 +3746,7 @@ function va() {
|
|
|
3742
3746
|
typeof arguments[t] == "string" ? r.push(arguments[t]) : r.push(Ye(arguments[t]));
|
|
3743
3747
|
return r.join(" : ");
|
|
3744
3748
|
}
|
|
3745
|
-
function
|
|
3749
|
+
function R(r, t) {
|
|
3746
3750
|
var s = Array.prototype.indexOf;
|
|
3747
3751
|
if (r === null)
|
|
3748
3752
|
return -1;
|
|
@@ -3816,7 +3820,7 @@ function va() {
|
|
|
3816
3820
|
return !1;
|
|
3817
3821
|
return !0;
|
|
3818
3822
|
}
|
|
3819
|
-
function
|
|
3823
|
+
function ke(r) {
|
|
3820
3824
|
return we(r, function(t) {
|
|
3821
3825
|
return typeof t == "object" && (t = Ye(t)), encodeURIComponent(me(t.toString()));
|
|
3822
3826
|
});
|
|
@@ -3824,7 +3828,7 @@ function va() {
|
|
|
3824
3828
|
function K(r) {
|
|
3825
3829
|
var t = Qe(r, function(a) {
|
|
3826
3830
|
return a !== void 0;
|
|
3827
|
-
}), s = ge(ft(
|
|
3831
|
+
}), s = ge(ft(ke(t)), ue.method("join", "=")).join("&");
|
|
3828
3832
|
return s;
|
|
3829
3833
|
}
|
|
3830
3834
|
function qe(r) {
|
|
@@ -3861,7 +3865,7 @@ function va() {
|
|
|
3861
3865
|
return JSON.stringify(qe(r));
|
|
3862
3866
|
}
|
|
3863
3867
|
}
|
|
3864
|
-
class
|
|
3868
|
+
class Ms {
|
|
3865
3869
|
constructor() {
|
|
3866
3870
|
this.globalLog = (t) => {
|
|
3867
3871
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -3887,20 +3891,20 @@ function va() {
|
|
|
3887
3891
|
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
3888
3892
|
}
|
|
3889
3893
|
}
|
|
3890
|
-
var oe = new
|
|
3894
|
+
var oe = new Ms(), xs = function(r, t, s, a, u) {
|
|
3891
3895
|
(s.headers !== void 0 || s.headersProvider != null) && oe.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
3892
3896
|
var p = r.nextAuthCallbackID.toString();
|
|
3893
3897
|
r.nextAuthCallbackID++;
|
|
3894
3898
|
var S = r.getDocument(), L = S.createElement("script");
|
|
3895
|
-
r.auth_callbacks[p] = function(
|
|
3896
|
-
u(null,
|
|
3899
|
+
r.auth_callbacks[p] = function(ee) {
|
|
3900
|
+
u(null, ee);
|
|
3897
3901
|
};
|
|
3898
3902
|
var z = "Pusher.auth_callbacks['" + p + "']";
|
|
3899
3903
|
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
3900
3904
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3901
3905
|
Q.insertBefore(L, Q.firstChild);
|
|
3902
|
-
},
|
|
3903
|
-
class
|
|
3906
|
+
}, ks = xs;
|
|
3907
|
+
class Ls {
|
|
3904
3908
|
constructor(t) {
|
|
3905
3909
|
this.src = t;
|
|
3906
3910
|
}
|
|
@@ -3920,7 +3924,7 @@ function va() {
|
|
|
3920
3924
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
3921
3925
|
}
|
|
3922
3926
|
}
|
|
3923
|
-
class
|
|
3927
|
+
class Is {
|
|
3924
3928
|
constructor(t, s) {
|
|
3925
3929
|
this.url = t, this.data = s;
|
|
3926
3930
|
}
|
|
@@ -3934,17 +3938,17 @@ function va() {
|
|
|
3934
3938
|
this.request && this.request.cleanup();
|
|
3935
3939
|
}
|
|
3936
3940
|
}
|
|
3937
|
-
var
|
|
3941
|
+
var Us = function(r, t) {
|
|
3938
3942
|
return function(s, a) {
|
|
3939
3943
|
var u = "http" + (t ? "s" : "") + "://", p = u + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
3940
3944
|
d.remove(L), S.cleanup(), Q && Q.host && (r.host = Q.host), a && a(z, Q);
|
|
3941
3945
|
});
|
|
3942
3946
|
S.send(L);
|
|
3943
3947
|
};
|
|
3944
|
-
},
|
|
3948
|
+
}, Os = {
|
|
3945
3949
|
name: "jsonp",
|
|
3946
|
-
getAgent:
|
|
3947
|
-
},
|
|
3950
|
+
getAgent: Us
|
|
3951
|
+
}, Fs = Os;
|
|
3948
3952
|
function pt(r, t, s) {
|
|
3949
3953
|
var a = r + (t.useTLS ? "s" : ""), u = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
3950
3954
|
return a + "://" + u + s;
|
|
@@ -3953,17 +3957,17 @@ function va() {
|
|
|
3953
3957
|
var s = "/app/" + r, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
3954
3958
|
return s + a;
|
|
3955
3959
|
}
|
|
3956
|
-
var
|
|
3960
|
+
var Ns = {
|
|
3957
3961
|
getInitial: function(r, t) {
|
|
3958
3962
|
var s = (t.httpPath || "") + gt(r, "flash=false");
|
|
3959
3963
|
return pt("ws", t, s);
|
|
3960
3964
|
}
|
|
3961
|
-
},
|
|
3965
|
+
}, Ds = {
|
|
3962
3966
|
getInitial: function(r, t) {
|
|
3963
3967
|
var s = (t.httpPath || "/pusher") + gt(r);
|
|
3964
3968
|
return pt("http", t, s);
|
|
3965
3969
|
}
|
|
3966
|
-
},
|
|
3970
|
+
}, qs = {
|
|
3967
3971
|
getInitial: function(r, t) {
|
|
3968
3972
|
return pt("http", t, t.httpPath || "/pusher");
|
|
3969
3973
|
},
|
|
@@ -3971,7 +3975,7 @@ function va() {
|
|
|
3971
3975
|
return gt(r);
|
|
3972
3976
|
}
|
|
3973
3977
|
};
|
|
3974
|
-
class
|
|
3978
|
+
class zs {
|
|
3975
3979
|
constructor() {
|
|
3976
3980
|
this._callbacks = {};
|
|
3977
3981
|
}
|
|
@@ -4011,7 +4015,7 @@ function va() {
|
|
|
4011
4015
|
}
|
|
4012
4016
|
class Te {
|
|
4013
4017
|
constructor(t) {
|
|
4014
|
-
this.callbacks = new
|
|
4018
|
+
this.callbacks = new zs(), this.global_callbacks = [], this.failThrough = t;
|
|
4015
4019
|
}
|
|
4016
4020
|
bind(t, s, a) {
|
|
4017
4021
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4039,7 +4043,7 @@ function va() {
|
|
|
4039
4043
|
return this;
|
|
4040
4044
|
}
|
|
4041
4045
|
}
|
|
4042
|
-
class
|
|
4046
|
+
class js extends Te {
|
|
4043
4047
|
constructor(t, s, a, u, p) {
|
|
4044
4048
|
super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = u, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4045
4049
|
}
|
|
@@ -4126,11 +4130,11 @@ function va() {
|
|
|
4126
4130
|
return this.hooks.isSupported(t);
|
|
4127
4131
|
}
|
|
4128
4132
|
createConnection(t, s, a, u) {
|
|
4129
|
-
return new
|
|
4133
|
+
return new js(this.hooks, t, s, a, u);
|
|
4130
4134
|
}
|
|
4131
4135
|
}
|
|
4132
|
-
var
|
|
4133
|
-
urls:
|
|
4136
|
+
var $s = new Ne({
|
|
4137
|
+
urls: Ns,
|
|
4134
4138
|
handlesActivityChecks: !1,
|
|
4135
4139
|
supportsPing: !1,
|
|
4136
4140
|
isInitialized: function() {
|
|
@@ -4143,7 +4147,7 @@ function va() {
|
|
|
4143
4147
|
return j.createWebSocket(r);
|
|
4144
4148
|
}
|
|
4145
4149
|
}), nn = {
|
|
4146
|
-
urls:
|
|
4150
|
+
urls: Ds,
|
|
4147
4151
|
handlesActivityChecks: !1,
|
|
4148
4152
|
supportsPing: !0,
|
|
4149
4153
|
isInitialized: function() {
|
|
@@ -4161,13 +4165,13 @@ function va() {
|
|
|
4161
4165
|
isSupported: function() {
|
|
4162
4166
|
return j.isXHRSupported();
|
|
4163
4167
|
}
|
|
4164
|
-
},
|
|
4165
|
-
ws:
|
|
4166
|
-
xhr_streaming:
|
|
4167
|
-
xhr_polling:
|
|
4168
|
-
}, Ze =
|
|
4168
|
+
}, Hs = new Ne(pe({}, sn, on)), Bs = new Ne(pe({}, rn, on)), Vs = {
|
|
4169
|
+
ws: $s,
|
|
4170
|
+
xhr_streaming: Hs,
|
|
4171
|
+
xhr_polling: Bs
|
|
4172
|
+
}, Ze = Vs, Xs = new Ne({
|
|
4169
4173
|
file: "sockjs",
|
|
4170
|
-
urls:
|
|
4174
|
+
urls: qs,
|
|
4171
4175
|
handlesActivityChecks: !0,
|
|
4172
4176
|
supportsPing: !1,
|
|
4173
4177
|
isSupported: function() {
|
|
@@ -4178,7 +4182,7 @@ function va() {
|
|
|
4178
4182
|
},
|
|
4179
4183
|
getSocket: function(r, t) {
|
|
4180
4184
|
return new window.SockJS(r, null, {
|
|
4181
|
-
js_path:
|
|
4185
|
+
js_path: y.getPath("sockjs", {
|
|
4182
4186
|
useTLS: t.useTLS
|
|
4183
4187
|
}),
|
|
4184
4188
|
ignore_null_origin: t.ignoreNullOrigin
|
|
@@ -4194,10 +4198,10 @@ function va() {
|
|
|
4194
4198
|
var t = j.isXDRSupported(r.useTLS);
|
|
4195
4199
|
return t;
|
|
4196
4200
|
}
|
|
4197
|
-
},
|
|
4198
|
-
Ze.xdr_streaming =
|
|
4199
|
-
var
|
|
4200
|
-
class
|
|
4201
|
+
}, Ws = new Ne(pe({}, sn, an)), Gs = new Ne(pe({}, rn, an));
|
|
4202
|
+
Ze.xdr_streaming = Ws, Ze.xdr_polling = Gs, Ze.sockjs = Xs;
|
|
4203
|
+
var Js = Ze;
|
|
4204
|
+
class Ks extends Te {
|
|
4201
4205
|
constructor() {
|
|
4202
4206
|
super();
|
|
4203
4207
|
var t = this;
|
|
@@ -4211,8 +4215,8 @@ function va() {
|
|
|
4211
4215
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4212
4216
|
}
|
|
4213
4217
|
}
|
|
4214
|
-
var
|
|
4215
|
-
class
|
|
4218
|
+
var Qs = new Ks();
|
|
4219
|
+
class Ys {
|
|
4216
4220
|
constructor(t, s, a) {
|
|
4217
4221
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4218
4222
|
}
|
|
@@ -4226,8 +4230,8 @@ function va() {
|
|
|
4226
4230
|
if (p.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
|
|
4227
4231
|
this.manager.reportDeath();
|
|
4228
4232
|
else if (!Q.wasClean && S) {
|
|
4229
|
-
var
|
|
4230
|
-
|
|
4233
|
+
var ee = ue.now() - S;
|
|
4234
|
+
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4231
4235
|
}
|
|
4232
4236
|
};
|
|
4233
4237
|
return p.bind("open", L), p;
|
|
@@ -4290,8 +4294,8 @@ function va() {
|
|
|
4290
4294
|
} : null;
|
|
4291
4295
|
}
|
|
4292
4296
|
};
|
|
4293
|
-
var
|
|
4294
|
-
class
|
|
4297
|
+
var Le = cn;
|
|
4298
|
+
class Zs extends Te {
|
|
4295
4299
|
constructor(t, s) {
|
|
4296
4300
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4297
4301
|
}
|
|
@@ -4303,7 +4307,7 @@ function va() {
|
|
|
4303
4307
|
}
|
|
4304
4308
|
send_event(t, s, a) {
|
|
4305
4309
|
var u = { event: t, data: s };
|
|
4306
|
-
return a && (u.channel = a), oe.debug("Event sent", u), this.send(
|
|
4310
|
+
return a && (u.channel = a), oe.debug("Event sent", u), this.send(Le.encodeMessage(u));
|
|
4307
4311
|
}
|
|
4308
4312
|
ping() {
|
|
4309
4313
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4316,7 +4320,7 @@ function va() {
|
|
|
4316
4320
|
message: (a) => {
|
|
4317
4321
|
var u;
|
|
4318
4322
|
try {
|
|
4319
|
-
u =
|
|
4323
|
+
u = Le.decodeMessage(a);
|
|
4320
4324
|
} catch (p) {
|
|
4321
4325
|
this.emit("error", {
|
|
4322
4326
|
type: "MessageParseError",
|
|
@@ -4361,11 +4365,11 @@ function va() {
|
|
|
4361
4365
|
});
|
|
4362
4366
|
}
|
|
4363
4367
|
handleCloseEvent(t) {
|
|
4364
|
-
var s =
|
|
4368
|
+
var s = Le.getCloseAction(t), a = Le.getCloseError(t);
|
|
4365
4369
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4366
4370
|
}
|
|
4367
4371
|
}
|
|
4368
|
-
class
|
|
4372
|
+
class er {
|
|
4369
4373
|
constructor(t, s) {
|
|
4370
4374
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4371
4375
|
}
|
|
@@ -4377,18 +4381,18 @@ function va() {
|
|
|
4377
4381
|
this.unbindListeners();
|
|
4378
4382
|
var s;
|
|
4379
4383
|
try {
|
|
4380
|
-
s =
|
|
4384
|
+
s = Le.processHandshake(t);
|
|
4381
4385
|
} catch (a) {
|
|
4382
4386
|
this.finish("error", { error: a }), this.transport.close();
|
|
4383
4387
|
return;
|
|
4384
4388
|
}
|
|
4385
4389
|
s.action === "connected" ? this.finish("connected", {
|
|
4386
|
-
connection: new
|
|
4390
|
+
connection: new Zs(s.id, this.transport),
|
|
4387
4391
|
activityTimeout: s.activityTimeout
|
|
4388
4392
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4389
4393
|
}, this.onClosed = (t) => {
|
|
4390
4394
|
this.unbindListeners();
|
|
4391
|
-
var s =
|
|
4395
|
+
var s = Le.getCloseAction(t) || "backoff", a = Le.getCloseError(t);
|
|
4392
4396
|
this.finish(s, { error: a });
|
|
4393
4397
|
}, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
|
|
4394
4398
|
}
|
|
@@ -4399,7 +4403,7 @@ function va() {
|
|
|
4399
4403
|
this.callback(pe({ transport: this.transport, action: t }, s));
|
|
4400
4404
|
}
|
|
4401
4405
|
}
|
|
4402
|
-
class
|
|
4406
|
+
class tr {
|
|
4403
4407
|
constructor(t, s) {
|
|
4404
4408
|
this.timeline = t, this.options = s || {};
|
|
4405
4409
|
}
|
|
@@ -4477,7 +4481,7 @@ function va() {
|
|
|
4477
4481
|
}, s);
|
|
4478
4482
|
}
|
|
4479
4483
|
}
|
|
4480
|
-
class
|
|
4484
|
+
class nr {
|
|
4481
4485
|
constructor() {
|
|
4482
4486
|
this.reset();
|
|
4483
4487
|
}
|
|
@@ -4509,39 +4513,39 @@ function va() {
|
|
|
4509
4513
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4510
4514
|
}
|
|
4511
4515
|
}
|
|
4512
|
-
var
|
|
4516
|
+
var sr = function(r, t, s, a) {
|
|
4513
4517
|
function u(p) {
|
|
4514
4518
|
return p instanceof s ? p : new s(function(S) {
|
|
4515
4519
|
S(p);
|
|
4516
4520
|
});
|
|
4517
4521
|
}
|
|
4518
4522
|
return new (s || (s = Promise))(function(p, S) {
|
|
4519
|
-
function L(
|
|
4523
|
+
function L(ee) {
|
|
4520
4524
|
try {
|
|
4521
|
-
Q(a.next(
|
|
4525
|
+
Q(a.next(ee));
|
|
4522
4526
|
} catch (ce) {
|
|
4523
4527
|
S(ce);
|
|
4524
4528
|
}
|
|
4525
4529
|
}
|
|
4526
|
-
function z(
|
|
4530
|
+
function z(ee) {
|
|
4527
4531
|
try {
|
|
4528
|
-
Q(a.throw(
|
|
4532
|
+
Q(a.throw(ee));
|
|
4529
4533
|
} catch (ce) {
|
|
4530
4534
|
S(ce);
|
|
4531
4535
|
}
|
|
4532
4536
|
}
|
|
4533
|
-
function Q(
|
|
4534
|
-
|
|
4537
|
+
function Q(ee) {
|
|
4538
|
+
ee.done ? p(ee.value) : u(ee.value).then(L, z);
|
|
4535
4539
|
}
|
|
4536
4540
|
Q((a = a.apply(r, t || [])).next());
|
|
4537
4541
|
});
|
|
4538
4542
|
};
|
|
4539
|
-
class
|
|
4543
|
+
class rr extends bt {
|
|
4540
4544
|
constructor(t, s) {
|
|
4541
|
-
super(t, s), this.members = new
|
|
4545
|
+
super(t, s), this.members = new nr();
|
|
4542
4546
|
}
|
|
4543
4547
|
authorize(t, s) {
|
|
4544
|
-
super.authorize(t, (a, u) =>
|
|
4548
|
+
super.authorize(t, (a, u) => sr(this, void 0, void 0, function* () {
|
|
4545
4549
|
if (!a)
|
|
4546
4550
|
if (u = u, u.channel_data != null) {
|
|
4547
4551
|
var p = JSON.parse(u.channel_data);
|
|
@@ -4591,8 +4595,8 @@ function va() {
|
|
|
4591
4595
|
this.members.reset(), super.disconnect();
|
|
4592
4596
|
}
|
|
4593
4597
|
}
|
|
4594
|
-
var
|
|
4595
|
-
class
|
|
4598
|
+
var ir = c(1), yt = c(0);
|
|
4599
|
+
class or extends bt {
|
|
4596
4600
|
constructor(t, s, a) {
|
|
4597
4601
|
super(t, s), this.key = null, this.nacl = a;
|
|
4598
4602
|
}
|
|
@@ -4658,7 +4662,7 @@ function va() {
|
|
|
4658
4662
|
this.emit(t, this.getDataToEmit(p));
|
|
4659
4663
|
}
|
|
4660
4664
|
getDataToEmit(t) {
|
|
4661
|
-
let s = Object(
|
|
4665
|
+
let s = Object(ir.decode)(t);
|
|
4662
4666
|
try {
|
|
4663
4667
|
return JSON.parse(s);
|
|
4664
4668
|
} catch {
|
|
@@ -4666,7 +4670,7 @@ function va() {
|
|
|
4666
4670
|
}
|
|
4667
4671
|
}
|
|
4668
4672
|
}
|
|
4669
|
-
class
|
|
4673
|
+
class ar extends Te {
|
|
4670
4674
|
constructor(t, s) {
|
|
4671
4675
|
super(), this.state = "initialized", this.connection = null, this.key = t, this.options = s, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
4672
4676
|
var a = j.getNetwork();
|
|
@@ -4822,12 +4826,12 @@ function va() {
|
|
|
4822
4826
|
return this.state === "connecting" || this.state === "connected";
|
|
4823
4827
|
}
|
|
4824
4828
|
}
|
|
4825
|
-
class
|
|
4829
|
+
class cr {
|
|
4826
4830
|
constructor() {
|
|
4827
4831
|
this.channels = {};
|
|
4828
4832
|
}
|
|
4829
4833
|
add(t, s) {
|
|
4830
|
-
return this.channels[t] || (this.channels[t] =
|
|
4834
|
+
return this.channels[t] || (this.channels[t] = ur(t, s)), this.channels[t];
|
|
4831
4835
|
}
|
|
4832
4836
|
all() {
|
|
4833
4837
|
return X(this.channels);
|
|
@@ -4845,7 +4849,7 @@ function va() {
|
|
|
4845
4849
|
});
|
|
4846
4850
|
}
|
|
4847
4851
|
}
|
|
4848
|
-
function
|
|
4852
|
+
function ur(r, t) {
|
|
4849
4853
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4850
4854
|
if (t.config.nacl)
|
|
4851
4855
|
return Ee.createEncryptedChannel(r, t, t.config.nacl);
|
|
@@ -4861,12 +4865,12 @@ function va() {
|
|
|
4861
4865
|
return Ee.createChannel(r, t);
|
|
4862
4866
|
}
|
|
4863
4867
|
}
|
|
4864
|
-
var
|
|
4868
|
+
var lr = {
|
|
4865
4869
|
createChannels() {
|
|
4866
|
-
return new
|
|
4870
|
+
return new cr();
|
|
4867
4871
|
},
|
|
4868
4872
|
createConnectionManager(r, t) {
|
|
4869
|
-
return new
|
|
4873
|
+
return new ar(r, t);
|
|
4870
4874
|
},
|
|
4871
4875
|
createChannel(r, t) {
|
|
4872
4876
|
return new vt(r, t);
|
|
@@ -4875,21 +4879,21 @@ function va() {
|
|
|
4875
4879
|
return new bt(r, t);
|
|
4876
4880
|
},
|
|
4877
4881
|
createPresenceChannel(r, t) {
|
|
4878
|
-
return new
|
|
4882
|
+
return new rr(r, t);
|
|
4879
4883
|
},
|
|
4880
4884
|
createEncryptedChannel(r, t, s) {
|
|
4881
|
-
return new
|
|
4885
|
+
return new or(r, t, s);
|
|
4882
4886
|
},
|
|
4883
4887
|
createTimelineSender(r, t) {
|
|
4884
|
-
return new
|
|
4888
|
+
return new tr(r, t);
|
|
4885
4889
|
},
|
|
4886
4890
|
createHandshake(r, t) {
|
|
4887
|
-
return new
|
|
4891
|
+
return new er(r, t);
|
|
4888
4892
|
},
|
|
4889
4893
|
createAssistantToTheTransportManager(r, t, s) {
|
|
4890
|
-
return new
|
|
4894
|
+
return new Ys(r, t, s);
|
|
4891
4895
|
}
|
|
4892
|
-
}, Ee =
|
|
4896
|
+
}, Ee = lr;
|
|
4893
4897
|
class un {
|
|
4894
4898
|
constructor(t) {
|
|
4895
4899
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
@@ -4907,7 +4911,7 @@ function va() {
|
|
|
4907
4911
|
this.livesLeft -= 1;
|
|
4908
4912
|
}
|
|
4909
4913
|
}
|
|
4910
|
-
class
|
|
4914
|
+
class Ie {
|
|
4911
4915
|
constructor(t, s) {
|
|
4912
4916
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
4913
4917
|
}
|
|
@@ -4951,10 +4955,10 @@ function va() {
|
|
|
4951
4955
|
return ye(this.strategies, ue.method("isSupported"));
|
|
4952
4956
|
}
|
|
4953
4957
|
connect(t, s) {
|
|
4954
|
-
return
|
|
4958
|
+
return dr(this.strategies, t, function(a, u) {
|
|
4955
4959
|
return function(p, S) {
|
|
4956
4960
|
if (u[a].error = p, p) {
|
|
4957
|
-
|
|
4961
|
+
hr(u) && s(!0);
|
|
4958
4962
|
return;
|
|
4959
4963
|
}
|
|
4960
4964
|
Y(u, function(L) {
|
|
@@ -4964,13 +4968,13 @@ function va() {
|
|
|
4964
4968
|
});
|
|
4965
4969
|
}
|
|
4966
4970
|
}
|
|
4967
|
-
function
|
|
4971
|
+
function dr(r, t, s) {
|
|
4968
4972
|
var a = ge(r, function(u, p, S, L) {
|
|
4969
4973
|
return u.connect(t, s(p, L));
|
|
4970
4974
|
});
|
|
4971
4975
|
return {
|
|
4972
4976
|
abort: function() {
|
|
4973
|
-
Y(a,
|
|
4977
|
+
Y(a, fr);
|
|
4974
4978
|
},
|
|
4975
4979
|
forceMinPriority: function(u) {
|
|
4976
4980
|
Y(a, function(p) {
|
|
@@ -4979,15 +4983,15 @@ function va() {
|
|
|
4979
4983
|
}
|
|
4980
4984
|
};
|
|
4981
4985
|
}
|
|
4982
|
-
function
|
|
4986
|
+
function hr(r) {
|
|
4983
4987
|
return Ce(r, function(t) {
|
|
4984
4988
|
return !!t.error;
|
|
4985
4989
|
});
|
|
4986
4990
|
}
|
|
4987
|
-
function
|
|
4991
|
+
function fr(r) {
|
|
4988
4992
|
!r.error && !r.aborted && (r.abort(), r.aborted = !0);
|
|
4989
4993
|
}
|
|
4990
|
-
class
|
|
4994
|
+
class pr {
|
|
4991
4995
|
constructor(t, s, a) {
|
|
4992
4996
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
4993
4997
|
}
|
|
@@ -4995,27 +4999,27 @@ function va() {
|
|
|
4995
4999
|
return this.strategy.isSupported();
|
|
4996
5000
|
}
|
|
4997
5001
|
connect(t, s) {
|
|
4998
|
-
var a = this.usingTLS, u =
|
|
5002
|
+
var a = this.usingTLS, u = gr(a), p = u && u.cacheSkipCount ? u.cacheSkipCount : 0, S = [this.strategy];
|
|
4999
5003
|
if (u && u.timestamp + this.ttl >= ue.now()) {
|
|
5000
5004
|
var L = this.transports[u.transport];
|
|
5001
5005
|
L && (["ws", "wss"].includes(u.transport) || p > 3 ? (this.timeline.info({
|
|
5002
5006
|
cached: !0,
|
|
5003
5007
|
transport: u.transport,
|
|
5004
5008
|
latency: u.latency
|
|
5005
|
-
}), S.push(new
|
|
5009
|
+
}), S.push(new Ie([L], {
|
|
5006
5010
|
timeout: u.latency * 2 + 1e3,
|
|
5007
5011
|
failFast: !0
|
|
5008
5012
|
}))) : p++);
|
|
5009
5013
|
}
|
|
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,
|
|
5014
|
+
var z = ue.now(), Q = S.pop().connect(t, function ee(ce, nt) {
|
|
5015
|
+
ce ? (ln(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (mr(a, nt.transport.name, ue.now() - z, p), s(null, nt));
|
|
5012
5016
|
});
|
|
5013
5017
|
return {
|
|
5014
5018
|
abort: function() {
|
|
5015
5019
|
Q.abort();
|
|
5016
5020
|
},
|
|
5017
|
-
forceMinPriority: function(
|
|
5018
|
-
t =
|
|
5021
|
+
forceMinPriority: function(ee) {
|
|
5022
|
+
t = ee, Q && Q.forceMinPriority(ee);
|
|
5019
5023
|
}
|
|
5020
5024
|
};
|
|
5021
5025
|
}
|
|
@@ -5023,7 +5027,7 @@ function va() {
|
|
|
5023
5027
|
function St(r) {
|
|
5024
5028
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
5025
5029
|
}
|
|
5026
|
-
function
|
|
5030
|
+
function gr(r) {
|
|
5027
5031
|
var t = j.getLocalStorage();
|
|
5028
5032
|
if (t)
|
|
5029
5033
|
try {
|
|
@@ -5035,7 +5039,7 @@ function va() {
|
|
|
5035
5039
|
}
|
|
5036
5040
|
return null;
|
|
5037
5041
|
}
|
|
5038
|
-
function
|
|
5042
|
+
function mr(r, t, s, a) {
|
|
5039
5043
|
var u = j.getLocalStorage();
|
|
5040
5044
|
if (u)
|
|
5041
5045
|
try {
|
|
@@ -5090,7 +5094,7 @@ function va() {
|
|
|
5090
5094
|
return a.connect(t, s);
|
|
5091
5095
|
}
|
|
5092
5096
|
}
|
|
5093
|
-
class
|
|
5097
|
+
class vr {
|
|
5094
5098
|
constructor(t) {
|
|
5095
5099
|
this.strategy = t;
|
|
5096
5100
|
}
|
|
@@ -5109,10 +5113,10 @@ function va() {
|
|
|
5109
5113
|
return r.isSupported();
|
|
5110
5114
|
};
|
|
5111
5115
|
}
|
|
5112
|
-
var
|
|
5116
|
+
var br = function(r, t, s) {
|
|
5113
5117
|
var a = {};
|
|
5114
|
-
function u(Sn,
|
|
5115
|
-
var Cn = s(r, Sn,
|
|
5118
|
+
function u(Sn, vi, bi, yi, _i) {
|
|
5119
|
+
var Cn = s(r, Sn, vi, bi, yi, _i);
|
|
5116
5120
|
return a[Sn] = Cn, Cn;
|
|
5117
5121
|
}
|
|
5118
5122
|
var p = Object.assign({}, t, {
|
|
@@ -5132,40 +5136,40 @@ function va() {
|
|
|
5132
5136
|
}, Q = new un({
|
|
5133
5137
|
minPingDelay: 1e4,
|
|
5134
5138
|
maxPingDelay: r.activityTimeout
|
|
5135
|
-
}),
|
|
5139
|
+
}), ee = new un({
|
|
5136
5140
|
lives: 2,
|
|
5137
5141
|
minPingDelay: 1e4,
|
|
5138
5142
|
maxPingDelay: r.activityTimeout
|
|
5139
|
-
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q),
|
|
5140
|
-
new ze(je(gn), gn,
|
|
5141
|
-
], z), yn = new
|
|
5142
|
-
new ze(je(mn), mn,
|
|
5143
|
-
], z), _n = new
|
|
5143
|
+
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q), hi = u("sockjs", "sockjs", 1, L), gn = u("xhr_streaming", "xhr_streaming", 1, L, ee), fi = u("xdr_streaming", "xdr_streaming", 1, L, ee), mn = u("xhr_polling", "xhr_polling", 1, L), pi = u("xdr_polling", "xdr_polling", 1, L), vn = new Ie([ce], z), gi = new Ie([nt], z), mi = new Ie([hi], z), bn = new Ie([
|
|
5144
|
+
new ze(je(gn), gn, fi)
|
|
5145
|
+
], z), yn = new Ie([
|
|
5146
|
+
new ze(je(mn), mn, pi)
|
|
5147
|
+
], z), _n = new Ie([
|
|
5144
5148
|
new ze(je(bn), new _t([
|
|
5145
5149
|
bn,
|
|
5146
5150
|
new et(yn, { delay: 4e3 })
|
|
5147
5151
|
]), yn)
|
|
5148
|
-
], z), Et = new ze(je(_n), _n,
|
|
5152
|
+
], z), Et = new ze(je(_n), _n, mi), At;
|
|
5149
5153
|
return t.useTLS ? At = new _t([
|
|
5150
5154
|
vn,
|
|
5151
5155
|
new et(Et, { delay: 2e3 })
|
|
5152
5156
|
]) : At = new _t([
|
|
5153
5157
|
vn,
|
|
5154
|
-
new et(
|
|
5158
|
+
new et(gi, { delay: 2e3 }),
|
|
5155
5159
|
new et(Et, { delay: 5e3 })
|
|
5156
|
-
]), new
|
|
5160
|
+
]), new pr(new vr(new ze(je(ce), At, Et)), a, {
|
|
5157
5161
|
ttl: 18e5,
|
|
5158
5162
|
timeline: t.timeline,
|
|
5159
5163
|
useTLS: t.useTLS
|
|
5160
5164
|
});
|
|
5161
|
-
},
|
|
5165
|
+
}, yr = br, _r = (function() {
|
|
5162
5166
|
var r = this;
|
|
5163
5167
|
r.timeline.info(r.buildTimelineMessage({
|
|
5164
5168
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
5165
|
-
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"),
|
|
5169
|
+
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), y.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
5166
5170
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
5167
5171
|
})) : r.onClose();
|
|
5168
|
-
}),
|
|
5172
|
+
}), Sr = {
|
|
5169
5173
|
getRequest: function(r) {
|
|
5170
5174
|
var t = new window.XDomainRequest();
|
|
5171
5175
|
return t.ontimeout = function() {
|
|
@@ -5181,9 +5185,9 @@ function va() {
|
|
|
5181
5185
|
abortRequest: function(r) {
|
|
5182
5186
|
r.ontimeout = r.onerror = r.onprogress = r.onload = null, r.abort();
|
|
5183
5187
|
}
|
|
5184
|
-
},
|
|
5185
|
-
const
|
|
5186
|
-
class
|
|
5188
|
+
}, Cr = Sr;
|
|
5189
|
+
const wr = 256 * 1024;
|
|
5190
|
+
class Tr extends Te {
|
|
5187
5191
|
constructor(t, s, a) {
|
|
5188
5192
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5189
5193
|
}
|
|
@@ -5211,17 +5215,17 @@ function va() {
|
|
|
5211
5215
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5212
5216
|
}
|
|
5213
5217
|
isBufferTooLong(t) {
|
|
5214
|
-
return this.position === t.length && t.length >
|
|
5218
|
+
return this.position === t.length && t.length > wr;
|
|
5215
5219
|
}
|
|
5216
5220
|
}
|
|
5217
5221
|
var Ct;
|
|
5218
5222
|
(function(r) {
|
|
5219
5223
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5220
5224
|
})(Ct || (Ct = {}));
|
|
5221
|
-
var
|
|
5222
|
-
class
|
|
5225
|
+
var Ue = Ct, Er = 1;
|
|
5226
|
+
class Ar {
|
|
5223
5227
|
constructor(t, s) {
|
|
5224
|
-
this.hooks = t, this.session = hn(1e3) + "/" +
|
|
5228
|
+
this.hooks = t, this.session = hn(1e3) + "/" + xr(8), this.location = Rr(s), this.readyState = Ue.CONNECTING, this.openStream();
|
|
5225
5229
|
}
|
|
5226
5230
|
send(t) {
|
|
5227
5231
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5233,9 +5237,9 @@ function va() {
|
|
|
5233
5237
|
this.onClose(t, s, !0);
|
|
5234
5238
|
}
|
|
5235
5239
|
sendRaw(t) {
|
|
5236
|
-
if (this.readyState ===
|
|
5240
|
+
if (this.readyState === Ue.OPEN)
|
|
5237
5241
|
try {
|
|
5238
|
-
return j.createSocketRequest("POST", dn(
|
|
5242
|
+
return j.createSocketRequest("POST", dn(Pr(this.location, this.session))).start(t), !0;
|
|
5239
5243
|
} catch {
|
|
5240
5244
|
return !1;
|
|
5241
5245
|
}
|
|
@@ -5246,7 +5250,7 @@ function va() {
|
|
|
5246
5250
|
this.closeStream(), this.openStream();
|
|
5247
5251
|
}
|
|
5248
5252
|
onClose(t, s, a) {
|
|
5249
|
-
this.closeStream(), this.readyState =
|
|
5253
|
+
this.closeStream(), this.readyState = Ue.CLOSED, this.onclose && this.onclose({
|
|
5250
5254
|
code: t,
|
|
5251
5255
|
reason: s,
|
|
5252
5256
|
wasClean: a
|
|
@@ -5254,7 +5258,7 @@ function va() {
|
|
|
5254
5258
|
}
|
|
5255
5259
|
onChunk(t) {
|
|
5256
5260
|
if (t.status === 200) {
|
|
5257
|
-
this.readyState ===
|
|
5261
|
+
this.readyState === Ue.OPEN && this.onActivity();
|
|
5258
5262
|
var s, a = t.data.slice(0, 1);
|
|
5259
5263
|
switch (a) {
|
|
5260
5264
|
case "o":
|
|
@@ -5278,10 +5282,10 @@ function va() {
|
|
|
5278
5282
|
}
|
|
5279
5283
|
}
|
|
5280
5284
|
onOpen(t) {
|
|
5281
|
-
this.readyState ===
|
|
5285
|
+
this.readyState === Ue.CONNECTING ? (t && t.hostname && (this.location.base = Mr(this.location.base, t.hostname)), this.readyState = Ue.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5282
5286
|
}
|
|
5283
5287
|
onEvent(t) {
|
|
5284
|
-
this.readyState ===
|
|
5288
|
+
this.readyState === Ue.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
5285
5289
|
}
|
|
5286
5290
|
onActivity() {
|
|
5287
5291
|
this.onactivity && this.onactivity();
|
|
@@ -5309,33 +5313,33 @@ function va() {
|
|
|
5309
5313
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5310
5314
|
}
|
|
5311
5315
|
}
|
|
5312
|
-
function
|
|
5316
|
+
function Rr(r) {
|
|
5313
5317
|
var t = /([^\?]*)\/*(\??.*)/.exec(r);
|
|
5314
5318
|
return {
|
|
5315
5319
|
base: t[1],
|
|
5316
5320
|
queryString: t[2]
|
|
5317
5321
|
};
|
|
5318
5322
|
}
|
|
5319
|
-
function
|
|
5323
|
+
function Pr(r, t) {
|
|
5320
5324
|
return r.base + "/" + t + "/xhr_send";
|
|
5321
5325
|
}
|
|
5322
5326
|
function dn(r) {
|
|
5323
5327
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5324
|
-
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5328
|
+
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + Er++;
|
|
5325
5329
|
}
|
|
5326
|
-
function
|
|
5330
|
+
function Mr(r, t) {
|
|
5327
5331
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5328
5332
|
return s[1] + t + s[3];
|
|
5329
5333
|
}
|
|
5330
5334
|
function hn(r) {
|
|
5331
5335
|
return j.randomInt(r);
|
|
5332
5336
|
}
|
|
5333
|
-
function
|
|
5337
|
+
function xr(r) {
|
|
5334
5338
|
for (var t = [], s = 0; s < r; s++)
|
|
5335
5339
|
t.push(hn(32).toString(32));
|
|
5336
5340
|
return t.join("");
|
|
5337
5341
|
}
|
|
5338
|
-
var
|
|
5342
|
+
var kr = Ar, Lr = {
|
|
5339
5343
|
getReceiveURL: function(r, t) {
|
|
5340
5344
|
return r.base + "/" + t + "/xhr_streaming" + r.queryString;
|
|
5341
5345
|
},
|
|
@@ -5348,7 +5352,7 @@ function va() {
|
|
|
5348
5352
|
onFinished: function(r, t) {
|
|
5349
5353
|
r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5350
5354
|
}
|
|
5351
|
-
},
|
|
5355
|
+
}, Ir = Lr, Ur = {
|
|
5352
5356
|
getReceiveURL: function(r, t) {
|
|
5353
5357
|
return r.base + "/" + t + "/xhr" + r.queryString;
|
|
5354
5358
|
},
|
|
@@ -5360,7 +5364,7 @@ function va() {
|
|
|
5360
5364
|
onFinished: function(r, t) {
|
|
5361
5365
|
t === 200 ? r.reconnect() : r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5362
5366
|
}
|
|
5363
|
-
},
|
|
5367
|
+
}, Or = Ur, Fr = {
|
|
5364
5368
|
getRequest: function(r) {
|
|
5365
5369
|
var t = j.getXHRAPI(), s = new t();
|
|
5366
5370
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5377,36 +5381,36 @@ function va() {
|
|
|
5377
5381
|
abortRequest: function(r) {
|
|
5378
5382
|
r.onreadystatechange = null, r.abort();
|
|
5379
5383
|
}
|
|
5380
|
-
},
|
|
5384
|
+
}, Nr = Fr, Dr = {
|
|
5381
5385
|
createStreamingSocket(r) {
|
|
5382
|
-
return this.createSocket(
|
|
5386
|
+
return this.createSocket(Ir, r);
|
|
5383
5387
|
},
|
|
5384
5388
|
createPollingSocket(r) {
|
|
5385
|
-
return this.createSocket(
|
|
5389
|
+
return this.createSocket(Or, r);
|
|
5386
5390
|
},
|
|
5387
5391
|
createSocket(r, t) {
|
|
5388
|
-
return new
|
|
5392
|
+
return new kr(r, t);
|
|
5389
5393
|
},
|
|
5390
5394
|
createXHR(r, t) {
|
|
5391
|
-
return this.createRequest(
|
|
5395
|
+
return this.createRequest(Nr, r, t);
|
|
5392
5396
|
},
|
|
5393
5397
|
createRequest(r, t, s) {
|
|
5394
|
-
return new
|
|
5398
|
+
return new Tr(r, t, s);
|
|
5395
5399
|
}
|
|
5396
|
-
}, fn =
|
|
5400
|
+
}, fn = Dr;
|
|
5397
5401
|
fn.createXDR = function(r, t) {
|
|
5398
|
-
return this.createRequest(
|
|
5402
|
+
return this.createRequest(Cr, r, t);
|
|
5399
5403
|
};
|
|
5400
|
-
var
|
|
5404
|
+
var qr = fn, zr = {
|
|
5401
5405
|
nextAuthCallbackID: 1,
|
|
5402
5406
|
auth_callbacks: {},
|
|
5403
5407
|
ScriptReceivers: d,
|
|
5404
5408
|
DependenciesReceivers: M,
|
|
5405
|
-
getDefaultStrategy:
|
|
5406
|
-
Transports:
|
|
5407
|
-
transportConnectionInitializer:
|
|
5408
|
-
HTTPFactory:
|
|
5409
|
-
TimelineTransport:
|
|
5409
|
+
getDefaultStrategy: yr,
|
|
5410
|
+
Transports: Js,
|
|
5411
|
+
transportConnectionInitializer: _r,
|
|
5412
|
+
HTTPFactory: qr,
|
|
5413
|
+
TimelineTransport: Fs,
|
|
5410
5414
|
getXHRAPI() {
|
|
5411
5415
|
return window.XMLHttpRequest;
|
|
5412
5416
|
},
|
|
@@ -5418,7 +5422,7 @@ function va() {
|
|
|
5418
5422
|
var t = () => {
|
|
5419
5423
|
this.onDocumentBody(r.ready);
|
|
5420
5424
|
};
|
|
5421
|
-
window.JSON ? t() :
|
|
5425
|
+
window.JSON ? t() : y.load("json2", {}, t);
|
|
5422
5426
|
},
|
|
5423
5427
|
getDocument() {
|
|
5424
5428
|
return document;
|
|
@@ -5427,7 +5431,7 @@ function va() {
|
|
|
5427
5431
|
return this.getDocument().location.protocol;
|
|
5428
5432
|
},
|
|
5429
5433
|
getAuthorizers() {
|
|
5430
|
-
return { ajax: J, jsonp:
|
|
5434
|
+
return { ajax: J, jsonp: ks };
|
|
5431
5435
|
},
|
|
5432
5436
|
onDocumentBody(r) {
|
|
5433
5437
|
document.body ? r() : setTimeout(() => {
|
|
@@ -5435,10 +5439,10 @@ function va() {
|
|
|
5435
5439
|
}, 0);
|
|
5436
5440
|
},
|
|
5437
5441
|
createJSONPRequest(r, t) {
|
|
5438
|
-
return new
|
|
5442
|
+
return new Is(r, t);
|
|
5439
5443
|
},
|
|
5440
5444
|
createScriptRequest(r) {
|
|
5441
|
-
return new
|
|
5445
|
+
return new Ls(r);
|
|
5442
5446
|
},
|
|
5443
5447
|
getLocalStorage() {
|
|
5444
5448
|
try {
|
|
@@ -5458,7 +5462,7 @@ function va() {
|
|
|
5458
5462
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5459
5463
|
},
|
|
5460
5464
|
getNetwork() {
|
|
5461
|
-
return
|
|
5465
|
+
return Qs;
|
|
5462
5466
|
},
|
|
5463
5467
|
createWebSocket(r) {
|
|
5464
5468
|
var t = this.getWebSocketAPI();
|
|
@@ -5490,12 +5494,12 @@ function va() {
|
|
|
5490
5494
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5491
5495
|
}() * r);
|
|
5492
5496
|
}
|
|
5493
|
-
}, j =
|
|
5497
|
+
}, j = zr, wt;
|
|
5494
5498
|
(function(r) {
|
|
5495
5499
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5496
5500
|
})(wt || (wt = {}));
|
|
5497
5501
|
var tt = wt;
|
|
5498
|
-
class
|
|
5502
|
+
class jr {
|
|
5499
5503
|
constructor(t, s, a) {
|
|
5500
5504
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5501
5505
|
}
|
|
@@ -5533,7 +5537,7 @@ function va() {
|
|
|
5533
5537
|
return this.uniqueID++, this.uniqueID;
|
|
5534
5538
|
}
|
|
5535
5539
|
}
|
|
5536
|
-
class
|
|
5540
|
+
class $r {
|
|
5537
5541
|
constructor(t, s, a, u) {
|
|
5538
5542
|
this.name = t, this.priority = s, this.transport = a, this.options = u || {};
|
|
5539
5543
|
}
|
|
@@ -5551,20 +5555,20 @@ function va() {
|
|
|
5551
5555
|
u.unbind("initialized", S), u.connect();
|
|
5552
5556
|
}, L = function() {
|
|
5553
5557
|
p = Ee.createHandshake(u, function(ce) {
|
|
5554
|
-
a = !0,
|
|
5558
|
+
a = !0, ee(), s(null, ce);
|
|
5555
5559
|
});
|
|
5556
5560
|
}, z = function(ce) {
|
|
5557
|
-
|
|
5561
|
+
ee(), s(ce);
|
|
5558
5562
|
}, Q = function() {
|
|
5559
|
-
|
|
5563
|
+
ee();
|
|
5560
5564
|
var ce;
|
|
5561
5565
|
ce = Ye(u), s(new q(ce));
|
|
5562
|
-
},
|
|
5566
|
+
}, ee = function() {
|
|
5563
5567
|
u.unbind("initialized", S), u.unbind("open", L), u.unbind("error", z), u.unbind("closed", Q);
|
|
5564
5568
|
};
|
|
5565
5569
|
return u.bind("initialized", S), u.bind("open", L), u.bind("error", z), u.bind("closed", Q), u.initialize(), {
|
|
5566
5570
|
abort: () => {
|
|
5567
|
-
a || (
|
|
5571
|
+
a || (ee(), p ? p.close() : u.close());
|
|
5568
5572
|
},
|
|
5569
5573
|
forceMinPriority: (ce) => {
|
|
5570
5574
|
a || this.priority < ce && (p ? p.close() : u.close());
|
|
@@ -5582,14 +5586,14 @@ function va() {
|
|
|
5582
5586
|
}
|
|
5583
5587
|
};
|
|
5584
5588
|
}
|
|
5585
|
-
const { Transports:
|
|
5586
|
-
var
|
|
5587
|
-
var S =
|
|
5589
|
+
const { Transports: Hr } = j;
|
|
5590
|
+
var Br = function(r, t, s, a, u, p) {
|
|
5591
|
+
var S = Hr[s];
|
|
5588
5592
|
if (!S)
|
|
5589
5593
|
throw new k(s);
|
|
5590
|
-
var L = (!r.enabledTransports ||
|
|
5591
|
-
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new
|
|
5592
|
-
},
|
|
5594
|
+
var L = (!r.enabledTransports || R(r.enabledTransports, t) !== -1) && (!r.disabledTransports || R(r.disabledTransports, t) === -1), z;
|
|
5595
|
+
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new $r(t, a, p ? p.getAssistant(S) : S, u)) : z = Vr, z;
|
|
5596
|
+
}, Vr = {
|
|
5593
5597
|
isSupported: function() {
|
|
5594
5598
|
return !1;
|
|
5595
5599
|
},
|
|
@@ -5606,14 +5610,14 @@ function va() {
|
|
|
5606
5610
|
};
|
|
5607
5611
|
}
|
|
5608
5612
|
};
|
|
5609
|
-
function
|
|
5613
|
+
function Xr(r) {
|
|
5610
5614
|
if (r == null)
|
|
5611
5615
|
throw "You must pass an options object";
|
|
5612
5616
|
if (r.cluster == null)
|
|
5613
5617
|
throw "Options object must provide a cluster";
|
|
5614
5618
|
"disableStats" in r && oe.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5615
5619
|
}
|
|
5616
|
-
const
|
|
5620
|
+
const Wr = (r, t) => {
|
|
5617
5621
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5618
5622
|
for (var a in t.params)
|
|
5619
5623
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5624,15 +5628,15 @@ function va() {
|
|
|
5624
5628
|
}
|
|
5625
5629
|
return s;
|
|
5626
5630
|
};
|
|
5627
|
-
var
|
|
5631
|
+
var Gr = (r) => {
|
|
5628
5632
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5629
5633
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5630
5634
|
return (t, s) => {
|
|
5631
|
-
const a =
|
|
5635
|
+
const a = Wr(t, r);
|
|
5632
5636
|
j.getAuthorizers()[r.transport](j, a, r, w.UserAuthentication, s);
|
|
5633
5637
|
};
|
|
5634
5638
|
};
|
|
5635
|
-
const
|
|
5639
|
+
const Jr = (r, t) => {
|
|
5636
5640
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5637
5641
|
s += "&channel_name=" + encodeURIComponent(r.channelName);
|
|
5638
5642
|
for (var a in t.params)
|
|
@@ -5644,15 +5648,15 @@ function va() {
|
|
|
5644
5648
|
}
|
|
5645
5649
|
return s;
|
|
5646
5650
|
};
|
|
5647
|
-
var
|
|
5651
|
+
var Kr = (r) => {
|
|
5648
5652
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5649
5653
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5650
5654
|
return (t, s) => {
|
|
5651
|
-
const a =
|
|
5655
|
+
const a = Jr(t, r);
|
|
5652
5656
|
j.getAuthorizers()[r.transport](j, a, r, w.ChannelAuthorization, s);
|
|
5653
5657
|
};
|
|
5654
5658
|
};
|
|
5655
|
-
const
|
|
5659
|
+
const Qr = (r, t, s) => {
|
|
5656
5660
|
const a = {
|
|
5657
5661
|
authTransport: t.transport,
|
|
5658
5662
|
authEndpoint: t.endpoint,
|
|
@@ -5666,7 +5670,7 @@ function va() {
|
|
|
5666
5670
|
s(S, a).authorize(u.socketId, p);
|
|
5667
5671
|
};
|
|
5668
5672
|
};
|
|
5669
|
-
function
|
|
5673
|
+
function Yr(r, t) {
|
|
5670
5674
|
let s = {
|
|
5671
5675
|
activityTimeout: r.activityTimeout || h.activityTimeout,
|
|
5672
5676
|
cluster: r.cluster,
|
|
@@ -5679,46 +5683,46 @@ function va() {
|
|
|
5679
5683
|
wsPath: r.wsPath || h.wsPath,
|
|
5680
5684
|
wsPort: r.wsPort || h.wsPort,
|
|
5681
5685
|
wssPort: r.wssPort || h.wssPort,
|
|
5682
|
-
enableStats:
|
|
5683
|
-
httpHost:
|
|
5684
|
-
useTLS:
|
|
5685
|
-
wsHost:
|
|
5686
|
-
userAuthenticator:
|
|
5687
|
-
channelAuthorizer:
|
|
5686
|
+
enableStats: si(r),
|
|
5687
|
+
httpHost: Zr(r),
|
|
5688
|
+
useTLS: ni(r),
|
|
5689
|
+
wsHost: ei(r),
|
|
5690
|
+
userAuthenticator: ri(r),
|
|
5691
|
+
channelAuthorizer: oi(r, t)
|
|
5688
5692
|
};
|
|
5689
5693
|
return "disabledTransports" in r && (s.disabledTransports = r.disabledTransports), "enabledTransports" in r && (s.enabledTransports = r.enabledTransports), "ignoreNullOrigin" in r && (s.ignoreNullOrigin = r.ignoreNullOrigin), "timelineParams" in r && (s.timelineParams = r.timelineParams), "nacl" in r && (s.nacl = r.nacl), s;
|
|
5690
5694
|
}
|
|
5691
|
-
function Yr(r) {
|
|
5692
|
-
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5693
|
-
}
|
|
5694
5695
|
function Zr(r) {
|
|
5695
|
-
return r.
|
|
5696
|
+
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5696
5697
|
}
|
|
5697
5698
|
function ei(r) {
|
|
5698
|
-
return
|
|
5699
|
+
return r.wsHost ? r.wsHost : ti(r.cluster);
|
|
5699
5700
|
}
|
|
5700
5701
|
function ti(r) {
|
|
5701
|
-
return
|
|
5702
|
+
return `ws-${r}.pusher.com`;
|
|
5702
5703
|
}
|
|
5703
5704
|
function ni(r) {
|
|
5704
|
-
return
|
|
5705
|
+
return j.getProtocol() === "https:" ? !0 : r.forceTLS !== !1;
|
|
5705
5706
|
}
|
|
5706
5707
|
function si(r) {
|
|
5708
|
+
return "enableStats" in r ? r.enableStats : "disableStats" in r ? !r.disableStats : !1;
|
|
5709
|
+
}
|
|
5710
|
+
function ri(r) {
|
|
5707
5711
|
const t = Object.assign(Object.assign({}, h.userAuthentication), r.userAuthentication);
|
|
5708
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5712
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : Gr(t);
|
|
5709
5713
|
}
|
|
5710
|
-
function
|
|
5714
|
+
function ii(r, t) {
|
|
5711
5715
|
let s;
|
|
5712
5716
|
return "channelAuthorization" in r ? s = Object.assign(Object.assign({}, h.channelAuthorization), r.channelAuthorization) : (s = {
|
|
5713
5717
|
transport: r.authTransport || h.authTransport,
|
|
5714
5718
|
endpoint: r.authEndpoint || h.authEndpoint
|
|
5715
|
-
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler =
|
|
5719
|
+
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler = Qr(t, s, r.authorizer))), s;
|
|
5716
5720
|
}
|
|
5717
|
-
function
|
|
5718
|
-
const s =
|
|
5719
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5721
|
+
function oi(r, t) {
|
|
5722
|
+
const s = ii(r, t);
|
|
5723
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : Kr(s);
|
|
5720
5724
|
}
|
|
5721
|
-
class
|
|
5725
|
+
class ai extends Te {
|
|
5722
5726
|
constructor(t) {
|
|
5723
5727
|
super(function(s, a) {
|
|
5724
5728
|
oe.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5736,14 +5740,14 @@ function va() {
|
|
|
5736
5740
|
});
|
|
5737
5741
|
}
|
|
5738
5742
|
}
|
|
5739
|
-
function
|
|
5743
|
+
function ci() {
|
|
5740
5744
|
let r, t;
|
|
5741
5745
|
return { promise: new Promise((a, u) => {
|
|
5742
5746
|
r = a, t = u;
|
|
5743
5747
|
}), resolve: r, reject: t };
|
|
5744
5748
|
}
|
|
5745
|
-
var
|
|
5746
|
-
class
|
|
5749
|
+
var ui = ci;
|
|
5750
|
+
class li extends Te {
|
|
5747
5751
|
constructor(t) {
|
|
5748
5752
|
super(function(s, a) {
|
|
5749
5753
|
oe.debug("No callbacks on user for " + s);
|
|
@@ -5758,7 +5762,7 @@ function va() {
|
|
|
5758
5762
|
});
|
|
5759
5763
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5760
5764
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5761
|
-
}), this.watchlist = new
|
|
5765
|
+
}), this.watchlist = new ai(t), this.pusher.connection.bind("message", (s) => {
|
|
5762
5766
|
var a = s.event;
|
|
5763
5767
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5764
5768
|
});
|
|
@@ -5798,7 +5802,7 @@ function va() {
|
|
|
5798
5802
|
_newSigninPromiseIfNeeded() {
|
|
5799
5803
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
5800
5804
|
return;
|
|
5801
|
-
const { promise: t, resolve: s } =
|
|
5805
|
+
const { promise: t, resolve: s } = ui();
|
|
5802
5806
|
t.done = !1;
|
|
5803
5807
|
const a = () => {
|
|
5804
5808
|
t.done = !0;
|
|
@@ -5818,7 +5822,7 @@ function va() {
|
|
|
5818
5822
|
}));
|
|
5819
5823
|
}
|
|
5820
5824
|
constructor(t, s) {
|
|
5821
|
-
|
|
5825
|
+
di(t), Xr(s), this.key = t, this.config = Yr(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new jr(this.key, this.sessionID, {
|
|
5822
5826
|
cluster: this.config.cluster,
|
|
5823
5827
|
features: de.getClientFeatures(),
|
|
5824
5828
|
params: this.config.timelineParams || {},
|
|
@@ -5829,7 +5833,7 @@ function va() {
|
|
|
5829
5833
|
host: this.config.statsHost,
|
|
5830
5834
|
path: "/timeline/v2/" + j.TimelineTransport.name
|
|
5831
5835
|
}));
|
|
5832
|
-
var a = (u) => j.getDefaultStrategy(this.config, u,
|
|
5836
|
+
var a = (u) => j.getDefaultStrategy(this.config, u, Br);
|
|
5833
5837
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
5834
5838
|
getStrategy: a,
|
|
5835
5839
|
timeline: this.timeline,
|
|
@@ -5852,7 +5856,7 @@ function va() {
|
|
|
5852
5856
|
this.channels.disconnect();
|
|
5853
5857
|
}), this.connection.bind("error", (u) => {
|
|
5854
5858
|
oe.warn(u);
|
|
5855
|
-
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new
|
|
5859
|
+
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new li(this), de.isReady && this.connect();
|
|
5856
5860
|
}
|
|
5857
5861
|
channel(t) {
|
|
5858
5862
|
return this.channels.find(t);
|
|
@@ -5911,7 +5915,7 @@ function va() {
|
|
|
5911
5915
|
}
|
|
5912
5916
|
de.instances = [], de.isReady = !1, de.logToConsole = !1, de.Runtime = j, de.ScriptReceivers = j.ScriptReceivers, de.DependenciesReceivers = j.DependenciesReceivers, de.auth_callbacks = j.auth_callbacks;
|
|
5913
5917
|
var Tt = o.default = de;
|
|
5914
|
-
function
|
|
5918
|
+
function di(r) {
|
|
5915
5919
|
if (r == null)
|
|
5916
5920
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
5917
5921
|
}
|
|
@@ -6028,7 +6032,7 @@ function Vn(e, n) {
|
|
|
6028
6032
|
"X-Requested-With": "XMLHttpRequest"
|
|
6029
6033
|
}), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
6030
6034
|
}
|
|
6031
|
-
function
|
|
6035
|
+
function Re(e, n, i) {
|
|
6032
6036
|
const o = e[n];
|
|
6033
6037
|
if (typeof o == "string" && o.trim() !== "")
|
|
6034
6038
|
return o;
|
|
@@ -6044,14 +6048,14 @@ function xa(e) {
|
|
|
6044
6048
|
function ka(e, n) {
|
|
6045
6049
|
if (!se(e))
|
|
6046
6050
|
return null;
|
|
6047
|
-
const i =
|
|
6051
|
+
const i = Re(e, "user_id", "userId"), o = xa(e.status);
|
|
6048
6052
|
if (!i || !o)
|
|
6049
6053
|
return null;
|
|
6050
6054
|
const c = {
|
|
6051
6055
|
user_id: i,
|
|
6052
|
-
tenant_scope:
|
|
6056
|
+
tenant_scope: Re(e, "tenant_scope", "tenantScope") ?? n,
|
|
6053
6057
|
status: o,
|
|
6054
|
-
ts:
|
|
6058
|
+
ts: Re(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6055
6059
|
}, l = e.tenant_id ?? e.tenantId;
|
|
6056
6060
|
typeof l == "string" ? c.tenant_id = l : l === null && (c.tenant_id = null);
|
|
6057
6061
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
@@ -6060,7 +6064,7 @@ function ka(e, n) {
|
|
|
6060
6064
|
function La(e) {
|
|
6061
6065
|
if (!se(e))
|
|
6062
6066
|
return null;
|
|
6063
|
-
const n =
|
|
6067
|
+
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
6064
6068
|
if (!n || !i)
|
|
6065
6069
|
return null;
|
|
6066
6070
|
const o = e.user, c = se(o) ? {
|
|
@@ -6081,7 +6085,7 @@ function La(e) {
|
|
|
6081
6085
|
function Ia(e) {
|
|
6082
6086
|
if (!se(e))
|
|
6083
6087
|
return null;
|
|
6084
|
-
const n =
|
|
6088
|
+
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
6085
6089
|
if (!n || !i)
|
|
6086
6090
|
return null;
|
|
6087
6091
|
const o = se(e.user) ? {
|
|
@@ -6100,7 +6104,7 @@ function Ia(e) {
|
|
|
6100
6104
|
function Ua(e) {
|
|
6101
6105
|
if (!se(e))
|
|
6102
6106
|
return null;
|
|
6103
|
-
const n =
|
|
6107
|
+
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
6104
6108
|
return !n || !i ? null : {
|
|
6105
6109
|
user_id: n,
|
|
6106
6110
|
conversation_id: i,
|
|
@@ -6144,48 +6148,48 @@ function Oe(e, n, i, o) {
|
|
|
6144
6148
|
function oc(e) {
|
|
6145
6149
|
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
6150
|
typeof window < "u" && (window.Pusher = ya);
|
|
6147
|
-
let d = null, g = null, h = null, x = null, M = "disconnected",
|
|
6148
|
-
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (
|
|
6149
|
-
M =
|
|
6151
|
+
let d = null, g = null, h = null, x = null, M = "disconnected", y = "available", C = null, b = null;
|
|
6152
|
+
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (R) => {
|
|
6153
|
+
M = R;
|
|
6150
6154
|
for (const P of T)
|
|
6151
|
-
P(
|
|
6152
|
-
}, v = (
|
|
6153
|
-
|
|
6155
|
+
P(R);
|
|
6156
|
+
}, v = (R) => {
|
|
6157
|
+
y = R;
|
|
6154
6158
|
for (const P of w)
|
|
6155
|
-
P(
|
|
6159
|
+
P(R);
|
|
6156
6160
|
}, N = () => {
|
|
6157
6161
|
b !== null && (clearTimeout(b), b = null);
|
|
6158
|
-
}, q = (
|
|
6159
|
-
h !== null && (h.disconnect(), h = null), x = null,
|
|
6162
|
+
}, q = (R = !0) => {
|
|
6163
|
+
h !== null && (h.disconnect(), h = null), x = null, R && m("disconnected");
|
|
6160
6164
|
}, G = () => {
|
|
6161
6165
|
N(), d = null, g = null, C = null, v("available"), q(), f.clear();
|
|
6162
6166
|
}, k = () => {
|
|
6163
6167
|
if (!e.getSourceToken)
|
|
6164
6168
|
return null;
|
|
6165
|
-
const
|
|
6166
|
-
return
|
|
6167
|
-
}, O = (
|
|
6168
|
-
if (
|
|
6169
|
+
const R = e.getSourceToken();
|
|
6170
|
+
return R === null ? (G(), null) : (C !== null && C !== R && (N(), d = null, g = null, v("available"), q()), C = R, R);
|
|
6171
|
+
}, O = (R) => {
|
|
6172
|
+
if (R === null)
|
|
6169
6173
|
return !1;
|
|
6170
|
-
if (
|
|
6171
|
-
return
|
|
6172
|
-
const P = Date.parse(
|
|
6174
|
+
if (R.auth.expiresAt === null)
|
|
6175
|
+
return R.auth.token !== "";
|
|
6176
|
+
const P = Date.parse(R.auth.expiresAt);
|
|
6173
6177
|
return Number.isNaN(P) ? !1 : P - Date.now() > o;
|
|
6174
|
-
}, H = (
|
|
6175
|
-
if (N(),
|
|
6178
|
+
}, H = (R) => {
|
|
6179
|
+
if (N(), R.auth.expiresAt === null)
|
|
6176
6180
|
return;
|
|
6177
|
-
const P = Date.parse(
|
|
6181
|
+
const P = Date.parse(R.auth.expiresAt);
|
|
6178
6182
|
if (Number.isNaN(P))
|
|
6179
6183
|
return;
|
|
6180
6184
|
const D = Math.max(0, P - Date.now() - o);
|
|
6181
6185
|
b = setTimeout(() => {
|
|
6182
6186
|
J();
|
|
6183
6187
|
}, D);
|
|
6184
|
-
}, F = async (
|
|
6188
|
+
}, F = async (R = !1) => e.getSourceToken && k() === null || !R && y === "account_suspended" ? null : !R && O(d) ? d : !R && g !== null ? await g : (g = (async () => {
|
|
6185
6189
|
try {
|
|
6186
6190
|
const D = await e.bootstrapClient.get(
|
|
6187
6191
|
i,
|
|
6188
|
-
|
|
6192
|
+
R ? { params: { refresh: 1 } } : void 0
|
|
6189
6193
|
), X = Ra(D.data);
|
|
6190
6194
|
return d = X, v("available"), H(X), X;
|
|
6191
6195
|
} catch (D) {
|
|
@@ -6196,16 +6200,16 @@ function oc(e) {
|
|
|
6196
6200
|
})().finally(() => {
|
|
6197
6201
|
g = null;
|
|
6198
6202
|
}), await g), J = async () => {
|
|
6199
|
-
const
|
|
6203
|
+
const R = h !== null;
|
|
6200
6204
|
try {
|
|
6201
|
-
if (await F(!0), !
|
|
6205
|
+
if (await F(!0), !R)
|
|
6202
6206
|
return;
|
|
6203
|
-
q(!1), await
|
|
6207
|
+
q(!1), await te(!0);
|
|
6204
6208
|
} catch (P) {
|
|
6205
6209
|
l.warn("Failed to refresh messenger bootstrap", P);
|
|
6206
6210
|
}
|
|
6207
|
-
}, me = (
|
|
6208
|
-
const P =
|
|
6211
|
+
}, me = (R) => {
|
|
6212
|
+
const P = R.connector?.pusher?.connection;
|
|
6209
6213
|
if (!P) {
|
|
6210
6214
|
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6211
6215
|
return;
|
|
@@ -6232,8 +6236,8 @@ function oc(e) {
|
|
|
6232
6236
|
}
|
|
6233
6237
|
(X === "unavailable" || X === "failed" || X === "disconnected") && m("disconnected");
|
|
6234
6238
|
}), P.state === "connected" && m("connected");
|
|
6235
|
-
},
|
|
6236
|
-
const D = await F(
|
|
6239
|
+
}, te = async (R = !1) => !R && h !== null && O(d) ? h : !R && x !== null ? await x : (x = (async () => {
|
|
6240
|
+
const D = await F(R);
|
|
6237
6241
|
if (D === null)
|
|
6238
6242
|
return null;
|
|
6239
6243
|
h !== null && q(!1);
|
|
@@ -6258,7 +6262,7 @@ function oc(e) {
|
|
|
6258
6262
|
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new ga(Y), me(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6259
6263
|
})().finally(() => {
|
|
6260
6264
|
x = null;
|
|
6261
|
-
}), await x),
|
|
6265
|
+
}), await x), _ = $t.create({
|
|
6262
6266
|
timeout: e.requestTimeoutMs ?? Ca,
|
|
6263
6267
|
withCredentials: !1,
|
|
6264
6268
|
headers: {
|
|
@@ -6266,35 +6270,33 @@ function oc(e) {
|
|
|
6266
6270
|
"X-Requested-With": "XMLHttpRequest"
|
|
6267
6271
|
}
|
|
6268
6272
|
});
|
|
6269
|
-
|
|
6273
|
+
_.interceptors.request.use(async (R) => {
|
|
6270
6274
|
const P = await F();
|
|
6271
6275
|
if (P === null)
|
|
6272
6276
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6273
|
-
return
|
|
6274
|
-
}),
|
|
6275
|
-
(
|
|
6276
|
-
async (
|
|
6277
|
-
const P =
|
|
6278
|
-
if (
|
|
6277
|
+
return R.baseURL = P.service.apiBaseUrl, Vn(R, P.auth.token), R;
|
|
6278
|
+
}), _.interceptors.response.use(
|
|
6279
|
+
(R) => R,
|
|
6280
|
+
async (R) => {
|
|
6281
|
+
const P = R.config;
|
|
6282
|
+
if (R.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6279
6283
|
P._messengerRetry = !0;
|
|
6280
6284
|
const D = await F(!0);
|
|
6281
6285
|
if (D !== null)
|
|
6282
|
-
return P.baseURL = D.service.apiBaseUrl, Vn(P, D.auth.token), await
|
|
6286
|
+
return P.baseURL = D.service.apiBaseUrl, Vn(P, D.auth.token), await _(P);
|
|
6283
6287
|
}
|
|
6284
|
-
return Promise.reject(
|
|
6288
|
+
return Promise.reject(R);
|
|
6285
6289
|
}
|
|
6286
6290
|
);
|
|
6287
|
-
const I = () =>
|
|
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;
|
|
6291
|
+
const I = () => y === "account_suspended" ? null : h, ae = (R) => (T.add(R), R(M), () => {
|
|
6292
|
+
T.delete(R);
|
|
6293
|
+
}), B = (R) => (w.add(R), R(y), () => {
|
|
6294
|
+
w.delete(R);
|
|
6295
|
+
}), E = () => d?.auth.tenantId ?? "global", V = (R) => {
|
|
6296
|
+
const P = qt(R.ts)?.getTime() ?? qt(R.last_seen_at)?.getTime() ?? null;
|
|
6295
6297
|
if (P === null)
|
|
6296
6298
|
return !0;
|
|
6297
|
-
const D = `${
|
|
6299
|
+
const D = `${R.tenant_scope ?? "global"}:${R.user_id}`, X = f.get(D);
|
|
6298
6300
|
if (X && P < X.timestampMs)
|
|
6299
6301
|
return !1;
|
|
6300
6302
|
const Y = Date.now();
|
|
@@ -6305,11 +6307,11 @@ function oc(e) {
|
|
|
6305
6307
|
for (const [ge, we] of f.entries())
|
|
6306
6308
|
Y - we.seenAt > c && f.delete(ge);
|
|
6307
6309
|
return !0;
|
|
6308
|
-
}, ne = (
|
|
6310
|
+
}, ne = (R) => {
|
|
6309
6311
|
const P = I();
|
|
6310
6312
|
if (!P || typeof P.join != "function")
|
|
6311
6313
|
return;
|
|
6312
|
-
const D = P.join(`online-users.${
|
|
6314
|
+
const D = P.join(`online-users.${E()}`), X = [
|
|
6313
6315
|
".PresenceStatusChanged",
|
|
6314
6316
|
"PresenceStatusChanged",
|
|
6315
6317
|
".presence.status.changed",
|
|
@@ -6321,17 +6323,17 @@ function oc(e) {
|
|
|
6321
6323
|
];
|
|
6322
6324
|
for (const Y of X)
|
|
6323
6325
|
D.listen(Y, (ge) => {
|
|
6324
|
-
const we = ka(ge,
|
|
6325
|
-
!we || !V(we) ||
|
|
6326
|
+
const we = ka(ge, E());
|
|
6327
|
+
!we || !V(we) || R(we);
|
|
6326
6328
|
});
|
|
6327
6329
|
}, _e = () => {
|
|
6328
|
-
h?.leave(`online-users.${
|
|
6329
|
-
},
|
|
6330
|
+
h?.leave(`online-users.${E()}`);
|
|
6331
|
+
}, A = (R, P) => {
|
|
6330
6332
|
const D = I();
|
|
6331
6333
|
if (!D)
|
|
6332
6334
|
return () => {
|
|
6333
6335
|
};
|
|
6334
|
-
const X = D.private(`conversation.${
|
|
6336
|
+
const X = D.private(`conversation.${R}`), Y = [];
|
|
6335
6337
|
return P.onMessageSent && Y.push({
|
|
6336
6338
|
event: ".ConversationMessageSent",
|
|
6337
6339
|
handler: Oe(X, ".ConversationMessageSent", Na, P.onMessageSent)
|
|
@@ -6358,10 +6360,10 @@ function oc(e) {
|
|
|
6358
6360
|
for (const ge of Y)
|
|
6359
6361
|
X.stopListening(ge.event, ge.handler);
|
|
6360
6362
|
};
|
|
6361
|
-
}, U = (
|
|
6362
|
-
h?.leave(`conversation.${
|
|
6363
|
-
}, re = (
|
|
6364
|
-
const X =
|
|
6363
|
+
}, U = (R) => {
|
|
6364
|
+
h?.leave(`conversation.${R}`);
|
|
6365
|
+
}, re = (R, P, D) => {
|
|
6366
|
+
const X = R.private(`typing-conversation.${P}`), Y = [], ge = [
|
|
6365
6367
|
".TypingStateChanged",
|
|
6366
6368
|
"TypingStateChanged",
|
|
6367
6369
|
".typing.changed",
|
|
@@ -6372,8 +6374,8 @@ function oc(e) {
|
|
|
6372
6374
|
"Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged"
|
|
6373
6375
|
], we = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], Ke = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Qe = /* @__PURE__ */ new Set(["start", "typing"]), ft = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6374
6376
|
for (const ye of ge) {
|
|
6375
|
-
const Ce = (
|
|
6376
|
-
const K = La(
|
|
6377
|
+
const Ce = (ke) => {
|
|
6378
|
+
const K = La(ke);
|
|
6377
6379
|
if (K) {
|
|
6378
6380
|
if (Qe.has(K.state)) {
|
|
6379
6381
|
D.onTypingStart?.({
|
|
@@ -6397,8 +6399,8 @@ function oc(e) {
|
|
|
6397
6399
|
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6398
6400
|
}
|
|
6399
6401
|
for (const ye of we) {
|
|
6400
|
-
const Ce = (
|
|
6401
|
-
const K = Ia(
|
|
6402
|
+
const Ce = (ke) => {
|
|
6403
|
+
const K = Ia(ke);
|
|
6402
6404
|
if (!K)
|
|
6403
6405
|
return;
|
|
6404
6406
|
const qe = {
|
|
@@ -6416,8 +6418,8 @@ function oc(e) {
|
|
|
6416
6418
|
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6417
6419
|
}
|
|
6418
6420
|
for (const ye of Ke) {
|
|
6419
|
-
const Ce = (
|
|
6420
|
-
const K = Ua(
|
|
6421
|
+
const Ce = (ke) => {
|
|
6422
|
+
const K = Ua(ke);
|
|
6421
6423
|
if (!K)
|
|
6422
6424
|
return;
|
|
6423
6425
|
const qe = {
|
|
@@ -6434,36 +6436,36 @@ function oc(e) {
|
|
|
6434
6436
|
for (const ye of Y)
|
|
6435
6437
|
X.stopListening(ye.event, ye.handler);
|
|
6436
6438
|
};
|
|
6437
|
-
}, fe = (
|
|
6439
|
+
}, fe = (R, P) => {
|
|
6438
6440
|
const D = I();
|
|
6439
6441
|
if (D)
|
|
6440
|
-
return re(D,
|
|
6442
|
+
return re(D, R, P);
|
|
6441
6443
|
let X = !1, Y = null;
|
|
6442
6444
|
return Je().then((ge) => {
|
|
6443
|
-
X || !ge || (Y = re(ge,
|
|
6445
|
+
X || !ge || (Y = re(ge, R, P));
|
|
6444
6446
|
}).catch((ge) => {
|
|
6445
6447
|
l.warn("Failed to defer typing subscription", ge);
|
|
6446
6448
|
}), () => {
|
|
6447
6449
|
X = !0, Y?.();
|
|
6448
6450
|
};
|
|
6449
|
-
}, ue = (
|
|
6450
|
-
h?.leave(`typing-conversation.${
|
|
6451
|
+
}, ue = (R) => {
|
|
6452
|
+
h?.leave(`typing-conversation.${R}`);
|
|
6451
6453
|
}, pe = async () => {
|
|
6452
|
-
v("available"), q(), await
|
|
6453
|
-
}, Je = async () =>
|
|
6454
|
+
v("available"), q(), await te(!0);
|
|
6455
|
+
}, Je = async () => y === "account_suspended" ? null : await te();
|
|
6454
6456
|
return {
|
|
6455
|
-
apiClient:
|
|
6457
|
+
apiClient: _,
|
|
6456
6458
|
initializedEvent: n,
|
|
6457
6459
|
getEcho: I,
|
|
6458
6460
|
waitForEcho: Je,
|
|
6459
6461
|
getConnectionStatus: () => M,
|
|
6460
|
-
getAccessState: () =>
|
|
6462
|
+
getAccessState: () => y,
|
|
6461
6463
|
onConnectionStatusChange: ae,
|
|
6462
6464
|
onAccessStateChange: B,
|
|
6463
6465
|
reconnect: pe,
|
|
6464
6466
|
subscribeToPresenceStatus: ne,
|
|
6465
6467
|
unsubscribeFromPresenceStatus: _e,
|
|
6466
|
-
subscribeToConversation:
|
|
6468
|
+
subscribeToConversation: A,
|
|
6467
6469
|
unsubscribeFromConversation: U,
|
|
6468
6470
|
subscribeToTyping: fe,
|
|
6469
6471
|
unsubscribeFromTyping: ue,
|
|
@@ -6477,12 +6479,12 @@ export {
|
|
|
6477
6479
|
W as getApi,
|
|
6478
6480
|
Fe as getAuthStore,
|
|
6479
6481
|
Tn as getConnectionStatus,
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
+
Ae as getEcho,
|
|
6483
|
+
rs as getEchoConnectionStatus,
|
|
6482
6484
|
We as getEchoInitializedEvent,
|
|
6483
6485
|
Z as getErrorMessage,
|
|
6484
6486
|
Kt as getLoggerFactory,
|
|
6485
|
-
|
|
6487
|
+
gs as getMainApi,
|
|
6486
6488
|
yo as getMainEcho,
|
|
6487
6489
|
_o as getMainEchoConnectionStatus,
|
|
6488
6490
|
bo as getMainEchoInitializedEvent,
|
|
@@ -6499,9 +6501,9 @@ export {
|
|
|
6499
6501
|
Oi as isValidMessageSentEvent,
|
|
6500
6502
|
qi as isValidReactionToggledEvent,
|
|
6501
6503
|
zi as isValidRequestAcceptedEvent,
|
|
6502
|
-
|
|
6504
|
+
Pe as messagingApi,
|
|
6503
6505
|
Uo as normalizePresenceStatus,
|
|
6504
|
-
|
|
6506
|
+
ms as normalizePresenceTimestamp,
|
|
6505
6507
|
ht as onConnectionStatusChange,
|
|
6506
6508
|
So as onMainEchoConnectionStatusChange,
|
|
6507
6509
|
Ei as onMessagingAccessStateChange,
|
|
@@ -6540,5 +6542,5 @@ export {
|
|
|
6540
6542
|
Gt as useMessagingStore,
|
|
6541
6543
|
nc as usePresence,
|
|
6542
6544
|
sc as useTypingChannel,
|
|
6543
|
-
|
|
6545
|
+
ss as waitForEcho
|
|
6544
6546
|
};
|