@codingfactory/messenger-client 0.2.30 → 0.2.32
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 +799 -784
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { ref as ye, getCurrentInstance as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import
|
|
1
|
+
import { ref as ye, getCurrentInstance as Nt, computed as re, watch as ot, onUnmounted as qe, toValue as ss, onMounted as qt } from "vue";
|
|
2
|
+
import { defineStore as Oi, storeToRefs as Fi } from "pinia";
|
|
3
|
+
import zt, { isAxiosError as Di, AxiosHeaders as Tn } from "axios";
|
|
4
4
|
import { isAxiosError as vc } from "axios";
|
|
5
|
-
import { useRoute as
|
|
6
|
-
const
|
|
7
|
-
},
|
|
8
|
-
},
|
|
5
|
+
import { useRoute as Ni } from "vue-router";
|
|
6
|
+
const rs = () => () => {
|
|
7
|
+
}, is = () => () => {
|
|
8
|
+
}, os = async () => {
|
|
9
|
+
}, as = () => {
|
|
10
|
+
}, cs = () => {
|
|
9
11
|
}, us = () => {
|
|
10
12
|
}, ls = () => {
|
|
11
13
|
}, ds = () => {
|
|
12
|
-
}, hs = () => {
|
|
13
|
-
}, fs = () => {
|
|
14
14
|
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
|
-
},
|
|
15
|
+
}, hs = () => {
|
|
16
16
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
17
|
-
},
|
|
17
|
+
}, fs = async () => null, $ = {
|
|
18
18
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
19
19
|
getEcho: () => null,
|
|
20
|
-
waitForEcho:
|
|
20
|
+
waitForEcho: fs,
|
|
21
21
|
getConnectionStatus: () => "disconnected",
|
|
22
22
|
getAccessState: () => "available",
|
|
23
|
-
onConnectionStatusChange:
|
|
24
|
-
onAccessStateChange:
|
|
25
|
-
reconnect:
|
|
26
|
-
subscribeToPresenceStatus:
|
|
27
|
-
unsubscribeFromPresenceStatus:
|
|
28
|
-
subscribeToConversation:
|
|
29
|
-
unsubscribeFromConversation:
|
|
30
|
-
subscribeToTyping:
|
|
31
|
-
unsubscribeFromTyping:
|
|
32
|
-
}, Je = () => $.ECHO_INITIALIZED_EVENT, Ae = () => $.getEcho(),
|
|
23
|
+
onConnectionStatusChange: rs,
|
|
24
|
+
onAccessStateChange: is,
|
|
25
|
+
reconnect: os,
|
|
26
|
+
subscribeToPresenceStatus: as,
|
|
27
|
+
unsubscribeFromPresenceStatus: cs,
|
|
28
|
+
subscribeToConversation: ds,
|
|
29
|
+
unsubscribeFromConversation: us,
|
|
30
|
+
subscribeToTyping: hs,
|
|
31
|
+
unsubscribeFromTyping: ls
|
|
32
|
+
}, Je = () => $.ECHO_INITIALIZED_EVENT, Ae = () => $.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
|
-
},
|
|
35
|
-
function
|
|
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
|
+
function Wi(e) {
|
|
36
36
|
e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho =
|
|
38
|
+
function Gi() {
|
|
39
|
+
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = fs, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = rs, $.onAccessStateChange = is, $.reconnect = os, $.subscribeToPresenceStatus = as, $.unsubscribeFromPresenceStatus = cs, $.subscribeToConversation = ds, $.unsubscribeFromConversation = us, $.subscribeToTyping = hs, $.unsubscribeFromTyping = ls;
|
|
40
40
|
}
|
|
41
41
|
function xe(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ji(e) {
|
|
45
45
|
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Ki(e) {
|
|
48
48
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Qi(e) {
|
|
51
51
|
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Yi(e) {
|
|
54
54
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Zi(e) {
|
|
57
57
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function eo(e) {
|
|
60
60
|
return xe(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let
|
|
62
|
+
const ms = zt;
|
|
63
|
+
let jt = ms;
|
|
64
64
|
function W() {
|
|
65
|
-
return
|
|
65
|
+
return jt;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
67
|
+
function to(e) {
|
|
68
|
+
jt = e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
70
|
+
function no() {
|
|
71
|
+
jt = ms;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
let
|
|
75
|
-
function
|
|
76
|
-
return
|
|
73
|
+
const vs = zt;
|
|
74
|
+
let $t = vs;
|
|
75
|
+
function Ht() {
|
|
76
|
+
return $t;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
78
|
+
function so(e) {
|
|
79
|
+
$t = e;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
81
|
+
function ro() {
|
|
82
|
+
$t = vs;
|
|
83
83
|
}
|
|
84
|
-
const
|
|
84
|
+
const bs = {
|
|
85
85
|
currentUser: null
|
|
86
86
|
};
|
|
87
|
-
let
|
|
87
|
+
let Bt = () => bs;
|
|
88
88
|
function ke() {
|
|
89
|
-
return
|
|
89
|
+
return Bt;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
91
|
+
function io(e) {
|
|
92
|
+
Bt = e;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
94
|
+
function oo() {
|
|
95
|
+
Bt = () => bs;
|
|
96
96
|
}
|
|
97
97
|
function Z(e) {
|
|
98
|
-
if (
|
|
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
|
}
|
|
@@ -107,29 +107,29 @@ function rc(e) {
|
|
|
107
107
|
function ic(e) {
|
|
108
108
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const ys = {
|
|
111
111
|
async uploadImage() {
|
|
112
112
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
let
|
|
116
|
-
function
|
|
117
|
-
return
|
|
115
|
+
let Vt = ys;
|
|
116
|
+
function ao() {
|
|
117
|
+
return Vt;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
119
|
+
function co(e) {
|
|
120
|
+
Vt = e;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
122
|
+
function uo() {
|
|
123
|
+
Vt = ys;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function lo(e) {
|
|
126
126
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function _s(e) {
|
|
129
129
|
return typeof e == "object" && e !== null;
|
|
130
130
|
}
|
|
131
131
|
function $e(e) {
|
|
132
|
-
return !
|
|
132
|
+
return !_s(e) || !("data" in e) ? e : e.data;
|
|
133
133
|
}
|
|
134
134
|
function nt(e, n) {
|
|
135
135
|
const r = e[n];
|
|
@@ -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 An(e, n) {
|
|
141
141
|
const r = e[n];
|
|
142
142
|
if (r == null)
|
|
143
143
|
return null;
|
|
@@ -145,7 +145,7 @@ function Pn(e, n) {
|
|
|
145
145
|
throw new Error(`Invalid messaging folder payload: ${n} must be a string or null`);
|
|
146
146
|
return r;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Et(e, n) {
|
|
149
149
|
const r = e[n];
|
|
150
150
|
if (typeof r == "number" && Number.isFinite(r))
|
|
151
151
|
return r;
|
|
@@ -156,43 +156,43 @@ function Rt(e, n) {
|
|
|
156
156
|
}
|
|
157
157
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
if (!
|
|
159
|
+
function Ut(e) {
|
|
160
|
+
if (!_s(e))
|
|
161
161
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
162
162
|
return {
|
|
163
163
|
id: nt(e, "id"),
|
|
164
164
|
name: nt(e, "name"),
|
|
165
|
-
color:
|
|
166
|
-
icon:
|
|
167
|
-
sort_order:
|
|
168
|
-
conversation_count:
|
|
169
|
-
unread_count:
|
|
165
|
+
color: An(e, "color"),
|
|
166
|
+
icon: An(e, "icon"),
|
|
167
|
+
sort_order: Et(e, "sort_order"),
|
|
168
|
+
conversation_count: Et(e, "conversation_count"),
|
|
169
|
+
unread_count: Et(e, "unread_count"),
|
|
170
170
|
created_at: nt(e, "created_at"),
|
|
171
171
|
updated_at: nt(e, "updated_at")
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function ho(e) {
|
|
175
175
|
if (!Array.isArray(e))
|
|
176
176
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
177
|
-
return e.map((n) =>
|
|
177
|
+
return e.map((n) => Ut(n));
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!
|
|
179
|
+
function Rn(e) {
|
|
180
|
+
if (!lo(e))
|
|
181
181
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
182
182
|
return e;
|
|
183
183
|
}
|
|
184
184
|
const Pe = {
|
|
185
185
|
async fetchFolders() {
|
|
186
186
|
const e = await W().get("/v1/messaging/folders");
|
|
187
|
-
return
|
|
187
|
+
return ho($e(e.data));
|
|
188
188
|
},
|
|
189
189
|
async createFolder(e) {
|
|
190
190
|
const n = await W().post("/v1/messaging/folders", e);
|
|
191
|
-
return
|
|
191
|
+
return Ut($e(n.data));
|
|
192
192
|
},
|
|
193
193
|
async updateFolder(e, n) {
|
|
194
194
|
const r = await W().patch(`/v1/messaging/folders/${e}`, n);
|
|
195
|
-
return
|
|
195
|
+
return Ut($e(r.data));
|
|
196
196
|
},
|
|
197
197
|
async deleteFolder(e) {
|
|
198
198
|
await W().delete(`/v1/messaging/folders/${e}`);
|
|
@@ -204,57 +204,57 @@ 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 Rn($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 Rn($e(n.data));
|
|
212
212
|
},
|
|
213
213
|
async declineRequest(e) {
|
|
214
214
|
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
215
215
|
}
|
|
216
|
-
},
|
|
217
|
-
function
|
|
216
|
+
}, fo = 6e4;
|
|
217
|
+
function po(e) {
|
|
218
218
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function go(e) {
|
|
221
221
|
if (typeof e != "string")
|
|
222
222
|
return null;
|
|
223
223
|
const n = e.trim().toLowerCase();
|
|
224
|
-
return
|
|
224
|
+
return po(n) ? n : null;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Ss(e) {
|
|
227
227
|
if (typeof e != "string")
|
|
228
228
|
return null;
|
|
229
229
|
const n = e.trim();
|
|
230
230
|
return n.length > 0 ? n : null;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
const n =
|
|
232
|
+
function Ot(e) {
|
|
233
|
+
const n = Ss(e);
|
|
234
234
|
if (n === null)
|
|
235
235
|
return null;
|
|
236
236
|
const r = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(r) ? r : `${r}Z`, c = new Date(o);
|
|
237
237
|
return Number.isNaN(c.getTime()) ? null : c;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function mo(e, n, r = {}) {
|
|
240
240
|
if (e === null)
|
|
241
241
|
return null;
|
|
242
242
|
if (e === "offline")
|
|
243
243
|
return "offline";
|
|
244
|
-
const o =
|
|
244
|
+
const o = Ot(n);
|
|
245
245
|
if (o === null)
|
|
246
246
|
return e;
|
|
247
|
-
const c = r.now ?? Date.now(), u = r.staleAfterMs ??
|
|
247
|
+
const c = r.now ?? Date.now(), u = r.staleAfterMs ?? fo;
|
|
248
248
|
return c - o.getTime() > u ? "offline" : e;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
const r =
|
|
250
|
+
function Ft(e, n = {}) {
|
|
251
|
+
const r = Ss(e?.last_seen_at), o = go(e?.status);
|
|
252
252
|
return {
|
|
253
|
-
status:
|
|
253
|
+
status: mo(o, r, n),
|
|
254
254
|
lastSeenAt: r
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const Pn = 1e3, Xt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Wt = (e) => {
|
|
258
258
|
if (typeof e == "number" && Number.isFinite(e))
|
|
259
259
|
return e;
|
|
260
260
|
if (typeof e == "string") {
|
|
@@ -262,32 +262,32 @@ const kn = 1e3, Gt = 4e3, yo = 12e4, _o = 300, So = 1, Co = 1600, Jt = (e) => {
|
|
|
262
262
|
if (Number.isFinite(n))
|
|
263
263
|
return n;
|
|
264
264
|
}
|
|
265
|
-
},
|
|
266
|
-
const r =
|
|
267
|
-
return r === void 0 ? !0 : r === 429 ||
|
|
268
|
-
},
|
|
265
|
+
}, Cs = (e) => typeof e == "number" && e >= 500 && e < 600, Mn = (e) => {
|
|
266
|
+
const r = Wt(e.response?.status);
|
|
267
|
+
return r === void 0 ? !0 : r === 429 || Cs(r);
|
|
268
|
+
}, ws = (e) => {
|
|
269
269
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
270
|
-
return Math.max(
|
|
270
|
+
return Math.max(Pn, e * 1e3);
|
|
271
271
|
if (typeof e == "string") {
|
|
272
272
|
const n = Number.parseInt(e, 10);
|
|
273
273
|
if (Number.isFinite(n) && n > 0)
|
|
274
|
-
return Math.max(
|
|
274
|
+
return Math.max(Pn, n * 1e3);
|
|
275
275
|
}
|
|
276
|
-
return
|
|
277
|
-
},
|
|
278
|
-
const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o =
|
|
279
|
-
return Math.min(
|
|
280
|
-
},
|
|
276
|
+
return Xt;
|
|
277
|
+
}, So = (e) => {
|
|
278
|
+
const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o = Xt * r;
|
|
279
|
+
return Math.min(vo, o);
|
|
280
|
+
}, Co = (e) => {
|
|
281
281
|
const n = e;
|
|
282
|
-
return
|
|
283
|
-
},
|
|
282
|
+
return Wt(n.response?.status) === 429 ? ws(n.response?.headers?.["retry-after"]) : bo;
|
|
283
|
+
}, kn = async (e) => {
|
|
284
284
|
await new Promise((n) => {
|
|
285
285
|
setTimeout(n, e);
|
|
286
286
|
});
|
|
287
|
-
},
|
|
287
|
+
}, xn = () => ({
|
|
288
288
|
data: [],
|
|
289
289
|
has_more: !1
|
|
290
|
-
}),
|
|
290
|
+
}), Ln = () => It() === "account_suspended", wo = (e) => {
|
|
291
291
|
if (!he(e))
|
|
292
292
|
return !1;
|
|
293
293
|
const r = (he(e.data) ? e.data : e).throttled;
|
|
@@ -301,7 +301,7 @@ const kn = 1e3, Gt = 4e3, yo = 12e4, _o = 300, So = 1, Co = 1600, Jt = (e) => {
|
|
|
301
301
|
}
|
|
302
302
|
return !1;
|
|
303
303
|
};
|
|
304
|
-
function
|
|
304
|
+
function To(e, n, r) {
|
|
305
305
|
const o = typeof e == "string" && e.trim().length > 0 ? e.trim().toLowerCase() : void 0;
|
|
306
306
|
if (o)
|
|
307
307
|
return o;
|
|
@@ -311,17 +311,17 @@ function Ao(e, n, r) {
|
|
|
311
311
|
const u = typeof r == "string" && r.trim().length > 0 ? r.trim().toLowerCase() : void 0;
|
|
312
312
|
return u ? u === "image" ? "image/*" : u === "video" ? "video/*" : u === "audio" ? "audio/*" : u : "application/octet-stream";
|
|
313
313
|
}
|
|
314
|
-
function
|
|
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 ?? Ao(n),
|
|
318
318
|
url: n,
|
|
319
|
-
type:
|
|
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 Ao(e) {
|
|
325
325
|
if (!e) return "attachment";
|
|
326
326
|
try {
|
|
327
327
|
const r = new URL(e).pathname.split("/");
|
|
@@ -330,8 +330,8 @@ function Po(e) {
|
|
|
330
330
|
return "attachment";
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
333
|
+
function Ro(e) {
|
|
334
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map(Eo);
|
|
335
335
|
}
|
|
336
336
|
function Ne(e) {
|
|
337
337
|
if (typeof e != "string")
|
|
@@ -340,7 +340,7 @@ function Ne(e) {
|
|
|
340
340
|
if (n.length !== 0)
|
|
341
341
|
return n;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Po(e) {
|
|
344
344
|
if (!e)
|
|
345
345
|
return;
|
|
346
346
|
const n = Ne(e.avatar) ?? Ne(e.avatar_url), r = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
@@ -367,12 +367,12 @@ function at(e) {
|
|
|
367
367
|
} : null;
|
|
368
368
|
return {
|
|
369
369
|
...e,
|
|
370
|
-
...r ? { author:
|
|
370
|
+
...r ? { author: Po(r) } : {},
|
|
371
371
|
shared_post: o,
|
|
372
|
-
attachments:
|
|
372
|
+
attachments: Ro(e.attachments)
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Mo(e) {
|
|
376
376
|
if (!e || !he(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() : "";
|
|
@@ -395,20 +395,20 @@ function xo(e) {
|
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function At(e) {
|
|
399
399
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function In(e) {
|
|
402
402
|
if (!(typeof e != "string" || e.length === 0))
|
|
403
403
|
return e;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function Dt(e) {
|
|
406
406
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function ko(e, n = []) {
|
|
409
409
|
const r = /* @__PURE__ */ new Map();
|
|
410
410
|
for (const o of n) {
|
|
411
|
-
const c =
|
|
411
|
+
const c = In(o.last_read_message_id);
|
|
412
412
|
c && r.set(o.user_id, c);
|
|
413
413
|
}
|
|
414
414
|
return e.map((o) => {
|
|
@@ -417,7 +417,7 @@ function Lo(e, n = []) {
|
|
|
417
417
|
name: o.user.name,
|
|
418
418
|
...u ? { avatar: u } : {},
|
|
419
419
|
...o.user.handle ? { handle: o.user.handle } : {}
|
|
420
|
-
} : void 0, f =
|
|
420
|
+
} : void 0, f = In(o.last_read_message_id);
|
|
421
421
|
if (f)
|
|
422
422
|
return {
|
|
423
423
|
...o,
|
|
@@ -442,14 +442,14 @@ function Lo(e, n = []) {
|
|
|
442
442
|
};
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
return Object.prototype.hasOwnProperty.call(e, "muted_until") ?
|
|
445
|
+
function xo(e, n) {
|
|
446
|
+
return Object.prototype.hasOwnProperty.call(e, "muted_until") ? At(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? At(e.me.muted_until) : At(n?.muted_until);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
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 =
|
|
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, R = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
|
|
453
453
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
454
454
|
return !1;
|
|
455
455
|
const E = n.last_message?.id, b = e.last_message?.id;
|
|
@@ -458,7 +458,7 @@ function He(e, n) {
|
|
|
458
458
|
return {
|
|
459
459
|
...e,
|
|
460
460
|
unread_count: o || v ? 0 : d,
|
|
461
|
-
participants:
|
|
461
|
+
participants: ko(e.participants, n?.participants),
|
|
462
462
|
is_muted: o,
|
|
463
463
|
muted_until: r,
|
|
464
464
|
is_pinned: f,
|
|
@@ -469,29 +469,29 @@ function He(e, n) {
|
|
|
469
469
|
...u ? { last_message_at: u } : {}
|
|
470
470
|
};
|
|
471
471
|
}
|
|
472
|
-
function
|
|
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
|
|
476
|
-
return
|
|
475
|
+
function Rt(e) {
|
|
476
|
+
return Io(e) ? 0 : e.unread_count || 0;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Un(e, n) {
|
|
479
479
|
const r = n[e.id];
|
|
480
480
|
if (Array.isArray(r))
|
|
481
481
|
for (let o = r.length - 1; o >= 0; o -= 1) {
|
|
482
482
|
const c = r[o]?.id;
|
|
483
|
-
if (
|
|
483
|
+
if (Dt(c))
|
|
484
484
|
return c;
|
|
485
485
|
}
|
|
486
|
-
return
|
|
486
|
+
return Dt(e.last_message?.id) ? e.last_message.id : null;
|
|
487
487
|
}
|
|
488
488
|
function he(e) {
|
|
489
489
|
return typeof e == "object" && e !== null;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function Uo(e) {
|
|
492
492
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function On(e) {
|
|
495
495
|
if (!Array.isArray(e))
|
|
496
496
|
return [];
|
|
497
497
|
const n = [];
|
|
@@ -512,7 +512,7 @@ function Dn(e) {
|
|
|
512
512
|
}
|
|
513
513
|
return n;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function Oo(e, n) {
|
|
516
516
|
const r = he(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;
|
|
@@ -522,16 +522,16 @@ function st(e, n) {
|
|
|
522
522
|
let c = [];
|
|
523
523
|
return Array.isArray(o) ? c = o : he(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
|
-
nextCursor:
|
|
525
|
+
nextCursor: Oo(r, o)
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function Fn(e) {
|
|
529
529
|
return he(e) && typeof e.id == "string" && e.id.length > 0;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Dn(e) {
|
|
532
532
|
return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function Gt(e, n) {
|
|
535
535
|
if (e.type !== "dm")
|
|
536
536
|
return !1;
|
|
537
537
|
const r = e.participants.find((c) => c.user_id === n);
|
|
@@ -540,7 +540,7 @@ function Kt(e, n) {
|
|
|
540
540
|
const o = r.user.name.trim();
|
|
541
541
|
return r.user.id === n && o.length > 0 && o.toLowerCase() !== "pending user";
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function Nn(e) {
|
|
544
544
|
if (!he(e) || typeof e.id != "string" || typeof e.name != "string")
|
|
545
545
|
return null;
|
|
546
546
|
const n = {
|
|
@@ -551,11 +551,11 @@ function zn(e) {
|
|
|
551
551
|
const r = typeof e.avatar == "string" ? e.avatar : null, o = typeof e.avatar_url == "string" ? e.avatar_url : null, c = Ne(r) ?? Ne(o);
|
|
552
552
|
return c && (n.avatar = c, n.avatar_url = c), n;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Fo(e) {
|
|
555
555
|
const r = (he(e) ? e : {}).data ?? e;
|
|
556
|
-
return Array.isArray(r) ? r.map((o) =>
|
|
556
|
+
return Array.isArray(r) ? r.map((o) => Nn(o)).filter((o) => o !== null) : he(r) ? Object.values(r).map((o) => Nn(o)).filter((o) => o !== null) : [];
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function Ts(e) {
|
|
559
559
|
if (e.type !== "dm")
|
|
560
560
|
return null;
|
|
561
561
|
const n = ke()().currentUser?.id;
|
|
@@ -566,19 +566,19 @@ function As(e) {
|
|
|
566
566
|
}
|
|
567
567
|
return e.participants.find((o) => o.user ? o.user.name.trim().toLowerCase() === "pending user" : !0)?.user_id ?? null;
|
|
568
568
|
}
|
|
569
|
-
async function
|
|
570
|
-
return (await
|
|
569
|
+
async function Do(e) {
|
|
570
|
+
return (await Es([e])).get(e) ?? null;
|
|
571
571
|
}
|
|
572
|
-
async function
|
|
572
|
+
async function Es(e) {
|
|
573
573
|
const n = Array.from(new Set(e.filter((r) => r.length > 0)));
|
|
574
574
|
if (n.length === 0)
|
|
575
575
|
return /* @__PURE__ */ new Map();
|
|
576
576
|
try {
|
|
577
|
-
const r = await
|
|
577
|
+
const r = await Ht().get("/v1/identity/users/by-ids", {
|
|
578
578
|
params: {
|
|
579
579
|
ids: n.join(",")
|
|
580
580
|
}
|
|
581
|
-
}), o =
|
|
581
|
+
}), o = Fo(r.data), c = /* @__PURE__ */ new Map();
|
|
582
582
|
for (const u of o)
|
|
583
583
|
n.includes(u.id) && c.set(u.id, {
|
|
584
584
|
id: u.id,
|
|
@@ -591,10 +591,10 @@ async function Rs(e) {
|
|
|
591
591
|
return /* @__PURE__ */ new Map();
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
async function
|
|
595
|
-
if (e.type !== "dm" ||
|
|
594
|
+
async function qn(e, n) {
|
|
595
|
+
if (e.type !== "dm" || Gt(e, n))
|
|
596
596
|
return e;
|
|
597
|
-
const r = await
|
|
597
|
+
const r = await Do(n);
|
|
598
598
|
if (!r)
|
|
599
599
|
return e;
|
|
600
600
|
const o = e.participants.map((c) => c.user_id !== n ? c : {
|
|
@@ -606,15 +606,15 @@ async function jn(e, n) {
|
|
|
606
606
|
participants: o
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
-
async function
|
|
609
|
+
async function zn(e) {
|
|
610
610
|
const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
611
611
|
for (const c of e) {
|
|
612
|
-
const u =
|
|
613
|
-
!u ||
|
|
612
|
+
const u = Ts(c);
|
|
613
|
+
!u || Gt(c, u) || (n.set(c.id, u), r.add(u));
|
|
614
614
|
}
|
|
615
615
|
if (r.size === 0)
|
|
616
616
|
return e;
|
|
617
|
-
const o = await
|
|
617
|
+
const o = await Es(Array.from(r));
|
|
618
618
|
return o.size === 0 ? e : e.map((c) => {
|
|
619
619
|
const u = n.get(c.id);
|
|
620
620
|
if (!u)
|
|
@@ -641,19 +641,19 @@ function rt(e, n) {
|
|
|
641
641
|
function Be(e) {
|
|
642
642
|
return [...e].sort((n, r) => n.sort_order !== r.sort_order ? n.sort_order - r.sort_order : n.name.localeCompare(r.name));
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function No(e, n) {
|
|
645
645
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function jn(e, n) {
|
|
648
648
|
return e.map((r) => {
|
|
649
|
-
const o =
|
|
649
|
+
const o = No(r.folder_id, n);
|
|
650
650
|
return (r.folder_id ?? null) === o ? r : {
|
|
651
651
|
...r,
|
|
652
652
|
folder_id: o
|
|
653
653
|
};
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function $n(e, n, r) {
|
|
657
657
|
let o = !1;
|
|
658
658
|
const c = e.map((u) => u.id !== n || (u.folder_id ?? null) === r ? u : (o = !0, {
|
|
659
659
|
...u,
|
|
@@ -661,7 +661,7 @@ function Bn(e, n, r) {
|
|
|
661
661
|
}));
|
|
662
662
|
return o ? c : e;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function qo(e, n, r) {
|
|
665
665
|
if (n === r)
|
|
666
666
|
return e;
|
|
667
667
|
let o = !1;
|
|
@@ -674,7 +674,7 @@ function jo(e, n, r) {
|
|
|
674
674
|
});
|
|
675
675
|
return o ? c : e;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function Pt(e) {
|
|
678
678
|
const n = /* @__PURE__ */ new Map();
|
|
679
679
|
for (const r of e.requests)
|
|
680
680
|
r.is_request === !0 && n.set(r.id, r);
|
|
@@ -682,7 +682,7 @@ function kt(e) {
|
|
|
682
682
|
r.is_request === !0 && n.set(r.id, r);
|
|
683
683
|
return Array.from(n.values()).sort(Xe);
|
|
684
684
|
}
|
|
685
|
-
const
|
|
685
|
+
const Jt = Oi("messaging", {
|
|
686
686
|
state: () => ({
|
|
687
687
|
conversations: [],
|
|
688
688
|
requests: [],
|
|
@@ -713,25 +713,25 @@ const Qt = Di("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) => Rt(n) > 0).length,
|
|
717
|
+
unreadCount: (e) => e.conversations.reduce((n, r) => n + Rt(r), 0),
|
|
718
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + Rt(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),
|
|
722
722
|
hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
|
|
723
723
|
isLoadingMessages: (e) => (n) => e.loadingMessages[n] ?? !1,
|
|
724
724
|
// Message request getters
|
|
725
|
-
requestConversations: (e) =>
|
|
726
|
-
requestCount: (e) =>
|
|
727
|
-
unreadRequestCount: (e) =>
|
|
725
|
+
requestConversations: (e) => Pt(e),
|
|
726
|
+
requestCount: (e) => Pt(e).length,
|
|
727
|
+
unreadRequestCount: (e) => Pt(e).filter((n) => n.unread_count > 0).length
|
|
728
728
|
},
|
|
729
729
|
actions: {
|
|
730
730
|
normalizeFolderAssignmentsState() {
|
|
731
731
|
if (!this.foldersLoaded)
|
|
732
732
|
return;
|
|
733
733
|
const e = new Set(this.folders.map((n) => n.id));
|
|
734
|
-
this.conversations =
|
|
734
|
+
this.conversations = jn(this.conversations, e), this.requests = jn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
|
|
735
735
|
},
|
|
736
736
|
async fetchFolders() {
|
|
737
737
|
try {
|
|
@@ -798,15 +798,15 @@ const Qt = Di("messaging", {
|
|
|
798
798
|
if (!o)
|
|
799
799
|
return;
|
|
800
800
|
const c = o.folder_id ?? null, u = typeof r.folder_id == "string" || r.folder_id === null ? r.folder_id : n;
|
|
801
|
-
this.conversations =
|
|
801
|
+
this.conversations = $n(
|
|
802
802
|
this.conversations,
|
|
803
803
|
e,
|
|
804
804
|
u
|
|
805
|
-
), this.requests =
|
|
805
|
+
), this.requests = $n(
|
|
806
806
|
this.requests,
|
|
807
807
|
e,
|
|
808
808
|
u
|
|
809
|
-
), this.folders =
|
|
809
|
+
), this.folders = qo(
|
|
810
810
|
this.folders,
|
|
811
811
|
c,
|
|
812
812
|
u
|
|
@@ -818,8 +818,8 @@ const Qt = Di("messaging", {
|
|
|
818
818
|
async fetchConversations(e, n, r, o) {
|
|
819
819
|
this.loading = !0, this.error = null;
|
|
820
820
|
try {
|
|
821
|
-
if (
|
|
822
|
-
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()),
|
|
821
|
+
if (Ln())
|
|
822
|
+
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), xn();
|
|
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
825
|
const d = await W().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
|
|
@@ -830,7 +830,7 @@ const Qt = Di("messaging", {
|
|
|
830
830
|
(A) => A.id === E.id
|
|
831
831
|
);
|
|
832
832
|
return He(E, b);
|
|
833
|
-
}), C = await
|
|
833
|
+
}), C = await zn(R);
|
|
834
834
|
e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
835
835
|
const v = {
|
|
836
836
|
data: C,
|
|
@@ -838,7 +838,7 @@ const Qt = Di("messaging", {
|
|
|
838
838
|
};
|
|
839
839
|
return h !== void 0 && (v.next_cursor = h), v;
|
|
840
840
|
} catch (c) {
|
|
841
|
-
throw o?.background &&
|
|
841
|
+
throw o?.background && Mn(c) || (this.error = Z(c)), c;
|
|
842
842
|
} finally {
|
|
843
843
|
this.loading = !1;
|
|
844
844
|
}
|
|
@@ -852,8 +852,8 @@ const Qt = Di("messaging", {
|
|
|
852
852
|
includePresence: !1
|
|
853
853
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
854
854
|
} catch (e) {
|
|
855
|
-
const n = e, r =
|
|
856
|
-
return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
855
|
+
const n = e, r = Wt(n.response?.status);
|
|
856
|
+
return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + ws(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, r === void 0 || Cs(r) ? (this.backgroundPollRetryAfterUntil = Date.now() + So(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Xt, !1));
|
|
857
857
|
}
|
|
858
858
|
},
|
|
859
859
|
async fetchConversation(e) {
|
|
@@ -863,8 +863,8 @@ const Qt = Di("messaging", {
|
|
|
863
863
|
params: { include_presence: 1 }
|
|
864
864
|
}), r = this.conversations.find((f) => f.id === e);
|
|
865
865
|
let o = He(n.data.data || n.data, r);
|
|
866
|
-
const c =
|
|
867
|
-
c && (o = await
|
|
866
|
+
const c = Ts(o);
|
|
867
|
+
c && (o = await qn(o, c));
|
|
868
868
|
const u = this.conversations.findIndex((f) => f.id === e);
|
|
869
869
|
u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
|
|
870
870
|
const d = this.requests.findIndex((f) => f.id === e);
|
|
@@ -878,8 +878,8 @@ const Qt = Di("messaging", {
|
|
|
878
878
|
async fetchRequests(e) {
|
|
879
879
|
this.loading = !0, this.error = null;
|
|
880
880
|
try {
|
|
881
|
-
if (
|
|
882
|
-
return e || (this.requests = [], this.normalizeFolderAssignmentsState()),
|
|
881
|
+
if (Ln())
|
|
882
|
+
return e || (this.requests = [], this.normalizeFolderAssignmentsState()), xn();
|
|
883
883
|
const n = {
|
|
884
884
|
include_presence: 1,
|
|
885
885
|
filter: "requests"
|
|
@@ -891,7 +891,7 @@ const Qt = Di("messaging", {
|
|
|
891
891
|
), u = o.map((h) => {
|
|
892
892
|
const R = this.requests.find((C) => C.id === h.id);
|
|
893
893
|
return He(h, R);
|
|
894
|
-
}), d = await
|
|
894
|
+
}), d = await zn(u);
|
|
895
895
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
896
896
|
const f = {
|
|
897
897
|
data: d,
|
|
@@ -914,9 +914,9 @@ const Qt = Di("messaging", {
|
|
|
914
914
|
c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
|
|
915
915
|
break;
|
|
916
916
|
} catch (v) {
|
|
917
|
-
if (!(o <
|
|
917
|
+
if (!(o < yo && Mn(v)))
|
|
918
918
|
throw v;
|
|
919
|
-
o += 1, await
|
|
919
|
+
o += 1, await kn(Co(v));
|
|
920
920
|
}
|
|
921
921
|
const { items: u, nextCursor: d } = st(
|
|
922
922
|
c.data,
|
|
@@ -942,7 +942,7 @@ const Qt = Di("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()}`, R = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C =
|
|
945
|
+
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, R = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = Mo(d), v = f.currentUser, E = {
|
|
946
946
|
id: h,
|
|
947
947
|
conversation_id: e,
|
|
948
948
|
author_id: v?.id || "",
|
|
@@ -971,7 +971,7 @@ const Qt = Di("messaging", {
|
|
|
971
971
|
if (r && r.length > 0) {
|
|
972
972
|
const G = await Promise.all(
|
|
973
973
|
r.map(async (te) => {
|
|
974
|
-
const k = await
|
|
974
|
+
const k = await ao().uploadImage(te);
|
|
975
975
|
return {
|
|
976
976
|
media_id: k.id,
|
|
977
977
|
mime: k.mime_type,
|
|
@@ -1018,13 +1018,20 @@ const Qt = Di("messaging", {
|
|
|
1018
1018
|
async deleteMessage(e, n) {
|
|
1019
1019
|
try {
|
|
1020
1020
|
await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
|
|
1021
|
-
const r = this.messages[e]
|
|
1022
|
-
if (
|
|
1023
|
-
const
|
|
1024
|
-
if (
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1021
|
+
const r = this.messages[e];
|
|
1022
|
+
if (r) {
|
|
1023
|
+
const o = r.findIndex((c) => c.id === n);
|
|
1024
|
+
if (o >= 0) {
|
|
1025
|
+
const c = r[o];
|
|
1026
|
+
if (c) {
|
|
1027
|
+
const u = { ...c, is_deleted: !0 };
|
|
1028
|
+
delete u.body, this.messages[e] = [
|
|
1029
|
+
...r.slice(0, o),
|
|
1030
|
+
u,
|
|
1031
|
+
...r.slice(o + 1)
|
|
1032
|
+
];
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1028
1035
|
}
|
|
1029
1036
|
} catch (r) {
|
|
1030
1037
|
throw this.error = Z(r), r;
|
|
@@ -1038,11 +1045,11 @@ const Qt = Di("messaging", {
|
|
|
1038
1045
|
return null;
|
|
1039
1046
|
for (let u = c.length - 1; u >= 0; u -= 1) {
|
|
1040
1047
|
const d = c[u]?.id;
|
|
1041
|
-
if (
|
|
1048
|
+
if (Dt(d))
|
|
1042
1049
|
return d;
|
|
1043
1050
|
}
|
|
1044
1051
|
return null;
|
|
1045
|
-
})(), o = n ?
|
|
1052
|
+
})(), o = n ? Un(n, this.messages) : r;
|
|
1046
1053
|
if (!o)
|
|
1047
1054
|
return;
|
|
1048
1055
|
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
@@ -1061,7 +1068,7 @@ const Qt = Di("messaging", {
|
|
|
1061
1068
|
if (e.length === 0)
|
|
1062
1069
|
return;
|
|
1063
1070
|
const n = e.map((c) => {
|
|
1064
|
-
const u =
|
|
1071
|
+
const u = Un(c, this.messages);
|
|
1065
1072
|
return u ? {
|
|
1066
1073
|
conversationId: c.id,
|
|
1067
1074
|
messageId: u
|
|
@@ -1093,9 +1100,9 @@ const Qt = Di("messaging", {
|
|
|
1093
1100
|
async sendTyping(e, n = "start") {
|
|
1094
1101
|
try {
|
|
1095
1102
|
const r = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1096
|
-
if (n !== "start" || !
|
|
1103
|
+
if (n !== "start" || !wo(r.data))
|
|
1097
1104
|
return;
|
|
1098
|
-
await
|
|
1105
|
+
await kn(_o), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1099
1106
|
} catch (r) {
|
|
1100
1107
|
console.warn("Failed to send typing indicator:", r);
|
|
1101
1108
|
}
|
|
@@ -1163,10 +1170,10 @@ const Qt = Di("messaging", {
|
|
|
1163
1170
|
};
|
|
1164
1171
|
n && (r.message = n);
|
|
1165
1172
|
const o = await W().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
|
|
1166
|
-
if (!
|
|
1173
|
+
if (!Fn(c))
|
|
1167
1174
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1168
|
-
let u =
|
|
1169
|
-
return u = await
|
|
1175
|
+
let u = Dn(c) && Gt(c, e) ? He(c) : await this.fetchConversation(c.id);
|
|
1176
|
+
return u = await qn(u, e), u.is_request === !0 ? (this.requests = rt(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = rt(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
|
|
1170
1177
|
} catch (r) {
|
|
1171
1178
|
throw this.error = Z(r), r;
|
|
1172
1179
|
}
|
|
@@ -1177,9 +1184,9 @@ const Qt = Di("messaging", {
|
|
|
1177
1184
|
title: e,
|
|
1178
1185
|
participant_ids: n
|
|
1179
1186
|
}), o = r.data.data || r.data;
|
|
1180
|
-
if (!
|
|
1187
|
+
if (!Fn(o))
|
|
1181
1188
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1182
|
-
const c =
|
|
1189
|
+
const c = Dn(o) ? o : await this.fetchConversation(o.id);
|
|
1183
1190
|
return this.conversations = rt(this.conversations, c), c;
|
|
1184
1191
|
} catch (r) {
|
|
1185
1192
|
throw this.error = Z(r), r;
|
|
@@ -1284,7 +1291,11 @@ const Qt = Di("messaging", {
|
|
|
1284
1291
|
const f = d.findIndex((h) => h.id === n);
|
|
1285
1292
|
if (f >= 0) {
|
|
1286
1293
|
const h = d[f];
|
|
1287
|
-
h && (
|
|
1294
|
+
h && (this.messages[e] = [
|
|
1295
|
+
...d.slice(0, f),
|
|
1296
|
+
r(h),
|
|
1297
|
+
...d.slice(f + 1)
|
|
1298
|
+
]);
|
|
1288
1299
|
return;
|
|
1289
1300
|
}
|
|
1290
1301
|
o && this.addMessage(o);
|
|
@@ -1296,16 +1307,16 @@ const Qt = Di("messaging", {
|
|
|
1296
1307
|
try {
|
|
1297
1308
|
f = await W().post(o, c);
|
|
1298
1309
|
} catch (v) {
|
|
1299
|
-
if (!
|
|
1310
|
+
if (!Uo(v))
|
|
1300
1311
|
throw v;
|
|
1301
1312
|
f = await W().post(o, c);
|
|
1302
1313
|
}
|
|
1303
|
-
const h = he(f.data) && "data" in f.data ? f.data.data : f.data, R =
|
|
1314
|
+
const h = he(f.data) && "data" in f.data ? f.data.data : f.data, R = On(
|
|
1304
1315
|
he(h) ? h.reactions : void 0
|
|
1305
1316
|
);
|
|
1306
1317
|
(R.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, R);
|
|
1307
1318
|
try {
|
|
1308
|
-
const v = await W().get(o), E = he(v.data) && "data" in v.data ? v.data.data : v.data, b =
|
|
1319
|
+
const v = await W().get(o), E = he(v.data) && "data" in v.data ? v.data.data : v.data, b = On(
|
|
1309
1320
|
he(E) ? E.reactions : void 0
|
|
1310
1321
|
);
|
|
1311
1322
|
this.updateMessageReactions(e, n, b);
|
|
@@ -1334,7 +1345,11 @@ const Qt = Di("messaging", {
|
|
|
1334
1345
|
const f = u[d];
|
|
1335
1346
|
if (!f) return;
|
|
1336
1347
|
const h = { ...f };
|
|
1337
|
-
r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c),
|
|
1348
|
+
r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), this.messages[e] = [
|
|
1349
|
+
...u.slice(0, d),
|
|
1350
|
+
h,
|
|
1351
|
+
...u.slice(d + 1)
|
|
1352
|
+
];
|
|
1338
1353
|
const R = this.conversations.find((v) => v.id === e);
|
|
1339
1354
|
R?.last_message?.id === n && (R.last_message = h);
|
|
1340
1355
|
const C = this.requests.find((v) => v.id === e);
|
|
@@ -1371,7 +1386,7 @@ const Qt = Di("messaging", {
|
|
|
1371
1386
|
params: { ids: n }
|
|
1372
1387
|
}), o = r.data?.data?.items ?? r.data?.items ?? [];
|
|
1373
1388
|
for (const c of o) {
|
|
1374
|
-
const u =
|
|
1389
|
+
const u = Ft(c);
|
|
1375
1390
|
u.status !== null && this.updatePresenceForUser(c.id, u.status, u.lastSeenAt);
|
|
1376
1391
|
}
|
|
1377
1392
|
},
|
|
@@ -1464,21 +1479,21 @@ const Qt = Di("messaging", {
|
|
|
1464
1479
|
}
|
|
1465
1480
|
});
|
|
1466
1481
|
function oc(e) {
|
|
1467
|
-
const n =
|
|
1482
|
+
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = Nt(), f = d !== null, h = 20, R = 250;
|
|
1468
1483
|
let C = 0, v = null, E = null;
|
|
1469
|
-
const b = re(() => r.currentUser?.id), A = () =>
|
|
1484
|
+
const b = re(() => r.currentUser?.id), A = () => ss(e)?.trim() ?? "";
|
|
1470
1485
|
function w() {
|
|
1471
1486
|
v && (clearTimeout(v), v = null), C = 0;
|
|
1472
1487
|
}
|
|
1473
1488
|
function p() {
|
|
1474
1489
|
!f || o.value || v || C >= h || (v = setTimeout(() => {
|
|
1475
|
-
v = null, C += 1,
|
|
1490
|
+
v = null, C += 1, I();
|
|
1476
1491
|
}, R));
|
|
1477
1492
|
}
|
|
1478
1493
|
function m(_) {
|
|
1479
1494
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1495
|
+
const x = n.getConversationById(_.conversation_id);
|
|
1496
|
+
x && (x.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
|
|
1482
1497
|
});
|
|
1483
1498
|
}
|
|
1484
1499
|
}
|
|
@@ -1505,8 +1520,8 @@ function oc(e) {
|
|
|
1505
1520
|
);
|
|
1506
1521
|
}
|
|
1507
1522
|
function G(_) {
|
|
1508
|
-
const
|
|
1509
|
-
|
|
1523
|
+
const x = n.getConversationById(_.conversation_id);
|
|
1524
|
+
x && (x.is_request = !1), n.requests = n.requests.filter(
|
|
1510
1525
|
(fe) => fe.id !== _.conversation_id
|
|
1511
1526
|
);
|
|
1512
1527
|
}
|
|
@@ -1515,10 +1530,10 @@ function oc(e) {
|
|
|
1515
1530
|
}));
|
|
1516
1531
|
}
|
|
1517
1532
|
function k(_) {
|
|
1518
|
-
const
|
|
1519
|
-
E && (E(), E = null),
|
|
1533
|
+
const x = u.value;
|
|
1534
|
+
E && (E(), E = null), x && (_ && !n.hasGlobalConversationSubscription(x) && Bi(x), n.unregisterDetailSubscription(x), u.value = null), o.value = !1;
|
|
1520
1535
|
}
|
|
1521
|
-
function
|
|
1536
|
+
function I() {
|
|
1522
1537
|
const _ = A();
|
|
1523
1538
|
if (!(o.value || !_)) {
|
|
1524
1539
|
if (!Ae()) {
|
|
@@ -1527,7 +1542,7 @@ function oc(e) {
|
|
|
1527
1542
|
}
|
|
1528
1543
|
c.value = null;
|
|
1529
1544
|
try {
|
|
1530
|
-
E =
|
|
1545
|
+
E = Hi(_, {
|
|
1531
1546
|
onMessageSent: m,
|
|
1532
1547
|
onMessageRead: y,
|
|
1533
1548
|
onMessageEdited: F,
|
|
@@ -1536,18 +1551,18 @@ function oc(e) {
|
|
|
1536
1551
|
onRequestAccepted: G,
|
|
1537
1552
|
onParticipantRemoved: te
|
|
1538
1553
|
}), o.value = !0, u.value = _, n.registerDetailSubscription(_), w();
|
|
1539
|
-
} catch (
|
|
1540
|
-
c.value =
|
|
1554
|
+
} catch (x) {
|
|
1555
|
+
c.value = x instanceof Error ? x.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", x);
|
|
1541
1556
|
}
|
|
1542
1557
|
}
|
|
1543
1558
|
}
|
|
1544
1559
|
function V() {
|
|
1545
|
-
o.value ||
|
|
1560
|
+
o.value || I();
|
|
1546
1561
|
}
|
|
1547
1562
|
typeof window < "u" && window.addEventListener(Je(), V);
|
|
1548
|
-
const H =
|
|
1563
|
+
const H = lt((_) => {
|
|
1549
1564
|
if (_ === "connected") {
|
|
1550
|
-
o.value ||
|
|
1565
|
+
o.value || I();
|
|
1551
1566
|
return;
|
|
1552
1567
|
}
|
|
1553
1568
|
(_ === "disconnected" || _ === "error") && (w(), k(!1));
|
|
@@ -1562,13 +1577,13 @@ function oc(e) {
|
|
|
1562
1577
|
}
|
|
1563
1578
|
return ot(
|
|
1564
1579
|
() => A(),
|
|
1565
|
-
(_,
|
|
1566
|
-
if (_ !==
|
|
1580
|
+
(_, x) => {
|
|
1581
|
+
if (_ !== x) {
|
|
1567
1582
|
if (w(), o.value && k(!0), !_) {
|
|
1568
1583
|
c.value = null;
|
|
1569
1584
|
return;
|
|
1570
1585
|
}
|
|
1571
|
-
|
|
1586
|
+
I();
|
|
1572
1587
|
}
|
|
1573
1588
|
}
|
|
1574
1589
|
), d !== null && qe(() => {
|
|
@@ -1576,23 +1591,23 @@ function oc(e) {
|
|
|
1576
1591
|
}), {
|
|
1577
1592
|
isSubscribed: re(() => o.value),
|
|
1578
1593
|
error: re(() => c.value),
|
|
1579
|
-
subscribe:
|
|
1594
|
+
subscribe: I,
|
|
1580
1595
|
unsubscribe: X
|
|
1581
1596
|
};
|
|
1582
1597
|
}
|
|
1583
|
-
const
|
|
1584
|
-
},
|
|
1598
|
+
const As = () => () => {
|
|
1599
|
+
}, Rs = async () => {
|
|
1585
1600
|
}, _e = {
|
|
1586
1601
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1587
1602
|
getEcho: () => null,
|
|
1588
1603
|
getConnectionStatus: () => "disconnected",
|
|
1589
|
-
onConnectionStatusChange:
|
|
1590
|
-
reconnect:
|
|
1604
|
+
onConnectionStatusChange: As,
|
|
1605
|
+
reconnect: Rs
|
|
1591
1606
|
};
|
|
1592
|
-
function
|
|
1607
|
+
function zo() {
|
|
1593
1608
|
return _e.initializedEvent;
|
|
1594
1609
|
}
|
|
1595
|
-
function
|
|
1610
|
+
function jo() {
|
|
1596
1611
|
return _e.getEcho();
|
|
1597
1612
|
}
|
|
1598
1613
|
function $o() {
|
|
@@ -1608,7 +1623,7 @@ function Vo(e) {
|
|
|
1608
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);
|
|
1609
1624
|
}
|
|
1610
1625
|
function Xo() {
|
|
1611
|
-
_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 = As, _e.reconnect = Rs;
|
|
1612
1627
|
}
|
|
1613
1628
|
const Wo = {
|
|
1614
1629
|
debug: () => {
|
|
@@ -1619,16 +1634,16 @@ const Wo = {
|
|
|
1619
1634
|
},
|
|
1620
1635
|
error: () => {
|
|
1621
1636
|
}
|
|
1622
|
-
},
|
|
1623
|
-
let
|
|
1624
|
-
function
|
|
1625
|
-
return
|
|
1637
|
+
}, Ps = () => Wo;
|
|
1638
|
+
let Kt = Ps;
|
|
1639
|
+
function Qt() {
|
|
1640
|
+
return Kt;
|
|
1626
1641
|
}
|
|
1627
1642
|
function Go(e) {
|
|
1628
|
-
|
|
1643
|
+
Kt = e;
|
|
1629
1644
|
}
|
|
1630
1645
|
function Jo() {
|
|
1631
|
-
|
|
1646
|
+
Kt = Ps;
|
|
1632
1647
|
}
|
|
1633
1648
|
const Ko = {
|
|
1634
1649
|
connected: "",
|
|
@@ -1636,26 +1651,26 @@ const Ko = {
|
|
|
1636
1651
|
disconnected: "",
|
|
1637
1652
|
error: "",
|
|
1638
1653
|
unknown: ""
|
|
1639
|
-
},
|
|
1640
|
-
function
|
|
1654
|
+
}, Hn = Qt()("ConnectionStatus");
|
|
1655
|
+
function Bn(e) {
|
|
1641
1656
|
return e?.connector?.pusher?.connection ?? null;
|
|
1642
1657
|
}
|
|
1643
1658
|
function Qo(e) {
|
|
1644
1659
|
return e === "messenger" ? {
|
|
1645
1660
|
initializedEvent: Je(),
|
|
1646
|
-
getConnectionStatus:
|
|
1647
|
-
onConnectionStatusChange:
|
|
1648
|
-
reconnect:
|
|
1649
|
-
getEchoConnection: () =>
|
|
1661
|
+
getConnectionStatus: gs,
|
|
1662
|
+
onConnectionStatusChange: lt,
|
|
1663
|
+
reconnect: zi,
|
|
1664
|
+
getEchoConnection: () => Bn(Ae())
|
|
1650
1665
|
} : {
|
|
1651
|
-
initializedEvent:
|
|
1666
|
+
initializedEvent: zo(),
|
|
1652
1667
|
getConnectionStatus: $o,
|
|
1653
1668
|
onConnectionStatusChange: Ho,
|
|
1654
1669
|
reconnect: Bo,
|
|
1655
|
-
getEchoConnection: () =>
|
|
1670
|
+
getEchoConnection: () => Bn(jo())
|
|
1656
1671
|
};
|
|
1657
1672
|
}
|
|
1658
|
-
function
|
|
1673
|
+
function Vn(e) {
|
|
1659
1674
|
return e.getEchoConnection()?.state ?? null;
|
|
1660
1675
|
}
|
|
1661
1676
|
function ac(e = {}) {
|
|
@@ -1677,7 +1692,7 @@ function ac(e = {}) {
|
|
|
1677
1692
|
default:
|
|
1678
1693
|
return "Unknown connection state";
|
|
1679
1694
|
}
|
|
1680
|
-
}),
|
|
1695
|
+
}), I = re(() => {
|
|
1681
1696
|
switch (u.value) {
|
|
1682
1697
|
case "connected":
|
|
1683
1698
|
return "success";
|
|
@@ -1703,7 +1718,7 @@ function ac(e = {}) {
|
|
|
1703
1718
|
return c.unknown;
|
|
1704
1719
|
}
|
|
1705
1720
|
}), H = async () => {
|
|
1706
|
-
|
|
1721
|
+
Hn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1707
1722
|
}, X = (B, K = u.value) => {
|
|
1708
1723
|
if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
|
|
1709
1724
|
const N = !v.value && K === B, Y = !R.value && (N || K === "connected" || K === "connecting");
|
|
@@ -1729,11 +1744,11 @@ function ac(e = {}) {
|
|
|
1729
1744
|
return;
|
|
1730
1745
|
b = setTimeout(() => {
|
|
1731
1746
|
if (b = null, u.value === "connecting") {
|
|
1732
|
-
if (
|
|
1747
|
+
if (Vn(o) === "connected") {
|
|
1733
1748
|
_("connected");
|
|
1734
1749
|
return;
|
|
1735
1750
|
}
|
|
1736
|
-
R.value = !0,
|
|
1751
|
+
R.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1737
1752
|
}
|
|
1738
1753
|
}, 1e4);
|
|
1739
1754
|
}
|
|
@@ -1744,8 +1759,8 @@ function ac(e = {}) {
|
|
|
1744
1759
|
return;
|
|
1745
1760
|
}
|
|
1746
1761
|
u.value = B, B === "connecting" && (K === "disconnected" || K === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), X(B, K);
|
|
1747
|
-
},
|
|
1748
|
-
const B =
|
|
1762
|
+
}, x = () => {
|
|
1763
|
+
const B = Vn(o), K = u.value;
|
|
1749
1764
|
if (B === "connected" && K !== "connected") {
|
|
1750
1765
|
_("connected");
|
|
1751
1766
|
return;
|
|
@@ -1798,11 +1813,11 @@ function ac(e = {}) {
|
|
|
1798
1813
|
const B = Date.now() - d.value.getTime(), K = Math.floor(B / 6e4), N = Math.floor(B % 6e4 / 1e3);
|
|
1799
1814
|
return K > 0 ? `${K}m ${N}s` : `${N}s`;
|
|
1800
1815
|
});
|
|
1801
|
-
return
|
|
1816
|
+
return qt(() => {
|
|
1802
1817
|
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), F.value && (d.value = /* @__PURE__ */ new Date()), X(u.value, u.value), v.value = !0, fe(), m = () => {
|
|
1803
|
-
fe(),
|
|
1804
|
-
}, window.addEventListener(o.initializedEvent, m),
|
|
1805
|
-
|
|
1818
|
+
fe(), x();
|
|
1819
|
+
}, window.addEventListener(o.initializedEvent, m), x(), w = setInterval(() => {
|
|
1820
|
+
x();
|
|
1806
1821
|
}, 3e3);
|
|
1807
1822
|
}), qe(() => {
|
|
1808
1823
|
E?.(), b && (clearTimeout(b), b = null), A && (clearTimeout(A), A = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
|
|
@@ -1814,7 +1829,7 @@ function ac(e = {}) {
|
|
|
1814
1829
|
isError: G,
|
|
1815
1830
|
hasConnectionIssues: te,
|
|
1816
1831
|
statusMessage: k,
|
|
1817
|
-
statusColor:
|
|
1832
|
+
statusColor: I,
|
|
1818
1833
|
statusIcon: V,
|
|
1819
1834
|
showConnectionBanner: re(() => h.value),
|
|
1820
1835
|
lastConnectionTime: re(() => d.value),
|
|
@@ -1823,39 +1838,39 @@ function ac(e = {}) {
|
|
|
1823
1838
|
reconnect: H
|
|
1824
1839
|
};
|
|
1825
1840
|
}
|
|
1826
|
-
const
|
|
1841
|
+
const Ms = () => {
|
|
1827
1842
|
};
|
|
1828
|
-
let
|
|
1843
|
+
let Yt = Ms;
|
|
1829
1844
|
function Yo() {
|
|
1830
|
-
return
|
|
1845
|
+
return Yt;
|
|
1831
1846
|
}
|
|
1832
1847
|
function Zo(e) {
|
|
1833
|
-
|
|
1848
|
+
Yt = e;
|
|
1834
1849
|
}
|
|
1835
1850
|
function ea() {
|
|
1836
|
-
|
|
1851
|
+
Yt = Ms;
|
|
1837
1852
|
}
|
|
1838
|
-
const Me =
|
|
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;
|
|
1839
1854
|
function cc() {
|
|
1840
|
-
const e =
|
|
1855
|
+
const e = Jt(), n = ke()(), r = Yo(), o = Ht(), c = Ni(), u = Nt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map();
|
|
1841
1856
|
let C = !1;
|
|
1842
1857
|
function v(k) {
|
|
1843
|
-
const
|
|
1844
|
-
if (
|
|
1845
|
-
if (R.delete(k),
|
|
1846
|
-
const V =
|
|
1858
|
+
const I = R.get(k);
|
|
1859
|
+
if (I) {
|
|
1860
|
+
if (R.delete(k), I.directBound) {
|
|
1861
|
+
const V = I.channel.subscription;
|
|
1847
1862
|
if (V)
|
|
1848
|
-
for (const H of
|
|
1863
|
+
for (const H of I.bindings)
|
|
1849
1864
|
try {
|
|
1850
1865
|
V.unbind(H.event, H.handler);
|
|
1851
1866
|
} catch {
|
|
1852
1867
|
}
|
|
1853
1868
|
return;
|
|
1854
1869
|
}
|
|
1855
|
-
if (typeof
|
|
1856
|
-
for (const V of
|
|
1870
|
+
if (typeof I.channel.stopListening == "function")
|
|
1871
|
+
for (const V of I.bindings)
|
|
1857
1872
|
try {
|
|
1858
|
-
|
|
1873
|
+
I.channel.stopListening(V.event, V.handler);
|
|
1859
1874
|
} catch {
|
|
1860
1875
|
}
|
|
1861
1876
|
}
|
|
@@ -1866,12 +1881,12 @@ function cc() {
|
|
|
1866
1881
|
h.clear();
|
|
1867
1882
|
}
|
|
1868
1883
|
function b(k) {
|
|
1869
|
-
const
|
|
1870
|
-
if (!
|
|
1884
|
+
const I = Ae();
|
|
1885
|
+
if (!I || h.has(k)) return;
|
|
1871
1886
|
const V = `conversation.${k}`;
|
|
1872
1887
|
v(k);
|
|
1873
|
-
const H =
|
|
1874
|
-
if (!
|
|
1888
|
+
const H = I.private(V), X = (N) => {
|
|
1889
|
+
if (!Ji(N)) {
|
|
1875
1890
|
Me.warn("Dropping malformed ConversationMessageSent event", N);
|
|
1876
1891
|
return;
|
|
1877
1892
|
}
|
|
@@ -1891,20 +1906,20 @@ function cc() {
|
|
|
1891
1906
|
oe || ue.unread_count++, r(oe);
|
|
1892
1907
|
}
|
|
1893
1908
|
}, _ = (N) => {
|
|
1894
|
-
if (!
|
|
1909
|
+
if (!Ki(N)) {
|
|
1895
1910
|
Me.warn("Dropping malformed ConversationMessageRead event", N);
|
|
1896
1911
|
return;
|
|
1897
1912
|
}
|
|
1898
1913
|
e.applyParticipantReadState(N);
|
|
1899
|
-
},
|
|
1900
|
-
if (!
|
|
1914
|
+
}, x = (N) => {
|
|
1915
|
+
if (!Zi(N)) {
|
|
1901
1916
|
Me.warn("Dropping malformed MessageReactionToggled event", N);
|
|
1902
1917
|
return;
|
|
1903
1918
|
}
|
|
1904
1919
|
const Y = N;
|
|
1905
1920
|
e.updateMessageReactions(Y.conversation_id, Y.message_id, Y.reactions);
|
|
1906
1921
|
}, fe = (N) => {
|
|
1907
|
-
if (!
|
|
1922
|
+
if (!Qi(N)) {
|
|
1908
1923
|
Me.warn("Dropping malformed ConversationMessageEdited event", N);
|
|
1909
1924
|
return;
|
|
1910
1925
|
}
|
|
@@ -1917,14 +1932,14 @@ function cc() {
|
|
|
1917
1932
|
Y.message.meta
|
|
1918
1933
|
);
|
|
1919
1934
|
}, Se = (N) => {
|
|
1920
|
-
if (!
|
|
1935
|
+
if (!Yi(N)) {
|
|
1921
1936
|
Me.warn("Dropping malformed ConversationMessageDeleted event", N);
|
|
1922
1937
|
return;
|
|
1923
1938
|
}
|
|
1924
1939
|
const Y = N;
|
|
1925
1940
|
e.removeMessage(Y.conversation_id, Y.message_id);
|
|
1926
1941
|
}, B = (N) => {
|
|
1927
|
-
if (!
|
|
1942
|
+
if (!eo(N)) {
|
|
1928
1943
|
Me.warn("Dropping malformed ConversationRequestAccepted event", N);
|
|
1929
1944
|
return;
|
|
1930
1945
|
}
|
|
@@ -1933,7 +1948,7 @@ function cc() {
|
|
|
1933
1948
|
(U) => U.id !== Y.conversation_id
|
|
1934
1949
|
);
|
|
1935
1950
|
}, K = H.subscription;
|
|
1936
|
-
K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled",
|
|
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), R.set(k, {
|
|
1937
1952
|
channel: H,
|
|
1938
1953
|
directBound: !0,
|
|
1939
1954
|
bindings: [
|
|
@@ -1941,10 +1956,10 @@ function cc() {
|
|
|
1941
1956
|
{ event: "ConversationMessageRead", handler: _ },
|
|
1942
1957
|
{ event: "ConversationMessageEdited", handler: fe },
|
|
1943
1958
|
{ event: "ConversationMessageDeleted", handler: Se },
|
|
1944
|
-
{ event: "MessageReactionToggled", handler:
|
|
1959
|
+
{ event: "MessageReactionToggled", handler: x },
|
|
1945
1960
|
{ event: "ConversationRequestAccepted", handler: B }
|
|
1946
1961
|
]
|
|
1947
|
-
})) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled",
|
|
1962
|
+
})) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", x), H.listen(".ConversationRequestAccepted", B), R.set(k, {
|
|
1948
1963
|
channel: H,
|
|
1949
1964
|
directBound: !1,
|
|
1950
1965
|
bindings: [
|
|
@@ -1952,7 +1967,7 @@ function cc() {
|
|
|
1952
1967
|
{ event: ".ConversationMessageRead", handler: _ },
|
|
1953
1968
|
{ event: ".ConversationMessageEdited", handler: fe },
|
|
1954
1969
|
{ event: ".ConversationMessageDeleted", handler: Se },
|
|
1955
|
-
{ event: ".MessageReactionToggled", handler:
|
|
1970
|
+
{ event: ".MessageReactionToggled", handler: x },
|
|
1956
1971
|
{ event: ".ConversationRequestAccepted", handler: B }
|
|
1957
1972
|
]
|
|
1958
1973
|
})), h.add(k), e.registerGlobalConversationSubscription(k);
|
|
@@ -1963,26 +1978,26 @@ function cc() {
|
|
|
1963
1978
|
E();
|
|
1964
1979
|
return;
|
|
1965
1980
|
}
|
|
1966
|
-
for (const
|
|
1967
|
-
v(
|
|
1981
|
+
for (const I of h) {
|
|
1982
|
+
v(I);
|
|
1968
1983
|
try {
|
|
1969
|
-
k.leave(`conversation.${
|
|
1984
|
+
k.leave(`conversation.${I}`);
|
|
1970
1985
|
} catch {
|
|
1971
1986
|
}
|
|
1972
|
-
e.unregisterGlobalConversationSubscription(
|
|
1987
|
+
e.unregisterGlobalConversationSubscription(I);
|
|
1973
1988
|
}
|
|
1974
1989
|
h.clear();
|
|
1975
1990
|
}
|
|
1976
1991
|
function w() {
|
|
1977
1992
|
const k = Ae();
|
|
1978
1993
|
if (!k) return;
|
|
1979
|
-
const
|
|
1994
|
+
const I = (() => {
|
|
1980
1995
|
const H = [...e.conversations, ...e.requestConversations], X = /* @__PURE__ */ new Set(), _ = [];
|
|
1981
|
-
for (const
|
|
1982
|
-
if (!X.has(
|
|
1996
|
+
for (const x of H)
|
|
1997
|
+
if (!X.has(x.id) && (X.add(x.id), _.push(x), _.length >= ta))
|
|
1983
1998
|
break;
|
|
1984
1999
|
return _;
|
|
1985
|
-
})(), V = new Set(
|
|
2000
|
+
})(), V = new Set(I.map((H) => H.id));
|
|
1986
2001
|
for (const H of h)
|
|
1987
2002
|
if (!V.has(H) && !e.hasDetailSubscription(H)) {
|
|
1988
2003
|
try {
|
|
@@ -1991,42 +2006,42 @@ function cc() {
|
|
|
1991
2006
|
}
|
|
1992
2007
|
h.delete(H), e.unregisterGlobalConversationSubscription(H);
|
|
1993
2008
|
}
|
|
1994
|
-
for (const H of
|
|
2009
|
+
for (const H of I)
|
|
1995
2010
|
b(H.id);
|
|
1996
2011
|
}
|
|
1997
2012
|
function p(k) {
|
|
1998
|
-
const
|
|
2013
|
+
const I = Ft({
|
|
1999
2014
|
status: k.status,
|
|
2000
2015
|
last_seen_at: k.last_seen_at ?? null
|
|
2001
2016
|
});
|
|
2002
|
-
|
|
2017
|
+
I.status !== null && e.updatePresenceForUser(
|
|
2003
2018
|
k.user_id,
|
|
2004
|
-
|
|
2005
|
-
|
|
2019
|
+
I.status,
|
|
2020
|
+
I.lastSeenAt
|
|
2006
2021
|
);
|
|
2007
2022
|
}
|
|
2008
2023
|
async function m() {
|
|
2009
2024
|
const k = [...new Set(
|
|
2010
|
-
e.conversations.filter((
|
|
2025
|
+
e.conversations.filter((I) => I.type === "dm" && typeof I.other_user_id == "string" && I.other_user_id.length > 0).map((I) => I.other_user_id)
|
|
2011
2026
|
)];
|
|
2012
2027
|
if (k.length !== 0)
|
|
2013
2028
|
try {
|
|
2014
|
-
const
|
|
2029
|
+
const I = await o.get("/v1/presence/users", {
|
|
2015
2030
|
params: { ids: k }
|
|
2016
|
-
}), V =
|
|
2031
|
+
}), V = I.data?.data?.items ?? I.data?.items ?? [];
|
|
2017
2032
|
for (const H of V) {
|
|
2018
|
-
const X =
|
|
2033
|
+
const X = Ft(H);
|
|
2019
2034
|
X.status !== null && e.updatePresenceForUser(H.id, X.status, X.lastSeenAt);
|
|
2020
2035
|
}
|
|
2021
|
-
} catch (
|
|
2022
|
-
Me.warn("Failed to refresh messaging presence snapshot",
|
|
2036
|
+
} catch (I) {
|
|
2037
|
+
Me.warn("Failed to refresh messaging presence snapshot", I);
|
|
2023
2038
|
}
|
|
2024
2039
|
}
|
|
2025
2040
|
function y() {
|
|
2026
|
-
!Ae() || C || (
|
|
2041
|
+
!Ae() || C || (ji(p), C = !0);
|
|
2027
2042
|
}
|
|
2028
2043
|
function F() {
|
|
2029
|
-
C && (
|
|
2044
|
+
C && ($i(), C = !1);
|
|
2030
2045
|
}
|
|
2031
2046
|
const q = ot(
|
|
2032
2047
|
d,
|
|
@@ -2045,10 +2060,10 @@ function cc() {
|
|
|
2045
2060
|
() => {
|
|
2046
2061
|
w();
|
|
2047
2062
|
}
|
|
2048
|
-
), te =
|
|
2063
|
+
), te = lt((k) => {
|
|
2049
2064
|
k === "connected" ? (E(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (E(), F());
|
|
2050
2065
|
});
|
|
2051
|
-
w(), y(), m(), Ae() ||
|
|
2066
|
+
w(), y(), m(), Ae() || ps().then((k) => {
|
|
2052
2067
|
k && (E(), w(), F(), y(), m());
|
|
2053
2068
|
}).catch((k) => {
|
|
2054
2069
|
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
@@ -2057,10 +2072,10 @@ function cc() {
|
|
|
2057
2072
|
});
|
|
2058
2073
|
}
|
|
2059
2074
|
function uc() {
|
|
2060
|
-
const e = ye(
|
|
2075
|
+
const e = ye(It());
|
|
2061
2076
|
let n = null;
|
|
2062
|
-
return
|
|
2063
|
-
e.value =
|
|
2077
|
+
return qt(() => {
|
|
2078
|
+
e.value = It(), n = qi((r) => {
|
|
2064
2079
|
e.value = r;
|
|
2065
2080
|
});
|
|
2066
2081
|
}), qe(() => {
|
|
@@ -2071,7 +2086,7 @@ function uc() {
|
|
|
2071
2086
|
isSuspended: re(() => e.value === "account_suspended")
|
|
2072
2087
|
};
|
|
2073
2088
|
}
|
|
2074
|
-
const
|
|
2089
|
+
const ks = () => null, xs = {
|
|
2075
2090
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
2076
2091
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
2077
2092
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -2082,29 +2097,29 @@ const Ls = () => null, Is = {
|
|
|
2082
2097
|
activityDebounceMs: 5e3,
|
|
2083
2098
|
heartbeatIntervalMs: 3e4,
|
|
2084
2099
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
2085
|
-
authTokenResolver:
|
|
2100
|
+
authTokenResolver: ks
|
|
2086
2101
|
};
|
|
2087
|
-
let
|
|
2102
|
+
let ct = { ...xs };
|
|
2088
2103
|
function ia() {
|
|
2089
|
-
return
|
|
2104
|
+
return ct;
|
|
2090
2105
|
}
|
|
2091
2106
|
function oa(e) {
|
|
2092
|
-
|
|
2093
|
-
...
|
|
2107
|
+
ct = {
|
|
2108
|
+
...ct,
|
|
2094
2109
|
...e
|
|
2095
2110
|
};
|
|
2096
2111
|
}
|
|
2097
2112
|
function aa() {
|
|
2098
|
-
|
|
2113
|
+
ct = { ...xs };
|
|
2099
2114
|
}
|
|
2100
2115
|
function ca(e) {
|
|
2101
|
-
return e.authTokenResolver !==
|
|
2116
|
+
return e.authTokenResolver !== ks;
|
|
2102
2117
|
}
|
|
2103
2118
|
const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
|
|
2104
2119
|
function We(e) {
|
|
2105
2120
|
return typeof e == "object" && e !== null;
|
|
2106
2121
|
}
|
|
2107
|
-
function
|
|
2122
|
+
function Ls(e) {
|
|
2108
2123
|
if (!We(e))
|
|
2109
2124
|
return null;
|
|
2110
2125
|
const n = e.response;
|
|
@@ -2119,7 +2134,7 @@ function Us(e) {
|
|
|
2119
2134
|
}
|
|
2120
2135
|
return null;
|
|
2121
2136
|
}
|
|
2122
|
-
function
|
|
2137
|
+
function Is(e) {
|
|
2123
2138
|
if (!We(e))
|
|
2124
2139
|
return null;
|
|
2125
2140
|
const n = e.response;
|
|
@@ -2128,12 +2143,12 @@ function Os(e) {
|
|
|
2128
2143
|
const r = n.data;
|
|
2129
2144
|
return We(r) && typeof r.code == "string" ? r.code : null;
|
|
2130
2145
|
}
|
|
2131
|
-
function
|
|
2132
|
-
const n =
|
|
2146
|
+
function Mt(e) {
|
|
2147
|
+
const n = Ls(e), r = Is(e);
|
|
2133
2148
|
return n === ua && r === ha || n === da && r === pa;
|
|
2134
2149
|
}
|
|
2135
|
-
function
|
|
2136
|
-
const n =
|
|
2150
|
+
function kt(e) {
|
|
2151
|
+
const n = Ls(e), r = Is(e);
|
|
2137
2152
|
return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2138
2153
|
}
|
|
2139
2154
|
function Ke() {
|
|
@@ -2153,7 +2168,7 @@ function ba(e) {
|
|
|
2153
2168
|
const o = Number.parseInt(r, 10);
|
|
2154
2169
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
2155
2170
|
}
|
|
2156
|
-
function
|
|
2171
|
+
function xt(e, n = Date.now()) {
|
|
2157
2172
|
const r = Ke(), o = ba(e);
|
|
2158
2173
|
return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
|
|
2159
2174
|
}
|
|
@@ -2209,28 +2224,28 @@ function Ta(e, n, r) {
|
|
|
2209
2224
|
}
|
|
2210
2225
|
}
|
|
2211
2226
|
function lc() {
|
|
2212
|
-
const e = ke()(), n = ia(), r =
|
|
2213
|
-
let c = null, u = null, d = !1, f =
|
|
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, R = !1, C = null, v = 0;
|
|
2214
2229
|
const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2215
2230
|
c && (clearInterval(c), c = null);
|
|
2216
2231
|
}, A = () => {
|
|
2217
2232
|
u && (clearTimeout(u), u = null);
|
|
2218
2233
|
}, w = () => {
|
|
2219
2234
|
b(), c = setInterval(() => {
|
|
2220
|
-
|
|
2235
|
+
I();
|
|
2221
2236
|
}, n.heartbeatIntervalMs);
|
|
2222
|
-
}, p = (
|
|
2223
|
-
f || console.warn(
|
|
2224
|
-
}, m = async (
|
|
2225
|
-
if (!(!d || R || f || h) && E() && C !==
|
|
2237
|
+
}, p = (x) => {
|
|
2238
|
+
f || console.warn(x), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
|
|
2239
|
+
}, m = async (x) => {
|
|
2240
|
+
if (!(!d || R || f || h) && E() && C !== x)
|
|
2226
2241
|
try {
|
|
2227
|
-
await r.patch(n.statusUrl, { status:
|
|
2242
|
+
await r.patch(n.statusUrl, { status: x }), C = x;
|
|
2228
2243
|
} catch (fe) {
|
|
2229
|
-
if (
|
|
2244
|
+
if (Mt(fe)) {
|
|
2230
2245
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2231
2246
|
return;
|
|
2232
2247
|
}
|
|
2233
|
-
|
|
2248
|
+
kt(fe) && (h = !0, d = !1, C = null, b(), A());
|
|
2234
2249
|
}
|
|
2235
2250
|
}, y = () => {
|
|
2236
2251
|
A(), !(!d || R || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
@@ -2239,8 +2254,8 @@ function lc() {
|
|
|
2239
2254
|
}, F = () => {
|
|
2240
2255
|
if (R || !d || f || h || document.visibilityState !== "visible")
|
|
2241
2256
|
return;
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2257
|
+
const x = Date.now();
|
|
2258
|
+
x - v < n.activityDebounceMs || (v = x, m("online"), y());
|
|
2244
2259
|
}, q = () => {
|
|
2245
2260
|
F();
|
|
2246
2261
|
}, J = () => {
|
|
@@ -2248,43 +2263,43 @@ function lc() {
|
|
|
2248
2263
|
}, G = () => {
|
|
2249
2264
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2250
2265
|
}, te = async () => {
|
|
2251
|
-
if (
|
|
2266
|
+
if (xt(n.accountLimitedUntilStorageKey))
|
|
2252
2267
|
return f = !0, "account_limited";
|
|
2253
2268
|
try {
|
|
2254
2269
|
return await r.post(n.sessionOpenUrl, {
|
|
2255
2270
|
client_id: o,
|
|
2256
2271
|
user_agent: n.userAgentResolver()
|
|
2257
2272
|
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
|
|
2258
|
-
} catch (
|
|
2259
|
-
return
|
|
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(), A(), "account_suspended") : "failed";
|
|
2260
2275
|
}
|
|
2261
2276
|
}, k = async () => {
|
|
2262
|
-
for (let
|
|
2277
|
+
for (let x = 0; x < ga; x += 1)
|
|
2263
2278
|
if (await te() !== "failed")
|
|
2264
2279
|
return;
|
|
2265
2280
|
console.warn("[Presence] Failed to open session");
|
|
2266
|
-
},
|
|
2281
|
+
}, I = async () => {
|
|
2267
2282
|
if (d && E())
|
|
2268
2283
|
try {
|
|
2269
2284
|
await r.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2270
|
-
} catch (
|
|
2271
|
-
if (
|
|
2285
|
+
} catch (x) {
|
|
2286
|
+
if (Mt(x)) {
|
|
2272
2287
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2273
2288
|
return;
|
|
2274
2289
|
}
|
|
2275
|
-
|
|
2290
|
+
kt(x) && (h = !0, d = !1, C = null, b(), A());
|
|
2276
2291
|
}
|
|
2277
2292
|
}, V = () => {
|
|
2278
2293
|
if (!d)
|
|
2279
2294
|
return;
|
|
2280
2295
|
d = !1, C = null, A();
|
|
2281
|
-
const
|
|
2296
|
+
const x = Ta(
|
|
2282
2297
|
n.sessionCloseUrl,
|
|
2283
2298
|
o,
|
|
2284
2299
|
n.authTokenResolver()
|
|
2285
2300
|
);
|
|
2286
|
-
if (
|
|
2287
|
-
|
|
2301
|
+
if (x) {
|
|
2302
|
+
x.catch(() => {
|
|
2288
2303
|
});
|
|
2289
2304
|
return;
|
|
2290
2305
|
}
|
|
@@ -2305,7 +2320,7 @@ function lc() {
|
|
|
2305
2320
|
return;
|
|
2306
2321
|
}
|
|
2307
2322
|
if (document.visibilityState === "visible" && !d) {
|
|
2308
|
-
f =
|
|
2323
|
+
f = xt(n.accountLimitedUntilStorageKey), !f && !h && H();
|
|
2309
2324
|
return;
|
|
2310
2325
|
}
|
|
2311
2326
|
document.visibilityState === "visible" && d && !f && !h && F();
|
|
@@ -2313,7 +2328,7 @@ function lc() {
|
|
|
2313
2328
|
}, _ = () => {
|
|
2314
2329
|
R || (V(), b(), A());
|
|
2315
2330
|
};
|
|
2316
|
-
|
|
2331
|
+
qt(async () => {
|
|
2317
2332
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2318
2333
|
if (await k(), R) {
|
|
2319
2334
|
V();
|
|
@@ -2327,9 +2342,9 @@ function lc() {
|
|
|
2327
2342
|
}
|
|
2328
2343
|
const Ea = 12e3;
|
|
2329
2344
|
function dc(e) {
|
|
2330
|
-
const n =
|
|
2345
|
+
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = Nt(), R = h !== null, C = 20, v = 250;
|
|
2331
2346
|
let E = !1, b = null, A = 0, w = null;
|
|
2332
|
-
const p = re(() => r.currentUser?.id), m = () =>
|
|
2347
|
+
const p = re(() => r.currentUser?.id), m = () => ss(e)?.trim() ?? "", y = () => {
|
|
2333
2348
|
const M = u.value?.trim() ?? "";
|
|
2334
2349
|
if (M.length > 0)
|
|
2335
2350
|
return M;
|
|
@@ -2353,7 +2368,7 @@ function dc(e) {
|
|
|
2353
2368
|
!R || o.value || w || A >= C || (w = setTimeout(() => {
|
|
2354
2369
|
w = null, A += 1, X();
|
|
2355
2370
|
}, v));
|
|
2356
|
-
},
|
|
2371
|
+
}, I = (M, U) => {
|
|
2357
2372
|
J(M);
|
|
2358
2373
|
const ne = setTimeout(() => {
|
|
2359
2374
|
f.delete(M), n.removeTypingUser(U, M), d.value = d.value.filter((ue) => ue.id !== M);
|
|
@@ -2363,8 +2378,8 @@ function dc(e) {
|
|
|
2363
2378
|
E = !0, te();
|
|
2364
2379
|
}, H = (M) => {
|
|
2365
2380
|
try {
|
|
2366
|
-
b && (b(), b = null), b =
|
|
2367
|
-
onTypingStart:
|
|
2381
|
+
b && (b(), b = null), b = Vi(M, {
|
|
2382
|
+
onTypingStart: x,
|
|
2368
2383
|
onTypingStop: fe
|
|
2369
2384
|
}), te(), o.value = !0, u.value = M;
|
|
2370
2385
|
} catch (U) {
|
|
@@ -2373,15 +2388,15 @@ function dc(e) {
|
|
|
2373
2388
|
}, X = () => {
|
|
2374
2389
|
const M = m();
|
|
2375
2390
|
if (!(o.value || !M)) {
|
|
2376
|
-
if (c.value = null, Ae() &&
|
|
2391
|
+
if (c.value = null, Ae() && En() === "connected") {
|
|
2377
2392
|
H(M);
|
|
2378
2393
|
return;
|
|
2379
2394
|
}
|
|
2380
|
-
E = !1,
|
|
2395
|
+
E = !1, ps().then((U) => {
|
|
2381
2396
|
if (E || o.value || !U)
|
|
2382
2397
|
return;
|
|
2383
2398
|
const ne = m();
|
|
2384
|
-
if (ne && ne === M && Ae() &&
|
|
2399
|
+
if (ne && ne === M && Ae() && En() === "connected") {
|
|
2385
2400
|
H(ne);
|
|
2386
2401
|
return;
|
|
2387
2402
|
}
|
|
@@ -2392,12 +2407,12 @@ function dc(e) {
|
|
|
2392
2407
|
const M = u.value;
|
|
2393
2408
|
if (V(), !(!o.value || !M))
|
|
2394
2409
|
try {
|
|
2395
|
-
b && (b(), b = null),
|
|
2410
|
+
b && (b(), b = null), Xi(M), G(), q(M), o.value = !1, u.value = null, c.value = null;
|
|
2396
2411
|
} catch (U) {
|
|
2397
2412
|
c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2398
2413
|
}
|
|
2399
2414
|
};
|
|
2400
|
-
function
|
|
2415
|
+
function x(M) {
|
|
2401
2416
|
if (M.user_id === p.value)
|
|
2402
2417
|
return;
|
|
2403
2418
|
const U = y();
|
|
@@ -2408,7 +2423,7 @@ function dc(e) {
|
|
|
2408
2423
|
name: M.user.name,
|
|
2409
2424
|
...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
|
|
2410
2425
|
};
|
|
2411
|
-
d.value.some((ue) => ue.id === ne.id) || (d.value = [...d.value, ne]), n.addTypingUser(U, ne),
|
|
2426
|
+
d.value.some((ue) => ue.id === ne.id) || (d.value = [...d.value, ne]), n.addTypingUser(U, ne), I(M.user_id, U);
|
|
2412
2427
|
}
|
|
2413
2428
|
function fe(M) {
|
|
2414
2429
|
if (M.user_id === p.value)
|
|
@@ -2452,7 +2467,7 @@ function dc(e) {
|
|
|
2452
2467
|
m() && (b && (b(), b = null), o.value = !1, u.value = null, X());
|
|
2453
2468
|
};
|
|
2454
2469
|
typeof window < "u" && window.addEventListener(Je(), N);
|
|
2455
|
-
const Y =
|
|
2470
|
+
const Y = lt((M) => {
|
|
2456
2471
|
if (M === "connected") {
|
|
2457
2472
|
o.value || X();
|
|
2458
2473
|
return;
|
|
@@ -2476,12 +2491,12 @@ function dc(e) {
|
|
|
2476
2491
|
};
|
|
2477
2492
|
}
|
|
2478
2493
|
function hc(e) {
|
|
2479
|
-
e.apiClient &&
|
|
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 && oa(e.presence);
|
|
2480
2495
|
}
|
|
2481
2496
|
function fc() {
|
|
2482
|
-
|
|
2497
|
+
no(), ro(), oo(), uo(), Jo(), ea(), Gi(), Xo(), aa();
|
|
2483
2498
|
}
|
|
2484
|
-
class
|
|
2499
|
+
class Zt {
|
|
2485
2500
|
constructor() {
|
|
2486
2501
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2487
2502
|
}
|
|
@@ -2510,7 +2525,7 @@ class tn {
|
|
|
2510
2525
|
return this.stopListening(".client-" + n, r);
|
|
2511
2526
|
}
|
|
2512
2527
|
}
|
|
2513
|
-
class
|
|
2528
|
+
class Us {
|
|
2514
2529
|
/**
|
|
2515
2530
|
* Create a new class instance.
|
|
2516
2531
|
*/
|
|
@@ -2539,12 +2554,12 @@ function Aa(e) {
|
|
|
2539
2554
|
}
|
|
2540
2555
|
return !0;
|
|
2541
2556
|
}
|
|
2542
|
-
class
|
|
2557
|
+
class en extends Zt {
|
|
2543
2558
|
/**
|
|
2544
2559
|
* Create a new class instance.
|
|
2545
2560
|
*/
|
|
2546
2561
|
constructor(n, r, o) {
|
|
2547
|
-
super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2562
|
+
super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new Us(this.options.namespace), this.subscribe();
|
|
2548
2563
|
}
|
|
2549
2564
|
/**
|
|
2550
2565
|
* Subscribe to a Pusher channel.
|
|
@@ -2616,7 +2631,7 @@ class nn extends tn {
|
|
|
2616
2631
|
return this.subscription.bind(n, r), this;
|
|
2617
2632
|
}
|
|
2618
2633
|
}
|
|
2619
|
-
class
|
|
2634
|
+
class Os extends en {
|
|
2620
2635
|
/**
|
|
2621
2636
|
* Send a whisper event to other clients in the channel.
|
|
2622
2637
|
*/
|
|
@@ -2627,7 +2642,7 @@ class Ds extends nn {
|
|
|
2627
2642
|
), this;
|
|
2628
2643
|
}
|
|
2629
2644
|
}
|
|
2630
|
-
class Ra extends
|
|
2645
|
+
class Ra extends en {
|
|
2631
2646
|
/**
|
|
2632
2647
|
* Send a whisper event to other clients in the channel.
|
|
2633
2648
|
*/
|
|
@@ -2638,7 +2653,7 @@ class Ra extends nn {
|
|
|
2638
2653
|
), this;
|
|
2639
2654
|
}
|
|
2640
2655
|
}
|
|
2641
|
-
class Pa extends
|
|
2656
|
+
class Pa extends Os {
|
|
2642
2657
|
/**
|
|
2643
2658
|
* Register a callback to be called anytime the member list changes.
|
|
2644
2659
|
*/
|
|
@@ -2673,12 +2688,12 @@ class Pa extends Ds {
|
|
|
2673
2688
|
}), this;
|
|
2674
2689
|
}
|
|
2675
2690
|
}
|
|
2676
|
-
class
|
|
2691
|
+
class Fs extends Zt {
|
|
2677
2692
|
/**
|
|
2678
2693
|
* Create a new class instance.
|
|
2679
2694
|
*/
|
|
2680
2695
|
constructor(n, r, o) {
|
|
2681
|
-
super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2696
|
+
super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new Us(this.options.namespace), this.subscribe();
|
|
2682
2697
|
}
|
|
2683
2698
|
/**
|
|
2684
2699
|
* Subscribe to a Socket.io channel.
|
|
@@ -2749,7 +2764,7 @@ class Ns extends tn {
|
|
|
2749
2764
|
)), (!r || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2750
2765
|
}
|
|
2751
2766
|
}
|
|
2752
|
-
class
|
|
2767
|
+
class Ds extends Fs {
|
|
2753
2768
|
/**
|
|
2754
2769
|
* Send a whisper event to other clients in the channel.
|
|
2755
2770
|
*/
|
|
@@ -2761,7 +2776,7 @@ class qs extends Ns {
|
|
|
2761
2776
|
}), this;
|
|
2762
2777
|
}
|
|
2763
2778
|
}
|
|
2764
|
-
class Ma extends
|
|
2779
|
+
class Ma extends Ds {
|
|
2765
2780
|
/**
|
|
2766
2781
|
* Register a callback to be called anytime the member list changes.
|
|
2767
2782
|
*/
|
|
@@ -2799,7 +2814,7 @@ class Ma extends qs {
|
|
|
2799
2814
|
), this;
|
|
2800
2815
|
}
|
|
2801
2816
|
}
|
|
2802
|
-
class
|
|
2817
|
+
class ut extends Zt {
|
|
2803
2818
|
/**
|
|
2804
2819
|
* Subscribe to a channel.
|
|
2805
2820
|
*/
|
|
@@ -2847,7 +2862,7 @@ class dt extends tn {
|
|
|
2847
2862
|
return this;
|
|
2848
2863
|
}
|
|
2849
2864
|
}
|
|
2850
|
-
class
|
|
2865
|
+
class Ns extends ut {
|
|
2851
2866
|
/**
|
|
2852
2867
|
* Send a whisper event to other clients in the channel.
|
|
2853
2868
|
*/
|
|
@@ -2855,7 +2870,7 @@ class zs extends dt {
|
|
|
2855
2870
|
return this;
|
|
2856
2871
|
}
|
|
2857
2872
|
}
|
|
2858
|
-
class ka extends
|
|
2873
|
+
class ka extends ut {
|
|
2859
2874
|
/**
|
|
2860
2875
|
* Send a whisper event to other clients in the channel.
|
|
2861
2876
|
*/
|
|
@@ -2863,7 +2878,7 @@ class ka extends dt {
|
|
|
2863
2878
|
return this;
|
|
2864
2879
|
}
|
|
2865
2880
|
}
|
|
2866
|
-
class xa extends
|
|
2881
|
+
class xa extends Ns {
|
|
2867
2882
|
/**
|
|
2868
2883
|
* Register a callback to be called anytime the member list changes.
|
|
2869
2884
|
*/
|
|
@@ -2889,7 +2904,7 @@ class xa extends zs {
|
|
|
2889
2904
|
return this;
|
|
2890
2905
|
}
|
|
2891
2906
|
}
|
|
2892
|
-
const
|
|
2907
|
+
const qs = class zs {
|
|
2893
2908
|
/**
|
|
2894
2909
|
* Create a new class instance.
|
|
2895
2910
|
*/
|
|
@@ -2901,7 +2916,7 @@ const js = class $s {
|
|
|
2901
2916
|
*/
|
|
2902
2917
|
setOptions(n) {
|
|
2903
2918
|
this.options = {
|
|
2904
|
-
|
|
2919
|
+
...zs._defaultOptions,
|
|
2905
2920
|
...n,
|
|
2906
2921
|
broadcaster: n.broadcaster
|
|
2907
2922
|
};
|
|
@@ -2916,7 +2931,7 @@ const js = class $s {
|
|
|
2916
2931
|
return typeof window < "u" && (n = window.Laravel) != null && n.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((r = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : r.getAttribute("content")) ?? null : null;
|
|
2917
2932
|
}
|
|
2918
2933
|
};
|
|
2919
|
-
|
|
2934
|
+
qs._defaultOptions = {
|
|
2920
2935
|
auth: {
|
|
2921
2936
|
headers: {}
|
|
2922
2937
|
},
|
|
@@ -2931,8 +2946,8 @@ js._defaultOptions = {
|
|
|
2931
2946
|
key: null,
|
|
2932
2947
|
namespace: "App.Events"
|
|
2933
2948
|
};
|
|
2934
|
-
let
|
|
2935
|
-
class it extends
|
|
2949
|
+
let tn = qs;
|
|
2950
|
+
class it extends tn {
|
|
2936
2951
|
constructor() {
|
|
2937
2952
|
super(...arguments), this.channels = {};
|
|
2938
2953
|
}
|
|
@@ -2970,7 +2985,7 @@ class it extends sn {
|
|
|
2970
2985
|
* Get a channel instance by name.
|
|
2971
2986
|
*/
|
|
2972
2987
|
channel(n) {
|
|
2973
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2988
|
+
return this.channels[n] || (this.channels[n] = new en(
|
|
2974
2989
|
this.pusher,
|
|
2975
2990
|
n,
|
|
2976
2991
|
this.options
|
|
@@ -2980,7 +2995,7 @@ class it extends sn {
|
|
|
2980
2995
|
* Get a private channel instance by name.
|
|
2981
2996
|
*/
|
|
2982
2997
|
privateChannel(n) {
|
|
2983
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2998
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Os(
|
|
2984
2999
|
this.pusher,
|
|
2985
3000
|
"private-" + n,
|
|
2986
3001
|
this.options
|
|
@@ -3069,7 +3084,7 @@ class it extends sn {
|
|
|
3069
3084
|
this.pusher.disconnect();
|
|
3070
3085
|
}
|
|
3071
3086
|
}
|
|
3072
|
-
class La extends
|
|
3087
|
+
class La extends tn {
|
|
3073
3088
|
constructor() {
|
|
3074
3089
|
super(...arguments), this.channels = {};
|
|
3075
3090
|
}
|
|
@@ -3109,7 +3124,7 @@ class La extends sn {
|
|
|
3109
3124
|
* Get a channel instance by name.
|
|
3110
3125
|
*/
|
|
3111
3126
|
channel(n) {
|
|
3112
|
-
return this.channels[n] || (this.channels[n] = new
|
|
3127
|
+
return this.channels[n] || (this.channels[n] = new Fs(
|
|
3113
3128
|
this.socket,
|
|
3114
3129
|
n,
|
|
3115
3130
|
this.options
|
|
@@ -3119,7 +3134,7 @@ class La extends sn {
|
|
|
3119
3134
|
* Get a private channel instance by name.
|
|
3120
3135
|
*/
|
|
3121
3136
|
privateChannel(n) {
|
|
3122
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
3137
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Ds(
|
|
3123
3138
|
this.socket,
|
|
3124
3139
|
"private-" + n,
|
|
3125
3140
|
this.options
|
|
@@ -3191,7 +3206,7 @@ class La extends sn {
|
|
|
3191
3206
|
this.socket.disconnect();
|
|
3192
3207
|
}
|
|
3193
3208
|
}
|
|
3194
|
-
class
|
|
3209
|
+
class Xn extends tn {
|
|
3195
3210
|
constructor() {
|
|
3196
3211
|
super(...arguments), this.channels = {};
|
|
3197
3212
|
}
|
|
@@ -3204,19 +3219,19 @@ class Gn extends sn {
|
|
|
3204
3219
|
* Listen for an event on a channel instance.
|
|
3205
3220
|
*/
|
|
3206
3221
|
listen(n, r, o) {
|
|
3207
|
-
return new
|
|
3222
|
+
return new ut();
|
|
3208
3223
|
}
|
|
3209
3224
|
/**
|
|
3210
3225
|
* Get a channel instance by name.
|
|
3211
3226
|
*/
|
|
3212
3227
|
channel(n) {
|
|
3213
|
-
return new
|
|
3228
|
+
return new ut();
|
|
3214
3229
|
}
|
|
3215
3230
|
/**
|
|
3216
3231
|
* Get a private channel instance by name.
|
|
3217
3232
|
*/
|
|
3218
3233
|
privateChannel(n) {
|
|
3219
|
-
return new
|
|
3234
|
+
return new Ns();
|
|
3220
3235
|
}
|
|
3221
3236
|
/**
|
|
3222
3237
|
* Get a private encrypted channel instance by name.
|
|
@@ -3298,7 +3313,7 @@ class Ia {
|
|
|
3298
3313
|
else if (this.options.broadcaster === "socket.io")
|
|
3299
3314
|
this.connector = new La(this.options);
|
|
3300
3315
|
else if (this.options.broadcaster === "null")
|
|
3301
|
-
this.connector = new
|
|
3316
|
+
this.connector = new Xn(this.options);
|
|
3302
3317
|
else if (typeof this.options.broadcaster == "function" && Aa(this.options.broadcaster))
|
|
3303
3318
|
this.connector = new this.options.broadcaster(this.options);
|
|
3304
3319
|
else
|
|
@@ -3362,7 +3377,7 @@ class Ia {
|
|
|
3362
3377
|
);
|
|
3363
3378
|
}
|
|
3364
3379
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3365
|
-
return n instanceof it || n instanceof
|
|
3380
|
+
return n instanceof it || n instanceof Xn;
|
|
3366
3381
|
}
|
|
3367
3382
|
/**
|
|
3368
3383
|
* Get the Socket ID for the connection.
|
|
@@ -3426,10 +3441,10 @@ class Ia {
|
|
|
3426
3441
|
function Ua(e) {
|
|
3427
3442
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3428
3443
|
}
|
|
3429
|
-
var
|
|
3430
|
-
var
|
|
3444
|
+
var Lt = { exports: {} };
|
|
3445
|
+
var Wn;
|
|
3431
3446
|
function Oa() {
|
|
3432
|
-
return
|
|
3447
|
+
return Wn || (Wn = 1, (function(e, n) {
|
|
3433
3448
|
(function(o, c) {
|
|
3434
3449
|
e.exports = c();
|
|
3435
3450
|
})(window, function() {
|
|
@@ -3525,9 +3540,9 @@ function Oa() {
|
|
|
3525
3540
|
}, w.prototype.decode = function(p) {
|
|
3526
3541
|
if (p.length === 0)
|
|
3527
3542
|
return new Uint8Array(0);
|
|
3528
|
-
for (var m = this._getPaddingLength(p), y = p.length - m, F = new Uint8Array(this.maxDecodedLength(y)), q = 0, J = 0, G = 0, te = 0, k = 0,
|
|
3529
|
-
te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)),
|
|
3530
|
-
if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), F[q++] = te << 2 | k >>> 4, G |= te & d, G |= k & d), J < y - 2 && (
|
|
3543
|
+
for (var m = this._getPaddingLength(p), y = p.length - m, F = new Uint8Array(this.maxDecodedLength(y)), q = 0, J = 0, G = 0, te = 0, k = 0, I = 0, V = 0; J < y - 4; J += 4)
|
|
3544
|
+
te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)), I = this._decodeChar(p.charCodeAt(J + 2)), V = this._decodeChar(p.charCodeAt(J + 3)), F[q++] = te << 2 | k >>> 4, F[q++] = k << 4 | I >>> 2, F[q++] = I << 6 | V, G |= te & d, G |= k & d, G |= I & d, G |= V & d;
|
|
3545
|
+
if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), F[q++] = te << 2 | k >>> 4, G |= te & d, G |= k & d), J < y - 2 && (I = this._decodeChar(p.charCodeAt(J + 2)), F[q++] = k << 4 | I >>> 2, G |= I & d), J < y - 3 && (V = this._decodeChar(p.charCodeAt(J + 3)), F[q++] = I << 6 | V, G |= V & d), G !== 0)
|
|
3531
3546
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3532
3547
|
return F;
|
|
3533
3548
|
}, w.prototype._encodeByte = function(p) {
|
|
@@ -3727,14 +3742,14 @@ function Oa() {
|
|
|
3727
3742
|
l.loading[t].push(a);
|
|
3728
3743
|
else {
|
|
3729
3744
|
l.loading[t] = [a];
|
|
3730
|
-
var g = j.createScriptRequest(l.getPath(t, s)), S = l.receivers.create(function(
|
|
3745
|
+
var g = j.createScriptRequest(l.getPath(t, s)), S = l.receivers.create(function(L) {
|
|
3731
3746
|
if (l.receivers.remove(S), l.loading[t]) {
|
|
3732
3747
|
var z = l.loading[t];
|
|
3733
3748
|
delete l.loading[t];
|
|
3734
3749
|
for (var Q = function(de) {
|
|
3735
3750
|
de || g.cleanup();
|
|
3736
3751
|
}, ee = 0; ee < z.length; ee++)
|
|
3737
|
-
z[ee](
|
|
3752
|
+
z[ee](L, Q);
|
|
3738
3753
|
}
|
|
3739
3754
|
});
|
|
3740
3755
|
g.send(S);
|
|
@@ -3836,42 +3851,42 @@ function Oa() {
|
|
|
3836
3851
|
for (var S in s.headers)
|
|
3837
3852
|
g.setRequestHeader(S, s.headers[S]);
|
|
3838
3853
|
if (s.headersProvider != null) {
|
|
3839
|
-
let
|
|
3840
|
-
for (var S in
|
|
3841
|
-
g.setRequestHeader(S,
|
|
3854
|
+
let L = s.headersProvider();
|
|
3855
|
+
for (var S in L)
|
|
3856
|
+
g.setRequestHeader(S, L[S]);
|
|
3842
3857
|
}
|
|
3843
3858
|
return g.onreadystatechange = function() {
|
|
3844
3859
|
if (g.readyState === 4)
|
|
3845
3860
|
if (g.status === 200) {
|
|
3846
|
-
let
|
|
3861
|
+
let L, z = !1;
|
|
3847
3862
|
try {
|
|
3848
|
-
|
|
3863
|
+
L = JSON.parse(g.responseText), z = !0;
|
|
3849
3864
|
} catch {
|
|
3850
3865
|
l(new k(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${g.responseText}`), null);
|
|
3851
3866
|
}
|
|
3852
|
-
z && l(null,
|
|
3867
|
+
z && l(null, L);
|
|
3853
3868
|
} else {
|
|
3854
|
-
let
|
|
3869
|
+
let L = "";
|
|
3855
3870
|
switch (a) {
|
|
3856
3871
|
case w.UserAuthentication:
|
|
3857
|
-
|
|
3872
|
+
L = A.buildLogSuffix("authenticationEndpoint");
|
|
3858
3873
|
break;
|
|
3859
3874
|
case w.ChannelAuthorization:
|
|
3860
|
-
|
|
3875
|
+
L = `Clients must be authorized to join private or presence channels. ${A.buildLogSuffix("authorizationEndpoint")}`;
|
|
3861
3876
|
break;
|
|
3862
3877
|
}
|
|
3863
|
-
l(new k(g.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${g.status} from ${s.endpoint}. ${
|
|
3878
|
+
l(new k(g.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${g.status} from ${s.endpoint}. ${L}`), null);
|
|
3864
3879
|
}
|
|
3865
3880
|
}, g.send(t), g;
|
|
3866
3881
|
};
|
|
3867
3882
|
function H(i) {
|
|
3868
3883
|
return B(fe(i));
|
|
3869
3884
|
}
|
|
3870
|
-
var X = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
3885
|
+
var X = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", x = function(i) {
|
|
3871
3886
|
var t = i.charCodeAt(0);
|
|
3872
3887
|
return t < 128 ? i : t < 2048 ? X(192 | t >>> 6) + X(128 | t & 63) : X(224 | t >>> 12 & 15) + X(128 | t >>> 6 & 63) + X(128 | t & 63);
|
|
3873
3888
|
}, fe = function(i) {
|
|
3874
|
-
return i.replace(/[^\x00-\x7F]/g,
|
|
3889
|
+
return i.replace(/[^\x00-\x7F]/g, x);
|
|
3875
3890
|
}, Se = function(i) {
|
|
3876
3891
|
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 = [
|
|
3877
3892
|
_.charAt(s >>> 18),
|
|
@@ -3939,12 +3954,12 @@ function Oa() {
|
|
|
3939
3954
|
}
|
|
3940
3955
|
return i;
|
|
3941
3956
|
}
|
|
3942
|
-
function
|
|
3957
|
+
function nn() {
|
|
3943
3958
|
for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3944
3959
|
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Qe(arguments[t]));
|
|
3945
3960
|
return i.join(" : ");
|
|
3946
3961
|
}
|
|
3947
|
-
function
|
|
3962
|
+
function dt(i, t) {
|
|
3948
3963
|
var s = Array.prototype.indexOf;
|
|
3949
3964
|
if (i === null)
|
|
3950
3965
|
return -1;
|
|
@@ -4023,16 +4038,16 @@ function Oa() {
|
|
|
4023
4038
|
return typeof t == "object" && (t = Qe(t)), encodeURIComponent(H(t.toString()));
|
|
4024
4039
|
});
|
|
4025
4040
|
}
|
|
4026
|
-
function
|
|
4041
|
+
function js(i) {
|
|
4027
4042
|
var t = Re(i, function(a) {
|
|
4028
4043
|
return a !== void 0;
|
|
4029
4044
|
}), s = se(Le(be(t)), oe.method("join", "=")).join("&");
|
|
4030
4045
|
return s;
|
|
4031
4046
|
}
|
|
4032
|
-
function
|
|
4047
|
+
function $s(i) {
|
|
4033
4048
|
var t = [], s = [];
|
|
4034
4049
|
return (function a(l, g) {
|
|
4035
|
-
var S,
|
|
4050
|
+
var S, L, z;
|
|
4036
4051
|
switch (typeof l) {
|
|
4037
4052
|
case "object":
|
|
4038
4053
|
if (!l)
|
|
@@ -4045,8 +4060,8 @@ function Oa() {
|
|
|
4045
4060
|
z[S] = a(l[S], g + "[" + S + "]");
|
|
4046
4061
|
else {
|
|
4047
4062
|
z = {};
|
|
4048
|
-
for (
|
|
4049
|
-
Object.prototype.hasOwnProperty.call(l,
|
|
4063
|
+
for (L in l)
|
|
4064
|
+
Object.prototype.hasOwnProperty.call(l, L) && (z[L] = a(l[L], g + "[" + JSON.stringify(L) + "]"));
|
|
4050
4065
|
}
|
|
4051
4066
|
return z;
|
|
4052
4067
|
case "number":
|
|
@@ -4060,10 +4075,10 @@ function Oa() {
|
|
|
4060
4075
|
try {
|
|
4061
4076
|
return JSON.stringify(i);
|
|
4062
4077
|
} catch {
|
|
4063
|
-
return JSON.stringify(
|
|
4078
|
+
return JSON.stringify($s(i));
|
|
4064
4079
|
}
|
|
4065
4080
|
}
|
|
4066
|
-
class
|
|
4081
|
+
class Hs {
|
|
4067
4082
|
constructor() {
|
|
4068
4083
|
this.globalLog = (t) => {
|
|
4069
4084
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -4085,24 +4100,24 @@ function Oa() {
|
|
|
4085
4100
|
window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
|
|
4086
4101
|
}
|
|
4087
4102
|
log(t, ...s) {
|
|
4088
|
-
var a =
|
|
4089
|
-
|
|
4103
|
+
var a = nn.apply(this, arguments);
|
|
4104
|
+
Ct.log ? Ct.log(a) : Ct.logToConsole && t.bind(this)(a);
|
|
4090
4105
|
}
|
|
4091
4106
|
}
|
|
4092
|
-
var ce = new
|
|
4107
|
+
var ce = new Hs(), Bs = function(i, t, s, a, l) {
|
|
4093
4108
|
(s.headers !== void 0 || s.headersProvider != null) && ce.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
4094
4109
|
var g = i.nextAuthCallbackID.toString();
|
|
4095
4110
|
i.nextAuthCallbackID++;
|
|
4096
|
-
var S = i.getDocument(),
|
|
4111
|
+
var S = i.getDocument(), L = S.createElement("script");
|
|
4097
4112
|
i.auth_callbacks[g] = function(ee) {
|
|
4098
4113
|
l(null, ee);
|
|
4099
4114
|
};
|
|
4100
4115
|
var z = "Pusher.auth_callbacks['" + g + "']";
|
|
4101
|
-
|
|
4116
|
+
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
4102
4117
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
4103
|
-
Q.insertBefore(
|
|
4104
|
-
},
|
|
4105
|
-
class
|
|
4118
|
+
Q.insertBefore(L, Q.firstChild);
|
|
4119
|
+
}, Vs = Bs;
|
|
4120
|
+
class Xs {
|
|
4106
4121
|
constructor(t) {
|
|
4107
4122
|
this.src = t;
|
|
4108
4123
|
}
|
|
@@ -4122,13 +4137,13 @@ function Oa() {
|
|
|
4122
4137
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
4123
4138
|
}
|
|
4124
4139
|
}
|
|
4125
|
-
class
|
|
4140
|
+
class Ws {
|
|
4126
4141
|
constructor(t, s) {
|
|
4127
4142
|
this.url = t, this.data = s;
|
|
4128
4143
|
}
|
|
4129
4144
|
send(t) {
|
|
4130
4145
|
if (!this.request) {
|
|
4131
|
-
var s =
|
|
4146
|
+
var s = js(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
4132
4147
|
this.request = j.createScriptRequest(a), this.request.send(t);
|
|
4133
4148
|
}
|
|
4134
4149
|
}
|
|
@@ -4136,52 +4151,52 @@ function Oa() {
|
|
|
4136
4151
|
this.request && this.request.cleanup();
|
|
4137
4152
|
}
|
|
4138
4153
|
}
|
|
4139
|
-
var
|
|
4154
|
+
var Gs = function(i, t) {
|
|
4140
4155
|
return function(s, a) {
|
|
4141
|
-
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = j.createJSONPRequest(g, s),
|
|
4142
|
-
d.remove(
|
|
4156
|
+
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = j.createJSONPRequest(g, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
4157
|
+
d.remove(L), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(z, Q);
|
|
4143
4158
|
});
|
|
4144
|
-
S.send(
|
|
4159
|
+
S.send(L);
|
|
4145
4160
|
};
|
|
4146
|
-
},
|
|
4161
|
+
}, Js = {
|
|
4147
4162
|
name: "jsonp",
|
|
4148
|
-
getAgent:
|
|
4149
|
-
},
|
|
4150
|
-
function
|
|
4163
|
+
getAgent: Gs
|
|
4164
|
+
}, Ks = Js;
|
|
4165
|
+
function ht(i, t, s) {
|
|
4151
4166
|
var a = i + (t.useTLS ? "s" : ""), l = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
4152
4167
|
return a + "://" + l + s;
|
|
4153
4168
|
}
|
|
4154
|
-
function
|
|
4169
|
+
function ft(i, t) {
|
|
4155
4170
|
var s = "/app/" + i, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
4156
4171
|
return s + a;
|
|
4157
4172
|
}
|
|
4158
|
-
var
|
|
4173
|
+
var Qs = {
|
|
4159
4174
|
getInitial: function(i, t) {
|
|
4160
|
-
var s = (t.httpPath || "") +
|
|
4161
|
-
return
|
|
4175
|
+
var s = (t.httpPath || "") + ft(i, "flash=false");
|
|
4176
|
+
return ht("ws", t, s);
|
|
4162
4177
|
}
|
|
4163
|
-
},
|
|
4178
|
+
}, Ys = {
|
|
4164
4179
|
getInitial: function(i, t) {
|
|
4165
|
-
var s = (t.httpPath || "/pusher") +
|
|
4166
|
-
return
|
|
4180
|
+
var s = (t.httpPath || "/pusher") + ft(i);
|
|
4181
|
+
return ht("http", t, s);
|
|
4167
4182
|
}
|
|
4168
|
-
},
|
|
4183
|
+
}, Zs = {
|
|
4169
4184
|
getInitial: function(i, t) {
|
|
4170
|
-
return
|
|
4185
|
+
return ht("http", t, t.httpPath || "/pusher");
|
|
4171
4186
|
},
|
|
4172
4187
|
getPath: function(i, t) {
|
|
4173
|
-
return
|
|
4188
|
+
return ft(i);
|
|
4174
4189
|
}
|
|
4175
4190
|
};
|
|
4176
|
-
class
|
|
4191
|
+
class er {
|
|
4177
4192
|
constructor() {
|
|
4178
4193
|
this._callbacks = {};
|
|
4179
4194
|
}
|
|
4180
4195
|
get(t) {
|
|
4181
|
-
return this._callbacks[
|
|
4196
|
+
return this._callbacks[pt(t)];
|
|
4182
4197
|
}
|
|
4183
4198
|
add(t, s, a) {
|
|
4184
|
-
var l =
|
|
4199
|
+
var l = pt(t);
|
|
4185
4200
|
this._callbacks[l] = this._callbacks[l] || [], this._callbacks[l].push({
|
|
4186
4201
|
fn: s,
|
|
4187
4202
|
context: a
|
|
@@ -4192,7 +4207,7 @@ function Oa() {
|
|
|
4192
4207
|
this._callbacks = {};
|
|
4193
4208
|
return;
|
|
4194
4209
|
}
|
|
4195
|
-
var l = t ? [
|
|
4210
|
+
var l = t ? [pt(t)] : P(this._callbacks);
|
|
4196
4211
|
s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
|
|
4197
4212
|
}
|
|
4198
4213
|
removeCallback(t, s, a) {
|
|
@@ -4208,12 +4223,12 @@ function Oa() {
|
|
|
4208
4223
|
}, this);
|
|
4209
4224
|
}
|
|
4210
4225
|
}
|
|
4211
|
-
function
|
|
4226
|
+
function pt(i) {
|
|
4212
4227
|
return "_" + i;
|
|
4213
4228
|
}
|
|
4214
4229
|
class Te {
|
|
4215
4230
|
constructor(t) {
|
|
4216
|
-
this.callbacks = new
|
|
4231
|
+
this.callbacks = new er(), this.global_callbacks = [], this.failThrough = t;
|
|
4217
4232
|
}
|
|
4218
4233
|
bind(t, s, a) {
|
|
4219
4234
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4241,7 +4256,7 @@ function Oa() {
|
|
|
4241
4256
|
return this;
|
|
4242
4257
|
}
|
|
4243
4258
|
}
|
|
4244
|
-
class
|
|
4259
|
+
class tr extends Te {
|
|
4245
4260
|
constructor(t, s, a, l, g) {
|
|
4246
4261
|
super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = l, this.options = g, this.state = "new", this.timeline = g.timeline, this.activityTimeout = g.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4247
4262
|
}
|
|
@@ -4328,11 +4343,11 @@ function Oa() {
|
|
|
4328
4343
|
return this.hooks.isSupported(t);
|
|
4329
4344
|
}
|
|
4330
4345
|
createConnection(t, s, a, l) {
|
|
4331
|
-
return new
|
|
4346
|
+
return new tr(this.hooks, t, s, a, l);
|
|
4332
4347
|
}
|
|
4333
4348
|
}
|
|
4334
|
-
var
|
|
4335
|
-
urls:
|
|
4349
|
+
var nr = new De({
|
|
4350
|
+
urls: Qs,
|
|
4336
4351
|
handlesActivityChecks: !1,
|
|
4337
4352
|
supportsPing: !1,
|
|
4338
4353
|
isInitialized: function() {
|
|
@@ -4344,32 +4359,32 @@ function Oa() {
|
|
|
4344
4359
|
getSocket: function(i) {
|
|
4345
4360
|
return j.createWebSocket(i);
|
|
4346
4361
|
}
|
|
4347
|
-
}),
|
|
4348
|
-
urls:
|
|
4362
|
+
}), sn = {
|
|
4363
|
+
urls: Ys,
|
|
4349
4364
|
handlesActivityChecks: !1,
|
|
4350
4365
|
supportsPing: !0,
|
|
4351
4366
|
isInitialized: function() {
|
|
4352
4367
|
return !0;
|
|
4353
4368
|
}
|
|
4354
|
-
},
|
|
4369
|
+
}, rn = ve({
|
|
4355
4370
|
getSocket: function(i) {
|
|
4356
4371
|
return j.HTTPFactory.createStreamingSocket(i);
|
|
4357
4372
|
}
|
|
4358
|
-
},
|
|
4373
|
+
}, sn), on = ve({
|
|
4359
4374
|
getSocket: function(i) {
|
|
4360
4375
|
return j.HTTPFactory.createPollingSocket(i);
|
|
4361
4376
|
}
|
|
4362
|
-
},
|
|
4377
|
+
}, sn), an = {
|
|
4363
4378
|
isSupported: function() {
|
|
4364
4379
|
return j.isXHRSupported();
|
|
4365
4380
|
}
|
|
4366
|
-
},
|
|
4367
|
-
ws:
|
|
4368
|
-
xhr_streaming:
|
|
4369
|
-
xhr_polling:
|
|
4370
|
-
}, Ye =
|
|
4381
|
+
}, sr = new De(ve({}, rn, an)), rr = new De(ve({}, on, an)), ir = {
|
|
4382
|
+
ws: nr,
|
|
4383
|
+
xhr_streaming: sr,
|
|
4384
|
+
xhr_polling: rr
|
|
4385
|
+
}, Ye = ir, or = new De({
|
|
4371
4386
|
file: "sockjs",
|
|
4372
|
-
urls:
|
|
4387
|
+
urls: Zs,
|
|
4373
4388
|
handlesActivityChecks: !0,
|
|
4374
4389
|
supportsPing: !1,
|
|
4375
4390
|
isSupported: function() {
|
|
@@ -4391,15 +4406,15 @@ function Oa() {
|
|
|
4391
4406
|
path: t
|
|
4392
4407
|
}));
|
|
4393
4408
|
}
|
|
4394
|
-
}),
|
|
4409
|
+
}), cn = {
|
|
4395
4410
|
isSupported: function(i) {
|
|
4396
4411
|
var t = j.isXDRSupported(i.useTLS);
|
|
4397
4412
|
return t;
|
|
4398
4413
|
}
|
|
4399
|
-
},
|
|
4400
|
-
Ye.xdr_streaming =
|
|
4401
|
-
var
|
|
4402
|
-
class
|
|
4414
|
+
}, ar = new De(ve({}, rn, cn)), cr = new De(ve({}, on, cn));
|
|
4415
|
+
Ye.xdr_streaming = ar, Ye.xdr_polling = cr, Ye.sockjs = or;
|
|
4416
|
+
var ur = Ye;
|
|
4417
|
+
class lr extends Te {
|
|
4403
4418
|
constructor() {
|
|
4404
4419
|
super();
|
|
4405
4420
|
var t = this;
|
|
@@ -4413,8 +4428,8 @@ function Oa() {
|
|
|
4413
4428
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4414
4429
|
}
|
|
4415
4430
|
}
|
|
4416
|
-
var
|
|
4417
|
-
class
|
|
4431
|
+
var dr = new lr();
|
|
4432
|
+
class hr {
|
|
4418
4433
|
constructor(t, s, a) {
|
|
4419
4434
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4420
4435
|
}
|
|
@@ -4422,8 +4437,8 @@ function Oa() {
|
|
|
4422
4437
|
l = ve({}, l, {
|
|
4423
4438
|
activityTimeout: this.pingDelay
|
|
4424
4439
|
});
|
|
4425
|
-
var g = this.transport.createConnection(t, s, a, l), S = null,
|
|
4426
|
-
g.unbind("open",
|
|
4440
|
+
var g = this.transport.createConnection(t, s, a, l), S = null, L = function() {
|
|
4441
|
+
g.unbind("open", L), g.bind("closed", z), S = oe.now();
|
|
4427
4442
|
}, z = (Q) => {
|
|
4428
4443
|
if (g.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
|
|
4429
4444
|
this.manager.reportDeath();
|
|
@@ -4432,13 +4447,13 @@ function Oa() {
|
|
|
4432
4447
|
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4433
4448
|
}
|
|
4434
4449
|
};
|
|
4435
|
-
return g.bind("open",
|
|
4450
|
+
return g.bind("open", L), g;
|
|
4436
4451
|
}
|
|
4437
4452
|
isSupported(t) {
|
|
4438
4453
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4439
4454
|
}
|
|
4440
4455
|
}
|
|
4441
|
-
const
|
|
4456
|
+
const un = {
|
|
4442
4457
|
decodeMessage: function(i) {
|
|
4443
4458
|
try {
|
|
4444
4459
|
var t = JSON.parse(i.data), s = t.data;
|
|
@@ -4461,7 +4476,7 @@ function Oa() {
|
|
|
4461
4476
|
return JSON.stringify(i);
|
|
4462
4477
|
},
|
|
4463
4478
|
processHandshake: function(i) {
|
|
4464
|
-
var t =
|
|
4479
|
+
var t = un.decodeMessage(i);
|
|
4465
4480
|
if (t.event === "pusher:connection_established") {
|
|
4466
4481
|
if (!t.data.activity_timeout)
|
|
4467
4482
|
throw "No activity timeout specified in handshake";
|
|
@@ -4492,8 +4507,8 @@ function Oa() {
|
|
|
4492
4507
|
} : null;
|
|
4493
4508
|
}
|
|
4494
4509
|
};
|
|
4495
|
-
var Ie =
|
|
4496
|
-
class
|
|
4510
|
+
var Ie = un;
|
|
4511
|
+
class fr extends Te {
|
|
4497
4512
|
constructor(t, s) {
|
|
4498
4513
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4499
4514
|
}
|
|
@@ -4567,7 +4582,7 @@ function Oa() {
|
|
|
4567
4582
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4568
4583
|
}
|
|
4569
4584
|
}
|
|
4570
|
-
class
|
|
4585
|
+
class pr {
|
|
4571
4586
|
constructor(t, s) {
|
|
4572
4587
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4573
4588
|
}
|
|
@@ -4585,7 +4600,7 @@ function Oa() {
|
|
|
4585
4600
|
return;
|
|
4586
4601
|
}
|
|
4587
4602
|
s.action === "connected" ? this.finish("connected", {
|
|
4588
|
-
connection: new
|
|
4603
|
+
connection: new fr(s.id, this.transport),
|
|
4589
4604
|
activityTimeout: s.activityTimeout
|
|
4590
4605
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4591
4606
|
}, this.onClosed = (t) => {
|
|
@@ -4601,7 +4616,7 @@ function Oa() {
|
|
|
4601
4616
|
this.callback(ve({ transport: this.transport, action: t }, s));
|
|
4602
4617
|
}
|
|
4603
4618
|
}
|
|
4604
|
-
class
|
|
4619
|
+
class gr {
|
|
4605
4620
|
constructor(t, s) {
|
|
4606
4621
|
this.timeline = t, this.options = s || {};
|
|
4607
4622
|
}
|
|
@@ -4609,7 +4624,7 @@ function Oa() {
|
|
|
4609
4624
|
this.timeline.isEmpty() || this.timeline.send(j.TimelineTransport.getAgent(this, t), s);
|
|
4610
4625
|
}
|
|
4611
4626
|
}
|
|
4612
|
-
class
|
|
4627
|
+
class gt extends Te {
|
|
4613
4628
|
constructor(t, s) {
|
|
4614
4629
|
super(function(a, l) {
|
|
4615
4630
|
ce.debug("No callbacks on " + t + " for " + a);
|
|
@@ -4671,7 +4686,7 @@ function Oa() {
|
|
|
4671
4686
|
this.subscriptionCancelled = !1;
|
|
4672
4687
|
}
|
|
4673
4688
|
}
|
|
4674
|
-
class
|
|
4689
|
+
class mt extends gt {
|
|
4675
4690
|
authorize(t, s) {
|
|
4676
4691
|
return this.pusher.config.channelAuthorizer({
|
|
4677
4692
|
channelName: this.name,
|
|
@@ -4679,7 +4694,7 @@ function Oa() {
|
|
|
4679
4694
|
}, s);
|
|
4680
4695
|
}
|
|
4681
4696
|
}
|
|
4682
|
-
class
|
|
4697
|
+
class mr {
|
|
4683
4698
|
constructor() {
|
|
4684
4699
|
this.reset();
|
|
4685
4700
|
}
|
|
@@ -4711,14 +4726,14 @@ function Oa() {
|
|
|
4711
4726
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4712
4727
|
}
|
|
4713
4728
|
}
|
|
4714
|
-
var
|
|
4729
|
+
var vr = function(i, t, s, a) {
|
|
4715
4730
|
function l(g) {
|
|
4716
4731
|
return g instanceof s ? g : new s(function(S) {
|
|
4717
4732
|
S(g);
|
|
4718
4733
|
});
|
|
4719
4734
|
}
|
|
4720
4735
|
return new (s || (s = Promise))(function(g, S) {
|
|
4721
|
-
function
|
|
4736
|
+
function L(ee) {
|
|
4722
4737
|
try {
|
|
4723
4738
|
Q(a.next(ee));
|
|
4724
4739
|
} catch (de) {
|
|
@@ -4733,17 +4748,17 @@ function Oa() {
|
|
|
4733
4748
|
}
|
|
4734
4749
|
}
|
|
4735
4750
|
function Q(ee) {
|
|
4736
|
-
ee.done ? g(ee.value) : l(ee.value).then(
|
|
4751
|
+
ee.done ? g(ee.value) : l(ee.value).then(L, z);
|
|
4737
4752
|
}
|
|
4738
4753
|
Q((a = a.apply(i, t || [])).next());
|
|
4739
4754
|
});
|
|
4740
4755
|
};
|
|
4741
|
-
class
|
|
4756
|
+
class br extends mt {
|
|
4742
4757
|
constructor(t, s) {
|
|
4743
|
-
super(t, s), this.members = new
|
|
4758
|
+
super(t, s), this.members = new mr();
|
|
4744
4759
|
}
|
|
4745
4760
|
authorize(t, s) {
|
|
4746
|
-
super.authorize(t, (a, l) =>
|
|
4761
|
+
super.authorize(t, (a, l) => vr(this, void 0, void 0, function* () {
|
|
4747
4762
|
if (!a)
|
|
4748
4763
|
if (l = l, l.channel_data != null) {
|
|
4749
4764
|
var g = JSON.parse(l.channel_data);
|
|
@@ -4793,8 +4808,8 @@ function Oa() {
|
|
|
4793
4808
|
this.members.reset(), super.disconnect();
|
|
4794
4809
|
}
|
|
4795
4810
|
}
|
|
4796
|
-
var
|
|
4797
|
-
class
|
|
4811
|
+
var yr = c(1), vt = c(0);
|
|
4812
|
+
class _r extends mt {
|
|
4798
4813
|
constructor(t, s, a) {
|
|
4799
4814
|
super(t, s), this.key = null, this.nacl = a;
|
|
4800
4815
|
}
|
|
@@ -4809,7 +4824,7 @@ function Oa() {
|
|
|
4809
4824
|
s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4810
4825
|
return;
|
|
4811
4826
|
}
|
|
4812
|
-
this.key = Object(
|
|
4827
|
+
this.key = Object(vt.decode)(g), delete l.shared_secret, s(null, l);
|
|
4813
4828
|
});
|
|
4814
4829
|
}
|
|
4815
4830
|
trigger(t, s) {
|
|
@@ -4832,21 +4847,21 @@ function Oa() {
|
|
|
4832
4847
|
ce.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4833
4848
|
return;
|
|
4834
4849
|
}
|
|
4835
|
-
let a = Object(
|
|
4850
|
+
let a = Object(vt.decode)(s.ciphertext);
|
|
4836
4851
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4837
4852
|
ce.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4838
4853
|
return;
|
|
4839
4854
|
}
|
|
4840
|
-
let l = Object(
|
|
4855
|
+
let l = Object(vt.decode)(s.nonce);
|
|
4841
4856
|
if (l.length < this.nacl.secretbox.nonceLength) {
|
|
4842
4857
|
ce.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
|
|
4843
4858
|
return;
|
|
4844
4859
|
}
|
|
4845
4860
|
let g = this.nacl.secretbox.open(a, l, this.key);
|
|
4846
4861
|
if (g === null) {
|
|
4847
|
-
ce.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S,
|
|
4862
|
+
ce.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, L) => {
|
|
4848
4863
|
if (S) {
|
|
4849
|
-
ce.error(`Failed to make a request to the authEndpoint: ${
|
|
4864
|
+
ce.error(`Failed to make a request to the authEndpoint: ${L}. Unable to fetch new key, so dropping encrypted event`);
|
|
4850
4865
|
return;
|
|
4851
4866
|
}
|
|
4852
4867
|
if (g = this.nacl.secretbox.open(a, l, this.key), g === null) {
|
|
@@ -4860,7 +4875,7 @@ function Oa() {
|
|
|
4860
4875
|
this.emit(t, this.getDataToEmit(g));
|
|
4861
4876
|
}
|
|
4862
4877
|
getDataToEmit(t) {
|
|
4863
|
-
let s = Object(
|
|
4878
|
+
let s = Object(yr.decode)(t);
|
|
4864
4879
|
try {
|
|
4865
4880
|
return JSON.parse(s);
|
|
4866
4881
|
} catch {
|
|
@@ -4868,7 +4883,7 @@ function Oa() {
|
|
|
4868
4883
|
}
|
|
4869
4884
|
}
|
|
4870
4885
|
}
|
|
4871
|
-
class
|
|
4886
|
+
class Sr extends Te {
|
|
4872
4887
|
constructor(t, s) {
|
|
4873
4888
|
super(), this.state = "initialized", this.connection = null, this.key = t, this.options = s, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
4874
4889
|
var a = j.getNetwork();
|
|
@@ -5024,12 +5039,12 @@ function Oa() {
|
|
|
5024
5039
|
return this.state === "connecting" || this.state === "connected";
|
|
5025
5040
|
}
|
|
5026
5041
|
}
|
|
5027
|
-
class
|
|
5042
|
+
class Cr {
|
|
5028
5043
|
constructor() {
|
|
5029
5044
|
this.channels = {};
|
|
5030
5045
|
}
|
|
5031
5046
|
add(t, s) {
|
|
5032
|
-
return this.channels[t] || (this.channels[t] =
|
|
5047
|
+
return this.channels[t] || (this.channels[t] = wr(t, s)), this.channels[t];
|
|
5033
5048
|
}
|
|
5034
5049
|
all() {
|
|
5035
5050
|
return D(this.channels);
|
|
@@ -5047,7 +5062,7 @@ function Oa() {
|
|
|
5047
5062
|
});
|
|
5048
5063
|
}
|
|
5049
5064
|
}
|
|
5050
|
-
function
|
|
5065
|
+
function wr(i, t) {
|
|
5051
5066
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5052
5067
|
if (t.config.nacl)
|
|
5053
5068
|
return Ee.createEncryptedChannel(i, t, t.config.nacl);
|
|
@@ -5063,36 +5078,36 @@ function Oa() {
|
|
|
5063
5078
|
return Ee.createChannel(i, t);
|
|
5064
5079
|
}
|
|
5065
5080
|
}
|
|
5066
|
-
var
|
|
5081
|
+
var Tr = {
|
|
5067
5082
|
createChannels() {
|
|
5068
|
-
return new
|
|
5083
|
+
return new Cr();
|
|
5069
5084
|
},
|
|
5070
5085
|
createConnectionManager(i, t) {
|
|
5071
|
-
return new
|
|
5086
|
+
return new Sr(i, t);
|
|
5072
5087
|
},
|
|
5073
5088
|
createChannel(i, t) {
|
|
5074
|
-
return new
|
|
5089
|
+
return new gt(i, t);
|
|
5075
5090
|
},
|
|
5076
5091
|
createPrivateChannel(i, t) {
|
|
5077
|
-
return new
|
|
5092
|
+
return new mt(i, t);
|
|
5078
5093
|
},
|
|
5079
5094
|
createPresenceChannel(i, t) {
|
|
5080
|
-
return new
|
|
5095
|
+
return new br(i, t);
|
|
5081
5096
|
},
|
|
5082
5097
|
createEncryptedChannel(i, t, s) {
|
|
5083
|
-
return new
|
|
5098
|
+
return new _r(i, t, s);
|
|
5084
5099
|
},
|
|
5085
5100
|
createTimelineSender(i, t) {
|
|
5086
|
-
return new
|
|
5101
|
+
return new gr(i, t);
|
|
5087
5102
|
},
|
|
5088
5103
|
createHandshake(i, t) {
|
|
5089
|
-
return new
|
|
5104
|
+
return new pr(i, t);
|
|
5090
5105
|
},
|
|
5091
5106
|
createAssistantToTheTransportManager(i, t, s) {
|
|
5092
|
-
return new
|
|
5107
|
+
return new hr(i, t, s);
|
|
5093
5108
|
}
|
|
5094
|
-
}, Ee =
|
|
5095
|
-
class
|
|
5109
|
+
}, Ee = Tr;
|
|
5110
|
+
class ln {
|
|
5096
5111
|
constructor(t) {
|
|
5097
5112
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
5098
5113
|
}
|
|
@@ -5117,10 +5132,10 @@ function Oa() {
|
|
|
5117
5132
|
return we(this.strategies, oe.method("isSupported"));
|
|
5118
5133
|
}
|
|
5119
5134
|
connect(t, s) {
|
|
5120
|
-
var a = this.strategies, l = 0, g = this.timeout, S = null,
|
|
5121
|
-
Q ? s(null, Q) : (l = l + 1, this.loop && (l = l % a.length), l < a.length ? (g && (g = g * 2, this.timeoutLimit && (g = Math.min(g, this.timeoutLimit))), S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast },
|
|
5135
|
+
var a = this.strategies, l = 0, g = this.timeout, S = null, L = (z, Q) => {
|
|
5136
|
+
Q ? s(null, Q) : (l = l + 1, this.loop && (l = l % a.length), l < a.length ? (g && (g = g * 2, this.timeoutLimit && (g = Math.min(g, this.timeoutLimit))), S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, L)) : s(!0));
|
|
5122
5137
|
};
|
|
5123
|
-
return S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast },
|
|
5138
|
+
return S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, L), {
|
|
5124
5139
|
abort: function() {
|
|
5125
5140
|
S.abort();
|
|
5126
5141
|
},
|
|
@@ -5133,19 +5148,19 @@ function Oa() {
|
|
|
5133
5148
|
var g = null, S = null;
|
|
5134
5149
|
return a.timeout > 0 && (g = new U(a.timeout, function() {
|
|
5135
5150
|
S.abort(), l(!0);
|
|
5136
|
-
})), S = t.connect(s, function(
|
|
5137
|
-
|
|
5151
|
+
})), S = t.connect(s, function(L, z) {
|
|
5152
|
+
L && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(L, z));
|
|
5138
5153
|
}), {
|
|
5139
5154
|
abort: function() {
|
|
5140
5155
|
g && g.ensureAborted(), S.abort();
|
|
5141
5156
|
},
|
|
5142
|
-
forceMinPriority: function(
|
|
5143
|
-
S.forceMinPriority(
|
|
5157
|
+
forceMinPriority: function(L) {
|
|
5158
|
+
S.forceMinPriority(L);
|
|
5144
5159
|
}
|
|
5145
5160
|
};
|
|
5146
5161
|
}
|
|
5147
5162
|
}
|
|
5148
|
-
class
|
|
5163
|
+
class bt {
|
|
5149
5164
|
constructor(t) {
|
|
5150
5165
|
this.strategies = t;
|
|
5151
5166
|
}
|
|
@@ -5153,26 +5168,26 @@ function Oa() {
|
|
|
5153
5168
|
return we(this.strategies, oe.method("isSupported"));
|
|
5154
5169
|
}
|
|
5155
5170
|
connect(t, s) {
|
|
5156
|
-
return
|
|
5171
|
+
return Er(this.strategies, t, function(a, l) {
|
|
5157
5172
|
return function(g, S) {
|
|
5158
5173
|
if (l[a].error = g, g) {
|
|
5159
|
-
|
|
5174
|
+
Ar(l) && s(!0);
|
|
5160
5175
|
return;
|
|
5161
5176
|
}
|
|
5162
|
-
O(l, function(
|
|
5163
|
-
|
|
5177
|
+
O(l, function(L) {
|
|
5178
|
+
L.forceMinPriority(S.transport.priority);
|
|
5164
5179
|
}), s(null, S);
|
|
5165
5180
|
};
|
|
5166
5181
|
});
|
|
5167
5182
|
}
|
|
5168
5183
|
}
|
|
5169
|
-
function
|
|
5170
|
-
var a = se(i, function(l, g, S,
|
|
5171
|
-
return l.connect(t, s(g,
|
|
5184
|
+
function Er(i, t, s) {
|
|
5185
|
+
var a = se(i, function(l, g, S, L) {
|
|
5186
|
+
return l.connect(t, s(g, L));
|
|
5172
5187
|
});
|
|
5173
5188
|
return {
|
|
5174
5189
|
abort: function() {
|
|
5175
|
-
O(a,
|
|
5190
|
+
O(a, Rr);
|
|
5176
5191
|
},
|
|
5177
5192
|
forceMinPriority: function(l) {
|
|
5178
5193
|
O(a, function(g) {
|
|
@@ -5181,15 +5196,15 @@ function Oa() {
|
|
|
5181
5196
|
}
|
|
5182
5197
|
};
|
|
5183
5198
|
}
|
|
5184
|
-
function
|
|
5199
|
+
function Ar(i) {
|
|
5185
5200
|
return ge(i, function(t) {
|
|
5186
5201
|
return !!t.error;
|
|
5187
5202
|
});
|
|
5188
5203
|
}
|
|
5189
|
-
function
|
|
5204
|
+
function Rr(i) {
|
|
5190
5205
|
!i.error && !i.aborted && (i.abort(), i.aborted = !0);
|
|
5191
5206
|
}
|
|
5192
|
-
class
|
|
5207
|
+
class Pr {
|
|
5193
5208
|
constructor(t, s, a) {
|
|
5194
5209
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
5195
5210
|
}
|
|
@@ -5197,20 +5212,20 @@ function Oa() {
|
|
|
5197
5212
|
return this.strategy.isSupported();
|
|
5198
5213
|
}
|
|
5199
5214
|
connect(t, s) {
|
|
5200
|
-
var a = this.usingTLS, l =
|
|
5215
|
+
var a = this.usingTLS, l = Mr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
|
|
5201
5216
|
if (l && l.timestamp + this.ttl >= oe.now()) {
|
|
5202
|
-
var
|
|
5203
|
-
|
|
5217
|
+
var L = this.transports[l.transport];
|
|
5218
|
+
L && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
|
|
5204
5219
|
cached: !0,
|
|
5205
5220
|
transport: l.transport,
|
|
5206
5221
|
latency: l.latency
|
|
5207
|
-
}), S.push(new Ue([
|
|
5222
|
+
}), S.push(new Ue([L], {
|
|
5208
5223
|
timeout: l.latency * 2 + 1e3,
|
|
5209
5224
|
failFast: !0
|
|
5210
5225
|
}))) : g++);
|
|
5211
5226
|
}
|
|
5212
5227
|
var z = oe.now(), Q = S.pop().connect(t, function ee(de, tt) {
|
|
5213
|
-
de ? (
|
|
5228
|
+
de ? (dn(a), S.length > 0 ? (z = oe.now(), Q = S.pop().connect(t, ee)) : s(de)) : (kr(a, tt.transport.name, oe.now() - z, g), s(null, tt));
|
|
5214
5229
|
});
|
|
5215
5230
|
return {
|
|
5216
5231
|
abort: function() {
|
|
@@ -5222,26 +5237,26 @@ function Oa() {
|
|
|
5222
5237
|
};
|
|
5223
5238
|
}
|
|
5224
5239
|
}
|
|
5225
|
-
function
|
|
5240
|
+
function yt(i) {
|
|
5226
5241
|
return "pusherTransport" + (i ? "TLS" : "NonTLS");
|
|
5227
5242
|
}
|
|
5228
|
-
function
|
|
5243
|
+
function Mr(i) {
|
|
5229
5244
|
var t = j.getLocalStorage();
|
|
5230
5245
|
if (t)
|
|
5231
5246
|
try {
|
|
5232
|
-
var s = t[
|
|
5247
|
+
var s = t[yt(i)];
|
|
5233
5248
|
if (s)
|
|
5234
5249
|
return JSON.parse(s);
|
|
5235
5250
|
} catch {
|
|
5236
|
-
|
|
5251
|
+
dn(i);
|
|
5237
5252
|
}
|
|
5238
5253
|
return null;
|
|
5239
5254
|
}
|
|
5240
|
-
function
|
|
5255
|
+
function kr(i, t, s, a) {
|
|
5241
5256
|
var l = j.getLocalStorage();
|
|
5242
5257
|
if (l)
|
|
5243
5258
|
try {
|
|
5244
|
-
l[
|
|
5259
|
+
l[yt(i)] = Qe({
|
|
5245
5260
|
timestamp: oe.now(),
|
|
5246
5261
|
transport: t,
|
|
5247
5262
|
latency: s,
|
|
@@ -5250,11 +5265,11 @@ function Oa() {
|
|
|
5250
5265
|
} catch {
|
|
5251
5266
|
}
|
|
5252
5267
|
}
|
|
5253
|
-
function
|
|
5268
|
+
function dn(i) {
|
|
5254
5269
|
var t = j.getLocalStorage();
|
|
5255
5270
|
if (t)
|
|
5256
5271
|
try {
|
|
5257
|
-
delete t[
|
|
5272
|
+
delete t[yt(i)];
|
|
5258
5273
|
} catch {
|
|
5259
5274
|
}
|
|
5260
5275
|
}
|
|
@@ -5292,7 +5307,7 @@ function Oa() {
|
|
|
5292
5307
|
return a.connect(t, s);
|
|
5293
5308
|
}
|
|
5294
5309
|
}
|
|
5295
|
-
class
|
|
5310
|
+
class xr {
|
|
5296
5311
|
constructor(t) {
|
|
5297
5312
|
this.strategy = t;
|
|
5298
5313
|
}
|
|
@@ -5311,11 +5326,11 @@ function Oa() {
|
|
|
5311
5326
|
return i.isSupported();
|
|
5312
5327
|
};
|
|
5313
5328
|
}
|
|
5314
|
-
var
|
|
5329
|
+
var Lr = function(i, t, s) {
|
|
5315
5330
|
var a = {};
|
|
5316
|
-
function l(
|
|
5317
|
-
var
|
|
5318
|
-
return a[
|
|
5331
|
+
function l(Cn, xi, Li, Ii, Ui) {
|
|
5332
|
+
var wn = s(i, Cn, xi, Li, Ii, Ui);
|
|
5333
|
+
return a[Cn] = wn, wn;
|
|
5319
5334
|
}
|
|
5320
5335
|
var g = Object.assign({}, t, {
|
|
5321
5336
|
hostNonTLS: i.wsHost + ":" + i.wsPort,
|
|
@@ -5323,7 +5338,7 @@ function Oa() {
|
|
|
5323
5338
|
httpPath: i.wsPath
|
|
5324
5339
|
}), S = Object.assign({}, g, {
|
|
5325
5340
|
useTLS: !0
|
|
5326
|
-
}),
|
|
5341
|
+
}), L = Object.assign({}, t, {
|
|
5327
5342
|
hostNonTLS: i.httpHost + ":" + i.httpPort,
|
|
5328
5343
|
hostTLS: i.httpHost + ":" + i.httpsPort,
|
|
5329
5344
|
httpPath: i.httpPath
|
|
@@ -5331,43 +5346,43 @@ function Oa() {
|
|
|
5331
5346
|
loop: !0,
|
|
5332
5347
|
timeout: 15e3,
|
|
5333
5348
|
timeoutLimit: 6e4
|
|
5334
|
-
}, Q = new
|
|
5349
|
+
}, Q = new ln({
|
|
5335
5350
|
minPingDelay: 1e4,
|
|
5336
5351
|
maxPingDelay: i.activityTimeout
|
|
5337
|
-
}), ee = new
|
|
5352
|
+
}), ee = new ln({
|
|
5338
5353
|
lives: 2,
|
|
5339
5354
|
minPingDelay: 1e4,
|
|
5340
5355
|
maxPingDelay: i.activityTimeout
|
|
5341
|
-
}), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q),
|
|
5342
|
-
new ze(je(
|
|
5343
|
-
], z),
|
|
5344
|
-
new ze(je(
|
|
5345
|
-
], z),
|
|
5346
|
-
new ze(je(
|
|
5347
|
-
|
|
5348
|
-
new Ze(
|
|
5349
|
-
]),
|
|
5350
|
-
], z),
|
|
5351
|
-
return t.useTLS ?
|
|
5352
|
-
|
|
5353
|
-
new Ze(
|
|
5354
|
-
]) :
|
|
5355
|
-
|
|
5356
|
-
new Ze(
|
|
5357
|
-
new Ze(
|
|
5358
|
-
]), new
|
|
5356
|
+
}), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Ai = l("sockjs", "sockjs", 1, L), mn = l("xhr_streaming", "xhr_streaming", 1, L, ee), Ri = 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([Ai], z), yn = new Ue([
|
|
5357
|
+
new ze(je(mn), mn, Ri)
|
|
5358
|
+
], z), _n = new Ue([
|
|
5359
|
+
new ze(je(vn), vn, Pi)
|
|
5360
|
+
], z), Sn = new Ue([
|
|
5361
|
+
new ze(je(yn), new bt([
|
|
5362
|
+
yn,
|
|
5363
|
+
new Ze(_n, { delay: 4e3 })
|
|
5364
|
+
]), _n)
|
|
5365
|
+
], z), wt = new ze(je(Sn), Sn, ki), Tt;
|
|
5366
|
+
return t.useTLS ? Tt = new bt([
|
|
5367
|
+
bn,
|
|
5368
|
+
new Ze(wt, { delay: 2e3 })
|
|
5369
|
+
]) : Tt = new bt([
|
|
5370
|
+
bn,
|
|
5371
|
+
new Ze(Mi, { delay: 2e3 }),
|
|
5372
|
+
new Ze(wt, { delay: 5e3 })
|
|
5373
|
+
]), new Pr(new xr(new ze(je(de), Tt, wt)), a, {
|
|
5359
5374
|
ttl: 18e5,
|
|
5360
5375
|
timeline: t.timeline,
|
|
5361
5376
|
useTLS: t.useTLS
|
|
5362
5377
|
});
|
|
5363
|
-
},
|
|
5378
|
+
}, Ir = Lr, Ur = (function() {
|
|
5364
5379
|
var i = this;
|
|
5365
5380
|
i.timeline.info(i.buildTimelineMessage({
|
|
5366
5381
|
transport: i.name + (i.options.useTLS ? "s" : "")
|
|
5367
5382
|
})), i.hooks.isInitialized() ? i.changeState("initialized") : i.hooks.file ? (i.changeState("initializing"), v.load(i.hooks.file, { useTLS: i.options.useTLS }, function(t, s) {
|
|
5368
5383
|
i.hooks.isInitialized() ? (i.changeState("initialized"), s(!0)) : (t && i.onError(t), i.onClose(), s(!1));
|
|
5369
5384
|
})) : i.onClose();
|
|
5370
|
-
}),
|
|
5385
|
+
}), Or = {
|
|
5371
5386
|
getRequest: function(i) {
|
|
5372
5387
|
var t = new window.XDomainRequest();
|
|
5373
5388
|
return t.ontimeout = function() {
|
|
@@ -5383,9 +5398,9 @@ function Oa() {
|
|
|
5383
5398
|
abortRequest: function(i) {
|
|
5384
5399
|
i.ontimeout = i.onerror = i.onprogress = i.onload = null, i.abort();
|
|
5385
5400
|
}
|
|
5386
|
-
},
|
|
5387
|
-
const
|
|
5388
|
-
class
|
|
5401
|
+
}, Fr = Or;
|
|
5402
|
+
const Dr = 256 * 1024;
|
|
5403
|
+
class Nr extends Te {
|
|
5389
5404
|
constructor(t, s, a) {
|
|
5390
5405
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5391
5406
|
}
|
|
@@ -5413,17 +5428,17 @@ function Oa() {
|
|
|
5413
5428
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5414
5429
|
}
|
|
5415
5430
|
isBufferTooLong(t) {
|
|
5416
|
-
return this.position === t.length && t.length >
|
|
5431
|
+
return this.position === t.length && t.length > Dr;
|
|
5417
5432
|
}
|
|
5418
5433
|
}
|
|
5419
|
-
var
|
|
5434
|
+
var _t;
|
|
5420
5435
|
(function(i) {
|
|
5421
5436
|
i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED";
|
|
5422
|
-
})(
|
|
5423
|
-
var Oe =
|
|
5424
|
-
class
|
|
5437
|
+
})(_t || (_t = {}));
|
|
5438
|
+
var Oe = _t, qr = 1;
|
|
5439
|
+
class zr {
|
|
5425
5440
|
constructor(t, s) {
|
|
5426
|
-
this.hooks = t, this.session =
|
|
5441
|
+
this.hooks = t, this.session = fn(1e3) + "/" + Br(8), this.location = jr(s), this.readyState = Oe.CONNECTING, this.openStream();
|
|
5427
5442
|
}
|
|
5428
5443
|
send(t) {
|
|
5429
5444
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5437,7 +5452,7 @@ function Oa() {
|
|
|
5437
5452
|
sendRaw(t) {
|
|
5438
5453
|
if (this.readyState === Oe.OPEN)
|
|
5439
5454
|
try {
|
|
5440
|
-
return j.createSocketRequest("POST",
|
|
5455
|
+
return j.createSocketRequest("POST", hn($r(this.location, this.session))).start(t), !0;
|
|
5441
5456
|
} catch {
|
|
5442
5457
|
return !1;
|
|
5443
5458
|
}
|
|
@@ -5480,7 +5495,7 @@ function Oa() {
|
|
|
5480
5495
|
}
|
|
5481
5496
|
}
|
|
5482
5497
|
onOpen(t) {
|
|
5483
|
-
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base =
|
|
5498
|
+
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base = Hr(this.location.base, t.hostname)), this.readyState = Oe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5484
5499
|
}
|
|
5485
5500
|
onEvent(t) {
|
|
5486
5501
|
this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
@@ -5492,7 +5507,7 @@ function Oa() {
|
|
|
5492
5507
|
this.onerror && this.onerror(t);
|
|
5493
5508
|
}
|
|
5494
5509
|
openStream() {
|
|
5495
|
-
this.stream = j.createSocketRequest("POST",
|
|
5510
|
+
this.stream = j.createSocketRequest("POST", hn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5496
5511
|
this.onChunk(t);
|
|
5497
5512
|
}), this.stream.bind("finished", (t) => {
|
|
5498
5513
|
this.hooks.onFinished(this, t);
|
|
@@ -5511,33 +5526,33 @@ function Oa() {
|
|
|
5511
5526
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5512
5527
|
}
|
|
5513
5528
|
}
|
|
5514
|
-
function
|
|
5529
|
+
function jr(i) {
|
|
5515
5530
|
var t = /([^\?]*)\/*(\??.*)/.exec(i);
|
|
5516
5531
|
return {
|
|
5517
5532
|
base: t[1],
|
|
5518
5533
|
queryString: t[2]
|
|
5519
5534
|
};
|
|
5520
5535
|
}
|
|
5521
|
-
function
|
|
5536
|
+
function $r(i, t) {
|
|
5522
5537
|
return i.base + "/" + t + "/xhr_send";
|
|
5523
5538
|
}
|
|
5524
|
-
function
|
|
5539
|
+
function hn(i) {
|
|
5525
5540
|
var t = i.indexOf("?") === -1 ? "?" : "&";
|
|
5526
|
-
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5541
|
+
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + qr++;
|
|
5527
5542
|
}
|
|
5528
|
-
function
|
|
5543
|
+
function Hr(i, t) {
|
|
5529
5544
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(i);
|
|
5530
5545
|
return s[1] + t + s[3];
|
|
5531
5546
|
}
|
|
5532
|
-
function
|
|
5547
|
+
function fn(i) {
|
|
5533
5548
|
return j.randomInt(i);
|
|
5534
5549
|
}
|
|
5535
|
-
function
|
|
5550
|
+
function Br(i) {
|
|
5536
5551
|
for (var t = [], s = 0; s < i; s++)
|
|
5537
|
-
t.push(
|
|
5552
|
+
t.push(fn(32).toString(32));
|
|
5538
5553
|
return t.join("");
|
|
5539
5554
|
}
|
|
5540
|
-
var
|
|
5555
|
+
var Vr = zr, Xr = {
|
|
5541
5556
|
getReceiveURL: function(i, t) {
|
|
5542
5557
|
return i.base + "/" + t + "/xhr_streaming" + i.queryString;
|
|
5543
5558
|
},
|
|
@@ -5550,7 +5565,7 @@ function Oa() {
|
|
|
5550
5565
|
onFinished: function(i, t) {
|
|
5551
5566
|
i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5552
5567
|
}
|
|
5553
|
-
},
|
|
5568
|
+
}, Wr = Xr, Gr = {
|
|
5554
5569
|
getReceiveURL: function(i, t) {
|
|
5555
5570
|
return i.base + "/" + t + "/xhr" + i.queryString;
|
|
5556
5571
|
},
|
|
@@ -5562,7 +5577,7 @@ function Oa() {
|
|
|
5562
5577
|
onFinished: function(i, t) {
|
|
5563
5578
|
t === 200 ? i.reconnect() : i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5564
5579
|
}
|
|
5565
|
-
},
|
|
5580
|
+
}, Jr = Gr, Kr = {
|
|
5566
5581
|
getRequest: function(i) {
|
|
5567
5582
|
var t = j.getXHRAPI(), s = new t();
|
|
5568
5583
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5579,36 +5594,36 @@ function Oa() {
|
|
|
5579
5594
|
abortRequest: function(i) {
|
|
5580
5595
|
i.onreadystatechange = null, i.abort();
|
|
5581
5596
|
}
|
|
5582
|
-
},
|
|
5597
|
+
}, Qr = Kr, Yr = {
|
|
5583
5598
|
createStreamingSocket(i) {
|
|
5584
|
-
return this.createSocket(
|
|
5599
|
+
return this.createSocket(Wr, i);
|
|
5585
5600
|
},
|
|
5586
5601
|
createPollingSocket(i) {
|
|
5587
|
-
return this.createSocket(
|
|
5602
|
+
return this.createSocket(Jr, i);
|
|
5588
5603
|
},
|
|
5589
5604
|
createSocket(i, t) {
|
|
5590
|
-
return new
|
|
5605
|
+
return new Vr(i, t);
|
|
5591
5606
|
},
|
|
5592
5607
|
createXHR(i, t) {
|
|
5593
|
-
return this.createRequest(
|
|
5608
|
+
return this.createRequest(Qr, i, t);
|
|
5594
5609
|
},
|
|
5595
5610
|
createRequest(i, t, s) {
|
|
5596
|
-
return new
|
|
5611
|
+
return new Nr(i, t, s);
|
|
5597
5612
|
}
|
|
5598
|
-
},
|
|
5599
|
-
|
|
5600
|
-
return this.createRequest(
|
|
5613
|
+
}, pn = Yr;
|
|
5614
|
+
pn.createXDR = function(i, t) {
|
|
5615
|
+
return this.createRequest(Fr, i, t);
|
|
5601
5616
|
};
|
|
5602
|
-
var
|
|
5617
|
+
var Zr = pn, ei = {
|
|
5603
5618
|
nextAuthCallbackID: 1,
|
|
5604
5619
|
auth_callbacks: {},
|
|
5605
5620
|
ScriptReceivers: d,
|
|
5606
5621
|
DependenciesReceivers: C,
|
|
5607
|
-
getDefaultStrategy:
|
|
5608
|
-
Transports:
|
|
5609
|
-
transportConnectionInitializer:
|
|
5610
|
-
HTTPFactory:
|
|
5611
|
-
TimelineTransport:
|
|
5622
|
+
getDefaultStrategy: Ir,
|
|
5623
|
+
Transports: ur,
|
|
5624
|
+
transportConnectionInitializer: Ur,
|
|
5625
|
+
HTTPFactory: Zr,
|
|
5626
|
+
TimelineTransport: Ks,
|
|
5612
5627
|
getXHRAPI() {
|
|
5613
5628
|
return window.XMLHttpRequest;
|
|
5614
5629
|
},
|
|
@@ -5629,7 +5644,7 @@ function Oa() {
|
|
|
5629
5644
|
return this.getDocument().location.protocol;
|
|
5630
5645
|
},
|
|
5631
5646
|
getAuthorizers() {
|
|
5632
|
-
return { ajax: V, jsonp:
|
|
5647
|
+
return { ajax: V, jsonp: Vs };
|
|
5633
5648
|
},
|
|
5634
5649
|
onDocumentBody(i) {
|
|
5635
5650
|
document.body ? i() : setTimeout(() => {
|
|
@@ -5637,10 +5652,10 @@ function Oa() {
|
|
|
5637
5652
|
}, 0);
|
|
5638
5653
|
},
|
|
5639
5654
|
createJSONPRequest(i, t) {
|
|
5640
|
-
return new
|
|
5655
|
+
return new Ws(i, t);
|
|
5641
5656
|
},
|
|
5642
5657
|
createScriptRequest(i) {
|
|
5643
|
-
return new
|
|
5658
|
+
return new Xs(i);
|
|
5644
5659
|
},
|
|
5645
5660
|
getLocalStorage() {
|
|
5646
5661
|
try {
|
|
@@ -5660,7 +5675,7 @@ function Oa() {
|
|
|
5660
5675
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5661
5676
|
},
|
|
5662
5677
|
getNetwork() {
|
|
5663
|
-
return
|
|
5678
|
+
return dr;
|
|
5664
5679
|
},
|
|
5665
5680
|
createWebSocket(i) {
|
|
5666
5681
|
var t = this.getWebSocketAPI();
|
|
@@ -5692,12 +5707,12 @@ function Oa() {
|
|
|
5692
5707
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5693
5708
|
}() * i);
|
|
5694
5709
|
}
|
|
5695
|
-
}, j =
|
|
5710
|
+
}, j = ei, St;
|
|
5696
5711
|
(function(i) {
|
|
5697
5712
|
i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
|
|
5698
|
-
})(
|
|
5699
|
-
var et =
|
|
5700
|
-
class
|
|
5713
|
+
})(St || (St = {}));
|
|
5714
|
+
var et = St;
|
|
5715
|
+
class ti {
|
|
5701
5716
|
constructor(t, s, a) {
|
|
5702
5717
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5703
5718
|
}
|
|
@@ -5735,7 +5750,7 @@ function Oa() {
|
|
|
5735
5750
|
return this.uniqueID++, this.uniqueID;
|
|
5736
5751
|
}
|
|
5737
5752
|
}
|
|
5738
|
-
class
|
|
5753
|
+
class ni {
|
|
5739
5754
|
constructor(t, s, a, l) {
|
|
5740
5755
|
this.name = t, this.priority = s, this.transport = a, this.options = l || {};
|
|
5741
5756
|
}
|
|
@@ -5747,11 +5762,11 @@ function Oa() {
|
|
|
5747
5762
|
connect(t, s) {
|
|
5748
5763
|
if (this.isSupported()) {
|
|
5749
5764
|
if (this.priority < t)
|
|
5750
|
-
return
|
|
5751
|
-
} else return
|
|
5765
|
+
return gn(new F(), s);
|
|
5766
|
+
} else return gn(new te(), s);
|
|
5752
5767
|
var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
|
|
5753
5768
|
l.unbind("initialized", S), l.connect();
|
|
5754
|
-
},
|
|
5769
|
+
}, L = function() {
|
|
5755
5770
|
g = Ee.createHandshake(l, function(de) {
|
|
5756
5771
|
a = !0, ee(), s(null, de);
|
|
5757
5772
|
});
|
|
@@ -5762,9 +5777,9 @@ function Oa() {
|
|
|
5762
5777
|
var de;
|
|
5763
5778
|
de = Qe(l), s(new q(de));
|
|
5764
5779
|
}, ee = function() {
|
|
5765
|
-
l.unbind("initialized", S), l.unbind("open",
|
|
5780
|
+
l.unbind("initialized", S), l.unbind("open", L), l.unbind("error", z), l.unbind("closed", Q);
|
|
5766
5781
|
};
|
|
5767
|
-
return l.bind("initialized", S), l.bind("open",
|
|
5782
|
+
return l.bind("initialized", S), l.bind("open", L), l.bind("error", z), l.bind("closed", Q), l.initialize(), {
|
|
5768
5783
|
abort: () => {
|
|
5769
5784
|
a || (ee(), g ? g.close() : l.close());
|
|
5770
5785
|
},
|
|
@@ -5774,7 +5789,7 @@ function Oa() {
|
|
|
5774
5789
|
};
|
|
5775
5790
|
}
|
|
5776
5791
|
}
|
|
5777
|
-
function
|
|
5792
|
+
function gn(i, t) {
|
|
5778
5793
|
return oe.defer(function() {
|
|
5779
5794
|
t(i);
|
|
5780
5795
|
}), {
|
|
@@ -5784,14 +5799,14 @@ function Oa() {
|
|
|
5784
5799
|
}
|
|
5785
5800
|
};
|
|
5786
5801
|
}
|
|
5787
|
-
const { Transports:
|
|
5788
|
-
var
|
|
5789
|
-
var S =
|
|
5802
|
+
const { Transports: si } = j;
|
|
5803
|
+
var ri = function(i, t, s, a, l, g) {
|
|
5804
|
+
var S = si[s];
|
|
5790
5805
|
if (!S)
|
|
5791
5806
|
throw new G(s);
|
|
5792
|
-
var
|
|
5793
|
-
return
|
|
5794
|
-
},
|
|
5807
|
+
var L = (!i.enabledTransports || dt(i.enabledTransports, t) !== -1) && (!i.disabledTransports || dt(i.disabledTransports, t) === -1), z;
|
|
5808
|
+
return L ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), z = new ni(t, a, g ? g.getAssistant(S) : S, l)) : z = ii, z;
|
|
5809
|
+
}, ii = {
|
|
5795
5810
|
isSupported: function() {
|
|
5796
5811
|
return !1;
|
|
5797
5812
|
},
|
|
@@ -5808,14 +5823,14 @@ function Oa() {
|
|
|
5808
5823
|
};
|
|
5809
5824
|
}
|
|
5810
5825
|
};
|
|
5811
|
-
function
|
|
5826
|
+
function oi(i) {
|
|
5812
5827
|
if (i == null)
|
|
5813
5828
|
throw "You must pass an options object";
|
|
5814
5829
|
if (i.cluster == null)
|
|
5815
5830
|
throw "Options object must provide a cluster";
|
|
5816
5831
|
"disableStats" in i && ce.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5817
5832
|
}
|
|
5818
|
-
const
|
|
5833
|
+
const ai = (i, t) => {
|
|
5819
5834
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5820
5835
|
for (var a in t.params)
|
|
5821
5836
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5826,15 +5841,15 @@ function Oa() {
|
|
|
5826
5841
|
}
|
|
5827
5842
|
return s;
|
|
5828
5843
|
};
|
|
5829
|
-
var
|
|
5844
|
+
var ci = (i) => {
|
|
5830
5845
|
if (typeof j.getAuthorizers()[i.transport] > "u")
|
|
5831
5846
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5832
5847
|
return (t, s) => {
|
|
5833
|
-
const a =
|
|
5848
|
+
const a = ai(t, i);
|
|
5834
5849
|
j.getAuthorizers()[i.transport](j, a, i, w.UserAuthentication, s);
|
|
5835
5850
|
};
|
|
5836
5851
|
};
|
|
5837
|
-
const
|
|
5852
|
+
const ui = (i, t) => {
|
|
5838
5853
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5839
5854
|
s += "&channel_name=" + encodeURIComponent(i.channelName);
|
|
5840
5855
|
for (var a in t.params)
|
|
@@ -5846,15 +5861,15 @@ function Oa() {
|
|
|
5846
5861
|
}
|
|
5847
5862
|
return s;
|
|
5848
5863
|
};
|
|
5849
|
-
var
|
|
5864
|
+
var li = (i) => {
|
|
5850
5865
|
if (typeof j.getAuthorizers()[i.transport] > "u")
|
|
5851
5866
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5852
5867
|
return (t, s) => {
|
|
5853
|
-
const a =
|
|
5868
|
+
const a = ui(t, i);
|
|
5854
5869
|
j.getAuthorizers()[i.transport](j, a, i, w.ChannelAuthorization, s);
|
|
5855
5870
|
};
|
|
5856
5871
|
};
|
|
5857
|
-
const
|
|
5872
|
+
const di = (i, t, s) => {
|
|
5858
5873
|
const a = {
|
|
5859
5874
|
authTransport: t.transport,
|
|
5860
5875
|
authEndpoint: t.endpoint,
|
|
@@ -5868,7 +5883,7 @@ function Oa() {
|
|
|
5868
5883
|
s(S, a).authorize(l.socketId, g);
|
|
5869
5884
|
};
|
|
5870
5885
|
};
|
|
5871
|
-
function
|
|
5886
|
+
function hi(i, t) {
|
|
5872
5887
|
let s = {
|
|
5873
5888
|
activityTimeout: i.activityTimeout || h.activityTimeout,
|
|
5874
5889
|
cluster: i.cluster,
|
|
@@ -5881,46 +5896,46 @@ function Oa() {
|
|
|
5881
5896
|
wsPath: i.wsPath || h.wsPath,
|
|
5882
5897
|
wsPort: i.wsPort || h.wsPort,
|
|
5883
5898
|
wssPort: i.wssPort || h.wssPort,
|
|
5884
|
-
enableStats:
|
|
5885
|
-
httpHost:
|
|
5886
|
-
useTLS:
|
|
5887
|
-
wsHost:
|
|
5888
|
-
userAuthenticator:
|
|
5889
|
-
channelAuthorizer:
|
|
5899
|
+
enableStats: vi(i),
|
|
5900
|
+
httpHost: fi(i),
|
|
5901
|
+
useTLS: mi(i),
|
|
5902
|
+
wsHost: pi(i),
|
|
5903
|
+
userAuthenticator: bi(i),
|
|
5904
|
+
channelAuthorizer: _i(i, t)
|
|
5890
5905
|
};
|
|
5891
5906
|
return "disabledTransports" in i && (s.disabledTransports = i.disabledTransports), "enabledTransports" in i && (s.enabledTransports = i.enabledTransports), "ignoreNullOrigin" in i && (s.ignoreNullOrigin = i.ignoreNullOrigin), "timelineParams" in i && (s.timelineParams = i.timelineParams), "nacl" in i && (s.nacl = i.nacl), s;
|
|
5892
5907
|
}
|
|
5893
|
-
function
|
|
5908
|
+
function fi(i) {
|
|
5894
5909
|
return i.httpHost ? i.httpHost : i.cluster ? `sockjs-${i.cluster}.pusher.com` : h.httpHost;
|
|
5895
5910
|
}
|
|
5896
|
-
function
|
|
5897
|
-
return i.wsHost ? i.wsHost :
|
|
5911
|
+
function pi(i) {
|
|
5912
|
+
return i.wsHost ? i.wsHost : gi(i.cluster);
|
|
5898
5913
|
}
|
|
5899
|
-
function
|
|
5914
|
+
function gi(i) {
|
|
5900
5915
|
return `ws-${i}.pusher.com`;
|
|
5901
5916
|
}
|
|
5902
|
-
function
|
|
5917
|
+
function mi(i) {
|
|
5903
5918
|
return j.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
|
|
5904
5919
|
}
|
|
5905
|
-
function
|
|
5920
|
+
function vi(i) {
|
|
5906
5921
|
return "enableStats" in i ? i.enableStats : "disableStats" in i ? !i.disableStats : !1;
|
|
5907
5922
|
}
|
|
5908
|
-
function
|
|
5923
|
+
function bi(i) {
|
|
5909
5924
|
const t = Object.assign(Object.assign({}, h.userAuthentication), i.userAuthentication);
|
|
5910
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5925
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : ci(t);
|
|
5911
5926
|
}
|
|
5912
|
-
function
|
|
5927
|
+
function yi(i, t) {
|
|
5913
5928
|
let s;
|
|
5914
5929
|
return "channelAuthorization" in i ? s = Object.assign(Object.assign({}, h.channelAuthorization), i.channelAuthorization) : (s = {
|
|
5915
5930
|
transport: i.authTransport || h.authTransport,
|
|
5916
5931
|
endpoint: i.authEndpoint || h.authEndpoint
|
|
5917
|
-
}, "auth" in i && ("params" in i.auth && (s.params = i.auth.params), "headers" in i.auth && (s.headers = i.auth.headers)), "authorizer" in i && (s.customHandler =
|
|
5932
|
+
}, "auth" in i && ("params" in i.auth && (s.params = i.auth.params), "headers" in i.auth && (s.headers = i.auth.headers)), "authorizer" in i && (s.customHandler = di(t, s, i.authorizer))), s;
|
|
5918
5933
|
}
|
|
5919
|
-
function
|
|
5920
|
-
const s =
|
|
5921
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5934
|
+
function _i(i, t) {
|
|
5935
|
+
const s = yi(i, t);
|
|
5936
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : li(s);
|
|
5922
5937
|
}
|
|
5923
|
-
class
|
|
5938
|
+
class Si extends Te {
|
|
5924
5939
|
constructor(t) {
|
|
5925
5940
|
super(function(s, a) {
|
|
5926
5941
|
ce.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5938,14 +5953,14 @@ function Oa() {
|
|
|
5938
5953
|
});
|
|
5939
5954
|
}
|
|
5940
5955
|
}
|
|
5941
|
-
function
|
|
5956
|
+
function Ci() {
|
|
5942
5957
|
let i, t;
|
|
5943
5958
|
return { promise: new Promise((a, l) => {
|
|
5944
5959
|
i = a, t = l;
|
|
5945
5960
|
}), resolve: i, reject: t };
|
|
5946
5961
|
}
|
|
5947
|
-
var
|
|
5948
|
-
class
|
|
5962
|
+
var wi = Ci;
|
|
5963
|
+
class Ti extends Te {
|
|
5949
5964
|
constructor(t) {
|
|
5950
5965
|
super(function(s, a) {
|
|
5951
5966
|
ce.debug("No callbacks on user for " + s);
|
|
@@ -5960,7 +5975,7 @@ function Oa() {
|
|
|
5960
5975
|
});
|
|
5961
5976
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5962
5977
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5963
|
-
}), this.watchlist = new
|
|
5978
|
+
}), this.watchlist = new Si(t), this.pusher.connection.bind("message", (s) => {
|
|
5964
5979
|
var a = s.event;
|
|
5965
5980
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5966
5981
|
});
|
|
@@ -5990,7 +6005,7 @@ function Oa() {
|
|
|
5990
6005
|
const t = (s) => {
|
|
5991
6006
|
s.subscriptionPending && s.subscriptionCancelled ? s.reinstateSubscription() : !s.subscriptionPending && this.pusher.connection.state === "connected" && s.subscribe();
|
|
5992
6007
|
};
|
|
5993
|
-
this.serverToUserChannel = new
|
|
6008
|
+
this.serverToUserChannel = new gt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
|
|
5994
6009
|
s.indexOf("pusher_internal:") === 0 || s.indexOf("pusher:") === 0 || this.emit(s, a);
|
|
5995
6010
|
}), t(this.serverToUserChannel);
|
|
5996
6011
|
}
|
|
@@ -6000,7 +6015,7 @@ function Oa() {
|
|
|
6000
6015
|
_newSigninPromiseIfNeeded() {
|
|
6001
6016
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
6002
6017
|
return;
|
|
6003
|
-
const { promise: t, resolve: s } =
|
|
6018
|
+
const { promise: t, resolve: s } = wi();
|
|
6004
6019
|
t.done = !1;
|
|
6005
6020
|
const a = () => {
|
|
6006
6021
|
t.done = !0;
|
|
@@ -6020,7 +6035,7 @@ function Oa() {
|
|
|
6020
6035
|
}));
|
|
6021
6036
|
}
|
|
6022
6037
|
constructor(t, s) {
|
|
6023
|
-
|
|
6038
|
+
Ei(t), oi(s), this.key = t, this.config = hi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new ti(this.key, this.sessionID, {
|
|
6024
6039
|
cluster: this.config.cluster,
|
|
6025
6040
|
features: me.getClientFeatures(),
|
|
6026
6041
|
params: this.config.timelineParams || {},
|
|
@@ -6031,7 +6046,7 @@ function Oa() {
|
|
|
6031
6046
|
host: this.config.statsHost,
|
|
6032
6047
|
path: "/timeline/v2/" + j.TimelineTransport.name
|
|
6033
6048
|
}));
|
|
6034
|
-
var a = (l) => j.getDefaultStrategy(this.config, l,
|
|
6049
|
+
var a = (l) => j.getDefaultStrategy(this.config, l, ri);
|
|
6035
6050
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
6036
6051
|
getStrategy: a,
|
|
6037
6052
|
timeline: this.timeline,
|
|
@@ -6044,8 +6059,8 @@ function Oa() {
|
|
|
6044
6059
|
}), this.connection.bind("message", (l) => {
|
|
6045
6060
|
var g = l.event, S = g.indexOf("pusher_internal:") === 0;
|
|
6046
6061
|
if (l.channel) {
|
|
6047
|
-
var
|
|
6048
|
-
|
|
6062
|
+
var L = this.channel(l.channel);
|
|
6063
|
+
L && L.handleEvent(l);
|
|
6049
6064
|
}
|
|
6050
6065
|
S || this.global_emitter.emit(l.event, l.data);
|
|
6051
6066
|
}), this.connection.bind("connecting", () => {
|
|
@@ -6054,7 +6069,7 @@ function Oa() {
|
|
|
6054
6069
|
this.channels.disconnect();
|
|
6055
6070
|
}), this.connection.bind("error", (l) => {
|
|
6056
6071
|
ce.warn(l);
|
|
6057
|
-
}), me.instances.push(this), this.timeline.info({ instances: me.instances.length }), this.user = new
|
|
6072
|
+
}), me.instances.push(this), this.timeline.info({ instances: me.instances.length }), this.user = new Ti(this), me.isReady && this.connect();
|
|
6058
6073
|
}
|
|
6059
6074
|
channel(t) {
|
|
6060
6075
|
return this.channels.find(t);
|
|
@@ -6112,8 +6127,8 @@ function Oa() {
|
|
|
6112
6127
|
}
|
|
6113
6128
|
}
|
|
6114
6129
|
me.instances = [], me.isReady = !1, me.logToConsole = !1, me.Runtime = j, me.ScriptReceivers = j.ScriptReceivers, me.DependenciesReceivers = j.DependenciesReceivers, me.auth_callbacks = j.auth_callbacks;
|
|
6115
|
-
var
|
|
6116
|
-
function
|
|
6130
|
+
var Ct = o.default = me;
|
|
6131
|
+
function Ei(i) {
|
|
6117
6132
|
if (i == null)
|
|
6118
6133
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
6119
6134
|
}
|
|
@@ -6123,7 +6138,7 @@ function Oa() {
|
|
|
6123
6138
|
])
|
|
6124
6139
|
);
|
|
6125
6140
|
});
|
|
6126
|
-
})(
|
|
6141
|
+
})(Lt)), Lt.exports;
|
|
6127
6142
|
}
|
|
6128
6143
|
var Fa = Oa();
|
|
6129
6144
|
const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
|
|
@@ -6217,13 +6232,13 @@ function Wa(e) {
|
|
|
6217
6232
|
const r = n.data;
|
|
6218
6233
|
return r?.code === "ACCOUNT_SUSPENDED" || r?.errors?.reason === "account_suspended" ? !0 : typeof r?.message == "string" && r.message.toLowerCase().includes("suspended");
|
|
6219
6234
|
}
|
|
6220
|
-
function
|
|
6221
|
-
if (e.headers instanceof
|
|
6235
|
+
function Gn(e, n) {
|
|
6236
|
+
if (e.headers instanceof Tn) {
|
|
6222
6237
|
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"));
|
|
6223
6238
|
return;
|
|
6224
6239
|
}
|
|
6225
6240
|
const r = ie(e.headers) ? e.headers : {};
|
|
6226
|
-
e.headers = new
|
|
6241
|
+
e.headers = new Tn({
|
|
6227
6242
|
...r,
|
|
6228
6243
|
Authorization: `Bearer ${n}`,
|
|
6229
6244
|
Accept: "application/json",
|
|
@@ -6259,7 +6274,7 @@ function Ja(e, n) {
|
|
|
6259
6274
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
6260
6275
|
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6261
6276
|
}
|
|
6262
|
-
function
|
|
6277
|
+
function Jn(e) {
|
|
6263
6278
|
if (!ie(e))
|
|
6264
6279
|
return null;
|
|
6265
6280
|
const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
|
|
@@ -6286,25 +6301,25 @@ function Ka(e) {
|
|
|
6286
6301
|
function Qa(e) {
|
|
6287
6302
|
return !ie(e) || !pe(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
|
|
6288
6303
|
}
|
|
6289
|
-
function
|
|
6304
|
+
function Kn(e) {
|
|
6290
6305
|
return ie(e) && ie(e.message) && pe(e.message, "id") && pe(e.message, "conversation_id") && pe(e.message, "author_id");
|
|
6291
6306
|
}
|
|
6292
|
-
function
|
|
6307
|
+
function Qn(e) {
|
|
6293
6308
|
return ie(e) && pe(e, "conversation_id") && pe(e, "user_id") && pe(e, "message_id");
|
|
6294
6309
|
}
|
|
6295
|
-
function
|
|
6310
|
+
function Yn(e) {
|
|
6296
6311
|
return ie(e) && pe(e, "conversation_id") && ie(e.message) && pe(e.message, "id");
|
|
6297
6312
|
}
|
|
6298
|
-
function
|
|
6313
|
+
function Zn(e) {
|
|
6299
6314
|
return ie(e) && pe(e, "conversation_id") && pe(e, "message_id");
|
|
6300
6315
|
}
|
|
6301
|
-
function
|
|
6316
|
+
function es(e) {
|
|
6302
6317
|
return ie(e) && pe(e, "conversation_id") && pe(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
|
|
6303
6318
|
}
|
|
6304
|
-
function
|
|
6319
|
+
function ts(e) {
|
|
6305
6320
|
return ie(e) && pe(e, "conversation_id");
|
|
6306
6321
|
}
|
|
6307
|
-
function
|
|
6322
|
+
function ns(e) {
|
|
6308
6323
|
return ie(e) && pe(e, "conversation_id") && pe(e, "removed_user_id");
|
|
6309
6324
|
}
|
|
6310
6325
|
function Fe(e, n, r, o) {
|
|
@@ -6314,7 +6329,7 @@ function Fe(e, n, r, o) {
|
|
|
6314
6329
|
return e.listen(n, c), c;
|
|
6315
6330
|
}
|
|
6316
6331
|
function pc(e) {
|
|
6317
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ??
|
|
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");
|
|
6318
6333
|
typeof window < "u" && (window.Pusher = Da);
|
|
6319
6334
|
let d = null, f = null, h = null, R = null, C = "disconnected", v = "available", E = null, b = null;
|
|
6320
6335
|
const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
|
|
@@ -6353,7 +6368,7 @@ function pc(e) {
|
|
|
6353
6368
|
b = setTimeout(() => {
|
|
6354
6369
|
V();
|
|
6355
6370
|
}, D);
|
|
6356
|
-
},
|
|
6371
|
+
}, I = async (T = !1) => e.getSourceToken && G() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
|
|
6357
6372
|
try {
|
|
6358
6373
|
const D = await e.bootstrapClient.get(
|
|
6359
6374
|
r,
|
|
@@ -6370,7 +6385,7 @@ function pc(e) {
|
|
|
6370
6385
|
}), await f), V = async () => {
|
|
6371
6386
|
const T = h !== null;
|
|
6372
6387
|
try {
|
|
6373
|
-
if (await
|
|
6388
|
+
if (await I(!0), !T)
|
|
6374
6389
|
return;
|
|
6375
6390
|
q(!1), await X(!0);
|
|
6376
6391
|
} catch (P) {
|
|
@@ -6405,7 +6420,7 @@ function pc(e) {
|
|
|
6405
6420
|
(O === "unavailable" || O === "failed" || O === "disconnected") && m("disconnected");
|
|
6406
6421
|
}), P.state === "connected" && m("connected");
|
|
6407
6422
|
}, X = async (T = !1) => !T && h !== null && te(d) ? h : !T && R !== null ? await R : (R = (async () => {
|
|
6408
|
-
const D = await
|
|
6423
|
+
const D = await I(T);
|
|
6409
6424
|
if (D === null)
|
|
6410
6425
|
return null;
|
|
6411
6426
|
h !== null && q(!1);
|
|
@@ -6430,7 +6445,7 @@ function pc(e) {
|
|
|
6430
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;
|
|
6431
6446
|
})().finally(() => {
|
|
6432
6447
|
R = null;
|
|
6433
|
-
}), await R), _ =
|
|
6448
|
+
}), await R), _ = zt.create({
|
|
6434
6449
|
timeout: e.requestTimeoutMs ?? za,
|
|
6435
6450
|
withCredentials: !1,
|
|
6436
6451
|
headers: {
|
|
@@ -6439,29 +6454,29 @@ function pc(e) {
|
|
|
6439
6454
|
}
|
|
6440
6455
|
});
|
|
6441
6456
|
_.interceptors.request.use(async (T) => {
|
|
6442
|
-
const P = await
|
|
6457
|
+
const P = await I();
|
|
6443
6458
|
if (P === null)
|
|
6444
6459
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6445
|
-
return T.baseURL = P.service.apiBaseUrl,
|
|
6460
|
+
return T.baseURL = P.service.apiBaseUrl, Gn(T, P.auth.token), T;
|
|
6446
6461
|
}), _.interceptors.response.use(
|
|
6447
6462
|
(T) => T,
|
|
6448
6463
|
async (T) => {
|
|
6449
6464
|
const P = T.config;
|
|
6450
6465
|
if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6451
6466
|
P._messengerRetry = !0;
|
|
6452
|
-
const D = await
|
|
6467
|
+
const D = await I(!0);
|
|
6453
6468
|
if (D !== null)
|
|
6454
|
-
return P.baseURL = D.service.apiBaseUrl,
|
|
6469
|
+
return P.baseURL = D.service.apiBaseUrl, Gn(P, D.auth.token), await _(P);
|
|
6455
6470
|
}
|
|
6456
6471
|
return Promise.reject(T);
|
|
6457
6472
|
}
|
|
6458
6473
|
);
|
|
6459
|
-
const
|
|
6474
|
+
const x = () => v === "account_suspended" ? null : h, fe = (T) => (A.add(T), T(C), () => {
|
|
6460
6475
|
A.delete(T);
|
|
6461
6476
|
}), Se = (T) => (w.add(T), T(v), () => {
|
|
6462
6477
|
w.delete(T);
|
|
6463
6478
|
}), B = () => d?.auth.tenantId ?? "global", K = (T) => {
|
|
6464
|
-
const P =
|
|
6479
|
+
const P = Ot(T.ts)?.getTime() ?? Ot(T.last_seen_at)?.getTime() ?? null;
|
|
6465
6480
|
if (P === null)
|
|
6466
6481
|
return !0;
|
|
6467
6482
|
const D = `${T.tenant_scope ?? "global"}:${T.user_id}`, O = p.get(D);
|
|
@@ -6476,7 +6491,7 @@ function pc(e) {
|
|
|
6476
6491
|
se - le.seenAt > c && p.delete(ae);
|
|
6477
6492
|
return !0;
|
|
6478
6493
|
}, N = (T) => {
|
|
6479
|
-
const P =
|
|
6494
|
+
const P = x();
|
|
6480
6495
|
if (!P || typeof P.join != "function")
|
|
6481
6496
|
return;
|
|
6482
6497
|
const D = P.join(`online-users.${B()}`), O = [
|
|
@@ -6507,13 +6522,13 @@ function pc(e) {
|
|
|
6507
6522
|
};
|
|
6508
6523
|
T.bind(se, Re), D.push({ event: se, handler: Re });
|
|
6509
6524
|
}
|
|
6510
|
-
return O("ConversationMessageSent",
|
|
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), () => {
|
|
6511
6526
|
for (const se of D)
|
|
6512
6527
|
T.unbind(se.event, se.handler);
|
|
6513
6528
|
};
|
|
6514
6529
|
}
|
|
6515
6530
|
const U = (T, P) => {
|
|
6516
|
-
const D =
|
|
6531
|
+
const D = x();
|
|
6517
6532
|
if (!D)
|
|
6518
6533
|
return () => {
|
|
6519
6534
|
};
|
|
@@ -6523,25 +6538,25 @@ function pc(e) {
|
|
|
6523
6538
|
const ae = [];
|
|
6524
6539
|
return P.onMessageSent && ae.push({
|
|
6525
6540
|
event: ".ConversationMessageSent",
|
|
6526
|
-
handler: Fe(O, ".ConversationMessageSent",
|
|
6541
|
+
handler: Fe(O, ".ConversationMessageSent", Kn, P.onMessageSent)
|
|
6527
6542
|
}), P.onMessageRead && ae.push({
|
|
6528
6543
|
event: ".ConversationMessageRead",
|
|
6529
|
-
handler: Fe(O, ".ConversationMessageRead",
|
|
6544
|
+
handler: Fe(O, ".ConversationMessageRead", Qn, P.onMessageRead)
|
|
6530
6545
|
}), P.onMessageEdited && ae.push({
|
|
6531
6546
|
event: ".ConversationMessageEdited",
|
|
6532
|
-
handler: Fe(O, ".ConversationMessageEdited",
|
|
6547
|
+
handler: Fe(O, ".ConversationMessageEdited", Yn, P.onMessageEdited)
|
|
6533
6548
|
}), P.onMessageDeleted && ae.push({
|
|
6534
6549
|
event: ".ConversationMessageDeleted",
|
|
6535
|
-
handler: Fe(O, ".ConversationMessageDeleted",
|
|
6550
|
+
handler: Fe(O, ".ConversationMessageDeleted", Zn, P.onMessageDeleted)
|
|
6536
6551
|
}), P.onReactionToggled && ae.push({
|
|
6537
6552
|
event: ".MessageReactionToggled",
|
|
6538
|
-
handler: Fe(O, ".MessageReactionToggled",
|
|
6553
|
+
handler: Fe(O, ".MessageReactionToggled", es, P.onReactionToggled)
|
|
6539
6554
|
}), P.onRequestAccepted && ae.push({
|
|
6540
6555
|
event: ".ConversationRequestAccepted",
|
|
6541
|
-
handler: Fe(O, ".ConversationRequestAccepted",
|
|
6556
|
+
handler: Fe(O, ".ConversationRequestAccepted", ts, P.onRequestAccepted)
|
|
6542
6557
|
}), P.onParticipantRemoved && ae.push({
|
|
6543
6558
|
event: ".ConversationParticipantRemoved",
|
|
6544
|
-
handler: Fe(O, ".ConversationParticipantRemoved",
|
|
6559
|
+
handler: Fe(O, ".ConversationParticipantRemoved", ns, P.onParticipantRemoved)
|
|
6545
6560
|
}), () => {
|
|
6546
6561
|
if (typeof O.stopListening == "function")
|
|
6547
6562
|
for (const le of ae)
|
|
@@ -6553,7 +6568,7 @@ function pc(e) {
|
|
|
6553
6568
|
const O = T.private(`typing-conversation.${P}`), se = /* @__PURE__ */ new Set(["start", "typing"]), ae = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), le = O.subscription;
|
|
6554
6569
|
if (le) {
|
|
6555
6570
|
const we = (ge) => {
|
|
6556
|
-
const be =
|
|
6571
|
+
const be = Jn(ge);
|
|
6557
6572
|
if (be) {
|
|
6558
6573
|
if (se.has(be.state)) {
|
|
6559
6574
|
D.onTypingStart?.({
|
|
@@ -6579,7 +6594,7 @@ function pc(e) {
|
|
|
6579
6594
|
};
|
|
6580
6595
|
}
|
|
6581
6596
|
const Re = [], Le = (we) => {
|
|
6582
|
-
const ge =
|
|
6597
|
+
const ge = Jn(we);
|
|
6583
6598
|
if (ge) {
|
|
6584
6599
|
if (se.has(ge.state)) {
|
|
6585
6600
|
D.onTypingStart?.({
|
|
@@ -6609,7 +6624,7 @@ function pc(e) {
|
|
|
6609
6624
|
return {
|
|
6610
6625
|
apiClient: _,
|
|
6611
6626
|
initializedEvent: n,
|
|
6612
|
-
getEcho:
|
|
6627
|
+
getEcho: x,
|
|
6613
6628
|
waitForEcho: async () => v === "account_suspended" ? null : await X(),
|
|
6614
6629
|
getConnectionStatus: () => C,
|
|
6615
6630
|
getAccessState: () => v,
|
|
@@ -6623,95 +6638,95 @@ function pc(e) {
|
|
|
6623
6638
|
subscribeToConversation: U,
|
|
6624
6639
|
unsubscribeFromConversation: ne,
|
|
6625
6640
|
subscribeToTyping: (T, P) => {
|
|
6626
|
-
const D =
|
|
6641
|
+
const D = x();
|
|
6627
6642
|
if (D)
|
|
6628
6643
|
return ue(D, T, P);
|
|
6629
6644
|
let O = !1, se = null;
|
|
6630
6645
|
const ae = () => {
|
|
6631
6646
|
if (O)
|
|
6632
6647
|
return;
|
|
6633
|
-
const le =
|
|
6634
|
-
le && (se = ue(le, T, P), typeof window < "u" && window.removeEventListener(
|
|
6648
|
+
const le = x();
|
|
6649
|
+
le && (se = ue(le, T, P), typeof window < "u" && window.removeEventListener(n, ae));
|
|
6635
6650
|
};
|
|
6636
|
-
return typeof window < "u" && window.addEventListener(
|
|
6637
|
-
O = !0, typeof window < "u" && window.removeEventListener(
|
|
6651
|
+
return typeof window < "u" && window.addEventListener(n, ae), () => {
|
|
6652
|
+
O = !0, typeof window < "u" && window.removeEventListener(n, ae), se?.();
|
|
6638
6653
|
};
|
|
6639
6654
|
},
|
|
6640
6655
|
unsubscribeFromTyping: (T) => {
|
|
6641
|
-
|
|
6656
|
+
h?.leave(`typing-conversation.${T}`);
|
|
6642
6657
|
},
|
|
6643
6658
|
clearRuntime: J
|
|
6644
6659
|
};
|
|
6645
6660
|
}
|
|
6646
6661
|
export {
|
|
6647
|
-
|
|
6662
|
+
fo as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6648
6663
|
hc as configureMessengerClient,
|
|
6649
6664
|
pc as createMessengerEcho,
|
|
6650
6665
|
W as getApi,
|
|
6651
6666
|
ke as getAuthStore,
|
|
6652
|
-
|
|
6667
|
+
En as getConnectionStatus,
|
|
6653
6668
|
Ae as getEcho,
|
|
6654
|
-
|
|
6669
|
+
gs as getEchoConnectionStatus,
|
|
6655
6670
|
Je as getEchoInitializedEvent,
|
|
6656
6671
|
Z as getErrorMessage,
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6672
|
+
Qt as getLoggerFactory,
|
|
6673
|
+
Ht as getMainApi,
|
|
6674
|
+
jo as getMainEcho,
|
|
6660
6675
|
$o as getMainEchoConnectionStatus,
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6676
|
+
zo as getMainEchoInitializedEvent,
|
|
6677
|
+
ao as getMediaApi,
|
|
6678
|
+
It as getMessagingAccessState,
|
|
6664
6679
|
ia as getPresenceRuntimeConfig,
|
|
6665
6680
|
ca as hasConfiguredPresenceAuthTokenResolver,
|
|
6666
6681
|
ic as hasResponse,
|
|
6667
6682
|
vc as isAxiosError,
|
|
6668
6683
|
rc as isError,
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6684
|
+
Yi as isValidMessageDeletedEvent,
|
|
6685
|
+
Qi as isValidMessageEditedEvent,
|
|
6686
|
+
Ki as isValidMessageReadEvent,
|
|
6687
|
+
Ji as isValidMessageSentEvent,
|
|
6688
|
+
Zi as isValidReactionToggledEvent,
|
|
6689
|
+
eo as isValidRequestAcceptedEvent,
|
|
6675
6690
|
Pe as messagingApi,
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6691
|
+
go as normalizePresenceStatus,
|
|
6692
|
+
Ss as normalizePresenceTimestamp,
|
|
6693
|
+
lt as onConnectionStatusChange,
|
|
6679
6694
|
Ho as onMainEchoConnectionStatusChange,
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6695
|
+
qi as onMessagingAccessStateChange,
|
|
6696
|
+
Ot as parsePresenceTimestamp,
|
|
6697
|
+
zi as reconnectEcho,
|
|
6683
6698
|
Bo as reconnectMainEcho,
|
|
6684
|
-
|
|
6699
|
+
Gi as resetEchoRuntimeConfig,
|
|
6685
6700
|
Jo as resetLoggerFactory,
|
|
6686
|
-
|
|
6701
|
+
ro as resetMainApiClient,
|
|
6687
6702
|
Xo as resetMainEchoRuntimeConfig,
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6703
|
+
no as resetMessagingApiClient,
|
|
6704
|
+
oo as resetMessagingAuthStoreResolver,
|
|
6705
|
+
uo as resetMessagingMediaApi,
|
|
6691
6706
|
fc as resetMessengerClientConfig,
|
|
6692
6707
|
aa as resetPresenceRuntimeConfig,
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6708
|
+
mo as resolveFreshPresenceStatus,
|
|
6709
|
+
Ft as resolvePresenceSnapshot,
|
|
6710
|
+
Wi as setEchoRuntimeConfig,
|
|
6696
6711
|
Go as setLoggerFactory,
|
|
6697
|
-
|
|
6712
|
+
so as setMainApiClient,
|
|
6698
6713
|
Vo as setMainEchoRuntimeConfig,
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6714
|
+
to as setMessagingApiClient,
|
|
6715
|
+
io as setMessagingAuthStoreResolver,
|
|
6716
|
+
co as setMessagingMediaApi,
|
|
6702
6717
|
oa as setPresenceRuntimeConfig,
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6718
|
+
Hi as subscribeToConversation,
|
|
6719
|
+
ji as subscribeToPresenceStatus,
|
|
6720
|
+
Vi as subscribeToTyping,
|
|
6721
|
+
Bi as unsubscribeFromConversation,
|
|
6722
|
+
$i as unsubscribeFromPresenceStatus,
|
|
6723
|
+
Xi as unsubscribeFromTyping,
|
|
6709
6724
|
ac as useConnectionStatus,
|
|
6710
6725
|
oc as useConversationChannel,
|
|
6711
6726
|
cc as useGlobalMessaging,
|
|
6712
6727
|
uc as useMessagingAccessState,
|
|
6713
|
-
|
|
6728
|
+
Jt as useMessagingStore,
|
|
6714
6729
|
lc as usePresence,
|
|
6715
6730
|
dc as useTypingChannel,
|
|
6716
|
-
|
|
6731
|
+
ps as waitForEcho
|
|
6717
6732
|
};
|