@codingfactory/messenger-client 0.2.32 → 0.2.33
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 +159 -159
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ const rs = () => () => {
|
|
|
29
29
|
unsubscribeFromConversation: us,
|
|
30
30
|
subscribeToTyping: hs,
|
|
31
31
|
unsubscribeFromTyping: ls
|
|
32
|
-
}, Je = () => $.ECHO_INITIALIZED_EVENT,
|
|
32
|
+
}, Je = () => $.ECHO_INITIALIZED_EVENT, Re = () => $.getEcho(), ps = async () => $.waitForEcho(), gs = () => $.getConnectionStatus(), En = () => gs(), It = () => $.getAccessState(), lt = (e) => $.onConnectionStatusChange(e), qi = (e) => $.onAccessStateChange(e), zi = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
34
|
}, ji = (e) => $.subscribeToPresenceStatus(e), $i = () => $.unsubscribeFromPresenceStatus(), Hi = (e, n) => $.subscribeToConversation(e, n), Bi = (e) => $.unsubscribeFromConversation(e), Vi = (e, n) => $.subscribeToTyping(e, n), Xi = (e) => $.unsubscribeFromTyping(e);
|
|
35
35
|
function Wi(e) {
|
|
@@ -137,7 +137,7 @@ function nt(e, n) {
|
|
|
137
137
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
138
138
|
return r;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Rn(e, n) {
|
|
141
141
|
const r = e[n];
|
|
142
142
|
if (r == null)
|
|
143
143
|
return null;
|
|
@@ -162,8 +162,8 @@ function Ut(e) {
|
|
|
162
162
|
return {
|
|
163
163
|
id: nt(e, "id"),
|
|
164
164
|
name: nt(e, "name"),
|
|
165
|
-
color:
|
|
166
|
-
icon:
|
|
165
|
+
color: Rn(e, "color"),
|
|
166
|
+
icon: Rn(e, "icon"),
|
|
167
167
|
sort_order: Et(e, "sort_order"),
|
|
168
168
|
conversation_count: Et(e, "conversation_count"),
|
|
169
169
|
unread_count: Et(e, "unread_count"),
|
|
@@ -176,7 +176,7 @@ function ho(e) {
|
|
|
176
176
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
177
177
|
return e.map((n) => Ut(n));
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function An(e) {
|
|
180
180
|
if (!lo(e))
|
|
181
181
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
182
182
|
return e;
|
|
@@ -204,11 +204,11 @@ const Pe = {
|
|
|
204
204
|
const r = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
205
205
|
folder_id: n
|
|
206
206
|
});
|
|
207
|
-
return
|
|
207
|
+
return An($e(r.data));
|
|
208
208
|
},
|
|
209
209
|
async acceptRequest(e) {
|
|
210
210
|
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
211
|
-
return
|
|
211
|
+
return An($e(n.data));
|
|
212
212
|
},
|
|
213
213
|
async declineRequest(e) {
|
|
214
214
|
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
@@ -314,14 +314,14 @@ function To(e, n, r) {
|
|
|
314
314
|
function Eo(e) {
|
|
315
315
|
const n = e.url || "", r = e.thumbnail_url ?? e.thumbnail, o = {
|
|
316
316
|
id: e.media_id ?? e.id ?? "",
|
|
317
|
-
name: e.name ??
|
|
317
|
+
name: e.name ?? Ro(n),
|
|
318
318
|
url: n,
|
|
319
319
|
type: To(e.mime, e.mime_type, e.type),
|
|
320
320
|
size: e.size ?? 0
|
|
321
321
|
};
|
|
322
322
|
return r !== void 0 && (o.thumbnail = r), o;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Ro(e) {
|
|
325
325
|
if (!e) return "attachment";
|
|
326
326
|
try {
|
|
327
327
|
const r = new URL(e).pathname.split("/");
|
|
@@ -330,7 +330,7 @@ function Ao(e) {
|
|
|
330
330
|
return "attachment";
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Ao(e) {
|
|
334
334
|
return !Array.isArray(e) || e.length === 0 ? [] : e.map(Eo);
|
|
335
335
|
}
|
|
336
336
|
function Ne(e) {
|
|
@@ -369,7 +369,7 @@ function at(e) {
|
|
|
369
369
|
...e,
|
|
370
370
|
...r ? { author: Po(r) } : {},
|
|
371
371
|
shared_post: o,
|
|
372
|
-
attachments:
|
|
372
|
+
attachments: Ao(e.attachments)
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
function Mo(e) {
|
|
@@ -378,7 +378,7 @@ function Mo(e) {
|
|
|
378
378
|
const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
379
379
|
if (n.length === 0 || r.length === 0 || o.length === 0)
|
|
380
380
|
return;
|
|
381
|
-
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "",
|
|
381
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", A = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
|
|
382
382
|
return {
|
|
383
383
|
id: n,
|
|
384
384
|
title: r,
|
|
@@ -389,13 +389,13 @@ function Mo(e) {
|
|
|
389
389
|
author: {
|
|
390
390
|
id: f,
|
|
391
391
|
name: h,
|
|
392
|
-
...
|
|
392
|
+
...A ? { avatar: A } : {},
|
|
393
393
|
...C ? { handle: C } : {}
|
|
394
394
|
}
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Rt(e) {
|
|
399
399
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
400
400
|
}
|
|
401
401
|
function In(e) {
|
|
@@ -443,13 +443,13 @@ function ko(e, n = []) {
|
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
function xo(e, n) {
|
|
446
|
-
return Object.prototype.hasOwnProperty.call(e, "muted_until") ?
|
|
446
|
+
return Object.prototype.hasOwnProperty.call(e, "muted_until") ? Rt(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? Rt(e.me.muted_until) : Rt(n?.muted_until);
|
|
447
447
|
}
|
|
448
448
|
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 He(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 ? at(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 ? at(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, A = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
|
|
453
453
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
454
454
|
return !1;
|
|
455
455
|
const E = n.last_message?.id, b = e.last_message?.id;
|
|
@@ -463,7 +463,7 @@ function He(e, n) {
|
|
|
463
463
|
muted_until: r,
|
|
464
464
|
is_pinned: f,
|
|
465
465
|
is_archived: h,
|
|
466
|
-
folder_id:
|
|
466
|
+
folder_id: A,
|
|
467
467
|
created_at: C,
|
|
468
468
|
...c ? { last_message: c } : {},
|
|
469
469
|
...u ? { last_message_at: u } : {}
|
|
@@ -472,7 +472,7 @@ function He(e, n) {
|
|
|
472
472
|
function Io(e) {
|
|
473
473
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function At(e) {
|
|
476
476
|
return Io(e) ? 0 : e.unread_count || 0;
|
|
477
477
|
}
|
|
478
478
|
function Un(e, n) {
|
|
@@ -713,9 +713,9 @@ const Jt = Oi("messaging", {
|
|
|
713
713
|
},
|
|
714
714
|
getMessagesByConversationId: (e) => (n) => e.messages[n] || [],
|
|
715
715
|
getTypingUsers: (e) => (n) => e.typingUsers[n] || [],
|
|
716
|
-
unreadConversationsCount: (e) => e.conversations.filter((n) =>
|
|
717
|
-
unreadCount: (e) => e.conversations.reduce((n, r) => n +
|
|
718
|
-
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n +
|
|
716
|
+
unreadConversationsCount: (e) => e.conversations.filter((n) => At(n) > 0).length,
|
|
717
|
+
unreadCount: (e) => e.conversations.reduce((n, r) => n + At(r), 0),
|
|
718
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + At(r), 0),
|
|
719
719
|
sortedFolders: (e) => Be(e.folders),
|
|
720
720
|
folderById: (e) => (n) => e.folders.find((r) => r.id === n),
|
|
721
721
|
conversationsInFolder: (e) => (n) => e.conversations.filter((r) => r.folder_id === n),
|
|
@@ -825,12 +825,12 @@ const Jt = Oi("messaging", {
|
|
|
825
825
|
const d = await W().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
|
|
826
826
|
d.data,
|
|
827
827
|
"conversations"
|
|
828
|
-
),
|
|
828
|
+
), A = f.map((E) => {
|
|
829
829
|
const b = this.conversations.find(
|
|
830
|
-
(
|
|
830
|
+
(R) => R.id === E.id
|
|
831
831
|
);
|
|
832
832
|
return He(E, b);
|
|
833
|
-
}), C = await zn(
|
|
833
|
+
}), C = await zn(A);
|
|
834
834
|
e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
835
835
|
const v = {
|
|
836
836
|
data: C,
|
|
@@ -847,7 +847,7 @@ const Jt = Oi("messaging", {
|
|
|
847
847
|
if (Date.now() < this.backgroundPollRetryAfterUntil)
|
|
848
848
|
return !1;
|
|
849
849
|
try {
|
|
850
|
-
return await this.fetchConversations(void 0, this.activeListFilter, void 0, {
|
|
850
|
+
return this.activeListFilter === "requests" ? await this.fetchRequests() : await this.fetchConversations(void 0, this.activeListFilter, void 0, {
|
|
851
851
|
background: !0,
|
|
852
852
|
includePresence: !1
|
|
853
853
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
@@ -889,8 +889,8 @@ const Jt = Oi("messaging", {
|
|
|
889
889
|
r.data,
|
|
890
890
|
"conversations"
|
|
891
891
|
), u = o.map((h) => {
|
|
892
|
-
const
|
|
893
|
-
return He(h,
|
|
892
|
+
const A = this.requests.find((C) => C.id === h.id);
|
|
893
|
+
return He(h, A);
|
|
894
894
|
}), d = await zn(u);
|
|
895
895
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
896
896
|
const f = {
|
|
@@ -942,13 +942,13 @@ const Jt = Oi("messaging", {
|
|
|
942
942
|
}
|
|
943
943
|
},
|
|
944
944
|
async sendMessage(e, n, r, o, c, u, d) {
|
|
945
|
-
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`,
|
|
945
|
+
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, A = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = 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:
|
|
951
|
+
meta: A ? { shared_post_id: A } : {},
|
|
952
952
|
...C ? { shared_post: C } : {},
|
|
953
953
|
is_deleted: !1,
|
|
954
954
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -962,10 +962,10 @@ const Jt = Oi("messaging", {
|
|
|
962
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 R = {
|
|
966
966
|
body: n || "",
|
|
967
967
|
...o ? { reply_to_id: o } : {},
|
|
968
|
-
...
|
|
968
|
+
...A ? { shared_post_id: A } : {},
|
|
969
969
|
...C ? { shared_post_preview: C } : {}
|
|
970
970
|
};
|
|
971
971
|
if (r && r.length > 0) {
|
|
@@ -980,12 +980,12 @@ const Jt = Oi("messaging", {
|
|
|
980
980
|
})
|
|
981
981
|
);
|
|
982
982
|
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
983
|
-
...
|
|
983
|
+
...R,
|
|
984
984
|
attachments: G
|
|
985
985
|
});
|
|
986
986
|
} else
|
|
987
987
|
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
988
|
-
...
|
|
988
|
+
...R,
|
|
989
989
|
type: "text"
|
|
990
990
|
});
|
|
991
991
|
const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], F = y.findIndex((G) => G.id === h);
|
|
@@ -998,7 +998,7 @@ const Jt = Oi("messaging", {
|
|
|
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((R) => R.id !== h), this.error = Z(b), b;
|
|
1002
1002
|
}
|
|
1003
1003
|
},
|
|
1004
1004
|
async editMessage(e, n, r) {
|
|
@@ -1236,28 +1236,28 @@ const Jt = Oi("messaging", {
|
|
|
1236
1236
|
return;
|
|
1237
1237
|
this.messages[n] || (this.messages[n] = []);
|
|
1238
1238
|
const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1239
|
-
if (o.find((
|
|
1239
|
+
if (o.find((A) => A.id === r.id))
|
|
1240
1240
|
return;
|
|
1241
1241
|
const u = ke()();
|
|
1242
1242
|
if (r.author_id === u.currentUser?.id) {
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
const C = o[
|
|
1243
|
+
const A = o.findIndex((C) => C.id.startsWith("temp-"));
|
|
1244
|
+
if (A >= 0) {
|
|
1245
|
+
const C = o[A]?.id ?? "";
|
|
1246
1246
|
this.messages[n] = [
|
|
1247
|
-
...o.slice(0,
|
|
1247
|
+
...o.slice(0, A),
|
|
1248
1248
|
r,
|
|
1249
|
-
...o.slice(
|
|
1249
|
+
...o.slice(A + 1)
|
|
1250
1250
|
], this._pendingSendIds.delete(C), 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 C = o[
|
|
1256
|
+
for (let A = o.length - 1; A >= 0; A--) {
|
|
1257
|
+
const C = o[A];
|
|
1258
1258
|
if (C && C.created_at <= d)
|
|
1259
1259
|
break;
|
|
1260
|
-
f =
|
|
1260
|
+
f = A;
|
|
1261
1261
|
}
|
|
1262
1262
|
const h = f === o.length;
|
|
1263
1263
|
this.messages[n] = [
|
|
@@ -1272,8 +1272,8 @@ const Jt = Oi("messaging", {
|
|
|
1272
1272
|
},
|
|
1273
1273
|
removeMessage(e, n) {
|
|
1274
1274
|
const r = (h) => {
|
|
1275
|
-
const
|
|
1276
|
-
return delete
|
|
1275
|
+
const A = { ...h, is_deleted: !0 };
|
|
1276
|
+
return delete A.body, A;
|
|
1277
1277
|
};
|
|
1278
1278
|
let o = null;
|
|
1279
1279
|
const c = this.conversations.find((h) => h.id === e);
|
|
@@ -1311,10 +1311,10 @@ const Jt = Oi("messaging", {
|
|
|
1311
1311
|
throw v;
|
|
1312
1312
|
f = await W().post(o, c);
|
|
1313
1313
|
}
|
|
1314
|
-
const h = he(f.data) && "data" in f.data ? f.data.data : f.data,
|
|
1314
|
+
const h = he(f.data) && "data" in f.data ? f.data.data : f.data, A = On(
|
|
1315
1315
|
he(h) ? h.reactions : void 0
|
|
1316
1316
|
);
|
|
1317
|
-
(
|
|
1317
|
+
(A.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, A);
|
|
1318
1318
|
try {
|
|
1319
1319
|
const v = await W().get(o), E = he(v.data) && "data" in v.data ? v.data.data : v.data, b = On(
|
|
1320
1320
|
he(E) ? E.reactions : void 0
|
|
@@ -1350,8 +1350,8 @@ const Jt = Oi("messaging", {
|
|
|
1350
1350
|
h,
|
|
1351
1351
|
...u.slice(d + 1)
|
|
1352
1352
|
];
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1353
|
+
const A = this.conversations.find((v) => v.id === e);
|
|
1354
|
+
A?.last_message?.id === n && (A.last_message = h);
|
|
1355
1355
|
const C = this.requests.find((v) => v.id === e);
|
|
1356
1356
|
C?.last_message?.id === n && (C.last_message = h);
|
|
1357
1357
|
},
|
|
@@ -1479,16 +1479,16 @@ const Jt = Oi("messaging", {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
});
|
|
1481
1481
|
function oc(e) {
|
|
1482
|
-
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = Nt(), f = d !== null, h = 20,
|
|
1482
|
+
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = Nt(), f = d !== null, h = 20, A = 250;
|
|
1483
1483
|
let C = 0, v = null, E = null;
|
|
1484
|
-
const b = re(() => r.currentUser?.id),
|
|
1484
|
+
const b = re(() => r.currentUser?.id), R = () => ss(e)?.trim() ?? "";
|
|
1485
1485
|
function w() {
|
|
1486
1486
|
v && (clearTimeout(v), v = null), C = 0;
|
|
1487
1487
|
}
|
|
1488
1488
|
function p() {
|
|
1489
1489
|
!f || o.value || v || C >= h || (v = setTimeout(() => {
|
|
1490
1490
|
v = null, C += 1, I();
|
|
1491
|
-
},
|
|
1491
|
+
}, A));
|
|
1492
1492
|
}
|
|
1493
1493
|
function m(_) {
|
|
1494
1494
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
@@ -1534,9 +1534,9 @@ function oc(e) {
|
|
|
1534
1534
|
E && (E(), E = null), x && (_ && !n.hasGlobalConversationSubscription(x) && Bi(x), n.unregisterDetailSubscription(x), u.value = null), o.value = !1;
|
|
1535
1535
|
}
|
|
1536
1536
|
function I() {
|
|
1537
|
-
const _ =
|
|
1537
|
+
const _ = R();
|
|
1538
1538
|
if (!(o.value || !_)) {
|
|
1539
|
-
if (!
|
|
1539
|
+
if (!Re()) {
|
|
1540
1540
|
p();
|
|
1541
1541
|
return;
|
|
1542
1542
|
}
|
|
@@ -1576,7 +1576,7 @@ function oc(e) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
return ot(
|
|
1579
|
-
() =>
|
|
1579
|
+
() => R(),
|
|
1580
1580
|
(_, x) => {
|
|
1581
1581
|
if (_ !== x) {
|
|
1582
1582
|
if (w(), o.value && k(!0), !_) {
|
|
@@ -1595,14 +1595,14 @@ function oc(e) {
|
|
|
1595
1595
|
unsubscribe: X
|
|
1596
1596
|
};
|
|
1597
1597
|
}
|
|
1598
|
-
const
|
|
1599
|
-
},
|
|
1598
|
+
const Rs = () => () => {
|
|
1599
|
+
}, As = async () => {
|
|
1600
1600
|
}, _e = {
|
|
1601
1601
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1602
1602
|
getEcho: () => null,
|
|
1603
1603
|
getConnectionStatus: () => "disconnected",
|
|
1604
|
-
onConnectionStatusChange:
|
|
1605
|
-
reconnect:
|
|
1604
|
+
onConnectionStatusChange: Rs,
|
|
1605
|
+
reconnect: As
|
|
1606
1606
|
};
|
|
1607
1607
|
function zo() {
|
|
1608
1608
|
return _e.initializedEvent;
|
|
@@ -1623,7 +1623,7 @@ function Vo(e) {
|
|
|
1623
1623
|
e.initializedEvent && (_e.initializedEvent = e.initializedEvent), e.getEcho && (_e.getEcho = e.getEcho), e.getConnectionStatus && (_e.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (_e.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (_e.reconnect = e.reconnect);
|
|
1624
1624
|
}
|
|
1625
1625
|
function Xo() {
|
|
1626
|
-
_e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange =
|
|
1626
|
+
_e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange = Rs, _e.reconnect = As;
|
|
1627
1627
|
}
|
|
1628
1628
|
const Wo = {
|
|
1629
1629
|
debug: () => {
|
|
@@ -1661,7 +1661,7 @@ function Qo(e) {
|
|
|
1661
1661
|
getConnectionStatus: gs,
|
|
1662
1662
|
onConnectionStatusChange: lt,
|
|
1663
1663
|
reconnect: zi,
|
|
1664
|
-
getEchoConnection: () => Bn(
|
|
1664
|
+
getEchoConnection: () => Bn(Re())
|
|
1665
1665
|
} : {
|
|
1666
1666
|
initializedEvent: zo(),
|
|
1667
1667
|
getConnectionStatus: $o,
|
|
@@ -1677,8 +1677,8 @@ function ac(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 E = null, b = null,
|
|
1680
|
+
}, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), A = ye(!1), C = ye(!1), v = ye(!1);
|
|
1681
|
+
let E = null, b = null, R = null, w = null, p = null, m = null, y = null;
|
|
1682
1682
|
const F = re(() => u.value === "connected"), q = re(() => u.value === "connecting"), J = re(() => u.value === "disconnected"), G = re(() => u.value === "error"), te = re(() => J.value || G.value), k = re(() => {
|
|
1683
1683
|
switch (u.value) {
|
|
1684
1684
|
case "connecting":
|
|
@@ -1721,22 +1721,22 @@ function ac(e = {}) {
|
|
|
1721
1721
|
Hn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1722
1722
|
}, X = (B, K = u.value) => {
|
|
1723
1723
|
if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
|
|
1724
|
-
const N = !v.value && K === B, Y = !
|
|
1724
|
+
const N = !v.value && K === B, Y = !A.value && (N || K === "connected" || K === "connecting");
|
|
1725
1725
|
if (C.value = !0, Y) {
|
|
1726
|
-
h.value = !1,
|
|
1727
|
-
|
|
1726
|
+
h.value = !1, R && clearTimeout(R), R = setTimeout(() => {
|
|
1727
|
+
R = null, u.value !== "connected" && (h.value = !0);
|
|
1728
1728
|
}, 5e3);
|
|
1729
1729
|
return;
|
|
1730
1730
|
}
|
|
1731
|
-
|
|
1731
|
+
R && (clearTimeout(R), R = null), h.value = !0;
|
|
1732
1732
|
return;
|
|
1733
1733
|
}
|
|
1734
1734
|
if (B === "connected") {
|
|
1735
|
-
|
|
1735
|
+
R && (clearTimeout(R), R = null), h.value = !1, A.value = !1, C.value = !1;
|
|
1736
1736
|
return;
|
|
1737
1737
|
}
|
|
1738
1738
|
if (B === "connecting") {
|
|
1739
|
-
if (
|
|
1739
|
+
if (R && (clearTimeout(R), R = null), A.value) {
|
|
1740
1740
|
h.value = !0;
|
|
1741
1741
|
return;
|
|
1742
1742
|
}
|
|
@@ -1748,13 +1748,13 @@ function ac(e = {}) {
|
|
|
1748
1748
|
_("connected");
|
|
1749
1749
|
return;
|
|
1750
1750
|
}
|
|
1751
|
-
|
|
1751
|
+
A.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1752
1752
|
}
|
|
1753
1753
|
}, 1e4);
|
|
1754
1754
|
}
|
|
1755
1755
|
}, _ = (B) => {
|
|
1756
1756
|
const K = u.value;
|
|
1757
|
-
if (B === "connecting" &&
|
|
1757
|
+
if (B === "connecting" && A.value) {
|
|
1758
1758
|
u.value = "disconnected", X("disconnected", K);
|
|
1759
1759
|
return;
|
|
1760
1760
|
}
|
|
@@ -1820,7 +1820,7 @@ function ac(e = {}) {
|
|
|
1820
1820
|
x();
|
|
1821
1821
|
}, 3e3);
|
|
1822
1822
|
}), qe(() => {
|
|
1823
|
-
E?.(), b && (clearTimeout(b), b = null),
|
|
1823
|
+
E?.(), b && (clearTimeout(b), b = null), R && (clearTimeout(R), R = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
|
|
1824
1824
|
}), {
|
|
1825
1825
|
connectionStatus: re(() => u.value),
|
|
1826
1826
|
isConnected: F,
|
|
@@ -1852,12 +1852,12 @@ function ea() {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
const Me = Qt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1854
1854
|
function cc() {
|
|
1855
|
-
const e = Jt(), n = ke()(), r = Yo(), o = Ht(), c = Ni(), u = Nt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(),
|
|
1855
|
+
const e = Jt(), n = ke()(), r = Yo(), o = Ht(), c = Ni(), u = Nt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map();
|
|
1856
1856
|
let C = !1;
|
|
1857
1857
|
function v(k) {
|
|
1858
|
-
const I =
|
|
1858
|
+
const I = A.get(k);
|
|
1859
1859
|
if (I) {
|
|
1860
|
-
if (
|
|
1860
|
+
if (A.delete(k), I.directBound) {
|
|
1861
1861
|
const V = I.channel.subscription;
|
|
1862
1862
|
if (V)
|
|
1863
1863
|
for (const H of I.bindings)
|
|
@@ -1881,7 +1881,7 @@ function cc() {
|
|
|
1881
1881
|
h.clear();
|
|
1882
1882
|
}
|
|
1883
1883
|
function b(k) {
|
|
1884
|
-
const I =
|
|
1884
|
+
const I = Re();
|
|
1885
1885
|
if (!I || h.has(k)) return;
|
|
1886
1886
|
const V = `conversation.${k}`;
|
|
1887
1887
|
v(k);
|
|
@@ -1948,7 +1948,7 @@ function cc() {
|
|
|
1948
1948
|
(U) => U.id !== Y.conversation_id
|
|
1949
1949
|
);
|
|
1950
1950
|
}, K = H.subscription;
|
|
1951
|
-
K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", x), K.bind("ConversationRequestAccepted", B),
|
|
1951
|
+
K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", x), K.bind("ConversationRequestAccepted", B), A.set(k, {
|
|
1952
1952
|
channel: H,
|
|
1953
1953
|
directBound: !0,
|
|
1954
1954
|
bindings: [
|
|
@@ -1959,7 +1959,7 @@ function cc() {
|
|
|
1959
1959
|
{ event: "MessageReactionToggled", handler: x },
|
|
1960
1960
|
{ event: "ConversationRequestAccepted", handler: B }
|
|
1961
1961
|
]
|
|
1962
|
-
})) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", x), H.listen(".ConversationRequestAccepted", B),
|
|
1962
|
+
})) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", x), H.listen(".ConversationRequestAccepted", B), A.set(k, {
|
|
1963
1963
|
channel: H,
|
|
1964
1964
|
directBound: !1,
|
|
1965
1965
|
bindings: [
|
|
@@ -1972,8 +1972,8 @@ function cc() {
|
|
|
1972
1972
|
]
|
|
1973
1973
|
})), h.add(k), e.registerGlobalConversationSubscription(k);
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1976
|
-
const k =
|
|
1975
|
+
function R() {
|
|
1976
|
+
const k = Re();
|
|
1977
1977
|
if (!k) {
|
|
1978
1978
|
E();
|
|
1979
1979
|
return;
|
|
@@ -1989,7 +1989,7 @@ function cc() {
|
|
|
1989
1989
|
h.clear();
|
|
1990
1990
|
}
|
|
1991
1991
|
function w() {
|
|
1992
|
-
const k =
|
|
1992
|
+
const k = Re();
|
|
1993
1993
|
if (!k) return;
|
|
1994
1994
|
const I = (() => {
|
|
1995
1995
|
const H = [...e.conversations, ...e.requestConversations], X = /* @__PURE__ */ new Set(), _ = [];
|
|
@@ -2038,7 +2038,7 @@ function cc() {
|
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
2040
|
function y() {
|
|
2041
|
-
!
|
|
2041
|
+
!Re() || C || (ji(p), C = !0);
|
|
2042
2042
|
}
|
|
2043
2043
|
function F() {
|
|
2044
2044
|
C && ($i(), C = !1);
|
|
@@ -2063,12 +2063,12 @@ function cc() {
|
|
|
2063
2063
|
), te = lt((k) => {
|
|
2064
2064
|
k === "connected" ? (E(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (E(), F());
|
|
2065
2065
|
});
|
|
2066
|
-
w(), y(), m(),
|
|
2066
|
+
w(), y(), m(), Re() || ps().then((k) => {
|
|
2067
2067
|
k && (E(), w(), F(), y(), m());
|
|
2068
2068
|
}).catch((k) => {
|
|
2069
2069
|
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
2070
2070
|
}), u !== null && qe(() => {
|
|
2071
|
-
q(), J(), G(), te(),
|
|
2071
|
+
q(), J(), G(), te(), R(), F();
|
|
2072
2072
|
});
|
|
2073
2073
|
}
|
|
2074
2074
|
function uc() {
|
|
@@ -2225,19 +2225,19 @@ function Ta(e, n, r) {
|
|
|
2225
2225
|
}
|
|
2226
2226
|
function lc() {
|
|
2227
2227
|
const e = ke()(), n = ia(), r = Ht(), o = va(n.clientIdStorageKey);
|
|
2228
|
-
let c = null, u = null, d = !1, f = xt(n.accountLimitedUntilStorageKey), h = !1,
|
|
2228
|
+
let c = null, u = null, d = !1, f = xt(n.accountLimitedUntilStorageKey), h = !1, A = !1, C = null, v = 0;
|
|
2229
2229
|
const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2230
2230
|
c && (clearInterval(c), c = null);
|
|
2231
|
-
},
|
|
2231
|
+
}, R = () => {
|
|
2232
2232
|
u && (clearTimeout(u), u = null);
|
|
2233
2233
|
}, w = () => {
|
|
2234
2234
|
b(), c = setInterval(() => {
|
|
2235
2235
|
I();
|
|
2236
2236
|
}, n.heartbeatIntervalMs);
|
|
2237
2237
|
}, p = (x) => {
|
|
2238
|
-
f || console.warn(x), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(),
|
|
2238
|
+
f || console.warn(x), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), R();
|
|
2239
2239
|
}, m = async (x) => {
|
|
2240
|
-
if (!(!d ||
|
|
2240
|
+
if (!(!d || A || f || h) && E() && C !== x)
|
|
2241
2241
|
try {
|
|
2242
2242
|
await r.patch(n.statusUrl, { status: x }), C = x;
|
|
2243
2243
|
} catch (fe) {
|
|
@@ -2245,14 +2245,14 @@ function lc() {
|
|
|
2245
2245
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2246
2246
|
return;
|
|
2247
2247
|
}
|
|
2248
|
-
kt(fe) && (h = !0, d = !1, C = null, b(),
|
|
2248
|
+
kt(fe) && (h = !0, d = !1, C = null, b(), R());
|
|
2249
2249
|
}
|
|
2250
2250
|
}, y = () => {
|
|
2251
|
-
|
|
2251
|
+
R(), !(!d || A || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
2252
2252
|
u = null, m("idle");
|
|
2253
2253
|
}, n.idleAfterMs));
|
|
2254
2254
|
}, F = () => {
|
|
2255
|
-
if (
|
|
2255
|
+
if (A || !d || f || h || document.visibilityState !== "visible")
|
|
2256
2256
|
return;
|
|
2257
2257
|
const x = Date.now();
|
|
2258
2258
|
x - v < n.activityDebounceMs || (v = x, m("online"), y());
|
|
@@ -2271,7 +2271,7 @@ function lc() {
|
|
|
2271
2271
|
user_agent: n.userAgentResolver()
|
|
2272
2272
|
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
|
|
2273
2273
|
} catch (x) {
|
|
2274
|
-
return Mt(x) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : kt(x) ? (h = !0, d = !1, C = null, b(),
|
|
2274
|
+
return Mt(x) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : kt(x) ? (h = !0, d = !1, C = null, b(), R(), "account_suspended") : "failed";
|
|
2275
2275
|
}
|
|
2276
2276
|
}, k = async () => {
|
|
2277
2277
|
for (let x = 0; x < ga; x += 1)
|
|
@@ -2287,12 +2287,12 @@ function lc() {
|
|
|
2287
2287
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2288
2288
|
return;
|
|
2289
2289
|
}
|
|
2290
|
-
kt(x) && (h = !0, d = !1, C = null, b(),
|
|
2290
|
+
kt(x) && (h = !0, d = !1, C = null, b(), R());
|
|
2291
2291
|
}
|
|
2292
2292
|
}, V = () => {
|
|
2293
2293
|
if (!d)
|
|
2294
2294
|
return;
|
|
2295
|
-
d = !1, C = null,
|
|
2295
|
+
d = !1, C = null, R();
|
|
2296
2296
|
const x = Ta(
|
|
2297
2297
|
n.sessionCloseUrl,
|
|
2298
2298
|
o,
|
|
@@ -2306,17 +2306,17 @@ function lc() {
|
|
|
2306
2306
|
r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2307
2307
|
});
|
|
2308
2308
|
}, H = async () => {
|
|
2309
|
-
if (!
|
|
2310
|
-
if (await k(),
|
|
2309
|
+
if (!A) {
|
|
2310
|
+
if (await k(), A) {
|
|
2311
2311
|
V();
|
|
2312
2312
|
return;
|
|
2313
2313
|
}
|
|
2314
2314
|
d && (w(), m("online"), y());
|
|
2315
2315
|
}
|
|
2316
2316
|
}, X = () => {
|
|
2317
|
-
if (!
|
|
2317
|
+
if (!A) {
|
|
2318
2318
|
if (document.visibilityState === "hidden") {
|
|
2319
|
-
V(), b(),
|
|
2319
|
+
V(), b(), R();
|
|
2320
2320
|
return;
|
|
2321
2321
|
}
|
|
2322
2322
|
if (document.visibilityState === "visible" && !d) {
|
|
@@ -2326,24 +2326,24 @@ function lc() {
|
|
|
2326
2326
|
document.visibilityState === "visible" && d && !f && !h && F();
|
|
2327
2327
|
}
|
|
2328
2328
|
}, _ = () => {
|
|
2329
|
-
|
|
2329
|
+
A || (V(), b(), R());
|
|
2330
2330
|
};
|
|
2331
2331
|
qt(async () => {
|
|
2332
2332
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2333
|
-
if (await k(),
|
|
2333
|
+
if (await k(), A) {
|
|
2334
2334
|
V();
|
|
2335
2335
|
return;
|
|
2336
2336
|
}
|
|
2337
2337
|
d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", X), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2338
2338
|
}
|
|
2339
2339
|
}), qe(() => {
|
|
2340
|
-
|
|
2340
|
+
A = !0, G(), R(), b(), V(), document.removeEventListener("visibilitychange", X), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2341
2341
|
});
|
|
2342
2342
|
}
|
|
2343
2343
|
const Ea = 12e3;
|
|
2344
2344
|
function dc(e) {
|
|
2345
|
-
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = Nt(),
|
|
2346
|
-
let E = !1, b = null,
|
|
2345
|
+
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = Nt(), A = h !== null, C = 20, v = 250;
|
|
2346
|
+
let E = !1, b = null, R = 0, w = null;
|
|
2347
2347
|
const p = re(() => r.currentUser?.id), m = () => ss(e)?.trim() ?? "", y = () => {
|
|
2348
2348
|
const M = u.value?.trim() ?? "";
|
|
2349
2349
|
if (M.length > 0)
|
|
@@ -2363,10 +2363,10 @@ function dc(e) {
|
|
|
2363
2363
|
clearTimeout(M);
|
|
2364
2364
|
f.clear();
|
|
2365
2365
|
}, te = () => {
|
|
2366
|
-
w && (clearTimeout(w), w = null),
|
|
2366
|
+
w && (clearTimeout(w), w = null), R = 0;
|
|
2367
2367
|
}, k = () => {
|
|
2368
|
-
!
|
|
2369
|
-
w = null,
|
|
2368
|
+
!A || o.value || w || R >= C || (w = setTimeout(() => {
|
|
2369
|
+
w = null, R += 1, X();
|
|
2370
2370
|
}, v));
|
|
2371
2371
|
}, I = (M, U) => {
|
|
2372
2372
|
J(M);
|
|
@@ -2388,7 +2388,7 @@ function dc(e) {
|
|
|
2388
2388
|
}, X = () => {
|
|
2389
2389
|
const M = m();
|
|
2390
2390
|
if (!(o.value || !M)) {
|
|
2391
|
-
if (c.value = null,
|
|
2391
|
+
if (c.value = null, Re() && En() === "connected") {
|
|
2392
2392
|
H(M);
|
|
2393
2393
|
return;
|
|
2394
2394
|
}
|
|
@@ -2396,7 +2396,7 @@ function dc(e) {
|
|
|
2396
2396
|
if (E || o.value || !U)
|
|
2397
2397
|
return;
|
|
2398
2398
|
const ne = m();
|
|
2399
|
-
if (ne && ne === M &&
|
|
2399
|
+
if (ne && ne === M && Re() && En() === "connected") {
|
|
2400
2400
|
H(ne);
|
|
2401
2401
|
return;
|
|
2402
2402
|
}
|
|
@@ -2545,7 +2545,7 @@ class Us {
|
|
|
2545
2545
|
this.namespace = n;
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
2548
|
-
function
|
|
2548
|
+
function Ra(e) {
|
|
2549
2549
|
try {
|
|
2550
2550
|
new e();
|
|
2551
2551
|
} catch (n) {
|
|
@@ -2642,7 +2642,7 @@ class Os extends en {
|
|
|
2642
2642
|
), this;
|
|
2643
2643
|
}
|
|
2644
2644
|
}
|
|
2645
|
-
class
|
|
2645
|
+
class Aa extends en {
|
|
2646
2646
|
/**
|
|
2647
2647
|
* Send a whisper event to other clients in the channel.
|
|
2648
2648
|
*/
|
|
@@ -3005,7 +3005,7 @@ class it extends tn {
|
|
|
3005
3005
|
* Get a private encrypted channel instance by name.
|
|
3006
3006
|
*/
|
|
3007
3007
|
encryptedPrivateChannel(n) {
|
|
3008
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
3008
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Aa(
|
|
3009
3009
|
this.pusher,
|
|
3010
3010
|
"private-encrypted-" + n,
|
|
3011
3011
|
this.options
|
|
@@ -3314,7 +3314,7 @@ class Ia {
|
|
|
3314
3314
|
this.connector = new La(this.options);
|
|
3315
3315
|
else if (this.options.broadcaster === "null")
|
|
3316
3316
|
this.connector = new Xn(this.options);
|
|
3317
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
3317
|
+
else if (typeof this.options.broadcaster == "function" && Ra(this.options.broadcaster))
|
|
3318
3318
|
this.connector = new this.options.broadcaster(this.options);
|
|
3319
3319
|
else
|
|
3320
3320
|
throw new Error(
|
|
@@ -3473,8 +3473,8 @@ function Oa() {
|
|
|
3473
3473
|
}, c.t = function(u, d) {
|
|
3474
3474
|
if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
|
|
3475
3475
|
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[
|
|
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(A) {
|
|
3477
|
+
return u[A];
|
|
3478
3478
|
}).bind(null, h));
|
|
3479
3479
|
return f;
|
|
3480
3480
|
}, c.n = function(u) {
|
|
@@ -3565,10 +3565,10 @@ function Oa() {
|
|
|
3565
3565
|
);
|
|
3566
3566
|
o.Coder = f;
|
|
3567
3567
|
var h = new f();
|
|
3568
|
-
function
|
|
3568
|
+
function A(w) {
|
|
3569
3569
|
return h.encode(w);
|
|
3570
3570
|
}
|
|
3571
|
-
o.encode =
|
|
3571
|
+
o.encode = A;
|
|
3572
3572
|
function C(w) {
|
|
3573
3573
|
return h.decode(w);
|
|
3574
3574
|
}
|
|
@@ -3595,10 +3595,10 @@ function Oa() {
|
|
|
3595
3595
|
return E.encode(w);
|
|
3596
3596
|
}
|
|
3597
3597
|
o.encodeURLSafe = b;
|
|
3598
|
-
function
|
|
3598
|
+
function R(w) {
|
|
3599
3599
|
return E.decode(w);
|
|
3600
3600
|
}
|
|
3601
|
-
o.decodeURLSafe =
|
|
3601
|
+
o.decodeURLSafe = R, o.encodedLength = function(w) {
|
|
3602
3602
|
return h.encodedLength(w);
|
|
3603
3603
|
}, o.maxDecodedLength = function(w) {
|
|
3604
3604
|
return h.maxDecodedLength(w);
|
|
@@ -3613,8 +3613,8 @@ function Oa() {
|
|
|
3613
3613
|
var u = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3614
3614
|
function f(C) {
|
|
3615
3615
|
for (var v = new Uint8Array(h(C)), E = 0, b = 0; b < C.length; b++) {
|
|
3616
|
-
var
|
|
3617
|
-
|
|
3616
|
+
var R = C.charCodeAt(b);
|
|
3617
|
+
R < 128 ? v[E++] = R : R < 2048 ? (v[E++] = 192 | R >> 6, v[E++] = 128 | R & 63) : R < 55296 ? (v[E++] = 224 | R >> 12, v[E++] = 128 | R >> 6 & 63, v[E++] = 128 | R & 63) : (b++, R = (R & 1023) << 10, R |= C.charCodeAt(b) & 1023, R += 65536, v[E++] = 240 | R >> 18, v[E++] = 128 | R >> 12 & 63, v[E++] = 128 | R >> 6 & 63, v[E++] = 128 | R & 63);
|
|
3618
3618
|
}
|
|
3619
3619
|
return v;
|
|
3620
3620
|
}
|
|
@@ -3638,35 +3638,35 @@ function Oa() {
|
|
|
3638
3638
|
return v;
|
|
3639
3639
|
}
|
|
3640
3640
|
o.encodedLength = h;
|
|
3641
|
-
function
|
|
3641
|
+
function A(C) {
|
|
3642
3642
|
for (var v = [], E = 0; E < C.length; E++) {
|
|
3643
3643
|
var b = C[E];
|
|
3644
3644
|
if (b & 128) {
|
|
3645
|
-
var
|
|
3645
|
+
var R = void 0;
|
|
3646
3646
|
if (b < 224) {
|
|
3647
3647
|
if (E >= C.length)
|
|
3648
3648
|
throw new Error(d);
|
|
3649
3649
|
var w = C[++E];
|
|
3650
3650
|
if ((w & 192) !== 128)
|
|
3651
3651
|
throw new Error(d);
|
|
3652
|
-
b = (b & 31) << 6 | w & 63,
|
|
3652
|
+
b = (b & 31) << 6 | w & 63, R = 128;
|
|
3653
3653
|
} else if (b < 240) {
|
|
3654
3654
|
if (E >= C.length - 1)
|
|
3655
3655
|
throw new Error(d);
|
|
3656
3656
|
var w = C[++E], p = C[++E];
|
|
3657
3657
|
if ((w & 192) !== 128 || (p & 192) !== 128)
|
|
3658
3658
|
throw new Error(d);
|
|
3659
|
-
b = (b & 15) << 12 | (w & 63) << 6 | p & 63,
|
|
3659
|
+
b = (b & 15) << 12 | (w & 63) << 6 | p & 63, R = 2048;
|
|
3660
3660
|
} else if (b < 248) {
|
|
3661
3661
|
if (E >= C.length - 2)
|
|
3662
3662
|
throw new Error(d);
|
|
3663
3663
|
var w = C[++E], p = C[++E], m = C[++E];
|
|
3664
3664
|
if ((w & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
|
|
3665
3665
|
throw new Error(d);
|
|
3666
|
-
b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63,
|
|
3666
|
+
b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63, R = 65536;
|
|
3667
3667
|
} else
|
|
3668
3668
|
throw new Error(d);
|
|
3669
|
-
if (b <
|
|
3669
|
+
if (b < R || b >= 55296 && b <= 57343)
|
|
3670
3670
|
throw new Error(d);
|
|
3671
3671
|
if (b >= 65536) {
|
|
3672
3672
|
if (b > 1114111)
|
|
@@ -3678,7 +3678,7 @@ function Oa() {
|
|
|
3678
3678
|
}
|
|
3679
3679
|
return v.join("");
|
|
3680
3680
|
}
|
|
3681
|
-
o.decode =
|
|
3681
|
+
o.decode = A;
|
|
3682
3682
|
}),
|
|
3683
3683
|
/* 2 */
|
|
3684
3684
|
/***/
|
|
@@ -3732,7 +3732,7 @@ function Oa() {
|
|
|
3732
3732
|
cdn_https: "https://js.pusher.com",
|
|
3733
3733
|
dependency_suffix: ""
|
|
3734
3734
|
}, h = f;
|
|
3735
|
-
class
|
|
3735
|
+
class A {
|
|
3736
3736
|
constructor(t) {
|
|
3737
3737
|
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3738
3738
|
}
|
|
@@ -3763,7 +3763,7 @@ function Oa() {
|
|
|
3763
3763
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3764
3764
|
}
|
|
3765
3765
|
}
|
|
3766
|
-
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new
|
|
3766
|
+
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new A({
|
|
3767
3767
|
cdn_http: h.cdn_http,
|
|
3768
3768
|
cdn_https: h.cdn_https,
|
|
3769
3769
|
version: h.VERSION,
|
|
@@ -3790,7 +3790,7 @@ function Oa() {
|
|
|
3790
3790
|
}
|
|
3791
3791
|
}
|
|
3792
3792
|
};
|
|
3793
|
-
var
|
|
3793
|
+
var R = { buildLogSuffix: function(i) {
|
|
3794
3794
|
const t = "See:", s = E.urls[i];
|
|
3795
3795
|
if (!s)
|
|
3796
3796
|
return "";
|
|
@@ -3869,10 +3869,10 @@ function Oa() {
|
|
|
3869
3869
|
let L = "";
|
|
3870
3870
|
switch (a) {
|
|
3871
3871
|
case w.UserAuthentication:
|
|
3872
|
-
L =
|
|
3872
|
+
L = R.buildLogSuffix("authenticationEndpoint");
|
|
3873
3873
|
break;
|
|
3874
3874
|
case w.ChannelAuthorization:
|
|
3875
|
-
L = `Clients must be authorized to join private or presence channels. ${
|
|
3875
|
+
L = `Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;
|
|
3876
3876
|
break;
|
|
3877
3877
|
}
|
|
3878
3878
|
l(new k(g.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${g.status} from ${s.endpoint}. ${L}`), null);
|
|
@@ -4009,7 +4009,7 @@ function Oa() {
|
|
|
4009
4009
|
t(i[a], a, i, s) && s.push(i[a]);
|
|
4010
4010
|
return s;
|
|
4011
4011
|
}
|
|
4012
|
-
function
|
|
4012
|
+
function Ae(i, t) {
|
|
4013
4013
|
var s = {};
|
|
4014
4014
|
return T(i, function(a, l) {
|
|
4015
4015
|
(t && t(a, l, i, s) || a) && (s[l] = a);
|
|
@@ -4039,7 +4039,7 @@ function Oa() {
|
|
|
4039
4039
|
});
|
|
4040
4040
|
}
|
|
4041
4041
|
function js(i) {
|
|
4042
|
-
var t =
|
|
4042
|
+
var t = Ae(i, function(a) {
|
|
4043
4043
|
return a !== void 0;
|
|
4044
4044
|
}), s = se(Le(be(t)), oe.method("join", "=")).join("&");
|
|
4045
4045
|
return s;
|
|
@@ -4637,7 +4637,7 @@ function Oa() {
|
|
|
4637
4637
|
if (t.indexOf("client-") !== 0)
|
|
4638
4638
|
throw new p("Event '" + t + "' does not start with 'client-'");
|
|
4639
4639
|
if (!this.subscribed) {
|
|
4640
|
-
var a =
|
|
4640
|
+
var a = R.buildLogSuffix("triggeringClientEvents");
|
|
4641
4641
|
ce.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4642
4642
|
}
|
|
4643
4643
|
return this.pusher.send_event(t, s, this.name);
|
|
@@ -4766,7 +4766,7 @@ function Oa() {
|
|
|
4766
4766
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4767
4767
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4768
4768
|
else {
|
|
4769
|
-
let S =
|
|
4769
|
+
let S = R.buildLogSuffix("authorizationEndpoint");
|
|
4770
4770
|
ce.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4771
4771
|
return;
|
|
4772
4772
|
}
|
|
@@ -5066,7 +5066,7 @@ function Oa() {
|
|
|
5066
5066
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5067
5067
|
if (t.config.nacl)
|
|
5068
5068
|
return Ee.createEncryptedChannel(i, t, t.config.nacl);
|
|
5069
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
5069
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = R.buildLogSuffix("encryptedChannelSupport");
|
|
5070
5070
|
throw new J(`${s}. ${a}`);
|
|
5071
5071
|
} else {
|
|
5072
5072
|
if (i.indexOf("private-") === 0)
|
|
@@ -5171,7 +5171,7 @@ function Oa() {
|
|
|
5171
5171
|
return Er(this.strategies, t, function(a, l) {
|
|
5172
5172
|
return function(g, S) {
|
|
5173
5173
|
if (l[a].error = g, g) {
|
|
5174
|
-
|
|
5174
|
+
Rr(l) && s(!0);
|
|
5175
5175
|
return;
|
|
5176
5176
|
}
|
|
5177
5177
|
O(l, function(L) {
|
|
@@ -5187,7 +5187,7 @@ function Oa() {
|
|
|
5187
5187
|
});
|
|
5188
5188
|
return {
|
|
5189
5189
|
abort: function() {
|
|
5190
|
-
O(a,
|
|
5190
|
+
O(a, Ar);
|
|
5191
5191
|
},
|
|
5192
5192
|
forceMinPriority: function(l) {
|
|
5193
5193
|
O(a, function(g) {
|
|
@@ -5196,12 +5196,12 @@ function Oa() {
|
|
|
5196
5196
|
}
|
|
5197
5197
|
};
|
|
5198
5198
|
}
|
|
5199
|
-
function
|
|
5199
|
+
function Rr(i) {
|
|
5200
5200
|
return ge(i, function(t) {
|
|
5201
5201
|
return !!t.error;
|
|
5202
5202
|
});
|
|
5203
5203
|
}
|
|
5204
|
-
function
|
|
5204
|
+
function Ar(i) {
|
|
5205
5205
|
!i.error && !i.aborted && (i.abort(), i.aborted = !0);
|
|
5206
5206
|
}
|
|
5207
5207
|
class Pr {
|
|
@@ -5353,8 +5353,8 @@ function Oa() {
|
|
|
5353
5353
|
lives: 2,
|
|
5354
5354
|
minPingDelay: 1e4,
|
|
5355
5355
|
maxPingDelay: i.activityTimeout
|
|
5356
|
-
}), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q),
|
|
5357
|
-
new ze(je(mn), mn,
|
|
5356
|
+
}), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Ri = l("sockjs", "sockjs", 1, L), mn = l("xhr_streaming", "xhr_streaming", 1, L, ee), Ai = l("xdr_streaming", "xdr_streaming", 1, L, ee), vn = l("xhr_polling", "xhr_polling", 1, L), Pi = l("xdr_polling", "xdr_polling", 1, L), bn = new Ue([de], z), Mi = new Ue([tt], z), ki = new Ue([Ri], z), yn = new Ue([
|
|
5357
|
+
new ze(je(mn), mn, Ai)
|
|
5358
5358
|
], z), _n = new Ue([
|
|
5359
5359
|
new ze(je(vn), vn, Pi)
|
|
5360
5360
|
], z), Sn = new Ue([
|
|
@@ -6030,7 +6030,7 @@ function Oa() {
|
|
|
6030
6030
|
me.instances[t].connect();
|
|
6031
6031
|
}
|
|
6032
6032
|
static getClientFeatures() {
|
|
6033
|
-
return P(
|
|
6033
|
+
return P(Ae({ ws: j.Transports.ws }, function(t) {
|
|
6034
6034
|
return t.isSupported({});
|
|
6035
6035
|
}));
|
|
6036
6036
|
}
|
|
@@ -6331,10 +6331,10 @@ function Fe(e, n, r, o) {
|
|
|
6331
6331
|
function pc(e) {
|
|
6332
6332
|
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Qt())("MessengerEcho");
|
|
6333
6333
|
typeof window < "u" && (window.Pusher = Da);
|
|
6334
|
-
let d = null, f = null, h = null,
|
|
6335
|
-
const
|
|
6334
|
+
let d = null, f = null, h = null, A = null, C = "disconnected", v = "available", E = null, b = null;
|
|
6335
|
+
const R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
|
|
6336
6336
|
C = T;
|
|
6337
|
-
for (const P of
|
|
6337
|
+
for (const P of R)
|
|
6338
6338
|
P(T);
|
|
6339
6339
|
}, y = (T) => {
|
|
6340
6340
|
v = T;
|
|
@@ -6343,7 +6343,7 @@ function pc(e) {
|
|
|
6343
6343
|
}, F = () => {
|
|
6344
6344
|
b !== null && (clearTimeout(b), b = null);
|
|
6345
6345
|
}, q = (T = !0) => {
|
|
6346
|
-
h !== null && (h.disconnect(), h = null),
|
|
6346
|
+
h !== null && (h.disconnect(), h = null), A = null, T && m("disconnected");
|
|
6347
6347
|
}, J = () => {
|
|
6348
6348
|
F(), d = null, f = null, E = null, y("available"), q(), p.clear();
|
|
6349
6349
|
}, G = () => {
|
|
@@ -6419,7 +6419,7 @@ function pc(e) {
|
|
|
6419
6419
|
}
|
|
6420
6420
|
(O === "unavailable" || O === "failed" || O === "disconnected") && m("disconnected");
|
|
6421
6421
|
}), P.state === "connected" && m("connected");
|
|
6422
|
-
}, X = async (T = !1) => !T && h !== null && te(d) ? h : !T &&
|
|
6422
|
+
}, X = async (T = !1) => !T && h !== null && te(d) ? h : !T && A !== null ? await A : (A = (async () => {
|
|
6423
6423
|
const D = await I(T);
|
|
6424
6424
|
if (D === null)
|
|
6425
6425
|
return null;
|
|
@@ -6444,8 +6444,8 @@ function pc(e) {
|
|
|
6444
6444
|
};
|
|
6445
6445
|
return D.service.reverb.path && (se.wsPath = D.service.reverb.path), h = new Ia(se), H(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6446
6446
|
})().finally(() => {
|
|
6447
|
-
|
|
6448
|
-
}), await
|
|
6447
|
+
A = null;
|
|
6448
|
+
}), await A), _ = zt.create({
|
|
6449
6449
|
timeout: e.requestTimeoutMs ?? za,
|
|
6450
6450
|
withCredentials: !1,
|
|
6451
6451
|
headers: {
|
|
@@ -6471,8 +6471,8 @@ function pc(e) {
|
|
|
6471
6471
|
return Promise.reject(T);
|
|
6472
6472
|
}
|
|
6473
6473
|
);
|
|
6474
|
-
const x = () => v === "account_suspended" ? null : h, fe = (T) => (
|
|
6475
|
-
|
|
6474
|
+
const x = () => v === "account_suspended" ? null : h, fe = (T) => (R.add(T), T(C), () => {
|
|
6475
|
+
R.delete(T);
|
|
6476
6476
|
}), Se = (T) => (w.add(T), T(v), () => {
|
|
6477
6477
|
w.delete(T);
|
|
6478
6478
|
}), B = () => d?.auth.tenantId ?? "global", K = (T) => {
|
|
@@ -6517,10 +6517,10 @@ function pc(e) {
|
|
|
6517
6517
|
function O(se, ae, le) {
|
|
6518
6518
|
if (!le)
|
|
6519
6519
|
return;
|
|
6520
|
-
const
|
|
6520
|
+
const Ae = (Le) => {
|
|
6521
6521
|
ae(Le) && le(Le);
|
|
6522
6522
|
};
|
|
6523
|
-
T.bind(se,
|
|
6523
|
+
T.bind(se, Ae), D.push({ event: se, handler: Ae });
|
|
6524
6524
|
}
|
|
6525
6525
|
return O("ConversationMessageSent", Kn, P.onMessageSent), O("ConversationMessageRead", Qn, P.onMessageRead), O("ConversationMessageEdited", Yn, P.onMessageEdited), O("ConversationMessageDeleted", Zn, P.onMessageDeleted), O("MessageReactionToggled", es, P.onReactionToggled), O("ConversationRequestAccepted", ts, P.onRequestAccepted), O("ConversationParticipantRemoved", ns, P.onParticipantRemoved), () => {
|
|
6526
6526
|
for (const se of D)
|
|
@@ -6593,7 +6593,7 @@ function pc(e) {
|
|
|
6593
6593
|
le.unbind("TypingStateChanged", we);
|
|
6594
6594
|
};
|
|
6595
6595
|
}
|
|
6596
|
-
const
|
|
6596
|
+
const Ae = [], Le = (we) => {
|
|
6597
6597
|
const ge = Jn(we);
|
|
6598
6598
|
if (ge) {
|
|
6599
6599
|
if (se.has(ge.state)) {
|
|
@@ -6615,9 +6615,9 @@ function pc(e) {
|
|
|
6615
6615
|
});
|
|
6616
6616
|
}
|
|
6617
6617
|
};
|
|
6618
|
-
return O.listen(".TypingStateChanged", Le),
|
|
6618
|
+
return O.listen(".TypingStateChanged", Le), Ae.push({ event: ".TypingStateChanged", handler: Le }), () => {
|
|
6619
6619
|
if (typeof O.stopListening == "function")
|
|
6620
|
-
for (const we of
|
|
6620
|
+
for (const we of Ae)
|
|
6621
6621
|
O.stopListening(we.event, we.handler);
|
|
6622
6622
|
};
|
|
6623
6623
|
};
|
|
@@ -6665,7 +6665,7 @@ export {
|
|
|
6665
6665
|
W as getApi,
|
|
6666
6666
|
ke as getAuthStore,
|
|
6667
6667
|
En as getConnectionStatus,
|
|
6668
|
-
|
|
6668
|
+
Re as getEcho,
|
|
6669
6669
|
gs as getEchoConnectionStatus,
|
|
6670
6670
|
Je as getEchoInitializedEvent,
|
|
6671
6671
|
Z as getErrorMessage,
|