@codingfactory/messenger-client 0.2.16 → 0.2.17
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 +901 -891
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { ref as ve, getCurrentInstance as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import
|
|
4
|
-
import { isAxiosError as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
const
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
}, Jn = () => {
|
|
1
|
+
import { ref as ve, getCurrentInstance as zt, computed as ie, watch as Ot, onUnmounted as De, toValue as Xn, onMounted as jt } from "vue";
|
|
2
|
+
import { defineStore as _i, storeToRefs as Si } from "pinia";
|
|
3
|
+
import $t, { isAxiosError as Ci, AxiosHeaders as wn } from "axios";
|
|
4
|
+
import { isAxiosError as uc } from "axios";
|
|
5
|
+
import { useRoute as wi } from "vue-router";
|
|
6
|
+
const Wn = () => () => {
|
|
7
|
+
}, Gn = () => () => {
|
|
8
|
+
}, Jn = async () => {
|
|
10
9
|
}, Kn = () => {
|
|
11
10
|
}, Qn = () => {
|
|
12
11
|
}, Yn = () => {
|
|
13
12
|
}, Zn = () => {
|
|
14
|
-
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
13
|
}, es = () => {
|
|
14
|
+
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
|
+
}, ts = () => {
|
|
16
16
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
17
|
-
},
|
|
17
|
+
}, ns = async () => null, $ = {
|
|
18
18
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
19
19
|
getEcho: () => null,
|
|
20
|
-
waitForEcho:
|
|
20
|
+
waitForEcho: ns,
|
|
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
|
-
}, We = () => $.ECHO_INITIALIZED_EVENT, Pe = () => $.getEcho(),
|
|
23
|
+
onConnectionStatusChange: Wn,
|
|
24
|
+
onAccessStateChange: Gn,
|
|
25
|
+
reconnect: Jn,
|
|
26
|
+
subscribeToPresenceStatus: Kn,
|
|
27
|
+
unsubscribeFromPresenceStatus: Qn,
|
|
28
|
+
subscribeToConversation: es,
|
|
29
|
+
unsubscribeFromConversation: Yn,
|
|
30
|
+
subscribeToTyping: ts,
|
|
31
|
+
unsubscribeFromTyping: Zn
|
|
32
|
+
}, We = () => $.ECHO_INITIALIZED_EVENT, Pe = () => $.getEcho(), Ti = async () => $.waitForEcho(), ss = () => $.getConnectionStatus(), Tn = () => ss(), Ft = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), Ei = (e) => $.onAccessStateChange(e), Ai = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
|
-
},
|
|
35
|
-
function
|
|
34
|
+
}, Ri = (e) => $.subscribeToPresenceStatus(e), Pi = () => $.unsubscribeFromPresenceStatus(), Mi = (e, n) => $.subscribeToConversation(e, n), xi = (e) => $.unsubscribeFromConversation(e), ki = (e, n) => $.subscribeToTyping(e, n), Li = (e) => $.unsubscribeFromTyping(e);
|
|
35
|
+
function Ii(e) {
|
|
36
36
|
e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho =
|
|
38
|
+
function Ui() {
|
|
39
|
+
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = ns, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = Wn, $.onAccessStateChange = Gn, $.reconnect = Jn, $.subscribeToPresenceStatus = Kn, $.unsubscribeFromPresenceStatus = Qn, $.subscribeToConversation = es, $.unsubscribeFromConversation = Yn, $.subscribeToTyping = ts, $.unsubscribeFromTyping = Zn;
|
|
40
40
|
}
|
|
41
41
|
function Me(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Oi(e) {
|
|
45
45
|
return Me(e) && typeof e.conversation_id == "string" && Me(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 Fi(e) {
|
|
48
48
|
return Me(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Ni(e) {
|
|
51
51
|
return Me(e) && typeof e.conversation_id == "string" && Me(e.message) && typeof e.message.id == "string";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Di(e) {
|
|
54
54
|
return Me(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function qi(e) {
|
|
57
57
|
return Me(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function zi(e) {
|
|
60
60
|
return Me(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let
|
|
62
|
+
const rs = $t;
|
|
63
|
+
let Ht = rs;
|
|
64
64
|
function W() {
|
|
65
|
-
return
|
|
65
|
+
return Ht;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
67
|
+
function ji(e) {
|
|
68
|
+
Ht = e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
70
|
+
function $i() {
|
|
71
|
+
Ht = rs;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const is = {
|
|
74
74
|
currentUser: null
|
|
75
75
|
};
|
|
76
|
-
let
|
|
76
|
+
let Bt = () => is;
|
|
77
77
|
function Fe() {
|
|
78
|
-
return
|
|
78
|
+
return Bt;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
80
|
+
function Hi(e) {
|
|
81
|
+
Bt = e;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
83
|
+
function Bi() {
|
|
84
|
+
Bt = () => is;
|
|
85
85
|
}
|
|
86
86
|
function Z(e) {
|
|
87
|
-
if (
|
|
87
|
+
if (Ci(e)) {
|
|
88
88
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
89
89
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
90
90
|
}
|
|
91
91
|
return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Ka(e) {
|
|
94
94
|
return e instanceof Error;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Qa(e) {
|
|
97
97
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const os = {
|
|
100
100
|
async uploadImage() {
|
|
101
101
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
let
|
|
105
|
-
function
|
|
106
|
-
return
|
|
104
|
+
let Vt = os;
|
|
105
|
+
function Vi() {
|
|
106
|
+
return Vt;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function Xi(e) {
|
|
109
|
+
Vt = e;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
111
|
+
function Wi() {
|
|
112
|
+
Vt = os;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Gi(e) {
|
|
115
115
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function as(e) {
|
|
118
118
|
return typeof e == "object" && e !== null;
|
|
119
119
|
}
|
|
120
120
|
function $e(e) {
|
|
121
|
-
return !
|
|
121
|
+
return !as(e) || !("data" in e) ? e : e.data;
|
|
122
122
|
}
|
|
123
123
|
function st(e, n) {
|
|
124
124
|
const i = e[n];
|
|
@@ -126,7 +126,7 @@ function st(e, n) {
|
|
|
126
126
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
127
127
|
return i;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function En(e, n) {
|
|
130
130
|
const i = e[n];
|
|
131
131
|
if (i == null)
|
|
132
132
|
return null;
|
|
@@ -145,14 +145,14 @@ function Rt(e, n) {
|
|
|
145
145
|
}
|
|
146
146
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
if (!
|
|
148
|
+
function Nt(e) {
|
|
149
|
+
if (!as(e))
|
|
150
150
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
151
151
|
return {
|
|
152
152
|
id: st(e, "id"),
|
|
153
153
|
name: st(e, "name"),
|
|
154
|
-
color:
|
|
155
|
-
icon:
|
|
154
|
+
color: En(e, "color"),
|
|
155
|
+
icon: En(e, "icon"),
|
|
156
156
|
sort_order: Rt(e, "sort_order"),
|
|
157
157
|
conversation_count: Rt(e, "conversation_count"),
|
|
158
158
|
unread_count: Rt(e, "unread_count"),
|
|
@@ -160,28 +160,28 @@ function Ft(e) {
|
|
|
160
160
|
updated_at: st(e, "updated_at")
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Ji(e) {
|
|
164
164
|
if (!Array.isArray(e))
|
|
165
165
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
166
|
-
return e.map((n) =>
|
|
166
|
+
return e.map((n) => Nt(n));
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
if (!
|
|
168
|
+
function An(e) {
|
|
169
|
+
if (!Gi(e))
|
|
170
170
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
171
171
|
return e;
|
|
172
172
|
}
|
|
173
173
|
const Re = {
|
|
174
174
|
async fetchFolders() {
|
|
175
175
|
const e = await W().get("/v1/messaging/folders");
|
|
176
|
-
return
|
|
176
|
+
return Ji($e(e.data));
|
|
177
177
|
},
|
|
178
178
|
async createFolder(e) {
|
|
179
179
|
const n = await W().post("/v1/messaging/folders", e);
|
|
180
|
-
return
|
|
180
|
+
return Nt($e(n.data));
|
|
181
181
|
},
|
|
182
182
|
async updateFolder(e, n) {
|
|
183
183
|
const i = await W().patch(`/v1/messaging/folders/${e}`, n);
|
|
184
|
-
return
|
|
184
|
+
return Nt($e(i.data));
|
|
185
185
|
},
|
|
186
186
|
async deleteFolder(e) {
|
|
187
187
|
await W().delete(`/v1/messaging/folders/${e}`);
|
|
@@ -193,16 +193,16 @@ const Re = {
|
|
|
193
193
|
const i = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
194
194
|
folder_id: n
|
|
195
195
|
});
|
|
196
|
-
return
|
|
196
|
+
return An($e(i.data));
|
|
197
197
|
},
|
|
198
198
|
async acceptRequest(e) {
|
|
199
199
|
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
200
|
-
return
|
|
200
|
+
return An($e(n.data));
|
|
201
201
|
},
|
|
202
202
|
async declineRequest(e) {
|
|
203
203
|
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
204
204
|
}
|
|
205
|
-
},
|
|
205
|
+
}, Rn = 1e3, Xt = 4e3, Ki = 12e4, Qi = 300, Yi = 1, Zi = 1600, Wt = (e) => {
|
|
206
206
|
if (typeof e == "number" && Number.isFinite(e))
|
|
207
207
|
return e;
|
|
208
208
|
if (typeof e == "string") {
|
|
@@ -210,32 +210,32 @@ const Re = {
|
|
|
210
210
|
if (Number.isFinite(n))
|
|
211
211
|
return n;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
214
|
-
const i =
|
|
215
|
-
return i === void 0 ? !0 : i === 429 ||
|
|
216
|
-
},
|
|
213
|
+
}, cs = (e) => typeof e == "number" && e >= 500 && e < 600, Pn = (e) => {
|
|
214
|
+
const i = Wt(e.response?.status);
|
|
215
|
+
return i === void 0 ? !0 : i === 429 || cs(i);
|
|
216
|
+
}, us = (e) => {
|
|
217
217
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
218
|
-
return Math.max(
|
|
218
|
+
return Math.max(Rn, e * 1e3);
|
|
219
219
|
if (typeof e == "string") {
|
|
220
220
|
const n = Number.parseInt(e, 10);
|
|
221
221
|
if (Number.isFinite(n) && n > 0)
|
|
222
|
-
return Math.max(
|
|
222
|
+
return Math.max(Rn, n * 1e3);
|
|
223
223
|
}
|
|
224
|
-
return
|
|
225
|
-
}, Zi = (e) => {
|
|
226
|
-
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Vt * i;
|
|
227
|
-
return Math.min(Ji, o);
|
|
224
|
+
return Xt;
|
|
228
225
|
}, eo = (e) => {
|
|
226
|
+
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Xt * i;
|
|
227
|
+
return Math.min(Ki, o);
|
|
228
|
+
}, to = (e) => {
|
|
229
229
|
const n = e;
|
|
230
|
-
return
|
|
231
|
-
},
|
|
230
|
+
return Wt(n.response?.status) === 429 ? us(n.response?.headers?.["retry-after"]) : Qi;
|
|
231
|
+
}, Mn = async (e) => {
|
|
232
232
|
await new Promise((n) => {
|
|
233
233
|
setTimeout(n, e);
|
|
234
234
|
});
|
|
235
|
-
},
|
|
235
|
+
}, xn = () => ({
|
|
236
236
|
data: [],
|
|
237
237
|
has_more: !1
|
|
238
|
-
}),
|
|
238
|
+
}), kn = () => Ft() === "account_suspended", no = (e) => {
|
|
239
239
|
if (!he(e))
|
|
240
240
|
return !1;
|
|
241
241
|
const i = (he(e.data) ? e.data : e).throttled;
|
|
@@ -249,7 +249,7 @@ const Re = {
|
|
|
249
249
|
}
|
|
250
250
|
return !1;
|
|
251
251
|
};
|
|
252
|
-
function
|
|
252
|
+
function so(e, n, i) {
|
|
253
253
|
const o = typeof e == "string" && e.trim().length > 0 ? e.trim().toLowerCase() : void 0;
|
|
254
254
|
if (o)
|
|
255
255
|
return o;
|
|
@@ -259,17 +259,17 @@ function no(e, n, i) {
|
|
|
259
259
|
const l = typeof i == "string" && i.trim().length > 0 ? i.trim().toLowerCase() : void 0;
|
|
260
260
|
return l ? l === "image" ? "image/*" : l === "video" ? "video/*" : l === "audio" ? "audio/*" : l : "application/octet-stream";
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function ro(e) {
|
|
263
263
|
const n = e.url || "", i = e.thumbnail_url ?? e.thumbnail, o = {
|
|
264
264
|
id: e.media_id ?? e.id ?? "",
|
|
265
|
-
name: e.name ??
|
|
265
|
+
name: e.name ?? io(n),
|
|
266
266
|
url: n,
|
|
267
|
-
type:
|
|
267
|
+
type: so(e.mime, e.mime_type, e.type),
|
|
268
268
|
size: e.size ?? 0
|
|
269
269
|
};
|
|
270
270
|
return i !== void 0 && (o.thumbnail = i), o;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function io(e) {
|
|
273
273
|
if (!e) return "attachment";
|
|
274
274
|
try {
|
|
275
275
|
const i = new URL(e).pathname.split("/");
|
|
@@ -278,8 +278,8 @@ function ro(e) {
|
|
|
278
278
|
return "attachment";
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
281
|
+
function oo(e) {
|
|
282
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map(ro);
|
|
283
283
|
}
|
|
284
284
|
function ut(e) {
|
|
285
285
|
if (typeof e != "string")
|
|
@@ -288,7 +288,7 @@ function ut(e) {
|
|
|
288
288
|
if (n.length !== 0)
|
|
289
289
|
return n;
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function ao(e) {
|
|
292
292
|
if (!e)
|
|
293
293
|
return;
|
|
294
294
|
const n = ut(e.avatar) ?? ut(e.avatar_url), i = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
@@ -315,12 +315,12 @@ function at(e) {
|
|
|
315
315
|
} : null;
|
|
316
316
|
return {
|
|
317
317
|
...e,
|
|
318
|
-
...i ? { author:
|
|
318
|
+
...i ? { author: ao(i) } : {},
|
|
319
319
|
shared_post: o,
|
|
320
|
-
attachments:
|
|
320
|
+
attachments: oo(e.attachments)
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function co(e) {
|
|
324
324
|
if (!e || !he(e))
|
|
325
325
|
return;
|
|
326
326
|
const n = typeof e.id == "string" ? e.id.trim() : "", i = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
@@ -343,20 +343,20 @@ function ao(e) {
|
|
|
343
343
|
} : {}
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Pt(e) {
|
|
347
347
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Ln(e) {
|
|
350
350
|
if (!(typeof e != "string" || e.length === 0))
|
|
351
351
|
return e;
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Dt(e) {
|
|
354
354
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
355
355
|
}
|
|
356
356
|
function uo(e, n = []) {
|
|
357
357
|
const i = /* @__PURE__ */ new Map();
|
|
358
358
|
for (const o of n) {
|
|
359
|
-
const c =
|
|
359
|
+
const c = Ln(o.last_read_message_id);
|
|
360
360
|
c && i.set(o.user_id, c);
|
|
361
361
|
}
|
|
362
362
|
return e.map((o) => {
|
|
@@ -365,7 +365,7 @@ function uo(e, n = []) {
|
|
|
365
365
|
name: o.user.name,
|
|
366
366
|
...l ? { avatar: l } : {},
|
|
367
367
|
...o.user.handle ? { handle: o.user.handle } : {}
|
|
368
|
-
} : void 0, g =
|
|
368
|
+
} : void 0, g = Ln(o.last_read_message_id);
|
|
369
369
|
if (g)
|
|
370
370
|
return {
|
|
371
371
|
...o,
|
|
@@ -390,46 +390,56 @@ function uo(e, n = []) {
|
|
|
390
390
|
};
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
+
function lo(e, n) {
|
|
394
|
+
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);
|
|
395
|
+
}
|
|
396
|
+
function ho(e, n) {
|
|
397
|
+
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;
|
|
398
|
+
}
|
|
393
399
|
function He(e, n) {
|
|
394
|
-
const i =
|
|
395
|
-
if (!n || n.unread_count !== 0 ||
|
|
400
|
+
const i = lo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : i !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, g = 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, x = ho(e, n), M = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", _ = (() => {
|
|
401
|
+
if (!n || n.unread_count !== 0 || d <= 0)
|
|
396
402
|
return !1;
|
|
397
|
-
const
|
|
398
|
-
return !
|
|
403
|
+
const C = n.last_message?.id, b = e.last_message?.id;
|
|
404
|
+
return !C || !b ? !1 : C === b;
|
|
399
405
|
})();
|
|
400
406
|
return {
|
|
401
407
|
...e,
|
|
402
|
-
unread_count: o ||
|
|
408
|
+
unread_count: o || _ ? 0 : d,
|
|
403
409
|
participants: uo(e.participants, n?.participants),
|
|
404
410
|
is_muted: o,
|
|
405
411
|
muted_until: i,
|
|
412
|
+
is_pinned: g,
|
|
413
|
+
is_archived: h,
|
|
414
|
+
folder_id: x,
|
|
415
|
+
created_at: M,
|
|
406
416
|
...c ? { last_message: c } : {},
|
|
407
417
|
...l ? { last_message_at: l } : {}
|
|
408
418
|
};
|
|
409
419
|
}
|
|
410
|
-
function
|
|
420
|
+
function fo(e) {
|
|
411
421
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
412
422
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
423
|
+
function Mt(e) {
|
|
424
|
+
return fo(e) ? 0 : e.unread_count || 0;
|
|
415
425
|
}
|
|
416
|
-
function
|
|
426
|
+
function In(e, n) {
|
|
417
427
|
const i = n[e.id];
|
|
418
428
|
if (Array.isArray(i))
|
|
419
429
|
for (let o = i.length - 1; o >= 0; o -= 1) {
|
|
420
430
|
const c = i[o]?.id;
|
|
421
|
-
if (
|
|
431
|
+
if (Dt(c))
|
|
422
432
|
return c;
|
|
423
433
|
}
|
|
424
|
-
return
|
|
434
|
+
return Dt(e.last_message?.id) ? e.last_message.id : null;
|
|
425
435
|
}
|
|
426
436
|
function he(e) {
|
|
427
437
|
return typeof e == "object" && e !== null;
|
|
428
438
|
}
|
|
429
|
-
function
|
|
439
|
+
function po(e) {
|
|
430
440
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
431
441
|
}
|
|
432
|
-
function
|
|
442
|
+
function Un(e) {
|
|
433
443
|
if (!Array.isArray(e))
|
|
434
444
|
return [];
|
|
435
445
|
const n = [];
|
|
@@ -450,7 +460,7 @@ function In(e) {
|
|
|
450
460
|
}
|
|
451
461
|
return n;
|
|
452
462
|
}
|
|
453
|
-
function
|
|
463
|
+
function go(e, n) {
|
|
454
464
|
const i = he(n) ? n : null, o = i?.next ?? i?.next_cursor ?? e.next_cursor;
|
|
455
465
|
if (!(typeof o != "string" || o.length === 0))
|
|
456
466
|
return o;
|
|
@@ -460,13 +470,13 @@ function rt(e, n) {
|
|
|
460
470
|
let c = [];
|
|
461
471
|
return Array.isArray(o) ? c = o : he(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
|
|
462
472
|
items: c,
|
|
463
|
-
nextCursor:
|
|
473
|
+
nextCursor: go(i, o)
|
|
464
474
|
};
|
|
465
475
|
}
|
|
466
|
-
function
|
|
476
|
+
function On(e) {
|
|
467
477
|
return he(e) && typeof e.id == "string" && e.id.length > 0;
|
|
468
478
|
}
|
|
469
|
-
function
|
|
479
|
+
function Fn(e) {
|
|
470
480
|
return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
471
481
|
}
|
|
472
482
|
function ct(e, n) {
|
|
@@ -481,19 +491,19 @@ function it(e, n) {
|
|
|
481
491
|
function Be(e) {
|
|
482
492
|
return [...e].sort((n, i) => n.sort_order !== i.sort_order ? n.sort_order - i.sort_order : n.name.localeCompare(i.name));
|
|
483
493
|
}
|
|
484
|
-
function
|
|
494
|
+
function mo(e, n) {
|
|
485
495
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
486
496
|
}
|
|
487
|
-
function
|
|
497
|
+
function Nn(e, n) {
|
|
488
498
|
return e.map((i) => {
|
|
489
|
-
const o =
|
|
499
|
+
const o = mo(i.folder_id, n);
|
|
490
500
|
return (i.folder_id ?? null) === o ? i : {
|
|
491
501
|
...i,
|
|
492
502
|
folder_id: o
|
|
493
503
|
};
|
|
494
504
|
});
|
|
495
505
|
}
|
|
496
|
-
function
|
|
506
|
+
function Dn(e, n, i) {
|
|
497
507
|
let o = !1;
|
|
498
508
|
const c = e.map((l) => l.id !== n || (l.folder_id ?? null) === i ? l : (o = !0, {
|
|
499
509
|
...l,
|
|
@@ -501,7 +511,7 @@ function Nn(e, n, i) {
|
|
|
501
511
|
}));
|
|
502
512
|
return o ? c : e;
|
|
503
513
|
}
|
|
504
|
-
function
|
|
514
|
+
function vo(e, n, i) {
|
|
505
515
|
if (n === i)
|
|
506
516
|
return e;
|
|
507
517
|
let o = !1;
|
|
@@ -514,7 +524,7 @@ function go(e, n, i) {
|
|
|
514
524
|
});
|
|
515
525
|
return o ? c : e;
|
|
516
526
|
}
|
|
517
|
-
function
|
|
527
|
+
function xt(e) {
|
|
518
528
|
const n = /* @__PURE__ */ new Map();
|
|
519
529
|
for (const i of e.requests)
|
|
520
530
|
i.is_request === !0 && n.set(i.id, i);
|
|
@@ -522,7 +532,7 @@ function Mt(e) {
|
|
|
522
532
|
i.is_request === !0 && n.set(i.id, i);
|
|
523
533
|
return Array.from(n.values()).sort(ct);
|
|
524
534
|
}
|
|
525
|
-
const
|
|
535
|
+
const Gt = _i("messaging", {
|
|
526
536
|
state: () => ({
|
|
527
537
|
conversations: [],
|
|
528
538
|
requests: [],
|
|
@@ -549,25 +559,25 @@ const Wt = yi("messaging", {
|
|
|
549
559
|
getConversationById: (e) => (n) => e.conversations.find((i) => i.id === n),
|
|
550
560
|
getMessagesByConversationId: (e) => (n) => e.messages[n] || [],
|
|
551
561
|
getTypingUsers: (e) => (n) => e.typingUsers[n] || [],
|
|
552
|
-
unreadConversationsCount: (e) => e.conversations.filter((n) =>
|
|
553
|
-
unreadCount: (e) => e.conversations.reduce((n, i) => n +
|
|
554
|
-
totalUnreadCount: (e) => e.conversations.reduce((n, i) => n +
|
|
562
|
+
unreadConversationsCount: (e) => e.conversations.filter((n) => Mt(n) > 0).length,
|
|
563
|
+
unreadCount: (e) => e.conversations.reduce((n, i) => n + Mt(i), 0),
|
|
564
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, i) => n + Mt(i), 0),
|
|
555
565
|
sortedFolders: (e) => Be(e.folders),
|
|
556
566
|
folderById: (e) => (n) => e.folders.find((i) => i.id === n),
|
|
557
567
|
conversationsInFolder: (e) => (n) => e.conversations.filter((i) => i.folder_id === n),
|
|
558
568
|
hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
|
|
559
569
|
isLoadingMessages: (e) => (n) => e.loadingMessages[n] ?? !1,
|
|
560
570
|
// Message request getters
|
|
561
|
-
requestConversations: (e) =>
|
|
562
|
-
requestCount: (e) =>
|
|
563
|
-
unreadRequestCount: (e) =>
|
|
571
|
+
requestConversations: (e) => xt(e),
|
|
572
|
+
requestCount: (e) => xt(e).length,
|
|
573
|
+
unreadRequestCount: (e) => xt(e).filter((n) => n.unread_count > 0).length
|
|
564
574
|
},
|
|
565
575
|
actions: {
|
|
566
576
|
normalizeFolderAssignmentsState() {
|
|
567
577
|
if (!this.foldersLoaded)
|
|
568
578
|
return;
|
|
569
579
|
const e = new Set(this.folders.map((n) => n.id));
|
|
570
|
-
this.conversations =
|
|
580
|
+
this.conversations = Nn(this.conversations, e), this.requests = Nn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
|
|
571
581
|
},
|
|
572
582
|
async fetchFolders() {
|
|
573
583
|
try {
|
|
@@ -634,15 +644,15 @@ const Wt = yi("messaging", {
|
|
|
634
644
|
if (!o)
|
|
635
645
|
return;
|
|
636
646
|
const c = o.folder_id ?? null, l = typeof i.folder_id == "string" || i.folder_id === null ? i.folder_id : n;
|
|
637
|
-
this.conversations =
|
|
647
|
+
this.conversations = Dn(
|
|
638
648
|
this.conversations,
|
|
639
649
|
e,
|
|
640
650
|
l
|
|
641
|
-
), this.requests =
|
|
651
|
+
), this.requests = Dn(
|
|
642
652
|
this.requests,
|
|
643
653
|
e,
|
|
644
654
|
l
|
|
645
|
-
), this.folders =
|
|
655
|
+
), this.folders = vo(
|
|
646
656
|
this.folders,
|
|
647
657
|
c,
|
|
648
658
|
l
|
|
@@ -654,18 +664,18 @@ const Wt = yi("messaging", {
|
|
|
654
664
|
async fetchConversations(e, n, i, o) {
|
|
655
665
|
this.loading = !0, this.error = null;
|
|
656
666
|
try {
|
|
657
|
-
if (
|
|
658
|
-
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()),
|
|
667
|
+
if (kn())
|
|
668
|
+
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), xn();
|
|
659
669
|
const c = o?.includePresence ?? !0, l = {};
|
|
660
670
|
c && (l.include_presence = 1), e && (l.cursor = e), n && (l.filter = n), typeof i == "string" && i.length > 0 && (l.folder_id = i);
|
|
661
671
|
const d = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: h } = rt(
|
|
662
672
|
d.data,
|
|
663
673
|
"conversations"
|
|
664
674
|
), x = g.map((_) => {
|
|
665
|
-
const
|
|
666
|
-
(
|
|
675
|
+
const C = this.conversations.find(
|
|
676
|
+
(b) => b.id === _.id
|
|
667
677
|
);
|
|
668
|
-
return He(_,
|
|
678
|
+
return He(_, C);
|
|
669
679
|
});
|
|
670
680
|
e ? this.conversations.push(...x) : this.conversations = x, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
671
681
|
const M = {
|
|
@@ -674,7 +684,7 @@ const Wt = yi("messaging", {
|
|
|
674
684
|
};
|
|
675
685
|
return h !== void 0 && (M.next_cursor = h), M;
|
|
676
686
|
} catch (c) {
|
|
677
|
-
throw o?.background &&
|
|
687
|
+
throw o?.background && Pn(c) || (this.error = Z(c)), c;
|
|
678
688
|
} finally {
|
|
679
689
|
this.loading = !1;
|
|
680
690
|
}
|
|
@@ -688,8 +698,8 @@ const Wt = yi("messaging", {
|
|
|
688
698
|
includePresence: !1
|
|
689
699
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
690
700
|
} catch (e) {
|
|
691
|
-
const n = e, i =
|
|
692
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
701
|
+
const n = e, i = Wt(n.response?.status);
|
|
702
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + us(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || cs(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + eo(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Xt, !1));
|
|
693
703
|
}
|
|
694
704
|
},
|
|
695
705
|
async fetchConversation(e) {
|
|
@@ -710,8 +720,8 @@ const Wt = yi("messaging", {
|
|
|
710
720
|
async fetchRequests(e) {
|
|
711
721
|
this.loading = !0, this.error = null;
|
|
712
722
|
try {
|
|
713
|
-
if (
|
|
714
|
-
return e || (this.requests = [], this.normalizeFolderAssignmentsState()),
|
|
723
|
+
if (kn())
|
|
724
|
+
return e || (this.requests = [], this.normalizeFolderAssignmentsState()), xn();
|
|
715
725
|
const n = {
|
|
716
726
|
include_presence: 1,
|
|
717
727
|
filter: "requests"
|
|
@@ -746,16 +756,16 @@ const Wt = yi("messaging", {
|
|
|
746
756
|
c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
747
757
|
break;
|
|
748
758
|
} catch (_) {
|
|
749
|
-
if (!(o <
|
|
759
|
+
if (!(o < Yi && Pn(_)))
|
|
750
760
|
throw _;
|
|
751
|
-
o += 1, await
|
|
761
|
+
o += 1, await Mn(to(_));
|
|
752
762
|
}
|
|
753
763
|
const { items: l, nextCursor: d } = rt(
|
|
754
764
|
c.data,
|
|
755
765
|
"messages"
|
|
756
766
|
), g = l.map(at), h = [...g].reverse();
|
|
757
767
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
758
|
-
const _ = this.conversations.find((
|
|
768
|
+
const _ = this.conversations.find((C) => C.id === e) ?? this.requests.find((C) => C.id === e);
|
|
759
769
|
return _ ? !_.last_message || !_.last_message_at : !1;
|
|
760
770
|
})()) {
|
|
761
771
|
const _ = this.messages[e]?.at(-1);
|
|
@@ -774,7 +784,7 @@ const Wt = yi("messaging", {
|
|
|
774
784
|
}
|
|
775
785
|
},
|
|
776
786
|
async sendMessage(e, n, i, o, c, l, d) {
|
|
777
|
-
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M =
|
|
787
|
+
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = co(d), _ = g.currentUser, C = {
|
|
778
788
|
id: h,
|
|
779
789
|
conversation_id: e,
|
|
780
790
|
author_id: _?.id || "",
|
|
@@ -786,15 +796,15 @@ const Wt = yi("messaging", {
|
|
|
786
796
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
787
797
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
788
798
|
};
|
|
789
|
-
_ && (
|
|
799
|
+
_ && (C.author = {
|
|
790
800
|
id: _.id,
|
|
791
801
|
name: _.name,
|
|
792
802
|
..._.avatar ? { avatar: _.avatar } : {},
|
|
793
803
|
..._.handle ? { handle: _.handle } : {}
|
|
794
|
-
}), o != null && (
|
|
804
|
+
}), o != null && (C.reply_to_id = o), c != null && (C.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(C), this._pendingSendIds.add(h);
|
|
795
805
|
try {
|
|
796
|
-
let
|
|
797
|
-
const
|
|
806
|
+
let b;
|
|
807
|
+
const T = {
|
|
798
808
|
body: n || "",
|
|
799
809
|
...o ? { reply_to_id: o } : {},
|
|
800
810
|
...x ? { shared_post_id: x } : {},
|
|
@@ -803,7 +813,7 @@ const Wt = yi("messaging", {
|
|
|
803
813
|
if (i && i.length > 0) {
|
|
804
814
|
const k = await Promise.all(
|
|
805
815
|
i.map(async (O) => {
|
|
806
|
-
const H = await
|
|
816
|
+
const H = await Vi().uploadImage(O);
|
|
807
817
|
return {
|
|
808
818
|
media_id: H.id,
|
|
809
819
|
mime: H.mime_type,
|
|
@@ -811,16 +821,16 @@ const Wt = yi("messaging", {
|
|
|
811
821
|
};
|
|
812
822
|
})
|
|
813
823
|
);
|
|
814
|
-
|
|
815
|
-
...
|
|
824
|
+
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
825
|
+
...T,
|
|
816
826
|
attachments: k
|
|
817
827
|
});
|
|
818
828
|
} else
|
|
819
|
-
|
|
820
|
-
...
|
|
829
|
+
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
830
|
+
...T,
|
|
821
831
|
type: "text"
|
|
822
832
|
});
|
|
823
|
-
const
|
|
833
|
+
const w = b.data.data || b.data, f = { ...C, ...w, attachments: w.attachments ?? C.attachments }, m = at(f), v = this.messages[e], N = v.findIndex((k) => k.id === h);
|
|
824
834
|
N >= 0 && (v[N] = m), this._pendingSendIds.delete(h);
|
|
825
835
|
const q = m.id;
|
|
826
836
|
let G = 0;
|
|
@@ -829,8 +839,8 @@ const Wt = yi("messaging", {
|
|
|
829
839
|
O && O.id === q && (G++, G > 1 && v.splice(k, 1));
|
|
830
840
|
}
|
|
831
841
|
return this.updateConversationLastMessage(e, m), m;
|
|
832
|
-
} catch (
|
|
833
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((
|
|
842
|
+
} catch (b) {
|
|
843
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((T) => T.id !== h), this.error = Z(b), b;
|
|
834
844
|
}
|
|
835
845
|
},
|
|
836
846
|
async editMessage(e, n, i) {
|
|
@@ -870,11 +880,11 @@ const Wt = yi("messaging", {
|
|
|
870
880
|
return null;
|
|
871
881
|
for (let l = c.length - 1; l >= 0; l -= 1) {
|
|
872
882
|
const d = c[l]?.id;
|
|
873
|
-
if (
|
|
883
|
+
if (Dt(d))
|
|
874
884
|
return d;
|
|
875
885
|
}
|
|
876
886
|
return null;
|
|
877
|
-
})(), o = n ?
|
|
887
|
+
})(), o = n ? In(n, this.messages) : i;
|
|
878
888
|
if (!o)
|
|
879
889
|
return;
|
|
880
890
|
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
@@ -893,7 +903,7 @@ const Wt = yi("messaging", {
|
|
|
893
903
|
if (e.length === 0)
|
|
894
904
|
return;
|
|
895
905
|
const n = e.map((c) => {
|
|
896
|
-
const l =
|
|
906
|
+
const l = In(c, this.messages);
|
|
897
907
|
return l ? {
|
|
898
908
|
conversationId: c.id,
|
|
899
909
|
messageId: l
|
|
@@ -925,9 +935,9 @@ const Wt = yi("messaging", {
|
|
|
925
935
|
async sendTyping(e, n = "start") {
|
|
926
936
|
try {
|
|
927
937
|
const i = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
928
|
-
if (n !== "start" || !
|
|
938
|
+
if (n !== "start" || !no(i.data))
|
|
929
939
|
return;
|
|
930
|
-
await
|
|
940
|
+
await Mn(Zi), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
931
941
|
} catch (i) {
|
|
932
942
|
console.warn("Failed to send typing indicator:", i);
|
|
933
943
|
}
|
|
@@ -993,9 +1003,9 @@ const Wt = yi("messaging", {
|
|
|
993
1003
|
};
|
|
994
1004
|
n && (i.message = n);
|
|
995
1005
|
const o = await W().post("/v1/messaging/conversations/dm", i), c = o.data.data || o.data;
|
|
996
|
-
if (!
|
|
1006
|
+
if (!On(c))
|
|
997
1007
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
998
|
-
const l =
|
|
1008
|
+
const l = Fn(c) ? He(c) : await this.fetchConversation(c.id);
|
|
999
1009
|
return l.is_request === !0 ? (this.requests = it(this.requests, l), this.conversations = this.conversations.filter((d) => d.id !== l.id), l) : (this.conversations = it(this.conversations, l), this.requests = this.requests.filter((d) => d.id !== l.id), l);
|
|
1000
1010
|
} catch (i) {
|
|
1001
1011
|
throw this.error = Z(i), i;
|
|
@@ -1007,9 +1017,9 @@ const Wt = yi("messaging", {
|
|
|
1007
1017
|
title: e,
|
|
1008
1018
|
participant_ids: n
|
|
1009
1019
|
}), o = i.data.data || i.data;
|
|
1010
|
-
if (!
|
|
1020
|
+
if (!On(o))
|
|
1011
1021
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1012
|
-
const c =
|
|
1022
|
+
const c = Fn(o) ? o : await this.fetchConversation(o.id);
|
|
1013
1023
|
return this.conversations = it(this.conversations, c), c;
|
|
1014
1024
|
} catch (i) {
|
|
1015
1025
|
throw this.error = Z(i), i;
|
|
@@ -1117,19 +1127,19 @@ const Wt = yi("messaging", {
|
|
|
1117
1127
|
try {
|
|
1118
1128
|
g = await W().post(o, c);
|
|
1119
1129
|
} catch (_) {
|
|
1120
|
-
if (!
|
|
1130
|
+
if (!po(_))
|
|
1121
1131
|
throw _;
|
|
1122
1132
|
g = await W().post(o, c);
|
|
1123
1133
|
}
|
|
1124
|
-
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x =
|
|
1134
|
+
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x = Un(
|
|
1125
1135
|
he(h) ? h.reactions : void 0
|
|
1126
1136
|
);
|
|
1127
1137
|
(x.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1128
1138
|
try {
|
|
1129
|
-
const _ = await W().get(o),
|
|
1130
|
-
he(
|
|
1139
|
+
const _ = await W().get(o), C = he(_.data) && "data" in _.data ? _.data.data : _.data, b = Un(
|
|
1140
|
+
he(C) ? C.reactions : void 0
|
|
1131
1141
|
);
|
|
1132
|
-
this.updateMessageReactions(e, n,
|
|
1142
|
+
this.updateMessageReactions(e, n, b);
|
|
1133
1143
|
} catch {
|
|
1134
1144
|
}
|
|
1135
1145
|
} catch (g) {
|
|
@@ -1253,11 +1263,11 @@ const Wt = yi("messaging", {
|
|
|
1253
1263
|
}
|
|
1254
1264
|
}
|
|
1255
1265
|
});
|
|
1256
|
-
function
|
|
1257
|
-
const n =
|
|
1258
|
-
let M = 0, _ = null,
|
|
1259
|
-
const
|
|
1260
|
-
function
|
|
1266
|
+
function Ya(e) {
|
|
1267
|
+
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = zt(), g = d !== null, h = 20, x = 250;
|
|
1268
|
+
let M = 0, _ = null, C = null;
|
|
1269
|
+
const b = ie(() => i.currentUser?.id), T = () => Xn(e)?.trim() ?? "";
|
|
1270
|
+
function w() {
|
|
1261
1271
|
_ && (clearTimeout(_), _ = null), M = 0;
|
|
1262
1272
|
}
|
|
1263
1273
|
function f() {
|
|
@@ -1265,61 +1275,61 @@ function Ka(e) {
|
|
|
1265
1275
|
_ = null, M += 1, F();
|
|
1266
1276
|
}, x));
|
|
1267
1277
|
}
|
|
1268
|
-
function m(
|
|
1269
|
-
if (n.addMessage(
|
|
1270
|
-
const I = n.getConversationById(
|
|
1271
|
-
I && (I.unread_count = 0), n.markAsRead(
|
|
1278
|
+
function m(y) {
|
|
1279
|
+
if (n.addMessage(y.message), y.message.author_id !== b.value) {
|
|
1280
|
+
const I = n.getConversationById(y.conversation_id);
|
|
1281
|
+
I && (I.unread_count = 0), n.markAsRead(y.conversation_id).catch(() => {
|
|
1272
1282
|
});
|
|
1273
1283
|
}
|
|
1274
1284
|
}
|
|
1275
|
-
function v(
|
|
1276
|
-
n.applyParticipantReadState(
|
|
1285
|
+
function v(y) {
|
|
1286
|
+
n.applyParticipantReadState(y);
|
|
1277
1287
|
}
|
|
1278
|
-
function N(
|
|
1279
|
-
const I = n.getMessagesByConversationId(
|
|
1288
|
+
function N(y) {
|
|
1289
|
+
const I = n.getMessagesByConversationId(y.conversation_id), ae = I.findIndex((B) => B.id === y.message.id);
|
|
1280
1290
|
if (ae >= 0) {
|
|
1281
1291
|
const B = I[ae];
|
|
1282
1292
|
if (!B) return;
|
|
1283
1293
|
const A = { ...B };
|
|
1284
|
-
|
|
1285
|
-
const V = n.getConversationById(
|
|
1286
|
-
V && V.last_message?.id ===
|
|
1294
|
+
y.message.body !== void 0 && (A.body = y.message.body), y.message.edited_at !== void 0 && (A.edited_at = y.message.edited_at), y.message.meta !== void 0 && (A.meta = y.message.meta), I[ae] = A;
|
|
1295
|
+
const V = n.getConversationById(y.conversation_id);
|
|
1296
|
+
V && V.last_message?.id === y.message.id && (V.last_message = A);
|
|
1287
1297
|
}
|
|
1288
1298
|
}
|
|
1289
|
-
function q(
|
|
1290
|
-
n.removeMessage(
|
|
1299
|
+
function q(y) {
|
|
1300
|
+
n.removeMessage(y.conversation_id, y.message_id);
|
|
1291
1301
|
}
|
|
1292
|
-
function G(
|
|
1302
|
+
function G(y) {
|
|
1293
1303
|
n.updateMessageReactions(
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1304
|
+
y.conversation_id,
|
|
1305
|
+
y.message_id,
|
|
1306
|
+
y.reactions
|
|
1297
1307
|
);
|
|
1298
1308
|
}
|
|
1299
|
-
function k(
|
|
1300
|
-
const I = n.getConversationById(
|
|
1309
|
+
function k(y) {
|
|
1310
|
+
const I = n.getConversationById(y.conversation_id);
|
|
1301
1311
|
I && (I.is_request = !1), n.requests = n.requests.filter(
|
|
1302
|
-
(ae) => ae.id !==
|
|
1312
|
+
(ae) => ae.id !== y.conversation_id
|
|
1303
1313
|
);
|
|
1304
1314
|
}
|
|
1305
|
-
function O(
|
|
1306
|
-
|
|
1315
|
+
function O(y) {
|
|
1316
|
+
y.removed_user_id === b.value && (ee(), n.deleteConversation(y.conversation_id).catch(() => {
|
|
1307
1317
|
}));
|
|
1308
1318
|
}
|
|
1309
|
-
function H(
|
|
1319
|
+
function H(y) {
|
|
1310
1320
|
const I = l.value;
|
|
1311
|
-
|
|
1321
|
+
C && (C(), C = null), I && (y && !n.hasGlobalConversationSubscription(I) && xi(I), n.unregisterDetailSubscription(I), l.value = null), o.value = !1;
|
|
1312
1322
|
}
|
|
1313
1323
|
function F() {
|
|
1314
|
-
const
|
|
1315
|
-
if (!(o.value || !
|
|
1324
|
+
const y = T();
|
|
1325
|
+
if (!(o.value || !y)) {
|
|
1316
1326
|
if (!Pe()) {
|
|
1317
1327
|
f();
|
|
1318
1328
|
return;
|
|
1319
1329
|
}
|
|
1320
1330
|
c.value = null;
|
|
1321
1331
|
try {
|
|
1322
|
-
|
|
1332
|
+
C = Mi(y, {
|
|
1323
1333
|
onMessageSent: m,
|
|
1324
1334
|
onMessageRead: v,
|
|
1325
1335
|
onMessageEdited: N,
|
|
@@ -1327,7 +1337,7 @@ function Ka(e) {
|
|
|
1327
1337
|
onReactionToggled: G,
|
|
1328
1338
|
onRequestAccepted: k,
|
|
1329
1339
|
onParticipantRemoved: O
|
|
1330
|
-
}), o.value = !0, l.value =
|
|
1340
|
+
}), o.value = !0, l.value = y, n.registerDetailSubscription(y), w();
|
|
1331
1341
|
} catch (I) {
|
|
1332
1342
|
c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
|
|
1333
1343
|
}
|
|
@@ -1337,26 +1347,26 @@ function Ka(e) {
|
|
|
1337
1347
|
o.value || F();
|
|
1338
1348
|
}
|
|
1339
1349
|
typeof window < "u" && window.addEventListener(We(), J);
|
|
1340
|
-
const me = ht((
|
|
1341
|
-
if (
|
|
1350
|
+
const me = ht((y) => {
|
|
1351
|
+
if (y === "connected") {
|
|
1342
1352
|
o.value || F();
|
|
1343
1353
|
return;
|
|
1344
1354
|
}
|
|
1345
|
-
(
|
|
1355
|
+
(y === "disconnected" || y === "error") && (w(), H(!1));
|
|
1346
1356
|
});
|
|
1347
1357
|
function ee() {
|
|
1348
|
-
if (
|
|
1358
|
+
if (w(), !(!o.value || !l.value))
|
|
1349
1359
|
try {
|
|
1350
1360
|
H(!0), c.value = null;
|
|
1351
|
-
} catch (
|
|
1352
|
-
c.value =
|
|
1361
|
+
} catch (y) {
|
|
1362
|
+
c.value = y instanceof Error ? y.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", y);
|
|
1353
1363
|
}
|
|
1354
1364
|
}
|
|
1355
|
-
return
|
|
1356
|
-
() =>
|
|
1357
|
-
(
|
|
1358
|
-
if (
|
|
1359
|
-
if (
|
|
1365
|
+
return Ot(
|
|
1366
|
+
() => T(),
|
|
1367
|
+
(y, I) => {
|
|
1368
|
+
if (y !== I) {
|
|
1369
|
+
if (w(), o.value && H(!0), !y) {
|
|
1360
1370
|
c.value = null;
|
|
1361
1371
|
return;
|
|
1362
1372
|
}
|
|
@@ -1364,7 +1374,7 @@ function Ka(e) {
|
|
|
1364
1374
|
}
|
|
1365
1375
|
}
|
|
1366
1376
|
), d !== null && De(() => {
|
|
1367
|
-
|
|
1377
|
+
w(), me(), ee(), typeof window < "u" && window.removeEventListener(We(), J);
|
|
1368
1378
|
}), {
|
|
1369
1379
|
isSubscribed: ie(() => o.value),
|
|
1370
1380
|
error: ie(() => c.value),
|
|
@@ -1372,37 +1382,37 @@ function Ka(e) {
|
|
|
1372
1382
|
unsubscribe: ee
|
|
1373
1383
|
};
|
|
1374
1384
|
}
|
|
1375
|
-
const
|
|
1376
|
-
},
|
|
1385
|
+
const ls = () => () => {
|
|
1386
|
+
}, ds = async () => {
|
|
1377
1387
|
}, be = {
|
|
1378
1388
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1379
1389
|
getEcho: () => null,
|
|
1380
1390
|
getConnectionStatus: () => "disconnected",
|
|
1381
|
-
onConnectionStatusChange:
|
|
1382
|
-
reconnect:
|
|
1391
|
+
onConnectionStatusChange: ls,
|
|
1392
|
+
reconnect: ds
|
|
1383
1393
|
};
|
|
1384
|
-
function
|
|
1394
|
+
function bo() {
|
|
1385
1395
|
return be.initializedEvent;
|
|
1386
1396
|
}
|
|
1387
|
-
function
|
|
1397
|
+
function yo() {
|
|
1388
1398
|
return be.getEcho();
|
|
1389
1399
|
}
|
|
1390
|
-
function
|
|
1400
|
+
function _o() {
|
|
1391
1401
|
return be.getConnectionStatus();
|
|
1392
1402
|
}
|
|
1393
|
-
function
|
|
1403
|
+
function So(e) {
|
|
1394
1404
|
return be.onConnectionStatusChange(e);
|
|
1395
1405
|
}
|
|
1396
|
-
async function
|
|
1406
|
+
async function Co() {
|
|
1397
1407
|
await be.reconnect();
|
|
1398
1408
|
}
|
|
1399
|
-
function
|
|
1409
|
+
function wo(e) {
|
|
1400
1410
|
e.initializedEvent && (be.initializedEvent = e.initializedEvent), e.getEcho && (be.getEcho = e.getEcho), e.getConnectionStatus && (be.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (be.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (be.reconnect = e.reconnect);
|
|
1401
1411
|
}
|
|
1402
|
-
function
|
|
1403
|
-
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange =
|
|
1412
|
+
function To() {
|
|
1413
|
+
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange = ls, be.reconnect = ds;
|
|
1404
1414
|
}
|
|
1405
|
-
const
|
|
1415
|
+
const Eo = {
|
|
1406
1416
|
debug: () => {
|
|
1407
1417
|
},
|
|
1408
1418
|
info: () => {
|
|
@@ -1411,51 +1421,51 @@ const wo = {
|
|
|
1411
1421
|
},
|
|
1412
1422
|
error: () => {
|
|
1413
1423
|
}
|
|
1414
|
-
},
|
|
1415
|
-
let
|
|
1416
|
-
function
|
|
1417
|
-
return
|
|
1424
|
+
}, hs = () => Eo;
|
|
1425
|
+
let Jt = hs;
|
|
1426
|
+
function Kt() {
|
|
1427
|
+
return Jt;
|
|
1418
1428
|
}
|
|
1419
|
-
function
|
|
1420
|
-
|
|
1429
|
+
function Ao(e) {
|
|
1430
|
+
Jt = e;
|
|
1421
1431
|
}
|
|
1422
|
-
function
|
|
1423
|
-
|
|
1432
|
+
function Ro() {
|
|
1433
|
+
Jt = hs;
|
|
1424
1434
|
}
|
|
1425
|
-
const
|
|
1435
|
+
const Po = {
|
|
1426
1436
|
connected: "",
|
|
1427
1437
|
connecting: "",
|
|
1428
1438
|
disconnected: "",
|
|
1429
1439
|
error: "",
|
|
1430
1440
|
unknown: ""
|
|
1431
|
-
},
|
|
1432
|
-
function
|
|
1441
|
+
}, qn = Kt()("ConnectionStatus");
|
|
1442
|
+
function zn(e) {
|
|
1433
1443
|
return e?.connector?.pusher?.connection ?? null;
|
|
1434
1444
|
}
|
|
1435
|
-
function
|
|
1445
|
+
function Mo(e) {
|
|
1436
1446
|
return e === "messenger" ? {
|
|
1437
1447
|
initializedEvent: We(),
|
|
1438
|
-
getConnectionStatus:
|
|
1448
|
+
getConnectionStatus: ss,
|
|
1439
1449
|
onConnectionStatusChange: ht,
|
|
1440
|
-
reconnect:
|
|
1441
|
-
getEchoConnection: () =>
|
|
1450
|
+
reconnect: Ai,
|
|
1451
|
+
getEchoConnection: () => zn(Pe())
|
|
1442
1452
|
} : {
|
|
1443
|
-
initializedEvent:
|
|
1444
|
-
getConnectionStatus:
|
|
1445
|
-
onConnectionStatusChange:
|
|
1446
|
-
reconnect:
|
|
1447
|
-
getEchoConnection: () =>
|
|
1453
|
+
initializedEvent: bo(),
|
|
1454
|
+
getConnectionStatus: _o,
|
|
1455
|
+
onConnectionStatusChange: So,
|
|
1456
|
+
reconnect: Co,
|
|
1457
|
+
getEchoConnection: () => zn(yo())
|
|
1448
1458
|
};
|
|
1449
1459
|
}
|
|
1450
|
-
function
|
|
1460
|
+
function jn(e) {
|
|
1451
1461
|
return e.getEchoConnection()?.state ?? null;
|
|
1452
1462
|
}
|
|
1453
|
-
function
|
|
1454
|
-
const o =
|
|
1455
|
-
...
|
|
1463
|
+
function Za(e = {}) {
|
|
1464
|
+
const o = Mo(e.source ?? "app"), c = {
|
|
1465
|
+
...Po,
|
|
1456
1466
|
...e.icons
|
|
1457
1467
|
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), _ = ve(!1);
|
|
1458
|
-
let
|
|
1468
|
+
let C = null, b = null, T = null, w = null, f = null, m = null, v = null;
|
|
1459
1469
|
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"), O = ie(() => G.value || k.value), H = ie(() => {
|
|
1460
1470
|
switch (l.value) {
|
|
1461
1471
|
case "connecting":
|
|
@@ -1495,21 +1505,21 @@ function Qa(e = {}) {
|
|
|
1495
1505
|
return c.unknown;
|
|
1496
1506
|
}
|
|
1497
1507
|
}), me = async () => {
|
|
1498
|
-
|
|
1508
|
+
qn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1499
1509
|
}, ee = (A, V = l.value) => {
|
|
1500
|
-
if (A !== "connecting" &&
|
|
1510
|
+
if (A !== "connecting" && b && (clearTimeout(b), b = null), A === "disconnected" || A === "error") {
|
|
1501
1511
|
const ne = !_.value && V === A, _e = !x.value && (ne || V === "connected" || V === "connecting");
|
|
1502
1512
|
if (M.value = !0, _e) {
|
|
1503
|
-
h.value = !1,
|
|
1504
|
-
|
|
1513
|
+
h.value = !1, T && clearTimeout(T), T = setTimeout(() => {
|
|
1514
|
+
T = null, l.value !== "connected" && (h.value = !0);
|
|
1505
1515
|
}, 2e3);
|
|
1506
1516
|
return;
|
|
1507
1517
|
}
|
|
1508
|
-
|
|
1518
|
+
T && (clearTimeout(T), T = null), h.value = !0;
|
|
1509
1519
|
return;
|
|
1510
1520
|
}
|
|
1511
1521
|
if (A === "connected") {
|
|
1512
|
-
|
|
1522
|
+
T && (clearTimeout(T), T = null), h.value = !1, x.value = !1, M.value = !1;
|
|
1513
1523
|
return;
|
|
1514
1524
|
}
|
|
1515
1525
|
if (A === "connecting") {
|
|
@@ -1517,19 +1527,19 @@ function Qa(e = {}) {
|
|
|
1517
1527
|
h.value = !0;
|
|
1518
1528
|
return;
|
|
1519
1529
|
}
|
|
1520
|
-
if (M.value || (h.value = !1),
|
|
1530
|
+
if (M.value || (h.value = !1), b)
|
|
1521
1531
|
return;
|
|
1522
|
-
|
|
1523
|
-
if (
|
|
1524
|
-
if (
|
|
1525
|
-
|
|
1532
|
+
b = setTimeout(() => {
|
|
1533
|
+
if (b = null, l.value === "connecting") {
|
|
1534
|
+
if (jn(o) === "connected") {
|
|
1535
|
+
y("connected");
|
|
1526
1536
|
return;
|
|
1527
1537
|
}
|
|
1528
|
-
x.value = !0,
|
|
1538
|
+
x.value = !0, qn.warn("Still connecting after 10s, treating as disconnected"), y("disconnected"), g.value += 1, o.reconnect();
|
|
1529
1539
|
}
|
|
1530
1540
|
}, 1e4);
|
|
1531
1541
|
}
|
|
1532
|
-
},
|
|
1542
|
+
}, y = (A) => {
|
|
1533
1543
|
const V = l.value;
|
|
1534
1544
|
if (A === "connecting" && x.value) {
|
|
1535
1545
|
l.value = "disconnected", ee("disconnected", V);
|
|
@@ -1537,67 +1547,67 @@ function Qa(e = {}) {
|
|
|
1537
1547
|
}
|
|
1538
1548
|
l.value = A, A === "connecting" && (V === "disconnected" || V === "error") && g.value === 0 && (g.value = 1), A === "connected" && (d.value = /* @__PURE__ */ new Date(), g.value = 0), ee(A, V);
|
|
1539
1549
|
}, I = () => {
|
|
1540
|
-
const A =
|
|
1550
|
+
const A = jn(o), V = l.value;
|
|
1541
1551
|
if (A === "connected" && V !== "connected") {
|
|
1542
|
-
|
|
1552
|
+
y("connected");
|
|
1543
1553
|
return;
|
|
1544
1554
|
}
|
|
1545
1555
|
if (A === "connecting" && V !== "connecting") {
|
|
1546
|
-
|
|
1556
|
+
y("connecting");
|
|
1547
1557
|
return;
|
|
1548
1558
|
}
|
|
1549
1559
|
if ((A === "unavailable" || A === "failed" || A === "disconnected") && V !== "disconnected") {
|
|
1550
|
-
|
|
1560
|
+
y("disconnected");
|
|
1551
1561
|
return;
|
|
1552
1562
|
}
|
|
1553
1563
|
const ne = o.getConnectionStatus();
|
|
1554
|
-
!A && ne === "connected" && V !== "connected" &&
|
|
1564
|
+
!A && ne === "connected" && V !== "connected" && y("connected");
|
|
1555
1565
|
}, ae = () => {
|
|
1556
1566
|
if (f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = o.getEchoConnection(), v = null, !f?.bind)
|
|
1557
1567
|
return;
|
|
1558
1568
|
v = {
|
|
1559
|
-
connected: () =>
|
|
1560
|
-
connecting: () =>
|
|
1561
|
-
disconnected: () =>
|
|
1562
|
-
unavailable: () =>
|
|
1563
|
-
error: () =>
|
|
1569
|
+
connected: () => y("connected"),
|
|
1570
|
+
connecting: () => y("connecting"),
|
|
1571
|
+
disconnected: () => y("disconnected"),
|
|
1572
|
+
unavailable: () => y("disconnected"),
|
|
1573
|
+
error: () => y("error"),
|
|
1564
1574
|
stateChange: (V) => {
|
|
1565
1575
|
const ne = V?.current;
|
|
1566
1576
|
if (ne === "connected") {
|
|
1567
|
-
|
|
1577
|
+
y("connected");
|
|
1568
1578
|
return;
|
|
1569
1579
|
}
|
|
1570
1580
|
if (ne === "connecting") {
|
|
1571
|
-
|
|
1581
|
+
y("connecting");
|
|
1572
1582
|
return;
|
|
1573
1583
|
}
|
|
1574
|
-
(ne === "unavailable" || ne === "failed" || ne === "disconnected") &&
|
|
1584
|
+
(ne === "unavailable" || ne === "failed" || ne === "disconnected") && y("disconnected");
|
|
1575
1585
|
}
|
|
1576
1586
|
}, f.bind("connected", v.connected), f.bind("connecting", v.connecting), f.bind("disconnected", v.disconnected), f.bind("unavailable", v.unavailable), f.bind("error", v.error), f.bind("state_change", v.stateChange);
|
|
1577
1587
|
const A = f.state ?? null;
|
|
1578
1588
|
if (A === "connected") {
|
|
1579
|
-
|
|
1589
|
+
y("connected");
|
|
1580
1590
|
return;
|
|
1581
1591
|
}
|
|
1582
1592
|
if (A === "connecting") {
|
|
1583
|
-
|
|
1593
|
+
y("connecting");
|
|
1584
1594
|
return;
|
|
1585
1595
|
}
|
|
1586
|
-
(A === "unavailable" || A === "failed" || A === "disconnected") &&
|
|
1596
|
+
(A === "unavailable" || A === "failed" || A === "disconnected") && y("disconnected");
|
|
1587
1597
|
}, B = ie(() => {
|
|
1588
1598
|
if (!d.value || !N.value)
|
|
1589
1599
|
return null;
|
|
1590
1600
|
const A = Date.now() - d.value.getTime(), V = Math.floor(A / 6e4), ne = Math.floor(A % 6e4 / 1e3);
|
|
1591
1601
|
return V > 0 ? `${V}m ${ne}s` : `${ne}s`;
|
|
1592
1602
|
});
|
|
1593
|
-
return
|
|
1594
|
-
l.value = o.getConnectionStatus(),
|
|
1603
|
+
return jt(() => {
|
|
1604
|
+
l.value = o.getConnectionStatus(), C = o.onConnectionStatusChange(y), N.value && (d.value = /* @__PURE__ */ new Date()), ee(l.value, l.value), _.value = !0, ae(), m = () => {
|
|
1595
1605
|
ae(), I();
|
|
1596
|
-
}, window.addEventListener(o.initializedEvent, m), I(),
|
|
1606
|
+
}, window.addEventListener(o.initializedEvent, m), I(), w = setInterval(() => {
|
|
1597
1607
|
I();
|
|
1598
1608
|
}, 3e3);
|
|
1599
1609
|
}), De(() => {
|
|
1600
|
-
|
|
1610
|
+
C?.(), b && (clearTimeout(b), b = null), T && (clearTimeout(T), T = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = null, v = null;
|
|
1601
1611
|
}), {
|
|
1602
1612
|
connectionStatus: ie(() => l.value),
|
|
1603
1613
|
isConnected: N,
|
|
@@ -1615,73 +1625,73 @@ function Qa(e = {}) {
|
|
|
1615
1625
|
reconnect: me
|
|
1616
1626
|
};
|
|
1617
1627
|
}
|
|
1618
|
-
const
|
|
1619
|
-
let
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1628
|
+
const fs = $t;
|
|
1629
|
+
let Qt = fs;
|
|
1630
|
+
function ps() {
|
|
1631
|
+
return Qt;
|
|
1622
1632
|
}
|
|
1623
|
-
function
|
|
1624
|
-
|
|
1633
|
+
function xo(e) {
|
|
1634
|
+
Qt = e;
|
|
1625
1635
|
}
|
|
1626
|
-
function
|
|
1627
|
-
|
|
1636
|
+
function ko() {
|
|
1637
|
+
Qt = fs;
|
|
1628
1638
|
}
|
|
1629
|
-
const
|
|
1630
|
-
function
|
|
1639
|
+
const Lo = 6e4;
|
|
1640
|
+
function Io(e) {
|
|
1631
1641
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
1632
1642
|
}
|
|
1633
|
-
function
|
|
1643
|
+
function Uo(e) {
|
|
1634
1644
|
if (typeof e != "string")
|
|
1635
1645
|
return null;
|
|
1636
1646
|
const n = e.trim().toLowerCase();
|
|
1637
|
-
return
|
|
1647
|
+
return Io(n) ? n : null;
|
|
1638
1648
|
}
|
|
1639
|
-
function
|
|
1649
|
+
function gs(e) {
|
|
1640
1650
|
if (typeof e != "string")
|
|
1641
1651
|
return null;
|
|
1642
1652
|
const n = e.trim();
|
|
1643
1653
|
return n.length > 0 ? n : null;
|
|
1644
1654
|
}
|
|
1645
|
-
function
|
|
1646
|
-
const n =
|
|
1655
|
+
function qt(e) {
|
|
1656
|
+
const n = gs(e);
|
|
1647
1657
|
if (n === null)
|
|
1648
1658
|
return null;
|
|
1649
1659
|
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, c = new Date(o);
|
|
1650
1660
|
return Number.isNaN(c.getTime()) ? null : c;
|
|
1651
1661
|
}
|
|
1652
|
-
function
|
|
1662
|
+
function Oo(e, n, i = {}) {
|
|
1653
1663
|
if (e === null)
|
|
1654
1664
|
return null;
|
|
1655
1665
|
if (e === "offline")
|
|
1656
1666
|
return "offline";
|
|
1657
|
-
const o =
|
|
1667
|
+
const o = qt(n);
|
|
1658
1668
|
if (o === null)
|
|
1659
1669
|
return e;
|
|
1660
|
-
const c = i.now ?? Date.now(), l = i.staleAfterMs ??
|
|
1670
|
+
const c = i.now ?? Date.now(), l = i.staleAfterMs ?? Lo;
|
|
1661
1671
|
return c - o.getTime() > l ? "offline" : e;
|
|
1662
1672
|
}
|
|
1663
|
-
function
|
|
1664
|
-
const i =
|
|
1673
|
+
function $n(e, n = {}) {
|
|
1674
|
+
const i = gs(e?.last_seen_at), o = Uo(e?.status);
|
|
1665
1675
|
return {
|
|
1666
|
-
status:
|
|
1676
|
+
status: Oo(o, i, n),
|
|
1667
1677
|
lastSeenAt: i
|
|
1668
1678
|
};
|
|
1669
1679
|
}
|
|
1670
|
-
const
|
|
1680
|
+
const ms = () => {
|
|
1671
1681
|
};
|
|
1672
|
-
let
|
|
1673
|
-
function
|
|
1674
|
-
return
|
|
1682
|
+
let Yt = ms;
|
|
1683
|
+
function Fo() {
|
|
1684
|
+
return Yt;
|
|
1675
1685
|
}
|
|
1676
|
-
function
|
|
1677
|
-
|
|
1686
|
+
function No(e) {
|
|
1687
|
+
Yt = e;
|
|
1678
1688
|
}
|
|
1679
|
-
function
|
|
1680
|
-
|
|
1689
|
+
function Do() {
|
|
1690
|
+
Yt = ms;
|
|
1681
1691
|
}
|
|
1682
|
-
const Ue =
|
|
1683
|
-
function
|
|
1684
|
-
const e =
|
|
1692
|
+
const Ue = Kt()("GlobalMessaging"), qo = 3, zo = (e) => e.replace(/\/+$/, ""), jo = (e) => zo(window.location.pathname) === `/messages/${e}`, $o = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1693
|
+
function ec() {
|
|
1694
|
+
const e = Gt(), n = Fe()(), i = Fo(), o = ps(), c = wi(), l = zt(), { conversations: d } = Si(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
|
|
1685
1695
|
let x = !1;
|
|
1686
1696
|
function M(k) {
|
|
1687
1697
|
const O = h.get(k);
|
|
@@ -1697,20 +1707,20 @@ function Ya() {
|
|
|
1697
1707
|
M(k), e.unregisterGlobalConversationSubscription(k);
|
|
1698
1708
|
g.clear();
|
|
1699
1709
|
}
|
|
1700
|
-
function
|
|
1710
|
+
function C(k) {
|
|
1701
1711
|
const O = Pe();
|
|
1702
1712
|
if (!O || g.has(k)) return;
|
|
1703
1713
|
const H = `conversation.${k}`;
|
|
1704
1714
|
M(k);
|
|
1705
1715
|
const F = O.private(H), J = (B) => {
|
|
1706
|
-
if (!
|
|
1716
|
+
if (!Oi(B)) {
|
|
1707
1717
|
Ue.warn("Dropping malformed ConversationMessageSent event", B);
|
|
1708
1718
|
return;
|
|
1709
1719
|
}
|
|
1710
1720
|
const A = B, V = n.currentUser?.id;
|
|
1711
1721
|
if (!V || A.message.author_id === V) return;
|
|
1712
1722
|
e.addMessage(A.message);
|
|
1713
|
-
const ne = e.hasDetailSubscription(A.conversation_id), _e =
|
|
1723
|
+
const ne = e.hasDetailSubscription(A.conversation_id), _e = jo(A.conversation_id);
|
|
1714
1724
|
if (ne || _e) {
|
|
1715
1725
|
const U = e.getConversationById(A.conversation_id);
|
|
1716
1726
|
U && (U.unread_count = 0), e.markAsRead(A.conversation_id).catch(() => {
|
|
@@ -1719,24 +1729,24 @@ function Ya() {
|
|
|
1719
1729
|
}
|
|
1720
1730
|
const R = e.getConversationById(A.conversation_id);
|
|
1721
1731
|
if (R) {
|
|
1722
|
-
const U =
|
|
1732
|
+
const U = $o(R);
|
|
1723
1733
|
U || R.unread_count++, i(U);
|
|
1724
1734
|
}
|
|
1725
1735
|
}, me = (B) => {
|
|
1726
|
-
if (!
|
|
1736
|
+
if (!Fi(B)) {
|
|
1727
1737
|
Ue.warn("Dropping malformed ConversationMessageRead event", B);
|
|
1728
1738
|
return;
|
|
1729
1739
|
}
|
|
1730
1740
|
e.applyParticipantReadState(B);
|
|
1731
1741
|
}, ee = (B) => {
|
|
1732
|
-
if (!
|
|
1742
|
+
if (!qi(B)) {
|
|
1733
1743
|
Ue.warn("Dropping malformed MessageReactionToggled event", B);
|
|
1734
1744
|
return;
|
|
1735
1745
|
}
|
|
1736
1746
|
const A = B;
|
|
1737
1747
|
e.updateMessageReactions(A.conversation_id, A.message_id, A.reactions);
|
|
1738
|
-
},
|
|
1739
|
-
if (!
|
|
1748
|
+
}, y = (B) => {
|
|
1749
|
+
if (!Ni(B)) {
|
|
1740
1750
|
Ue.warn("Dropping malformed ConversationMessageEdited event", B);
|
|
1741
1751
|
return;
|
|
1742
1752
|
}
|
|
@@ -1754,14 +1764,14 @@ function Ya() {
|
|
|
1754
1764
|
body: A.message.body
|
|
1755
1765
|
});
|
|
1756
1766
|
}, I = (B) => {
|
|
1757
|
-
if (!
|
|
1767
|
+
if (!Di(B)) {
|
|
1758
1768
|
Ue.warn("Dropping malformed ConversationMessageDeleted event", B);
|
|
1759
1769
|
return;
|
|
1760
1770
|
}
|
|
1761
1771
|
const A = B;
|
|
1762
1772
|
e.removeMessage(A.conversation_id, A.message_id);
|
|
1763
1773
|
}, ae = (B) => {
|
|
1764
|
-
if (!
|
|
1774
|
+
if (!zi(B)) {
|
|
1765
1775
|
Ue.warn("Dropping malformed ConversationRequestAccepted event", B);
|
|
1766
1776
|
return;
|
|
1767
1777
|
}
|
|
@@ -1770,19 +1780,19 @@ function Ya() {
|
|
|
1770
1780
|
(ne) => ne.id !== A.conversation_id
|
|
1771
1781
|
);
|
|
1772
1782
|
};
|
|
1773
|
-
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited",
|
|
1783
|
+
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited", y), F.listen(".ConversationMessageDeleted", I), F.listen(".MessageReactionToggled", ee), F.listen(".ConversationRequestAccepted", ae), h.set(k, {
|
|
1774
1784
|
channel: F,
|
|
1775
1785
|
bindings: [
|
|
1776
1786
|
{ event: ".ConversationMessageSent", handler: J },
|
|
1777
1787
|
{ event: ".ConversationMessageRead", handler: me },
|
|
1778
|
-
{ event: ".ConversationMessageEdited", handler:
|
|
1788
|
+
{ event: ".ConversationMessageEdited", handler: y },
|
|
1779
1789
|
{ event: ".ConversationMessageDeleted", handler: I },
|
|
1780
1790
|
{ event: ".MessageReactionToggled", handler: ee },
|
|
1781
1791
|
{ event: ".ConversationRequestAccepted", handler: ae }
|
|
1782
1792
|
]
|
|
1783
1793
|
}), g.add(k), e.registerGlobalConversationSubscription(k);
|
|
1784
1794
|
}
|
|
1785
|
-
function
|
|
1795
|
+
function b() {
|
|
1786
1796
|
const k = Pe();
|
|
1787
1797
|
if (!k) {
|
|
1788
1798
|
_();
|
|
@@ -1798,10 +1808,10 @@ function Ya() {
|
|
|
1798
1808
|
}
|
|
1799
1809
|
g.clear();
|
|
1800
1810
|
}
|
|
1801
|
-
function
|
|
1811
|
+
function T() {
|
|
1802
1812
|
const k = Pe();
|
|
1803
1813
|
if (!k) return;
|
|
1804
|
-
const O = e.conversations.slice(0,
|
|
1814
|
+
const O = e.conversations.slice(0, qo), H = new Set(O.map((F) => F.id));
|
|
1805
1815
|
for (const F of g)
|
|
1806
1816
|
if (!H.has(F) && !e.hasDetailSubscription(F)) {
|
|
1807
1817
|
try {
|
|
@@ -1811,10 +1821,10 @@ function Ya() {
|
|
|
1811
1821
|
g.delete(F), e.unregisterGlobalConversationSubscription(F);
|
|
1812
1822
|
}
|
|
1813
1823
|
for (const F of O)
|
|
1814
|
-
|
|
1824
|
+
C(F.id);
|
|
1815
1825
|
}
|
|
1816
|
-
function
|
|
1817
|
-
const O =
|
|
1826
|
+
function w(k) {
|
|
1827
|
+
const O = $n({
|
|
1818
1828
|
status: k.status,
|
|
1819
1829
|
last_seen_at: k.last_seen_at ?? null
|
|
1820
1830
|
});
|
|
@@ -1834,7 +1844,7 @@ function Ya() {
|
|
|
1834
1844
|
params: { ids: k }
|
|
1835
1845
|
}), H = O.data?.data?.items ?? O.data?.items ?? [];
|
|
1836
1846
|
for (const F of H) {
|
|
1837
|
-
const J =
|
|
1847
|
+
const J = $n(F);
|
|
1838
1848
|
J.status !== null && e.updatePresenceForUser(F.id, J.status, J.lastSeenAt);
|
|
1839
1849
|
}
|
|
1840
1850
|
} catch (O) {
|
|
@@ -1842,34 +1852,34 @@ function Ya() {
|
|
|
1842
1852
|
}
|
|
1843
1853
|
}
|
|
1844
1854
|
function m() {
|
|
1845
|
-
!Pe() || x || (
|
|
1855
|
+
!Pe() || x || (Ri(w), x = !0);
|
|
1846
1856
|
}
|
|
1847
1857
|
function v() {
|
|
1848
|
-
x && (
|
|
1858
|
+
x && (Pi(), x = !1);
|
|
1849
1859
|
}
|
|
1850
|
-
const N =
|
|
1860
|
+
const N = Ot(
|
|
1851
1861
|
d,
|
|
1852
1862
|
() => {
|
|
1853
|
-
|
|
1863
|
+
T();
|
|
1854
1864
|
},
|
|
1855
1865
|
{ deep: !1, immediate: !0 }
|
|
1856
|
-
), q =
|
|
1866
|
+
), q = Ot(
|
|
1857
1867
|
() => c.fullPath,
|
|
1858
1868
|
() => {
|
|
1859
|
-
|
|
1869
|
+
T();
|
|
1860
1870
|
}
|
|
1861
1871
|
), G = ht((k) => {
|
|
1862
|
-
k === "connected" ? (_(),
|
|
1872
|
+
k === "connected" ? (_(), T(), v(), m(), f()) : (k === "disconnected" || k === "error") && (_(), v());
|
|
1863
1873
|
});
|
|
1864
|
-
|
|
1865
|
-
N(), q(), G(),
|
|
1874
|
+
T(), m(), f(), l !== null && De(() => {
|
|
1875
|
+
N(), q(), G(), b(), v();
|
|
1866
1876
|
});
|
|
1867
1877
|
}
|
|
1868
|
-
function
|
|
1869
|
-
const e = ve(
|
|
1878
|
+
function tc() {
|
|
1879
|
+
const e = ve(Ft());
|
|
1870
1880
|
let n = null;
|
|
1871
|
-
return
|
|
1872
|
-
e.value =
|
|
1881
|
+
return jt(() => {
|
|
1882
|
+
e.value = Ft(), n = Ei((i) => {
|
|
1873
1883
|
e.value = i;
|
|
1874
1884
|
});
|
|
1875
1885
|
}), De(() => {
|
|
@@ -1880,7 +1890,7 @@ function Za() {
|
|
|
1880
1890
|
isSuspended: ie(() => e.value === "account_suspended")
|
|
1881
1891
|
};
|
|
1882
1892
|
}
|
|
1883
|
-
const
|
|
1893
|
+
const vs = () => null, bs = {
|
|
1884
1894
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
1885
1895
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
1886
1896
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -1891,29 +1901,29 @@ const ms = () => null, vs = {
|
|
|
1891
1901
|
activityDebounceMs: 5e3,
|
|
1892
1902
|
heartbeatIntervalMs: 3e4,
|
|
1893
1903
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
1894
|
-
authTokenResolver:
|
|
1904
|
+
authTokenResolver: vs
|
|
1895
1905
|
};
|
|
1896
|
-
let lt = { ...
|
|
1897
|
-
function
|
|
1906
|
+
let lt = { ...bs };
|
|
1907
|
+
function Ho() {
|
|
1898
1908
|
return lt;
|
|
1899
1909
|
}
|
|
1900
|
-
function
|
|
1910
|
+
function Bo(e) {
|
|
1901
1911
|
lt = {
|
|
1902
1912
|
...lt,
|
|
1903
1913
|
...e
|
|
1904
1914
|
};
|
|
1905
1915
|
}
|
|
1906
|
-
function
|
|
1907
|
-
lt = { ...
|
|
1916
|
+
function Vo() {
|
|
1917
|
+
lt = { ...bs };
|
|
1908
1918
|
}
|
|
1909
|
-
function
|
|
1910
|
-
return e.authTokenResolver !==
|
|
1919
|
+
function Xo(e) {
|
|
1920
|
+
return e.authTokenResolver !== vs;
|
|
1911
1921
|
}
|
|
1912
|
-
const
|
|
1922
|
+
const Wo = 429, Go = 403, Jo = 423, Ko = "ACCOUNT_LIMITED", Qo = "ACCOUNT_SUSPENDED", Yo = "ACCOUNT_WRITE_TIMEOUT", Zo = 2, ea = 5 * 6e4;
|
|
1913
1923
|
function Xe(e) {
|
|
1914
1924
|
return typeof e == "object" && e !== null;
|
|
1915
1925
|
}
|
|
1916
|
-
function
|
|
1926
|
+
function ys(e) {
|
|
1917
1927
|
if (!Xe(e))
|
|
1918
1928
|
return null;
|
|
1919
1929
|
const n = e.response;
|
|
@@ -1928,7 +1938,7 @@ function bs(e) {
|
|
|
1928
1938
|
}
|
|
1929
1939
|
return null;
|
|
1930
1940
|
}
|
|
1931
|
-
function
|
|
1941
|
+
function _s(e) {
|
|
1932
1942
|
if (!Xe(e))
|
|
1933
1943
|
return null;
|
|
1934
1944
|
const n = e.response;
|
|
@@ -1937,45 +1947,45 @@ function ys(e) {
|
|
|
1937
1947
|
const i = n.data;
|
|
1938
1948
|
return Xe(i) && typeof i.code == "string" ? i.code : null;
|
|
1939
1949
|
}
|
|
1940
|
-
function xt(e) {
|
|
1941
|
-
const n = bs(e), i = ys(e);
|
|
1942
|
-
return n === Vo && i === Go || n === Wo && i === Ko;
|
|
1943
|
-
}
|
|
1944
1950
|
function kt(e) {
|
|
1945
|
-
const n =
|
|
1946
|
-
return n ===
|
|
1951
|
+
const n = ys(e), i = _s(e);
|
|
1952
|
+
return n === Wo && i === Ko || n === Jo && i === Yo;
|
|
1953
|
+
}
|
|
1954
|
+
function Lt(e) {
|
|
1955
|
+
const n = ys(e), i = _s(e);
|
|
1956
|
+
return n === Go && i === Qo ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
1947
1957
|
}
|
|
1948
1958
|
function Ge() {
|
|
1949
1959
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
1950
1960
|
}
|
|
1951
|
-
function
|
|
1961
|
+
function ta(e) {
|
|
1952
1962
|
const n = Ge(), i = n?.getItem(e);
|
|
1953
1963
|
if (i)
|
|
1954
1964
|
return i;
|
|
1955
1965
|
const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1956
1966
|
return n?.setItem(e, o), o;
|
|
1957
1967
|
}
|
|
1958
|
-
function
|
|
1968
|
+
function na(e) {
|
|
1959
1969
|
const n = Ge(), i = n?.getItem(e);
|
|
1960
1970
|
if (!i)
|
|
1961
1971
|
return null;
|
|
1962
1972
|
const o = Number.parseInt(i, 10);
|
|
1963
1973
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
1964
1974
|
}
|
|
1965
|
-
function
|
|
1966
|
-
const i = Ge(), o =
|
|
1975
|
+
function It(e, n = Date.now()) {
|
|
1976
|
+
const i = Ge(), o = na(e);
|
|
1967
1977
|
return o === null ? !1 : o <= n ? (i?.removeItem(e), !1) : !0;
|
|
1968
1978
|
}
|
|
1969
|
-
function
|
|
1970
|
-
Ge()?.setItem(e, String(n +
|
|
1979
|
+
function sa(e, n = Date.now()) {
|
|
1980
|
+
Ge()?.setItem(e, String(n + ea));
|
|
1971
1981
|
}
|
|
1972
|
-
function
|
|
1982
|
+
function ra(e) {
|
|
1973
1983
|
Ge()?.removeItem(e);
|
|
1974
1984
|
}
|
|
1975
|
-
function
|
|
1985
|
+
function ia(e) {
|
|
1976
1986
|
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
1977
1987
|
}
|
|
1978
|
-
function
|
|
1988
|
+
function oa(e, n, i) {
|
|
1979
1989
|
if (typeof fetch > "u")
|
|
1980
1990
|
return null;
|
|
1981
1991
|
const o = {
|
|
@@ -1984,7 +1994,7 @@ function ra(e, n, i) {
|
|
|
1984
1994
|
};
|
|
1985
1995
|
i && (o.Authorization = `Bearer ${i}`);
|
|
1986
1996
|
try {
|
|
1987
|
-
return fetch(
|
|
1997
|
+
return fetch(ia(e), {
|
|
1988
1998
|
method: "POST",
|
|
1989
1999
|
headers: o,
|
|
1990
2000
|
body: JSON.stringify({ client_id: n }),
|
|
@@ -1996,32 +2006,32 @@ function ra(e, n, i) {
|
|
|
1996
2006
|
return null;
|
|
1997
2007
|
}
|
|
1998
2008
|
}
|
|
1999
|
-
function
|
|
2000
|
-
const e = Fe()(), n =
|
|
2001
|
-
let c = null, l = null, d = !1, g =
|
|
2002
|
-
const
|
|
2009
|
+
function nc() {
|
|
2010
|
+
const e = Fe()(), n = Ho(), i = ps(), o = ta(n.clientIdStorageKey);
|
|
2011
|
+
let c = null, l = null, d = !1, g = It(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null, _ = 0;
|
|
2012
|
+
const C = () => Xo(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2003
2013
|
c && (clearInterval(c), c = null);
|
|
2004
|
-
},
|
|
2014
|
+
}, T = () => {
|
|
2005
2015
|
l && (clearTimeout(l), l = null);
|
|
2006
|
-
},
|
|
2007
|
-
|
|
2016
|
+
}, w = () => {
|
|
2017
|
+
b(), c = setInterval(() => {
|
|
2008
2018
|
F();
|
|
2009
2019
|
}, n.heartbeatIntervalMs);
|
|
2010
2020
|
}, f = (I) => {
|
|
2011
|
-
g || console.warn(I),
|
|
2021
|
+
g || console.warn(I), sa(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null, b(), T();
|
|
2012
2022
|
}, m = async (I) => {
|
|
2013
|
-
if (!(!d || x || g || h) &&
|
|
2023
|
+
if (!(!d || x || g || h) && C() && M !== I)
|
|
2014
2024
|
try {
|
|
2015
2025
|
await i.patch(n.statusUrl, { status: I }), M = I;
|
|
2016
2026
|
} catch (ae) {
|
|
2017
|
-
if (
|
|
2027
|
+
if (kt(ae)) {
|
|
2018
2028
|
f("[Presence] Presence updates paused: account is temporarily limited");
|
|
2019
2029
|
return;
|
|
2020
2030
|
}
|
|
2021
|
-
|
|
2031
|
+
Lt(ae) && (h = !0, d = !1, M = null, b(), T());
|
|
2022
2032
|
}
|
|
2023
2033
|
}, v = () => {
|
|
2024
|
-
|
|
2034
|
+
T(), !(!d || x || g || h || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
2025
2035
|
l = null, m("idle");
|
|
2026
2036
|
}, n.idleAfterMs));
|
|
2027
2037
|
}, N = () => {
|
|
@@ -2036,37 +2046,37 @@ function ec() {
|
|
|
2036
2046
|
}, k = () => {
|
|
2037
2047
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2038
2048
|
}, O = async () => {
|
|
2039
|
-
if (
|
|
2049
|
+
if (It(n.accountLimitedUntilStorageKey))
|
|
2040
2050
|
return g = !0, "account_limited";
|
|
2041
2051
|
try {
|
|
2042
2052
|
return await i.post(n.sessionOpenUrl, {
|
|
2043
2053
|
client_id: o,
|
|
2044
2054
|
user_agent: n.userAgentResolver()
|
|
2045
|
-
}),
|
|
2055
|
+
}), ra(n.accountLimitedUntilStorageKey), g = !1, h = !1, d = !0, M = null, "opened";
|
|
2046
2056
|
} catch (I) {
|
|
2047
|
-
return
|
|
2057
|
+
return kt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, M = null, b(), T(), "account_suspended") : "failed";
|
|
2048
2058
|
}
|
|
2049
2059
|
}, H = async () => {
|
|
2050
|
-
for (let I = 0; I <
|
|
2060
|
+
for (let I = 0; I < Zo; I += 1)
|
|
2051
2061
|
if (await O() !== "failed")
|
|
2052
2062
|
return;
|
|
2053
2063
|
console.warn("[Presence] Failed to open session");
|
|
2054
2064
|
}, F = async () => {
|
|
2055
|
-
if (d &&
|
|
2065
|
+
if (d && C())
|
|
2056
2066
|
try {
|
|
2057
2067
|
await i.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2058
2068
|
} catch (I) {
|
|
2059
|
-
if (
|
|
2069
|
+
if (kt(I)) {
|
|
2060
2070
|
f("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2061
2071
|
return;
|
|
2062
2072
|
}
|
|
2063
|
-
|
|
2073
|
+
Lt(I) && (h = !0, d = !1, M = null, b(), T());
|
|
2064
2074
|
}
|
|
2065
2075
|
}, J = () => {
|
|
2066
2076
|
if (!d)
|
|
2067
2077
|
return;
|
|
2068
|
-
d = !1, M = null,
|
|
2069
|
-
const I =
|
|
2078
|
+
d = !1, M = null, T();
|
|
2079
|
+
const I = oa(
|
|
2070
2080
|
n.sessionCloseUrl,
|
|
2071
2081
|
o,
|
|
2072
2082
|
n.authTokenResolver()
|
|
@@ -2084,40 +2094,40 @@ function ec() {
|
|
|
2084
2094
|
J();
|
|
2085
2095
|
return;
|
|
2086
2096
|
}
|
|
2087
|
-
d && (
|
|
2097
|
+
d && (w(), m("online"), v());
|
|
2088
2098
|
}
|
|
2089
2099
|
}, ee = () => {
|
|
2090
2100
|
if (!x) {
|
|
2091
2101
|
if (document.visibilityState === "hidden") {
|
|
2092
|
-
J(),
|
|
2102
|
+
J(), b(), T();
|
|
2093
2103
|
return;
|
|
2094
2104
|
}
|
|
2095
2105
|
if (document.visibilityState === "visible" && !d) {
|
|
2096
|
-
g =
|
|
2106
|
+
g = It(n.accountLimitedUntilStorageKey), !g && !h && me();
|
|
2097
2107
|
return;
|
|
2098
2108
|
}
|
|
2099
2109
|
document.visibilityState === "visible" && d && !g && !h && N();
|
|
2100
2110
|
}
|
|
2101
|
-
},
|
|
2102
|
-
x || (J(),
|
|
2111
|
+
}, y = () => {
|
|
2112
|
+
x || (J(), b(), T());
|
|
2103
2113
|
};
|
|
2104
|
-
|
|
2114
|
+
jt(async () => {
|
|
2105
2115
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2106
2116
|
if (await H(), x) {
|
|
2107
2117
|
J();
|
|
2108
2118
|
return;
|
|
2109
2119
|
}
|
|
2110
|
-
d && (
|
|
2120
|
+
d && (w(), m("online"), v()), G(), document.addEventListener("visibilitychange", ee), window.addEventListener("pagehide", y), window.addEventListener("beforeunload", y);
|
|
2111
2121
|
}
|
|
2112
2122
|
}), De(() => {
|
|
2113
|
-
x = !0, k(),
|
|
2123
|
+
x = !0, k(), T(), b(), J(), document.removeEventListener("visibilitychange", ee), window.removeEventListener("pagehide", y), window.removeEventListener("beforeunload", y);
|
|
2114
2124
|
});
|
|
2115
2125
|
}
|
|
2116
|
-
const
|
|
2117
|
-
function
|
|
2118
|
-
const n =
|
|
2119
|
-
let
|
|
2120
|
-
const f = ie(() => i.currentUser?.id), m = () =>
|
|
2126
|
+
const aa = 12e3;
|
|
2127
|
+
function sc(e) {
|
|
2128
|
+
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = ve([]), g = /* @__PURE__ */ new Map(), h = zt(), x = h !== null, M = 20, _ = 250;
|
|
2129
|
+
let C = !1, b = null, T = 0, w = null;
|
|
2130
|
+
const f = ie(() => i.currentUser?.id), m = () => Xn(e)?.trim() ?? "", v = () => {
|
|
2121
2131
|
const R = l.value?.trim() ?? "";
|
|
2122
2132
|
if (R.length > 0)
|
|
2123
2133
|
return R;
|
|
@@ -2136,22 +2146,22 @@ function tc(e) {
|
|
|
2136
2146
|
clearTimeout(R);
|
|
2137
2147
|
g.clear();
|
|
2138
2148
|
}, O = () => {
|
|
2139
|
-
|
|
2149
|
+
w && (clearTimeout(w), w = null), T = 0;
|
|
2140
2150
|
}, H = () => {
|
|
2141
|
-
!x || o.value ||
|
|
2142
|
-
|
|
2151
|
+
!x || o.value || w || T >= M || (w = setTimeout(() => {
|
|
2152
|
+
w = null, T += 1, ee();
|
|
2143
2153
|
}, _));
|
|
2144
2154
|
}, F = (R, U) => {
|
|
2145
2155
|
G(R);
|
|
2146
2156
|
const re = setTimeout(() => {
|
|
2147
2157
|
g.delete(R), n.removeTypingUser(U, R), d.value = d.value.filter((fe) => fe.id !== R);
|
|
2148
|
-
},
|
|
2158
|
+
}, aa);
|
|
2149
2159
|
g.set(R, re);
|
|
2150
2160
|
}, J = () => {
|
|
2151
|
-
|
|
2161
|
+
C = !0, O();
|
|
2152
2162
|
}, me = (R) => {
|
|
2153
2163
|
try {
|
|
2154
|
-
|
|
2164
|
+
b && (b(), b = null), b = ki(R, {
|
|
2155
2165
|
onTypingStart: I,
|
|
2156
2166
|
onTypingStop: ae
|
|
2157
2167
|
}), O(), o.value = !0, l.value = R;
|
|
@@ -2161,26 +2171,26 @@ function tc(e) {
|
|
|
2161
2171
|
}, ee = () => {
|
|
2162
2172
|
const R = m();
|
|
2163
2173
|
if (!(o.value || !R)) {
|
|
2164
|
-
if (c.value = null, Pe() &&
|
|
2174
|
+
if (c.value = null, Pe() && Tn() === "connected") {
|
|
2165
2175
|
me(R);
|
|
2166
2176
|
return;
|
|
2167
2177
|
}
|
|
2168
|
-
|
|
2169
|
-
if (
|
|
2178
|
+
C = !1, Ti().then((U) => {
|
|
2179
|
+
if (C || o.value || !U)
|
|
2170
2180
|
return;
|
|
2171
2181
|
const re = m();
|
|
2172
|
-
if (re && re === R && Pe() &&
|
|
2182
|
+
if (re && re === R && Pe() && Tn() === "connected") {
|
|
2173
2183
|
me(re);
|
|
2174
2184
|
return;
|
|
2175
2185
|
}
|
|
2176
2186
|
H();
|
|
2177
2187
|
}), H();
|
|
2178
2188
|
}
|
|
2179
|
-
},
|
|
2189
|
+
}, y = () => {
|
|
2180
2190
|
const R = l.value;
|
|
2181
2191
|
if (J(), !(!o.value || !R))
|
|
2182
2192
|
try {
|
|
2183
|
-
|
|
2193
|
+
b && (b(), b = null), Li(R), k(), q(R), o.value = !1, l.value = null, c.value = null;
|
|
2184
2194
|
} catch (U) {
|
|
2185
2195
|
c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2186
2196
|
}
|
|
@@ -2246,13 +2256,13 @@ function tc(e) {
|
|
|
2246
2256
|
return;
|
|
2247
2257
|
}
|
|
2248
2258
|
if (R === "disconnected" || R === "error") {
|
|
2249
|
-
J(),
|
|
2259
|
+
J(), b && (b(), b = null);
|
|
2250
2260
|
const U = v();
|
|
2251
2261
|
U && q(U), o.value = !1, l.value = null, k();
|
|
2252
2262
|
}
|
|
2253
2263
|
});
|
|
2254
2264
|
return h !== null && De(() => {
|
|
2255
|
-
J(), _e(), k(),
|
|
2265
|
+
J(), _e(), k(), y(), typeof window < "u" && window.removeEventListener(We(), ne);
|
|
2256
2266
|
}), {
|
|
2257
2267
|
isSubscribed: ie(() => o.value),
|
|
2258
2268
|
error: ie(() => c.value),
|
|
@@ -2260,16 +2270,16 @@ function tc(e) {
|
|
|
2260
2270
|
formatTypingIndicator: A,
|
|
2261
2271
|
hasTypingUsers: V,
|
|
2262
2272
|
subscribe: ee,
|
|
2263
|
-
unsubscribe:
|
|
2273
|
+
unsubscribe: y
|
|
2264
2274
|
};
|
|
2265
2275
|
}
|
|
2266
|
-
function
|
|
2267
|
-
e.apiClient &&
|
|
2276
|
+
function rc(e) {
|
|
2277
|
+
e.apiClient && ji(e.apiClient), e.mainApiClient && xo(e.mainApiClient), e.authStore && Hi(e.authStore), e.mediaApi && Xi(e.mediaApi), e.createLogger && Ao(e.createLogger), e.playMessageNotification && No(e.playMessageNotification), e.echo && Ii(e.echo), e.mainEcho && wo(e.mainEcho), e.presence && Bo(e.presence);
|
|
2268
2278
|
}
|
|
2269
|
-
function
|
|
2270
|
-
|
|
2279
|
+
function ic() {
|
|
2280
|
+
$i(), ko(), Bi(), Wi(), Ro(), Do(), Ui(), To(), Vo();
|
|
2271
2281
|
}
|
|
2272
|
-
class
|
|
2282
|
+
class Zt {
|
|
2273
2283
|
constructor() {
|
|
2274
2284
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2275
2285
|
}
|
|
@@ -2298,7 +2308,7 @@ class Yt {
|
|
|
2298
2308
|
return this.stopListening(".client-" + n, i);
|
|
2299
2309
|
}
|
|
2300
2310
|
}
|
|
2301
|
-
class
|
|
2311
|
+
class Ss {
|
|
2302
2312
|
/**
|
|
2303
2313
|
* Create a new class instance.
|
|
2304
2314
|
*/
|
|
@@ -2318,7 +2328,7 @@ class _s {
|
|
|
2318
2328
|
this.namespace = n;
|
|
2319
2329
|
}
|
|
2320
2330
|
}
|
|
2321
|
-
function
|
|
2331
|
+
function ca(e) {
|
|
2322
2332
|
try {
|
|
2323
2333
|
new e();
|
|
2324
2334
|
} catch (n) {
|
|
@@ -2327,12 +2337,12 @@ function oa(e) {
|
|
|
2327
2337
|
}
|
|
2328
2338
|
return !0;
|
|
2329
2339
|
}
|
|
2330
|
-
class
|
|
2340
|
+
class en extends Zt {
|
|
2331
2341
|
/**
|
|
2332
2342
|
* Create a new class instance.
|
|
2333
2343
|
*/
|
|
2334
2344
|
constructor(n, i, o) {
|
|
2335
|
-
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2345
|
+
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new Ss(this.options.namespace), this.subscribe();
|
|
2336
2346
|
}
|
|
2337
2347
|
/**
|
|
2338
2348
|
* Subscribe to a Pusher channel.
|
|
@@ -2404,7 +2414,7 @@ class Zt extends Yt {
|
|
|
2404
2414
|
return this.subscription.bind(n, i), this;
|
|
2405
2415
|
}
|
|
2406
2416
|
}
|
|
2407
|
-
class
|
|
2417
|
+
class Cs extends en {
|
|
2408
2418
|
/**
|
|
2409
2419
|
* Send a whisper event to other clients in the channel.
|
|
2410
2420
|
*/
|
|
@@ -2415,7 +2425,7 @@ class Ss extends Zt {
|
|
|
2415
2425
|
), this;
|
|
2416
2426
|
}
|
|
2417
2427
|
}
|
|
2418
|
-
class
|
|
2428
|
+
class ua extends en {
|
|
2419
2429
|
/**
|
|
2420
2430
|
* Send a whisper event to other clients in the channel.
|
|
2421
2431
|
*/
|
|
@@ -2426,7 +2436,7 @@ class aa extends Zt {
|
|
|
2426
2436
|
), this;
|
|
2427
2437
|
}
|
|
2428
2438
|
}
|
|
2429
|
-
class
|
|
2439
|
+
class la extends Cs {
|
|
2430
2440
|
/**
|
|
2431
2441
|
* Register a callback to be called anytime the member list changes.
|
|
2432
2442
|
*/
|
|
@@ -2461,12 +2471,12 @@ class ca extends Ss {
|
|
|
2461
2471
|
}), this;
|
|
2462
2472
|
}
|
|
2463
2473
|
}
|
|
2464
|
-
class
|
|
2474
|
+
class ws extends Zt {
|
|
2465
2475
|
/**
|
|
2466
2476
|
* Create a new class instance.
|
|
2467
2477
|
*/
|
|
2468
2478
|
constructor(n, i, o) {
|
|
2469
|
-
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2479
|
+
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new Ss(this.options.namespace), this.subscribe();
|
|
2470
2480
|
}
|
|
2471
2481
|
/**
|
|
2472
2482
|
* Subscribe to a Socket.io channel.
|
|
@@ -2537,7 +2547,7 @@ class Cs extends Yt {
|
|
|
2537
2547
|
)), (!i || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2538
2548
|
}
|
|
2539
2549
|
}
|
|
2540
|
-
class
|
|
2550
|
+
class Ts extends ws {
|
|
2541
2551
|
/**
|
|
2542
2552
|
* Send a whisper event to other clients in the channel.
|
|
2543
2553
|
*/
|
|
@@ -2549,7 +2559,7 @@ class ws extends Cs {
|
|
|
2549
2559
|
}), this;
|
|
2550
2560
|
}
|
|
2551
2561
|
}
|
|
2552
|
-
class
|
|
2562
|
+
class da extends Ts {
|
|
2553
2563
|
/**
|
|
2554
2564
|
* Register a callback to be called anytime the member list changes.
|
|
2555
2565
|
*/
|
|
@@ -2587,7 +2597,7 @@ class ua extends ws {
|
|
|
2587
2597
|
), this;
|
|
2588
2598
|
}
|
|
2589
2599
|
}
|
|
2590
|
-
class dt extends
|
|
2600
|
+
class dt extends Zt {
|
|
2591
2601
|
/**
|
|
2592
2602
|
* Subscribe to a channel.
|
|
2593
2603
|
*/
|
|
@@ -2635,7 +2645,7 @@ class dt extends Yt {
|
|
|
2635
2645
|
return this;
|
|
2636
2646
|
}
|
|
2637
2647
|
}
|
|
2638
|
-
class
|
|
2648
|
+
class Es extends dt {
|
|
2639
2649
|
/**
|
|
2640
2650
|
* Send a whisper event to other clients in the channel.
|
|
2641
2651
|
*/
|
|
@@ -2643,7 +2653,7 @@ class Ts extends dt {
|
|
|
2643
2653
|
return this;
|
|
2644
2654
|
}
|
|
2645
2655
|
}
|
|
2646
|
-
class
|
|
2656
|
+
class ha extends dt {
|
|
2647
2657
|
/**
|
|
2648
2658
|
* Send a whisper event to other clients in the channel.
|
|
2649
2659
|
*/
|
|
@@ -2651,7 +2661,7 @@ class la extends dt {
|
|
|
2651
2661
|
return this;
|
|
2652
2662
|
}
|
|
2653
2663
|
}
|
|
2654
|
-
class
|
|
2664
|
+
class fa extends Es {
|
|
2655
2665
|
/**
|
|
2656
2666
|
* Register a callback to be called anytime the member list changes.
|
|
2657
2667
|
*/
|
|
@@ -2677,7 +2687,7 @@ class da extends Ts {
|
|
|
2677
2687
|
return this;
|
|
2678
2688
|
}
|
|
2679
2689
|
}
|
|
2680
|
-
const
|
|
2690
|
+
const As = class Rs {
|
|
2681
2691
|
/**
|
|
2682
2692
|
* Create a new class instance.
|
|
2683
2693
|
*/
|
|
@@ -2689,7 +2699,7 @@ const Es = class As {
|
|
|
2689
2699
|
*/
|
|
2690
2700
|
setOptions(n) {
|
|
2691
2701
|
this.options = {
|
|
2692
|
-
...
|
|
2702
|
+
...Rs._defaultOptions,
|
|
2693
2703
|
...n,
|
|
2694
2704
|
broadcaster: n.broadcaster
|
|
2695
2705
|
};
|
|
@@ -2704,7 +2714,7 @@ const Es = class As {
|
|
|
2704
2714
|
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" ? ((i = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : i.getAttribute("content")) ?? null : null;
|
|
2705
2715
|
}
|
|
2706
2716
|
};
|
|
2707
|
-
|
|
2717
|
+
As._defaultOptions = {
|
|
2708
2718
|
auth: {
|
|
2709
2719
|
headers: {}
|
|
2710
2720
|
},
|
|
@@ -2719,8 +2729,8 @@ Es._defaultOptions = {
|
|
|
2719
2729
|
key: null,
|
|
2720
2730
|
namespace: "App.Events"
|
|
2721
2731
|
};
|
|
2722
|
-
let
|
|
2723
|
-
class ot extends
|
|
2732
|
+
let tn = As;
|
|
2733
|
+
class ot extends tn {
|
|
2724
2734
|
constructor() {
|
|
2725
2735
|
super(...arguments), this.channels = {};
|
|
2726
2736
|
}
|
|
@@ -2758,7 +2768,7 @@ class ot extends en {
|
|
|
2758
2768
|
* Get a channel instance by name.
|
|
2759
2769
|
*/
|
|
2760
2770
|
channel(n) {
|
|
2761
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2771
|
+
return this.channels[n] || (this.channels[n] = new en(
|
|
2762
2772
|
this.pusher,
|
|
2763
2773
|
n,
|
|
2764
2774
|
this.options
|
|
@@ -2768,7 +2778,7 @@ class ot extends en {
|
|
|
2768
2778
|
* Get a private channel instance by name.
|
|
2769
2779
|
*/
|
|
2770
2780
|
privateChannel(n) {
|
|
2771
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2781
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Cs(
|
|
2772
2782
|
this.pusher,
|
|
2773
2783
|
"private-" + n,
|
|
2774
2784
|
this.options
|
|
@@ -2778,7 +2788,7 @@ class ot extends en {
|
|
|
2778
2788
|
* Get a private encrypted channel instance by name.
|
|
2779
2789
|
*/
|
|
2780
2790
|
encryptedPrivateChannel(n) {
|
|
2781
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
2791
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new ua(
|
|
2782
2792
|
this.pusher,
|
|
2783
2793
|
"private-encrypted-" + n,
|
|
2784
2794
|
this.options
|
|
@@ -2788,7 +2798,7 @@ class ot extends en {
|
|
|
2788
2798
|
* Get a presence channel instance by name.
|
|
2789
2799
|
*/
|
|
2790
2800
|
presenceChannel(n) {
|
|
2791
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2801
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new la(
|
|
2792
2802
|
this.pusher,
|
|
2793
2803
|
"presence-" + n,
|
|
2794
2804
|
this.options
|
|
@@ -2857,7 +2867,7 @@ class ot extends en {
|
|
|
2857
2867
|
this.pusher.disconnect();
|
|
2858
2868
|
}
|
|
2859
2869
|
}
|
|
2860
|
-
class
|
|
2870
|
+
class pa extends tn {
|
|
2861
2871
|
constructor() {
|
|
2862
2872
|
super(...arguments), this.channels = {};
|
|
2863
2873
|
}
|
|
@@ -2897,7 +2907,7 @@ class ha extends en {
|
|
|
2897
2907
|
* Get a channel instance by name.
|
|
2898
2908
|
*/
|
|
2899
2909
|
channel(n) {
|
|
2900
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2910
|
+
return this.channels[n] || (this.channels[n] = new ws(
|
|
2901
2911
|
this.socket,
|
|
2902
2912
|
n,
|
|
2903
2913
|
this.options
|
|
@@ -2907,7 +2917,7 @@ class ha extends en {
|
|
|
2907
2917
|
* Get a private channel instance by name.
|
|
2908
2918
|
*/
|
|
2909
2919
|
privateChannel(n) {
|
|
2910
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2920
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Ts(
|
|
2911
2921
|
this.socket,
|
|
2912
2922
|
"private-" + n,
|
|
2913
2923
|
this.options
|
|
@@ -2917,7 +2927,7 @@ class ha extends en {
|
|
|
2917
2927
|
* Get a presence channel instance by name.
|
|
2918
2928
|
*/
|
|
2919
2929
|
presenceChannel(n) {
|
|
2920
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2930
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new da(
|
|
2921
2931
|
this.socket,
|
|
2922
2932
|
"presence-" + n,
|
|
2923
2933
|
this.options
|
|
@@ -2979,7 +2989,7 @@ class ha extends en {
|
|
|
2979
2989
|
this.socket.disconnect();
|
|
2980
2990
|
}
|
|
2981
2991
|
}
|
|
2982
|
-
class
|
|
2992
|
+
class Hn extends tn {
|
|
2983
2993
|
constructor() {
|
|
2984
2994
|
super(...arguments), this.channels = {};
|
|
2985
2995
|
}
|
|
@@ -3004,19 +3014,19 @@ class $n extends en {
|
|
|
3004
3014
|
* Get a private channel instance by name.
|
|
3005
3015
|
*/
|
|
3006
3016
|
privateChannel(n) {
|
|
3007
|
-
return new
|
|
3017
|
+
return new Es();
|
|
3008
3018
|
}
|
|
3009
3019
|
/**
|
|
3010
3020
|
* Get a private encrypted channel instance by name.
|
|
3011
3021
|
*/
|
|
3012
3022
|
encryptedPrivateChannel(n) {
|
|
3013
|
-
return new
|
|
3023
|
+
return new ha();
|
|
3014
3024
|
}
|
|
3015
3025
|
/**
|
|
3016
3026
|
* Get a presence channel instance by name.
|
|
3017
3027
|
*/
|
|
3018
3028
|
presenceChannel(n) {
|
|
3019
|
-
return new
|
|
3029
|
+
return new fa();
|
|
3020
3030
|
}
|
|
3021
3031
|
/**
|
|
3022
3032
|
* Leave the given channel, as well as its private and presence variants.
|
|
@@ -3053,7 +3063,7 @@ class $n extends en {
|
|
|
3053
3063
|
disconnect() {
|
|
3054
3064
|
}
|
|
3055
3065
|
}
|
|
3056
|
-
class
|
|
3066
|
+
class ga {
|
|
3057
3067
|
/**
|
|
3058
3068
|
* Create a new class instance.
|
|
3059
3069
|
*/
|
|
@@ -3084,10 +3094,10 @@ class fa {
|
|
|
3084
3094
|
broadcaster: "pusher"
|
|
3085
3095
|
});
|
|
3086
3096
|
else if (this.options.broadcaster === "socket.io")
|
|
3087
|
-
this.connector = new
|
|
3097
|
+
this.connector = new pa(this.options);
|
|
3088
3098
|
else if (this.options.broadcaster === "null")
|
|
3089
|
-
this.connector = new
|
|
3090
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
3099
|
+
this.connector = new Hn(this.options);
|
|
3100
|
+
else if (typeof this.options.broadcaster == "function" && ca(this.options.broadcaster))
|
|
3091
3101
|
this.connector = new this.options.broadcaster(this.options);
|
|
3092
3102
|
else
|
|
3093
3103
|
throw new Error(
|
|
@@ -3150,7 +3160,7 @@ class fa {
|
|
|
3150
3160
|
);
|
|
3151
3161
|
}
|
|
3152
3162
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3153
|
-
return n instanceof ot || n instanceof
|
|
3163
|
+
return n instanceof ot || n instanceof Hn;
|
|
3154
3164
|
}
|
|
3155
3165
|
/**
|
|
3156
3166
|
* Get the Socket ID for the connection.
|
|
@@ -3211,13 +3221,13 @@ class fa {
|
|
|
3211
3221
|
);
|
|
3212
3222
|
}
|
|
3213
3223
|
}
|
|
3214
|
-
function
|
|
3224
|
+
function ma(e) {
|
|
3215
3225
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3216
3226
|
}
|
|
3217
|
-
var
|
|
3218
|
-
var
|
|
3219
|
-
function
|
|
3220
|
-
return
|
|
3227
|
+
var Ut = { exports: {} };
|
|
3228
|
+
var Bn;
|
|
3229
|
+
function va() {
|
|
3230
|
+
return Bn || (Bn = 1, (function(e, n) {
|
|
3221
3231
|
(function(o, c) {
|
|
3222
3232
|
e.exports = c();
|
|
3223
3233
|
})(window, function() {
|
|
@@ -3271,15 +3281,15 @@ function ga() {
|
|
|
3271
3281
|
/***/
|
|
3272
3282
|
(function(i, o, c) {
|
|
3273
3283
|
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3274
|
-
var
|
|
3275
|
-
return
|
|
3284
|
+
var w = function(f, m) {
|
|
3285
|
+
return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(v, N) {
|
|
3276
3286
|
v.__proto__ = N;
|
|
3277
3287
|
} || function(v, N) {
|
|
3278
3288
|
for (var q in N) N.hasOwnProperty(q) && (v[q] = N[q]);
|
|
3279
|
-
},
|
|
3289
|
+
}, w(f, m);
|
|
3280
3290
|
};
|
|
3281
3291
|
return function(f, m) {
|
|
3282
|
-
|
|
3292
|
+
w(f, m);
|
|
3283
3293
|
function v() {
|
|
3284
3294
|
this.constructor = f;
|
|
3285
3295
|
}
|
|
@@ -3290,12 +3300,12 @@ function ga() {
|
|
|
3290
3300
|
var d = 256, g = (
|
|
3291
3301
|
/** @class */
|
|
3292
3302
|
(function() {
|
|
3293
|
-
function
|
|
3303
|
+
function w(f) {
|
|
3294
3304
|
f === void 0 && (f = "="), this._paddingCharacter = f;
|
|
3295
3305
|
}
|
|
3296
|
-
return
|
|
3306
|
+
return w.prototype.encodedLength = function(f) {
|
|
3297
3307
|
return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
|
|
3298
|
-
},
|
|
3308
|
+
}, w.prototype.encode = function(f) {
|
|
3299
3309
|
for (var m = "", v = 0; v < f.length - 2; v += 3) {
|
|
3300
3310
|
var N = f[v] << 16 | f[v + 1] << 8 | f[v + 2];
|
|
3301
3311
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), m += this._encodeByte(N >>> 6 & 63), m += this._encodeByte(N >>> 0 & 63);
|
|
@@ -3306,11 +3316,11 @@ function ga() {
|
|
|
3306
3316
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), q === 2 ? m += this._encodeByte(N >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
|
|
3307
3317
|
}
|
|
3308
3318
|
return m;
|
|
3309
|
-
},
|
|
3319
|
+
}, w.prototype.maxDecodedLength = function(f) {
|
|
3310
3320
|
return this._paddingCharacter ? f / 4 * 3 | 0 : (f * 6 + 7) / 8 | 0;
|
|
3311
|
-
},
|
|
3321
|
+
}, w.prototype.decodedLength = function(f) {
|
|
3312
3322
|
return this.maxDecodedLength(f.length - this._getPaddingLength(f));
|
|
3313
|
-
},
|
|
3323
|
+
}, w.prototype.decode = function(f) {
|
|
3314
3324
|
if (f.length === 0)
|
|
3315
3325
|
return new Uint8Array(0);
|
|
3316
3326
|
for (var m = this._getPaddingLength(f), v = f.length - m, N = new Uint8Array(this.maxDecodedLength(v)), q = 0, G = 0, k = 0, O = 0, H = 0, F = 0, J = 0; G < v - 4; G += 4)
|
|
@@ -3318,13 +3328,13 @@ function ga() {
|
|
|
3318
3328
|
if (G < v - 1 && (O = this._decodeChar(f.charCodeAt(G)), H = this._decodeChar(f.charCodeAt(G + 1)), N[q++] = O << 2 | H >>> 4, k |= O & d, k |= H & d), G < v - 2 && (F = this._decodeChar(f.charCodeAt(G + 2)), N[q++] = H << 4 | F >>> 2, k |= F & d), G < v - 3 && (J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = F << 6 | J, k |= J & d), k !== 0)
|
|
3319
3329
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3320
3330
|
return N;
|
|
3321
|
-
},
|
|
3331
|
+
}, w.prototype._encodeByte = function(f) {
|
|
3322
3332
|
var m = f;
|
|
3323
3333
|
return m += 65, m += 25 - f >>> 8 & 6, m += 51 - f >>> 8 & -75, m += 61 - f >>> 8 & -15, m += 62 - f >>> 8 & 3, String.fromCharCode(m);
|
|
3324
|
-
},
|
|
3334
|
+
}, w.prototype._decodeChar = function(f) {
|
|
3325
3335
|
var m = d;
|
|
3326
3336
|
return m += (42 - f & f - 44) >>> 8 & -d + f - 43 + 62, m += (46 - f & f - 48) >>> 8 & -d + f - 47 + 63, m += (47 - f & f - 58) >>> 8 & -d + f - 48 + 52, m += (64 - f & f - 91) >>> 8 & -d + f - 65 + 0, m += (96 - f & f - 123) >>> 8 & -d + f - 97 + 26, m;
|
|
3327
|
-
},
|
|
3337
|
+
}, w.prototype._getPaddingLength = function(f) {
|
|
3328
3338
|
var m = 0;
|
|
3329
3339
|
if (this._paddingCharacter) {
|
|
3330
3340
|
for (var v = f.length - 1; v >= 0 && f[v] === this._paddingCharacter; v--)
|
|
@@ -3333,25 +3343,25 @@ function ga() {
|
|
|
3333
3343
|
throw new Error("Base64Coder: incorrect padding");
|
|
3334
3344
|
}
|
|
3335
3345
|
return m;
|
|
3336
|
-
},
|
|
3346
|
+
}, w;
|
|
3337
3347
|
})()
|
|
3338
3348
|
);
|
|
3339
3349
|
o.Coder = g;
|
|
3340
3350
|
var h = new g();
|
|
3341
|
-
function x(
|
|
3342
|
-
return h.encode(
|
|
3351
|
+
function x(w) {
|
|
3352
|
+
return h.encode(w);
|
|
3343
3353
|
}
|
|
3344
3354
|
o.encode = x;
|
|
3345
|
-
function M(
|
|
3346
|
-
return h.decode(
|
|
3355
|
+
function M(w) {
|
|
3356
|
+
return h.decode(w);
|
|
3347
3357
|
}
|
|
3348
3358
|
o.decode = M;
|
|
3349
3359
|
var _ = (
|
|
3350
3360
|
/** @class */
|
|
3351
|
-
(function(
|
|
3352
|
-
l(f,
|
|
3361
|
+
(function(w) {
|
|
3362
|
+
l(f, w);
|
|
3353
3363
|
function f() {
|
|
3354
|
-
return
|
|
3364
|
+
return w !== null && w.apply(this, arguments) || this;
|
|
3355
3365
|
}
|
|
3356
3366
|
return f.prototype._encodeByte = function(m) {
|
|
3357
3367
|
var v = m;
|
|
@@ -3363,20 +3373,20 @@ function ga() {
|
|
|
3363
3373
|
})(g)
|
|
3364
3374
|
);
|
|
3365
3375
|
o.URLSafeCoder = _;
|
|
3366
|
-
var
|
|
3367
|
-
function
|
|
3368
|
-
return
|
|
3376
|
+
var C = new _();
|
|
3377
|
+
function b(w) {
|
|
3378
|
+
return C.encode(w);
|
|
3369
3379
|
}
|
|
3370
|
-
o.encodeURLSafe =
|
|
3371
|
-
function w
|
|
3372
|
-
return
|
|
3380
|
+
o.encodeURLSafe = b;
|
|
3381
|
+
function T(w) {
|
|
3382
|
+
return C.decode(w);
|
|
3373
3383
|
}
|
|
3374
|
-
o.decodeURLSafe =
|
|
3375
|
-
return h.encodedLength(
|
|
3376
|
-
}, o.maxDecodedLength = function(
|
|
3377
|
-
return h.maxDecodedLength(
|
|
3378
|
-
}, o.decodedLength = function(
|
|
3379
|
-
return h.decodedLength(
|
|
3384
|
+
o.decodeURLSafe = T, o.encodedLength = function(w) {
|
|
3385
|
+
return h.encodedLength(w);
|
|
3386
|
+
}, o.maxDecodedLength = function(w) {
|
|
3387
|
+
return h.maxDecodedLength(w);
|
|
3388
|
+
}, o.decodedLength = function(w) {
|
|
3389
|
+
return h.decodedLength(w);
|
|
3380
3390
|
};
|
|
3381
3391
|
}),
|
|
3382
3392
|
/* 1 */
|
|
@@ -3385,26 +3395,26 @@ function ga() {
|
|
|
3385
3395
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3386
3396
|
var l = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3387
3397
|
function g(M) {
|
|
3388
|
-
for (var _ = new Uint8Array(h(M)),
|
|
3389
|
-
var
|
|
3390
|
-
|
|
3398
|
+
for (var _ = new Uint8Array(h(M)), C = 0, b = 0; b < M.length; b++) {
|
|
3399
|
+
var T = M.charCodeAt(b);
|
|
3400
|
+
T < 128 ? _[C++] = T : T < 2048 ? (_[C++] = 192 | T >> 6, _[C++] = 128 | T & 63) : T < 55296 ? (_[C++] = 224 | T >> 12, _[C++] = 128 | T >> 6 & 63, _[C++] = 128 | T & 63) : (b++, T = (T & 1023) << 10, T |= M.charCodeAt(b) & 1023, T += 65536, _[C++] = 240 | T >> 18, _[C++] = 128 | T >> 12 & 63, _[C++] = 128 | T >> 6 & 63, _[C++] = 128 | T & 63);
|
|
3391
3401
|
}
|
|
3392
3402
|
return _;
|
|
3393
3403
|
}
|
|
3394
3404
|
o.encode = g;
|
|
3395
3405
|
function h(M) {
|
|
3396
|
-
for (var _ = 0,
|
|
3397
|
-
var
|
|
3398
|
-
if (
|
|
3406
|
+
for (var _ = 0, C = 0; C < M.length; C++) {
|
|
3407
|
+
var b = M.charCodeAt(C);
|
|
3408
|
+
if (b < 128)
|
|
3399
3409
|
_ += 1;
|
|
3400
|
-
else if (
|
|
3410
|
+
else if (b < 2048)
|
|
3401
3411
|
_ += 2;
|
|
3402
|
-
else if (
|
|
3412
|
+
else if (b < 55296)
|
|
3403
3413
|
_ += 3;
|
|
3404
|
-
else if (
|
|
3405
|
-
if (
|
|
3414
|
+
else if (b <= 57343) {
|
|
3415
|
+
if (C >= M.length - 1)
|
|
3406
3416
|
throw new Error(l);
|
|
3407
|
-
|
|
3417
|
+
C++, _ += 4;
|
|
3408
3418
|
} else
|
|
3409
3419
|
throw new Error(l);
|
|
3410
3420
|
}
|
|
@@ -3412,42 +3422,42 @@ function ga() {
|
|
|
3412
3422
|
}
|
|
3413
3423
|
o.encodedLength = h;
|
|
3414
3424
|
function x(M) {
|
|
3415
|
-
for (var _ = [],
|
|
3416
|
-
var
|
|
3417
|
-
if (
|
|
3418
|
-
var
|
|
3419
|
-
if (
|
|
3420
|
-
if (
|
|
3425
|
+
for (var _ = [], C = 0; C < M.length; C++) {
|
|
3426
|
+
var b = M[C];
|
|
3427
|
+
if (b & 128) {
|
|
3428
|
+
var T = void 0;
|
|
3429
|
+
if (b < 224) {
|
|
3430
|
+
if (C >= M.length)
|
|
3421
3431
|
throw new Error(d);
|
|
3422
|
-
var
|
|
3423
|
-
if ((
|
|
3432
|
+
var w = M[++C];
|
|
3433
|
+
if ((w & 192) !== 128)
|
|
3424
3434
|
throw new Error(d);
|
|
3425
|
-
|
|
3426
|
-
} else if (
|
|
3427
|
-
if (
|
|
3435
|
+
b = (b & 31) << 6 | w & 63, T = 128;
|
|
3436
|
+
} else if (b < 240) {
|
|
3437
|
+
if (C >= M.length - 1)
|
|
3428
3438
|
throw new Error(d);
|
|
3429
|
-
var
|
|
3430
|
-
if ((
|
|
3439
|
+
var w = M[++C], f = M[++C];
|
|
3440
|
+
if ((w & 192) !== 128 || (f & 192) !== 128)
|
|
3431
3441
|
throw new Error(d);
|
|
3432
|
-
|
|
3433
|
-
} else if (
|
|
3434
|
-
if (
|
|
3442
|
+
b = (b & 15) << 12 | (w & 63) << 6 | f & 63, T = 2048;
|
|
3443
|
+
} else if (b < 248) {
|
|
3444
|
+
if (C >= M.length - 2)
|
|
3435
3445
|
throw new Error(d);
|
|
3436
|
-
var
|
|
3437
|
-
if ((
|
|
3446
|
+
var w = M[++C], f = M[++C], m = M[++C];
|
|
3447
|
+
if ((w & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
|
|
3438
3448
|
throw new Error(d);
|
|
3439
|
-
|
|
3449
|
+
b = (b & 15) << 18 | (w & 63) << 12 | (f & 63) << 6 | m & 63, T = 65536;
|
|
3440
3450
|
} else
|
|
3441
3451
|
throw new Error(d);
|
|
3442
|
-
if (
|
|
3452
|
+
if (b < T || b >= 55296 && b <= 57343)
|
|
3443
3453
|
throw new Error(d);
|
|
3444
|
-
if (
|
|
3445
|
-
if (
|
|
3454
|
+
if (b >= 65536) {
|
|
3455
|
+
if (b > 1114111)
|
|
3446
3456
|
throw new Error(d);
|
|
3447
|
-
|
|
3457
|
+
b -= 65536, _.push(String.fromCharCode(55296 | b >> 10)), b = 56320 | b & 1023;
|
|
3448
3458
|
}
|
|
3449
3459
|
}
|
|
3450
|
-
_.push(String.fromCharCode(
|
|
3460
|
+
_.push(String.fromCharCode(b));
|
|
3451
3461
|
}
|
|
3452
3462
|
return _.join("");
|
|
3453
3463
|
}
|
|
@@ -3543,7 +3553,7 @@ function ga() {
|
|
|
3543
3553
|
suffix: h.dependency_suffix,
|
|
3544
3554
|
receivers: M
|
|
3545
3555
|
});
|
|
3546
|
-
const
|
|
3556
|
+
const C = {
|
|
3547
3557
|
baseUrl: "https://pusher.com",
|
|
3548
3558
|
urls: {
|
|
3549
3559
|
authenticationEndpoint: {
|
|
@@ -3563,16 +3573,16 @@ function ga() {
|
|
|
3563
3573
|
}
|
|
3564
3574
|
}
|
|
3565
3575
|
};
|
|
3566
|
-
var
|
|
3567
|
-
const t = "See:", s =
|
|
3576
|
+
var T = { buildLogSuffix: function(r) {
|
|
3577
|
+
const t = "See:", s = C.urls[r];
|
|
3568
3578
|
if (!s)
|
|
3569
3579
|
return "";
|
|
3570
3580
|
let a;
|
|
3571
|
-
return s.fullUrl ? a = s.fullUrl : s.path && (a =
|
|
3572
|
-
} },
|
|
3581
|
+
return s.fullUrl ? a = s.fullUrl : s.path && (a = C.baseUrl + s.path), a ? `${t} ${a}` : "";
|
|
3582
|
+
} }, w;
|
|
3573
3583
|
(function(r) {
|
|
3574
3584
|
r.UserAuthentication = "user-authentication", r.ChannelAuthorization = "channel-authorization";
|
|
3575
|
-
})(
|
|
3585
|
+
})(w || (w = {}));
|
|
3576
3586
|
class f extends Error {
|
|
3577
3587
|
constructor(t) {
|
|
3578
3588
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
@@ -3641,11 +3651,11 @@ function ga() {
|
|
|
3641
3651
|
} else {
|
|
3642
3652
|
let L = "";
|
|
3643
3653
|
switch (a) {
|
|
3644
|
-
case
|
|
3645
|
-
L =
|
|
3654
|
+
case w.UserAuthentication:
|
|
3655
|
+
L = T.buildLogSuffix("authenticationEndpoint");
|
|
3646
3656
|
break;
|
|
3647
|
-
case
|
|
3648
|
-
L = `Clients must be authorized to join private or presence channels. ${
|
|
3657
|
+
case w.ChannelAuthorization:
|
|
3658
|
+
L = `Clients must be authorized to join private or presence channels. ${T.buildLogSuffix("authorizationEndpoint")}`;
|
|
3649
3659
|
break;
|
|
3650
3660
|
}
|
|
3651
3661
|
u(new H(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${L}`), null);
|
|
@@ -3655,17 +3665,17 @@ function ga() {
|
|
|
3655
3665
|
function me(r) {
|
|
3656
3666
|
return A(ae(r));
|
|
3657
3667
|
}
|
|
3658
|
-
var ee = String.fromCharCode,
|
|
3668
|
+
var ee = String.fromCharCode, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(r) {
|
|
3659
3669
|
var t = r.charCodeAt(0);
|
|
3660
3670
|
return t < 128 ? r : t < 2048 ? ee(192 | t >>> 6) + ee(128 | t & 63) : ee(224 | t >>> 12 & 15) + ee(128 | t >>> 6 & 63) + ee(128 | t & 63);
|
|
3661
3671
|
}, ae = function(r) {
|
|
3662
3672
|
return r.replace(/[^\x00-\x7F]/g, I);
|
|
3663
3673
|
}, B = function(r) {
|
|
3664
3674
|
var t = [0, 2, 1][r.length % 3], s = r.charCodeAt(0) << 16 | (r.length > 1 ? r.charCodeAt(1) : 0) << 8 | (r.length > 2 ? r.charCodeAt(2) : 0), a = [
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
t >= 2 ? "=" :
|
|
3668
|
-
t >= 1 ? "=" :
|
|
3675
|
+
y.charAt(s >>> 18),
|
|
3676
|
+
y.charAt(s >>> 12 & 63),
|
|
3677
|
+
t >= 2 ? "=" : y.charAt(s >>> 6 & 63),
|
|
3678
|
+
t >= 1 ? "=" : y.charAt(s & 63)
|
|
3669
3679
|
];
|
|
3670
3680
|
return a.join("");
|
|
3671
3681
|
}, A = window.btoa || function(r) {
|
|
@@ -3851,7 +3861,7 @@ function ga() {
|
|
|
3851
3861
|
return JSON.stringify(qe(r));
|
|
3852
3862
|
}
|
|
3853
3863
|
}
|
|
3854
|
-
class
|
|
3864
|
+
class Ps {
|
|
3855
3865
|
constructor() {
|
|
3856
3866
|
this.globalLog = (t) => {
|
|
3857
3867
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -3877,7 +3887,7 @@ function ga() {
|
|
|
3877
3887
|
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
3878
3888
|
}
|
|
3879
3889
|
}
|
|
3880
|
-
var oe = new
|
|
3890
|
+
var oe = new Ps(), Ms = function(r, t, s, a, u) {
|
|
3881
3891
|
(s.headers !== void 0 || s.headersProvider != null) && oe.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
3882
3892
|
var p = r.nextAuthCallbackID.toString();
|
|
3883
3893
|
r.nextAuthCallbackID++;
|
|
@@ -3889,8 +3899,8 @@ function ga() {
|
|
|
3889
3899
|
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
3890
3900
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3891
3901
|
Q.insertBefore(L, Q.firstChild);
|
|
3892
|
-
},
|
|
3893
|
-
class
|
|
3902
|
+
}, xs = Ms;
|
|
3903
|
+
class ks {
|
|
3894
3904
|
constructor(t) {
|
|
3895
3905
|
this.src = t;
|
|
3896
3906
|
}
|
|
@@ -3910,7 +3920,7 @@ function ga() {
|
|
|
3910
3920
|
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;
|
|
3911
3921
|
}
|
|
3912
3922
|
}
|
|
3913
|
-
class
|
|
3923
|
+
class Ls {
|
|
3914
3924
|
constructor(t, s) {
|
|
3915
3925
|
this.url = t, this.data = s;
|
|
3916
3926
|
}
|
|
@@ -3924,17 +3934,17 @@ function ga() {
|
|
|
3924
3934
|
this.request && this.request.cleanup();
|
|
3925
3935
|
}
|
|
3926
3936
|
}
|
|
3927
|
-
var
|
|
3937
|
+
var Is = function(r, t) {
|
|
3928
3938
|
return function(s, a) {
|
|
3929
3939
|
var u = "http" + (t ? "s" : "") + "://", p = u + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
3930
3940
|
d.remove(L), S.cleanup(), Q && Q.host && (r.host = Q.host), a && a(z, Q);
|
|
3931
3941
|
});
|
|
3932
3942
|
S.send(L);
|
|
3933
3943
|
};
|
|
3934
|
-
},
|
|
3944
|
+
}, Us = {
|
|
3935
3945
|
name: "jsonp",
|
|
3936
|
-
getAgent:
|
|
3937
|
-
},
|
|
3946
|
+
getAgent: Is
|
|
3947
|
+
}, Os = Us;
|
|
3938
3948
|
function pt(r, t, s) {
|
|
3939
3949
|
var a = r + (t.useTLS ? "s" : ""), u = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
3940
3950
|
return a + "://" + u + s;
|
|
@@ -3943,17 +3953,17 @@ function ga() {
|
|
|
3943
3953
|
var s = "/app/" + r, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
3944
3954
|
return s + a;
|
|
3945
3955
|
}
|
|
3946
|
-
var
|
|
3956
|
+
var Fs = {
|
|
3947
3957
|
getInitial: function(r, t) {
|
|
3948
3958
|
var s = (t.httpPath || "") + gt(r, "flash=false");
|
|
3949
3959
|
return pt("ws", t, s);
|
|
3950
3960
|
}
|
|
3951
|
-
},
|
|
3961
|
+
}, Ns = {
|
|
3952
3962
|
getInitial: function(r, t) {
|
|
3953
3963
|
var s = (t.httpPath || "/pusher") + gt(r);
|
|
3954
3964
|
return pt("http", t, s);
|
|
3955
3965
|
}
|
|
3956
|
-
},
|
|
3966
|
+
}, Ds = {
|
|
3957
3967
|
getInitial: function(r, t) {
|
|
3958
3968
|
return pt("http", t, t.httpPath || "/pusher");
|
|
3959
3969
|
},
|
|
@@ -3961,7 +3971,7 @@ function ga() {
|
|
|
3961
3971
|
return gt(r);
|
|
3962
3972
|
}
|
|
3963
3973
|
};
|
|
3964
|
-
class
|
|
3974
|
+
class qs {
|
|
3965
3975
|
constructor() {
|
|
3966
3976
|
this._callbacks = {};
|
|
3967
3977
|
}
|
|
@@ -4001,7 +4011,7 @@ function ga() {
|
|
|
4001
4011
|
}
|
|
4002
4012
|
class Te {
|
|
4003
4013
|
constructor(t) {
|
|
4004
|
-
this.callbacks = new
|
|
4014
|
+
this.callbacks = new qs(), this.global_callbacks = [], this.failThrough = t;
|
|
4005
4015
|
}
|
|
4006
4016
|
bind(t, s, a) {
|
|
4007
4017
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4029,7 +4039,7 @@ function ga() {
|
|
|
4029
4039
|
return this;
|
|
4030
4040
|
}
|
|
4031
4041
|
}
|
|
4032
|
-
class
|
|
4042
|
+
class zs extends Te {
|
|
4033
4043
|
constructor(t, s, a, u, p) {
|
|
4034
4044
|
super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = u, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4035
4045
|
}
|
|
@@ -4116,11 +4126,11 @@ function ga() {
|
|
|
4116
4126
|
return this.hooks.isSupported(t);
|
|
4117
4127
|
}
|
|
4118
4128
|
createConnection(t, s, a, u) {
|
|
4119
|
-
return new
|
|
4129
|
+
return new zs(this.hooks, t, s, a, u);
|
|
4120
4130
|
}
|
|
4121
4131
|
}
|
|
4122
|
-
var
|
|
4123
|
-
urls:
|
|
4132
|
+
var js = new Ne({
|
|
4133
|
+
urls: Fs,
|
|
4124
4134
|
handlesActivityChecks: !1,
|
|
4125
4135
|
supportsPing: !1,
|
|
4126
4136
|
isInitialized: function() {
|
|
@@ -4132,32 +4142,32 @@ function ga() {
|
|
|
4132
4142
|
getSocket: function(r) {
|
|
4133
4143
|
return j.createWebSocket(r);
|
|
4134
4144
|
}
|
|
4135
|
-
}),
|
|
4136
|
-
urls:
|
|
4145
|
+
}), nn = {
|
|
4146
|
+
urls: Ns,
|
|
4137
4147
|
handlesActivityChecks: !1,
|
|
4138
4148
|
supportsPing: !0,
|
|
4139
4149
|
isInitialized: function() {
|
|
4140
4150
|
return !0;
|
|
4141
4151
|
}
|
|
4142
|
-
},
|
|
4152
|
+
}, sn = pe({
|
|
4143
4153
|
getSocket: function(r) {
|
|
4144
4154
|
return j.HTTPFactory.createStreamingSocket(r);
|
|
4145
4155
|
}
|
|
4146
|
-
},
|
|
4156
|
+
}, nn), rn = pe({
|
|
4147
4157
|
getSocket: function(r) {
|
|
4148
4158
|
return j.HTTPFactory.createPollingSocket(r);
|
|
4149
4159
|
}
|
|
4150
|
-
},
|
|
4160
|
+
}, nn), on = {
|
|
4151
4161
|
isSupported: function() {
|
|
4152
4162
|
return j.isXHRSupported();
|
|
4153
4163
|
}
|
|
4154
|
-
},
|
|
4155
|
-
ws:
|
|
4156
|
-
xhr_streaming:
|
|
4157
|
-
xhr_polling:
|
|
4158
|
-
}, Ze =
|
|
4164
|
+
}, $s = new Ne(pe({}, sn, on)), Hs = new Ne(pe({}, rn, on)), Bs = {
|
|
4165
|
+
ws: js,
|
|
4166
|
+
xhr_streaming: $s,
|
|
4167
|
+
xhr_polling: Hs
|
|
4168
|
+
}, Ze = Bs, Vs = new Ne({
|
|
4159
4169
|
file: "sockjs",
|
|
4160
|
-
urls:
|
|
4170
|
+
urls: Ds,
|
|
4161
4171
|
handlesActivityChecks: !0,
|
|
4162
4172
|
supportsPing: !1,
|
|
4163
4173
|
isSupported: function() {
|
|
@@ -4179,15 +4189,15 @@ function ga() {
|
|
|
4179
4189
|
path: t
|
|
4180
4190
|
}));
|
|
4181
4191
|
}
|
|
4182
|
-
}),
|
|
4192
|
+
}), an = {
|
|
4183
4193
|
isSupported: function(r) {
|
|
4184
4194
|
var t = j.isXDRSupported(r.useTLS);
|
|
4185
4195
|
return t;
|
|
4186
4196
|
}
|
|
4187
|
-
},
|
|
4188
|
-
Ze.xdr_streaming =
|
|
4189
|
-
var
|
|
4190
|
-
class
|
|
4197
|
+
}, Xs = new Ne(pe({}, sn, an)), Ws = new Ne(pe({}, rn, an));
|
|
4198
|
+
Ze.xdr_streaming = Xs, Ze.xdr_polling = Ws, Ze.sockjs = Vs;
|
|
4199
|
+
var Gs = Ze;
|
|
4200
|
+
class Js extends Te {
|
|
4191
4201
|
constructor() {
|
|
4192
4202
|
super();
|
|
4193
4203
|
var t = this;
|
|
@@ -4201,8 +4211,8 @@ function ga() {
|
|
|
4201
4211
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4202
4212
|
}
|
|
4203
4213
|
}
|
|
4204
|
-
var
|
|
4205
|
-
class
|
|
4214
|
+
var Ks = new Js();
|
|
4215
|
+
class Qs {
|
|
4206
4216
|
constructor(t, s, a) {
|
|
4207
4217
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4208
4218
|
}
|
|
@@ -4226,7 +4236,7 @@ function ga() {
|
|
|
4226
4236
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4227
4237
|
}
|
|
4228
4238
|
}
|
|
4229
|
-
const
|
|
4239
|
+
const cn = {
|
|
4230
4240
|
decodeMessage: function(r) {
|
|
4231
4241
|
try {
|
|
4232
4242
|
var t = JSON.parse(r.data), s = t.data;
|
|
@@ -4249,7 +4259,7 @@ function ga() {
|
|
|
4249
4259
|
return JSON.stringify(r);
|
|
4250
4260
|
},
|
|
4251
4261
|
processHandshake: function(r) {
|
|
4252
|
-
var t =
|
|
4262
|
+
var t = cn.decodeMessage(r);
|
|
4253
4263
|
if (t.event === "pusher:connection_established") {
|
|
4254
4264
|
if (!t.data.activity_timeout)
|
|
4255
4265
|
throw "No activity timeout specified in handshake";
|
|
@@ -4280,8 +4290,8 @@ function ga() {
|
|
|
4280
4290
|
} : null;
|
|
4281
4291
|
}
|
|
4282
4292
|
};
|
|
4283
|
-
var ke =
|
|
4284
|
-
class
|
|
4293
|
+
var ke = cn;
|
|
4294
|
+
class Ys extends Te {
|
|
4285
4295
|
constructor(t, s) {
|
|
4286
4296
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4287
4297
|
}
|
|
@@ -4355,7 +4365,7 @@ function ga() {
|
|
|
4355
4365
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4356
4366
|
}
|
|
4357
4367
|
}
|
|
4358
|
-
class
|
|
4368
|
+
class Zs {
|
|
4359
4369
|
constructor(t, s) {
|
|
4360
4370
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4361
4371
|
}
|
|
@@ -4373,7 +4383,7 @@ function ga() {
|
|
|
4373
4383
|
return;
|
|
4374
4384
|
}
|
|
4375
4385
|
s.action === "connected" ? this.finish("connected", {
|
|
4376
|
-
connection: new
|
|
4386
|
+
connection: new Ys(s.id, this.transport),
|
|
4377
4387
|
activityTimeout: s.activityTimeout
|
|
4378
4388
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4379
4389
|
}, this.onClosed = (t) => {
|
|
@@ -4389,7 +4399,7 @@ function ga() {
|
|
|
4389
4399
|
this.callback(pe({ transport: this.transport, action: t }, s));
|
|
4390
4400
|
}
|
|
4391
4401
|
}
|
|
4392
|
-
class
|
|
4402
|
+
class er {
|
|
4393
4403
|
constructor(t, s) {
|
|
4394
4404
|
this.timeline = t, this.options = s || {};
|
|
4395
4405
|
}
|
|
@@ -4410,7 +4420,7 @@ function ga() {
|
|
|
4410
4420
|
if (t.indexOf("client-") !== 0)
|
|
4411
4421
|
throw new f("Event '" + t + "' does not start with 'client-'");
|
|
4412
4422
|
if (!this.subscribed) {
|
|
4413
|
-
var a =
|
|
4423
|
+
var a = T.buildLogSuffix("triggeringClientEvents");
|
|
4414
4424
|
oe.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4415
4425
|
}
|
|
4416
4426
|
return this.pusher.send_event(t, s, this.name);
|
|
@@ -4467,7 +4477,7 @@ function ga() {
|
|
|
4467
4477
|
}, s);
|
|
4468
4478
|
}
|
|
4469
4479
|
}
|
|
4470
|
-
class
|
|
4480
|
+
class tr {
|
|
4471
4481
|
constructor() {
|
|
4472
4482
|
this.reset();
|
|
4473
4483
|
}
|
|
@@ -4499,7 +4509,7 @@ function ga() {
|
|
|
4499
4509
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4500
4510
|
}
|
|
4501
4511
|
}
|
|
4502
|
-
var
|
|
4512
|
+
var nr = function(r, t, s, a) {
|
|
4503
4513
|
function u(p) {
|
|
4504
4514
|
return p instanceof s ? p : new s(function(S) {
|
|
4505
4515
|
S(p);
|
|
@@ -4526,12 +4536,12 @@ function ga() {
|
|
|
4526
4536
|
Q((a = a.apply(r, t || [])).next());
|
|
4527
4537
|
});
|
|
4528
4538
|
};
|
|
4529
|
-
class
|
|
4539
|
+
class sr extends bt {
|
|
4530
4540
|
constructor(t, s) {
|
|
4531
|
-
super(t, s), this.members = new
|
|
4541
|
+
super(t, s), this.members = new tr();
|
|
4532
4542
|
}
|
|
4533
4543
|
authorize(t, s) {
|
|
4534
|
-
super.authorize(t, (a, u) =>
|
|
4544
|
+
super.authorize(t, (a, u) => nr(this, void 0, void 0, function* () {
|
|
4535
4545
|
if (!a)
|
|
4536
4546
|
if (u = u, u.channel_data != null) {
|
|
4537
4547
|
var p = JSON.parse(u.channel_data);
|
|
@@ -4539,7 +4549,7 @@ function ga() {
|
|
|
4539
4549
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4540
4550
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4541
4551
|
else {
|
|
4542
|
-
let S =
|
|
4552
|
+
let S = T.buildLogSuffix("authorizationEndpoint");
|
|
4543
4553
|
oe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4544
4554
|
return;
|
|
4545
4555
|
}
|
|
@@ -4581,8 +4591,8 @@ function ga() {
|
|
|
4581
4591
|
this.members.reset(), super.disconnect();
|
|
4582
4592
|
}
|
|
4583
4593
|
}
|
|
4584
|
-
var
|
|
4585
|
-
class
|
|
4594
|
+
var rr = c(1), yt = c(0);
|
|
4595
|
+
class ir extends bt {
|
|
4586
4596
|
constructor(t, s, a) {
|
|
4587
4597
|
super(t, s), this.key = null, this.nacl = a;
|
|
4588
4598
|
}
|
|
@@ -4648,7 +4658,7 @@ function ga() {
|
|
|
4648
4658
|
this.emit(t, this.getDataToEmit(p));
|
|
4649
4659
|
}
|
|
4650
4660
|
getDataToEmit(t) {
|
|
4651
|
-
let s = Object(
|
|
4661
|
+
let s = Object(rr.decode)(t);
|
|
4652
4662
|
try {
|
|
4653
4663
|
return JSON.parse(s);
|
|
4654
4664
|
} catch {
|
|
@@ -4656,7 +4666,7 @@ function ga() {
|
|
|
4656
4666
|
}
|
|
4657
4667
|
}
|
|
4658
4668
|
}
|
|
4659
|
-
class
|
|
4669
|
+
class or extends Te {
|
|
4660
4670
|
constructor(t, s) {
|
|
4661
4671
|
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);
|
|
4662
4672
|
var a = j.getNetwork();
|
|
@@ -4812,12 +4822,12 @@ function ga() {
|
|
|
4812
4822
|
return this.state === "connecting" || this.state === "connected";
|
|
4813
4823
|
}
|
|
4814
4824
|
}
|
|
4815
|
-
class
|
|
4825
|
+
class ar {
|
|
4816
4826
|
constructor() {
|
|
4817
4827
|
this.channels = {};
|
|
4818
4828
|
}
|
|
4819
4829
|
add(t, s) {
|
|
4820
|
-
return this.channels[t] || (this.channels[t] =
|
|
4830
|
+
return this.channels[t] || (this.channels[t] = cr(t, s)), this.channels[t];
|
|
4821
4831
|
}
|
|
4822
4832
|
all() {
|
|
4823
4833
|
return X(this.channels);
|
|
@@ -4835,11 +4845,11 @@ function ga() {
|
|
|
4835
4845
|
});
|
|
4836
4846
|
}
|
|
4837
4847
|
}
|
|
4838
|
-
function
|
|
4848
|
+
function cr(r, t) {
|
|
4839
4849
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4840
4850
|
if (t.config.nacl)
|
|
4841
4851
|
return Ee.createEncryptedChannel(r, t, t.config.nacl);
|
|
4842
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
4852
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = T.buildLogSuffix("encryptedChannelSupport");
|
|
4843
4853
|
throw new G(`${s}. ${a}`);
|
|
4844
4854
|
} else {
|
|
4845
4855
|
if (r.indexOf("private-") === 0)
|
|
@@ -4851,12 +4861,12 @@ function ga() {
|
|
|
4851
4861
|
return Ee.createChannel(r, t);
|
|
4852
4862
|
}
|
|
4853
4863
|
}
|
|
4854
|
-
var
|
|
4864
|
+
var ur = {
|
|
4855
4865
|
createChannels() {
|
|
4856
|
-
return new
|
|
4866
|
+
return new ar();
|
|
4857
4867
|
},
|
|
4858
4868
|
createConnectionManager(r, t) {
|
|
4859
|
-
return new
|
|
4869
|
+
return new or(r, t);
|
|
4860
4870
|
},
|
|
4861
4871
|
createChannel(r, t) {
|
|
4862
4872
|
return new vt(r, t);
|
|
@@ -4865,22 +4875,22 @@ function ga() {
|
|
|
4865
4875
|
return new bt(r, t);
|
|
4866
4876
|
},
|
|
4867
4877
|
createPresenceChannel(r, t) {
|
|
4868
|
-
return new
|
|
4878
|
+
return new sr(r, t);
|
|
4869
4879
|
},
|
|
4870
4880
|
createEncryptedChannel(r, t, s) {
|
|
4871
|
-
return new
|
|
4881
|
+
return new ir(r, t, s);
|
|
4872
4882
|
},
|
|
4873
4883
|
createTimelineSender(r, t) {
|
|
4874
|
-
return new
|
|
4884
|
+
return new er(r, t);
|
|
4875
4885
|
},
|
|
4876
4886
|
createHandshake(r, t) {
|
|
4877
|
-
return new
|
|
4887
|
+
return new Zs(r, t);
|
|
4878
4888
|
},
|
|
4879
4889
|
createAssistantToTheTransportManager(r, t, s) {
|
|
4880
|
-
return new
|
|
4890
|
+
return new Qs(r, t, s);
|
|
4881
4891
|
}
|
|
4882
|
-
}, Ee =
|
|
4883
|
-
class
|
|
4892
|
+
}, Ee = ur;
|
|
4893
|
+
class un {
|
|
4884
4894
|
constructor(t) {
|
|
4885
4895
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
4886
4896
|
}
|
|
@@ -4941,10 +4951,10 @@ function ga() {
|
|
|
4941
4951
|
return ye(this.strategies, ue.method("isSupported"));
|
|
4942
4952
|
}
|
|
4943
4953
|
connect(t, s) {
|
|
4944
|
-
return
|
|
4954
|
+
return lr(this.strategies, t, function(a, u) {
|
|
4945
4955
|
return function(p, S) {
|
|
4946
4956
|
if (u[a].error = p, p) {
|
|
4947
|
-
|
|
4957
|
+
dr(u) && s(!0);
|
|
4948
4958
|
return;
|
|
4949
4959
|
}
|
|
4950
4960
|
Y(u, function(L) {
|
|
@@ -4954,13 +4964,13 @@ function ga() {
|
|
|
4954
4964
|
});
|
|
4955
4965
|
}
|
|
4956
4966
|
}
|
|
4957
|
-
function
|
|
4967
|
+
function lr(r, t, s) {
|
|
4958
4968
|
var a = ge(r, function(u, p, S, L) {
|
|
4959
4969
|
return u.connect(t, s(p, L));
|
|
4960
4970
|
});
|
|
4961
4971
|
return {
|
|
4962
4972
|
abort: function() {
|
|
4963
|
-
Y(a,
|
|
4973
|
+
Y(a, hr);
|
|
4964
4974
|
},
|
|
4965
4975
|
forceMinPriority: function(u) {
|
|
4966
4976
|
Y(a, function(p) {
|
|
@@ -4969,15 +4979,15 @@ function ga() {
|
|
|
4969
4979
|
}
|
|
4970
4980
|
};
|
|
4971
4981
|
}
|
|
4972
|
-
function
|
|
4982
|
+
function dr(r) {
|
|
4973
4983
|
return Ce(r, function(t) {
|
|
4974
4984
|
return !!t.error;
|
|
4975
4985
|
});
|
|
4976
4986
|
}
|
|
4977
|
-
function
|
|
4987
|
+
function hr(r) {
|
|
4978
4988
|
!r.error && !r.aborted && (r.abort(), r.aborted = !0);
|
|
4979
4989
|
}
|
|
4980
|
-
class
|
|
4990
|
+
class fr {
|
|
4981
4991
|
constructor(t, s, a) {
|
|
4982
4992
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
4983
4993
|
}
|
|
@@ -4985,7 +4995,7 @@ function ga() {
|
|
|
4985
4995
|
return this.strategy.isSupported();
|
|
4986
4996
|
}
|
|
4987
4997
|
connect(t, s) {
|
|
4988
|
-
var a = this.usingTLS, u =
|
|
4998
|
+
var a = this.usingTLS, u = pr(a), p = u && u.cacheSkipCount ? u.cacheSkipCount : 0, S = [this.strategy];
|
|
4989
4999
|
if (u && u.timestamp + this.ttl >= ue.now()) {
|
|
4990
5000
|
var L = this.transports[u.transport];
|
|
4991
5001
|
L && (["ws", "wss"].includes(u.transport) || p > 3 ? (this.timeline.info({
|
|
@@ -4998,7 +5008,7 @@ function ga() {
|
|
|
4998
5008
|
}))) : p++);
|
|
4999
5009
|
}
|
|
5000
5010
|
var z = ue.now(), Q = S.pop().connect(t, function te(ce, nt) {
|
|
5001
|
-
ce ? (
|
|
5011
|
+
ce ? (ln(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, te)) : s(ce)) : (gr(a, nt.transport.name, ue.now() - z, p), s(null, nt));
|
|
5002
5012
|
});
|
|
5003
5013
|
return {
|
|
5004
5014
|
abort: function() {
|
|
@@ -5013,7 +5023,7 @@ function ga() {
|
|
|
5013
5023
|
function St(r) {
|
|
5014
5024
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
5015
5025
|
}
|
|
5016
|
-
function
|
|
5026
|
+
function pr(r) {
|
|
5017
5027
|
var t = j.getLocalStorage();
|
|
5018
5028
|
if (t)
|
|
5019
5029
|
try {
|
|
@@ -5021,11 +5031,11 @@ function ga() {
|
|
|
5021
5031
|
if (s)
|
|
5022
5032
|
return JSON.parse(s);
|
|
5023
5033
|
} catch {
|
|
5024
|
-
|
|
5034
|
+
ln(r);
|
|
5025
5035
|
}
|
|
5026
5036
|
return null;
|
|
5027
5037
|
}
|
|
5028
|
-
function
|
|
5038
|
+
function gr(r, t, s, a) {
|
|
5029
5039
|
var u = j.getLocalStorage();
|
|
5030
5040
|
if (u)
|
|
5031
5041
|
try {
|
|
@@ -5038,7 +5048,7 @@ function ga() {
|
|
|
5038
5048
|
} catch {
|
|
5039
5049
|
}
|
|
5040
5050
|
}
|
|
5041
|
-
function
|
|
5051
|
+
function ln(r) {
|
|
5042
5052
|
var t = j.getLocalStorage();
|
|
5043
5053
|
if (t)
|
|
5044
5054
|
try {
|
|
@@ -5080,7 +5090,7 @@ function ga() {
|
|
|
5080
5090
|
return a.connect(t, s);
|
|
5081
5091
|
}
|
|
5082
5092
|
}
|
|
5083
|
-
class
|
|
5093
|
+
class mr {
|
|
5084
5094
|
constructor(t) {
|
|
5085
5095
|
this.strategy = t;
|
|
5086
5096
|
}
|
|
@@ -5099,11 +5109,11 @@ function ga() {
|
|
|
5099
5109
|
return r.isSupported();
|
|
5100
5110
|
};
|
|
5101
5111
|
}
|
|
5102
|
-
var
|
|
5112
|
+
var vr = function(r, t, s) {
|
|
5103
5113
|
var a = {};
|
|
5104
|
-
function u(
|
|
5105
|
-
var
|
|
5106
|
-
return a[
|
|
5114
|
+
function u(Sn, mi, vi, bi, yi) {
|
|
5115
|
+
var Cn = s(r, Sn, mi, vi, bi, yi);
|
|
5116
|
+
return a[Sn] = Cn, Cn;
|
|
5107
5117
|
}
|
|
5108
5118
|
var p = Object.assign({}, t, {
|
|
5109
5119
|
hostNonTLS: r.wsHost + ":" + r.wsPort,
|
|
@@ -5119,43 +5129,43 @@ function ga() {
|
|
|
5119
5129
|
loop: !0,
|
|
5120
5130
|
timeout: 15e3,
|
|
5121
5131
|
timeoutLimit: 6e4
|
|
5122
|
-
}, Q = new
|
|
5132
|
+
}, Q = new un({
|
|
5123
5133
|
minPingDelay: 1e4,
|
|
5124
5134
|
maxPingDelay: r.activityTimeout
|
|
5125
|
-
}), te = new
|
|
5135
|
+
}), te = new un({
|
|
5126
5136
|
lives: 2,
|
|
5127
5137
|
minPingDelay: 1e4,
|
|
5128
5138
|
maxPingDelay: r.activityTimeout
|
|
5129
|
-
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q),
|
|
5130
|
-
new ze(je(pn), pn, di)
|
|
5131
|
-
], z), bn = new Le([
|
|
5139
|
+
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q), di = u("sockjs", "sockjs", 1, L), gn = u("xhr_streaming", "xhr_streaming", 1, L, te), hi = u("xdr_streaming", "xdr_streaming", 1, L, te), mn = u("xhr_polling", "xhr_polling", 1, L), fi = u("xdr_polling", "xdr_polling", 1, L), vn = new Le([ce], z), pi = new Le([nt], z), gi = new Le([di], z), bn = new Le([
|
|
5132
5140
|
new ze(je(gn), gn, hi)
|
|
5133
5141
|
], z), yn = new Le([
|
|
5134
|
-
new ze(je(
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5142
|
+
new ze(je(mn), mn, fi)
|
|
5143
|
+
], z), _n = new Le([
|
|
5144
|
+
new ze(je(bn), new _t([
|
|
5145
|
+
bn,
|
|
5146
|
+
new et(yn, { delay: 4e3 })
|
|
5147
|
+
]), yn)
|
|
5148
|
+
], z), Et = new ze(je(_n), _n, gi), At;
|
|
5139
5149
|
return t.useTLS ? At = new _t([
|
|
5140
|
-
|
|
5150
|
+
vn,
|
|
5141
5151
|
new et(Et, { delay: 2e3 })
|
|
5142
5152
|
]) : At = new _t([
|
|
5143
|
-
|
|
5144
|
-
new et(
|
|
5153
|
+
vn,
|
|
5154
|
+
new et(pi, { delay: 2e3 }),
|
|
5145
5155
|
new et(Et, { delay: 5e3 })
|
|
5146
|
-
]), new
|
|
5156
|
+
]), new fr(new mr(new ze(je(ce), At, Et)), a, {
|
|
5147
5157
|
ttl: 18e5,
|
|
5148
5158
|
timeline: t.timeline,
|
|
5149
5159
|
useTLS: t.useTLS
|
|
5150
5160
|
});
|
|
5151
|
-
},
|
|
5161
|
+
}, br = vr, yr = (function() {
|
|
5152
5162
|
var r = this;
|
|
5153
5163
|
r.timeline.info(r.buildTimelineMessage({
|
|
5154
5164
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
5155
5165
|
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), _.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
5156
5166
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
5157
5167
|
})) : r.onClose();
|
|
5158
|
-
}),
|
|
5168
|
+
}), _r = {
|
|
5159
5169
|
getRequest: function(r) {
|
|
5160
5170
|
var t = new window.XDomainRequest();
|
|
5161
5171
|
return t.ontimeout = function() {
|
|
@@ -5171,9 +5181,9 @@ function ga() {
|
|
|
5171
5181
|
abortRequest: function(r) {
|
|
5172
5182
|
r.ontimeout = r.onerror = r.onprogress = r.onload = null, r.abort();
|
|
5173
5183
|
}
|
|
5174
|
-
},
|
|
5175
|
-
const
|
|
5176
|
-
class
|
|
5184
|
+
}, Sr = _r;
|
|
5185
|
+
const Cr = 256 * 1024;
|
|
5186
|
+
class wr extends Te {
|
|
5177
5187
|
constructor(t, s, a) {
|
|
5178
5188
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5179
5189
|
}
|
|
@@ -5201,17 +5211,17 @@ function ga() {
|
|
|
5201
5211
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5202
5212
|
}
|
|
5203
5213
|
isBufferTooLong(t) {
|
|
5204
|
-
return this.position === t.length && t.length >
|
|
5214
|
+
return this.position === t.length && t.length > Cr;
|
|
5205
5215
|
}
|
|
5206
5216
|
}
|
|
5207
5217
|
var Ct;
|
|
5208
5218
|
(function(r) {
|
|
5209
5219
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5210
5220
|
})(Ct || (Ct = {}));
|
|
5211
|
-
var Ie = Ct,
|
|
5212
|
-
class
|
|
5221
|
+
var Ie = Ct, Tr = 1;
|
|
5222
|
+
class Er {
|
|
5213
5223
|
constructor(t, s) {
|
|
5214
|
-
this.hooks = t, this.session =
|
|
5224
|
+
this.hooks = t, this.session = hn(1e3) + "/" + Mr(8), this.location = Ar(s), this.readyState = Ie.CONNECTING, this.openStream();
|
|
5215
5225
|
}
|
|
5216
5226
|
send(t) {
|
|
5217
5227
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5225,7 +5235,7 @@ function ga() {
|
|
|
5225
5235
|
sendRaw(t) {
|
|
5226
5236
|
if (this.readyState === Ie.OPEN)
|
|
5227
5237
|
try {
|
|
5228
|
-
return j.createSocketRequest("POST",
|
|
5238
|
+
return j.createSocketRequest("POST", dn(Rr(this.location, this.session))).start(t), !0;
|
|
5229
5239
|
} catch {
|
|
5230
5240
|
return !1;
|
|
5231
5241
|
}
|
|
@@ -5268,7 +5278,7 @@ function ga() {
|
|
|
5268
5278
|
}
|
|
5269
5279
|
}
|
|
5270
5280
|
onOpen(t) {
|
|
5271
|
-
this.readyState === Ie.CONNECTING ? (t && t.hostname && (this.location.base =
|
|
5281
|
+
this.readyState === Ie.CONNECTING ? (t && t.hostname && (this.location.base = Pr(this.location.base, t.hostname)), this.readyState = Ie.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5272
5282
|
}
|
|
5273
5283
|
onEvent(t) {
|
|
5274
5284
|
this.readyState === Ie.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
@@ -5280,7 +5290,7 @@ function ga() {
|
|
|
5280
5290
|
this.onerror && this.onerror(t);
|
|
5281
5291
|
}
|
|
5282
5292
|
openStream() {
|
|
5283
|
-
this.stream = j.createSocketRequest("POST",
|
|
5293
|
+
this.stream = j.createSocketRequest("POST", dn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5284
5294
|
this.onChunk(t);
|
|
5285
5295
|
}), this.stream.bind("finished", (t) => {
|
|
5286
5296
|
this.hooks.onFinished(this, t);
|
|
@@ -5299,33 +5309,33 @@ function ga() {
|
|
|
5299
5309
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5300
5310
|
}
|
|
5301
5311
|
}
|
|
5302
|
-
function
|
|
5312
|
+
function Ar(r) {
|
|
5303
5313
|
var t = /([^\?]*)\/*(\??.*)/.exec(r);
|
|
5304
5314
|
return {
|
|
5305
5315
|
base: t[1],
|
|
5306
5316
|
queryString: t[2]
|
|
5307
5317
|
};
|
|
5308
5318
|
}
|
|
5309
|
-
function
|
|
5319
|
+
function Rr(r, t) {
|
|
5310
5320
|
return r.base + "/" + t + "/xhr_send";
|
|
5311
5321
|
}
|
|
5312
|
-
function
|
|
5322
|
+
function dn(r) {
|
|
5313
5323
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5314
|
-
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5324
|
+
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + Tr++;
|
|
5315
5325
|
}
|
|
5316
|
-
function
|
|
5326
|
+
function Pr(r, t) {
|
|
5317
5327
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5318
5328
|
return s[1] + t + s[3];
|
|
5319
5329
|
}
|
|
5320
|
-
function
|
|
5330
|
+
function hn(r) {
|
|
5321
5331
|
return j.randomInt(r);
|
|
5322
5332
|
}
|
|
5323
|
-
function
|
|
5333
|
+
function Mr(r) {
|
|
5324
5334
|
for (var t = [], s = 0; s < r; s++)
|
|
5325
|
-
t.push(
|
|
5335
|
+
t.push(hn(32).toString(32));
|
|
5326
5336
|
return t.join("");
|
|
5327
5337
|
}
|
|
5328
|
-
var
|
|
5338
|
+
var xr = Er, kr = {
|
|
5329
5339
|
getReceiveURL: function(r, t) {
|
|
5330
5340
|
return r.base + "/" + t + "/xhr_streaming" + r.queryString;
|
|
5331
5341
|
},
|
|
@@ -5338,7 +5348,7 @@ function ga() {
|
|
|
5338
5348
|
onFinished: function(r, t) {
|
|
5339
5349
|
r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5340
5350
|
}
|
|
5341
|
-
},
|
|
5351
|
+
}, Lr = kr, Ir = {
|
|
5342
5352
|
getReceiveURL: function(r, t) {
|
|
5343
5353
|
return r.base + "/" + t + "/xhr" + r.queryString;
|
|
5344
5354
|
},
|
|
@@ -5350,7 +5360,7 @@ function ga() {
|
|
|
5350
5360
|
onFinished: function(r, t) {
|
|
5351
5361
|
t === 200 ? r.reconnect() : r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5352
5362
|
}
|
|
5353
|
-
},
|
|
5363
|
+
}, Ur = Ir, Or = {
|
|
5354
5364
|
getRequest: function(r) {
|
|
5355
5365
|
var t = j.getXHRAPI(), s = new t();
|
|
5356
5366
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5367,36 +5377,36 @@ function ga() {
|
|
|
5367
5377
|
abortRequest: function(r) {
|
|
5368
5378
|
r.onreadystatechange = null, r.abort();
|
|
5369
5379
|
}
|
|
5370
|
-
},
|
|
5380
|
+
}, Fr = Or, Nr = {
|
|
5371
5381
|
createStreamingSocket(r) {
|
|
5372
|
-
return this.createSocket(
|
|
5382
|
+
return this.createSocket(Lr, r);
|
|
5373
5383
|
},
|
|
5374
5384
|
createPollingSocket(r) {
|
|
5375
|
-
return this.createSocket(
|
|
5385
|
+
return this.createSocket(Ur, r);
|
|
5376
5386
|
},
|
|
5377
5387
|
createSocket(r, t) {
|
|
5378
|
-
return new
|
|
5388
|
+
return new xr(r, t);
|
|
5379
5389
|
},
|
|
5380
5390
|
createXHR(r, t) {
|
|
5381
|
-
return this.createRequest(
|
|
5391
|
+
return this.createRequest(Fr, r, t);
|
|
5382
5392
|
},
|
|
5383
5393
|
createRequest(r, t, s) {
|
|
5384
|
-
return new
|
|
5394
|
+
return new wr(r, t, s);
|
|
5385
5395
|
}
|
|
5386
|
-
},
|
|
5387
|
-
|
|
5388
|
-
return this.createRequest(
|
|
5396
|
+
}, fn = Nr;
|
|
5397
|
+
fn.createXDR = function(r, t) {
|
|
5398
|
+
return this.createRequest(Sr, r, t);
|
|
5389
5399
|
};
|
|
5390
|
-
var
|
|
5400
|
+
var Dr = fn, qr = {
|
|
5391
5401
|
nextAuthCallbackID: 1,
|
|
5392
5402
|
auth_callbacks: {},
|
|
5393
5403
|
ScriptReceivers: d,
|
|
5394
5404
|
DependenciesReceivers: M,
|
|
5395
|
-
getDefaultStrategy:
|
|
5396
|
-
Transports:
|
|
5397
|
-
transportConnectionInitializer:
|
|
5398
|
-
HTTPFactory:
|
|
5399
|
-
TimelineTransport:
|
|
5405
|
+
getDefaultStrategy: br,
|
|
5406
|
+
Transports: Gs,
|
|
5407
|
+
transportConnectionInitializer: yr,
|
|
5408
|
+
HTTPFactory: Dr,
|
|
5409
|
+
TimelineTransport: Os,
|
|
5400
5410
|
getXHRAPI() {
|
|
5401
5411
|
return window.XMLHttpRequest;
|
|
5402
5412
|
},
|
|
@@ -5417,7 +5427,7 @@ function ga() {
|
|
|
5417
5427
|
return this.getDocument().location.protocol;
|
|
5418
5428
|
},
|
|
5419
5429
|
getAuthorizers() {
|
|
5420
|
-
return { ajax: J, jsonp:
|
|
5430
|
+
return { ajax: J, jsonp: xs };
|
|
5421
5431
|
},
|
|
5422
5432
|
onDocumentBody(r) {
|
|
5423
5433
|
document.body ? r() : setTimeout(() => {
|
|
@@ -5425,10 +5435,10 @@ function ga() {
|
|
|
5425
5435
|
}, 0);
|
|
5426
5436
|
},
|
|
5427
5437
|
createJSONPRequest(r, t) {
|
|
5428
|
-
return new
|
|
5438
|
+
return new Ls(r, t);
|
|
5429
5439
|
},
|
|
5430
5440
|
createScriptRequest(r) {
|
|
5431
|
-
return new
|
|
5441
|
+
return new ks(r);
|
|
5432
5442
|
},
|
|
5433
5443
|
getLocalStorage() {
|
|
5434
5444
|
try {
|
|
@@ -5448,7 +5458,7 @@ function ga() {
|
|
|
5448
5458
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5449
5459
|
},
|
|
5450
5460
|
getNetwork() {
|
|
5451
|
-
return
|
|
5461
|
+
return Ks;
|
|
5452
5462
|
},
|
|
5453
5463
|
createWebSocket(r) {
|
|
5454
5464
|
var t = this.getWebSocketAPI();
|
|
@@ -5480,12 +5490,12 @@ function ga() {
|
|
|
5480
5490
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5481
5491
|
}() * r);
|
|
5482
5492
|
}
|
|
5483
|
-
}, j =
|
|
5493
|
+
}, j = qr, wt;
|
|
5484
5494
|
(function(r) {
|
|
5485
5495
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5486
5496
|
})(wt || (wt = {}));
|
|
5487
5497
|
var tt = wt;
|
|
5488
|
-
class
|
|
5498
|
+
class zr {
|
|
5489
5499
|
constructor(t, s, a) {
|
|
5490
5500
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5491
5501
|
}
|
|
@@ -5523,7 +5533,7 @@ function ga() {
|
|
|
5523
5533
|
return this.uniqueID++, this.uniqueID;
|
|
5524
5534
|
}
|
|
5525
5535
|
}
|
|
5526
|
-
class
|
|
5536
|
+
class jr {
|
|
5527
5537
|
constructor(t, s, a, u) {
|
|
5528
5538
|
this.name = t, this.priority = s, this.transport = a, this.options = u || {};
|
|
5529
5539
|
}
|
|
@@ -5535,8 +5545,8 @@ function ga() {
|
|
|
5535
5545
|
connect(t, s) {
|
|
5536
5546
|
if (this.isSupported()) {
|
|
5537
5547
|
if (this.priority < t)
|
|
5538
|
-
return
|
|
5539
|
-
} else return
|
|
5548
|
+
return pn(new N(), s);
|
|
5549
|
+
} else return pn(new O(), s);
|
|
5540
5550
|
var a = !1, u = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5541
5551
|
u.unbind("initialized", S), u.connect();
|
|
5542
5552
|
}, L = function() {
|
|
@@ -5562,7 +5572,7 @@ function ga() {
|
|
|
5562
5572
|
};
|
|
5563
5573
|
}
|
|
5564
5574
|
}
|
|
5565
|
-
function
|
|
5575
|
+
function pn(r, t) {
|
|
5566
5576
|
return ue.defer(function() {
|
|
5567
5577
|
t(r);
|
|
5568
5578
|
}), {
|
|
@@ -5572,14 +5582,14 @@ function ga() {
|
|
|
5572
5582
|
}
|
|
5573
5583
|
};
|
|
5574
5584
|
}
|
|
5575
|
-
const { Transports:
|
|
5576
|
-
var
|
|
5577
|
-
var S =
|
|
5585
|
+
const { Transports: $r } = j;
|
|
5586
|
+
var Hr = function(r, t, s, a, u, p) {
|
|
5587
|
+
var S = $r[s];
|
|
5578
5588
|
if (!S)
|
|
5579
5589
|
throw new k(s);
|
|
5580
5590
|
var L = (!r.enabledTransports || E(r.enabledTransports, t) !== -1) && (!r.disabledTransports || E(r.disabledTransports, t) === -1), z;
|
|
5581
|
-
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new
|
|
5582
|
-
},
|
|
5591
|
+
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new jr(t, a, p ? p.getAssistant(S) : S, u)) : z = Br, z;
|
|
5592
|
+
}, Br = {
|
|
5583
5593
|
isSupported: function() {
|
|
5584
5594
|
return !1;
|
|
5585
5595
|
},
|
|
@@ -5596,14 +5606,14 @@ function ga() {
|
|
|
5596
5606
|
};
|
|
5597
5607
|
}
|
|
5598
5608
|
};
|
|
5599
|
-
function
|
|
5609
|
+
function Vr(r) {
|
|
5600
5610
|
if (r == null)
|
|
5601
5611
|
throw "You must pass an options object";
|
|
5602
5612
|
if (r.cluster == null)
|
|
5603
5613
|
throw "Options object must provide a cluster";
|
|
5604
5614
|
"disableStats" in r && oe.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5605
5615
|
}
|
|
5606
|
-
const
|
|
5616
|
+
const Xr = (r, t) => {
|
|
5607
5617
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5608
5618
|
for (var a in t.params)
|
|
5609
5619
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5614,15 +5624,15 @@ function ga() {
|
|
|
5614
5624
|
}
|
|
5615
5625
|
return s;
|
|
5616
5626
|
};
|
|
5617
|
-
var
|
|
5627
|
+
var Wr = (r) => {
|
|
5618
5628
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5619
5629
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5620
5630
|
return (t, s) => {
|
|
5621
|
-
const a =
|
|
5622
|
-
j.getAuthorizers()[r.transport](j, a, r,
|
|
5631
|
+
const a = Xr(t, r);
|
|
5632
|
+
j.getAuthorizers()[r.transport](j, a, r, w.UserAuthentication, s);
|
|
5623
5633
|
};
|
|
5624
5634
|
};
|
|
5625
|
-
const
|
|
5635
|
+
const Gr = (r, t) => {
|
|
5626
5636
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5627
5637
|
s += "&channel_name=" + encodeURIComponent(r.channelName);
|
|
5628
5638
|
for (var a in t.params)
|
|
@@ -5634,15 +5644,15 @@ function ga() {
|
|
|
5634
5644
|
}
|
|
5635
5645
|
return s;
|
|
5636
5646
|
};
|
|
5637
|
-
var
|
|
5647
|
+
var Jr = (r) => {
|
|
5638
5648
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5639
5649
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5640
5650
|
return (t, s) => {
|
|
5641
|
-
const a =
|
|
5642
|
-
j.getAuthorizers()[r.transport](j, a, r,
|
|
5651
|
+
const a = Gr(t, r);
|
|
5652
|
+
j.getAuthorizers()[r.transport](j, a, r, w.ChannelAuthorization, s);
|
|
5643
5653
|
};
|
|
5644
5654
|
};
|
|
5645
|
-
const
|
|
5655
|
+
const Kr = (r, t, s) => {
|
|
5646
5656
|
const a = {
|
|
5647
5657
|
authTransport: t.transport,
|
|
5648
5658
|
authEndpoint: t.endpoint,
|
|
@@ -5656,7 +5666,7 @@ function ga() {
|
|
|
5656
5666
|
s(S, a).authorize(u.socketId, p);
|
|
5657
5667
|
};
|
|
5658
5668
|
};
|
|
5659
|
-
function
|
|
5669
|
+
function Qr(r, t) {
|
|
5660
5670
|
let s = {
|
|
5661
5671
|
activityTimeout: r.activityTimeout || h.activityTimeout,
|
|
5662
5672
|
cluster: r.cluster,
|
|
@@ -5669,46 +5679,46 @@ function ga() {
|
|
|
5669
5679
|
wsPath: r.wsPath || h.wsPath,
|
|
5670
5680
|
wsPort: r.wsPort || h.wsPort,
|
|
5671
5681
|
wssPort: r.wssPort || h.wssPort,
|
|
5672
|
-
enableStats:
|
|
5673
|
-
httpHost:
|
|
5674
|
-
useTLS:
|
|
5675
|
-
wsHost:
|
|
5676
|
-
userAuthenticator:
|
|
5677
|
-
channelAuthorizer:
|
|
5682
|
+
enableStats: ni(r),
|
|
5683
|
+
httpHost: Yr(r),
|
|
5684
|
+
useTLS: ti(r),
|
|
5685
|
+
wsHost: Zr(r),
|
|
5686
|
+
userAuthenticator: si(r),
|
|
5687
|
+
channelAuthorizer: ii(r, t)
|
|
5678
5688
|
};
|
|
5679
5689
|
return "disabledTransports" in r && (s.disabledTransports = r.disabledTransports), "enabledTransports" in r && (s.enabledTransports = r.enabledTransports), "ignoreNullOrigin" in r && (s.ignoreNullOrigin = r.ignoreNullOrigin), "timelineParams" in r && (s.timelineParams = r.timelineParams), "nacl" in r && (s.nacl = r.nacl), s;
|
|
5680
5690
|
}
|
|
5681
|
-
function Qr(r) {
|
|
5682
|
-
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5683
|
-
}
|
|
5684
5691
|
function Yr(r) {
|
|
5685
|
-
return r.
|
|
5692
|
+
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5686
5693
|
}
|
|
5687
5694
|
function Zr(r) {
|
|
5688
|
-
return
|
|
5695
|
+
return r.wsHost ? r.wsHost : ei(r.cluster);
|
|
5689
5696
|
}
|
|
5690
5697
|
function ei(r) {
|
|
5691
|
-
return
|
|
5698
|
+
return `ws-${r}.pusher.com`;
|
|
5692
5699
|
}
|
|
5693
5700
|
function ti(r) {
|
|
5694
|
-
return
|
|
5701
|
+
return j.getProtocol() === "https:" ? !0 : r.forceTLS !== !1;
|
|
5695
5702
|
}
|
|
5696
5703
|
function ni(r) {
|
|
5704
|
+
return "enableStats" in r ? r.enableStats : "disableStats" in r ? !r.disableStats : !1;
|
|
5705
|
+
}
|
|
5706
|
+
function si(r) {
|
|
5697
5707
|
const t = Object.assign(Object.assign({}, h.userAuthentication), r.userAuthentication);
|
|
5698
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5708
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : Wr(t);
|
|
5699
5709
|
}
|
|
5700
|
-
function
|
|
5710
|
+
function ri(r, t) {
|
|
5701
5711
|
let s;
|
|
5702
5712
|
return "channelAuthorization" in r ? s = Object.assign(Object.assign({}, h.channelAuthorization), r.channelAuthorization) : (s = {
|
|
5703
5713
|
transport: r.authTransport || h.authTransport,
|
|
5704
5714
|
endpoint: r.authEndpoint || h.authEndpoint
|
|
5705
|
-
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler =
|
|
5715
|
+
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler = Kr(t, s, r.authorizer))), s;
|
|
5706
5716
|
}
|
|
5707
|
-
function
|
|
5708
|
-
const s =
|
|
5709
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5717
|
+
function ii(r, t) {
|
|
5718
|
+
const s = ri(r, t);
|
|
5719
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : Jr(s);
|
|
5710
5720
|
}
|
|
5711
|
-
class
|
|
5721
|
+
class oi extends Te {
|
|
5712
5722
|
constructor(t) {
|
|
5713
5723
|
super(function(s, a) {
|
|
5714
5724
|
oe.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5726,14 +5736,14 @@ function ga() {
|
|
|
5726
5736
|
});
|
|
5727
5737
|
}
|
|
5728
5738
|
}
|
|
5729
|
-
function
|
|
5739
|
+
function ai() {
|
|
5730
5740
|
let r, t;
|
|
5731
5741
|
return { promise: new Promise((a, u) => {
|
|
5732
5742
|
r = a, t = u;
|
|
5733
5743
|
}), resolve: r, reject: t };
|
|
5734
5744
|
}
|
|
5735
|
-
var
|
|
5736
|
-
class
|
|
5745
|
+
var ci = ai;
|
|
5746
|
+
class ui extends Te {
|
|
5737
5747
|
constructor(t) {
|
|
5738
5748
|
super(function(s, a) {
|
|
5739
5749
|
oe.debug("No callbacks on user for " + s);
|
|
@@ -5748,7 +5758,7 @@ function ga() {
|
|
|
5748
5758
|
});
|
|
5749
5759
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5750
5760
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5751
|
-
}), this.watchlist = new
|
|
5761
|
+
}), this.watchlist = new oi(t), this.pusher.connection.bind("message", (s) => {
|
|
5752
5762
|
var a = s.event;
|
|
5753
5763
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5754
5764
|
});
|
|
@@ -5788,7 +5798,7 @@ function ga() {
|
|
|
5788
5798
|
_newSigninPromiseIfNeeded() {
|
|
5789
5799
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
5790
5800
|
return;
|
|
5791
|
-
const { promise: t, resolve: s } =
|
|
5801
|
+
const { promise: t, resolve: s } = ci();
|
|
5792
5802
|
t.done = !1;
|
|
5793
5803
|
const a = () => {
|
|
5794
5804
|
t.done = !0;
|
|
@@ -5808,7 +5818,7 @@ function ga() {
|
|
|
5808
5818
|
}));
|
|
5809
5819
|
}
|
|
5810
5820
|
constructor(t, s) {
|
|
5811
|
-
|
|
5821
|
+
li(t), Vr(s), this.key = t, this.config = Qr(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new zr(this.key, this.sessionID, {
|
|
5812
5822
|
cluster: this.config.cluster,
|
|
5813
5823
|
features: de.getClientFeatures(),
|
|
5814
5824
|
params: this.config.timelineParams || {},
|
|
@@ -5819,7 +5829,7 @@ function ga() {
|
|
|
5819
5829
|
host: this.config.statsHost,
|
|
5820
5830
|
path: "/timeline/v2/" + j.TimelineTransport.name
|
|
5821
5831
|
}));
|
|
5822
|
-
var a = (u) => j.getDefaultStrategy(this.config, u,
|
|
5832
|
+
var a = (u) => j.getDefaultStrategy(this.config, u, Hr);
|
|
5823
5833
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
5824
5834
|
getStrategy: a,
|
|
5825
5835
|
timeline: this.timeline,
|
|
@@ -5842,7 +5852,7 @@ function ga() {
|
|
|
5842
5852
|
this.channels.disconnect();
|
|
5843
5853
|
}), this.connection.bind("error", (u) => {
|
|
5844
5854
|
oe.warn(u);
|
|
5845
|
-
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new
|
|
5855
|
+
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new ui(this), de.isReady && this.connect();
|
|
5846
5856
|
}
|
|
5847
5857
|
channel(t) {
|
|
5848
5858
|
return this.channels.find(t);
|
|
@@ -5901,7 +5911,7 @@ function ga() {
|
|
|
5901
5911
|
}
|
|
5902
5912
|
de.instances = [], de.isReady = !1, de.logToConsole = !1, de.Runtime = j, de.ScriptReceivers = j.ScriptReceivers, de.DependenciesReceivers = j.DependenciesReceivers, de.auth_callbacks = j.auth_callbacks;
|
|
5903
5913
|
var Tt = o.default = de;
|
|
5904
|
-
function
|
|
5914
|
+
function li(r) {
|
|
5905
5915
|
if (r == null)
|
|
5906
5916
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
5907
5917
|
}
|
|
@@ -5911,10 +5921,10 @@ function ga() {
|
|
|
5911
5921
|
])
|
|
5912
5922
|
);
|
|
5913
5923
|
});
|
|
5914
|
-
})(
|
|
5924
|
+
})(Ut)), Ut.exports;
|
|
5915
5925
|
}
|
|
5916
|
-
var
|
|
5917
|
-
const
|
|
5926
|
+
var ba = va();
|
|
5927
|
+
const ya = /* @__PURE__ */ ma(ba), _a = "/v1/messenger/bootstrap", Sa = 3e4, Ca = 3e4, wa = 5 * 6e4;
|
|
5918
5928
|
function se(e) {
|
|
5919
5929
|
return typeof e == "object" && e !== null;
|
|
5920
5930
|
}
|
|
@@ -5936,7 +5946,7 @@ function Ve(e, n) {
|
|
|
5936
5946
|
const o = i.trim();
|
|
5937
5947
|
return o === "" ? null : o;
|
|
5938
5948
|
}
|
|
5939
|
-
function
|
|
5949
|
+
function Ta(e, n) {
|
|
5940
5950
|
const i = e[n];
|
|
5941
5951
|
if (typeof i == "number" && Number.isFinite(i))
|
|
5942
5952
|
return i;
|
|
@@ -5947,14 +5957,14 @@ function Ca(e, n) {
|
|
|
5947
5957
|
}
|
|
5948
5958
|
throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
|
|
5949
5959
|
}
|
|
5950
|
-
function
|
|
5960
|
+
function Ea(e) {
|
|
5951
5961
|
return e.toLowerCase() === "http" ? "http" : "https";
|
|
5952
5962
|
}
|
|
5953
|
-
function
|
|
5963
|
+
function Aa(e) {
|
|
5954
5964
|
if (e !== null)
|
|
5955
5965
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5956
5966
|
}
|
|
5957
|
-
function
|
|
5967
|
+
function Ra(e) {
|
|
5958
5968
|
const n = se(e) && se(e.data) ? e.data : e;
|
|
5959
5969
|
if (!se(n))
|
|
5960
5970
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
@@ -5964,7 +5974,7 @@ function Ea(e) {
|
|
|
5964
5974
|
const c = i.user, l = o.reverb;
|
|
5965
5975
|
if (!se(c) || !se(l))
|
|
5966
5976
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5967
|
-
const d =
|
|
5977
|
+
const d = Aa(Ve(l, "path"));
|
|
5968
5978
|
return {
|
|
5969
5979
|
auth: {
|
|
5970
5980
|
token: Se(i, "token"),
|
|
@@ -5986,17 +5996,17 @@ function Ea(e) {
|
|
|
5986
5996
|
reverb: {
|
|
5987
5997
|
appKey: Se(l, "app_key"),
|
|
5988
5998
|
host: Se(l, "host"),
|
|
5989
|
-
port:
|
|
5990
|
-
scheme:
|
|
5999
|
+
port: Ta(l, "port"),
|
|
6000
|
+
scheme: Ea(Se(l, "scheme")),
|
|
5991
6001
|
...d ? { path: d } : {}
|
|
5992
6002
|
}
|
|
5993
6003
|
}
|
|
5994
6004
|
};
|
|
5995
6005
|
}
|
|
5996
|
-
function
|
|
6006
|
+
function Pa(e) {
|
|
5997
6007
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
5998
6008
|
}
|
|
5999
|
-
function
|
|
6009
|
+
function Ma(e) {
|
|
6000
6010
|
if (!se(e))
|
|
6001
6011
|
return !1;
|
|
6002
6012
|
const n = se(e.response) ? e.response : null;
|
|
@@ -6005,13 +6015,13 @@ function Ra(e) {
|
|
|
6005
6015
|
const i = n.data;
|
|
6006
6016
|
return i?.code === "ACCOUNT_SUSPENDED" || i?.errors?.reason === "account_suspended" ? !0 : typeof i?.message == "string" && i.message.toLowerCase().includes("suspended");
|
|
6007
6017
|
}
|
|
6008
|
-
function
|
|
6009
|
-
if (e.headers instanceof
|
|
6018
|
+
function Vn(e, n) {
|
|
6019
|
+
if (e.headers instanceof wn) {
|
|
6010
6020
|
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"));
|
|
6011
6021
|
return;
|
|
6012
6022
|
}
|
|
6013
6023
|
const i = se(e.headers) ? e.headers : {};
|
|
6014
|
-
e.headers = new
|
|
6024
|
+
e.headers = new wn({
|
|
6015
6025
|
...i,
|
|
6016
6026
|
Authorization: `Bearer ${n}`,
|
|
6017
6027
|
Accept: "application/json",
|
|
@@ -6025,16 +6035,16 @@ function Ae(e, n, i) {
|
|
|
6025
6035
|
const c = e[i];
|
|
6026
6036
|
return typeof c == "string" && c.trim() !== "" ? c : null;
|
|
6027
6037
|
}
|
|
6028
|
-
function
|
|
6038
|
+
function xa(e) {
|
|
6029
6039
|
if (typeof e != "string")
|
|
6030
6040
|
return null;
|
|
6031
6041
|
const n = e.trim().toLowerCase();
|
|
6032
6042
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
6033
6043
|
}
|
|
6034
|
-
function
|
|
6044
|
+
function ka(e, n) {
|
|
6035
6045
|
if (!se(e))
|
|
6036
6046
|
return null;
|
|
6037
|
-
const i = Ae(e, "user_id", "userId"), o =
|
|
6047
|
+
const i = Ae(e, "user_id", "userId"), o = xa(e.status);
|
|
6038
6048
|
if (!i || !o)
|
|
6039
6049
|
return null;
|
|
6040
6050
|
const c = {
|
|
@@ -6047,7 +6057,7 @@ function Ma(e, n) {
|
|
|
6047
6057
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
6048
6058
|
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6049
6059
|
}
|
|
6050
|
-
function
|
|
6060
|
+
function La(e) {
|
|
6051
6061
|
if (!se(e))
|
|
6052
6062
|
return null;
|
|
6053
6063
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
@@ -6068,7 +6078,7 @@ function xa(e) {
|
|
|
6068
6078
|
...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
|
|
6069
6079
|
};
|
|
6070
6080
|
}
|
|
6071
|
-
function
|
|
6081
|
+
function Ia(e) {
|
|
6072
6082
|
if (!se(e))
|
|
6073
6083
|
return null;
|
|
6074
6084
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
@@ -6087,7 +6097,7 @@ function ka(e) {
|
|
|
6087
6097
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6088
6098
|
};
|
|
6089
6099
|
}
|
|
6090
|
-
function
|
|
6100
|
+
function Ua(e) {
|
|
6091
6101
|
if (!se(e))
|
|
6092
6102
|
return null;
|
|
6093
6103
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
@@ -6098,31 +6108,31 @@ function La(e) {
|
|
|
6098
6108
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6099
6109
|
};
|
|
6100
6110
|
}
|
|
6101
|
-
function
|
|
6111
|
+
function Oa(e) {
|
|
6102
6112
|
return se(e) && le(e, "id") && le(e, "name");
|
|
6103
6113
|
}
|
|
6104
|
-
function
|
|
6105
|
-
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) =>
|
|
6114
|
+
function Fa(e) {
|
|
6115
|
+
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Oa(n));
|
|
6106
6116
|
}
|
|
6107
|
-
function
|
|
6117
|
+
function Na(e) {
|
|
6108
6118
|
return se(e) && se(e.message) && le(e.message, "id") && le(e.message, "conversation_id") && le(e.message, "author_id");
|
|
6109
6119
|
}
|
|
6110
|
-
function
|
|
6120
|
+
function Da(e) {
|
|
6111
6121
|
return se(e) && le(e, "conversation_id") && le(e, "user_id") && le(e, "message_id");
|
|
6112
6122
|
}
|
|
6113
|
-
function
|
|
6123
|
+
function qa(e) {
|
|
6114
6124
|
return se(e) && le(e, "conversation_id") && se(e.message) && le(e.message, "id");
|
|
6115
6125
|
}
|
|
6116
|
-
function
|
|
6126
|
+
function za(e) {
|
|
6117
6127
|
return se(e) && le(e, "conversation_id") && le(e, "message_id");
|
|
6118
6128
|
}
|
|
6119
|
-
function
|
|
6120
|
-
return se(e) && le(e, "conversation_id") && le(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) =>
|
|
6129
|
+
function ja(e) {
|
|
6130
|
+
return se(e) && le(e, "conversation_id") && le(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Fa(n));
|
|
6121
6131
|
}
|
|
6122
|
-
function
|
|
6132
|
+
function $a(e) {
|
|
6123
6133
|
return se(e) && le(e, "conversation_id");
|
|
6124
6134
|
}
|
|
6125
|
-
function
|
|
6135
|
+
function Ha(e) {
|
|
6126
6136
|
return se(e) && le(e, "conversation_id") && le(e, "removed_user_id");
|
|
6127
6137
|
}
|
|
6128
6138
|
function Oe(e, n, i, o) {
|
|
@@ -6131,29 +6141,29 @@ function Oe(e, n, i, o) {
|
|
|
6131
6141
|
};
|
|
6132
6142
|
return e.listen(n, c), c;
|
|
6133
6143
|
}
|
|
6134
|
-
function
|
|
6135
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ??
|
|
6136
|
-
typeof window < "u" && (window.Pusher =
|
|
6137
|
-
let d = null, g = null, h = null, x = null, M = "disconnected", _ = "available",
|
|
6138
|
-
const
|
|
6144
|
+
function oc(e) {
|
|
6145
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? _a, o = e.bootstrapRefreshSkewMs ?? Sa, c = e.presenceFreshnessTtlMs ?? wa, l = (e.createLogger ?? Kt())("MessengerEcho");
|
|
6146
|
+
typeof window < "u" && (window.Pusher = ya);
|
|
6147
|
+
let d = null, g = null, h = null, x = null, M = "disconnected", _ = "available", C = null, b = null;
|
|
6148
|
+
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (E) => {
|
|
6139
6149
|
M = E;
|
|
6140
|
-
for (const P of
|
|
6150
|
+
for (const P of T)
|
|
6141
6151
|
P(E);
|
|
6142
6152
|
}, v = (E) => {
|
|
6143
6153
|
_ = E;
|
|
6144
|
-
for (const P of
|
|
6154
|
+
for (const P of w)
|
|
6145
6155
|
P(E);
|
|
6146
6156
|
}, N = () => {
|
|
6147
|
-
|
|
6157
|
+
b !== null && (clearTimeout(b), b = null);
|
|
6148
6158
|
}, q = (E = !0) => {
|
|
6149
6159
|
h !== null && (h.disconnect(), h = null), x = null, E && m("disconnected");
|
|
6150
6160
|
}, G = () => {
|
|
6151
|
-
N(), d = null, g = null,
|
|
6161
|
+
N(), d = null, g = null, C = null, v("available"), q(), f.clear();
|
|
6152
6162
|
}, k = () => {
|
|
6153
6163
|
if (!e.getSourceToken)
|
|
6154
6164
|
return null;
|
|
6155
6165
|
const E = e.getSourceToken();
|
|
6156
|
-
return E === null ? (G(), null) : (
|
|
6166
|
+
return E === null ? (G(), null) : (C !== null && C !== E && (N(), d = null, g = null, v("available"), q()), C = E, E);
|
|
6157
6167
|
}, O = (E) => {
|
|
6158
6168
|
if (E === null)
|
|
6159
6169
|
return !1;
|
|
@@ -6168,7 +6178,7 @@ function rc(e) {
|
|
|
6168
6178
|
if (Number.isNaN(P))
|
|
6169
6179
|
return;
|
|
6170
6180
|
const D = Math.max(0, P - Date.now() - o);
|
|
6171
|
-
|
|
6181
|
+
b = setTimeout(() => {
|
|
6172
6182
|
J();
|
|
6173
6183
|
}, D);
|
|
6174
6184
|
}, F = async (E = !1) => e.getSourceToken && k() === null || !E && _ === "account_suspended" ? null : !E && O(d) ? d : !E && g !== null ? await g : (g = (async () => {
|
|
@@ -6176,10 +6186,10 @@ function rc(e) {
|
|
|
6176
6186
|
const D = await e.bootstrapClient.get(
|
|
6177
6187
|
i,
|
|
6178
6188
|
E ? { params: { refresh: 1 } } : void 0
|
|
6179
|
-
), X =
|
|
6189
|
+
), X = Ra(D.data);
|
|
6180
6190
|
return d = X, v("available"), H(X), X;
|
|
6181
6191
|
} catch (D) {
|
|
6182
|
-
if (
|
|
6192
|
+
if (Ma(D))
|
|
6183
6193
|
return d = null, N(), v("account_suspended"), q(), m("disconnected"), null;
|
|
6184
6194
|
throw D;
|
|
6185
6195
|
}
|
|
@@ -6230,7 +6240,7 @@ function rc(e) {
|
|
|
6230
6240
|
const X = D.service.reverb.scheme === "https", Y = {
|
|
6231
6241
|
broadcaster: "reverb",
|
|
6232
6242
|
key: D.service.reverb.appKey,
|
|
6233
|
-
wsHost:
|
|
6243
|
+
wsHost: Pa(D.service.reverb.host),
|
|
6234
6244
|
wsPort: D.service.reverb.port,
|
|
6235
6245
|
wssPort: D.service.reverb.port,
|
|
6236
6246
|
forceTLS: X,
|
|
@@ -6245,23 +6255,23 @@ function rc(e) {
|
|
|
6245
6255
|
}
|
|
6246
6256
|
}
|
|
6247
6257
|
};
|
|
6248
|
-
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new
|
|
6258
|
+
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new ga(Y), me(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6249
6259
|
})().finally(() => {
|
|
6250
6260
|
x = null;
|
|
6251
|
-
}), await x),
|
|
6252
|
-
timeout: e.requestTimeoutMs ??
|
|
6261
|
+
}), await x), y = $t.create({
|
|
6262
|
+
timeout: e.requestTimeoutMs ?? Ca,
|
|
6253
6263
|
withCredentials: !1,
|
|
6254
6264
|
headers: {
|
|
6255
6265
|
Accept: "application/json",
|
|
6256
6266
|
"X-Requested-With": "XMLHttpRequest"
|
|
6257
6267
|
}
|
|
6258
6268
|
});
|
|
6259
|
-
|
|
6269
|
+
y.interceptors.request.use(async (E) => {
|
|
6260
6270
|
const P = await F();
|
|
6261
6271
|
if (P === null)
|
|
6262
6272
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6263
|
-
return E.baseURL = P.service.apiBaseUrl,
|
|
6264
|
-
}),
|
|
6273
|
+
return E.baseURL = P.service.apiBaseUrl, Vn(E, P.auth.token), E;
|
|
6274
|
+
}), y.interceptors.response.use(
|
|
6265
6275
|
(E) => E,
|
|
6266
6276
|
async (E) => {
|
|
6267
6277
|
const P = E.config;
|
|
@@ -6269,19 +6279,19 @@ function rc(e) {
|
|
|
6269
6279
|
P._messengerRetry = !0;
|
|
6270
6280
|
const D = await F(!0);
|
|
6271
6281
|
if (D !== null)
|
|
6272
|
-
return P.baseURL = D.service.apiBaseUrl,
|
|
6282
|
+
return P.baseURL = D.service.apiBaseUrl, Vn(P, D.auth.token), await y(P);
|
|
6273
6283
|
}
|
|
6274
6284
|
return Promise.reject(E);
|
|
6275
6285
|
}
|
|
6276
6286
|
);
|
|
6277
6287
|
const I = () => _ === "account_suspended" ? null : (ee().catch((E) => {
|
|
6278
6288
|
l.warn("Failed to initialize messenger echo", E);
|
|
6279
|
-
}), h), ae = (E) => (
|
|
6289
|
+
}), h), ae = (E) => (T.add(E), E(M), () => {
|
|
6290
|
+
T.delete(E);
|
|
6291
|
+
}), B = (E) => (w.add(E), E(_), () => {
|
|
6280
6292
|
w.delete(E);
|
|
6281
|
-
}), B = (E) => (C.add(E), E(_), () => {
|
|
6282
|
-
C.delete(E);
|
|
6283
6293
|
}), A = () => d?.auth.tenantId ?? "global", V = (E) => {
|
|
6284
|
-
const P =
|
|
6294
|
+
const P = qt(E.ts)?.getTime() ?? qt(E.last_seen_at)?.getTime() ?? null;
|
|
6285
6295
|
if (P === null)
|
|
6286
6296
|
return !0;
|
|
6287
6297
|
const D = `${E.tenant_scope ?? "global"}:${E.user_id}`, X = f.get(D);
|
|
@@ -6311,7 +6321,7 @@ function rc(e) {
|
|
|
6311
6321
|
];
|
|
6312
6322
|
for (const Y of X)
|
|
6313
6323
|
D.listen(Y, (ge) => {
|
|
6314
|
-
const we =
|
|
6324
|
+
const we = ka(ge, A());
|
|
6315
6325
|
!we || !V(we) || E(we);
|
|
6316
6326
|
});
|
|
6317
6327
|
}, _e = () => {
|
|
@@ -6324,25 +6334,25 @@ function rc(e) {
|
|
|
6324
6334
|
const X = D.private(`conversation.${E}`), Y = [];
|
|
6325
6335
|
return P.onMessageSent && Y.push({
|
|
6326
6336
|
event: ".ConversationMessageSent",
|
|
6327
|
-
handler: Oe(X, ".ConversationMessageSent",
|
|
6337
|
+
handler: Oe(X, ".ConversationMessageSent", Na, P.onMessageSent)
|
|
6328
6338
|
}), P.onMessageRead && Y.push({
|
|
6329
6339
|
event: ".ConversationMessageRead",
|
|
6330
|
-
handler: Oe(X, ".ConversationMessageRead",
|
|
6340
|
+
handler: Oe(X, ".ConversationMessageRead", Da, P.onMessageRead)
|
|
6331
6341
|
}), P.onMessageEdited && Y.push({
|
|
6332
6342
|
event: ".ConversationMessageEdited",
|
|
6333
|
-
handler: Oe(X, ".ConversationMessageEdited",
|
|
6343
|
+
handler: Oe(X, ".ConversationMessageEdited", qa, P.onMessageEdited)
|
|
6334
6344
|
}), P.onMessageDeleted && Y.push({
|
|
6335
6345
|
event: ".ConversationMessageDeleted",
|
|
6336
|
-
handler: Oe(X, ".ConversationMessageDeleted",
|
|
6346
|
+
handler: Oe(X, ".ConversationMessageDeleted", za, P.onMessageDeleted)
|
|
6337
6347
|
}), P.onReactionToggled && Y.push({
|
|
6338
6348
|
event: ".MessageReactionToggled",
|
|
6339
|
-
handler: Oe(X, ".MessageReactionToggled",
|
|
6349
|
+
handler: Oe(X, ".MessageReactionToggled", ja, P.onReactionToggled)
|
|
6340
6350
|
}), P.onRequestAccepted && Y.push({
|
|
6341
6351
|
event: ".ConversationRequestAccepted",
|
|
6342
|
-
handler: Oe(X, ".ConversationRequestAccepted",
|
|
6352
|
+
handler: Oe(X, ".ConversationRequestAccepted", $a, P.onRequestAccepted)
|
|
6343
6353
|
}), P.onParticipantRemoved && Y.push({
|
|
6344
6354
|
event: ".ConversationParticipantRemoved",
|
|
6345
|
-
handler: Oe(X, ".ConversationParticipantRemoved",
|
|
6355
|
+
handler: Oe(X, ".ConversationParticipantRemoved", Ha, P.onParticipantRemoved)
|
|
6346
6356
|
}), () => {
|
|
6347
6357
|
if (typeof X.stopListening == "function")
|
|
6348
6358
|
for (const ge of Y)
|
|
@@ -6363,7 +6373,7 @@ function rc(e) {
|
|
|
6363
6373
|
], we = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], Ke = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Qe = /* @__PURE__ */ new Set(["start", "typing"]), ft = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6364
6374
|
for (const ye of ge) {
|
|
6365
6375
|
const Ce = (xe) => {
|
|
6366
|
-
const K =
|
|
6376
|
+
const K = La(xe);
|
|
6367
6377
|
if (K) {
|
|
6368
6378
|
if (Qe.has(K.state)) {
|
|
6369
6379
|
D.onTypingStart?.({
|
|
@@ -6388,7 +6398,7 @@ function rc(e) {
|
|
|
6388
6398
|
}
|
|
6389
6399
|
for (const ye of we) {
|
|
6390
6400
|
const Ce = (xe) => {
|
|
6391
|
-
const K =
|
|
6401
|
+
const K = Ia(xe);
|
|
6392
6402
|
if (!K)
|
|
6393
6403
|
return;
|
|
6394
6404
|
const qe = {
|
|
@@ -6407,7 +6417,7 @@ function rc(e) {
|
|
|
6407
6417
|
}
|
|
6408
6418
|
for (const ye of Ke) {
|
|
6409
6419
|
const Ce = (xe) => {
|
|
6410
|
-
const K =
|
|
6420
|
+
const K = Ua(xe);
|
|
6411
6421
|
if (!K)
|
|
6412
6422
|
return;
|
|
6413
6423
|
const qe = {
|
|
@@ -6442,7 +6452,7 @@ function rc(e) {
|
|
|
6442
6452
|
v("available"), q(), await ee(!0);
|
|
6443
6453
|
}, Je = async () => _ === "account_suspended" ? null : await ee();
|
|
6444
6454
|
return {
|
|
6445
|
-
apiClient:
|
|
6455
|
+
apiClient: y,
|
|
6446
6456
|
initializedEvent: n,
|
|
6447
6457
|
getEcho: I,
|
|
6448
6458
|
waitForEcho: Je,
|
|
@@ -6461,74 +6471,74 @@ function rc(e) {
|
|
|
6461
6471
|
};
|
|
6462
6472
|
}
|
|
6463
6473
|
export {
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6474
|
+
Lo as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6475
|
+
rc as configureMessengerClient,
|
|
6476
|
+
oc as createMessengerEcho,
|
|
6467
6477
|
W as getApi,
|
|
6468
6478
|
Fe as getAuthStore,
|
|
6469
|
-
|
|
6479
|
+
Tn as getConnectionStatus,
|
|
6470
6480
|
Pe as getEcho,
|
|
6471
|
-
|
|
6481
|
+
ss as getEchoConnectionStatus,
|
|
6472
6482
|
We as getEchoInitializedEvent,
|
|
6473
6483
|
Z as getErrorMessage,
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6484
|
+
Kt as getLoggerFactory,
|
|
6485
|
+
ps as getMainApi,
|
|
6486
|
+
yo as getMainEcho,
|
|
6487
|
+
_o as getMainEchoConnectionStatus,
|
|
6488
|
+
bo as getMainEchoInitializedEvent,
|
|
6489
|
+
Vi as getMediaApi,
|
|
6490
|
+
Ft as getMessagingAccessState,
|
|
6491
|
+
Ho as getPresenceRuntimeConfig,
|
|
6492
|
+
Xo as hasConfiguredPresenceAuthTokenResolver,
|
|
6493
|
+
Qa as hasResponse,
|
|
6494
|
+
uc as isAxiosError,
|
|
6495
|
+
Ka as isError,
|
|
6496
|
+
Di as isValidMessageDeletedEvent,
|
|
6497
|
+
Ni as isValidMessageEditedEvent,
|
|
6498
|
+
Fi as isValidMessageReadEvent,
|
|
6499
|
+
Oi as isValidMessageSentEvent,
|
|
6500
|
+
qi as isValidReactionToggledEvent,
|
|
6501
|
+
zi as isValidRequestAcceptedEvent,
|
|
6492
6502
|
Re as messagingApi,
|
|
6493
|
-
|
|
6494
|
-
|
|
6503
|
+
Uo as normalizePresenceStatus,
|
|
6504
|
+
gs as normalizePresenceTimestamp,
|
|
6495
6505
|
ht as onConnectionStatusChange,
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6506
|
+
So as onMainEchoConnectionStatusChange,
|
|
6507
|
+
Ei as onMessagingAccessStateChange,
|
|
6508
|
+
qt as parsePresenceTimestamp,
|
|
6509
|
+
Ai as reconnectEcho,
|
|
6510
|
+
Co as reconnectMainEcho,
|
|
6511
|
+
Ui as resetEchoRuntimeConfig,
|
|
6512
|
+
Ro as resetLoggerFactory,
|
|
6513
|
+
ko as resetMainApiClient,
|
|
6514
|
+
To as resetMainEchoRuntimeConfig,
|
|
6515
|
+
$i as resetMessagingApiClient,
|
|
6516
|
+
Bi as resetMessagingAuthStoreResolver,
|
|
6517
|
+
Wi as resetMessagingMediaApi,
|
|
6518
|
+
ic as resetMessengerClientConfig,
|
|
6519
|
+
Vo as resetPresenceRuntimeConfig,
|
|
6520
|
+
Oo as resolveFreshPresenceStatus,
|
|
6521
|
+
$n as resolvePresenceSnapshot,
|
|
6522
|
+
Ii as setEchoRuntimeConfig,
|
|
6523
|
+
Ao as setLoggerFactory,
|
|
6524
|
+
xo as setMainApiClient,
|
|
6525
|
+
wo as setMainEchoRuntimeConfig,
|
|
6526
|
+
ji as setMessagingApiClient,
|
|
6527
|
+
Hi as setMessagingAuthStoreResolver,
|
|
6528
|
+
Xi as setMessagingMediaApi,
|
|
6529
|
+
Bo as setPresenceRuntimeConfig,
|
|
6530
|
+
Mi as subscribeToConversation,
|
|
6531
|
+
Ri as subscribeToPresenceStatus,
|
|
6532
|
+
ki as subscribeToTyping,
|
|
6533
|
+
xi as unsubscribeFromConversation,
|
|
6534
|
+
Pi as unsubscribeFromPresenceStatus,
|
|
6535
|
+
Li as unsubscribeFromTyping,
|
|
6536
|
+
Za as useConnectionStatus,
|
|
6537
|
+
Ya as useConversationChannel,
|
|
6538
|
+
ec as useGlobalMessaging,
|
|
6539
|
+
tc as useMessagingAccessState,
|
|
6540
|
+
Gt as useMessagingStore,
|
|
6541
|
+
nc as usePresence,
|
|
6542
|
+
sc as useTypingChannel,
|
|
6543
|
+
Ti as waitForEcho
|
|
6534
6544
|
};
|