@codingfactory/messenger-client 0.2.31 → 0.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +876 -876
- 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,
|
|
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, Re = () => $.getEcho(), ps = async () => $.waitForEcho(), gs = () => $.getConnectionStatus(), En = () => gs(), It = () => $.getAccessState(), lt = (e) => $.onConnectionStatusChange(e), qi = (e) => $.onAccessStateChange(e), zi = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
|
-
},
|
|
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 Rn(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: Rn(e, "color"),
|
|
166
|
+
icon: Rn(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 An(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 An($e(r.data));
|
|
208
208
|
},
|
|
209
209
|
async acceptRequest(e) {
|
|
210
210
|
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
211
|
-
return
|
|
211
|
+
return An($e(n.data));
|
|
212
212
|
},
|
|
213
213
|
async declineRequest(e) {
|
|
214
214
|
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
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 ?? Ro(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 Ro(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 Ao(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,18 +367,18 @@ 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: Ao(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() : "";
|
|
379
379
|
if (n.length === 0 || r.length === 0 || o.length === 0)
|
|
380
380
|
return;
|
|
381
|
-
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "",
|
|
381
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", A = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
|
|
382
382
|
return {
|
|
383
383
|
id: n,
|
|
384
384
|
title: r,
|
|
@@ -389,26 +389,26 @@ function xo(e) {
|
|
|
389
389
|
author: {
|
|
390
390
|
id: f,
|
|
391
391
|
name: h,
|
|
392
|
-
...
|
|
392
|
+
...A ? { avatar: A } : {},
|
|
393
393
|
...C ? { handle: C } : {}
|
|
394
394
|
}
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Rt(e) {
|
|
399
399
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
400
400
|
}
|
|
401
|
-
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") ? Rt(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? Rt(e.me.muted_until) : Rt(n?.muted_until);
|
|
447
447
|
}
|
|
448
|
-
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, A = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
|
|
453
453
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
454
454
|
return !1;
|
|
455
455
|
const E = n.last_message?.id, b = e.last_message?.id;
|
|
@@ -458,40 +458,40 @@ 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,
|
|
465
465
|
is_archived: h,
|
|
466
|
-
folder_id:
|
|
466
|
+
folder_id: A,
|
|
467
467
|
created_at: C,
|
|
468
468
|
...c ? { last_message: c } : {},
|
|
469
469
|
...u ? { last_message_at: u } : {}
|
|
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 At(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) => At(n) > 0).length,
|
|
717
|
+
unreadCount: (e) => e.conversations.reduce((n, r) => n + At(r), 0),
|
|
718
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + At(r), 0),
|
|
719
719
|
sortedFolders: (e) => Be(e.folders),
|
|
720
720
|
folderById: (e) => (n) => e.folders.find((r) => r.id === n),
|
|
721
721
|
conversationsInFolder: (e) => (n) => e.conversations.filter((r) => r.folder_id === n),
|
|
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,19 +818,19 @@ 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(
|
|
826
826
|
d.data,
|
|
827
827
|
"conversations"
|
|
828
|
-
),
|
|
828
|
+
), A = f.map((E) => {
|
|
829
829
|
const b = this.conversations.find(
|
|
830
|
-
(
|
|
830
|
+
(R) => R.id === E.id
|
|
831
831
|
);
|
|
832
832
|
return He(E, b);
|
|
833
|
-
}), C = await
|
|
833
|
+
}), C = await zn(A);
|
|
834
834
|
e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
835
835
|
const v = {
|
|
836
836
|
data: C,
|
|
@@ -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
|
}
|
|
@@ -847,13 +847,13 @@ const Qt = Di("messaging", {
|
|
|
847
847
|
if (Date.now() < this.backgroundPollRetryAfterUntil)
|
|
848
848
|
return !1;
|
|
849
849
|
try {
|
|
850
|
-
return await this.fetchConversations(void 0, this.activeListFilter, void 0, {
|
|
850
|
+
return this.activeListFilter === "requests" ? await this.fetchRequests() : await this.fetchConversations(void 0, this.activeListFilter, void 0, {
|
|
851
851
|
background: !0,
|
|
852
852
|
includePresence: !1
|
|
853
853
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
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"
|
|
@@ -889,9 +889,9 @@ const Qt = Di("messaging", {
|
|
|
889
889
|
r.data,
|
|
890
890
|
"conversations"
|
|
891
891
|
), u = o.map((h) => {
|
|
892
|
-
const
|
|
893
|
-
return He(h,
|
|
894
|
-
}), d = await
|
|
892
|
+
const A = this.requests.find((C) => C.id === h.id);
|
|
893
|
+
return He(h, A);
|
|
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,13 +942,13 @@ 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()}`,
|
|
945
|
+
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, A = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = Mo(d), v = f.currentUser, E = {
|
|
946
946
|
id: h,
|
|
947
947
|
conversation_id: e,
|
|
948
948
|
author_id: v?.id || "",
|
|
949
949
|
body: n || "",
|
|
950
950
|
attachments: [],
|
|
951
|
-
meta:
|
|
951
|
+
meta: A ? { shared_post_id: A } : {},
|
|
952
952
|
...C ? { shared_post: C } : {},
|
|
953
953
|
is_deleted: !1,
|
|
954
954
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -962,16 +962,16 @@ const Qt = Di("messaging", {
|
|
|
962
962
|
}), o != null && (E.reply_to_id = o), c != null && (E.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(E), this._pendingSendIds.add(h);
|
|
963
963
|
try {
|
|
964
964
|
let b;
|
|
965
|
-
const
|
|
965
|
+
const R = {
|
|
966
966
|
body: n || "",
|
|
967
967
|
...o ? { reply_to_id: o } : {},
|
|
968
|
-
...
|
|
968
|
+
...A ? { shared_post_id: A } : {},
|
|
969
969
|
...C ? { shared_post_preview: C } : {}
|
|
970
970
|
};
|
|
971
971
|
if (r && r.length > 0) {
|
|
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,
|
|
@@ -980,12 +980,12 @@ const Qt = Di("messaging", {
|
|
|
980
980
|
})
|
|
981
981
|
);
|
|
982
982
|
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
983
|
-
...
|
|
983
|
+
...R,
|
|
984
984
|
attachments: G
|
|
985
985
|
});
|
|
986
986
|
} else
|
|
987
987
|
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
988
|
-
...
|
|
988
|
+
...R,
|
|
989
989
|
type: "text"
|
|
990
990
|
});
|
|
991
991
|
const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], F = y.findIndex((G) => G.id === h);
|
|
@@ -998,7 +998,7 @@ const Qt = Di("messaging", {
|
|
|
998
998
|
}
|
|
999
999
|
return this.updateConversationLastMessage(e, m), m;
|
|
1000
1000
|
} catch (b) {
|
|
1001
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((
|
|
1001
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((R) => R.id !== h), this.error = Z(b), b;
|
|
1002
1002
|
}
|
|
1003
1003
|
},
|
|
1004
1004
|
async editMessage(e, n, r) {
|
|
@@ -1045,11 +1045,11 @@ const Qt = Di("messaging", {
|
|
|
1045
1045
|
return null;
|
|
1046
1046
|
for (let u = c.length - 1; u >= 0; u -= 1) {
|
|
1047
1047
|
const d = c[u]?.id;
|
|
1048
|
-
if (
|
|
1048
|
+
if (Dt(d))
|
|
1049
1049
|
return d;
|
|
1050
1050
|
}
|
|
1051
1051
|
return null;
|
|
1052
|
-
})(), o = n ?
|
|
1052
|
+
})(), o = n ? Un(n, this.messages) : r;
|
|
1053
1053
|
if (!o)
|
|
1054
1054
|
return;
|
|
1055
1055
|
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
@@ -1068,7 +1068,7 @@ const Qt = Di("messaging", {
|
|
|
1068
1068
|
if (e.length === 0)
|
|
1069
1069
|
return;
|
|
1070
1070
|
const n = e.map((c) => {
|
|
1071
|
-
const u =
|
|
1071
|
+
const u = Un(c, this.messages);
|
|
1072
1072
|
return u ? {
|
|
1073
1073
|
conversationId: c.id,
|
|
1074
1074
|
messageId: u
|
|
@@ -1100,9 +1100,9 @@ const Qt = Di("messaging", {
|
|
|
1100
1100
|
async sendTyping(e, n = "start") {
|
|
1101
1101
|
try {
|
|
1102
1102
|
const r = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1103
|
-
if (n !== "start" || !
|
|
1103
|
+
if (n !== "start" || !wo(r.data))
|
|
1104
1104
|
return;
|
|
1105
|
-
await
|
|
1105
|
+
await kn(_o), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1106
1106
|
} catch (r) {
|
|
1107
1107
|
console.warn("Failed to send typing indicator:", r);
|
|
1108
1108
|
}
|
|
@@ -1170,10 +1170,10 @@ const Qt = Di("messaging", {
|
|
|
1170
1170
|
};
|
|
1171
1171
|
n && (r.message = n);
|
|
1172
1172
|
const o = await W().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
|
|
1173
|
-
if (!
|
|
1173
|
+
if (!Fn(c))
|
|
1174
1174
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1175
|
-
let u =
|
|
1176
|
-
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);
|
|
1177
1177
|
} catch (r) {
|
|
1178
1178
|
throw this.error = Z(r), r;
|
|
1179
1179
|
}
|
|
@@ -1184,9 +1184,9 @@ const Qt = Di("messaging", {
|
|
|
1184
1184
|
title: e,
|
|
1185
1185
|
participant_ids: n
|
|
1186
1186
|
}), o = r.data.data || r.data;
|
|
1187
|
-
if (!
|
|
1187
|
+
if (!Fn(o))
|
|
1188
1188
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1189
|
-
const c =
|
|
1189
|
+
const c = Dn(o) ? o : await this.fetchConversation(o.id);
|
|
1190
1190
|
return this.conversations = rt(this.conversations, c), c;
|
|
1191
1191
|
} catch (r) {
|
|
1192
1192
|
throw this.error = Z(r), r;
|
|
@@ -1236,28 +1236,28 @@ const Qt = Di("messaging", {
|
|
|
1236
1236
|
return;
|
|
1237
1237
|
this.messages[n] || (this.messages[n] = []);
|
|
1238
1238
|
const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1239
|
-
if (o.find((
|
|
1239
|
+
if (o.find((A) => A.id === r.id))
|
|
1240
1240
|
return;
|
|
1241
1241
|
const u = ke()();
|
|
1242
1242
|
if (r.author_id === u.currentUser?.id) {
|
|
1243
|
-
const
|
|
1244
|
-
if (
|
|
1245
|
-
const C = o[
|
|
1243
|
+
const A = o.findIndex((C) => C.id.startsWith("temp-"));
|
|
1244
|
+
if (A >= 0) {
|
|
1245
|
+
const C = o[A]?.id ?? "";
|
|
1246
1246
|
this.messages[n] = [
|
|
1247
|
-
...o.slice(0,
|
|
1247
|
+
...o.slice(0, A),
|
|
1248
1248
|
r,
|
|
1249
|
-
...o.slice(
|
|
1249
|
+
...o.slice(A + 1)
|
|
1250
1250
|
], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
|
|
1251
1251
|
return;
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
1254
|
const d = r.created_at;
|
|
1255
1255
|
let f = o.length;
|
|
1256
|
-
for (let
|
|
1257
|
-
const C = o[
|
|
1256
|
+
for (let A = o.length - 1; A >= 0; A--) {
|
|
1257
|
+
const C = o[A];
|
|
1258
1258
|
if (C && C.created_at <= d)
|
|
1259
1259
|
break;
|
|
1260
|
-
f =
|
|
1260
|
+
f = A;
|
|
1261
1261
|
}
|
|
1262
1262
|
const h = f === o.length;
|
|
1263
1263
|
this.messages[n] = [
|
|
@@ -1272,8 +1272,8 @@ const Qt = Di("messaging", {
|
|
|
1272
1272
|
},
|
|
1273
1273
|
removeMessage(e, n) {
|
|
1274
1274
|
const r = (h) => {
|
|
1275
|
-
const
|
|
1276
|
-
return delete
|
|
1275
|
+
const A = { ...h, is_deleted: !0 };
|
|
1276
|
+
return delete A.body, A;
|
|
1277
1277
|
};
|
|
1278
1278
|
let o = null;
|
|
1279
1279
|
const c = this.conversations.find((h) => h.id === e);
|
|
@@ -1307,16 +1307,16 @@ const Qt = Di("messaging", {
|
|
|
1307
1307
|
try {
|
|
1308
1308
|
f = await W().post(o, c);
|
|
1309
1309
|
} catch (v) {
|
|
1310
|
-
if (!
|
|
1310
|
+
if (!Uo(v))
|
|
1311
1311
|
throw v;
|
|
1312
1312
|
f = await W().post(o, c);
|
|
1313
1313
|
}
|
|
1314
|
-
const h = he(f.data) && "data" in f.data ? f.data.data : f.data,
|
|
1314
|
+
const h = he(f.data) && "data" in f.data ? f.data.data : f.data, A = On(
|
|
1315
1315
|
he(h) ? h.reactions : void 0
|
|
1316
1316
|
);
|
|
1317
|
-
(
|
|
1317
|
+
(A.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, A);
|
|
1318
1318
|
try {
|
|
1319
|
-
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(
|
|
1320
1320
|
he(E) ? E.reactions : void 0
|
|
1321
1321
|
);
|
|
1322
1322
|
this.updateMessageReactions(e, n, b);
|
|
@@ -1350,8 +1350,8 @@ const Qt = Di("messaging", {
|
|
|
1350
1350
|
h,
|
|
1351
1351
|
...u.slice(d + 1)
|
|
1352
1352
|
];
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1353
|
+
const A = this.conversations.find((v) => v.id === e);
|
|
1354
|
+
A?.last_message?.id === n && (A.last_message = h);
|
|
1355
1355
|
const C = this.requests.find((v) => v.id === e);
|
|
1356
1356
|
C?.last_message?.id === n && (C.last_message = h);
|
|
1357
1357
|
},
|
|
@@ -1386,7 +1386,7 @@ const Qt = Di("messaging", {
|
|
|
1386
1386
|
params: { ids: n }
|
|
1387
1387
|
}), o = r.data?.data?.items ?? r.data?.items ?? [];
|
|
1388
1388
|
for (const c of o) {
|
|
1389
|
-
const u =
|
|
1389
|
+
const u = Ft(c);
|
|
1390
1390
|
u.status !== null && this.updatePresenceForUser(c.id, u.status, u.lastSeenAt);
|
|
1391
1391
|
}
|
|
1392
1392
|
},
|
|
@@ -1479,21 +1479,21 @@ const Qt = Di("messaging", {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
});
|
|
1481
1481
|
function oc(e) {
|
|
1482
|
-
const n =
|
|
1482
|
+
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = Nt(), f = d !== null, h = 20, A = 250;
|
|
1483
1483
|
let C = 0, v = null, E = null;
|
|
1484
|
-
const b = re(() => r.currentUser?.id),
|
|
1484
|
+
const b = re(() => r.currentUser?.id), R = () => ss(e)?.trim() ?? "";
|
|
1485
1485
|
function w() {
|
|
1486
1486
|
v && (clearTimeout(v), v = null), C = 0;
|
|
1487
1487
|
}
|
|
1488
1488
|
function p() {
|
|
1489
1489
|
!f || o.value || v || C >= h || (v = setTimeout(() => {
|
|
1490
|
-
v = null, C += 1,
|
|
1491
|
-
},
|
|
1490
|
+
v = null, C += 1, I();
|
|
1491
|
+
}, A));
|
|
1492
1492
|
}
|
|
1493
1493
|
function m(_) {
|
|
1494
1494
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1495
|
+
const x = n.getConversationById(_.conversation_id);
|
|
1496
|
+
x && (x.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
|
|
1497
1497
|
});
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
@@ -1520,8 +1520,8 @@ function oc(e) {
|
|
|
1520
1520
|
);
|
|
1521
1521
|
}
|
|
1522
1522
|
function G(_) {
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1523
|
+
const x = n.getConversationById(_.conversation_id);
|
|
1524
|
+
x && (x.is_request = !1), n.requests = n.requests.filter(
|
|
1525
1525
|
(fe) => fe.id !== _.conversation_id
|
|
1526
1526
|
);
|
|
1527
1527
|
}
|
|
@@ -1530,19 +1530,19 @@ function oc(e) {
|
|
|
1530
1530
|
}));
|
|
1531
1531
|
}
|
|
1532
1532
|
function k(_) {
|
|
1533
|
-
const
|
|
1534
|
-
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;
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1537
|
-
const _ =
|
|
1536
|
+
function I() {
|
|
1537
|
+
const _ = R();
|
|
1538
1538
|
if (!(o.value || !_)) {
|
|
1539
|
-
if (!
|
|
1539
|
+
if (!Re()) {
|
|
1540
1540
|
p();
|
|
1541
1541
|
return;
|
|
1542
1542
|
}
|
|
1543
1543
|
c.value = null;
|
|
1544
1544
|
try {
|
|
1545
|
-
E =
|
|
1545
|
+
E = Hi(_, {
|
|
1546
1546
|
onMessageSent: m,
|
|
1547
1547
|
onMessageRead: y,
|
|
1548
1548
|
onMessageEdited: F,
|
|
@@ -1551,18 +1551,18 @@ function oc(e) {
|
|
|
1551
1551
|
onRequestAccepted: G,
|
|
1552
1552
|
onParticipantRemoved: te
|
|
1553
1553
|
}), o.value = !0, u.value = _, n.registerDetailSubscription(_), w();
|
|
1554
|
-
} catch (
|
|
1555
|
-
c.value =
|
|
1554
|
+
} catch (x) {
|
|
1555
|
+
c.value = x instanceof Error ? x.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", x);
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
1559
|
function V() {
|
|
1560
|
-
o.value ||
|
|
1560
|
+
o.value || I();
|
|
1561
1561
|
}
|
|
1562
1562
|
typeof window < "u" && window.addEventListener(Je(), V);
|
|
1563
|
-
const H =
|
|
1563
|
+
const H = lt((_) => {
|
|
1564
1564
|
if (_ === "connected") {
|
|
1565
|
-
o.value ||
|
|
1565
|
+
o.value || I();
|
|
1566
1566
|
return;
|
|
1567
1567
|
}
|
|
1568
1568
|
(_ === "disconnected" || _ === "error") && (w(), k(!1));
|
|
@@ -1576,14 +1576,14 @@ function oc(e) {
|
|
|
1576
1576
|
}
|
|
1577
1577
|
}
|
|
1578
1578
|
return ot(
|
|
1579
|
-
() =>
|
|
1580
|
-
(_,
|
|
1581
|
-
if (_ !==
|
|
1579
|
+
() => R(),
|
|
1580
|
+
(_, x) => {
|
|
1581
|
+
if (_ !== x) {
|
|
1582
1582
|
if (w(), o.value && k(!0), !_) {
|
|
1583
1583
|
c.value = null;
|
|
1584
1584
|
return;
|
|
1585
1585
|
}
|
|
1586
|
-
|
|
1586
|
+
I();
|
|
1587
1587
|
}
|
|
1588
1588
|
}
|
|
1589
1589
|
), d !== null && qe(() => {
|
|
@@ -1591,23 +1591,23 @@ function oc(e) {
|
|
|
1591
1591
|
}), {
|
|
1592
1592
|
isSubscribed: re(() => o.value),
|
|
1593
1593
|
error: re(() => c.value),
|
|
1594
|
-
subscribe:
|
|
1594
|
+
subscribe: I,
|
|
1595
1595
|
unsubscribe: X
|
|
1596
1596
|
};
|
|
1597
1597
|
}
|
|
1598
|
-
const
|
|
1599
|
-
},
|
|
1598
|
+
const Rs = () => () => {
|
|
1599
|
+
}, As = async () => {
|
|
1600
1600
|
}, _e = {
|
|
1601
1601
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1602
1602
|
getEcho: () => null,
|
|
1603
1603
|
getConnectionStatus: () => "disconnected",
|
|
1604
|
-
onConnectionStatusChange:
|
|
1605
|
-
reconnect:
|
|
1604
|
+
onConnectionStatusChange: Rs,
|
|
1605
|
+
reconnect: As
|
|
1606
1606
|
};
|
|
1607
|
-
function
|
|
1607
|
+
function zo() {
|
|
1608
1608
|
return _e.initializedEvent;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function jo() {
|
|
1611
1611
|
return _e.getEcho();
|
|
1612
1612
|
}
|
|
1613
1613
|
function $o() {
|
|
@@ -1623,7 +1623,7 @@ function Vo(e) {
|
|
|
1623
1623
|
e.initializedEvent && (_e.initializedEvent = e.initializedEvent), e.getEcho && (_e.getEcho = e.getEcho), e.getConnectionStatus && (_e.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (_e.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (_e.reconnect = e.reconnect);
|
|
1624
1624
|
}
|
|
1625
1625
|
function Xo() {
|
|
1626
|
-
_e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange =
|
|
1626
|
+
_e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange = Rs, _e.reconnect = As;
|
|
1627
1627
|
}
|
|
1628
1628
|
const Wo = {
|
|
1629
1629
|
debug: () => {
|
|
@@ -1634,16 +1634,16 @@ const Wo = {
|
|
|
1634
1634
|
},
|
|
1635
1635
|
error: () => {
|
|
1636
1636
|
}
|
|
1637
|
-
},
|
|
1638
|
-
let
|
|
1639
|
-
function
|
|
1640
|
-
return
|
|
1637
|
+
}, Ps = () => Wo;
|
|
1638
|
+
let Kt = Ps;
|
|
1639
|
+
function Qt() {
|
|
1640
|
+
return Kt;
|
|
1641
1641
|
}
|
|
1642
1642
|
function Go(e) {
|
|
1643
|
-
|
|
1643
|
+
Kt = e;
|
|
1644
1644
|
}
|
|
1645
1645
|
function Jo() {
|
|
1646
|
-
|
|
1646
|
+
Kt = Ps;
|
|
1647
1647
|
}
|
|
1648
1648
|
const Ko = {
|
|
1649
1649
|
connected: "",
|
|
@@ -1651,34 +1651,34 @@ const Ko = {
|
|
|
1651
1651
|
disconnected: "",
|
|
1652
1652
|
error: "",
|
|
1653
1653
|
unknown: ""
|
|
1654
|
-
},
|
|
1655
|
-
function
|
|
1654
|
+
}, Hn = Qt()("ConnectionStatus");
|
|
1655
|
+
function Bn(e) {
|
|
1656
1656
|
return e?.connector?.pusher?.connection ?? null;
|
|
1657
1657
|
}
|
|
1658
1658
|
function Qo(e) {
|
|
1659
1659
|
return e === "messenger" ? {
|
|
1660
1660
|
initializedEvent: Je(),
|
|
1661
|
-
getConnectionStatus:
|
|
1662
|
-
onConnectionStatusChange:
|
|
1663
|
-
reconnect:
|
|
1664
|
-
getEchoConnection: () =>
|
|
1661
|
+
getConnectionStatus: gs,
|
|
1662
|
+
onConnectionStatusChange: lt,
|
|
1663
|
+
reconnect: zi,
|
|
1664
|
+
getEchoConnection: () => Bn(Re())
|
|
1665
1665
|
} : {
|
|
1666
|
-
initializedEvent:
|
|
1666
|
+
initializedEvent: zo(),
|
|
1667
1667
|
getConnectionStatus: $o,
|
|
1668
1668
|
onConnectionStatusChange: Ho,
|
|
1669
1669
|
reconnect: Bo,
|
|
1670
|
-
getEchoConnection: () =>
|
|
1670
|
+
getEchoConnection: () => Bn(jo())
|
|
1671
1671
|
};
|
|
1672
1672
|
}
|
|
1673
|
-
function
|
|
1673
|
+
function Vn(e) {
|
|
1674
1674
|
return e.getEchoConnection()?.state ?? null;
|
|
1675
1675
|
}
|
|
1676
1676
|
function ac(e = {}) {
|
|
1677
1677
|
const o = Qo(e.source ?? "app"), c = {
|
|
1678
1678
|
...Ko,
|
|
1679
1679
|
...e.icons
|
|
1680
|
-
}, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1),
|
|
1681
|
-
let E = null, b = null,
|
|
1680
|
+
}, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), A = ye(!1), C = ye(!1), v = ye(!1);
|
|
1681
|
+
let E = null, b = null, R = null, w = null, p = null, m = null, y = null;
|
|
1682
1682
|
const F = re(() => u.value === "connected"), q = re(() => u.value === "connecting"), J = re(() => u.value === "disconnected"), G = re(() => u.value === "error"), te = re(() => J.value || G.value), k = re(() => {
|
|
1683
1683
|
switch (u.value) {
|
|
1684
1684
|
case "connecting":
|
|
@@ -1692,7 +1692,7 @@ function ac(e = {}) {
|
|
|
1692
1692
|
default:
|
|
1693
1693
|
return "Unknown connection state";
|
|
1694
1694
|
}
|
|
1695
|
-
}),
|
|
1695
|
+
}), I = re(() => {
|
|
1696
1696
|
switch (u.value) {
|
|
1697
1697
|
case "connected":
|
|
1698
1698
|
return "success";
|
|
@@ -1718,25 +1718,25 @@ function ac(e = {}) {
|
|
|
1718
1718
|
return c.unknown;
|
|
1719
1719
|
}
|
|
1720
1720
|
}), H = async () => {
|
|
1721
|
-
|
|
1721
|
+
Hn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1722
1722
|
}, X = (B, K = u.value) => {
|
|
1723
1723
|
if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
|
|
1724
|
-
const N = !v.value && K === B, Y = !
|
|
1724
|
+
const N = !v.value && K === B, Y = !A.value && (N || K === "connected" || K === "connecting");
|
|
1725
1725
|
if (C.value = !0, Y) {
|
|
1726
|
-
h.value = !1,
|
|
1727
|
-
|
|
1726
|
+
h.value = !1, R && clearTimeout(R), R = setTimeout(() => {
|
|
1727
|
+
R = null, u.value !== "connected" && (h.value = !0);
|
|
1728
1728
|
}, 5e3);
|
|
1729
1729
|
return;
|
|
1730
1730
|
}
|
|
1731
|
-
|
|
1731
|
+
R && (clearTimeout(R), R = null), h.value = !0;
|
|
1732
1732
|
return;
|
|
1733
1733
|
}
|
|
1734
1734
|
if (B === "connected") {
|
|
1735
|
-
|
|
1735
|
+
R && (clearTimeout(R), R = null), h.value = !1, A.value = !1, C.value = !1;
|
|
1736
1736
|
return;
|
|
1737
1737
|
}
|
|
1738
1738
|
if (B === "connecting") {
|
|
1739
|
-
if (
|
|
1739
|
+
if (R && (clearTimeout(R), R = null), A.value) {
|
|
1740
1740
|
h.value = !0;
|
|
1741
1741
|
return;
|
|
1742
1742
|
}
|
|
@@ -1744,23 +1744,23 @@ function ac(e = {}) {
|
|
|
1744
1744
|
return;
|
|
1745
1745
|
b = setTimeout(() => {
|
|
1746
1746
|
if (b = null, u.value === "connecting") {
|
|
1747
|
-
if (
|
|
1747
|
+
if (Vn(o) === "connected") {
|
|
1748
1748
|
_("connected");
|
|
1749
1749
|
return;
|
|
1750
1750
|
}
|
|
1751
|
-
|
|
1751
|
+
A.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1752
1752
|
}
|
|
1753
1753
|
}, 1e4);
|
|
1754
1754
|
}
|
|
1755
1755
|
}, _ = (B) => {
|
|
1756
1756
|
const K = u.value;
|
|
1757
|
-
if (B === "connecting" &&
|
|
1757
|
+
if (B === "connecting" && A.value) {
|
|
1758
1758
|
u.value = "disconnected", X("disconnected", K);
|
|
1759
1759
|
return;
|
|
1760
1760
|
}
|
|
1761
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);
|
|
1762
|
-
},
|
|
1763
|
-
const B =
|
|
1762
|
+
}, x = () => {
|
|
1763
|
+
const B = Vn(o), K = u.value;
|
|
1764
1764
|
if (B === "connected" && K !== "connected") {
|
|
1765
1765
|
_("connected");
|
|
1766
1766
|
return;
|
|
@@ -1813,14 +1813,14 @@ function ac(e = {}) {
|
|
|
1813
1813
|
const B = Date.now() - d.value.getTime(), K = Math.floor(B / 6e4), N = Math.floor(B % 6e4 / 1e3);
|
|
1814
1814
|
return K > 0 ? `${K}m ${N}s` : `${N}s`;
|
|
1815
1815
|
});
|
|
1816
|
-
return
|
|
1816
|
+
return qt(() => {
|
|
1817
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 = () => {
|
|
1818
|
-
fe(),
|
|
1819
|
-
}, window.addEventListener(o.initializedEvent, m),
|
|
1820
|
-
|
|
1818
|
+
fe(), x();
|
|
1819
|
+
}, window.addEventListener(o.initializedEvent, m), x(), w = setInterval(() => {
|
|
1820
|
+
x();
|
|
1821
1821
|
}, 3e3);
|
|
1822
1822
|
}), qe(() => {
|
|
1823
|
-
E?.(), b && (clearTimeout(b), b = null),
|
|
1823
|
+
E?.(), b && (clearTimeout(b), b = null), R && (clearTimeout(R), R = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
|
|
1824
1824
|
}), {
|
|
1825
1825
|
connectionStatus: re(() => u.value),
|
|
1826
1826
|
isConnected: F,
|
|
@@ -1829,7 +1829,7 @@ function ac(e = {}) {
|
|
|
1829
1829
|
isError: G,
|
|
1830
1830
|
hasConnectionIssues: te,
|
|
1831
1831
|
statusMessage: k,
|
|
1832
|
-
statusColor:
|
|
1832
|
+
statusColor: I,
|
|
1833
1833
|
statusIcon: V,
|
|
1834
1834
|
showConnectionBanner: re(() => h.value),
|
|
1835
1835
|
lastConnectionTime: re(() => d.value),
|
|
@@ -1838,39 +1838,39 @@ function ac(e = {}) {
|
|
|
1838
1838
|
reconnect: H
|
|
1839
1839
|
};
|
|
1840
1840
|
}
|
|
1841
|
-
const
|
|
1841
|
+
const Ms = () => {
|
|
1842
1842
|
};
|
|
1843
|
-
let
|
|
1843
|
+
let Yt = Ms;
|
|
1844
1844
|
function Yo() {
|
|
1845
|
-
return
|
|
1845
|
+
return Yt;
|
|
1846
1846
|
}
|
|
1847
1847
|
function Zo(e) {
|
|
1848
|
-
|
|
1848
|
+
Yt = e;
|
|
1849
1849
|
}
|
|
1850
1850
|
function ea() {
|
|
1851
|
-
|
|
1851
|
+
Yt = Ms;
|
|
1852
1852
|
}
|
|
1853
|
-
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;
|
|
1854
1854
|
function cc() {
|
|
1855
|
-
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(), A = /* @__PURE__ */ new Map();
|
|
1856
1856
|
let C = !1;
|
|
1857
1857
|
function v(k) {
|
|
1858
|
-
const
|
|
1859
|
-
if (
|
|
1860
|
-
if (
|
|
1861
|
-
const V =
|
|
1858
|
+
const I = A.get(k);
|
|
1859
|
+
if (I) {
|
|
1860
|
+
if (A.delete(k), I.directBound) {
|
|
1861
|
+
const V = I.channel.subscription;
|
|
1862
1862
|
if (V)
|
|
1863
|
-
for (const H of
|
|
1863
|
+
for (const H of I.bindings)
|
|
1864
1864
|
try {
|
|
1865
1865
|
V.unbind(H.event, H.handler);
|
|
1866
1866
|
} catch {
|
|
1867
1867
|
}
|
|
1868
1868
|
return;
|
|
1869
1869
|
}
|
|
1870
|
-
if (typeof
|
|
1871
|
-
for (const V of
|
|
1870
|
+
if (typeof I.channel.stopListening == "function")
|
|
1871
|
+
for (const V of I.bindings)
|
|
1872
1872
|
try {
|
|
1873
|
-
|
|
1873
|
+
I.channel.stopListening(V.event, V.handler);
|
|
1874
1874
|
} catch {
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
@@ -1881,12 +1881,12 @@ function cc() {
|
|
|
1881
1881
|
h.clear();
|
|
1882
1882
|
}
|
|
1883
1883
|
function b(k) {
|
|
1884
|
-
const
|
|
1885
|
-
if (!
|
|
1884
|
+
const I = Re();
|
|
1885
|
+
if (!I || h.has(k)) return;
|
|
1886
1886
|
const V = `conversation.${k}`;
|
|
1887
1887
|
v(k);
|
|
1888
|
-
const H =
|
|
1889
|
-
if (!
|
|
1888
|
+
const H = I.private(V), X = (N) => {
|
|
1889
|
+
if (!Ji(N)) {
|
|
1890
1890
|
Me.warn("Dropping malformed ConversationMessageSent event", N);
|
|
1891
1891
|
return;
|
|
1892
1892
|
}
|
|
@@ -1906,20 +1906,20 @@ function cc() {
|
|
|
1906
1906
|
oe || ue.unread_count++, r(oe);
|
|
1907
1907
|
}
|
|
1908
1908
|
}, _ = (N) => {
|
|
1909
|
-
if (!
|
|
1909
|
+
if (!Ki(N)) {
|
|
1910
1910
|
Me.warn("Dropping malformed ConversationMessageRead event", N);
|
|
1911
1911
|
return;
|
|
1912
1912
|
}
|
|
1913
1913
|
e.applyParticipantReadState(N);
|
|
1914
|
-
},
|
|
1915
|
-
if (!
|
|
1914
|
+
}, x = (N) => {
|
|
1915
|
+
if (!Zi(N)) {
|
|
1916
1916
|
Me.warn("Dropping malformed MessageReactionToggled event", N);
|
|
1917
1917
|
return;
|
|
1918
1918
|
}
|
|
1919
1919
|
const Y = N;
|
|
1920
1920
|
e.updateMessageReactions(Y.conversation_id, Y.message_id, Y.reactions);
|
|
1921
1921
|
}, fe = (N) => {
|
|
1922
|
-
if (!
|
|
1922
|
+
if (!Qi(N)) {
|
|
1923
1923
|
Me.warn("Dropping malformed ConversationMessageEdited event", N);
|
|
1924
1924
|
return;
|
|
1925
1925
|
}
|
|
@@ -1932,14 +1932,14 @@ function cc() {
|
|
|
1932
1932
|
Y.message.meta
|
|
1933
1933
|
);
|
|
1934
1934
|
}, Se = (N) => {
|
|
1935
|
-
if (!
|
|
1935
|
+
if (!Yi(N)) {
|
|
1936
1936
|
Me.warn("Dropping malformed ConversationMessageDeleted event", N);
|
|
1937
1937
|
return;
|
|
1938
1938
|
}
|
|
1939
1939
|
const Y = N;
|
|
1940
1940
|
e.removeMessage(Y.conversation_id, Y.message_id);
|
|
1941
1941
|
}, B = (N) => {
|
|
1942
|
-
if (!
|
|
1942
|
+
if (!eo(N)) {
|
|
1943
1943
|
Me.warn("Dropping malformed ConversationRequestAccepted event", N);
|
|
1944
1944
|
return;
|
|
1945
1945
|
}
|
|
@@ -1948,7 +1948,7 @@ function cc() {
|
|
|
1948
1948
|
(U) => U.id !== Y.conversation_id
|
|
1949
1949
|
);
|
|
1950
1950
|
}, K = H.subscription;
|
|
1951
|
-
K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled",
|
|
1951
|
+
K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", x), K.bind("ConversationRequestAccepted", B), A.set(k, {
|
|
1952
1952
|
channel: H,
|
|
1953
1953
|
directBound: !0,
|
|
1954
1954
|
bindings: [
|
|
@@ -1956,10 +1956,10 @@ function cc() {
|
|
|
1956
1956
|
{ event: "ConversationMessageRead", handler: _ },
|
|
1957
1957
|
{ event: "ConversationMessageEdited", handler: fe },
|
|
1958
1958
|
{ event: "ConversationMessageDeleted", handler: Se },
|
|
1959
|
-
{ event: "MessageReactionToggled", handler:
|
|
1959
|
+
{ event: "MessageReactionToggled", handler: x },
|
|
1960
1960
|
{ event: "ConversationRequestAccepted", handler: B }
|
|
1961
1961
|
]
|
|
1962
|
-
})) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled",
|
|
1962
|
+
})) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", x), H.listen(".ConversationRequestAccepted", B), A.set(k, {
|
|
1963
1963
|
channel: H,
|
|
1964
1964
|
directBound: !1,
|
|
1965
1965
|
bindings: [
|
|
@@ -1967,37 +1967,37 @@ function cc() {
|
|
|
1967
1967
|
{ event: ".ConversationMessageRead", handler: _ },
|
|
1968
1968
|
{ event: ".ConversationMessageEdited", handler: fe },
|
|
1969
1969
|
{ event: ".ConversationMessageDeleted", handler: Se },
|
|
1970
|
-
{ event: ".MessageReactionToggled", handler:
|
|
1970
|
+
{ event: ".MessageReactionToggled", handler: x },
|
|
1971
1971
|
{ event: ".ConversationRequestAccepted", handler: B }
|
|
1972
1972
|
]
|
|
1973
1973
|
})), h.add(k), e.registerGlobalConversationSubscription(k);
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1976
|
-
const k =
|
|
1975
|
+
function R() {
|
|
1976
|
+
const k = Re();
|
|
1977
1977
|
if (!k) {
|
|
1978
1978
|
E();
|
|
1979
1979
|
return;
|
|
1980
1980
|
}
|
|
1981
|
-
for (const
|
|
1982
|
-
v(
|
|
1981
|
+
for (const I of h) {
|
|
1982
|
+
v(I);
|
|
1983
1983
|
try {
|
|
1984
|
-
k.leave(`conversation.${
|
|
1984
|
+
k.leave(`conversation.${I}`);
|
|
1985
1985
|
} catch {
|
|
1986
1986
|
}
|
|
1987
|
-
e.unregisterGlobalConversationSubscription(
|
|
1987
|
+
e.unregisterGlobalConversationSubscription(I);
|
|
1988
1988
|
}
|
|
1989
1989
|
h.clear();
|
|
1990
1990
|
}
|
|
1991
1991
|
function w() {
|
|
1992
|
-
const k =
|
|
1992
|
+
const k = Re();
|
|
1993
1993
|
if (!k) return;
|
|
1994
|
-
const
|
|
1994
|
+
const I = (() => {
|
|
1995
1995
|
const H = [...e.conversations, ...e.requestConversations], X = /* @__PURE__ */ new Set(), _ = [];
|
|
1996
|
-
for (const
|
|
1997
|
-
if (!X.has(
|
|
1996
|
+
for (const x of H)
|
|
1997
|
+
if (!X.has(x.id) && (X.add(x.id), _.push(x), _.length >= ta))
|
|
1998
1998
|
break;
|
|
1999
1999
|
return _;
|
|
2000
|
-
})(), V = new Set(
|
|
2000
|
+
})(), V = new Set(I.map((H) => H.id));
|
|
2001
2001
|
for (const H of h)
|
|
2002
2002
|
if (!V.has(H) && !e.hasDetailSubscription(H)) {
|
|
2003
2003
|
try {
|
|
@@ -2006,42 +2006,42 @@ function cc() {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
h.delete(H), e.unregisterGlobalConversationSubscription(H);
|
|
2008
2008
|
}
|
|
2009
|
-
for (const H of
|
|
2009
|
+
for (const H of I)
|
|
2010
2010
|
b(H.id);
|
|
2011
2011
|
}
|
|
2012
2012
|
function p(k) {
|
|
2013
|
-
const
|
|
2013
|
+
const I = Ft({
|
|
2014
2014
|
status: k.status,
|
|
2015
2015
|
last_seen_at: k.last_seen_at ?? null
|
|
2016
2016
|
});
|
|
2017
|
-
|
|
2017
|
+
I.status !== null && e.updatePresenceForUser(
|
|
2018
2018
|
k.user_id,
|
|
2019
|
-
|
|
2020
|
-
|
|
2019
|
+
I.status,
|
|
2020
|
+
I.lastSeenAt
|
|
2021
2021
|
);
|
|
2022
2022
|
}
|
|
2023
2023
|
async function m() {
|
|
2024
2024
|
const k = [...new Set(
|
|
2025
|
-
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)
|
|
2026
2026
|
)];
|
|
2027
2027
|
if (k.length !== 0)
|
|
2028
2028
|
try {
|
|
2029
|
-
const
|
|
2029
|
+
const I = await o.get("/v1/presence/users", {
|
|
2030
2030
|
params: { ids: k }
|
|
2031
|
-
}), V =
|
|
2031
|
+
}), V = I.data?.data?.items ?? I.data?.items ?? [];
|
|
2032
2032
|
for (const H of V) {
|
|
2033
|
-
const X =
|
|
2033
|
+
const X = Ft(H);
|
|
2034
2034
|
X.status !== null && e.updatePresenceForUser(H.id, X.status, X.lastSeenAt);
|
|
2035
2035
|
}
|
|
2036
|
-
} catch (
|
|
2037
|
-
Me.warn("Failed to refresh messaging presence snapshot",
|
|
2036
|
+
} catch (I) {
|
|
2037
|
+
Me.warn("Failed to refresh messaging presence snapshot", I);
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
2040
|
function y() {
|
|
2041
|
-
!
|
|
2041
|
+
!Re() || C || (ji(p), C = !0);
|
|
2042
2042
|
}
|
|
2043
2043
|
function F() {
|
|
2044
|
-
C && (
|
|
2044
|
+
C && ($i(), C = !1);
|
|
2045
2045
|
}
|
|
2046
2046
|
const q = ot(
|
|
2047
2047
|
d,
|
|
@@ -2060,22 +2060,22 @@ function cc() {
|
|
|
2060
2060
|
() => {
|
|
2061
2061
|
w();
|
|
2062
2062
|
}
|
|
2063
|
-
), te =
|
|
2063
|
+
), te = lt((k) => {
|
|
2064
2064
|
k === "connected" ? (E(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (E(), F());
|
|
2065
2065
|
});
|
|
2066
|
-
w(), y(), m(),
|
|
2066
|
+
w(), y(), m(), Re() || ps().then((k) => {
|
|
2067
2067
|
k && (E(), w(), F(), y(), m());
|
|
2068
2068
|
}).catch((k) => {
|
|
2069
2069
|
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
2070
2070
|
}), u !== null && qe(() => {
|
|
2071
|
-
q(), J(), G(), te(),
|
|
2071
|
+
q(), J(), G(), te(), R(), F();
|
|
2072
2072
|
});
|
|
2073
2073
|
}
|
|
2074
2074
|
function uc() {
|
|
2075
|
-
const e = ye(
|
|
2075
|
+
const e = ye(It());
|
|
2076
2076
|
let n = null;
|
|
2077
|
-
return
|
|
2078
|
-
e.value =
|
|
2077
|
+
return qt(() => {
|
|
2078
|
+
e.value = It(), n = qi((r) => {
|
|
2079
2079
|
e.value = r;
|
|
2080
2080
|
});
|
|
2081
2081
|
}), qe(() => {
|
|
@@ -2086,7 +2086,7 @@ function uc() {
|
|
|
2086
2086
|
isSuspended: re(() => e.value === "account_suspended")
|
|
2087
2087
|
};
|
|
2088
2088
|
}
|
|
2089
|
-
const
|
|
2089
|
+
const ks = () => null, xs = {
|
|
2090
2090
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
2091
2091
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
2092
2092
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -2097,29 +2097,29 @@ const Ls = () => null, Is = {
|
|
|
2097
2097
|
activityDebounceMs: 5e3,
|
|
2098
2098
|
heartbeatIntervalMs: 3e4,
|
|
2099
2099
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
2100
|
-
authTokenResolver:
|
|
2100
|
+
authTokenResolver: ks
|
|
2101
2101
|
};
|
|
2102
|
-
let
|
|
2102
|
+
let ct = { ...xs };
|
|
2103
2103
|
function ia() {
|
|
2104
|
-
return
|
|
2104
|
+
return ct;
|
|
2105
2105
|
}
|
|
2106
2106
|
function oa(e) {
|
|
2107
|
-
|
|
2108
|
-
...
|
|
2107
|
+
ct = {
|
|
2108
|
+
...ct,
|
|
2109
2109
|
...e
|
|
2110
2110
|
};
|
|
2111
2111
|
}
|
|
2112
2112
|
function aa() {
|
|
2113
|
-
|
|
2113
|
+
ct = { ...xs };
|
|
2114
2114
|
}
|
|
2115
2115
|
function ca(e) {
|
|
2116
|
-
return e.authTokenResolver !==
|
|
2116
|
+
return e.authTokenResolver !== ks;
|
|
2117
2117
|
}
|
|
2118
2118
|
const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
|
|
2119
2119
|
function We(e) {
|
|
2120
2120
|
return typeof e == "object" && e !== null;
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function Ls(e) {
|
|
2123
2123
|
if (!We(e))
|
|
2124
2124
|
return null;
|
|
2125
2125
|
const n = e.response;
|
|
@@ -2134,7 +2134,7 @@ function Us(e) {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
return null;
|
|
2136
2136
|
}
|
|
2137
|
-
function
|
|
2137
|
+
function Is(e) {
|
|
2138
2138
|
if (!We(e))
|
|
2139
2139
|
return null;
|
|
2140
2140
|
const n = e.response;
|
|
@@ -2143,12 +2143,12 @@ function Os(e) {
|
|
|
2143
2143
|
const r = n.data;
|
|
2144
2144
|
return We(r) && typeof r.code == "string" ? r.code : null;
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2147
|
-
const n =
|
|
2146
|
+
function Mt(e) {
|
|
2147
|
+
const n = Ls(e), r = Is(e);
|
|
2148
2148
|
return n === ua && r === ha || n === da && r === pa;
|
|
2149
2149
|
}
|
|
2150
|
-
function
|
|
2151
|
-
const n =
|
|
2150
|
+
function kt(e) {
|
|
2151
|
+
const n = Ls(e), r = Is(e);
|
|
2152
2152
|
return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2153
2153
|
}
|
|
2154
2154
|
function Ke() {
|
|
@@ -2168,7 +2168,7 @@ function ba(e) {
|
|
|
2168
2168
|
const o = Number.parseInt(r, 10);
|
|
2169
2169
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
2170
2170
|
}
|
|
2171
|
-
function
|
|
2171
|
+
function xt(e, n = Date.now()) {
|
|
2172
2172
|
const r = Ke(), o = ba(e);
|
|
2173
2173
|
return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
|
|
2174
2174
|
}
|
|
@@ -2224,38 +2224,38 @@ function Ta(e, n, r) {
|
|
|
2224
2224
|
}
|
|
2225
2225
|
}
|
|
2226
2226
|
function lc() {
|
|
2227
|
-
const e = ke()(), n = ia(), r =
|
|
2228
|
-
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, A = !1, C = null, v = 0;
|
|
2229
2229
|
const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2230
2230
|
c && (clearInterval(c), c = null);
|
|
2231
|
-
},
|
|
2231
|
+
}, R = () => {
|
|
2232
2232
|
u && (clearTimeout(u), u = null);
|
|
2233
2233
|
}, w = () => {
|
|
2234
2234
|
b(), c = setInterval(() => {
|
|
2235
|
-
|
|
2235
|
+
I();
|
|
2236
2236
|
}, n.heartbeatIntervalMs);
|
|
2237
|
-
}, p = (
|
|
2238
|
-
f || console.warn(
|
|
2239
|
-
}, m = async (
|
|
2240
|
-
if (!(!d ||
|
|
2237
|
+
}, p = (x) => {
|
|
2238
|
+
f || console.warn(x), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), R();
|
|
2239
|
+
}, m = async (x) => {
|
|
2240
|
+
if (!(!d || A || f || h) && E() && C !== x)
|
|
2241
2241
|
try {
|
|
2242
|
-
await r.patch(n.statusUrl, { status:
|
|
2242
|
+
await r.patch(n.statusUrl, { status: x }), C = x;
|
|
2243
2243
|
} catch (fe) {
|
|
2244
|
-
if (
|
|
2244
|
+
if (Mt(fe)) {
|
|
2245
2245
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2246
2246
|
return;
|
|
2247
2247
|
}
|
|
2248
|
-
|
|
2248
|
+
kt(fe) && (h = !0, d = !1, C = null, b(), R());
|
|
2249
2249
|
}
|
|
2250
2250
|
}, y = () => {
|
|
2251
|
-
|
|
2251
|
+
R(), !(!d || A || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
2252
2252
|
u = null, m("idle");
|
|
2253
2253
|
}, n.idleAfterMs));
|
|
2254
2254
|
}, F = () => {
|
|
2255
|
-
if (
|
|
2255
|
+
if (A || !d || f || h || document.visibilityState !== "visible")
|
|
2256
2256
|
return;
|
|
2257
|
-
const
|
|
2258
|
-
|
|
2257
|
+
const x = Date.now();
|
|
2258
|
+
x - v < n.activityDebounceMs || (v = x, m("online"), y());
|
|
2259
2259
|
}, q = () => {
|
|
2260
2260
|
F();
|
|
2261
2261
|
}, J = () => {
|
|
@@ -2263,88 +2263,88 @@ function lc() {
|
|
|
2263
2263
|
}, G = () => {
|
|
2264
2264
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2265
2265
|
}, te = async () => {
|
|
2266
|
-
if (
|
|
2266
|
+
if (xt(n.accountLimitedUntilStorageKey))
|
|
2267
2267
|
return f = !0, "account_limited";
|
|
2268
2268
|
try {
|
|
2269
2269
|
return await r.post(n.sessionOpenUrl, {
|
|
2270
2270
|
client_id: o,
|
|
2271
2271
|
user_agent: n.userAgentResolver()
|
|
2272
2272
|
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
|
|
2273
|
-
} catch (
|
|
2274
|
-
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(), R(), "account_suspended") : "failed";
|
|
2275
2275
|
}
|
|
2276
2276
|
}, k = async () => {
|
|
2277
|
-
for (let
|
|
2277
|
+
for (let x = 0; x < ga; x += 1)
|
|
2278
2278
|
if (await te() !== "failed")
|
|
2279
2279
|
return;
|
|
2280
2280
|
console.warn("[Presence] Failed to open session");
|
|
2281
|
-
},
|
|
2281
|
+
}, I = async () => {
|
|
2282
2282
|
if (d && E())
|
|
2283
2283
|
try {
|
|
2284
2284
|
await r.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2285
|
-
} catch (
|
|
2286
|
-
if (
|
|
2285
|
+
} catch (x) {
|
|
2286
|
+
if (Mt(x)) {
|
|
2287
2287
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2288
2288
|
return;
|
|
2289
2289
|
}
|
|
2290
|
-
|
|
2290
|
+
kt(x) && (h = !0, d = !1, C = null, b(), R());
|
|
2291
2291
|
}
|
|
2292
2292
|
}, V = () => {
|
|
2293
2293
|
if (!d)
|
|
2294
2294
|
return;
|
|
2295
|
-
d = !1, C = null,
|
|
2296
|
-
const
|
|
2295
|
+
d = !1, C = null, R();
|
|
2296
|
+
const x = Ta(
|
|
2297
2297
|
n.sessionCloseUrl,
|
|
2298
2298
|
o,
|
|
2299
2299
|
n.authTokenResolver()
|
|
2300
2300
|
);
|
|
2301
|
-
if (
|
|
2302
|
-
|
|
2301
|
+
if (x) {
|
|
2302
|
+
x.catch(() => {
|
|
2303
2303
|
});
|
|
2304
2304
|
return;
|
|
2305
2305
|
}
|
|
2306
2306
|
r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2307
2307
|
});
|
|
2308
2308
|
}, H = async () => {
|
|
2309
|
-
if (!
|
|
2310
|
-
if (await k(),
|
|
2309
|
+
if (!A) {
|
|
2310
|
+
if (await k(), A) {
|
|
2311
2311
|
V();
|
|
2312
2312
|
return;
|
|
2313
2313
|
}
|
|
2314
2314
|
d && (w(), m("online"), y());
|
|
2315
2315
|
}
|
|
2316
2316
|
}, X = () => {
|
|
2317
|
-
if (!
|
|
2317
|
+
if (!A) {
|
|
2318
2318
|
if (document.visibilityState === "hidden") {
|
|
2319
|
-
V(), b(),
|
|
2319
|
+
V(), b(), R();
|
|
2320
2320
|
return;
|
|
2321
2321
|
}
|
|
2322
2322
|
if (document.visibilityState === "visible" && !d) {
|
|
2323
|
-
f =
|
|
2323
|
+
f = xt(n.accountLimitedUntilStorageKey), !f && !h && H();
|
|
2324
2324
|
return;
|
|
2325
2325
|
}
|
|
2326
2326
|
document.visibilityState === "visible" && d && !f && !h && F();
|
|
2327
2327
|
}
|
|
2328
2328
|
}, _ = () => {
|
|
2329
|
-
|
|
2329
|
+
A || (V(), b(), R());
|
|
2330
2330
|
};
|
|
2331
|
-
|
|
2331
|
+
qt(async () => {
|
|
2332
2332
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2333
|
-
if (await k(),
|
|
2333
|
+
if (await k(), A) {
|
|
2334
2334
|
V();
|
|
2335
2335
|
return;
|
|
2336
2336
|
}
|
|
2337
2337
|
d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", X), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2338
2338
|
}
|
|
2339
2339
|
}), qe(() => {
|
|
2340
|
-
|
|
2340
|
+
A = !0, G(), R(), b(), V(), document.removeEventListener("visibilitychange", X), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2341
2341
|
});
|
|
2342
2342
|
}
|
|
2343
2343
|
const Ea = 12e3;
|
|
2344
2344
|
function dc(e) {
|
|
2345
|
-
const n =
|
|
2346
|
-
let E = !1, b = null,
|
|
2347
|
-
const p = re(() => r.currentUser?.id), m = () =>
|
|
2345
|
+
const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = Nt(), A = h !== null, C = 20, v = 250;
|
|
2346
|
+
let E = !1, b = null, R = 0, w = null;
|
|
2347
|
+
const p = re(() => r.currentUser?.id), m = () => ss(e)?.trim() ?? "", y = () => {
|
|
2348
2348
|
const M = u.value?.trim() ?? "";
|
|
2349
2349
|
if (M.length > 0)
|
|
2350
2350
|
return M;
|
|
@@ -2363,12 +2363,12 @@ function dc(e) {
|
|
|
2363
2363
|
clearTimeout(M);
|
|
2364
2364
|
f.clear();
|
|
2365
2365
|
}, te = () => {
|
|
2366
|
-
w && (clearTimeout(w), w = null),
|
|
2366
|
+
w && (clearTimeout(w), w = null), R = 0;
|
|
2367
2367
|
}, k = () => {
|
|
2368
|
-
!
|
|
2369
|
-
w = null,
|
|
2368
|
+
!A || o.value || w || R >= C || (w = setTimeout(() => {
|
|
2369
|
+
w = null, R += 1, X();
|
|
2370
2370
|
}, v));
|
|
2371
|
-
},
|
|
2371
|
+
}, I = (M, U) => {
|
|
2372
2372
|
J(M);
|
|
2373
2373
|
const ne = setTimeout(() => {
|
|
2374
2374
|
f.delete(M), n.removeTypingUser(U, M), d.value = d.value.filter((ue) => ue.id !== M);
|
|
@@ -2378,8 +2378,8 @@ function dc(e) {
|
|
|
2378
2378
|
E = !0, te();
|
|
2379
2379
|
}, H = (M) => {
|
|
2380
2380
|
try {
|
|
2381
|
-
b && (b(), b = null), b =
|
|
2382
|
-
onTypingStart:
|
|
2381
|
+
b && (b(), b = null), b = Vi(M, {
|
|
2382
|
+
onTypingStart: x,
|
|
2383
2383
|
onTypingStop: fe
|
|
2384
2384
|
}), te(), o.value = !0, u.value = M;
|
|
2385
2385
|
} catch (U) {
|
|
@@ -2388,15 +2388,15 @@ function dc(e) {
|
|
|
2388
2388
|
}, X = () => {
|
|
2389
2389
|
const M = m();
|
|
2390
2390
|
if (!(o.value || !M)) {
|
|
2391
|
-
if (c.value = null,
|
|
2391
|
+
if (c.value = null, Re() && En() === "connected") {
|
|
2392
2392
|
H(M);
|
|
2393
2393
|
return;
|
|
2394
2394
|
}
|
|
2395
|
-
E = !1,
|
|
2395
|
+
E = !1, ps().then((U) => {
|
|
2396
2396
|
if (E || o.value || !U)
|
|
2397
2397
|
return;
|
|
2398
2398
|
const ne = m();
|
|
2399
|
-
if (ne && ne === M &&
|
|
2399
|
+
if (ne && ne === M && Re() && En() === "connected") {
|
|
2400
2400
|
H(ne);
|
|
2401
2401
|
return;
|
|
2402
2402
|
}
|
|
@@ -2407,12 +2407,12 @@ function dc(e) {
|
|
|
2407
2407
|
const M = u.value;
|
|
2408
2408
|
if (V(), !(!o.value || !M))
|
|
2409
2409
|
try {
|
|
2410
|
-
b && (b(), b = null),
|
|
2410
|
+
b && (b(), b = null), Xi(M), G(), q(M), o.value = !1, u.value = null, c.value = null;
|
|
2411
2411
|
} catch (U) {
|
|
2412
2412
|
c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2413
2413
|
}
|
|
2414
2414
|
};
|
|
2415
|
-
function
|
|
2415
|
+
function x(M) {
|
|
2416
2416
|
if (M.user_id === p.value)
|
|
2417
2417
|
return;
|
|
2418
2418
|
const U = y();
|
|
@@ -2423,7 +2423,7 @@ function dc(e) {
|
|
|
2423
2423
|
name: M.user.name,
|
|
2424
2424
|
...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
|
|
2425
2425
|
};
|
|
2426
|
-
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);
|
|
2427
2427
|
}
|
|
2428
2428
|
function fe(M) {
|
|
2429
2429
|
if (M.user_id === p.value)
|
|
@@ -2467,7 +2467,7 @@ function dc(e) {
|
|
|
2467
2467
|
m() && (b && (b(), b = null), o.value = !1, u.value = null, X());
|
|
2468
2468
|
};
|
|
2469
2469
|
typeof window < "u" && window.addEventListener(Je(), N);
|
|
2470
|
-
const Y =
|
|
2470
|
+
const Y = lt((M) => {
|
|
2471
2471
|
if (M === "connected") {
|
|
2472
2472
|
o.value || X();
|
|
2473
2473
|
return;
|
|
@@ -2491,12 +2491,12 @@ function dc(e) {
|
|
|
2491
2491
|
};
|
|
2492
2492
|
}
|
|
2493
2493
|
function hc(e) {
|
|
2494
|
-
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);
|
|
2495
2495
|
}
|
|
2496
2496
|
function fc() {
|
|
2497
|
-
|
|
2497
|
+
no(), ro(), oo(), uo(), Jo(), ea(), Gi(), Xo(), aa();
|
|
2498
2498
|
}
|
|
2499
|
-
class
|
|
2499
|
+
class Zt {
|
|
2500
2500
|
constructor() {
|
|
2501
2501
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2502
2502
|
}
|
|
@@ -2525,7 +2525,7 @@ class tn {
|
|
|
2525
2525
|
return this.stopListening(".client-" + n, r);
|
|
2526
2526
|
}
|
|
2527
2527
|
}
|
|
2528
|
-
class
|
|
2528
|
+
class Us {
|
|
2529
2529
|
/**
|
|
2530
2530
|
* Create a new class instance.
|
|
2531
2531
|
*/
|
|
@@ -2545,7 +2545,7 @@ class Fs {
|
|
|
2545
2545
|
this.namespace = n;
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
2548
|
-
function
|
|
2548
|
+
function Ra(e) {
|
|
2549
2549
|
try {
|
|
2550
2550
|
new e();
|
|
2551
2551
|
} catch (n) {
|
|
@@ -2554,12 +2554,12 @@ function Aa(e) {
|
|
|
2554
2554
|
}
|
|
2555
2555
|
return !0;
|
|
2556
2556
|
}
|
|
2557
|
-
class
|
|
2557
|
+
class en extends Zt {
|
|
2558
2558
|
/**
|
|
2559
2559
|
* Create a new class instance.
|
|
2560
2560
|
*/
|
|
2561
2561
|
constructor(n, r, o) {
|
|
2562
|
-
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();
|
|
2563
2563
|
}
|
|
2564
2564
|
/**
|
|
2565
2565
|
* Subscribe to a Pusher channel.
|
|
@@ -2631,7 +2631,7 @@ class nn extends tn {
|
|
|
2631
2631
|
return this.subscription.bind(n, r), this;
|
|
2632
2632
|
}
|
|
2633
2633
|
}
|
|
2634
|
-
class
|
|
2634
|
+
class Os extends en {
|
|
2635
2635
|
/**
|
|
2636
2636
|
* Send a whisper event to other clients in the channel.
|
|
2637
2637
|
*/
|
|
@@ -2642,7 +2642,7 @@ class Ds extends nn {
|
|
|
2642
2642
|
), this;
|
|
2643
2643
|
}
|
|
2644
2644
|
}
|
|
2645
|
-
class
|
|
2645
|
+
class Aa extends en {
|
|
2646
2646
|
/**
|
|
2647
2647
|
* Send a whisper event to other clients in the channel.
|
|
2648
2648
|
*/
|
|
@@ -2653,7 +2653,7 @@ class Ra extends nn {
|
|
|
2653
2653
|
), this;
|
|
2654
2654
|
}
|
|
2655
2655
|
}
|
|
2656
|
-
class Pa extends
|
|
2656
|
+
class Pa extends Os {
|
|
2657
2657
|
/**
|
|
2658
2658
|
* Register a callback to be called anytime the member list changes.
|
|
2659
2659
|
*/
|
|
@@ -2688,12 +2688,12 @@ class Pa extends Ds {
|
|
|
2688
2688
|
}), this;
|
|
2689
2689
|
}
|
|
2690
2690
|
}
|
|
2691
|
-
class
|
|
2691
|
+
class Fs extends Zt {
|
|
2692
2692
|
/**
|
|
2693
2693
|
* Create a new class instance.
|
|
2694
2694
|
*/
|
|
2695
2695
|
constructor(n, r, o) {
|
|
2696
|
-
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();
|
|
2697
2697
|
}
|
|
2698
2698
|
/**
|
|
2699
2699
|
* Subscribe to a Socket.io channel.
|
|
@@ -2764,7 +2764,7 @@ class Ns extends tn {
|
|
|
2764
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]);
|
|
2765
2765
|
}
|
|
2766
2766
|
}
|
|
2767
|
-
class
|
|
2767
|
+
class Ds extends Fs {
|
|
2768
2768
|
/**
|
|
2769
2769
|
* Send a whisper event to other clients in the channel.
|
|
2770
2770
|
*/
|
|
@@ -2776,7 +2776,7 @@ class qs extends Ns {
|
|
|
2776
2776
|
}), this;
|
|
2777
2777
|
}
|
|
2778
2778
|
}
|
|
2779
|
-
class Ma extends
|
|
2779
|
+
class Ma extends Ds {
|
|
2780
2780
|
/**
|
|
2781
2781
|
* Register a callback to be called anytime the member list changes.
|
|
2782
2782
|
*/
|
|
@@ -2814,7 +2814,7 @@ class Ma extends qs {
|
|
|
2814
2814
|
), this;
|
|
2815
2815
|
}
|
|
2816
2816
|
}
|
|
2817
|
-
class
|
|
2817
|
+
class ut extends Zt {
|
|
2818
2818
|
/**
|
|
2819
2819
|
* Subscribe to a channel.
|
|
2820
2820
|
*/
|
|
@@ -2862,7 +2862,7 @@ class dt extends tn {
|
|
|
2862
2862
|
return this;
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
|
-
class
|
|
2865
|
+
class Ns extends ut {
|
|
2866
2866
|
/**
|
|
2867
2867
|
* Send a whisper event to other clients in the channel.
|
|
2868
2868
|
*/
|
|
@@ -2870,7 +2870,7 @@ class zs extends dt {
|
|
|
2870
2870
|
return this;
|
|
2871
2871
|
}
|
|
2872
2872
|
}
|
|
2873
|
-
class ka extends
|
|
2873
|
+
class ka extends ut {
|
|
2874
2874
|
/**
|
|
2875
2875
|
* Send a whisper event to other clients in the channel.
|
|
2876
2876
|
*/
|
|
@@ -2878,7 +2878,7 @@ class ka extends dt {
|
|
|
2878
2878
|
return this;
|
|
2879
2879
|
}
|
|
2880
2880
|
}
|
|
2881
|
-
class xa extends
|
|
2881
|
+
class xa extends Ns {
|
|
2882
2882
|
/**
|
|
2883
2883
|
* Register a callback to be called anytime the member list changes.
|
|
2884
2884
|
*/
|
|
@@ -2904,7 +2904,7 @@ class xa extends zs {
|
|
|
2904
2904
|
return this;
|
|
2905
2905
|
}
|
|
2906
2906
|
}
|
|
2907
|
-
const
|
|
2907
|
+
const qs = class zs {
|
|
2908
2908
|
/**
|
|
2909
2909
|
* Create a new class instance.
|
|
2910
2910
|
*/
|
|
@@ -2916,7 +2916,7 @@ const js = class $s {
|
|
|
2916
2916
|
*/
|
|
2917
2917
|
setOptions(n) {
|
|
2918
2918
|
this.options = {
|
|
2919
|
-
|
|
2919
|
+
...zs._defaultOptions,
|
|
2920
2920
|
...n,
|
|
2921
2921
|
broadcaster: n.broadcaster
|
|
2922
2922
|
};
|
|
@@ -2931,7 +2931,7 @@ const js = class $s {
|
|
|
2931
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;
|
|
2932
2932
|
}
|
|
2933
2933
|
};
|
|
2934
|
-
|
|
2934
|
+
qs._defaultOptions = {
|
|
2935
2935
|
auth: {
|
|
2936
2936
|
headers: {}
|
|
2937
2937
|
},
|
|
@@ -2946,8 +2946,8 @@ js._defaultOptions = {
|
|
|
2946
2946
|
key: null,
|
|
2947
2947
|
namespace: "App.Events"
|
|
2948
2948
|
};
|
|
2949
|
-
let
|
|
2950
|
-
class it extends
|
|
2949
|
+
let tn = qs;
|
|
2950
|
+
class it extends tn {
|
|
2951
2951
|
constructor() {
|
|
2952
2952
|
super(...arguments), this.channels = {};
|
|
2953
2953
|
}
|
|
@@ -2985,7 +2985,7 @@ class it extends sn {
|
|
|
2985
2985
|
* Get a channel instance by name.
|
|
2986
2986
|
*/
|
|
2987
2987
|
channel(n) {
|
|
2988
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2988
|
+
return this.channels[n] || (this.channels[n] = new en(
|
|
2989
2989
|
this.pusher,
|
|
2990
2990
|
n,
|
|
2991
2991
|
this.options
|
|
@@ -2995,7 +2995,7 @@ class it extends sn {
|
|
|
2995
2995
|
* Get a private channel instance by name.
|
|
2996
2996
|
*/
|
|
2997
2997
|
privateChannel(n) {
|
|
2998
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2998
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Os(
|
|
2999
2999
|
this.pusher,
|
|
3000
3000
|
"private-" + n,
|
|
3001
3001
|
this.options
|
|
@@ -3005,7 +3005,7 @@ class it extends sn {
|
|
|
3005
3005
|
* Get a private encrypted channel instance by name.
|
|
3006
3006
|
*/
|
|
3007
3007
|
encryptedPrivateChannel(n) {
|
|
3008
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
3008
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Aa(
|
|
3009
3009
|
this.pusher,
|
|
3010
3010
|
"private-encrypted-" + n,
|
|
3011
3011
|
this.options
|
|
@@ -3084,7 +3084,7 @@ class it extends sn {
|
|
|
3084
3084
|
this.pusher.disconnect();
|
|
3085
3085
|
}
|
|
3086
3086
|
}
|
|
3087
|
-
class La extends
|
|
3087
|
+
class La extends tn {
|
|
3088
3088
|
constructor() {
|
|
3089
3089
|
super(...arguments), this.channels = {};
|
|
3090
3090
|
}
|
|
@@ -3124,7 +3124,7 @@ class La extends sn {
|
|
|
3124
3124
|
* Get a channel instance by name.
|
|
3125
3125
|
*/
|
|
3126
3126
|
channel(n) {
|
|
3127
|
-
return this.channels[n] || (this.channels[n] = new
|
|
3127
|
+
return this.channels[n] || (this.channels[n] = new Fs(
|
|
3128
3128
|
this.socket,
|
|
3129
3129
|
n,
|
|
3130
3130
|
this.options
|
|
@@ -3134,7 +3134,7 @@ class La extends sn {
|
|
|
3134
3134
|
* Get a private channel instance by name.
|
|
3135
3135
|
*/
|
|
3136
3136
|
privateChannel(n) {
|
|
3137
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
3137
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Ds(
|
|
3138
3138
|
this.socket,
|
|
3139
3139
|
"private-" + n,
|
|
3140
3140
|
this.options
|
|
@@ -3206,7 +3206,7 @@ class La extends sn {
|
|
|
3206
3206
|
this.socket.disconnect();
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
|
-
class
|
|
3209
|
+
class Xn extends tn {
|
|
3210
3210
|
constructor() {
|
|
3211
3211
|
super(...arguments), this.channels = {};
|
|
3212
3212
|
}
|
|
@@ -3219,19 +3219,19 @@ class Gn extends sn {
|
|
|
3219
3219
|
* Listen for an event on a channel instance.
|
|
3220
3220
|
*/
|
|
3221
3221
|
listen(n, r, o) {
|
|
3222
|
-
return new
|
|
3222
|
+
return new ut();
|
|
3223
3223
|
}
|
|
3224
3224
|
/**
|
|
3225
3225
|
* Get a channel instance by name.
|
|
3226
3226
|
*/
|
|
3227
3227
|
channel(n) {
|
|
3228
|
-
return new
|
|
3228
|
+
return new ut();
|
|
3229
3229
|
}
|
|
3230
3230
|
/**
|
|
3231
3231
|
* Get a private channel instance by name.
|
|
3232
3232
|
*/
|
|
3233
3233
|
privateChannel(n) {
|
|
3234
|
-
return new
|
|
3234
|
+
return new Ns();
|
|
3235
3235
|
}
|
|
3236
3236
|
/**
|
|
3237
3237
|
* Get a private encrypted channel instance by name.
|
|
@@ -3313,8 +3313,8 @@ class Ia {
|
|
|
3313
3313
|
else if (this.options.broadcaster === "socket.io")
|
|
3314
3314
|
this.connector = new La(this.options);
|
|
3315
3315
|
else if (this.options.broadcaster === "null")
|
|
3316
|
-
this.connector = new
|
|
3317
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
3316
|
+
this.connector = new Xn(this.options);
|
|
3317
|
+
else if (typeof this.options.broadcaster == "function" && Ra(this.options.broadcaster))
|
|
3318
3318
|
this.connector = new this.options.broadcaster(this.options);
|
|
3319
3319
|
else
|
|
3320
3320
|
throw new Error(
|
|
@@ -3377,7 +3377,7 @@ class Ia {
|
|
|
3377
3377
|
);
|
|
3378
3378
|
}
|
|
3379
3379
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3380
|
-
return n instanceof it || n instanceof
|
|
3380
|
+
return n instanceof it || n instanceof Xn;
|
|
3381
3381
|
}
|
|
3382
3382
|
/**
|
|
3383
3383
|
* Get the Socket ID for the connection.
|
|
@@ -3441,10 +3441,10 @@ class Ia {
|
|
|
3441
3441
|
function Ua(e) {
|
|
3442
3442
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3443
3443
|
}
|
|
3444
|
-
var
|
|
3445
|
-
var
|
|
3444
|
+
var Lt = { exports: {} };
|
|
3445
|
+
var Wn;
|
|
3446
3446
|
function Oa() {
|
|
3447
|
-
return
|
|
3447
|
+
return Wn || (Wn = 1, (function(e, n) {
|
|
3448
3448
|
(function(o, c) {
|
|
3449
3449
|
e.exports = c();
|
|
3450
3450
|
})(window, function() {
|
|
@@ -3473,8 +3473,8 @@ function Oa() {
|
|
|
3473
3473
|
}, c.t = function(u, d) {
|
|
3474
3474
|
if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
|
|
3475
3475
|
var f = /* @__PURE__ */ Object.create(null);
|
|
3476
|
-
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(
|
|
3477
|
-
return u[
|
|
3476
|
+
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(A) {
|
|
3477
|
+
return u[A];
|
|
3478
3478
|
}).bind(null, h));
|
|
3479
3479
|
return f;
|
|
3480
3480
|
}, c.n = function(u) {
|
|
@@ -3540,9 +3540,9 @@ function Oa() {
|
|
|
3540
3540
|
}, w.prototype.decode = function(p) {
|
|
3541
3541
|
if (p.length === 0)
|
|
3542
3542
|
return new Uint8Array(0);
|
|
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,
|
|
3544
|
-
te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)),
|
|
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 && (
|
|
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)
|
|
3546
3546
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3547
3547
|
return F;
|
|
3548
3548
|
}, w.prototype._encodeByte = function(p) {
|
|
@@ -3565,10 +3565,10 @@ function Oa() {
|
|
|
3565
3565
|
);
|
|
3566
3566
|
o.Coder = f;
|
|
3567
3567
|
var h = new f();
|
|
3568
|
-
function
|
|
3568
|
+
function A(w) {
|
|
3569
3569
|
return h.encode(w);
|
|
3570
3570
|
}
|
|
3571
|
-
o.encode =
|
|
3571
|
+
o.encode = A;
|
|
3572
3572
|
function C(w) {
|
|
3573
3573
|
return h.decode(w);
|
|
3574
3574
|
}
|
|
@@ -3595,10 +3595,10 @@ function Oa() {
|
|
|
3595
3595
|
return E.encode(w);
|
|
3596
3596
|
}
|
|
3597
3597
|
o.encodeURLSafe = b;
|
|
3598
|
-
function
|
|
3598
|
+
function R(w) {
|
|
3599
3599
|
return E.decode(w);
|
|
3600
3600
|
}
|
|
3601
|
-
o.decodeURLSafe =
|
|
3601
|
+
o.decodeURLSafe = R, o.encodedLength = function(w) {
|
|
3602
3602
|
return h.encodedLength(w);
|
|
3603
3603
|
}, o.maxDecodedLength = function(w) {
|
|
3604
3604
|
return h.maxDecodedLength(w);
|
|
@@ -3613,8 +3613,8 @@ function Oa() {
|
|
|
3613
3613
|
var u = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3614
3614
|
function f(C) {
|
|
3615
3615
|
for (var v = new Uint8Array(h(C)), E = 0, b = 0; b < C.length; b++) {
|
|
3616
|
-
var
|
|
3617
|
-
|
|
3616
|
+
var R = C.charCodeAt(b);
|
|
3617
|
+
R < 128 ? v[E++] = R : R < 2048 ? (v[E++] = 192 | R >> 6, v[E++] = 128 | R & 63) : R < 55296 ? (v[E++] = 224 | R >> 12, v[E++] = 128 | R >> 6 & 63, v[E++] = 128 | R & 63) : (b++, R = (R & 1023) << 10, R |= C.charCodeAt(b) & 1023, R += 65536, v[E++] = 240 | R >> 18, v[E++] = 128 | R >> 12 & 63, v[E++] = 128 | R >> 6 & 63, v[E++] = 128 | R & 63);
|
|
3618
3618
|
}
|
|
3619
3619
|
return v;
|
|
3620
3620
|
}
|
|
@@ -3638,35 +3638,35 @@ function Oa() {
|
|
|
3638
3638
|
return v;
|
|
3639
3639
|
}
|
|
3640
3640
|
o.encodedLength = h;
|
|
3641
|
-
function
|
|
3641
|
+
function A(C) {
|
|
3642
3642
|
for (var v = [], E = 0; E < C.length; E++) {
|
|
3643
3643
|
var b = C[E];
|
|
3644
3644
|
if (b & 128) {
|
|
3645
|
-
var
|
|
3645
|
+
var R = void 0;
|
|
3646
3646
|
if (b < 224) {
|
|
3647
3647
|
if (E >= C.length)
|
|
3648
3648
|
throw new Error(d);
|
|
3649
3649
|
var w = C[++E];
|
|
3650
3650
|
if ((w & 192) !== 128)
|
|
3651
3651
|
throw new Error(d);
|
|
3652
|
-
b = (b & 31) << 6 | w & 63,
|
|
3652
|
+
b = (b & 31) << 6 | w & 63, R = 128;
|
|
3653
3653
|
} else if (b < 240) {
|
|
3654
3654
|
if (E >= C.length - 1)
|
|
3655
3655
|
throw new Error(d);
|
|
3656
3656
|
var w = C[++E], p = C[++E];
|
|
3657
3657
|
if ((w & 192) !== 128 || (p & 192) !== 128)
|
|
3658
3658
|
throw new Error(d);
|
|
3659
|
-
b = (b & 15) << 12 | (w & 63) << 6 | p & 63,
|
|
3659
|
+
b = (b & 15) << 12 | (w & 63) << 6 | p & 63, R = 2048;
|
|
3660
3660
|
} else if (b < 248) {
|
|
3661
3661
|
if (E >= C.length - 2)
|
|
3662
3662
|
throw new Error(d);
|
|
3663
3663
|
var w = C[++E], p = C[++E], m = C[++E];
|
|
3664
3664
|
if ((w & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
|
|
3665
3665
|
throw new Error(d);
|
|
3666
|
-
b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63,
|
|
3666
|
+
b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63, R = 65536;
|
|
3667
3667
|
} else
|
|
3668
3668
|
throw new Error(d);
|
|
3669
|
-
if (b <
|
|
3669
|
+
if (b < R || b >= 55296 && b <= 57343)
|
|
3670
3670
|
throw new Error(d);
|
|
3671
3671
|
if (b >= 65536) {
|
|
3672
3672
|
if (b > 1114111)
|
|
@@ -3678,7 +3678,7 @@ function Oa() {
|
|
|
3678
3678
|
}
|
|
3679
3679
|
return v.join("");
|
|
3680
3680
|
}
|
|
3681
|
-
o.decode =
|
|
3681
|
+
o.decode = A;
|
|
3682
3682
|
}),
|
|
3683
3683
|
/* 2 */
|
|
3684
3684
|
/***/
|
|
@@ -3732,7 +3732,7 @@ function Oa() {
|
|
|
3732
3732
|
cdn_https: "https://js.pusher.com",
|
|
3733
3733
|
dependency_suffix: ""
|
|
3734
3734
|
}, h = f;
|
|
3735
|
-
class
|
|
3735
|
+
class A {
|
|
3736
3736
|
constructor(t) {
|
|
3737
3737
|
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3738
3738
|
}
|
|
@@ -3742,14 +3742,14 @@ function Oa() {
|
|
|
3742
3742
|
l.loading[t].push(a);
|
|
3743
3743
|
else {
|
|
3744
3744
|
l.loading[t] = [a];
|
|
3745
|
-
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) {
|
|
3746
3746
|
if (l.receivers.remove(S), l.loading[t]) {
|
|
3747
3747
|
var z = l.loading[t];
|
|
3748
3748
|
delete l.loading[t];
|
|
3749
3749
|
for (var Q = function(de) {
|
|
3750
3750
|
de || g.cleanup();
|
|
3751
3751
|
}, ee = 0; ee < z.length; ee++)
|
|
3752
|
-
z[ee](
|
|
3752
|
+
z[ee](L, Q);
|
|
3753
3753
|
}
|
|
3754
3754
|
});
|
|
3755
3755
|
g.send(S);
|
|
@@ -3763,7 +3763,7 @@ function Oa() {
|
|
|
3763
3763
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3764
3764
|
}
|
|
3765
3765
|
}
|
|
3766
|
-
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new
|
|
3766
|
+
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new A({
|
|
3767
3767
|
cdn_http: h.cdn_http,
|
|
3768
3768
|
cdn_https: h.cdn_https,
|
|
3769
3769
|
version: h.VERSION,
|
|
@@ -3790,7 +3790,7 @@ function Oa() {
|
|
|
3790
3790
|
}
|
|
3791
3791
|
}
|
|
3792
3792
|
};
|
|
3793
|
-
var
|
|
3793
|
+
var R = { buildLogSuffix: function(i) {
|
|
3794
3794
|
const t = "See:", s = E.urls[i];
|
|
3795
3795
|
if (!s)
|
|
3796
3796
|
return "";
|
|
@@ -3851,42 +3851,42 @@ function Oa() {
|
|
|
3851
3851
|
for (var S in s.headers)
|
|
3852
3852
|
g.setRequestHeader(S, s.headers[S]);
|
|
3853
3853
|
if (s.headersProvider != null) {
|
|
3854
|
-
let
|
|
3855
|
-
for (var S in
|
|
3856
|
-
g.setRequestHeader(S,
|
|
3854
|
+
let L = s.headersProvider();
|
|
3855
|
+
for (var S in L)
|
|
3856
|
+
g.setRequestHeader(S, L[S]);
|
|
3857
3857
|
}
|
|
3858
3858
|
return g.onreadystatechange = function() {
|
|
3859
3859
|
if (g.readyState === 4)
|
|
3860
3860
|
if (g.status === 200) {
|
|
3861
|
-
let
|
|
3861
|
+
let L, z = !1;
|
|
3862
3862
|
try {
|
|
3863
|
-
|
|
3863
|
+
L = JSON.parse(g.responseText), z = !0;
|
|
3864
3864
|
} catch {
|
|
3865
3865
|
l(new k(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${g.responseText}`), null);
|
|
3866
3866
|
}
|
|
3867
|
-
z && l(null,
|
|
3867
|
+
z && l(null, L);
|
|
3868
3868
|
} else {
|
|
3869
|
-
let
|
|
3869
|
+
let L = "";
|
|
3870
3870
|
switch (a) {
|
|
3871
3871
|
case w.UserAuthentication:
|
|
3872
|
-
|
|
3872
|
+
L = R.buildLogSuffix("authenticationEndpoint");
|
|
3873
3873
|
break;
|
|
3874
3874
|
case w.ChannelAuthorization:
|
|
3875
|
-
|
|
3875
|
+
L = `Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;
|
|
3876
3876
|
break;
|
|
3877
3877
|
}
|
|
3878
|
-
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);
|
|
3879
3879
|
}
|
|
3880
3880
|
}, g.send(t), g;
|
|
3881
3881
|
};
|
|
3882
3882
|
function H(i) {
|
|
3883
3883
|
return B(fe(i));
|
|
3884
3884
|
}
|
|
3885
|
-
var X = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
3885
|
+
var X = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", x = function(i) {
|
|
3886
3886
|
var t = i.charCodeAt(0);
|
|
3887
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);
|
|
3888
3888
|
}, fe = function(i) {
|
|
3889
|
-
return i.replace(/[^\x00-\x7F]/g,
|
|
3889
|
+
return i.replace(/[^\x00-\x7F]/g, x);
|
|
3890
3890
|
}, Se = function(i) {
|
|
3891
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 = [
|
|
3892
3892
|
_.charAt(s >>> 18),
|
|
@@ -3954,12 +3954,12 @@ function Oa() {
|
|
|
3954
3954
|
}
|
|
3955
3955
|
return i;
|
|
3956
3956
|
}
|
|
3957
|
-
function
|
|
3957
|
+
function nn() {
|
|
3958
3958
|
for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3959
3959
|
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Qe(arguments[t]));
|
|
3960
3960
|
return i.join(" : ");
|
|
3961
3961
|
}
|
|
3962
|
-
function
|
|
3962
|
+
function dt(i, t) {
|
|
3963
3963
|
var s = Array.prototype.indexOf;
|
|
3964
3964
|
if (i === null)
|
|
3965
3965
|
return -1;
|
|
@@ -4009,7 +4009,7 @@ function Oa() {
|
|
|
4009
4009
|
t(i[a], a, i, s) && s.push(i[a]);
|
|
4010
4010
|
return s;
|
|
4011
4011
|
}
|
|
4012
|
-
function
|
|
4012
|
+
function Ae(i, t) {
|
|
4013
4013
|
var s = {};
|
|
4014
4014
|
return T(i, function(a, l) {
|
|
4015
4015
|
(t && t(a, l, i, s) || a) && (s[l] = a);
|
|
@@ -4038,16 +4038,16 @@ function Oa() {
|
|
|
4038
4038
|
return typeof t == "object" && (t = Qe(t)), encodeURIComponent(H(t.toString()));
|
|
4039
4039
|
});
|
|
4040
4040
|
}
|
|
4041
|
-
function
|
|
4042
|
-
var t =
|
|
4041
|
+
function js(i) {
|
|
4042
|
+
var t = Ae(i, function(a) {
|
|
4043
4043
|
return a !== void 0;
|
|
4044
4044
|
}), s = se(Le(be(t)), oe.method("join", "=")).join("&");
|
|
4045
4045
|
return s;
|
|
4046
4046
|
}
|
|
4047
|
-
function
|
|
4047
|
+
function $s(i) {
|
|
4048
4048
|
var t = [], s = [];
|
|
4049
4049
|
return (function a(l, g) {
|
|
4050
|
-
var S,
|
|
4050
|
+
var S, L, z;
|
|
4051
4051
|
switch (typeof l) {
|
|
4052
4052
|
case "object":
|
|
4053
4053
|
if (!l)
|
|
@@ -4060,8 +4060,8 @@ function Oa() {
|
|
|
4060
4060
|
z[S] = a(l[S], g + "[" + S + "]");
|
|
4061
4061
|
else {
|
|
4062
4062
|
z = {};
|
|
4063
|
-
for (
|
|
4064
|
-
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) + "]"));
|
|
4065
4065
|
}
|
|
4066
4066
|
return z;
|
|
4067
4067
|
case "number":
|
|
@@ -4075,10 +4075,10 @@ function Oa() {
|
|
|
4075
4075
|
try {
|
|
4076
4076
|
return JSON.stringify(i);
|
|
4077
4077
|
} catch {
|
|
4078
|
-
return JSON.stringify(
|
|
4078
|
+
return JSON.stringify($s(i));
|
|
4079
4079
|
}
|
|
4080
4080
|
}
|
|
4081
|
-
class
|
|
4081
|
+
class Hs {
|
|
4082
4082
|
constructor() {
|
|
4083
4083
|
this.globalLog = (t) => {
|
|
4084
4084
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -4100,24 +4100,24 @@ function Oa() {
|
|
|
4100
4100
|
window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
|
|
4101
4101
|
}
|
|
4102
4102
|
log(t, ...s) {
|
|
4103
|
-
var a =
|
|
4104
|
-
|
|
4103
|
+
var a = nn.apply(this, arguments);
|
|
4104
|
+
Ct.log ? Ct.log(a) : Ct.logToConsole && t.bind(this)(a);
|
|
4105
4105
|
}
|
|
4106
4106
|
}
|
|
4107
|
-
var ce = new
|
|
4107
|
+
var ce = new Hs(), Bs = function(i, t, s, a, l) {
|
|
4108
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.`);
|
|
4109
4109
|
var g = i.nextAuthCallbackID.toString();
|
|
4110
4110
|
i.nextAuthCallbackID++;
|
|
4111
|
-
var S = i.getDocument(),
|
|
4111
|
+
var S = i.getDocument(), L = S.createElement("script");
|
|
4112
4112
|
i.auth_callbacks[g] = function(ee) {
|
|
4113
4113
|
l(null, ee);
|
|
4114
4114
|
};
|
|
4115
4115
|
var z = "Pusher.auth_callbacks['" + g + "']";
|
|
4116
|
-
|
|
4116
|
+
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
4117
4117
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
4118
|
-
Q.insertBefore(
|
|
4119
|
-
},
|
|
4120
|
-
class
|
|
4118
|
+
Q.insertBefore(L, Q.firstChild);
|
|
4119
|
+
}, Vs = Bs;
|
|
4120
|
+
class Xs {
|
|
4121
4121
|
constructor(t) {
|
|
4122
4122
|
this.src = t;
|
|
4123
4123
|
}
|
|
@@ -4137,13 +4137,13 @@ function Oa() {
|
|
|
4137
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;
|
|
4138
4138
|
}
|
|
4139
4139
|
}
|
|
4140
|
-
class
|
|
4140
|
+
class Ws {
|
|
4141
4141
|
constructor(t, s) {
|
|
4142
4142
|
this.url = t, this.data = s;
|
|
4143
4143
|
}
|
|
4144
4144
|
send(t) {
|
|
4145
4145
|
if (!this.request) {
|
|
4146
|
-
var s =
|
|
4146
|
+
var s = js(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
4147
4147
|
this.request = j.createScriptRequest(a), this.request.send(t);
|
|
4148
4148
|
}
|
|
4149
4149
|
}
|
|
@@ -4151,52 +4151,52 @@ function Oa() {
|
|
|
4151
4151
|
this.request && this.request.cleanup();
|
|
4152
4152
|
}
|
|
4153
4153
|
}
|
|
4154
|
-
var
|
|
4154
|
+
var Gs = function(i, t) {
|
|
4155
4155
|
return function(s, a) {
|
|
4156
|
-
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = j.createJSONPRequest(g, s),
|
|
4157
|
-
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);
|
|
4158
4158
|
});
|
|
4159
|
-
S.send(
|
|
4159
|
+
S.send(L);
|
|
4160
4160
|
};
|
|
4161
|
-
},
|
|
4161
|
+
}, Js = {
|
|
4162
4162
|
name: "jsonp",
|
|
4163
|
-
getAgent:
|
|
4164
|
-
},
|
|
4165
|
-
function
|
|
4163
|
+
getAgent: Gs
|
|
4164
|
+
}, Ks = Js;
|
|
4165
|
+
function ht(i, t, s) {
|
|
4166
4166
|
var a = i + (t.useTLS ? "s" : ""), l = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
4167
4167
|
return a + "://" + l + s;
|
|
4168
4168
|
}
|
|
4169
|
-
function
|
|
4169
|
+
function ft(i, t) {
|
|
4170
4170
|
var s = "/app/" + i, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
4171
4171
|
return s + a;
|
|
4172
4172
|
}
|
|
4173
|
-
var
|
|
4173
|
+
var Qs = {
|
|
4174
4174
|
getInitial: function(i, t) {
|
|
4175
|
-
var s = (t.httpPath || "") +
|
|
4176
|
-
return
|
|
4175
|
+
var s = (t.httpPath || "") + ft(i, "flash=false");
|
|
4176
|
+
return ht("ws", t, s);
|
|
4177
4177
|
}
|
|
4178
|
-
},
|
|
4178
|
+
}, Ys = {
|
|
4179
4179
|
getInitial: function(i, t) {
|
|
4180
|
-
var s = (t.httpPath || "/pusher") +
|
|
4181
|
-
return
|
|
4180
|
+
var s = (t.httpPath || "/pusher") + ft(i);
|
|
4181
|
+
return ht("http", t, s);
|
|
4182
4182
|
}
|
|
4183
|
-
},
|
|
4183
|
+
}, Zs = {
|
|
4184
4184
|
getInitial: function(i, t) {
|
|
4185
|
-
return
|
|
4185
|
+
return ht("http", t, t.httpPath || "/pusher");
|
|
4186
4186
|
},
|
|
4187
4187
|
getPath: function(i, t) {
|
|
4188
|
-
return
|
|
4188
|
+
return ft(i);
|
|
4189
4189
|
}
|
|
4190
4190
|
};
|
|
4191
|
-
class
|
|
4191
|
+
class er {
|
|
4192
4192
|
constructor() {
|
|
4193
4193
|
this._callbacks = {};
|
|
4194
4194
|
}
|
|
4195
4195
|
get(t) {
|
|
4196
|
-
return this._callbacks[
|
|
4196
|
+
return this._callbacks[pt(t)];
|
|
4197
4197
|
}
|
|
4198
4198
|
add(t, s, a) {
|
|
4199
|
-
var l =
|
|
4199
|
+
var l = pt(t);
|
|
4200
4200
|
this._callbacks[l] = this._callbacks[l] || [], this._callbacks[l].push({
|
|
4201
4201
|
fn: s,
|
|
4202
4202
|
context: a
|
|
@@ -4207,7 +4207,7 @@ function Oa() {
|
|
|
4207
4207
|
this._callbacks = {};
|
|
4208
4208
|
return;
|
|
4209
4209
|
}
|
|
4210
|
-
var l = t ? [
|
|
4210
|
+
var l = t ? [pt(t)] : P(this._callbacks);
|
|
4211
4211
|
s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
|
|
4212
4212
|
}
|
|
4213
4213
|
removeCallback(t, s, a) {
|
|
@@ -4223,12 +4223,12 @@ function Oa() {
|
|
|
4223
4223
|
}, this);
|
|
4224
4224
|
}
|
|
4225
4225
|
}
|
|
4226
|
-
function
|
|
4226
|
+
function pt(i) {
|
|
4227
4227
|
return "_" + i;
|
|
4228
4228
|
}
|
|
4229
4229
|
class Te {
|
|
4230
4230
|
constructor(t) {
|
|
4231
|
-
this.callbacks = new
|
|
4231
|
+
this.callbacks = new er(), this.global_callbacks = [], this.failThrough = t;
|
|
4232
4232
|
}
|
|
4233
4233
|
bind(t, s, a) {
|
|
4234
4234
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4256,7 +4256,7 @@ function Oa() {
|
|
|
4256
4256
|
return this;
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
|
-
class
|
|
4259
|
+
class tr extends Te {
|
|
4260
4260
|
constructor(t, s, a, l, g) {
|
|
4261
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();
|
|
4262
4262
|
}
|
|
@@ -4343,11 +4343,11 @@ function Oa() {
|
|
|
4343
4343
|
return this.hooks.isSupported(t);
|
|
4344
4344
|
}
|
|
4345
4345
|
createConnection(t, s, a, l) {
|
|
4346
|
-
return new
|
|
4346
|
+
return new tr(this.hooks, t, s, a, l);
|
|
4347
4347
|
}
|
|
4348
4348
|
}
|
|
4349
|
-
var
|
|
4350
|
-
urls:
|
|
4349
|
+
var nr = new De({
|
|
4350
|
+
urls: Qs,
|
|
4351
4351
|
handlesActivityChecks: !1,
|
|
4352
4352
|
supportsPing: !1,
|
|
4353
4353
|
isInitialized: function() {
|
|
@@ -4359,32 +4359,32 @@ function Oa() {
|
|
|
4359
4359
|
getSocket: function(i) {
|
|
4360
4360
|
return j.createWebSocket(i);
|
|
4361
4361
|
}
|
|
4362
|
-
}),
|
|
4363
|
-
urls:
|
|
4362
|
+
}), sn = {
|
|
4363
|
+
urls: Ys,
|
|
4364
4364
|
handlesActivityChecks: !1,
|
|
4365
4365
|
supportsPing: !0,
|
|
4366
4366
|
isInitialized: function() {
|
|
4367
4367
|
return !0;
|
|
4368
4368
|
}
|
|
4369
|
-
},
|
|
4369
|
+
}, rn = ve({
|
|
4370
4370
|
getSocket: function(i) {
|
|
4371
4371
|
return j.HTTPFactory.createStreamingSocket(i);
|
|
4372
4372
|
}
|
|
4373
|
-
},
|
|
4373
|
+
}, sn), on = ve({
|
|
4374
4374
|
getSocket: function(i) {
|
|
4375
4375
|
return j.HTTPFactory.createPollingSocket(i);
|
|
4376
4376
|
}
|
|
4377
|
-
},
|
|
4377
|
+
}, sn), an = {
|
|
4378
4378
|
isSupported: function() {
|
|
4379
4379
|
return j.isXHRSupported();
|
|
4380
4380
|
}
|
|
4381
|
-
},
|
|
4382
|
-
ws:
|
|
4383
|
-
xhr_streaming:
|
|
4384
|
-
xhr_polling:
|
|
4385
|
-
}, 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({
|
|
4386
4386
|
file: "sockjs",
|
|
4387
|
-
urls:
|
|
4387
|
+
urls: Zs,
|
|
4388
4388
|
handlesActivityChecks: !0,
|
|
4389
4389
|
supportsPing: !1,
|
|
4390
4390
|
isSupported: function() {
|
|
@@ -4406,15 +4406,15 @@ function Oa() {
|
|
|
4406
4406
|
path: t
|
|
4407
4407
|
}));
|
|
4408
4408
|
}
|
|
4409
|
-
}),
|
|
4409
|
+
}), cn = {
|
|
4410
4410
|
isSupported: function(i) {
|
|
4411
4411
|
var t = j.isXDRSupported(i.useTLS);
|
|
4412
4412
|
return t;
|
|
4413
4413
|
}
|
|
4414
|
-
},
|
|
4415
|
-
Ye.xdr_streaming =
|
|
4416
|
-
var
|
|
4417
|
-
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 {
|
|
4418
4418
|
constructor() {
|
|
4419
4419
|
super();
|
|
4420
4420
|
var t = this;
|
|
@@ -4428,8 +4428,8 @@ function Oa() {
|
|
|
4428
4428
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4429
4429
|
}
|
|
4430
4430
|
}
|
|
4431
|
-
var
|
|
4432
|
-
class
|
|
4431
|
+
var dr = new lr();
|
|
4432
|
+
class hr {
|
|
4433
4433
|
constructor(t, s, a) {
|
|
4434
4434
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4435
4435
|
}
|
|
@@ -4437,8 +4437,8 @@ function Oa() {
|
|
|
4437
4437
|
l = ve({}, l, {
|
|
4438
4438
|
activityTimeout: this.pingDelay
|
|
4439
4439
|
});
|
|
4440
|
-
var g = this.transport.createConnection(t, s, a, l), S = null,
|
|
4441
|
-
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();
|
|
4442
4442
|
}, z = (Q) => {
|
|
4443
4443
|
if (g.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
|
|
4444
4444
|
this.manager.reportDeath();
|
|
@@ -4447,13 +4447,13 @@ function Oa() {
|
|
|
4447
4447
|
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4448
4448
|
}
|
|
4449
4449
|
};
|
|
4450
|
-
return g.bind("open",
|
|
4450
|
+
return g.bind("open", L), g;
|
|
4451
4451
|
}
|
|
4452
4452
|
isSupported(t) {
|
|
4453
4453
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4454
4454
|
}
|
|
4455
4455
|
}
|
|
4456
|
-
const
|
|
4456
|
+
const un = {
|
|
4457
4457
|
decodeMessage: function(i) {
|
|
4458
4458
|
try {
|
|
4459
4459
|
var t = JSON.parse(i.data), s = t.data;
|
|
@@ -4476,7 +4476,7 @@ function Oa() {
|
|
|
4476
4476
|
return JSON.stringify(i);
|
|
4477
4477
|
},
|
|
4478
4478
|
processHandshake: function(i) {
|
|
4479
|
-
var t =
|
|
4479
|
+
var t = un.decodeMessage(i);
|
|
4480
4480
|
if (t.event === "pusher:connection_established") {
|
|
4481
4481
|
if (!t.data.activity_timeout)
|
|
4482
4482
|
throw "No activity timeout specified in handshake";
|
|
@@ -4507,8 +4507,8 @@ function Oa() {
|
|
|
4507
4507
|
} : null;
|
|
4508
4508
|
}
|
|
4509
4509
|
};
|
|
4510
|
-
var Ie =
|
|
4511
|
-
class
|
|
4510
|
+
var Ie = un;
|
|
4511
|
+
class fr extends Te {
|
|
4512
4512
|
constructor(t, s) {
|
|
4513
4513
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4514
4514
|
}
|
|
@@ -4582,7 +4582,7 @@ function Oa() {
|
|
|
4582
4582
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4583
4583
|
}
|
|
4584
4584
|
}
|
|
4585
|
-
class
|
|
4585
|
+
class pr {
|
|
4586
4586
|
constructor(t, s) {
|
|
4587
4587
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4588
4588
|
}
|
|
@@ -4600,7 +4600,7 @@ function Oa() {
|
|
|
4600
4600
|
return;
|
|
4601
4601
|
}
|
|
4602
4602
|
s.action === "connected" ? this.finish("connected", {
|
|
4603
|
-
connection: new
|
|
4603
|
+
connection: new fr(s.id, this.transport),
|
|
4604
4604
|
activityTimeout: s.activityTimeout
|
|
4605
4605
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4606
4606
|
}, this.onClosed = (t) => {
|
|
@@ -4616,7 +4616,7 @@ function Oa() {
|
|
|
4616
4616
|
this.callback(ve({ transport: this.transport, action: t }, s));
|
|
4617
4617
|
}
|
|
4618
4618
|
}
|
|
4619
|
-
class
|
|
4619
|
+
class gr {
|
|
4620
4620
|
constructor(t, s) {
|
|
4621
4621
|
this.timeline = t, this.options = s || {};
|
|
4622
4622
|
}
|
|
@@ -4624,7 +4624,7 @@ function Oa() {
|
|
|
4624
4624
|
this.timeline.isEmpty() || this.timeline.send(j.TimelineTransport.getAgent(this, t), s);
|
|
4625
4625
|
}
|
|
4626
4626
|
}
|
|
4627
|
-
class
|
|
4627
|
+
class gt extends Te {
|
|
4628
4628
|
constructor(t, s) {
|
|
4629
4629
|
super(function(a, l) {
|
|
4630
4630
|
ce.debug("No callbacks on " + t + " for " + a);
|
|
@@ -4637,7 +4637,7 @@ function Oa() {
|
|
|
4637
4637
|
if (t.indexOf("client-") !== 0)
|
|
4638
4638
|
throw new p("Event '" + t + "' does not start with 'client-'");
|
|
4639
4639
|
if (!this.subscribed) {
|
|
4640
|
-
var a =
|
|
4640
|
+
var a = R.buildLogSuffix("triggeringClientEvents");
|
|
4641
4641
|
ce.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4642
4642
|
}
|
|
4643
4643
|
return this.pusher.send_event(t, s, this.name);
|
|
@@ -4686,7 +4686,7 @@ function Oa() {
|
|
|
4686
4686
|
this.subscriptionCancelled = !1;
|
|
4687
4687
|
}
|
|
4688
4688
|
}
|
|
4689
|
-
class
|
|
4689
|
+
class mt extends gt {
|
|
4690
4690
|
authorize(t, s) {
|
|
4691
4691
|
return this.pusher.config.channelAuthorizer({
|
|
4692
4692
|
channelName: this.name,
|
|
@@ -4694,7 +4694,7 @@ function Oa() {
|
|
|
4694
4694
|
}, s);
|
|
4695
4695
|
}
|
|
4696
4696
|
}
|
|
4697
|
-
class
|
|
4697
|
+
class mr {
|
|
4698
4698
|
constructor() {
|
|
4699
4699
|
this.reset();
|
|
4700
4700
|
}
|
|
@@ -4726,14 +4726,14 @@ function Oa() {
|
|
|
4726
4726
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4727
4727
|
}
|
|
4728
4728
|
}
|
|
4729
|
-
var
|
|
4729
|
+
var vr = function(i, t, s, a) {
|
|
4730
4730
|
function l(g) {
|
|
4731
4731
|
return g instanceof s ? g : new s(function(S) {
|
|
4732
4732
|
S(g);
|
|
4733
4733
|
});
|
|
4734
4734
|
}
|
|
4735
4735
|
return new (s || (s = Promise))(function(g, S) {
|
|
4736
|
-
function
|
|
4736
|
+
function L(ee) {
|
|
4737
4737
|
try {
|
|
4738
4738
|
Q(a.next(ee));
|
|
4739
4739
|
} catch (de) {
|
|
@@ -4748,17 +4748,17 @@ function Oa() {
|
|
|
4748
4748
|
}
|
|
4749
4749
|
}
|
|
4750
4750
|
function Q(ee) {
|
|
4751
|
-
ee.done ? g(ee.value) : l(ee.value).then(
|
|
4751
|
+
ee.done ? g(ee.value) : l(ee.value).then(L, z);
|
|
4752
4752
|
}
|
|
4753
4753
|
Q((a = a.apply(i, t || [])).next());
|
|
4754
4754
|
});
|
|
4755
4755
|
};
|
|
4756
|
-
class
|
|
4756
|
+
class br extends mt {
|
|
4757
4757
|
constructor(t, s) {
|
|
4758
|
-
super(t, s), this.members = new
|
|
4758
|
+
super(t, s), this.members = new mr();
|
|
4759
4759
|
}
|
|
4760
4760
|
authorize(t, s) {
|
|
4761
|
-
super.authorize(t, (a, l) =>
|
|
4761
|
+
super.authorize(t, (a, l) => vr(this, void 0, void 0, function* () {
|
|
4762
4762
|
if (!a)
|
|
4763
4763
|
if (l = l, l.channel_data != null) {
|
|
4764
4764
|
var g = JSON.parse(l.channel_data);
|
|
@@ -4766,7 +4766,7 @@ function Oa() {
|
|
|
4766
4766
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4767
4767
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4768
4768
|
else {
|
|
4769
|
-
let S =
|
|
4769
|
+
let S = R.buildLogSuffix("authorizationEndpoint");
|
|
4770
4770
|
ce.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4771
4771
|
return;
|
|
4772
4772
|
}
|
|
@@ -4808,8 +4808,8 @@ function Oa() {
|
|
|
4808
4808
|
this.members.reset(), super.disconnect();
|
|
4809
4809
|
}
|
|
4810
4810
|
}
|
|
4811
|
-
var
|
|
4812
|
-
class
|
|
4811
|
+
var yr = c(1), vt = c(0);
|
|
4812
|
+
class _r extends mt {
|
|
4813
4813
|
constructor(t, s, a) {
|
|
4814
4814
|
super(t, s), this.key = null, this.nacl = a;
|
|
4815
4815
|
}
|
|
@@ -4824,7 +4824,7 @@ function Oa() {
|
|
|
4824
4824
|
s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4825
4825
|
return;
|
|
4826
4826
|
}
|
|
4827
|
-
this.key = Object(
|
|
4827
|
+
this.key = Object(vt.decode)(g), delete l.shared_secret, s(null, l);
|
|
4828
4828
|
});
|
|
4829
4829
|
}
|
|
4830
4830
|
trigger(t, s) {
|
|
@@ -4847,21 +4847,21 @@ function Oa() {
|
|
|
4847
4847
|
ce.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4848
4848
|
return;
|
|
4849
4849
|
}
|
|
4850
|
-
let a = Object(
|
|
4850
|
+
let a = Object(vt.decode)(s.ciphertext);
|
|
4851
4851
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4852
4852
|
ce.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4853
4853
|
return;
|
|
4854
4854
|
}
|
|
4855
|
-
let l = Object(
|
|
4855
|
+
let l = Object(vt.decode)(s.nonce);
|
|
4856
4856
|
if (l.length < this.nacl.secretbox.nonceLength) {
|
|
4857
4857
|
ce.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
|
|
4858
4858
|
return;
|
|
4859
4859
|
}
|
|
4860
4860
|
let g = this.nacl.secretbox.open(a, l, this.key);
|
|
4861
4861
|
if (g === null) {
|
|
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,
|
|
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) => {
|
|
4863
4863
|
if (S) {
|
|
4864
|
-
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`);
|
|
4865
4865
|
return;
|
|
4866
4866
|
}
|
|
4867
4867
|
if (g = this.nacl.secretbox.open(a, l, this.key), g === null) {
|
|
@@ -4875,7 +4875,7 @@ function Oa() {
|
|
|
4875
4875
|
this.emit(t, this.getDataToEmit(g));
|
|
4876
4876
|
}
|
|
4877
4877
|
getDataToEmit(t) {
|
|
4878
|
-
let s = Object(
|
|
4878
|
+
let s = Object(yr.decode)(t);
|
|
4879
4879
|
try {
|
|
4880
4880
|
return JSON.parse(s);
|
|
4881
4881
|
} catch {
|
|
@@ -4883,7 +4883,7 @@ function Oa() {
|
|
|
4883
4883
|
}
|
|
4884
4884
|
}
|
|
4885
4885
|
}
|
|
4886
|
-
class
|
|
4886
|
+
class Sr extends Te {
|
|
4887
4887
|
constructor(t, s) {
|
|
4888
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);
|
|
4889
4889
|
var a = j.getNetwork();
|
|
@@ -5039,12 +5039,12 @@ function Oa() {
|
|
|
5039
5039
|
return this.state === "connecting" || this.state === "connected";
|
|
5040
5040
|
}
|
|
5041
5041
|
}
|
|
5042
|
-
class
|
|
5042
|
+
class Cr {
|
|
5043
5043
|
constructor() {
|
|
5044
5044
|
this.channels = {};
|
|
5045
5045
|
}
|
|
5046
5046
|
add(t, s) {
|
|
5047
|
-
return this.channels[t] || (this.channels[t] =
|
|
5047
|
+
return this.channels[t] || (this.channels[t] = wr(t, s)), this.channels[t];
|
|
5048
5048
|
}
|
|
5049
5049
|
all() {
|
|
5050
5050
|
return D(this.channels);
|
|
@@ -5062,11 +5062,11 @@ function Oa() {
|
|
|
5062
5062
|
});
|
|
5063
5063
|
}
|
|
5064
5064
|
}
|
|
5065
|
-
function
|
|
5065
|
+
function wr(i, t) {
|
|
5066
5066
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5067
5067
|
if (t.config.nacl)
|
|
5068
5068
|
return Ee.createEncryptedChannel(i, t, t.config.nacl);
|
|
5069
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
5069
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = R.buildLogSuffix("encryptedChannelSupport");
|
|
5070
5070
|
throw new J(`${s}. ${a}`);
|
|
5071
5071
|
} else {
|
|
5072
5072
|
if (i.indexOf("private-") === 0)
|
|
@@ -5078,36 +5078,36 @@ function Oa() {
|
|
|
5078
5078
|
return Ee.createChannel(i, t);
|
|
5079
5079
|
}
|
|
5080
5080
|
}
|
|
5081
|
-
var
|
|
5081
|
+
var Tr = {
|
|
5082
5082
|
createChannels() {
|
|
5083
|
-
return new
|
|
5083
|
+
return new Cr();
|
|
5084
5084
|
},
|
|
5085
5085
|
createConnectionManager(i, t) {
|
|
5086
|
-
return new
|
|
5086
|
+
return new Sr(i, t);
|
|
5087
5087
|
},
|
|
5088
5088
|
createChannel(i, t) {
|
|
5089
|
-
return new
|
|
5089
|
+
return new gt(i, t);
|
|
5090
5090
|
},
|
|
5091
5091
|
createPrivateChannel(i, t) {
|
|
5092
|
-
return new
|
|
5092
|
+
return new mt(i, t);
|
|
5093
5093
|
},
|
|
5094
5094
|
createPresenceChannel(i, t) {
|
|
5095
|
-
return new
|
|
5095
|
+
return new br(i, t);
|
|
5096
5096
|
},
|
|
5097
5097
|
createEncryptedChannel(i, t, s) {
|
|
5098
|
-
return new
|
|
5098
|
+
return new _r(i, t, s);
|
|
5099
5099
|
},
|
|
5100
5100
|
createTimelineSender(i, t) {
|
|
5101
|
-
return new
|
|
5101
|
+
return new gr(i, t);
|
|
5102
5102
|
},
|
|
5103
5103
|
createHandshake(i, t) {
|
|
5104
|
-
return new
|
|
5104
|
+
return new pr(i, t);
|
|
5105
5105
|
},
|
|
5106
5106
|
createAssistantToTheTransportManager(i, t, s) {
|
|
5107
|
-
return new
|
|
5107
|
+
return new hr(i, t, s);
|
|
5108
5108
|
}
|
|
5109
|
-
}, Ee =
|
|
5110
|
-
class
|
|
5109
|
+
}, Ee = Tr;
|
|
5110
|
+
class ln {
|
|
5111
5111
|
constructor(t) {
|
|
5112
5112
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
5113
5113
|
}
|
|
@@ -5132,10 +5132,10 @@ function Oa() {
|
|
|
5132
5132
|
return we(this.strategies, oe.method("isSupported"));
|
|
5133
5133
|
}
|
|
5134
5134
|
connect(t, s) {
|
|
5135
|
-
var a = this.strategies, l = 0, g = this.timeout, S = null,
|
|
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 },
|
|
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));
|
|
5137
5137
|
};
|
|
5138
|
-
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), {
|
|
5139
5139
|
abort: function() {
|
|
5140
5140
|
S.abort();
|
|
5141
5141
|
},
|
|
@@ -5148,19 +5148,19 @@ function Oa() {
|
|
|
5148
5148
|
var g = null, S = null;
|
|
5149
5149
|
return a.timeout > 0 && (g = new U(a.timeout, function() {
|
|
5150
5150
|
S.abort(), l(!0);
|
|
5151
|
-
})), S = t.connect(s, function(
|
|
5152
|
-
|
|
5151
|
+
})), S = t.connect(s, function(L, z) {
|
|
5152
|
+
L && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(L, z));
|
|
5153
5153
|
}), {
|
|
5154
5154
|
abort: function() {
|
|
5155
5155
|
g && g.ensureAborted(), S.abort();
|
|
5156
5156
|
},
|
|
5157
|
-
forceMinPriority: function(
|
|
5158
|
-
S.forceMinPriority(
|
|
5157
|
+
forceMinPriority: function(L) {
|
|
5158
|
+
S.forceMinPriority(L);
|
|
5159
5159
|
}
|
|
5160
5160
|
};
|
|
5161
5161
|
}
|
|
5162
5162
|
}
|
|
5163
|
-
class
|
|
5163
|
+
class bt {
|
|
5164
5164
|
constructor(t) {
|
|
5165
5165
|
this.strategies = t;
|
|
5166
5166
|
}
|
|
@@ -5168,26 +5168,26 @@ function Oa() {
|
|
|
5168
5168
|
return we(this.strategies, oe.method("isSupported"));
|
|
5169
5169
|
}
|
|
5170
5170
|
connect(t, s) {
|
|
5171
|
-
return
|
|
5171
|
+
return Er(this.strategies, t, function(a, l) {
|
|
5172
5172
|
return function(g, S) {
|
|
5173
5173
|
if (l[a].error = g, g) {
|
|
5174
|
-
|
|
5174
|
+
Rr(l) && s(!0);
|
|
5175
5175
|
return;
|
|
5176
5176
|
}
|
|
5177
|
-
O(l, function(
|
|
5178
|
-
|
|
5177
|
+
O(l, function(L) {
|
|
5178
|
+
L.forceMinPriority(S.transport.priority);
|
|
5179
5179
|
}), s(null, S);
|
|
5180
5180
|
};
|
|
5181
5181
|
});
|
|
5182
5182
|
}
|
|
5183
5183
|
}
|
|
5184
|
-
function
|
|
5185
|
-
var a = se(i, function(l, g, S,
|
|
5186
|
-
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));
|
|
5187
5187
|
});
|
|
5188
5188
|
return {
|
|
5189
5189
|
abort: function() {
|
|
5190
|
-
O(a,
|
|
5190
|
+
O(a, Ar);
|
|
5191
5191
|
},
|
|
5192
5192
|
forceMinPriority: function(l) {
|
|
5193
5193
|
O(a, function(g) {
|
|
@@ -5196,15 +5196,15 @@ function Oa() {
|
|
|
5196
5196
|
}
|
|
5197
5197
|
};
|
|
5198
5198
|
}
|
|
5199
|
-
function
|
|
5199
|
+
function Rr(i) {
|
|
5200
5200
|
return ge(i, function(t) {
|
|
5201
5201
|
return !!t.error;
|
|
5202
5202
|
});
|
|
5203
5203
|
}
|
|
5204
|
-
function
|
|
5204
|
+
function Ar(i) {
|
|
5205
5205
|
!i.error && !i.aborted && (i.abort(), i.aborted = !0);
|
|
5206
5206
|
}
|
|
5207
|
-
class
|
|
5207
|
+
class Pr {
|
|
5208
5208
|
constructor(t, s, a) {
|
|
5209
5209
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
5210
5210
|
}
|
|
@@ -5212,20 +5212,20 @@ function Oa() {
|
|
|
5212
5212
|
return this.strategy.isSupported();
|
|
5213
5213
|
}
|
|
5214
5214
|
connect(t, s) {
|
|
5215
|
-
var a = this.usingTLS, l =
|
|
5215
|
+
var a = this.usingTLS, l = Mr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
|
|
5216
5216
|
if (l && l.timestamp + this.ttl >= oe.now()) {
|
|
5217
|
-
var
|
|
5218
|
-
|
|
5217
|
+
var L = this.transports[l.transport];
|
|
5218
|
+
L && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
|
|
5219
5219
|
cached: !0,
|
|
5220
5220
|
transport: l.transport,
|
|
5221
5221
|
latency: l.latency
|
|
5222
|
-
}), S.push(new Ue([
|
|
5222
|
+
}), S.push(new Ue([L], {
|
|
5223
5223
|
timeout: l.latency * 2 + 1e3,
|
|
5224
5224
|
failFast: !0
|
|
5225
5225
|
}))) : g++);
|
|
5226
5226
|
}
|
|
5227
5227
|
var z = oe.now(), Q = S.pop().connect(t, function ee(de, tt) {
|
|
5228
|
-
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));
|
|
5229
5229
|
});
|
|
5230
5230
|
return {
|
|
5231
5231
|
abort: function() {
|
|
@@ -5237,26 +5237,26 @@ function Oa() {
|
|
|
5237
5237
|
};
|
|
5238
5238
|
}
|
|
5239
5239
|
}
|
|
5240
|
-
function
|
|
5240
|
+
function yt(i) {
|
|
5241
5241
|
return "pusherTransport" + (i ? "TLS" : "NonTLS");
|
|
5242
5242
|
}
|
|
5243
|
-
function
|
|
5243
|
+
function Mr(i) {
|
|
5244
5244
|
var t = j.getLocalStorage();
|
|
5245
5245
|
if (t)
|
|
5246
5246
|
try {
|
|
5247
|
-
var s = t[
|
|
5247
|
+
var s = t[yt(i)];
|
|
5248
5248
|
if (s)
|
|
5249
5249
|
return JSON.parse(s);
|
|
5250
5250
|
} catch {
|
|
5251
|
-
|
|
5251
|
+
dn(i);
|
|
5252
5252
|
}
|
|
5253
5253
|
return null;
|
|
5254
5254
|
}
|
|
5255
|
-
function
|
|
5255
|
+
function kr(i, t, s, a) {
|
|
5256
5256
|
var l = j.getLocalStorage();
|
|
5257
5257
|
if (l)
|
|
5258
5258
|
try {
|
|
5259
|
-
l[
|
|
5259
|
+
l[yt(i)] = Qe({
|
|
5260
5260
|
timestamp: oe.now(),
|
|
5261
5261
|
transport: t,
|
|
5262
5262
|
latency: s,
|
|
@@ -5265,11 +5265,11 @@ function Oa() {
|
|
|
5265
5265
|
} catch {
|
|
5266
5266
|
}
|
|
5267
5267
|
}
|
|
5268
|
-
function
|
|
5268
|
+
function dn(i) {
|
|
5269
5269
|
var t = j.getLocalStorage();
|
|
5270
5270
|
if (t)
|
|
5271
5271
|
try {
|
|
5272
|
-
delete t[
|
|
5272
|
+
delete t[yt(i)];
|
|
5273
5273
|
} catch {
|
|
5274
5274
|
}
|
|
5275
5275
|
}
|
|
@@ -5307,7 +5307,7 @@ function Oa() {
|
|
|
5307
5307
|
return a.connect(t, s);
|
|
5308
5308
|
}
|
|
5309
5309
|
}
|
|
5310
|
-
class
|
|
5310
|
+
class xr {
|
|
5311
5311
|
constructor(t) {
|
|
5312
5312
|
this.strategy = t;
|
|
5313
5313
|
}
|
|
@@ -5326,11 +5326,11 @@ function Oa() {
|
|
|
5326
5326
|
return i.isSupported();
|
|
5327
5327
|
};
|
|
5328
5328
|
}
|
|
5329
|
-
var
|
|
5329
|
+
var Lr = function(i, t, s) {
|
|
5330
5330
|
var a = {};
|
|
5331
|
-
function l(
|
|
5332
|
-
var
|
|
5333
|
-
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;
|
|
5334
5334
|
}
|
|
5335
5335
|
var g = Object.assign({}, t, {
|
|
5336
5336
|
hostNonTLS: i.wsHost + ":" + i.wsPort,
|
|
@@ -5338,7 +5338,7 @@ function Oa() {
|
|
|
5338
5338
|
httpPath: i.wsPath
|
|
5339
5339
|
}), S = Object.assign({}, g, {
|
|
5340
5340
|
useTLS: !0
|
|
5341
|
-
}),
|
|
5341
|
+
}), L = Object.assign({}, t, {
|
|
5342
5342
|
hostNonTLS: i.httpHost + ":" + i.httpPort,
|
|
5343
5343
|
hostTLS: i.httpHost + ":" + i.httpsPort,
|
|
5344
5344
|
httpPath: i.httpPath
|
|
@@ -5346,43 +5346,43 @@ function Oa() {
|
|
|
5346
5346
|
loop: !0,
|
|
5347
5347
|
timeout: 15e3,
|
|
5348
5348
|
timeoutLimit: 6e4
|
|
5349
|
-
}, Q = new
|
|
5349
|
+
}, Q = new ln({
|
|
5350
5350
|
minPingDelay: 1e4,
|
|
5351
5351
|
maxPingDelay: i.activityTimeout
|
|
5352
|
-
}), ee = new
|
|
5352
|
+
}), ee = new ln({
|
|
5353
5353
|
lives: 2,
|
|
5354
5354
|
minPingDelay: 1e4,
|
|
5355
5355
|
maxPingDelay: i.activityTimeout
|
|
5356
|
-
}), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q),
|
|
5357
|
-
new ze(je(
|
|
5358
|
-
], z),
|
|
5359
|
-
new ze(je(
|
|
5360
|
-
], z),
|
|
5361
|
-
new ze(je(
|
|
5362
|
-
|
|
5363
|
-
new Ze(
|
|
5364
|
-
]),
|
|
5365
|
-
], z),
|
|
5366
|
-
return t.useTLS ?
|
|
5367
|
-
|
|
5368
|
-
new Ze(
|
|
5369
|
-
]) :
|
|
5370
|
-
|
|
5371
|
-
new Ze(
|
|
5372
|
-
new Ze(
|
|
5373
|
-
]), new
|
|
5356
|
+
}), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Ri = l("sockjs", "sockjs", 1, L), mn = l("xhr_streaming", "xhr_streaming", 1, L, ee), Ai = l("xdr_streaming", "xdr_streaming", 1, L, ee), vn = l("xhr_polling", "xhr_polling", 1, L), Pi = l("xdr_polling", "xdr_polling", 1, L), bn = new Ue([de], z), Mi = new Ue([tt], z), ki = new Ue([Ri], z), yn = new Ue([
|
|
5357
|
+
new ze(je(mn), mn, Ai)
|
|
5358
|
+
], 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, {
|
|
5374
5374
|
ttl: 18e5,
|
|
5375
5375
|
timeline: t.timeline,
|
|
5376
5376
|
useTLS: t.useTLS
|
|
5377
5377
|
});
|
|
5378
|
-
},
|
|
5378
|
+
}, Ir = Lr, Ur = (function() {
|
|
5379
5379
|
var i = this;
|
|
5380
5380
|
i.timeline.info(i.buildTimelineMessage({
|
|
5381
5381
|
transport: i.name + (i.options.useTLS ? "s" : "")
|
|
5382
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) {
|
|
5383
5383
|
i.hooks.isInitialized() ? (i.changeState("initialized"), s(!0)) : (t && i.onError(t), i.onClose(), s(!1));
|
|
5384
5384
|
})) : i.onClose();
|
|
5385
|
-
}),
|
|
5385
|
+
}), Or = {
|
|
5386
5386
|
getRequest: function(i) {
|
|
5387
5387
|
var t = new window.XDomainRequest();
|
|
5388
5388
|
return t.ontimeout = function() {
|
|
@@ -5398,9 +5398,9 @@ function Oa() {
|
|
|
5398
5398
|
abortRequest: function(i) {
|
|
5399
5399
|
i.ontimeout = i.onerror = i.onprogress = i.onload = null, i.abort();
|
|
5400
5400
|
}
|
|
5401
|
-
},
|
|
5402
|
-
const
|
|
5403
|
-
class
|
|
5401
|
+
}, Fr = Or;
|
|
5402
|
+
const Dr = 256 * 1024;
|
|
5403
|
+
class Nr extends Te {
|
|
5404
5404
|
constructor(t, s, a) {
|
|
5405
5405
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5406
5406
|
}
|
|
@@ -5428,17 +5428,17 @@ function Oa() {
|
|
|
5428
5428
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5429
5429
|
}
|
|
5430
5430
|
isBufferTooLong(t) {
|
|
5431
|
-
return this.position === t.length && t.length >
|
|
5431
|
+
return this.position === t.length && t.length > Dr;
|
|
5432
5432
|
}
|
|
5433
5433
|
}
|
|
5434
|
-
var
|
|
5434
|
+
var _t;
|
|
5435
5435
|
(function(i) {
|
|
5436
5436
|
i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED";
|
|
5437
|
-
})(
|
|
5438
|
-
var Oe =
|
|
5439
|
-
class
|
|
5437
|
+
})(_t || (_t = {}));
|
|
5438
|
+
var Oe = _t, qr = 1;
|
|
5439
|
+
class zr {
|
|
5440
5440
|
constructor(t, s) {
|
|
5441
|
-
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();
|
|
5442
5442
|
}
|
|
5443
5443
|
send(t) {
|
|
5444
5444
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5452,7 +5452,7 @@ function Oa() {
|
|
|
5452
5452
|
sendRaw(t) {
|
|
5453
5453
|
if (this.readyState === Oe.OPEN)
|
|
5454
5454
|
try {
|
|
5455
|
-
return j.createSocketRequest("POST",
|
|
5455
|
+
return j.createSocketRequest("POST", hn($r(this.location, this.session))).start(t), !0;
|
|
5456
5456
|
} catch {
|
|
5457
5457
|
return !1;
|
|
5458
5458
|
}
|
|
@@ -5495,7 +5495,7 @@ function Oa() {
|
|
|
5495
5495
|
}
|
|
5496
5496
|
}
|
|
5497
5497
|
onOpen(t) {
|
|
5498
|
-
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);
|
|
5499
5499
|
}
|
|
5500
5500
|
onEvent(t) {
|
|
5501
5501
|
this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
@@ -5507,7 +5507,7 @@ function Oa() {
|
|
|
5507
5507
|
this.onerror && this.onerror(t);
|
|
5508
5508
|
}
|
|
5509
5509
|
openStream() {
|
|
5510
|
-
this.stream = j.createSocketRequest("POST",
|
|
5510
|
+
this.stream = j.createSocketRequest("POST", hn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5511
5511
|
this.onChunk(t);
|
|
5512
5512
|
}), this.stream.bind("finished", (t) => {
|
|
5513
5513
|
this.hooks.onFinished(this, t);
|
|
@@ -5526,33 +5526,33 @@ function Oa() {
|
|
|
5526
5526
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5527
5527
|
}
|
|
5528
5528
|
}
|
|
5529
|
-
function
|
|
5529
|
+
function jr(i) {
|
|
5530
5530
|
var t = /([^\?]*)\/*(\??.*)/.exec(i);
|
|
5531
5531
|
return {
|
|
5532
5532
|
base: t[1],
|
|
5533
5533
|
queryString: t[2]
|
|
5534
5534
|
};
|
|
5535
5535
|
}
|
|
5536
|
-
function
|
|
5536
|
+
function $r(i, t) {
|
|
5537
5537
|
return i.base + "/" + t + "/xhr_send";
|
|
5538
5538
|
}
|
|
5539
|
-
function
|
|
5539
|
+
function hn(i) {
|
|
5540
5540
|
var t = i.indexOf("?") === -1 ? "?" : "&";
|
|
5541
|
-
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5541
|
+
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + qr++;
|
|
5542
5542
|
}
|
|
5543
|
-
function
|
|
5543
|
+
function Hr(i, t) {
|
|
5544
5544
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(i);
|
|
5545
5545
|
return s[1] + t + s[3];
|
|
5546
5546
|
}
|
|
5547
|
-
function
|
|
5547
|
+
function fn(i) {
|
|
5548
5548
|
return j.randomInt(i);
|
|
5549
5549
|
}
|
|
5550
|
-
function
|
|
5550
|
+
function Br(i) {
|
|
5551
5551
|
for (var t = [], s = 0; s < i; s++)
|
|
5552
|
-
t.push(
|
|
5552
|
+
t.push(fn(32).toString(32));
|
|
5553
5553
|
return t.join("");
|
|
5554
5554
|
}
|
|
5555
|
-
var
|
|
5555
|
+
var Vr = zr, Xr = {
|
|
5556
5556
|
getReceiveURL: function(i, t) {
|
|
5557
5557
|
return i.base + "/" + t + "/xhr_streaming" + i.queryString;
|
|
5558
5558
|
},
|
|
@@ -5565,7 +5565,7 @@ function Oa() {
|
|
|
5565
5565
|
onFinished: function(i, t) {
|
|
5566
5566
|
i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5567
5567
|
}
|
|
5568
|
-
},
|
|
5568
|
+
}, Wr = Xr, Gr = {
|
|
5569
5569
|
getReceiveURL: function(i, t) {
|
|
5570
5570
|
return i.base + "/" + t + "/xhr" + i.queryString;
|
|
5571
5571
|
},
|
|
@@ -5577,7 +5577,7 @@ function Oa() {
|
|
|
5577
5577
|
onFinished: function(i, t) {
|
|
5578
5578
|
t === 200 ? i.reconnect() : i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5579
5579
|
}
|
|
5580
|
-
},
|
|
5580
|
+
}, Jr = Gr, Kr = {
|
|
5581
5581
|
getRequest: function(i) {
|
|
5582
5582
|
var t = j.getXHRAPI(), s = new t();
|
|
5583
5583
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5594,36 +5594,36 @@ function Oa() {
|
|
|
5594
5594
|
abortRequest: function(i) {
|
|
5595
5595
|
i.onreadystatechange = null, i.abort();
|
|
5596
5596
|
}
|
|
5597
|
-
},
|
|
5597
|
+
}, Qr = Kr, Yr = {
|
|
5598
5598
|
createStreamingSocket(i) {
|
|
5599
|
-
return this.createSocket(
|
|
5599
|
+
return this.createSocket(Wr, i);
|
|
5600
5600
|
},
|
|
5601
5601
|
createPollingSocket(i) {
|
|
5602
|
-
return this.createSocket(
|
|
5602
|
+
return this.createSocket(Jr, i);
|
|
5603
5603
|
},
|
|
5604
5604
|
createSocket(i, t) {
|
|
5605
|
-
return new
|
|
5605
|
+
return new Vr(i, t);
|
|
5606
5606
|
},
|
|
5607
5607
|
createXHR(i, t) {
|
|
5608
|
-
return this.createRequest(
|
|
5608
|
+
return this.createRequest(Qr, i, t);
|
|
5609
5609
|
},
|
|
5610
5610
|
createRequest(i, t, s) {
|
|
5611
|
-
return new
|
|
5611
|
+
return new Nr(i, t, s);
|
|
5612
5612
|
}
|
|
5613
|
-
},
|
|
5614
|
-
|
|
5615
|
-
return this.createRequest(
|
|
5613
|
+
}, pn = Yr;
|
|
5614
|
+
pn.createXDR = function(i, t) {
|
|
5615
|
+
return this.createRequest(Fr, i, t);
|
|
5616
5616
|
};
|
|
5617
|
-
var
|
|
5617
|
+
var Zr = pn, ei = {
|
|
5618
5618
|
nextAuthCallbackID: 1,
|
|
5619
5619
|
auth_callbacks: {},
|
|
5620
5620
|
ScriptReceivers: d,
|
|
5621
5621
|
DependenciesReceivers: C,
|
|
5622
|
-
getDefaultStrategy:
|
|
5623
|
-
Transports:
|
|
5624
|
-
transportConnectionInitializer:
|
|
5625
|
-
HTTPFactory:
|
|
5626
|
-
TimelineTransport:
|
|
5622
|
+
getDefaultStrategy: Ir,
|
|
5623
|
+
Transports: ur,
|
|
5624
|
+
transportConnectionInitializer: Ur,
|
|
5625
|
+
HTTPFactory: Zr,
|
|
5626
|
+
TimelineTransport: Ks,
|
|
5627
5627
|
getXHRAPI() {
|
|
5628
5628
|
return window.XMLHttpRequest;
|
|
5629
5629
|
},
|
|
@@ -5644,7 +5644,7 @@ function Oa() {
|
|
|
5644
5644
|
return this.getDocument().location.protocol;
|
|
5645
5645
|
},
|
|
5646
5646
|
getAuthorizers() {
|
|
5647
|
-
return { ajax: V, jsonp:
|
|
5647
|
+
return { ajax: V, jsonp: Vs };
|
|
5648
5648
|
},
|
|
5649
5649
|
onDocumentBody(i) {
|
|
5650
5650
|
document.body ? i() : setTimeout(() => {
|
|
@@ -5652,10 +5652,10 @@ function Oa() {
|
|
|
5652
5652
|
}, 0);
|
|
5653
5653
|
},
|
|
5654
5654
|
createJSONPRequest(i, t) {
|
|
5655
|
-
return new
|
|
5655
|
+
return new Ws(i, t);
|
|
5656
5656
|
},
|
|
5657
5657
|
createScriptRequest(i) {
|
|
5658
|
-
return new
|
|
5658
|
+
return new Xs(i);
|
|
5659
5659
|
},
|
|
5660
5660
|
getLocalStorage() {
|
|
5661
5661
|
try {
|
|
@@ -5675,7 +5675,7 @@ function Oa() {
|
|
|
5675
5675
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5676
5676
|
},
|
|
5677
5677
|
getNetwork() {
|
|
5678
|
-
return
|
|
5678
|
+
return dr;
|
|
5679
5679
|
},
|
|
5680
5680
|
createWebSocket(i) {
|
|
5681
5681
|
var t = this.getWebSocketAPI();
|
|
@@ -5707,12 +5707,12 @@ function Oa() {
|
|
|
5707
5707
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5708
5708
|
}() * i);
|
|
5709
5709
|
}
|
|
5710
|
-
}, j =
|
|
5710
|
+
}, j = ei, St;
|
|
5711
5711
|
(function(i) {
|
|
5712
5712
|
i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
|
|
5713
|
-
})(
|
|
5714
|
-
var et =
|
|
5715
|
-
class
|
|
5713
|
+
})(St || (St = {}));
|
|
5714
|
+
var et = St;
|
|
5715
|
+
class ti {
|
|
5716
5716
|
constructor(t, s, a) {
|
|
5717
5717
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5718
5718
|
}
|
|
@@ -5750,7 +5750,7 @@ function Oa() {
|
|
|
5750
5750
|
return this.uniqueID++, this.uniqueID;
|
|
5751
5751
|
}
|
|
5752
5752
|
}
|
|
5753
|
-
class
|
|
5753
|
+
class ni {
|
|
5754
5754
|
constructor(t, s, a, l) {
|
|
5755
5755
|
this.name = t, this.priority = s, this.transport = a, this.options = l || {};
|
|
5756
5756
|
}
|
|
@@ -5762,11 +5762,11 @@ function Oa() {
|
|
|
5762
5762
|
connect(t, s) {
|
|
5763
5763
|
if (this.isSupported()) {
|
|
5764
5764
|
if (this.priority < t)
|
|
5765
|
-
return
|
|
5766
|
-
} else return
|
|
5765
|
+
return gn(new F(), s);
|
|
5766
|
+
} else return gn(new te(), s);
|
|
5767
5767
|
var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
|
|
5768
5768
|
l.unbind("initialized", S), l.connect();
|
|
5769
|
-
},
|
|
5769
|
+
}, L = function() {
|
|
5770
5770
|
g = Ee.createHandshake(l, function(de) {
|
|
5771
5771
|
a = !0, ee(), s(null, de);
|
|
5772
5772
|
});
|
|
@@ -5777,9 +5777,9 @@ function Oa() {
|
|
|
5777
5777
|
var de;
|
|
5778
5778
|
de = Qe(l), s(new q(de));
|
|
5779
5779
|
}, ee = function() {
|
|
5780
|
-
l.unbind("initialized", S), l.unbind("open",
|
|
5780
|
+
l.unbind("initialized", S), l.unbind("open", L), l.unbind("error", z), l.unbind("closed", Q);
|
|
5781
5781
|
};
|
|
5782
|
-
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(), {
|
|
5783
5783
|
abort: () => {
|
|
5784
5784
|
a || (ee(), g ? g.close() : l.close());
|
|
5785
5785
|
},
|
|
@@ -5789,7 +5789,7 @@ function Oa() {
|
|
|
5789
5789
|
};
|
|
5790
5790
|
}
|
|
5791
5791
|
}
|
|
5792
|
-
function
|
|
5792
|
+
function gn(i, t) {
|
|
5793
5793
|
return oe.defer(function() {
|
|
5794
5794
|
t(i);
|
|
5795
5795
|
}), {
|
|
@@ -5799,14 +5799,14 @@ function Oa() {
|
|
|
5799
5799
|
}
|
|
5800
5800
|
};
|
|
5801
5801
|
}
|
|
5802
|
-
const { Transports:
|
|
5803
|
-
var
|
|
5804
|
-
var S =
|
|
5802
|
+
const { Transports: si } = j;
|
|
5803
|
+
var ri = function(i, t, s, a, l, g) {
|
|
5804
|
+
var S = si[s];
|
|
5805
5805
|
if (!S)
|
|
5806
5806
|
throw new G(s);
|
|
5807
|
-
var
|
|
5808
|
-
return
|
|
5809
|
-
},
|
|
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 = {
|
|
5810
5810
|
isSupported: function() {
|
|
5811
5811
|
return !1;
|
|
5812
5812
|
},
|
|
@@ -5823,14 +5823,14 @@ function Oa() {
|
|
|
5823
5823
|
};
|
|
5824
5824
|
}
|
|
5825
5825
|
};
|
|
5826
|
-
function
|
|
5826
|
+
function oi(i) {
|
|
5827
5827
|
if (i == null)
|
|
5828
5828
|
throw "You must pass an options object";
|
|
5829
5829
|
if (i.cluster == null)
|
|
5830
5830
|
throw "Options object must provide a cluster";
|
|
5831
5831
|
"disableStats" in i && ce.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5832
5832
|
}
|
|
5833
|
-
const
|
|
5833
|
+
const ai = (i, t) => {
|
|
5834
5834
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5835
5835
|
for (var a in t.params)
|
|
5836
5836
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5841,15 +5841,15 @@ function Oa() {
|
|
|
5841
5841
|
}
|
|
5842
5842
|
return s;
|
|
5843
5843
|
};
|
|
5844
|
-
var
|
|
5844
|
+
var ci = (i) => {
|
|
5845
5845
|
if (typeof j.getAuthorizers()[i.transport] > "u")
|
|
5846
5846
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5847
5847
|
return (t, s) => {
|
|
5848
|
-
const a =
|
|
5848
|
+
const a = ai(t, i);
|
|
5849
5849
|
j.getAuthorizers()[i.transport](j, a, i, w.UserAuthentication, s);
|
|
5850
5850
|
};
|
|
5851
5851
|
};
|
|
5852
|
-
const
|
|
5852
|
+
const ui = (i, t) => {
|
|
5853
5853
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5854
5854
|
s += "&channel_name=" + encodeURIComponent(i.channelName);
|
|
5855
5855
|
for (var a in t.params)
|
|
@@ -5861,15 +5861,15 @@ function Oa() {
|
|
|
5861
5861
|
}
|
|
5862
5862
|
return s;
|
|
5863
5863
|
};
|
|
5864
|
-
var
|
|
5864
|
+
var li = (i) => {
|
|
5865
5865
|
if (typeof j.getAuthorizers()[i.transport] > "u")
|
|
5866
5866
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5867
5867
|
return (t, s) => {
|
|
5868
|
-
const a =
|
|
5868
|
+
const a = ui(t, i);
|
|
5869
5869
|
j.getAuthorizers()[i.transport](j, a, i, w.ChannelAuthorization, s);
|
|
5870
5870
|
};
|
|
5871
5871
|
};
|
|
5872
|
-
const
|
|
5872
|
+
const di = (i, t, s) => {
|
|
5873
5873
|
const a = {
|
|
5874
5874
|
authTransport: t.transport,
|
|
5875
5875
|
authEndpoint: t.endpoint,
|
|
@@ -5883,7 +5883,7 @@ function Oa() {
|
|
|
5883
5883
|
s(S, a).authorize(l.socketId, g);
|
|
5884
5884
|
};
|
|
5885
5885
|
};
|
|
5886
|
-
function
|
|
5886
|
+
function hi(i, t) {
|
|
5887
5887
|
let s = {
|
|
5888
5888
|
activityTimeout: i.activityTimeout || h.activityTimeout,
|
|
5889
5889
|
cluster: i.cluster,
|
|
@@ -5896,46 +5896,46 @@ function Oa() {
|
|
|
5896
5896
|
wsPath: i.wsPath || h.wsPath,
|
|
5897
5897
|
wsPort: i.wsPort || h.wsPort,
|
|
5898
5898
|
wssPort: i.wssPort || h.wssPort,
|
|
5899
|
-
enableStats:
|
|
5900
|
-
httpHost:
|
|
5901
|
-
useTLS:
|
|
5902
|
-
wsHost:
|
|
5903
|
-
userAuthenticator:
|
|
5904
|
-
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)
|
|
5905
5905
|
};
|
|
5906
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;
|
|
5907
5907
|
}
|
|
5908
|
-
function
|
|
5908
|
+
function fi(i) {
|
|
5909
5909
|
return i.httpHost ? i.httpHost : i.cluster ? `sockjs-${i.cluster}.pusher.com` : h.httpHost;
|
|
5910
5910
|
}
|
|
5911
|
-
function
|
|
5912
|
-
return i.wsHost ? i.wsHost :
|
|
5911
|
+
function pi(i) {
|
|
5912
|
+
return i.wsHost ? i.wsHost : gi(i.cluster);
|
|
5913
5913
|
}
|
|
5914
|
-
function
|
|
5914
|
+
function gi(i) {
|
|
5915
5915
|
return `ws-${i}.pusher.com`;
|
|
5916
5916
|
}
|
|
5917
|
-
function
|
|
5917
|
+
function mi(i) {
|
|
5918
5918
|
return j.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
|
|
5919
5919
|
}
|
|
5920
|
-
function
|
|
5920
|
+
function vi(i) {
|
|
5921
5921
|
return "enableStats" in i ? i.enableStats : "disableStats" in i ? !i.disableStats : !1;
|
|
5922
5922
|
}
|
|
5923
|
-
function
|
|
5923
|
+
function bi(i) {
|
|
5924
5924
|
const t = Object.assign(Object.assign({}, h.userAuthentication), i.userAuthentication);
|
|
5925
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5925
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : ci(t);
|
|
5926
5926
|
}
|
|
5927
|
-
function
|
|
5927
|
+
function yi(i, t) {
|
|
5928
5928
|
let s;
|
|
5929
5929
|
return "channelAuthorization" in i ? s = Object.assign(Object.assign({}, h.channelAuthorization), i.channelAuthorization) : (s = {
|
|
5930
5930
|
transport: i.authTransport || h.authTransport,
|
|
5931
5931
|
endpoint: i.authEndpoint || h.authEndpoint
|
|
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 =
|
|
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;
|
|
5933
5933
|
}
|
|
5934
|
-
function
|
|
5935
|
-
const s =
|
|
5936
|
-
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);
|
|
5937
5937
|
}
|
|
5938
|
-
class
|
|
5938
|
+
class Si extends Te {
|
|
5939
5939
|
constructor(t) {
|
|
5940
5940
|
super(function(s, a) {
|
|
5941
5941
|
ce.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5953,14 +5953,14 @@ function Oa() {
|
|
|
5953
5953
|
});
|
|
5954
5954
|
}
|
|
5955
5955
|
}
|
|
5956
|
-
function
|
|
5956
|
+
function Ci() {
|
|
5957
5957
|
let i, t;
|
|
5958
5958
|
return { promise: new Promise((a, l) => {
|
|
5959
5959
|
i = a, t = l;
|
|
5960
5960
|
}), resolve: i, reject: t };
|
|
5961
5961
|
}
|
|
5962
|
-
var
|
|
5963
|
-
class
|
|
5962
|
+
var wi = Ci;
|
|
5963
|
+
class Ti extends Te {
|
|
5964
5964
|
constructor(t) {
|
|
5965
5965
|
super(function(s, a) {
|
|
5966
5966
|
ce.debug("No callbacks on user for " + s);
|
|
@@ -5975,7 +5975,7 @@ function Oa() {
|
|
|
5975
5975
|
});
|
|
5976
5976
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5977
5977
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5978
|
-
}), this.watchlist = new
|
|
5978
|
+
}), this.watchlist = new Si(t), this.pusher.connection.bind("message", (s) => {
|
|
5979
5979
|
var a = s.event;
|
|
5980
5980
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5981
5981
|
});
|
|
@@ -6005,7 +6005,7 @@ function Oa() {
|
|
|
6005
6005
|
const t = (s) => {
|
|
6006
6006
|
s.subscriptionPending && s.subscriptionCancelled ? s.reinstateSubscription() : !s.subscriptionPending && this.pusher.connection.state === "connected" && s.subscribe();
|
|
6007
6007
|
};
|
|
6008
|
-
this.serverToUserChannel = new
|
|
6008
|
+
this.serverToUserChannel = new gt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
|
|
6009
6009
|
s.indexOf("pusher_internal:") === 0 || s.indexOf("pusher:") === 0 || this.emit(s, a);
|
|
6010
6010
|
}), t(this.serverToUserChannel);
|
|
6011
6011
|
}
|
|
@@ -6015,7 +6015,7 @@ function Oa() {
|
|
|
6015
6015
|
_newSigninPromiseIfNeeded() {
|
|
6016
6016
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
6017
6017
|
return;
|
|
6018
|
-
const { promise: t, resolve: s } =
|
|
6018
|
+
const { promise: t, resolve: s } = wi();
|
|
6019
6019
|
t.done = !1;
|
|
6020
6020
|
const a = () => {
|
|
6021
6021
|
t.done = !0;
|
|
@@ -6030,12 +6030,12 @@ function Oa() {
|
|
|
6030
6030
|
me.instances[t].connect();
|
|
6031
6031
|
}
|
|
6032
6032
|
static getClientFeatures() {
|
|
6033
|
-
return P(
|
|
6033
|
+
return P(Ae({ ws: j.Transports.ws }, function(t) {
|
|
6034
6034
|
return t.isSupported({});
|
|
6035
6035
|
}));
|
|
6036
6036
|
}
|
|
6037
6037
|
constructor(t, s) {
|
|
6038
|
-
|
|
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, {
|
|
6039
6039
|
cluster: this.config.cluster,
|
|
6040
6040
|
features: me.getClientFeatures(),
|
|
6041
6041
|
params: this.config.timelineParams || {},
|
|
@@ -6046,7 +6046,7 @@ function Oa() {
|
|
|
6046
6046
|
host: this.config.statsHost,
|
|
6047
6047
|
path: "/timeline/v2/" + j.TimelineTransport.name
|
|
6048
6048
|
}));
|
|
6049
|
-
var a = (l) => j.getDefaultStrategy(this.config, l,
|
|
6049
|
+
var a = (l) => j.getDefaultStrategy(this.config, l, ri);
|
|
6050
6050
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
6051
6051
|
getStrategy: a,
|
|
6052
6052
|
timeline: this.timeline,
|
|
@@ -6059,8 +6059,8 @@ function Oa() {
|
|
|
6059
6059
|
}), this.connection.bind("message", (l) => {
|
|
6060
6060
|
var g = l.event, S = g.indexOf("pusher_internal:") === 0;
|
|
6061
6061
|
if (l.channel) {
|
|
6062
|
-
var
|
|
6063
|
-
|
|
6062
|
+
var L = this.channel(l.channel);
|
|
6063
|
+
L && L.handleEvent(l);
|
|
6064
6064
|
}
|
|
6065
6065
|
S || this.global_emitter.emit(l.event, l.data);
|
|
6066
6066
|
}), this.connection.bind("connecting", () => {
|
|
@@ -6069,7 +6069,7 @@ function Oa() {
|
|
|
6069
6069
|
this.channels.disconnect();
|
|
6070
6070
|
}), this.connection.bind("error", (l) => {
|
|
6071
6071
|
ce.warn(l);
|
|
6072
|
-
}), 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();
|
|
6073
6073
|
}
|
|
6074
6074
|
channel(t) {
|
|
6075
6075
|
return this.channels.find(t);
|
|
@@ -6127,8 +6127,8 @@ function Oa() {
|
|
|
6127
6127
|
}
|
|
6128
6128
|
}
|
|
6129
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;
|
|
6130
|
-
var
|
|
6131
|
-
function
|
|
6130
|
+
var Ct = o.default = me;
|
|
6131
|
+
function Ei(i) {
|
|
6132
6132
|
if (i == null)
|
|
6133
6133
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
6134
6134
|
}
|
|
@@ -6138,7 +6138,7 @@ function Oa() {
|
|
|
6138
6138
|
])
|
|
6139
6139
|
);
|
|
6140
6140
|
});
|
|
6141
|
-
})(
|
|
6141
|
+
})(Lt)), Lt.exports;
|
|
6142
6142
|
}
|
|
6143
6143
|
var Fa = Oa();
|
|
6144
6144
|
const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
|
|
@@ -6232,13 +6232,13 @@ function Wa(e) {
|
|
|
6232
6232
|
const r = n.data;
|
|
6233
6233
|
return r?.code === "ACCOUNT_SUSPENDED" || r?.errors?.reason === "account_suspended" ? !0 : typeof r?.message == "string" && r.message.toLowerCase().includes("suspended");
|
|
6234
6234
|
}
|
|
6235
|
-
function
|
|
6236
|
-
if (e.headers instanceof
|
|
6235
|
+
function Gn(e, n) {
|
|
6236
|
+
if (e.headers instanceof Tn) {
|
|
6237
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"));
|
|
6238
6238
|
return;
|
|
6239
6239
|
}
|
|
6240
6240
|
const r = ie(e.headers) ? e.headers : {};
|
|
6241
|
-
e.headers = new
|
|
6241
|
+
e.headers = new Tn({
|
|
6242
6242
|
...r,
|
|
6243
6243
|
Authorization: `Bearer ${n}`,
|
|
6244
6244
|
Accept: "application/json",
|
|
@@ -6274,7 +6274,7 @@ function Ja(e, n) {
|
|
|
6274
6274
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
6275
6275
|
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6276
6276
|
}
|
|
6277
|
-
function
|
|
6277
|
+
function Jn(e) {
|
|
6278
6278
|
if (!ie(e))
|
|
6279
6279
|
return null;
|
|
6280
6280
|
const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
|
|
@@ -6301,25 +6301,25 @@ function Ka(e) {
|
|
|
6301
6301
|
function Qa(e) {
|
|
6302
6302
|
return !ie(e) || !pe(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
|
|
6303
6303
|
}
|
|
6304
|
-
function
|
|
6304
|
+
function Kn(e) {
|
|
6305
6305
|
return ie(e) && ie(e.message) && pe(e.message, "id") && pe(e.message, "conversation_id") && pe(e.message, "author_id");
|
|
6306
6306
|
}
|
|
6307
|
-
function
|
|
6307
|
+
function Qn(e) {
|
|
6308
6308
|
return ie(e) && pe(e, "conversation_id") && pe(e, "user_id") && pe(e, "message_id");
|
|
6309
6309
|
}
|
|
6310
|
-
function
|
|
6310
|
+
function Yn(e) {
|
|
6311
6311
|
return ie(e) && pe(e, "conversation_id") && ie(e.message) && pe(e.message, "id");
|
|
6312
6312
|
}
|
|
6313
|
-
function
|
|
6313
|
+
function Zn(e) {
|
|
6314
6314
|
return ie(e) && pe(e, "conversation_id") && pe(e, "message_id");
|
|
6315
6315
|
}
|
|
6316
|
-
function
|
|
6316
|
+
function es(e) {
|
|
6317
6317
|
return ie(e) && pe(e, "conversation_id") && pe(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
|
|
6318
6318
|
}
|
|
6319
|
-
function
|
|
6319
|
+
function ts(e) {
|
|
6320
6320
|
return ie(e) && pe(e, "conversation_id");
|
|
6321
6321
|
}
|
|
6322
|
-
function
|
|
6322
|
+
function ns(e) {
|
|
6323
6323
|
return ie(e) && pe(e, "conversation_id") && pe(e, "removed_user_id");
|
|
6324
6324
|
}
|
|
6325
6325
|
function Fe(e, n, r, o) {
|
|
@@ -6329,12 +6329,12 @@ function Fe(e, n, r, o) {
|
|
|
6329
6329
|
return e.listen(n, c), c;
|
|
6330
6330
|
}
|
|
6331
6331
|
function pc(e) {
|
|
6332
|
-
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");
|
|
6333
6333
|
typeof window < "u" && (window.Pusher = Da);
|
|
6334
|
-
let d = null, f = null, h = null,
|
|
6335
|
-
const
|
|
6334
|
+
let d = null, f = null, h = null, A = null, C = "disconnected", v = "available", E = null, b = null;
|
|
6335
|
+
const R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
|
|
6336
6336
|
C = T;
|
|
6337
|
-
for (const P of
|
|
6337
|
+
for (const P of R)
|
|
6338
6338
|
P(T);
|
|
6339
6339
|
}, y = (T) => {
|
|
6340
6340
|
v = T;
|
|
@@ -6343,7 +6343,7 @@ function pc(e) {
|
|
|
6343
6343
|
}, F = () => {
|
|
6344
6344
|
b !== null && (clearTimeout(b), b = null);
|
|
6345
6345
|
}, q = (T = !0) => {
|
|
6346
|
-
h !== null && (h.disconnect(), h = null),
|
|
6346
|
+
h !== null && (h.disconnect(), h = null), A = null, T && m("disconnected");
|
|
6347
6347
|
}, J = () => {
|
|
6348
6348
|
F(), d = null, f = null, E = null, y("available"), q(), p.clear();
|
|
6349
6349
|
}, G = () => {
|
|
@@ -6368,7 +6368,7 @@ function pc(e) {
|
|
|
6368
6368
|
b = setTimeout(() => {
|
|
6369
6369
|
V();
|
|
6370
6370
|
}, D);
|
|
6371
|
-
},
|
|
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 () => {
|
|
6372
6372
|
try {
|
|
6373
6373
|
const D = await e.bootstrapClient.get(
|
|
6374
6374
|
r,
|
|
@@ -6385,7 +6385,7 @@ function pc(e) {
|
|
|
6385
6385
|
}), await f), V = async () => {
|
|
6386
6386
|
const T = h !== null;
|
|
6387
6387
|
try {
|
|
6388
|
-
if (await
|
|
6388
|
+
if (await I(!0), !T)
|
|
6389
6389
|
return;
|
|
6390
6390
|
q(!1), await X(!0);
|
|
6391
6391
|
} catch (P) {
|
|
@@ -6419,8 +6419,8 @@ function pc(e) {
|
|
|
6419
6419
|
}
|
|
6420
6420
|
(O === "unavailable" || O === "failed" || O === "disconnected") && m("disconnected");
|
|
6421
6421
|
}), P.state === "connected" && m("connected");
|
|
6422
|
-
}, X = async (T = !1) => !T && h !== null && te(d) ? h : !T &&
|
|
6423
|
-
const D = await
|
|
6422
|
+
}, X = async (T = !1) => !T && h !== null && te(d) ? h : !T && A !== null ? await A : (A = (async () => {
|
|
6423
|
+
const D = await I(T);
|
|
6424
6424
|
if (D === null)
|
|
6425
6425
|
return null;
|
|
6426
6426
|
h !== null && q(!1);
|
|
@@ -6444,8 +6444,8 @@ function pc(e) {
|
|
|
6444
6444
|
};
|
|
6445
6445
|
return D.service.reverb.path && (se.wsPath = D.service.reverb.path), h = new Ia(se), H(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6446
6446
|
})().finally(() => {
|
|
6447
|
-
|
|
6448
|
-
}), await
|
|
6447
|
+
A = null;
|
|
6448
|
+
}), await A), _ = zt.create({
|
|
6449
6449
|
timeout: e.requestTimeoutMs ?? za,
|
|
6450
6450
|
withCredentials: !1,
|
|
6451
6451
|
headers: {
|
|
@@ -6454,29 +6454,29 @@ function pc(e) {
|
|
|
6454
6454
|
}
|
|
6455
6455
|
});
|
|
6456
6456
|
_.interceptors.request.use(async (T) => {
|
|
6457
|
-
const P = await
|
|
6457
|
+
const P = await I();
|
|
6458
6458
|
if (P === null)
|
|
6459
6459
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6460
|
-
return T.baseURL = P.service.apiBaseUrl,
|
|
6460
|
+
return T.baseURL = P.service.apiBaseUrl, Gn(T, P.auth.token), T;
|
|
6461
6461
|
}), _.interceptors.response.use(
|
|
6462
6462
|
(T) => T,
|
|
6463
6463
|
async (T) => {
|
|
6464
6464
|
const P = T.config;
|
|
6465
6465
|
if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6466
6466
|
P._messengerRetry = !0;
|
|
6467
|
-
const D = await
|
|
6467
|
+
const D = await I(!0);
|
|
6468
6468
|
if (D !== null)
|
|
6469
|
-
return P.baseURL = D.service.apiBaseUrl,
|
|
6469
|
+
return P.baseURL = D.service.apiBaseUrl, Gn(P, D.auth.token), await _(P);
|
|
6470
6470
|
}
|
|
6471
6471
|
return Promise.reject(T);
|
|
6472
6472
|
}
|
|
6473
6473
|
);
|
|
6474
|
-
const
|
|
6475
|
-
|
|
6474
|
+
const x = () => v === "account_suspended" ? null : h, fe = (T) => (R.add(T), T(C), () => {
|
|
6475
|
+
R.delete(T);
|
|
6476
6476
|
}), Se = (T) => (w.add(T), T(v), () => {
|
|
6477
6477
|
w.delete(T);
|
|
6478
6478
|
}), B = () => d?.auth.tenantId ?? "global", K = (T) => {
|
|
6479
|
-
const P =
|
|
6479
|
+
const P = Ot(T.ts)?.getTime() ?? Ot(T.last_seen_at)?.getTime() ?? null;
|
|
6480
6480
|
if (P === null)
|
|
6481
6481
|
return !0;
|
|
6482
6482
|
const D = `${T.tenant_scope ?? "global"}:${T.user_id}`, O = p.get(D);
|
|
@@ -6491,7 +6491,7 @@ function pc(e) {
|
|
|
6491
6491
|
se - le.seenAt > c && p.delete(ae);
|
|
6492
6492
|
return !0;
|
|
6493
6493
|
}, N = (T) => {
|
|
6494
|
-
const P =
|
|
6494
|
+
const P = x();
|
|
6495
6495
|
if (!P || typeof P.join != "function")
|
|
6496
6496
|
return;
|
|
6497
6497
|
const D = P.join(`online-users.${B()}`), O = [
|
|
@@ -6517,18 +6517,18 @@ function pc(e) {
|
|
|
6517
6517
|
function O(se, ae, le) {
|
|
6518
6518
|
if (!le)
|
|
6519
6519
|
return;
|
|
6520
|
-
const
|
|
6520
|
+
const Ae = (Le) => {
|
|
6521
6521
|
ae(Le) && le(Le);
|
|
6522
6522
|
};
|
|
6523
|
-
T.bind(se,
|
|
6523
|
+
T.bind(se, Ae), D.push({ event: se, handler: Ae });
|
|
6524
6524
|
}
|
|
6525
|
-
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), () => {
|
|
6526
6526
|
for (const se of D)
|
|
6527
6527
|
T.unbind(se.event, se.handler);
|
|
6528
6528
|
};
|
|
6529
6529
|
}
|
|
6530
6530
|
const U = (T, P) => {
|
|
6531
|
-
const D =
|
|
6531
|
+
const D = x();
|
|
6532
6532
|
if (!D)
|
|
6533
6533
|
return () => {
|
|
6534
6534
|
};
|
|
@@ -6538,25 +6538,25 @@ function pc(e) {
|
|
|
6538
6538
|
const ae = [];
|
|
6539
6539
|
return P.onMessageSent && ae.push({
|
|
6540
6540
|
event: ".ConversationMessageSent",
|
|
6541
|
-
handler: Fe(O, ".ConversationMessageSent",
|
|
6541
|
+
handler: Fe(O, ".ConversationMessageSent", Kn, P.onMessageSent)
|
|
6542
6542
|
}), P.onMessageRead && ae.push({
|
|
6543
6543
|
event: ".ConversationMessageRead",
|
|
6544
|
-
handler: Fe(O, ".ConversationMessageRead",
|
|
6544
|
+
handler: Fe(O, ".ConversationMessageRead", Qn, P.onMessageRead)
|
|
6545
6545
|
}), P.onMessageEdited && ae.push({
|
|
6546
6546
|
event: ".ConversationMessageEdited",
|
|
6547
|
-
handler: Fe(O, ".ConversationMessageEdited",
|
|
6547
|
+
handler: Fe(O, ".ConversationMessageEdited", Yn, P.onMessageEdited)
|
|
6548
6548
|
}), P.onMessageDeleted && ae.push({
|
|
6549
6549
|
event: ".ConversationMessageDeleted",
|
|
6550
|
-
handler: Fe(O, ".ConversationMessageDeleted",
|
|
6550
|
+
handler: Fe(O, ".ConversationMessageDeleted", Zn, P.onMessageDeleted)
|
|
6551
6551
|
}), P.onReactionToggled && ae.push({
|
|
6552
6552
|
event: ".MessageReactionToggled",
|
|
6553
|
-
handler: Fe(O, ".MessageReactionToggled",
|
|
6553
|
+
handler: Fe(O, ".MessageReactionToggled", es, P.onReactionToggled)
|
|
6554
6554
|
}), P.onRequestAccepted && ae.push({
|
|
6555
6555
|
event: ".ConversationRequestAccepted",
|
|
6556
|
-
handler: Fe(O, ".ConversationRequestAccepted",
|
|
6556
|
+
handler: Fe(O, ".ConversationRequestAccepted", ts, P.onRequestAccepted)
|
|
6557
6557
|
}), P.onParticipantRemoved && ae.push({
|
|
6558
6558
|
event: ".ConversationParticipantRemoved",
|
|
6559
|
-
handler: Fe(O, ".ConversationParticipantRemoved",
|
|
6559
|
+
handler: Fe(O, ".ConversationParticipantRemoved", ns, P.onParticipantRemoved)
|
|
6560
6560
|
}), () => {
|
|
6561
6561
|
if (typeof O.stopListening == "function")
|
|
6562
6562
|
for (const le of ae)
|
|
@@ -6568,7 +6568,7 @@ function pc(e) {
|
|
|
6568
6568
|
const O = T.private(`typing-conversation.${P}`), se = /* @__PURE__ */ new Set(["start", "typing"]), ae = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), le = O.subscription;
|
|
6569
6569
|
if (le) {
|
|
6570
6570
|
const we = (ge) => {
|
|
6571
|
-
const be =
|
|
6571
|
+
const be = Jn(ge);
|
|
6572
6572
|
if (be) {
|
|
6573
6573
|
if (se.has(be.state)) {
|
|
6574
6574
|
D.onTypingStart?.({
|
|
@@ -6593,8 +6593,8 @@ function pc(e) {
|
|
|
6593
6593
|
le.unbind("TypingStateChanged", we);
|
|
6594
6594
|
};
|
|
6595
6595
|
}
|
|
6596
|
-
const
|
|
6597
|
-
const ge =
|
|
6596
|
+
const Ae = [], Le = (we) => {
|
|
6597
|
+
const ge = Jn(we);
|
|
6598
6598
|
if (ge) {
|
|
6599
6599
|
if (se.has(ge.state)) {
|
|
6600
6600
|
D.onTypingStart?.({
|
|
@@ -6615,16 +6615,16 @@ function pc(e) {
|
|
|
6615
6615
|
});
|
|
6616
6616
|
}
|
|
6617
6617
|
};
|
|
6618
|
-
return O.listen(".TypingStateChanged", Le),
|
|
6618
|
+
return O.listen(".TypingStateChanged", Le), Ae.push({ event: ".TypingStateChanged", handler: Le }), () => {
|
|
6619
6619
|
if (typeof O.stopListening == "function")
|
|
6620
|
-
for (const we of
|
|
6620
|
+
for (const we of Ae)
|
|
6621
6621
|
O.stopListening(we.event, we.handler);
|
|
6622
6622
|
};
|
|
6623
6623
|
};
|
|
6624
6624
|
return {
|
|
6625
6625
|
apiClient: _,
|
|
6626
6626
|
initializedEvent: n,
|
|
6627
|
-
getEcho:
|
|
6627
|
+
getEcho: x,
|
|
6628
6628
|
waitForEcho: async () => v === "account_suspended" ? null : await X(),
|
|
6629
6629
|
getConnectionStatus: () => C,
|
|
6630
6630
|
getAccessState: () => v,
|
|
@@ -6638,95 +6638,95 @@ function pc(e) {
|
|
|
6638
6638
|
subscribeToConversation: U,
|
|
6639
6639
|
unsubscribeFromConversation: ne,
|
|
6640
6640
|
subscribeToTyping: (T, P) => {
|
|
6641
|
-
const D =
|
|
6641
|
+
const D = x();
|
|
6642
6642
|
if (D)
|
|
6643
6643
|
return ue(D, T, P);
|
|
6644
6644
|
let O = !1, se = null;
|
|
6645
6645
|
const ae = () => {
|
|
6646
6646
|
if (O)
|
|
6647
6647
|
return;
|
|
6648
|
-
const le =
|
|
6649
|
-
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));
|
|
6650
6650
|
};
|
|
6651
|
-
return typeof window < "u" && window.addEventListener(
|
|
6652
|
-
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?.();
|
|
6653
6653
|
};
|
|
6654
6654
|
},
|
|
6655
6655
|
unsubscribeFromTyping: (T) => {
|
|
6656
|
-
|
|
6656
|
+
h?.leave(`typing-conversation.${T}`);
|
|
6657
6657
|
},
|
|
6658
6658
|
clearRuntime: J
|
|
6659
6659
|
};
|
|
6660
6660
|
}
|
|
6661
6661
|
export {
|
|
6662
|
-
|
|
6662
|
+
fo as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6663
6663
|
hc as configureMessengerClient,
|
|
6664
6664
|
pc as createMessengerEcho,
|
|
6665
6665
|
W as getApi,
|
|
6666
6666
|
ke as getAuthStore,
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6667
|
+
En as getConnectionStatus,
|
|
6668
|
+
Re as getEcho,
|
|
6669
|
+
gs as getEchoConnectionStatus,
|
|
6670
6670
|
Je as getEchoInitializedEvent,
|
|
6671
6671
|
Z as getErrorMessage,
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6672
|
+
Qt as getLoggerFactory,
|
|
6673
|
+
Ht as getMainApi,
|
|
6674
|
+
jo as getMainEcho,
|
|
6675
6675
|
$o as getMainEchoConnectionStatus,
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6676
|
+
zo as getMainEchoInitializedEvent,
|
|
6677
|
+
ao as getMediaApi,
|
|
6678
|
+
It as getMessagingAccessState,
|
|
6679
6679
|
ia as getPresenceRuntimeConfig,
|
|
6680
6680
|
ca as hasConfiguredPresenceAuthTokenResolver,
|
|
6681
6681
|
ic as hasResponse,
|
|
6682
6682
|
vc as isAxiosError,
|
|
6683
6683
|
rc as isError,
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6684
|
+
Yi as isValidMessageDeletedEvent,
|
|
6685
|
+
Qi as isValidMessageEditedEvent,
|
|
6686
|
+
Ki as isValidMessageReadEvent,
|
|
6687
|
+
Ji as isValidMessageSentEvent,
|
|
6688
|
+
Zi as isValidReactionToggledEvent,
|
|
6689
|
+
eo as isValidRequestAcceptedEvent,
|
|
6690
6690
|
Pe as messagingApi,
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6691
|
+
go as normalizePresenceStatus,
|
|
6692
|
+
Ss as normalizePresenceTimestamp,
|
|
6693
|
+
lt as onConnectionStatusChange,
|
|
6694
6694
|
Ho as onMainEchoConnectionStatusChange,
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6695
|
+
qi as onMessagingAccessStateChange,
|
|
6696
|
+
Ot as parsePresenceTimestamp,
|
|
6697
|
+
zi as reconnectEcho,
|
|
6698
6698
|
Bo as reconnectMainEcho,
|
|
6699
|
-
|
|
6699
|
+
Gi as resetEchoRuntimeConfig,
|
|
6700
6700
|
Jo as resetLoggerFactory,
|
|
6701
|
-
|
|
6701
|
+
ro as resetMainApiClient,
|
|
6702
6702
|
Xo as resetMainEchoRuntimeConfig,
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6703
|
+
no as resetMessagingApiClient,
|
|
6704
|
+
oo as resetMessagingAuthStoreResolver,
|
|
6705
|
+
uo as resetMessagingMediaApi,
|
|
6706
6706
|
fc as resetMessengerClientConfig,
|
|
6707
6707
|
aa as resetPresenceRuntimeConfig,
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6708
|
+
mo as resolveFreshPresenceStatus,
|
|
6709
|
+
Ft as resolvePresenceSnapshot,
|
|
6710
|
+
Wi as setEchoRuntimeConfig,
|
|
6711
6711
|
Go as setLoggerFactory,
|
|
6712
|
-
|
|
6712
|
+
so as setMainApiClient,
|
|
6713
6713
|
Vo as setMainEchoRuntimeConfig,
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6714
|
+
to as setMessagingApiClient,
|
|
6715
|
+
io as setMessagingAuthStoreResolver,
|
|
6716
|
+
co as setMessagingMediaApi,
|
|
6717
6717
|
oa as setPresenceRuntimeConfig,
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6718
|
+
Hi as subscribeToConversation,
|
|
6719
|
+
ji as subscribeToPresenceStatus,
|
|
6720
|
+
Vi as subscribeToTyping,
|
|
6721
|
+
Bi as unsubscribeFromConversation,
|
|
6722
|
+
$i as unsubscribeFromPresenceStatus,
|
|
6723
|
+
Xi as unsubscribeFromTyping,
|
|
6724
6724
|
ac as useConnectionStatus,
|
|
6725
6725
|
oc as useConversationChannel,
|
|
6726
6726
|
cc as useGlobalMessaging,
|
|
6727
6727
|
uc as useMessagingAccessState,
|
|
6728
|
-
|
|
6728
|
+
Jt as useMessagingStore,
|
|
6729
6729
|
lc as usePresence,
|
|
6730
6730
|
dc as useTypingChannel,
|
|
6731
|
-
|
|
6731
|
+
ps as waitForEcho
|
|
6732
6732
|
};
|