@codingfactory/messenger-client 0.2.35 → 0.2.36
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 +1103 -1099
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as ye, getCurrentInstance as jt, computed as
|
|
1
|
+
import { ref as ye, getCurrentInstance as jt, computed as se, watch as ut, onUnmounted as ze, toValue as is, onMounted as $t } from "vue";
|
|
2
2
|
import { defineStore as Oi, storeToRefs as Fi } from "pinia";
|
|
3
3
|
import Ht, { isAxiosError as Di, AxiosHeaders as Rn } from "axios";
|
|
4
|
-
import { isAxiosError as
|
|
4
|
+
import { isAxiosError as bc } from "axios";
|
|
5
5
|
import { useRoute as Ni } from "vue-router";
|
|
6
6
|
const os = () => () => {
|
|
7
7
|
}, as = () => () => {
|
|
@@ -61,7 +61,7 @@ function eo(e) {
|
|
|
61
61
|
}
|
|
62
62
|
const bs = Ht;
|
|
63
63
|
let Bt = bs;
|
|
64
|
-
function
|
|
64
|
+
function B() {
|
|
65
65
|
return Bt;
|
|
66
66
|
}
|
|
67
67
|
function to(e) {
|
|
@@ -94,17 +94,17 @@ function io(e) {
|
|
|
94
94
|
function oo() {
|
|
95
95
|
Wt = () => _s;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function K(e) {
|
|
98
98
|
if (Di(e)) {
|
|
99
99
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
100
100
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
101
101
|
}
|
|
102
102
|
return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function ic(e) {
|
|
105
105
|
return e instanceof Error;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function oc(e) {
|
|
108
108
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
109
109
|
}
|
|
110
110
|
const Ss = {
|
|
@@ -183,35 +183,35 @@ function Mn(e) {
|
|
|
183
183
|
}
|
|
184
184
|
const ke = {
|
|
185
185
|
async fetchFolders() {
|
|
186
|
-
const e = await
|
|
186
|
+
const e = await B().get("/v1/messaging/folders");
|
|
187
187
|
return ho(He(e.data));
|
|
188
188
|
},
|
|
189
189
|
async createFolder(e) {
|
|
190
|
-
const n = await
|
|
190
|
+
const n = await B().post("/v1/messaging/folders", e);
|
|
191
191
|
return Dt(He(n.data));
|
|
192
192
|
},
|
|
193
193
|
async updateFolder(e, n) {
|
|
194
|
-
const r = await
|
|
194
|
+
const r = await B().patch(`/v1/messaging/folders/${e}`, n);
|
|
195
195
|
return Dt(He(r.data));
|
|
196
196
|
},
|
|
197
197
|
async deleteFolder(e) {
|
|
198
|
-
await
|
|
198
|
+
await B().delete(`/v1/messaging/folders/${e}`);
|
|
199
199
|
},
|
|
200
200
|
async reorderFolders(e) {
|
|
201
|
-
await
|
|
201
|
+
await B().patch("/v1/messaging/folders/reorder", { order: e });
|
|
202
202
|
},
|
|
203
203
|
async assignFolder(e, n) {
|
|
204
|
-
const r = await
|
|
204
|
+
const r = await B().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
205
205
|
folder_id: n
|
|
206
206
|
});
|
|
207
207
|
return Mn(He(r.data));
|
|
208
208
|
},
|
|
209
209
|
async acceptRequest(e) {
|
|
210
|
-
const n = await
|
|
210
|
+
const n = await B().post(`/v1/messaging/conversations/${e}/accept`);
|
|
211
211
|
return Mn(He(n.data));
|
|
212
212
|
},
|
|
213
213
|
async declineRequest(e) {
|
|
214
|
-
await
|
|
214
|
+
await B().post(`/v1/messaging/conversations/${e}/decline`);
|
|
215
215
|
}
|
|
216
216
|
}, fo = 6e4;
|
|
217
217
|
function po(e) {
|
|
@@ -288,9 +288,9 @@ const kn = 1e3, Jt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Kt = (e) => {
|
|
|
288
288
|
data: [],
|
|
289
289
|
has_more: !1
|
|
290
290
|
}), Un = () => Ft() === "account_suspended", wo = (e) => {
|
|
291
|
-
if (!
|
|
291
|
+
if (!fe(e))
|
|
292
292
|
return !1;
|
|
293
|
-
const r = (
|
|
293
|
+
const r = (fe(e.data) ? e.data : e).throttled;
|
|
294
294
|
if (typeof r == "boolean")
|
|
295
295
|
return r;
|
|
296
296
|
if (typeof r == "number")
|
|
@@ -373,12 +373,12 @@ function lt(e) {
|
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
function Mo(e) {
|
|
376
|
-
if (!e || !
|
|
376
|
+
if (!e || !fe(e))
|
|
377
377
|
return;
|
|
378
378
|
const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
379
379
|
if (n.length === 0 || r.length === 0 || o.length === 0)
|
|
380
380
|
return;
|
|
381
|
-
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d =
|
|
381
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = fe(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", M = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, w = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
|
|
382
382
|
return {
|
|
383
383
|
id: n,
|
|
384
384
|
title: r,
|
|
@@ -389,8 +389,8 @@ function Mo(e) {
|
|
|
389
389
|
author: {
|
|
390
390
|
id: f,
|
|
391
391
|
name: h,
|
|
392
|
-
...
|
|
393
|
-
...
|
|
392
|
+
...M ? { avatar: M } : {},
|
|
393
|
+
...w ? { handle: w } : {}
|
|
394
394
|
}
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
@@ -449,11 +449,11 @@ function Lo(e, n) {
|
|
|
449
449
|
return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : n?.folder_id;
|
|
450
450
|
}
|
|
451
451
|
function Be(e, n) {
|
|
452
|
-
const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? lt(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1,
|
|
452
|
+
const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? lt(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, M = Lo(e, n), w = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
|
|
453
453
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
454
454
|
return !1;
|
|
455
|
-
const
|
|
456
|
-
return !
|
|
455
|
+
const E = n.last_message?.id, b = e.last_message?.id;
|
|
456
|
+
return !E || !b ? !1 : E === b;
|
|
457
457
|
})();
|
|
458
458
|
return {
|
|
459
459
|
...e,
|
|
@@ -463,8 +463,8 @@ function Be(e, n) {
|
|
|
463
463
|
muted_until: r,
|
|
464
464
|
is_pinned: f,
|
|
465
465
|
is_archived: h,
|
|
466
|
-
folder_id:
|
|
467
|
-
created_at:
|
|
466
|
+
folder_id: M,
|
|
467
|
+
created_at: w,
|
|
468
468
|
...c ? { last_message: c } : {},
|
|
469
469
|
...u ? { last_message_at: u } : {}
|
|
470
470
|
};
|
|
@@ -485,20 +485,20 @@ function Fn(e, n) {
|
|
|
485
485
|
}
|
|
486
486
|
return zt(e.last_message?.id) ? e.last_message.id : null;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function fe(e) {
|
|
489
489
|
return typeof e == "object" && e !== null;
|
|
490
490
|
}
|
|
491
491
|
function Uo(e) {
|
|
492
|
-
return
|
|
492
|
+
return fe(e) ? (fe(e.response) ? e.response : null)?.status === 401 : !1;
|
|
493
493
|
}
|
|
494
494
|
function Dn(e) {
|
|
495
495
|
if (!Array.isArray(e))
|
|
496
496
|
return [];
|
|
497
497
|
const n = [];
|
|
498
498
|
for (const r of e) {
|
|
499
|
-
if (!
|
|
499
|
+
if (!fe(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
|
|
500
500
|
continue;
|
|
501
|
-
const o = r.users.filter((c) =>
|
|
501
|
+
const o = r.users.filter((c) => fe(c)).filter(
|
|
502
502
|
(c) => typeof c.id == "string" && typeof c.name == "string"
|
|
503
503
|
).map((c) => ({
|
|
504
504
|
id: c.id,
|
|
@@ -513,23 +513,23 @@ function Dn(e) {
|
|
|
513
513
|
return n;
|
|
514
514
|
}
|
|
515
515
|
function Oo(e, n) {
|
|
516
|
-
const r =
|
|
516
|
+
const r = fe(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
|
|
517
517
|
if (!(typeof o != "string" || o.length === 0))
|
|
518
518
|
return o;
|
|
519
519
|
}
|
|
520
520
|
function ot(e, n) {
|
|
521
|
-
const r =
|
|
521
|
+
const r = fe(e) ? e : {}, o = r.data ?? e;
|
|
522
522
|
let c = [];
|
|
523
|
-
return Array.isArray(o) ? c = o :
|
|
523
|
+
return Array.isArray(o) ? c = o : fe(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
|
|
524
524
|
items: c,
|
|
525
525
|
nextCursor: Oo(r, o)
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
function Nn(e) {
|
|
529
|
-
return
|
|
529
|
+
return fe(e) && typeof e.id == "string" && e.id.length > 0;
|
|
530
530
|
}
|
|
531
531
|
function qn(e) {
|
|
532
|
-
return
|
|
532
|
+
return fe(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
533
533
|
}
|
|
534
534
|
function Qt(e, n) {
|
|
535
535
|
if (e.type !== "dm")
|
|
@@ -541,7 +541,7 @@ function Qt(e, n) {
|
|
|
541
541
|
return r.user.id === n && o.length > 0 && o.toLowerCase() !== "pending user";
|
|
542
542
|
}
|
|
543
543
|
function zn(e) {
|
|
544
|
-
if (!
|
|
544
|
+
if (!fe(e) || typeof e.id != "string" || typeof e.name != "string")
|
|
545
545
|
return null;
|
|
546
546
|
const n = {
|
|
547
547
|
id: e.id,
|
|
@@ -552,8 +552,8 @@ function zn(e) {
|
|
|
552
552
|
return c && (n.avatar = c, n.avatar_url = c), n;
|
|
553
553
|
}
|
|
554
554
|
function Fo(e) {
|
|
555
|
-
const r = (
|
|
556
|
-
return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) :
|
|
555
|
+
const r = (fe(e) ? e : {}).data ?? e;
|
|
556
|
+
return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : fe(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
|
|
557
557
|
}
|
|
558
558
|
function Rs(e) {
|
|
559
559
|
if (e.type !== "dm")
|
|
@@ -738,7 +738,7 @@ const Yt = Oi("messaging", {
|
|
|
738
738
|
const e = await ke.fetchFolders();
|
|
739
739
|
return this.folders = Ve(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
740
740
|
} catch (e) {
|
|
741
|
-
throw this.error =
|
|
741
|
+
throw this.error = K(e), e;
|
|
742
742
|
}
|
|
743
743
|
},
|
|
744
744
|
async createFolder(e) {
|
|
@@ -746,7 +746,7 @@ const Yt = Oi("messaging", {
|
|
|
746
746
|
const n = await ke.createFolder(e);
|
|
747
747
|
return this.folders = Ve([...this.folders, n]), n;
|
|
748
748
|
} catch (n) {
|
|
749
|
-
throw this.error =
|
|
749
|
+
throw this.error = K(n), n;
|
|
750
750
|
}
|
|
751
751
|
},
|
|
752
752
|
async updateFolder(e, n) {
|
|
@@ -756,14 +756,14 @@ const Yt = Oi("messaging", {
|
|
|
756
756
|
this.folders.map((o) => o.id === e ? r : o)
|
|
757
757
|
), r;
|
|
758
758
|
} catch (r) {
|
|
759
|
-
throw this.error =
|
|
759
|
+
throw this.error = K(r), r;
|
|
760
760
|
}
|
|
761
761
|
},
|
|
762
762
|
async deleteFolder(e) {
|
|
763
763
|
try {
|
|
764
764
|
await ke.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
765
765
|
} catch (n) {
|
|
766
|
-
throw this.error =
|
|
766
|
+
throw this.error = K(n), n;
|
|
767
767
|
}
|
|
768
768
|
},
|
|
769
769
|
async reorderFolders(e) {
|
|
@@ -785,7 +785,7 @@ const Yt = Oi("messaging", {
|
|
|
785
785
|
});
|
|
786
786
|
this.folders = r;
|
|
787
787
|
} catch (n) {
|
|
788
|
-
throw this.error =
|
|
788
|
+
throw this.error = K(n), n;
|
|
789
789
|
}
|
|
790
790
|
},
|
|
791
791
|
async assignToFolder(e, n) {
|
|
@@ -812,7 +812,7 @@ const Yt = Oi("messaging", {
|
|
|
812
812
|
u
|
|
813
813
|
);
|
|
814
814
|
} catch (r) {
|
|
815
|
-
throw this.error =
|
|
815
|
+
throw this.error = K(r), r;
|
|
816
816
|
}
|
|
817
817
|
},
|
|
818
818
|
async fetchConversations(e, n, r, o) {
|
|
@@ -822,23 +822,23 @@ const Yt = Oi("messaging", {
|
|
|
822
822
|
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), In();
|
|
823
823
|
const c = o?.includePresence ?? !0, u = {};
|
|
824
824
|
c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
|
|
825
|
-
const d = await
|
|
825
|
+
const d = await B().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = ot(
|
|
826
826
|
d.data,
|
|
827
827
|
"conversations"
|
|
828
|
-
),
|
|
828
|
+
), M = f.map((E) => {
|
|
829
829
|
const b = this.conversations.find(
|
|
830
|
-
(
|
|
830
|
+
(A) => A.id === E.id
|
|
831
831
|
);
|
|
832
|
-
return Be(
|
|
833
|
-
}),
|
|
834
|
-
e ? this.conversations.push(...
|
|
832
|
+
return Be(E, b);
|
|
833
|
+
}), w = await $n(M);
|
|
834
|
+
e ? this.conversations.push(...w) : this.conversations = w, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
835
835
|
const v = {
|
|
836
|
-
data:
|
|
836
|
+
data: w,
|
|
837
837
|
has_more: !!h
|
|
838
838
|
};
|
|
839
839
|
return h !== void 0 && (v.next_cursor = h), v;
|
|
840
840
|
} catch (c) {
|
|
841
|
-
throw o?.background && xn(c) || (this.error =
|
|
841
|
+
throw o?.background && xn(c) || (this.error = K(c)), c;
|
|
842
842
|
} finally {
|
|
843
843
|
this.loading = !1;
|
|
844
844
|
}
|
|
@@ -859,7 +859,7 @@ const Yt = Oi("messaging", {
|
|
|
859
859
|
async fetchConversation(e) {
|
|
860
860
|
this.loading = !0, this.error = null;
|
|
861
861
|
try {
|
|
862
|
-
const n = await
|
|
862
|
+
const n = await B().get(`/v1/messaging/conversations/${e}`, {
|
|
863
863
|
params: { include_presence: 1 }
|
|
864
864
|
}), r = this.conversations.find((f) => f.id === e);
|
|
865
865
|
let o = Be(n.data.data || n.data, r);
|
|
@@ -870,7 +870,7 @@ const Yt = Oi("messaging", {
|
|
|
870
870
|
const d = this.requests.findIndex((f) => f.id === e);
|
|
871
871
|
return d >= 0 && (this.requests[d] = o), this.normalizeFolderAssignmentsState(), o;
|
|
872
872
|
} catch (n) {
|
|
873
|
-
throw this.error =
|
|
873
|
+
throw this.error = K(n), n;
|
|
874
874
|
} finally {
|
|
875
875
|
this.loading = !1;
|
|
876
876
|
}
|
|
@@ -885,12 +885,12 @@ const Yt = Oi("messaging", {
|
|
|
885
885
|
filter: "requests"
|
|
886
886
|
};
|
|
887
887
|
e && (n.cursor = e);
|
|
888
|
-
const r = await
|
|
888
|
+
const r = await B().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = ot(
|
|
889
889
|
r.data,
|
|
890
890
|
"conversations"
|
|
891
891
|
), u = o.map((h) => {
|
|
892
|
-
const
|
|
893
|
-
return Be(h,
|
|
892
|
+
const M = this.requests.find((w) => w.id === h.id);
|
|
893
|
+
return Be(h, M);
|
|
894
894
|
}), d = await $n(u);
|
|
895
895
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
896
896
|
const f = {
|
|
@@ -899,7 +899,7 @@ const Yt = Oi("messaging", {
|
|
|
899
899
|
};
|
|
900
900
|
return c !== void 0 && (f.next_cursor = c), f;
|
|
901
901
|
} catch (n) {
|
|
902
|
-
throw this.error =
|
|
902
|
+
throw this.error = K(n), n;
|
|
903
903
|
} finally {
|
|
904
904
|
this.loading = !1;
|
|
905
905
|
}
|
|
@@ -911,7 +911,7 @@ const Yt = Oi("messaging", {
|
|
|
911
911
|
let o = 0, c;
|
|
912
912
|
for (; ; )
|
|
913
913
|
try {
|
|
914
|
-
c = await
|
|
914
|
+
c = await B().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
|
|
915
915
|
break;
|
|
916
916
|
} catch (v) {
|
|
917
917
|
if (!(o < yo && xn(v)))
|
|
@@ -923,87 +923,87 @@ const Yt = Oi("messaging", {
|
|
|
923
923
|
"messages"
|
|
924
924
|
), f = u.map(lt), h = [...f].reverse();
|
|
925
925
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
926
|
-
const v = this.conversations.find((
|
|
926
|
+
const v = this.conversations.find((E) => E.id === e) ?? this.requests.find((E) => E.id === e);
|
|
927
927
|
return v ? !v.last_message || !v.last_message_at : !1;
|
|
928
928
|
})()) {
|
|
929
929
|
const v = this.messages[e]?.at(-1);
|
|
930
930
|
v && this.updateConversationLastMessage(e, v);
|
|
931
931
|
}
|
|
932
932
|
d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
933
|
-
const
|
|
933
|
+
const w = {
|
|
934
934
|
data: f,
|
|
935
935
|
has_more: !!d
|
|
936
936
|
};
|
|
937
|
-
return d !== void 0 && (
|
|
937
|
+
return d !== void 0 && (w.next_cursor = d), w;
|
|
938
938
|
} catch (r) {
|
|
939
|
-
throw this.error =
|
|
939
|
+
throw this.error = K(r), r;
|
|
940
940
|
} finally {
|
|
941
941
|
this.loadingMessages[e] = !1, this.loading = !1;
|
|
942
942
|
}
|
|
943
943
|
},
|
|
944
944
|
async sendMessage(e, n, r, o, c, u, d) {
|
|
945
|
-
const f = Le()(), h = `temp-${Date.now()}-${Math.random()}`,
|
|
945
|
+
const f = Le()(), h = `temp-${Date.now()}-${Math.random()}`, M = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, w = Mo(d), v = f.currentUser, E = {
|
|
946
946
|
id: h,
|
|
947
947
|
conversation_id: e,
|
|
948
948
|
author_id: v?.id || "",
|
|
949
949
|
body: n || "",
|
|
950
950
|
attachments: [],
|
|
951
|
-
meta:
|
|
952
|
-
...
|
|
951
|
+
meta: M ? { shared_post_id: M } : {},
|
|
952
|
+
...w ? { shared_post: w } : {},
|
|
953
953
|
is_deleted: !1,
|
|
954
954
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
955
955
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
956
956
|
};
|
|
957
|
-
v && (
|
|
957
|
+
v && (E.author = {
|
|
958
958
|
id: v.id,
|
|
959
959
|
name: v.name,
|
|
960
960
|
...v.avatar ? { avatar: v.avatar } : {},
|
|
961
961
|
...v.handle ? { handle: v.handle } : {}
|
|
962
|
-
}), o != null && (
|
|
962
|
+
}), o != null && (E.reply_to_id = o), c != null && (E.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(E), this._pendingSendIds.add(h);
|
|
963
963
|
try {
|
|
964
964
|
let b;
|
|
965
|
-
const
|
|
965
|
+
const A = {
|
|
966
966
|
body: n || "",
|
|
967
967
|
...o ? { reply_to_id: o } : {},
|
|
968
|
-
...
|
|
969
|
-
...
|
|
968
|
+
...M ? { shared_post_id: M } : {},
|
|
969
|
+
...w ? { shared_post_preview: w } : {}
|
|
970
970
|
};
|
|
971
971
|
if (r && r.length > 0) {
|
|
972
|
-
const
|
|
973
|
-
r.map(async (
|
|
974
|
-
const
|
|
972
|
+
const V = await Promise.all(
|
|
973
|
+
r.map(async (ee) => {
|
|
974
|
+
const W = await ao().uploadImage(ee);
|
|
975
975
|
return {
|
|
976
|
-
media_id:
|
|
977
|
-
mime:
|
|
978
|
-
size:
|
|
976
|
+
media_id: W.id,
|
|
977
|
+
mime: W.mime_type,
|
|
978
|
+
size: W.size
|
|
979
979
|
};
|
|
980
980
|
})
|
|
981
981
|
);
|
|
982
|
-
b = await
|
|
983
|
-
...
|
|
984
|
-
attachments:
|
|
982
|
+
b = await B().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
983
|
+
...A,
|
|
984
|
+
attachments: V
|
|
985
985
|
});
|
|
986
986
|
} else
|
|
987
|
-
b = await
|
|
988
|
-
...
|
|
987
|
+
b = await B().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
988
|
+
...A,
|
|
989
989
|
type: "text"
|
|
990
990
|
});
|
|
991
|
-
const
|
|
992
|
-
|
|
991
|
+
const T = b.data.data || b.data, p = { ...E, ...T, attachments: T.attachments ?? E.attachments }, m = lt(p), y = this.messages[e], D = y.findIndex((V) => V.id === h);
|
|
992
|
+
D >= 0 && (y[D] = m), this._pendingSendIds.delete(h);
|
|
993
993
|
const q = m.id;
|
|
994
|
-
let
|
|
995
|
-
for (let
|
|
996
|
-
const
|
|
997
|
-
|
|
994
|
+
let X = 0;
|
|
995
|
+
for (let V = y.length - 1; V >= 0; V--) {
|
|
996
|
+
const ee = y[V];
|
|
997
|
+
ee && ee.id === q && (X++, X > 1 && y.splice(V, 1));
|
|
998
998
|
}
|
|
999
999
|
return this.updateConversationLastMessage(e, m), m;
|
|
1000
1000
|
} catch (b) {
|
|
1001
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((
|
|
1001
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = K(b), b;
|
|
1002
1002
|
}
|
|
1003
1003
|
},
|
|
1004
1004
|
async editMessage(e, n, r) {
|
|
1005
1005
|
try {
|
|
1006
|
-
const o = await
|
|
1006
|
+
const o = await B().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
|
|
1007
1007
|
body: r
|
|
1008
1008
|
}), c = o.data.data || o.data, u = this.messages[e] || [], d = u.findIndex((f) => f.id === n);
|
|
1009
1009
|
if (d >= 0) {
|
|
@@ -1012,12 +1012,12 @@ const Yt = Oi("messaging", {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
return c;
|
|
1014
1014
|
} catch (o) {
|
|
1015
|
-
throw this.error =
|
|
1015
|
+
throw this.error = K(o), o;
|
|
1016
1016
|
}
|
|
1017
1017
|
},
|
|
1018
1018
|
async deleteMessage(e, n) {
|
|
1019
1019
|
try {
|
|
1020
|
-
await
|
|
1020
|
+
await B().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
|
|
1021
1021
|
const r = this.messages[e];
|
|
1022
1022
|
if (r) {
|
|
1023
1023
|
const o = r.findIndex((c) => c.id === n);
|
|
@@ -1034,7 +1034,7 @@ const Yt = Oi("messaging", {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
1036
|
} catch (r) {
|
|
1037
|
-
throw this.error =
|
|
1037
|
+
throw this.error = K(r), r;
|
|
1038
1038
|
}
|
|
1039
1039
|
},
|
|
1040
1040
|
async markAsRead(e) {
|
|
@@ -1052,7 +1052,7 @@ const Yt = Oi("messaging", {
|
|
|
1052
1052
|
})(), o = n ? Fn(n, this.messages) : r;
|
|
1053
1053
|
if (!o)
|
|
1054
1054
|
return;
|
|
1055
|
-
await
|
|
1055
|
+
await B().post(`/v1/messaging/conversations/${e}/read`, {
|
|
1056
1056
|
message_id: o
|
|
1057
1057
|
}), this.conversations.forEach((c) => {
|
|
1058
1058
|
c.id === e && (c.unread_count = 0);
|
|
@@ -1060,7 +1060,7 @@ const Yt = Oi("messaging", {
|
|
|
1060
1060
|
c.id === e && (c.unread_count = 0);
|
|
1061
1061
|
});
|
|
1062
1062
|
} catch (n) {
|
|
1063
|
-
throw this.error =
|
|
1063
|
+
throw this.error = K(n), n;
|
|
1064
1064
|
}
|
|
1065
1065
|
},
|
|
1066
1066
|
async markAllAsRead() {
|
|
@@ -1078,7 +1078,7 @@ const Yt = Oi("messaging", {
|
|
|
1078
1078
|
return;
|
|
1079
1079
|
const r = await Promise.allSettled(
|
|
1080
1080
|
n.map(
|
|
1081
|
-
(c) =>
|
|
1081
|
+
(c) => B().post(`/v1/messaging/conversations/${c.conversationId}/read`, {
|
|
1082
1082
|
message_id: c.messageId
|
|
1083
1083
|
})
|
|
1084
1084
|
)
|
|
@@ -1095,39 +1095,39 @@ const Yt = Oi("messaging", {
|
|
|
1095
1095
|
o === null && (o = c.reason);
|
|
1096
1096
|
}
|
|
1097
1097
|
}), o !== null)
|
|
1098
|
-
throw this.error =
|
|
1098
|
+
throw this.error = K(o), o;
|
|
1099
1099
|
},
|
|
1100
1100
|
async sendTyping(e, n = "start") {
|
|
1101
1101
|
try {
|
|
1102
|
-
const r = await
|
|
1102
|
+
const r = await B().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1103
1103
|
if (n !== "start" || !wo(r.data))
|
|
1104
1104
|
return;
|
|
1105
|
-
await Ln(_o), await
|
|
1105
|
+
await Ln(_o), await B().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1106
1106
|
} catch (r) {
|
|
1107
1107
|
console.warn("Failed to send typing indicator:", r);
|
|
1108
1108
|
}
|
|
1109
1109
|
},
|
|
1110
1110
|
async muteConversation(e, n) {
|
|
1111
1111
|
try {
|
|
1112
|
-
const r = { minutes: n }, o = await
|
|
1112
|
+
const r = { minutes: n }, o = await B().patch(`/v1/messaging/conversations/${e}/mute`, r), u = (o.data.data || o.data).muted_until || null, d = this.conversations.find((f) => f.id === e);
|
|
1113
1113
|
d && (d.is_muted = u !== null, d.muted_until = u);
|
|
1114
1114
|
} catch (r) {
|
|
1115
|
-
throw this.error =
|
|
1115
|
+
throw this.error = K(r), r;
|
|
1116
1116
|
}
|
|
1117
1117
|
},
|
|
1118
1118
|
async unmuteConversation(e) {
|
|
1119
1119
|
try {
|
|
1120
|
-
const n = await
|
|
1120
|
+
const n = await B().patch(`/v1/messaging/conversations/${e}/mute`, {
|
|
1121
1121
|
minutes: 0
|
|
1122
1122
|
}), o = (n.data.data || n.data).muted_until || null, c = this.conversations.find((u) => u.id === e);
|
|
1123
1123
|
c && (c.is_muted = o !== null, c.muted_until = o);
|
|
1124
1124
|
} catch (n) {
|
|
1125
|
-
throw this.error =
|
|
1125
|
+
throw this.error = K(n), n;
|
|
1126
1126
|
}
|
|
1127
1127
|
},
|
|
1128
1128
|
async updateConversationTitle(e, n) {
|
|
1129
1129
|
try {
|
|
1130
|
-
const r = await
|
|
1130
|
+
const r = await B().patch(`/v1/messaging/conversations/${e}`, {
|
|
1131
1131
|
title: n
|
|
1132
1132
|
}), o = r.data.data || r.data, c = typeof o?.title == "string" ? o.title : n, u = (d) => d.map((f) => f.id !== e ? f : {
|
|
1133
1133
|
...f,
|
|
@@ -1135,32 +1135,32 @@ const Yt = Oi("messaging", {
|
|
|
1135
1135
|
});
|
|
1136
1136
|
this.conversations = u(this.conversations), this.requests = u(this.requests);
|
|
1137
1137
|
} catch (r) {
|
|
1138
|
-
throw this.error =
|
|
1138
|
+
throw this.error = K(r), r;
|
|
1139
1139
|
}
|
|
1140
1140
|
},
|
|
1141
1141
|
async pinConversation(e, n) {
|
|
1142
1142
|
const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
|
|
1143
1143
|
r && (r.is_pinned = n), this.conversations.sort(We);
|
|
1144
1144
|
try {
|
|
1145
|
-
await
|
|
1145
|
+
await B().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
1146
1146
|
} catch (c) {
|
|
1147
|
-
throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(We)), this.error =
|
|
1147
|
+
throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(We)), this.error = K(c), c;
|
|
1148
1148
|
}
|
|
1149
1149
|
},
|
|
1150
1150
|
async archiveConversation(e, n) {
|
|
1151
1151
|
try {
|
|
1152
|
-
await
|
|
1152
|
+
await B().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
|
|
1153
1153
|
const r = this.conversations.find((o) => o.id === e);
|
|
1154
1154
|
r && (r.is_archived = n);
|
|
1155
1155
|
} catch (r) {
|
|
1156
|
-
throw this.error =
|
|
1156
|
+
throw this.error = K(r), r;
|
|
1157
1157
|
}
|
|
1158
1158
|
},
|
|
1159
1159
|
async deleteConversation(e) {
|
|
1160
1160
|
try {
|
|
1161
|
-
await
|
|
1161
|
+
await B().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];
|
|
1162
1162
|
} catch (n) {
|
|
1163
|
-
throw this.error =
|
|
1163
|
+
throw this.error = K(n), n;
|
|
1164
1164
|
}
|
|
1165
1165
|
},
|
|
1166
1166
|
async createDMConversation(e, n) {
|
|
@@ -1169,18 +1169,18 @@ const Yt = Oi("messaging", {
|
|
|
1169
1169
|
user_id: e
|
|
1170
1170
|
};
|
|
1171
1171
|
n && (r.message = n);
|
|
1172
|
-
const o = await
|
|
1172
|
+
const o = await B().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
|
|
1173
1173
|
if (!Nn(c))
|
|
1174
1174
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1175
1175
|
let u = qn(c) && Qt(c, e) ? Be(c) : await this.fetchConversation(c.id);
|
|
1176
1176
|
return u = await jn(u, e), u.is_request === !0 ? (this.requests = at(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = at(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
|
|
1177
1177
|
} catch (r) {
|
|
1178
|
-
throw this.error =
|
|
1178
|
+
throw this.error = K(r), r;
|
|
1179
1179
|
}
|
|
1180
1180
|
},
|
|
1181
1181
|
async createGroupConversation(e, n) {
|
|
1182
1182
|
try {
|
|
1183
|
-
const r = await
|
|
1183
|
+
const r = await B().post("/v1/messaging/conversations/group", {
|
|
1184
1184
|
title: e,
|
|
1185
1185
|
participant_ids: n
|
|
1186
1186
|
}), o = r.data.data || r.data;
|
|
@@ -1189,22 +1189,22 @@ const Yt = Oi("messaging", {
|
|
|
1189
1189
|
const c = qn(o) ? o : await this.fetchConversation(o.id);
|
|
1190
1190
|
return this.conversations = at(this.conversations, c), c;
|
|
1191
1191
|
} catch (r) {
|
|
1192
|
-
throw this.error =
|
|
1192
|
+
throw this.error = K(r), r;
|
|
1193
1193
|
}
|
|
1194
1194
|
},
|
|
1195
1195
|
async addParticipants(e, n) {
|
|
1196
1196
|
try {
|
|
1197
|
-
await
|
|
1197
|
+
await B().post(`/v1/messaging/conversations/${e}/participants`, {
|
|
1198
1198
|
user_ids: n
|
|
1199
1199
|
// Changed from participant_ids to user_ids to match backend
|
|
1200
1200
|
}), await this.fetchConversation(e);
|
|
1201
1201
|
} catch (r) {
|
|
1202
|
-
throw this.error =
|
|
1202
|
+
throw this.error = K(r), r;
|
|
1203
1203
|
}
|
|
1204
1204
|
},
|
|
1205
1205
|
async removeParticipant(e, n) {
|
|
1206
1206
|
try {
|
|
1207
|
-
await
|
|
1207
|
+
await B().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
|
|
1208
1208
|
const r = Le()();
|
|
1209
1209
|
if (n === r.currentUser?.id) {
|
|
1210
1210
|
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];
|
|
@@ -1212,7 +1212,7 @@ const Yt = Oi("messaging", {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
await this.fetchConversation(e);
|
|
1214
1214
|
} catch (r) {
|
|
1215
|
-
throw this.error =
|
|
1215
|
+
throw this.error = K(r), r;
|
|
1216
1216
|
}
|
|
1217
1217
|
},
|
|
1218
1218
|
applyParticipantReadState(e) {
|
|
@@ -1236,28 +1236,28 @@ const Yt = Oi("messaging", {
|
|
|
1236
1236
|
return;
|
|
1237
1237
|
this.messages[n] || (this.messages[n] = []);
|
|
1238
1238
|
const r = lt({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1239
|
-
if (o.find((
|
|
1239
|
+
if (o.find((M) => M.id === r.id))
|
|
1240
1240
|
return;
|
|
1241
1241
|
const u = Le()();
|
|
1242
1242
|
if (r.author_id === u.currentUser?.id) {
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
const
|
|
1243
|
+
const M = o.findIndex((w) => w.id.startsWith("temp-"));
|
|
1244
|
+
if (M >= 0) {
|
|
1245
|
+
const w = o[M]?.id ?? "";
|
|
1246
1246
|
this.messages[n] = [
|
|
1247
|
-
...o.slice(0,
|
|
1247
|
+
...o.slice(0, M),
|
|
1248
1248
|
r,
|
|
1249
|
-
...o.slice(
|
|
1250
|
-
], this._pendingSendIds.delete(
|
|
1249
|
+
...o.slice(M + 1)
|
|
1250
|
+
], this._pendingSendIds.delete(w), this.updateConversationLastMessage(n, r);
|
|
1251
1251
|
return;
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
1254
|
const d = r.created_at;
|
|
1255
1255
|
let f = o.length;
|
|
1256
|
-
for (let
|
|
1257
|
-
const
|
|
1258
|
-
if (
|
|
1256
|
+
for (let M = o.length - 1; M >= 0; M--) {
|
|
1257
|
+
const w = o[M];
|
|
1258
|
+
if (w && w.created_at <= d)
|
|
1259
1259
|
break;
|
|
1260
|
-
f =
|
|
1260
|
+
f = M;
|
|
1261
1261
|
}
|
|
1262
1262
|
const h = f === o.length;
|
|
1263
1263
|
this.messages[n] = [
|
|
@@ -1272,8 +1272,8 @@ const Yt = Oi("messaging", {
|
|
|
1272
1272
|
},
|
|
1273
1273
|
removeMessage(e, n) {
|
|
1274
1274
|
const r = (h) => {
|
|
1275
|
-
const
|
|
1276
|
-
return delete
|
|
1275
|
+
const M = { ...h, is_deleted: !0 };
|
|
1276
|
+
return delete M.body, M;
|
|
1277
1277
|
};
|
|
1278
1278
|
let o = null;
|
|
1279
1279
|
const c = this.conversations.find((h) => h.id === e);
|
|
@@ -1305,25 +1305,25 @@ const Yt = Oi("messaging", {
|
|
|
1305
1305
|
try {
|
|
1306
1306
|
let f;
|
|
1307
1307
|
try {
|
|
1308
|
-
f = await
|
|
1308
|
+
f = await B().post(o, c);
|
|
1309
1309
|
} catch (v) {
|
|
1310
1310
|
if (!Uo(v))
|
|
1311
1311
|
throw v;
|
|
1312
|
-
f = await
|
|
1312
|
+
f = await B().post(o, c);
|
|
1313
1313
|
}
|
|
1314
|
-
const h =
|
|
1315
|
-
|
|
1314
|
+
const h = fe(f.data) && "data" in f.data ? f.data.data : f.data, M = Dn(
|
|
1315
|
+
fe(h) ? h.reactions : void 0
|
|
1316
1316
|
);
|
|
1317
|
-
(
|
|
1317
|
+
(M.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, M);
|
|
1318
1318
|
try {
|
|
1319
|
-
const v = await
|
|
1320
|
-
|
|
1319
|
+
const v = await B().get(o), E = fe(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
|
|
1320
|
+
fe(E) ? E.reactions : void 0
|
|
1321
1321
|
);
|
|
1322
1322
|
this.updateMessageReactions(e, n, b);
|
|
1323
1323
|
} catch {
|
|
1324
1324
|
}
|
|
1325
1325
|
} catch (f) {
|
|
1326
|
-
throw this.error =
|
|
1326
|
+
throw this.error = K(f), f;
|
|
1327
1327
|
}
|
|
1328
1328
|
},
|
|
1329
1329
|
updateMessageReactions(e, n, r) {
|
|
@@ -1350,10 +1350,10 @@ const Yt = Oi("messaging", {
|
|
|
1350
1350
|
h,
|
|
1351
1351
|
...u.slice(d + 1)
|
|
1352
1352
|
];
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1353
|
+
const M = this.conversations.find((v) => v.id === e);
|
|
1354
|
+
M?.last_message?.id === n && (M.last_message = h);
|
|
1355
|
+
const w = this.requests.find((v) => v.id === e);
|
|
1356
|
+
w?.last_message?.id === n && (w.last_message = h);
|
|
1357
1357
|
},
|
|
1358
1358
|
addTypingUser(e, n) {
|
|
1359
1359
|
const r = this.typingUsers[e] ?? [];
|
|
@@ -1382,7 +1382,7 @@ const Yt = Oi("messaging", {
|
|
|
1382
1382
|
)];
|
|
1383
1383
|
if (n.length === 0)
|
|
1384
1384
|
return;
|
|
1385
|
-
const r = await
|
|
1385
|
+
const r = await B().get("/v1/presence/users", {
|
|
1386
1386
|
params: { ids: n }
|
|
1387
1387
|
}), o = r.data?.data?.items ?? r.data?.items ?? [];
|
|
1388
1388
|
for (const c of o) {
|
|
@@ -1402,14 +1402,14 @@ const Yt = Oi("messaging", {
|
|
|
1402
1402
|
});
|
|
1403
1403
|
this.conversations = at(this.conversations, r);
|
|
1404
1404
|
} catch (n) {
|
|
1405
|
-
throw this.error =
|
|
1405
|
+
throw this.error = K(n), n;
|
|
1406
1406
|
}
|
|
1407
1407
|
},
|
|
1408
1408
|
async declineRequest(e) {
|
|
1409
1409
|
try {
|
|
1410
1410
|
await ke.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1411
1411
|
} catch (n) {
|
|
1412
|
-
throw this.error =
|
|
1412
|
+
throw this.error = K(n), n;
|
|
1413
1413
|
}
|
|
1414
1414
|
},
|
|
1415
1415
|
async searchConversations(e, n, r) {
|
|
@@ -1417,7 +1417,7 @@ const Yt = Oi("messaging", {
|
|
|
1417
1417
|
try {
|
|
1418
1418
|
const o = { search: e, limit: 20 };
|
|
1419
1419
|
n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
|
|
1420
|
-
const c = await
|
|
1420
|
+
const c = await B().get("/v1/messaging/conversations", {
|
|
1421
1421
|
params: o
|
|
1422
1422
|
}), { items: u } = ot(
|
|
1423
1423
|
c.data,
|
|
@@ -1425,7 +1425,7 @@ const Yt = Oi("messaging", {
|
|
|
1425
1425
|
);
|
|
1426
1426
|
return u;
|
|
1427
1427
|
} catch (o) {
|
|
1428
|
-
return this.error =
|
|
1428
|
+
return this.error = K(o), [];
|
|
1429
1429
|
} finally {
|
|
1430
1430
|
this.searchLoading = !1;
|
|
1431
1431
|
}
|
|
@@ -1433,12 +1433,12 @@ const Yt = Oi("messaging", {
|
|
|
1433
1433
|
async searchMessages(e, n) {
|
|
1434
1434
|
this.searchLoading = !0;
|
|
1435
1435
|
try {
|
|
1436
|
-
const r = await
|
|
1436
|
+
const r = await B().get(`/v1/messaging/conversations/${e}/search`, {
|
|
1437
1437
|
params: { q: n }
|
|
1438
1438
|
}), o = r.data.data || r.data || [];
|
|
1439
1439
|
return this.searchResults = o, o;
|
|
1440
1440
|
} catch (r) {
|
|
1441
|
-
return this.error =
|
|
1441
|
+
return this.error = K(r), [];
|
|
1442
1442
|
} finally {
|
|
1443
1443
|
this.searchLoading = !1;
|
|
1444
1444
|
}
|
|
@@ -1478,17 +1478,17 @@ const Yt = Oi("messaging", {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
1480
|
});
|
|
1481
|
-
function
|
|
1482
|
-
const n = Yt(), r = Le()(), o = ye(!1), c = ye(null), u = ye(null), d = jt(), f = d !== null, h = 20,
|
|
1483
|
-
let
|
|
1484
|
-
const b =
|
|
1485
|
-
function
|
|
1486
|
-
v && (clearTimeout(v), v = null),
|
|
1481
|
+
function ac(e) {
|
|
1482
|
+
const n = Yt(), r = Le()(), o = ye(!1), c = ye(null), u = ye(null), d = jt(), f = d !== null, h = 20, M = 250;
|
|
1483
|
+
let w = 0, v = null, E = null;
|
|
1484
|
+
const b = se(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
|
|
1485
|
+
function T() {
|
|
1486
|
+
v && (clearTimeout(v), v = null), w = 0;
|
|
1487
1487
|
}
|
|
1488
1488
|
function p() {
|
|
1489
|
-
!f || o.value || v ||
|
|
1490
|
-
v = null,
|
|
1491
|
-
},
|
|
1489
|
+
!f || o.value || v || w >= h || (v = setTimeout(() => {
|
|
1490
|
+
v = null, w += 1, k();
|
|
1491
|
+
}, M));
|
|
1492
1492
|
}
|
|
1493
1493
|
function m(_) {
|
|
1494
1494
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
@@ -1500,7 +1500,7 @@ function oc(e) {
|
|
|
1500
1500
|
function y(_) {
|
|
1501
1501
|
n.applyParticipantReadState(_);
|
|
1502
1502
|
}
|
|
1503
|
-
function
|
|
1503
|
+
function D(_) {
|
|
1504
1504
|
n.applyMessageEdit(
|
|
1505
1505
|
_.conversation_id,
|
|
1506
1506
|
_.message.id,
|
|
@@ -1512,29 +1512,29 @@ function oc(e) {
|
|
|
1512
1512
|
function q(_) {
|
|
1513
1513
|
n.removeMessage(_.conversation_id, _.message_id);
|
|
1514
1514
|
}
|
|
1515
|
-
function
|
|
1515
|
+
function X(_) {
|
|
1516
1516
|
n.updateMessageReactions(
|
|
1517
1517
|
_.conversation_id,
|
|
1518
1518
|
_.message_id,
|
|
1519
1519
|
_.reactions
|
|
1520
1520
|
);
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function V(_) {
|
|
1523
1523
|
const x = n.getConversationById(_.conversation_id);
|
|
1524
1524
|
x && (x.is_request = !1), n.requests = n.requests.filter(
|
|
1525
|
-
(
|
|
1525
|
+
(oe) => oe.id !== _.conversation_id
|
|
1526
1526
|
);
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1529
|
-
_.removed_user_id === b.value && (
|
|
1528
|
+
function ee(_) {
|
|
1529
|
+
_.removed_user_id === b.value && (O(), n.deleteConversation(_.conversation_id).catch(() => {
|
|
1530
1530
|
}));
|
|
1531
1531
|
}
|
|
1532
|
-
function
|
|
1532
|
+
function W(_) {
|
|
1533
1533
|
const x = u.value;
|
|
1534
|
-
|
|
1534
|
+
E && (E(), E = null), x && (_ && !n.hasGlobalConversationSubscription(x) && Bi(x), n.unregisterDetailSubscription(x), u.value = null), o.value = !1;
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1537
|
-
const _ =
|
|
1536
|
+
function k() {
|
|
1537
|
+
const _ = A();
|
|
1538
1538
|
if (!(o.value || !_)) {
|
|
1539
1539
|
if (!Pe()) {
|
|
1540
1540
|
p();
|
|
@@ -1542,57 +1542,57 @@ function oc(e) {
|
|
|
1542
1542
|
}
|
|
1543
1543
|
c.value = null;
|
|
1544
1544
|
try {
|
|
1545
|
-
|
|
1545
|
+
E = Hi(_, {
|
|
1546
1546
|
onMessageSent: m,
|
|
1547
1547
|
onMessageRead: y,
|
|
1548
|
-
onMessageEdited:
|
|
1548
|
+
onMessageEdited: D,
|
|
1549
1549
|
onMessageDeleted: q,
|
|
1550
|
-
onReactionToggled:
|
|
1551
|
-
onRequestAccepted:
|
|
1552
|
-
onParticipantRemoved:
|
|
1553
|
-
}), o.value = !0, u.value = _, n.registerDetailSubscription(_),
|
|
1550
|
+
onReactionToggled: X,
|
|
1551
|
+
onRequestAccepted: V,
|
|
1552
|
+
onParticipantRemoved: ee
|
|
1553
|
+
}), o.value = !0, u.value = _, n.registerDetailSubscription(_), T();
|
|
1554
1554
|
} catch (x) {
|
|
1555
1555
|
c.value = x instanceof Error ? x.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", x);
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1560
|
-
o.value ||
|
|
1559
|
+
function I() {
|
|
1560
|
+
o.value || k();
|
|
1561
1561
|
}
|
|
1562
|
-
typeof window < "u" && window.addEventListener(Ke(),
|
|
1563
|
-
const
|
|
1562
|
+
typeof window < "u" && window.addEventListener(Ke(), I);
|
|
1563
|
+
const re = ft((_) => {
|
|
1564
1564
|
if (_ === "connected") {
|
|
1565
|
-
o.value ||
|
|
1565
|
+
o.value || k();
|
|
1566
1566
|
return;
|
|
1567
1567
|
}
|
|
1568
|
-
(_ === "disconnected" || _ === "error") && (
|
|
1568
|
+
(_ === "disconnected" || _ === "error") && (T(), W(!1));
|
|
1569
1569
|
});
|
|
1570
|
-
function
|
|
1571
|
-
if (
|
|
1570
|
+
function O() {
|
|
1571
|
+
if (T(), !(!o.value || !u.value))
|
|
1572
1572
|
try {
|
|
1573
|
-
|
|
1573
|
+
W(!0), c.value = null;
|
|
1574
1574
|
} catch (_) {
|
|
1575
1575
|
c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
return ut(
|
|
1579
|
-
() =>
|
|
1579
|
+
() => A(),
|
|
1580
1580
|
(_, x) => {
|
|
1581
1581
|
if (_ !== x) {
|
|
1582
|
-
if (
|
|
1582
|
+
if (T(), o.value && W(!0), !_) {
|
|
1583
1583
|
c.value = null;
|
|
1584
1584
|
return;
|
|
1585
1585
|
}
|
|
1586
|
-
|
|
1586
|
+
k();
|
|
1587
1587
|
}
|
|
1588
1588
|
}
|
|
1589
1589
|
), d !== null && ze(() => {
|
|
1590
|
-
|
|
1590
|
+
T(), re(), O(), typeof window < "u" && window.removeEventListener(Ke(), I);
|
|
1591
1591
|
}), {
|
|
1592
|
-
isSubscribed:
|
|
1593
|
-
error:
|
|
1594
|
-
subscribe:
|
|
1595
|
-
unsubscribe:
|
|
1592
|
+
isSubscribed: se(() => o.value),
|
|
1593
|
+
error: se(() => c.value),
|
|
1594
|
+
subscribe: k,
|
|
1595
|
+
unsubscribe: O
|
|
1596
1596
|
};
|
|
1597
1597
|
}
|
|
1598
1598
|
const Ps = () => () => {
|
|
@@ -1673,13 +1673,13 @@ function Qo(e) {
|
|
|
1673
1673
|
function Wn(e) {
|
|
1674
1674
|
return e.getEchoConnection()?.state ?? null;
|
|
1675
1675
|
}
|
|
1676
|
-
function
|
|
1676
|
+
function cc(e = {}) {
|
|
1677
1677
|
const o = Qo(e.source ?? "app"), c = {
|
|
1678
1678
|
...Ko,
|
|
1679
1679
|
...e.icons
|
|
1680
|
-
}, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1),
|
|
1681
|
-
let
|
|
1682
|
-
const
|
|
1680
|
+
}, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), M = ye(!1), w = ye(!1), v = ye(!1);
|
|
1681
|
+
let E = null, b = null, A = null, T = null, p = null, m = null, y = null;
|
|
1682
|
+
const D = se(() => u.value === "connected"), q = se(() => u.value === "connecting"), X = se(() => u.value === "disconnected"), V = se(() => u.value === "error"), ee = se(() => X.value || V.value), W = se(() => {
|
|
1683
1683
|
switch (u.value) {
|
|
1684
1684
|
case "connecting":
|
|
1685
1685
|
return f.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1692,7 +1692,7 @@ function ac(e = {}) {
|
|
|
1692
1692
|
default:
|
|
1693
1693
|
return "Unknown connection state";
|
|
1694
1694
|
}
|
|
1695
|
-
}),
|
|
1695
|
+
}), k = se(() => {
|
|
1696
1696
|
switch (u.value) {
|
|
1697
1697
|
case "connected":
|
|
1698
1698
|
return "success";
|
|
@@ -1704,7 +1704,7 @@ function ac(e = {}) {
|
|
|
1704
1704
|
default:
|
|
1705
1705
|
return "medium";
|
|
1706
1706
|
}
|
|
1707
|
-
}),
|
|
1707
|
+
}), I = se(() => {
|
|
1708
1708
|
switch (u.value) {
|
|
1709
1709
|
case "connected":
|
|
1710
1710
|
return c.connected;
|
|
@@ -1717,30 +1717,30 @@ function ac(e = {}) {
|
|
|
1717
1717
|
default:
|
|
1718
1718
|
return c.unknown;
|
|
1719
1719
|
}
|
|
1720
|
-
}),
|
|
1720
|
+
}), re = async () => {
|
|
1721
1721
|
Vn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1722
|
-
},
|
|
1723
|
-
if (
|
|
1724
|
-
const
|
|
1725
|
-
if (
|
|
1726
|
-
h.value = !1,
|
|
1727
|
-
|
|
1722
|
+
}, O = (H, Q = u.value) => {
|
|
1723
|
+
if (H !== "connecting" && b && (clearTimeout(b), b = null), H === "disconnected" || H === "error") {
|
|
1724
|
+
const te = !v.value && Q === H, J = !M.value && (te || Q === "connected" || Q === "connecting");
|
|
1725
|
+
if (w.value = !0, J) {
|
|
1726
|
+
h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
|
|
1727
|
+
A = null, u.value !== "connected" && (h.value = !0);
|
|
1728
1728
|
}, 5e3);
|
|
1729
1729
|
return;
|
|
1730
1730
|
}
|
|
1731
|
-
|
|
1731
|
+
A && (clearTimeout(A), A = null), h.value = !0;
|
|
1732
1732
|
return;
|
|
1733
1733
|
}
|
|
1734
|
-
if (
|
|
1735
|
-
|
|
1734
|
+
if (H === "connected") {
|
|
1735
|
+
A && (clearTimeout(A), A = null), h.value = !1, M.value = !1, w.value = !1;
|
|
1736
1736
|
return;
|
|
1737
1737
|
}
|
|
1738
|
-
if (
|
|
1739
|
-
if (
|
|
1738
|
+
if (H === "connecting") {
|
|
1739
|
+
if (A && (clearTimeout(A), A = null), M.value) {
|
|
1740
1740
|
h.value = !0;
|
|
1741
1741
|
return;
|
|
1742
1742
|
}
|
|
1743
|
-
if (
|
|
1743
|
+
if (w.value || (h.value = !1), b)
|
|
1744
1744
|
return;
|
|
1745
1745
|
b = setTimeout(() => {
|
|
1746
1746
|
if (b = null, u.value === "connecting") {
|
|
@@ -1748,34 +1748,34 @@ function ac(e = {}) {
|
|
|
1748
1748
|
_("connected");
|
|
1749
1749
|
return;
|
|
1750
1750
|
}
|
|
1751
|
-
|
|
1751
|
+
M.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1752
1752
|
}
|
|
1753
1753
|
}, 1e4);
|
|
1754
1754
|
}
|
|
1755
|
-
}, _ = (
|
|
1756
|
-
const
|
|
1757
|
-
if (
|
|
1758
|
-
u.value = "disconnected",
|
|
1755
|
+
}, _ = (H) => {
|
|
1756
|
+
const Q = u.value;
|
|
1757
|
+
if (H === "connecting" && M.value) {
|
|
1758
|
+
u.value = "disconnected", O("disconnected", Q);
|
|
1759
1759
|
return;
|
|
1760
1760
|
}
|
|
1761
|
-
u.value =
|
|
1761
|
+
u.value = H, H === "connecting" && (Q === "disconnected" || Q === "error") && f.value === 0 && (f.value = 1), H === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), O(H, Q);
|
|
1762
1762
|
}, x = () => {
|
|
1763
|
-
const
|
|
1764
|
-
if (
|
|
1763
|
+
const H = Wn(o), Q = u.value;
|
|
1764
|
+
if (H === "connected" && Q !== "connected") {
|
|
1765
1765
|
_("connected");
|
|
1766
1766
|
return;
|
|
1767
1767
|
}
|
|
1768
|
-
if (
|
|
1768
|
+
if (H === "connecting" && Q !== "connecting") {
|
|
1769
1769
|
_("connecting");
|
|
1770
1770
|
return;
|
|
1771
1771
|
}
|
|
1772
|
-
if ((
|
|
1772
|
+
if ((H === "unavailable" || H === "failed" || H === "disconnected") && Q !== "disconnected") {
|
|
1773
1773
|
_("disconnected");
|
|
1774
1774
|
return;
|
|
1775
1775
|
}
|
|
1776
|
-
const
|
|
1777
|
-
!
|
|
1778
|
-
},
|
|
1776
|
+
const te = o.getConnectionStatus();
|
|
1777
|
+
!H && te === "connected" && Q !== "connected" && _("connected");
|
|
1778
|
+
}, oe = () => {
|
|
1779
1779
|
if (p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = o.getEchoConnection(), y = null, !p?.bind)
|
|
1780
1780
|
return;
|
|
1781
1781
|
y = {
|
|
@@ -1784,58 +1784,58 @@ function ac(e = {}) {
|
|
|
1784
1784
|
disconnected: () => _("disconnected"),
|
|
1785
1785
|
unavailable: () => _("disconnected"),
|
|
1786
1786
|
error: () => _("error"),
|
|
1787
|
-
stateChange: (
|
|
1788
|
-
const
|
|
1789
|
-
if (
|
|
1787
|
+
stateChange: (Q) => {
|
|
1788
|
+
const te = Q?.current;
|
|
1789
|
+
if (te === "connected") {
|
|
1790
1790
|
_("connected");
|
|
1791
1791
|
return;
|
|
1792
1792
|
}
|
|
1793
|
-
if (
|
|
1793
|
+
if (te === "connecting") {
|
|
1794
1794
|
_("connecting");
|
|
1795
1795
|
return;
|
|
1796
1796
|
}
|
|
1797
|
-
(
|
|
1797
|
+
(te === "unavailable" || te === "failed" || te === "disconnected") && _("disconnected");
|
|
1798
1798
|
}
|
|
1799
1799
|
}, p.bind("connected", y.connected), p.bind("connecting", y.connecting), p.bind("disconnected", y.disconnected), p.bind("unavailable", y.unavailable), p.bind("error", y.error), p.bind("state_change", y.stateChange);
|
|
1800
|
-
const
|
|
1801
|
-
if (
|
|
1800
|
+
const H = p.state ?? null;
|
|
1801
|
+
if (H === "connected") {
|
|
1802
1802
|
_("connected");
|
|
1803
1803
|
return;
|
|
1804
1804
|
}
|
|
1805
|
-
if (
|
|
1805
|
+
if (H === "connecting") {
|
|
1806
1806
|
_("connecting");
|
|
1807
1807
|
return;
|
|
1808
1808
|
}
|
|
1809
|
-
(
|
|
1810
|
-
}, Se =
|
|
1811
|
-
if (!d.value || !
|
|
1809
|
+
(H === "unavailable" || H === "failed" || H === "disconnected") && _("disconnected");
|
|
1810
|
+
}, Se = se(() => {
|
|
1811
|
+
if (!d.value || !D.value)
|
|
1812
1812
|
return null;
|
|
1813
|
-
const
|
|
1814
|
-
return
|
|
1813
|
+
const H = Date.now() - d.value.getTime(), Q = Math.floor(H / 6e4), te = Math.floor(H % 6e4 / 1e3);
|
|
1814
|
+
return Q > 0 ? `${Q}m ${te}s` : `${te}s`;
|
|
1815
1815
|
});
|
|
1816
1816
|
return $t(() => {
|
|
1817
|
-
u.value = o.getConnectionStatus(),
|
|
1818
|
-
|
|
1819
|
-
}, window.addEventListener(o.initializedEvent, m), x(),
|
|
1817
|
+
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), D.value && (d.value = /* @__PURE__ */ new Date()), O(u.value, u.value), v.value = !0, oe(), m = () => {
|
|
1818
|
+
oe(), x();
|
|
1819
|
+
}, window.addEventListener(o.initializedEvent, m), x(), T = setInterval(() => {
|
|
1820
1820
|
x();
|
|
1821
1821
|
}, 3e3);
|
|
1822
1822
|
}), ze(() => {
|
|
1823
|
-
|
|
1823
|
+
E?.(), b && (clearTimeout(b), b = null), A && (clearTimeout(A), A = null), T && (clearInterval(T), T = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
|
|
1824
1824
|
}), {
|
|
1825
|
-
connectionStatus:
|
|
1826
|
-
isConnected:
|
|
1825
|
+
connectionStatus: se(() => u.value),
|
|
1826
|
+
isConnected: D,
|
|
1827
1827
|
isConnecting: q,
|
|
1828
|
-
isDisconnected:
|
|
1829
|
-
isError:
|
|
1830
|
-
hasConnectionIssues:
|
|
1831
|
-
statusMessage:
|
|
1832
|
-
statusColor:
|
|
1833
|
-
statusIcon:
|
|
1834
|
-
showConnectionBanner:
|
|
1835
|
-
lastConnectionTime:
|
|
1828
|
+
isDisconnected: X,
|
|
1829
|
+
isError: V,
|
|
1830
|
+
hasConnectionIssues: ee,
|
|
1831
|
+
statusMessage: W,
|
|
1832
|
+
statusColor: k,
|
|
1833
|
+
statusIcon: I,
|
|
1834
|
+
showConnectionBanner: se(() => h.value),
|
|
1835
|
+
lastConnectionTime: se(() => d.value),
|
|
1836
1836
|
connectionUptime: Se,
|
|
1837
|
-
reconnectAttempts:
|
|
1838
|
-
reconnect:
|
|
1837
|
+
reconnectAttempts: se(() => f.value),
|
|
1838
|
+
reconnect: re
|
|
1839
1839
|
};
|
|
1840
1840
|
}
|
|
1841
1841
|
const xs = () => {
|
|
@@ -1850,32 +1850,32 @@ function Zo(e) {
|
|
|
1850
1850
|
function ea() {
|
|
1851
1851
|
tn = xs;
|
|
1852
1852
|
}
|
|
1853
|
-
const xe = en()("GlobalMessaging"), ta =
|
|
1854
|
-
function
|
|
1855
|
-
const e = Yt(), n = Le()(), r = Yo(), o = Xt(), c = Ni(), u = jt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(),
|
|
1856
|
-
let
|
|
1853
|
+
const xe = en()("GlobalMessaging"), ta = 25, na = 3e4, sa = (e) => e.replace(/\/+$/, ""), ra = (e) => sa(window.location.pathname) === `/messages/${e}`, ia = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1854
|
+
function uc() {
|
|
1855
|
+
const e = Yt(), n = Le()(), r = Yo(), o = Xt(), c = Ni(), u = jt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map();
|
|
1856
|
+
let w = !1;
|
|
1857
1857
|
function v(k) {
|
|
1858
|
-
const I =
|
|
1858
|
+
const I = M.get(k);
|
|
1859
1859
|
if (I) {
|
|
1860
|
-
if (
|
|
1861
|
-
const
|
|
1862
|
-
if (
|
|
1863
|
-
for (const
|
|
1860
|
+
if (M.delete(k), I.directBound) {
|
|
1861
|
+
const re = I.channel.subscription;
|
|
1862
|
+
if (re)
|
|
1863
|
+
for (const O of I.bindings)
|
|
1864
1864
|
try {
|
|
1865
|
-
|
|
1865
|
+
re.unbind(O.event, O.handler);
|
|
1866
1866
|
} catch {
|
|
1867
1867
|
}
|
|
1868
1868
|
return;
|
|
1869
1869
|
}
|
|
1870
1870
|
if (typeof I.channel.stopListening == "function")
|
|
1871
|
-
for (const
|
|
1871
|
+
for (const re of I.bindings)
|
|
1872
1872
|
try {
|
|
1873
|
-
I.channel.stopListening(
|
|
1873
|
+
I.channel.stopListening(re.event, re.handler);
|
|
1874
1874
|
} catch {
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function E() {
|
|
1879
1879
|
for (const k of h)
|
|
1880
1880
|
v(k), e.unregisterGlobalConversationSubscription(k);
|
|
1881
1881
|
h.clear();
|
|
@@ -1883,99 +1883,99 @@ function cc() {
|
|
|
1883
1883
|
function b(k) {
|
|
1884
1884
|
const I = Pe();
|
|
1885
1885
|
if (!I || h.has(k)) return;
|
|
1886
|
-
const
|
|
1886
|
+
const re = `conversation.${k}`;
|
|
1887
1887
|
v(k);
|
|
1888
|
-
const
|
|
1889
|
-
if (!Ji(
|
|
1890
|
-
xe.warn("Dropping malformed ConversationMessageSent event",
|
|
1888
|
+
const O = I.private(re), _ = (J) => {
|
|
1889
|
+
if (!Ji(J)) {
|
|
1890
|
+
xe.warn("Dropping malformed ConversationMessageSent event", J);
|
|
1891
1891
|
return;
|
|
1892
1892
|
}
|
|
1893
|
-
const
|
|
1894
|
-
if (!
|
|
1895
|
-
e.addMessage(
|
|
1896
|
-
const
|
|
1897
|
-
if (
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1893
|
+
const S = J, F = n.currentUser?.id;
|
|
1894
|
+
if (!F || S.message.author_id === F) return;
|
|
1895
|
+
e.addMessage(S.message);
|
|
1896
|
+
const Y = e.hasDetailSubscription(S.conversation_id), pe = ra(S.conversation_id);
|
|
1897
|
+
if (Y || pe) {
|
|
1898
|
+
const le = e.getConversationById(S.conversation_id);
|
|
1899
|
+
le && (le.unread_count = 0), e.markAsRead(S.conversation_id).catch(() => {
|
|
1900
1900
|
});
|
|
1901
1901
|
return;
|
|
1902
1902
|
}
|
|
1903
|
-
const
|
|
1904
|
-
if (
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1903
|
+
const ae = e.getConversationById(S.conversation_id);
|
|
1904
|
+
if (ae) {
|
|
1905
|
+
const le = ia(ae);
|
|
1906
|
+
le || ae.unread_count++, r(le);
|
|
1907
1907
|
}
|
|
1908
|
-
},
|
|
1909
|
-
if (!Ki(
|
|
1910
|
-
xe.warn("Dropping malformed ConversationMessageRead event",
|
|
1908
|
+
}, x = (J) => {
|
|
1909
|
+
if (!Ki(J)) {
|
|
1910
|
+
xe.warn("Dropping malformed ConversationMessageRead event", J);
|
|
1911
1911
|
return;
|
|
1912
1912
|
}
|
|
1913
|
-
e.applyParticipantReadState(
|
|
1914
|
-
},
|
|
1915
|
-
if (!Zi(
|
|
1916
|
-
xe.warn("Dropping malformed MessageReactionToggled event",
|
|
1913
|
+
e.applyParticipantReadState(J);
|
|
1914
|
+
}, oe = (J) => {
|
|
1915
|
+
if (!Zi(J)) {
|
|
1916
|
+
xe.warn("Dropping malformed MessageReactionToggled event", J);
|
|
1917
1917
|
return;
|
|
1918
1918
|
}
|
|
1919
|
-
const
|
|
1920
|
-
e.updateMessageReactions(
|
|
1921
|
-
},
|
|
1922
|
-
if (!Qi(
|
|
1923
|
-
xe.warn("Dropping malformed ConversationMessageEdited event",
|
|
1919
|
+
const S = J;
|
|
1920
|
+
e.updateMessageReactions(S.conversation_id, S.message_id, S.reactions);
|
|
1921
|
+
}, Se = (J) => {
|
|
1922
|
+
if (!Qi(J)) {
|
|
1923
|
+
xe.warn("Dropping malformed ConversationMessageEdited event", J);
|
|
1924
1924
|
return;
|
|
1925
1925
|
}
|
|
1926
|
-
const
|
|
1926
|
+
const S = J;
|
|
1927
1927
|
e.applyMessageEdit(
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1928
|
+
S.conversation_id,
|
|
1929
|
+
S.message.id,
|
|
1930
|
+
S.message.body,
|
|
1931
|
+
S.message.edited_at,
|
|
1932
|
+
S.message.meta
|
|
1933
1933
|
);
|
|
1934
|
-
},
|
|
1935
|
-
if (!Yi(
|
|
1936
|
-
xe.warn("Dropping malformed ConversationMessageDeleted event",
|
|
1934
|
+
}, H = (J) => {
|
|
1935
|
+
if (!Yi(J)) {
|
|
1936
|
+
xe.warn("Dropping malformed ConversationMessageDeleted event", J);
|
|
1937
1937
|
return;
|
|
1938
1938
|
}
|
|
1939
|
-
const
|
|
1940
|
-
e.removeMessage(
|
|
1941
|
-
},
|
|
1942
|
-
if (!eo(
|
|
1943
|
-
xe.warn("Dropping malformed ConversationRequestAccepted event",
|
|
1939
|
+
const S = J;
|
|
1940
|
+
e.removeMessage(S.conversation_id, S.message_id);
|
|
1941
|
+
}, Q = (J) => {
|
|
1942
|
+
if (!eo(J)) {
|
|
1943
|
+
xe.warn("Dropping malformed ConversationRequestAccepted event", J);
|
|
1944
1944
|
return;
|
|
1945
1945
|
}
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1948
|
-
(
|
|
1946
|
+
const S = J, F = e.getConversationById(S.conversation_id);
|
|
1947
|
+
F && (F.is_request = !1), e.requests = e.requests.filter(
|
|
1948
|
+
(Y) => Y.id !== S.conversation_id
|
|
1949
1949
|
);
|
|
1950
|
-
},
|
|
1951
|
-
|
|
1952
|
-
channel:
|
|
1950
|
+
}, te = O.subscription;
|
|
1951
|
+
te ? (te.bind("ConversationMessageSent", _), te.bind("ConversationMessageRead", x), te.bind("ConversationMessageEdited", Se), te.bind("ConversationMessageDeleted", H), te.bind("MessageReactionToggled", oe), te.bind("ConversationRequestAccepted", Q), M.set(k, {
|
|
1952
|
+
channel: O,
|
|
1953
1953
|
directBound: !0,
|
|
1954
1954
|
bindings: [
|
|
1955
|
-
{ event: "ConversationMessageSent", handler:
|
|
1956
|
-
{ event: "ConversationMessageRead", handler:
|
|
1957
|
-
{ event: "ConversationMessageEdited", handler:
|
|
1958
|
-
{ event: "ConversationMessageDeleted", handler:
|
|
1959
|
-
{ event: "MessageReactionToggled", handler:
|
|
1960
|
-
{ event: "ConversationRequestAccepted", handler:
|
|
1955
|
+
{ event: "ConversationMessageSent", handler: _ },
|
|
1956
|
+
{ event: "ConversationMessageRead", handler: x },
|
|
1957
|
+
{ event: "ConversationMessageEdited", handler: Se },
|
|
1958
|
+
{ event: "ConversationMessageDeleted", handler: H },
|
|
1959
|
+
{ event: "MessageReactionToggled", handler: oe },
|
|
1960
|
+
{ event: "ConversationRequestAccepted", handler: Q }
|
|
1961
1961
|
]
|
|
1962
|
-
})) : (
|
|
1963
|
-
channel:
|
|
1962
|
+
})) : (O.listen(".ConversationMessageSent", _), O.listen(".ConversationMessageRead", x), O.listen(".ConversationMessageEdited", Se), O.listen(".ConversationMessageDeleted", H), O.listen(".MessageReactionToggled", oe), O.listen(".ConversationRequestAccepted", Q), M.set(k, {
|
|
1963
|
+
channel: O,
|
|
1964
1964
|
directBound: !1,
|
|
1965
1965
|
bindings: [
|
|
1966
|
-
{ event: ".ConversationMessageSent", handler:
|
|
1967
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1968
|
-
{ event: ".ConversationMessageEdited", handler:
|
|
1969
|
-
{ event: ".ConversationMessageDeleted", handler:
|
|
1970
|
-
{ event: ".MessageReactionToggled", handler:
|
|
1971
|
-
{ event: ".ConversationRequestAccepted", handler:
|
|
1966
|
+
{ event: ".ConversationMessageSent", handler: _ },
|
|
1967
|
+
{ event: ".ConversationMessageRead", handler: x },
|
|
1968
|
+
{ event: ".ConversationMessageEdited", handler: Se },
|
|
1969
|
+
{ event: ".ConversationMessageDeleted", handler: H },
|
|
1970
|
+
{ event: ".MessageReactionToggled", handler: oe },
|
|
1971
|
+
{ event: ".ConversationRequestAccepted", handler: Q }
|
|
1972
1972
|
]
|
|
1973
1973
|
})), h.add(k), e.registerGlobalConversationSubscription(k);
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1975
|
+
function A() {
|
|
1976
1976
|
const k = Pe();
|
|
1977
1977
|
if (!k) {
|
|
1978
|
-
|
|
1978
|
+
E();
|
|
1979
1979
|
return;
|
|
1980
1980
|
}
|
|
1981
1981
|
for (const I of h) {
|
|
@@ -1988,26 +1988,26 @@ function cc() {
|
|
|
1988
1988
|
}
|
|
1989
1989
|
h.clear();
|
|
1990
1990
|
}
|
|
1991
|
-
function
|
|
1991
|
+
function T() {
|
|
1992
1992
|
const k = Pe();
|
|
1993
1993
|
if (!k) return;
|
|
1994
1994
|
const I = (() => {
|
|
1995
|
-
const
|
|
1996
|
-
for (const
|
|
1997
|
-
if (!
|
|
1995
|
+
const O = [...e.conversations, ...e.requestConversations], _ = /* @__PURE__ */ new Set(), x = [];
|
|
1996
|
+
for (const oe of O)
|
|
1997
|
+
if (!_.has(oe.id) && (_.add(oe.id), x.push(oe), x.length >= ta))
|
|
1998
1998
|
break;
|
|
1999
|
-
return
|
|
2000
|
-
})(),
|
|
2001
|
-
for (const
|
|
2002
|
-
if (!
|
|
1999
|
+
return x;
|
|
2000
|
+
})(), re = new Set(I.map((O) => O.id));
|
|
2001
|
+
for (const O of h)
|
|
2002
|
+
if (!re.has(O) && !e.hasDetailSubscription(O)) {
|
|
2003
2003
|
try {
|
|
2004
|
-
v(
|
|
2004
|
+
v(O), k.leave(`conversation.${O}`);
|
|
2005
2005
|
} catch {
|
|
2006
2006
|
}
|
|
2007
|
-
h.delete(
|
|
2007
|
+
h.delete(O), e.unregisterGlobalConversationSubscription(O);
|
|
2008
2008
|
}
|
|
2009
|
-
for (const
|
|
2010
|
-
b(
|
|
2009
|
+
for (const O of I)
|
|
2010
|
+
b(O.id);
|
|
2011
2011
|
}
|
|
2012
2012
|
function p(k) {
|
|
2013
2013
|
const I = qt({
|
|
@@ -2028,50 +2028,54 @@ function cc() {
|
|
|
2028
2028
|
try {
|
|
2029
2029
|
const I = await o.get("/v1/presence/users", {
|
|
2030
2030
|
params: { ids: k }
|
|
2031
|
-
}),
|
|
2032
|
-
for (const
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2031
|
+
}), re = I.data?.data?.items ?? I.data?.items ?? [];
|
|
2032
|
+
for (const O of re) {
|
|
2033
|
+
const _ = qt(O);
|
|
2034
|
+
_.status !== null && e.updatePresenceForUser(O.id, _.status, _.lastSeenAt);
|
|
2035
2035
|
}
|
|
2036
2036
|
} catch (I) {
|
|
2037
2037
|
xe.warn("Failed to refresh messaging presence snapshot", I);
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
2040
|
function y() {
|
|
2041
|
-
!Pe() ||
|
|
2041
|
+
!Pe() || w || (ji(p), w = !0);
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2044
|
-
|
|
2043
|
+
function D() {
|
|
2044
|
+
w && ($i(), w = !1);
|
|
2045
2045
|
}
|
|
2046
2046
|
const q = ut(
|
|
2047
2047
|
d,
|
|
2048
2048
|
() => {
|
|
2049
|
-
|
|
2049
|
+
T();
|
|
2050
2050
|
},
|
|
2051
2051
|
{ deep: !1, immediate: !0 }
|
|
2052
|
-
),
|
|
2052
|
+
), X = ut(
|
|
2053
2053
|
f,
|
|
2054
2054
|
() => {
|
|
2055
|
-
|
|
2055
|
+
T();
|
|
2056
2056
|
},
|
|
2057
2057
|
{ deep: !1, immediate: !0 }
|
|
2058
|
-
),
|
|
2058
|
+
), V = ut(
|
|
2059
2059
|
() => c.fullPath,
|
|
2060
2060
|
() => {
|
|
2061
|
-
|
|
2061
|
+
T();
|
|
2062
2062
|
}
|
|
2063
|
-
),
|
|
2064
|
-
k === "connected" ? (
|
|
2063
|
+
), ee = ft((k) => {
|
|
2064
|
+
k === "connected" ? (E(), T(), D(), y(), m()) : (k === "disconnected" || k === "error") && (E(), D());
|
|
2065
2065
|
});
|
|
2066
|
-
|
|
2067
|
-
|
|
2066
|
+
T(), y(), m();
|
|
2067
|
+
const W = setInterval(() => {
|
|
2068
|
+
e.pollConversationsForUnread();
|
|
2069
|
+
}, na);
|
|
2070
|
+
Pe() || ms().then((k) => {
|
|
2071
|
+
k && (E(), T(), D(), y(), m());
|
|
2068
2072
|
}).catch((k) => {
|
|
2069
2073
|
xe.warn("Failed to eagerly initialize messenger echo", k);
|
|
2070
2074
|
}), u !== null && ze(() => {
|
|
2071
|
-
q(),
|
|
2075
|
+
q(), X(), V(), ee(), A(), D(), clearInterval(W);
|
|
2072
2076
|
});
|
|
2073
2077
|
}
|
|
2074
|
-
function
|
|
2078
|
+
function lc() {
|
|
2075
2079
|
const e = ye(Ft());
|
|
2076
2080
|
let n = null;
|
|
2077
2081
|
return $t(() => {
|
|
@@ -2081,9 +2085,9 @@ function uc() {
|
|
|
2081
2085
|
}), ze(() => {
|
|
2082
2086
|
n?.(), n = null;
|
|
2083
2087
|
}), {
|
|
2084
|
-
accessState:
|
|
2085
|
-
isBlocked:
|
|
2086
|
-
isSuspended:
|
|
2088
|
+
accessState: se(() => e.value),
|
|
2089
|
+
isBlocked: se(() => e.value !== "available"),
|
|
2090
|
+
isSuspended: se(() => e.value === "account_suspended")
|
|
2087
2091
|
};
|
|
2088
2092
|
}
|
|
2089
2093
|
const Ls = () => null, Is = {
|
|
@@ -2100,22 +2104,22 @@ const Ls = () => null, Is = {
|
|
|
2100
2104
|
authTokenResolver: Ls
|
|
2101
2105
|
};
|
|
2102
2106
|
let dt = { ...Is };
|
|
2103
|
-
function
|
|
2107
|
+
function oa() {
|
|
2104
2108
|
return dt;
|
|
2105
2109
|
}
|
|
2106
|
-
function
|
|
2110
|
+
function aa(e) {
|
|
2107
2111
|
dt = {
|
|
2108
2112
|
...dt,
|
|
2109
2113
|
...e
|
|
2110
2114
|
};
|
|
2111
2115
|
}
|
|
2112
|
-
function
|
|
2116
|
+
function ca() {
|
|
2113
2117
|
dt = { ...Is };
|
|
2114
2118
|
}
|
|
2115
|
-
function
|
|
2119
|
+
function ua(e) {
|
|
2116
2120
|
return e.authTokenResolver !== Ls;
|
|
2117
2121
|
}
|
|
2118
|
-
const
|
|
2122
|
+
const la = 429, da = 403, ha = 423, fa = "ACCOUNT_LIMITED", pa = "ACCOUNT_SUSPENDED", ga = "ACCOUNT_WRITE_TIMEOUT", ma = 2, va = 5 * 6e4;
|
|
2119
2123
|
function Ge(e) {
|
|
2120
2124
|
return typeof e == "object" && e !== null;
|
|
2121
2125
|
}
|
|
@@ -2145,23 +2149,23 @@ function Os(e) {
|
|
|
2145
2149
|
}
|
|
2146
2150
|
function Lt(e) {
|
|
2147
2151
|
const n = Us(e), r = Os(e);
|
|
2148
|
-
return n ===
|
|
2152
|
+
return n === la && r === fa || n === ha && r === ga;
|
|
2149
2153
|
}
|
|
2150
2154
|
function It(e) {
|
|
2151
2155
|
const n = Us(e), r = Os(e);
|
|
2152
|
-
return n ===
|
|
2156
|
+
return n === da && r === pa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2153
2157
|
}
|
|
2154
2158
|
function Qe() {
|
|
2155
2159
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
2156
2160
|
}
|
|
2157
|
-
function
|
|
2161
|
+
function ba(e) {
|
|
2158
2162
|
const n = Qe(), r = n?.getItem(e);
|
|
2159
2163
|
if (r)
|
|
2160
2164
|
return r;
|
|
2161
2165
|
const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
2162
2166
|
return n?.setItem(e, o), o;
|
|
2163
2167
|
}
|
|
2164
|
-
function
|
|
2168
|
+
function ya(e) {
|
|
2165
2169
|
const n = Qe(), r = n?.getItem(e);
|
|
2166
2170
|
if (!r)
|
|
2167
2171
|
return null;
|
|
@@ -2169,19 +2173,19 @@ function ba(e) {
|
|
|
2169
2173
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
2170
2174
|
}
|
|
2171
2175
|
function Ut(e, n = Date.now()) {
|
|
2172
|
-
const r = Qe(), o =
|
|
2176
|
+
const r = Qe(), o = ya(e);
|
|
2173
2177
|
return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
|
|
2174
2178
|
}
|
|
2175
|
-
function
|
|
2176
|
-
Qe()?.setItem(e, String(n +
|
|
2179
|
+
function _a(e, n = Date.now()) {
|
|
2180
|
+
Qe()?.setItem(e, String(n + va));
|
|
2177
2181
|
}
|
|
2178
|
-
function
|
|
2182
|
+
function Sa(e) {
|
|
2179
2183
|
Qe()?.removeItem(e);
|
|
2180
2184
|
}
|
|
2181
|
-
function
|
|
2185
|
+
function Ca(e) {
|
|
2182
2186
|
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
2183
2187
|
}
|
|
2184
|
-
function
|
|
2188
|
+
function wa(e) {
|
|
2185
2189
|
if (typeof document > "u")
|
|
2186
2190
|
return null;
|
|
2187
2191
|
const n = `${e}=`, r = document.cookie.split(";");
|
|
@@ -2192,8 +2196,8 @@ function Ca(e) {
|
|
|
2192
2196
|
}
|
|
2193
2197
|
return null;
|
|
2194
2198
|
}
|
|
2195
|
-
function
|
|
2196
|
-
const e =
|
|
2199
|
+
function Ta() {
|
|
2200
|
+
const e = wa("XSRF-TOKEN");
|
|
2197
2201
|
if (!e)
|
|
2198
2202
|
return null;
|
|
2199
2203
|
try {
|
|
@@ -2202,16 +2206,16 @@ function wa() {
|
|
|
2202
2206
|
return e;
|
|
2203
2207
|
}
|
|
2204
2208
|
}
|
|
2205
|
-
function
|
|
2209
|
+
function Ea(e, n, r) {
|
|
2206
2210
|
if (typeof fetch > "u")
|
|
2207
2211
|
return null;
|
|
2208
2212
|
const o = {
|
|
2209
2213
|
Accept: "application/json",
|
|
2210
2214
|
"Content-Type": "application/json"
|
|
2211
|
-
}, c =
|
|
2215
|
+
}, c = Ta();
|
|
2212
2216
|
c && (o["X-XSRF-TOKEN"] = c), r && (o.Authorization = `Bearer ${r}`);
|
|
2213
2217
|
try {
|
|
2214
|
-
return fetch(
|
|
2218
|
+
return fetch(Ca(e), {
|
|
2215
2219
|
method: "POST",
|
|
2216
2220
|
headers: o,
|
|
2217
2221
|
body: JSON.stringify({ client_id: n }),
|
|
@@ -2223,63 +2227,63 @@ function Ta(e, n, r) {
|
|
|
2223
2227
|
return null;
|
|
2224
2228
|
}
|
|
2225
2229
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const e = Le()(), n =
|
|
2228
|
-
let c = null, u = null, d = !1, f = Ut(n.accountLimitedUntilStorageKey), h = !1,
|
|
2229
|
-
const
|
|
2230
|
+
function dc() {
|
|
2231
|
+
const e = Le()(), n = oa(), r = Xt(), o = ba(n.clientIdStorageKey);
|
|
2232
|
+
let c = null, u = null, d = !1, f = Ut(n.accountLimitedUntilStorageKey), h = !1, M = !1, w = null, v = 0;
|
|
2233
|
+
const E = () => ua(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2230
2234
|
c && (clearInterval(c), c = null);
|
|
2231
|
-
},
|
|
2235
|
+
}, A = () => {
|
|
2232
2236
|
u && (clearTimeout(u), u = null);
|
|
2233
|
-
},
|
|
2237
|
+
}, T = () => {
|
|
2234
2238
|
b(), c = setInterval(() => {
|
|
2235
|
-
|
|
2239
|
+
k();
|
|
2236
2240
|
}, n.heartbeatIntervalMs);
|
|
2237
2241
|
}, p = (x) => {
|
|
2238
|
-
f || console.warn(x),
|
|
2242
|
+
f || console.warn(x), _a(n.accountLimitedUntilStorageKey), f = !0, d = !1, w = null, b(), A();
|
|
2239
2243
|
}, m = async (x) => {
|
|
2240
|
-
if (!(!d ||
|
|
2244
|
+
if (!(!d || M || f || h) && E() && w !== x)
|
|
2241
2245
|
try {
|
|
2242
|
-
await r.patch(n.statusUrl, { status: x }),
|
|
2243
|
-
} catch (
|
|
2244
|
-
if (Lt(
|
|
2246
|
+
await r.patch(n.statusUrl, { status: x }), w = x;
|
|
2247
|
+
} catch (oe) {
|
|
2248
|
+
if (Lt(oe)) {
|
|
2245
2249
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2246
2250
|
return;
|
|
2247
2251
|
}
|
|
2248
|
-
It(
|
|
2252
|
+
It(oe) && (h = !0, d = !1, w = null, b(), A());
|
|
2249
2253
|
}
|
|
2250
2254
|
}, y = () => {
|
|
2251
|
-
|
|
2255
|
+
A(), !(!d || M || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
2252
2256
|
u = null, m("idle");
|
|
2253
2257
|
}, n.idleAfterMs));
|
|
2254
|
-
},
|
|
2255
|
-
if (
|
|
2258
|
+
}, D = () => {
|
|
2259
|
+
if (M || !d || f || h || document.visibilityState !== "visible")
|
|
2256
2260
|
return;
|
|
2257
2261
|
const x = Date.now();
|
|
2258
2262
|
x - v < n.activityDebounceMs || (v = x, m("online"), y());
|
|
2259
2263
|
}, q = () => {
|
|
2260
|
-
|
|
2261
|
-
},
|
|
2264
|
+
D();
|
|
2265
|
+
}, X = () => {
|
|
2262
2266
|
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", q, { passive: !0 }), document.addEventListener("keydown", q), document.addEventListener("touchstart", q, { passive: !0 }), window.addEventListener("focus", q));
|
|
2263
|
-
},
|
|
2267
|
+
}, V = () => {
|
|
2264
2268
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2265
|
-
},
|
|
2269
|
+
}, ee = async () => {
|
|
2266
2270
|
if (Ut(n.accountLimitedUntilStorageKey))
|
|
2267
2271
|
return f = !0, "account_limited";
|
|
2268
2272
|
try {
|
|
2269
2273
|
return await r.post(n.sessionOpenUrl, {
|
|
2270
2274
|
client_id: o,
|
|
2271
2275
|
user_agent: n.userAgentResolver()
|
|
2272
|
-
}),
|
|
2276
|
+
}), Sa(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, w = null, "opened";
|
|
2273
2277
|
} catch (x) {
|
|
2274
|
-
return Lt(x) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : It(x) ? (h = !0, d = !1,
|
|
2278
|
+
return Lt(x) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : It(x) ? (h = !0, d = !1, w = null, b(), A(), "account_suspended") : "failed";
|
|
2275
2279
|
}
|
|
2276
|
-
},
|
|
2277
|
-
for (let x = 0; x <
|
|
2278
|
-
if (await
|
|
2280
|
+
}, W = async () => {
|
|
2281
|
+
for (let x = 0; x < ma; x += 1)
|
|
2282
|
+
if (await ee() !== "failed")
|
|
2279
2283
|
return;
|
|
2280
2284
|
console.warn("[Presence] Failed to open session");
|
|
2281
|
-
},
|
|
2282
|
-
if (d &&
|
|
2285
|
+
}, k = async () => {
|
|
2286
|
+
if (d && E())
|
|
2283
2287
|
try {
|
|
2284
2288
|
await r.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2285
2289
|
} catch (x) {
|
|
@@ -2287,13 +2291,13 @@ function lc() {
|
|
|
2287
2291
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2288
2292
|
return;
|
|
2289
2293
|
}
|
|
2290
|
-
It(x) && (h = !0, d = !1,
|
|
2294
|
+
It(x) && (h = !0, d = !1, w = null, b(), A());
|
|
2291
2295
|
}
|
|
2292
|
-
},
|
|
2296
|
+
}, I = () => {
|
|
2293
2297
|
if (!d)
|
|
2294
2298
|
return;
|
|
2295
|
-
d = !1,
|
|
2296
|
-
const x =
|
|
2299
|
+
d = !1, w = null, A();
|
|
2300
|
+
const x = Ea(
|
|
2297
2301
|
n.sessionCloseUrl,
|
|
2298
2302
|
o,
|
|
2299
2303
|
n.authTokenResolver()
|
|
@@ -2305,196 +2309,196 @@ function lc() {
|
|
|
2305
2309
|
}
|
|
2306
2310
|
r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2307
2311
|
});
|
|
2308
|
-
},
|
|
2309
|
-
if (!
|
|
2310
|
-
if (await
|
|
2311
|
-
|
|
2312
|
+
}, re = async () => {
|
|
2313
|
+
if (!M) {
|
|
2314
|
+
if (await W(), M) {
|
|
2315
|
+
I();
|
|
2312
2316
|
return;
|
|
2313
2317
|
}
|
|
2314
|
-
d && (
|
|
2318
|
+
d && (T(), m("online"), y());
|
|
2315
2319
|
}
|
|
2316
|
-
},
|
|
2317
|
-
if (!
|
|
2320
|
+
}, O = () => {
|
|
2321
|
+
if (!M) {
|
|
2318
2322
|
if (document.visibilityState === "hidden") {
|
|
2319
|
-
|
|
2323
|
+
I(), b(), A();
|
|
2320
2324
|
return;
|
|
2321
2325
|
}
|
|
2322
2326
|
if (document.visibilityState === "visible" && !d) {
|
|
2323
|
-
f = Ut(n.accountLimitedUntilStorageKey), !f && !h &&
|
|
2327
|
+
f = Ut(n.accountLimitedUntilStorageKey), !f && !h && re();
|
|
2324
2328
|
return;
|
|
2325
2329
|
}
|
|
2326
|
-
document.visibilityState === "visible" && d && !f && !h &&
|
|
2330
|
+
document.visibilityState === "visible" && d && !f && !h && D();
|
|
2327
2331
|
}
|
|
2328
2332
|
}, _ = () => {
|
|
2329
|
-
|
|
2333
|
+
M || (I(), b(), A());
|
|
2330
2334
|
};
|
|
2331
2335
|
$t(async () => {
|
|
2332
2336
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2333
|
-
if (await
|
|
2334
|
-
|
|
2337
|
+
if (await W(), M) {
|
|
2338
|
+
I();
|
|
2335
2339
|
return;
|
|
2336
2340
|
}
|
|
2337
|
-
d && (
|
|
2341
|
+
d && (T(), m("online"), y()), X(), document.addEventListener("visibilitychange", O), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2338
2342
|
}
|
|
2339
2343
|
}), ze(() => {
|
|
2340
|
-
|
|
2344
|
+
M = !0, V(), A(), b(), I(), document.removeEventListener("visibilitychange", O), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2341
2345
|
});
|
|
2342
2346
|
}
|
|
2343
|
-
const
|
|
2344
|
-
function
|
|
2345
|
-
const n = Yt(), r = Le()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = jt(),
|
|
2346
|
-
let
|
|
2347
|
-
const p =
|
|
2348
|
-
const
|
|
2349
|
-
if (
|
|
2350
|
-
return
|
|
2351
|
-
const
|
|
2352
|
-
return
|
|
2353
|
-
},
|
|
2354
|
-
const
|
|
2355
|
-
for (const
|
|
2356
|
-
n.removeTypingUser(
|
|
2347
|
+
const Ra = 12e3;
|
|
2348
|
+
function hc(e) {
|
|
2349
|
+
const n = Yt(), r = Le()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = jt(), M = h !== null, w = 20, v = 250;
|
|
2350
|
+
let E = !1, b = null, A = 0, T = null;
|
|
2351
|
+
const p = se(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
|
|
2352
|
+
const S = u.value?.trim() ?? "";
|
|
2353
|
+
if (S.length > 0)
|
|
2354
|
+
return S;
|
|
2355
|
+
const F = m();
|
|
2356
|
+
return F.length > 0 && (u.value = F), F;
|
|
2357
|
+
}, D = (S) => n.getTypingUsers(S), q = (S) => {
|
|
2358
|
+
const F = D(S);
|
|
2359
|
+
for (const Y of F)
|
|
2360
|
+
n.removeTypingUser(S, Y.id);
|
|
2357
2361
|
d.value = [];
|
|
2358
|
-
},
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
},
|
|
2362
|
-
for (const
|
|
2363
|
-
clearTimeout(
|
|
2362
|
+
}, X = (S) => {
|
|
2363
|
+
const F = f.get(S);
|
|
2364
|
+
F && (clearTimeout(F), f.delete(S));
|
|
2365
|
+
}, V = () => {
|
|
2366
|
+
for (const S of f.values())
|
|
2367
|
+
clearTimeout(S);
|
|
2364
2368
|
f.clear();
|
|
2365
|
-
},
|
|
2366
|
-
|
|
2367
|
-
},
|
|
2368
|
-
!
|
|
2369
|
-
|
|
2369
|
+
}, ee = () => {
|
|
2370
|
+
T && (clearTimeout(T), T = null), A = 0;
|
|
2371
|
+
}, W = () => {
|
|
2372
|
+
!M || o.value || T || A >= w || (T = setTimeout(() => {
|
|
2373
|
+
T = null, A += 1, O();
|
|
2370
2374
|
}, v));
|
|
2371
|
-
},
|
|
2372
|
-
|
|
2373
|
-
const
|
|
2374
|
-
f.delete(
|
|
2375
|
-
},
|
|
2376
|
-
f.set(
|
|
2377
|
-
},
|
|
2378
|
-
|
|
2379
|
-
},
|
|
2375
|
+
}, k = (S, F) => {
|
|
2376
|
+
X(S);
|
|
2377
|
+
const Y = setTimeout(() => {
|
|
2378
|
+
f.delete(S), n.removeTypingUser(F, S), d.value = d.value.filter((pe) => pe.id !== S);
|
|
2379
|
+
}, Ra);
|
|
2380
|
+
f.set(S, Y);
|
|
2381
|
+
}, I = () => {
|
|
2382
|
+
E = !0, ee();
|
|
2383
|
+
}, re = (S) => {
|
|
2380
2384
|
try {
|
|
2381
|
-
b && (b(), b = null), b = Vi(
|
|
2385
|
+
b && (b(), b = null), b = Vi(S, {
|
|
2382
2386
|
onTypingStart: x,
|
|
2383
|
-
onTypingStop:
|
|
2384
|
-
}),
|
|
2385
|
-
} catch (
|
|
2386
|
-
c.value =
|
|
2387
|
+
onTypingStop: oe
|
|
2388
|
+
}), ee(), o.value = !0, u.value = S;
|
|
2389
|
+
} catch (F) {
|
|
2390
|
+
c.value = F instanceof Error ? F.message : "Failed to subscribe to typing channel";
|
|
2387
2391
|
}
|
|
2388
|
-
},
|
|
2389
|
-
const
|
|
2390
|
-
if (!(o.value || !
|
|
2392
|
+
}, O = () => {
|
|
2393
|
+
const S = m();
|
|
2394
|
+
if (!(o.value || !S)) {
|
|
2391
2395
|
if (c.value = null, Pe() && An() === "connected") {
|
|
2392
|
-
|
|
2396
|
+
re(S);
|
|
2393
2397
|
return;
|
|
2394
2398
|
}
|
|
2395
|
-
|
|
2396
|
-
if (
|
|
2399
|
+
E = !1, ms().then((F) => {
|
|
2400
|
+
if (E || o.value || !F)
|
|
2397
2401
|
return;
|
|
2398
|
-
const
|
|
2399
|
-
if (
|
|
2400
|
-
|
|
2402
|
+
const Y = m();
|
|
2403
|
+
if (Y && Y === S && Pe() && An() === "connected") {
|
|
2404
|
+
re(Y);
|
|
2401
2405
|
return;
|
|
2402
2406
|
}
|
|
2403
|
-
|
|
2404
|
-
}),
|
|
2407
|
+
W();
|
|
2408
|
+
}), W();
|
|
2405
2409
|
}
|
|
2406
2410
|
}, _ = () => {
|
|
2407
|
-
const
|
|
2408
|
-
if (
|
|
2411
|
+
const S = u.value;
|
|
2412
|
+
if (I(), !(!o.value || !S))
|
|
2409
2413
|
try {
|
|
2410
|
-
b && (b(), b = null), Xi(
|
|
2411
|
-
} catch (
|
|
2412
|
-
c.value =
|
|
2414
|
+
b && (b(), b = null), Xi(S), V(), q(S), o.value = !1, u.value = null, c.value = null;
|
|
2415
|
+
} catch (F) {
|
|
2416
|
+
c.value = F instanceof Error ? F.message : "Failed to unsubscribe from typing channel";
|
|
2413
2417
|
}
|
|
2414
2418
|
};
|
|
2415
|
-
function x(
|
|
2416
|
-
if (
|
|
2419
|
+
function x(S) {
|
|
2420
|
+
if (S.user_id === p.value)
|
|
2417
2421
|
return;
|
|
2418
|
-
const
|
|
2419
|
-
if (!
|
|
2422
|
+
const F = S.conversation_id.trim() || y();
|
|
2423
|
+
if (!F)
|
|
2420
2424
|
return;
|
|
2421
|
-
const
|
|
2422
|
-
id:
|
|
2423
|
-
name:
|
|
2424
|
-
...
|
|
2425
|
+
const Y = {
|
|
2426
|
+
id: S.user.id,
|
|
2427
|
+
name: S.user.name,
|
|
2428
|
+
...S.user.avatar !== void 0 ? { avatar: S.user.avatar } : {}
|
|
2425
2429
|
};
|
|
2426
|
-
d.value.some((
|
|
2430
|
+
d.value.some((pe) => pe.id === Y.id) || (d.value = [...d.value, Y]), n.addTypingUser(F, Y), k(S.user_id, F);
|
|
2427
2431
|
}
|
|
2428
|
-
function
|
|
2429
|
-
if (
|
|
2432
|
+
function oe(S) {
|
|
2433
|
+
if (S.user_id === p.value)
|
|
2430
2434
|
return;
|
|
2431
|
-
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2435
|
+
X(S.user_id);
|
|
2436
|
+
const F = S.conversation_id.trim() || y();
|
|
2437
|
+
F && (d.value = d.value.filter((Y) => Y.id !== S.user_id), n.removeTypingUser(F, S.user_id));
|
|
2434
2438
|
}
|
|
2435
|
-
const Se =
|
|
2436
|
-
const
|
|
2437
|
-
if (!
|
|
2439
|
+
const Se = se(() => {
|
|
2440
|
+
const S = y();
|
|
2441
|
+
if (!S)
|
|
2438
2442
|
return d.value;
|
|
2439
|
-
const
|
|
2443
|
+
const F = D(S);
|
|
2440
2444
|
if (d.value.length === 0)
|
|
2441
|
-
return
|
|
2442
|
-
if (
|
|
2445
|
+
return F;
|
|
2446
|
+
if (F.length === 0)
|
|
2443
2447
|
return d.value;
|
|
2444
|
-
const
|
|
2445
|
-
for (const
|
|
2446
|
-
|
|
2447
|
-
for (const
|
|
2448
|
-
|
|
2449
|
-
return [...
|
|
2450
|
-
}),
|
|
2451
|
-
const
|
|
2452
|
-
if (
|
|
2448
|
+
const Y = /* @__PURE__ */ new Map();
|
|
2449
|
+
for (const pe of F)
|
|
2450
|
+
Y.set(pe.id, pe);
|
|
2451
|
+
for (const pe of d.value)
|
|
2452
|
+
Y.set(pe.id, pe);
|
|
2453
|
+
return [...Y.values()];
|
|
2454
|
+
}), H = se(() => {
|
|
2455
|
+
const S = Se.value;
|
|
2456
|
+
if (S.length === 0)
|
|
2453
2457
|
return "";
|
|
2454
|
-
const
|
|
2455
|
-
if (!
|
|
2458
|
+
const F = S[0];
|
|
2459
|
+
if (!F)
|
|
2456
2460
|
return "";
|
|
2457
|
-
if (
|
|
2458
|
-
return `${
|
|
2459
|
-
const
|
|
2460
|
-
if (!
|
|
2461
|
-
return `${
|
|
2462
|
-
if (
|
|
2463
|
-
return `${
|
|
2464
|
-
const
|
|
2465
|
-
return
|
|
2466
|
-
}),
|
|
2467
|
-
m() && (b && (b(), b = null), o.value = !1, u.value = null,
|
|
2461
|
+
if (S.length === 1)
|
|
2462
|
+
return `${F.name} is typing...`;
|
|
2463
|
+
const Y = S[1];
|
|
2464
|
+
if (!Y)
|
|
2465
|
+
return `${S.length} people are typing...`;
|
|
2466
|
+
if (S.length === 2)
|
|
2467
|
+
return `${F.name} and ${Y.name} are typing...`;
|
|
2468
|
+
const pe = S[2];
|
|
2469
|
+
return pe ? S.length === 3 ? `${F.name}, ${Y.name} and ${pe.name} are typing...` : `${S.length} people are typing...` : `${S.length} people are typing...`;
|
|
2470
|
+
}), Q = se(() => Se.value.length > 0), te = () => {
|
|
2471
|
+
m() && (b && (b(), b = null), o.value = !1, u.value = null, O());
|
|
2468
2472
|
};
|
|
2469
|
-
typeof window < "u" && window.addEventListener(Ke(),
|
|
2470
|
-
const
|
|
2471
|
-
if (
|
|
2472
|
-
o.value ||
|
|
2473
|
+
typeof window < "u" && window.addEventListener(Ke(), te);
|
|
2474
|
+
const J = ft((S) => {
|
|
2475
|
+
if (S === "connected") {
|
|
2476
|
+
o.value || O();
|
|
2473
2477
|
return;
|
|
2474
2478
|
}
|
|
2475
|
-
if (
|
|
2476
|
-
|
|
2477
|
-
const
|
|
2478
|
-
|
|
2479
|
+
if (S === "disconnected" || S === "error") {
|
|
2480
|
+
I(), b && (b(), b = null);
|
|
2481
|
+
const F = y();
|
|
2482
|
+
F && q(F), o.value = !1, u.value = null, V();
|
|
2479
2483
|
}
|
|
2480
2484
|
});
|
|
2481
2485
|
return h !== null && ze(() => {
|
|
2482
|
-
|
|
2486
|
+
I(), J(), V(), _(), typeof window < "u" && window.removeEventListener(Ke(), te);
|
|
2483
2487
|
}), {
|
|
2484
|
-
isSubscribed:
|
|
2485
|
-
error:
|
|
2488
|
+
isSubscribed: se(() => o.value),
|
|
2489
|
+
error: se(() => c.value),
|
|
2486
2490
|
typingUsers: Se,
|
|
2487
|
-
formatTypingIndicator:
|
|
2488
|
-
hasTypingUsers:
|
|
2489
|
-
subscribe:
|
|
2491
|
+
formatTypingIndicator: H,
|
|
2492
|
+
hasTypingUsers: Q,
|
|
2493
|
+
subscribe: O,
|
|
2490
2494
|
unsubscribe: _
|
|
2491
2495
|
};
|
|
2492
2496
|
}
|
|
2493
|
-
function
|
|
2494
|
-
e.apiClient && to(e.apiClient), e.mainApiClient && so(e.mainApiClient), e.authStore && io(e.authStore), e.mediaApi && co(e.mediaApi), e.createLogger && Go(e.createLogger), e.playMessageNotification && Zo(e.playMessageNotification), e.echo && Wi(e.echo), e.mainEcho && Vo(e.mainEcho), e.presence &&
|
|
2497
|
+
function fc(e) {
|
|
2498
|
+
e.apiClient && to(e.apiClient), e.mainApiClient && so(e.mainApiClient), e.authStore && io(e.authStore), e.mediaApi && co(e.mediaApi), e.createLogger && Go(e.createLogger), e.playMessageNotification && Zo(e.playMessageNotification), e.echo && Wi(e.echo), e.mainEcho && Vo(e.mainEcho), e.presence && aa(e.presence);
|
|
2495
2499
|
}
|
|
2496
|
-
function
|
|
2497
|
-
no(), ro(), oo(), uo(), Jo(), ea(), Gi(), Xo(),
|
|
2500
|
+
function pc() {
|
|
2501
|
+
no(), ro(), oo(), uo(), Jo(), ea(), Gi(), Xo(), ca();
|
|
2498
2502
|
}
|
|
2499
2503
|
class nn {
|
|
2500
2504
|
constructor() {
|
|
@@ -2545,7 +2549,7 @@ class Fs {
|
|
|
2545
2549
|
this.namespace = n;
|
|
2546
2550
|
}
|
|
2547
2551
|
}
|
|
2548
|
-
function
|
|
2552
|
+
function Aa(e) {
|
|
2549
2553
|
try {
|
|
2550
2554
|
new e();
|
|
2551
2555
|
} catch (n) {
|
|
@@ -2642,7 +2646,7 @@ class Ds extends sn {
|
|
|
2642
2646
|
), this;
|
|
2643
2647
|
}
|
|
2644
2648
|
}
|
|
2645
|
-
class
|
|
2649
|
+
class Pa extends sn {
|
|
2646
2650
|
/**
|
|
2647
2651
|
* Send a whisper event to other clients in the channel.
|
|
2648
2652
|
*/
|
|
@@ -2653,7 +2657,7 @@ class Aa extends sn {
|
|
|
2653
2657
|
), this;
|
|
2654
2658
|
}
|
|
2655
2659
|
}
|
|
2656
|
-
class
|
|
2660
|
+
class Ma extends Ds {
|
|
2657
2661
|
/**
|
|
2658
2662
|
* Register a callback to be called anytime the member list changes.
|
|
2659
2663
|
*/
|
|
@@ -2776,7 +2780,7 @@ class qs extends Ns {
|
|
|
2776
2780
|
}), this;
|
|
2777
2781
|
}
|
|
2778
2782
|
}
|
|
2779
|
-
class
|
|
2783
|
+
class ka extends qs {
|
|
2780
2784
|
/**
|
|
2781
2785
|
* Register a callback to be called anytime the member list changes.
|
|
2782
2786
|
*/
|
|
@@ -2870,7 +2874,7 @@ class zs extends ht {
|
|
|
2870
2874
|
return this;
|
|
2871
2875
|
}
|
|
2872
2876
|
}
|
|
2873
|
-
class
|
|
2877
|
+
class xa extends ht {
|
|
2874
2878
|
/**
|
|
2875
2879
|
* Send a whisper event to other clients in the channel.
|
|
2876
2880
|
*/
|
|
@@ -2878,7 +2882,7 @@ class ka extends ht {
|
|
|
2878
2882
|
return this;
|
|
2879
2883
|
}
|
|
2880
2884
|
}
|
|
2881
|
-
class
|
|
2885
|
+
class La extends zs {
|
|
2882
2886
|
/**
|
|
2883
2887
|
* Register a callback to be called anytime the member list changes.
|
|
2884
2888
|
*/
|
|
@@ -3005,7 +3009,7 @@ class ct extends rn {
|
|
|
3005
3009
|
* Get a private encrypted channel instance by name.
|
|
3006
3010
|
*/
|
|
3007
3011
|
encryptedPrivateChannel(n) {
|
|
3008
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
3012
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Pa(
|
|
3009
3013
|
this.pusher,
|
|
3010
3014
|
"private-encrypted-" + n,
|
|
3011
3015
|
this.options
|
|
@@ -3015,7 +3019,7 @@ class ct extends rn {
|
|
|
3015
3019
|
* Get a presence channel instance by name.
|
|
3016
3020
|
*/
|
|
3017
3021
|
presenceChannel(n) {
|
|
3018
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
3022
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Ma(
|
|
3019
3023
|
this.pusher,
|
|
3020
3024
|
"presence-" + n,
|
|
3021
3025
|
this.options
|
|
@@ -3084,7 +3088,7 @@ class ct extends rn {
|
|
|
3084
3088
|
this.pusher.disconnect();
|
|
3085
3089
|
}
|
|
3086
3090
|
}
|
|
3087
|
-
class
|
|
3091
|
+
class Ia extends rn {
|
|
3088
3092
|
constructor() {
|
|
3089
3093
|
super(...arguments), this.channels = {};
|
|
3090
3094
|
}
|
|
@@ -3144,7 +3148,7 @@ class La extends rn {
|
|
|
3144
3148
|
* Get a presence channel instance by name.
|
|
3145
3149
|
*/
|
|
3146
3150
|
presenceChannel(n) {
|
|
3147
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
3151
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new ka(
|
|
3148
3152
|
this.socket,
|
|
3149
3153
|
"presence-" + n,
|
|
3150
3154
|
this.options
|
|
@@ -3237,13 +3241,13 @@ class Gn extends rn {
|
|
|
3237
3241
|
* Get a private encrypted channel instance by name.
|
|
3238
3242
|
*/
|
|
3239
3243
|
encryptedPrivateChannel(n) {
|
|
3240
|
-
return new
|
|
3244
|
+
return new xa();
|
|
3241
3245
|
}
|
|
3242
3246
|
/**
|
|
3243
3247
|
* Get a presence channel instance by name.
|
|
3244
3248
|
*/
|
|
3245
3249
|
presenceChannel(n) {
|
|
3246
|
-
return new
|
|
3250
|
+
return new La();
|
|
3247
3251
|
}
|
|
3248
3252
|
/**
|
|
3249
3253
|
* Leave the given channel, as well as its private and presence variants.
|
|
@@ -3280,7 +3284,7 @@ class Gn extends rn {
|
|
|
3280
3284
|
disconnect() {
|
|
3281
3285
|
}
|
|
3282
3286
|
}
|
|
3283
|
-
class
|
|
3287
|
+
class Ua {
|
|
3284
3288
|
/**
|
|
3285
3289
|
* Create a new class instance.
|
|
3286
3290
|
*/
|
|
@@ -3311,10 +3315,10 @@ class Ia {
|
|
|
3311
3315
|
broadcaster: "pusher"
|
|
3312
3316
|
});
|
|
3313
3317
|
else if (this.options.broadcaster === "socket.io")
|
|
3314
|
-
this.connector = new
|
|
3318
|
+
this.connector = new Ia(this.options);
|
|
3315
3319
|
else if (this.options.broadcaster === "null")
|
|
3316
3320
|
this.connector = new Gn(this.options);
|
|
3317
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
3321
|
+
else if (typeof this.options.broadcaster == "function" && Aa(this.options.broadcaster))
|
|
3318
3322
|
this.connector = new this.options.broadcaster(this.options);
|
|
3319
3323
|
else
|
|
3320
3324
|
throw new Error(
|
|
@@ -3438,12 +3442,12 @@ class Ia {
|
|
|
3438
3442
|
);
|
|
3439
3443
|
}
|
|
3440
3444
|
}
|
|
3441
|
-
function
|
|
3445
|
+
function Oa(e) {
|
|
3442
3446
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3443
3447
|
}
|
|
3444
3448
|
var Ot = { exports: {} };
|
|
3445
3449
|
var Jn;
|
|
3446
|
-
function
|
|
3450
|
+
function Fa() {
|
|
3447
3451
|
return Jn || (Jn = 1, (function(e, n) {
|
|
3448
3452
|
(function(o, c) {
|
|
3449
3453
|
e.exports = c();
|
|
@@ -3473,8 +3477,8 @@ function Oa() {
|
|
|
3473
3477
|
}, c.t = function(u, d) {
|
|
3474
3478
|
if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
|
|
3475
3479
|
var f = /* @__PURE__ */ Object.create(null);
|
|
3476
|
-
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(
|
|
3477
|
-
return u[
|
|
3480
|
+
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(M) {
|
|
3481
|
+
return u[M];
|
|
3478
3482
|
}).bind(null, h));
|
|
3479
3483
|
return f;
|
|
3480
3484
|
}, c.n = function(u) {
|
|
@@ -3498,15 +3502,15 @@ function Oa() {
|
|
|
3498
3502
|
/***/
|
|
3499
3503
|
(function(r, o, c) {
|
|
3500
3504
|
var u = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3501
|
-
var
|
|
3502
|
-
return
|
|
3503
|
-
y.__proto__ =
|
|
3504
|
-
} || function(y,
|
|
3505
|
-
for (var q in
|
|
3506
|
-
},
|
|
3505
|
+
var T = function(p, m) {
|
|
3506
|
+
return T = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, D) {
|
|
3507
|
+
y.__proto__ = D;
|
|
3508
|
+
} || function(y, D) {
|
|
3509
|
+
for (var q in D) D.hasOwnProperty(q) && (y[q] = D[q]);
|
|
3510
|
+
}, T(p, m);
|
|
3507
3511
|
};
|
|
3508
3512
|
return function(p, m) {
|
|
3509
|
-
|
|
3513
|
+
T(p, m);
|
|
3510
3514
|
function y() {
|
|
3511
3515
|
this.constructor = p;
|
|
3512
3516
|
}
|
|
@@ -3517,41 +3521,41 @@ function Oa() {
|
|
|
3517
3521
|
var d = 256, f = (
|
|
3518
3522
|
/** @class */
|
|
3519
3523
|
(function() {
|
|
3520
|
-
function
|
|
3524
|
+
function T(p) {
|
|
3521
3525
|
p === void 0 && (p = "="), this._paddingCharacter = p;
|
|
3522
3526
|
}
|
|
3523
|
-
return
|
|
3527
|
+
return T.prototype.encodedLength = function(p) {
|
|
3524
3528
|
return this._paddingCharacter ? (p + 2) / 3 * 4 | 0 : (p * 8 + 5) / 6 | 0;
|
|
3525
|
-
},
|
|
3529
|
+
}, T.prototype.encode = function(p) {
|
|
3526
3530
|
for (var m = "", y = 0; y < p.length - 2; y += 3) {
|
|
3527
|
-
var
|
|
3528
|
-
m += this._encodeByte(
|
|
3531
|
+
var D = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
|
|
3532
|
+
m += this._encodeByte(D >>> 18 & 63), m += this._encodeByte(D >>> 12 & 63), m += this._encodeByte(D >>> 6 & 63), m += this._encodeByte(D >>> 0 & 63);
|
|
3529
3533
|
}
|
|
3530
3534
|
var q = p.length - y;
|
|
3531
3535
|
if (q > 0) {
|
|
3532
|
-
var
|
|
3533
|
-
m += this._encodeByte(
|
|
3536
|
+
var D = p[y] << 16 | (q === 2 ? p[y + 1] << 8 : 0);
|
|
3537
|
+
m += this._encodeByte(D >>> 18 & 63), m += this._encodeByte(D >>> 12 & 63), q === 2 ? m += this._encodeByte(D >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
|
|
3534
3538
|
}
|
|
3535
3539
|
return m;
|
|
3536
|
-
},
|
|
3540
|
+
}, T.prototype.maxDecodedLength = function(p) {
|
|
3537
3541
|
return this._paddingCharacter ? p / 4 * 3 | 0 : (p * 6 + 7) / 8 | 0;
|
|
3538
|
-
},
|
|
3542
|
+
}, T.prototype.decodedLength = function(p) {
|
|
3539
3543
|
return this.maxDecodedLength(p.length - this._getPaddingLength(p));
|
|
3540
|
-
},
|
|
3544
|
+
}, T.prototype.decode = function(p) {
|
|
3541
3545
|
if (p.length === 0)
|
|
3542
3546
|
return new Uint8Array(0);
|
|
3543
|
-
for (var m = this._getPaddingLength(p), y = p.length - m,
|
|
3544
|
-
|
|
3545
|
-
if (
|
|
3547
|
+
for (var m = this._getPaddingLength(p), y = p.length - m, D = new Uint8Array(this.maxDecodedLength(y)), q = 0, X = 0, V = 0, ee = 0, W = 0, k = 0, I = 0; X < y - 4; X += 4)
|
|
3548
|
+
ee = this._decodeChar(p.charCodeAt(X + 0)), W = this._decodeChar(p.charCodeAt(X + 1)), k = this._decodeChar(p.charCodeAt(X + 2)), I = this._decodeChar(p.charCodeAt(X + 3)), D[q++] = ee << 2 | W >>> 4, D[q++] = W << 4 | k >>> 2, D[q++] = k << 6 | I, V |= ee & d, V |= W & d, V |= k & d, V |= I & d;
|
|
3549
|
+
if (X < y - 1 && (ee = this._decodeChar(p.charCodeAt(X)), W = this._decodeChar(p.charCodeAt(X + 1)), D[q++] = ee << 2 | W >>> 4, V |= ee & d, V |= W & d), X < y - 2 && (k = this._decodeChar(p.charCodeAt(X + 2)), D[q++] = W << 4 | k >>> 2, V |= k & d), X < y - 3 && (I = this._decodeChar(p.charCodeAt(X + 3)), D[q++] = k << 6 | I, V |= I & d), V !== 0)
|
|
3546
3550
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3547
|
-
return
|
|
3548
|
-
},
|
|
3551
|
+
return D;
|
|
3552
|
+
}, T.prototype._encodeByte = function(p) {
|
|
3549
3553
|
var m = p;
|
|
3550
3554
|
return m += 65, m += 25 - p >>> 8 & 6, m += 51 - p >>> 8 & -75, m += 61 - p >>> 8 & -15, m += 62 - p >>> 8 & 3, String.fromCharCode(m);
|
|
3551
|
-
},
|
|
3555
|
+
}, T.prototype._decodeChar = function(p) {
|
|
3552
3556
|
var m = d;
|
|
3553
3557
|
return m += (42 - p & p - 44) >>> 8 & -d + p - 43 + 62, m += (46 - p & p - 48) >>> 8 & -d + p - 47 + 63, m += (47 - p & p - 58) >>> 8 & -d + p - 48 + 52, m += (64 - p & p - 91) >>> 8 & -d + p - 65 + 0, m += (96 - p & p - 123) >>> 8 & -d + p - 97 + 26, m;
|
|
3554
|
-
},
|
|
3558
|
+
}, T.prototype._getPaddingLength = function(p) {
|
|
3555
3559
|
var m = 0;
|
|
3556
3560
|
if (this._paddingCharacter) {
|
|
3557
3561
|
for (var y = p.length - 1; y >= 0 && p[y] === this._paddingCharacter; y--)
|
|
@@ -3560,25 +3564,25 @@ function Oa() {
|
|
|
3560
3564
|
throw new Error("Base64Coder: incorrect padding");
|
|
3561
3565
|
}
|
|
3562
3566
|
return m;
|
|
3563
|
-
},
|
|
3567
|
+
}, T;
|
|
3564
3568
|
})()
|
|
3565
3569
|
);
|
|
3566
3570
|
o.Coder = f;
|
|
3567
3571
|
var h = new f();
|
|
3568
|
-
function
|
|
3569
|
-
return h.encode(
|
|
3572
|
+
function M(T) {
|
|
3573
|
+
return h.encode(T);
|
|
3570
3574
|
}
|
|
3571
|
-
o.encode =
|
|
3572
|
-
function
|
|
3573
|
-
return h.decode(
|
|
3575
|
+
o.encode = M;
|
|
3576
|
+
function w(T) {
|
|
3577
|
+
return h.decode(T);
|
|
3574
3578
|
}
|
|
3575
|
-
o.decode =
|
|
3579
|
+
o.decode = w;
|
|
3576
3580
|
var v = (
|
|
3577
3581
|
/** @class */
|
|
3578
|
-
(function(
|
|
3579
|
-
u(p,
|
|
3582
|
+
(function(T) {
|
|
3583
|
+
u(p, T);
|
|
3580
3584
|
function p() {
|
|
3581
|
-
return
|
|
3585
|
+
return T !== null && T.apply(this, arguments) || this;
|
|
3582
3586
|
}
|
|
3583
3587
|
return p.prototype._encodeByte = function(m) {
|
|
3584
3588
|
var y = m;
|
|
@@ -3590,20 +3594,20 @@ function Oa() {
|
|
|
3590
3594
|
})(f)
|
|
3591
3595
|
);
|
|
3592
3596
|
o.URLSafeCoder = v;
|
|
3593
|
-
var
|
|
3594
|
-
function b(
|
|
3595
|
-
return
|
|
3597
|
+
var E = new v();
|
|
3598
|
+
function b(T) {
|
|
3599
|
+
return E.encode(T);
|
|
3596
3600
|
}
|
|
3597
3601
|
o.encodeURLSafe = b;
|
|
3598
|
-
function
|
|
3599
|
-
return
|
|
3602
|
+
function A(T) {
|
|
3603
|
+
return E.decode(T);
|
|
3600
3604
|
}
|
|
3601
|
-
o.decodeURLSafe =
|
|
3602
|
-
return h.encodedLength(
|
|
3603
|
-
}, o.maxDecodedLength = function(
|
|
3604
|
-
return h.maxDecodedLength(
|
|
3605
|
-
}, o.decodedLength = function(
|
|
3606
|
-
return h.decodedLength(
|
|
3605
|
+
o.decodeURLSafe = A, o.encodedLength = function(T) {
|
|
3606
|
+
return h.encodedLength(T);
|
|
3607
|
+
}, o.maxDecodedLength = function(T) {
|
|
3608
|
+
return h.maxDecodedLength(T);
|
|
3609
|
+
}, o.decodedLength = function(T) {
|
|
3610
|
+
return h.decodedLength(T);
|
|
3607
3611
|
};
|
|
3608
3612
|
}),
|
|
3609
3613
|
/* 1 */
|
|
@@ -3611,17 +3615,17 @@ function Oa() {
|
|
|
3611
3615
|
(function(r, o, c) {
|
|
3612
3616
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3613
3617
|
var u = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3614
|
-
function f(
|
|
3615
|
-
for (var v = new Uint8Array(h(
|
|
3616
|
-
var
|
|
3617
|
-
|
|
3618
|
+
function f(w) {
|
|
3619
|
+
for (var v = new Uint8Array(h(w)), E = 0, b = 0; b < w.length; b++) {
|
|
3620
|
+
var A = w.charCodeAt(b);
|
|
3621
|
+
A < 128 ? v[E++] = A : A < 2048 ? (v[E++] = 192 | A >> 6, v[E++] = 128 | A & 63) : A < 55296 ? (v[E++] = 224 | A >> 12, v[E++] = 128 | A >> 6 & 63, v[E++] = 128 | A & 63) : (b++, A = (A & 1023) << 10, A |= w.charCodeAt(b) & 1023, A += 65536, v[E++] = 240 | A >> 18, v[E++] = 128 | A >> 12 & 63, v[E++] = 128 | A >> 6 & 63, v[E++] = 128 | A & 63);
|
|
3618
3622
|
}
|
|
3619
3623
|
return v;
|
|
3620
3624
|
}
|
|
3621
3625
|
o.encode = f;
|
|
3622
|
-
function h(
|
|
3623
|
-
for (var v = 0,
|
|
3624
|
-
var b =
|
|
3626
|
+
function h(w) {
|
|
3627
|
+
for (var v = 0, E = 0; E < w.length; E++) {
|
|
3628
|
+
var b = w.charCodeAt(E);
|
|
3625
3629
|
if (b < 128)
|
|
3626
3630
|
v += 1;
|
|
3627
3631
|
else if (b < 2048)
|
|
@@ -3629,44 +3633,44 @@ function Oa() {
|
|
|
3629
3633
|
else if (b < 55296)
|
|
3630
3634
|
v += 3;
|
|
3631
3635
|
else if (b <= 57343) {
|
|
3632
|
-
if (
|
|
3636
|
+
if (E >= w.length - 1)
|
|
3633
3637
|
throw new Error(u);
|
|
3634
|
-
|
|
3638
|
+
E++, v += 4;
|
|
3635
3639
|
} else
|
|
3636
3640
|
throw new Error(u);
|
|
3637
3641
|
}
|
|
3638
3642
|
return v;
|
|
3639
3643
|
}
|
|
3640
3644
|
o.encodedLength = h;
|
|
3641
|
-
function
|
|
3642
|
-
for (var v = [],
|
|
3643
|
-
var b =
|
|
3645
|
+
function M(w) {
|
|
3646
|
+
for (var v = [], E = 0; E < w.length; E++) {
|
|
3647
|
+
var b = w[E];
|
|
3644
3648
|
if (b & 128) {
|
|
3645
|
-
var
|
|
3649
|
+
var A = void 0;
|
|
3646
3650
|
if (b < 224) {
|
|
3647
|
-
if (
|
|
3651
|
+
if (E >= w.length)
|
|
3648
3652
|
throw new Error(d);
|
|
3649
|
-
var
|
|
3650
|
-
if ((
|
|
3653
|
+
var T = w[++E];
|
|
3654
|
+
if ((T & 192) !== 128)
|
|
3651
3655
|
throw new Error(d);
|
|
3652
|
-
b = (b & 31) << 6 |
|
|
3656
|
+
b = (b & 31) << 6 | T & 63, A = 128;
|
|
3653
3657
|
} else if (b < 240) {
|
|
3654
|
-
if (
|
|
3658
|
+
if (E >= w.length - 1)
|
|
3655
3659
|
throw new Error(d);
|
|
3656
|
-
var
|
|
3657
|
-
if ((
|
|
3660
|
+
var T = w[++E], p = w[++E];
|
|
3661
|
+
if ((T & 192) !== 128 || (p & 192) !== 128)
|
|
3658
3662
|
throw new Error(d);
|
|
3659
|
-
b = (b & 15) << 12 | (
|
|
3663
|
+
b = (b & 15) << 12 | (T & 63) << 6 | p & 63, A = 2048;
|
|
3660
3664
|
} else if (b < 248) {
|
|
3661
|
-
if (
|
|
3665
|
+
if (E >= w.length - 2)
|
|
3662
3666
|
throw new Error(d);
|
|
3663
|
-
var
|
|
3664
|
-
if ((
|
|
3667
|
+
var T = w[++E], p = w[++E], m = w[++E];
|
|
3668
|
+
if ((T & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
|
|
3665
3669
|
throw new Error(d);
|
|
3666
|
-
b = (b & 15) << 18 | (
|
|
3670
|
+
b = (b & 15) << 18 | (T & 63) << 12 | (p & 63) << 6 | m & 63, A = 65536;
|
|
3667
3671
|
} else
|
|
3668
3672
|
throw new Error(d);
|
|
3669
|
-
if (b <
|
|
3673
|
+
if (b < A || b >= 55296 && b <= 57343)
|
|
3670
3674
|
throw new Error(d);
|
|
3671
3675
|
if (b >= 65536) {
|
|
3672
3676
|
if (b > 1114111)
|
|
@@ -3678,7 +3682,7 @@ function Oa() {
|
|
|
3678
3682
|
}
|
|
3679
3683
|
return v.join("");
|
|
3680
3684
|
}
|
|
3681
|
-
o.decode =
|
|
3685
|
+
o.decode = M;
|
|
3682
3686
|
}),
|
|
3683
3687
|
/* 2 */
|
|
3684
3688
|
/***/
|
|
@@ -3695,10 +3699,10 @@ function Oa() {
|
|
|
3695
3699
|
}
|
|
3696
3700
|
create(t) {
|
|
3697
3701
|
this.lastId++;
|
|
3698
|
-
var s = this.lastId, a = this.prefix + s, l = this.name + "[" + s + "]", g = !1,
|
|
3702
|
+
var s = this.lastId, a = this.prefix + s, l = this.name + "[" + s + "]", g = !1, C = function() {
|
|
3699
3703
|
g || (t.apply(null, arguments), g = !0);
|
|
3700
3704
|
};
|
|
3701
|
-
return this[s] =
|
|
3705
|
+
return this[s] = C, { number: s, id: a, name: l, callback: C };
|
|
3702
3706
|
}
|
|
3703
3707
|
remove(t) {
|
|
3704
3708
|
delete this[t.number];
|
|
@@ -3732,7 +3736,7 @@ function Oa() {
|
|
|
3732
3736
|
cdn_https: "https://js.pusher.com",
|
|
3733
3737
|
dependency_suffix: ""
|
|
3734
3738
|
}, h = f;
|
|
3735
|
-
class
|
|
3739
|
+
class M {
|
|
3736
3740
|
constructor(t) {
|
|
3737
3741
|
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3738
3742
|
}
|
|
@@ -3742,17 +3746,17 @@ function Oa() {
|
|
|
3742
3746
|
l.loading[t].push(a);
|
|
3743
3747
|
else {
|
|
3744
3748
|
l.loading[t] = [a];
|
|
3745
|
-
var g = j.createScriptRequest(l.getPath(t, s)),
|
|
3746
|
-
if (l.receivers.remove(
|
|
3749
|
+
var g = j.createScriptRequest(l.getPath(t, s)), C = l.receivers.create(function(L) {
|
|
3750
|
+
if (l.receivers.remove(C), l.loading[t]) {
|
|
3747
3751
|
var z = l.loading[t];
|
|
3748
3752
|
delete l.loading[t];
|
|
3749
|
-
for (var
|
|
3750
|
-
|
|
3751
|
-
},
|
|
3752
|
-
z[
|
|
3753
|
+
for (var G = function(he) {
|
|
3754
|
+
he || g.cleanup();
|
|
3755
|
+
}, Z = 0; Z < z.length; Z++)
|
|
3756
|
+
z[Z](L, G);
|
|
3753
3757
|
}
|
|
3754
3758
|
});
|
|
3755
|
-
g.send(
|
|
3759
|
+
g.send(C);
|
|
3756
3760
|
}
|
|
3757
3761
|
}
|
|
3758
3762
|
getRoot(t) {
|
|
@@ -3763,14 +3767,14 @@ function Oa() {
|
|
|
3763
3767
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3764
3768
|
}
|
|
3765
3769
|
}
|
|
3766
|
-
var
|
|
3770
|
+
var w = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new M({
|
|
3767
3771
|
cdn_http: h.cdn_http,
|
|
3768
3772
|
cdn_https: h.cdn_https,
|
|
3769
3773
|
version: h.VERSION,
|
|
3770
3774
|
suffix: h.dependency_suffix,
|
|
3771
|
-
receivers:
|
|
3775
|
+
receivers: w
|
|
3772
3776
|
});
|
|
3773
|
-
const
|
|
3777
|
+
const E = {
|
|
3774
3778
|
baseUrl: "https://pusher.com",
|
|
3775
3779
|
urls: {
|
|
3776
3780
|
authenticationEndpoint: {
|
|
@@ -3790,16 +3794,16 @@ function Oa() {
|
|
|
3790
3794
|
}
|
|
3791
3795
|
}
|
|
3792
3796
|
};
|
|
3793
|
-
var
|
|
3794
|
-
const t = "See:", s =
|
|
3797
|
+
var A = { buildLogSuffix: function(i) {
|
|
3798
|
+
const t = "See:", s = E.urls[i];
|
|
3795
3799
|
if (!s)
|
|
3796
3800
|
return "";
|
|
3797
3801
|
let a;
|
|
3798
|
-
return s.fullUrl ? a = s.fullUrl : s.path && (a =
|
|
3799
|
-
} },
|
|
3802
|
+
return s.fullUrl ? a = s.fullUrl : s.path && (a = E.baseUrl + s.path), a ? `${t} ${a}` : "";
|
|
3803
|
+
} }, T;
|
|
3800
3804
|
(function(i) {
|
|
3801
3805
|
i.UserAuthentication = "user-authentication", i.ChannelAuthorization = "channel-authorization";
|
|
3802
|
-
})(
|
|
3806
|
+
})(T || (T = {}));
|
|
3803
3807
|
class p extends Error {
|
|
3804
3808
|
constructor(t) {
|
|
3805
3809
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -3815,7 +3819,7 @@ function Oa() {
|
|
|
3815
3819
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3816
3820
|
}
|
|
3817
3821
|
}
|
|
3818
|
-
class
|
|
3822
|
+
class D extends Error {
|
|
3819
3823
|
constructor(t) {
|
|
3820
3824
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3821
3825
|
}
|
|
@@ -3825,35 +3829,35 @@ function Oa() {
|
|
|
3825
3829
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3826
3830
|
}
|
|
3827
3831
|
}
|
|
3828
|
-
class
|
|
3832
|
+
class X extends Error {
|
|
3829
3833
|
constructor(t) {
|
|
3830
3834
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3831
3835
|
}
|
|
3832
3836
|
}
|
|
3833
|
-
class
|
|
3837
|
+
class V extends Error {
|
|
3834
3838
|
constructor(t) {
|
|
3835
3839
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3836
3840
|
}
|
|
3837
3841
|
}
|
|
3838
|
-
class
|
|
3842
|
+
class ee extends Error {
|
|
3839
3843
|
constructor(t) {
|
|
3840
3844
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3841
3845
|
}
|
|
3842
3846
|
}
|
|
3843
|
-
class
|
|
3847
|
+
class W extends Error {
|
|
3844
3848
|
constructor(t, s) {
|
|
3845
3849
|
super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
|
|
3846
3850
|
}
|
|
3847
3851
|
}
|
|
3848
|
-
var
|
|
3852
|
+
var I = function(i, t, s, a, l) {
|
|
3849
3853
|
const g = j.createXHR();
|
|
3850
3854
|
g.open("POST", s.endpoint, !0), g.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
3851
|
-
for (var
|
|
3852
|
-
g.setRequestHeader(
|
|
3855
|
+
for (var C in s.headers)
|
|
3856
|
+
g.setRequestHeader(C, s.headers[C]);
|
|
3853
3857
|
if (s.headersProvider != null) {
|
|
3854
3858
|
let L = s.headersProvider();
|
|
3855
|
-
for (var
|
|
3856
|
-
g.setRequestHeader(
|
|
3859
|
+
for (var C in L)
|
|
3860
|
+
g.setRequestHeader(C, L[C]);
|
|
3857
3861
|
}
|
|
3858
3862
|
return g.onreadystatechange = function() {
|
|
3859
3863
|
if (g.readyState === 4)
|
|
@@ -3862,30 +3866,30 @@ function Oa() {
|
|
|
3862
3866
|
try {
|
|
3863
3867
|
L = JSON.parse(g.responseText), z = !0;
|
|
3864
3868
|
} catch {
|
|
3865
|
-
l(new
|
|
3869
|
+
l(new W(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${g.responseText}`), null);
|
|
3866
3870
|
}
|
|
3867
3871
|
z && l(null, L);
|
|
3868
3872
|
} else {
|
|
3869
3873
|
let L = "";
|
|
3870
3874
|
switch (a) {
|
|
3871
|
-
case
|
|
3872
|
-
L =
|
|
3875
|
+
case T.UserAuthentication:
|
|
3876
|
+
L = A.buildLogSuffix("authenticationEndpoint");
|
|
3873
3877
|
break;
|
|
3874
|
-
case
|
|
3875
|
-
L = `Clients must be authorized to join private or presence channels. ${
|
|
3878
|
+
case T.ChannelAuthorization:
|
|
3879
|
+
L = `Clients must be authorized to join private or presence channels. ${A.buildLogSuffix("authorizationEndpoint")}`;
|
|
3876
3880
|
break;
|
|
3877
3881
|
}
|
|
3878
|
-
l(new
|
|
3882
|
+
l(new W(g.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${g.status} from ${s.endpoint}. ${L}`), null);
|
|
3879
3883
|
}
|
|
3880
3884
|
}, g.send(t), g;
|
|
3881
3885
|
};
|
|
3882
|
-
function
|
|
3883
|
-
return
|
|
3886
|
+
function re(i) {
|
|
3887
|
+
return H(oe(i));
|
|
3884
3888
|
}
|
|
3885
|
-
var
|
|
3889
|
+
var O = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", x = function(i) {
|
|
3886
3890
|
var t = i.charCodeAt(0);
|
|
3887
|
-
return t < 128 ? i : t < 2048 ?
|
|
3888
|
-
},
|
|
3891
|
+
return t < 128 ? i : t < 2048 ? O(192 | t >>> 6) + O(128 | t & 63) : O(224 | t >>> 12 & 15) + O(128 | t >>> 6 & 63) + O(128 | t & 63);
|
|
3892
|
+
}, oe = function(i) {
|
|
3889
3893
|
return i.replace(/[^\x00-\x7F]/g, x);
|
|
3890
3894
|
}, Se = function(i) {
|
|
3891
3895
|
var t = [0, 2, 1][i.length % 3], s = i.charCodeAt(0) << 16 | (i.length > 1 ? i.charCodeAt(1) : 0) << 8 | (i.length > 2 ? i.charCodeAt(2) : 0), a = [
|
|
@@ -3895,10 +3899,10 @@ function Oa() {
|
|
|
3895
3899
|
t >= 1 ? "=" : _.charAt(s & 63)
|
|
3896
3900
|
];
|
|
3897
3901
|
return a.join("");
|
|
3898
|
-
},
|
|
3902
|
+
}, H = window.btoa || function(i) {
|
|
3899
3903
|
return i.replace(/[\s\S]{1,3}/g, Se);
|
|
3900
3904
|
};
|
|
3901
|
-
class
|
|
3905
|
+
class Q {
|
|
3902
3906
|
constructor(t, s, a, l) {
|
|
3903
3907
|
this.clear = s, this.timer = t(() => {
|
|
3904
3908
|
this.timer && (this.timer = l(this.timer));
|
|
@@ -3911,33 +3915,33 @@ function Oa() {
|
|
|
3911
3915
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
3912
3916
|
}
|
|
3913
3917
|
}
|
|
3914
|
-
var
|
|
3915
|
-
function
|
|
3918
|
+
var te = Q;
|
|
3919
|
+
function J(i) {
|
|
3916
3920
|
window.clearTimeout(i);
|
|
3917
3921
|
}
|
|
3918
|
-
function
|
|
3922
|
+
function S(i) {
|
|
3919
3923
|
window.clearInterval(i);
|
|
3920
3924
|
}
|
|
3921
|
-
class
|
|
3925
|
+
class F extends te {
|
|
3922
3926
|
constructor(t, s) {
|
|
3923
|
-
super(setTimeout,
|
|
3927
|
+
super(setTimeout, J, t, function(a) {
|
|
3924
3928
|
return s(), null;
|
|
3925
3929
|
});
|
|
3926
3930
|
}
|
|
3927
3931
|
}
|
|
3928
|
-
class
|
|
3932
|
+
class Y extends te {
|
|
3929
3933
|
constructor(t, s) {
|
|
3930
|
-
super(setInterval,
|
|
3934
|
+
super(setInterval, S, t, function(a) {
|
|
3931
3935
|
return s(), a;
|
|
3932
3936
|
});
|
|
3933
3937
|
}
|
|
3934
3938
|
}
|
|
3935
|
-
var
|
|
3939
|
+
var pe = {
|
|
3936
3940
|
now() {
|
|
3937
3941
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3938
3942
|
},
|
|
3939
3943
|
defer(i) {
|
|
3940
|
-
return new
|
|
3944
|
+
return new F(0, i);
|
|
3941
3945
|
},
|
|
3942
3946
|
method(i, ...t) {
|
|
3943
3947
|
var s = Array.prototype.slice.call(arguments, 1);
|
|
@@ -3945,12 +3949,12 @@ function Oa() {
|
|
|
3945
3949
|
return a[i].apply(a, s.concat(arguments));
|
|
3946
3950
|
};
|
|
3947
3951
|
}
|
|
3948
|
-
},
|
|
3949
|
-
function
|
|
3952
|
+
}, ae = pe;
|
|
3953
|
+
function le(i, ...t) {
|
|
3950
3954
|
for (var s = 0; s < t.length; s++) {
|
|
3951
3955
|
var a = t[s];
|
|
3952
3956
|
for (var l in a)
|
|
3953
|
-
a[l] && a[l].constructor && a[l].constructor === Object ? i[l] =
|
|
3957
|
+
a[l] && a[l].constructor && a[l].constructor === Object ? i[l] = le(i[l] || {}, a[l]) : i[l] = a[l];
|
|
3954
3958
|
}
|
|
3955
3959
|
return i;
|
|
3956
3960
|
}
|
|
@@ -3974,13 +3978,13 @@ function Oa() {
|
|
|
3974
3978
|
for (var s in i)
|
|
3975
3979
|
Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
|
|
3976
3980
|
}
|
|
3977
|
-
function
|
|
3981
|
+
function R(i) {
|
|
3978
3982
|
var t = [];
|
|
3979
3983
|
return we(i, function(s, a) {
|
|
3980
3984
|
t.push(a);
|
|
3981
3985
|
}), t;
|
|
3982
3986
|
}
|
|
3983
|
-
function
|
|
3987
|
+
function P(i) {
|
|
3984
3988
|
var t = [];
|
|
3985
3989
|
return we(i, function(s) {
|
|
3986
3990
|
t.push(s);
|
|
@@ -3990,7 +3994,7 @@ function Oa() {
|
|
|
3990
3994
|
for (var a = 0; a < i.length; a++)
|
|
3991
3995
|
t.call(s || window, i[a], a, i);
|
|
3992
3996
|
}
|
|
3993
|
-
function
|
|
3997
|
+
function N(i, t) {
|
|
3994
3998
|
for (var s = [], a = 0; a < i.length; a++)
|
|
3995
3999
|
s.push(t(i[a], a, i, s));
|
|
3996
4000
|
return s;
|
|
@@ -4001,7 +4005,7 @@ function Oa() {
|
|
|
4001
4005
|
s[l] = t(a);
|
|
4002
4006
|
}), s;
|
|
4003
4007
|
}
|
|
4004
|
-
function
|
|
4008
|
+
function ce(i, t) {
|
|
4005
4009
|
t = t || function(l) {
|
|
4006
4010
|
return !!l;
|
|
4007
4011
|
};
|
|
@@ -4009,7 +4013,7 @@ function Oa() {
|
|
|
4009
4013
|
t(i[a], a, i, s) && s.push(i[a]);
|
|
4010
4014
|
return s;
|
|
4011
4015
|
}
|
|
4012
|
-
function
|
|
4016
|
+
function de(i, t) {
|
|
4013
4017
|
var s = {};
|
|
4014
4018
|
return we(i, function(a, l) {
|
|
4015
4019
|
(t && t(a, l, i, s) || a) && (s[l] = a);
|
|
@@ -4035,29 +4039,29 @@ function Oa() {
|
|
|
4035
4039
|
}
|
|
4036
4040
|
function Ee(i) {
|
|
4037
4041
|
return ne(i, function(t) {
|
|
4038
|
-
return typeof t == "object" && (t = et(t)), encodeURIComponent(
|
|
4042
|
+
return typeof t == "object" && (t = et(t)), encodeURIComponent(re(t.toString()));
|
|
4039
4043
|
});
|
|
4040
4044
|
}
|
|
4041
|
-
function
|
|
4042
|
-
var t =
|
|
4045
|
+
function me(i) {
|
|
4046
|
+
var t = de(i, function(a) {
|
|
4043
4047
|
return a !== void 0;
|
|
4044
|
-
}), s =
|
|
4048
|
+
}), s = N(Ce(Ee(t)), ae.method("join", "=")).join("&");
|
|
4045
4049
|
return s;
|
|
4046
4050
|
}
|
|
4047
4051
|
function be(i) {
|
|
4048
4052
|
var t = [], s = [];
|
|
4049
4053
|
return (function a(l, g) {
|
|
4050
|
-
var
|
|
4054
|
+
var C, L, z;
|
|
4051
4055
|
switch (typeof l) {
|
|
4052
4056
|
case "object":
|
|
4053
4057
|
if (!l)
|
|
4054
4058
|
return null;
|
|
4055
|
-
for (
|
|
4056
|
-
if (t[
|
|
4057
|
-
return { $ref: s[
|
|
4059
|
+
for (C = 0; C < t.length; C += 1)
|
|
4060
|
+
if (t[C] === l)
|
|
4061
|
+
return { $ref: s[C] };
|
|
4058
4062
|
if (t.push(l), s.push(g), Object.prototype.toString.apply(l) === "[object Array]")
|
|
4059
|
-
for (z = [],
|
|
4060
|
-
z[
|
|
4063
|
+
for (z = [], C = 0; C < l.length; C += 1)
|
|
4064
|
+
z[C] = a(l[C], g + "[" + C + "]");
|
|
4061
4065
|
else {
|
|
4062
4066
|
z = {};
|
|
4063
4067
|
for (L in l)
|
|
@@ -4104,18 +4108,18 @@ function Oa() {
|
|
|
4104
4108
|
Et.log ? Et.log(a) : Et.logToConsole && t.bind(this)(a);
|
|
4105
4109
|
}
|
|
4106
4110
|
}
|
|
4107
|
-
var
|
|
4108
|
-
(s.headers !== void 0 || s.headersProvider != null) &&
|
|
4111
|
+
var ue = new Hs(), Bs = function(i, t, s, a, l) {
|
|
4112
|
+
(s.headers !== void 0 || s.headersProvider != null) && ue.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
4109
4113
|
var g = i.nextAuthCallbackID.toString();
|
|
4110
4114
|
i.nextAuthCallbackID++;
|
|
4111
|
-
var
|
|
4112
|
-
i.auth_callbacks[g] = function(
|
|
4113
|
-
l(null,
|
|
4115
|
+
var C = i.getDocument(), L = C.createElement("script");
|
|
4116
|
+
i.auth_callbacks[g] = function(Z) {
|
|
4117
|
+
l(null, Z);
|
|
4114
4118
|
};
|
|
4115
4119
|
var z = "Pusher.auth_callbacks['" + g + "']";
|
|
4116
4120
|
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
4117
|
-
var
|
|
4118
|
-
|
|
4121
|
+
var G = C.getElementsByTagName("head")[0] || C.documentElement;
|
|
4122
|
+
G.insertBefore(L, G.firstChild);
|
|
4119
4123
|
}, Vs = Bs;
|
|
4120
4124
|
class Xs {
|
|
4121
4125
|
constructor(t) {
|
|
@@ -4143,7 +4147,7 @@ function Oa() {
|
|
|
4143
4147
|
}
|
|
4144
4148
|
send(t) {
|
|
4145
4149
|
if (!this.request) {
|
|
4146
|
-
var s =
|
|
4150
|
+
var s = me(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
4147
4151
|
this.request = j.createScriptRequest(a), this.request.send(t);
|
|
4148
4152
|
}
|
|
4149
4153
|
}
|
|
@@ -4153,10 +4157,10 @@ function Oa() {
|
|
|
4153
4157
|
}
|
|
4154
4158
|
var Gs = function(i, t) {
|
|
4155
4159
|
return function(s, a) {
|
|
4156
|
-
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path,
|
|
4157
|
-
d.remove(L),
|
|
4160
|
+
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, C = j.createJSONPRequest(g, s), L = j.ScriptReceivers.create(function(z, G) {
|
|
4161
|
+
d.remove(L), C.cleanup(), G && G.host && (i.host = G.host), a && a(z, G);
|
|
4158
4162
|
});
|
|
4159
|
-
|
|
4163
|
+
C.send(L);
|
|
4160
4164
|
};
|
|
4161
4165
|
}, Js = {
|
|
4162
4166
|
name: "jsonp",
|
|
@@ -4207,12 +4211,12 @@ function Oa() {
|
|
|
4207
4211
|
this._callbacks = {};
|
|
4208
4212
|
return;
|
|
4209
4213
|
}
|
|
4210
|
-
var l = t ? [vt(t)] :
|
|
4214
|
+
var l = t ? [vt(t)] : R(this._callbacks);
|
|
4211
4215
|
s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
|
|
4212
4216
|
}
|
|
4213
4217
|
removeCallback(t, s, a) {
|
|
4214
4218
|
U(t, function(l) {
|
|
4215
|
-
this._callbacks[l] =
|
|
4219
|
+
this._callbacks[l] = ce(this._callbacks[l] || [], function(g) {
|
|
4216
4220
|
return s && s !== g.fn || a && a !== g.context;
|
|
4217
4221
|
}), this._callbacks[l].length === 0 && delete this._callbacks[l];
|
|
4218
4222
|
}, this);
|
|
@@ -4240,7 +4244,7 @@ function Oa() {
|
|
|
4240
4244
|
return this.callbacks.remove(t, s, a), this;
|
|
4241
4245
|
}
|
|
4242
4246
|
unbind_global(t) {
|
|
4243
|
-
return t ? (this.global_callbacks =
|
|
4247
|
+
return t ? (this.global_callbacks = ce(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
|
|
4244
4248
|
}
|
|
4245
4249
|
unbind_all() {
|
|
4246
4250
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -4248,10 +4252,10 @@ function Oa() {
|
|
|
4248
4252
|
emit(t, s, a) {
|
|
4249
4253
|
for (var l = 0; l < this.global_callbacks.length; l++)
|
|
4250
4254
|
this.global_callbacks[l](t, s);
|
|
4251
|
-
var g = this.callbacks.get(t),
|
|
4252
|
-
if (a ?
|
|
4255
|
+
var g = this.callbacks.get(t), C = [];
|
|
4256
|
+
if (a ? C.push(s, a) : s && C.push(s), g && g.length > 0)
|
|
4253
4257
|
for (var l = 0; l < g.length; l++)
|
|
4254
|
-
g[l].fn.apply(g[l].context || window,
|
|
4258
|
+
g[l].fn.apply(g[l].context || window, C);
|
|
4255
4259
|
else this.failThrough && this.failThrough(t, s);
|
|
4256
4260
|
return this;
|
|
4257
4261
|
}
|
|
@@ -4273,17 +4277,17 @@ function Oa() {
|
|
|
4273
4277
|
try {
|
|
4274
4278
|
this.socket = this.hooks.getSocket(t, this.options);
|
|
4275
4279
|
} catch (s) {
|
|
4276
|
-
return
|
|
4280
|
+
return ae.defer(() => {
|
|
4277
4281
|
this.onError(s), this.changeState("closed");
|
|
4278
4282
|
}), !1;
|
|
4279
4283
|
}
|
|
4280
|
-
return this.bindListeners(),
|
|
4284
|
+
return this.bindListeners(), ue.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
|
|
4281
4285
|
}
|
|
4282
4286
|
close() {
|
|
4283
4287
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
4284
4288
|
}
|
|
4285
4289
|
send(t) {
|
|
4286
|
-
return this.state === "open" ? (
|
|
4290
|
+
return this.state === "open" ? (ae.defer(() => {
|
|
4287
4291
|
this.socket && this.socket.send(t);
|
|
4288
4292
|
}), !0) : !1;
|
|
4289
4293
|
}
|
|
@@ -4332,7 +4336,7 @@ function Oa() {
|
|
|
4332
4336
|
})), this.emit(t, s);
|
|
4333
4337
|
}
|
|
4334
4338
|
buildTimelineMessage(t) {
|
|
4335
|
-
return
|
|
4339
|
+
return le({ cid: this.id }, t);
|
|
4336
4340
|
}
|
|
4337
4341
|
}
|
|
4338
4342
|
class Ne {
|
|
@@ -4366,11 +4370,11 @@ function Oa() {
|
|
|
4366
4370
|
isInitialized: function() {
|
|
4367
4371
|
return !0;
|
|
4368
4372
|
}
|
|
4369
|
-
}, an =
|
|
4373
|
+
}, an = le({
|
|
4370
4374
|
getSocket: function(i) {
|
|
4371
4375
|
return j.HTTPFactory.createStreamingSocket(i);
|
|
4372
4376
|
}
|
|
4373
|
-
}, on), cn =
|
|
4377
|
+
}, on), cn = le({
|
|
4374
4378
|
getSocket: function(i) {
|
|
4375
4379
|
return j.HTTPFactory.createPollingSocket(i);
|
|
4376
4380
|
}
|
|
@@ -4378,7 +4382,7 @@ function Oa() {
|
|
|
4378
4382
|
isSupported: function() {
|
|
4379
4383
|
return j.isXHRSupported();
|
|
4380
4384
|
}
|
|
4381
|
-
}, sr = new Ne(
|
|
4385
|
+
}, sr = new Ne(le({}, an, un)), rr = new Ne(le({}, cn, un)), ir = {
|
|
4382
4386
|
ws: nr,
|
|
4383
4387
|
xhr_streaming: sr,
|
|
4384
4388
|
xhr_polling: rr
|
|
@@ -4411,7 +4415,7 @@ function Oa() {
|
|
|
4411
4415
|
var t = j.isXDRSupported(i.useTLS);
|
|
4412
4416
|
return t;
|
|
4413
4417
|
}
|
|
4414
|
-
}, ar = new Ne(
|
|
4418
|
+
}, ar = new Ne(le({}, an, ln)), cr = new Ne(le({}, cn, ln));
|
|
4415
4419
|
tt.xdr_streaming = ar, tt.xdr_polling = cr, tt.sockjs = or;
|
|
4416
4420
|
var ur = tt;
|
|
4417
4421
|
class lr extends Re {
|
|
@@ -4434,17 +4438,17 @@ function Oa() {
|
|
|
4434
4438
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4435
4439
|
}
|
|
4436
4440
|
createConnection(t, s, a, l) {
|
|
4437
|
-
l =
|
|
4441
|
+
l = le({}, l, {
|
|
4438
4442
|
activityTimeout: this.pingDelay
|
|
4439
4443
|
});
|
|
4440
|
-
var g = this.transport.createConnection(t, s, a, l),
|
|
4441
|
-
g.unbind("open", L), g.bind("closed", z),
|
|
4442
|
-
}, z = (
|
|
4443
|
-
if (g.unbind("closed", z),
|
|
4444
|
+
var g = this.transport.createConnection(t, s, a, l), C = null, L = function() {
|
|
4445
|
+
g.unbind("open", L), g.bind("closed", z), C = ae.now();
|
|
4446
|
+
}, z = (G) => {
|
|
4447
|
+
if (g.unbind("closed", z), G.code === 1002 || G.code === 1003)
|
|
4444
4448
|
this.manager.reportDeath();
|
|
4445
|
-
else if (!
|
|
4446
|
-
var
|
|
4447
|
-
|
|
4449
|
+
else if (!G.wasClean && C) {
|
|
4450
|
+
var Z = ae.now() - C;
|
|
4451
|
+
Z < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(Z / 2, this.minPingDelay));
|
|
4448
4452
|
}
|
|
4449
4453
|
};
|
|
4450
4454
|
return g.bind("open", L), g;
|
|
@@ -4520,7 +4524,7 @@ function Oa() {
|
|
|
4520
4524
|
}
|
|
4521
4525
|
send_event(t, s, a) {
|
|
4522
4526
|
var l = { event: t, data: s };
|
|
4523
|
-
return a && (l.channel = a),
|
|
4527
|
+
return a && (l.channel = a), ue.debug("Event sent", l), this.send(Ue.encodeMessage(l));
|
|
4524
4528
|
}
|
|
4525
4529
|
ping() {
|
|
4526
4530
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4542,7 +4546,7 @@ function Oa() {
|
|
|
4542
4546
|
});
|
|
4543
4547
|
}
|
|
4544
4548
|
if (l !== void 0) {
|
|
4545
|
-
switch (
|
|
4549
|
+
switch (ue.debug("Event recd", l), l.event) {
|
|
4546
4550
|
case "pusher:error":
|
|
4547
4551
|
this.emit("error", {
|
|
4548
4552
|
type: "PusherError",
|
|
@@ -4613,7 +4617,7 @@ function Oa() {
|
|
|
4613
4617
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
4614
4618
|
}
|
|
4615
4619
|
finish(t, s) {
|
|
4616
|
-
this.callback(
|
|
4620
|
+
this.callback(le({ transport: this.transport, action: t }, s));
|
|
4617
4621
|
}
|
|
4618
4622
|
}
|
|
4619
4623
|
class gr {
|
|
@@ -4627,7 +4631,7 @@ function Oa() {
|
|
|
4627
4631
|
class bt extends Re {
|
|
4628
4632
|
constructor(t, s) {
|
|
4629
4633
|
super(function(a, l) {
|
|
4630
|
-
|
|
4634
|
+
ue.debug("No callbacks on " + t + " for " + a);
|
|
4631
4635
|
}), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
4632
4636
|
}
|
|
4633
4637
|
authorize(t, s) {
|
|
@@ -4637,8 +4641,8 @@ function Oa() {
|
|
|
4637
4641
|
if (t.indexOf("client-") !== 0)
|
|
4638
4642
|
throw new p("Event '" + t + "' does not start with 'client-'");
|
|
4639
4643
|
if (!this.subscribed) {
|
|
4640
|
-
var a =
|
|
4641
|
-
|
|
4644
|
+
var a = A.buildLogSuffix("triggeringClientEvents");
|
|
4645
|
+
ue.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4642
4646
|
}
|
|
4643
4647
|
return this.pusher.send_event(t, s, this.name);
|
|
4644
4648
|
}
|
|
@@ -4664,10 +4668,10 @@ function Oa() {
|
|
|
4664
4668
|
}
|
|
4665
4669
|
subscribe() {
|
|
4666
4670
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (t, s) => {
|
|
4667
|
-
t ? (this.subscriptionPending = !1,
|
|
4671
|
+
t ? (this.subscriptionPending = !1, ue.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
4668
4672
|
type: "AuthError",
|
|
4669
4673
|
error: t.message
|
|
4670
|
-
}, t instanceof
|
|
4674
|
+
}, t instanceof W ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
4671
4675
|
auth: s.auth,
|
|
4672
4676
|
channel_data: s.channel_data,
|
|
4673
4677
|
channel: this.name
|
|
@@ -4728,29 +4732,29 @@ function Oa() {
|
|
|
4728
4732
|
}
|
|
4729
4733
|
var vr = function(i, t, s, a) {
|
|
4730
4734
|
function l(g) {
|
|
4731
|
-
return g instanceof s ? g : new s(function(
|
|
4732
|
-
|
|
4735
|
+
return g instanceof s ? g : new s(function(C) {
|
|
4736
|
+
C(g);
|
|
4733
4737
|
});
|
|
4734
4738
|
}
|
|
4735
|
-
return new (s || (s = Promise))(function(g,
|
|
4736
|
-
function L(
|
|
4739
|
+
return new (s || (s = Promise))(function(g, C) {
|
|
4740
|
+
function L(Z) {
|
|
4737
4741
|
try {
|
|
4738
|
-
|
|
4739
|
-
} catch (
|
|
4740
|
-
|
|
4742
|
+
G(a.next(Z));
|
|
4743
|
+
} catch (he) {
|
|
4744
|
+
C(he);
|
|
4741
4745
|
}
|
|
4742
4746
|
}
|
|
4743
|
-
function z(
|
|
4747
|
+
function z(Z) {
|
|
4744
4748
|
try {
|
|
4745
|
-
|
|
4746
|
-
} catch (
|
|
4747
|
-
|
|
4749
|
+
G(a.throw(Z));
|
|
4750
|
+
} catch (he) {
|
|
4751
|
+
C(he);
|
|
4748
4752
|
}
|
|
4749
4753
|
}
|
|
4750
|
-
function
|
|
4751
|
-
|
|
4754
|
+
function G(Z) {
|
|
4755
|
+
Z.done ? g(Z.value) : l(Z.value).then(L, z);
|
|
4752
4756
|
}
|
|
4753
|
-
|
|
4757
|
+
G((a = a.apply(i, t || [])).next());
|
|
4754
4758
|
});
|
|
4755
4759
|
};
|
|
4756
4760
|
class br extends yt {
|
|
@@ -4766,8 +4770,8 @@ function Oa() {
|
|
|
4766
4770
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4767
4771
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4768
4772
|
else {
|
|
4769
|
-
let
|
|
4770
|
-
|
|
4773
|
+
let C = A.buildLogSuffix("authorizationEndpoint");
|
|
4774
|
+
ue.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${C}, or the user should be signed in.`), s("Invalid auth response");
|
|
4771
4775
|
return;
|
|
4772
4776
|
}
|
|
4773
4777
|
s(a, l);
|
|
@@ -4828,7 +4832,7 @@ function Oa() {
|
|
|
4828
4832
|
});
|
|
4829
4833
|
}
|
|
4830
4834
|
trigger(t, s) {
|
|
4831
|
-
throw new
|
|
4835
|
+
throw new X("Client events are not currently supported for encrypted channels");
|
|
4832
4836
|
}
|
|
4833
4837
|
handleEvent(t) {
|
|
4834
4838
|
var s = t.event, a = t.data;
|
|
@@ -4840,32 +4844,32 @@ function Oa() {
|
|
|
4840
4844
|
}
|
|
4841
4845
|
handleEncryptedEvent(t, s) {
|
|
4842
4846
|
if (!this.key) {
|
|
4843
|
-
|
|
4847
|
+
ue.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
4844
4848
|
return;
|
|
4845
4849
|
}
|
|
4846
4850
|
if (!s.ciphertext || !s.nonce) {
|
|
4847
|
-
|
|
4851
|
+
ue.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4848
4852
|
return;
|
|
4849
4853
|
}
|
|
4850
4854
|
let a = Object(_t.decode)(s.ciphertext);
|
|
4851
4855
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4852
|
-
|
|
4856
|
+
ue.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4853
4857
|
return;
|
|
4854
4858
|
}
|
|
4855
4859
|
let l = Object(_t.decode)(s.nonce);
|
|
4856
4860
|
if (l.length < this.nacl.secretbox.nonceLength) {
|
|
4857
|
-
|
|
4861
|
+
ue.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
|
|
4858
4862
|
return;
|
|
4859
4863
|
}
|
|
4860
4864
|
let g = this.nacl.secretbox.open(a, l, this.key);
|
|
4861
4865
|
if (g === null) {
|
|
4862
|
-
|
|
4863
|
-
if (
|
|
4864
|
-
|
|
4866
|
+
ue.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, (C, L) => {
|
|
4867
|
+
if (C) {
|
|
4868
|
+
ue.error(`Failed to make a request to the authEndpoint: ${L}. Unable to fetch new key, so dropping encrypted event`);
|
|
4865
4869
|
return;
|
|
4866
4870
|
}
|
|
4867
4871
|
if (g = this.nacl.secretbox.open(a, l, this.key), g === null) {
|
|
4868
|
-
|
|
4872
|
+
ue.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
4869
4873
|
return;
|
|
4870
4874
|
}
|
|
4871
4875
|
this.emit(t, this.getDataToEmit(g));
|
|
@@ -4940,7 +4944,7 @@ function Oa() {
|
|
|
4940
4944
|
});
|
|
4941
4945
|
}
|
|
4942
4946
|
retryIn(t) {
|
|
4943
|
-
this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new
|
|
4947
|
+
this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new F(t || 0, () => {
|
|
4944
4948
|
this.disconnectInternally(), this.connect();
|
|
4945
4949
|
});
|
|
4946
4950
|
}
|
|
@@ -4948,7 +4952,7 @@ function Oa() {
|
|
|
4948
4952
|
this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
|
|
4949
4953
|
}
|
|
4950
4954
|
setUnavailableTimer() {
|
|
4951
|
-
this.unavailableTimer = new
|
|
4955
|
+
this.unavailableTimer = new F(this.options.unavailableTimeout, () => {
|
|
4952
4956
|
this.updateState("unavailable");
|
|
4953
4957
|
});
|
|
4954
4958
|
}
|
|
@@ -4956,12 +4960,12 @@ function Oa() {
|
|
|
4956
4960
|
this.unavailableTimer && this.unavailableTimer.ensureAborted();
|
|
4957
4961
|
}
|
|
4958
4962
|
sendActivityCheck() {
|
|
4959
|
-
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new
|
|
4963
|
+
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new F(this.options.pongTimeout, () => {
|
|
4960
4964
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
|
|
4961
4965
|
});
|
|
4962
4966
|
}
|
|
4963
4967
|
resetActivityCheck() {
|
|
4964
|
-
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new
|
|
4968
|
+
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new F(this.activityTimeout, () => {
|
|
4965
4969
|
this.sendActivityCheck();
|
|
4966
4970
|
}));
|
|
4967
4971
|
}
|
|
@@ -4969,7 +4973,7 @@ function Oa() {
|
|
|
4969
4973
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
4970
4974
|
}
|
|
4971
4975
|
buildConnectionCallbacks(t) {
|
|
4972
|
-
return
|
|
4976
|
+
return le({}, t, {
|
|
4973
4977
|
message: (s) => {
|
|
4974
4978
|
this.resetActivityCheck(), this.emit("message", s);
|
|
4975
4979
|
},
|
|
@@ -4988,7 +4992,7 @@ function Oa() {
|
|
|
4988
4992
|
});
|
|
4989
4993
|
}
|
|
4990
4994
|
buildHandshakeCallbacks(t) {
|
|
4991
|
-
return
|
|
4995
|
+
return le({}, t, {
|
|
4992
4996
|
connected: (s) => {
|
|
4993
4997
|
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 });
|
|
4994
4998
|
}
|
|
@@ -5032,7 +5036,7 @@ function Oa() {
|
|
|
5032
5036
|
var a = this.state;
|
|
5033
5037
|
if (this.state = t, a !== t) {
|
|
5034
5038
|
var l = t;
|
|
5035
|
-
l === "connected" && (l += " with new socket ID " + s.socket_id),
|
|
5039
|
+
l === "connected" && (l += " with new socket ID " + s.socket_id), ue.debug("State changed", a + " -> " + l), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
|
|
5036
5040
|
}
|
|
5037
5041
|
}
|
|
5038
5042
|
shouldRetry() {
|
|
@@ -5047,7 +5051,7 @@ function Oa() {
|
|
|
5047
5051
|
return this.channels[t] || (this.channels[t] = wr(t, s)), this.channels[t];
|
|
5048
5052
|
}
|
|
5049
5053
|
all() {
|
|
5050
|
-
return
|
|
5054
|
+
return P(this.channels);
|
|
5051
5055
|
}
|
|
5052
5056
|
find(t) {
|
|
5053
5057
|
return this.channels[t];
|
|
@@ -5066,8 +5070,8 @@ function Oa() {
|
|
|
5066
5070
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5067
5071
|
if (t.config.nacl)
|
|
5068
5072
|
return Ae.createEncryptedChannel(i, t, t.config.nacl);
|
|
5069
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
5070
|
-
throw new
|
|
5073
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = A.buildLogSuffix("encryptedChannelSupport");
|
|
5074
|
+
throw new X(`${s}. ${a}`);
|
|
5071
5075
|
} else {
|
|
5072
5076
|
if (i.indexOf("private-") === 0)
|
|
5073
5077
|
return Ae.createPrivateChannel(i, t);
|
|
@@ -5129,33 +5133,33 @@ function Oa() {
|
|
|
5129
5133
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
5130
5134
|
}
|
|
5131
5135
|
isSupported() {
|
|
5132
|
-
return Me(this.strategies,
|
|
5136
|
+
return Me(this.strategies, ae.method("isSupported"));
|
|
5133
5137
|
}
|
|
5134
5138
|
connect(t, s) {
|
|
5135
|
-
var a = this.strategies, l = 0, g = this.timeout,
|
|
5136
|
-
|
|
5139
|
+
var a = this.strategies, l = 0, g = this.timeout, C = null, L = (z, G) => {
|
|
5140
|
+
G ? s(null, G) : (l = l + 1, this.loop && (l = l % a.length), l < a.length ? (g && (g = g * 2, this.timeoutLimit && (g = Math.min(g, this.timeoutLimit))), C = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, L)) : s(!0));
|
|
5137
5141
|
};
|
|
5138
|
-
return
|
|
5142
|
+
return C = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, L), {
|
|
5139
5143
|
abort: function() {
|
|
5140
|
-
|
|
5144
|
+
C.abort();
|
|
5141
5145
|
},
|
|
5142
5146
|
forceMinPriority: function(z) {
|
|
5143
|
-
t = z,
|
|
5147
|
+
t = z, C && C.forceMinPriority(z);
|
|
5144
5148
|
}
|
|
5145
5149
|
};
|
|
5146
5150
|
}
|
|
5147
5151
|
tryStrategy(t, s, a, l) {
|
|
5148
|
-
var g = null,
|
|
5149
|
-
return a.timeout > 0 && (g = new
|
|
5150
|
-
|
|
5151
|
-
})),
|
|
5152
|
+
var g = null, C = null;
|
|
5153
|
+
return a.timeout > 0 && (g = new F(a.timeout, function() {
|
|
5154
|
+
C.abort(), l(!0);
|
|
5155
|
+
})), C = t.connect(s, function(L, z) {
|
|
5152
5156
|
L && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(L, z));
|
|
5153
5157
|
}), {
|
|
5154
5158
|
abort: function() {
|
|
5155
|
-
g && g.ensureAborted(),
|
|
5159
|
+
g && g.ensureAborted(), C.abort();
|
|
5156
5160
|
},
|
|
5157
5161
|
forceMinPriority: function(L) {
|
|
5158
|
-
|
|
5162
|
+
C.forceMinPriority(L);
|
|
5159
5163
|
}
|
|
5160
5164
|
};
|
|
5161
5165
|
}
|
|
@@ -5165,24 +5169,24 @@ function Oa() {
|
|
|
5165
5169
|
this.strategies = t;
|
|
5166
5170
|
}
|
|
5167
5171
|
isSupported() {
|
|
5168
|
-
return Me(this.strategies,
|
|
5172
|
+
return Me(this.strategies, ae.method("isSupported"));
|
|
5169
5173
|
}
|
|
5170
5174
|
connect(t, s) {
|
|
5171
5175
|
return Er(this.strategies, t, function(a, l) {
|
|
5172
|
-
return function(g,
|
|
5176
|
+
return function(g, C) {
|
|
5173
5177
|
if (l[a].error = g, g) {
|
|
5174
5178
|
Rr(l) && s(!0);
|
|
5175
5179
|
return;
|
|
5176
5180
|
}
|
|
5177
5181
|
U(l, function(L) {
|
|
5178
|
-
L.forceMinPriority(
|
|
5179
|
-
}), s(null,
|
|
5182
|
+
L.forceMinPriority(C.transport.priority);
|
|
5183
|
+
}), s(null, C);
|
|
5180
5184
|
};
|
|
5181
5185
|
});
|
|
5182
5186
|
}
|
|
5183
5187
|
}
|
|
5184
5188
|
function Er(i, t, s) {
|
|
5185
|
-
var a =
|
|
5189
|
+
var a = N(i, function(l, g, C, L) {
|
|
5186
5190
|
return l.connect(t, s(g, L));
|
|
5187
5191
|
});
|
|
5188
5192
|
return {
|
|
@@ -5212,27 +5216,27 @@ function Oa() {
|
|
|
5212
5216
|
return this.strategy.isSupported();
|
|
5213
5217
|
}
|
|
5214
5218
|
connect(t, s) {
|
|
5215
|
-
var a = this.usingTLS, l = Mr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0,
|
|
5216
|
-
if (l && l.timestamp + this.ttl >=
|
|
5219
|
+
var a = this.usingTLS, l = Mr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, C = [this.strategy];
|
|
5220
|
+
if (l && l.timestamp + this.ttl >= ae.now()) {
|
|
5217
5221
|
var L = this.transports[l.transport];
|
|
5218
5222
|
L && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
|
|
5219
5223
|
cached: !0,
|
|
5220
5224
|
transport: l.transport,
|
|
5221
5225
|
latency: l.latency
|
|
5222
|
-
}),
|
|
5226
|
+
}), C.push(new Oe([L], {
|
|
5223
5227
|
timeout: l.latency * 2 + 1e3,
|
|
5224
5228
|
failFast: !0
|
|
5225
5229
|
}))) : g++);
|
|
5226
5230
|
}
|
|
5227
|
-
var z =
|
|
5228
|
-
|
|
5231
|
+
var z = ae.now(), G = C.pop().connect(t, function Z(he, rt) {
|
|
5232
|
+
he ? (fn(a), C.length > 0 ? (z = ae.now(), G = C.pop().connect(t, Z)) : s(he)) : (kr(a, rt.transport.name, ae.now() - z, g), s(null, rt));
|
|
5229
5233
|
});
|
|
5230
5234
|
return {
|
|
5231
5235
|
abort: function() {
|
|
5232
|
-
|
|
5236
|
+
G.abort();
|
|
5233
5237
|
},
|
|
5234
|
-
forceMinPriority: function(
|
|
5235
|
-
t =
|
|
5238
|
+
forceMinPriority: function(Z) {
|
|
5239
|
+
t = Z, G && G.forceMinPriority(Z);
|
|
5236
5240
|
}
|
|
5237
5241
|
};
|
|
5238
5242
|
}
|
|
@@ -5257,7 +5261,7 @@ function Oa() {
|
|
|
5257
5261
|
if (l)
|
|
5258
5262
|
try {
|
|
5259
5263
|
l[Ct(i)] = et({
|
|
5260
|
-
timestamp:
|
|
5264
|
+
timestamp: ae.now(),
|
|
5261
5265
|
transport: t,
|
|
5262
5266
|
latency: s,
|
|
5263
5267
|
cacheSkipCount: a
|
|
@@ -5281,15 +5285,15 @@ function Oa() {
|
|
|
5281
5285
|
return this.strategy.isSupported();
|
|
5282
5286
|
}
|
|
5283
5287
|
connect(t, s) {
|
|
5284
|
-
var a = this.strategy, l, g = new
|
|
5288
|
+
var a = this.strategy, l, g = new F(this.options.delay, function() {
|
|
5285
5289
|
l = a.connect(t, s);
|
|
5286
5290
|
});
|
|
5287
5291
|
return {
|
|
5288
5292
|
abort: function() {
|
|
5289
5293
|
g.ensureAborted(), l && l.abort();
|
|
5290
5294
|
},
|
|
5291
|
-
forceMinPriority: function(
|
|
5292
|
-
t =
|
|
5295
|
+
forceMinPriority: function(C) {
|
|
5296
|
+
t = C, l && l.forceMinPriority(C);
|
|
5293
5297
|
}
|
|
5294
5298
|
};
|
|
5295
5299
|
}
|
|
@@ -5336,7 +5340,7 @@ function Oa() {
|
|
|
5336
5340
|
hostNonTLS: i.wsHost + ":" + i.wsPort,
|
|
5337
5341
|
hostTLS: i.wsHost + ":" + i.wssPort,
|
|
5338
5342
|
httpPath: i.wsPath
|
|
5339
|
-
}),
|
|
5343
|
+
}), C = Object.assign({}, g, {
|
|
5340
5344
|
useTLS: !0
|
|
5341
5345
|
}), L = Object.assign({}, t, {
|
|
5342
5346
|
hostNonTLS: i.httpHost + ":" + i.httpPort,
|
|
@@ -5346,14 +5350,14 @@ function Oa() {
|
|
|
5346
5350
|
loop: !0,
|
|
5347
5351
|
timeout: 15e3,
|
|
5348
5352
|
timeoutLimit: 6e4
|
|
5349
|
-
},
|
|
5353
|
+
}, G = new hn({
|
|
5350
5354
|
minPingDelay: 1e4,
|
|
5351
5355
|
maxPingDelay: i.activityTimeout
|
|
5352
|
-
}),
|
|
5356
|
+
}), Z = new hn({
|
|
5353
5357
|
lives: 2,
|
|
5354
5358
|
minPingDelay: 1e4,
|
|
5355
5359
|
maxPingDelay: i.activityTimeout
|
|
5356
|
-
}),
|
|
5360
|
+
}), he = l("ws", "ws", 3, g, G), rt = l("wss", "ws", 3, C, G), Ri = l("sockjs", "sockjs", 1, L), bn = l("xhr_streaming", "xhr_streaming", 1, L, Z), Ai = l("xdr_streaming", "xdr_streaming", 1, L, Z), yn = l("xhr_polling", "xhr_polling", 1, L), Pi = l("xdr_polling", "xdr_polling", 1, L), _n = new Oe([he], z), Mi = new Oe([rt], z), ki = new Oe([Ri], z), Sn = new Oe([
|
|
5357
5361
|
new je($e(bn), bn, Ai)
|
|
5358
5362
|
], z), Cn = new Oe([
|
|
5359
5363
|
new je($e(yn), yn, Pi)
|
|
@@ -5370,7 +5374,7 @@ function Oa() {
|
|
|
5370
5374
|
_n,
|
|
5371
5375
|
new nt(Mi, { delay: 2e3 }),
|
|
5372
5376
|
new nt(Rt, { delay: 5e3 })
|
|
5373
|
-
]), new Pr(new xr(new je($e(
|
|
5377
|
+
]), new Pr(new xr(new je($e(he), At, Rt)), a, {
|
|
5374
5378
|
ttl: 18e5,
|
|
5375
5379
|
timeline: t.timeline,
|
|
5376
5380
|
useTLS: t.useTLS
|
|
@@ -5517,7 +5521,7 @@ function Oa() {
|
|
|
5517
5521
|
try {
|
|
5518
5522
|
this.stream.start();
|
|
5519
5523
|
} catch (t) {
|
|
5520
|
-
|
|
5524
|
+
ae.defer(() => {
|
|
5521
5525
|
this.onError(t), this.onClose(1006, "Could not start streaming", !1);
|
|
5522
5526
|
});
|
|
5523
5527
|
}
|
|
@@ -5618,7 +5622,7 @@ function Oa() {
|
|
|
5618
5622
|
nextAuthCallbackID: 1,
|
|
5619
5623
|
auth_callbacks: {},
|
|
5620
5624
|
ScriptReceivers: d,
|
|
5621
|
-
DependenciesReceivers:
|
|
5625
|
+
DependenciesReceivers: w,
|
|
5622
5626
|
getDefaultStrategy: Ir,
|
|
5623
5627
|
Transports: ur,
|
|
5624
5628
|
transportConnectionInitializer: Ur,
|
|
@@ -5644,7 +5648,7 @@ function Oa() {
|
|
|
5644
5648
|
return this.getDocument().location.protocol;
|
|
5645
5649
|
},
|
|
5646
5650
|
getAuthorizers() {
|
|
5647
|
-
return { ajax:
|
|
5651
|
+
return { ajax: I, jsonp: Vs };
|
|
5648
5652
|
},
|
|
5649
5653
|
onDocumentBody(i) {
|
|
5650
5654
|
document.body ? i() : setTimeout(() => {
|
|
@@ -5717,7 +5721,7 @@ function Oa() {
|
|
|
5717
5721
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5718
5722
|
}
|
|
5719
5723
|
log(t, s) {
|
|
5720
|
-
t <= this.options.level && (this.events.push(
|
|
5724
|
+
t <= this.options.level && (this.events.push(le({}, s, { timestamp: ae.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5721
5725
|
}
|
|
5722
5726
|
error(t) {
|
|
5723
5727
|
this.log(st.ERROR, t);
|
|
@@ -5732,7 +5736,7 @@ function Oa() {
|
|
|
5732
5736
|
return this.events.length === 0;
|
|
5733
5737
|
}
|
|
5734
5738
|
send(t, s) {
|
|
5735
|
-
var a =
|
|
5739
|
+
var a = le({
|
|
5736
5740
|
session: this.session,
|
|
5737
5741
|
bundle: this.sent + 1,
|
|
5738
5742
|
key: this.key,
|
|
@@ -5762,35 +5766,35 @@ function Oa() {
|
|
|
5762
5766
|
connect(t, s) {
|
|
5763
5767
|
if (this.isSupported()) {
|
|
5764
5768
|
if (this.priority < t)
|
|
5765
|
-
return vn(new
|
|
5766
|
-
} else return vn(new
|
|
5767
|
-
var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null,
|
|
5768
|
-
l.unbind("initialized",
|
|
5769
|
+
return vn(new D(), s);
|
|
5770
|
+
} else return vn(new ee(), s);
|
|
5771
|
+
var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, C = function() {
|
|
5772
|
+
l.unbind("initialized", C), l.connect();
|
|
5769
5773
|
}, L = function() {
|
|
5770
|
-
g = Ae.createHandshake(l, function(
|
|
5771
|
-
a = !0,
|
|
5774
|
+
g = Ae.createHandshake(l, function(he) {
|
|
5775
|
+
a = !0, Z(), s(null, he);
|
|
5772
5776
|
});
|
|
5773
|
-
}, z = function(
|
|
5774
|
-
|
|
5775
|
-
},
|
|
5776
|
-
|
|
5777
|
-
var
|
|
5778
|
-
|
|
5779
|
-
},
|
|
5780
|
-
l.unbind("initialized",
|
|
5777
|
+
}, z = function(he) {
|
|
5778
|
+
Z(), s(he);
|
|
5779
|
+
}, G = function() {
|
|
5780
|
+
Z();
|
|
5781
|
+
var he;
|
|
5782
|
+
he = et(l), s(new q(he));
|
|
5783
|
+
}, Z = function() {
|
|
5784
|
+
l.unbind("initialized", C), l.unbind("open", L), l.unbind("error", z), l.unbind("closed", G);
|
|
5781
5785
|
};
|
|
5782
|
-
return l.bind("initialized",
|
|
5786
|
+
return l.bind("initialized", C), l.bind("open", L), l.bind("error", z), l.bind("closed", G), l.initialize(), {
|
|
5783
5787
|
abort: () => {
|
|
5784
|
-
a || (
|
|
5788
|
+
a || (Z(), g ? g.close() : l.close());
|
|
5785
5789
|
},
|
|
5786
|
-
forceMinPriority: (
|
|
5787
|
-
a || this.priority <
|
|
5790
|
+
forceMinPriority: (he) => {
|
|
5791
|
+
a || this.priority < he && (g ? g.close() : l.close());
|
|
5788
5792
|
}
|
|
5789
5793
|
};
|
|
5790
5794
|
}
|
|
5791
5795
|
}
|
|
5792
5796
|
function vn(i, t) {
|
|
5793
|
-
return
|
|
5797
|
+
return ae.defer(function() {
|
|
5794
5798
|
t(i);
|
|
5795
5799
|
}), {
|
|
5796
5800
|
abort: function() {
|
|
@@ -5801,18 +5805,18 @@ function Oa() {
|
|
|
5801
5805
|
}
|
|
5802
5806
|
const { Transports: si } = j;
|
|
5803
5807
|
var ri = function(i, t, s, a, l, g) {
|
|
5804
|
-
var
|
|
5805
|
-
if (!
|
|
5806
|
-
throw new
|
|
5808
|
+
var C = si[s];
|
|
5809
|
+
if (!C)
|
|
5810
|
+
throw new V(s);
|
|
5807
5811
|
var L = (!i.enabledTransports || Ye(i.enabledTransports, t) !== -1) && (!i.disabledTransports || Ye(i.disabledTransports, t) === -1), z;
|
|
5808
|
-
return L ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), z = new ni(t, a, g ? g.getAssistant(
|
|
5812
|
+
return L ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), z = new ni(t, a, g ? g.getAssistant(C) : C, l)) : z = ii, z;
|
|
5809
5813
|
}, ii = {
|
|
5810
5814
|
isSupported: function() {
|
|
5811
5815
|
return !1;
|
|
5812
5816
|
},
|
|
5813
5817
|
connect: function(i, t) {
|
|
5814
|
-
var s =
|
|
5815
|
-
t(new
|
|
5818
|
+
var s = ae.defer(function() {
|
|
5819
|
+
t(new ee());
|
|
5816
5820
|
});
|
|
5817
5821
|
return {
|
|
5818
5822
|
abort: function() {
|
|
@@ -5828,7 +5832,7 @@ function Oa() {
|
|
|
5828
5832
|
throw "You must pass an options object";
|
|
5829
5833
|
if (i.cluster == null)
|
|
5830
5834
|
throw "Options object must provide a cluster";
|
|
5831
|
-
"disableStats" in i &&
|
|
5835
|
+
"disableStats" in i && ue.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5832
5836
|
}
|
|
5833
5837
|
const ai = (i, t) => {
|
|
5834
5838
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
@@ -5846,7 +5850,7 @@ function Oa() {
|
|
|
5846
5850
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5847
5851
|
return (t, s) => {
|
|
5848
5852
|
const a = ai(t, i);
|
|
5849
|
-
j.getAuthorizers()[i.transport](j, a, i,
|
|
5853
|
+
j.getAuthorizers()[i.transport](j, a, i, T.UserAuthentication, s);
|
|
5850
5854
|
};
|
|
5851
5855
|
};
|
|
5852
5856
|
const ui = (i, t) => {
|
|
@@ -5866,7 +5870,7 @@ function Oa() {
|
|
|
5866
5870
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5867
5871
|
return (t, s) => {
|
|
5868
5872
|
const a = ui(t, i);
|
|
5869
|
-
j.getAuthorizers()[i.transport](j, a, i,
|
|
5873
|
+
j.getAuthorizers()[i.transport](j, a, i, T.ChannelAuthorization, s);
|
|
5870
5874
|
};
|
|
5871
5875
|
};
|
|
5872
5876
|
const di = (i, t, s) => {
|
|
@@ -5879,8 +5883,8 @@ function Oa() {
|
|
|
5879
5883
|
}
|
|
5880
5884
|
};
|
|
5881
5885
|
return (l, g) => {
|
|
5882
|
-
const
|
|
5883
|
-
s(
|
|
5886
|
+
const C = i.channel(l.channelName);
|
|
5887
|
+
s(C, a).authorize(l.socketId, g);
|
|
5884
5888
|
};
|
|
5885
5889
|
};
|
|
5886
5890
|
function hi(i, t) {
|
|
@@ -5938,7 +5942,7 @@ function Oa() {
|
|
|
5938
5942
|
class Si extends Re {
|
|
5939
5943
|
constructor(t) {
|
|
5940
5944
|
super(function(s, a) {
|
|
5941
|
-
|
|
5945
|
+
ue.debug(`No callbacks on watchlist events for ${s}`);
|
|
5942
5946
|
}), this.pusher = t, this.bindWatchlistInternalEvent();
|
|
5943
5947
|
}
|
|
5944
5948
|
handleEvent(t) {
|
|
@@ -5963,10 +5967,10 @@ function Oa() {
|
|
|
5963
5967
|
class Ti extends Re {
|
|
5964
5968
|
constructor(t) {
|
|
5965
5969
|
super(function(s, a) {
|
|
5966
|
-
|
|
5970
|
+
ue.debug("No callbacks on user for " + s);
|
|
5967
5971
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (s, a) => {
|
|
5968
5972
|
if (s) {
|
|
5969
|
-
|
|
5973
|
+
ue.warn(`Error during signin: ${s}`), this._cleanup();
|
|
5970
5974
|
return;
|
|
5971
5975
|
}
|
|
5972
5976
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -5992,11 +5996,11 @@ function Oa() {
|
|
|
5992
5996
|
try {
|
|
5993
5997
|
this.user_data = JSON.parse(t.user_data);
|
|
5994
5998
|
} catch {
|
|
5995
|
-
|
|
5999
|
+
ue.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
|
|
5996
6000
|
return;
|
|
5997
6001
|
}
|
|
5998
6002
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
5999
|
-
|
|
6003
|
+
ue.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
6000
6004
|
return;
|
|
6001
6005
|
}
|
|
6002
6006
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -6023,21 +6027,21 @@ function Oa() {
|
|
|
6023
6027
|
t.then(a).catch(a), this.signinDonePromise = t, this._signinDoneResolve = s;
|
|
6024
6028
|
}
|
|
6025
6029
|
}
|
|
6026
|
-
class
|
|
6030
|
+
class ve {
|
|
6027
6031
|
static ready() {
|
|
6028
|
-
|
|
6029
|
-
for (var t = 0, s =
|
|
6030
|
-
|
|
6032
|
+
ve.isReady = !0;
|
|
6033
|
+
for (var t = 0, s = ve.instances.length; t < s; t++)
|
|
6034
|
+
ve.instances[t].connect();
|
|
6031
6035
|
}
|
|
6032
6036
|
static getClientFeatures() {
|
|
6033
|
-
return
|
|
6037
|
+
return R(de({ ws: j.Transports.ws }, function(t) {
|
|
6034
6038
|
return t.isSupported({});
|
|
6035
6039
|
}));
|
|
6036
6040
|
}
|
|
6037
6041
|
constructor(t, s) {
|
|
6038
6042
|
Ei(t), oi(s), this.key = t, this.config = hi(s, this), this.channels = Ae.createChannels(), this.global_emitter = new Re(), this.sessionID = j.randomInt(1e9), this.timeline = new ti(this.key, this.sessionID, {
|
|
6039
6043
|
cluster: this.config.cluster,
|
|
6040
|
-
features:
|
|
6044
|
+
features: ve.getClientFeatures(),
|
|
6041
6045
|
params: this.config.timelineParams || {},
|
|
6042
6046
|
limit: 50,
|
|
6043
6047
|
level: st.INFO,
|
|
@@ -6057,19 +6061,19 @@ function Oa() {
|
|
|
6057
6061
|
}), this.connection.bind("connected", () => {
|
|
6058
6062
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
6059
6063
|
}), this.connection.bind("message", (l) => {
|
|
6060
|
-
var g = l.event,
|
|
6064
|
+
var g = l.event, C = g.indexOf("pusher_internal:") === 0;
|
|
6061
6065
|
if (l.channel) {
|
|
6062
6066
|
var L = this.channel(l.channel);
|
|
6063
6067
|
L && L.handleEvent(l);
|
|
6064
6068
|
}
|
|
6065
|
-
|
|
6069
|
+
C || this.global_emitter.emit(l.event, l.data);
|
|
6066
6070
|
}), this.connection.bind("connecting", () => {
|
|
6067
6071
|
this.channels.disconnect();
|
|
6068
6072
|
}), this.connection.bind("disconnected", () => {
|
|
6069
6073
|
this.channels.disconnect();
|
|
6070
6074
|
}), this.connection.bind("error", (l) => {
|
|
6071
|
-
|
|
6072
|
-
}),
|
|
6075
|
+
ue.warn(l);
|
|
6076
|
+
}), ve.instances.push(this), this.timeline.info({ instances: ve.instances.length }), this.user = new Ti(this), ve.isReady && this.connect();
|
|
6073
6077
|
}
|
|
6074
6078
|
channel(t) {
|
|
6075
6079
|
return this.channels.find(t);
|
|
@@ -6080,7 +6084,7 @@ function Oa() {
|
|
|
6080
6084
|
connect() {
|
|
6081
6085
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
6082
6086
|
var t = this.connection.isUsingTLS(), s = this.timelineSender;
|
|
6083
|
-
this.timelineSenderTimer = new
|
|
6087
|
+
this.timelineSenderTimer = new Y(6e4, function() {
|
|
6084
6088
|
s.send(t);
|
|
6085
6089
|
});
|
|
6086
6090
|
}
|
|
@@ -6126,13 +6130,13 @@ function Oa() {
|
|
|
6126
6130
|
this.user.signin();
|
|
6127
6131
|
}
|
|
6128
6132
|
}
|
|
6129
|
-
|
|
6130
|
-
var Et = o.default =
|
|
6133
|
+
ve.instances = [], ve.isReady = !1, ve.logToConsole = !1, ve.Runtime = j, ve.ScriptReceivers = j.ScriptReceivers, ve.DependenciesReceivers = j.DependenciesReceivers, ve.auth_callbacks = j.auth_callbacks;
|
|
6134
|
+
var Et = o.default = ve;
|
|
6131
6135
|
function Ei(i) {
|
|
6132
6136
|
if (i == null)
|
|
6133
6137
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
6134
6138
|
}
|
|
6135
|
-
j.setup(
|
|
6139
|
+
j.setup(ve);
|
|
6136
6140
|
})
|
|
6137
6141
|
/******/
|
|
6138
6142
|
])
|
|
@@ -6140,12 +6144,12 @@ function Oa() {
|
|
|
6140
6144
|
});
|
|
6141
6145
|
})(Ot)), Ot.exports;
|
|
6142
6146
|
}
|
|
6143
|
-
var
|
|
6144
|
-
const
|
|
6145
|
-
function
|
|
6147
|
+
var Da = Fa();
|
|
6148
|
+
const Na = /* @__PURE__ */ Oa(Da), qa = "/v1/messenger/bootstrap", za = 3e4, ja = 3e4, $a = 5 * 6e4;
|
|
6149
|
+
function ie(e) {
|
|
6146
6150
|
return typeof e == "object" && e !== null;
|
|
6147
6151
|
}
|
|
6148
|
-
function
|
|
6152
|
+
function ge(e, n) {
|
|
6149
6153
|
return typeof e[n] == "string";
|
|
6150
6154
|
}
|
|
6151
6155
|
function Te(e, n) {
|
|
@@ -6163,7 +6167,7 @@ function Xe(e, n) {
|
|
|
6163
6167
|
const o = r.trim();
|
|
6164
6168
|
return o === "" ? null : o;
|
|
6165
6169
|
}
|
|
6166
|
-
function
|
|
6170
|
+
function Ha(e, n) {
|
|
6167
6171
|
const r = e[n];
|
|
6168
6172
|
if (typeof r == "number" && Number.isFinite(r))
|
|
6169
6173
|
return r;
|
|
@@ -6174,24 +6178,24 @@ function $a(e, n) {
|
|
|
6174
6178
|
}
|
|
6175
6179
|
throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
|
|
6176
6180
|
}
|
|
6177
|
-
function
|
|
6181
|
+
function Ba(e) {
|
|
6178
6182
|
return e.toLowerCase() === "http" ? "http" : "https";
|
|
6179
6183
|
}
|
|
6180
|
-
function
|
|
6184
|
+
function Va(e) {
|
|
6181
6185
|
if (e !== null)
|
|
6182
6186
|
return e.startsWith("/") ? e : `/${e}`;
|
|
6183
6187
|
}
|
|
6184
|
-
function
|
|
6185
|
-
const n =
|
|
6186
|
-
if (!
|
|
6188
|
+
function Xa(e) {
|
|
6189
|
+
const n = ie(e) && ie(e.data) ? e.data : e;
|
|
6190
|
+
if (!ie(n))
|
|
6187
6191
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
6188
6192
|
const r = n.auth, o = n.service;
|
|
6189
|
-
if (!
|
|
6193
|
+
if (!ie(r) || !ie(o))
|
|
6190
6194
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
6191
6195
|
const c = r.user, u = o.reverb;
|
|
6192
|
-
if (!
|
|
6196
|
+
if (!ie(c) || !ie(u))
|
|
6193
6197
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
6194
|
-
const d =
|
|
6198
|
+
const d = Va(Xe(u, "path"));
|
|
6195
6199
|
return {
|
|
6196
6200
|
auth: {
|
|
6197
6201
|
token: Te(r, "token"),
|
|
@@ -6213,20 +6217,20 @@ function Va(e) {
|
|
|
6213
6217
|
reverb: {
|
|
6214
6218
|
appKey: Te(u, "app_key"),
|
|
6215
6219
|
host: Te(u, "host"),
|
|
6216
|
-
port:
|
|
6217
|
-
scheme:
|
|
6220
|
+
port: Ha(u, "port"),
|
|
6221
|
+
scheme: Ba(Te(u, "scheme")),
|
|
6218
6222
|
...d ? { path: d } : {}
|
|
6219
6223
|
}
|
|
6220
6224
|
}
|
|
6221
6225
|
};
|
|
6222
6226
|
}
|
|
6223
|
-
function
|
|
6227
|
+
function Wa(e) {
|
|
6224
6228
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
6225
6229
|
}
|
|
6226
|
-
function
|
|
6227
|
-
if (!
|
|
6230
|
+
function Ga(e) {
|
|
6231
|
+
if (!ie(e))
|
|
6228
6232
|
return !1;
|
|
6229
|
-
const n =
|
|
6233
|
+
const n = ie(e.response) ? e.response : null;
|
|
6230
6234
|
if (n?.status !== 403)
|
|
6231
6235
|
return !1;
|
|
6232
6236
|
const r = n.data;
|
|
@@ -6237,7 +6241,7 @@ function Kn(e, n) {
|
|
|
6237
6241
|
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"));
|
|
6238
6242
|
return;
|
|
6239
6243
|
}
|
|
6240
|
-
const r =
|
|
6244
|
+
const r = ie(e.headers) ? e.headers : {};
|
|
6241
6245
|
e.headers = new Rn({
|
|
6242
6246
|
...r,
|
|
6243
6247
|
Authorization: `Bearer ${n}`,
|
|
@@ -6252,16 +6256,16 @@ function Je(e, n, r) {
|
|
|
6252
6256
|
const c = e[r];
|
|
6253
6257
|
return typeof c == "string" && c.trim() !== "" ? c : null;
|
|
6254
6258
|
}
|
|
6255
|
-
function
|
|
6259
|
+
function Ja(e) {
|
|
6256
6260
|
if (typeof e != "string")
|
|
6257
6261
|
return null;
|
|
6258
6262
|
const n = e.trim().toLowerCase();
|
|
6259
6263
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
6260
6264
|
}
|
|
6261
|
-
function
|
|
6262
|
-
if (!
|
|
6265
|
+
function Ka(e, n) {
|
|
6266
|
+
if (!ie(e))
|
|
6263
6267
|
return null;
|
|
6264
|
-
const r = Je(e, "user_id", "userId"), o =
|
|
6268
|
+
const r = Je(e, "user_id", "userId"), o = Ja(e.status);
|
|
6265
6269
|
if (!r || !o)
|
|
6266
6270
|
return null;
|
|
6267
6271
|
const c = {
|
|
@@ -6275,12 +6279,12 @@ function Ja(e, n) {
|
|
|
6275
6279
|
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6276
6280
|
}
|
|
6277
6281
|
function Qn(e) {
|
|
6278
|
-
if (!
|
|
6282
|
+
if (!ie(e))
|
|
6279
6283
|
return null;
|
|
6280
6284
|
const n = Je(e, "user_id", "userId"), r = Je(e, "conversation_id", "conversationId");
|
|
6281
6285
|
if (!n || !r)
|
|
6282
6286
|
return null;
|
|
6283
|
-
const o = e.user, c =
|
|
6287
|
+
const o = e.user, c = ie(o) ? {
|
|
6284
6288
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
6285
6289
|
name: typeof o.name == "string" ? o.name : "",
|
|
6286
6290
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
@@ -6295,32 +6299,32 @@ function Qn(e) {
|
|
|
6295
6299
|
...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
|
|
6296
6300
|
};
|
|
6297
6301
|
}
|
|
6298
|
-
function Ka(e) {
|
|
6299
|
-
return oe(e) && pe(e, "id") && pe(e, "name");
|
|
6300
|
-
}
|
|
6301
6302
|
function Qa(e) {
|
|
6302
|
-
return
|
|
6303
|
+
return ie(e) && ge(e, "id") && ge(e, "name");
|
|
6304
|
+
}
|
|
6305
|
+
function Ya(e) {
|
|
6306
|
+
return !ie(e) || !ge(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Qa(n));
|
|
6303
6307
|
}
|
|
6304
6308
|
function Yn(e) {
|
|
6305
|
-
return
|
|
6309
|
+
return ie(e) && ie(e.message) && ge(e.message, "id") && ge(e.message, "conversation_id") && ge(e.message, "author_id");
|
|
6306
6310
|
}
|
|
6307
6311
|
function Zn(e) {
|
|
6308
|
-
return
|
|
6312
|
+
return ie(e) && ge(e, "conversation_id") && ge(e, "user_id") && ge(e, "message_id");
|
|
6309
6313
|
}
|
|
6310
6314
|
function es(e) {
|
|
6311
|
-
return
|
|
6315
|
+
return ie(e) && ge(e, "conversation_id") && ie(e.message) && ge(e.message, "id");
|
|
6312
6316
|
}
|
|
6313
6317
|
function ts(e) {
|
|
6314
|
-
return
|
|
6318
|
+
return ie(e) && ge(e, "conversation_id") && ge(e, "message_id");
|
|
6315
6319
|
}
|
|
6316
6320
|
function ns(e) {
|
|
6317
|
-
return
|
|
6321
|
+
return ie(e) && ge(e, "conversation_id") && ge(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Ya(n));
|
|
6318
6322
|
}
|
|
6319
6323
|
function ss(e) {
|
|
6320
|
-
return
|
|
6324
|
+
return ie(e) && ge(e, "conversation_id");
|
|
6321
6325
|
}
|
|
6322
6326
|
function rs(e) {
|
|
6323
|
-
return
|
|
6327
|
+
return ie(e) && ge(e, "conversation_id") && ge(e, "removed_user_id");
|
|
6324
6328
|
}
|
|
6325
6329
|
function De(e, n, r, o) {
|
|
6326
6330
|
const c = (u) => {
|
|
@@ -6328,110 +6332,110 @@ function De(e, n, r, o) {
|
|
|
6328
6332
|
};
|
|
6329
6333
|
return e.listen(n, c), c;
|
|
6330
6334
|
}
|
|
6331
|
-
function
|
|
6332
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ??
|
|
6333
|
-
typeof window < "u" && (window.Pusher =
|
|
6334
|
-
let d = null, f = null, h = null,
|
|
6335
|
-
const
|
|
6336
|
-
|
|
6337
|
-
for (const
|
|
6338
|
-
|
|
6339
|
-
}, y = (
|
|
6340
|
-
v =
|
|
6341
|
-
for (const
|
|
6342
|
-
|
|
6343
|
-
},
|
|
6335
|
+
function gc(e) {
|
|
6336
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? qa, o = e.bootstrapRefreshSkewMs ?? za, c = e.presenceFreshnessTtlMs ?? $a, u = (e.createLogger ?? en())("MessengerEcho");
|
|
6337
|
+
typeof window < "u" && (window.Pusher = Na);
|
|
6338
|
+
let d = null, f = null, h = null, M = null, w = "disconnected", v = "available", E = null, b = null;
|
|
6339
|
+
const A = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (R) => {
|
|
6340
|
+
w = R;
|
|
6341
|
+
for (const P of A)
|
|
6342
|
+
P(R);
|
|
6343
|
+
}, y = (R) => {
|
|
6344
|
+
v = R;
|
|
6345
|
+
for (const P of T)
|
|
6346
|
+
P(R);
|
|
6347
|
+
}, D = () => {
|
|
6344
6348
|
b !== null && (clearTimeout(b), b = null);
|
|
6345
|
-
}, q = (
|
|
6346
|
-
h !== null && (h.disconnect(), h = null),
|
|
6347
|
-
},
|
|
6348
|
-
|
|
6349
|
-
},
|
|
6349
|
+
}, q = (R = !0) => {
|
|
6350
|
+
h !== null && (h.disconnect(), h = null), M = null, R && m("disconnected");
|
|
6351
|
+
}, X = () => {
|
|
6352
|
+
D(), d = null, f = null, E = null, y("available"), q(), p.clear();
|
|
6353
|
+
}, V = () => {
|
|
6350
6354
|
if (!e.getSourceToken)
|
|
6351
6355
|
return null;
|
|
6352
|
-
const
|
|
6353
|
-
return
|
|
6354
|
-
},
|
|
6355
|
-
if (
|
|
6356
|
+
const R = e.getSourceToken();
|
|
6357
|
+
return R === null ? (X(), null) : (E !== null && E !== R && (D(), d = null, f = null, y("available"), q()), E = R, R);
|
|
6358
|
+
}, ee = (R) => {
|
|
6359
|
+
if (R === null)
|
|
6356
6360
|
return !1;
|
|
6357
|
-
if (
|
|
6358
|
-
return
|
|
6359
|
-
const
|
|
6360
|
-
return Number.isNaN(
|
|
6361
|
-
},
|
|
6362
|
-
if (
|
|
6361
|
+
if (R.auth.expiresAt === null)
|
|
6362
|
+
return R.auth.token !== "";
|
|
6363
|
+
const P = Date.parse(R.auth.expiresAt);
|
|
6364
|
+
return Number.isNaN(P) ? !1 : P - Date.now() > o;
|
|
6365
|
+
}, W = (R) => {
|
|
6366
|
+
if (D(), R.auth.expiresAt === null)
|
|
6363
6367
|
return;
|
|
6364
|
-
const
|
|
6365
|
-
if (Number.isNaN(
|
|
6368
|
+
const P = Date.parse(R.auth.expiresAt);
|
|
6369
|
+
if (Number.isNaN(P))
|
|
6366
6370
|
return;
|
|
6367
|
-
const U = Math.max(0,
|
|
6371
|
+
const U = Math.max(0, P - Date.now() - o);
|
|
6368
6372
|
b = setTimeout(() => {
|
|
6369
|
-
|
|
6373
|
+
I();
|
|
6370
6374
|
}, U);
|
|
6371
|
-
},
|
|
6375
|
+
}, k = async (R = !1) => e.getSourceToken && V() === null || !R && v === "account_suspended" ? null : !R && ee(d) ? d : !R && f !== null ? await f : (f = (async () => {
|
|
6372
6376
|
try {
|
|
6373
6377
|
const U = await e.bootstrapClient.get(
|
|
6374
6378
|
r,
|
|
6375
|
-
|
|
6376
|
-
),
|
|
6377
|
-
return d =
|
|
6379
|
+
R ? { params: { refresh: 1 } } : void 0
|
|
6380
|
+
), N = Xa(U.data);
|
|
6381
|
+
return d = N, y("available"), W(N), N;
|
|
6378
6382
|
} catch (U) {
|
|
6379
|
-
if (
|
|
6380
|
-
return d = null,
|
|
6383
|
+
if (Ga(U))
|
|
6384
|
+
return d = null, D(), y("account_suspended"), q(), m("disconnected"), null;
|
|
6381
6385
|
throw U;
|
|
6382
6386
|
}
|
|
6383
6387
|
})().finally(() => {
|
|
6384
6388
|
f = null;
|
|
6385
|
-
}), await f),
|
|
6386
|
-
const
|
|
6389
|
+
}), await f), I = async () => {
|
|
6390
|
+
const R = h !== null;
|
|
6387
6391
|
try {
|
|
6388
|
-
if (await
|
|
6392
|
+
if (await k(!0), !R)
|
|
6389
6393
|
return;
|
|
6390
|
-
q(!1), await
|
|
6391
|
-
} catch (
|
|
6392
|
-
u.warn("Failed to refresh messenger bootstrap",
|
|
6394
|
+
q(!1), await O(!0);
|
|
6395
|
+
} catch (P) {
|
|
6396
|
+
u.warn("Failed to refresh messenger bootstrap", P);
|
|
6393
6397
|
}
|
|
6394
|
-
},
|
|
6395
|
-
const
|
|
6396
|
-
if (!
|
|
6398
|
+
}, re = (R) => {
|
|
6399
|
+
const P = R.connector?.pusher?.connection;
|
|
6400
|
+
if (!P) {
|
|
6397
6401
|
u.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6398
6402
|
return;
|
|
6399
6403
|
}
|
|
6400
|
-
|
|
6404
|
+
P.bind("connecting", () => {
|
|
6401
6405
|
m("connecting");
|
|
6402
|
-
}),
|
|
6406
|
+
}), P.bind("connected", () => {
|
|
6403
6407
|
m("connected");
|
|
6404
|
-
}),
|
|
6408
|
+
}), P.bind("disconnected", () => {
|
|
6405
6409
|
m("disconnected");
|
|
6406
|
-
}),
|
|
6410
|
+
}), P.bind("unavailable", () => {
|
|
6407
6411
|
m("disconnected");
|
|
6408
|
-
}),
|
|
6412
|
+
}), P.bind("error", () => {
|
|
6409
6413
|
m("error");
|
|
6410
|
-
}),
|
|
6411
|
-
const
|
|
6412
|
-
if (
|
|
6414
|
+
}), P.bind("state_change", (U) => {
|
|
6415
|
+
const N = typeof U == "object" && U !== null && "current" in U && typeof U.current == "string" ? U.current : P.state;
|
|
6416
|
+
if (N === "connected") {
|
|
6413
6417
|
m("connected");
|
|
6414
6418
|
return;
|
|
6415
6419
|
}
|
|
6416
|
-
if (
|
|
6420
|
+
if (N === "connecting") {
|
|
6417
6421
|
m("connecting");
|
|
6418
6422
|
return;
|
|
6419
6423
|
}
|
|
6420
|
-
(
|
|
6421
|
-
}),
|
|
6422
|
-
},
|
|
6423
|
-
const U = await
|
|
6424
|
+
(N === "unavailable" || N === "failed" || N === "disconnected") && m("disconnected");
|
|
6425
|
+
}), P.state === "connected" && m("connected");
|
|
6426
|
+
}, O = async (R = !1) => !R && h !== null && ee(d) ? h : !R && M !== null ? await M : (M = (async () => {
|
|
6427
|
+
const U = await k(R);
|
|
6424
6428
|
if (U === null)
|
|
6425
6429
|
return null;
|
|
6426
6430
|
h !== null && q(!1);
|
|
6427
|
-
const
|
|
6431
|
+
const N = U.service.reverb.scheme === "https", ne = {
|
|
6428
6432
|
broadcaster: "reverb",
|
|
6429
6433
|
key: U.service.reverb.appKey,
|
|
6430
|
-
wsHost:
|
|
6434
|
+
wsHost: Wa(U.service.reverb.host),
|
|
6431
6435
|
wsPort: U.service.reverb.port,
|
|
6432
6436
|
wssPort: U.service.reverb.port,
|
|
6433
|
-
forceTLS:
|
|
6434
|
-
encrypted:
|
|
6437
|
+
forceTLS: N,
|
|
6438
|
+
encrypted: N,
|
|
6435
6439
|
disableStats: !0,
|
|
6436
6440
|
enabledTransports: ["ws", "wss"],
|
|
6437
6441
|
authEndpoint: U.service.broadcastingAuthUrl,
|
|
@@ -6442,59 +6446,59 @@ function pc(e) {
|
|
|
6442
6446
|
}
|
|
6443
6447
|
}
|
|
6444
6448
|
};
|
|
6445
|
-
return U.service.reverb.path && (ne.wsPath = U.service.reverb.path), h = new
|
|
6449
|
+
return U.service.reverb.path && (ne.wsPath = U.service.reverb.path), h = new Ua(ne), re(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6446
6450
|
})().finally(() => {
|
|
6447
|
-
|
|
6448
|
-
}), await
|
|
6449
|
-
timeout: e.requestTimeoutMs ??
|
|
6451
|
+
M = null;
|
|
6452
|
+
}), await M), _ = Ht.create({
|
|
6453
|
+
timeout: e.requestTimeoutMs ?? ja,
|
|
6450
6454
|
withCredentials: !1,
|
|
6451
6455
|
headers: {
|
|
6452
6456
|
Accept: "application/json",
|
|
6453
6457
|
"X-Requested-With": "XMLHttpRequest"
|
|
6454
6458
|
}
|
|
6455
6459
|
});
|
|
6456
|
-
_.interceptors.request.use(async (
|
|
6457
|
-
const
|
|
6458
|
-
if (
|
|
6460
|
+
_.interceptors.request.use(async (R) => {
|
|
6461
|
+
const P = await k();
|
|
6462
|
+
if (P === null)
|
|
6459
6463
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6460
|
-
return
|
|
6464
|
+
return R.baseURL = P.service.apiBaseUrl, Kn(R, P.auth.token), R;
|
|
6461
6465
|
}), _.interceptors.response.use(
|
|
6462
|
-
(
|
|
6463
|
-
async (
|
|
6464
|
-
const
|
|
6465
|
-
if (
|
|
6466
|
-
|
|
6467
|
-
const U = await
|
|
6466
|
+
(R) => R,
|
|
6467
|
+
async (R) => {
|
|
6468
|
+
const P = R.config;
|
|
6469
|
+
if (R.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6470
|
+
P._messengerRetry = !0;
|
|
6471
|
+
const U = await k(!0);
|
|
6468
6472
|
if (U !== null)
|
|
6469
|
-
return
|
|
6473
|
+
return P.baseURL = U.service.apiBaseUrl, Kn(P, U.auth.token), await _(P);
|
|
6470
6474
|
}
|
|
6471
|
-
return Promise.reject(
|
|
6475
|
+
return Promise.reject(R);
|
|
6472
6476
|
}
|
|
6473
6477
|
);
|
|
6474
|
-
const x = () => v === "account_suspended" ? null : h,
|
|
6475
|
-
|
|
6476
|
-
}), Se = (
|
|
6477
|
-
|
|
6478
|
-
}),
|
|
6479
|
-
const
|
|
6480
|
-
if (
|
|
6478
|
+
const x = () => v === "account_suspended" ? null : h, oe = (R) => (A.add(R), R(w), () => {
|
|
6479
|
+
A.delete(R);
|
|
6480
|
+
}), Se = (R) => (T.add(R), R(v), () => {
|
|
6481
|
+
T.delete(R);
|
|
6482
|
+
}), H = () => d?.auth.tenantId ?? "global", Q = (R) => {
|
|
6483
|
+
const P = Nt(R.ts)?.getTime() ?? Nt(R.last_seen_at)?.getTime() ?? null;
|
|
6484
|
+
if (P === null)
|
|
6481
6485
|
return !0;
|
|
6482
|
-
const U = `${
|
|
6483
|
-
if (
|
|
6486
|
+
const U = `${R.tenant_scope ?? "global"}:${R.user_id}`, N = p.get(U);
|
|
6487
|
+
if (N && P < N.timestampMs)
|
|
6484
6488
|
return !1;
|
|
6485
6489
|
const ne = Date.now();
|
|
6486
6490
|
p.set(U, {
|
|
6487
|
-
timestampMs:
|
|
6491
|
+
timestampMs: P,
|
|
6488
6492
|
seenAt: ne
|
|
6489
6493
|
});
|
|
6490
|
-
for (const [
|
|
6491
|
-
ne -
|
|
6494
|
+
for (const [ce, de] of p.entries())
|
|
6495
|
+
ne - de.seenAt > c && p.delete(ce);
|
|
6492
6496
|
return !0;
|
|
6493
|
-
},
|
|
6494
|
-
const
|
|
6495
|
-
if (!
|
|
6497
|
+
}, te = (R) => {
|
|
6498
|
+
const P = x();
|
|
6499
|
+
if (!P || typeof P.join != "function")
|
|
6496
6500
|
return;
|
|
6497
|
-
const U =
|
|
6501
|
+
const U = P.join(`online-users.${H()}`), N = [
|
|
6498
6502
|
".PresenceStatusChanged",
|
|
6499
6503
|
"PresenceStatusChanged",
|
|
6500
6504
|
".presence.status.changed",
|
|
@@ -6504,81 +6508,81 @@ function pc(e) {
|
|
|
6504
6508
|
".Modules\\Presence\\Events\\UserPresenceStatusChanged",
|
|
6505
6509
|
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6506
6510
|
];
|
|
6507
|
-
for (const ne of
|
|
6508
|
-
U.listen(ne, (
|
|
6509
|
-
const
|
|
6510
|
-
!
|
|
6511
|
+
for (const ne of N)
|
|
6512
|
+
U.listen(ne, (ce) => {
|
|
6513
|
+
const de = Ka(ce, H());
|
|
6514
|
+
!de || !Q(de) || R(de);
|
|
6511
6515
|
});
|
|
6512
|
-
},
|
|
6513
|
-
h?.leave(`online-users.${
|
|
6516
|
+
}, J = () => {
|
|
6517
|
+
h?.leave(`online-users.${H()}`);
|
|
6514
6518
|
};
|
|
6515
|
-
function
|
|
6519
|
+
function S(R, P) {
|
|
6516
6520
|
const U = [];
|
|
6517
|
-
function
|
|
6518
|
-
if (!
|
|
6521
|
+
function N(ne, ce, de) {
|
|
6522
|
+
if (!de)
|
|
6519
6523
|
return;
|
|
6520
6524
|
const Ce = (Me) => {
|
|
6521
|
-
|
|
6525
|
+
ce(Me) && de(Me);
|
|
6522
6526
|
};
|
|
6523
|
-
|
|
6527
|
+
R.bind(ne, Ce), U.push({ event: ne, handler: Ce });
|
|
6524
6528
|
}
|
|
6525
|
-
return
|
|
6529
|
+
return N("ConversationMessageSent", Yn, P.onMessageSent), N("ConversationMessageRead", Zn, P.onMessageRead), N("ConversationMessageEdited", es, P.onMessageEdited), N("ConversationMessageDeleted", ts, P.onMessageDeleted), N("MessageReactionToggled", ns, P.onReactionToggled), N("ConversationRequestAccepted", ss, P.onRequestAccepted), N("ConversationParticipantRemoved", rs, P.onParticipantRemoved), () => {
|
|
6526
6530
|
for (const ne of U)
|
|
6527
|
-
|
|
6531
|
+
R.unbind(ne.event, ne.handler);
|
|
6528
6532
|
};
|
|
6529
6533
|
}
|
|
6530
|
-
const
|
|
6534
|
+
const F = (R, P) => {
|
|
6531
6535
|
const U = x();
|
|
6532
6536
|
if (!U)
|
|
6533
6537
|
return () => {
|
|
6534
6538
|
};
|
|
6535
|
-
const
|
|
6539
|
+
const N = U.private(`conversation.${R}`), ne = N.subscription;
|
|
6536
6540
|
if (ne)
|
|
6537
|
-
return
|
|
6538
|
-
const
|
|
6539
|
-
return
|
|
6541
|
+
return S(ne, P);
|
|
6542
|
+
const ce = [];
|
|
6543
|
+
return P.onMessageSent && ce.push({
|
|
6540
6544
|
event: ".ConversationMessageSent",
|
|
6541
|
-
handler: De(
|
|
6542
|
-
}),
|
|
6545
|
+
handler: De(N, ".ConversationMessageSent", Yn, P.onMessageSent)
|
|
6546
|
+
}), P.onMessageRead && ce.push({
|
|
6543
6547
|
event: ".ConversationMessageRead",
|
|
6544
|
-
handler: De(
|
|
6545
|
-
}),
|
|
6548
|
+
handler: De(N, ".ConversationMessageRead", Zn, P.onMessageRead)
|
|
6549
|
+
}), P.onMessageEdited && ce.push({
|
|
6546
6550
|
event: ".ConversationMessageEdited",
|
|
6547
|
-
handler: De(
|
|
6548
|
-
}),
|
|
6551
|
+
handler: De(N, ".ConversationMessageEdited", es, P.onMessageEdited)
|
|
6552
|
+
}), P.onMessageDeleted && ce.push({
|
|
6549
6553
|
event: ".ConversationMessageDeleted",
|
|
6550
|
-
handler: De(
|
|
6551
|
-
}),
|
|
6554
|
+
handler: De(N, ".ConversationMessageDeleted", ts, P.onMessageDeleted)
|
|
6555
|
+
}), P.onReactionToggled && ce.push({
|
|
6552
6556
|
event: ".MessageReactionToggled",
|
|
6553
|
-
handler: De(
|
|
6554
|
-
}),
|
|
6557
|
+
handler: De(N, ".MessageReactionToggled", ns, P.onReactionToggled)
|
|
6558
|
+
}), P.onRequestAccepted && ce.push({
|
|
6555
6559
|
event: ".ConversationRequestAccepted",
|
|
6556
|
-
handler: De(
|
|
6557
|
-
}),
|
|
6560
|
+
handler: De(N, ".ConversationRequestAccepted", ss, P.onRequestAccepted)
|
|
6561
|
+
}), P.onParticipantRemoved && ce.push({
|
|
6558
6562
|
event: ".ConversationParticipantRemoved",
|
|
6559
|
-
handler: De(
|
|
6563
|
+
handler: De(N, ".ConversationParticipantRemoved", rs, P.onParticipantRemoved)
|
|
6560
6564
|
}), () => {
|
|
6561
|
-
if (typeof
|
|
6562
|
-
for (const
|
|
6563
|
-
|
|
6565
|
+
if (typeof N.stopListening == "function")
|
|
6566
|
+
for (const de of ce)
|
|
6567
|
+
N.stopListening(de.event, de.handler);
|
|
6564
6568
|
};
|
|
6565
|
-
},
|
|
6566
|
-
h?.leave(`conversation.${
|
|
6567
|
-
},
|
|
6568
|
-
if (
|
|
6569
|
-
return
|
|
6570
|
-
const
|
|
6571
|
-
if (!
|
|
6569
|
+
}, Y = (R) => {
|
|
6570
|
+
h?.leave(`conversation.${R}`);
|
|
6571
|
+
}, pe = (R, P, U) => {
|
|
6572
|
+
if (P.subscription)
|
|
6573
|
+
return P.subscription;
|
|
6574
|
+
const N = R.connector?.pusher;
|
|
6575
|
+
if (!N || typeof N.channel != "function")
|
|
6572
6576
|
return null;
|
|
6573
6577
|
const ne = U.startsWith("private-") ? U : `private-${U}`;
|
|
6574
|
-
return
|
|
6575
|
-
},
|
|
6576
|
-
const
|
|
6578
|
+
return N.channel(ne) ?? null;
|
|
6579
|
+
}, ae = (R, P, U) => {
|
|
6580
|
+
const N = `typing-conversation.${P}`, ne = R.private(N), ce = /* @__PURE__ */ new Set(["start", "typing"]), de = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), Ce = pe(R, ne, N);
|
|
6577
6581
|
if (Ce) {
|
|
6578
|
-
const Ee = (
|
|
6579
|
-
const be = Qn(
|
|
6582
|
+
const Ee = (me) => {
|
|
6583
|
+
const be = Qn(me);
|
|
6580
6584
|
if (be) {
|
|
6581
|
-
if (
|
|
6585
|
+
if (ce.has(be.state)) {
|
|
6582
6586
|
U.onTypingStart?.({
|
|
6583
6587
|
user_id: be.user_id,
|
|
6584
6588
|
user: be.user ?? {
|
|
@@ -6590,7 +6594,7 @@ function pc(e) {
|
|
|
6590
6594
|
});
|
|
6591
6595
|
return;
|
|
6592
6596
|
}
|
|
6593
|
-
|
|
6597
|
+
de.has(be.state) && U.onTypingStop?.({
|
|
6594
6598
|
user_id: be.user_id,
|
|
6595
6599
|
conversation_id: be.conversation_id,
|
|
6596
6600
|
stopped_at: be.stopped_at ?? be.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -6602,24 +6606,24 @@ function pc(e) {
|
|
|
6602
6606
|
};
|
|
6603
6607
|
}
|
|
6604
6608
|
const Me = [], Ze = (Ee) => {
|
|
6605
|
-
const
|
|
6606
|
-
if (
|
|
6607
|
-
if (
|
|
6609
|
+
const me = Qn(Ee);
|
|
6610
|
+
if (me) {
|
|
6611
|
+
if (ce.has(me.state)) {
|
|
6608
6612
|
U.onTypingStart?.({
|
|
6609
|
-
user_id:
|
|
6610
|
-
user:
|
|
6611
|
-
id:
|
|
6613
|
+
user_id: me.user_id,
|
|
6614
|
+
user: me.user ?? {
|
|
6615
|
+
id: me.user_id,
|
|
6612
6616
|
name: ""
|
|
6613
6617
|
},
|
|
6614
|
-
conversation_id:
|
|
6615
|
-
started_at:
|
|
6618
|
+
conversation_id: me.conversation_id,
|
|
6619
|
+
started_at: me.started_at ?? me.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6616
6620
|
});
|
|
6617
6621
|
return;
|
|
6618
6622
|
}
|
|
6619
|
-
|
|
6620
|
-
user_id:
|
|
6621
|
-
conversation_id:
|
|
6622
|
-
stopped_at:
|
|
6623
|
+
de.has(me.state) && U.onTypingStop?.({
|
|
6624
|
+
user_id: me.user_id,
|
|
6625
|
+
conversation_id: me.conversation_id,
|
|
6626
|
+
stopped_at: me.stopped_at ?? me.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6623
6627
|
});
|
|
6624
6628
|
}
|
|
6625
6629
|
};
|
|
@@ -6628,56 +6632,56 @@ function pc(e) {
|
|
|
6628
6632
|
for (const Ee of Me)
|
|
6629
6633
|
ne.stopListening(Ee.event, Ee.handler);
|
|
6630
6634
|
};
|
|
6631
|
-
},
|
|
6635
|
+
}, le = (R, P) => {
|
|
6632
6636
|
const U = x();
|
|
6633
6637
|
if (U)
|
|
6634
|
-
return
|
|
6635
|
-
let
|
|
6636
|
-
const
|
|
6637
|
-
|
|
6638
|
-
},
|
|
6639
|
-
|
|
6638
|
+
return ae(U, R, P);
|
|
6639
|
+
let N = !1, ne = null;
|
|
6640
|
+
const ce = (Ce) => {
|
|
6641
|
+
N || Ce && (ne = ae(Ce, R, P), typeof window < "u" && window.removeEventListener(n, de));
|
|
6642
|
+
}, de = () => {
|
|
6643
|
+
ce(x());
|
|
6640
6644
|
};
|
|
6641
|
-
return typeof window < "u" && window.addEventListener(n,
|
|
6642
|
-
|
|
6645
|
+
return typeof window < "u" && window.addEventListener(n, de), we().then((Ce) => {
|
|
6646
|
+
ce(Ce);
|
|
6643
6647
|
}), () => {
|
|
6644
|
-
|
|
6648
|
+
N = !0, typeof window < "u" && window.removeEventListener(n, de), ne?.();
|
|
6645
6649
|
};
|
|
6646
|
-
}, pt = (
|
|
6647
|
-
h?.leave(`typing-conversation.${
|
|
6650
|
+
}, pt = (R) => {
|
|
6651
|
+
h?.leave(`typing-conversation.${R}`);
|
|
6648
6652
|
}, Ye = async () => {
|
|
6649
|
-
y("available"), q(), await
|
|
6650
|
-
}, we = async () => v === "account_suspended" ? null : await
|
|
6653
|
+
y("available"), q(), await O(!0);
|
|
6654
|
+
}, we = async () => v === "account_suspended" ? null : await O();
|
|
6651
6655
|
return {
|
|
6652
6656
|
apiClient: _,
|
|
6653
6657
|
initializedEvent: n,
|
|
6654
6658
|
getEcho: x,
|
|
6655
6659
|
waitForEcho: we,
|
|
6656
|
-
getConnectionStatus: () =>
|
|
6660
|
+
getConnectionStatus: () => w,
|
|
6657
6661
|
getAccessState: () => v,
|
|
6658
|
-
onConnectionStatusChange:
|
|
6662
|
+
onConnectionStatusChange: oe,
|
|
6659
6663
|
onAccessStateChange: Se,
|
|
6660
6664
|
reconnect: Ye,
|
|
6661
|
-
subscribeToPresenceStatus:
|
|
6662
|
-
unsubscribeFromPresenceStatus:
|
|
6663
|
-
subscribeToConversation:
|
|
6664
|
-
unsubscribeFromConversation:
|
|
6665
|
-
subscribeToTyping:
|
|
6665
|
+
subscribeToPresenceStatus: te,
|
|
6666
|
+
unsubscribeFromPresenceStatus: J,
|
|
6667
|
+
subscribeToConversation: F,
|
|
6668
|
+
unsubscribeFromConversation: Y,
|
|
6669
|
+
subscribeToTyping: le,
|
|
6666
6670
|
unsubscribeFromTyping: pt,
|
|
6667
|
-
clearRuntime:
|
|
6671
|
+
clearRuntime: X
|
|
6668
6672
|
};
|
|
6669
6673
|
}
|
|
6670
6674
|
export {
|
|
6671
6675
|
fo as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6676
|
+
fc as configureMessengerClient,
|
|
6677
|
+
gc as createMessengerEcho,
|
|
6678
|
+
B as getApi,
|
|
6675
6679
|
Le as getAuthStore,
|
|
6676
6680
|
An as getConnectionStatus,
|
|
6677
6681
|
Pe as getEcho,
|
|
6678
6682
|
vs as getEchoConnectionStatus,
|
|
6679
6683
|
Ke as getEchoInitializedEvent,
|
|
6680
|
-
|
|
6684
|
+
K as getErrorMessage,
|
|
6681
6685
|
en as getLoggerFactory,
|
|
6682
6686
|
Xt as getMainApi,
|
|
6683
6687
|
jo as getMainEcho,
|
|
@@ -6685,11 +6689,11 @@ export {
|
|
|
6685
6689
|
zo as getMainEchoInitializedEvent,
|
|
6686
6690
|
ao as getMediaApi,
|
|
6687
6691
|
Ft as getMessagingAccessState,
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6692
|
+
oa as getPresenceRuntimeConfig,
|
|
6693
|
+
ua as hasConfiguredPresenceAuthTokenResolver,
|
|
6694
|
+
oc as hasResponse,
|
|
6695
|
+
bc as isAxiosError,
|
|
6696
|
+
ic as isError,
|
|
6693
6697
|
Yi as isValidMessageDeletedEvent,
|
|
6694
6698
|
Qi as isValidMessageEditedEvent,
|
|
6695
6699
|
Ki as isValidMessageReadEvent,
|
|
@@ -6712,8 +6716,8 @@ export {
|
|
|
6712
6716
|
no as resetMessagingApiClient,
|
|
6713
6717
|
oo as resetMessagingAuthStoreResolver,
|
|
6714
6718
|
uo as resetMessagingMediaApi,
|
|
6715
|
-
|
|
6716
|
-
|
|
6719
|
+
pc as resetMessengerClientConfig,
|
|
6720
|
+
ca as resetPresenceRuntimeConfig,
|
|
6717
6721
|
mo as resolveFreshPresenceStatus,
|
|
6718
6722
|
qt as resolvePresenceSnapshot,
|
|
6719
6723
|
Wi as setEchoRuntimeConfig,
|
|
@@ -6723,19 +6727,19 @@ export {
|
|
|
6723
6727
|
to as setMessagingApiClient,
|
|
6724
6728
|
io as setMessagingAuthStoreResolver,
|
|
6725
6729
|
co as setMessagingMediaApi,
|
|
6726
|
-
|
|
6730
|
+
aa as setPresenceRuntimeConfig,
|
|
6727
6731
|
Hi as subscribeToConversation,
|
|
6728
6732
|
ji as subscribeToPresenceStatus,
|
|
6729
6733
|
Vi as subscribeToTyping,
|
|
6730
6734
|
Bi as unsubscribeFromConversation,
|
|
6731
6735
|
$i as unsubscribeFromPresenceStatus,
|
|
6732
6736
|
Xi as unsubscribeFromTyping,
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
+
cc as useConnectionStatus,
|
|
6738
|
+
ac as useConversationChannel,
|
|
6739
|
+
uc as useGlobalMessaging,
|
|
6740
|
+
lc as useMessagingAccessState,
|
|
6737
6741
|
Yt as useMessagingStore,
|
|
6738
|
-
|
|
6739
|
-
|
|
6742
|
+
dc as usePresence,
|
|
6743
|
+
hc as useTypingChannel,
|
|
6740
6744
|
ms as waitForEcho
|
|
6741
6745
|
};
|