@codingfactory/messenger-client 0.2.28 → 0.2.29
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 +944 -942
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { ref as be, getCurrentInstance as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import
|
|
1
|
+
import { ref as be, getCurrentInstance as zt, computed as se, watch as ot, onUnmounted as qe, toValue as is, onMounted as jt } from "vue";
|
|
2
|
+
import { defineStore as Di, storeToRefs as Ni } from "pinia";
|
|
3
|
+
import $t, { isAxiosError as qi, AxiosHeaders as An } from "axios";
|
|
4
4
|
import { isAxiosError as vc } from "axios";
|
|
5
|
-
import { useRoute as
|
|
6
|
-
const
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
}, as = () => {
|
|
10
|
-
}, cs = () => {
|
|
5
|
+
import { useRoute as zi } from "vue-router";
|
|
6
|
+
const os = () => () => {
|
|
7
|
+
}, as = () => () => {
|
|
8
|
+
}, cs = async () => {
|
|
11
9
|
}, us = () => {
|
|
12
10
|
}, ls = () => {
|
|
13
11
|
}, ds = () => {
|
|
14
|
-
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
12
|
}, hs = () => {
|
|
13
|
+
}, fs = () => {
|
|
14
|
+
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
|
+
}, ps = () => {
|
|
16
16
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
17
|
-
},
|
|
17
|
+
}, gs = async () => null, H = {
|
|
18
18
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
19
19
|
getEcho: () => null,
|
|
20
|
-
waitForEcho:
|
|
20
|
+
waitForEcho: gs,
|
|
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
|
-
},
|
|
23
|
+
onConnectionStatusChange: os,
|
|
24
|
+
onAccessStateChange: as,
|
|
25
|
+
reconnect: cs,
|
|
26
|
+
subscribeToPresenceStatus: us,
|
|
27
|
+
unsubscribeFromPresenceStatus: ls,
|
|
28
|
+
subscribeToConversation: fs,
|
|
29
|
+
unsubscribeFromConversation: ds,
|
|
30
|
+
subscribeToTyping: ps,
|
|
31
|
+
unsubscribeFromTyping: hs
|
|
32
|
+
}, Je = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ms = async () => H.waitForEcho(), vs = () => H.getConnectionStatus(), Rn = () => vs(), Ot = () => H.getAccessState(), ht = (e) => H.onConnectionStatusChange(e), ji = (e) => H.onAccessStateChange(e), $i = async () => {
|
|
33
33
|
await H.reconnect();
|
|
34
|
-
},
|
|
35
|
-
function
|
|
34
|
+
}, Hi = (e) => H.subscribeToPresenceStatus(e), Bi = () => H.unsubscribeFromPresenceStatus(), Vi = (e, n) => H.subscribeToConversation(e, n), Xi = (e) => H.unsubscribeFromConversation(e), Wi = (e, n) => H.subscribeToTyping(e, n), Gi = (e) => H.unsubscribeFromTyping(e);
|
|
35
|
+
function Ji(e) {
|
|
36
36
|
e.initializedEvent && (H.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (H.getEcho = e.getEcho), e.waitForEcho && (H.waitForEcho = e.waitForEcho), e.getConnectionStatus && (H.getConnectionStatus = e.getConnectionStatus), e.getAccessState && (H.getAccessState = e.getAccessState), e.onConnectionStatusChange && (H.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && (H.onAccessStateChange = e.onAccessStateChange), e.reconnect && (H.reconnect = e.reconnect), e.subscribeToPresenceStatus && (H.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (H.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (H.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (H.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (H.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (H.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
H.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", H.getEcho = () => null, H.waitForEcho =
|
|
38
|
+
function Ki() {
|
|
39
|
+
H.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", H.getEcho = () => null, H.waitForEcho = gs, H.getConnectionStatus = () => "disconnected", H.getAccessState = () => "available", H.onConnectionStatusChange = os, H.onAccessStateChange = as, H.reconnect = cs, H.subscribeToPresenceStatus = us, H.unsubscribeFromPresenceStatus = ls, H.subscribeToConversation = fs, H.unsubscribeFromConversation = ds, H.subscribeToTyping = ps, H.unsubscribeFromTyping = hs;
|
|
40
40
|
}
|
|
41
41
|
function xe(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Qi(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 Yi(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 Zi(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 eo(e) {
|
|
54
54
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function to(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 no(e) {
|
|
60
60
|
return xe(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let
|
|
62
|
+
const bs = $t;
|
|
63
|
+
let Ht = bs;
|
|
64
64
|
function X() {
|
|
65
|
-
return $t;
|
|
66
|
-
}
|
|
67
|
-
function to(e) {
|
|
68
|
-
$t = e;
|
|
69
|
-
}
|
|
70
|
-
function no() {
|
|
71
|
-
$t = ms;
|
|
72
|
-
}
|
|
73
|
-
const vs = jt;
|
|
74
|
-
let Ht = vs;
|
|
75
|
-
function Bt() {
|
|
76
65
|
return Ht;
|
|
77
66
|
}
|
|
78
67
|
function so(e) {
|
|
79
68
|
Ht = e;
|
|
80
69
|
}
|
|
81
70
|
function ro() {
|
|
82
|
-
Ht =
|
|
71
|
+
Ht = bs;
|
|
83
72
|
}
|
|
84
|
-
const
|
|
73
|
+
const ys = $t;
|
|
74
|
+
let Bt = ys;
|
|
75
|
+
function Vt() {
|
|
76
|
+
return Bt;
|
|
77
|
+
}
|
|
78
|
+
function io(e) {
|
|
79
|
+
Bt = e;
|
|
80
|
+
}
|
|
81
|
+
function oo() {
|
|
82
|
+
Bt = ys;
|
|
83
|
+
}
|
|
84
|
+
const _s = {
|
|
85
85
|
currentUser: null
|
|
86
86
|
};
|
|
87
|
-
let
|
|
87
|
+
let Xt = () => _s;
|
|
88
88
|
function ke() {
|
|
89
|
-
return
|
|
89
|
+
return Xt;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
91
|
+
function ao(e) {
|
|
92
|
+
Xt = e;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
94
|
+
function co() {
|
|
95
|
+
Xt = () => _s;
|
|
96
96
|
}
|
|
97
97
|
function Y(e) {
|
|
98
|
-
if (
|
|
98
|
+
if (qi(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,37 +107,37 @@ 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 Ss = {
|
|
111
111
|
async uploadImage() {
|
|
112
112
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
let
|
|
116
|
-
function ao() {
|
|
117
|
-
return Xt;
|
|
118
|
-
}
|
|
119
|
-
function co(e) {
|
|
120
|
-
Xt = e;
|
|
121
|
-
}
|
|
115
|
+
let Wt = Ss;
|
|
122
116
|
function uo() {
|
|
123
|
-
|
|
117
|
+
return Wt;
|
|
124
118
|
}
|
|
125
119
|
function lo(e) {
|
|
120
|
+
Wt = e;
|
|
121
|
+
}
|
|
122
|
+
function ho() {
|
|
123
|
+
Wt = Ss;
|
|
124
|
+
}
|
|
125
|
+
function fo(e) {
|
|
126
126
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Cs(e) {
|
|
129
129
|
return typeof e == "object" && e !== null;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
return !
|
|
131
|
+
function $e(e) {
|
|
132
|
+
return !Cs(e) || !("data" in e) ? e : e.data;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function nt(e, n) {
|
|
135
135
|
const r = e[n];
|
|
136
136
|
if (typeof r != "string")
|
|
137
137
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
138
138
|
return r;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Pn(e, n) {
|
|
141
141
|
const r = e[n];
|
|
142
142
|
if (r == null)
|
|
143
143
|
return null;
|
|
@@ -145,7 +145,7 @@ function An(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 Rt(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 At(e, n) {
|
|
|
156
156
|
}
|
|
157
157
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
if (!
|
|
159
|
+
function Ft(e) {
|
|
160
|
+
if (!Cs(e))
|
|
161
161
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
162
162
|
return {
|
|
163
|
-
id:
|
|
164
|
-
name:
|
|
165
|
-
color:
|
|
166
|
-
icon:
|
|
167
|
-
sort_order:
|
|
168
|
-
conversation_count:
|
|
169
|
-
unread_count:
|
|
170
|
-
created_at:
|
|
171
|
-
updated_at:
|
|
163
|
+
id: nt(e, "id"),
|
|
164
|
+
name: nt(e, "name"),
|
|
165
|
+
color: Pn(e, "color"),
|
|
166
|
+
icon: Pn(e, "icon"),
|
|
167
|
+
sort_order: Rt(e, "sort_order"),
|
|
168
|
+
conversation_count: Rt(e, "conversation_count"),
|
|
169
|
+
unread_count: Rt(e, "unread_count"),
|
|
170
|
+
created_at: nt(e, "created_at"),
|
|
171
|
+
updated_at: nt(e, "updated_at")
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function po(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) => Ft(n));
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!
|
|
179
|
+
function Mn(e) {
|
|
180
|
+
if (!fo(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 X().get("/v1/messaging/folders");
|
|
187
|
-
return
|
|
187
|
+
return po($e(e.data));
|
|
188
188
|
},
|
|
189
189
|
async createFolder(e) {
|
|
190
190
|
const n = await X().post("/v1/messaging/folders", e);
|
|
191
|
-
return
|
|
191
|
+
return Ft($e(n.data));
|
|
192
192
|
},
|
|
193
193
|
async updateFolder(e, n) {
|
|
194
194
|
const r = await X().patch(`/v1/messaging/folders/${e}`, n);
|
|
195
|
-
return
|
|
195
|
+
return Ft($e(r.data));
|
|
196
196
|
},
|
|
197
197
|
async deleteFolder(e) {
|
|
198
198
|
await X().delete(`/v1/messaging/folders/${e}`);
|
|
@@ -204,57 +204,57 @@ const Pe = {
|
|
|
204
204
|
const r = await X().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
205
205
|
folder_id: n
|
|
206
206
|
});
|
|
207
|
-
return
|
|
207
|
+
return Mn($e(r.data));
|
|
208
208
|
},
|
|
209
209
|
async acceptRequest(e) {
|
|
210
210
|
const n = await X().post(`/v1/messaging/conversations/${e}/accept`);
|
|
211
|
-
return
|
|
211
|
+
return Mn($e(n.data));
|
|
212
212
|
},
|
|
213
213
|
async declineRequest(e) {
|
|
214
214
|
await X().post(`/v1/messaging/conversations/${e}/decline`);
|
|
215
215
|
}
|
|
216
|
-
},
|
|
217
|
-
function
|
|
216
|
+
}, go = 6e4;
|
|
217
|
+
function mo(e) {
|
|
218
218
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function vo(e) {
|
|
221
221
|
if (typeof e != "string")
|
|
222
222
|
return null;
|
|
223
223
|
const n = e.trim().toLowerCase();
|
|
224
|
-
return
|
|
224
|
+
return mo(n) ? n : null;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ws(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 Dt(e) {
|
|
233
|
+
const n = ws(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 bo(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 = Dt(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 ?? go;
|
|
248
248
|
return c - o.getTime() > u ? "offline" : e;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
const r =
|
|
250
|
+
function Nt(e, n = {}) {
|
|
251
|
+
const r = ws(e?.last_seen_at), o = vo(e?.status);
|
|
252
252
|
return {
|
|
253
|
-
status:
|
|
253
|
+
status: bo(o, r, n),
|
|
254
254
|
lastSeenAt: r
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const kn = 1e3, Gt = 4e3, yo = 12e4, _o = 300, So = 1, Co = 1600, Jt = (e) => {
|
|
258
258
|
if (typeof e == "number" && Number.isFinite(e))
|
|
259
259
|
return e;
|
|
260
260
|
if (typeof e == "string") {
|
|
@@ -262,35 +262,35 @@ const Pn = 1e3, Wt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Gt = (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
|
+
}, Ts = (e) => typeof e == "number" && e >= 500 && e < 600, xn = (e) => {
|
|
266
|
+
const r = Jt(e.response?.status);
|
|
267
|
+
return r === void 0 ? !0 : r === 429 || Ts(r);
|
|
268
|
+
}, Es = (e) => {
|
|
269
269
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
270
|
-
return Math.max(
|
|
270
|
+
return Math.max(kn, 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(kn, 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 Gt;
|
|
277
|
+
}, wo = (e) => {
|
|
278
|
+
const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o = Gt * r;
|
|
279
|
+
return Math.min(yo, o);
|
|
280
|
+
}, To = (e) => {
|
|
281
281
|
const n = e;
|
|
282
|
-
return
|
|
283
|
-
},
|
|
282
|
+
return Jt(n.response?.status) === 429 ? Es(n.response?.headers?.["retry-after"]) : _o;
|
|
283
|
+
}, Ln = async (e) => {
|
|
284
284
|
await new Promise((n) => {
|
|
285
285
|
setTimeout(n, e);
|
|
286
286
|
});
|
|
287
|
-
},
|
|
287
|
+
}, In = () => ({
|
|
288
288
|
data: [],
|
|
289
289
|
has_more: !1
|
|
290
|
-
}),
|
|
291
|
-
if (!
|
|
290
|
+
}), Un = () => Ot() === "account_suspended", Eo = (e) => {
|
|
291
|
+
if (!le(e))
|
|
292
292
|
return !1;
|
|
293
|
-
const r = (
|
|
293
|
+
const r = (le(e.data) ? e.data : e).throttled;
|
|
294
294
|
if (typeof r == "boolean")
|
|
295
295
|
return r;
|
|
296
296
|
if (typeof r == "number")
|
|
@@ -301,7 +301,7 @@ const Pn = 1e3, Wt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Gt = (e) => {
|
|
|
301
301
|
}
|
|
302
302
|
return !1;
|
|
303
303
|
};
|
|
304
|
-
function
|
|
304
|
+
function Ao(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 To(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 Ro(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 ?? Po(n),
|
|
318
318
|
url: n,
|
|
319
|
-
type:
|
|
319
|
+
type: Ao(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 Po(e) {
|
|
325
325
|
if (!e) return "attachment";
|
|
326
326
|
try {
|
|
327
327
|
const r = new URL(e).pathname.split("/");
|
|
@@ -330,8 +330,8 @@ function Ao(e) {
|
|
|
330
330
|
return "attachment";
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
333
|
+
function Mo(e) {
|
|
334
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map(Ro);
|
|
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 ko(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;
|
|
@@ -351,7 +351,7 @@ function Po(e) {
|
|
|
351
351
|
...r ? { handle: r } : {}
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function at(e) {
|
|
355
355
|
const n = e.shared_post, r = e.author, o = n && typeof n == "object" ? {
|
|
356
356
|
id: n.id ?? "",
|
|
357
357
|
title: n.title ?? "",
|
|
@@ -367,18 +367,18 @@ function ct(e) {
|
|
|
367
367
|
} : null;
|
|
368
368
|
return {
|
|
369
369
|
...e,
|
|
370
|
-
...r ? { author:
|
|
370
|
+
...r ? { author: ko(r) } : {},
|
|
371
371
|
shared_post: o,
|
|
372
|
-
attachments:
|
|
372
|
+
attachments: Mo(e.attachments)
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
if (!e || !
|
|
375
|
+
function xo(e) {
|
|
376
|
+
if (!e || !le(e))
|
|
377
377
|
return;
|
|
378
378
|
const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
379
379
|
if (n.length === 0 || r.length === 0 || o.length === 0)
|
|
380
380
|
return;
|
|
381
|
-
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d =
|
|
381
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = le(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", P = 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 Mo(e) {
|
|
|
389
389
|
author: {
|
|
390
390
|
id: f,
|
|
391
391
|
name: h,
|
|
392
|
-
...
|
|
392
|
+
...P ? { avatar: P } : {},
|
|
393
393
|
...C ? { handle: C } : {}
|
|
394
394
|
}
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Pt(e) {
|
|
399
399
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function On(e) {
|
|
402
402
|
if (!(typeof e != "string" || e.length === 0))
|
|
403
403
|
return e;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function qt(e) {
|
|
406
406
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Lo(e, n = []) {
|
|
409
409
|
const r = /* @__PURE__ */ new Map();
|
|
410
410
|
for (const o of n) {
|
|
411
|
-
const c =
|
|
411
|
+
const c = On(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 ko(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 = On(o.last_read_message_id);
|
|
421
421
|
if (f)
|
|
422
422
|
return {
|
|
423
423
|
...o,
|
|
@@ -442,14 +442,14 @@ function ko(e, n = []) {
|
|
|
442
442
|
};
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
return Object.prototype.hasOwnProperty.call(e, "muted_until") ?
|
|
445
|
+
function Io(e, n) {
|
|
446
|
+
return Object.prototype.hasOwnProperty.call(e, "muted_until") ? Pt(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? Pt(e.me.muted_until) : Pt(n?.muted_until);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Uo(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
|
-
function
|
|
452
|
-
const r =
|
|
451
|
+
function He(e, n) {
|
|
452
|
+
const r = Io(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, P = Uo(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,47 +458,47 @@ function Be(e, n) {
|
|
|
458
458
|
return {
|
|
459
459
|
...e,
|
|
460
460
|
unread_count: o || v ? 0 : d,
|
|
461
|
-
participants:
|
|
461
|
+
participants: Lo(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: P,
|
|
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 Oo(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 Mt(e) {
|
|
476
|
+
return Oo(e) ? 0 : e.unread_count || 0;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Fn(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 (qt(c))
|
|
484
484
|
return c;
|
|
485
485
|
}
|
|
486
|
-
return
|
|
486
|
+
return qt(e.last_message?.id) ? e.last_message.id : null;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function le(e) {
|
|
489
489
|
return typeof e == "object" && e !== null;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
491
|
+
function Fo(e) {
|
|
492
|
+
return le(e) ? (le(e.response) ? e.response : null)?.status === 401 : !1;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function Dn(e) {
|
|
495
495
|
if (!Array.isArray(e))
|
|
496
496
|
return [];
|
|
497
497
|
const n = [];
|
|
498
498
|
for (const r of e) {
|
|
499
|
-
if (!
|
|
499
|
+
if (!le(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
|
|
500
500
|
continue;
|
|
501
|
-
const o = r.users.filter((c) =>
|
|
501
|
+
const o = r.users.filter((c) => le(c)).filter(
|
|
502
502
|
(c) => typeof c.id == "string" && typeof c.name == "string"
|
|
503
503
|
).map((c) => ({
|
|
504
504
|
id: c.id,
|
|
@@ -512,26 +512,26 @@ function On(e) {
|
|
|
512
512
|
}
|
|
513
513
|
return n;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
const r =
|
|
515
|
+
function Do(e, n) {
|
|
516
|
+
const r = le(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
|
|
517
517
|
if (!(typeof o != "string" || o.length === 0))
|
|
518
518
|
return o;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
521
|
-
const r =
|
|
520
|
+
function st(e, n) {
|
|
521
|
+
const r = le(e) ? e : {}, o = r.data ?? e;
|
|
522
522
|
let c = [];
|
|
523
|
-
return Array.isArray(o) ? c = o :
|
|
523
|
+
return Array.isArray(o) ? c = o : le(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: Do(r, o)
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
function
|
|
529
|
-
return
|
|
528
|
+
function Nn(e) {
|
|
529
|
+
return le(e) && typeof e.id == "string" && e.id.length > 0;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
532
|
-
return
|
|
531
|
+
function qn(e) {
|
|
532
|
+
return le(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function Kt(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,8 +540,8 @@ function Jt(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
|
|
544
|
-
if (!
|
|
543
|
+
function zn(e) {
|
|
544
|
+
if (!le(e) || typeof e.id != "string" || typeof e.name != "string")
|
|
545
545
|
return null;
|
|
546
546
|
const n = {
|
|
547
547
|
id: e.id,
|
|
@@ -551,11 +551,11 @@ function Nn(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
|
|
555
|
-
const r = (
|
|
556
|
-
return Array.isArray(r) ? r.map((o) =>
|
|
554
|
+
function No(e) {
|
|
555
|
+
const r = (le(e) ? e : {}).data ?? e;
|
|
556
|
+
return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : le(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function As(e) {
|
|
559
559
|
if (e.type !== "dm")
|
|
560
560
|
return null;
|
|
561
561
|
const n = ke()().currentUser?.id;
|
|
@@ -566,19 +566,19 @@ function Ts(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 qo(e) {
|
|
570
|
+
return (await Rs([e])).get(e) ?? null;
|
|
571
571
|
}
|
|
572
|
-
async function
|
|
572
|
+
async function Rs(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 Vt().get("/v1/identity/users/by-ids", {
|
|
578
578
|
params: {
|
|
579
579
|
ids: n.join(",")
|
|
580
580
|
}
|
|
581
|
-
}), o =
|
|
581
|
+
}), o = No(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 Es(e) {
|
|
|
591
591
|
return /* @__PURE__ */ new Map();
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
async function
|
|
595
|
-
if (e.type !== "dm" ||
|
|
594
|
+
async function jn(e, n) {
|
|
595
|
+
if (e.type !== "dm" || Kt(e, n))
|
|
596
596
|
return e;
|
|
597
|
-
const r = await
|
|
597
|
+
const r = await qo(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 qn(e, n) {
|
|
|
606
606
|
participants: o
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
-
async function
|
|
609
|
+
async function $n(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 = As(c);
|
|
613
|
+
!u || Kt(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 Rs(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)
|
|
@@ -629,31 +629,31 @@ async function zn(e) {
|
|
|
629
629
|
} : c;
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Xe(e, n) {
|
|
633
633
|
if (e.is_pinned !== n.is_pinned)
|
|
634
634
|
return e.is_pinned ? -1 : 1;
|
|
635
635
|
const r = e.last_message_at ?? e.created_at, c = (n.last_message_at ?? n.created_at).localeCompare(r);
|
|
636
636
|
return c !== 0 ? c : e.id.localeCompare(n.id);
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function rt(e, n) {
|
|
639
639
|
return [n, ...e.filter((r) => r.id !== n.id)];
|
|
640
640
|
}
|
|
641
|
-
function
|
|
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 zo(e, n) {
|
|
645
645
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Hn(e, n) {
|
|
648
648
|
return e.map((r) => {
|
|
649
|
-
const o =
|
|
649
|
+
const o = zo(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 Bn(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 $n(e, n, r) {
|
|
|
661
661
|
}));
|
|
662
662
|
return o ? c : e;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function jo(e, n, r) {
|
|
665
665
|
if (n === r)
|
|
666
666
|
return e;
|
|
667
667
|
let o = !1;
|
|
@@ -674,15 +674,15 @@ function qo(e, n, r) {
|
|
|
674
674
|
});
|
|
675
675
|
return o ? c : e;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function kt(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);
|
|
681
681
|
for (const r of e.conversations)
|
|
682
682
|
r.is_request === !0 && n.set(r.id, r);
|
|
683
|
-
return Array.from(n.values()).sort(
|
|
683
|
+
return Array.from(n.values()).sort(Xe);
|
|
684
684
|
}
|
|
685
|
-
const
|
|
685
|
+
const Qt = Di("messaging", {
|
|
686
686
|
state: () => ({
|
|
687
687
|
conversations: [],
|
|
688
688
|
requests: [],
|
|
@@ -713,30 +713,30 @@ const Kt = Oi("messaging", {
|
|
|
713
713
|
},
|
|
714
714
|
getMessagesByConversationId: (e) => (n) => e.messages[n] || [],
|
|
715
715
|
getTypingUsers: (e) => (n) => e.typingUsers[n] || [],
|
|
716
|
-
unreadConversationsCount: (e) => e.conversations.filter((n) =>
|
|
717
|
-
unreadCount: (e) => e.conversations.reduce((n, r) => n +
|
|
718
|
-
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n +
|
|
719
|
-
sortedFolders: (e) =>
|
|
716
|
+
unreadConversationsCount: (e) => e.conversations.filter((n) => Mt(n) > 0).length,
|
|
717
|
+
unreadCount: (e) => e.conversations.reduce((n, r) => n + Mt(r), 0),
|
|
718
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + Mt(r), 0),
|
|
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) => kt(e),
|
|
726
|
+
requestCount: (e) => kt(e).length,
|
|
727
|
+
unreadRequestCount: (e) => kt(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 = Hn(this.conversations, e), this.requests = Hn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
|
|
735
735
|
},
|
|
736
736
|
async fetchFolders() {
|
|
737
737
|
try {
|
|
738
738
|
const e = await Pe.fetchFolders();
|
|
739
|
-
return this.folders =
|
|
739
|
+
return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
740
740
|
} catch (e) {
|
|
741
741
|
throw this.error = Y(e), e;
|
|
742
742
|
}
|
|
@@ -744,7 +744,7 @@ const Kt = Oi("messaging", {
|
|
|
744
744
|
async createFolder(e) {
|
|
745
745
|
try {
|
|
746
746
|
const n = await Pe.createFolder(e);
|
|
747
|
-
return this.folders =
|
|
747
|
+
return this.folders = Be([...this.folders, n]), n;
|
|
748
748
|
} catch (n) {
|
|
749
749
|
throw this.error = Y(n), n;
|
|
750
750
|
}
|
|
@@ -752,7 +752,7 @@ const Kt = Oi("messaging", {
|
|
|
752
752
|
async updateFolder(e, n) {
|
|
753
753
|
try {
|
|
754
754
|
const r = await Pe.updateFolder(e, n);
|
|
755
|
-
return this.folders =
|
|
755
|
+
return this.folders = Be(
|
|
756
756
|
this.folders.map((o) => o.id === e ? r : o)
|
|
757
757
|
), r;
|
|
758
758
|
} catch (r) {
|
|
@@ -777,7 +777,7 @@ const Kt = Oi("messaging", {
|
|
|
777
777
|
sort_order: r.length + 1
|
|
778
778
|
}), n.delete(c));
|
|
779
779
|
}
|
|
780
|
-
const o =
|
|
780
|
+
const o = Be(Array.from(n.values()));
|
|
781
781
|
for (const c of o)
|
|
782
782
|
r.push({
|
|
783
783
|
...c,
|
|
@@ -798,15 +798,15 @@ const Kt = Oi("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 = Bn(
|
|
802
802
|
this.conversations,
|
|
803
803
|
e,
|
|
804
804
|
u
|
|
805
|
-
), this.requests =
|
|
805
|
+
), this.requests = Bn(
|
|
806
806
|
this.requests,
|
|
807
807
|
e,
|
|
808
808
|
u
|
|
809
|
-
), this.folders =
|
|
809
|
+
), this.folders = jo(
|
|
810
810
|
this.folders,
|
|
811
811
|
c,
|
|
812
812
|
u
|
|
@@ -818,19 +818,19 @@ const Kt = Oi("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 (Un())
|
|
822
|
+
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), In();
|
|
823
823
|
const c = o?.includePresence ?? !0, u = {};
|
|
824
824
|
c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
|
|
825
|
-
const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } =
|
|
825
|
+
const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
|
|
826
826
|
d.data,
|
|
827
827
|
"conversations"
|
|
828
|
-
),
|
|
828
|
+
), P = f.map((E) => {
|
|
829
829
|
const b = this.conversations.find(
|
|
830
830
|
(A) => A.id === E.id
|
|
831
831
|
);
|
|
832
|
-
return
|
|
833
|
-
}), C = await
|
|
832
|
+
return He(E, b);
|
|
833
|
+
}), C = await $n(P);
|
|
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 Kt = Oi("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 && xn(c) || (this.error = Y(c)), c;
|
|
842
842
|
} finally {
|
|
843
843
|
this.loading = !1;
|
|
844
844
|
}
|
|
@@ -852,8 +852,8 @@ const Kt = Oi("messaging", {
|
|
|
852
852
|
includePresence: !1
|
|
853
853
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
854
854
|
} catch (e) {
|
|
855
|
-
const n = e, r =
|
|
856
|
-
return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
855
|
+
const n = e, r = Jt(n.response?.status);
|
|
856
|
+
return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Es(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, r === void 0 || Ts(r) ? (this.backgroundPollRetryAfterUntil = Date.now() + wo(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Gt, !1));
|
|
857
857
|
}
|
|
858
858
|
},
|
|
859
859
|
async fetchConversation(e) {
|
|
@@ -862,9 +862,9 @@ const Kt = Oi("messaging", {
|
|
|
862
862
|
const n = await X().get(`/v1/messaging/conversations/${e}`, {
|
|
863
863
|
params: { include_presence: 1 }
|
|
864
864
|
}), r = this.conversations.find((f) => f.id === e);
|
|
865
|
-
let o =
|
|
866
|
-
const c =
|
|
867
|
-
c && (o = await
|
|
865
|
+
let o = He(n.data.data || n.data, r);
|
|
866
|
+
const c = As(o);
|
|
867
|
+
c && (o = await jn(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,20 +878,20 @@ const Kt = Oi("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 (Un())
|
|
882
|
+
return e || (this.requests = [], this.normalizeFolderAssignmentsState()), In();
|
|
883
883
|
const n = {
|
|
884
884
|
include_presence: 1,
|
|
885
885
|
filter: "requests"
|
|
886
886
|
};
|
|
887
887
|
e && (n.cursor = e);
|
|
888
|
-
const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } =
|
|
888
|
+
const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
|
|
889
889
|
r.data,
|
|
890
890
|
"conversations"
|
|
891
891
|
), u = o.map((h) => {
|
|
892
|
-
const
|
|
893
|
-
return
|
|
894
|
-
}), d = await
|
|
892
|
+
const P = this.requests.find((C) => C.id === h.id);
|
|
893
|
+
return He(h, P);
|
|
894
|
+
}), d = await $n(u);
|
|
895
895
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
896
896
|
const f = {
|
|
897
897
|
data: d,
|
|
@@ -914,14 +914,14 @@ const Kt = Oi("messaging", {
|
|
|
914
914
|
c = await X().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
|
|
915
915
|
break;
|
|
916
916
|
} catch (v) {
|
|
917
|
-
if (!(o <
|
|
917
|
+
if (!(o < So && xn(v)))
|
|
918
918
|
throw v;
|
|
919
|
-
o += 1, await
|
|
919
|
+
o += 1, await Ln(To(v));
|
|
920
920
|
}
|
|
921
|
-
const { items: u, nextCursor: d } =
|
|
921
|
+
const { items: u, nextCursor: d } = st(
|
|
922
922
|
c.data,
|
|
923
923
|
"messages"
|
|
924
|
-
), f = u.map(
|
|
924
|
+
), f = u.map(at), h = [...f].reverse();
|
|
925
925
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
926
926
|
const v = this.conversations.find((E) => E.id === e) ?? this.requests.find((E) => E.id === e);
|
|
927
927
|
return v ? !v.last_message || !v.last_message_at : !1;
|
|
@@ -942,13 +942,13 @@ const Kt = Oi("messaging", {
|
|
|
942
942
|
}
|
|
943
943
|
},
|
|
944
944
|
async sendMessage(e, n, r, o, c, u, d) {
|
|
945
|
-
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`,
|
|
945
|
+
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, P = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = xo(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: P ? { shared_post_id: P } : {},
|
|
952
952
|
...C ? { shared_post: C } : {},
|
|
953
953
|
is_deleted: !1,
|
|
954
954
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -965,13 +965,13 @@ const Kt = Oi("messaging", {
|
|
|
965
965
|
const A = {
|
|
966
966
|
body: n || "",
|
|
967
967
|
...o ? { reply_to_id: o } : {},
|
|
968
|
-
...
|
|
968
|
+
...P ? { shared_post_id: P } : {},
|
|
969
969
|
...C ? { shared_post_preview: C } : {}
|
|
970
970
|
};
|
|
971
971
|
if (r && r.length > 0) {
|
|
972
972
|
const W = await Promise.all(
|
|
973
973
|
r.map(async (te) => {
|
|
974
|
-
const k = await
|
|
974
|
+
const k = await uo().uploadImage(te);
|
|
975
975
|
return {
|
|
976
976
|
media_id: k.id,
|
|
977
977
|
mime: k.mime_type,
|
|
@@ -988,7 +988,7 @@ const Kt = Oi("messaging", {
|
|
|
988
988
|
...A,
|
|
989
989
|
type: "text"
|
|
990
990
|
});
|
|
991
|
-
const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m =
|
|
991
|
+
const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
|
|
992
992
|
O >= 0 && (y[O] = m), this._pendingSendIds.delete(h);
|
|
993
993
|
const z = m.id;
|
|
994
994
|
let J = 0;
|
|
@@ -1038,11 +1038,11 @@ const Kt = Oi("messaging", {
|
|
|
1038
1038
|
return null;
|
|
1039
1039
|
for (let u = c.length - 1; u >= 0; u -= 1) {
|
|
1040
1040
|
const d = c[u]?.id;
|
|
1041
|
-
if (
|
|
1041
|
+
if (qt(d))
|
|
1042
1042
|
return d;
|
|
1043
1043
|
}
|
|
1044
1044
|
return null;
|
|
1045
|
-
})(), o = n ?
|
|
1045
|
+
})(), o = n ? Fn(n, this.messages) : r;
|
|
1046
1046
|
if (!o)
|
|
1047
1047
|
return;
|
|
1048
1048
|
await X().post(`/v1/messaging/conversations/${e}/read`, {
|
|
@@ -1061,7 +1061,7 @@ const Kt = Oi("messaging", {
|
|
|
1061
1061
|
if (e.length === 0)
|
|
1062
1062
|
return;
|
|
1063
1063
|
const n = e.map((c) => {
|
|
1064
|
-
const u =
|
|
1064
|
+
const u = Fn(c, this.messages);
|
|
1065
1065
|
return u ? {
|
|
1066
1066
|
conversationId: c.id,
|
|
1067
1067
|
messageId: u
|
|
@@ -1093,9 +1093,9 @@ const Kt = Oi("messaging", {
|
|
|
1093
1093
|
async sendTyping(e, n = "start") {
|
|
1094
1094
|
try {
|
|
1095
1095
|
const r = await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1096
|
-
if (n !== "start" || !
|
|
1096
|
+
if (n !== "start" || !Eo(r.data))
|
|
1097
1097
|
return;
|
|
1098
|
-
await
|
|
1098
|
+
await Ln(Co), await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1099
1099
|
} catch (r) {
|
|
1100
1100
|
console.warn("Failed to send typing indicator:", r);
|
|
1101
1101
|
}
|
|
@@ -1133,11 +1133,11 @@ const Kt = Oi("messaging", {
|
|
|
1133
1133
|
},
|
|
1134
1134
|
async pinConversation(e, n) {
|
|
1135
1135
|
const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
|
|
1136
|
-
r && (r.is_pinned = n), this.conversations.sort(
|
|
1136
|
+
r && (r.is_pinned = n), this.conversations.sort(Xe);
|
|
1137
1137
|
try {
|
|
1138
1138
|
await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
1139
1139
|
} catch (c) {
|
|
1140
|
-
throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(
|
|
1140
|
+
throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Y(c), c;
|
|
1141
1141
|
}
|
|
1142
1142
|
},
|
|
1143
1143
|
async archiveConversation(e, n) {
|
|
@@ -1163,10 +1163,10 @@ const Kt = Oi("messaging", {
|
|
|
1163
1163
|
};
|
|
1164
1164
|
n && (r.message = n);
|
|
1165
1165
|
const o = await X().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
|
|
1166
|
-
if (!
|
|
1166
|
+
if (!Nn(c))
|
|
1167
1167
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1168
|
-
let u =
|
|
1169
|
-
return u = await
|
|
1168
|
+
let u = qn(c) && Kt(c, e) ? He(c) : await this.fetchConversation(c.id);
|
|
1169
|
+
return u = await jn(u, e), u.is_request === !0 ? (this.requests = rt(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = rt(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
|
|
1170
1170
|
} catch (r) {
|
|
1171
1171
|
throw this.error = Y(r), r;
|
|
1172
1172
|
}
|
|
@@ -1177,10 +1177,10 @@ const Kt = Oi("messaging", {
|
|
|
1177
1177
|
title: e,
|
|
1178
1178
|
participant_ids: n
|
|
1179
1179
|
}), o = r.data.data || r.data;
|
|
1180
|
-
if (!
|
|
1180
|
+
if (!Nn(o))
|
|
1181
1181
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1182
|
-
const c =
|
|
1183
|
-
return this.conversations =
|
|
1182
|
+
const c = qn(o) ? o : await this.fetchConversation(o.id);
|
|
1183
|
+
return this.conversations = rt(this.conversations, c), c;
|
|
1184
1184
|
} catch (r) {
|
|
1185
1185
|
throw this.error = Y(r), r;
|
|
1186
1186
|
}
|
|
@@ -1228,29 +1228,29 @@ const Kt = Oi("messaging", {
|
|
|
1228
1228
|
if (!n)
|
|
1229
1229
|
return;
|
|
1230
1230
|
this.messages[n] || (this.messages[n] = []);
|
|
1231
|
-
const r =
|
|
1232
|
-
if (o.find((
|
|
1231
|
+
const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1232
|
+
if (o.find((P) => P.id === r.id))
|
|
1233
1233
|
return;
|
|
1234
1234
|
const u = ke()();
|
|
1235
1235
|
if (r.author_id === u.currentUser?.id) {
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1238
|
-
const C = o[
|
|
1236
|
+
const P = o.findIndex((C) => C.id.startsWith("temp-"));
|
|
1237
|
+
if (P >= 0) {
|
|
1238
|
+
const C = o[P]?.id ?? "";
|
|
1239
1239
|
this.messages[n] = [
|
|
1240
|
-
...o.slice(0,
|
|
1240
|
+
...o.slice(0, P),
|
|
1241
1241
|
r,
|
|
1242
|
-
...o.slice(
|
|
1242
|
+
...o.slice(P + 1)
|
|
1243
1243
|
], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
|
|
1244
1244
|
return;
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
1247
|
const d = r.created_at;
|
|
1248
1248
|
let f = o.length;
|
|
1249
|
-
for (let
|
|
1250
|
-
const C = o[
|
|
1249
|
+
for (let P = o.length - 1; P >= 0; P--) {
|
|
1250
|
+
const C = o[P];
|
|
1251
1251
|
if (C && C.created_at <= d)
|
|
1252
1252
|
break;
|
|
1253
|
-
f =
|
|
1253
|
+
f = P;
|
|
1254
1254
|
}
|
|
1255
1255
|
const h = f === o.length;
|
|
1256
1256
|
this.messages[n] = [
|
|
@@ -1265,8 +1265,8 @@ const Kt = Oi("messaging", {
|
|
|
1265
1265
|
},
|
|
1266
1266
|
removeMessage(e, n) {
|
|
1267
1267
|
const r = (h) => {
|
|
1268
|
-
const
|
|
1269
|
-
return delete
|
|
1268
|
+
const P = { ...h, is_deleted: !0 };
|
|
1269
|
+
return delete P.body, P;
|
|
1270
1270
|
};
|
|
1271
1271
|
let o = null;
|
|
1272
1272
|
const c = this.conversations.find((h) => h.id === e);
|
|
@@ -1296,17 +1296,17 @@ const Kt = Oi("messaging", {
|
|
|
1296
1296
|
try {
|
|
1297
1297
|
f = await X().post(o, c);
|
|
1298
1298
|
} catch (v) {
|
|
1299
|
-
if (!
|
|
1299
|
+
if (!Fo(v))
|
|
1300
1300
|
throw v;
|
|
1301
1301
|
f = await X().post(o, c);
|
|
1302
1302
|
}
|
|
1303
|
-
const h =
|
|
1304
|
-
|
|
1303
|
+
const h = le(f.data) && "data" in f.data ? f.data.data : f.data, P = Dn(
|
|
1304
|
+
le(h) ? h.reactions : void 0
|
|
1305
1305
|
);
|
|
1306
|
-
(
|
|
1306
|
+
(P.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, P);
|
|
1307
1307
|
try {
|
|
1308
|
-
const v = await X().get(o), E =
|
|
1309
|
-
|
|
1308
|
+
const v = await X().get(o), E = le(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
|
|
1309
|
+
le(E) ? E.reactions : void 0
|
|
1310
1310
|
);
|
|
1311
1311
|
this.updateMessageReactions(e, n, b);
|
|
1312
1312
|
} catch {
|
|
@@ -1335,8 +1335,8 @@ const Kt = Oi("messaging", {
|
|
|
1335
1335
|
if (!f) return;
|
|
1336
1336
|
const h = { ...f };
|
|
1337
1337
|
r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), u[d] = h;
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1338
|
+
const P = this.conversations.find((v) => v.id === e);
|
|
1339
|
+
P?.last_message?.id === n && (P.last_message = h);
|
|
1340
1340
|
const C = this.requests.find((v) => v.id === e);
|
|
1341
1341
|
C?.last_message?.id === n && (C.last_message = h);
|
|
1342
1342
|
},
|
|
@@ -1352,7 +1352,7 @@ const Kt = Oi("messaging", {
|
|
|
1352
1352
|
const d = u.find((f) => f.id === e);
|
|
1353
1353
|
return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
|
|
1354
1354
|
}, o = r(this.conversations), c = r(this.requests);
|
|
1355
|
-
o && this.conversations.sort(
|
|
1355
|
+
o && this.conversations.sort(Xe), c && this.requests.sort(Xe);
|
|
1356
1356
|
},
|
|
1357
1357
|
updatePresenceForUser(e, n, r) {
|
|
1358
1358
|
const o = n === "online" || n === "idle" || n === "dnd", c = (u) => {
|
|
@@ -1371,7 +1371,7 @@ const Kt = Oi("messaging", {
|
|
|
1371
1371
|
params: { ids: n }
|
|
1372
1372
|
}), o = r.data?.data?.items ?? r.data?.items ?? [];
|
|
1373
1373
|
for (const c of o) {
|
|
1374
|
-
const u =
|
|
1374
|
+
const u = Nt(c);
|
|
1375
1375
|
u.status !== null && this.updatePresenceForUser(c.id, u.status, u.lastSeenAt);
|
|
1376
1376
|
}
|
|
1377
1377
|
},
|
|
@@ -1379,13 +1379,13 @@ const Kt = Oi("messaging", {
|
|
|
1379
1379
|
try {
|
|
1380
1380
|
const n = await Pe.acceptRequest(e);
|
|
1381
1381
|
this.requests = this.requests.filter((o) => o.id !== e);
|
|
1382
|
-
const r =
|
|
1382
|
+
const r = He({
|
|
1383
1383
|
...n,
|
|
1384
1384
|
is_pinned: n.is_pinned ?? !1,
|
|
1385
1385
|
is_archived: n.is_archived ?? !1,
|
|
1386
1386
|
is_muted: n.is_muted ?? !1
|
|
1387
1387
|
});
|
|
1388
|
-
this.conversations =
|
|
1388
|
+
this.conversations = rt(this.conversations, r);
|
|
1389
1389
|
} catch (n) {
|
|
1390
1390
|
throw this.error = Y(n), n;
|
|
1391
1391
|
}
|
|
@@ -1404,7 +1404,7 @@ const Kt = Oi("messaging", {
|
|
|
1404
1404
|
n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
|
|
1405
1405
|
const c = await X().get("/v1/messaging/conversations", {
|
|
1406
1406
|
params: o
|
|
1407
|
-
}), { items: u } =
|
|
1407
|
+
}), { items: u } = st(
|
|
1408
1408
|
c.data,
|
|
1409
1409
|
"conversations"
|
|
1410
1410
|
);
|
|
@@ -1464,16 +1464,16 @@ const Kt = Oi("messaging", {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
function oc(e) {
|
|
1467
|
-
const n =
|
|
1467
|
+
const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = zt(), f = d !== null, h = 20, P = 250;
|
|
1468
1468
|
let C = 0, v = null, E = null;
|
|
1469
|
-
const b = se(() => r.currentUser?.id), A = () =>
|
|
1469
|
+
const b = se(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
|
|
1470
1470
|
function w() {
|
|
1471
1471
|
v && (clearTimeout(v), v = null), C = 0;
|
|
1472
1472
|
}
|
|
1473
1473
|
function p() {
|
|
1474
1474
|
!f || o.value || v || C >= h || (v = setTimeout(() => {
|
|
1475
1475
|
v = null, C += 1, I();
|
|
1476
|
-
},
|
|
1476
|
+
}, P));
|
|
1477
1477
|
}
|
|
1478
1478
|
function m(_) {
|
|
1479
1479
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
@@ -1507,7 +1507,7 @@ function oc(e) {
|
|
|
1507
1507
|
function W(_) {
|
|
1508
1508
|
const L = n.getConversationById(_.conversation_id);
|
|
1509
1509
|
L && (L.is_request = !1), n.requests = n.requests.filter(
|
|
1510
|
-
(
|
|
1510
|
+
(he) => he.id !== _.conversation_id
|
|
1511
1511
|
);
|
|
1512
1512
|
}
|
|
1513
1513
|
function te(_) {
|
|
@@ -1516,7 +1516,7 @@ function oc(e) {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
function k(_) {
|
|
1518
1518
|
const L = u.value;
|
|
1519
|
-
E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) &&
|
|
1519
|
+
E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Xi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
|
|
1520
1520
|
}
|
|
1521
1521
|
function I() {
|
|
1522
1522
|
const _ = A();
|
|
@@ -1527,7 +1527,7 @@ function oc(e) {
|
|
|
1527
1527
|
}
|
|
1528
1528
|
c.value = null;
|
|
1529
1529
|
try {
|
|
1530
|
-
E =
|
|
1530
|
+
E = Vi(_, {
|
|
1531
1531
|
onMessageSent: m,
|
|
1532
1532
|
onMessageRead: y,
|
|
1533
1533
|
onMessageEdited: O,
|
|
@@ -1544,8 +1544,8 @@ function oc(e) {
|
|
|
1544
1544
|
function K() {
|
|
1545
1545
|
o.value || I();
|
|
1546
1546
|
}
|
|
1547
|
-
typeof window < "u" && window.addEventListener(
|
|
1548
|
-
const V =
|
|
1547
|
+
typeof window < "u" && window.addEventListener(Je(), K);
|
|
1548
|
+
const V = ht((_) => {
|
|
1549
1549
|
if (_ === "connected") {
|
|
1550
1550
|
o.value || I();
|
|
1551
1551
|
return;
|
|
@@ -1560,7 +1560,7 @@ function oc(e) {
|
|
|
1560
1560
|
c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1561
1561
|
}
|
|
1562
1562
|
}
|
|
1563
|
-
return
|
|
1563
|
+
return ot(
|
|
1564
1564
|
() => A(),
|
|
1565
1565
|
(_, L) => {
|
|
1566
1566
|
if (_ !== L) {
|
|
@@ -1572,7 +1572,7 @@ function oc(e) {
|
|
|
1572
1572
|
}
|
|
1573
1573
|
}
|
|
1574
1574
|
), d !== null && qe(() => {
|
|
1575
|
-
w(), V(), G(), typeof window < "u" && window.removeEventListener(
|
|
1575
|
+
w(), V(), G(), typeof window < "u" && window.removeEventListener(Je(), K);
|
|
1576
1576
|
}), {
|
|
1577
1577
|
isSubscribed: se(() => o.value),
|
|
1578
1578
|
error: se(() => c.value),
|
|
@@ -1580,19 +1580,19 @@ function oc(e) {
|
|
|
1580
1580
|
unsubscribe: G
|
|
1581
1581
|
};
|
|
1582
1582
|
}
|
|
1583
|
-
const
|
|
1584
|
-
},
|
|
1583
|
+
const Ps = () => () => {
|
|
1584
|
+
}, Ms = async () => {
|
|
1585
1585
|
}, ye = {
|
|
1586
1586
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1587
1587
|
getEcho: () => null,
|
|
1588
1588
|
getConnectionStatus: () => "disconnected",
|
|
1589
|
-
onConnectionStatusChange:
|
|
1590
|
-
reconnect:
|
|
1589
|
+
onConnectionStatusChange: Ps,
|
|
1590
|
+
reconnect: Ms
|
|
1591
1591
|
};
|
|
1592
|
-
function
|
|
1592
|
+
function ct() {
|
|
1593
1593
|
return ye.initializedEvent;
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function ut() {
|
|
1596
1596
|
return ye.getEcho();
|
|
1597
1597
|
}
|
|
1598
1598
|
function $o() {
|
|
@@ -1608,7 +1608,7 @@ function Vo(e) {
|
|
|
1608
1608
|
e.initializedEvent && (ye.initializedEvent = e.initializedEvent), e.getEcho && (ye.getEcho = e.getEcho), e.getConnectionStatus && (ye.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (ye.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (ye.reconnect = e.reconnect);
|
|
1609
1609
|
}
|
|
1610
1610
|
function Xo() {
|
|
1611
|
-
ye.initializedEvent = "messenger-client:main-echo-initialized", ye.getEcho = () => null, ye.getConnectionStatus = () => "disconnected", ye.onConnectionStatusChange =
|
|
1611
|
+
ye.initializedEvent = "messenger-client:main-echo-initialized", ye.getEcho = () => null, ye.getConnectionStatus = () => "disconnected", ye.onConnectionStatusChange = Ps, ye.reconnect = Ms;
|
|
1612
1612
|
}
|
|
1613
1613
|
const Wo = {
|
|
1614
1614
|
debug: () => {
|
|
@@ -1619,16 +1619,16 @@ const Wo = {
|
|
|
1619
1619
|
},
|
|
1620
1620
|
error: () => {
|
|
1621
1621
|
}
|
|
1622
|
-
},
|
|
1623
|
-
let
|
|
1624
|
-
function
|
|
1625
|
-
return
|
|
1622
|
+
}, ks = () => Wo;
|
|
1623
|
+
let Yt = ks;
|
|
1624
|
+
function Zt() {
|
|
1625
|
+
return Yt;
|
|
1626
1626
|
}
|
|
1627
1627
|
function Go(e) {
|
|
1628
|
-
|
|
1628
|
+
Yt = e;
|
|
1629
1629
|
}
|
|
1630
1630
|
function Jo() {
|
|
1631
|
-
|
|
1631
|
+
Yt = ks;
|
|
1632
1632
|
}
|
|
1633
1633
|
const Ko = {
|
|
1634
1634
|
connected: "",
|
|
@@ -1636,33 +1636,33 @@ const Ko = {
|
|
|
1636
1636
|
disconnected: "",
|
|
1637
1637
|
error: "",
|
|
1638
1638
|
unknown: ""
|
|
1639
|
-
},
|
|
1640
|
-
function
|
|
1639
|
+
}, Vn = Zt()("ConnectionStatus");
|
|
1640
|
+
function Xn(e) {
|
|
1641
1641
|
return e?.connector?.pusher?.connection ?? null;
|
|
1642
1642
|
}
|
|
1643
1643
|
function Qo(e) {
|
|
1644
1644
|
return e === "messenger" ? {
|
|
1645
|
-
initializedEvent:
|
|
1646
|
-
getConnectionStatus:
|
|
1647
|
-
onConnectionStatusChange:
|
|
1648
|
-
reconnect:
|
|
1649
|
-
getEchoConnection: () =>
|
|
1645
|
+
initializedEvent: Je(),
|
|
1646
|
+
getConnectionStatus: vs,
|
|
1647
|
+
onConnectionStatusChange: ht,
|
|
1648
|
+
reconnect: $i,
|
|
1649
|
+
getEchoConnection: () => Xn(Ae())
|
|
1650
1650
|
} : {
|
|
1651
|
-
initializedEvent:
|
|
1651
|
+
initializedEvent: ct(),
|
|
1652
1652
|
getConnectionStatus: $o,
|
|
1653
1653
|
onConnectionStatusChange: Ho,
|
|
1654
1654
|
reconnect: Bo,
|
|
1655
|
-
getEchoConnection: () =>
|
|
1655
|
+
getEchoConnection: () => Xn(ut())
|
|
1656
1656
|
};
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1658
|
+
function Wn(e) {
|
|
1659
1659
|
return e.getEchoConnection()?.state ?? null;
|
|
1660
1660
|
}
|
|
1661
1661
|
function ac(e = {}) {
|
|
1662
1662
|
const o = Qo(e.source ?? "app"), c = {
|
|
1663
1663
|
...Ko,
|
|
1664
1664
|
...e.icons
|
|
1665
|
-
}, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1),
|
|
1665
|
+
}, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), P = be(!1), C = be(!1), v = be(!1);
|
|
1666
1666
|
let E = null, b = null, A = null, w = null, p = null, m = null, y = null;
|
|
1667
1667
|
const O = se(() => u.value === "connected"), z = se(() => u.value === "connecting"), J = se(() => u.value === "disconnected"), W = se(() => u.value === "error"), te = se(() => J.value || W.value), k = se(() => {
|
|
1668
1668
|
switch (u.value) {
|
|
@@ -1703,10 +1703,10 @@ function ac(e = {}) {
|
|
|
1703
1703
|
return c.unknown;
|
|
1704
1704
|
}
|
|
1705
1705
|
}), V = async () => {
|
|
1706
|
-
|
|
1706
|
+
Vn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1707
1707
|
}, G = (B, D = u.value) => {
|
|
1708
1708
|
if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
|
|
1709
|
-
const q = !v.value && D === B, _e = !
|
|
1709
|
+
const q = !v.value && D === B, _e = !P.value && (q || D === "connected" || D === "connecting");
|
|
1710
1710
|
if (C.value = !0, _e) {
|
|
1711
1711
|
h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
|
|
1712
1712
|
A = null, u.value !== "connected" && (h.value = !0);
|
|
@@ -1717,11 +1717,11 @@ function ac(e = {}) {
|
|
|
1717
1717
|
return;
|
|
1718
1718
|
}
|
|
1719
1719
|
if (B === "connected") {
|
|
1720
|
-
A && (clearTimeout(A), A = null), h.value = !1,
|
|
1720
|
+
A && (clearTimeout(A), A = null), h.value = !1, P.value = !1, C.value = !1;
|
|
1721
1721
|
return;
|
|
1722
1722
|
}
|
|
1723
1723
|
if (B === "connecting") {
|
|
1724
|
-
if (A && (clearTimeout(A), A = null),
|
|
1724
|
+
if (A && (clearTimeout(A), A = null), P.value) {
|
|
1725
1725
|
h.value = !0;
|
|
1726
1726
|
return;
|
|
1727
1727
|
}
|
|
@@ -1729,23 +1729,23 @@ function ac(e = {}) {
|
|
|
1729
1729
|
return;
|
|
1730
1730
|
b = setTimeout(() => {
|
|
1731
1731
|
if (b = null, u.value === "connecting") {
|
|
1732
|
-
if (
|
|
1732
|
+
if (Wn(o) === "connected") {
|
|
1733
1733
|
_("connected");
|
|
1734
1734
|
return;
|
|
1735
1735
|
}
|
|
1736
|
-
|
|
1736
|
+
P.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1737
1737
|
}
|
|
1738
1738
|
}, 1e4);
|
|
1739
1739
|
}
|
|
1740
1740
|
}, _ = (B) => {
|
|
1741
1741
|
const D = u.value;
|
|
1742
|
-
if (B === "connecting" &&
|
|
1742
|
+
if (B === "connecting" && P.value) {
|
|
1743
1743
|
u.value = "disconnected", G("disconnected", D);
|
|
1744
1744
|
return;
|
|
1745
1745
|
}
|
|
1746
1746
|
u.value = B, B === "connecting" && (D === "disconnected" || D === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), G(B, D);
|
|
1747
1747
|
}, L = () => {
|
|
1748
|
-
const B =
|
|
1748
|
+
const B = Wn(o), D = u.value;
|
|
1749
1749
|
if (B === "connected" && D !== "connected") {
|
|
1750
1750
|
_("connected");
|
|
1751
1751
|
return;
|
|
@@ -1760,7 +1760,7 @@ function ac(e = {}) {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
const q = o.getConnectionStatus();
|
|
1762
1762
|
!B && q === "connected" && D !== "connected" && _("connected");
|
|
1763
|
-
},
|
|
1763
|
+
}, he = () => {
|
|
1764
1764
|
if (p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = o.getEchoConnection(), y = null, !p?.bind)
|
|
1765
1765
|
return;
|
|
1766
1766
|
y = {
|
|
@@ -1798,9 +1798,9 @@ function ac(e = {}) {
|
|
|
1798
1798
|
const B = Date.now() - d.value.getTime(), D = Math.floor(B / 6e4), q = Math.floor(B % 6e4 / 1e3);
|
|
1799
1799
|
return D > 0 ? `${D}m ${q}s` : `${q}s`;
|
|
1800
1800
|
});
|
|
1801
|
-
return
|
|
1802
|
-
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0,
|
|
1803
|
-
|
|
1801
|
+
return jt(() => {
|
|
1802
|
+
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, he(), m = () => {
|
|
1803
|
+
he(), L();
|
|
1804
1804
|
}, window.addEventListener(o.initializedEvent, m), L(), w = setInterval(() => {
|
|
1805
1805
|
L();
|
|
1806
1806
|
}, 3e3);
|
|
@@ -1823,25 +1823,25 @@ function ac(e = {}) {
|
|
|
1823
1823
|
reconnect: V
|
|
1824
1824
|
};
|
|
1825
1825
|
}
|
|
1826
|
-
const
|
|
1826
|
+
const xs = () => {
|
|
1827
1827
|
};
|
|
1828
|
-
let
|
|
1828
|
+
let en = xs;
|
|
1829
1829
|
function Yo() {
|
|
1830
|
-
return
|
|
1830
|
+
return en;
|
|
1831
1831
|
}
|
|
1832
1832
|
function Zo(e) {
|
|
1833
|
-
|
|
1833
|
+
en = e;
|
|
1834
1834
|
}
|
|
1835
1835
|
function ea() {
|
|
1836
|
-
|
|
1836
|
+
en = xs;
|
|
1837
1837
|
}
|
|
1838
|
-
const Me =
|
|
1838
|
+
const Me = Zt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1839
1839
|
function cc() {
|
|
1840
|
-
const e =
|
|
1840
|
+
const e = Qt(), n = ke()(), r = Yo(), o = Vt(), c = zi(), u = zt(), { conversations: d, requestConversations: f } = Ni(e), h = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map();
|
|
1841
1841
|
let C = !1;
|
|
1842
1842
|
function v(k) {
|
|
1843
|
-
const I =
|
|
1844
|
-
if (I && (
|
|
1843
|
+
const I = P.get(k);
|
|
1844
|
+
if (I && (P.delete(k), typeof I.channel.stopListening == "function"))
|
|
1845
1845
|
for (const K of I.bindings)
|
|
1846
1846
|
try {
|
|
1847
1847
|
I.channel.stopListening(K.event, K.handler);
|
|
@@ -1859,7 +1859,7 @@ function cc() {
|
|
|
1859
1859
|
const K = `conversation.${k}`;
|
|
1860
1860
|
v(k);
|
|
1861
1861
|
const V = I.private(K), G = (D) => {
|
|
1862
|
-
if (!
|
|
1862
|
+
if (!Qi(D)) {
|
|
1863
1863
|
Me.warn("Dropping malformed ConversationMessageSent event", D);
|
|
1864
1864
|
return;
|
|
1865
1865
|
}
|
|
@@ -1868,31 +1868,31 @@ function cc() {
|
|
|
1868
1868
|
e.addMessage(q.message);
|
|
1869
1869
|
const M = e.hasDetailSubscription(q.conversation_id), F = sa(q.conversation_id);
|
|
1870
1870
|
if (M || F) {
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1871
|
+
const ie = e.getConversationById(q.conversation_id);
|
|
1872
|
+
ie && (ie.unread_count = 0), e.markAsRead(q.conversation_id).catch(() => {
|
|
1873
1873
|
});
|
|
1874
1874
|
return;
|
|
1875
1875
|
}
|
|
1876
1876
|
const Z = e.getConversationById(q.conversation_id);
|
|
1877
1877
|
if (Z) {
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1878
|
+
const ie = ra(Z);
|
|
1879
|
+
ie || Z.unread_count++, r(ie);
|
|
1880
1880
|
}
|
|
1881
1881
|
}, _ = (D) => {
|
|
1882
|
-
if (!
|
|
1882
|
+
if (!Yi(D)) {
|
|
1883
1883
|
Me.warn("Dropping malformed ConversationMessageRead event", D);
|
|
1884
1884
|
return;
|
|
1885
1885
|
}
|
|
1886
1886
|
e.applyParticipantReadState(D);
|
|
1887
1887
|
}, L = (D) => {
|
|
1888
|
-
if (!
|
|
1888
|
+
if (!to(D)) {
|
|
1889
1889
|
Me.warn("Dropping malformed MessageReactionToggled event", D);
|
|
1890
1890
|
return;
|
|
1891
1891
|
}
|
|
1892
1892
|
const q = D;
|
|
1893
1893
|
e.updateMessageReactions(q.conversation_id, q.message_id, q.reactions);
|
|
1894
|
-
},
|
|
1895
|
-
if (!
|
|
1894
|
+
}, he = (D) => {
|
|
1895
|
+
if (!Zi(D)) {
|
|
1896
1896
|
Me.warn("Dropping malformed ConversationMessageEdited event", D);
|
|
1897
1897
|
return;
|
|
1898
1898
|
}
|
|
@@ -1905,14 +1905,14 @@ function cc() {
|
|
|
1905
1905
|
q.message.meta
|
|
1906
1906
|
);
|
|
1907
1907
|
}, Se = (D) => {
|
|
1908
|
-
if (!
|
|
1908
|
+
if (!eo(D)) {
|
|
1909
1909
|
Me.warn("Dropping malformed ConversationMessageDeleted event", D);
|
|
1910
1910
|
return;
|
|
1911
1911
|
}
|
|
1912
1912
|
const q = D;
|
|
1913
1913
|
e.removeMessage(q.conversation_id, q.message_id);
|
|
1914
1914
|
}, B = (D) => {
|
|
1915
|
-
if (!
|
|
1915
|
+
if (!no(D)) {
|
|
1916
1916
|
Me.warn("Dropping malformed ConversationRequestAccepted event", D);
|
|
1917
1917
|
return;
|
|
1918
1918
|
}
|
|
@@ -1921,12 +1921,12 @@ function cc() {
|
|
|
1921
1921
|
(M) => M.id !== q.conversation_id
|
|
1922
1922
|
);
|
|
1923
1923
|
};
|
|
1924
|
-
V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited",
|
|
1924
|
+
V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", he), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), P.set(k, {
|
|
1925
1925
|
channel: V,
|
|
1926
1926
|
bindings: [
|
|
1927
1927
|
{ event: ".ConversationMessageSent", handler: G },
|
|
1928
1928
|
{ event: ".ConversationMessageRead", handler: _ },
|
|
1929
|
-
{ event: ".ConversationMessageEdited", handler:
|
|
1929
|
+
{ event: ".ConversationMessageEdited", handler: he },
|
|
1930
1930
|
{ event: ".ConversationMessageDeleted", handler: Se },
|
|
1931
1931
|
{ event: ".MessageReactionToggled", handler: L },
|
|
1932
1932
|
{ event: ".ConversationRequestAccepted", handler: B }
|
|
@@ -1971,7 +1971,7 @@ function cc() {
|
|
|
1971
1971
|
b(V.id);
|
|
1972
1972
|
}
|
|
1973
1973
|
function p(k) {
|
|
1974
|
-
const I =
|
|
1974
|
+
const I = Nt({
|
|
1975
1975
|
status: k.status,
|
|
1976
1976
|
last_seen_at: k.last_seen_at ?? null
|
|
1977
1977
|
});
|
|
@@ -1991,7 +1991,7 @@ function cc() {
|
|
|
1991
1991
|
params: { ids: k }
|
|
1992
1992
|
}), K = I.data?.data?.items ?? I.data?.items ?? [];
|
|
1993
1993
|
for (const V of K) {
|
|
1994
|
-
const G =
|
|
1994
|
+
const G = Nt(V);
|
|
1995
1995
|
G.status !== null && e.updatePresenceForUser(V.id, G.status, G.lastSeenAt);
|
|
1996
1996
|
}
|
|
1997
1997
|
} catch (I) {
|
|
@@ -1999,32 +1999,32 @@ function cc() {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
}
|
|
2001
2001
|
function y() {
|
|
2002
|
-
!Ae() || C || (
|
|
2002
|
+
!Ae() || C || (Hi(p), C = !0);
|
|
2003
2003
|
}
|
|
2004
2004
|
function O() {
|
|
2005
|
-
C && (
|
|
2005
|
+
C && (Bi(), C = !1);
|
|
2006
2006
|
}
|
|
2007
|
-
const z =
|
|
2007
|
+
const z = ot(
|
|
2008
2008
|
d,
|
|
2009
2009
|
() => {
|
|
2010
2010
|
w();
|
|
2011
2011
|
},
|
|
2012
2012
|
{ deep: !1, immediate: !0 }
|
|
2013
|
-
), J =
|
|
2013
|
+
), J = ot(
|
|
2014
2014
|
f,
|
|
2015
2015
|
() => {
|
|
2016
2016
|
w();
|
|
2017
2017
|
},
|
|
2018
2018
|
{ deep: !1, immediate: !0 }
|
|
2019
|
-
), W =
|
|
2019
|
+
), W = ot(
|
|
2020
2020
|
() => c.fullPath,
|
|
2021
2021
|
() => {
|
|
2022
2022
|
w();
|
|
2023
2023
|
}
|
|
2024
|
-
), te =
|
|
2024
|
+
), te = ht((k) => {
|
|
2025
2025
|
k === "connected" ? (E(), w(), O(), y(), m()) : (k === "disconnected" || k === "error") && (E(), O());
|
|
2026
2026
|
});
|
|
2027
|
-
w(), y(), m(), Ae() ||
|
|
2027
|
+
w(), y(), m(), Ae() || ms().then((k) => {
|
|
2028
2028
|
k && (E(), w(), O(), y(), m());
|
|
2029
2029
|
}).catch((k) => {
|
|
2030
2030
|
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
@@ -2033,10 +2033,10 @@ function cc() {
|
|
|
2033
2033
|
});
|
|
2034
2034
|
}
|
|
2035
2035
|
function uc() {
|
|
2036
|
-
const e = be(
|
|
2036
|
+
const e = be(Ot());
|
|
2037
2037
|
let n = null;
|
|
2038
|
-
return
|
|
2039
|
-
e.value =
|
|
2038
|
+
return jt(() => {
|
|
2039
|
+
e.value = Ot(), n = ji((r) => {
|
|
2040
2040
|
e.value = r;
|
|
2041
2041
|
});
|
|
2042
2042
|
}), qe(() => {
|
|
@@ -2047,7 +2047,7 @@ function uc() {
|
|
|
2047
2047
|
isSuspended: se(() => e.value === "account_suspended")
|
|
2048
2048
|
};
|
|
2049
2049
|
}
|
|
2050
|
-
const
|
|
2050
|
+
const Ls = () => null, Is = {
|
|
2051
2051
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
2052
2052
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
2053
2053
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -2058,33 +2058,33 @@ const ks = () => null, xs = {
|
|
|
2058
2058
|
activityDebounceMs: 5e3,
|
|
2059
2059
|
heartbeatIntervalMs: 3e4,
|
|
2060
2060
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
2061
|
-
authTokenResolver:
|
|
2061
|
+
authTokenResolver: Ls
|
|
2062
2062
|
};
|
|
2063
|
-
let
|
|
2063
|
+
let lt = { ...Is };
|
|
2064
2064
|
function ia() {
|
|
2065
|
-
return
|
|
2065
|
+
return lt;
|
|
2066
2066
|
}
|
|
2067
2067
|
function oa(e) {
|
|
2068
|
-
|
|
2069
|
-
...
|
|
2068
|
+
lt = {
|
|
2069
|
+
...lt,
|
|
2070
2070
|
...e
|
|
2071
2071
|
};
|
|
2072
2072
|
}
|
|
2073
2073
|
function aa() {
|
|
2074
|
-
|
|
2074
|
+
lt = { ...Is };
|
|
2075
2075
|
}
|
|
2076
2076
|
function ca(e) {
|
|
2077
|
-
return e.authTokenResolver !==
|
|
2077
|
+
return e.authTokenResolver !== Ls;
|
|
2078
2078
|
}
|
|
2079
2079
|
const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
|
|
2080
|
-
function
|
|
2080
|
+
function We(e) {
|
|
2081
2081
|
return typeof e == "object" && e !== null;
|
|
2082
2082
|
}
|
|
2083
|
-
function
|
|
2084
|
-
if (!
|
|
2083
|
+
function Us(e) {
|
|
2084
|
+
if (!We(e))
|
|
2085
2085
|
return null;
|
|
2086
2086
|
const n = e.response;
|
|
2087
|
-
if (!
|
|
2087
|
+
if (!We(n))
|
|
2088
2088
|
return null;
|
|
2089
2089
|
const r = n.status;
|
|
2090
2090
|
if (typeof r == "number")
|
|
@@ -2095,49 +2095,49 @@ function Ls(e) {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
return null;
|
|
2097
2097
|
}
|
|
2098
|
-
function
|
|
2099
|
-
if (!
|
|
2098
|
+
function Os(e) {
|
|
2099
|
+
if (!We(e))
|
|
2100
2100
|
return null;
|
|
2101
2101
|
const n = e.response;
|
|
2102
|
-
if (!
|
|
2102
|
+
if (!We(n))
|
|
2103
2103
|
return null;
|
|
2104
2104
|
const r = n.data;
|
|
2105
|
-
return
|
|
2105
|
+
return We(r) && typeof r.code == "string" ? r.code : null;
|
|
2106
2106
|
}
|
|
2107
|
-
function
|
|
2108
|
-
const n =
|
|
2107
|
+
function xt(e) {
|
|
2108
|
+
const n = Us(e), r = Os(e);
|
|
2109
2109
|
return n === ua && r === ha || n === da && r === pa;
|
|
2110
2110
|
}
|
|
2111
|
-
function
|
|
2112
|
-
const n =
|
|
2111
|
+
function Lt(e) {
|
|
2112
|
+
const n = Us(e), r = Os(e);
|
|
2113
2113
|
return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Ke() {
|
|
2116
2116
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
2117
2117
|
}
|
|
2118
2118
|
function va(e) {
|
|
2119
|
-
const n =
|
|
2119
|
+
const n = Ke(), r = n?.getItem(e);
|
|
2120
2120
|
if (r)
|
|
2121
2121
|
return r;
|
|
2122
2122
|
const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
2123
2123
|
return n?.setItem(e, o), o;
|
|
2124
2124
|
}
|
|
2125
2125
|
function ba(e) {
|
|
2126
|
-
const n =
|
|
2126
|
+
const n = Ke(), r = n?.getItem(e);
|
|
2127
2127
|
if (!r)
|
|
2128
2128
|
return null;
|
|
2129
2129
|
const o = Number.parseInt(r, 10);
|
|
2130
2130
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
2131
2131
|
}
|
|
2132
|
-
function
|
|
2133
|
-
const r =
|
|
2132
|
+
function It(e, n = Date.now()) {
|
|
2133
|
+
const r = Ke(), o = ba(e);
|
|
2134
2134
|
return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
|
|
2135
2135
|
}
|
|
2136
2136
|
function ya(e, n = Date.now()) {
|
|
2137
|
-
|
|
2137
|
+
Ke()?.setItem(e, String(n + ma));
|
|
2138
2138
|
}
|
|
2139
2139
|
function _a(e) {
|
|
2140
|
-
|
|
2140
|
+
Ke()?.removeItem(e);
|
|
2141
2141
|
}
|
|
2142
2142
|
function Sa(e) {
|
|
2143
2143
|
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
@@ -2185,8 +2185,8 @@ function Ta(e, n, r) {
|
|
|
2185
2185
|
}
|
|
2186
2186
|
}
|
|
2187
2187
|
function lc() {
|
|
2188
|
-
const e = ke()(), n = ia(), r =
|
|
2189
|
-
let c = null, u = null, d = !1, f =
|
|
2188
|
+
const e = ke()(), n = ia(), r = Vt(), o = va(n.clientIdStorageKey);
|
|
2189
|
+
let c = null, u = null, d = !1, f = It(n.accountLimitedUntilStorageKey), h = !1, P = !1, C = null, v = 0;
|
|
2190
2190
|
const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2191
2191
|
c && (clearInterval(c), c = null);
|
|
2192
2192
|
}, A = () => {
|
|
@@ -2198,22 +2198,22 @@ function lc() {
|
|
|
2198
2198
|
}, p = (L) => {
|
|
2199
2199
|
f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
|
|
2200
2200
|
}, m = async (L) => {
|
|
2201
|
-
if (!(!d ||
|
|
2201
|
+
if (!(!d || P || f || h) && E() && C !== L)
|
|
2202
2202
|
try {
|
|
2203
2203
|
await r.patch(n.statusUrl, { status: L }), C = L;
|
|
2204
|
-
} catch (
|
|
2205
|
-
if (
|
|
2204
|
+
} catch (he) {
|
|
2205
|
+
if (xt(he)) {
|
|
2206
2206
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2207
2207
|
return;
|
|
2208
2208
|
}
|
|
2209
|
-
|
|
2209
|
+
Lt(he) && (h = !0, d = !1, C = null, b(), A());
|
|
2210
2210
|
}
|
|
2211
2211
|
}, y = () => {
|
|
2212
|
-
A(), !(!d ||
|
|
2212
|
+
A(), !(!d || P || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
2213
2213
|
u = null, m("idle");
|
|
2214
2214
|
}, n.idleAfterMs));
|
|
2215
2215
|
}, O = () => {
|
|
2216
|
-
if (
|
|
2216
|
+
if (P || !d || f || h || document.visibilityState !== "visible")
|
|
2217
2217
|
return;
|
|
2218
2218
|
const L = Date.now();
|
|
2219
2219
|
L - v < n.activityDebounceMs || (v = L, m("online"), y());
|
|
@@ -2224,7 +2224,7 @@ function lc() {
|
|
|
2224
2224
|
}, W = () => {
|
|
2225
2225
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", z), document.removeEventListener("keydown", z), document.removeEventListener("touchstart", z), window.removeEventListener("focus", z));
|
|
2226
2226
|
}, te = async () => {
|
|
2227
|
-
if (
|
|
2227
|
+
if (It(n.accountLimitedUntilStorageKey))
|
|
2228
2228
|
return f = !0, "account_limited";
|
|
2229
2229
|
try {
|
|
2230
2230
|
return await r.post(n.sessionOpenUrl, {
|
|
@@ -2232,7 +2232,7 @@ function lc() {
|
|
|
2232
2232
|
user_agent: n.userAgentResolver()
|
|
2233
2233
|
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
|
|
2234
2234
|
} catch (L) {
|
|
2235
|
-
return
|
|
2235
|
+
return xt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(L) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
|
|
2236
2236
|
}
|
|
2237
2237
|
}, k = async () => {
|
|
2238
2238
|
for (let L = 0; L < ga; L += 1)
|
|
@@ -2244,11 +2244,11 @@ function lc() {
|
|
|
2244
2244
|
try {
|
|
2245
2245
|
await r.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2246
2246
|
} catch (L) {
|
|
2247
|
-
if (
|
|
2247
|
+
if (xt(L)) {
|
|
2248
2248
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2249
2249
|
return;
|
|
2250
2250
|
}
|
|
2251
|
-
|
|
2251
|
+
Lt(L) && (h = !0, d = !1, C = null, b(), A());
|
|
2252
2252
|
}
|
|
2253
2253
|
}, K = () => {
|
|
2254
2254
|
if (!d)
|
|
@@ -2267,45 +2267,45 @@ function lc() {
|
|
|
2267
2267
|
r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2268
2268
|
});
|
|
2269
2269
|
}, V = async () => {
|
|
2270
|
-
if (!
|
|
2271
|
-
if (await k(),
|
|
2270
|
+
if (!P) {
|
|
2271
|
+
if (await k(), P) {
|
|
2272
2272
|
K();
|
|
2273
2273
|
return;
|
|
2274
2274
|
}
|
|
2275
2275
|
d && (w(), m("online"), y());
|
|
2276
2276
|
}
|
|
2277
2277
|
}, G = () => {
|
|
2278
|
-
if (!
|
|
2278
|
+
if (!P) {
|
|
2279
2279
|
if (document.visibilityState === "hidden") {
|
|
2280
2280
|
K(), b(), A();
|
|
2281
2281
|
return;
|
|
2282
2282
|
}
|
|
2283
2283
|
if (document.visibilityState === "visible" && !d) {
|
|
2284
|
-
f =
|
|
2284
|
+
f = It(n.accountLimitedUntilStorageKey), !f && !h && V();
|
|
2285
2285
|
return;
|
|
2286
2286
|
}
|
|
2287
2287
|
document.visibilityState === "visible" && d && !f && !h && O();
|
|
2288
2288
|
}
|
|
2289
2289
|
}, _ = () => {
|
|
2290
|
-
|
|
2290
|
+
P || (K(), b(), A());
|
|
2291
2291
|
};
|
|
2292
|
-
|
|
2292
|
+
jt(async () => {
|
|
2293
2293
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2294
|
-
if (await k(),
|
|
2294
|
+
if (await k(), P) {
|
|
2295
2295
|
K();
|
|
2296
2296
|
return;
|
|
2297
2297
|
}
|
|
2298
2298
|
d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2299
2299
|
}
|
|
2300
2300
|
}), qe(() => {
|
|
2301
|
-
|
|
2301
|
+
P = !0, W(), A(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2302
2302
|
});
|
|
2303
2303
|
}
|
|
2304
2304
|
const Ea = 12e3;
|
|
2305
2305
|
function dc(e) {
|
|
2306
|
-
const n =
|
|
2306
|
+
const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = zt(), P = h !== null, C = 20, v = 250;
|
|
2307
2307
|
let E = !1, b = null, A = 0, w = null;
|
|
2308
|
-
const p = se(() => r.currentUser?.id), m = () =>
|
|
2308
|
+
const p = se(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
|
|
2309
2309
|
const M = u.value?.trim() ?? "";
|
|
2310
2310
|
if (M.length > 0)
|
|
2311
2311
|
return M;
|
|
@@ -2326,22 +2326,22 @@ function dc(e) {
|
|
|
2326
2326
|
}, te = () => {
|
|
2327
2327
|
w && (clearTimeout(w), w = null), A = 0;
|
|
2328
2328
|
}, k = () => {
|
|
2329
|
-
!
|
|
2329
|
+
!P || o.value || w || A >= C || (w = setTimeout(() => {
|
|
2330
2330
|
w = null, A += 1, G();
|
|
2331
2331
|
}, v));
|
|
2332
2332
|
}, I = (M, F) => {
|
|
2333
2333
|
J(M);
|
|
2334
2334
|
const Z = setTimeout(() => {
|
|
2335
|
-
f.delete(M), n.removeTypingUser(F, M), d.value = d.value.filter((
|
|
2335
|
+
f.delete(M), n.removeTypingUser(F, M), d.value = d.value.filter((ie) => ie.id !== M);
|
|
2336
2336
|
}, Ea);
|
|
2337
2337
|
f.set(M, Z);
|
|
2338
2338
|
}, K = () => {
|
|
2339
2339
|
E = !0, te();
|
|
2340
2340
|
}, V = (M) => {
|
|
2341
2341
|
try {
|
|
2342
|
-
b && (b(), b = null), b =
|
|
2342
|
+
b && (b(), b = null), b = Wi(M, {
|
|
2343
2343
|
onTypingStart: L,
|
|
2344
|
-
onTypingStop:
|
|
2344
|
+
onTypingStop: he
|
|
2345
2345
|
}), te(), o.value = !0, u.value = M;
|
|
2346
2346
|
} catch (F) {
|
|
2347
2347
|
c.value = F instanceof Error ? F.message : "Failed to subscribe to typing channel";
|
|
@@ -2349,15 +2349,15 @@ function dc(e) {
|
|
|
2349
2349
|
}, G = () => {
|
|
2350
2350
|
const M = m();
|
|
2351
2351
|
if (!(o.value || !M)) {
|
|
2352
|
-
if (c.value = null, Ae() &&
|
|
2352
|
+
if (c.value = null, Ae() && Rn() === "connected") {
|
|
2353
2353
|
V(M);
|
|
2354
2354
|
return;
|
|
2355
2355
|
}
|
|
2356
|
-
E = !1,
|
|
2356
|
+
E = !1, ms().then((F) => {
|
|
2357
2357
|
if (E || o.value || !F)
|
|
2358
2358
|
return;
|
|
2359
2359
|
const Z = m();
|
|
2360
|
-
if (Z && Z === M && Ae() &&
|
|
2360
|
+
if (Z && Z === M && Ae() && Rn() === "connected") {
|
|
2361
2361
|
V(Z);
|
|
2362
2362
|
return;
|
|
2363
2363
|
}
|
|
@@ -2368,7 +2368,7 @@ function dc(e) {
|
|
|
2368
2368
|
const M = u.value;
|
|
2369
2369
|
if (K(), !(!o.value || !M))
|
|
2370
2370
|
try {
|
|
2371
|
-
b && (b(), b = null),
|
|
2371
|
+
b && (b(), b = null), Gi(M), W(), z(M), o.value = !1, u.value = null, c.value = null;
|
|
2372
2372
|
} catch (F) {
|
|
2373
2373
|
c.value = F instanceof Error ? F.message : "Failed to unsubscribe from typing channel";
|
|
2374
2374
|
}
|
|
@@ -2384,9 +2384,9 @@ function dc(e) {
|
|
|
2384
2384
|
name: M.user.name,
|
|
2385
2385
|
...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
|
|
2386
2386
|
};
|
|
2387
|
-
d.value.some((
|
|
2387
|
+
d.value.some((ie) => ie.id === Z.id) || (d.value = [...d.value, Z]), n.addTypingUser(F, Z), I(M.user_id, F);
|
|
2388
2388
|
}
|
|
2389
|
-
function
|
|
2389
|
+
function he(M) {
|
|
2390
2390
|
if (M.user_id === p.value)
|
|
2391
2391
|
return;
|
|
2392
2392
|
J(M.user_id);
|
|
@@ -2403,10 +2403,10 @@ function dc(e) {
|
|
|
2403
2403
|
if (F.length === 0)
|
|
2404
2404
|
return d.value;
|
|
2405
2405
|
const Z = /* @__PURE__ */ new Map();
|
|
2406
|
-
for (const
|
|
2407
|
-
Z.set(
|
|
2408
|
-
for (const
|
|
2409
|
-
Z.set(
|
|
2406
|
+
for (const ie of F)
|
|
2407
|
+
Z.set(ie.id, ie);
|
|
2408
|
+
for (const ie of d.value)
|
|
2409
|
+
Z.set(ie.id, ie);
|
|
2410
2410
|
return [...Z.values()];
|
|
2411
2411
|
}), B = se(() => {
|
|
2412
2412
|
const M = Se.value;
|
|
@@ -2422,13 +2422,13 @@ function dc(e) {
|
|
|
2422
2422
|
return `${M.length} people are typing...`;
|
|
2423
2423
|
if (M.length === 2)
|
|
2424
2424
|
return `${F.name} and ${Z.name} are typing...`;
|
|
2425
|
-
const
|
|
2426
|
-
return
|
|
2425
|
+
const ie = M[2];
|
|
2426
|
+
return ie ? M.length === 3 ? `${F.name}, ${Z.name} and ${ie.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
|
|
2427
2427
|
}), D = se(() => Se.value.length > 0), q = () => {
|
|
2428
2428
|
m() && (b && (b(), b = null), o.value = !1, u.value = null, G());
|
|
2429
2429
|
};
|
|
2430
|
-
typeof window < "u" && window.addEventListener(
|
|
2431
|
-
const _e =
|
|
2430
|
+
typeof window < "u" && window.addEventListener(Je(), q);
|
|
2431
|
+
const _e = ht((M) => {
|
|
2432
2432
|
if (M === "connected") {
|
|
2433
2433
|
o.value || G();
|
|
2434
2434
|
return;
|
|
@@ -2440,7 +2440,7 @@ function dc(e) {
|
|
|
2440
2440
|
}
|
|
2441
2441
|
});
|
|
2442
2442
|
return h !== null && qe(() => {
|
|
2443
|
-
K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(
|
|
2443
|
+
K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(Je(), q);
|
|
2444
2444
|
}), {
|
|
2445
2445
|
isSubscribed: se(() => o.value),
|
|
2446
2446
|
error: se(() => c.value),
|
|
@@ -2452,12 +2452,12 @@ function dc(e) {
|
|
|
2452
2452
|
};
|
|
2453
2453
|
}
|
|
2454
2454
|
function hc(e) {
|
|
2455
|
-
e.apiClient &&
|
|
2455
|
+
e.apiClient && so(e.apiClient), e.mainApiClient && io(e.mainApiClient), e.authStore && ao(e.authStore), e.mediaApi && lo(e.mediaApi), e.createLogger && Go(e.createLogger), e.playMessageNotification && Zo(e.playMessageNotification), e.echo && Ji(e.echo), e.mainEcho && Vo(e.mainEcho), e.presence && oa(e.presence);
|
|
2456
2456
|
}
|
|
2457
2457
|
function fc() {
|
|
2458
|
-
|
|
2458
|
+
ro(), oo(), co(), ho(), Jo(), ea(), Ki(), Xo(), aa();
|
|
2459
2459
|
}
|
|
2460
|
-
class
|
|
2460
|
+
class tn {
|
|
2461
2461
|
constructor() {
|
|
2462
2462
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2463
2463
|
}
|
|
@@ -2486,7 +2486,7 @@ class en {
|
|
|
2486
2486
|
return this.stopListening(".client-" + n, r);
|
|
2487
2487
|
}
|
|
2488
2488
|
}
|
|
2489
|
-
class
|
|
2489
|
+
class Fs {
|
|
2490
2490
|
/**
|
|
2491
2491
|
* Create a new class instance.
|
|
2492
2492
|
*/
|
|
@@ -2515,12 +2515,12 @@ function Aa(e) {
|
|
|
2515
2515
|
}
|
|
2516
2516
|
return !0;
|
|
2517
2517
|
}
|
|
2518
|
-
class
|
|
2518
|
+
class nn extends tn {
|
|
2519
2519
|
/**
|
|
2520
2520
|
* Create a new class instance.
|
|
2521
2521
|
*/
|
|
2522
2522
|
constructor(n, r, o) {
|
|
2523
|
-
super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2523
|
+
super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new Fs(this.options.namespace), this.subscribe();
|
|
2524
2524
|
}
|
|
2525
2525
|
/**
|
|
2526
2526
|
* Subscribe to a Pusher channel.
|
|
@@ -2592,7 +2592,7 @@ class tn extends en {
|
|
|
2592
2592
|
return this.subscription.bind(n, r), this;
|
|
2593
2593
|
}
|
|
2594
2594
|
}
|
|
2595
|
-
class
|
|
2595
|
+
class Ds extends nn {
|
|
2596
2596
|
/**
|
|
2597
2597
|
* Send a whisper event to other clients in the channel.
|
|
2598
2598
|
*/
|
|
@@ -2603,7 +2603,7 @@ class Os extends tn {
|
|
|
2603
2603
|
), this;
|
|
2604
2604
|
}
|
|
2605
2605
|
}
|
|
2606
|
-
class Ra extends
|
|
2606
|
+
class Ra extends nn {
|
|
2607
2607
|
/**
|
|
2608
2608
|
* Send a whisper event to other clients in the channel.
|
|
2609
2609
|
*/
|
|
@@ -2614,7 +2614,7 @@ class Ra extends tn {
|
|
|
2614
2614
|
), this;
|
|
2615
2615
|
}
|
|
2616
2616
|
}
|
|
2617
|
-
class Pa extends
|
|
2617
|
+
class Pa extends Ds {
|
|
2618
2618
|
/**
|
|
2619
2619
|
* Register a callback to be called anytime the member list changes.
|
|
2620
2620
|
*/
|
|
@@ -2649,12 +2649,12 @@ class Pa extends Os {
|
|
|
2649
2649
|
}), this;
|
|
2650
2650
|
}
|
|
2651
2651
|
}
|
|
2652
|
-
class
|
|
2652
|
+
class Ns extends tn {
|
|
2653
2653
|
/**
|
|
2654
2654
|
* Create a new class instance.
|
|
2655
2655
|
*/
|
|
2656
2656
|
constructor(n, r, o) {
|
|
2657
|
-
super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2657
|
+
super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new Fs(this.options.namespace), this.subscribe();
|
|
2658
2658
|
}
|
|
2659
2659
|
/**
|
|
2660
2660
|
* Subscribe to a Socket.io channel.
|
|
@@ -2725,7 +2725,7 @@ class Fs extends en {
|
|
|
2725
2725
|
)), (!r || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2726
2726
|
}
|
|
2727
2727
|
}
|
|
2728
|
-
class
|
|
2728
|
+
class qs extends Ns {
|
|
2729
2729
|
/**
|
|
2730
2730
|
* Send a whisper event to other clients in the channel.
|
|
2731
2731
|
*/
|
|
@@ -2737,7 +2737,7 @@ class Ds extends Fs {
|
|
|
2737
2737
|
}), this;
|
|
2738
2738
|
}
|
|
2739
2739
|
}
|
|
2740
|
-
class Ma extends
|
|
2740
|
+
class Ma extends qs {
|
|
2741
2741
|
/**
|
|
2742
2742
|
* Register a callback to be called anytime the member list changes.
|
|
2743
2743
|
*/
|
|
@@ -2775,7 +2775,7 @@ class Ma extends Ds {
|
|
|
2775
2775
|
), this;
|
|
2776
2776
|
}
|
|
2777
2777
|
}
|
|
2778
|
-
class
|
|
2778
|
+
class dt extends tn {
|
|
2779
2779
|
/**
|
|
2780
2780
|
* Subscribe to a channel.
|
|
2781
2781
|
*/
|
|
@@ -2823,7 +2823,7 @@ class lt extends en {
|
|
|
2823
2823
|
return this;
|
|
2824
2824
|
}
|
|
2825
2825
|
}
|
|
2826
|
-
class
|
|
2826
|
+
class zs extends dt {
|
|
2827
2827
|
/**
|
|
2828
2828
|
* Send a whisper event to other clients in the channel.
|
|
2829
2829
|
*/
|
|
@@ -2831,7 +2831,7 @@ class Ns extends lt {
|
|
|
2831
2831
|
return this;
|
|
2832
2832
|
}
|
|
2833
2833
|
}
|
|
2834
|
-
class ka extends
|
|
2834
|
+
class ka extends dt {
|
|
2835
2835
|
/**
|
|
2836
2836
|
* Send a whisper event to other clients in the channel.
|
|
2837
2837
|
*/
|
|
@@ -2839,7 +2839,7 @@ class ka extends lt {
|
|
|
2839
2839
|
return this;
|
|
2840
2840
|
}
|
|
2841
2841
|
}
|
|
2842
|
-
class xa extends
|
|
2842
|
+
class xa extends zs {
|
|
2843
2843
|
/**
|
|
2844
2844
|
* Register a callback to be called anytime the member list changes.
|
|
2845
2845
|
*/
|
|
@@ -2865,7 +2865,7 @@ class xa extends Ns {
|
|
|
2865
2865
|
return this;
|
|
2866
2866
|
}
|
|
2867
2867
|
}
|
|
2868
|
-
const
|
|
2868
|
+
const js = class $s {
|
|
2869
2869
|
/**
|
|
2870
2870
|
* Create a new class instance.
|
|
2871
2871
|
*/
|
|
@@ -2877,7 +2877,7 @@ const qs = class zs {
|
|
|
2877
2877
|
*/
|
|
2878
2878
|
setOptions(n) {
|
|
2879
2879
|
this.options = {
|
|
2880
|
-
|
|
2880
|
+
...$s._defaultOptions,
|
|
2881
2881
|
...n,
|
|
2882
2882
|
broadcaster: n.broadcaster
|
|
2883
2883
|
};
|
|
@@ -2892,7 +2892,7 @@ const qs = class zs {
|
|
|
2892
2892
|
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;
|
|
2893
2893
|
}
|
|
2894
2894
|
};
|
|
2895
|
-
|
|
2895
|
+
js._defaultOptions = {
|
|
2896
2896
|
auth: {
|
|
2897
2897
|
headers: {}
|
|
2898
2898
|
},
|
|
@@ -2907,8 +2907,8 @@ qs._defaultOptions = {
|
|
|
2907
2907
|
key: null,
|
|
2908
2908
|
namespace: "App.Events"
|
|
2909
2909
|
};
|
|
2910
|
-
let
|
|
2911
|
-
class
|
|
2910
|
+
let sn = js;
|
|
2911
|
+
class it extends sn {
|
|
2912
2912
|
constructor() {
|
|
2913
2913
|
super(...arguments), this.channels = {};
|
|
2914
2914
|
}
|
|
@@ -2946,7 +2946,7 @@ class ot extends nn {
|
|
|
2946
2946
|
* Get a channel instance by name.
|
|
2947
2947
|
*/
|
|
2948
2948
|
channel(n) {
|
|
2949
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2949
|
+
return this.channels[n] || (this.channels[n] = new nn(
|
|
2950
2950
|
this.pusher,
|
|
2951
2951
|
n,
|
|
2952
2952
|
this.options
|
|
@@ -2956,7 +2956,7 @@ class ot extends nn {
|
|
|
2956
2956
|
* Get a private channel instance by name.
|
|
2957
2957
|
*/
|
|
2958
2958
|
privateChannel(n) {
|
|
2959
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2959
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Ds(
|
|
2960
2960
|
this.pusher,
|
|
2961
2961
|
"private-" + n,
|
|
2962
2962
|
this.options
|
|
@@ -3045,7 +3045,7 @@ class ot extends nn {
|
|
|
3045
3045
|
this.pusher.disconnect();
|
|
3046
3046
|
}
|
|
3047
3047
|
}
|
|
3048
|
-
class La extends
|
|
3048
|
+
class La extends sn {
|
|
3049
3049
|
constructor() {
|
|
3050
3050
|
super(...arguments), this.channels = {};
|
|
3051
3051
|
}
|
|
@@ -3085,7 +3085,7 @@ class La extends nn {
|
|
|
3085
3085
|
* Get a channel instance by name.
|
|
3086
3086
|
*/
|
|
3087
3087
|
channel(n) {
|
|
3088
|
-
return this.channels[n] || (this.channels[n] = new
|
|
3088
|
+
return this.channels[n] || (this.channels[n] = new Ns(
|
|
3089
3089
|
this.socket,
|
|
3090
3090
|
n,
|
|
3091
3091
|
this.options
|
|
@@ -3095,7 +3095,7 @@ class La extends nn {
|
|
|
3095
3095
|
* Get a private channel instance by name.
|
|
3096
3096
|
*/
|
|
3097
3097
|
privateChannel(n) {
|
|
3098
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
3098
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new qs(
|
|
3099
3099
|
this.socket,
|
|
3100
3100
|
"private-" + n,
|
|
3101
3101
|
this.options
|
|
@@ -3167,7 +3167,7 @@ class La extends nn {
|
|
|
3167
3167
|
this.socket.disconnect();
|
|
3168
3168
|
}
|
|
3169
3169
|
}
|
|
3170
|
-
class
|
|
3170
|
+
class Gn extends sn {
|
|
3171
3171
|
constructor() {
|
|
3172
3172
|
super(...arguments), this.channels = {};
|
|
3173
3173
|
}
|
|
@@ -3180,19 +3180,19 @@ class Xn extends nn {
|
|
|
3180
3180
|
* Listen for an event on a channel instance.
|
|
3181
3181
|
*/
|
|
3182
3182
|
listen(n, r, o) {
|
|
3183
|
-
return new
|
|
3183
|
+
return new dt();
|
|
3184
3184
|
}
|
|
3185
3185
|
/**
|
|
3186
3186
|
* Get a channel instance by name.
|
|
3187
3187
|
*/
|
|
3188
3188
|
channel(n) {
|
|
3189
|
-
return new
|
|
3189
|
+
return new dt();
|
|
3190
3190
|
}
|
|
3191
3191
|
/**
|
|
3192
3192
|
* Get a private channel instance by name.
|
|
3193
3193
|
*/
|
|
3194
3194
|
privateChannel(n) {
|
|
3195
|
-
return new
|
|
3195
|
+
return new zs();
|
|
3196
3196
|
}
|
|
3197
3197
|
/**
|
|
3198
3198
|
* Get a private encrypted channel instance by name.
|
|
@@ -3259,14 +3259,14 @@ class Ia {
|
|
|
3259
3259
|
*/
|
|
3260
3260
|
connect() {
|
|
3261
3261
|
if (this.options.broadcaster === "reverb")
|
|
3262
|
-
this.connector = new
|
|
3262
|
+
this.connector = new it({
|
|
3263
3263
|
...this.options,
|
|
3264
3264
|
cluster: ""
|
|
3265
3265
|
});
|
|
3266
3266
|
else if (this.options.broadcaster === "pusher")
|
|
3267
|
-
this.connector = new
|
|
3267
|
+
this.connector = new it(this.options);
|
|
3268
3268
|
else if (this.options.broadcaster === "ably")
|
|
3269
|
-
this.connector = new
|
|
3269
|
+
this.connector = new it({
|
|
3270
3270
|
...this.options,
|
|
3271
3271
|
cluster: "",
|
|
3272
3272
|
broadcaster: "pusher"
|
|
@@ -3274,7 +3274,7 @@ class Ia {
|
|
|
3274
3274
|
else if (this.options.broadcaster === "socket.io")
|
|
3275
3275
|
this.connector = new La(this.options);
|
|
3276
3276
|
else if (this.options.broadcaster === "null")
|
|
3277
|
-
this.connector = new
|
|
3277
|
+
this.connector = new Gn(this.options);
|
|
3278
3278
|
else if (typeof this.options.broadcaster == "function" && Aa(this.options.broadcaster))
|
|
3279
3279
|
this.connector = new this.options.broadcaster(this.options);
|
|
3280
3280
|
else
|
|
@@ -3338,7 +3338,7 @@ class Ia {
|
|
|
3338
3338
|
);
|
|
3339
3339
|
}
|
|
3340
3340
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3341
|
-
return n instanceof
|
|
3341
|
+
return n instanceof it || n instanceof Gn;
|
|
3342
3342
|
}
|
|
3343
3343
|
/**
|
|
3344
3344
|
* Get the Socket ID for the connection.
|
|
@@ -3402,10 +3402,10 @@ class Ia {
|
|
|
3402
3402
|
function Ua(e) {
|
|
3403
3403
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3404
3404
|
}
|
|
3405
|
-
var
|
|
3406
|
-
var
|
|
3405
|
+
var Ut = { exports: {} };
|
|
3406
|
+
var Jn;
|
|
3407
3407
|
function Oa() {
|
|
3408
|
-
return
|
|
3408
|
+
return Jn || (Jn = 1, (function(e, n) {
|
|
3409
3409
|
(function(o, c) {
|
|
3410
3410
|
e.exports = c();
|
|
3411
3411
|
})(window, function() {
|
|
@@ -3434,8 +3434,8 @@ function Oa() {
|
|
|
3434
3434
|
}, c.t = function(u, d) {
|
|
3435
3435
|
if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
|
|
3436
3436
|
var f = /* @__PURE__ */ Object.create(null);
|
|
3437
|
-
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(
|
|
3438
|
-
return u[
|
|
3437
|
+
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(P) {
|
|
3438
|
+
return u[P];
|
|
3439
3439
|
}).bind(null, h));
|
|
3440
3440
|
return f;
|
|
3441
3441
|
}, c.n = function(u) {
|
|
@@ -3526,10 +3526,10 @@ function Oa() {
|
|
|
3526
3526
|
);
|
|
3527
3527
|
o.Coder = f;
|
|
3528
3528
|
var h = new f();
|
|
3529
|
-
function
|
|
3529
|
+
function P(w) {
|
|
3530
3530
|
return h.encode(w);
|
|
3531
3531
|
}
|
|
3532
|
-
o.encode =
|
|
3532
|
+
o.encode = P;
|
|
3533
3533
|
function C(w) {
|
|
3534
3534
|
return h.decode(w);
|
|
3535
3535
|
}
|
|
@@ -3599,7 +3599,7 @@ function Oa() {
|
|
|
3599
3599
|
return v;
|
|
3600
3600
|
}
|
|
3601
3601
|
o.encodedLength = h;
|
|
3602
|
-
function
|
|
3602
|
+
function P(C) {
|
|
3603
3603
|
for (var v = [], E = 0; E < C.length; E++) {
|
|
3604
3604
|
var b = C[E];
|
|
3605
3605
|
if (b & 128) {
|
|
@@ -3639,7 +3639,7 @@ function Oa() {
|
|
|
3639
3639
|
}
|
|
3640
3640
|
return v.join("");
|
|
3641
3641
|
}
|
|
3642
|
-
o.decode =
|
|
3642
|
+
o.decode = P;
|
|
3643
3643
|
}),
|
|
3644
3644
|
/* 2 */
|
|
3645
3645
|
/***/
|
|
@@ -3693,7 +3693,7 @@ function Oa() {
|
|
|
3693
3693
|
cdn_https: "https://js.pusher.com",
|
|
3694
3694
|
dependency_suffix: ""
|
|
3695
3695
|
}, h = f;
|
|
3696
|
-
class
|
|
3696
|
+
class P {
|
|
3697
3697
|
constructor(t) {
|
|
3698
3698
|
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3699
3699
|
}
|
|
@@ -3707,8 +3707,8 @@ function Oa() {
|
|
|
3707
3707
|
if (l.receivers.remove(S), l.loading[t]) {
|
|
3708
3708
|
var j = l.loading[t];
|
|
3709
3709
|
delete l.loading[t];
|
|
3710
|
-
for (var Q = function(
|
|
3711
|
-
|
|
3710
|
+
for (var Q = function(ue) {
|
|
3711
|
+
ue || g.cleanup();
|
|
3712
3712
|
}, ee = 0; ee < j.length; ee++)
|
|
3713
3713
|
j[ee](x, Q);
|
|
3714
3714
|
}
|
|
@@ -3724,7 +3724,7 @@ function Oa() {
|
|
|
3724
3724
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3725
3725
|
}
|
|
3726
3726
|
}
|
|
3727
|
-
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new
|
|
3727
|
+
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
|
|
3728
3728
|
cdn_http: h.cdn_http,
|
|
3729
3729
|
cdn_https: h.cdn_https,
|
|
3730
3730
|
version: h.VERSION,
|
|
@@ -3841,12 +3841,12 @@ function Oa() {
|
|
|
3841
3841
|
}, g.send(t), g;
|
|
3842
3842
|
};
|
|
3843
3843
|
function V(i) {
|
|
3844
|
-
return B(
|
|
3844
|
+
return B(he(i));
|
|
3845
3845
|
}
|
|
3846
3846
|
var G = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = function(i) {
|
|
3847
3847
|
var t = i.charCodeAt(0);
|
|
3848
3848
|
return t < 128 ? i : t < 2048 ? G(192 | t >>> 6) + G(128 | t & 63) : G(224 | t >>> 12 & 15) + G(128 | t >>> 6 & 63) + G(128 | t & 63);
|
|
3849
|
-
},
|
|
3849
|
+
}, he = function(i) {
|
|
3850
3850
|
return i.replace(/[^\x00-\x7F]/g, L);
|
|
3851
3851
|
}, Se = function(i) {
|
|
3852
3852
|
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 = [
|
|
@@ -3893,7 +3893,7 @@ function Oa() {
|
|
|
3893
3893
|
});
|
|
3894
3894
|
}
|
|
3895
3895
|
}
|
|
3896
|
-
var
|
|
3896
|
+
var ie = {
|
|
3897
3897
|
now() {
|
|
3898
3898
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3899
3899
|
},
|
|
@@ -3906,7 +3906,7 @@ function Oa() {
|
|
|
3906
3906
|
return a[i].apply(a, s.concat(arguments));
|
|
3907
3907
|
};
|
|
3908
3908
|
}
|
|
3909
|
-
},
|
|
3909
|
+
}, fe = ie;
|
|
3910
3910
|
function me(i, ...t) {
|
|
3911
3911
|
for (var s = 0; s < t.length; s++) {
|
|
3912
3912
|
var a = t[s];
|
|
@@ -3915,12 +3915,12 @@ function Oa() {
|
|
|
3915
3915
|
}
|
|
3916
3916
|
return i;
|
|
3917
3917
|
}
|
|
3918
|
-
function
|
|
3918
|
+
function rn() {
|
|
3919
3919
|
for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3920
|
-
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(
|
|
3920
|
+
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Qe(arguments[t]));
|
|
3921
3921
|
return i.join(" : ");
|
|
3922
3922
|
}
|
|
3923
|
-
function
|
|
3923
|
+
function ft(i, t) {
|
|
3924
3924
|
var s = Array.prototype.indexOf;
|
|
3925
3925
|
if (i === null)
|
|
3926
3926
|
return -1;
|
|
@@ -3935,7 +3935,7 @@ function Oa() {
|
|
|
3935
3935
|
for (var s in i)
|
|
3936
3936
|
Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
|
|
3937
3937
|
}
|
|
3938
|
-
function
|
|
3938
|
+
function R(i) {
|
|
3939
3939
|
var t = [];
|
|
3940
3940
|
return T(i, function(s, a) {
|
|
3941
3941
|
t.push(a);
|
|
@@ -3956,13 +3956,13 @@ function Oa() {
|
|
|
3956
3956
|
s.push(t(i[a], a, i, s));
|
|
3957
3957
|
return s;
|
|
3958
3958
|
}
|
|
3959
|
-
function
|
|
3959
|
+
function oe(i, t) {
|
|
3960
3960
|
var s = {};
|
|
3961
3961
|
return T(i, function(a, l) {
|
|
3962
3962
|
s[l] = t(a);
|
|
3963
3963
|
}), s;
|
|
3964
3964
|
}
|
|
3965
|
-
function
|
|
3965
|
+
function ce(i, t) {
|
|
3966
3966
|
t = t || function(l) {
|
|
3967
3967
|
return !!l;
|
|
3968
3968
|
};
|
|
@@ -3995,17 +3995,17 @@ function Oa() {
|
|
|
3995
3995
|
return !0;
|
|
3996
3996
|
}
|
|
3997
3997
|
function ve(i) {
|
|
3998
|
-
return
|
|
3999
|
-
return typeof t == "object" && (t =
|
|
3998
|
+
return oe(i, function(t) {
|
|
3999
|
+
return typeof t == "object" && (t = Qe(t)), encodeURIComponent(V(t.toString()));
|
|
4000
4000
|
});
|
|
4001
4001
|
}
|
|
4002
|
-
function
|
|
4002
|
+
function Hs(i) {
|
|
4003
4003
|
var t = Re(i, function(a) {
|
|
4004
4004
|
return a !== void 0;
|
|
4005
|
-
}), s = ne(Le(ve(t)),
|
|
4005
|
+
}), s = ne(Le(ve(t)), fe.method("join", "=")).join("&");
|
|
4006
4006
|
return s;
|
|
4007
4007
|
}
|
|
4008
|
-
function
|
|
4008
|
+
function Bs(i) {
|
|
4009
4009
|
var t = [], s = [];
|
|
4010
4010
|
return (function a(l, g) {
|
|
4011
4011
|
var S, x, j;
|
|
@@ -4032,14 +4032,14 @@ function Oa() {
|
|
|
4032
4032
|
}
|
|
4033
4033
|
})(i, "$");
|
|
4034
4034
|
}
|
|
4035
|
-
function
|
|
4035
|
+
function Qe(i) {
|
|
4036
4036
|
try {
|
|
4037
4037
|
return JSON.stringify(i);
|
|
4038
4038
|
} catch {
|
|
4039
|
-
return JSON.stringify(
|
|
4039
|
+
return JSON.stringify(Bs(i));
|
|
4040
4040
|
}
|
|
4041
4041
|
}
|
|
4042
|
-
class
|
|
4042
|
+
class Vs {
|
|
4043
4043
|
constructor() {
|
|
4044
4044
|
this.globalLog = (t) => {
|
|
4045
4045
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -4061,11 +4061,11 @@ function Oa() {
|
|
|
4061
4061
|
window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
|
|
4062
4062
|
}
|
|
4063
4063
|
log(t, ...s) {
|
|
4064
|
-
var a =
|
|
4065
|
-
|
|
4064
|
+
var a = rn.apply(this, arguments);
|
|
4065
|
+
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
4066
4066
|
}
|
|
4067
4067
|
}
|
|
4068
|
-
var ae = new
|
|
4068
|
+
var ae = new Vs(), Xs = function(i, t, s, a, l) {
|
|
4069
4069
|
(s.headers !== void 0 || s.headersProvider != null) && ae.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
4070
4070
|
var g = i.nextAuthCallbackID.toString();
|
|
4071
4071
|
i.nextAuthCallbackID++;
|
|
@@ -4077,8 +4077,8 @@ function Oa() {
|
|
|
4077
4077
|
x.src = s.endpoint + "?callback=" + encodeURIComponent(j) + "&" + t;
|
|
4078
4078
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
4079
4079
|
Q.insertBefore(x, Q.firstChild);
|
|
4080
|
-
},
|
|
4081
|
-
class
|
|
4080
|
+
}, Ws = Xs;
|
|
4081
|
+
class Gs {
|
|
4082
4082
|
constructor(t) {
|
|
4083
4083
|
this.src = t;
|
|
4084
4084
|
}
|
|
@@ -4098,13 +4098,13 @@ function Oa() {
|
|
|
4098
4098
|
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;
|
|
4099
4099
|
}
|
|
4100
4100
|
}
|
|
4101
|
-
class
|
|
4101
|
+
class Js {
|
|
4102
4102
|
constructor(t, s) {
|
|
4103
4103
|
this.url = t, this.data = s;
|
|
4104
4104
|
}
|
|
4105
4105
|
send(t) {
|
|
4106
4106
|
if (!this.request) {
|
|
4107
|
-
var s =
|
|
4107
|
+
var s = Hs(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
4108
4108
|
this.request = $.createScriptRequest(a), this.request.send(t);
|
|
4109
4109
|
}
|
|
4110
4110
|
}
|
|
@@ -4112,52 +4112,52 @@ function Oa() {
|
|
|
4112
4112
|
this.request && this.request.cleanup();
|
|
4113
4113
|
}
|
|
4114
4114
|
}
|
|
4115
|
-
var
|
|
4115
|
+
var Ks = function(i, t) {
|
|
4116
4116
|
return function(s, a) {
|
|
4117
4117
|
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = $.createJSONPRequest(g, s), x = $.ScriptReceivers.create(function(j, Q) {
|
|
4118
4118
|
d.remove(x), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(j, Q);
|
|
4119
4119
|
});
|
|
4120
4120
|
S.send(x);
|
|
4121
4121
|
};
|
|
4122
|
-
},
|
|
4122
|
+
}, Qs = {
|
|
4123
4123
|
name: "jsonp",
|
|
4124
|
-
getAgent:
|
|
4125
|
-
},
|
|
4126
|
-
function
|
|
4124
|
+
getAgent: Ks
|
|
4125
|
+
}, Ys = Qs;
|
|
4126
|
+
function pt(i, t, s) {
|
|
4127
4127
|
var a = i + (t.useTLS ? "s" : ""), l = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
4128
4128
|
return a + "://" + l + s;
|
|
4129
4129
|
}
|
|
4130
|
-
function
|
|
4130
|
+
function gt(i, t) {
|
|
4131
4131
|
var s = "/app/" + i, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
4132
4132
|
return s + a;
|
|
4133
4133
|
}
|
|
4134
|
-
var
|
|
4134
|
+
var Zs = {
|
|
4135
4135
|
getInitial: function(i, t) {
|
|
4136
|
-
var s = (t.httpPath || "") +
|
|
4137
|
-
return
|
|
4136
|
+
var s = (t.httpPath || "") + gt(i, "flash=false");
|
|
4137
|
+
return pt("ws", t, s);
|
|
4138
4138
|
}
|
|
4139
|
-
},
|
|
4139
|
+
}, er = {
|
|
4140
4140
|
getInitial: function(i, t) {
|
|
4141
|
-
var s = (t.httpPath || "/pusher") +
|
|
4142
|
-
return
|
|
4141
|
+
var s = (t.httpPath || "/pusher") + gt(i);
|
|
4142
|
+
return pt("http", t, s);
|
|
4143
4143
|
}
|
|
4144
|
-
},
|
|
4144
|
+
}, tr = {
|
|
4145
4145
|
getInitial: function(i, t) {
|
|
4146
|
-
return
|
|
4146
|
+
return pt("http", t, t.httpPath || "/pusher");
|
|
4147
4147
|
},
|
|
4148
4148
|
getPath: function(i, t) {
|
|
4149
|
-
return
|
|
4149
|
+
return gt(i);
|
|
4150
4150
|
}
|
|
4151
4151
|
};
|
|
4152
|
-
class
|
|
4152
|
+
class nr {
|
|
4153
4153
|
constructor() {
|
|
4154
4154
|
this._callbacks = {};
|
|
4155
4155
|
}
|
|
4156
4156
|
get(t) {
|
|
4157
|
-
return this._callbacks[
|
|
4157
|
+
return this._callbacks[mt(t)];
|
|
4158
4158
|
}
|
|
4159
4159
|
add(t, s, a) {
|
|
4160
|
-
var l =
|
|
4160
|
+
var l = mt(t);
|
|
4161
4161
|
this._callbacks[l] = this._callbacks[l] || [], this._callbacks[l].push({
|
|
4162
4162
|
fn: s,
|
|
4163
4163
|
context: a
|
|
@@ -4168,12 +4168,12 @@ function Oa() {
|
|
|
4168
4168
|
this._callbacks = {};
|
|
4169
4169
|
return;
|
|
4170
4170
|
}
|
|
4171
|
-
var l = t ? [
|
|
4171
|
+
var l = t ? [mt(t)] : R(this._callbacks);
|
|
4172
4172
|
s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
|
|
4173
4173
|
}
|
|
4174
4174
|
removeCallback(t, s, a) {
|
|
4175
4175
|
U(t, function(l) {
|
|
4176
|
-
this._callbacks[l] =
|
|
4176
|
+
this._callbacks[l] = ce(this._callbacks[l] || [], function(g) {
|
|
4177
4177
|
return s && s !== g.fn || a && a !== g.context;
|
|
4178
4178
|
}), this._callbacks[l].length === 0 && delete this._callbacks[l];
|
|
4179
4179
|
}, this);
|
|
@@ -4184,12 +4184,12 @@ function Oa() {
|
|
|
4184
4184
|
}, this);
|
|
4185
4185
|
}
|
|
4186
4186
|
}
|
|
4187
|
-
function
|
|
4187
|
+
function mt(i) {
|
|
4188
4188
|
return "_" + i;
|
|
4189
4189
|
}
|
|
4190
4190
|
class Te {
|
|
4191
4191
|
constructor(t) {
|
|
4192
|
-
this.callbacks = new
|
|
4192
|
+
this.callbacks = new nr(), this.global_callbacks = [], this.failThrough = t;
|
|
4193
4193
|
}
|
|
4194
4194
|
bind(t, s, a) {
|
|
4195
4195
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4201,7 +4201,7 @@ function Oa() {
|
|
|
4201
4201
|
return this.callbacks.remove(t, s, a), this;
|
|
4202
4202
|
}
|
|
4203
4203
|
unbind_global(t) {
|
|
4204
|
-
return t ? (this.global_callbacks =
|
|
4204
|
+
return t ? (this.global_callbacks = ce(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
|
|
4205
4205
|
}
|
|
4206
4206
|
unbind_all() {
|
|
4207
4207
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -4217,7 +4217,7 @@ function Oa() {
|
|
|
4217
4217
|
return this;
|
|
4218
4218
|
}
|
|
4219
4219
|
}
|
|
4220
|
-
class
|
|
4220
|
+
class sr extends Te {
|
|
4221
4221
|
constructor(t, s, a, l, g) {
|
|
4222
4222
|
super(), this.initialize = $.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();
|
|
4223
4223
|
}
|
|
@@ -4234,7 +4234,7 @@ function Oa() {
|
|
|
4234
4234
|
try {
|
|
4235
4235
|
this.socket = this.hooks.getSocket(t, this.options);
|
|
4236
4236
|
} catch (s) {
|
|
4237
|
-
return
|
|
4237
|
+
return fe.defer(() => {
|
|
4238
4238
|
this.onError(s), this.changeState("closed");
|
|
4239
4239
|
}), !1;
|
|
4240
4240
|
}
|
|
@@ -4244,7 +4244,7 @@ function Oa() {
|
|
|
4244
4244
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
4245
4245
|
}
|
|
4246
4246
|
send(t) {
|
|
4247
|
-
return this.state === "open" ? (
|
|
4247
|
+
return this.state === "open" ? (fe.defer(() => {
|
|
4248
4248
|
this.socket && this.socket.send(t);
|
|
4249
4249
|
}), !0) : !1;
|
|
4250
4250
|
}
|
|
@@ -4304,11 +4304,11 @@ function Oa() {
|
|
|
4304
4304
|
return this.hooks.isSupported(t);
|
|
4305
4305
|
}
|
|
4306
4306
|
createConnection(t, s, a, l) {
|
|
4307
|
-
return new
|
|
4307
|
+
return new sr(this.hooks, t, s, a, l);
|
|
4308
4308
|
}
|
|
4309
4309
|
}
|
|
4310
|
-
var
|
|
4311
|
-
urls:
|
|
4310
|
+
var rr = new De({
|
|
4311
|
+
urls: Zs,
|
|
4312
4312
|
handlesActivityChecks: !1,
|
|
4313
4313
|
supportsPing: !1,
|
|
4314
4314
|
isInitialized: function() {
|
|
@@ -4320,32 +4320,32 @@ function Oa() {
|
|
|
4320
4320
|
getSocket: function(i) {
|
|
4321
4321
|
return $.createWebSocket(i);
|
|
4322
4322
|
}
|
|
4323
|
-
}),
|
|
4324
|
-
urls:
|
|
4323
|
+
}), on = {
|
|
4324
|
+
urls: er,
|
|
4325
4325
|
handlesActivityChecks: !1,
|
|
4326
4326
|
supportsPing: !0,
|
|
4327
4327
|
isInitialized: function() {
|
|
4328
4328
|
return !0;
|
|
4329
4329
|
}
|
|
4330
|
-
},
|
|
4330
|
+
}, an = me({
|
|
4331
4331
|
getSocket: function(i) {
|
|
4332
4332
|
return $.HTTPFactory.createStreamingSocket(i);
|
|
4333
4333
|
}
|
|
4334
|
-
},
|
|
4334
|
+
}, on), cn = me({
|
|
4335
4335
|
getSocket: function(i) {
|
|
4336
4336
|
return $.HTTPFactory.createPollingSocket(i);
|
|
4337
4337
|
}
|
|
4338
|
-
},
|
|
4338
|
+
}, on), un = {
|
|
4339
4339
|
isSupported: function() {
|
|
4340
4340
|
return $.isXHRSupported();
|
|
4341
4341
|
}
|
|
4342
|
-
},
|
|
4343
|
-
ws:
|
|
4344
|
-
xhr_streaming:
|
|
4345
|
-
xhr_polling:
|
|
4346
|
-
},
|
|
4342
|
+
}, ir = new De(me({}, an, un)), or = new De(me({}, cn, un)), ar = {
|
|
4343
|
+
ws: rr,
|
|
4344
|
+
xhr_streaming: ir,
|
|
4345
|
+
xhr_polling: or
|
|
4346
|
+
}, Ye = ar, cr = new De({
|
|
4347
4347
|
file: "sockjs",
|
|
4348
|
-
urls:
|
|
4348
|
+
urls: tr,
|
|
4349
4349
|
handlesActivityChecks: !0,
|
|
4350
4350
|
supportsPing: !1,
|
|
4351
4351
|
isSupported: function() {
|
|
@@ -4367,15 +4367,15 @@ function Oa() {
|
|
|
4367
4367
|
path: t
|
|
4368
4368
|
}));
|
|
4369
4369
|
}
|
|
4370
|
-
}),
|
|
4370
|
+
}), ln = {
|
|
4371
4371
|
isSupported: function(i) {
|
|
4372
4372
|
var t = $.isXDRSupported(i.useTLS);
|
|
4373
4373
|
return t;
|
|
4374
4374
|
}
|
|
4375
|
-
},
|
|
4376
|
-
|
|
4377
|
-
var
|
|
4378
|
-
class
|
|
4375
|
+
}, ur = new De(me({}, an, ln)), lr = new De(me({}, cn, ln));
|
|
4376
|
+
Ye.xdr_streaming = ur, Ye.xdr_polling = lr, Ye.sockjs = cr;
|
|
4377
|
+
var dr = Ye;
|
|
4378
|
+
class hr extends Te {
|
|
4379
4379
|
constructor() {
|
|
4380
4380
|
super();
|
|
4381
4381
|
var t = this;
|
|
@@ -4389,8 +4389,8 @@ function Oa() {
|
|
|
4389
4389
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4390
4390
|
}
|
|
4391
4391
|
}
|
|
4392
|
-
var
|
|
4393
|
-
class
|
|
4392
|
+
var fr = new hr();
|
|
4393
|
+
class pr {
|
|
4394
4394
|
constructor(t, s, a) {
|
|
4395
4395
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4396
4396
|
}
|
|
@@ -4399,12 +4399,12 @@ function Oa() {
|
|
|
4399
4399
|
activityTimeout: this.pingDelay
|
|
4400
4400
|
});
|
|
4401
4401
|
var g = this.transport.createConnection(t, s, a, l), S = null, x = function() {
|
|
4402
|
-
g.unbind("open", x), g.bind("closed", j), S =
|
|
4402
|
+
g.unbind("open", x), g.bind("closed", j), S = fe.now();
|
|
4403
4403
|
}, j = (Q) => {
|
|
4404
4404
|
if (g.unbind("closed", j), Q.code === 1002 || Q.code === 1003)
|
|
4405
4405
|
this.manager.reportDeath();
|
|
4406
4406
|
else if (!Q.wasClean && S) {
|
|
4407
|
-
var ee =
|
|
4407
|
+
var ee = fe.now() - S;
|
|
4408
4408
|
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4409
4409
|
}
|
|
4410
4410
|
};
|
|
@@ -4414,7 +4414,7 @@ function Oa() {
|
|
|
4414
4414
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4415
4415
|
}
|
|
4416
4416
|
}
|
|
4417
|
-
const
|
|
4417
|
+
const dn = {
|
|
4418
4418
|
decodeMessage: function(i) {
|
|
4419
4419
|
try {
|
|
4420
4420
|
var t = JSON.parse(i.data), s = t.data;
|
|
@@ -4437,7 +4437,7 @@ function Oa() {
|
|
|
4437
4437
|
return JSON.stringify(i);
|
|
4438
4438
|
},
|
|
4439
4439
|
processHandshake: function(i) {
|
|
4440
|
-
var t =
|
|
4440
|
+
var t = dn.decodeMessage(i);
|
|
4441
4441
|
if (t.event === "pusher:connection_established") {
|
|
4442
4442
|
if (!t.data.activity_timeout)
|
|
4443
4443
|
throw "No activity timeout specified in handshake";
|
|
@@ -4468,8 +4468,8 @@ function Oa() {
|
|
|
4468
4468
|
} : null;
|
|
4469
4469
|
}
|
|
4470
4470
|
};
|
|
4471
|
-
var Ie =
|
|
4472
|
-
class
|
|
4471
|
+
var Ie = dn;
|
|
4472
|
+
class gr extends Te {
|
|
4473
4473
|
constructor(t, s) {
|
|
4474
4474
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4475
4475
|
}
|
|
@@ -4543,7 +4543,7 @@ function Oa() {
|
|
|
4543
4543
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4544
4544
|
}
|
|
4545
4545
|
}
|
|
4546
|
-
class
|
|
4546
|
+
class mr {
|
|
4547
4547
|
constructor(t, s) {
|
|
4548
4548
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4549
4549
|
}
|
|
@@ -4561,7 +4561,7 @@ function Oa() {
|
|
|
4561
4561
|
return;
|
|
4562
4562
|
}
|
|
4563
4563
|
s.action === "connected" ? this.finish("connected", {
|
|
4564
|
-
connection: new
|
|
4564
|
+
connection: new gr(s.id, this.transport),
|
|
4565
4565
|
activityTimeout: s.activityTimeout
|
|
4566
4566
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4567
4567
|
}, this.onClosed = (t) => {
|
|
@@ -4577,7 +4577,7 @@ function Oa() {
|
|
|
4577
4577
|
this.callback(me({ transport: this.transport, action: t }, s));
|
|
4578
4578
|
}
|
|
4579
4579
|
}
|
|
4580
|
-
class
|
|
4580
|
+
class vr {
|
|
4581
4581
|
constructor(t, s) {
|
|
4582
4582
|
this.timeline = t, this.options = s || {};
|
|
4583
4583
|
}
|
|
@@ -4585,7 +4585,7 @@ function Oa() {
|
|
|
4585
4585
|
this.timeline.isEmpty() || this.timeline.send($.TimelineTransport.getAgent(this, t), s);
|
|
4586
4586
|
}
|
|
4587
4587
|
}
|
|
4588
|
-
class
|
|
4588
|
+
class vt extends Te {
|
|
4589
4589
|
constructor(t, s) {
|
|
4590
4590
|
super(function(a, l) {
|
|
4591
4591
|
ae.debug("No callbacks on " + t + " for " + a);
|
|
@@ -4647,7 +4647,7 @@ function Oa() {
|
|
|
4647
4647
|
this.subscriptionCancelled = !1;
|
|
4648
4648
|
}
|
|
4649
4649
|
}
|
|
4650
|
-
class
|
|
4650
|
+
class bt extends vt {
|
|
4651
4651
|
authorize(t, s) {
|
|
4652
4652
|
return this.pusher.config.channelAuthorizer({
|
|
4653
4653
|
channelName: this.name,
|
|
@@ -4655,7 +4655,7 @@ function Oa() {
|
|
|
4655
4655
|
}, s);
|
|
4656
4656
|
}
|
|
4657
4657
|
}
|
|
4658
|
-
class
|
|
4658
|
+
class br {
|
|
4659
4659
|
constructor() {
|
|
4660
4660
|
this.reset();
|
|
4661
4661
|
}
|
|
@@ -4687,7 +4687,7 @@ function Oa() {
|
|
|
4687
4687
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4688
4688
|
}
|
|
4689
4689
|
}
|
|
4690
|
-
var
|
|
4690
|
+
var yr = function(i, t, s, a) {
|
|
4691
4691
|
function l(g) {
|
|
4692
4692
|
return g instanceof s ? g : new s(function(S) {
|
|
4693
4693
|
S(g);
|
|
@@ -4697,15 +4697,15 @@ function Oa() {
|
|
|
4697
4697
|
function x(ee) {
|
|
4698
4698
|
try {
|
|
4699
4699
|
Q(a.next(ee));
|
|
4700
|
-
} catch (
|
|
4701
|
-
S(
|
|
4700
|
+
} catch (ue) {
|
|
4701
|
+
S(ue);
|
|
4702
4702
|
}
|
|
4703
4703
|
}
|
|
4704
4704
|
function j(ee) {
|
|
4705
4705
|
try {
|
|
4706
4706
|
Q(a.throw(ee));
|
|
4707
|
-
} catch (
|
|
4708
|
-
S(
|
|
4707
|
+
} catch (ue) {
|
|
4708
|
+
S(ue);
|
|
4709
4709
|
}
|
|
4710
4710
|
}
|
|
4711
4711
|
function Q(ee) {
|
|
@@ -4714,12 +4714,12 @@ function Oa() {
|
|
|
4714
4714
|
Q((a = a.apply(i, t || [])).next());
|
|
4715
4715
|
});
|
|
4716
4716
|
};
|
|
4717
|
-
class
|
|
4717
|
+
class _r extends bt {
|
|
4718
4718
|
constructor(t, s) {
|
|
4719
|
-
super(t, s), this.members = new
|
|
4719
|
+
super(t, s), this.members = new br();
|
|
4720
4720
|
}
|
|
4721
4721
|
authorize(t, s) {
|
|
4722
|
-
super.authorize(t, (a, l) =>
|
|
4722
|
+
super.authorize(t, (a, l) => yr(this, void 0, void 0, function* () {
|
|
4723
4723
|
if (!a)
|
|
4724
4724
|
if (l = l, l.channel_data != null) {
|
|
4725
4725
|
var g = JSON.parse(l.channel_data);
|
|
@@ -4769,8 +4769,8 @@ function Oa() {
|
|
|
4769
4769
|
this.members.reset(), super.disconnect();
|
|
4770
4770
|
}
|
|
4771
4771
|
}
|
|
4772
|
-
var
|
|
4773
|
-
class
|
|
4772
|
+
var Sr = c(1), yt = c(0);
|
|
4773
|
+
class Cr extends bt {
|
|
4774
4774
|
constructor(t, s, a) {
|
|
4775
4775
|
super(t, s), this.key = null, this.nacl = a;
|
|
4776
4776
|
}
|
|
@@ -4785,7 +4785,7 @@ function Oa() {
|
|
|
4785
4785
|
s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4786
4786
|
return;
|
|
4787
4787
|
}
|
|
4788
|
-
this.key = Object(
|
|
4788
|
+
this.key = Object(yt.decode)(g), delete l.shared_secret, s(null, l);
|
|
4789
4789
|
});
|
|
4790
4790
|
}
|
|
4791
4791
|
trigger(t, s) {
|
|
@@ -4808,12 +4808,12 @@ function Oa() {
|
|
|
4808
4808
|
ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4809
4809
|
return;
|
|
4810
4810
|
}
|
|
4811
|
-
let a = Object(
|
|
4811
|
+
let a = Object(yt.decode)(s.ciphertext);
|
|
4812
4812
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4813
4813
|
ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4814
4814
|
return;
|
|
4815
4815
|
}
|
|
4816
|
-
let l = Object(
|
|
4816
|
+
let l = Object(yt.decode)(s.nonce);
|
|
4817
4817
|
if (l.length < this.nacl.secretbox.nonceLength) {
|
|
4818
4818
|
ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
|
|
4819
4819
|
return;
|
|
@@ -4836,7 +4836,7 @@ function Oa() {
|
|
|
4836
4836
|
this.emit(t, this.getDataToEmit(g));
|
|
4837
4837
|
}
|
|
4838
4838
|
getDataToEmit(t) {
|
|
4839
|
-
let s = Object(
|
|
4839
|
+
let s = Object(Sr.decode)(t);
|
|
4840
4840
|
try {
|
|
4841
4841
|
return JSON.parse(s);
|
|
4842
4842
|
} catch {
|
|
@@ -4844,7 +4844,7 @@ function Oa() {
|
|
|
4844
4844
|
}
|
|
4845
4845
|
}
|
|
4846
4846
|
}
|
|
4847
|
-
class
|
|
4847
|
+
class wr extends Te {
|
|
4848
4848
|
constructor(t, s) {
|
|
4849
4849
|
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);
|
|
4850
4850
|
var a = $.getNetwork();
|
|
@@ -5000,12 +5000,12 @@ function Oa() {
|
|
|
5000
5000
|
return this.state === "connecting" || this.state === "connected";
|
|
5001
5001
|
}
|
|
5002
5002
|
}
|
|
5003
|
-
class
|
|
5003
|
+
class Tr {
|
|
5004
5004
|
constructor() {
|
|
5005
5005
|
this.channels = {};
|
|
5006
5006
|
}
|
|
5007
5007
|
add(t, s) {
|
|
5008
|
-
return this.channels[t] || (this.channels[t] =
|
|
5008
|
+
return this.channels[t] || (this.channels[t] = Er(t, s)), this.channels[t];
|
|
5009
5009
|
}
|
|
5010
5010
|
all() {
|
|
5011
5011
|
return N(this.channels);
|
|
@@ -5023,7 +5023,7 @@ function Oa() {
|
|
|
5023
5023
|
});
|
|
5024
5024
|
}
|
|
5025
5025
|
}
|
|
5026
|
-
function
|
|
5026
|
+
function Er(i, t) {
|
|
5027
5027
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5028
5028
|
if (t.config.nacl)
|
|
5029
5029
|
return Ee.createEncryptedChannel(i, t, t.config.nacl);
|
|
@@ -5039,36 +5039,36 @@ function Oa() {
|
|
|
5039
5039
|
return Ee.createChannel(i, t);
|
|
5040
5040
|
}
|
|
5041
5041
|
}
|
|
5042
|
-
var
|
|
5042
|
+
var Ar = {
|
|
5043
5043
|
createChannels() {
|
|
5044
|
-
return new
|
|
5044
|
+
return new Tr();
|
|
5045
5045
|
},
|
|
5046
5046
|
createConnectionManager(i, t) {
|
|
5047
|
-
return new
|
|
5047
|
+
return new wr(i, t);
|
|
5048
5048
|
},
|
|
5049
5049
|
createChannel(i, t) {
|
|
5050
|
-
return new
|
|
5050
|
+
return new vt(i, t);
|
|
5051
5051
|
},
|
|
5052
5052
|
createPrivateChannel(i, t) {
|
|
5053
|
-
return new
|
|
5053
|
+
return new bt(i, t);
|
|
5054
5054
|
},
|
|
5055
5055
|
createPresenceChannel(i, t) {
|
|
5056
|
-
return new
|
|
5056
|
+
return new _r(i, t);
|
|
5057
5057
|
},
|
|
5058
5058
|
createEncryptedChannel(i, t, s) {
|
|
5059
|
-
return new
|
|
5059
|
+
return new Cr(i, t, s);
|
|
5060
5060
|
},
|
|
5061
5061
|
createTimelineSender(i, t) {
|
|
5062
|
-
return new
|
|
5062
|
+
return new vr(i, t);
|
|
5063
5063
|
},
|
|
5064
5064
|
createHandshake(i, t) {
|
|
5065
|
-
return new
|
|
5065
|
+
return new mr(i, t);
|
|
5066
5066
|
},
|
|
5067
5067
|
createAssistantToTheTransportManager(i, t, s) {
|
|
5068
|
-
return new
|
|
5068
|
+
return new pr(i, t, s);
|
|
5069
5069
|
}
|
|
5070
|
-
}, Ee =
|
|
5071
|
-
class
|
|
5070
|
+
}, Ee = Ar;
|
|
5071
|
+
class hn {
|
|
5072
5072
|
constructor(t) {
|
|
5073
5073
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
5074
5074
|
}
|
|
@@ -5090,7 +5090,7 @@ function Oa() {
|
|
|
5090
5090
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
5091
5091
|
}
|
|
5092
5092
|
isSupported() {
|
|
5093
|
-
return we(this.strategies,
|
|
5093
|
+
return we(this.strategies, fe.method("isSupported"));
|
|
5094
5094
|
}
|
|
5095
5095
|
connect(t, s) {
|
|
5096
5096
|
var a = this.strategies, l = 0, g = this.timeout, S = null, x = (j, Q) => {
|
|
@@ -5121,18 +5121,18 @@ function Oa() {
|
|
|
5121
5121
|
};
|
|
5122
5122
|
}
|
|
5123
5123
|
}
|
|
5124
|
-
class
|
|
5124
|
+
class _t {
|
|
5125
5125
|
constructor(t) {
|
|
5126
5126
|
this.strategies = t;
|
|
5127
5127
|
}
|
|
5128
5128
|
isSupported() {
|
|
5129
|
-
return we(this.strategies,
|
|
5129
|
+
return we(this.strategies, fe.method("isSupported"));
|
|
5130
5130
|
}
|
|
5131
5131
|
connect(t, s) {
|
|
5132
|
-
return
|
|
5132
|
+
return Rr(this.strategies, t, function(a, l) {
|
|
5133
5133
|
return function(g, S) {
|
|
5134
5134
|
if (l[a].error = g, g) {
|
|
5135
|
-
|
|
5135
|
+
Pr(l) && s(!0);
|
|
5136
5136
|
return;
|
|
5137
5137
|
}
|
|
5138
5138
|
U(l, function(x) {
|
|
@@ -5142,13 +5142,13 @@ function Oa() {
|
|
|
5142
5142
|
});
|
|
5143
5143
|
}
|
|
5144
5144
|
}
|
|
5145
|
-
function
|
|
5145
|
+
function Rr(i, t, s) {
|
|
5146
5146
|
var a = ne(i, function(l, g, S, x) {
|
|
5147
5147
|
return l.connect(t, s(g, x));
|
|
5148
5148
|
});
|
|
5149
5149
|
return {
|
|
5150
5150
|
abort: function() {
|
|
5151
|
-
U(a,
|
|
5151
|
+
U(a, Mr);
|
|
5152
5152
|
},
|
|
5153
5153
|
forceMinPriority: function(l) {
|
|
5154
5154
|
U(a, function(g) {
|
|
@@ -5157,15 +5157,15 @@ function Oa() {
|
|
|
5157
5157
|
}
|
|
5158
5158
|
};
|
|
5159
5159
|
}
|
|
5160
|
-
function
|
|
5160
|
+
function Pr(i) {
|
|
5161
5161
|
return pe(i, function(t) {
|
|
5162
5162
|
return !!t.error;
|
|
5163
5163
|
});
|
|
5164
5164
|
}
|
|
5165
|
-
function
|
|
5165
|
+
function Mr(i) {
|
|
5166
5166
|
!i.error && !i.aborted && (i.abort(), i.aborted = !0);
|
|
5167
5167
|
}
|
|
5168
|
-
class
|
|
5168
|
+
class kr {
|
|
5169
5169
|
constructor(t, s, a) {
|
|
5170
5170
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
5171
5171
|
}
|
|
@@ -5173,8 +5173,8 @@ function Oa() {
|
|
|
5173
5173
|
return this.strategy.isSupported();
|
|
5174
5174
|
}
|
|
5175
5175
|
connect(t, s) {
|
|
5176
|
-
var a = this.usingTLS, l =
|
|
5177
|
-
if (l && l.timestamp + this.ttl >=
|
|
5176
|
+
var a = this.usingTLS, l = xr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
|
|
5177
|
+
if (l && l.timestamp + this.ttl >= fe.now()) {
|
|
5178
5178
|
var x = this.transports[l.transport];
|
|
5179
5179
|
x && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
|
|
5180
5180
|
cached: !0,
|
|
@@ -5185,8 +5185,8 @@ function Oa() {
|
|
|
5185
5185
|
failFast: !0
|
|
5186
5186
|
}))) : g++);
|
|
5187
5187
|
}
|
|
5188
|
-
var j =
|
|
5189
|
-
|
|
5188
|
+
var j = fe.now(), Q = S.pop().connect(t, function ee(ue, tt) {
|
|
5189
|
+
ue ? (fn(a), S.length > 0 ? (j = fe.now(), Q = S.pop().connect(t, ee)) : s(ue)) : (Lr(a, tt.transport.name, fe.now() - j, g), s(null, tt));
|
|
5190
5190
|
});
|
|
5191
5191
|
return {
|
|
5192
5192
|
abort: function() {
|
|
@@ -5198,27 +5198,27 @@ function Oa() {
|
|
|
5198
5198
|
};
|
|
5199
5199
|
}
|
|
5200
5200
|
}
|
|
5201
|
-
function
|
|
5201
|
+
function St(i) {
|
|
5202
5202
|
return "pusherTransport" + (i ? "TLS" : "NonTLS");
|
|
5203
5203
|
}
|
|
5204
|
-
function
|
|
5204
|
+
function xr(i) {
|
|
5205
5205
|
var t = $.getLocalStorage();
|
|
5206
5206
|
if (t)
|
|
5207
5207
|
try {
|
|
5208
|
-
var s = t[
|
|
5208
|
+
var s = t[St(i)];
|
|
5209
5209
|
if (s)
|
|
5210
5210
|
return JSON.parse(s);
|
|
5211
5211
|
} catch {
|
|
5212
|
-
|
|
5212
|
+
fn(i);
|
|
5213
5213
|
}
|
|
5214
5214
|
return null;
|
|
5215
5215
|
}
|
|
5216
|
-
function
|
|
5216
|
+
function Lr(i, t, s, a) {
|
|
5217
5217
|
var l = $.getLocalStorage();
|
|
5218
5218
|
if (l)
|
|
5219
5219
|
try {
|
|
5220
|
-
l[
|
|
5221
|
-
timestamp:
|
|
5220
|
+
l[St(i)] = Qe({
|
|
5221
|
+
timestamp: fe.now(),
|
|
5222
5222
|
transport: t,
|
|
5223
5223
|
latency: s,
|
|
5224
5224
|
cacheSkipCount: a
|
|
@@ -5226,15 +5226,15 @@ function Oa() {
|
|
|
5226
5226
|
} catch {
|
|
5227
5227
|
}
|
|
5228
5228
|
}
|
|
5229
|
-
function
|
|
5229
|
+
function fn(i) {
|
|
5230
5230
|
var t = $.getLocalStorage();
|
|
5231
5231
|
if (t)
|
|
5232
5232
|
try {
|
|
5233
|
-
delete t[
|
|
5233
|
+
delete t[St(i)];
|
|
5234
5234
|
} catch {
|
|
5235
5235
|
}
|
|
5236
5236
|
}
|
|
5237
|
-
class
|
|
5237
|
+
class Ze {
|
|
5238
5238
|
constructor(t, { delay: s }) {
|
|
5239
5239
|
this.strategy = t, this.options = { delay: s };
|
|
5240
5240
|
}
|
|
@@ -5255,7 +5255,7 @@ function Oa() {
|
|
|
5255
5255
|
};
|
|
5256
5256
|
}
|
|
5257
5257
|
}
|
|
5258
|
-
class
|
|
5258
|
+
class ze {
|
|
5259
5259
|
constructor(t, s, a) {
|
|
5260
5260
|
this.test = t, this.trueBranch = s, this.falseBranch = a;
|
|
5261
5261
|
}
|
|
@@ -5268,7 +5268,7 @@ function Oa() {
|
|
|
5268
5268
|
return a.connect(t, s);
|
|
5269
5269
|
}
|
|
5270
5270
|
}
|
|
5271
|
-
class
|
|
5271
|
+
class Ir {
|
|
5272
5272
|
constructor(t) {
|
|
5273
5273
|
this.strategy = t;
|
|
5274
5274
|
}
|
|
@@ -5282,16 +5282,16 @@ function Oa() {
|
|
|
5282
5282
|
return a;
|
|
5283
5283
|
}
|
|
5284
5284
|
}
|
|
5285
|
-
function
|
|
5285
|
+
function je(i) {
|
|
5286
5286
|
return function() {
|
|
5287
5287
|
return i.isSupported();
|
|
5288
5288
|
};
|
|
5289
5289
|
}
|
|
5290
|
-
var
|
|
5290
|
+
var Ur = function(i, t, s) {
|
|
5291
5291
|
var a = {};
|
|
5292
|
-
function l(
|
|
5293
|
-
var
|
|
5294
|
-
return a[
|
|
5292
|
+
function l(Tn, Ii, Ui, Oi, Fi) {
|
|
5293
|
+
var En = s(i, Tn, Ii, Ui, Oi, Fi);
|
|
5294
|
+
return a[Tn] = En, En;
|
|
5295
5295
|
}
|
|
5296
5296
|
var g = Object.assign({}, t, {
|
|
5297
5297
|
hostNonTLS: i.wsHost + ":" + i.wsPort,
|
|
@@ -5307,43 +5307,43 @@ function Oa() {
|
|
|
5307
5307
|
loop: !0,
|
|
5308
5308
|
timeout: 15e3,
|
|
5309
5309
|
timeoutLimit: 6e4
|
|
5310
|
-
}, Q = new
|
|
5310
|
+
}, Q = new hn({
|
|
5311
5311
|
minPingDelay: 1e4,
|
|
5312
5312
|
maxPingDelay: i.activityTimeout
|
|
5313
|
-
}), ee = new
|
|
5313
|
+
}), ee = new hn({
|
|
5314
5314
|
lives: 2,
|
|
5315
5315
|
minPingDelay: 1e4,
|
|
5316
5316
|
maxPingDelay: i.activityTimeout
|
|
5317
|
-
}),
|
|
5318
|
-
new je(
|
|
5319
|
-
], j),
|
|
5320
|
-
new je(
|
|
5321
|
-
], j),
|
|
5322
|
-
new je(
|
|
5323
|
-
|
|
5324
|
-
new
|
|
5325
|
-
]),
|
|
5326
|
-
], j),
|
|
5327
|
-
return t.useTLS ?
|
|
5328
|
-
|
|
5329
|
-
new
|
|
5330
|
-
]) :
|
|
5331
|
-
|
|
5332
|
-
new
|
|
5333
|
-
new
|
|
5334
|
-
]), new
|
|
5317
|
+
}), ue = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Pi = l("sockjs", "sockjs", 1, x), bn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Mi = l("xdr_streaming", "xdr_streaming", 1, x, ee), yn = l("xhr_polling", "xhr_polling", 1, x), ki = l("xdr_polling", "xdr_polling", 1, x), _n = new Ue([ue], j), xi = new Ue([tt], j), Li = new Ue([Pi], j), Sn = new Ue([
|
|
5318
|
+
new ze(je(bn), bn, Mi)
|
|
5319
|
+
], j), Cn = new Ue([
|
|
5320
|
+
new ze(je(yn), yn, ki)
|
|
5321
|
+
], j), wn = new Ue([
|
|
5322
|
+
new ze(je(Sn), new _t([
|
|
5323
|
+
Sn,
|
|
5324
|
+
new Ze(Cn, { delay: 4e3 })
|
|
5325
|
+
]), Cn)
|
|
5326
|
+
], j), Et = new ze(je(wn), wn, Li), At;
|
|
5327
|
+
return t.useTLS ? At = new _t([
|
|
5328
|
+
_n,
|
|
5329
|
+
new Ze(Et, { delay: 2e3 })
|
|
5330
|
+
]) : At = new _t([
|
|
5331
|
+
_n,
|
|
5332
|
+
new Ze(xi, { delay: 2e3 }),
|
|
5333
|
+
new Ze(Et, { delay: 5e3 })
|
|
5334
|
+
]), new kr(new Ir(new ze(je(ue), At, Et)), a, {
|
|
5335
5335
|
ttl: 18e5,
|
|
5336
5336
|
timeline: t.timeline,
|
|
5337
5337
|
useTLS: t.useTLS
|
|
5338
5338
|
});
|
|
5339
|
-
},
|
|
5339
|
+
}, Or = Ur, Fr = (function() {
|
|
5340
5340
|
var i = this;
|
|
5341
5341
|
i.timeline.info(i.buildTimelineMessage({
|
|
5342
5342
|
transport: i.name + (i.options.useTLS ? "s" : "")
|
|
5343
5343
|
})), i.hooks.isInitialized() ? i.changeState("initialized") : i.hooks.file ? (i.changeState("initializing"), v.load(i.hooks.file, { useTLS: i.options.useTLS }, function(t, s) {
|
|
5344
5344
|
i.hooks.isInitialized() ? (i.changeState("initialized"), s(!0)) : (t && i.onError(t), i.onClose(), s(!1));
|
|
5345
5345
|
})) : i.onClose();
|
|
5346
|
-
}),
|
|
5346
|
+
}), Dr = {
|
|
5347
5347
|
getRequest: function(i) {
|
|
5348
5348
|
var t = new window.XDomainRequest();
|
|
5349
5349
|
return t.ontimeout = function() {
|
|
@@ -5359,9 +5359,9 @@ function Oa() {
|
|
|
5359
5359
|
abortRequest: function(i) {
|
|
5360
5360
|
i.ontimeout = i.onerror = i.onprogress = i.onload = null, i.abort();
|
|
5361
5361
|
}
|
|
5362
|
-
},
|
|
5363
|
-
const
|
|
5364
|
-
class
|
|
5362
|
+
}, Nr = Dr;
|
|
5363
|
+
const qr = 256 * 1024;
|
|
5364
|
+
class zr extends Te {
|
|
5365
5365
|
constructor(t, s, a) {
|
|
5366
5366
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5367
5367
|
}
|
|
@@ -5389,17 +5389,17 @@ function Oa() {
|
|
|
5389
5389
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5390
5390
|
}
|
|
5391
5391
|
isBufferTooLong(t) {
|
|
5392
|
-
return this.position === t.length && t.length >
|
|
5392
|
+
return this.position === t.length && t.length > qr;
|
|
5393
5393
|
}
|
|
5394
5394
|
}
|
|
5395
|
-
var
|
|
5395
|
+
var Ct;
|
|
5396
5396
|
(function(i) {
|
|
5397
5397
|
i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED";
|
|
5398
|
-
})(
|
|
5399
|
-
var Oe =
|
|
5400
|
-
class
|
|
5398
|
+
})(Ct || (Ct = {}));
|
|
5399
|
+
var Oe = Ct, jr = 1;
|
|
5400
|
+
class $r {
|
|
5401
5401
|
constructor(t, s) {
|
|
5402
|
-
this.hooks = t, this.session =
|
|
5402
|
+
this.hooks = t, this.session = gn(1e3) + "/" + Xr(8), this.location = Hr(s), this.readyState = Oe.CONNECTING, this.openStream();
|
|
5403
5403
|
}
|
|
5404
5404
|
send(t) {
|
|
5405
5405
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5413,7 +5413,7 @@ function Oa() {
|
|
|
5413
5413
|
sendRaw(t) {
|
|
5414
5414
|
if (this.readyState === Oe.OPEN)
|
|
5415
5415
|
try {
|
|
5416
|
-
return $.createSocketRequest("POST",
|
|
5416
|
+
return $.createSocketRequest("POST", pn(Br(this.location, this.session))).start(t), !0;
|
|
5417
5417
|
} catch {
|
|
5418
5418
|
return !1;
|
|
5419
5419
|
}
|
|
@@ -5456,7 +5456,7 @@ function Oa() {
|
|
|
5456
5456
|
}
|
|
5457
5457
|
}
|
|
5458
5458
|
onOpen(t) {
|
|
5459
|
-
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base =
|
|
5459
|
+
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base = Vr(this.location.base, t.hostname)), this.readyState = Oe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5460
5460
|
}
|
|
5461
5461
|
onEvent(t) {
|
|
5462
5462
|
this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
@@ -5468,7 +5468,7 @@ function Oa() {
|
|
|
5468
5468
|
this.onerror && this.onerror(t);
|
|
5469
5469
|
}
|
|
5470
5470
|
openStream() {
|
|
5471
|
-
this.stream = $.createSocketRequest("POST",
|
|
5471
|
+
this.stream = $.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5472
5472
|
this.onChunk(t);
|
|
5473
5473
|
}), this.stream.bind("finished", (t) => {
|
|
5474
5474
|
this.hooks.onFinished(this, t);
|
|
@@ -5478,7 +5478,7 @@ function Oa() {
|
|
|
5478
5478
|
try {
|
|
5479
5479
|
this.stream.start();
|
|
5480
5480
|
} catch (t) {
|
|
5481
|
-
|
|
5481
|
+
fe.defer(() => {
|
|
5482
5482
|
this.onError(t), this.onClose(1006, "Could not start streaming", !1);
|
|
5483
5483
|
});
|
|
5484
5484
|
}
|
|
@@ -5487,33 +5487,33 @@ function Oa() {
|
|
|
5487
5487
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5488
5488
|
}
|
|
5489
5489
|
}
|
|
5490
|
-
function
|
|
5490
|
+
function Hr(i) {
|
|
5491
5491
|
var t = /([^\?]*)\/*(\??.*)/.exec(i);
|
|
5492
5492
|
return {
|
|
5493
5493
|
base: t[1],
|
|
5494
5494
|
queryString: t[2]
|
|
5495
5495
|
};
|
|
5496
5496
|
}
|
|
5497
|
-
function
|
|
5497
|
+
function Br(i, t) {
|
|
5498
5498
|
return i.base + "/" + t + "/xhr_send";
|
|
5499
5499
|
}
|
|
5500
|
-
function
|
|
5500
|
+
function pn(i) {
|
|
5501
5501
|
var t = i.indexOf("?") === -1 ? "?" : "&";
|
|
5502
|
-
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5502
|
+
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + jr++;
|
|
5503
5503
|
}
|
|
5504
|
-
function
|
|
5504
|
+
function Vr(i, t) {
|
|
5505
5505
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(i);
|
|
5506
5506
|
return s[1] + t + s[3];
|
|
5507
5507
|
}
|
|
5508
|
-
function
|
|
5508
|
+
function gn(i) {
|
|
5509
5509
|
return $.randomInt(i);
|
|
5510
5510
|
}
|
|
5511
|
-
function
|
|
5511
|
+
function Xr(i) {
|
|
5512
5512
|
for (var t = [], s = 0; s < i; s++)
|
|
5513
|
-
t.push(
|
|
5513
|
+
t.push(gn(32).toString(32));
|
|
5514
5514
|
return t.join("");
|
|
5515
5515
|
}
|
|
5516
|
-
var
|
|
5516
|
+
var Wr = $r, Gr = {
|
|
5517
5517
|
getReceiveURL: function(i, t) {
|
|
5518
5518
|
return i.base + "/" + t + "/xhr_streaming" + i.queryString;
|
|
5519
5519
|
},
|
|
@@ -5526,7 +5526,7 @@ function Oa() {
|
|
|
5526
5526
|
onFinished: function(i, t) {
|
|
5527
5527
|
i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5528
5528
|
}
|
|
5529
|
-
},
|
|
5529
|
+
}, Jr = Gr, Kr = {
|
|
5530
5530
|
getReceiveURL: function(i, t) {
|
|
5531
5531
|
return i.base + "/" + t + "/xhr" + i.queryString;
|
|
5532
5532
|
},
|
|
@@ -5538,7 +5538,7 @@ function Oa() {
|
|
|
5538
5538
|
onFinished: function(i, t) {
|
|
5539
5539
|
t === 200 ? i.reconnect() : i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5540
5540
|
}
|
|
5541
|
-
},
|
|
5541
|
+
}, Qr = Kr, Yr = {
|
|
5542
5542
|
getRequest: function(i) {
|
|
5543
5543
|
var t = $.getXHRAPI(), s = new t();
|
|
5544
5544
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5555,36 +5555,36 @@ function Oa() {
|
|
|
5555
5555
|
abortRequest: function(i) {
|
|
5556
5556
|
i.onreadystatechange = null, i.abort();
|
|
5557
5557
|
}
|
|
5558
|
-
},
|
|
5558
|
+
}, Zr = Yr, ei = {
|
|
5559
5559
|
createStreamingSocket(i) {
|
|
5560
|
-
return this.createSocket(
|
|
5560
|
+
return this.createSocket(Jr, i);
|
|
5561
5561
|
},
|
|
5562
5562
|
createPollingSocket(i) {
|
|
5563
|
-
return this.createSocket(
|
|
5563
|
+
return this.createSocket(Qr, i);
|
|
5564
5564
|
},
|
|
5565
5565
|
createSocket(i, t) {
|
|
5566
|
-
return new
|
|
5566
|
+
return new Wr(i, t);
|
|
5567
5567
|
},
|
|
5568
5568
|
createXHR(i, t) {
|
|
5569
|
-
return this.createRequest(
|
|
5569
|
+
return this.createRequest(Zr, i, t);
|
|
5570
5570
|
},
|
|
5571
5571
|
createRequest(i, t, s) {
|
|
5572
|
-
return new
|
|
5572
|
+
return new zr(i, t, s);
|
|
5573
5573
|
}
|
|
5574
|
-
},
|
|
5575
|
-
|
|
5576
|
-
return this.createRequest(
|
|
5574
|
+
}, mn = ei;
|
|
5575
|
+
mn.createXDR = function(i, t) {
|
|
5576
|
+
return this.createRequest(Nr, i, t);
|
|
5577
5577
|
};
|
|
5578
|
-
var
|
|
5578
|
+
var ti = mn, ni = {
|
|
5579
5579
|
nextAuthCallbackID: 1,
|
|
5580
5580
|
auth_callbacks: {},
|
|
5581
5581
|
ScriptReceivers: d,
|
|
5582
5582
|
DependenciesReceivers: C,
|
|
5583
|
-
getDefaultStrategy:
|
|
5584
|
-
Transports:
|
|
5585
|
-
transportConnectionInitializer:
|
|
5586
|
-
HTTPFactory:
|
|
5587
|
-
TimelineTransport:
|
|
5583
|
+
getDefaultStrategy: Or,
|
|
5584
|
+
Transports: dr,
|
|
5585
|
+
transportConnectionInitializer: Fr,
|
|
5586
|
+
HTTPFactory: ti,
|
|
5587
|
+
TimelineTransport: Ys,
|
|
5588
5588
|
getXHRAPI() {
|
|
5589
5589
|
return window.XMLHttpRequest;
|
|
5590
5590
|
},
|
|
@@ -5605,7 +5605,7 @@ function Oa() {
|
|
|
5605
5605
|
return this.getDocument().location.protocol;
|
|
5606
5606
|
},
|
|
5607
5607
|
getAuthorizers() {
|
|
5608
|
-
return { ajax: K, jsonp:
|
|
5608
|
+
return { ajax: K, jsonp: Ws };
|
|
5609
5609
|
},
|
|
5610
5610
|
onDocumentBody(i) {
|
|
5611
5611
|
document.body ? i() : setTimeout(() => {
|
|
@@ -5613,10 +5613,10 @@ function Oa() {
|
|
|
5613
5613
|
}, 0);
|
|
5614
5614
|
},
|
|
5615
5615
|
createJSONPRequest(i, t) {
|
|
5616
|
-
return new
|
|
5616
|
+
return new Js(i, t);
|
|
5617
5617
|
},
|
|
5618
5618
|
createScriptRequest(i) {
|
|
5619
|
-
return new
|
|
5619
|
+
return new Gs(i);
|
|
5620
5620
|
},
|
|
5621
5621
|
getLocalStorage() {
|
|
5622
5622
|
try {
|
|
@@ -5636,7 +5636,7 @@ function Oa() {
|
|
|
5636
5636
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5637
5637
|
},
|
|
5638
5638
|
getNetwork() {
|
|
5639
|
-
return
|
|
5639
|
+
return fr;
|
|
5640
5640
|
},
|
|
5641
5641
|
createWebSocket(i) {
|
|
5642
5642
|
var t = this.getWebSocketAPI();
|
|
@@ -5668,26 +5668,26 @@ function Oa() {
|
|
|
5668
5668
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5669
5669
|
}() * i);
|
|
5670
5670
|
}
|
|
5671
|
-
}, $ =
|
|
5671
|
+
}, $ = ni, wt;
|
|
5672
5672
|
(function(i) {
|
|
5673
5673
|
i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
|
|
5674
|
-
})(
|
|
5675
|
-
var
|
|
5676
|
-
class
|
|
5674
|
+
})(wt || (wt = {}));
|
|
5675
|
+
var et = wt;
|
|
5676
|
+
class si {
|
|
5677
5677
|
constructor(t, s, a) {
|
|
5678
5678
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5679
5679
|
}
|
|
5680
5680
|
log(t, s) {
|
|
5681
|
-
t <= this.options.level && (this.events.push(me({}, s, { timestamp:
|
|
5681
|
+
t <= this.options.level && (this.events.push(me({}, s, { timestamp: fe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5682
5682
|
}
|
|
5683
5683
|
error(t) {
|
|
5684
|
-
this.log(
|
|
5684
|
+
this.log(et.ERROR, t);
|
|
5685
5685
|
}
|
|
5686
5686
|
info(t) {
|
|
5687
|
-
this.log(
|
|
5687
|
+
this.log(et.INFO, t);
|
|
5688
5688
|
}
|
|
5689
5689
|
debug(t) {
|
|
5690
|
-
this.log(
|
|
5690
|
+
this.log(et.DEBUG, t);
|
|
5691
5691
|
}
|
|
5692
5692
|
isEmpty() {
|
|
5693
5693
|
return this.events.length === 0;
|
|
@@ -5711,7 +5711,7 @@ function Oa() {
|
|
|
5711
5711
|
return this.uniqueID++, this.uniqueID;
|
|
5712
5712
|
}
|
|
5713
5713
|
}
|
|
5714
|
-
class
|
|
5714
|
+
class ri {
|
|
5715
5715
|
constructor(t, s, a, l) {
|
|
5716
5716
|
this.name = t, this.priority = s, this.transport = a, this.options = l || {};
|
|
5717
5717
|
}
|
|
@@ -5723,20 +5723,20 @@ function Oa() {
|
|
|
5723
5723
|
connect(t, s) {
|
|
5724
5724
|
if (this.isSupported()) {
|
|
5725
5725
|
if (this.priority < t)
|
|
5726
|
-
return
|
|
5727
|
-
} else return
|
|
5726
|
+
return vn(new O(), s);
|
|
5727
|
+
} else return vn(new te(), s);
|
|
5728
5728
|
var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
|
|
5729
5729
|
l.unbind("initialized", S), l.connect();
|
|
5730
5730
|
}, x = function() {
|
|
5731
|
-
g = Ee.createHandshake(l, function(
|
|
5732
|
-
a = !0, ee(), s(null,
|
|
5731
|
+
g = Ee.createHandshake(l, function(ue) {
|
|
5732
|
+
a = !0, ee(), s(null, ue);
|
|
5733
5733
|
});
|
|
5734
|
-
}, j = function(
|
|
5735
|
-
ee(), s(
|
|
5734
|
+
}, j = function(ue) {
|
|
5735
|
+
ee(), s(ue);
|
|
5736
5736
|
}, Q = function() {
|
|
5737
5737
|
ee();
|
|
5738
|
-
var
|
|
5739
|
-
|
|
5738
|
+
var ue;
|
|
5739
|
+
ue = Qe(l), s(new z(ue));
|
|
5740
5740
|
}, ee = function() {
|
|
5741
5741
|
l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", j), l.unbind("closed", Q);
|
|
5742
5742
|
};
|
|
@@ -5744,14 +5744,14 @@ function Oa() {
|
|
|
5744
5744
|
abort: () => {
|
|
5745
5745
|
a || (ee(), g ? g.close() : l.close());
|
|
5746
5746
|
},
|
|
5747
|
-
forceMinPriority: (
|
|
5748
|
-
a || this.priority <
|
|
5747
|
+
forceMinPriority: (ue) => {
|
|
5748
|
+
a || this.priority < ue && (g ? g.close() : l.close());
|
|
5749
5749
|
}
|
|
5750
5750
|
};
|
|
5751
5751
|
}
|
|
5752
5752
|
}
|
|
5753
|
-
function
|
|
5754
|
-
return
|
|
5753
|
+
function vn(i, t) {
|
|
5754
|
+
return fe.defer(function() {
|
|
5755
5755
|
t(i);
|
|
5756
5756
|
}), {
|
|
5757
5757
|
abort: function() {
|
|
@@ -5760,19 +5760,19 @@ function Oa() {
|
|
|
5760
5760
|
}
|
|
5761
5761
|
};
|
|
5762
5762
|
}
|
|
5763
|
-
const { Transports:
|
|
5764
|
-
var
|
|
5765
|
-
var S =
|
|
5763
|
+
const { Transports: ii } = $;
|
|
5764
|
+
var oi = function(i, t, s, a, l, g) {
|
|
5765
|
+
var S = ii[s];
|
|
5766
5766
|
if (!S)
|
|
5767
5767
|
throw new W(s);
|
|
5768
|
-
var x = (!i.enabledTransports ||
|
|
5769
|
-
return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), j = new
|
|
5770
|
-
},
|
|
5768
|
+
var x = (!i.enabledTransports || ft(i.enabledTransports, t) !== -1) && (!i.disabledTransports || ft(i.disabledTransports, t) === -1), j;
|
|
5769
|
+
return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), j = new ri(t, a, g ? g.getAssistant(S) : S, l)) : j = ai, j;
|
|
5770
|
+
}, ai = {
|
|
5771
5771
|
isSupported: function() {
|
|
5772
5772
|
return !1;
|
|
5773
5773
|
},
|
|
5774
5774
|
connect: function(i, t) {
|
|
5775
|
-
var s =
|
|
5775
|
+
var s = fe.defer(function() {
|
|
5776
5776
|
t(new te());
|
|
5777
5777
|
});
|
|
5778
5778
|
return {
|
|
@@ -5784,14 +5784,14 @@ function Oa() {
|
|
|
5784
5784
|
};
|
|
5785
5785
|
}
|
|
5786
5786
|
};
|
|
5787
|
-
function
|
|
5787
|
+
function ci(i) {
|
|
5788
5788
|
if (i == null)
|
|
5789
5789
|
throw "You must pass an options object";
|
|
5790
5790
|
if (i.cluster == null)
|
|
5791
5791
|
throw "Options object must provide a cluster";
|
|
5792
5792
|
"disableStats" in i && ae.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5793
5793
|
}
|
|
5794
|
-
const
|
|
5794
|
+
const ui = (i, t) => {
|
|
5795
5795
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5796
5796
|
for (var a in t.params)
|
|
5797
5797
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5802,15 +5802,15 @@ function Oa() {
|
|
|
5802
5802
|
}
|
|
5803
5803
|
return s;
|
|
5804
5804
|
};
|
|
5805
|
-
var
|
|
5805
|
+
var li = (i) => {
|
|
5806
5806
|
if (typeof $.getAuthorizers()[i.transport] > "u")
|
|
5807
5807
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5808
5808
|
return (t, s) => {
|
|
5809
|
-
const a =
|
|
5809
|
+
const a = ui(t, i);
|
|
5810
5810
|
$.getAuthorizers()[i.transport]($, a, i, w.UserAuthentication, s);
|
|
5811
5811
|
};
|
|
5812
5812
|
};
|
|
5813
|
-
const
|
|
5813
|
+
const di = (i, t) => {
|
|
5814
5814
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5815
5815
|
s += "&channel_name=" + encodeURIComponent(i.channelName);
|
|
5816
5816
|
for (var a in t.params)
|
|
@@ -5822,15 +5822,15 @@ function Oa() {
|
|
|
5822
5822
|
}
|
|
5823
5823
|
return s;
|
|
5824
5824
|
};
|
|
5825
|
-
var
|
|
5825
|
+
var hi = (i) => {
|
|
5826
5826
|
if (typeof $.getAuthorizers()[i.transport] > "u")
|
|
5827
5827
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5828
5828
|
return (t, s) => {
|
|
5829
|
-
const a =
|
|
5829
|
+
const a = di(t, i);
|
|
5830
5830
|
$.getAuthorizers()[i.transport]($, a, i, w.ChannelAuthorization, s);
|
|
5831
5831
|
};
|
|
5832
5832
|
};
|
|
5833
|
-
const
|
|
5833
|
+
const fi = (i, t, s) => {
|
|
5834
5834
|
const a = {
|
|
5835
5835
|
authTransport: t.transport,
|
|
5836
5836
|
authEndpoint: t.endpoint,
|
|
@@ -5844,7 +5844,7 @@ function Oa() {
|
|
|
5844
5844
|
s(S, a).authorize(l.socketId, g);
|
|
5845
5845
|
};
|
|
5846
5846
|
};
|
|
5847
|
-
function
|
|
5847
|
+
function pi(i, t) {
|
|
5848
5848
|
let s = {
|
|
5849
5849
|
activityTimeout: i.activityTimeout || h.activityTimeout,
|
|
5850
5850
|
cluster: i.cluster,
|
|
@@ -5857,46 +5857,46 @@ function Oa() {
|
|
|
5857
5857
|
wsPath: i.wsPath || h.wsPath,
|
|
5858
5858
|
wsPort: i.wsPort || h.wsPort,
|
|
5859
5859
|
wssPort: i.wssPort || h.wssPort,
|
|
5860
|
-
enableStats:
|
|
5861
|
-
httpHost:
|
|
5862
|
-
useTLS:
|
|
5863
|
-
wsHost:
|
|
5864
|
-
userAuthenticator:
|
|
5865
|
-
channelAuthorizer:
|
|
5860
|
+
enableStats: yi(i),
|
|
5861
|
+
httpHost: gi(i),
|
|
5862
|
+
useTLS: bi(i),
|
|
5863
|
+
wsHost: mi(i),
|
|
5864
|
+
userAuthenticator: _i(i),
|
|
5865
|
+
channelAuthorizer: Ci(i, t)
|
|
5866
5866
|
};
|
|
5867
5867
|
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;
|
|
5868
5868
|
}
|
|
5869
|
-
function
|
|
5869
|
+
function gi(i) {
|
|
5870
5870
|
return i.httpHost ? i.httpHost : i.cluster ? `sockjs-${i.cluster}.pusher.com` : h.httpHost;
|
|
5871
5871
|
}
|
|
5872
|
-
function
|
|
5873
|
-
return i.wsHost ? i.wsHost :
|
|
5872
|
+
function mi(i) {
|
|
5873
|
+
return i.wsHost ? i.wsHost : vi(i.cluster);
|
|
5874
5874
|
}
|
|
5875
|
-
function
|
|
5875
|
+
function vi(i) {
|
|
5876
5876
|
return `ws-${i}.pusher.com`;
|
|
5877
5877
|
}
|
|
5878
|
-
function
|
|
5878
|
+
function bi(i) {
|
|
5879
5879
|
return $.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
|
|
5880
5880
|
}
|
|
5881
|
-
function
|
|
5881
|
+
function yi(i) {
|
|
5882
5882
|
return "enableStats" in i ? i.enableStats : "disableStats" in i ? !i.disableStats : !1;
|
|
5883
5883
|
}
|
|
5884
|
-
function
|
|
5884
|
+
function _i(i) {
|
|
5885
5885
|
const t = Object.assign(Object.assign({}, h.userAuthentication), i.userAuthentication);
|
|
5886
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5886
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : li(t);
|
|
5887
5887
|
}
|
|
5888
|
-
function
|
|
5888
|
+
function Si(i, t) {
|
|
5889
5889
|
let s;
|
|
5890
5890
|
return "channelAuthorization" in i ? s = Object.assign(Object.assign({}, h.channelAuthorization), i.channelAuthorization) : (s = {
|
|
5891
5891
|
transport: i.authTransport || h.authTransport,
|
|
5892
5892
|
endpoint: i.authEndpoint || h.authEndpoint
|
|
5893
|
-
}, "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 =
|
|
5893
|
+
}, "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 = fi(t, s, i.authorizer))), s;
|
|
5894
5894
|
}
|
|
5895
|
-
function
|
|
5896
|
-
const s =
|
|
5897
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5895
|
+
function Ci(i, t) {
|
|
5896
|
+
const s = Si(i, t);
|
|
5897
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : hi(s);
|
|
5898
5898
|
}
|
|
5899
|
-
class
|
|
5899
|
+
class wi extends Te {
|
|
5900
5900
|
constructor(t) {
|
|
5901
5901
|
super(function(s, a) {
|
|
5902
5902
|
ae.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5914,14 +5914,14 @@ function Oa() {
|
|
|
5914
5914
|
});
|
|
5915
5915
|
}
|
|
5916
5916
|
}
|
|
5917
|
-
function
|
|
5917
|
+
function Ti() {
|
|
5918
5918
|
let i, t;
|
|
5919
5919
|
return { promise: new Promise((a, l) => {
|
|
5920
5920
|
i = a, t = l;
|
|
5921
5921
|
}), resolve: i, reject: t };
|
|
5922
5922
|
}
|
|
5923
|
-
var
|
|
5924
|
-
class
|
|
5923
|
+
var Ei = Ti;
|
|
5924
|
+
class Ai extends Te {
|
|
5925
5925
|
constructor(t) {
|
|
5926
5926
|
super(function(s, a) {
|
|
5927
5927
|
ae.debug("No callbacks on user for " + s);
|
|
@@ -5936,7 +5936,7 @@ function Oa() {
|
|
|
5936
5936
|
});
|
|
5937
5937
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5938
5938
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5939
|
-
}), this.watchlist = new
|
|
5939
|
+
}), this.watchlist = new wi(t), this.pusher.connection.bind("message", (s) => {
|
|
5940
5940
|
var a = s.event;
|
|
5941
5941
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5942
5942
|
});
|
|
@@ -5966,7 +5966,7 @@ function Oa() {
|
|
|
5966
5966
|
const t = (s) => {
|
|
5967
5967
|
s.subscriptionPending && s.subscriptionCancelled ? s.reinstateSubscription() : !s.subscriptionPending && this.pusher.connection.state === "connected" && s.subscribe();
|
|
5968
5968
|
};
|
|
5969
|
-
this.serverToUserChannel = new
|
|
5969
|
+
this.serverToUserChannel = new vt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
|
|
5970
5970
|
s.indexOf("pusher_internal:") === 0 || s.indexOf("pusher:") === 0 || this.emit(s, a);
|
|
5971
5971
|
}), t(this.serverToUserChannel);
|
|
5972
5972
|
}
|
|
@@ -5976,7 +5976,7 @@ function Oa() {
|
|
|
5976
5976
|
_newSigninPromiseIfNeeded() {
|
|
5977
5977
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
5978
5978
|
return;
|
|
5979
|
-
const { promise: t, resolve: s } =
|
|
5979
|
+
const { promise: t, resolve: s } = Ei();
|
|
5980
5980
|
t.done = !1;
|
|
5981
5981
|
const a = () => {
|
|
5982
5982
|
t.done = !0;
|
|
@@ -5991,23 +5991,23 @@ function Oa() {
|
|
|
5991
5991
|
ge.instances[t].connect();
|
|
5992
5992
|
}
|
|
5993
5993
|
static getClientFeatures() {
|
|
5994
|
-
return
|
|
5994
|
+
return R(Re({ ws: $.Transports.ws }, function(t) {
|
|
5995
5995
|
return t.isSupported({});
|
|
5996
5996
|
}));
|
|
5997
5997
|
}
|
|
5998
5998
|
constructor(t, s) {
|
|
5999
|
-
|
|
5999
|
+
Ri(t), ci(s), this.key = t, this.config = pi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = $.randomInt(1e9), this.timeline = new si(this.key, this.sessionID, {
|
|
6000
6000
|
cluster: this.config.cluster,
|
|
6001
6001
|
features: ge.getClientFeatures(),
|
|
6002
6002
|
params: this.config.timelineParams || {},
|
|
6003
6003
|
limit: 50,
|
|
6004
|
-
level:
|
|
6004
|
+
level: et.INFO,
|
|
6005
6005
|
version: h.VERSION
|
|
6006
6006
|
}), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
|
|
6007
6007
|
host: this.config.statsHost,
|
|
6008
6008
|
path: "/timeline/v2/" + $.TimelineTransport.name
|
|
6009
6009
|
}));
|
|
6010
|
-
var a = (l) => $.getDefaultStrategy(this.config, l,
|
|
6010
|
+
var a = (l) => $.getDefaultStrategy(this.config, l, oi);
|
|
6011
6011
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
6012
6012
|
getStrategy: a,
|
|
6013
6013
|
timeline: this.timeline,
|
|
@@ -6030,7 +6030,7 @@ function Oa() {
|
|
|
6030
6030
|
this.channels.disconnect();
|
|
6031
6031
|
}), this.connection.bind("error", (l) => {
|
|
6032
6032
|
ae.warn(l);
|
|
6033
|
-
}), ge.instances.push(this), this.timeline.info({ instances: ge.instances.length }), this.user = new
|
|
6033
|
+
}), ge.instances.push(this), this.timeline.info({ instances: ge.instances.length }), this.user = new Ai(this), ge.isReady && this.connect();
|
|
6034
6034
|
}
|
|
6035
6035
|
channel(t) {
|
|
6036
6036
|
return this.channels.find(t);
|
|
@@ -6088,8 +6088,8 @@ function Oa() {
|
|
|
6088
6088
|
}
|
|
6089
6089
|
}
|
|
6090
6090
|
ge.instances = [], ge.isReady = !1, ge.logToConsole = !1, ge.Runtime = $, ge.ScriptReceivers = $.ScriptReceivers, ge.DependenciesReceivers = $.DependenciesReceivers, ge.auth_callbacks = $.auth_callbacks;
|
|
6091
|
-
var
|
|
6092
|
-
function
|
|
6091
|
+
var Tt = o.default = ge;
|
|
6092
|
+
function Ri(i) {
|
|
6093
6093
|
if (i == null)
|
|
6094
6094
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
6095
6095
|
}
|
|
@@ -6099,14 +6099,14 @@ function Oa() {
|
|
|
6099
6099
|
])
|
|
6100
6100
|
);
|
|
6101
6101
|
});
|
|
6102
|
-
})(
|
|
6102
|
+
})(Ut)), Ut.exports;
|
|
6103
6103
|
}
|
|
6104
6104
|
var Fa = Oa();
|
|
6105
6105
|
const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
|
|
6106
|
-
function
|
|
6106
|
+
function re(e) {
|
|
6107
6107
|
return typeof e == "object" && e !== null;
|
|
6108
6108
|
}
|
|
6109
|
-
function
|
|
6109
|
+
function de(e, n) {
|
|
6110
6110
|
return typeof e[n] == "string";
|
|
6111
6111
|
}
|
|
6112
6112
|
function Ce(e, n) {
|
|
@@ -6115,7 +6115,7 @@ function Ce(e, n) {
|
|
|
6115
6115
|
throw new Error(`Invalid messenger bootstrap payload: missing string ${n}`);
|
|
6116
6116
|
return r.trim();
|
|
6117
6117
|
}
|
|
6118
|
-
function
|
|
6118
|
+
function Ve(e, n) {
|
|
6119
6119
|
const r = e[n];
|
|
6120
6120
|
if (r == null)
|
|
6121
6121
|
return null;
|
|
@@ -6143,28 +6143,28 @@ function Ba(e) {
|
|
|
6143
6143
|
return e.startsWith("/") ? e : `/${e}`;
|
|
6144
6144
|
}
|
|
6145
6145
|
function Va(e) {
|
|
6146
|
-
const n =
|
|
6147
|
-
if (!
|
|
6146
|
+
const n = re(e) && re(e.data) ? e.data : e;
|
|
6147
|
+
if (!re(n))
|
|
6148
6148
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
6149
6149
|
const r = n.auth, o = n.service;
|
|
6150
|
-
if (!
|
|
6150
|
+
if (!re(r) || !re(o))
|
|
6151
6151
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
6152
6152
|
const c = r.user, u = o.reverb;
|
|
6153
|
-
if (!
|
|
6153
|
+
if (!re(c) || !re(u))
|
|
6154
6154
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
6155
|
-
const d = Ba(
|
|
6155
|
+
const d = Ba(Ve(u, "path"));
|
|
6156
6156
|
return {
|
|
6157
6157
|
auth: {
|
|
6158
6158
|
token: Ce(r, "token"),
|
|
6159
6159
|
tokenType: Ce(r, "token_type"),
|
|
6160
|
-
expiresAt:
|
|
6161
|
-
tenantId:
|
|
6160
|
+
expiresAt: Ve(r, "expires_at"),
|
|
6161
|
+
tenantId: Ve(r, "tenant_id"),
|
|
6162
6162
|
user: {
|
|
6163
6163
|
id: Ce(c, "id"),
|
|
6164
6164
|
handle: Ce(c, "handle"),
|
|
6165
6165
|
name: Ce(c, "name"),
|
|
6166
|
-
avatarUrl:
|
|
6167
|
-
email:
|
|
6166
|
+
avatarUrl: Ve(c, "avatar_url"),
|
|
6167
|
+
email: Ve(c, "email")
|
|
6168
6168
|
}
|
|
6169
6169
|
},
|
|
6170
6170
|
service: {
|
|
@@ -6185,28 +6185,28 @@ function Xa(e) {
|
|
|
6185
6185
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
6186
6186
|
}
|
|
6187
6187
|
function Wa(e) {
|
|
6188
|
-
if (!
|
|
6188
|
+
if (!re(e))
|
|
6189
6189
|
return !1;
|
|
6190
|
-
const n =
|
|
6190
|
+
const n = re(e.response) ? e.response : null;
|
|
6191
6191
|
if (n?.status !== 403)
|
|
6192
6192
|
return !1;
|
|
6193
6193
|
const r = n.data;
|
|
6194
6194
|
return r?.code === "ACCOUNT_SUSPENDED" || r?.errors?.reason === "account_suspended" ? !0 : typeof r?.message == "string" && r.message.toLowerCase().includes("suspended");
|
|
6195
6195
|
}
|
|
6196
|
-
function
|
|
6197
|
-
if (e.headers instanceof
|
|
6196
|
+
function Kn(e, n) {
|
|
6197
|
+
if (e.headers instanceof An) {
|
|
6198
6198
|
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"));
|
|
6199
6199
|
return;
|
|
6200
6200
|
}
|
|
6201
|
-
const r =
|
|
6202
|
-
e.headers = new
|
|
6201
|
+
const r = re(e.headers) ? e.headers : {};
|
|
6202
|
+
e.headers = new An({
|
|
6203
6203
|
...r,
|
|
6204
6204
|
Authorization: `Bearer ${n}`,
|
|
6205
6205
|
Accept: "application/json",
|
|
6206
6206
|
"X-Requested-With": "XMLHttpRequest"
|
|
6207
6207
|
}), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
6208
6208
|
}
|
|
6209
|
-
function
|
|
6209
|
+
function Ge(e, n, r) {
|
|
6210
6210
|
const o = e[n];
|
|
6211
6211
|
if (typeof o == "string" && o.trim() !== "")
|
|
6212
6212
|
return o;
|
|
@@ -6220,28 +6220,28 @@ function Ga(e) {
|
|
|
6220
6220
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
6221
6221
|
}
|
|
6222
6222
|
function Ja(e, n) {
|
|
6223
|
-
if (!
|
|
6223
|
+
if (!re(e))
|
|
6224
6224
|
return null;
|
|
6225
|
-
const r =
|
|
6225
|
+
const r = Ge(e, "user_id", "userId"), o = Ga(e.status);
|
|
6226
6226
|
if (!r || !o)
|
|
6227
6227
|
return null;
|
|
6228
6228
|
const c = {
|
|
6229
6229
|
user_id: r,
|
|
6230
|
-
tenant_scope:
|
|
6230
|
+
tenant_scope: Ge(e, "tenant_scope", "tenantScope") ?? n,
|
|
6231
6231
|
status: o,
|
|
6232
|
-
ts:
|
|
6232
|
+
ts: Ge(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6233
6233
|
}, u = e.tenant_id ?? e.tenantId;
|
|
6234
6234
|
typeof u == "string" ? c.tenant_id = u : u === null && (c.tenant_id = null);
|
|
6235
6235
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
6236
6236
|
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6237
6237
|
}
|
|
6238
|
-
function
|
|
6239
|
-
if (!
|
|
6238
|
+
function Qn(e) {
|
|
6239
|
+
if (!re(e))
|
|
6240
6240
|
return null;
|
|
6241
|
-
const n =
|
|
6241
|
+
const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
|
|
6242
6242
|
if (!n || !r)
|
|
6243
6243
|
return null;
|
|
6244
|
-
const o = e.user, c =
|
|
6244
|
+
const o = e.user, c = re(o) ? {
|
|
6245
6245
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
6246
6246
|
name: typeof o.name == "string" ? o.name : "",
|
|
6247
6247
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
@@ -6257,31 +6257,31 @@ function Jn(e) {
|
|
|
6257
6257
|
};
|
|
6258
6258
|
}
|
|
6259
6259
|
function Ka(e) {
|
|
6260
|
-
return
|
|
6260
|
+
return re(e) && de(e, "id") && de(e, "name");
|
|
6261
6261
|
}
|
|
6262
6262
|
function Qa(e) {
|
|
6263
|
-
return !
|
|
6264
|
-
}
|
|
6265
|
-
function Kn(e) {
|
|
6266
|
-
return ie(e) && ie(e.message) && he(e.message, "id") && he(e.message, "conversation_id") && he(e.message, "author_id");
|
|
6267
|
-
}
|
|
6268
|
-
function Qn(e) {
|
|
6269
|
-
return ie(e) && he(e, "conversation_id") && he(e, "user_id") && he(e, "message_id");
|
|
6263
|
+
return !re(e) || !de(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
|
|
6270
6264
|
}
|
|
6271
6265
|
function Yn(e) {
|
|
6272
|
-
return
|
|
6266
|
+
return re(e) && re(e.message) && de(e.message, "id") && de(e.message, "conversation_id") && de(e.message, "author_id");
|
|
6273
6267
|
}
|
|
6274
6268
|
function Zn(e) {
|
|
6275
|
-
return
|
|
6269
|
+
return re(e) && de(e, "conversation_id") && de(e, "user_id") && de(e, "message_id");
|
|
6276
6270
|
}
|
|
6277
6271
|
function es(e) {
|
|
6278
|
-
return
|
|
6272
|
+
return re(e) && de(e, "conversation_id") && re(e.message) && de(e.message, "id");
|
|
6279
6273
|
}
|
|
6280
6274
|
function ts(e) {
|
|
6281
|
-
return
|
|
6275
|
+
return re(e) && de(e, "conversation_id") && de(e, "message_id");
|
|
6282
6276
|
}
|
|
6283
6277
|
function ns(e) {
|
|
6284
|
-
return
|
|
6278
|
+
return re(e) && de(e, "conversation_id") && de(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
|
|
6279
|
+
}
|
|
6280
|
+
function ss(e) {
|
|
6281
|
+
return re(e) && de(e, "conversation_id");
|
|
6282
|
+
}
|
|
6283
|
+
function rs(e) {
|
|
6284
|
+
return re(e) && de(e, "conversation_id") && de(e, "removed_user_id");
|
|
6285
6285
|
}
|
|
6286
6286
|
function Fe(e, n, r, o) {
|
|
6287
6287
|
const c = (u) => {
|
|
@@ -6290,21 +6290,21 @@ function Fe(e, n, r, o) {
|
|
|
6290
6290
|
return e.listen(n, c), c;
|
|
6291
6291
|
}
|
|
6292
6292
|
function pc(e) {
|
|
6293
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ??
|
|
6293
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Zt())("MessengerEcho");
|
|
6294
6294
|
typeof window < "u" && (window.Pusher = Da);
|
|
6295
|
-
let d = null, f = null, h = null,
|
|
6295
|
+
let d = null, f = null, h = null, P = null, C = "disconnected", v = "available", E = null, b = null;
|
|
6296
6296
|
const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
|
|
6297
6297
|
C = T;
|
|
6298
|
-
for (const
|
|
6299
|
-
|
|
6298
|
+
for (const R of A)
|
|
6299
|
+
R(T);
|
|
6300
6300
|
}, y = (T) => {
|
|
6301
6301
|
v = T;
|
|
6302
|
-
for (const
|
|
6303
|
-
|
|
6302
|
+
for (const R of w)
|
|
6303
|
+
R(T);
|
|
6304
6304
|
}, O = () => {
|
|
6305
6305
|
b !== null && (clearTimeout(b), b = null);
|
|
6306
6306
|
}, z = (T = !0) => {
|
|
6307
|
-
h !== null && (h.disconnect(), h = null),
|
|
6307
|
+
h !== null && (h.disconnect(), h = null), P = null, T && m("disconnected");
|
|
6308
6308
|
}, J = () => {
|
|
6309
6309
|
O(), d = null, f = null, E = null, y("available"), z(), p.clear();
|
|
6310
6310
|
}, W = () => {
|
|
@@ -6317,15 +6317,15 @@ function pc(e) {
|
|
|
6317
6317
|
return !1;
|
|
6318
6318
|
if (T.auth.expiresAt === null)
|
|
6319
6319
|
return T.auth.token !== "";
|
|
6320
|
-
const
|
|
6321
|
-
return Number.isNaN(
|
|
6320
|
+
const R = Date.parse(T.auth.expiresAt);
|
|
6321
|
+
return Number.isNaN(R) ? !1 : R - Date.now() > o;
|
|
6322
6322
|
}, k = (T) => {
|
|
6323
6323
|
if (O(), T.auth.expiresAt === null)
|
|
6324
6324
|
return;
|
|
6325
|
-
const
|
|
6326
|
-
if (Number.isNaN(
|
|
6325
|
+
const R = Date.parse(T.auth.expiresAt);
|
|
6326
|
+
if (Number.isNaN(R))
|
|
6327
6327
|
return;
|
|
6328
|
-
const N = Math.max(0,
|
|
6328
|
+
const N = Math.max(0, R - Date.now() - o);
|
|
6329
6329
|
b = setTimeout(() => {
|
|
6330
6330
|
K();
|
|
6331
6331
|
}, N);
|
|
@@ -6349,27 +6349,27 @@ function pc(e) {
|
|
|
6349
6349
|
if (await I(!0), !T)
|
|
6350
6350
|
return;
|
|
6351
6351
|
z(!1), await G(!0);
|
|
6352
|
-
} catch (
|
|
6353
|
-
u.warn("Failed to refresh messenger bootstrap",
|
|
6352
|
+
} catch (R) {
|
|
6353
|
+
u.warn("Failed to refresh messenger bootstrap", R);
|
|
6354
6354
|
}
|
|
6355
6355
|
}, V = (T) => {
|
|
6356
|
-
const
|
|
6357
|
-
if (!
|
|
6356
|
+
const R = T.connector?.pusher?.connection;
|
|
6357
|
+
if (!R) {
|
|
6358
6358
|
u.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6359
6359
|
return;
|
|
6360
6360
|
}
|
|
6361
|
-
|
|
6361
|
+
R.bind("connecting", () => {
|
|
6362
6362
|
m("connecting");
|
|
6363
|
-
}),
|
|
6363
|
+
}), R.bind("connected", () => {
|
|
6364
6364
|
m("connected");
|
|
6365
|
-
}),
|
|
6365
|
+
}), R.bind("disconnected", () => {
|
|
6366
6366
|
m("disconnected");
|
|
6367
|
-
}),
|
|
6367
|
+
}), R.bind("unavailable", () => {
|
|
6368
6368
|
m("disconnected");
|
|
6369
|
-
}),
|
|
6369
|
+
}), R.bind("error", () => {
|
|
6370
6370
|
m("error");
|
|
6371
|
-
}),
|
|
6372
|
-
const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current :
|
|
6371
|
+
}), R.bind("state_change", (N) => {
|
|
6372
|
+
const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : R.state;
|
|
6373
6373
|
if (U === "connected") {
|
|
6374
6374
|
m("connected");
|
|
6375
6375
|
return;
|
|
@@ -6379,8 +6379,8 @@ function pc(e) {
|
|
|
6379
6379
|
return;
|
|
6380
6380
|
}
|
|
6381
6381
|
(U === "unavailable" || U === "failed" || U === "disconnected") && m("disconnected");
|
|
6382
|
-
}),
|
|
6383
|
-
}, G = async (T = !1) => !T && h !== null && te(d) ? h : !T &&
|
|
6382
|
+
}), R.state === "connected" && m("connected");
|
|
6383
|
+
}, G = async (T = !1) => !T && h !== null && te(d) ? h : !T && P !== null ? await P : (P = (async () => {
|
|
6384
6384
|
const N = await I(T);
|
|
6385
6385
|
if (N === null)
|
|
6386
6386
|
return null;
|
|
@@ -6405,8 +6405,8 @@ function pc(e) {
|
|
|
6405
6405
|
};
|
|
6406
6406
|
return N.service.reverb.path && (ne.wsPath = N.service.reverb.path), h = new Ia(ne), V(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6407
6407
|
})().finally(() => {
|
|
6408
|
-
|
|
6409
|
-
}), await
|
|
6408
|
+
P = null;
|
|
6409
|
+
}), await P), _ = $t.create({
|
|
6410
6410
|
timeout: e.requestTimeoutMs ?? za,
|
|
6411
6411
|
withCredentials: !1,
|
|
6412
6412
|
headers: {
|
|
@@ -6415,47 +6415,47 @@ function pc(e) {
|
|
|
6415
6415
|
}
|
|
6416
6416
|
});
|
|
6417
6417
|
_.interceptors.request.use(async (T) => {
|
|
6418
|
-
const
|
|
6419
|
-
if (
|
|
6418
|
+
const R = await I();
|
|
6419
|
+
if (R === null)
|
|
6420
6420
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6421
|
-
return T.baseURL =
|
|
6421
|
+
return T.baseURL = R.service.apiBaseUrl, Kn(T, R.auth.token), T;
|
|
6422
6422
|
}), _.interceptors.response.use(
|
|
6423
6423
|
(T) => T,
|
|
6424
6424
|
async (T) => {
|
|
6425
|
-
const
|
|
6426
|
-
if (T.response?.status === 401 &&
|
|
6427
|
-
|
|
6425
|
+
const R = T.config;
|
|
6426
|
+
if (T.response?.status === 401 && R && R._messengerRetry !== !0) {
|
|
6427
|
+
R._messengerRetry = !0;
|
|
6428
6428
|
const N = await I(!0);
|
|
6429
6429
|
if (N !== null)
|
|
6430
|
-
return
|
|
6430
|
+
return R.baseURL = N.service.apiBaseUrl, Kn(R, N.auth.token), await _(R);
|
|
6431
6431
|
}
|
|
6432
6432
|
return Promise.reject(T);
|
|
6433
6433
|
}
|
|
6434
6434
|
);
|
|
6435
|
-
const L = () => v === "account_suspended" ? null : h,
|
|
6435
|
+
const L = () => v === "account_suspended" ? null : h, he = (T) => (A.add(T), T(C), () => {
|
|
6436
6436
|
A.delete(T);
|
|
6437
6437
|
}), Se = (T) => (w.add(T), T(v), () => {
|
|
6438
6438
|
w.delete(T);
|
|
6439
6439
|
}), B = () => d?.auth.tenantId ?? "global", D = (T) => {
|
|
6440
|
-
const
|
|
6441
|
-
if (
|
|
6440
|
+
const R = Dt(T.ts)?.getTime() ?? Dt(T.last_seen_at)?.getTime() ?? null;
|
|
6441
|
+
if (R === null)
|
|
6442
6442
|
return !0;
|
|
6443
6443
|
const N = `${T.tenant_scope ?? "global"}:${T.user_id}`, U = p.get(N);
|
|
6444
|
-
if (U &&
|
|
6444
|
+
if (U && R < U.timestampMs)
|
|
6445
6445
|
return !1;
|
|
6446
6446
|
const ne = Date.now();
|
|
6447
6447
|
p.set(N, {
|
|
6448
|
-
timestampMs:
|
|
6448
|
+
timestampMs: R,
|
|
6449
6449
|
seenAt: ne
|
|
6450
6450
|
});
|
|
6451
|
-
for (const [
|
|
6452
|
-
ne -
|
|
6451
|
+
for (const [oe, ce] of p.entries())
|
|
6452
|
+
ne - ce.seenAt > c && p.delete(oe);
|
|
6453
6453
|
return !0;
|
|
6454
6454
|
}, q = (T) => {
|
|
6455
|
-
const
|
|
6456
|
-
if (!
|
|
6455
|
+
const R = L();
|
|
6456
|
+
if (!R || typeof R.join != "function")
|
|
6457
6457
|
return;
|
|
6458
|
-
const N =
|
|
6458
|
+
const N = R.join(`online-users.${B()}`), U = [
|
|
6459
6459
|
".PresenceStatusChanged",
|
|
6460
6460
|
"PresenceStatusChanged",
|
|
6461
6461
|
".presence.status.changed",
|
|
@@ -6466,70 +6466,70 @@ function pc(e) {
|
|
|
6466
6466
|
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6467
6467
|
];
|
|
6468
6468
|
for (const ne of U)
|
|
6469
|
-
N.listen(ne, (
|
|
6470
|
-
const
|
|
6471
|
-
!
|
|
6469
|
+
N.listen(ne, (oe) => {
|
|
6470
|
+
const ce = Ja(oe, B());
|
|
6471
|
+
!ce || !D(ce) || T(ce);
|
|
6472
6472
|
});
|
|
6473
6473
|
}, _e = () => {
|
|
6474
6474
|
h?.leave(`online-users.${B()}`);
|
|
6475
6475
|
};
|
|
6476
|
-
function M(T,
|
|
6476
|
+
function M(T, R) {
|
|
6477
6477
|
const N = [];
|
|
6478
|
-
function U(ne,
|
|
6479
|
-
if (!
|
|
6478
|
+
function U(ne, oe, ce) {
|
|
6479
|
+
if (!ce)
|
|
6480
6480
|
return;
|
|
6481
6481
|
const Re = (Le) => {
|
|
6482
|
-
|
|
6482
|
+
oe(Le) && ce(Le);
|
|
6483
6483
|
};
|
|
6484
6484
|
T.bind(ne, Re), N.push({ event: ne, handler: Re });
|
|
6485
6485
|
}
|
|
6486
|
-
return U("ConversationMessageSent",
|
|
6486
|
+
return U("ConversationMessageSent", Yn, R.onMessageSent), U("ConversationMessageRead", Zn, R.onMessageRead), U("ConversationMessageEdited", es, R.onMessageEdited), U("ConversationMessageDeleted", ts, R.onMessageDeleted), U("MessageReactionToggled", ns, R.onReactionToggled), U("ConversationRequestAccepted", ss, R.onRequestAccepted), U("ConversationParticipantRemoved", rs, R.onParticipantRemoved), () => {
|
|
6487
6487
|
for (const ne of N)
|
|
6488
6488
|
T.unbind(ne.event, ne.handler);
|
|
6489
6489
|
};
|
|
6490
6490
|
}
|
|
6491
|
-
const F = (T,
|
|
6491
|
+
const F = (T, R) => {
|
|
6492
6492
|
const N = L();
|
|
6493
6493
|
if (!N)
|
|
6494
6494
|
return () => {
|
|
6495
6495
|
};
|
|
6496
6496
|
const U = N.private(`conversation.${T}`), ne = U.subscription;
|
|
6497
6497
|
if (ne)
|
|
6498
|
-
return M(ne,
|
|
6499
|
-
const
|
|
6500
|
-
return
|
|
6498
|
+
return M(ne, R);
|
|
6499
|
+
const oe = [];
|
|
6500
|
+
return R.onMessageSent && oe.push({
|
|
6501
6501
|
event: ".ConversationMessageSent",
|
|
6502
|
-
handler: Fe(U, ".ConversationMessageSent",
|
|
6503
|
-
}),
|
|
6502
|
+
handler: Fe(U, ".ConversationMessageSent", Yn, R.onMessageSent)
|
|
6503
|
+
}), R.onMessageRead && oe.push({
|
|
6504
6504
|
event: ".ConversationMessageRead",
|
|
6505
|
-
handler: Fe(U, ".ConversationMessageRead",
|
|
6506
|
-
}),
|
|
6505
|
+
handler: Fe(U, ".ConversationMessageRead", Zn, R.onMessageRead)
|
|
6506
|
+
}), R.onMessageEdited && oe.push({
|
|
6507
6507
|
event: ".ConversationMessageEdited",
|
|
6508
|
-
handler: Fe(U, ".ConversationMessageEdited",
|
|
6509
|
-
}),
|
|
6508
|
+
handler: Fe(U, ".ConversationMessageEdited", es, R.onMessageEdited)
|
|
6509
|
+
}), R.onMessageDeleted && oe.push({
|
|
6510
6510
|
event: ".ConversationMessageDeleted",
|
|
6511
|
-
handler: Fe(U, ".ConversationMessageDeleted",
|
|
6512
|
-
}),
|
|
6511
|
+
handler: Fe(U, ".ConversationMessageDeleted", ts, R.onMessageDeleted)
|
|
6512
|
+
}), R.onReactionToggled && oe.push({
|
|
6513
6513
|
event: ".MessageReactionToggled",
|
|
6514
|
-
handler: Fe(U, ".MessageReactionToggled",
|
|
6515
|
-
}),
|
|
6514
|
+
handler: Fe(U, ".MessageReactionToggled", ns, R.onReactionToggled)
|
|
6515
|
+
}), R.onRequestAccepted && oe.push({
|
|
6516
6516
|
event: ".ConversationRequestAccepted",
|
|
6517
|
-
handler: Fe(U, ".ConversationRequestAccepted",
|
|
6518
|
-
}),
|
|
6517
|
+
handler: Fe(U, ".ConversationRequestAccepted", ss, R.onRequestAccepted)
|
|
6518
|
+
}), R.onParticipantRemoved && oe.push({
|
|
6519
6519
|
event: ".ConversationParticipantRemoved",
|
|
6520
|
-
handler: Fe(U, ".ConversationParticipantRemoved",
|
|
6520
|
+
handler: Fe(U, ".ConversationParticipantRemoved", rs, R.onParticipantRemoved)
|
|
6521
6521
|
}), () => {
|
|
6522
6522
|
if (typeof U.stopListening == "function")
|
|
6523
|
-
for (const
|
|
6524
|
-
U.stopListening(
|
|
6523
|
+
for (const ce of oe)
|
|
6524
|
+
U.stopListening(ce.event, ce.handler);
|
|
6525
6525
|
};
|
|
6526
6526
|
}, Z = (T) => {
|
|
6527
6527
|
h?.leave(`conversation.${T}`);
|
|
6528
|
-
},
|
|
6529
|
-
const U = T.private(`typing-conversation.${
|
|
6530
|
-
if (
|
|
6528
|
+
}, ie = (T, R, N) => {
|
|
6529
|
+
const U = T.private(`typing-conversation.${R}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), oe = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), ce = U.subscription;
|
|
6530
|
+
if (ce) {
|
|
6531
6531
|
const we = (pe) => {
|
|
6532
|
-
const ve =
|
|
6532
|
+
const ve = Qn(pe);
|
|
6533
6533
|
if (ve) {
|
|
6534
6534
|
if (ne.has(ve.state)) {
|
|
6535
6535
|
N.onTypingStart?.({
|
|
@@ -6543,19 +6543,19 @@ function pc(e) {
|
|
|
6543
6543
|
});
|
|
6544
6544
|
return;
|
|
6545
6545
|
}
|
|
6546
|
-
|
|
6546
|
+
oe.has(ve.state) && N.onTypingStop?.({
|
|
6547
6547
|
user_id: ve.user_id,
|
|
6548
6548
|
conversation_id: ve.conversation_id,
|
|
6549
6549
|
stopped_at: ve.stopped_at ?? ve.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6550
6550
|
});
|
|
6551
6551
|
}
|
|
6552
6552
|
};
|
|
6553
|
-
return
|
|
6554
|
-
|
|
6553
|
+
return ce.bind("TypingStateChanged", we), () => {
|
|
6554
|
+
ce.unbind("TypingStateChanged", we);
|
|
6555
6555
|
};
|
|
6556
6556
|
}
|
|
6557
6557
|
const Re = [], Le = (we) => {
|
|
6558
|
-
const pe =
|
|
6558
|
+
const pe = Qn(we);
|
|
6559
6559
|
if (pe) {
|
|
6560
6560
|
if (ne.has(pe.state)) {
|
|
6561
6561
|
N.onTypingStart?.({
|
|
@@ -6569,7 +6569,7 @@ function pc(e) {
|
|
|
6569
6569
|
});
|
|
6570
6570
|
return;
|
|
6571
6571
|
}
|
|
6572
|
-
|
|
6572
|
+
oe.has(pe.state) && N.onTypingStop?.({
|
|
6573
6573
|
user_id: pe.user_id,
|
|
6574
6574
|
conversation_id: pe.conversation_id,
|
|
6575
6575
|
stopped_at: pe.stopped_at ?? pe.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -6581,111 +6581,113 @@ function pc(e) {
|
|
|
6581
6581
|
for (const we of Re)
|
|
6582
6582
|
U.stopListening(we.event, we.handler);
|
|
6583
6583
|
};
|
|
6584
|
-
}
|
|
6585
|
-
const N = L();
|
|
6586
|
-
if (N)
|
|
6587
|
-
return oe(N, T, P);
|
|
6588
|
-
let U = !1, ne = null;
|
|
6589
|
-
return ze().then((re) => {
|
|
6590
|
-
U || !re || (ne = oe(re, T, P));
|
|
6591
|
-
}).catch((re) => {
|
|
6592
|
-
u.warn("Failed to defer typing subscription", re);
|
|
6593
|
-
}), () => {
|
|
6594
|
-
U = !0, ne?.();
|
|
6595
|
-
};
|
|
6596
|
-
}, me = (T) => {
|
|
6597
|
-
h?.leave(`typing-conversation.${T}`);
|
|
6598
|
-
}, ht = async () => {
|
|
6599
|
-
y("available"), z(), await G(!0);
|
|
6600
|
-
}, ze = async () => v === "account_suspended" ? null : await G();
|
|
6584
|
+
};
|
|
6601
6585
|
return {
|
|
6602
6586
|
apiClient: _,
|
|
6603
6587
|
initializedEvent: n,
|
|
6604
6588
|
getEcho: L,
|
|
6605
|
-
waitForEcho:
|
|
6589
|
+
waitForEcho: async () => v === "account_suspended" ? null : await G(),
|
|
6606
6590
|
getConnectionStatus: () => C,
|
|
6607
6591
|
getAccessState: () => v,
|
|
6608
|
-
onConnectionStatusChange:
|
|
6592
|
+
onConnectionStatusChange: he,
|
|
6609
6593
|
onAccessStateChange: Se,
|
|
6610
|
-
reconnect:
|
|
6594
|
+
reconnect: async () => {
|
|
6595
|
+
y("available"), z(), await G(!0);
|
|
6596
|
+
},
|
|
6611
6597
|
subscribeToPresenceStatus: q,
|
|
6612
6598
|
unsubscribeFromPresenceStatus: _e,
|
|
6613
6599
|
subscribeToConversation: F,
|
|
6614
6600
|
unsubscribeFromConversation: Z,
|
|
6615
|
-
subscribeToTyping:
|
|
6616
|
-
|
|
6601
|
+
subscribeToTyping: (T, R) => {
|
|
6602
|
+
const N = ut();
|
|
6603
|
+
if (N)
|
|
6604
|
+
return ie(N, T, R);
|
|
6605
|
+
let U = !1, ne = null;
|
|
6606
|
+
const oe = () => {
|
|
6607
|
+
if (U)
|
|
6608
|
+
return;
|
|
6609
|
+
const ce = ut();
|
|
6610
|
+
ce && (ne = ie(ce, T, R), typeof window < "u" && window.removeEventListener(ct(), oe));
|
|
6611
|
+
};
|
|
6612
|
+
return typeof window < "u" && window.addEventListener(ct(), oe), () => {
|
|
6613
|
+
U = !0, typeof window < "u" && window.removeEventListener(ct(), oe), ne?.();
|
|
6614
|
+
};
|
|
6615
|
+
},
|
|
6616
|
+
unsubscribeFromTyping: (T) => {
|
|
6617
|
+
ut()?.leave(`typing-conversation.${T}`);
|
|
6618
|
+
},
|
|
6617
6619
|
clearRuntime: J
|
|
6618
6620
|
};
|
|
6619
6621
|
}
|
|
6620
6622
|
export {
|
|
6621
|
-
|
|
6623
|
+
go as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6622
6624
|
hc as configureMessengerClient,
|
|
6623
6625
|
pc as createMessengerEcho,
|
|
6624
6626
|
X as getApi,
|
|
6625
6627
|
ke as getAuthStore,
|
|
6626
|
-
|
|
6628
|
+
Rn as getConnectionStatus,
|
|
6627
6629
|
Ae as getEcho,
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
+
vs as getEchoConnectionStatus,
|
|
6631
|
+
Je as getEchoInitializedEvent,
|
|
6630
6632
|
Y as getErrorMessage,
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6633
|
+
Zt as getLoggerFactory,
|
|
6634
|
+
Vt as getMainApi,
|
|
6635
|
+
ut as getMainEcho,
|
|
6634
6636
|
$o as getMainEchoConnectionStatus,
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6637
|
+
ct as getMainEchoInitializedEvent,
|
|
6638
|
+
uo as getMediaApi,
|
|
6639
|
+
Ot as getMessagingAccessState,
|
|
6638
6640
|
ia as getPresenceRuntimeConfig,
|
|
6639
6641
|
ca as hasConfiguredPresenceAuthTokenResolver,
|
|
6640
6642
|
ic as hasResponse,
|
|
6641
6643
|
vc as isAxiosError,
|
|
6642
6644
|
rc as isError,
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6645
|
+
eo as isValidMessageDeletedEvent,
|
|
6646
|
+
Zi as isValidMessageEditedEvent,
|
|
6647
|
+
Yi as isValidMessageReadEvent,
|
|
6648
|
+
Qi as isValidMessageSentEvent,
|
|
6649
|
+
to as isValidReactionToggledEvent,
|
|
6650
|
+
no as isValidRequestAcceptedEvent,
|
|
6649
6651
|
Pe as messagingApi,
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6652
|
+
vo as normalizePresenceStatus,
|
|
6653
|
+
ws as normalizePresenceTimestamp,
|
|
6654
|
+
ht as onConnectionStatusChange,
|
|
6653
6655
|
Ho as onMainEchoConnectionStatusChange,
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6656
|
+
ji as onMessagingAccessStateChange,
|
|
6657
|
+
Dt as parsePresenceTimestamp,
|
|
6658
|
+
$i as reconnectEcho,
|
|
6657
6659
|
Bo as reconnectMainEcho,
|
|
6658
|
-
|
|
6660
|
+
Ki as resetEchoRuntimeConfig,
|
|
6659
6661
|
Jo as resetLoggerFactory,
|
|
6660
|
-
|
|
6662
|
+
oo as resetMainApiClient,
|
|
6661
6663
|
Xo as resetMainEchoRuntimeConfig,
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6664
|
+
ro as resetMessagingApiClient,
|
|
6665
|
+
co as resetMessagingAuthStoreResolver,
|
|
6666
|
+
ho as resetMessagingMediaApi,
|
|
6665
6667
|
fc as resetMessengerClientConfig,
|
|
6666
6668
|
aa as resetPresenceRuntimeConfig,
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6669
|
+
bo as resolveFreshPresenceStatus,
|
|
6670
|
+
Nt as resolvePresenceSnapshot,
|
|
6671
|
+
Ji as setEchoRuntimeConfig,
|
|
6670
6672
|
Go as setLoggerFactory,
|
|
6671
|
-
|
|
6673
|
+
io as setMainApiClient,
|
|
6672
6674
|
Vo as setMainEchoRuntimeConfig,
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6675
|
+
so as setMessagingApiClient,
|
|
6676
|
+
ao as setMessagingAuthStoreResolver,
|
|
6677
|
+
lo as setMessagingMediaApi,
|
|
6676
6678
|
oa as setPresenceRuntimeConfig,
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6679
|
+
Vi as subscribeToConversation,
|
|
6680
|
+
Hi as subscribeToPresenceStatus,
|
|
6681
|
+
Wi as subscribeToTyping,
|
|
6682
|
+
Xi as unsubscribeFromConversation,
|
|
6683
|
+
Bi as unsubscribeFromPresenceStatus,
|
|
6684
|
+
Gi as unsubscribeFromTyping,
|
|
6683
6685
|
ac as useConnectionStatus,
|
|
6684
6686
|
oc as useConversationChannel,
|
|
6685
6687
|
cc as useGlobalMessaging,
|
|
6686
6688
|
uc as useMessagingAccessState,
|
|
6687
|
-
|
|
6689
|
+
Qt as useMessagingStore,
|
|
6688
6690
|
lc as usePresence,
|
|
6689
6691
|
dc as useTypingChannel,
|
|
6690
|
-
|
|
6692
|
+
ms as waitForEcho
|
|
6691
6693
|
};
|