@codingfactory/messenger-client 0.2.2 → 0.2.4
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 +1080 -1065
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ref as de, getCurrentInstance as
|
|
1
|
+
import { ref as de, getCurrentInstance as Mt, computed as re, watch as Rt, onUnmounted as qe, toValue as Ln, onMounted as Un } from "vue";
|
|
2
2
|
import { defineStore as ci, storeToRefs as ui } from "pinia";
|
|
3
|
-
import
|
|
3
|
+
import kt, { isAxiosError as li, AxiosHeaders as pn } from "axios";
|
|
4
4
|
import { isAxiosError as Ha } from "axios";
|
|
5
5
|
import { useRoute as hi } from "vue-router";
|
|
6
6
|
const On = () => () => {
|
|
@@ -13,7 +13,7 @@ const On = () => () => {
|
|
|
13
13
|
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
14
14
|
}, $n = () => {
|
|
15
15
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
16
|
-
},
|
|
16
|
+
}, J = {
|
|
17
17
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
18
18
|
getEcho: () => null,
|
|
19
19
|
getConnectionStatus: () => "disconnected",
|
|
@@ -25,14 +25,14 @@ const On = () => () => {
|
|
|
25
25
|
unsubscribeFromConversation: qn,
|
|
26
26
|
subscribeToTyping: $n,
|
|
27
27
|
unsubscribeFromTyping: zn
|
|
28
|
-
}, De = () =>
|
|
29
|
-
await
|
|
30
|
-
}, fi = (e) =>
|
|
28
|
+
}, De = () => J.ECHO_INITIALIZED_EVENT, Ae = () => J.getEcho(), Hn = () => J.getConnectionStatus(), Ma = () => Hn(), it = (e) => J.onConnectionStatusChange(e), di = async () => {
|
|
29
|
+
await J.reconnect();
|
|
30
|
+
}, fi = (e) => J.subscribeToPresenceStatus(e), pi = () => J.unsubscribeFromPresenceStatus(), gi = (e, n) => J.subscribeToConversation(e, n), mi = (e) => J.unsubscribeFromConversation(e), vi = (e, n) => J.subscribeToTyping(e, n), bi = (e) => J.unsubscribeFromTyping(e);
|
|
31
31
|
function yi(e) {
|
|
32
|
-
e.initializedEvent && (
|
|
32
|
+
e.initializedEvent && (J.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (J.getEcho = e.getEcho), e.getConnectionStatus && (J.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (J.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (J.reconnect = e.reconnect), e.subscribeToPresenceStatus && (J.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (J.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (J.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (J.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (J.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (J.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
33
33
|
}
|
|
34
34
|
function _i() {
|
|
35
|
-
|
|
35
|
+
J.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", J.getEcho = () => null, J.getConnectionStatus = () => "disconnected", J.onConnectionStatusChange = On, J.reconnect = Nn, J.subscribeToPresenceStatus = Fn, J.unsubscribeFromPresenceStatus = Dn, J.subscribeToConversation = jn, J.unsubscribeFromConversation = qn, J.subscribeToTyping = $n, J.unsubscribeFromTyping = zn;
|
|
36
36
|
}
|
|
37
37
|
function tt(e) {
|
|
38
38
|
return typeof e == "object" && e !== null;
|
|
@@ -46,31 +46,31 @@ function wi(e) {
|
|
|
46
46
|
function Ci(e) {
|
|
47
47
|
return tt(e) && typeof e.conversation_id == "string";
|
|
48
48
|
}
|
|
49
|
-
const Bn =
|
|
50
|
-
let
|
|
51
|
-
function
|
|
52
|
-
return
|
|
49
|
+
const Bn = kt;
|
|
50
|
+
let It = Bn;
|
|
51
|
+
function W() {
|
|
52
|
+
return It;
|
|
53
53
|
}
|
|
54
54
|
function Ti(e) {
|
|
55
|
-
|
|
55
|
+
It = e;
|
|
56
56
|
}
|
|
57
57
|
function Ei() {
|
|
58
|
-
|
|
58
|
+
It = Bn;
|
|
59
59
|
}
|
|
60
60
|
const Vn = {
|
|
61
61
|
currentUser: null
|
|
62
62
|
};
|
|
63
|
-
let
|
|
63
|
+
let Lt = () => Vn;
|
|
64
64
|
function Pe() {
|
|
65
|
-
return
|
|
65
|
+
return Lt;
|
|
66
66
|
}
|
|
67
67
|
function Ri(e) {
|
|
68
|
-
|
|
68
|
+
Lt = e;
|
|
69
69
|
}
|
|
70
70
|
function Ai() {
|
|
71
|
-
|
|
71
|
+
Lt = () => Vn;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Z(e) {
|
|
74
74
|
if (li(e)) {
|
|
75
75
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
76
76
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
@@ -88,15 +88,15 @@ const Xn = {
|
|
|
88
88
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
let
|
|
91
|
+
let Ut = Xn;
|
|
92
92
|
function Pi() {
|
|
93
|
-
return
|
|
93
|
+
return Ut;
|
|
94
94
|
}
|
|
95
95
|
function xi(e) {
|
|
96
|
-
|
|
96
|
+
Ut = e;
|
|
97
97
|
}
|
|
98
98
|
function Mi() {
|
|
99
|
-
|
|
99
|
+
Ut = Xn;
|
|
100
100
|
}
|
|
101
101
|
function ki(e) {
|
|
102
102
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
@@ -132,7 +132,7 @@ function _t(e, n) {
|
|
|
132
132
|
}
|
|
133
133
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function At(e) {
|
|
136
136
|
if (!Wn(e))
|
|
137
137
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
138
138
|
return {
|
|
@@ -150,7 +150,7 @@ function Rt(e) {
|
|
|
150
150
|
function Ii(e) {
|
|
151
151
|
if (!Array.isArray(e))
|
|
152
152
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
153
|
-
return e.map((n) =>
|
|
153
|
+
return e.map((n) => At(n));
|
|
154
154
|
}
|
|
155
155
|
function mn(e) {
|
|
156
156
|
if (!ki(e))
|
|
@@ -159,37 +159,37 @@ function mn(e) {
|
|
|
159
159
|
}
|
|
160
160
|
const Se = {
|
|
161
161
|
async fetchFolders() {
|
|
162
|
-
const e = await
|
|
162
|
+
const e = await W().get("/v1/messaging/folders");
|
|
163
163
|
return Ii(Le(e.data));
|
|
164
164
|
},
|
|
165
165
|
async createFolder(e) {
|
|
166
|
-
const n = await
|
|
167
|
-
return
|
|
166
|
+
const n = await W().post("/v1/messaging/folders", e);
|
|
167
|
+
return At(Le(n.data));
|
|
168
168
|
},
|
|
169
169
|
async updateFolder(e, n) {
|
|
170
|
-
const i = await
|
|
171
|
-
return
|
|
170
|
+
const i = await W().patch(`/v1/messaging/folders/${e}`, n);
|
|
171
|
+
return At(Le(i.data));
|
|
172
172
|
},
|
|
173
173
|
async deleteFolder(e) {
|
|
174
|
-
await
|
|
174
|
+
await W().delete(`/v1/messaging/folders/${e}`);
|
|
175
175
|
},
|
|
176
176
|
async reorderFolders(e) {
|
|
177
|
-
await
|
|
177
|
+
await W().patch("/v1/messaging/folders/reorder", { order: e });
|
|
178
178
|
},
|
|
179
179
|
async assignFolder(e, n) {
|
|
180
|
-
const i = await
|
|
180
|
+
const i = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
181
181
|
folder_id: n
|
|
182
182
|
});
|
|
183
183
|
return mn(Le(i.data));
|
|
184
184
|
},
|
|
185
185
|
async acceptRequest(e) {
|
|
186
|
-
const n = await
|
|
186
|
+
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
187
187
|
return mn(Le(n.data));
|
|
188
188
|
},
|
|
189
189
|
async declineRequest(e) {
|
|
190
|
-
await
|
|
190
|
+
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
191
191
|
}
|
|
192
|
-
}, vn = 1e3,
|
|
192
|
+
}, vn = 1e3, Ot = 4e3, Li = 12e4, Ui = 300, Oi = 1, Ni = 1600, Nt = (e) => {
|
|
193
193
|
if (typeof e == "number" && Number.isFinite(e))
|
|
194
194
|
return e;
|
|
195
195
|
if (typeof e == "string") {
|
|
@@ -198,7 +198,7 @@ const Se = {
|
|
|
198
198
|
return n;
|
|
199
199
|
}
|
|
200
200
|
}, Gn = (e) => typeof e == "number" && e >= 500 && e < 600, bn = (e) => {
|
|
201
|
-
const i =
|
|
201
|
+
const i = Nt(e.response?.status);
|
|
202
202
|
return i === void 0 ? !0 : i === 429 || Gn(i);
|
|
203
203
|
}, Jn = (e) => {
|
|
204
204
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
@@ -208,13 +208,13 @@ const Se = {
|
|
|
208
208
|
if (Number.isFinite(n) && n > 0)
|
|
209
209
|
return Math.max(vn, n * 1e3);
|
|
210
210
|
}
|
|
211
|
-
return
|
|
211
|
+
return Ot;
|
|
212
212
|
}, Fi = (e) => {
|
|
213
|
-
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o =
|
|
213
|
+
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Ot * i;
|
|
214
214
|
return Math.min(Li, o);
|
|
215
215
|
}, Di = (e) => {
|
|
216
216
|
const n = e;
|
|
217
|
-
return
|
|
217
|
+
return Nt(n.response?.status) === 429 ? Jn(n.response?.headers?.["retry-after"]) : Ui;
|
|
218
218
|
}, yn = async (e) => {
|
|
219
219
|
await new Promise((n) => {
|
|
220
220
|
setTimeout(n, e);
|
|
@@ -311,7 +311,7 @@ function _n(e) {
|
|
|
311
311
|
if (!(typeof e != "string" || e.length === 0))
|
|
312
312
|
return e;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Pt(e) {
|
|
315
315
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
316
316
|
}
|
|
317
317
|
function Xi(e, n = []) {
|
|
@@ -379,10 +379,10 @@ function Sn(e, n) {
|
|
|
379
379
|
if (Array.isArray(i))
|
|
380
380
|
for (let o = i.length - 1; o >= 0; o -= 1) {
|
|
381
381
|
const u = i[o]?.id;
|
|
382
|
-
if (
|
|
382
|
+
if (Pt(u))
|
|
383
383
|
return u;
|
|
384
384
|
}
|
|
385
|
-
return
|
|
385
|
+
return Pt(e.last_message?.id) ? e.last_message.id : null;
|
|
386
386
|
}
|
|
387
387
|
function he(e) {
|
|
388
388
|
return typeof e == "object" && e !== null;
|
|
@@ -462,7 +462,7 @@ function wt(e) {
|
|
|
462
462
|
i.is_request === !0 && n.set(i.id, i);
|
|
463
463
|
return Array.from(n.values()).sort(et);
|
|
464
464
|
}
|
|
465
|
-
const
|
|
465
|
+
const Ft = ci("messaging", {
|
|
466
466
|
state: () => ({
|
|
467
467
|
conversations: [],
|
|
468
468
|
requests: [],
|
|
@@ -514,7 +514,7 @@ const Nt = ci("messaging", {
|
|
|
514
514
|
const e = await Se.fetchFolders();
|
|
515
515
|
return this.folders = Oe(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
516
516
|
} catch (e) {
|
|
517
|
-
throw this.error =
|
|
517
|
+
throw this.error = Z(e), e;
|
|
518
518
|
}
|
|
519
519
|
},
|
|
520
520
|
async createFolder(e) {
|
|
@@ -522,7 +522,7 @@ const Nt = ci("messaging", {
|
|
|
522
522
|
const n = await Se.createFolder(e);
|
|
523
523
|
return this.folders = Oe([...this.folders, n]), n;
|
|
524
524
|
} catch (n) {
|
|
525
|
-
throw this.error =
|
|
525
|
+
throw this.error = Z(n), n;
|
|
526
526
|
}
|
|
527
527
|
},
|
|
528
528
|
async updateFolder(e, n) {
|
|
@@ -532,14 +532,14 @@ const Nt = ci("messaging", {
|
|
|
532
532
|
this.folders.map((o) => o.id === e ? i : o)
|
|
533
533
|
), i;
|
|
534
534
|
} catch (i) {
|
|
535
|
-
throw this.error =
|
|
535
|
+
throw this.error = Z(i), i;
|
|
536
536
|
}
|
|
537
537
|
},
|
|
538
538
|
async deleteFolder(e) {
|
|
539
539
|
try {
|
|
540
540
|
await Se.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
541
541
|
} catch (n) {
|
|
542
|
-
throw this.error =
|
|
542
|
+
throw this.error = Z(n), n;
|
|
543
543
|
}
|
|
544
544
|
},
|
|
545
545
|
async reorderFolders(e) {
|
|
@@ -561,7 +561,7 @@ const Nt = ci("messaging", {
|
|
|
561
561
|
});
|
|
562
562
|
this.folders = i;
|
|
563
563
|
} catch (n) {
|
|
564
|
-
throw this.error =
|
|
564
|
+
throw this.error = Z(n), n;
|
|
565
565
|
}
|
|
566
566
|
},
|
|
567
567
|
async assignToFolder(e, n) {
|
|
@@ -578,7 +578,7 @@ const Nt = ci("messaging", {
|
|
|
578
578
|
folder_id: l
|
|
579
579
|
};
|
|
580
580
|
} catch (i) {
|
|
581
|
-
throw this.error =
|
|
581
|
+
throw this.error = Z(i), i;
|
|
582
582
|
}
|
|
583
583
|
},
|
|
584
584
|
async fetchConversations(e, n, i, o) {
|
|
@@ -586,14 +586,14 @@ const Nt = ci("messaging", {
|
|
|
586
586
|
try {
|
|
587
587
|
const u = o?.includePresence ?? !0, l = {};
|
|
588
588
|
u && (l.include_presence = 1), e && (l.cursor = e), n && (l.filter = n), typeof i == "string" && i.length > 0 && (l.folder_id = i);
|
|
589
|
-
const h = await
|
|
589
|
+
const h = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: d } = Je(
|
|
590
590
|
h.data,
|
|
591
591
|
"conversations"
|
|
592
|
-
), A = g.map((
|
|
593
|
-
const
|
|
594
|
-
(
|
|
592
|
+
), A = g.map((v) => {
|
|
593
|
+
const w = this.conversations.find(
|
|
594
|
+
(R) => R.id === v.id
|
|
595
595
|
);
|
|
596
|
-
return Ue(
|
|
596
|
+
return Ue(v, w);
|
|
597
597
|
});
|
|
598
598
|
e ? this.conversations.push(...A) : this.conversations = A, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
599
599
|
const x = {
|
|
@@ -602,7 +602,7 @@ const Nt = ci("messaging", {
|
|
|
602
602
|
};
|
|
603
603
|
return d !== void 0 && (x.next_cursor = d), x;
|
|
604
604
|
} catch (u) {
|
|
605
|
-
throw o?.background && bn(u) || (this.error =
|
|
605
|
+
throw o?.background && bn(u) || (this.error = Z(u)), u;
|
|
606
606
|
} finally {
|
|
607
607
|
this.loading = !1;
|
|
608
608
|
}
|
|
@@ -616,21 +616,21 @@ const Nt = ci("messaging", {
|
|
|
616
616
|
includePresence: !1
|
|
617
617
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
618
618
|
} catch (e) {
|
|
619
|
-
const n = e, i =
|
|
620
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Jn(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || Gn(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Fi(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
619
|
+
const n = e, i = Nt(n.response?.status);
|
|
620
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Jn(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || Gn(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Fi(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Ot, !1));
|
|
621
621
|
}
|
|
622
622
|
},
|
|
623
623
|
async fetchConversation(e) {
|
|
624
624
|
this.loading = !0, this.error = null;
|
|
625
625
|
try {
|
|
626
|
-
const n = await
|
|
626
|
+
const n = await W().get(`/v1/messaging/conversations/${e}`, {
|
|
627
627
|
params: { include_presence: 1 }
|
|
628
628
|
}), i = this.conversations.find((h) => h.id === e), o = Ue(n.data.data || n.data, i), u = this.conversations.findIndex((h) => h.id === e);
|
|
629
629
|
u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
|
|
630
630
|
const l = this.requests.findIndex((h) => h.id === e);
|
|
631
631
|
return l >= 0 && (this.requests[l] = o), this.normalizeFolderAssignmentsState(), o;
|
|
632
632
|
} catch (n) {
|
|
633
|
-
throw this.error =
|
|
633
|
+
throw this.error = Z(n), n;
|
|
634
634
|
} finally {
|
|
635
635
|
this.loading = !1;
|
|
636
636
|
}
|
|
@@ -643,7 +643,7 @@ const Nt = ci("messaging", {
|
|
|
643
643
|
filter: "requests"
|
|
644
644
|
};
|
|
645
645
|
e && (n.cursor = e);
|
|
646
|
-
const i = await
|
|
646
|
+
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } = Je(
|
|
647
647
|
i.data,
|
|
648
648
|
"conversations"
|
|
649
649
|
), l = o.map((g) => {
|
|
@@ -657,7 +657,7 @@ const Nt = ci("messaging", {
|
|
|
657
657
|
};
|
|
658
658
|
return u !== void 0 && (h.next_cursor = u), h;
|
|
659
659
|
} catch (n) {
|
|
660
|
-
throw this.error =
|
|
660
|
+
throw this.error = Z(n), n;
|
|
661
661
|
} finally {
|
|
662
662
|
this.loading = !1;
|
|
663
663
|
}
|
|
@@ -669,23 +669,23 @@ const Nt = ci("messaging", {
|
|
|
669
669
|
let o = 0, u;
|
|
670
670
|
for (; ; )
|
|
671
671
|
try {
|
|
672
|
-
u = await
|
|
672
|
+
u = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
673
673
|
break;
|
|
674
|
-
} catch (
|
|
675
|
-
if (!(o < Oi && bn(
|
|
676
|
-
throw
|
|
677
|
-
o += 1, await yn(Di(
|
|
674
|
+
} catch (v) {
|
|
675
|
+
if (!(o < Oi && bn(v)))
|
|
676
|
+
throw v;
|
|
677
|
+
o += 1, await yn(Di(v));
|
|
678
678
|
}
|
|
679
679
|
const { items: l, nextCursor: h } = Je(
|
|
680
680
|
u.data,
|
|
681
681
|
"messages"
|
|
682
682
|
), g = l.map(Ze), d = [...g].reverse();
|
|
683
683
|
if (n ? this.messages[e] = [...d, ...this.messages[e] || []] : this.messages[e] = d, (() => {
|
|
684
|
-
const
|
|
685
|
-
return
|
|
684
|
+
const v = this.conversations.find((w) => w.id === e) ?? this.requests.find((w) => w.id === e);
|
|
685
|
+
return v ? !v.last_message || !v.last_message_at : !1;
|
|
686
686
|
})()) {
|
|
687
|
-
const
|
|
688
|
-
|
|
687
|
+
const v = this.messages[e]?.at(-1);
|
|
688
|
+
v && this.updateConversationLastMessage(e, v);
|
|
689
689
|
}
|
|
690
690
|
h ? (this.conversationCursors[e] = h, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
691
691
|
const x = {
|
|
@@ -694,7 +694,7 @@ const Nt = ci("messaging", {
|
|
|
694
694
|
};
|
|
695
695
|
return h !== void 0 && (x.next_cursor = h), x;
|
|
696
696
|
} catch (i) {
|
|
697
|
-
throw this.error =
|
|
697
|
+
throw this.error = Z(i), i;
|
|
698
698
|
} finally {
|
|
699
699
|
this.loadingMessages[e] = !1, this.loading = !1;
|
|
700
700
|
}
|
|
@@ -718,14 +718,14 @@ const Nt = ci("messaging", {
|
|
|
718
718
|
...A.handle ? { handle: A.handle } : {}
|
|
719
719
|
}), o != null && (x.reply_to_id = o), u != null && (x.reply_to = u), this.messages[e] || (this.messages[e] = []), this.messages[e].push(x), this._pendingSendIds.add(g);
|
|
720
720
|
try {
|
|
721
|
-
let
|
|
722
|
-
const
|
|
721
|
+
let v;
|
|
722
|
+
const w = {
|
|
723
723
|
body: n || "",
|
|
724
724
|
...o ? { reply_to_id: o } : {},
|
|
725
725
|
...d ? { shared_post_id: d } : {}
|
|
726
726
|
};
|
|
727
727
|
if (i && i.length > 0) {
|
|
728
|
-
const
|
|
728
|
+
const H = await Promise.all(
|
|
729
729
|
i.map(async (B) => {
|
|
730
730
|
const P = await Pi().uploadImage(B);
|
|
731
731
|
return {
|
|
@@ -735,31 +735,31 @@ const Nt = ci("messaging", {
|
|
|
735
735
|
};
|
|
736
736
|
})
|
|
737
737
|
);
|
|
738
|
-
|
|
739
|
-
...
|
|
740
|
-
attachments:
|
|
738
|
+
v = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
739
|
+
...w,
|
|
740
|
+
attachments: H
|
|
741
741
|
});
|
|
742
742
|
} else
|
|
743
|
-
|
|
744
|
-
...
|
|
743
|
+
v = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
744
|
+
...w,
|
|
745
745
|
type: "text"
|
|
746
746
|
});
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
const
|
|
747
|
+
const R = v.data.data || v.data, E = { ...x, ...R, attachments: R.attachments ?? x.attachments }, _ = Ze(E), f = this.messages[e], b = f.findIndex((H) => H.id === g);
|
|
748
|
+
b >= 0 && (f[b] = _), this._pendingSendIds.delete(g);
|
|
749
|
+
const y = _.id;
|
|
750
750
|
let F = 0;
|
|
751
|
-
for (let
|
|
752
|
-
const B = f[
|
|
753
|
-
B && B.id ===
|
|
751
|
+
for (let H = f.length - 1; H >= 0; H--) {
|
|
752
|
+
const B = f[H];
|
|
753
|
+
B && B.id === y && (F++, F > 1 && f.splice(H, 1));
|
|
754
754
|
}
|
|
755
|
-
return this.updateConversationLastMessage(e,
|
|
756
|
-
} catch (
|
|
757
|
-
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((
|
|
755
|
+
return this.updateConversationLastMessage(e, _), _;
|
|
756
|
+
} catch (v) {
|
|
757
|
+
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((w) => w.id !== g), this.error = Z(v), v;
|
|
758
758
|
}
|
|
759
759
|
},
|
|
760
760
|
async editMessage(e, n, i) {
|
|
761
761
|
try {
|
|
762
|
-
const o = await
|
|
762
|
+
const o = await W().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
|
|
763
763
|
body: i
|
|
764
764
|
}), u = o.data.data || o.data, l = this.messages[e] || [], h = l.findIndex((g) => g.id === n);
|
|
765
765
|
if (h >= 0) {
|
|
@@ -768,12 +768,12 @@ const Nt = ci("messaging", {
|
|
|
768
768
|
}
|
|
769
769
|
return u;
|
|
770
770
|
} catch (o) {
|
|
771
|
-
throw this.error =
|
|
771
|
+
throw this.error = Z(o), o;
|
|
772
772
|
}
|
|
773
773
|
},
|
|
774
774
|
async deleteMessage(e, n) {
|
|
775
775
|
try {
|
|
776
|
-
await
|
|
776
|
+
await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
|
|
777
777
|
const i = this.messages[e] || [], o = i.findIndex((u) => u.id === n);
|
|
778
778
|
if (o >= 0) {
|
|
779
779
|
const u = i[o];
|
|
@@ -783,7 +783,7 @@ const Nt = ci("messaging", {
|
|
|
783
783
|
delete l.body, i[o] = l;
|
|
784
784
|
}
|
|
785
785
|
} catch (i) {
|
|
786
|
-
throw this.error =
|
|
786
|
+
throw this.error = Z(i), i;
|
|
787
787
|
}
|
|
788
788
|
},
|
|
789
789
|
async markAsRead(e) {
|
|
@@ -794,14 +794,14 @@ const Nt = ci("messaging", {
|
|
|
794
794
|
return null;
|
|
795
795
|
for (let l = u.length - 1; l >= 0; l -= 1) {
|
|
796
796
|
const h = u[l]?.id;
|
|
797
|
-
if (
|
|
797
|
+
if (Pt(h))
|
|
798
798
|
return h;
|
|
799
799
|
}
|
|
800
800
|
return null;
|
|
801
801
|
})(), o = n ? Sn(n, this.messages) : i;
|
|
802
802
|
if (!o)
|
|
803
803
|
return;
|
|
804
|
-
await
|
|
804
|
+
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
805
805
|
message_id: o
|
|
806
806
|
}), this.conversations.forEach((u) => {
|
|
807
807
|
u.id === e && (u.unread_count = 0);
|
|
@@ -809,7 +809,7 @@ const Nt = ci("messaging", {
|
|
|
809
809
|
u.id === e && (u.unread_count = 0);
|
|
810
810
|
});
|
|
811
811
|
} catch (n) {
|
|
812
|
-
throw this.error =
|
|
812
|
+
throw this.error = Z(n), n;
|
|
813
813
|
}
|
|
814
814
|
},
|
|
815
815
|
async markAllAsRead() {
|
|
@@ -827,7 +827,7 @@ const Nt = ci("messaging", {
|
|
|
827
827
|
return;
|
|
828
828
|
const i = await Promise.allSettled(
|
|
829
829
|
n.map(
|
|
830
|
-
(u) =>
|
|
830
|
+
(u) => W().post(`/v1/messaging/conversations/${u.conversationId}/read`, {
|
|
831
831
|
message_id: u.messageId
|
|
832
832
|
})
|
|
833
833
|
)
|
|
@@ -844,39 +844,39 @@ const Nt = ci("messaging", {
|
|
|
844
844
|
o === null && (o = u.reason);
|
|
845
845
|
}
|
|
846
846
|
}), o !== null)
|
|
847
|
-
throw this.error =
|
|
847
|
+
throw this.error = Z(o), o;
|
|
848
848
|
},
|
|
849
849
|
async sendTyping(e, n = "start") {
|
|
850
850
|
try {
|
|
851
|
-
const i = await
|
|
851
|
+
const i = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
852
852
|
if (n !== "start" || !qi(i.data))
|
|
853
853
|
return;
|
|
854
|
-
await yn(Ni), await
|
|
854
|
+
await yn(Ni), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
855
855
|
} catch (i) {
|
|
856
856
|
console.warn("Failed to send typing indicator:", i);
|
|
857
857
|
}
|
|
858
858
|
},
|
|
859
859
|
async muteConversation(e, n) {
|
|
860
860
|
try {
|
|
861
|
-
const i = { minutes: n }, o = await
|
|
861
|
+
const i = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, i), l = (o.data.data || o.data).muted_until || null, h = this.conversations.find((g) => g.id === e);
|
|
862
862
|
h && (h.is_muted = l !== null, h.muted_until = l);
|
|
863
863
|
} catch (i) {
|
|
864
|
-
throw this.error =
|
|
864
|
+
throw this.error = Z(i), i;
|
|
865
865
|
}
|
|
866
866
|
},
|
|
867
867
|
async unmuteConversation(e) {
|
|
868
868
|
try {
|
|
869
|
-
const n = await
|
|
869
|
+
const n = await W().patch(`/v1/messaging/conversations/${e}/mute`, {
|
|
870
870
|
minutes: 0
|
|
871
871
|
}), o = (n.data.data || n.data).muted_until || null, u = this.conversations.find((l) => l.id === e);
|
|
872
872
|
u && (u.is_muted = o !== null, u.muted_until = o);
|
|
873
873
|
} catch (n) {
|
|
874
|
-
throw this.error =
|
|
874
|
+
throw this.error = Z(n), n;
|
|
875
875
|
}
|
|
876
876
|
},
|
|
877
877
|
async updateConversationTitle(e, n) {
|
|
878
878
|
try {
|
|
879
|
-
const i = await
|
|
879
|
+
const i = await W().patch(`/v1/messaging/conversations/${e}`, {
|
|
880
880
|
title: n
|
|
881
881
|
}), o = i.data.data || i.data, u = typeof o?.title == "string" ? o.title : n, l = (h) => h.map((g) => g.id !== e ? g : {
|
|
882
882
|
...g,
|
|
@@ -884,30 +884,30 @@ const Nt = ci("messaging", {
|
|
|
884
884
|
});
|
|
885
885
|
this.conversations = l(this.conversations), this.requests = l(this.requests);
|
|
886
886
|
} catch (i) {
|
|
887
|
-
throw this.error =
|
|
887
|
+
throw this.error = Z(i), i;
|
|
888
888
|
}
|
|
889
889
|
},
|
|
890
890
|
async pinConversation(e, n) {
|
|
891
891
|
try {
|
|
892
|
-
await
|
|
892
|
+
await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
893
893
|
const i = this.conversations.find((o) => o.id === e);
|
|
894
894
|
i && (i.is_pinned = n), this.conversations.sort(et);
|
|
895
895
|
} catch (i) {
|
|
896
|
-
throw this.error =
|
|
896
|
+
throw this.error = Z(i), i;
|
|
897
897
|
}
|
|
898
898
|
},
|
|
899
899
|
async archiveConversation(e, n) {
|
|
900
900
|
try {
|
|
901
|
-
await
|
|
901
|
+
await W().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((i) => i.id !== e);
|
|
902
902
|
} catch (i) {
|
|
903
|
-
throw this.error =
|
|
903
|
+
throw this.error = Z(i), i;
|
|
904
904
|
}
|
|
905
905
|
},
|
|
906
906
|
async deleteConversation(e) {
|
|
907
907
|
try {
|
|
908
|
-
await
|
|
908
|
+
await W().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
909
909
|
} catch (n) {
|
|
910
|
-
throw this.error =
|
|
910
|
+
throw this.error = Z(n), n;
|
|
911
911
|
}
|
|
912
912
|
},
|
|
913
913
|
async createDMConversation(e, n) {
|
|
@@ -916,18 +916,18 @@ const Nt = ci("messaging", {
|
|
|
916
916
|
user_id: e
|
|
917
917
|
};
|
|
918
918
|
n && (i.message = n);
|
|
919
|
-
const o = await
|
|
919
|
+
const o = await W().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
|
|
920
920
|
if (!Cn(u))
|
|
921
921
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
922
922
|
const l = Tn(u) ? Ue(u) : await this.fetchConversation(u.id);
|
|
923
923
|
return l.is_request === !0 ? (this.requests = Ke(this.requests, l), this.conversations = this.conversations.filter((h) => h.id !== l.id), l) : (this.conversations = Ke(this.conversations, l), this.requests = this.requests.filter((h) => h.id !== l.id), l);
|
|
924
924
|
} catch (i) {
|
|
925
|
-
throw this.error =
|
|
925
|
+
throw this.error = Z(i), i;
|
|
926
926
|
}
|
|
927
927
|
},
|
|
928
928
|
async createGroupConversation(e, n) {
|
|
929
929
|
try {
|
|
930
|
-
const i = await
|
|
930
|
+
const i = await W().post("/v1/messaging/conversations/group", {
|
|
931
931
|
title: e,
|
|
932
932
|
participant_ids: n
|
|
933
933
|
}), o = i.data.data || i.data;
|
|
@@ -936,22 +936,22 @@ const Nt = ci("messaging", {
|
|
|
936
936
|
const u = Tn(o) ? o : await this.fetchConversation(o.id);
|
|
937
937
|
return this.conversations = Ke(this.conversations, u), u;
|
|
938
938
|
} catch (i) {
|
|
939
|
-
throw this.error =
|
|
939
|
+
throw this.error = Z(i), i;
|
|
940
940
|
}
|
|
941
941
|
},
|
|
942
942
|
async addParticipants(e, n) {
|
|
943
943
|
try {
|
|
944
|
-
await
|
|
944
|
+
await W().post(`/v1/messaging/conversations/${e}/participants`, {
|
|
945
945
|
user_ids: n
|
|
946
946
|
// Changed from participant_ids to user_ids to match backend
|
|
947
947
|
}), await this.fetchConversation(e);
|
|
948
948
|
} catch (i) {
|
|
949
|
-
throw this.error =
|
|
949
|
+
throw this.error = Z(i), i;
|
|
950
950
|
}
|
|
951
951
|
},
|
|
952
952
|
async removeParticipant(e, n) {
|
|
953
953
|
try {
|
|
954
|
-
await
|
|
954
|
+
await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
|
|
955
955
|
const i = Pe()();
|
|
956
956
|
if (n === i.currentUser?.id) {
|
|
957
957
|
this.conversations = this.conversations.filter((o) => o.id !== e), this.requests = this.requests.filter((o) => o.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
@@ -959,7 +959,7 @@ const Nt = ci("messaging", {
|
|
|
959
959
|
}
|
|
960
960
|
await this.fetchConversation(e);
|
|
961
961
|
} catch (i) {
|
|
962
|
-
throw this.error =
|
|
962
|
+
throw this.error = Z(i), i;
|
|
963
963
|
}
|
|
964
964
|
},
|
|
965
965
|
applyParticipantReadState(e) {
|
|
@@ -1039,25 +1039,25 @@ const Nt = ci("messaging", {
|
|
|
1039
1039
|
try {
|
|
1040
1040
|
let g;
|
|
1041
1041
|
try {
|
|
1042
|
-
g = await
|
|
1043
|
-
} catch (
|
|
1044
|
-
if (!Gi(
|
|
1045
|
-
throw
|
|
1046
|
-
g = await
|
|
1042
|
+
g = await W().post(o, u);
|
|
1043
|
+
} catch (v) {
|
|
1044
|
+
if (!Gi(v))
|
|
1045
|
+
throw v;
|
|
1046
|
+
g = await W().post(o, u);
|
|
1047
1047
|
}
|
|
1048
1048
|
const d = he(g.data) && "data" in g.data ? g.data.data : g.data, A = wn(
|
|
1049
1049
|
he(d) ? d.reactions : void 0
|
|
1050
1050
|
);
|
|
1051
1051
|
(A.length > 0 || h.length === 0) && this.updateMessageReactions(e, n, A);
|
|
1052
1052
|
try {
|
|
1053
|
-
const
|
|
1054
|
-
he(
|
|
1053
|
+
const v = await W().get(o), w = he(v.data) && "data" in v.data ? v.data.data : v.data, R = wn(
|
|
1054
|
+
he(w) ? w.reactions : void 0
|
|
1055
1055
|
);
|
|
1056
|
-
this.updateMessageReactions(e, n,
|
|
1056
|
+
this.updateMessageReactions(e, n, R);
|
|
1057
1057
|
} catch {
|
|
1058
1058
|
}
|
|
1059
1059
|
} catch (g) {
|
|
1060
|
-
throw this.error =
|
|
1060
|
+
throw this.error = Z(g), g;
|
|
1061
1061
|
}
|
|
1062
1062
|
},
|
|
1063
1063
|
updateMessageReactions(e, n, i) {
|
|
@@ -1101,14 +1101,14 @@ const Nt = ci("messaging", {
|
|
|
1101
1101
|
});
|
|
1102
1102
|
this.conversations = Ke(this.conversations, i);
|
|
1103
1103
|
} catch (n) {
|
|
1104
|
-
throw this.error =
|
|
1104
|
+
throw this.error = Z(n), n;
|
|
1105
1105
|
}
|
|
1106
1106
|
},
|
|
1107
1107
|
async declineRequest(e) {
|
|
1108
1108
|
try {
|
|
1109
1109
|
await Se.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1110
1110
|
} catch (n) {
|
|
1111
|
-
throw this.error =
|
|
1111
|
+
throw this.error = Z(n), n;
|
|
1112
1112
|
}
|
|
1113
1113
|
},
|
|
1114
1114
|
async searchConversations(e, n, i) {
|
|
@@ -1116,7 +1116,7 @@ const Nt = ci("messaging", {
|
|
|
1116
1116
|
try {
|
|
1117
1117
|
const o = { search: e, limit: 20 };
|
|
1118
1118
|
n && (o.filter = n), typeof i == "string" && i.length > 0 && (o.folder_id = i);
|
|
1119
|
-
const u = await
|
|
1119
|
+
const u = await W().get("/v1/messaging/conversations", {
|
|
1120
1120
|
params: o
|
|
1121
1121
|
}), { items: l } = Je(
|
|
1122
1122
|
u.data,
|
|
@@ -1124,7 +1124,7 @@ const Nt = ci("messaging", {
|
|
|
1124
1124
|
);
|
|
1125
1125
|
return l;
|
|
1126
1126
|
} catch (o) {
|
|
1127
|
-
return this.error =
|
|
1127
|
+
return this.error = Z(o), [];
|
|
1128
1128
|
} finally {
|
|
1129
1129
|
this.searchLoading = !1;
|
|
1130
1130
|
}
|
|
@@ -1132,12 +1132,12 @@ const Nt = ci("messaging", {
|
|
|
1132
1132
|
async searchMessages(e, n) {
|
|
1133
1133
|
this.searchLoading = !0;
|
|
1134
1134
|
try {
|
|
1135
|
-
const i = await
|
|
1135
|
+
const i = await W().get(`/v1/messaging/conversations/${e}/search`, {
|
|
1136
1136
|
params: { q: n }
|
|
1137
1137
|
}), o = i.data.data || i.data || [];
|
|
1138
1138
|
return this.searchResults = o, o;
|
|
1139
1139
|
} catch (i) {
|
|
1140
|
-
return this.error =
|
|
1140
|
+
return this.error = Z(i), [];
|
|
1141
1141
|
} finally {
|
|
1142
1142
|
this.searchLoading = !1;
|
|
1143
1143
|
}
|
|
@@ -1178,108 +1178,122 @@ const Nt = ci("messaging", {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
});
|
|
1180
1180
|
function La(e) {
|
|
1181
|
-
const n =
|
|
1182
|
-
let x = 0,
|
|
1183
|
-
const
|
|
1184
|
-
function
|
|
1185
|
-
|
|
1181
|
+
const n = Ft(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = Mt(), g = h !== null, d = 20, A = 250;
|
|
1182
|
+
let x = 0, v = null, w = null;
|
|
1183
|
+
const R = re(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "";
|
|
1184
|
+
function _() {
|
|
1185
|
+
v && (clearTimeout(v), v = null), x = 0;
|
|
1186
1186
|
}
|
|
1187
1187
|
function f() {
|
|
1188
|
-
!g || o.value ||
|
|
1189
|
-
|
|
1188
|
+
!g || o.value || v || x >= d || (v = setTimeout(() => {
|
|
1189
|
+
v = null, x += 1, O();
|
|
1190
1190
|
}, A));
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (n.addMessage(
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1192
|
+
function b(m) {
|
|
1193
|
+
if (n.addMessage(m.message), m.message.author_id !== R.value) {
|
|
1194
|
+
const j = n.getConversationById(m.conversation_id);
|
|
1195
|
+
j && (j.unread_count = 0), n.markAsRead(m.conversation_id).catch(() => {
|
|
1196
1196
|
});
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1200
|
-
n.applyParticipantReadState(
|
|
1201
|
-
}
|
|
1202
|
-
function F(
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1205
|
-
const
|
|
1206
|
-
if (!
|
|
1207
|
-
const
|
|
1208
|
-
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1199
|
+
function y(m) {
|
|
1200
|
+
n.applyParticipantReadState(m);
|
|
1201
|
+
}
|
|
1202
|
+
function F(m) {
|
|
1203
|
+
const j = n.getMessagesByConversationId(m.conversation_id), C = j.findIndex((U) => U.id === m.message.id);
|
|
1204
|
+
if (C >= 0) {
|
|
1205
|
+
const U = j[C];
|
|
1206
|
+
if (!U) return;
|
|
1207
|
+
const I = { ...U };
|
|
1208
|
+
m.message.body !== void 0 && (I.body = m.message.body), m.message.edited_at !== void 0 && (I.edited_at = m.message.edited_at), m.message.meta !== void 0 && (I.meta = m.message.meta), j[C] = I;
|
|
1209
|
+
const q = n.getConversationById(m.conversation_id);
|
|
1210
|
+
q && q.last_message?.id === m.message.id && (q.last_message = I);
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
n.removeMessage(
|
|
1213
|
+
function H(m) {
|
|
1214
|
+
n.removeMessage(m.conversation_id, m.message_id);
|
|
1215
1215
|
}
|
|
1216
|
-
function B(
|
|
1216
|
+
function B(m) {
|
|
1217
1217
|
n.updateMessageReactions(
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1218
|
+
m.conversation_id,
|
|
1219
|
+
m.message_id,
|
|
1220
|
+
m.reactions
|
|
1221
1221
|
);
|
|
1222
1222
|
}
|
|
1223
|
-
function P(
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
(
|
|
1223
|
+
function P(m) {
|
|
1224
|
+
const j = n.getConversationById(m.conversation_id);
|
|
1225
|
+
j && (j.is_request = !1), n.requests = n.requests.filter(
|
|
1226
|
+
(C) => C.id !== m.conversation_id
|
|
1227
1227
|
);
|
|
1228
1228
|
}
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1229
|
+
function L(m) {
|
|
1230
|
+
m.removed_user_id === R.value && ($(), n.deleteConversation(m.conversation_id).catch(() => {
|
|
1231
1231
|
}));
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1233
|
+
function V(m) {
|
|
1234
|
+
const j = l.value;
|
|
1235
|
+
w && (w(), w = null), j && (m && !n.hasGlobalConversationSubscription(j) && mi(j), n.unregisterDetailSubscription(j), l.value = null), o.value = !1;
|
|
1236
|
+
}
|
|
1237
|
+
function O() {
|
|
1238
|
+
const m = E();
|
|
1239
|
+
if (!(o.value || !m)) {
|
|
1236
1240
|
if (!Ae()) {
|
|
1237
1241
|
f();
|
|
1238
1242
|
return;
|
|
1239
1243
|
}
|
|
1240
1244
|
u.value = null;
|
|
1241
1245
|
try {
|
|
1242
|
-
|
|
1243
|
-
onMessageSent:
|
|
1244
|
-
onMessageRead:
|
|
1246
|
+
w = gi(m, {
|
|
1247
|
+
onMessageSent: b,
|
|
1248
|
+
onMessageRead: y,
|
|
1245
1249
|
onMessageEdited: F,
|
|
1246
|
-
onMessageDeleted:
|
|
1250
|
+
onMessageDeleted: H,
|
|
1247
1251
|
onReactionToggled: B,
|
|
1248
1252
|
onRequestAccepted: P,
|
|
1249
|
-
onParticipantRemoved:
|
|
1250
|
-
}), o.value = !0, l.value =
|
|
1251
|
-
} catch (
|
|
1252
|
-
u.value =
|
|
1253
|
+
onParticipantRemoved: L
|
|
1254
|
+
}), o.value = !0, l.value = m, n.registerDetailSubscription(m), _();
|
|
1255
|
+
} catch (j) {
|
|
1256
|
+
u.value = j instanceof Error ? j.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", j);
|
|
1253
1257
|
}
|
|
1254
1258
|
}
|
|
1255
1259
|
}
|
|
1256
|
-
function
|
|
1257
|
-
o.value ||
|
|
1260
|
+
function K() {
|
|
1261
|
+
o.value || O();
|
|
1258
1262
|
}
|
|
1259
|
-
typeof window < "u" && window.addEventListener(De(),
|
|
1260
|
-
const
|
|
1261
|
-
if (
|
|
1262
|
-
o.value ||
|
|
1263
|
+
typeof window < "u" && window.addEventListener(De(), K);
|
|
1264
|
+
const ie = it((m) => {
|
|
1265
|
+
if (m === "connected") {
|
|
1266
|
+
o.value || O();
|
|
1263
1267
|
return;
|
|
1264
1268
|
}
|
|
1265
|
-
(
|
|
1269
|
+
(m === "disconnected" || m === "error") && (_(), V(!1));
|
|
1266
1270
|
});
|
|
1267
|
-
function
|
|
1268
|
-
|
|
1269
|
-
if (S(), !(!o.value || !w))
|
|
1271
|
+
function $() {
|
|
1272
|
+
if (_(), !(!o.value || !l.value))
|
|
1270
1273
|
try {
|
|
1271
|
-
|
|
1272
|
-
} catch (
|
|
1273
|
-
u.value =
|
|
1274
|
+
V(!0), u.value = null;
|
|
1275
|
+
} catch (m) {
|
|
1276
|
+
u.value = m instanceof Error ? m.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", m);
|
|
1274
1277
|
}
|
|
1275
1278
|
}
|
|
1276
|
-
return
|
|
1277
|
-
|
|
1279
|
+
return Rt(
|
|
1280
|
+
() => E(),
|
|
1281
|
+
(m, j) => {
|
|
1282
|
+
if (m !== j) {
|
|
1283
|
+
if (_(), o.value && V(!0), !m) {
|
|
1284
|
+
u.value = null;
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
O();
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
), h !== null && qe(() => {
|
|
1291
|
+
_(), ie(), $(), typeof window < "u" && window.removeEventListener(De(), K);
|
|
1278
1292
|
}), {
|
|
1279
|
-
isSubscribed:
|
|
1280
|
-
error:
|
|
1281
|
-
subscribe:
|
|
1282
|
-
unsubscribe:
|
|
1293
|
+
isSubscribed: re(() => o.value),
|
|
1294
|
+
error: re(() => u.value),
|
|
1295
|
+
subscribe: O,
|
|
1296
|
+
unsubscribe: $
|
|
1283
1297
|
};
|
|
1284
1298
|
}
|
|
1285
1299
|
const Kn = () => () => {
|
|
@@ -1322,15 +1336,15 @@ const ro = {
|
|
|
1322
1336
|
error: () => {
|
|
1323
1337
|
}
|
|
1324
1338
|
}, Qn = () => ro;
|
|
1325
|
-
let
|
|
1326
|
-
function
|
|
1327
|
-
return
|
|
1339
|
+
let Dt = Qn;
|
|
1340
|
+
function qt() {
|
|
1341
|
+
return Dt;
|
|
1328
1342
|
}
|
|
1329
1343
|
function io(e) {
|
|
1330
|
-
|
|
1344
|
+
Dt = e;
|
|
1331
1345
|
}
|
|
1332
1346
|
function oo() {
|
|
1333
|
-
|
|
1347
|
+
Dt = Qn;
|
|
1334
1348
|
}
|
|
1335
1349
|
const ao = {
|
|
1336
1350
|
connected: "",
|
|
@@ -1338,7 +1352,7 @@ const ao = {
|
|
|
1338
1352
|
disconnected: "",
|
|
1339
1353
|
error: "",
|
|
1340
1354
|
unknown: ""
|
|
1341
|
-
}, Rn =
|
|
1355
|
+
}, Rn = qt()("ConnectionStatus");
|
|
1342
1356
|
function An(e) {
|
|
1343
1357
|
return e?.connector?.pusher?.connection ?? null;
|
|
1344
1358
|
}
|
|
@@ -1364,9 +1378,9 @@ function Ua(e = {}) {
|
|
|
1364
1378
|
const o = co(e.source ?? "app"), u = {
|
|
1365
1379
|
...ao,
|
|
1366
1380
|
...e.icons
|
|
1367
|
-
}, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1),
|
|
1368
|
-
let
|
|
1369
|
-
const F =
|
|
1381
|
+
}, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1), v = de(!1);
|
|
1382
|
+
let w = null, R = null, E = null, _ = null, f = null, b = null, y = null;
|
|
1383
|
+
const F = re(() => l.value === "connected"), H = re(() => l.value === "connecting"), B = re(() => l.value === "disconnected"), P = re(() => l.value === "error"), L = re(() => B.value || P.value), V = re(() => {
|
|
1370
1384
|
switch (l.value) {
|
|
1371
1385
|
case "connecting":
|
|
1372
1386
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1379,7 +1393,7 @@ function Ua(e = {}) {
|
|
|
1379
1393
|
default:
|
|
1380
1394
|
return "Unknown connection state";
|
|
1381
1395
|
}
|
|
1382
|
-
}),
|
|
1396
|
+
}), O = re(() => {
|
|
1383
1397
|
switch (l.value) {
|
|
1384
1398
|
case "connected":
|
|
1385
1399
|
return "success";
|
|
@@ -1391,7 +1405,7 @@ function Ua(e = {}) {
|
|
|
1391
1405
|
default:
|
|
1392
1406
|
return "medium";
|
|
1393
1407
|
}
|
|
1394
|
-
}), K =
|
|
1408
|
+
}), K = re(() => {
|
|
1395
1409
|
switch (l.value) {
|
|
1396
1410
|
case "connected":
|
|
1397
1411
|
return u.connected;
|
|
@@ -1404,137 +1418,137 @@ function Ua(e = {}) {
|
|
|
1404
1418
|
default:
|
|
1405
1419
|
return u.unknown;
|
|
1406
1420
|
}
|
|
1407
|
-
}),
|
|
1421
|
+
}), ie = async () => {
|
|
1408
1422
|
Rn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1409
|
-
},
|
|
1410
|
-
if (
|
|
1411
|
-
const
|
|
1423
|
+
}, $ = (I, q = l.value) => {
|
|
1424
|
+
if (I !== "connecting" && R && (clearTimeout(R), R = null), I === "disconnected" || I === "error") {
|
|
1425
|
+
const se = !v.value && q === I, je = !A.value && (se || q === "connected" || q === "connecting");
|
|
1412
1426
|
if (x.value = !0, je) {
|
|
1413
|
-
d.value = !1,
|
|
1414
|
-
|
|
1427
|
+
d.value = !1, E && clearTimeout(E), E = setTimeout(() => {
|
|
1428
|
+
E = null, l.value !== "connected" && (d.value = !0);
|
|
1415
1429
|
}, 2e3);
|
|
1416
1430
|
return;
|
|
1417
1431
|
}
|
|
1418
|
-
|
|
1432
|
+
E && (clearTimeout(E), E = null), d.value = !0;
|
|
1419
1433
|
return;
|
|
1420
1434
|
}
|
|
1421
|
-
if (
|
|
1422
|
-
|
|
1435
|
+
if (I === "connected") {
|
|
1436
|
+
E && (clearTimeout(E), E = null), d.value = !1, A.value = !1, x.value = !1;
|
|
1423
1437
|
return;
|
|
1424
1438
|
}
|
|
1425
|
-
if (
|
|
1439
|
+
if (I === "connecting") {
|
|
1426
1440
|
if (A.value) {
|
|
1427
1441
|
d.value = !0;
|
|
1428
1442
|
return;
|
|
1429
1443
|
}
|
|
1430
|
-
if (x.value || (d.value = !1),
|
|
1444
|
+
if (x.value || (d.value = !1), R)
|
|
1431
1445
|
return;
|
|
1432
|
-
|
|
1433
|
-
if (
|
|
1446
|
+
R = setTimeout(() => {
|
|
1447
|
+
if (R = null, l.value === "connecting") {
|
|
1434
1448
|
if (Pn(o) === "connected") {
|
|
1435
|
-
|
|
1449
|
+
m("connected");
|
|
1436
1450
|
return;
|
|
1437
1451
|
}
|
|
1438
|
-
A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"),
|
|
1452
|
+
A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), m("disconnected"), g.value += 1, o.reconnect();
|
|
1439
1453
|
}
|
|
1440
1454
|
}, 1e4);
|
|
1441
1455
|
}
|
|
1442
|
-
},
|
|
1443
|
-
const
|
|
1444
|
-
if (
|
|
1445
|
-
l.value = "disconnected",
|
|
1456
|
+
}, m = (I) => {
|
|
1457
|
+
const q = l.value;
|
|
1458
|
+
if (I === "connecting" && A.value) {
|
|
1459
|
+
l.value = "disconnected", $("disconnected", q);
|
|
1446
1460
|
return;
|
|
1447
1461
|
}
|
|
1448
|
-
l.value =
|
|
1449
|
-
},
|
|
1450
|
-
const
|
|
1451
|
-
if (
|
|
1452
|
-
|
|
1462
|
+
l.value = I, I === "connecting" && (q === "disconnected" || q === "error") && g.value === 0 && (g.value = 1), I === "connected" && (h.value = /* @__PURE__ */ new Date(), g.value = 0), $(I, q);
|
|
1463
|
+
}, j = () => {
|
|
1464
|
+
const I = Pn(o), q = l.value;
|
|
1465
|
+
if (I === "connected" && q !== "connected") {
|
|
1466
|
+
m("connected");
|
|
1453
1467
|
return;
|
|
1454
1468
|
}
|
|
1455
|
-
if (
|
|
1456
|
-
|
|
1469
|
+
if (I === "connecting" && q !== "connecting") {
|
|
1470
|
+
m("connecting");
|
|
1457
1471
|
return;
|
|
1458
1472
|
}
|
|
1459
|
-
if ((
|
|
1460
|
-
|
|
1473
|
+
if ((I === "unavailable" || I === "failed" || I === "disconnected") && q !== "disconnected") {
|
|
1474
|
+
m("disconnected");
|
|
1461
1475
|
return;
|
|
1462
1476
|
}
|
|
1463
|
-
const
|
|
1464
|
-
!
|
|
1477
|
+
const se = o.getConnectionStatus();
|
|
1478
|
+
!I && se === "connected" && q !== "connected" && m("connected");
|
|
1465
1479
|
}, C = () => {
|
|
1466
|
-
if (f?.unbind &&
|
|
1480
|
+
if (f?.unbind && y && (f.unbind("connected", y.connected), f.unbind("connecting", y.connecting), f.unbind("disconnected", y.disconnected), f.unbind("unavailable", y.unavailable), f.unbind("error", y.error), f.unbind("state_change", y.stateChange)), f = o.getEchoConnection(), y = null, !f?.bind)
|
|
1467
1481
|
return;
|
|
1468
|
-
|
|
1469
|
-
connected: () =>
|
|
1470
|
-
connecting: () =>
|
|
1471
|
-
disconnected: () =>
|
|
1472
|
-
unavailable: () =>
|
|
1473
|
-
error: () =>
|
|
1474
|
-
stateChange: (
|
|
1475
|
-
const
|
|
1476
|
-
if (
|
|
1477
|
-
|
|
1482
|
+
y = {
|
|
1483
|
+
connected: () => m("connected"),
|
|
1484
|
+
connecting: () => m("connecting"),
|
|
1485
|
+
disconnected: () => m("disconnected"),
|
|
1486
|
+
unavailable: () => m("disconnected"),
|
|
1487
|
+
error: () => m("error"),
|
|
1488
|
+
stateChange: (q) => {
|
|
1489
|
+
const se = q?.current;
|
|
1490
|
+
if (se === "connected") {
|
|
1491
|
+
m("connected");
|
|
1478
1492
|
return;
|
|
1479
1493
|
}
|
|
1480
|
-
if (
|
|
1481
|
-
|
|
1494
|
+
if (se === "connecting") {
|
|
1495
|
+
m("connecting");
|
|
1482
1496
|
return;
|
|
1483
1497
|
}
|
|
1484
|
-
(
|
|
1498
|
+
(se === "unavailable" || se === "failed" || se === "disconnected") && m("disconnected");
|
|
1485
1499
|
}
|
|
1486
|
-
}, f.bind("connected",
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1500
|
+
}, f.bind("connected", y.connected), f.bind("connecting", y.connecting), f.bind("disconnected", y.disconnected), f.bind("unavailable", y.unavailable), f.bind("error", y.error), f.bind("state_change", y.stateChange);
|
|
1501
|
+
const I = f.state ?? null;
|
|
1502
|
+
if (I === "connected") {
|
|
1503
|
+
m("connected");
|
|
1490
1504
|
return;
|
|
1491
1505
|
}
|
|
1492
|
-
if (
|
|
1493
|
-
|
|
1506
|
+
if (I === "connecting") {
|
|
1507
|
+
m("connecting");
|
|
1494
1508
|
return;
|
|
1495
1509
|
}
|
|
1496
|
-
(
|
|
1497
|
-
},
|
|
1510
|
+
(I === "unavailable" || I === "failed" || I === "disconnected") && m("disconnected");
|
|
1511
|
+
}, U = re(() => {
|
|
1498
1512
|
if (!h.value || !F.value)
|
|
1499
1513
|
return null;
|
|
1500
|
-
const
|
|
1501
|
-
return
|
|
1514
|
+
const I = Date.now() - h.value.getTime(), q = Math.floor(I / 6e4), se = Math.floor(I % 6e4 / 1e3);
|
|
1515
|
+
return q > 0 ? `${q}m ${se}s` : `${se}s`;
|
|
1502
1516
|
});
|
|
1503
1517
|
return Un(() => {
|
|
1504
|
-
l.value = o.getConnectionStatus(),
|
|
1505
|
-
C(),
|
|
1506
|
-
}, window.addEventListener(o.initializedEvent,
|
|
1507
|
-
|
|
1518
|
+
l.value = o.getConnectionStatus(), w = o.onConnectionStatusChange(m), F.value && (h.value = /* @__PURE__ */ new Date()), $(l.value, l.value), v.value = !0, C(), b = () => {
|
|
1519
|
+
C(), j();
|
|
1520
|
+
}, window.addEventListener(o.initializedEvent, b), j(), _ = setInterval(() => {
|
|
1521
|
+
j();
|
|
1508
1522
|
}, 3e3);
|
|
1509
1523
|
}), qe(() => {
|
|
1510
|
-
|
|
1524
|
+
w?.(), R && (clearTimeout(R), R = null), E && (clearTimeout(E), E = null), _ && (clearInterval(_), _ = null), b && (window.removeEventListener(o.initializedEvent, b), b = null), f?.unbind && y && (f.unbind("connected", y.connected), f.unbind("connecting", y.connecting), f.unbind("disconnected", y.disconnected), f.unbind("unavailable", y.unavailable), f.unbind("error", y.error), f.unbind("state_change", y.stateChange)), f = null, y = null;
|
|
1511
1525
|
}), {
|
|
1512
|
-
connectionStatus:
|
|
1526
|
+
connectionStatus: re(() => l.value),
|
|
1513
1527
|
isConnected: F,
|
|
1514
|
-
isConnecting:
|
|
1528
|
+
isConnecting: H,
|
|
1515
1529
|
isDisconnected: B,
|
|
1516
1530
|
isError: P,
|
|
1517
|
-
hasConnectionIssues:
|
|
1518
|
-
statusMessage:
|
|
1519
|
-
statusColor:
|
|
1531
|
+
hasConnectionIssues: L,
|
|
1532
|
+
statusMessage: V,
|
|
1533
|
+
statusColor: O,
|
|
1520
1534
|
statusIcon: K,
|
|
1521
|
-
showConnectionBanner:
|
|
1522
|
-
lastConnectionTime:
|
|
1523
|
-
connectionUptime:
|
|
1524
|
-
reconnectAttempts:
|
|
1525
|
-
reconnect:
|
|
1535
|
+
showConnectionBanner: re(() => d.value),
|
|
1536
|
+
lastConnectionTime: re(() => h.value),
|
|
1537
|
+
connectionUptime: U,
|
|
1538
|
+
reconnectAttempts: re(() => g.value),
|
|
1539
|
+
reconnect: ie
|
|
1526
1540
|
};
|
|
1527
1541
|
}
|
|
1528
|
-
const Zn =
|
|
1529
|
-
let
|
|
1542
|
+
const Zn = kt;
|
|
1543
|
+
let zt = Zn;
|
|
1530
1544
|
function es() {
|
|
1531
|
-
return
|
|
1545
|
+
return zt;
|
|
1532
1546
|
}
|
|
1533
1547
|
function uo(e) {
|
|
1534
|
-
|
|
1548
|
+
zt = e;
|
|
1535
1549
|
}
|
|
1536
1550
|
function lo() {
|
|
1537
|
-
|
|
1551
|
+
zt = Zn;
|
|
1538
1552
|
}
|
|
1539
1553
|
const ho = 6e4;
|
|
1540
1554
|
function fo(e) {
|
|
@@ -1552,7 +1566,7 @@ function ts(e) {
|
|
|
1552
1566
|
const n = e.trim();
|
|
1553
1567
|
return n.length > 0 ? n : null;
|
|
1554
1568
|
}
|
|
1555
|
-
function
|
|
1569
|
+
function xt(e) {
|
|
1556
1570
|
const n = ts(e);
|
|
1557
1571
|
if (n === null)
|
|
1558
1572
|
return null;
|
|
@@ -1564,7 +1578,7 @@ function go(e, n, i = {}) {
|
|
|
1564
1578
|
return null;
|
|
1565
1579
|
if (e === "offline")
|
|
1566
1580
|
return "offline";
|
|
1567
|
-
const o =
|
|
1581
|
+
const o = xt(n);
|
|
1568
1582
|
if (o === null)
|
|
1569
1583
|
return e;
|
|
1570
1584
|
const u = i.now ?? Date.now(), l = i.staleAfterMs ?? ho;
|
|
@@ -1579,165 +1593,165 @@ function xn(e, n = {}) {
|
|
|
1579
1593
|
}
|
|
1580
1594
|
const ns = () => {
|
|
1581
1595
|
};
|
|
1582
|
-
let
|
|
1596
|
+
let jt = ns;
|
|
1583
1597
|
function mo() {
|
|
1584
|
-
return
|
|
1598
|
+
return jt;
|
|
1585
1599
|
}
|
|
1586
1600
|
function vo(e) {
|
|
1587
|
-
|
|
1601
|
+
jt = e;
|
|
1588
1602
|
}
|
|
1589
1603
|
function bo() {
|
|
1590
|
-
|
|
1604
|
+
jt = ns;
|
|
1591
1605
|
}
|
|
1592
|
-
const Ye =
|
|
1606
|
+
const Ye = qt()("GlobalMessaging"), yo = 3, _o = (e) => e.replace(/\/+$/, ""), So = (e) => _o(window.location.pathname) === `/messages/${e}`, wo = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1593
1607
|
function Oa() {
|
|
1594
|
-
const e =
|
|
1608
|
+
const e = Ft(), n = Pe()(), i = mo(), o = es(), u = hi(), l = Mt(), { conversations: h } = ui(e), g = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map();
|
|
1595
1609
|
let A = !1;
|
|
1596
1610
|
function x(P) {
|
|
1597
|
-
const
|
|
1598
|
-
if (
|
|
1599
|
-
for (const
|
|
1611
|
+
const L = d.get(P);
|
|
1612
|
+
if (L && (d.delete(P), typeof L.channel.stopListening == "function"))
|
|
1613
|
+
for (const V of L.bindings)
|
|
1600
1614
|
try {
|
|
1601
|
-
|
|
1615
|
+
L.channel.stopListening(V.event, V.handler);
|
|
1602
1616
|
} catch {
|
|
1603
1617
|
}
|
|
1604
1618
|
}
|
|
1605
|
-
function
|
|
1619
|
+
function v() {
|
|
1606
1620
|
for (const P of g)
|
|
1607
1621
|
x(P), e.unregisterGlobalConversationSubscription(P);
|
|
1608
1622
|
g.clear();
|
|
1609
1623
|
}
|
|
1610
|
-
function
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1613
|
-
const
|
|
1624
|
+
function w(P) {
|
|
1625
|
+
const L = Ae();
|
|
1626
|
+
if (!L || g.has(P)) return;
|
|
1627
|
+
const V = `conversation.${P}`;
|
|
1614
1628
|
x(P);
|
|
1615
|
-
const
|
|
1616
|
-
if (!Si(
|
|
1617
|
-
Ye.warn("Dropping malformed ConversationMessageSent event",
|
|
1629
|
+
const O = L.private(V), K = (m) => {
|
|
1630
|
+
if (!Si(m)) {
|
|
1631
|
+
Ye.warn("Dropping malformed ConversationMessageSent event", m);
|
|
1618
1632
|
return;
|
|
1619
1633
|
}
|
|
1620
|
-
const
|
|
1621
|
-
if (!C ||
|
|
1622
|
-
e.addMessage(
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1634
|
+
const j = m, C = n.currentUser?.id;
|
|
1635
|
+
if (!C || j.message.author_id === C) return;
|
|
1636
|
+
e.addMessage(j.message);
|
|
1637
|
+
const U = e.hasDetailSubscription(j.conversation_id), I = So(j.conversation_id);
|
|
1638
|
+
if (U || I) {
|
|
1639
|
+
const se = e.getConversationById(j.conversation_id);
|
|
1640
|
+
se && (se.unread_count = 0), e.markAsRead(j.conversation_id).catch(() => {
|
|
1627
1641
|
});
|
|
1628
1642
|
return;
|
|
1629
1643
|
}
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1644
|
+
const q = e.getConversationById(j.conversation_id);
|
|
1645
|
+
if (q) {
|
|
1646
|
+
const se = wo(q);
|
|
1647
|
+
se || q.unread_count++, i(se);
|
|
1634
1648
|
}
|
|
1635
|
-
},
|
|
1636
|
-
if (!wi(
|
|
1637
|
-
Ye.warn("Dropping malformed ConversationMessageRead event",
|
|
1649
|
+
}, ie = (m) => {
|
|
1650
|
+
if (!wi(m)) {
|
|
1651
|
+
Ye.warn("Dropping malformed ConversationMessageRead event", m);
|
|
1638
1652
|
return;
|
|
1639
1653
|
}
|
|
1640
|
-
e.applyParticipantReadState(
|
|
1641
|
-
},
|
|
1642
|
-
if (!Ci(
|
|
1643
|
-
Ye.warn("Dropping malformed ConversationRequestAccepted event",
|
|
1654
|
+
e.applyParticipantReadState(m);
|
|
1655
|
+
}, $ = (m) => {
|
|
1656
|
+
if (!Ci(m)) {
|
|
1657
|
+
Ye.warn("Dropping malformed ConversationRequestAccepted event", m);
|
|
1644
1658
|
return;
|
|
1645
1659
|
}
|
|
1646
|
-
const
|
|
1660
|
+
const j = m, C = e.getConversationById(j.conversation_id);
|
|
1647
1661
|
C && (C.is_request = !1), e.requests = e.requests.filter(
|
|
1648
|
-
(
|
|
1662
|
+
(U) => U.id !== j.conversation_id
|
|
1649
1663
|
);
|
|
1650
1664
|
};
|
|
1651
|
-
|
|
1652
|
-
channel:
|
|
1665
|
+
O.listen(".ConversationMessageSent", K), O.listen(".ConversationMessageRead", ie), O.listen(".ConversationRequestAccepted", $), d.set(P, {
|
|
1666
|
+
channel: O,
|
|
1653
1667
|
bindings: [
|
|
1654
1668
|
{ event: ".ConversationMessageSent", handler: K },
|
|
1655
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1656
|
-
{ event: ".ConversationRequestAccepted", handler:
|
|
1669
|
+
{ event: ".ConversationMessageRead", handler: ie },
|
|
1670
|
+
{ event: ".ConversationRequestAccepted", handler: $ }
|
|
1657
1671
|
]
|
|
1658
1672
|
}), g.add(P), e.registerGlobalConversationSubscription(P);
|
|
1659
1673
|
}
|
|
1660
|
-
function
|
|
1674
|
+
function R() {
|
|
1661
1675
|
const P = Ae();
|
|
1662
1676
|
if (!P) {
|
|
1663
|
-
|
|
1677
|
+
v();
|
|
1664
1678
|
return;
|
|
1665
1679
|
}
|
|
1666
|
-
for (const
|
|
1667
|
-
x(
|
|
1680
|
+
for (const L of g) {
|
|
1681
|
+
x(L);
|
|
1668
1682
|
try {
|
|
1669
|
-
P.leave(`conversation.${
|
|
1683
|
+
P.leave(`conversation.${L}`);
|
|
1670
1684
|
} catch {
|
|
1671
1685
|
}
|
|
1672
|
-
e.unregisterGlobalConversationSubscription(
|
|
1686
|
+
e.unregisterGlobalConversationSubscription(L);
|
|
1673
1687
|
}
|
|
1674
1688
|
g.clear();
|
|
1675
1689
|
}
|
|
1676
|
-
function
|
|
1690
|
+
function E() {
|
|
1677
1691
|
const P = Ae();
|
|
1678
1692
|
if (!P) return;
|
|
1679
|
-
const
|
|
1680
|
-
for (const
|
|
1681
|
-
if (
|
|
1693
|
+
const L = e.conversations.slice(0, yo), V = new Set(L.map((O) => O.id));
|
|
1694
|
+
for (const O of g)
|
|
1695
|
+
if (!V.has(O) && !e.hasDetailSubscription(O)) {
|
|
1682
1696
|
try {
|
|
1683
|
-
x(
|
|
1697
|
+
x(O), P.leave(`conversation.${O}`);
|
|
1684
1698
|
} catch {
|
|
1685
1699
|
}
|
|
1686
|
-
g.delete(
|
|
1700
|
+
g.delete(O), e.unregisterGlobalConversationSubscription(O);
|
|
1687
1701
|
}
|
|
1688
|
-
for (const
|
|
1689
|
-
|
|
1702
|
+
for (const O of L)
|
|
1703
|
+
w(O.id);
|
|
1690
1704
|
}
|
|
1691
|
-
function
|
|
1692
|
-
const
|
|
1705
|
+
function _(P) {
|
|
1706
|
+
const L = xn({
|
|
1693
1707
|
status: P.status,
|
|
1694
1708
|
last_seen_at: P.last_seen_at ?? null
|
|
1695
1709
|
});
|
|
1696
|
-
|
|
1710
|
+
L.status !== null && e.updatePresenceForUser(
|
|
1697
1711
|
P.user_id,
|
|
1698
|
-
|
|
1699
|
-
|
|
1712
|
+
L.status,
|
|
1713
|
+
L.lastSeenAt
|
|
1700
1714
|
);
|
|
1701
1715
|
}
|
|
1702
1716
|
async function f() {
|
|
1703
1717
|
const P = [...new Set(
|
|
1704
|
-
e.conversations.filter((
|
|
1718
|
+
e.conversations.filter((L) => L.type === "dm" && typeof L.other_user_id == "string" && L.other_user_id.length > 0).map((L) => L.other_user_id)
|
|
1705
1719
|
)];
|
|
1706
1720
|
if (P.length !== 0)
|
|
1707
1721
|
try {
|
|
1708
|
-
const
|
|
1722
|
+
const L = await o.get("/v1/presence/users", {
|
|
1709
1723
|
params: { ids: P }
|
|
1710
|
-
}),
|
|
1711
|
-
for (const
|
|
1712
|
-
const K = xn(
|
|
1713
|
-
K.status !== null && e.updatePresenceForUser(
|
|
1724
|
+
}), V = L.data?.data?.items ?? L.data?.items ?? [];
|
|
1725
|
+
for (const O of V) {
|
|
1726
|
+
const K = xn(O);
|
|
1727
|
+
K.status !== null && e.updatePresenceForUser(O.id, K.status, K.lastSeenAt);
|
|
1714
1728
|
}
|
|
1715
|
-
} catch (
|
|
1716
|
-
Ye.warn("Failed to refresh messaging presence snapshot",
|
|
1729
|
+
} catch (L) {
|
|
1730
|
+
Ye.warn("Failed to refresh messaging presence snapshot", L);
|
|
1717
1731
|
}
|
|
1718
1732
|
}
|
|
1719
|
-
function v() {
|
|
1720
|
-
!Ae() || A || (fi(S), A = !0);
|
|
1721
|
-
}
|
|
1722
1733
|
function b() {
|
|
1734
|
+
!Ae() || A || (fi(_), A = !0);
|
|
1735
|
+
}
|
|
1736
|
+
function y() {
|
|
1723
1737
|
A && (pi(), A = !1);
|
|
1724
1738
|
}
|
|
1725
|
-
const F =
|
|
1739
|
+
const F = Rt(
|
|
1726
1740
|
h,
|
|
1727
1741
|
() => {
|
|
1728
|
-
|
|
1742
|
+
E();
|
|
1729
1743
|
},
|
|
1730
1744
|
{ deep: !1, immediate: !0 }
|
|
1731
|
-
),
|
|
1745
|
+
), H = Rt(
|
|
1732
1746
|
() => u.fullPath,
|
|
1733
1747
|
() => {
|
|
1734
|
-
|
|
1748
|
+
E();
|
|
1735
1749
|
}
|
|
1736
1750
|
), B = it((P) => {
|
|
1737
|
-
P === "connected" ? (
|
|
1751
|
+
P === "connected" ? (v(), E(), y(), b(), f()) : (P === "disconnected" || P === "error") && (v(), y());
|
|
1738
1752
|
});
|
|
1739
|
-
|
|
1740
|
-
F(),
|
|
1753
|
+
E(), b(), f(), l !== null && qe(() => {
|
|
1754
|
+
F(), H(), B(), R(), y();
|
|
1741
1755
|
});
|
|
1742
1756
|
}
|
|
1743
1757
|
const ss = {
|
|
@@ -1852,38 +1866,38 @@ function qo(e, n, i) {
|
|
|
1852
1866
|
function Na() {
|
|
1853
1867
|
const e = Pe()(), n = Co(), i = es(), o = Uo(n.clientIdStorageKey);
|
|
1854
1868
|
let u = null, l = null, h = !1, g = Tt(n.accountLimitedUntilStorageKey), d = !1, A = null, x = 0;
|
|
1855
|
-
const
|
|
1869
|
+
const v = () => {
|
|
1856
1870
|
u && (clearInterval(u), u = null);
|
|
1857
|
-
},
|
|
1871
|
+
}, w = () => {
|
|
1858
1872
|
l && (clearTimeout(l), l = null);
|
|
1859
|
-
},
|
|
1860
|
-
|
|
1861
|
-
|
|
1873
|
+
}, R = () => {
|
|
1874
|
+
v(), u = setInterval(() => {
|
|
1875
|
+
L();
|
|
1862
1876
|
}, n.heartbeatIntervalMs);
|
|
1863
|
-
},
|
|
1864
|
-
g || console.warn(
|
|
1865
|
-
},
|
|
1866
|
-
if (!(!h || d || g) && A !==
|
|
1877
|
+
}, E = ($) => {
|
|
1878
|
+
g || console.warn($), No(n.accountLimitedUntilStorageKey), g = !0, h = !1, A = null, v(), w();
|
|
1879
|
+
}, _ = async ($) => {
|
|
1880
|
+
if (!(!h || d || g) && A !== $)
|
|
1867
1881
|
try {
|
|
1868
|
-
await i.patch(n.statusUrl, { status:
|
|
1869
|
-
} catch (
|
|
1870
|
-
Ct(
|
|
1882
|
+
await i.patch(n.statusUrl, { status: $ }), A = $;
|
|
1883
|
+
} catch (m) {
|
|
1884
|
+
Ct(m) && E("[Presence] Presence updates paused: account is temporarily limited");
|
|
1871
1885
|
}
|
|
1872
1886
|
}, f = () => {
|
|
1873
|
-
|
|
1874
|
-
l = null,
|
|
1887
|
+
w(), !(!h || d || g || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
1888
|
+
l = null, _("idle");
|
|
1875
1889
|
}, n.idleAfterMs));
|
|
1876
|
-
},
|
|
1890
|
+
}, b = () => {
|
|
1877
1891
|
if (d || !h || g || document.visibilityState !== "visible")
|
|
1878
1892
|
return;
|
|
1879
|
-
const
|
|
1880
|
-
|
|
1881
|
-
},
|
|
1882
|
-
|
|
1893
|
+
const $ = Date.now();
|
|
1894
|
+
$ - x < n.activityDebounceMs || (x = $, _("online"), f());
|
|
1895
|
+
}, y = () => {
|
|
1896
|
+
b();
|
|
1883
1897
|
}, F = () => {
|
|
1884
|
-
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown",
|
|
1885
|
-
},
|
|
1886
|
-
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown",
|
|
1898
|
+
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", y, { passive: !0 }), document.addEventListener("keydown", y), document.addEventListener("touchstart", y, { passive: !0 }), window.addEventListener("focus", y));
|
|
1899
|
+
}, H = () => {
|
|
1900
|
+
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", y), document.removeEventListener("keydown", y), document.removeEventListener("touchstart", y), window.removeEventListener("focus", y));
|
|
1887
1901
|
}, B = async () => {
|
|
1888
1902
|
if (Tt(n.accountLimitedUntilStorageKey))
|
|
1889
1903
|
return g = !0, "account_limited";
|
|
@@ -1892,205 +1906,205 @@ function Na() {
|
|
|
1892
1906
|
client_id: o,
|
|
1893
1907
|
user_agent: n.userAgentResolver()
|
|
1894
1908
|
}), Fo(n.accountLimitedUntilStorageKey), g = !1, h = !0, A = null, "opened";
|
|
1895
|
-
} catch (
|
|
1896
|
-
return Ct(
|
|
1909
|
+
} catch ($) {
|
|
1910
|
+
return Ct($) ? (E("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
|
|
1897
1911
|
}
|
|
1898
1912
|
}, P = async () => {
|
|
1899
|
-
for (let
|
|
1913
|
+
for (let $ = 0; $ < Mo; $ += 1)
|
|
1900
1914
|
if (await B() !== "failed")
|
|
1901
1915
|
return;
|
|
1902
1916
|
console.warn("[Presence] Failed to open session");
|
|
1903
|
-
},
|
|
1917
|
+
}, L = async () => {
|
|
1904
1918
|
if (h)
|
|
1905
1919
|
try {
|
|
1906
1920
|
await i.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
1907
|
-
} catch (
|
|
1908
|
-
Ct(
|
|
1921
|
+
} catch ($) {
|
|
1922
|
+
Ct($) && E("[Presence] Heartbeat paused: account is temporarily limited");
|
|
1909
1923
|
}
|
|
1910
|
-
},
|
|
1924
|
+
}, V = () => {
|
|
1911
1925
|
if (!h)
|
|
1912
1926
|
return;
|
|
1913
|
-
h = !1, A = null,
|
|
1914
|
-
const
|
|
1927
|
+
h = !1, A = null, w();
|
|
1928
|
+
const $ = qo(
|
|
1915
1929
|
n.sessionCloseUrl,
|
|
1916
1930
|
o,
|
|
1917
1931
|
n.authTokenResolver()
|
|
1918
1932
|
);
|
|
1919
|
-
if (
|
|
1920
|
-
|
|
1933
|
+
if ($) {
|
|
1934
|
+
$.catch(() => {
|
|
1921
1935
|
});
|
|
1922
1936
|
return;
|
|
1923
1937
|
}
|
|
1924
1938
|
i.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
1925
1939
|
});
|
|
1926
|
-
},
|
|
1940
|
+
}, O = async () => {
|
|
1927
1941
|
if (!d) {
|
|
1928
1942
|
if (await P(), d) {
|
|
1929
|
-
|
|
1943
|
+
V();
|
|
1930
1944
|
return;
|
|
1931
1945
|
}
|
|
1932
|
-
h && (
|
|
1946
|
+
h && (R(), _("online"), f());
|
|
1933
1947
|
}
|
|
1934
1948
|
}, K = () => {
|
|
1935
1949
|
if (!d) {
|
|
1936
1950
|
if (document.visibilityState === "hidden") {
|
|
1937
|
-
|
|
1951
|
+
V(), v(), w();
|
|
1938
1952
|
return;
|
|
1939
1953
|
}
|
|
1940
1954
|
if (document.visibilityState === "visible" && !h) {
|
|
1941
|
-
g = Tt(n.accountLimitedUntilStorageKey), g ||
|
|
1955
|
+
g = Tt(n.accountLimitedUntilStorageKey), g || O();
|
|
1942
1956
|
return;
|
|
1943
1957
|
}
|
|
1944
|
-
document.visibilityState === "visible" && h && !g &&
|
|
1958
|
+
document.visibilityState === "visible" && h && !g && b();
|
|
1945
1959
|
}
|
|
1946
|
-
},
|
|
1947
|
-
d || (
|
|
1960
|
+
}, ie = () => {
|
|
1961
|
+
d || (V(), v(), w());
|
|
1948
1962
|
};
|
|
1949
1963
|
Un(async () => {
|
|
1950
1964
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
1951
1965
|
if (await P(), d) {
|
|
1952
|
-
|
|
1966
|
+
V();
|
|
1953
1967
|
return;
|
|
1954
1968
|
}
|
|
1955
|
-
h && (
|
|
1969
|
+
h && (R(), _("online"), f()), F(), document.addEventListener("visibilitychange", K), window.addEventListener("pagehide", ie), window.addEventListener("beforeunload", ie);
|
|
1956
1970
|
}
|
|
1957
1971
|
}), qe(() => {
|
|
1958
|
-
d = !0,
|
|
1972
|
+
d = !0, H(), w(), v(), V(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", ie), window.removeEventListener("beforeunload", ie);
|
|
1959
1973
|
});
|
|
1960
1974
|
}
|
|
1961
1975
|
const zo = 12e3, jo = 250, $o = 20;
|
|
1962
1976
|
function Fa(e) {
|
|
1963
|
-
const n =
|
|
1964
|
-
let x = 0,
|
|
1965
|
-
const
|
|
1977
|
+
const n = Ft(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = Mt(), A = d !== null;
|
|
1978
|
+
let x = 0, v = null, w = null;
|
|
1979
|
+
const R = re(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "", _ = () => {
|
|
1966
1980
|
const C = l.value?.trim() ?? "";
|
|
1967
1981
|
if (C.length > 0)
|
|
1968
1982
|
return C;
|
|
1969
|
-
const
|
|
1970
|
-
return
|
|
1971
|
-
}, f = (C) => n.getTypingUsers(C),
|
|
1972
|
-
const
|
|
1973
|
-
for (const
|
|
1974
|
-
n.removeTypingUser(C,
|
|
1983
|
+
const U = E();
|
|
1984
|
+
return U.length > 0 && (l.value = U), U;
|
|
1985
|
+
}, f = (C) => n.getTypingUsers(C), b = (C) => {
|
|
1986
|
+
const U = f(C);
|
|
1987
|
+
for (const I of U)
|
|
1988
|
+
n.removeTypingUser(C, I.id);
|
|
1975
1989
|
h.value = [];
|
|
1976
|
-
},
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1990
|
+
}, y = (C) => {
|
|
1991
|
+
const U = g.get(C);
|
|
1992
|
+
U && (clearTimeout(U), g.delete(C));
|
|
1979
1993
|
}, F = () => {
|
|
1980
1994
|
for (const C of g.values())
|
|
1981
1995
|
clearTimeout(C);
|
|
1982
1996
|
g.clear();
|
|
1983
|
-
},
|
|
1984
|
-
|
|
1985
|
-
const
|
|
1986
|
-
g.delete(C), n.removeTypingUser(
|
|
1997
|
+
}, H = (C, U) => {
|
|
1998
|
+
y(C);
|
|
1999
|
+
const I = setTimeout(() => {
|
|
2000
|
+
g.delete(C), n.removeTypingUser(U, C), h.value = h.value.filter((q) => q.id !== C);
|
|
1987
2001
|
}, zo);
|
|
1988
|
-
g.set(C,
|
|
2002
|
+
g.set(C, I);
|
|
1989
2003
|
}, B = () => {
|
|
1990
|
-
|
|
2004
|
+
v && (clearTimeout(v), v = null), x = 0;
|
|
1991
2005
|
}, P = () => {
|
|
1992
|
-
const C =
|
|
2006
|
+
const C = E();
|
|
1993
2007
|
if (!(o.value || !C)) {
|
|
1994
2008
|
if (u.value = null, !Ae()) {
|
|
1995
|
-
A && !
|
|
1996
|
-
|
|
2009
|
+
A && !v && x < $o && (v = setTimeout(() => {
|
|
2010
|
+
v = null, x += 1, P();
|
|
1997
2011
|
}, jo));
|
|
1998
2012
|
return;
|
|
1999
2013
|
}
|
|
2000
2014
|
try {
|
|
2001
|
-
|
|
2002
|
-
onTypingStart:
|
|
2003
|
-
onTypingStop:
|
|
2015
|
+
w && (w(), w = null), w = vi(C, {
|
|
2016
|
+
onTypingStart: V,
|
|
2017
|
+
onTypingStop: O
|
|
2004
2018
|
}), o.value = !0, l.value = C, B();
|
|
2005
|
-
} catch (
|
|
2006
|
-
u.value =
|
|
2019
|
+
} catch (U) {
|
|
2020
|
+
u.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
|
|
2007
2021
|
}
|
|
2008
2022
|
}
|
|
2009
|
-
},
|
|
2023
|
+
}, L = () => {
|
|
2010
2024
|
const C = l.value;
|
|
2011
2025
|
if (B(), !(!o.value || !C))
|
|
2012
2026
|
try {
|
|
2013
|
-
|
|
2014
|
-
} catch (
|
|
2015
|
-
u.value =
|
|
2027
|
+
w && (w(), w = null), bi(C), F(), b(C), o.value = !1, l.value = null, u.value = null;
|
|
2028
|
+
} catch (U) {
|
|
2029
|
+
u.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2016
2030
|
}
|
|
2017
2031
|
};
|
|
2018
|
-
function
|
|
2019
|
-
if (C.user_id ===
|
|
2032
|
+
function V(C) {
|
|
2033
|
+
if (C.user_id === R.value)
|
|
2020
2034
|
return;
|
|
2021
|
-
const
|
|
2022
|
-
if (!
|
|
2035
|
+
const U = _();
|
|
2036
|
+
if (!U)
|
|
2023
2037
|
return;
|
|
2024
|
-
const
|
|
2038
|
+
const I = {
|
|
2025
2039
|
id: C.user.id,
|
|
2026
2040
|
name: C.user.name,
|
|
2027
2041
|
...C.user.avatar !== void 0 ? { avatar: C.user.avatar } : {}
|
|
2028
2042
|
};
|
|
2029
|
-
h.value.some((
|
|
2043
|
+
h.value.some((q) => q.id === I.id) || (h.value = [...h.value, I]), n.addTypingUser(U, I), H(C.user_id, U);
|
|
2030
2044
|
}
|
|
2031
|
-
function
|
|
2032
|
-
if (C.user_id ===
|
|
2045
|
+
function O(C) {
|
|
2046
|
+
if (C.user_id === R.value)
|
|
2033
2047
|
return;
|
|
2034
|
-
|
|
2035
|
-
const
|
|
2036
|
-
|
|
2048
|
+
y(C.user_id);
|
|
2049
|
+
const U = _();
|
|
2050
|
+
U && (h.value = h.value.filter((I) => I.id !== C.user_id), n.removeTypingUser(U, C.user_id));
|
|
2037
2051
|
}
|
|
2038
|
-
const K =
|
|
2039
|
-
const C =
|
|
2052
|
+
const K = re(() => {
|
|
2053
|
+
const C = _();
|
|
2040
2054
|
if (!C)
|
|
2041
2055
|
return h.value;
|
|
2042
|
-
const
|
|
2056
|
+
const U = f(C);
|
|
2043
2057
|
if (h.value.length === 0)
|
|
2044
|
-
return
|
|
2045
|
-
if (
|
|
2058
|
+
return U;
|
|
2059
|
+
if (U.length === 0)
|
|
2046
2060
|
return h.value;
|
|
2047
|
-
const
|
|
2048
|
-
for (const
|
|
2049
|
-
|
|
2050
|
-
for (const
|
|
2051
|
-
|
|
2052
|
-
return [...
|
|
2053
|
-
}),
|
|
2061
|
+
const I = /* @__PURE__ */ new Map();
|
|
2062
|
+
for (const q of U)
|
|
2063
|
+
I.set(q.id, q);
|
|
2064
|
+
for (const q of h.value)
|
|
2065
|
+
I.set(q.id, q);
|
|
2066
|
+
return [...I.values()];
|
|
2067
|
+
}), ie = re(() => {
|
|
2054
2068
|
const C = K.value;
|
|
2055
2069
|
if (C.length === 0)
|
|
2056
2070
|
return "";
|
|
2057
|
-
const
|
|
2058
|
-
if (!
|
|
2071
|
+
const U = C[0];
|
|
2072
|
+
if (!U)
|
|
2059
2073
|
return "";
|
|
2060
2074
|
if (C.length === 1)
|
|
2061
|
-
return `${
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2075
|
+
return `${U.name} is typing...`;
|
|
2076
|
+
const I = C[1];
|
|
2077
|
+
if (!I)
|
|
2064
2078
|
return `${C.length} people are typing...`;
|
|
2065
2079
|
if (C.length === 2)
|
|
2066
|
-
return `${
|
|
2067
|
-
const
|
|
2068
|
-
return
|
|
2069
|
-
}),
|
|
2080
|
+
return `${U.name} and ${I.name} are typing...`;
|
|
2081
|
+
const q = C[2];
|
|
2082
|
+
return q ? C.length === 3 ? `${U.name}, ${I.name} and ${q.name} are typing...` : `${C.length} people are typing...` : `${C.length} people are typing...`;
|
|
2083
|
+
}), $ = re(() => K.value.length > 0), m = () => {
|
|
2070
2084
|
o.value || P();
|
|
2071
2085
|
};
|
|
2072
|
-
typeof window < "u" && window.addEventListener(De(),
|
|
2073
|
-
const
|
|
2086
|
+
typeof window < "u" && window.addEventListener(De(), m);
|
|
2087
|
+
const j = it((C) => {
|
|
2074
2088
|
if (C === "connected") {
|
|
2075
2089
|
o.value || P();
|
|
2076
2090
|
return;
|
|
2077
2091
|
}
|
|
2078
2092
|
if (C === "disconnected" || C === "error") {
|
|
2079
|
-
B(),
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2093
|
+
B(), w && (w(), w = null);
|
|
2094
|
+
const U = _();
|
|
2095
|
+
U && b(U), o.value = !1, l.value = null, F();
|
|
2082
2096
|
}
|
|
2083
2097
|
});
|
|
2084
2098
|
return d !== null && qe(() => {
|
|
2085
|
-
B(),
|
|
2099
|
+
B(), j(), F(), L(), typeof window < "u" && window.removeEventListener(De(), m);
|
|
2086
2100
|
}), {
|
|
2087
|
-
isSubscribed:
|
|
2088
|
-
error:
|
|
2101
|
+
isSubscribed: re(() => o.value),
|
|
2102
|
+
error: re(() => u.value),
|
|
2089
2103
|
typingUsers: K,
|
|
2090
|
-
formatTypingIndicator:
|
|
2091
|
-
hasTypingUsers:
|
|
2104
|
+
formatTypingIndicator: ie,
|
|
2105
|
+
hasTypingUsers: $,
|
|
2092
2106
|
subscribe: P,
|
|
2093
|
-
unsubscribe:
|
|
2107
|
+
unsubscribe: L
|
|
2094
2108
|
};
|
|
2095
2109
|
}
|
|
2096
2110
|
function Da(e) {
|
|
@@ -2099,7 +2113,7 @@ function Da(e) {
|
|
|
2099
2113
|
function qa() {
|
|
2100
2114
|
Ei(), lo(), Ai(), Mi(), oo(), bo(), _i(), so(), Eo();
|
|
2101
2115
|
}
|
|
2102
|
-
class
|
|
2116
|
+
class $t {
|
|
2103
2117
|
constructor() {
|
|
2104
2118
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2105
2119
|
}
|
|
@@ -2157,7 +2171,7 @@ function Ho(e) {
|
|
|
2157
2171
|
}
|
|
2158
2172
|
return !0;
|
|
2159
2173
|
}
|
|
2160
|
-
class
|
|
2174
|
+
class Ht extends $t {
|
|
2161
2175
|
/**
|
|
2162
2176
|
* Create a new class instance.
|
|
2163
2177
|
*/
|
|
@@ -2234,7 +2248,7 @@ class $t extends jt {
|
|
|
2234
2248
|
return this.subscription.bind(n, i), this;
|
|
2235
2249
|
}
|
|
2236
2250
|
}
|
|
2237
|
-
class is extends
|
|
2251
|
+
class is extends Ht {
|
|
2238
2252
|
/**
|
|
2239
2253
|
* Send a whisper event to other clients in the channel.
|
|
2240
2254
|
*/
|
|
@@ -2245,7 +2259,7 @@ class is extends $t {
|
|
|
2245
2259
|
), this;
|
|
2246
2260
|
}
|
|
2247
2261
|
}
|
|
2248
|
-
class Bo extends
|
|
2262
|
+
class Bo extends Ht {
|
|
2249
2263
|
/**
|
|
2250
2264
|
* Send a whisper event to other clients in the channel.
|
|
2251
2265
|
*/
|
|
@@ -2291,7 +2305,7 @@ class Vo extends is {
|
|
|
2291
2305
|
}), this;
|
|
2292
2306
|
}
|
|
2293
2307
|
}
|
|
2294
|
-
class os extends
|
|
2308
|
+
class os extends $t {
|
|
2295
2309
|
/**
|
|
2296
2310
|
* Create a new class instance.
|
|
2297
2311
|
*/
|
|
@@ -2417,7 +2431,7 @@ class Xo extends as {
|
|
|
2417
2431
|
), this;
|
|
2418
2432
|
}
|
|
2419
2433
|
}
|
|
2420
|
-
class rt extends
|
|
2434
|
+
class rt extends $t {
|
|
2421
2435
|
/**
|
|
2422
2436
|
* Subscribe to a channel.
|
|
2423
2437
|
*/
|
|
@@ -2549,8 +2563,8 @@ us._defaultOptions = {
|
|
|
2549
2563
|
key: null,
|
|
2550
2564
|
namespace: "App.Events"
|
|
2551
2565
|
};
|
|
2552
|
-
let
|
|
2553
|
-
class Qe extends
|
|
2566
|
+
let Bt = us;
|
|
2567
|
+
class Qe extends Bt {
|
|
2554
2568
|
constructor() {
|
|
2555
2569
|
super(...arguments), this.channels = {};
|
|
2556
2570
|
}
|
|
@@ -2588,7 +2602,7 @@ class Qe extends Ht {
|
|
|
2588
2602
|
* Get a channel instance by name.
|
|
2589
2603
|
*/
|
|
2590
2604
|
channel(n) {
|
|
2591
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2605
|
+
return this.channels[n] || (this.channels[n] = new Ht(
|
|
2592
2606
|
this.pusher,
|
|
2593
2607
|
n,
|
|
2594
2608
|
this.options
|
|
@@ -2687,7 +2701,7 @@ class Qe extends Ht {
|
|
|
2687
2701
|
this.pusher.disconnect();
|
|
2688
2702
|
}
|
|
2689
2703
|
}
|
|
2690
|
-
class Jo extends
|
|
2704
|
+
class Jo extends Bt {
|
|
2691
2705
|
constructor() {
|
|
2692
2706
|
super(...arguments), this.channels = {};
|
|
2693
2707
|
}
|
|
@@ -2809,7 +2823,7 @@ class Jo extends Ht {
|
|
|
2809
2823
|
this.socket.disconnect();
|
|
2810
2824
|
}
|
|
2811
2825
|
}
|
|
2812
|
-
class Mn extends
|
|
2826
|
+
class Mn extends Bt {
|
|
2813
2827
|
constructor() {
|
|
2814
2828
|
super(...arguments), this.channels = {};
|
|
2815
2829
|
}
|
|
@@ -3101,112 +3115,112 @@ function Qo() {
|
|
|
3101
3115
|
/***/
|
|
3102
3116
|
(function(i, o, u) {
|
|
3103
3117
|
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3104
|
-
var
|
|
3105
|
-
return
|
|
3106
|
-
|
|
3107
|
-
} || function(
|
|
3108
|
-
for (var
|
|
3109
|
-
},
|
|
3118
|
+
var _ = function(f, b) {
|
|
3119
|
+
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, F) {
|
|
3120
|
+
y.__proto__ = F;
|
|
3121
|
+
} || function(y, F) {
|
|
3122
|
+
for (var H in F) F.hasOwnProperty(H) && (y[H] = F[H]);
|
|
3123
|
+
}, _(f, b);
|
|
3110
3124
|
};
|
|
3111
|
-
return function(f,
|
|
3112
|
-
|
|
3113
|
-
function
|
|
3125
|
+
return function(f, b) {
|
|
3126
|
+
_(f, b);
|
|
3127
|
+
function y() {
|
|
3114
3128
|
this.constructor = f;
|
|
3115
3129
|
}
|
|
3116
|
-
f.prototype =
|
|
3130
|
+
f.prototype = b === null ? Object.create(b) : (y.prototype = b.prototype, new y());
|
|
3117
3131
|
};
|
|
3118
3132
|
})();
|
|
3119
3133
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3120
3134
|
var h = 256, g = (
|
|
3121
3135
|
/** @class */
|
|
3122
3136
|
(function() {
|
|
3123
|
-
function
|
|
3137
|
+
function _(f) {
|
|
3124
3138
|
f === void 0 && (f = "="), this._paddingCharacter = f;
|
|
3125
3139
|
}
|
|
3126
|
-
return
|
|
3140
|
+
return _.prototype.encodedLength = function(f) {
|
|
3127
3141
|
return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
|
|
3128
|
-
},
|
|
3129
|
-
for (var
|
|
3130
|
-
var F = f[
|
|
3131
|
-
|
|
3142
|
+
}, _.prototype.encode = function(f) {
|
|
3143
|
+
for (var b = "", y = 0; y < f.length - 2; y += 3) {
|
|
3144
|
+
var F = f[y] << 16 | f[y + 1] << 8 | f[y + 2];
|
|
3145
|
+
b += this._encodeByte(F >>> 18 & 63), b += this._encodeByte(F >>> 12 & 63), b += this._encodeByte(F >>> 6 & 63), b += this._encodeByte(F >>> 0 & 63);
|
|
3132
3146
|
}
|
|
3133
|
-
var
|
|
3134
|
-
if (
|
|
3135
|
-
var F = f[
|
|
3136
|
-
|
|
3147
|
+
var H = f.length - y;
|
|
3148
|
+
if (H > 0) {
|
|
3149
|
+
var F = f[y] << 16 | (H === 2 ? f[y + 1] << 8 : 0);
|
|
3150
|
+
b += this._encodeByte(F >>> 18 & 63), b += this._encodeByte(F >>> 12 & 63), H === 2 ? b += this._encodeByte(F >>> 6 & 63) : b += this._paddingCharacter || "", b += this._paddingCharacter || "";
|
|
3137
3151
|
}
|
|
3138
|
-
return
|
|
3139
|
-
},
|
|
3152
|
+
return b;
|
|
3153
|
+
}, _.prototype.maxDecodedLength = function(f) {
|
|
3140
3154
|
return this._paddingCharacter ? f / 4 * 3 | 0 : (f * 6 + 7) / 8 | 0;
|
|
3141
|
-
},
|
|
3155
|
+
}, _.prototype.decodedLength = function(f) {
|
|
3142
3156
|
return this.maxDecodedLength(f.length - this._getPaddingLength(f));
|
|
3143
|
-
},
|
|
3157
|
+
}, _.prototype.decode = function(f) {
|
|
3144
3158
|
if (f.length === 0)
|
|
3145
3159
|
return new Uint8Array(0);
|
|
3146
|
-
for (var
|
|
3147
|
-
|
|
3148
|
-
if (B <
|
|
3160
|
+
for (var b = this._getPaddingLength(f), y = f.length - b, F = new Uint8Array(this.maxDecodedLength(y)), H = 0, B = 0, P = 0, L = 0, V = 0, O = 0, K = 0; B < y - 4; B += 4)
|
|
3161
|
+
L = this._decodeChar(f.charCodeAt(B + 0)), V = this._decodeChar(f.charCodeAt(B + 1)), O = this._decodeChar(f.charCodeAt(B + 2)), K = this._decodeChar(f.charCodeAt(B + 3)), F[H++] = L << 2 | V >>> 4, F[H++] = V << 4 | O >>> 2, F[H++] = O << 6 | K, P |= L & h, P |= V & h, P |= O & h, P |= K & h;
|
|
3162
|
+
if (B < y - 1 && (L = this._decodeChar(f.charCodeAt(B)), V = this._decodeChar(f.charCodeAt(B + 1)), F[H++] = L << 2 | V >>> 4, P |= L & h, P |= V & h), B < y - 2 && (O = this._decodeChar(f.charCodeAt(B + 2)), F[H++] = V << 4 | O >>> 2, P |= O & h), B < y - 3 && (K = this._decodeChar(f.charCodeAt(B + 3)), F[H++] = O << 6 | K, P |= K & h), P !== 0)
|
|
3149
3163
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3150
3164
|
return F;
|
|
3151
|
-
},
|
|
3152
|
-
var
|
|
3153
|
-
return
|
|
3154
|
-
},
|
|
3155
|
-
var
|
|
3156
|
-
return
|
|
3157
|
-
},
|
|
3158
|
-
var
|
|
3165
|
+
}, _.prototype._encodeByte = function(f) {
|
|
3166
|
+
var b = f;
|
|
3167
|
+
return b += 65, b += 25 - f >>> 8 & 6, b += 51 - f >>> 8 & -75, b += 61 - f >>> 8 & -15, b += 62 - f >>> 8 & 3, String.fromCharCode(b);
|
|
3168
|
+
}, _.prototype._decodeChar = function(f) {
|
|
3169
|
+
var b = h;
|
|
3170
|
+
return b += (42 - f & f - 44) >>> 8 & -h + f - 43 + 62, b += (46 - f & f - 48) >>> 8 & -h + f - 47 + 63, b += (47 - f & f - 58) >>> 8 & -h + f - 48 + 52, b += (64 - f & f - 91) >>> 8 & -h + f - 65 + 0, b += (96 - f & f - 123) >>> 8 & -h + f - 97 + 26, b;
|
|
3171
|
+
}, _.prototype._getPaddingLength = function(f) {
|
|
3172
|
+
var b = 0;
|
|
3159
3173
|
if (this._paddingCharacter) {
|
|
3160
|
-
for (var
|
|
3161
|
-
|
|
3162
|
-
if (f.length < 4 ||
|
|
3174
|
+
for (var y = f.length - 1; y >= 0 && f[y] === this._paddingCharacter; y--)
|
|
3175
|
+
b++;
|
|
3176
|
+
if (f.length < 4 || b > 2)
|
|
3163
3177
|
throw new Error("Base64Coder: incorrect padding");
|
|
3164
3178
|
}
|
|
3165
|
-
return
|
|
3166
|
-
},
|
|
3179
|
+
return b;
|
|
3180
|
+
}, _;
|
|
3167
3181
|
})()
|
|
3168
3182
|
);
|
|
3169
3183
|
o.Coder = g;
|
|
3170
3184
|
var d = new g();
|
|
3171
|
-
function A(
|
|
3172
|
-
return d.encode(
|
|
3185
|
+
function A(_) {
|
|
3186
|
+
return d.encode(_);
|
|
3173
3187
|
}
|
|
3174
3188
|
o.encode = A;
|
|
3175
|
-
function x(
|
|
3176
|
-
return d.decode(
|
|
3189
|
+
function x(_) {
|
|
3190
|
+
return d.decode(_);
|
|
3177
3191
|
}
|
|
3178
3192
|
o.decode = x;
|
|
3179
|
-
var
|
|
3193
|
+
var v = (
|
|
3180
3194
|
/** @class */
|
|
3181
|
-
(function(
|
|
3182
|
-
l(f,
|
|
3195
|
+
(function(_) {
|
|
3196
|
+
l(f, _);
|
|
3183
3197
|
function f() {
|
|
3184
|
-
return
|
|
3198
|
+
return _ !== null && _.apply(this, arguments) || this;
|
|
3185
3199
|
}
|
|
3186
|
-
return f.prototype._encodeByte = function(
|
|
3187
|
-
var
|
|
3188
|
-
return
|
|
3189
|
-
}, f.prototype._decodeChar = function(
|
|
3190
|
-
var
|
|
3191
|
-
return
|
|
3200
|
+
return f.prototype._encodeByte = function(b) {
|
|
3201
|
+
var y = b;
|
|
3202
|
+
return y += 65, y += 25 - b >>> 8 & 6, y += 51 - b >>> 8 & -75, y += 61 - b >>> 8 & -13, y += 62 - b >>> 8 & 49, String.fromCharCode(y);
|
|
3203
|
+
}, f.prototype._decodeChar = function(b) {
|
|
3204
|
+
var y = h;
|
|
3205
|
+
return y += (44 - b & b - 46) >>> 8 & -h + b - 45 + 62, y += (94 - b & b - 96) >>> 8 & -h + b - 95 + 63, y += (47 - b & b - 58) >>> 8 & -h + b - 48 + 52, y += (64 - b & b - 91) >>> 8 & -h + b - 65 + 0, y += (96 - b & b - 123) >>> 8 & -h + b - 97 + 26, y;
|
|
3192
3206
|
}, f;
|
|
3193
3207
|
})(g)
|
|
3194
3208
|
);
|
|
3195
|
-
o.URLSafeCoder =
|
|
3196
|
-
var
|
|
3197
|
-
function
|
|
3198
|
-
return
|
|
3209
|
+
o.URLSafeCoder = v;
|
|
3210
|
+
var w = new v();
|
|
3211
|
+
function R(_) {
|
|
3212
|
+
return w.encode(_);
|
|
3199
3213
|
}
|
|
3200
|
-
o.encodeURLSafe =
|
|
3201
|
-
function
|
|
3202
|
-
return
|
|
3214
|
+
o.encodeURLSafe = R;
|
|
3215
|
+
function E(_) {
|
|
3216
|
+
return w.decode(_);
|
|
3203
3217
|
}
|
|
3204
|
-
o.decodeURLSafe =
|
|
3205
|
-
return d.encodedLength(
|
|
3206
|
-
}, o.maxDecodedLength = function(
|
|
3207
|
-
return d.maxDecodedLength(
|
|
3208
|
-
}, o.decodedLength = function(
|
|
3209
|
-
return d.decodedLength(
|
|
3218
|
+
o.decodeURLSafe = E, o.encodedLength = function(_) {
|
|
3219
|
+
return d.encodedLength(_);
|
|
3220
|
+
}, o.maxDecodedLength = function(_) {
|
|
3221
|
+
return d.maxDecodedLength(_);
|
|
3222
|
+
}, o.decodedLength = function(_) {
|
|
3223
|
+
return d.decodedLength(_);
|
|
3210
3224
|
};
|
|
3211
3225
|
}),
|
|
3212
3226
|
/* 1 */
|
|
@@ -3215,71 +3229,71 @@ function Qo() {
|
|
|
3215
3229
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3216
3230
|
var l = "utf8: invalid string", h = "utf8: invalid source encoding";
|
|
3217
3231
|
function g(x) {
|
|
3218
|
-
for (var
|
|
3219
|
-
var
|
|
3220
|
-
|
|
3232
|
+
for (var v = new Uint8Array(d(x)), w = 0, R = 0; R < x.length; R++) {
|
|
3233
|
+
var E = x.charCodeAt(R);
|
|
3234
|
+
E < 128 ? v[w++] = E : E < 2048 ? (v[w++] = 192 | E >> 6, v[w++] = 128 | E & 63) : E < 55296 ? (v[w++] = 224 | E >> 12, v[w++] = 128 | E >> 6 & 63, v[w++] = 128 | E & 63) : (R++, E = (E & 1023) << 10, E |= x.charCodeAt(R) & 1023, E += 65536, v[w++] = 240 | E >> 18, v[w++] = 128 | E >> 12 & 63, v[w++] = 128 | E >> 6 & 63, v[w++] = 128 | E & 63);
|
|
3221
3235
|
}
|
|
3222
|
-
return
|
|
3236
|
+
return v;
|
|
3223
3237
|
}
|
|
3224
3238
|
o.encode = g;
|
|
3225
3239
|
function d(x) {
|
|
3226
|
-
for (var
|
|
3227
|
-
var
|
|
3228
|
-
if (
|
|
3229
|
-
|
|
3230
|
-
else if (
|
|
3231
|
-
|
|
3232
|
-
else if (
|
|
3233
|
-
|
|
3234
|
-
else if (
|
|
3235
|
-
if (
|
|
3240
|
+
for (var v = 0, w = 0; w < x.length; w++) {
|
|
3241
|
+
var R = x.charCodeAt(w);
|
|
3242
|
+
if (R < 128)
|
|
3243
|
+
v += 1;
|
|
3244
|
+
else if (R < 2048)
|
|
3245
|
+
v += 2;
|
|
3246
|
+
else if (R < 55296)
|
|
3247
|
+
v += 3;
|
|
3248
|
+
else if (R <= 57343) {
|
|
3249
|
+
if (w >= x.length - 1)
|
|
3236
3250
|
throw new Error(l);
|
|
3237
|
-
|
|
3251
|
+
w++, v += 4;
|
|
3238
3252
|
} else
|
|
3239
3253
|
throw new Error(l);
|
|
3240
3254
|
}
|
|
3241
|
-
return
|
|
3255
|
+
return v;
|
|
3242
3256
|
}
|
|
3243
3257
|
o.encodedLength = d;
|
|
3244
3258
|
function A(x) {
|
|
3245
|
-
for (var
|
|
3246
|
-
var
|
|
3247
|
-
if (
|
|
3248
|
-
var
|
|
3249
|
-
if (
|
|
3250
|
-
if (
|
|
3259
|
+
for (var v = [], w = 0; w < x.length; w++) {
|
|
3260
|
+
var R = x[w];
|
|
3261
|
+
if (R & 128) {
|
|
3262
|
+
var E = void 0;
|
|
3263
|
+
if (R < 224) {
|
|
3264
|
+
if (w >= x.length)
|
|
3251
3265
|
throw new Error(h);
|
|
3252
|
-
var
|
|
3253
|
-
if ((
|
|
3266
|
+
var _ = x[++w];
|
|
3267
|
+
if ((_ & 192) !== 128)
|
|
3254
3268
|
throw new Error(h);
|
|
3255
|
-
|
|
3256
|
-
} else if (
|
|
3257
|
-
if (
|
|
3269
|
+
R = (R & 31) << 6 | _ & 63, E = 128;
|
|
3270
|
+
} else if (R < 240) {
|
|
3271
|
+
if (w >= x.length - 1)
|
|
3258
3272
|
throw new Error(h);
|
|
3259
|
-
var
|
|
3260
|
-
if ((
|
|
3273
|
+
var _ = x[++w], f = x[++w];
|
|
3274
|
+
if ((_ & 192) !== 128 || (f & 192) !== 128)
|
|
3261
3275
|
throw new Error(h);
|
|
3262
|
-
|
|
3263
|
-
} else if (
|
|
3264
|
-
if (
|
|
3276
|
+
R = (R & 15) << 12 | (_ & 63) << 6 | f & 63, E = 2048;
|
|
3277
|
+
} else if (R < 248) {
|
|
3278
|
+
if (w >= x.length - 2)
|
|
3265
3279
|
throw new Error(h);
|
|
3266
|
-
var
|
|
3267
|
-
if ((
|
|
3280
|
+
var _ = x[++w], f = x[++w], b = x[++w];
|
|
3281
|
+
if ((_ & 192) !== 128 || (f & 192) !== 128 || (b & 192) !== 128)
|
|
3268
3282
|
throw new Error(h);
|
|
3269
|
-
|
|
3283
|
+
R = (R & 15) << 18 | (_ & 63) << 12 | (f & 63) << 6 | b & 63, E = 65536;
|
|
3270
3284
|
} else
|
|
3271
3285
|
throw new Error(h);
|
|
3272
|
-
if (
|
|
3286
|
+
if (R < E || R >= 55296 && R <= 57343)
|
|
3273
3287
|
throw new Error(h);
|
|
3274
|
-
if (
|
|
3275
|
-
if (
|
|
3288
|
+
if (R >= 65536) {
|
|
3289
|
+
if (R > 1114111)
|
|
3276
3290
|
throw new Error(h);
|
|
3277
|
-
|
|
3291
|
+
R -= 65536, v.push(String.fromCharCode(55296 | R >> 10)), R = 56320 | R & 1023;
|
|
3278
3292
|
}
|
|
3279
3293
|
}
|
|
3280
|
-
|
|
3294
|
+
v.push(String.fromCharCode(R));
|
|
3281
3295
|
}
|
|
3282
|
-
return
|
|
3296
|
+
return v.join("");
|
|
3283
3297
|
}
|
|
3284
3298
|
o.decode = A;
|
|
3285
3299
|
}),
|
|
@@ -3298,10 +3312,10 @@ function Qo() {
|
|
|
3298
3312
|
}
|
|
3299
3313
|
create(t) {
|
|
3300
3314
|
this.lastId++;
|
|
3301
|
-
var s = this.lastId, a = this.prefix + s, c = this.name + "[" + s + "]", p = !1,
|
|
3315
|
+
var s = this.lastId, a = this.prefix + s, c = this.name + "[" + s + "]", p = !1, S = function() {
|
|
3302
3316
|
p || (t.apply(null, arguments), p = !0);
|
|
3303
3317
|
};
|
|
3304
|
-
return this[s] =
|
|
3318
|
+
return this[s] = S, { number: s, id: a, name: c, callback: S };
|
|
3305
3319
|
}
|
|
3306
3320
|
remove(t) {
|
|
3307
3321
|
delete this[t.number];
|
|
@@ -3345,35 +3359,35 @@ function Qo() {
|
|
|
3345
3359
|
c.loading[t].push(a);
|
|
3346
3360
|
else {
|
|
3347
3361
|
c.loading[t] = [a];
|
|
3348
|
-
var p =
|
|
3349
|
-
if (c.receivers.remove(
|
|
3362
|
+
var p = z.createScriptRequest(c.getPath(t, s)), S = c.receivers.create(function(k) {
|
|
3363
|
+
if (c.receivers.remove(S), c.loading[t]) {
|
|
3350
3364
|
var D = c.loading[t];
|
|
3351
3365
|
delete c.loading[t];
|
|
3352
|
-
for (var
|
|
3366
|
+
for (var Y = function(oe) {
|
|
3353
3367
|
oe || p.cleanup();
|
|
3354
|
-
},
|
|
3355
|
-
D[
|
|
3368
|
+
}, ee = 0; ee < D.length; ee++)
|
|
3369
|
+
D[ee](k, Y);
|
|
3356
3370
|
}
|
|
3357
3371
|
});
|
|
3358
|
-
p.send(
|
|
3372
|
+
p.send(S);
|
|
3359
3373
|
}
|
|
3360
3374
|
}
|
|
3361
3375
|
getRoot(t) {
|
|
3362
|
-
var s, a =
|
|
3376
|
+
var s, a = z.getDocument().location.protocol;
|
|
3363
3377
|
return t && t.useTLS || a === "https:" ? s = this.options.cdn_https : s = this.options.cdn_http, s.replace(/\/*$/, "") + "/" + this.options.version;
|
|
3364
3378
|
}
|
|
3365
3379
|
getPath(t, s) {
|
|
3366
3380
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3367
3381
|
}
|
|
3368
3382
|
}
|
|
3369
|
-
var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"),
|
|
3383
|
+
var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new A({
|
|
3370
3384
|
cdn_http: d.cdn_http,
|
|
3371
3385
|
cdn_https: d.cdn_https,
|
|
3372
3386
|
version: d.VERSION,
|
|
3373
3387
|
suffix: d.dependency_suffix,
|
|
3374
3388
|
receivers: x
|
|
3375
3389
|
});
|
|
3376
|
-
const
|
|
3390
|
+
const w = {
|
|
3377
3391
|
baseUrl: "https://pusher.com",
|
|
3378
3392
|
urls: {
|
|
3379
3393
|
authenticationEndpoint: {
|
|
@@ -3393,27 +3407,27 @@ function Qo() {
|
|
|
3393
3407
|
}
|
|
3394
3408
|
}
|
|
3395
3409
|
};
|
|
3396
|
-
var
|
|
3397
|
-
const t = "See:", s =
|
|
3410
|
+
var E = { buildLogSuffix: function(r) {
|
|
3411
|
+
const t = "See:", s = w.urls[r];
|
|
3398
3412
|
if (!s)
|
|
3399
3413
|
return "";
|
|
3400
3414
|
let a;
|
|
3401
|
-
return s.fullUrl ? a = s.fullUrl : s.path && (a =
|
|
3402
|
-
} },
|
|
3415
|
+
return s.fullUrl ? a = s.fullUrl : s.path && (a = w.baseUrl + s.path), a ? `${t} ${a}` : "";
|
|
3416
|
+
} }, _;
|
|
3403
3417
|
(function(r) {
|
|
3404
3418
|
r.UserAuthentication = "user-authentication", r.ChannelAuthorization = "channel-authorization";
|
|
3405
|
-
})(
|
|
3419
|
+
})(_ || (_ = {}));
|
|
3406
3420
|
class f extends Error {
|
|
3407
3421
|
constructor(t) {
|
|
3408
3422
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3409
3423
|
}
|
|
3410
3424
|
}
|
|
3411
|
-
class
|
|
3425
|
+
class b extends Error {
|
|
3412
3426
|
constructor(t) {
|
|
3413
3427
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3414
3428
|
}
|
|
3415
3429
|
}
|
|
3416
|
-
class
|
|
3430
|
+
class y extends Error {
|
|
3417
3431
|
constructor(t) {
|
|
3418
3432
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3419
3433
|
}
|
|
@@ -3423,7 +3437,7 @@ function Qo() {
|
|
|
3423
3437
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3424
3438
|
}
|
|
3425
3439
|
}
|
|
3426
|
-
class
|
|
3440
|
+
class H extends Error {
|
|
3427
3441
|
constructor(t) {
|
|
3428
3442
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3429
3443
|
}
|
|
@@ -3438,70 +3452,70 @@ function Qo() {
|
|
|
3438
3452
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3439
3453
|
}
|
|
3440
3454
|
}
|
|
3441
|
-
class
|
|
3455
|
+
class L extends Error {
|
|
3442
3456
|
constructor(t) {
|
|
3443
3457
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3444
3458
|
}
|
|
3445
3459
|
}
|
|
3446
|
-
class
|
|
3460
|
+
class V extends Error {
|
|
3447
3461
|
constructor(t, s) {
|
|
3448
3462
|
super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
|
|
3449
3463
|
}
|
|
3450
3464
|
}
|
|
3451
3465
|
var K = function(r, t, s, a, c) {
|
|
3452
|
-
const p =
|
|
3466
|
+
const p = z.createXHR();
|
|
3453
3467
|
p.open("POST", s.endpoint, !0), p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
3454
|
-
for (var
|
|
3455
|
-
p.setRequestHeader(
|
|
3468
|
+
for (var S in s.headers)
|
|
3469
|
+
p.setRequestHeader(S, s.headers[S]);
|
|
3456
3470
|
if (s.headersProvider != null) {
|
|
3457
|
-
let
|
|
3458
|
-
for (var
|
|
3459
|
-
p.setRequestHeader(
|
|
3471
|
+
let k = s.headersProvider();
|
|
3472
|
+
for (var S in k)
|
|
3473
|
+
p.setRequestHeader(S, k[S]);
|
|
3460
3474
|
}
|
|
3461
3475
|
return p.onreadystatechange = function() {
|
|
3462
3476
|
if (p.readyState === 4)
|
|
3463
3477
|
if (p.status === 200) {
|
|
3464
|
-
let
|
|
3478
|
+
let k, D = !1;
|
|
3465
3479
|
try {
|
|
3466
|
-
|
|
3480
|
+
k = JSON.parse(p.responseText), D = !0;
|
|
3467
3481
|
} catch {
|
|
3468
|
-
c(new
|
|
3482
|
+
c(new V(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
|
|
3469
3483
|
}
|
|
3470
|
-
D && c(null,
|
|
3484
|
+
D && c(null, k);
|
|
3471
3485
|
} else {
|
|
3472
|
-
let
|
|
3486
|
+
let k = "";
|
|
3473
3487
|
switch (a) {
|
|
3474
|
-
case
|
|
3475
|
-
|
|
3488
|
+
case _.UserAuthentication:
|
|
3489
|
+
k = E.buildLogSuffix("authenticationEndpoint");
|
|
3476
3490
|
break;
|
|
3477
|
-
case
|
|
3478
|
-
|
|
3491
|
+
case _.ChannelAuthorization:
|
|
3492
|
+
k = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
|
|
3479
3493
|
break;
|
|
3480
3494
|
}
|
|
3481
|
-
c(new
|
|
3495
|
+
c(new V(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${k}`), null);
|
|
3482
3496
|
}
|
|
3483
3497
|
}, p.send(t), p;
|
|
3484
3498
|
};
|
|
3485
|
-
function
|
|
3486
|
-
return
|
|
3499
|
+
function ie(r) {
|
|
3500
|
+
return I(C(r));
|
|
3487
3501
|
}
|
|
3488
|
-
var
|
|
3502
|
+
var $ = String.fromCharCode, m = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", j = function(r) {
|
|
3489
3503
|
var t = r.charCodeAt(0);
|
|
3490
|
-
return t < 128 ? r : t < 2048 ?
|
|
3504
|
+
return t < 128 ? r : t < 2048 ? $(192 | t >>> 6) + $(128 | t & 63) : $(224 | t >>> 12 & 15) + $(128 | t >>> 6 & 63) + $(128 | t & 63);
|
|
3491
3505
|
}, C = function(r) {
|
|
3492
|
-
return r.replace(/[^\x00-\x7F]/g,
|
|
3493
|
-
},
|
|
3506
|
+
return r.replace(/[^\x00-\x7F]/g, j);
|
|
3507
|
+
}, U = function(r) {
|
|
3494
3508
|
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 = [
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
t >= 2 ? "=" :
|
|
3498
|
-
t >= 1 ? "=" :
|
|
3509
|
+
m.charAt(s >>> 18),
|
|
3510
|
+
m.charAt(s >>> 12 & 63),
|
|
3511
|
+
t >= 2 ? "=" : m.charAt(s >>> 6 & 63),
|
|
3512
|
+
t >= 1 ? "=" : m.charAt(s & 63)
|
|
3499
3513
|
];
|
|
3500
3514
|
return a.join("");
|
|
3501
|
-
},
|
|
3502
|
-
return r.replace(/[\s\S]{1,3}/g,
|
|
3515
|
+
}, I = window.btoa || function(r) {
|
|
3516
|
+
return r.replace(/[\s\S]{1,3}/g, U);
|
|
3503
3517
|
};
|
|
3504
|
-
class
|
|
3518
|
+
class q {
|
|
3505
3519
|
constructor(t, s, a, c) {
|
|
3506
3520
|
this.clear = s, this.timer = t(() => {
|
|
3507
3521
|
this.timer && (this.timer = c(this.timer));
|
|
@@ -3514,28 +3528,28 @@ function Qo() {
|
|
|
3514
3528
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
3515
3529
|
}
|
|
3516
3530
|
}
|
|
3517
|
-
var
|
|
3531
|
+
var se = q;
|
|
3518
3532
|
function je(r) {
|
|
3519
3533
|
window.clearTimeout(r);
|
|
3520
3534
|
}
|
|
3521
|
-
function
|
|
3535
|
+
function Vt(r) {
|
|
3522
3536
|
window.clearInterval(r);
|
|
3523
3537
|
}
|
|
3524
|
-
class T extends
|
|
3538
|
+
class T extends se {
|
|
3525
3539
|
constructor(t, s) {
|
|
3526
3540
|
super(setTimeout, je, t, function(a) {
|
|
3527
3541
|
return s(), null;
|
|
3528
3542
|
});
|
|
3529
3543
|
}
|
|
3530
3544
|
}
|
|
3531
|
-
class
|
|
3545
|
+
class M extends se {
|
|
3532
3546
|
constructor(t, s) {
|
|
3533
|
-
super(setInterval,
|
|
3547
|
+
super(setInterval, Vt, t, function(a) {
|
|
3534
3548
|
return s(), a;
|
|
3535
3549
|
});
|
|
3536
3550
|
}
|
|
3537
3551
|
}
|
|
3538
|
-
var
|
|
3552
|
+
var Q = {
|
|
3539
3553
|
now() {
|
|
3540
3554
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3541
3555
|
},
|
|
@@ -3548,12 +3562,12 @@ function Qo() {
|
|
|
3548
3562
|
return a[r].apply(a, s.concat(arguments));
|
|
3549
3563
|
};
|
|
3550
3564
|
}
|
|
3551
|
-
}, N =
|
|
3552
|
-
function
|
|
3565
|
+
}, N = Q;
|
|
3566
|
+
function X(r, ...t) {
|
|
3553
3567
|
for (var s = 0; s < t.length; s++) {
|
|
3554
3568
|
var a = t[s];
|
|
3555
3569
|
for (var c in a)
|
|
3556
|
-
a[c] && a[c].constructor && a[c].constructor === Object ? r[c] =
|
|
3570
|
+
a[c] && a[c].constructor && a[c].constructor === Object ? r[c] = X(r[c] || {}, a[c]) : r[c] = a[c];
|
|
3557
3571
|
}
|
|
3558
3572
|
return r;
|
|
3559
3573
|
}
|
|
@@ -3604,7 +3618,7 @@ function Qo() {
|
|
|
3604
3618
|
s[c] = t(a);
|
|
3605
3619
|
}), s;
|
|
3606
3620
|
}
|
|
3607
|
-
function
|
|
3621
|
+
function G(r, t) {
|
|
3608
3622
|
t = t || function(c) {
|
|
3609
3623
|
return !!c;
|
|
3610
3624
|
};
|
|
@@ -3624,7 +3638,7 @@ function Qo() {
|
|
|
3624
3638
|
t.push([a, s]);
|
|
3625
3639
|
}), t;
|
|
3626
3640
|
}
|
|
3627
|
-
function
|
|
3641
|
+
function Xt(r, t) {
|
|
3628
3642
|
for (var s = 0; s < r.length; s++)
|
|
3629
3643
|
if (t(r[s], s, r))
|
|
3630
3644
|
return !0;
|
|
@@ -3638,7 +3652,7 @@ function Qo() {
|
|
|
3638
3652
|
}
|
|
3639
3653
|
function fs(r) {
|
|
3640
3654
|
return we(r, function(t) {
|
|
3641
|
-
return typeof t == "object" && (t = He(t)), encodeURIComponent(
|
|
3655
|
+
return typeof t == "object" && (t = He(t)), encodeURIComponent(ie(t.toString()));
|
|
3642
3656
|
});
|
|
3643
3657
|
}
|
|
3644
3658
|
function ps(r) {
|
|
@@ -3650,21 +3664,21 @@ function Qo() {
|
|
|
3650
3664
|
function gs(r) {
|
|
3651
3665
|
var t = [], s = [];
|
|
3652
3666
|
return (function a(c, p) {
|
|
3653
|
-
var
|
|
3667
|
+
var S, k, D;
|
|
3654
3668
|
switch (typeof c) {
|
|
3655
3669
|
case "object":
|
|
3656
3670
|
if (!c)
|
|
3657
3671
|
return null;
|
|
3658
|
-
for (
|
|
3659
|
-
if (t[
|
|
3660
|
-
return { $ref: s[
|
|
3672
|
+
for (S = 0; S < t.length; S += 1)
|
|
3673
|
+
if (t[S] === c)
|
|
3674
|
+
return { $ref: s[S] };
|
|
3661
3675
|
if (t.push(c), s.push(p), Object.prototype.toString.apply(c) === "[object Array]")
|
|
3662
|
-
for (D = [],
|
|
3663
|
-
D[
|
|
3676
|
+
for (D = [], S = 0; S < c.length; S += 1)
|
|
3677
|
+
D[S] = a(c[S], p + "[" + S + "]");
|
|
3664
3678
|
else {
|
|
3665
3679
|
D = {};
|
|
3666
|
-
for (
|
|
3667
|
-
Object.prototype.hasOwnProperty.call(c,
|
|
3680
|
+
for (k in c)
|
|
3681
|
+
Object.prototype.hasOwnProperty.call(c, k) && (D[k] = a(c[k], p + "[" + JSON.stringify(k) + "]"));
|
|
3668
3682
|
}
|
|
3669
3683
|
return D;
|
|
3670
3684
|
case "number":
|
|
@@ -3707,18 +3721,18 @@ function Qo() {
|
|
|
3707
3721
|
vt.log ? vt.log(a) : vt.logToConsole && t.bind(this)(a);
|
|
3708
3722
|
}
|
|
3709
3723
|
}
|
|
3710
|
-
var
|
|
3711
|
-
(s.headers !== void 0 || s.headersProvider != null) &&
|
|
3724
|
+
var ne = new ms(), vs = function(r, t, s, a, c) {
|
|
3725
|
+
(s.headers !== void 0 || s.headersProvider != null) && ne.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
3712
3726
|
var p = r.nextAuthCallbackID.toString();
|
|
3713
3727
|
r.nextAuthCallbackID++;
|
|
3714
|
-
var
|
|
3715
|
-
r.auth_callbacks[p] = function(
|
|
3716
|
-
c(null,
|
|
3728
|
+
var S = r.getDocument(), k = S.createElement("script");
|
|
3729
|
+
r.auth_callbacks[p] = function(ee) {
|
|
3730
|
+
c(null, ee);
|
|
3717
3731
|
};
|
|
3718
3732
|
var D = "Pusher.auth_callbacks['" + p + "']";
|
|
3719
|
-
|
|
3720
|
-
var
|
|
3721
|
-
|
|
3733
|
+
k.src = s.endpoint + "?callback=" + encodeURIComponent(D) + "&" + t;
|
|
3734
|
+
var Y = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3735
|
+
Y.insertBefore(k, Y.firstChild);
|
|
3722
3736
|
}, bs = vs;
|
|
3723
3737
|
class ys {
|
|
3724
3738
|
constructor(t) {
|
|
@@ -3747,7 +3761,7 @@ function Qo() {
|
|
|
3747
3761
|
send(t) {
|
|
3748
3762
|
if (!this.request) {
|
|
3749
3763
|
var s = ps(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
3750
|
-
this.request =
|
|
3764
|
+
this.request = z.createScriptRequest(a), this.request.send(t);
|
|
3751
3765
|
}
|
|
3752
3766
|
}
|
|
3753
3767
|
cleanup() {
|
|
@@ -3756,10 +3770,10 @@ function Qo() {
|
|
|
3756
3770
|
}
|
|
3757
3771
|
var Ss = function(r, t) {
|
|
3758
3772
|
return function(s, a) {
|
|
3759
|
-
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path,
|
|
3760
|
-
h.remove(
|
|
3773
|
+
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, S = z.createJSONPRequest(p, s), k = z.ScriptReceivers.create(function(D, Y) {
|
|
3774
|
+
h.remove(k), S.cleanup(), Y && Y.host && (r.host = Y.host), a && a(D, Y);
|
|
3761
3775
|
});
|
|
3762
|
-
|
|
3776
|
+
S.send(k);
|
|
3763
3777
|
};
|
|
3764
3778
|
}, ws = {
|
|
3765
3779
|
name: "jsonp",
|
|
@@ -3815,7 +3829,7 @@ function Qo() {
|
|
|
3815
3829
|
}
|
|
3816
3830
|
removeCallback(t, s, a) {
|
|
3817
3831
|
ce(t, function(c) {
|
|
3818
|
-
this._callbacks[c] =
|
|
3832
|
+
this._callbacks[c] = G(this._callbacks[c] || [], function(p) {
|
|
3819
3833
|
return s && s !== p.fn || a && a !== p.context;
|
|
3820
3834
|
}), this._callbacks[c].length === 0 && delete this._callbacks[c];
|
|
3821
3835
|
}, this);
|
|
@@ -3843,7 +3857,7 @@ function Qo() {
|
|
|
3843
3857
|
return this.callbacks.remove(t, s, a), this;
|
|
3844
3858
|
}
|
|
3845
3859
|
unbind_global(t) {
|
|
3846
|
-
return t ? (this.global_callbacks =
|
|
3860
|
+
return t ? (this.global_callbacks = G(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
|
|
3847
3861
|
}
|
|
3848
3862
|
unbind_all() {
|
|
3849
3863
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -3851,17 +3865,17 @@ function Qo() {
|
|
|
3851
3865
|
emit(t, s, a) {
|
|
3852
3866
|
for (var c = 0; c < this.global_callbacks.length; c++)
|
|
3853
3867
|
this.global_callbacks[c](t, s);
|
|
3854
|
-
var p = this.callbacks.get(t),
|
|
3855
|
-
if (a ?
|
|
3868
|
+
var p = this.callbacks.get(t), S = [];
|
|
3869
|
+
if (a ? S.push(s, a) : s && S.push(s), p && p.length > 0)
|
|
3856
3870
|
for (var c = 0; c < p.length; c++)
|
|
3857
|
-
p[c].fn.apply(p[c].context || window,
|
|
3871
|
+
p[c].fn.apply(p[c].context || window, S);
|
|
3858
3872
|
else this.failThrough && this.failThrough(t, s);
|
|
3859
3873
|
return this;
|
|
3860
3874
|
}
|
|
3861
3875
|
}
|
|
3862
3876
|
class Ps extends be {
|
|
3863
3877
|
constructor(t, s, a, c, p) {
|
|
3864
|
-
super(), this.initialize =
|
|
3878
|
+
super(), this.initialize = z.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = c, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
3865
3879
|
}
|
|
3866
3880
|
handlesActivityChecks() {
|
|
3867
3881
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -3880,7 +3894,7 @@ function Qo() {
|
|
|
3880
3894
|
this.onError(s), this.changeState("closed");
|
|
3881
3895
|
}), !1;
|
|
3882
3896
|
}
|
|
3883
|
-
return this.bindListeners(),
|
|
3897
|
+
return this.bindListeners(), ne.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
|
|
3884
3898
|
}
|
|
3885
3899
|
close() {
|
|
3886
3900
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -3935,7 +3949,7 @@ function Qo() {
|
|
|
3935
3949
|
})), this.emit(t, s);
|
|
3936
3950
|
}
|
|
3937
3951
|
buildTimelineMessage(t) {
|
|
3938
|
-
return
|
|
3952
|
+
return X({ cid: this.id }, t);
|
|
3939
3953
|
}
|
|
3940
3954
|
}
|
|
3941
3955
|
class Me {
|
|
@@ -3954,34 +3968,34 @@ function Qo() {
|
|
|
3954
3968
|
handlesActivityChecks: !1,
|
|
3955
3969
|
supportsPing: !1,
|
|
3956
3970
|
isInitialized: function() {
|
|
3957
|
-
return !!
|
|
3971
|
+
return !!z.getWebSocketAPI();
|
|
3958
3972
|
},
|
|
3959
3973
|
isSupported: function() {
|
|
3960
|
-
return !!
|
|
3974
|
+
return !!z.getWebSocketAPI();
|
|
3961
3975
|
},
|
|
3962
3976
|
getSocket: function(r) {
|
|
3963
|
-
return
|
|
3977
|
+
return z.createWebSocket(r);
|
|
3964
3978
|
}
|
|
3965
|
-
}),
|
|
3979
|
+
}), Wt = {
|
|
3966
3980
|
urls: Es,
|
|
3967
3981
|
handlesActivityChecks: !1,
|
|
3968
3982
|
supportsPing: !0,
|
|
3969
3983
|
isInitialized: function() {
|
|
3970
3984
|
return !0;
|
|
3971
3985
|
}
|
|
3972
|
-
},
|
|
3986
|
+
}, Gt = X({
|
|
3973
3987
|
getSocket: function(r) {
|
|
3974
|
-
return
|
|
3988
|
+
return z.HTTPFactory.createStreamingSocket(r);
|
|
3975
3989
|
}
|
|
3976
|
-
},
|
|
3990
|
+
}, Wt), Jt = X({
|
|
3977
3991
|
getSocket: function(r) {
|
|
3978
|
-
return
|
|
3992
|
+
return z.HTTPFactory.createPollingSocket(r);
|
|
3979
3993
|
}
|
|
3980
|
-
},
|
|
3994
|
+
}, Wt), Kt = {
|
|
3981
3995
|
isSupported: function() {
|
|
3982
|
-
return
|
|
3996
|
+
return z.isXHRSupported();
|
|
3983
3997
|
}
|
|
3984
|
-
}, Ms = new Me(
|
|
3998
|
+
}, Ms = new Me(X({}, Gt, Kt)), ks = new Me(X({}, Jt, Kt)), Is = {
|
|
3985
3999
|
ws: xs,
|
|
3986
4000
|
xhr_streaming: Ms,
|
|
3987
4001
|
xhr_polling: ks
|
|
@@ -3998,7 +4012,7 @@ function Qo() {
|
|
|
3998
4012
|
},
|
|
3999
4013
|
getSocket: function(r, t) {
|
|
4000
4014
|
return new window.SockJS(r, null, {
|
|
4001
|
-
js_path:
|
|
4015
|
+
js_path: v.getPath("sockjs", {
|
|
4002
4016
|
useTLS: t.useTLS
|
|
4003
4017
|
}),
|
|
4004
4018
|
ignore_null_origin: t.ignoreNullOrigin
|
|
@@ -4009,12 +4023,12 @@ function Qo() {
|
|
|
4009
4023
|
path: t
|
|
4010
4024
|
}));
|
|
4011
4025
|
}
|
|
4012
|
-
}),
|
|
4026
|
+
}), Yt = {
|
|
4013
4027
|
isSupported: function(r) {
|
|
4014
|
-
var t =
|
|
4028
|
+
var t = z.isXDRSupported(r.useTLS);
|
|
4015
4029
|
return t;
|
|
4016
4030
|
}
|
|
4017
|
-
}, Us = new Me(
|
|
4031
|
+
}, Us = new Me(X({}, Gt, Yt)), Os = new Me(X({}, Jt, Yt));
|
|
4018
4032
|
Be.xdr_streaming = Us, Be.xdr_polling = Os, Be.sockjs = Ls;
|
|
4019
4033
|
var Ns = Be;
|
|
4020
4034
|
class Fs extends be {
|
|
@@ -4037,26 +4051,26 @@ function Qo() {
|
|
|
4037
4051
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4038
4052
|
}
|
|
4039
4053
|
createConnection(t, s, a, c) {
|
|
4040
|
-
c =
|
|
4054
|
+
c = X({}, c, {
|
|
4041
4055
|
activityTimeout: this.pingDelay
|
|
4042
4056
|
});
|
|
4043
|
-
var p = this.transport.createConnection(t, s, a, c),
|
|
4044
|
-
p.unbind("open",
|
|
4045
|
-
}, D = (
|
|
4046
|
-
if (p.unbind("closed", D),
|
|
4057
|
+
var p = this.transport.createConnection(t, s, a, c), S = null, k = function() {
|
|
4058
|
+
p.unbind("open", k), p.bind("closed", D), S = N.now();
|
|
4059
|
+
}, D = (Y) => {
|
|
4060
|
+
if (p.unbind("closed", D), Y.code === 1002 || Y.code === 1003)
|
|
4047
4061
|
this.manager.reportDeath();
|
|
4048
|
-
else if (!
|
|
4049
|
-
var
|
|
4050
|
-
|
|
4062
|
+
else if (!Y.wasClean && S) {
|
|
4063
|
+
var ee = N.now() - S;
|
|
4064
|
+
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4051
4065
|
}
|
|
4052
4066
|
};
|
|
4053
|
-
return p.bind("open",
|
|
4067
|
+
return p.bind("open", k), p;
|
|
4054
4068
|
}
|
|
4055
4069
|
isSupported(t) {
|
|
4056
4070
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4057
4071
|
}
|
|
4058
4072
|
}
|
|
4059
|
-
const
|
|
4073
|
+
const Qt = {
|
|
4060
4074
|
decodeMessage: function(r) {
|
|
4061
4075
|
try {
|
|
4062
4076
|
var t = JSON.parse(r.data), s = t.data;
|
|
@@ -4079,7 +4093,7 @@ function Qo() {
|
|
|
4079
4093
|
return JSON.stringify(r);
|
|
4080
4094
|
},
|
|
4081
4095
|
processHandshake: function(r) {
|
|
4082
|
-
var t =
|
|
4096
|
+
var t = Qt.decodeMessage(r);
|
|
4083
4097
|
if (t.event === "pusher:connection_established") {
|
|
4084
4098
|
if (!t.data.activity_timeout)
|
|
4085
4099
|
throw "No activity timeout specified in handshake";
|
|
@@ -4110,7 +4124,7 @@ function Qo() {
|
|
|
4110
4124
|
} : null;
|
|
4111
4125
|
}
|
|
4112
4126
|
};
|
|
4113
|
-
var Ce =
|
|
4127
|
+
var Ce = Qt;
|
|
4114
4128
|
class zs extends be {
|
|
4115
4129
|
constructor(t, s) {
|
|
4116
4130
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
@@ -4123,7 +4137,7 @@ function Qo() {
|
|
|
4123
4137
|
}
|
|
4124
4138
|
send_event(t, s, a) {
|
|
4125
4139
|
var c = { event: t, data: s };
|
|
4126
|
-
return a && (c.channel = a),
|
|
4140
|
+
return a && (c.channel = a), ne.debug("Event sent", c), this.send(Ce.encodeMessage(c));
|
|
4127
4141
|
}
|
|
4128
4142
|
ping() {
|
|
4129
4143
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4145,7 +4159,7 @@ function Qo() {
|
|
|
4145
4159
|
});
|
|
4146
4160
|
}
|
|
4147
4161
|
if (c !== void 0) {
|
|
4148
|
-
switch (
|
|
4162
|
+
switch (ne.debug("Event recd", c), c.event) {
|
|
4149
4163
|
case "pusher:error":
|
|
4150
4164
|
this.emit("error", {
|
|
4151
4165
|
type: "PusherError",
|
|
@@ -4216,7 +4230,7 @@ function Qo() {
|
|
|
4216
4230
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
4217
4231
|
}
|
|
4218
4232
|
finish(t, s) {
|
|
4219
|
-
this.callback(
|
|
4233
|
+
this.callback(X({ transport: this.transport, action: t }, s));
|
|
4220
4234
|
}
|
|
4221
4235
|
}
|
|
4222
4236
|
class $s {
|
|
@@ -4224,13 +4238,13 @@ function Qo() {
|
|
|
4224
4238
|
this.timeline = t, this.options = s || {};
|
|
4225
4239
|
}
|
|
4226
4240
|
send(t, s) {
|
|
4227
|
-
this.timeline.isEmpty() || this.timeline.send(
|
|
4241
|
+
this.timeline.isEmpty() || this.timeline.send(z.TimelineTransport.getAgent(this, t), s);
|
|
4228
4242
|
}
|
|
4229
4243
|
}
|
|
4230
4244
|
class lt extends be {
|
|
4231
4245
|
constructor(t, s) {
|
|
4232
4246
|
super(function(a, c) {
|
|
4233
|
-
|
|
4247
|
+
ne.debug("No callbacks on " + t + " for " + a);
|
|
4234
4248
|
}), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
4235
4249
|
}
|
|
4236
4250
|
authorize(t, s) {
|
|
@@ -4240,8 +4254,8 @@ function Qo() {
|
|
|
4240
4254
|
if (t.indexOf("client-") !== 0)
|
|
4241
4255
|
throw new f("Event '" + t + "' does not start with 'client-'");
|
|
4242
4256
|
if (!this.subscribed) {
|
|
4243
|
-
var a =
|
|
4244
|
-
|
|
4257
|
+
var a = E.buildLogSuffix("triggeringClientEvents");
|
|
4258
|
+
ne.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4245
4259
|
}
|
|
4246
4260
|
return this.pusher.send_event(t, s, this.name);
|
|
4247
4261
|
}
|
|
@@ -4267,10 +4281,10 @@ function Qo() {
|
|
|
4267
4281
|
}
|
|
4268
4282
|
subscribe() {
|
|
4269
4283
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (t, s) => {
|
|
4270
|
-
t ? (this.subscriptionPending = !1,
|
|
4284
|
+
t ? (this.subscriptionPending = !1, ne.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
4271
4285
|
type: "AuthError",
|
|
4272
4286
|
error: t.message
|
|
4273
|
-
}, t instanceof
|
|
4287
|
+
}, t instanceof V ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
4274
4288
|
auth: s.auth,
|
|
4275
4289
|
channel_data: s.channel_data,
|
|
4276
4290
|
channel: this.name
|
|
@@ -4331,29 +4345,29 @@ function Qo() {
|
|
|
4331
4345
|
}
|
|
4332
4346
|
var Bs = function(r, t, s, a) {
|
|
4333
4347
|
function c(p) {
|
|
4334
|
-
return p instanceof s ? p : new s(function(
|
|
4335
|
-
|
|
4348
|
+
return p instanceof s ? p : new s(function(S) {
|
|
4349
|
+
S(p);
|
|
4336
4350
|
});
|
|
4337
4351
|
}
|
|
4338
|
-
return new (s || (s = Promise))(function(p,
|
|
4339
|
-
function
|
|
4352
|
+
return new (s || (s = Promise))(function(p, S) {
|
|
4353
|
+
function k(ee) {
|
|
4340
4354
|
try {
|
|
4341
|
-
|
|
4355
|
+
Y(a.next(ee));
|
|
4342
4356
|
} catch (oe) {
|
|
4343
|
-
|
|
4357
|
+
S(oe);
|
|
4344
4358
|
}
|
|
4345
4359
|
}
|
|
4346
|
-
function D(
|
|
4360
|
+
function D(ee) {
|
|
4347
4361
|
try {
|
|
4348
|
-
|
|
4362
|
+
Y(a.throw(ee));
|
|
4349
4363
|
} catch (oe) {
|
|
4350
|
-
|
|
4364
|
+
S(oe);
|
|
4351
4365
|
}
|
|
4352
4366
|
}
|
|
4353
|
-
function
|
|
4354
|
-
|
|
4367
|
+
function Y(ee) {
|
|
4368
|
+
ee.done ? p(ee.value) : c(ee.value).then(k, D);
|
|
4355
4369
|
}
|
|
4356
|
-
|
|
4370
|
+
Y((a = a.apply(r, t || [])).next());
|
|
4357
4371
|
});
|
|
4358
4372
|
};
|
|
4359
4373
|
class Vs extends ht {
|
|
@@ -4369,8 +4383,8 @@ function Qo() {
|
|
|
4369
4383
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4370
4384
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4371
4385
|
else {
|
|
4372
|
-
let
|
|
4373
|
-
|
|
4386
|
+
let S = E.buildLogSuffix("authorizationEndpoint");
|
|
4387
|
+
ne.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4374
4388
|
return;
|
|
4375
4389
|
}
|
|
4376
4390
|
s(a, c);
|
|
@@ -4443,32 +4457,32 @@ function Qo() {
|
|
|
4443
4457
|
}
|
|
4444
4458
|
handleEncryptedEvent(t, s) {
|
|
4445
4459
|
if (!this.key) {
|
|
4446
|
-
|
|
4460
|
+
ne.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
4447
4461
|
return;
|
|
4448
4462
|
}
|
|
4449
4463
|
if (!s.ciphertext || !s.nonce) {
|
|
4450
|
-
|
|
4464
|
+
ne.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4451
4465
|
return;
|
|
4452
4466
|
}
|
|
4453
4467
|
let a = Object(dt.decode)(s.ciphertext);
|
|
4454
4468
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4455
|
-
|
|
4469
|
+
ne.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4456
4470
|
return;
|
|
4457
4471
|
}
|
|
4458
4472
|
let c = Object(dt.decode)(s.nonce);
|
|
4459
4473
|
if (c.length < this.nacl.secretbox.nonceLength) {
|
|
4460
|
-
|
|
4474
|
+
ne.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${c.length}`);
|
|
4461
4475
|
return;
|
|
4462
4476
|
}
|
|
4463
4477
|
let p = this.nacl.secretbox.open(a, c, this.key);
|
|
4464
4478
|
if (p === null) {
|
|
4465
|
-
|
|
4466
|
-
if (
|
|
4467
|
-
|
|
4479
|
+
ne.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, k) => {
|
|
4480
|
+
if (S) {
|
|
4481
|
+
ne.error(`Failed to make a request to the authEndpoint: ${k}. Unable to fetch new key, so dropping encrypted event`);
|
|
4468
4482
|
return;
|
|
4469
4483
|
}
|
|
4470
4484
|
if (p = this.nacl.secretbox.open(a, c, this.key), p === null) {
|
|
4471
|
-
|
|
4485
|
+
ne.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
4472
4486
|
return;
|
|
4473
4487
|
}
|
|
4474
4488
|
this.emit(t, this.getDataToEmit(p));
|
|
@@ -4489,7 +4503,7 @@ function Qo() {
|
|
|
4489
4503
|
class Gs extends be {
|
|
4490
4504
|
constructor(t, s) {
|
|
4491
4505
|
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);
|
|
4492
|
-
var a =
|
|
4506
|
+
var a = z.getNetwork();
|
|
4493
4507
|
a.bind("online", () => {
|
|
4494
4508
|
this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
|
|
4495
4509
|
}), a.bind("offline", () => {
|
|
@@ -4572,7 +4586,7 @@ function Qo() {
|
|
|
4572
4586
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
4573
4587
|
}
|
|
4574
4588
|
buildConnectionCallbacks(t) {
|
|
4575
|
-
return
|
|
4589
|
+
return X({}, t, {
|
|
4576
4590
|
message: (s) => {
|
|
4577
4591
|
this.resetActivityCheck(), this.emit("message", s);
|
|
4578
4592
|
},
|
|
@@ -4591,7 +4605,7 @@ function Qo() {
|
|
|
4591
4605
|
});
|
|
4592
4606
|
}
|
|
4593
4607
|
buildHandshakeCallbacks(t) {
|
|
4594
|
-
return
|
|
4608
|
+
return X({}, t, {
|
|
4595
4609
|
connected: (s) => {
|
|
4596
4610
|
this.activityTimeout = Math.min(this.options.activityTimeout, s.activityTimeout, s.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(s.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
|
|
4597
4611
|
}
|
|
@@ -4635,7 +4649,7 @@ function Qo() {
|
|
|
4635
4649
|
var a = this.state;
|
|
4636
4650
|
if (this.state = t, a !== t) {
|
|
4637
4651
|
var c = t;
|
|
4638
|
-
c === "connected" && (c += " with new socket ID " + s.socket_id),
|
|
4652
|
+
c === "connected" && (c += " with new socket ID " + s.socket_id), ne.debug("State changed", a + " -> " + c), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
|
|
4639
4653
|
}
|
|
4640
4654
|
}
|
|
4641
4655
|
shouldRetry() {
|
|
@@ -4669,7 +4683,7 @@ function Qo() {
|
|
|
4669
4683
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4670
4684
|
if (t.config.nacl)
|
|
4671
4685
|
return ye.createEncryptedChannel(r, t, t.config.nacl);
|
|
4672
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
4686
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = E.buildLogSuffix("encryptedChannelSupport");
|
|
4673
4687
|
throw new B(`${s}. ${a}`);
|
|
4674
4688
|
} else {
|
|
4675
4689
|
if (r.indexOf("private-") === 0)
|
|
@@ -4677,7 +4691,7 @@ function Qo() {
|
|
|
4677
4691
|
if (r.indexOf("presence-") === 0)
|
|
4678
4692
|
return ye.createPresenceChannel(r, t);
|
|
4679
4693
|
if (r.indexOf("#") === 0)
|
|
4680
|
-
throw new
|
|
4694
|
+
throw new b('Cannot create a channel with name "' + r + '".');
|
|
4681
4695
|
return ye.createChannel(r, t);
|
|
4682
4696
|
}
|
|
4683
4697
|
}
|
|
@@ -4710,7 +4724,7 @@ function Qo() {
|
|
|
4710
4724
|
return new qs(r, t, s);
|
|
4711
4725
|
}
|
|
4712
4726
|
}, ye = Ys;
|
|
4713
|
-
class
|
|
4727
|
+
class Zt {
|
|
4714
4728
|
constructor(t) {
|
|
4715
4729
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
4716
4730
|
}
|
|
@@ -4732,33 +4746,33 @@ function Qo() {
|
|
|
4732
4746
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
4733
4747
|
}
|
|
4734
4748
|
isSupported() {
|
|
4735
|
-
return
|
|
4749
|
+
return Xt(this.strategies, N.method("isSupported"));
|
|
4736
4750
|
}
|
|
4737
4751
|
connect(t, s) {
|
|
4738
|
-
var a = this.strategies, c = 0, p = this.timeout,
|
|
4739
|
-
|
|
4752
|
+
var a = this.strategies, c = 0, p = this.timeout, S = null, k = (D, Y) => {
|
|
4753
|
+
Y ? s(null, Y) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, k)) : s(!0));
|
|
4740
4754
|
};
|
|
4741
|
-
return
|
|
4755
|
+
return S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, k), {
|
|
4742
4756
|
abort: function() {
|
|
4743
|
-
|
|
4757
|
+
S.abort();
|
|
4744
4758
|
},
|
|
4745
4759
|
forceMinPriority: function(D) {
|
|
4746
|
-
t = D,
|
|
4760
|
+
t = D, S && S.forceMinPriority(D);
|
|
4747
4761
|
}
|
|
4748
4762
|
};
|
|
4749
4763
|
}
|
|
4750
4764
|
tryStrategy(t, s, a, c) {
|
|
4751
|
-
var p = null,
|
|
4765
|
+
var p = null, S = null;
|
|
4752
4766
|
return a.timeout > 0 && (p = new T(a.timeout, function() {
|
|
4753
|
-
|
|
4754
|
-
})),
|
|
4755
|
-
|
|
4767
|
+
S.abort(), c(!0);
|
|
4768
|
+
})), S = t.connect(s, function(k, D) {
|
|
4769
|
+
k && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(k, D));
|
|
4756
4770
|
}), {
|
|
4757
4771
|
abort: function() {
|
|
4758
|
-
p && p.ensureAborted(),
|
|
4772
|
+
p && p.ensureAborted(), S.abort();
|
|
4759
4773
|
},
|
|
4760
|
-
forceMinPriority: function(
|
|
4761
|
-
|
|
4774
|
+
forceMinPriority: function(k) {
|
|
4775
|
+
S.forceMinPriority(k);
|
|
4762
4776
|
}
|
|
4763
4777
|
};
|
|
4764
4778
|
}
|
|
@@ -4768,25 +4782,25 @@ function Qo() {
|
|
|
4768
4782
|
this.strategies = t;
|
|
4769
4783
|
}
|
|
4770
4784
|
isSupported() {
|
|
4771
|
-
return
|
|
4785
|
+
return Xt(this.strategies, N.method("isSupported"));
|
|
4772
4786
|
}
|
|
4773
4787
|
connect(t, s) {
|
|
4774
4788
|
return Qs(this.strategies, t, function(a, c) {
|
|
4775
|
-
return function(p,
|
|
4789
|
+
return function(p, S) {
|
|
4776
4790
|
if (c[a].error = p, p) {
|
|
4777
4791
|
Zs(c) && s(!0);
|
|
4778
4792
|
return;
|
|
4779
4793
|
}
|
|
4780
|
-
ce(c, function(
|
|
4781
|
-
|
|
4782
|
-
}), s(null,
|
|
4794
|
+
ce(c, function(k) {
|
|
4795
|
+
k.forceMinPriority(S.transport.priority);
|
|
4796
|
+
}), s(null, S);
|
|
4783
4797
|
};
|
|
4784
4798
|
});
|
|
4785
4799
|
}
|
|
4786
4800
|
}
|
|
4787
4801
|
function Qs(r, t, s) {
|
|
4788
|
-
var a = pe(r, function(c, p,
|
|
4789
|
-
return c.connect(t, s(p,
|
|
4802
|
+
var a = pe(r, function(c, p, S, k) {
|
|
4803
|
+
return c.connect(t, s(p, k));
|
|
4790
4804
|
});
|
|
4791
4805
|
return {
|
|
4792
4806
|
abort: function() {
|
|
@@ -4815,27 +4829,27 @@ function Qo() {
|
|
|
4815
4829
|
return this.strategy.isSupported();
|
|
4816
4830
|
}
|
|
4817
4831
|
connect(t, s) {
|
|
4818
|
-
var a = this.usingTLS, c = nr(a), p = c && c.cacheSkipCount ? c.cacheSkipCount : 0,
|
|
4832
|
+
var a = this.usingTLS, c = nr(a), p = c && c.cacheSkipCount ? c.cacheSkipCount : 0, S = [this.strategy];
|
|
4819
4833
|
if (c && c.timestamp + this.ttl >= N.now()) {
|
|
4820
|
-
var
|
|
4821
|
-
|
|
4834
|
+
var k = this.transports[c.transport];
|
|
4835
|
+
k && (["ws", "wss"].includes(c.transport) || p > 3 ? (this.timeline.info({
|
|
4822
4836
|
cached: !0,
|
|
4823
4837
|
transport: c.transport,
|
|
4824
4838
|
latency: c.latency
|
|
4825
|
-
}),
|
|
4839
|
+
}), S.push(new Te([k], {
|
|
4826
4840
|
timeout: c.latency * 2 + 1e3,
|
|
4827
4841
|
failFast: !0
|
|
4828
4842
|
}))) : p++);
|
|
4829
4843
|
}
|
|
4830
|
-
var D = N.now(),
|
|
4831
|
-
oe ? (
|
|
4844
|
+
var D = N.now(), Y = S.pop().connect(t, function ee(oe, We) {
|
|
4845
|
+
oe ? (en(a), S.length > 0 ? (D = N.now(), Y = S.pop().connect(t, ee)) : s(oe)) : (sr(a, We.transport.name, N.now() - D, p), s(null, We));
|
|
4832
4846
|
});
|
|
4833
4847
|
return {
|
|
4834
4848
|
abort: function() {
|
|
4835
|
-
|
|
4849
|
+
Y.abort();
|
|
4836
4850
|
},
|
|
4837
|
-
forceMinPriority: function(
|
|
4838
|
-
t =
|
|
4851
|
+
forceMinPriority: function(ee) {
|
|
4852
|
+
t = ee, Y && Y.forceMinPriority(ee);
|
|
4839
4853
|
}
|
|
4840
4854
|
};
|
|
4841
4855
|
}
|
|
@@ -4844,19 +4858,19 @@ function Qo() {
|
|
|
4844
4858
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
4845
4859
|
}
|
|
4846
4860
|
function nr(r) {
|
|
4847
|
-
var t =
|
|
4861
|
+
var t = z.getLocalStorage();
|
|
4848
4862
|
if (t)
|
|
4849
4863
|
try {
|
|
4850
4864
|
var s = t[pt(r)];
|
|
4851
4865
|
if (s)
|
|
4852
4866
|
return JSON.parse(s);
|
|
4853
4867
|
} catch {
|
|
4854
|
-
|
|
4868
|
+
en(r);
|
|
4855
4869
|
}
|
|
4856
4870
|
return null;
|
|
4857
4871
|
}
|
|
4858
4872
|
function sr(r, t, s, a) {
|
|
4859
|
-
var c =
|
|
4873
|
+
var c = z.getLocalStorage();
|
|
4860
4874
|
if (c)
|
|
4861
4875
|
try {
|
|
4862
4876
|
c[pt(r)] = He({
|
|
@@ -4868,8 +4882,8 @@ function Qo() {
|
|
|
4868
4882
|
} catch {
|
|
4869
4883
|
}
|
|
4870
4884
|
}
|
|
4871
|
-
function
|
|
4872
|
-
var t =
|
|
4885
|
+
function en(r) {
|
|
4886
|
+
var t = z.getLocalStorage();
|
|
4873
4887
|
if (t)
|
|
4874
4888
|
try {
|
|
4875
4889
|
delete t[pt(r)];
|
|
@@ -4891,8 +4905,8 @@ function Qo() {
|
|
|
4891
4905
|
abort: function() {
|
|
4892
4906
|
p.ensureAborted(), c && c.abort();
|
|
4893
4907
|
},
|
|
4894
|
-
forceMinPriority: function(
|
|
4895
|
-
t =
|
|
4908
|
+
forceMinPriority: function(S) {
|
|
4909
|
+
t = S, c && c.forceMinPriority(S);
|
|
4896
4910
|
}
|
|
4897
4911
|
};
|
|
4898
4912
|
}
|
|
@@ -4931,17 +4945,17 @@ function Qo() {
|
|
|
4931
4945
|
}
|
|
4932
4946
|
var ir = function(r, t, s) {
|
|
4933
4947
|
var a = {};
|
|
4934
|
-
function c(
|
|
4935
|
-
var
|
|
4936
|
-
return a[
|
|
4948
|
+
function c(dn, ri, ii, oi, ai) {
|
|
4949
|
+
var fn = s(r, dn, ri, ii, oi, ai);
|
|
4950
|
+
return a[dn] = fn, fn;
|
|
4937
4951
|
}
|
|
4938
4952
|
var p = Object.assign({}, t, {
|
|
4939
4953
|
hostNonTLS: r.wsHost + ":" + r.wsPort,
|
|
4940
4954
|
hostTLS: r.wsHost + ":" + r.wssPort,
|
|
4941
4955
|
httpPath: r.wsPath
|
|
4942
|
-
}),
|
|
4956
|
+
}), S = Object.assign({}, p, {
|
|
4943
4957
|
useTLS: !0
|
|
4944
|
-
}),
|
|
4958
|
+
}), k = Object.assign({}, t, {
|
|
4945
4959
|
hostNonTLS: r.httpHost + ":" + r.httpPort,
|
|
4946
4960
|
hostTLS: r.httpHost + ":" + r.httpsPort,
|
|
4947
4961
|
httpPath: r.httpPath
|
|
@@ -4949,28 +4963,28 @@ function Qo() {
|
|
|
4949
4963
|
loop: !0,
|
|
4950
4964
|
timeout: 15e3,
|
|
4951
4965
|
timeoutLimit: 6e4
|
|
4952
|
-
},
|
|
4966
|
+
}, Y = new Zt({
|
|
4953
4967
|
minPingDelay: 1e4,
|
|
4954
4968
|
maxPingDelay: r.activityTimeout
|
|
4955
|
-
}),
|
|
4969
|
+
}), ee = new Zt({
|
|
4956
4970
|
lives: 2,
|
|
4957
4971
|
minPingDelay: 1e4,
|
|
4958
4972
|
maxPingDelay: r.activityTimeout
|
|
4959
|
-
}), oe = c("ws", "ws", 3, p,
|
|
4960
|
-
new ke(Ie(
|
|
4961
|
-
], D), un = new Te([
|
|
4962
|
-
new ke(Ie(on), on, ti)
|
|
4973
|
+
}), oe = c("ws", "ws", 3, p, Y), We = c("wss", "ws", 3, S, Y), Zr = c("sockjs", "sockjs", 1, k), on = c("xhr_streaming", "xhr_streaming", 1, k, ee), ei = c("xdr_streaming", "xdr_streaming", 1, k, ee), an = c("xhr_polling", "xhr_polling", 1, k), ti = c("xdr_polling", "xdr_polling", 1, k), cn = new Te([oe], D), ni = new Te([We], D), si = new Te([Zr], D), un = new Te([
|
|
4974
|
+
new ke(Ie(on), on, ei)
|
|
4963
4975
|
], D), ln = new Te([
|
|
4964
|
-
new ke(Ie(
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4976
|
+
new ke(Ie(an), an, ti)
|
|
4977
|
+
], D), hn = new Te([
|
|
4978
|
+
new ke(Ie(un), new ft([
|
|
4979
|
+
un,
|
|
4980
|
+
new Ve(ln, { delay: 4e3 })
|
|
4981
|
+
]), ln)
|
|
4982
|
+
], D), bt = new ke(Ie(hn), hn, si), yt;
|
|
4969
4983
|
return t.useTLS ? yt = new ft([
|
|
4970
|
-
|
|
4984
|
+
cn,
|
|
4971
4985
|
new Ve(bt, { delay: 2e3 })
|
|
4972
4986
|
]) : yt = new ft([
|
|
4973
|
-
|
|
4987
|
+
cn,
|
|
4974
4988
|
new Ve(ni, { delay: 2e3 }),
|
|
4975
4989
|
new Ve(bt, { delay: 5e3 })
|
|
4976
4990
|
]), new tr(new rr(new ke(Ie(oe), yt, bt)), a, {
|
|
@@ -4982,14 +4996,14 @@ function Qo() {
|
|
|
4982
4996
|
var r = this;
|
|
4983
4997
|
r.timeline.info(r.buildTimelineMessage({
|
|
4984
4998
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
4985
|
-
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"),
|
|
4999
|
+
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), v.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
4986
5000
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
4987
5001
|
})) : r.onClose();
|
|
4988
5002
|
}), cr = {
|
|
4989
5003
|
getRequest: function(r) {
|
|
4990
5004
|
var t = new window.XDomainRequest();
|
|
4991
5005
|
return t.ontimeout = function() {
|
|
4992
|
-
r.emit("error", new
|
|
5006
|
+
r.emit("error", new y()), r.close();
|
|
4993
5007
|
}, t.onerror = function(s) {
|
|
4994
5008
|
r.emit("error", s), r.close();
|
|
4995
5009
|
}, t.onprogress = function() {
|
|
@@ -5010,10 +5024,10 @@ function Qo() {
|
|
|
5010
5024
|
start(t) {
|
|
5011
5025
|
this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
|
|
5012
5026
|
this.close();
|
|
5013
|
-
},
|
|
5027
|
+
}, z.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(t);
|
|
5014
5028
|
}
|
|
5015
5029
|
close() {
|
|
5016
|
-
this.unloader && (
|
|
5030
|
+
this.unloader && (z.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
|
|
5017
5031
|
}
|
|
5018
5032
|
onChunk(t, s) {
|
|
5019
5033
|
for (; ; ) {
|
|
@@ -5041,7 +5055,7 @@ function Qo() {
|
|
|
5041
5055
|
var Ee = gt, dr = 1;
|
|
5042
5056
|
class fr {
|
|
5043
5057
|
constructor(t, s) {
|
|
5044
|
-
this.hooks = t, this.session =
|
|
5058
|
+
this.hooks = t, this.session = nn(1e3) + "/" + vr(8), this.location = pr(s), this.readyState = Ee.CONNECTING, this.openStream();
|
|
5045
5059
|
}
|
|
5046
5060
|
send(t) {
|
|
5047
5061
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5055,7 +5069,7 @@ function Qo() {
|
|
|
5055
5069
|
sendRaw(t) {
|
|
5056
5070
|
if (this.readyState === Ee.OPEN)
|
|
5057
5071
|
try {
|
|
5058
|
-
return
|
|
5072
|
+
return z.createSocketRequest("POST", tn(gr(this.location, this.session))).start(t), !0;
|
|
5059
5073
|
} catch {
|
|
5060
5074
|
return !1;
|
|
5061
5075
|
}
|
|
@@ -5110,7 +5124,7 @@ function Qo() {
|
|
|
5110
5124
|
this.onerror && this.onerror(t);
|
|
5111
5125
|
}
|
|
5112
5126
|
openStream() {
|
|
5113
|
-
this.stream =
|
|
5127
|
+
this.stream = z.createSocketRequest("POST", tn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5114
5128
|
this.onChunk(t);
|
|
5115
5129
|
}), this.stream.bind("finished", (t) => {
|
|
5116
5130
|
this.hooks.onFinished(this, t);
|
|
@@ -5139,7 +5153,7 @@ function Qo() {
|
|
|
5139
5153
|
function gr(r, t) {
|
|
5140
5154
|
return r.base + "/" + t + "/xhr_send";
|
|
5141
5155
|
}
|
|
5142
|
-
function
|
|
5156
|
+
function tn(r) {
|
|
5143
5157
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5144
5158
|
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + dr++;
|
|
5145
5159
|
}
|
|
@@ -5147,12 +5161,12 @@ function Qo() {
|
|
|
5147
5161
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5148
5162
|
return s[1] + t + s[3];
|
|
5149
5163
|
}
|
|
5150
|
-
function
|
|
5151
|
-
return
|
|
5164
|
+
function nn(r) {
|
|
5165
|
+
return z.randomInt(r);
|
|
5152
5166
|
}
|
|
5153
5167
|
function vr(r) {
|
|
5154
5168
|
for (var t = [], s = 0; s < r; s++)
|
|
5155
|
-
t.push(
|
|
5169
|
+
t.push(nn(32).toString(32));
|
|
5156
5170
|
return t.join("");
|
|
5157
5171
|
}
|
|
5158
5172
|
var br = fr, yr = {
|
|
@@ -5182,7 +5196,7 @@ function Qo() {
|
|
|
5182
5196
|
}
|
|
5183
5197
|
}, wr = Sr, Cr = {
|
|
5184
5198
|
getRequest: function(r) {
|
|
5185
|
-
var t =
|
|
5199
|
+
var t = z.getXHRAPI(), s = new t();
|
|
5186
5200
|
return s.onreadystatechange = s.onprogress = function() {
|
|
5187
5201
|
switch (s.readyState) {
|
|
5188
5202
|
case 3:
|
|
@@ -5213,11 +5227,11 @@ function Qo() {
|
|
|
5213
5227
|
createRequest(r, t, s) {
|
|
5214
5228
|
return new hr(r, t, s);
|
|
5215
5229
|
}
|
|
5216
|
-
},
|
|
5217
|
-
|
|
5230
|
+
}, sn = Er;
|
|
5231
|
+
sn.createXDR = function(r, t) {
|
|
5218
5232
|
return this.createRequest(ur, r, t);
|
|
5219
5233
|
};
|
|
5220
|
-
var Rr =
|
|
5234
|
+
var Rr = sn, Ar = {
|
|
5221
5235
|
nextAuthCallbackID: 1,
|
|
5222
5236
|
auth_callbacks: {},
|
|
5223
5237
|
ScriptReceivers: h,
|
|
@@ -5238,7 +5252,7 @@ function Qo() {
|
|
|
5238
5252
|
var t = () => {
|
|
5239
5253
|
this.onDocumentBody(r.ready);
|
|
5240
5254
|
};
|
|
5241
|
-
window.JSON ? t() :
|
|
5255
|
+
window.JSON ? t() : v.load("json2", {}, t);
|
|
5242
5256
|
},
|
|
5243
5257
|
getDocument() {
|
|
5244
5258
|
return document;
|
|
@@ -5310,7 +5324,7 @@ function Qo() {
|
|
|
5310
5324
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5311
5325
|
}() * r);
|
|
5312
5326
|
}
|
|
5313
|
-
},
|
|
5327
|
+
}, z = Ar, mt;
|
|
5314
5328
|
(function(r) {
|
|
5315
5329
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5316
5330
|
})(mt || (mt = {}));
|
|
@@ -5320,7 +5334,7 @@ function Qo() {
|
|
|
5320
5334
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5321
5335
|
}
|
|
5322
5336
|
log(t, s) {
|
|
5323
|
-
t <= this.options.level && (this.events.push(
|
|
5337
|
+
t <= this.options.level && (this.events.push(X({}, s, { timestamp: N.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5324
5338
|
}
|
|
5325
5339
|
error(t) {
|
|
5326
5340
|
this.log(Xe.ERROR, t);
|
|
@@ -5335,7 +5349,7 @@ function Qo() {
|
|
|
5335
5349
|
return this.events.length === 0;
|
|
5336
5350
|
}
|
|
5337
5351
|
send(t, s) {
|
|
5338
|
-
var a =
|
|
5352
|
+
var a = X({
|
|
5339
5353
|
session: this.session,
|
|
5340
5354
|
bundle: this.sent + 1,
|
|
5341
5355
|
key: this.key,
|
|
@@ -5365,26 +5379,26 @@ function Qo() {
|
|
|
5365
5379
|
connect(t, s) {
|
|
5366
5380
|
if (this.isSupported()) {
|
|
5367
5381
|
if (this.priority < t)
|
|
5368
|
-
return
|
|
5369
|
-
} else return
|
|
5370
|
-
var a = !1, c = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null,
|
|
5371
|
-
c.unbind("initialized",
|
|
5372
|
-
},
|
|
5382
|
+
return rn(new F(), s);
|
|
5383
|
+
} else return rn(new L(), s);
|
|
5384
|
+
var a = !1, c = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5385
|
+
c.unbind("initialized", S), c.connect();
|
|
5386
|
+
}, k = function() {
|
|
5373
5387
|
p = ye.createHandshake(c, function(oe) {
|
|
5374
|
-
a = !0,
|
|
5388
|
+
a = !0, ee(), s(null, oe);
|
|
5375
5389
|
});
|
|
5376
5390
|
}, D = function(oe) {
|
|
5377
|
-
|
|
5378
|
-
},
|
|
5379
|
-
|
|
5391
|
+
ee(), s(oe);
|
|
5392
|
+
}, Y = function() {
|
|
5393
|
+
ee();
|
|
5380
5394
|
var oe;
|
|
5381
|
-
oe = He(c), s(new
|
|
5382
|
-
},
|
|
5383
|
-
c.unbind("initialized",
|
|
5395
|
+
oe = He(c), s(new H(oe));
|
|
5396
|
+
}, ee = function() {
|
|
5397
|
+
c.unbind("initialized", S), c.unbind("open", k), c.unbind("error", D), c.unbind("closed", Y);
|
|
5384
5398
|
};
|
|
5385
|
-
return c.bind("initialized",
|
|
5399
|
+
return c.bind("initialized", S), c.bind("open", k), c.bind("error", D), c.bind("closed", Y), c.initialize(), {
|
|
5386
5400
|
abort: () => {
|
|
5387
|
-
a || (
|
|
5401
|
+
a || (ee(), p ? p.close() : c.close());
|
|
5388
5402
|
},
|
|
5389
5403
|
forceMinPriority: (oe) => {
|
|
5390
5404
|
a || this.priority < oe && (p ? p.close() : c.close());
|
|
@@ -5392,7 +5406,7 @@ function Qo() {
|
|
|
5392
5406
|
};
|
|
5393
5407
|
}
|
|
5394
5408
|
}
|
|
5395
|
-
function
|
|
5409
|
+
function rn(r, t) {
|
|
5396
5410
|
return N.defer(function() {
|
|
5397
5411
|
t(r);
|
|
5398
5412
|
}), {
|
|
@@ -5402,20 +5416,20 @@ function Qo() {
|
|
|
5402
5416
|
}
|
|
5403
5417
|
};
|
|
5404
5418
|
}
|
|
5405
|
-
const { Transports: Mr } =
|
|
5419
|
+
const { Transports: Mr } = z;
|
|
5406
5420
|
var kr = function(r, t, s, a, c, p) {
|
|
5407
|
-
var
|
|
5408
|
-
if (!
|
|
5421
|
+
var S = Mr[s];
|
|
5422
|
+
if (!S)
|
|
5409
5423
|
throw new P(s);
|
|
5410
|
-
var
|
|
5411
|
-
return
|
|
5424
|
+
var k = (!r.enabledTransports || ve(r.enabledTransports, t) !== -1) && (!r.disabledTransports || ve(r.disabledTransports, t) === -1), D;
|
|
5425
|
+
return k ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c), D = new xr(t, a, p ? p.getAssistant(S) : S, c)) : D = Ir, D;
|
|
5412
5426
|
}, Ir = {
|
|
5413
5427
|
isSupported: function() {
|
|
5414
5428
|
return !1;
|
|
5415
5429
|
},
|
|
5416
5430
|
connect: function(r, t) {
|
|
5417
5431
|
var s = N.defer(function() {
|
|
5418
|
-
t(new
|
|
5432
|
+
t(new L());
|
|
5419
5433
|
});
|
|
5420
5434
|
return {
|
|
5421
5435
|
abort: function() {
|
|
@@ -5431,7 +5445,7 @@ function Qo() {
|
|
|
5431
5445
|
throw "You must pass an options object";
|
|
5432
5446
|
if (r.cluster == null)
|
|
5433
5447
|
throw "Options object must provide a cluster";
|
|
5434
|
-
"disableStats" in r &&
|
|
5448
|
+
"disableStats" in r && ne.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5435
5449
|
}
|
|
5436
5450
|
const Ur = (r, t) => {
|
|
5437
5451
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
@@ -5445,11 +5459,11 @@ function Qo() {
|
|
|
5445
5459
|
return s;
|
|
5446
5460
|
};
|
|
5447
5461
|
var Or = (r) => {
|
|
5448
|
-
if (typeof
|
|
5462
|
+
if (typeof z.getAuthorizers()[r.transport] > "u")
|
|
5449
5463
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5450
5464
|
return (t, s) => {
|
|
5451
5465
|
const a = Ur(t, r);
|
|
5452
|
-
|
|
5466
|
+
z.getAuthorizers()[r.transport](z, a, r, _.UserAuthentication, s);
|
|
5453
5467
|
};
|
|
5454
5468
|
};
|
|
5455
5469
|
const Nr = (r, t) => {
|
|
@@ -5465,11 +5479,11 @@ function Qo() {
|
|
|
5465
5479
|
return s;
|
|
5466
5480
|
};
|
|
5467
5481
|
var Fr = (r) => {
|
|
5468
|
-
if (typeof
|
|
5482
|
+
if (typeof z.getAuthorizers()[r.transport] > "u")
|
|
5469
5483
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5470
5484
|
return (t, s) => {
|
|
5471
5485
|
const a = Nr(t, r);
|
|
5472
|
-
|
|
5486
|
+
z.getAuthorizers()[r.transport](z, a, r, _.ChannelAuthorization, s);
|
|
5473
5487
|
};
|
|
5474
5488
|
};
|
|
5475
5489
|
const Dr = (r, t, s) => {
|
|
@@ -5482,8 +5496,8 @@ function Qo() {
|
|
|
5482
5496
|
}
|
|
5483
5497
|
};
|
|
5484
5498
|
return (c, p) => {
|
|
5485
|
-
const
|
|
5486
|
-
s(
|
|
5499
|
+
const S = r.channel(c.channelName);
|
|
5500
|
+
s(S, a).authorize(c.socketId, p);
|
|
5487
5501
|
};
|
|
5488
5502
|
};
|
|
5489
5503
|
function qr(r, t) {
|
|
@@ -5518,7 +5532,7 @@ function Qo() {
|
|
|
5518
5532
|
return `ws-${r}.pusher.com`;
|
|
5519
5533
|
}
|
|
5520
5534
|
function Hr(r) {
|
|
5521
|
-
return
|
|
5535
|
+
return z.getProtocol() === "https:" ? !0 : r.forceTLS !== !1;
|
|
5522
5536
|
}
|
|
5523
5537
|
function Br(r) {
|
|
5524
5538
|
return "enableStats" in r ? r.enableStats : "disableStats" in r ? !r.disableStats : !1;
|
|
@@ -5541,7 +5555,7 @@ function Qo() {
|
|
|
5541
5555
|
class Gr extends be {
|
|
5542
5556
|
constructor(t) {
|
|
5543
5557
|
super(function(s, a) {
|
|
5544
|
-
|
|
5558
|
+
ne.debug(`No callbacks on watchlist events for ${s}`);
|
|
5545
5559
|
}), this.pusher = t, this.bindWatchlistInternalEvent();
|
|
5546
5560
|
}
|
|
5547
5561
|
handleEvent(t) {
|
|
@@ -5566,10 +5580,10 @@ function Qo() {
|
|
|
5566
5580
|
class Yr extends be {
|
|
5567
5581
|
constructor(t) {
|
|
5568
5582
|
super(function(s, a) {
|
|
5569
|
-
|
|
5583
|
+
ne.debug("No callbacks on user for " + s);
|
|
5570
5584
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (s, a) => {
|
|
5571
5585
|
if (s) {
|
|
5572
|
-
|
|
5586
|
+
ne.warn(`Error during signin: ${s}`), this._cleanup();
|
|
5573
5587
|
return;
|
|
5574
5588
|
}
|
|
5575
5589
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -5595,11 +5609,11 @@ function Qo() {
|
|
|
5595
5609
|
try {
|
|
5596
5610
|
this.user_data = JSON.parse(t.user_data);
|
|
5597
5611
|
} catch {
|
|
5598
|
-
|
|
5612
|
+
ne.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
|
|
5599
5613
|
return;
|
|
5600
5614
|
}
|
|
5601
5615
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
5602
|
-
|
|
5616
|
+
ne.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
5603
5617
|
return;
|
|
5604
5618
|
}
|
|
5605
5619
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -5633,12 +5647,12 @@ function Qo() {
|
|
|
5633
5647
|
ue.instances[t].connect();
|
|
5634
5648
|
}
|
|
5635
5649
|
static getClientFeatures() {
|
|
5636
|
-
return $e(xe({ ws:
|
|
5650
|
+
return $e(xe({ ws: z.Transports.ws }, function(t) {
|
|
5637
5651
|
return t.isSupported({});
|
|
5638
5652
|
}));
|
|
5639
5653
|
}
|
|
5640
5654
|
constructor(t, s) {
|
|
5641
|
-
Qr(t), Lr(s), this.key = t, this.config = qr(s, this), this.channels = ye.createChannels(), this.global_emitter = new be(), this.sessionID =
|
|
5655
|
+
Qr(t), Lr(s), this.key = t, this.config = qr(s, this), this.channels = ye.createChannels(), this.global_emitter = new be(), this.sessionID = z.randomInt(1e9), this.timeline = new Pr(this.key, this.sessionID, {
|
|
5642
5656
|
cluster: this.config.cluster,
|
|
5643
5657
|
features: ue.getClientFeatures(),
|
|
5644
5658
|
params: this.config.timelineParams || {},
|
|
@@ -5647,9 +5661,9 @@ function Qo() {
|
|
|
5647
5661
|
version: d.VERSION
|
|
5648
5662
|
}), this.config.enableStats && (this.timelineSender = ye.createTimelineSender(this.timeline, {
|
|
5649
5663
|
host: this.config.statsHost,
|
|
5650
|
-
path: "/timeline/v2/" +
|
|
5664
|
+
path: "/timeline/v2/" + z.TimelineTransport.name
|
|
5651
5665
|
}));
|
|
5652
|
-
var a = (c) =>
|
|
5666
|
+
var a = (c) => z.getDefaultStrategy(this.config, c, kr);
|
|
5653
5667
|
this.connection = ye.createConnectionManager(this.key, {
|
|
5654
5668
|
getStrategy: a,
|
|
5655
5669
|
timeline: this.timeline,
|
|
@@ -5660,18 +5674,18 @@ function Qo() {
|
|
|
5660
5674
|
}), this.connection.bind("connected", () => {
|
|
5661
5675
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
5662
5676
|
}), this.connection.bind("message", (c) => {
|
|
5663
|
-
var p = c.event,
|
|
5677
|
+
var p = c.event, S = p.indexOf("pusher_internal:") === 0;
|
|
5664
5678
|
if (c.channel) {
|
|
5665
|
-
var
|
|
5666
|
-
|
|
5679
|
+
var k = this.channel(c.channel);
|
|
5680
|
+
k && k.handleEvent(c);
|
|
5667
5681
|
}
|
|
5668
|
-
|
|
5682
|
+
S || this.global_emitter.emit(c.event, c.data);
|
|
5669
5683
|
}), this.connection.bind("connecting", () => {
|
|
5670
5684
|
this.channels.disconnect();
|
|
5671
5685
|
}), this.connection.bind("disconnected", () => {
|
|
5672
5686
|
this.channels.disconnect();
|
|
5673
5687
|
}), this.connection.bind("error", (c) => {
|
|
5674
|
-
|
|
5688
|
+
ne.warn(c);
|
|
5675
5689
|
}), ue.instances.push(this), this.timeline.info({ instances: ue.instances.length }), this.user = new Yr(this), ue.isReady && this.connect();
|
|
5676
5690
|
}
|
|
5677
5691
|
channel(t) {
|
|
@@ -5683,7 +5697,7 @@ function Qo() {
|
|
|
5683
5697
|
connect() {
|
|
5684
5698
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
5685
5699
|
var t = this.connection.isUsingTLS(), s = this.timelineSender;
|
|
5686
|
-
this.timelineSenderTimer = new
|
|
5700
|
+
this.timelineSenderTimer = new M(6e4, function() {
|
|
5687
5701
|
s.send(t);
|
|
5688
5702
|
});
|
|
5689
5703
|
}
|
|
@@ -5729,13 +5743,13 @@ function Qo() {
|
|
|
5729
5743
|
this.user.signin();
|
|
5730
5744
|
}
|
|
5731
5745
|
}
|
|
5732
|
-
ue.instances = [], ue.isReady = !1, ue.logToConsole = !1, ue.Runtime =
|
|
5746
|
+
ue.instances = [], ue.isReady = !1, ue.logToConsole = !1, ue.Runtime = z, ue.ScriptReceivers = z.ScriptReceivers, ue.DependenciesReceivers = z.DependenciesReceivers, ue.auth_callbacks = z.auth_callbacks;
|
|
5733
5747
|
var vt = o.default = ue;
|
|
5734
5748
|
function Qr(r) {
|
|
5735
5749
|
if (r == null)
|
|
5736
5750
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
5737
5751
|
}
|
|
5738
|
-
|
|
5752
|
+
z.setup(ue);
|
|
5739
5753
|
})
|
|
5740
5754
|
/******/
|
|
5741
5755
|
])
|
|
@@ -5745,7 +5759,7 @@ function Qo() {
|
|
|
5745
5759
|
}
|
|
5746
5760
|
var Zo = Qo();
|
|
5747
5761
|
const ea = /* @__PURE__ */ Yo(Zo), ta = "/v1/messenger/bootstrap", na = 3e4, sa = 3e4, ra = 5 * 6e4;
|
|
5748
|
-
function
|
|
5762
|
+
function te(e) {
|
|
5749
5763
|
return typeof e == "object" && e !== null;
|
|
5750
5764
|
}
|
|
5751
5765
|
function ae(e, n) {
|
|
@@ -5785,39 +5799,40 @@ function aa(e) {
|
|
|
5785
5799
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5786
5800
|
}
|
|
5787
5801
|
function ca(e) {
|
|
5788
|
-
|
|
5802
|
+
const n = te(e) && te(e.data) ? e.data : e;
|
|
5803
|
+
if (!te(n))
|
|
5789
5804
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
5790
|
-
const
|
|
5791
|
-
if (!
|
|
5805
|
+
const i = n.auth, o = n.service;
|
|
5806
|
+
if (!te(i) || !te(o))
|
|
5792
5807
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
5793
|
-
const
|
|
5794
|
-
if (!
|
|
5808
|
+
const u = i.user, l = o.reverb;
|
|
5809
|
+
if (!te(u) || !te(l))
|
|
5795
5810
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5796
|
-
const
|
|
5811
|
+
const h = aa(Ne(l, "path"));
|
|
5797
5812
|
return {
|
|
5798
5813
|
auth: {
|
|
5799
|
-
token: ge(
|
|
5800
|
-
tokenType: ge(
|
|
5801
|
-
expiresAt: Ne(
|
|
5802
|
-
tenantId: Ne(
|
|
5814
|
+
token: ge(i, "token"),
|
|
5815
|
+
tokenType: ge(i, "token_type"),
|
|
5816
|
+
expiresAt: Ne(i, "expires_at"),
|
|
5817
|
+
tenantId: Ne(i, "tenant_id"),
|
|
5803
5818
|
user: {
|
|
5804
|
-
id: ge(
|
|
5805
|
-
handle: ge(
|
|
5806
|
-
name: ge(
|
|
5807
|
-
avatarUrl: Ne(
|
|
5808
|
-
email: Ne(
|
|
5819
|
+
id: ge(u, "id"),
|
|
5820
|
+
handle: ge(u, "handle"),
|
|
5821
|
+
name: ge(u, "name"),
|
|
5822
|
+
avatarUrl: Ne(u, "avatar_url"),
|
|
5823
|
+
email: Ne(u, "email")
|
|
5809
5824
|
}
|
|
5810
5825
|
},
|
|
5811
5826
|
service: {
|
|
5812
|
-
baseUrl: ge(
|
|
5813
|
-
apiBaseUrl: ge(
|
|
5814
|
-
broadcastingAuthUrl: ge(
|
|
5827
|
+
baseUrl: ge(o, "base_url"),
|
|
5828
|
+
apiBaseUrl: ge(o, "api_base_url"),
|
|
5829
|
+
broadcastingAuthUrl: ge(o, "broadcasting_auth_url"),
|
|
5815
5830
|
reverb: {
|
|
5816
|
-
appKey: ge(
|
|
5817
|
-
host: ge(
|
|
5818
|
-
port: ia(
|
|
5819
|
-
scheme: oa(ge(
|
|
5820
|
-
...
|
|
5831
|
+
appKey: ge(l, "app_key"),
|
|
5832
|
+
host: ge(l, "host"),
|
|
5833
|
+
port: ia(l, "port"),
|
|
5834
|
+
scheme: oa(ge(l, "scheme")),
|
|
5835
|
+
...h ? { path: h } : {}
|
|
5821
5836
|
}
|
|
5822
5837
|
}
|
|
5823
5838
|
};
|
|
@@ -5830,7 +5845,7 @@ function In(e, n) {
|
|
|
5830
5845
|
e.headers.set("Authorization", `Bearer ${n}`), e.headers.set("Accept", "application/json"), e.headers.set("X-Requested-With", "XMLHttpRequest"), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
5831
5846
|
return;
|
|
5832
5847
|
}
|
|
5833
|
-
const i =
|
|
5848
|
+
const i = te(e.headers) ? e.headers : {};
|
|
5834
5849
|
e.headers = new pn({
|
|
5835
5850
|
...i,
|
|
5836
5851
|
Authorization: `Bearer ${n}`,
|
|
@@ -5852,7 +5867,7 @@ function la(e) {
|
|
|
5852
5867
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
5853
5868
|
}
|
|
5854
5869
|
function ha(e, n) {
|
|
5855
|
-
if (!
|
|
5870
|
+
if (!te(e))
|
|
5856
5871
|
return null;
|
|
5857
5872
|
const i = _e(e, "user_id", "userId"), o = la(e.status);
|
|
5858
5873
|
if (!i || !o)
|
|
@@ -5868,12 +5883,12 @@ function ha(e, n) {
|
|
|
5868
5883
|
return typeof h == "string" ? u.last_seen_at = h : h === null && (u.last_seen_at = null), u;
|
|
5869
5884
|
}
|
|
5870
5885
|
function da(e) {
|
|
5871
|
-
if (!
|
|
5886
|
+
if (!te(e))
|
|
5872
5887
|
return null;
|
|
5873
5888
|
const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
|
|
5874
5889
|
if (!n || !i)
|
|
5875
5890
|
return null;
|
|
5876
|
-
const o = e.user, u =
|
|
5891
|
+
const o = e.user, u = te(o) ? {
|
|
5877
5892
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
5878
5893
|
name: typeof o.name == "string" ? o.name : "",
|
|
5879
5894
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
@@ -5889,12 +5904,12 @@ function da(e) {
|
|
|
5889
5904
|
};
|
|
5890
5905
|
}
|
|
5891
5906
|
function fa(e) {
|
|
5892
|
-
if (!
|
|
5907
|
+
if (!te(e))
|
|
5893
5908
|
return null;
|
|
5894
5909
|
const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
|
|
5895
5910
|
if (!n || !i)
|
|
5896
5911
|
return null;
|
|
5897
|
-
const o =
|
|
5912
|
+
const o = te(e.user) ? {
|
|
5898
5913
|
...typeof e.user.id == "string" && e.user.id !== "" ? { id: e.user.id } : {},
|
|
5899
5914
|
...typeof e.user.name == "string" ? { name: e.user.name } : {},
|
|
5900
5915
|
...typeof e.user.avatar == "string" && e.user.avatar !== "" ? { avatar: e.user.avatar } : {}
|
|
@@ -5908,7 +5923,7 @@ function fa(e) {
|
|
|
5908
5923
|
};
|
|
5909
5924
|
}
|
|
5910
5925
|
function pa(e) {
|
|
5911
|
-
if (!
|
|
5926
|
+
if (!te(e))
|
|
5912
5927
|
return null;
|
|
5913
5928
|
const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
|
|
5914
5929
|
return !n || !i ? null : {
|
|
@@ -5919,31 +5934,31 @@ function pa(e) {
|
|
|
5919
5934
|
};
|
|
5920
5935
|
}
|
|
5921
5936
|
function ga(e) {
|
|
5922
|
-
return
|
|
5937
|
+
return te(e) && ae(e, "id") && ae(e, "name");
|
|
5923
5938
|
}
|
|
5924
5939
|
function ma(e) {
|
|
5925
|
-
return !
|
|
5940
|
+
return !te(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ga(n));
|
|
5926
5941
|
}
|
|
5927
5942
|
function va(e) {
|
|
5928
|
-
return
|
|
5943
|
+
return te(e) && te(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
|
|
5929
5944
|
}
|
|
5930
5945
|
function ba(e) {
|
|
5931
|
-
return
|
|
5946
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
|
|
5932
5947
|
}
|
|
5933
5948
|
function ya(e) {
|
|
5934
|
-
return
|
|
5949
|
+
return te(e) && ae(e, "conversation_id") && te(e.message) && ae(e.message, "id");
|
|
5935
5950
|
}
|
|
5936
5951
|
function _a(e) {
|
|
5937
|
-
return
|
|
5952
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "message_id");
|
|
5938
5953
|
}
|
|
5939
5954
|
function Sa(e) {
|
|
5940
|
-
return
|
|
5955
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => ma(n));
|
|
5941
5956
|
}
|
|
5942
5957
|
function wa(e) {
|
|
5943
|
-
return
|
|
5958
|
+
return te(e) && ae(e, "conversation_id");
|
|
5944
5959
|
}
|
|
5945
5960
|
function Ca(e) {
|
|
5946
|
-
return
|
|
5961
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
|
|
5947
5962
|
}
|
|
5948
5963
|
function Re(e, n, i, o) {
|
|
5949
5964
|
const u = (l) => {
|
|
@@ -5952,102 +5967,102 @@ function Re(e, n, i, o) {
|
|
|
5952
5967
|
return e.listen(n, u), u;
|
|
5953
5968
|
}
|
|
5954
5969
|
function za(e) {
|
|
5955
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ta, o = e.bootstrapRefreshSkewMs ?? na, u = e.presenceFreshnessTtlMs ?? ra, l = (e.createLogger ??
|
|
5970
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ta, o = e.bootstrapRefreshSkewMs ?? na, u = e.presenceFreshnessTtlMs ?? ra, l = (e.createLogger ?? qt())("MessengerEcho");
|
|
5956
5971
|
typeof window < "u" && (window.Pusher = ea);
|
|
5957
|
-
let h = null, g = null, d = null, A = null, x = "disconnected",
|
|
5958
|
-
const
|
|
5972
|
+
let h = null, g = null, d = null, A = null, x = "disconnected", v = null, w = null;
|
|
5973
|
+
const R = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map(), _ = (T) => {
|
|
5959
5974
|
x = T;
|
|
5960
|
-
for (const
|
|
5961
|
-
|
|
5975
|
+
for (const M of R)
|
|
5976
|
+
M(T);
|
|
5962
5977
|
}, f = () => {
|
|
5963
|
-
|
|
5964
|
-
},
|
|
5965
|
-
d !== null && (d.disconnect(), d = null), A = null, T &&
|
|
5966
|
-
},
|
|
5967
|
-
f(), h = null, g = null,
|
|
5978
|
+
w !== null && (clearTimeout(w), w = null);
|
|
5979
|
+
}, b = (T = !0) => {
|
|
5980
|
+
d !== null && (d.disconnect(), d = null), A = null, T && _("disconnected");
|
|
5981
|
+
}, y = () => {
|
|
5982
|
+
f(), h = null, g = null, v = null, b(), E.clear();
|
|
5968
5983
|
}, F = () => {
|
|
5969
5984
|
if (!e.getSourceToken)
|
|
5970
5985
|
return null;
|
|
5971
5986
|
const T = e.getSourceToken();
|
|
5972
|
-
return T === null ? (
|
|
5973
|
-
},
|
|
5987
|
+
return T === null ? (y(), null) : (v !== null && v !== T && (f(), h = null, g = null, b()), v = T, T);
|
|
5988
|
+
}, H = (T) => {
|
|
5974
5989
|
if (T === null)
|
|
5975
5990
|
return !1;
|
|
5976
5991
|
if (T.auth.expiresAt === null)
|
|
5977
5992
|
return T.auth.token !== "";
|
|
5978
|
-
const
|
|
5979
|
-
return Number.isNaN(
|
|
5993
|
+
const M = Date.parse(T.auth.expiresAt);
|
|
5994
|
+
return Number.isNaN(M) ? !1 : M - Date.now() > o;
|
|
5980
5995
|
}, B = (T) => {
|
|
5981
5996
|
if (f(), T.auth.expiresAt === null)
|
|
5982
5997
|
return;
|
|
5983
|
-
const
|
|
5984
|
-
if (Number.isNaN(
|
|
5998
|
+
const M = Date.parse(T.auth.expiresAt);
|
|
5999
|
+
if (Number.isNaN(M))
|
|
5985
6000
|
return;
|
|
5986
|
-
const
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
},
|
|
5990
|
-
}, P = async (T = !1) => e.getSourceToken && F() === null ? null : !T &&
|
|
5991
|
-
const
|
|
6001
|
+
const Q = Math.max(0, M - Date.now() - o);
|
|
6002
|
+
w = setTimeout(() => {
|
|
6003
|
+
L();
|
|
6004
|
+
}, Q);
|
|
6005
|
+
}, P = async (T = !1) => e.getSourceToken && F() === null ? null : !T && H(h) ? h : !T && g !== null ? await g : (g = (async () => {
|
|
6006
|
+
const Q = await e.bootstrapClient.get(
|
|
5992
6007
|
i,
|
|
5993
6008
|
T ? { params: { refresh: 1 } } : void 0
|
|
5994
|
-
), N = ca(
|
|
6009
|
+
), N = ca(Q.data);
|
|
5995
6010
|
return h = N, B(N), N;
|
|
5996
6011
|
})().finally(() => {
|
|
5997
6012
|
g = null;
|
|
5998
|
-
}), await g),
|
|
6013
|
+
}), await g), L = async () => {
|
|
5999
6014
|
const T = d !== null;
|
|
6000
6015
|
try {
|
|
6001
6016
|
if (await P(!0), !T)
|
|
6002
6017
|
return;
|
|
6003
|
-
|
|
6004
|
-
} catch (
|
|
6005
|
-
l.warn("Failed to refresh messenger bootstrap",
|
|
6018
|
+
b(!1), await O(!0);
|
|
6019
|
+
} catch (M) {
|
|
6020
|
+
l.warn("Failed to refresh messenger bootstrap", M);
|
|
6006
6021
|
}
|
|
6007
|
-
},
|
|
6008
|
-
const
|
|
6009
|
-
if (!
|
|
6022
|
+
}, V = (T) => {
|
|
6023
|
+
const M = T.connector?.pusher?.connection;
|
|
6024
|
+
if (!M) {
|
|
6010
6025
|
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6011
6026
|
return;
|
|
6012
6027
|
}
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
}),
|
|
6016
|
-
|
|
6017
|
-
}),
|
|
6018
|
-
|
|
6019
|
-
}),
|
|
6020
|
-
|
|
6021
|
-
}),
|
|
6022
|
-
|
|
6023
|
-
}),
|
|
6024
|
-
},
|
|
6025
|
-
const
|
|
6026
|
-
if (
|
|
6028
|
+
M.bind("connecting", () => {
|
|
6029
|
+
_("connecting");
|
|
6030
|
+
}), M.bind("connected", () => {
|
|
6031
|
+
_("connected");
|
|
6032
|
+
}), M.bind("disconnected", () => {
|
|
6033
|
+
_("disconnected");
|
|
6034
|
+
}), M.bind("unavailable", () => {
|
|
6035
|
+
_("disconnected");
|
|
6036
|
+
}), M.bind("error", () => {
|
|
6037
|
+
_("error");
|
|
6038
|
+
}), M.state === "connected" && _("connected");
|
|
6039
|
+
}, O = async (T = !1) => !T && d !== null && H(h) ? d : !T && A !== null ? await A : (A = (async () => {
|
|
6040
|
+
const Q = await P(T);
|
|
6041
|
+
if (Q === null)
|
|
6027
6042
|
return null;
|
|
6028
|
-
d !== null &&
|
|
6029
|
-
const N =
|
|
6043
|
+
d !== null && b(!1);
|
|
6044
|
+
const N = Q.service.reverb.scheme === "https", X = {
|
|
6030
6045
|
broadcaster: "reverb",
|
|
6031
|
-
key:
|
|
6032
|
-
wsHost: ua(
|
|
6033
|
-
wsPort:
|
|
6034
|
-
wssPort:
|
|
6046
|
+
key: Q.service.reverb.appKey,
|
|
6047
|
+
wsHost: ua(Q.service.reverb.host),
|
|
6048
|
+
wsPort: Q.service.reverb.port,
|
|
6049
|
+
wssPort: Q.service.reverb.port,
|
|
6035
6050
|
forceTLS: N,
|
|
6036
6051
|
encrypted: N,
|
|
6037
6052
|
disableStats: !0,
|
|
6038
6053
|
enabledTransports: ["ws", "wss"],
|
|
6039
|
-
authEndpoint:
|
|
6054
|
+
authEndpoint: Q.service.broadcastingAuthUrl,
|
|
6040
6055
|
auth: {
|
|
6041
6056
|
headers: {
|
|
6042
|
-
Authorization: `Bearer ${
|
|
6057
|
+
Authorization: `Bearer ${Q.auth.token}`,
|
|
6043
6058
|
Accept: "application/json"
|
|
6044
6059
|
}
|
|
6045
6060
|
}
|
|
6046
6061
|
};
|
|
6047
|
-
return
|
|
6062
|
+
return Q.service.reverb.path && (X.wsPath = Q.service.reverb.path), d = new Ko(X), V(d), _("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
|
|
6048
6063
|
})().finally(() => {
|
|
6049
6064
|
A = null;
|
|
6050
|
-
}), await A), K =
|
|
6065
|
+
}), await A), K = kt.create({
|
|
6051
6066
|
timeout: e.requestTimeoutMs ?? sa,
|
|
6052
6067
|
withCredentials: !1,
|
|
6053
6068
|
headers: {
|
|
@@ -6056,57 +6071,57 @@ function za(e) {
|
|
|
6056
6071
|
}
|
|
6057
6072
|
});
|
|
6058
6073
|
K.interceptors.request.use(async (T) => {
|
|
6059
|
-
const
|
|
6060
|
-
if (
|
|
6074
|
+
const M = await P();
|
|
6075
|
+
if (M === null)
|
|
6061
6076
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6062
|
-
return T.baseURL =
|
|
6077
|
+
return T.baseURL = M.service.apiBaseUrl, In(T, M.auth.token), T;
|
|
6063
6078
|
}), K.interceptors.response.use(
|
|
6064
6079
|
(T) => T,
|
|
6065
6080
|
async (T) => {
|
|
6066
|
-
const
|
|
6067
|
-
if (T.response?.status === 401 &&
|
|
6068
|
-
|
|
6069
|
-
const
|
|
6070
|
-
if (
|
|
6071
|
-
return
|
|
6081
|
+
const M = T.config;
|
|
6082
|
+
if (T.response?.status === 401 && M && M._messengerRetry !== !0) {
|
|
6083
|
+
M._messengerRetry = !0;
|
|
6084
|
+
const Q = await P(!0);
|
|
6085
|
+
if (Q !== null)
|
|
6086
|
+
return M.baseURL = Q.service.apiBaseUrl, In(M, Q.auth.token), await K(M);
|
|
6072
6087
|
}
|
|
6073
6088
|
return Promise.reject(T);
|
|
6074
6089
|
}
|
|
6075
6090
|
);
|
|
6076
|
-
const
|
|
6091
|
+
const ie = () => (O().catch((T) => {
|
|
6077
6092
|
l.warn("Failed to initialize messenger echo", T);
|
|
6078
|
-
}), d),
|
|
6079
|
-
|
|
6080
|
-
}),
|
|
6081
|
-
const
|
|
6082
|
-
if (
|
|
6093
|
+
}), d), $ = (T) => (R.add(T), T(x), () => {
|
|
6094
|
+
R.delete(T);
|
|
6095
|
+
}), m = () => h?.auth.tenantId ?? "global", j = (T) => {
|
|
6096
|
+
const M = xt(T.ts)?.getTime() ?? xt(T.last_seen_at)?.getTime() ?? null;
|
|
6097
|
+
if (M === null)
|
|
6083
6098
|
return !0;
|
|
6084
|
-
const
|
|
6085
|
-
if (N &&
|
|
6099
|
+
const Q = `${T.tenant_scope ?? "global"}:${T.user_id}`, N = E.get(Q);
|
|
6100
|
+
if (N && M < N.timestampMs)
|
|
6086
6101
|
return !1;
|
|
6087
|
-
const
|
|
6088
|
-
|
|
6089
|
-
timestampMs:
|
|
6090
|
-
seenAt:
|
|
6102
|
+
const X = Date.now();
|
|
6103
|
+
E.set(Q, {
|
|
6104
|
+
timestampMs: M,
|
|
6105
|
+
seenAt: X
|
|
6091
6106
|
});
|
|
6092
|
-
for (const [me, ve] of
|
|
6093
|
-
|
|
6107
|
+
for (const [me, ve] of E.entries())
|
|
6108
|
+
X - ve.seenAt > u && E.delete(me);
|
|
6094
6109
|
return !0;
|
|
6095
6110
|
};
|
|
6096
6111
|
return {
|
|
6097
6112
|
apiClient: K,
|
|
6098
6113
|
initializedEvent: n,
|
|
6099
|
-
getEcho:
|
|
6114
|
+
getEcho: ie,
|
|
6100
6115
|
getConnectionStatus: () => x,
|
|
6101
|
-
onConnectionStatusChange:
|
|
6116
|
+
onConnectionStatusChange: $,
|
|
6102
6117
|
reconnect: async () => {
|
|
6103
|
-
|
|
6118
|
+
b(), await O(!0);
|
|
6104
6119
|
},
|
|
6105
6120
|
subscribeToPresenceStatus: (T) => {
|
|
6106
|
-
const
|
|
6107
|
-
if (!
|
|
6121
|
+
const M = ie();
|
|
6122
|
+
if (!M || typeof M.join != "function")
|
|
6108
6123
|
return;
|
|
6109
|
-
const
|
|
6124
|
+
const Q = M.join(`online-users.${m()}`), N = [
|
|
6110
6125
|
".PresenceStatusChanged",
|
|
6111
6126
|
"PresenceStatusChanged",
|
|
6112
6127
|
".presence.status.changed",
|
|
@@ -6116,57 +6131,57 @@ function za(e) {
|
|
|
6116
6131
|
".Modules\\Presence\\Events\\UserPresenceStatusChanged",
|
|
6117
6132
|
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6118
6133
|
];
|
|
6119
|
-
for (const
|
|
6120
|
-
|
|
6121
|
-
const ve = ha(me,
|
|
6122
|
-
!ve || !
|
|
6134
|
+
for (const X of N)
|
|
6135
|
+
Q.listen(X, (me) => {
|
|
6136
|
+
const ve = ha(me, m());
|
|
6137
|
+
!ve || !j(ve) || T(ve);
|
|
6123
6138
|
});
|
|
6124
6139
|
},
|
|
6125
6140
|
unsubscribeFromPresenceStatus: () => {
|
|
6126
|
-
d?.leave(`online-users.${
|
|
6141
|
+
d?.leave(`online-users.${m()}`);
|
|
6127
6142
|
},
|
|
6128
|
-
subscribeToConversation: (T,
|
|
6129
|
-
const
|
|
6130
|
-
if (!
|
|
6143
|
+
subscribeToConversation: (T, M) => {
|
|
6144
|
+
const Q = ie();
|
|
6145
|
+
if (!Q)
|
|
6131
6146
|
return () => {
|
|
6132
6147
|
};
|
|
6133
|
-
const N =
|
|
6134
|
-
return
|
|
6148
|
+
const N = Q.private(`conversation.${T}`), X = [];
|
|
6149
|
+
return M.onMessageSent && X.push({
|
|
6135
6150
|
event: ".ConversationMessageSent",
|
|
6136
|
-
handler: Re(N, ".ConversationMessageSent", va,
|
|
6137
|
-
}),
|
|
6151
|
+
handler: Re(N, ".ConversationMessageSent", va, M.onMessageSent)
|
|
6152
|
+
}), M.onMessageRead && X.push({
|
|
6138
6153
|
event: ".ConversationMessageRead",
|
|
6139
|
-
handler: Re(N, ".ConversationMessageRead", ba,
|
|
6140
|
-
}),
|
|
6154
|
+
handler: Re(N, ".ConversationMessageRead", ba, M.onMessageRead)
|
|
6155
|
+
}), M.onMessageEdited && X.push({
|
|
6141
6156
|
event: ".ConversationMessageEdited",
|
|
6142
|
-
handler: Re(N, ".ConversationMessageEdited", ya,
|
|
6143
|
-
}),
|
|
6157
|
+
handler: Re(N, ".ConversationMessageEdited", ya, M.onMessageEdited)
|
|
6158
|
+
}), M.onMessageDeleted && X.push({
|
|
6144
6159
|
event: ".ConversationMessageDeleted",
|
|
6145
|
-
handler: Re(N, ".ConversationMessageDeleted", _a,
|
|
6146
|
-
}),
|
|
6160
|
+
handler: Re(N, ".ConversationMessageDeleted", _a, M.onMessageDeleted)
|
|
6161
|
+
}), M.onReactionToggled && X.push({
|
|
6147
6162
|
event: ".MessageReactionToggled",
|
|
6148
|
-
handler: Re(N, ".MessageReactionToggled", Sa,
|
|
6149
|
-
}),
|
|
6163
|
+
handler: Re(N, ".MessageReactionToggled", Sa, M.onReactionToggled)
|
|
6164
|
+
}), M.onRequestAccepted && X.push({
|
|
6150
6165
|
event: ".ConversationRequestAccepted",
|
|
6151
|
-
handler: Re(N, ".ConversationRequestAccepted", wa,
|
|
6152
|
-
}),
|
|
6166
|
+
handler: Re(N, ".ConversationRequestAccepted", wa, M.onRequestAccepted)
|
|
6167
|
+
}), M.onParticipantRemoved && X.push({
|
|
6153
6168
|
event: ".ConversationParticipantRemoved",
|
|
6154
|
-
handler: Re(N, ".ConversationParticipantRemoved", Ca,
|
|
6169
|
+
handler: Re(N, ".ConversationParticipantRemoved", Ca, M.onParticipantRemoved)
|
|
6155
6170
|
}), () => {
|
|
6156
6171
|
if (typeof N.stopListening == "function")
|
|
6157
|
-
for (const me of
|
|
6172
|
+
for (const me of X)
|
|
6158
6173
|
N.stopListening(me.event, me.handler);
|
|
6159
6174
|
};
|
|
6160
6175
|
},
|
|
6161
6176
|
unsubscribeFromConversation: (T) => {
|
|
6162
6177
|
d?.leave(`conversation.${T}`);
|
|
6163
6178
|
},
|
|
6164
|
-
subscribeToTyping: (T,
|
|
6165
|
-
const
|
|
6166
|
-
if (!
|
|
6179
|
+
subscribeToTyping: (T, M) => {
|
|
6180
|
+
const Q = ie();
|
|
6181
|
+
if (!Q)
|
|
6167
6182
|
return () => {
|
|
6168
6183
|
};
|
|
6169
|
-
const N =
|
|
6184
|
+
const N = Q.private(`typing-conversation.${T}`), X = [], me = [
|
|
6170
6185
|
".TypingStateChanged",
|
|
6171
6186
|
"TypingStateChanged",
|
|
6172
6187
|
".typing.changed",
|
|
@@ -6178,86 +6193,86 @@ function za(e) {
|
|
|
6178
6193
|
], ve = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], fe = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], $e = /* @__PURE__ */ new Set(["start", "typing"]), ot = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6179
6194
|
for (const ce of me) {
|
|
6180
6195
|
const pe = (we) => {
|
|
6181
|
-
const
|
|
6182
|
-
if (
|
|
6183
|
-
if ($e.has(
|
|
6184
|
-
|
|
6185
|
-
user_id:
|
|
6186
|
-
user:
|
|
6187
|
-
id:
|
|
6196
|
+
const G = da(we);
|
|
6197
|
+
if (G) {
|
|
6198
|
+
if ($e.has(G.state)) {
|
|
6199
|
+
M.onTypingStart?.({
|
|
6200
|
+
user_id: G.user_id,
|
|
6201
|
+
user: G.user ?? {
|
|
6202
|
+
id: G.user_id,
|
|
6188
6203
|
name: ""
|
|
6189
6204
|
},
|
|
6190
|
-
conversation_id:
|
|
6191
|
-
started_at:
|
|
6205
|
+
conversation_id: G.conversation_id,
|
|
6206
|
+
started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6192
6207
|
});
|
|
6193
6208
|
return;
|
|
6194
6209
|
}
|
|
6195
|
-
ot.has(
|
|
6196
|
-
user_id:
|
|
6197
|
-
conversation_id:
|
|
6198
|
-
stopped_at:
|
|
6210
|
+
ot.has(G.state) && M.onTypingStop?.({
|
|
6211
|
+
user_id: G.user_id,
|
|
6212
|
+
conversation_id: G.conversation_id,
|
|
6213
|
+
stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6199
6214
|
});
|
|
6200
6215
|
}
|
|
6201
6216
|
};
|
|
6202
|
-
N.listen(ce, pe),
|
|
6217
|
+
N.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6203
6218
|
}
|
|
6204
6219
|
for (const ce of ve) {
|
|
6205
6220
|
const pe = (we) => {
|
|
6206
|
-
const
|
|
6207
|
-
if (!
|
|
6221
|
+
const G = fa(we);
|
|
6222
|
+
if (!G)
|
|
6208
6223
|
return;
|
|
6209
6224
|
const xe = {
|
|
6210
|
-
user_id:
|
|
6225
|
+
user_id: G.user_id,
|
|
6211
6226
|
user: {
|
|
6212
|
-
id:
|
|
6213
|
-
name:
|
|
6214
|
-
...
|
|
6227
|
+
id: G.user?.id ?? G.user_id,
|
|
6228
|
+
name: G.user?.name ?? "",
|
|
6229
|
+
...G.user?.avatar ? { avatar: G.user.avatar } : {}
|
|
6215
6230
|
},
|
|
6216
|
-
conversation_id:
|
|
6217
|
-
started_at:
|
|
6231
|
+
conversation_id: G.conversation_id,
|
|
6232
|
+
started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6218
6233
|
};
|
|
6219
|
-
|
|
6234
|
+
M.onTypingStart?.(xe);
|
|
6220
6235
|
};
|
|
6221
|
-
N.listen(ce, pe),
|
|
6236
|
+
N.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6222
6237
|
}
|
|
6223
6238
|
for (const ce of fe) {
|
|
6224
6239
|
const pe = (we) => {
|
|
6225
|
-
const
|
|
6226
|
-
if (!
|
|
6240
|
+
const G = pa(we);
|
|
6241
|
+
if (!G)
|
|
6227
6242
|
return;
|
|
6228
6243
|
const xe = {
|
|
6229
|
-
user_id:
|
|
6230
|
-
conversation_id:
|
|
6231
|
-
stopped_at:
|
|
6244
|
+
user_id: G.user_id,
|
|
6245
|
+
conversation_id: G.conversation_id,
|
|
6246
|
+
stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6232
6247
|
};
|
|
6233
|
-
|
|
6248
|
+
M.onTypingStop?.(xe);
|
|
6234
6249
|
};
|
|
6235
|
-
N.listen(ce, pe),
|
|
6250
|
+
N.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6236
6251
|
}
|
|
6237
6252
|
return () => {
|
|
6238
6253
|
if (typeof N.stopListening == "function")
|
|
6239
|
-
for (const ce of
|
|
6254
|
+
for (const ce of X)
|
|
6240
6255
|
N.stopListening(ce.event, ce.handler);
|
|
6241
6256
|
};
|
|
6242
6257
|
},
|
|
6243
6258
|
unsubscribeFromTyping: (T) => {
|
|
6244
6259
|
d?.leave(`typing-conversation.${T}`);
|
|
6245
6260
|
},
|
|
6246
|
-
clearRuntime:
|
|
6261
|
+
clearRuntime: y
|
|
6247
6262
|
};
|
|
6248
6263
|
}
|
|
6249
6264
|
export {
|
|
6250
6265
|
ho as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6251
6266
|
Da as configureMessengerClient,
|
|
6252
6267
|
za as createMessengerEcho,
|
|
6253
|
-
|
|
6268
|
+
W as getApi,
|
|
6254
6269
|
Pe as getAuthStore,
|
|
6255
6270
|
Ma as getConnectionStatus,
|
|
6256
6271
|
Ae as getEcho,
|
|
6257
6272
|
Hn as getEchoConnectionStatus,
|
|
6258
6273
|
De as getEchoInitializedEvent,
|
|
6259
|
-
|
|
6260
|
-
|
|
6274
|
+
Z as getErrorMessage,
|
|
6275
|
+
qt as getLoggerFactory,
|
|
6261
6276
|
es as getMainApi,
|
|
6262
6277
|
Qi as getMainEcho,
|
|
6263
6278
|
Zi as getMainEchoConnectionStatus,
|
|
@@ -6275,7 +6290,7 @@ export {
|
|
|
6275
6290
|
ts as normalizePresenceTimestamp,
|
|
6276
6291
|
it as onConnectionStatusChange,
|
|
6277
6292
|
eo as onMainEchoConnectionStatusChange,
|
|
6278
|
-
|
|
6293
|
+
xt as parsePresenceTimestamp,
|
|
6279
6294
|
di as reconnectEcho,
|
|
6280
6295
|
to as reconnectMainEcho,
|
|
6281
6296
|
_i as resetEchoRuntimeConfig,
|
|
@@ -6306,7 +6321,7 @@ export {
|
|
|
6306
6321
|
Ua as useConnectionStatus,
|
|
6307
6322
|
La as useConversationChannel,
|
|
6308
6323
|
Oa as useGlobalMessaging,
|
|
6309
|
-
|
|
6324
|
+
Ft as useMessagingStore,
|
|
6310
6325
|
Na as usePresence,
|
|
6311
6326
|
Fa as useTypingChannel
|
|
6312
6327
|
};
|