@codingfactory/messenger-client 0.2.13 → 0.2.15
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 +1168 -1149
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as ve, getCurrentInstance as qt, computed as ie, watch as Ut, onUnmounted as De, toValue as Bn, onMounted as zt } from "vue";
|
|
2
2
|
import { defineStore as bi, storeToRefs as yi } from "pinia";
|
|
3
|
-
import
|
|
3
|
+
import jt, { isAxiosError as _i, AxiosHeaders as Cn } from "axios";
|
|
4
4
|
import { isAxiosError as ic } from "axios";
|
|
5
5
|
import { useRoute as Si } from "vue-router";
|
|
6
|
-
const
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
}, Wn = () => {
|
|
6
|
+
const Vn = () => () => {
|
|
7
|
+
}, Xn = () => () => {
|
|
8
|
+
}, Wn = async () => {
|
|
10
9
|
}, Gn = () => {
|
|
11
10
|
}, Jn = () => {
|
|
12
11
|
}, Kn = () => {
|
|
13
12
|
}, Qn = () => {
|
|
14
|
-
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
13
|
}, Yn = () => {
|
|
14
|
+
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
|
+
}, Zn = () => {
|
|
16
16
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
17
|
-
},
|
|
17
|
+
}, es = async () => null, $ = {
|
|
18
18
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
19
19
|
getEcho: () => null,
|
|
20
|
-
waitForEcho:
|
|
20
|
+
waitForEcho: es,
|
|
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(), Ci = async () => $.waitForEcho(),
|
|
23
|
+
onConnectionStatusChange: Vn,
|
|
24
|
+
onAccessStateChange: Xn,
|
|
25
|
+
reconnect: Wn,
|
|
26
|
+
subscribeToPresenceStatus: Gn,
|
|
27
|
+
unsubscribeFromPresenceStatus: Jn,
|
|
28
|
+
subscribeToConversation: Yn,
|
|
29
|
+
unsubscribeFromConversation: Kn,
|
|
30
|
+
subscribeToTyping: Zn,
|
|
31
|
+
unsubscribeFromTyping: Qn
|
|
32
|
+
}, We = () => $.ECHO_INITIALIZED_EVENT, Pe = () => $.getEcho(), Ci = async () => $.waitForEcho(), ts = () => $.getConnectionStatus(), wn = () => ts(), Ot = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), wi = (e) => $.onAccessStateChange(e), Ti = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
34
|
}, Ei = (e) => $.subscribeToPresenceStatus(e), Ai = () => $.unsubscribeFromPresenceStatus(), Ri = (e, n) => $.subscribeToConversation(e, n), Pi = (e) => $.unsubscribeFromConversation(e), Mi = (e, n) => $.subscribeToTyping(e, n), xi = (e) => $.unsubscribeFromTyping(e);
|
|
35
35
|
function ki(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
38
|
function Li() {
|
|
39
|
-
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho =
|
|
39
|
+
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = es, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = Vn, $.onAccessStateChange = Xn, $.reconnect = Wn, $.subscribeToPresenceStatus = Gn, $.unsubscribeFromPresenceStatus = Jn, $.subscribeToConversation = Yn, $.unsubscribeFromConversation = Kn, $.subscribeToTyping = Zn, $.unsubscribeFromTyping = Qn;
|
|
40
40
|
}
|
|
41
41
|
function Me(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
@@ -59,31 +59,31 @@ function Ni(e) {
|
|
|
59
59
|
function Di(e) {
|
|
60
60
|
return Me(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let
|
|
64
|
-
function
|
|
65
|
-
return
|
|
62
|
+
const ns = jt;
|
|
63
|
+
let $t = ns;
|
|
64
|
+
function W() {
|
|
65
|
+
return $t;
|
|
66
66
|
}
|
|
67
67
|
function qi(e) {
|
|
68
|
-
|
|
68
|
+
$t = e;
|
|
69
69
|
}
|
|
70
70
|
function zi() {
|
|
71
|
-
|
|
71
|
+
$t = ns;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const ss = {
|
|
74
74
|
currentUser: null
|
|
75
75
|
};
|
|
76
|
-
let
|
|
76
|
+
let Ht = () => ss;
|
|
77
77
|
function Fe() {
|
|
78
|
-
return
|
|
78
|
+
return Ht;
|
|
79
79
|
}
|
|
80
80
|
function ji(e) {
|
|
81
|
-
|
|
81
|
+
Ht = e;
|
|
82
82
|
}
|
|
83
83
|
function $i() {
|
|
84
|
-
|
|
84
|
+
Ht = () => ss;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function Z(e) {
|
|
87
87
|
if (_i(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;
|
|
@@ -96,37 +96,37 @@ function Xa(e) {
|
|
|
96
96
|
function Wa(e) {
|
|
97
97
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const rs = {
|
|
100
100
|
async uploadImage() {
|
|
101
101
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
let
|
|
104
|
+
let Bt = rs;
|
|
105
105
|
function Hi() {
|
|
106
|
-
return
|
|
106
|
+
return Bt;
|
|
107
107
|
}
|
|
108
108
|
function Bi(e) {
|
|
109
|
-
|
|
109
|
+
Bt = e;
|
|
110
110
|
}
|
|
111
111
|
function Vi() {
|
|
112
|
-
|
|
112
|
+
Bt = rs;
|
|
113
113
|
}
|
|
114
114
|
function Xi(e) {
|
|
115
115
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function is(e) {
|
|
118
118
|
return typeof e == "object" && e !== null;
|
|
119
119
|
}
|
|
120
120
|
function $e(e) {
|
|
121
|
-
return !
|
|
121
|
+
return !is(e) || !("data" in e) ? e : e.data;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function st(e, n) {
|
|
124
124
|
const i = e[n];
|
|
125
125
|
if (typeof i != "string")
|
|
126
126
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
127
127
|
return i;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Tn(e, n) {
|
|
130
130
|
const i = e[n];
|
|
131
131
|
if (i == null)
|
|
132
132
|
return null;
|
|
@@ -134,7 +134,7 @@ function wn(e, n) {
|
|
|
134
134
|
throw new Error(`Invalid messaging folder payload: ${n} must be a string or null`);
|
|
135
135
|
return i;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function Rt(e, n) {
|
|
138
138
|
const i = e[n];
|
|
139
139
|
if (typeof i == "number" && Number.isFinite(i))
|
|
140
140
|
return i;
|
|
@@ -145,64 +145,64 @@ function At(e, n) {
|
|
|
145
145
|
}
|
|
146
146
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
if (!
|
|
148
|
+
function Ft(e) {
|
|
149
|
+
if (!is(e))
|
|
150
150
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
151
151
|
return {
|
|
152
|
-
id:
|
|
153
|
-
name:
|
|
154
|
-
color:
|
|
155
|
-
icon:
|
|
156
|
-
sort_order:
|
|
157
|
-
conversation_count:
|
|
158
|
-
unread_count:
|
|
159
|
-
created_at:
|
|
160
|
-
updated_at:
|
|
152
|
+
id: st(e, "id"),
|
|
153
|
+
name: st(e, "name"),
|
|
154
|
+
color: Tn(e, "color"),
|
|
155
|
+
icon: Tn(e, "icon"),
|
|
156
|
+
sort_order: Rt(e, "sort_order"),
|
|
157
|
+
conversation_count: Rt(e, "conversation_count"),
|
|
158
|
+
unread_count: Rt(e, "unread_count"),
|
|
159
|
+
created_at: st(e, "created_at"),
|
|
160
|
+
updated_at: st(e, "updated_at")
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
function Wi(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) => Ft(n));
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function En(e) {
|
|
169
169
|
if (!Xi(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
|
-
const e = await
|
|
175
|
+
const e = await W().get("/v1/messaging/folders");
|
|
176
176
|
return Wi($e(e.data));
|
|
177
177
|
},
|
|
178
178
|
async createFolder(e) {
|
|
179
|
-
const n = await
|
|
180
|
-
return
|
|
179
|
+
const n = await W().post("/v1/messaging/folders", e);
|
|
180
|
+
return Ft($e(n.data));
|
|
181
181
|
},
|
|
182
182
|
async updateFolder(e, n) {
|
|
183
|
-
const i = await
|
|
184
|
-
return
|
|
183
|
+
const i = await W().patch(`/v1/messaging/folders/${e}`, n);
|
|
184
|
+
return Ft($e(i.data));
|
|
185
185
|
},
|
|
186
186
|
async deleteFolder(e) {
|
|
187
|
-
await
|
|
187
|
+
await W().delete(`/v1/messaging/folders/${e}`);
|
|
188
188
|
},
|
|
189
189
|
async reorderFolders(e) {
|
|
190
|
-
await
|
|
190
|
+
await W().patch("/v1/messaging/folders/reorder", { order: e });
|
|
191
191
|
},
|
|
192
192
|
async assignFolder(e, n) {
|
|
193
|
-
const i = await
|
|
193
|
+
const i = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
194
194
|
folder_id: n
|
|
195
195
|
});
|
|
196
|
-
return
|
|
196
|
+
return En($e(i.data));
|
|
197
197
|
},
|
|
198
198
|
async acceptRequest(e) {
|
|
199
|
-
const n = await
|
|
200
|
-
return
|
|
199
|
+
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
200
|
+
return En($e(n.data));
|
|
201
201
|
},
|
|
202
202
|
async declineRequest(e) {
|
|
203
|
-
await
|
|
203
|
+
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
204
204
|
}
|
|
205
|
-
},
|
|
205
|
+
}, An = 1e3, Vt = 4e3, Gi = 12e4, Ji = 300, Ki = 1, Qi = 1600, Xt = (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
|
+
}, os = (e) => typeof e == "number" && e >= 500 && e < 600, Rn = (e) => {
|
|
214
|
+
const i = Xt(e.response?.status);
|
|
215
|
+
return i === void 0 ? !0 : i === 429 || os(i);
|
|
216
|
+
}, as = (e) => {
|
|
217
217
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
218
|
-
return Math.max(
|
|
218
|
+
return Math.max(An, 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(An, n * 1e3);
|
|
223
223
|
}
|
|
224
|
-
return
|
|
224
|
+
return Vt;
|
|
225
225
|
}, Yi = (e) => {
|
|
226
|
-
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o =
|
|
226
|
+
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Vt * i;
|
|
227
227
|
return Math.min(Gi, o);
|
|
228
228
|
}, Zi = (e) => {
|
|
229
229
|
const n = e;
|
|
230
|
-
return
|
|
231
|
-
},
|
|
230
|
+
return Xt(n.response?.status) === 429 ? as(n.response?.headers?.["retry-after"]) : Ji;
|
|
231
|
+
}, Pn = async (e) => {
|
|
232
232
|
await new Promise((n) => {
|
|
233
233
|
setTimeout(n, e);
|
|
234
234
|
});
|
|
235
|
-
},
|
|
235
|
+
}, Mn = () => ({
|
|
236
236
|
data: [],
|
|
237
237
|
has_more: !1
|
|
238
|
-
}),
|
|
238
|
+
}), xn = () => Ot() === "account_suspended", eo = (e) => {
|
|
239
239
|
if (!he(e))
|
|
240
240
|
return !1;
|
|
241
241
|
const i = (he(e.data) ? e.data : e).throttled;
|
|
@@ -281,7 +281,7 @@ function so(e) {
|
|
|
281
281
|
function ro(e) {
|
|
282
282
|
return !Array.isArray(e) || e.length === 0 ? [] : e.map(no);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function ut(e) {
|
|
285
285
|
if (typeof e != "string")
|
|
286
286
|
return;
|
|
287
287
|
const n = e.trim();
|
|
@@ -291,7 +291,7 @@ function ct(e) {
|
|
|
291
291
|
function io(e) {
|
|
292
292
|
if (!e)
|
|
293
293
|
return;
|
|
294
|
-
const n =
|
|
294
|
+
const n = ut(e.avatar) ?? ut(e.avatar_url), i = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
295
295
|
return {
|
|
296
296
|
id: e.id ?? "",
|
|
297
297
|
name: e.name ?? "",
|
|
@@ -299,7 +299,7 @@ function io(e) {
|
|
|
299
299
|
...i ? { handle: i } : {}
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function at(e) {
|
|
303
303
|
const n = e.shared_post, i = e.author, o = n && typeof n == "object" ? {
|
|
304
304
|
id: n.id ?? "",
|
|
305
305
|
title: n.title ?? "",
|
|
@@ -326,7 +326,7 @@ function oo(e) {
|
|
|
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() : "";
|
|
327
327
|
if (n.length === 0 || i.length === 0 || o.length === 0)
|
|
328
328
|
return;
|
|
329
|
-
const u = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, d = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, l = he(e.author) ? e.author : null, g = l && typeof l.id == "string" ? l.id.trim() : "", h = l && typeof l.name == "string" ? l.name.trim() : "",
|
|
329
|
+
const u = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, d = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, l = he(e.author) ? e.author : null, g = l && typeof l.id == "string" ? l.id.trim() : "", h = l && typeof l.name == "string" ? l.name.trim() : "", x = l && typeof l.avatar == "string" && l.avatar.trim().length > 0 ? l.avatar.trim() : null, M = l && typeof l.handle == "string" && l.handle.trim().length > 0 ? l.handle.trim() : null;
|
|
330
330
|
return {
|
|
331
331
|
id: n,
|
|
332
332
|
title: i,
|
|
@@ -337,8 +337,8 @@ function oo(e) {
|
|
|
337
337
|
author: {
|
|
338
338
|
id: g,
|
|
339
339
|
name: h,
|
|
340
|
-
...
|
|
341
|
-
...
|
|
340
|
+
...x ? { avatar: x } : {},
|
|
341
|
+
...M ? { handle: M } : {}
|
|
342
342
|
}
|
|
343
343
|
} : {}
|
|
344
344
|
};
|
|
@@ -346,26 +346,26 @@ function oo(e) {
|
|
|
346
346
|
function ao(e) {
|
|
347
347
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function kn(e) {
|
|
350
350
|
if (!(typeof e != "string" || e.length === 0))
|
|
351
351
|
return e;
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Nt(e) {
|
|
354
354
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
355
355
|
}
|
|
356
356
|
function co(e, n = []) {
|
|
357
357
|
const i = /* @__PURE__ */ new Map();
|
|
358
358
|
for (const o of n) {
|
|
359
|
-
const u =
|
|
359
|
+
const u = kn(o.last_read_message_id);
|
|
360
360
|
u && i.set(o.user_id, u);
|
|
361
361
|
}
|
|
362
362
|
return e.map((o) => {
|
|
363
|
-
const u = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), d =
|
|
363
|
+
const u = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), d = ut(o.user?.avatar) ?? ut(o.user?.avatar_url), l = o.user ? {
|
|
364
364
|
id: o.user.id,
|
|
365
365
|
name: o.user.name,
|
|
366
366
|
...d ? { avatar: d } : {},
|
|
367
367
|
...o.user.handle ? { handle: o.user.handle } : {}
|
|
368
|
-
} : void 0, g =
|
|
368
|
+
} : void 0, g = kn(o.last_read_message_id);
|
|
369
369
|
if (g)
|
|
370
370
|
return {
|
|
371
371
|
...o,
|
|
@@ -391,7 +391,7 @@ function co(e, n = []) {
|
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
function He(e, n) {
|
|
394
|
-
const i = ao(e.muted_until), o = e.is_muted ?? i !== null, u = e.last_message ?
|
|
394
|
+
const i = ao(e.muted_until), o = e.is_muted ?? i !== null, u = e.last_message ? at(e.last_message) : n?.last_message, d = e.last_message_at ?? n?.last_message_at, l = (() => {
|
|
395
395
|
if (!n || n.unread_count !== 0 || e.unread_count <= 0)
|
|
396
396
|
return !1;
|
|
397
397
|
const g = n.last_message?.id, h = e.last_message?.id;
|
|
@@ -410,18 +410,18 @@ function He(e, n) {
|
|
|
410
410
|
function uo(e) {
|
|
411
411
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function Pt(e) {
|
|
414
414
|
return uo(e) ? 0 : e.unread_count || 0;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function Ln(e, n) {
|
|
417
417
|
const i = n[e.id];
|
|
418
418
|
if (Array.isArray(i))
|
|
419
419
|
for (let o = i.length - 1; o >= 0; o -= 1) {
|
|
420
420
|
const u = i[o]?.id;
|
|
421
|
-
if (
|
|
421
|
+
if (Nt(u))
|
|
422
422
|
return u;
|
|
423
423
|
}
|
|
424
|
-
return
|
|
424
|
+
return Nt(e.last_message?.id) ? e.last_message.id : null;
|
|
425
425
|
}
|
|
426
426
|
function he(e) {
|
|
427
427
|
return typeof e == "object" && e !== null;
|
|
@@ -429,7 +429,7 @@ function he(e) {
|
|
|
429
429
|
function lo(e) {
|
|
430
430
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function In(e) {
|
|
433
433
|
if (!Array.isArray(e))
|
|
434
434
|
return [];
|
|
435
435
|
const n = [];
|
|
@@ -455,7 +455,7 @@ function ho(e, n) {
|
|
|
455
455
|
if (!(typeof o != "string" || o.length === 0))
|
|
456
456
|
return o;
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function rt(e, n) {
|
|
459
459
|
const i = he(e) ? e : {}, o = i.data ?? e;
|
|
460
460
|
let u = [];
|
|
461
461
|
return Array.isArray(o) ? u = o : he(o) && (Array.isArray(o.items) ? u = o.items : Array.isArray(o[n]) ? u = o[n] : Array.isArray(o.data) && (u = o.data)), {
|
|
@@ -463,19 +463,19 @@ function st(e, n) {
|
|
|
463
463
|
nextCursor: ho(i, o)
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function Un(e) {
|
|
467
467
|
return he(e) && typeof e.id == "string" && e.id.length > 0;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function On(e) {
|
|
470
470
|
return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function ct(e, n) {
|
|
473
473
|
if (e.is_pinned !== n.is_pinned)
|
|
474
474
|
return e.is_pinned ? -1 : 1;
|
|
475
475
|
const i = e.last_message_at ?? e.created_at, u = (n.last_message_at ?? n.created_at).localeCompare(i);
|
|
476
476
|
return u !== 0 ? u : e.id.localeCompare(n.id);
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function it(e, n) {
|
|
479
479
|
return [n, ...e.filter((i) => i.id !== n.id)];
|
|
480
480
|
}
|
|
481
481
|
function Be(e) {
|
|
@@ -484,7 +484,7 @@ function Be(e) {
|
|
|
484
484
|
function fo(e, n) {
|
|
485
485
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Fn(e, n) {
|
|
488
488
|
return e.map((i) => {
|
|
489
489
|
const o = fo(i.folder_id, n);
|
|
490
490
|
return (i.folder_id ?? null) === o ? i : {
|
|
@@ -493,15 +493,15 @@ function On(e, n) {
|
|
|
493
493
|
};
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Mt(e) {
|
|
497
497
|
const n = /* @__PURE__ */ new Map();
|
|
498
498
|
for (const i of e.requests)
|
|
499
499
|
i.is_request === !0 && n.set(i.id, i);
|
|
500
500
|
for (const i of e.conversations)
|
|
501
501
|
i.is_request === !0 && n.set(i.id, i);
|
|
502
|
-
return Array.from(n.values()).sort(
|
|
502
|
+
return Array.from(n.values()).sort(ct);
|
|
503
503
|
}
|
|
504
|
-
const
|
|
504
|
+
const Wt = bi("messaging", {
|
|
505
505
|
state: () => ({
|
|
506
506
|
conversations: [],
|
|
507
507
|
requests: [],
|
|
@@ -528,32 +528,32 @@ const Xt = bi("messaging", {
|
|
|
528
528
|
getConversationById: (e) => (n) => e.conversations.find((i) => i.id === n),
|
|
529
529
|
getMessagesByConversationId: (e) => (n) => e.messages[n] || [],
|
|
530
530
|
getTypingUsers: (e) => (n) => e.typingUsers[n] || [],
|
|
531
|
-
unreadConversationsCount: (e) => e.conversations.filter((n) =>
|
|
532
|
-
unreadCount: (e) => e.conversations.reduce((n, i) => n +
|
|
533
|
-
totalUnreadCount: (e) => e.conversations.reduce((n, i) => n +
|
|
531
|
+
unreadConversationsCount: (e) => e.conversations.filter((n) => Pt(n) > 0).length,
|
|
532
|
+
unreadCount: (e) => e.conversations.reduce((n, i) => n + Pt(i), 0),
|
|
533
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, i) => n + Pt(i), 0),
|
|
534
534
|
sortedFolders: (e) => Be(e.folders),
|
|
535
535
|
folderById: (e) => (n) => e.folders.find((i) => i.id === n),
|
|
536
536
|
conversationsInFolder: (e) => (n) => e.conversations.filter((i) => i.folder_id === n),
|
|
537
537
|
hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
|
|
538
538
|
isLoadingMessages: (e) => (n) => e.loadingMessages[n] ?? !1,
|
|
539
539
|
// Message request getters
|
|
540
|
-
requestConversations: (e) =>
|
|
541
|
-
requestCount: (e) =>
|
|
542
|
-
unreadRequestCount: (e) =>
|
|
540
|
+
requestConversations: (e) => Mt(e),
|
|
541
|
+
requestCount: (e) => Mt(e).length,
|
|
542
|
+
unreadRequestCount: (e) => Mt(e).filter((n) => n.unread_count > 0).length
|
|
543
543
|
},
|
|
544
544
|
actions: {
|
|
545
545
|
normalizeFolderAssignmentsState() {
|
|
546
546
|
if (!this.foldersLoaded)
|
|
547
547
|
return;
|
|
548
548
|
const e = new Set(this.folders.map((n) => n.id));
|
|
549
|
-
this.conversations =
|
|
549
|
+
this.conversations = Fn(this.conversations, e), this.requests = Fn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
|
|
550
550
|
},
|
|
551
551
|
async fetchFolders() {
|
|
552
552
|
try {
|
|
553
553
|
const e = await Re.fetchFolders();
|
|
554
554
|
return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
555
555
|
} catch (e) {
|
|
556
|
-
throw this.error =
|
|
556
|
+
throw this.error = Z(e), e;
|
|
557
557
|
}
|
|
558
558
|
},
|
|
559
559
|
async createFolder(e) {
|
|
@@ -561,7 +561,7 @@ const Xt = bi("messaging", {
|
|
|
561
561
|
const n = await Re.createFolder(e);
|
|
562
562
|
return this.folders = Be([...this.folders, n]), n;
|
|
563
563
|
} catch (n) {
|
|
564
|
-
throw this.error =
|
|
564
|
+
throw this.error = Z(n), n;
|
|
565
565
|
}
|
|
566
566
|
},
|
|
567
567
|
async updateFolder(e, n) {
|
|
@@ -571,14 +571,14 @@ const Xt = bi("messaging", {
|
|
|
571
571
|
this.folders.map((o) => o.id === e ? i : o)
|
|
572
572
|
), i;
|
|
573
573
|
} catch (i) {
|
|
574
|
-
throw this.error =
|
|
574
|
+
throw this.error = Z(i), i;
|
|
575
575
|
}
|
|
576
576
|
},
|
|
577
577
|
async deleteFolder(e) {
|
|
578
578
|
try {
|
|
579
579
|
await Re.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
580
580
|
} catch (n) {
|
|
581
|
-
throw this.error =
|
|
581
|
+
throw this.error = Z(n), n;
|
|
582
582
|
}
|
|
583
583
|
},
|
|
584
584
|
async reorderFolders(e) {
|
|
@@ -600,7 +600,7 @@ const Xt = bi("messaging", {
|
|
|
600
600
|
});
|
|
601
601
|
this.folders = i;
|
|
602
602
|
} catch (n) {
|
|
603
|
-
throw this.error =
|
|
603
|
+
throw this.error = Z(n), n;
|
|
604
604
|
}
|
|
605
605
|
},
|
|
606
606
|
async assignToFolder(e, n) {
|
|
@@ -617,33 +617,33 @@ const Xt = bi("messaging", {
|
|
|
617
617
|
folder_id: d
|
|
618
618
|
};
|
|
619
619
|
} catch (i) {
|
|
620
|
-
throw this.error =
|
|
620
|
+
throw this.error = Z(i), i;
|
|
621
621
|
}
|
|
622
622
|
},
|
|
623
623
|
async fetchConversations(e, n, i, o) {
|
|
624
624
|
this.loading = !0, this.error = null;
|
|
625
625
|
try {
|
|
626
|
-
if (
|
|
627
|
-
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()),
|
|
626
|
+
if (xn())
|
|
627
|
+
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), Mn();
|
|
628
628
|
const u = o?.includePresence ?? !0, d = {};
|
|
629
629
|
u && (d.include_presence = 1), e && (d.cursor = e), n && (d.filter = n), typeof i == "string" && i.length > 0 && (d.folder_id = i);
|
|
630
|
-
const l = await
|
|
630
|
+
const l = await W().get("/v1/messaging/conversations", { params: d }), { items: g, nextCursor: h } = rt(
|
|
631
631
|
l.data,
|
|
632
632
|
"conversations"
|
|
633
|
-
),
|
|
633
|
+
), x = g.map((_) => {
|
|
634
634
|
const T = this.conversations.find(
|
|
635
635
|
(y) => y.id === _.id
|
|
636
636
|
);
|
|
637
637
|
return He(_, T);
|
|
638
638
|
});
|
|
639
|
-
e ? this.conversations.push(...
|
|
640
|
-
const
|
|
641
|
-
data:
|
|
639
|
+
e ? this.conversations.push(...x) : this.conversations = x, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
640
|
+
const M = {
|
|
641
|
+
data: x,
|
|
642
642
|
has_more: !!h
|
|
643
643
|
};
|
|
644
|
-
return h !== void 0 && (
|
|
644
|
+
return h !== void 0 && (M.next_cursor = h), M;
|
|
645
645
|
} catch (u) {
|
|
646
|
-
throw o?.background &&
|
|
646
|
+
throw o?.background && Rn(u) || (this.error = Z(u)), u;
|
|
647
647
|
} finally {
|
|
648
648
|
this.loading = !1;
|
|
649
649
|
}
|
|
@@ -657,21 +657,21 @@ const Xt = bi("messaging", {
|
|
|
657
657
|
includePresence: !1
|
|
658
658
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
659
659
|
} catch (e) {
|
|
660
|
-
const n = e, i =
|
|
661
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
660
|
+
const n = e, i = Xt(n.response?.status);
|
|
661
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + as(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || os(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Yi(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Vt, !1));
|
|
662
662
|
}
|
|
663
663
|
},
|
|
664
664
|
async fetchConversation(e) {
|
|
665
665
|
this.loading = !0, this.error = null;
|
|
666
666
|
try {
|
|
667
|
-
const n = await
|
|
667
|
+
const n = await W().get(`/v1/messaging/conversations/${e}`, {
|
|
668
668
|
params: { include_presence: 1 }
|
|
669
669
|
}), i = this.conversations.find((l) => l.id === e), o = He(n.data.data || n.data, i), u = this.conversations.findIndex((l) => l.id === e);
|
|
670
670
|
u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
|
|
671
671
|
const d = this.requests.findIndex((l) => l.id === e);
|
|
672
672
|
return d >= 0 && (this.requests[d] = o), this.normalizeFolderAssignmentsState(), o;
|
|
673
673
|
} catch (n) {
|
|
674
|
-
throw this.error =
|
|
674
|
+
throw this.error = Z(n), n;
|
|
675
675
|
} finally {
|
|
676
676
|
this.loading = !1;
|
|
677
677
|
}
|
|
@@ -679,18 +679,18 @@ const Xt = bi("messaging", {
|
|
|
679
679
|
async fetchRequests(e) {
|
|
680
680
|
this.loading = !0, this.error = null;
|
|
681
681
|
try {
|
|
682
|
-
if (
|
|
683
|
-
return e || (this.requests = [], this.normalizeFolderAssignmentsState()),
|
|
682
|
+
if (xn())
|
|
683
|
+
return e || (this.requests = [], this.normalizeFolderAssignmentsState()), Mn();
|
|
684
684
|
const n = {
|
|
685
685
|
include_presence: 1,
|
|
686
686
|
filter: "requests"
|
|
687
687
|
};
|
|
688
688
|
e && (n.cursor = e);
|
|
689
|
-
const i = await
|
|
689
|
+
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } = rt(
|
|
690
690
|
i.data,
|
|
691
691
|
"conversations"
|
|
692
692
|
), d = o.map((g) => {
|
|
693
|
-
const h = this.requests.find((
|
|
693
|
+
const h = this.requests.find((x) => x.id === g.id);
|
|
694
694
|
return He(g, h);
|
|
695
695
|
});
|
|
696
696
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
@@ -700,7 +700,7 @@ const Xt = bi("messaging", {
|
|
|
700
700
|
};
|
|
701
701
|
return u !== void 0 && (l.next_cursor = u), l;
|
|
702
702
|
} catch (n) {
|
|
703
|
-
throw this.error =
|
|
703
|
+
throw this.error = Z(n), n;
|
|
704
704
|
} finally {
|
|
705
705
|
this.loading = !1;
|
|
706
706
|
}
|
|
@@ -712,17 +712,17 @@ const Xt = bi("messaging", {
|
|
|
712
712
|
let o = 0, u;
|
|
713
713
|
for (; ; )
|
|
714
714
|
try {
|
|
715
|
-
u = await
|
|
715
|
+
u = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
716
716
|
break;
|
|
717
717
|
} catch (_) {
|
|
718
|
-
if (!(o < Ki &&
|
|
718
|
+
if (!(o < Ki && Rn(_)))
|
|
719
719
|
throw _;
|
|
720
|
-
o += 1, await
|
|
720
|
+
o += 1, await Pn(Zi(_));
|
|
721
721
|
}
|
|
722
|
-
const { items: d, nextCursor: l } =
|
|
722
|
+
const { items: d, nextCursor: l } = rt(
|
|
723
723
|
u.data,
|
|
724
724
|
"messages"
|
|
725
|
-
), g = d.map(
|
|
725
|
+
), g = d.map(at), h = [...g].reverse();
|
|
726
726
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
727
727
|
const _ = this.conversations.find((T) => T.id === e) ?? this.requests.find((T) => T.id === e);
|
|
728
728
|
return _ ? !_.last_message || !_.last_message_at : !1;
|
|
@@ -731,26 +731,26 @@ const Xt = bi("messaging", {
|
|
|
731
731
|
_ && this.updateConversationLastMessage(e, _);
|
|
732
732
|
}
|
|
733
733
|
l ? (this.conversationCursors[e] = l, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
734
|
-
const
|
|
734
|
+
const M = {
|
|
735
735
|
data: g,
|
|
736
736
|
has_more: !!l
|
|
737
737
|
};
|
|
738
|
-
return l !== void 0 && (
|
|
738
|
+
return l !== void 0 && (M.next_cursor = l), M;
|
|
739
739
|
} catch (i) {
|
|
740
|
-
throw this.error =
|
|
740
|
+
throw this.error = Z(i), i;
|
|
741
741
|
} finally {
|
|
742
742
|
this.loadingMessages[e] = !1, this.loading = !1;
|
|
743
743
|
}
|
|
744
744
|
},
|
|
745
745
|
async sendMessage(e, n, i, o, u, d, l) {
|
|
746
|
-
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`,
|
|
746
|
+
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof d == "string" && d.trim().length > 0 ? d.trim() : null, M = oo(l), _ = g.currentUser, T = {
|
|
747
747
|
id: h,
|
|
748
748
|
conversation_id: e,
|
|
749
749
|
author_id: _?.id || "",
|
|
750
750
|
body: n || "",
|
|
751
751
|
attachments: [],
|
|
752
|
-
meta:
|
|
753
|
-
...
|
|
752
|
+
meta: x ? { shared_post_id: x } : {},
|
|
753
|
+
...M ? { shared_post: M } : {},
|
|
754
754
|
is_deleted: !1,
|
|
755
755
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
756
756
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -766,11 +766,11 @@ const Xt = bi("messaging", {
|
|
|
766
766
|
const w = {
|
|
767
767
|
body: n || "",
|
|
768
768
|
...o ? { reply_to_id: o } : {},
|
|
769
|
-
...
|
|
770
|
-
...
|
|
769
|
+
...x ? { shared_post_id: x } : {},
|
|
770
|
+
...M ? { shared_post_preview: M } : {}
|
|
771
771
|
};
|
|
772
772
|
if (i && i.length > 0) {
|
|
773
|
-
const
|
|
773
|
+
const k = await Promise.all(
|
|
774
774
|
i.map(async (O) => {
|
|
775
775
|
const H = await Hi().uploadImage(O);
|
|
776
776
|
return {
|
|
@@ -780,31 +780,31 @@ const Xt = bi("messaging", {
|
|
|
780
780
|
};
|
|
781
781
|
})
|
|
782
782
|
);
|
|
783
|
-
y = await
|
|
783
|
+
y = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
784
784
|
...w,
|
|
785
|
-
attachments:
|
|
785
|
+
attachments: k
|
|
786
786
|
});
|
|
787
787
|
} else
|
|
788
|
-
y = await
|
|
788
|
+
y = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
789
789
|
...w,
|
|
790
790
|
type: "text"
|
|
791
791
|
});
|
|
792
|
-
const C = y.data.data || y.data, f = { ...T, ...C, attachments: C.attachments ?? T.attachments }, m =
|
|
792
|
+
const C = y.data.data || y.data, f = { ...T, ...C, attachments: C.attachments ?? T.attachments }, m = at(f), v = this.messages[e], N = v.findIndex((k) => k.id === h);
|
|
793
793
|
N >= 0 && (v[N] = m), this._pendingSendIds.delete(h);
|
|
794
|
-
const
|
|
795
|
-
let
|
|
796
|
-
for (let
|
|
797
|
-
const O = v[
|
|
798
|
-
O && O.id ===
|
|
794
|
+
const q = m.id;
|
|
795
|
+
let G = 0;
|
|
796
|
+
for (let k = v.length - 1; k >= 0; k--) {
|
|
797
|
+
const O = v[k];
|
|
798
|
+
O && O.id === q && (G++, G > 1 && v.splice(k, 1));
|
|
799
799
|
}
|
|
800
800
|
return this.updateConversationLastMessage(e, m), m;
|
|
801
801
|
} catch (y) {
|
|
802
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((w) => w.id !== h), this.error =
|
|
802
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((w) => w.id !== h), this.error = Z(y), y;
|
|
803
803
|
}
|
|
804
804
|
},
|
|
805
805
|
async editMessage(e, n, i) {
|
|
806
806
|
try {
|
|
807
|
-
const o = await
|
|
807
|
+
const o = await W().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
|
|
808
808
|
body: i
|
|
809
809
|
}), u = o.data.data || o.data, d = this.messages[e] || [], l = d.findIndex((g) => g.id === n);
|
|
810
810
|
if (l >= 0) {
|
|
@@ -813,12 +813,12 @@ const Xt = bi("messaging", {
|
|
|
813
813
|
}
|
|
814
814
|
return u;
|
|
815
815
|
} catch (o) {
|
|
816
|
-
throw this.error =
|
|
816
|
+
throw this.error = Z(o), o;
|
|
817
817
|
}
|
|
818
818
|
},
|
|
819
819
|
async deleteMessage(e, n) {
|
|
820
820
|
try {
|
|
821
|
-
await
|
|
821
|
+
await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
|
|
822
822
|
const i = this.messages[e] || [], o = i.findIndex((u) => u.id === n);
|
|
823
823
|
if (o >= 0) {
|
|
824
824
|
const u = i[o];
|
|
@@ -828,7 +828,7 @@ const Xt = bi("messaging", {
|
|
|
828
828
|
delete d.body, i[o] = d;
|
|
829
829
|
}
|
|
830
830
|
} catch (i) {
|
|
831
|
-
throw this.error =
|
|
831
|
+
throw this.error = Z(i), i;
|
|
832
832
|
}
|
|
833
833
|
},
|
|
834
834
|
async markAsRead(e) {
|
|
@@ -839,14 +839,14 @@ const Xt = bi("messaging", {
|
|
|
839
839
|
return null;
|
|
840
840
|
for (let d = u.length - 1; d >= 0; d -= 1) {
|
|
841
841
|
const l = u[d]?.id;
|
|
842
|
-
if (
|
|
842
|
+
if (Nt(l))
|
|
843
843
|
return l;
|
|
844
844
|
}
|
|
845
845
|
return null;
|
|
846
|
-
})(), o = n ?
|
|
846
|
+
})(), o = n ? Ln(n, this.messages) : i;
|
|
847
847
|
if (!o)
|
|
848
848
|
return;
|
|
849
|
-
await
|
|
849
|
+
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
850
850
|
message_id: o
|
|
851
851
|
}), this.conversations.forEach((u) => {
|
|
852
852
|
u.id === e && (u.unread_count = 0);
|
|
@@ -854,7 +854,7 @@ const Xt = bi("messaging", {
|
|
|
854
854
|
u.id === e && (u.unread_count = 0);
|
|
855
855
|
});
|
|
856
856
|
} catch (n) {
|
|
857
|
-
throw this.error =
|
|
857
|
+
throw this.error = Z(n), n;
|
|
858
858
|
}
|
|
859
859
|
},
|
|
860
860
|
async markAllAsRead() {
|
|
@@ -862,7 +862,7 @@ const Xt = bi("messaging", {
|
|
|
862
862
|
if (e.length === 0)
|
|
863
863
|
return;
|
|
864
864
|
const n = e.map((u) => {
|
|
865
|
-
const d =
|
|
865
|
+
const d = Ln(u, this.messages);
|
|
866
866
|
return d ? {
|
|
867
867
|
conversationId: u.id,
|
|
868
868
|
messageId: d
|
|
@@ -872,7 +872,7 @@ const Xt = bi("messaging", {
|
|
|
872
872
|
return;
|
|
873
873
|
const i = await Promise.allSettled(
|
|
874
874
|
n.map(
|
|
875
|
-
(u) =>
|
|
875
|
+
(u) => W().post(`/v1/messaging/conversations/${u.conversationId}/read`, {
|
|
876
876
|
message_id: u.messageId
|
|
877
877
|
})
|
|
878
878
|
)
|
|
@@ -889,39 +889,39 @@ const Xt = bi("messaging", {
|
|
|
889
889
|
o === null && (o = u.reason);
|
|
890
890
|
}
|
|
891
891
|
}), o !== null)
|
|
892
|
-
throw this.error =
|
|
892
|
+
throw this.error = Z(o), o;
|
|
893
893
|
},
|
|
894
894
|
async sendTyping(e, n = "start") {
|
|
895
895
|
try {
|
|
896
|
-
const i = await
|
|
896
|
+
const i = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
897
897
|
if (n !== "start" || !eo(i.data))
|
|
898
898
|
return;
|
|
899
|
-
await
|
|
899
|
+
await Pn(Qi), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
900
900
|
} catch (i) {
|
|
901
901
|
console.warn("Failed to send typing indicator:", i);
|
|
902
902
|
}
|
|
903
903
|
},
|
|
904
904
|
async muteConversation(e, n) {
|
|
905
905
|
try {
|
|
906
|
-
const i = { minutes: n }, o = await
|
|
906
|
+
const i = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, i), d = (o.data.data || o.data).muted_until || null, l = this.conversations.find((g) => g.id === e);
|
|
907
907
|
l && (l.is_muted = d !== null, l.muted_until = d);
|
|
908
908
|
} catch (i) {
|
|
909
|
-
throw this.error =
|
|
909
|
+
throw this.error = Z(i), i;
|
|
910
910
|
}
|
|
911
911
|
},
|
|
912
912
|
async unmuteConversation(e) {
|
|
913
913
|
try {
|
|
914
|
-
const n = await
|
|
914
|
+
const n = await W().patch(`/v1/messaging/conversations/${e}/mute`, {
|
|
915
915
|
minutes: 0
|
|
916
916
|
}), o = (n.data.data || n.data).muted_until || null, u = this.conversations.find((d) => d.id === e);
|
|
917
917
|
u && (u.is_muted = o !== null, u.muted_until = o);
|
|
918
918
|
} catch (n) {
|
|
919
|
-
throw this.error =
|
|
919
|
+
throw this.error = Z(n), n;
|
|
920
920
|
}
|
|
921
921
|
},
|
|
922
922
|
async updateConversationTitle(e, n) {
|
|
923
923
|
try {
|
|
924
|
-
const i = await
|
|
924
|
+
const i = await W().patch(`/v1/messaging/conversations/${e}`, {
|
|
925
925
|
title: n
|
|
926
926
|
}), o = i.data.data || i.data, u = typeof o?.title == "string" ? o.title : n, d = (l) => l.map((g) => g.id !== e ? g : {
|
|
927
927
|
...g,
|
|
@@ -929,30 +929,30 @@ const Xt = bi("messaging", {
|
|
|
929
929
|
});
|
|
930
930
|
this.conversations = d(this.conversations), this.requests = d(this.requests);
|
|
931
931
|
} catch (i) {
|
|
932
|
-
throw this.error =
|
|
932
|
+
throw this.error = Z(i), i;
|
|
933
933
|
}
|
|
934
934
|
},
|
|
935
935
|
async pinConversation(e, n) {
|
|
936
936
|
try {
|
|
937
|
-
await
|
|
937
|
+
await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
938
938
|
const i = this.conversations.find((o) => o.id === e);
|
|
939
|
-
i && (i.is_pinned = n), this.conversations.sort(
|
|
939
|
+
i && (i.is_pinned = n), this.conversations.sort(ct);
|
|
940
940
|
} catch (i) {
|
|
941
|
-
throw this.error =
|
|
941
|
+
throw this.error = Z(i), i;
|
|
942
942
|
}
|
|
943
943
|
},
|
|
944
944
|
async archiveConversation(e, n) {
|
|
945
945
|
try {
|
|
946
|
-
await
|
|
946
|
+
await W().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((i) => i.id !== e);
|
|
947
947
|
} catch (i) {
|
|
948
|
-
throw this.error =
|
|
948
|
+
throw this.error = Z(i), i;
|
|
949
949
|
}
|
|
950
950
|
},
|
|
951
951
|
async deleteConversation(e) {
|
|
952
952
|
try {
|
|
953
|
-
await
|
|
953
|
+
await W().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
954
954
|
} catch (n) {
|
|
955
|
-
throw this.error =
|
|
955
|
+
throw this.error = Z(n), n;
|
|
956
956
|
}
|
|
957
957
|
},
|
|
958
958
|
async createDMConversation(e, n) {
|
|
@@ -961,42 +961,42 @@ const Xt = bi("messaging", {
|
|
|
961
961
|
user_id: e
|
|
962
962
|
};
|
|
963
963
|
n && (i.message = n);
|
|
964
|
-
const o = await
|
|
965
|
-
if (!
|
|
964
|
+
const o = await W().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
|
|
965
|
+
if (!Un(u))
|
|
966
966
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
967
|
-
const d =
|
|
968
|
-
return d.is_request === !0 ? (this.requests =
|
|
967
|
+
const d = On(u) ? He(u) : await this.fetchConversation(u.id);
|
|
968
|
+
return d.is_request === !0 ? (this.requests = it(this.requests, d), this.conversations = this.conversations.filter((l) => l.id !== d.id), d) : (this.conversations = it(this.conversations, d), this.requests = this.requests.filter((l) => l.id !== d.id), d);
|
|
969
969
|
} catch (i) {
|
|
970
|
-
throw this.error =
|
|
970
|
+
throw this.error = Z(i), i;
|
|
971
971
|
}
|
|
972
972
|
},
|
|
973
973
|
async createGroupConversation(e, n) {
|
|
974
974
|
try {
|
|
975
|
-
const i = await
|
|
975
|
+
const i = await W().post("/v1/messaging/conversations/group", {
|
|
976
976
|
title: e,
|
|
977
977
|
participant_ids: n
|
|
978
978
|
}), o = i.data.data || i.data;
|
|
979
|
-
if (!
|
|
979
|
+
if (!Un(o))
|
|
980
980
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
981
|
-
const u =
|
|
982
|
-
return this.conversations =
|
|
981
|
+
const u = On(o) ? o : await this.fetchConversation(o.id);
|
|
982
|
+
return this.conversations = it(this.conversations, u), u;
|
|
983
983
|
} catch (i) {
|
|
984
|
-
throw this.error =
|
|
984
|
+
throw this.error = Z(i), i;
|
|
985
985
|
}
|
|
986
986
|
},
|
|
987
987
|
async addParticipants(e, n) {
|
|
988
988
|
try {
|
|
989
|
-
await
|
|
989
|
+
await W().post(`/v1/messaging/conversations/${e}/participants`, {
|
|
990
990
|
user_ids: n
|
|
991
991
|
// Changed from participant_ids to user_ids to match backend
|
|
992
992
|
}), await this.fetchConversation(e);
|
|
993
993
|
} catch (i) {
|
|
994
|
-
throw this.error =
|
|
994
|
+
throw this.error = Z(i), i;
|
|
995
995
|
}
|
|
996
996
|
},
|
|
997
997
|
async removeParticipant(e, n) {
|
|
998
998
|
try {
|
|
999
|
-
await
|
|
999
|
+
await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
|
|
1000
1000
|
const i = Fe()();
|
|
1001
1001
|
if (n === i.currentUser?.id) {
|
|
1002
1002
|
this.conversations = this.conversations.filter((o) => o.id !== e), this.requests = this.requests.filter((o) => o.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
@@ -1004,7 +1004,7 @@ const Xt = bi("messaging", {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
await this.fetchConversation(e);
|
|
1006
1006
|
} catch (i) {
|
|
1007
|
-
throw this.error =
|
|
1007
|
+
throw this.error = Z(i), i;
|
|
1008
1008
|
}
|
|
1009
1009
|
},
|
|
1010
1010
|
applyParticipantReadState(e) {
|
|
@@ -1027,23 +1027,23 @@ const Xt = bi("messaging", {
|
|
|
1027
1027
|
if (!n)
|
|
1028
1028
|
return;
|
|
1029
1029
|
this.messages[n] || (this.messages[n] = []);
|
|
1030
|
-
const i =
|
|
1030
|
+
const i = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1031
1031
|
if (o.find((h) => h.id === i.id))
|
|
1032
1032
|
return;
|
|
1033
1033
|
const d = Fe()();
|
|
1034
1034
|
if (i.author_id === d.currentUser?.id) {
|
|
1035
|
-
const h = o.findIndex((
|
|
1035
|
+
const h = o.findIndex((x) => x.id.startsWith("temp-"));
|
|
1036
1036
|
if (h >= 0) {
|
|
1037
|
-
const
|
|
1038
|
-
o[h] = i, this._pendingSendIds.delete(
|
|
1037
|
+
const x = o[h]?.id ?? "";
|
|
1038
|
+
o[h] = i, this._pendingSendIds.delete(x), this.updateConversationLastMessage(n, i);
|
|
1039
1039
|
return;
|
|
1040
1040
|
}
|
|
1041
1041
|
}
|
|
1042
1042
|
const l = i.created_at;
|
|
1043
1043
|
let g = o.length;
|
|
1044
1044
|
for (let h = o.length - 1; h >= 0; h--) {
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1045
|
+
const x = o[h];
|
|
1046
|
+
if (x && x.created_at <= l)
|
|
1047
1047
|
break;
|
|
1048
1048
|
g = h;
|
|
1049
1049
|
}
|
|
@@ -1055,8 +1055,8 @@ const Xt = bi("messaging", {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
removeMessage(e, n) {
|
|
1057
1057
|
const i = (h) => {
|
|
1058
|
-
const
|
|
1059
|
-
return delete
|
|
1058
|
+
const x = { ...h, is_deleted: !0 };
|
|
1059
|
+
return delete x.body, x;
|
|
1060
1060
|
};
|
|
1061
1061
|
let o = null;
|
|
1062
1062
|
const u = this.conversations.find((h) => h.id === e);
|
|
@@ -1084,25 +1084,25 @@ const Xt = bi("messaging", {
|
|
|
1084
1084
|
try {
|
|
1085
1085
|
let g;
|
|
1086
1086
|
try {
|
|
1087
|
-
g = await
|
|
1087
|
+
g = await W().post(o, u);
|
|
1088
1088
|
} catch (_) {
|
|
1089
1089
|
if (!lo(_))
|
|
1090
1090
|
throw _;
|
|
1091
|
-
g = await
|
|
1091
|
+
g = await W().post(o, u);
|
|
1092
1092
|
}
|
|
1093
|
-
const h = he(g.data) && "data" in g.data ? g.data.data : g.data,
|
|
1093
|
+
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x = In(
|
|
1094
1094
|
he(h) ? h.reactions : void 0
|
|
1095
1095
|
);
|
|
1096
|
-
(
|
|
1096
|
+
(x.length > 0 || l.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1097
1097
|
try {
|
|
1098
|
-
const _ = await
|
|
1098
|
+
const _ = await W().get(o), T = he(_.data) && "data" in _.data ? _.data.data : _.data, y = In(
|
|
1099
1099
|
he(T) ? T.reactions : void 0
|
|
1100
1100
|
);
|
|
1101
1101
|
this.updateMessageReactions(e, n, y);
|
|
1102
1102
|
} catch {
|
|
1103
1103
|
}
|
|
1104
1104
|
} catch (g) {
|
|
1105
|
-
throw this.error =
|
|
1105
|
+
throw this.error = Z(g), g;
|
|
1106
1106
|
}
|
|
1107
1107
|
},
|
|
1108
1108
|
updateMessageReactions(e, n, i) {
|
|
@@ -1127,7 +1127,7 @@ const Xt = bi("messaging", {
|
|
|
1127
1127
|
const l = d.find((g) => g.id === e);
|
|
1128
1128
|
return l ? (l.last_message = n, l.last_message_at = n.created_at, !0) : !1;
|
|
1129
1129
|
}, o = i(this.conversations), u = i(this.requests);
|
|
1130
|
-
o && this.conversations.sort(
|
|
1130
|
+
o && this.conversations.sort(ct), u && this.requests.sort(ct);
|
|
1131
1131
|
},
|
|
1132
1132
|
updatePresenceForUser(e, n, i) {
|
|
1133
1133
|
const o = n === "online" || n === "idle" || n === "dnd";
|
|
@@ -1144,16 +1144,16 @@ const Xt = bi("messaging", {
|
|
|
1144
1144
|
is_archived: n.is_archived ?? !1,
|
|
1145
1145
|
is_muted: n.is_muted ?? !1
|
|
1146
1146
|
});
|
|
1147
|
-
this.conversations =
|
|
1147
|
+
this.conversations = it(this.conversations, i);
|
|
1148
1148
|
} catch (n) {
|
|
1149
|
-
throw this.error =
|
|
1149
|
+
throw this.error = Z(n), n;
|
|
1150
1150
|
}
|
|
1151
1151
|
},
|
|
1152
1152
|
async declineRequest(e) {
|
|
1153
1153
|
try {
|
|
1154
1154
|
await Re.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1155
1155
|
} catch (n) {
|
|
1156
|
-
throw this.error =
|
|
1156
|
+
throw this.error = Z(n), n;
|
|
1157
1157
|
}
|
|
1158
1158
|
},
|
|
1159
1159
|
async searchConversations(e, n, i) {
|
|
@@ -1161,15 +1161,15 @@ const Xt = bi("messaging", {
|
|
|
1161
1161
|
try {
|
|
1162
1162
|
const o = { search: e, limit: 20 };
|
|
1163
1163
|
n && (o.filter = n), typeof i == "string" && i.length > 0 && (o.folder_id = i);
|
|
1164
|
-
const u = await
|
|
1164
|
+
const u = await W().get("/v1/messaging/conversations", {
|
|
1165
1165
|
params: o
|
|
1166
|
-
}), { items: d } =
|
|
1166
|
+
}), { items: d } = rt(
|
|
1167
1167
|
u.data,
|
|
1168
1168
|
"conversations"
|
|
1169
1169
|
);
|
|
1170
1170
|
return d;
|
|
1171
1171
|
} catch (o) {
|
|
1172
|
-
return this.error =
|
|
1172
|
+
return this.error = Z(o), [];
|
|
1173
1173
|
} finally {
|
|
1174
1174
|
this.searchLoading = !1;
|
|
1175
1175
|
}
|
|
@@ -1177,12 +1177,12 @@ const Xt = bi("messaging", {
|
|
|
1177
1177
|
async searchMessages(e, n) {
|
|
1178
1178
|
this.searchLoading = !0;
|
|
1179
1179
|
try {
|
|
1180
|
-
const i = await
|
|
1180
|
+
const i = await W().get(`/v1/messaging/conversations/${e}/search`, {
|
|
1181
1181
|
params: { q: n }
|
|
1182
1182
|
}), o = i.data.data || i.data || [];
|
|
1183
1183
|
return this.searchResults = o, o;
|
|
1184
1184
|
} catch (i) {
|
|
1185
|
-
return this.error =
|
|
1185
|
+
return this.error = Z(i), [];
|
|
1186
1186
|
} finally {
|
|
1187
1187
|
this.searchLoading = !1;
|
|
1188
1188
|
}
|
|
@@ -1223,16 +1223,16 @@ const Xt = bi("messaging", {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
});
|
|
1225
1225
|
function Ga(e) {
|
|
1226
|
-
const n =
|
|
1227
|
-
let
|
|
1228
|
-
const y =
|
|
1226
|
+
const n = Wt(), i = Fe()(), o = ve(!1), u = ve(null), d = ve(null), l = qt(), g = l !== null, h = 20, x = 250;
|
|
1227
|
+
let M = 0, _ = null, T = null;
|
|
1228
|
+
const y = ie(() => i.currentUser?.id), w = () => Bn(e)?.trim() ?? "";
|
|
1229
1229
|
function C() {
|
|
1230
|
-
_ && (clearTimeout(_), _ = null),
|
|
1230
|
+
_ && (clearTimeout(_), _ = null), M = 0;
|
|
1231
1231
|
}
|
|
1232
1232
|
function f() {
|
|
1233
|
-
!g || o.value || _ ||
|
|
1234
|
-
_ = null,
|
|
1235
|
-
},
|
|
1233
|
+
!g || o.value || _ || M >= h || (_ = setTimeout(() => {
|
|
1234
|
+
_ = null, M += 1, F();
|
|
1235
|
+
}, x));
|
|
1236
1236
|
}
|
|
1237
1237
|
function m(b) {
|
|
1238
1238
|
if (n.addMessage(b.message), b.message.author_id !== y.value) {
|
|
@@ -1249,30 +1249,30 @@ function Ga(e) {
|
|
|
1249
1249
|
if (ae >= 0) {
|
|
1250
1250
|
const B = I[ae];
|
|
1251
1251
|
if (!B) return;
|
|
1252
|
-
const
|
|
1253
|
-
b.message.body !== void 0 && (
|
|
1252
|
+
const A = { ...B };
|
|
1253
|
+
b.message.body !== void 0 && (A.body = b.message.body), b.message.edited_at !== void 0 && (A.edited_at = b.message.edited_at), b.message.meta !== void 0 && (A.meta = b.message.meta), I[ae] = A;
|
|
1254
1254
|
const V = n.getConversationById(b.conversation_id);
|
|
1255
|
-
V && V.last_message?.id === b.message.id && (V.last_message =
|
|
1255
|
+
V && V.last_message?.id === b.message.id && (V.last_message = A);
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function q(b) {
|
|
1259
1259
|
n.removeMessage(b.conversation_id, b.message_id);
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function G(b) {
|
|
1262
1262
|
n.updateMessageReactions(
|
|
1263
1263
|
b.conversation_id,
|
|
1264
1264
|
b.message_id,
|
|
1265
1265
|
b.reactions
|
|
1266
1266
|
);
|
|
1267
1267
|
}
|
|
1268
|
-
function
|
|
1268
|
+
function k(b) {
|
|
1269
1269
|
const I = n.getConversationById(b.conversation_id);
|
|
1270
1270
|
I && (I.is_request = !1), n.requests = n.requests.filter(
|
|
1271
1271
|
(ae) => ae.id !== b.conversation_id
|
|
1272
1272
|
);
|
|
1273
1273
|
}
|
|
1274
1274
|
function O(b) {
|
|
1275
|
-
b.removed_user_id === y.value && (
|
|
1275
|
+
b.removed_user_id === y.value && (ee(), n.deleteConversation(b.conversation_id).catch(() => {
|
|
1276
1276
|
}));
|
|
1277
1277
|
}
|
|
1278
1278
|
function H(b) {
|
|
@@ -1292,9 +1292,9 @@ function Ga(e) {
|
|
|
1292
1292
|
onMessageSent: m,
|
|
1293
1293
|
onMessageRead: v,
|
|
1294
1294
|
onMessageEdited: N,
|
|
1295
|
-
onMessageDeleted:
|
|
1296
|
-
onReactionToggled:
|
|
1297
|
-
onRequestAccepted:
|
|
1295
|
+
onMessageDeleted: q,
|
|
1296
|
+
onReactionToggled: G,
|
|
1297
|
+
onRequestAccepted: k,
|
|
1298
1298
|
onParticipantRemoved: O
|
|
1299
1299
|
}), o.value = !0, d.value = b, n.registerDetailSubscription(b), C();
|
|
1300
1300
|
} catch (I) {
|
|
@@ -1302,18 +1302,18 @@ function Ga(e) {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
|
-
function
|
|
1305
|
+
function J() {
|
|
1306
1306
|
o.value || F();
|
|
1307
1307
|
}
|
|
1308
|
-
typeof window < "u" && window.addEventListener(We(),
|
|
1309
|
-
const
|
|
1308
|
+
typeof window < "u" && window.addEventListener(We(), J);
|
|
1309
|
+
const me = ht((b) => {
|
|
1310
1310
|
if (b === "connected") {
|
|
1311
1311
|
o.value || F();
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
1314
|
(b === "disconnected" || b === "error") && (C(), H(!1));
|
|
1315
1315
|
});
|
|
1316
|
-
function
|
|
1316
|
+
function ee() {
|
|
1317
1317
|
if (C(), !(!o.value || !d.value))
|
|
1318
1318
|
try {
|
|
1319
1319
|
H(!0), u.value = null;
|
|
@@ -1321,7 +1321,7 @@ function Ga(e) {
|
|
|
1321
1321
|
u.value = b instanceof Error ? b.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", b);
|
|
1322
1322
|
}
|
|
1323
1323
|
}
|
|
1324
|
-
return
|
|
1324
|
+
return Ut(
|
|
1325
1325
|
() => w(),
|
|
1326
1326
|
(b, I) => {
|
|
1327
1327
|
if (b !== I) {
|
|
@@ -1333,43 +1333,43 @@ function Ga(e) {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
1335
|
), l !== null && De(() => {
|
|
1336
|
-
C(),
|
|
1336
|
+
C(), me(), ee(), typeof window < "u" && window.removeEventListener(We(), J);
|
|
1337
1337
|
}), {
|
|
1338
|
-
isSubscribed:
|
|
1339
|
-
error:
|
|
1338
|
+
isSubscribed: ie(() => o.value),
|
|
1339
|
+
error: ie(() => u.value),
|
|
1340
1340
|
subscribe: F,
|
|
1341
|
-
unsubscribe:
|
|
1341
|
+
unsubscribe: ee
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
const
|
|
1345
|
-
},
|
|
1346
|
-
},
|
|
1344
|
+
const cs = () => () => {
|
|
1345
|
+
}, us = async () => {
|
|
1346
|
+
}, be = {
|
|
1347
1347
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1348
1348
|
getEcho: () => null,
|
|
1349
1349
|
getConnectionStatus: () => "disconnected",
|
|
1350
|
-
onConnectionStatusChange:
|
|
1351
|
-
reconnect:
|
|
1350
|
+
onConnectionStatusChange: cs,
|
|
1351
|
+
reconnect: us
|
|
1352
1352
|
};
|
|
1353
1353
|
function po() {
|
|
1354
|
-
return
|
|
1354
|
+
return be.initializedEvent;
|
|
1355
1355
|
}
|
|
1356
1356
|
function go() {
|
|
1357
|
-
return
|
|
1357
|
+
return be.getEcho();
|
|
1358
1358
|
}
|
|
1359
1359
|
function mo() {
|
|
1360
|
-
return
|
|
1360
|
+
return be.getConnectionStatus();
|
|
1361
1361
|
}
|
|
1362
1362
|
function vo(e) {
|
|
1363
|
-
return
|
|
1363
|
+
return be.onConnectionStatusChange(e);
|
|
1364
1364
|
}
|
|
1365
1365
|
async function bo() {
|
|
1366
|
-
await
|
|
1366
|
+
await be.reconnect();
|
|
1367
1367
|
}
|
|
1368
1368
|
function yo(e) {
|
|
1369
|
-
e.initializedEvent && (
|
|
1369
|
+
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);
|
|
1370
1370
|
}
|
|
1371
1371
|
function _o() {
|
|
1372
|
-
|
|
1372
|
+
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange = cs, be.reconnect = us;
|
|
1373
1373
|
}
|
|
1374
1374
|
const So = {
|
|
1375
1375
|
debug: () => {
|
|
@@ -1380,16 +1380,16 @@ const So = {
|
|
|
1380
1380
|
},
|
|
1381
1381
|
error: () => {
|
|
1382
1382
|
}
|
|
1383
|
-
},
|
|
1384
|
-
let
|
|
1385
|
-
function
|
|
1386
|
-
return
|
|
1383
|
+
}, ls = () => So;
|
|
1384
|
+
let Gt = ls;
|
|
1385
|
+
function Jt() {
|
|
1386
|
+
return Gt;
|
|
1387
1387
|
}
|
|
1388
1388
|
function Co(e) {
|
|
1389
|
-
|
|
1389
|
+
Gt = e;
|
|
1390
1390
|
}
|
|
1391
1391
|
function wo() {
|
|
1392
|
-
|
|
1392
|
+
Gt = ls;
|
|
1393
1393
|
}
|
|
1394
1394
|
const To = {
|
|
1395
1395
|
connected: "",
|
|
@@ -1397,35 +1397,35 @@ const To = {
|
|
|
1397
1397
|
disconnected: "",
|
|
1398
1398
|
error: "",
|
|
1399
1399
|
unknown: ""
|
|
1400
|
-
},
|
|
1401
|
-
function
|
|
1400
|
+
}, Nn = Jt()("ConnectionStatus");
|
|
1401
|
+
function Dn(e) {
|
|
1402
1402
|
return e?.connector?.pusher?.connection ?? null;
|
|
1403
1403
|
}
|
|
1404
1404
|
function Eo(e) {
|
|
1405
1405
|
return e === "messenger" ? {
|
|
1406
1406
|
initializedEvent: We(),
|
|
1407
|
-
getConnectionStatus:
|
|
1408
|
-
onConnectionStatusChange:
|
|
1407
|
+
getConnectionStatus: ts,
|
|
1408
|
+
onConnectionStatusChange: ht,
|
|
1409
1409
|
reconnect: Ti,
|
|
1410
|
-
getEchoConnection: () =>
|
|
1410
|
+
getEchoConnection: () => Dn(Pe())
|
|
1411
1411
|
} : {
|
|
1412
1412
|
initializedEvent: po(),
|
|
1413
1413
|
getConnectionStatus: mo,
|
|
1414
1414
|
onConnectionStatusChange: vo,
|
|
1415
1415
|
reconnect: bo,
|
|
1416
|
-
getEchoConnection: () =>
|
|
1416
|
+
getEchoConnection: () => Dn(go())
|
|
1417
1417
|
};
|
|
1418
1418
|
}
|
|
1419
|
-
function
|
|
1419
|
+
function qn(e) {
|
|
1420
1420
|
return e.getEchoConnection()?.state ?? null;
|
|
1421
1421
|
}
|
|
1422
1422
|
function Ja(e = {}) {
|
|
1423
1423
|
const o = Eo(e.source ?? "app"), u = {
|
|
1424
1424
|
...To,
|
|
1425
1425
|
...e.icons
|
|
1426
|
-
}, d =
|
|
1426
|
+
}, d = ve(o.getConnectionStatus()), l = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), _ = ve(!1);
|
|
1427
1427
|
let T = null, y = null, w = null, C = null, f = null, m = null, v = null;
|
|
1428
|
-
const N =
|
|
1428
|
+
const N = ie(() => d.value === "connected"), q = ie(() => d.value === "connecting"), G = ie(() => d.value === "disconnected"), k = ie(() => d.value === "error"), O = ie(() => G.value || k.value), H = ie(() => {
|
|
1429
1429
|
switch (d.value) {
|
|
1430
1430
|
case "connecting":
|
|
1431
1431
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1438,7 +1438,7 @@ function Ja(e = {}) {
|
|
|
1438
1438
|
default:
|
|
1439
1439
|
return "Unknown connection state";
|
|
1440
1440
|
}
|
|
1441
|
-
}), F =
|
|
1441
|
+
}), F = ie(() => {
|
|
1442
1442
|
switch (d.value) {
|
|
1443
1443
|
case "connected":
|
|
1444
1444
|
return "success";
|
|
@@ -1450,7 +1450,7 @@ function Ja(e = {}) {
|
|
|
1450
1450
|
default:
|
|
1451
1451
|
return "medium";
|
|
1452
1452
|
}
|
|
1453
|
-
}),
|
|
1453
|
+
}), J = ie(() => {
|
|
1454
1454
|
switch (d.value) {
|
|
1455
1455
|
case "connected":
|
|
1456
1456
|
return u.connected;
|
|
@@ -1463,12 +1463,12 @@ function Ja(e = {}) {
|
|
|
1463
1463
|
default:
|
|
1464
1464
|
return u.unknown;
|
|
1465
1465
|
}
|
|
1466
|
-
}),
|
|
1467
|
-
|
|
1468
|
-
},
|
|
1469
|
-
if (
|
|
1470
|
-
const
|
|
1471
|
-
if (
|
|
1466
|
+
}), me = async () => {
|
|
1467
|
+
Nn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1468
|
+
}, ee = (A, V = d.value) => {
|
|
1469
|
+
if (A !== "connecting" && y && (clearTimeout(y), y = null), A === "disconnected" || A === "error") {
|
|
1470
|
+
const ne = !_.value && V === A, _e = !x.value && (ne || V === "connected" || V === "connecting");
|
|
1471
|
+
if (M.value = !0, _e) {
|
|
1472
1472
|
h.value = !1, w && clearTimeout(w), w = setTimeout(() => {
|
|
1473
1473
|
w = null, d.value !== "connected" && (h.value = !0);
|
|
1474
1474
|
}, 2e3);
|
|
@@ -1477,50 +1477,50 @@ function Ja(e = {}) {
|
|
|
1477
1477
|
w && (clearTimeout(w), w = null), h.value = !0;
|
|
1478
1478
|
return;
|
|
1479
1479
|
}
|
|
1480
|
-
if (
|
|
1481
|
-
w && (clearTimeout(w), w = null), h.value = !1,
|
|
1480
|
+
if (A === "connected") {
|
|
1481
|
+
w && (clearTimeout(w), w = null), h.value = !1, x.value = !1, M.value = !1;
|
|
1482
1482
|
return;
|
|
1483
1483
|
}
|
|
1484
|
-
if (
|
|
1485
|
-
if (
|
|
1484
|
+
if (A === "connecting") {
|
|
1485
|
+
if (x.value) {
|
|
1486
1486
|
h.value = !0;
|
|
1487
1487
|
return;
|
|
1488
1488
|
}
|
|
1489
|
-
if (
|
|
1489
|
+
if (M.value || (h.value = !1), y)
|
|
1490
1490
|
return;
|
|
1491
1491
|
y = setTimeout(() => {
|
|
1492
1492
|
if (y = null, d.value === "connecting") {
|
|
1493
|
-
if (
|
|
1493
|
+
if (qn(o) === "connected") {
|
|
1494
1494
|
b("connected");
|
|
1495
1495
|
return;
|
|
1496
1496
|
}
|
|
1497
|
-
|
|
1497
|
+
x.value = !0, Nn.warn("Still connecting after 10s, treating as disconnected"), b("disconnected"), g.value += 1, o.reconnect();
|
|
1498
1498
|
}
|
|
1499
1499
|
}, 1e4);
|
|
1500
1500
|
}
|
|
1501
|
-
}, b = (
|
|
1501
|
+
}, b = (A) => {
|
|
1502
1502
|
const V = d.value;
|
|
1503
|
-
if (
|
|
1504
|
-
d.value = "disconnected",
|
|
1503
|
+
if (A === "connecting" && x.value) {
|
|
1504
|
+
d.value = "disconnected", ee("disconnected", V);
|
|
1505
1505
|
return;
|
|
1506
1506
|
}
|
|
1507
|
-
d.value =
|
|
1507
|
+
d.value = A, A === "connecting" && (V === "disconnected" || V === "error") && g.value === 0 && (g.value = 1), A === "connected" && (l.value = /* @__PURE__ */ new Date(), g.value = 0), ee(A, V);
|
|
1508
1508
|
}, I = () => {
|
|
1509
|
-
const
|
|
1510
|
-
if (
|
|
1509
|
+
const A = qn(o), V = d.value;
|
|
1510
|
+
if (A === "connected" && V !== "connected") {
|
|
1511
1511
|
b("connected");
|
|
1512
1512
|
return;
|
|
1513
1513
|
}
|
|
1514
|
-
if (
|
|
1514
|
+
if (A === "connecting" && V !== "connecting") {
|
|
1515
1515
|
b("connecting");
|
|
1516
1516
|
return;
|
|
1517
1517
|
}
|
|
1518
|
-
if ((
|
|
1518
|
+
if ((A === "unavailable" || A === "failed" || A === "disconnected") && V !== "disconnected") {
|
|
1519
1519
|
b("disconnected");
|
|
1520
1520
|
return;
|
|
1521
1521
|
}
|
|
1522
|
-
const
|
|
1523
|
-
!
|
|
1522
|
+
const ne = o.getConnectionStatus();
|
|
1523
|
+
!A && ne === "connected" && V !== "connected" && b("connected");
|
|
1524
1524
|
}, ae = () => {
|
|
1525
1525
|
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)
|
|
1526
1526
|
return;
|
|
@@ -1531,36 +1531,36 @@ function Ja(e = {}) {
|
|
|
1531
1531
|
unavailable: () => b("disconnected"),
|
|
1532
1532
|
error: () => b("error"),
|
|
1533
1533
|
stateChange: (V) => {
|
|
1534
|
-
const
|
|
1535
|
-
if (
|
|
1534
|
+
const ne = V?.current;
|
|
1535
|
+
if (ne === "connected") {
|
|
1536
1536
|
b("connected");
|
|
1537
1537
|
return;
|
|
1538
1538
|
}
|
|
1539
|
-
if (
|
|
1539
|
+
if (ne === "connecting") {
|
|
1540
1540
|
b("connecting");
|
|
1541
1541
|
return;
|
|
1542
1542
|
}
|
|
1543
|
-
(
|
|
1543
|
+
(ne === "unavailable" || ne === "failed" || ne === "disconnected") && b("disconnected");
|
|
1544
1544
|
}
|
|
1545
1545
|
}, 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);
|
|
1546
|
-
const
|
|
1547
|
-
if (
|
|
1546
|
+
const A = f.state ?? null;
|
|
1547
|
+
if (A === "connected") {
|
|
1548
1548
|
b("connected");
|
|
1549
1549
|
return;
|
|
1550
1550
|
}
|
|
1551
|
-
if (
|
|
1551
|
+
if (A === "connecting") {
|
|
1552
1552
|
b("connecting");
|
|
1553
1553
|
return;
|
|
1554
1554
|
}
|
|
1555
|
-
(
|
|
1556
|
-
}, B =
|
|
1555
|
+
(A === "unavailable" || A === "failed" || A === "disconnected") && b("disconnected");
|
|
1556
|
+
}, B = ie(() => {
|
|
1557
1557
|
if (!l.value || !N.value)
|
|
1558
1558
|
return null;
|
|
1559
|
-
const
|
|
1560
|
-
return V > 0 ? `${V}m ${
|
|
1559
|
+
const A = Date.now() - l.value.getTime(), V = Math.floor(A / 6e4), ne = Math.floor(A % 6e4 / 1e3);
|
|
1560
|
+
return V > 0 ? `${V}m ${ne}s` : `${ne}s`;
|
|
1561
1561
|
});
|
|
1562
|
-
return
|
|
1563
|
-
d.value = o.getConnectionStatus(), T = o.onConnectionStatusChange(b), N.value && (l.value = /* @__PURE__ */ new Date()),
|
|
1562
|
+
return zt(() => {
|
|
1563
|
+
d.value = o.getConnectionStatus(), T = o.onConnectionStatusChange(b), N.value && (l.value = /* @__PURE__ */ new Date()), ee(d.value, d.value), _.value = !0, ae(), m = () => {
|
|
1564
1564
|
ae(), I();
|
|
1565
1565
|
}, window.addEventListener(o.initializedEvent, m), I(), C = setInterval(() => {
|
|
1566
1566
|
I();
|
|
@@ -1568,32 +1568,32 @@ function Ja(e = {}) {
|
|
|
1568
1568
|
}), De(() => {
|
|
1569
1569
|
T?.(), y && (clearTimeout(y), y = null), w && (clearTimeout(w), w = null), C && (clearInterval(C), C = 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;
|
|
1570
1570
|
}), {
|
|
1571
|
-
connectionStatus:
|
|
1571
|
+
connectionStatus: ie(() => d.value),
|
|
1572
1572
|
isConnected: N,
|
|
1573
|
-
isConnecting:
|
|
1574
|
-
isDisconnected:
|
|
1575
|
-
isError:
|
|
1573
|
+
isConnecting: q,
|
|
1574
|
+
isDisconnected: G,
|
|
1575
|
+
isError: k,
|
|
1576
1576
|
hasConnectionIssues: O,
|
|
1577
1577
|
statusMessage: H,
|
|
1578
1578
|
statusColor: F,
|
|
1579
|
-
statusIcon:
|
|
1580
|
-
showConnectionBanner:
|
|
1581
|
-
lastConnectionTime:
|
|
1579
|
+
statusIcon: J,
|
|
1580
|
+
showConnectionBanner: ie(() => h.value),
|
|
1581
|
+
lastConnectionTime: ie(() => l.value),
|
|
1582
1582
|
connectionUptime: B,
|
|
1583
|
-
reconnectAttempts:
|
|
1584
|
-
reconnect:
|
|
1583
|
+
reconnectAttempts: ie(() => g.value),
|
|
1584
|
+
reconnect: me
|
|
1585
1585
|
};
|
|
1586
1586
|
}
|
|
1587
|
-
const
|
|
1588
|
-
let
|
|
1589
|
-
function
|
|
1590
|
-
return
|
|
1587
|
+
const ds = jt;
|
|
1588
|
+
let Kt = ds;
|
|
1589
|
+
function hs() {
|
|
1590
|
+
return Kt;
|
|
1591
1591
|
}
|
|
1592
1592
|
function Ao(e) {
|
|
1593
|
-
|
|
1593
|
+
Kt = e;
|
|
1594
1594
|
}
|
|
1595
1595
|
function Ro() {
|
|
1596
|
-
|
|
1596
|
+
Kt = ds;
|
|
1597
1597
|
}
|
|
1598
1598
|
const Po = 6e4;
|
|
1599
1599
|
function Mo(e) {
|
|
@@ -1605,14 +1605,14 @@ function xo(e) {
|
|
|
1605
1605
|
const n = e.trim().toLowerCase();
|
|
1606
1606
|
return Mo(n) ? n : null;
|
|
1607
1607
|
}
|
|
1608
|
-
function
|
|
1608
|
+
function fs(e) {
|
|
1609
1609
|
if (typeof e != "string")
|
|
1610
1610
|
return null;
|
|
1611
1611
|
const n = e.trim();
|
|
1612
1612
|
return n.length > 0 ? n : null;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1615
|
-
const n =
|
|
1614
|
+
function Dt(e) {
|
|
1615
|
+
const n = fs(e);
|
|
1616
1616
|
if (n === null)
|
|
1617
1617
|
return null;
|
|
1618
1618
|
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, u = new Date(o);
|
|
@@ -1623,38 +1623,38 @@ function ko(e, n, i = {}) {
|
|
|
1623
1623
|
return null;
|
|
1624
1624
|
if (e === "offline")
|
|
1625
1625
|
return "offline";
|
|
1626
|
-
const o =
|
|
1626
|
+
const o = Dt(n);
|
|
1627
1627
|
if (o === null)
|
|
1628
1628
|
return e;
|
|
1629
1629
|
const u = i.now ?? Date.now(), d = i.staleAfterMs ?? Po;
|
|
1630
1630
|
return u - o.getTime() > d ? "offline" : e;
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1633
|
-
const i =
|
|
1632
|
+
function zn(e, n = {}) {
|
|
1633
|
+
const i = fs(e?.last_seen_at), o = xo(e?.status);
|
|
1634
1634
|
return {
|
|
1635
1635
|
status: ko(o, i, n),
|
|
1636
1636
|
lastSeenAt: i
|
|
1637
1637
|
};
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1639
|
+
const ps = () => {
|
|
1640
1640
|
};
|
|
1641
|
-
let
|
|
1641
|
+
let Qt = ps;
|
|
1642
1642
|
function Lo() {
|
|
1643
|
-
return
|
|
1643
|
+
return Qt;
|
|
1644
1644
|
}
|
|
1645
1645
|
function Io(e) {
|
|
1646
|
-
|
|
1646
|
+
Qt = e;
|
|
1647
1647
|
}
|
|
1648
1648
|
function Uo() {
|
|
1649
|
-
|
|
1649
|
+
Qt = ps;
|
|
1650
1650
|
}
|
|
1651
|
-
const Ue =
|
|
1651
|
+
const Ue = Jt()("GlobalMessaging"), Oo = 3, Fo = (e) => e.replace(/\/+$/, ""), No = (e) => Fo(window.location.pathname) === `/messages/${e}`, Do = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1652
1652
|
function Ka() {
|
|
1653
|
-
const e =
|
|
1654
|
-
let
|
|
1655
|
-
function
|
|
1656
|
-
const O = h.get(
|
|
1657
|
-
if (O && (h.delete(
|
|
1653
|
+
const e = Wt(), n = Fe()(), i = Lo(), o = hs(), u = Si(), d = qt(), { conversations: l } = yi(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
|
|
1654
|
+
let x = !1;
|
|
1655
|
+
function M(k) {
|
|
1656
|
+
const O = h.get(k);
|
|
1657
|
+
if (O && (h.delete(k), typeof O.channel.stopListening == "function"))
|
|
1658
1658
|
for (const H of O.bindings)
|
|
1659
1659
|
try {
|
|
1660
1660
|
O.channel.stopListening(H.event, H.handler);
|
|
@@ -1662,105 +1662,105 @@ function Ka() {
|
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
function _() {
|
|
1665
|
-
for (const
|
|
1666
|
-
|
|
1665
|
+
for (const k of g)
|
|
1666
|
+
M(k), e.unregisterGlobalConversationSubscription(k);
|
|
1667
1667
|
g.clear();
|
|
1668
1668
|
}
|
|
1669
|
-
function T(
|
|
1669
|
+
function T(k) {
|
|
1670
1670
|
const O = Pe();
|
|
1671
|
-
if (!O || g.has(
|
|
1672
|
-
const H = `conversation.${
|
|
1673
|
-
|
|
1674
|
-
const F = O.private(H),
|
|
1671
|
+
if (!O || g.has(k)) return;
|
|
1672
|
+
const H = `conversation.${k}`;
|
|
1673
|
+
M(k);
|
|
1674
|
+
const F = O.private(H), J = (B) => {
|
|
1675
1675
|
if (!Ii(B)) {
|
|
1676
1676
|
Ue.warn("Dropping malformed ConversationMessageSent event", B);
|
|
1677
1677
|
return;
|
|
1678
1678
|
}
|
|
1679
|
-
const
|
|
1680
|
-
if (!V ||
|
|
1681
|
-
e.addMessage(
|
|
1682
|
-
const
|
|
1683
|
-
if (
|
|
1684
|
-
const U = e.getConversationById(
|
|
1685
|
-
U && (U.unread_count = 0), e.markAsRead(
|
|
1679
|
+
const A = B, V = n.currentUser?.id;
|
|
1680
|
+
if (!V || A.message.author_id === V) return;
|
|
1681
|
+
e.addMessage(A.message);
|
|
1682
|
+
const ne = e.hasDetailSubscription(A.conversation_id), _e = No(A.conversation_id);
|
|
1683
|
+
if (ne || _e) {
|
|
1684
|
+
const U = e.getConversationById(A.conversation_id);
|
|
1685
|
+
U && (U.unread_count = 0), e.markAsRead(A.conversation_id).catch(() => {
|
|
1686
1686
|
});
|
|
1687
1687
|
return;
|
|
1688
1688
|
}
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1691
|
-
const U = Do(
|
|
1692
|
-
U ||
|
|
1689
|
+
const R = e.getConversationById(A.conversation_id);
|
|
1690
|
+
if (R) {
|
|
1691
|
+
const U = Do(R);
|
|
1692
|
+
U || R.unread_count++, i(U);
|
|
1693
1693
|
}
|
|
1694
|
-
},
|
|
1694
|
+
}, me = (B) => {
|
|
1695
1695
|
if (!Ui(B)) {
|
|
1696
1696
|
Ue.warn("Dropping malformed ConversationMessageRead event", B);
|
|
1697
1697
|
return;
|
|
1698
1698
|
}
|
|
1699
1699
|
e.applyParticipantReadState(B);
|
|
1700
|
-
},
|
|
1700
|
+
}, ee = (B) => {
|
|
1701
1701
|
if (!Ni(B)) {
|
|
1702
1702
|
Ue.warn("Dropping malformed MessageReactionToggled event", B);
|
|
1703
1703
|
return;
|
|
1704
1704
|
}
|
|
1705
|
-
const
|
|
1706
|
-
e.updateMessageReactions(
|
|
1705
|
+
const A = B;
|
|
1706
|
+
e.updateMessageReactions(A.conversation_id, A.message_id, A.reactions);
|
|
1707
1707
|
}, b = (B) => {
|
|
1708
1708
|
if (!Oi(B)) {
|
|
1709
1709
|
Ue.warn("Dropping malformed ConversationMessageEdited event", B);
|
|
1710
1710
|
return;
|
|
1711
1711
|
}
|
|
1712
|
-
const
|
|
1713
|
-
if (
|
|
1714
|
-
const
|
|
1715
|
-
if (
|
|
1716
|
-
const U = { ...
|
|
1717
|
-
|
|
1712
|
+
const A = B, V = e.getMessagesByConversationId(A.conversation_id), ne = V.findIndex((R) => R.id === A.message.id);
|
|
1713
|
+
if (ne >= 0) {
|
|
1714
|
+
const R = V[ne];
|
|
1715
|
+
if (R) {
|
|
1716
|
+
const U = { ...R };
|
|
1717
|
+
A.message.body !== void 0 && (U.body = A.message.body), A.message.edited_at !== void 0 && (U.edited_at = A.message.edited_at), A.message.meta !== void 0 && (U.meta = A.message.meta), V[ne] = U;
|
|
1718
1718
|
}
|
|
1719
1719
|
}
|
|
1720
|
-
const _e = e.getConversationById(
|
|
1721
|
-
_e?.last_message?.id ===
|
|
1720
|
+
const _e = e.getConversationById(A.conversation_id);
|
|
1721
|
+
_e?.last_message?.id === A.message.id && A.message.body !== void 0 && (_e.last_message = {
|
|
1722
1722
|
..._e.last_message,
|
|
1723
|
-
body:
|
|
1723
|
+
body: A.message.body
|
|
1724
1724
|
});
|
|
1725
1725
|
}, I = (B) => {
|
|
1726
1726
|
if (!Fi(B)) {
|
|
1727
1727
|
Ue.warn("Dropping malformed ConversationMessageDeleted event", B);
|
|
1728
1728
|
return;
|
|
1729
1729
|
}
|
|
1730
|
-
const
|
|
1731
|
-
e.removeMessage(
|
|
1730
|
+
const A = B;
|
|
1731
|
+
e.removeMessage(A.conversation_id, A.message_id);
|
|
1732
1732
|
}, ae = (B) => {
|
|
1733
1733
|
if (!Di(B)) {
|
|
1734
1734
|
Ue.warn("Dropping malformed ConversationRequestAccepted event", B);
|
|
1735
1735
|
return;
|
|
1736
1736
|
}
|
|
1737
|
-
const
|
|
1737
|
+
const A = B, V = e.getConversationById(A.conversation_id);
|
|
1738
1738
|
V && (V.is_request = !1), e.requests = e.requests.filter(
|
|
1739
|
-
(
|
|
1739
|
+
(ne) => ne.id !== A.conversation_id
|
|
1740
1740
|
);
|
|
1741
1741
|
};
|
|
1742
|
-
F.listen(".ConversationMessageSent",
|
|
1742
|
+
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited", b), F.listen(".ConversationMessageDeleted", I), F.listen(".MessageReactionToggled", ee), F.listen(".ConversationRequestAccepted", ae), h.set(k, {
|
|
1743
1743
|
channel: F,
|
|
1744
1744
|
bindings: [
|
|
1745
|
-
{ event: ".ConversationMessageSent", handler:
|
|
1746
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1745
|
+
{ event: ".ConversationMessageSent", handler: J },
|
|
1746
|
+
{ event: ".ConversationMessageRead", handler: me },
|
|
1747
1747
|
{ event: ".ConversationMessageEdited", handler: b },
|
|
1748
1748
|
{ event: ".ConversationMessageDeleted", handler: I },
|
|
1749
|
-
{ event: ".MessageReactionToggled", handler:
|
|
1749
|
+
{ event: ".MessageReactionToggled", handler: ee },
|
|
1750
1750
|
{ event: ".ConversationRequestAccepted", handler: ae }
|
|
1751
1751
|
]
|
|
1752
|
-
}), g.add(
|
|
1752
|
+
}), g.add(k), e.registerGlobalConversationSubscription(k);
|
|
1753
1753
|
}
|
|
1754
1754
|
function y() {
|
|
1755
|
-
const
|
|
1756
|
-
if (!
|
|
1755
|
+
const k = Pe();
|
|
1756
|
+
if (!k) {
|
|
1757
1757
|
_();
|
|
1758
1758
|
return;
|
|
1759
1759
|
}
|
|
1760
1760
|
for (const O of g) {
|
|
1761
|
-
|
|
1761
|
+
M(O);
|
|
1762
1762
|
try {
|
|
1763
|
-
|
|
1763
|
+
k.leave(`conversation.${O}`);
|
|
1764
1764
|
} catch {
|
|
1765
1765
|
}
|
|
1766
1766
|
e.unregisterGlobalConversationSubscription(O);
|
|
@@ -1768,13 +1768,13 @@ function Ka() {
|
|
|
1768
1768
|
g.clear();
|
|
1769
1769
|
}
|
|
1770
1770
|
function w() {
|
|
1771
|
-
const
|
|
1772
|
-
if (!
|
|
1771
|
+
const k = Pe();
|
|
1772
|
+
if (!k) return;
|
|
1773
1773
|
const O = e.conversations.slice(0, Oo), H = new Set(O.map((F) => F.id));
|
|
1774
1774
|
for (const F of g)
|
|
1775
1775
|
if (!H.has(F) && !e.hasDetailSubscription(F)) {
|
|
1776
1776
|
try {
|
|
1777
|
-
|
|
1777
|
+
M(F), k.leave(`conversation.${F}`);
|
|
1778
1778
|
} catch {
|
|
1779
1779
|
}
|
|
1780
1780
|
g.delete(F), e.unregisterGlobalConversationSubscription(F);
|
|
@@ -1782,74 +1782,74 @@ function Ka() {
|
|
|
1782
1782
|
for (const F of O)
|
|
1783
1783
|
T(F.id);
|
|
1784
1784
|
}
|
|
1785
|
-
function C(
|
|
1786
|
-
const O =
|
|
1787
|
-
status:
|
|
1788
|
-
last_seen_at:
|
|
1785
|
+
function C(k) {
|
|
1786
|
+
const O = zn({
|
|
1787
|
+
status: k.status,
|
|
1788
|
+
last_seen_at: k.last_seen_at ?? null
|
|
1789
1789
|
});
|
|
1790
1790
|
O.status !== null && e.updatePresenceForUser(
|
|
1791
|
-
|
|
1791
|
+
k.user_id,
|
|
1792
1792
|
O.status,
|
|
1793
1793
|
O.lastSeenAt
|
|
1794
1794
|
);
|
|
1795
1795
|
}
|
|
1796
1796
|
async function f() {
|
|
1797
|
-
const
|
|
1797
|
+
const k = [...new Set(
|
|
1798
1798
|
e.conversations.filter((O) => O.type === "dm" && typeof O.other_user_id == "string" && O.other_user_id.length > 0).map((O) => O.other_user_id)
|
|
1799
1799
|
)];
|
|
1800
|
-
if (
|
|
1800
|
+
if (k.length !== 0)
|
|
1801
1801
|
try {
|
|
1802
1802
|
const O = await o.get("/v1/presence/users", {
|
|
1803
|
-
params: { ids:
|
|
1803
|
+
params: { ids: k }
|
|
1804
1804
|
}), H = O.data?.data?.items ?? O.data?.items ?? [];
|
|
1805
1805
|
for (const F of H) {
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1806
|
+
const J = zn(F);
|
|
1807
|
+
J.status !== null && e.updatePresenceForUser(F.id, J.status, J.lastSeenAt);
|
|
1808
1808
|
}
|
|
1809
1809
|
} catch (O) {
|
|
1810
1810
|
Ue.warn("Failed to refresh messaging presence snapshot", O);
|
|
1811
1811
|
}
|
|
1812
1812
|
}
|
|
1813
1813
|
function m() {
|
|
1814
|
-
!Pe() ||
|
|
1814
|
+
!Pe() || x || (Ei(C), x = !0);
|
|
1815
1815
|
}
|
|
1816
1816
|
function v() {
|
|
1817
|
-
|
|
1817
|
+
x && (Ai(), x = !1);
|
|
1818
1818
|
}
|
|
1819
|
-
const N =
|
|
1819
|
+
const N = Ut(
|
|
1820
1820
|
l,
|
|
1821
1821
|
() => {
|
|
1822
1822
|
w();
|
|
1823
1823
|
},
|
|
1824
1824
|
{ deep: !1, immediate: !0 }
|
|
1825
|
-
),
|
|
1825
|
+
), q = Ut(
|
|
1826
1826
|
() => u.fullPath,
|
|
1827
1827
|
() => {
|
|
1828
1828
|
w();
|
|
1829
1829
|
}
|
|
1830
|
-
),
|
|
1831
|
-
|
|
1830
|
+
), G = ht((k) => {
|
|
1831
|
+
k === "connected" ? (_(), w(), v(), m(), f()) : (k === "disconnected" || k === "error") && (_(), v());
|
|
1832
1832
|
});
|
|
1833
1833
|
w(), m(), f(), d !== null && De(() => {
|
|
1834
|
-
N(),
|
|
1834
|
+
N(), q(), G(), y(), v();
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
1837
|
function Qa() {
|
|
1838
|
-
const e =
|
|
1838
|
+
const e = ve(Ot());
|
|
1839
1839
|
let n = null;
|
|
1840
|
-
return
|
|
1841
|
-
e.value =
|
|
1840
|
+
return zt(() => {
|
|
1841
|
+
e.value = Ot(), n = wi((i) => {
|
|
1842
1842
|
e.value = i;
|
|
1843
1843
|
});
|
|
1844
1844
|
}), De(() => {
|
|
1845
1845
|
n?.(), n = null;
|
|
1846
1846
|
}), {
|
|
1847
|
-
accessState:
|
|
1848
|
-
isBlocked:
|
|
1849
|
-
isSuspended:
|
|
1847
|
+
accessState: ie(() => e.value),
|
|
1848
|
+
isBlocked: ie(() => e.value !== "available"),
|
|
1849
|
+
isSuspended: ie(() => e.value === "account_suspended")
|
|
1850
1850
|
};
|
|
1851
1851
|
}
|
|
1852
|
-
const
|
|
1852
|
+
const gs = () => null, ms = {
|
|
1853
1853
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
1854
1854
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
1855
1855
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -1860,29 +1860,29 @@ const ps = () => null, gs = {
|
|
|
1860
1860
|
activityDebounceMs: 5e3,
|
|
1861
1861
|
heartbeatIntervalMs: 3e4,
|
|
1862
1862
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
1863
|
-
authTokenResolver:
|
|
1863
|
+
authTokenResolver: gs
|
|
1864
1864
|
};
|
|
1865
|
-
let
|
|
1865
|
+
let lt = { ...ms };
|
|
1866
1866
|
function qo() {
|
|
1867
|
-
return
|
|
1867
|
+
return lt;
|
|
1868
1868
|
}
|
|
1869
1869
|
function zo(e) {
|
|
1870
|
-
|
|
1871
|
-
...
|
|
1870
|
+
lt = {
|
|
1871
|
+
...lt,
|
|
1872
1872
|
...e
|
|
1873
1873
|
};
|
|
1874
1874
|
}
|
|
1875
1875
|
function jo() {
|
|
1876
|
-
|
|
1876
|
+
lt = { ...ms };
|
|
1877
1877
|
}
|
|
1878
1878
|
function $o(e) {
|
|
1879
|
-
return e.authTokenResolver !==
|
|
1879
|
+
return e.authTokenResolver !== gs;
|
|
1880
1880
|
}
|
|
1881
1881
|
const Ho = 429, Bo = 403, Vo = 423, Xo = "ACCOUNT_LIMITED", Wo = "ACCOUNT_SUSPENDED", Go = "ACCOUNT_WRITE_TIMEOUT", Jo = 2, Ko = 5 * 6e4;
|
|
1882
1882
|
function Xe(e) {
|
|
1883
1883
|
return typeof e == "object" && e !== null;
|
|
1884
1884
|
}
|
|
1885
|
-
function
|
|
1885
|
+
function vs(e) {
|
|
1886
1886
|
if (!Xe(e))
|
|
1887
1887
|
return null;
|
|
1888
1888
|
const n = e.response;
|
|
@@ -1897,7 +1897,7 @@ function ms(e) {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
return null;
|
|
1899
1899
|
}
|
|
1900
|
-
function
|
|
1900
|
+
function bs(e) {
|
|
1901
1901
|
if (!Xe(e))
|
|
1902
1902
|
return null;
|
|
1903
1903
|
const n = e.response;
|
|
@@ -1906,12 +1906,12 @@ function vs(e) {
|
|
|
1906
1906
|
const i = n.data;
|
|
1907
1907
|
return Xe(i) && typeof i.code == "string" ? i.code : null;
|
|
1908
1908
|
}
|
|
1909
|
-
function
|
|
1910
|
-
const n =
|
|
1909
|
+
function xt(e) {
|
|
1910
|
+
const n = vs(e), i = bs(e);
|
|
1911
1911
|
return n === Ho && i === Xo || n === Vo && i === Go;
|
|
1912
1912
|
}
|
|
1913
|
-
function
|
|
1914
|
-
const n =
|
|
1913
|
+
function kt(e) {
|
|
1914
|
+
const n = vs(e), i = bs(e);
|
|
1915
1915
|
return n === Bo && i === Wo ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
1916
1916
|
}
|
|
1917
1917
|
function Ge() {
|
|
@@ -1931,7 +1931,7 @@ function Yo(e) {
|
|
|
1931
1931
|
const o = Number.parseInt(i, 10);
|
|
1932
1932
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
1933
1933
|
}
|
|
1934
|
-
function
|
|
1934
|
+
function Lt(e, n = Date.now()) {
|
|
1935
1935
|
const i = Ge(), o = Yo(e);
|
|
1936
1936
|
return o === null ? !1 : o <= n ? (i?.removeItem(e), !1) : !0;
|
|
1937
1937
|
}
|
|
@@ -1966,8 +1966,8 @@ function na(e, n, i) {
|
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
1968
|
function Ya() {
|
|
1969
|
-
const e = Fe()(), n = qo(), i =
|
|
1970
|
-
let u = null, d = null, l = !1, g =
|
|
1969
|
+
const e = Fe()(), n = qo(), i = hs(), o = Qo(n.clientIdStorageKey);
|
|
1970
|
+
let u = null, d = null, l = !1, g = Lt(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null, _ = 0;
|
|
1971
1971
|
const T = () => $o(n) ? n.authTokenResolver() !== null : !0, y = () => {
|
|
1972
1972
|
u && (clearInterval(u), u = null);
|
|
1973
1973
|
}, w = () => {
|
|
@@ -1977,43 +1977,43 @@ function Ya() {
|
|
|
1977
1977
|
F();
|
|
1978
1978
|
}, n.heartbeatIntervalMs);
|
|
1979
1979
|
}, f = (I) => {
|
|
1980
|
-
g || console.warn(I), Zo(n.accountLimitedUntilStorageKey), g = !0, l = !1,
|
|
1980
|
+
g || console.warn(I), Zo(n.accountLimitedUntilStorageKey), g = !0, l = !1, M = null, y(), w();
|
|
1981
1981
|
}, m = async (I) => {
|
|
1982
|
-
if (!(!l ||
|
|
1982
|
+
if (!(!l || x || g || h) && T() && M !== I)
|
|
1983
1983
|
try {
|
|
1984
|
-
await i.patch(n.statusUrl, { status: I }),
|
|
1984
|
+
await i.patch(n.statusUrl, { status: I }), M = I;
|
|
1985
1985
|
} catch (ae) {
|
|
1986
|
-
if (
|
|
1986
|
+
if (xt(ae)) {
|
|
1987
1987
|
f("[Presence] Presence updates paused: account is temporarily limited");
|
|
1988
1988
|
return;
|
|
1989
1989
|
}
|
|
1990
|
-
|
|
1990
|
+
kt(ae) && (h = !0, l = !1, M = null, y(), w());
|
|
1991
1991
|
}
|
|
1992
1992
|
}, v = () => {
|
|
1993
|
-
w(), !(!l ||
|
|
1993
|
+
w(), !(!l || x || g || h || document.visibilityState !== "visible") && (d = setTimeout(() => {
|
|
1994
1994
|
d = null, m("idle");
|
|
1995
1995
|
}, n.idleAfterMs));
|
|
1996
1996
|
}, N = () => {
|
|
1997
|
-
if (
|
|
1997
|
+
if (x || !l || g || h || document.visibilityState !== "visible")
|
|
1998
1998
|
return;
|
|
1999
1999
|
const I = Date.now();
|
|
2000
2000
|
I - _ < n.activityDebounceMs || (_ = I, m("online"), v());
|
|
2001
|
-
},
|
|
2001
|
+
}, q = () => {
|
|
2002
2002
|
N();
|
|
2003
|
-
},
|
|
2004
|
-
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown",
|
|
2005
|
-
},
|
|
2006
|
-
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown",
|
|
2003
|
+
}, G = () => {
|
|
2004
|
+
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", q, { passive: !0 }), document.addEventListener("keydown", q), document.addEventListener("touchstart", q, { passive: !0 }), window.addEventListener("focus", q));
|
|
2005
|
+
}, k = () => {
|
|
2006
|
+
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2007
2007
|
}, O = async () => {
|
|
2008
|
-
if (
|
|
2008
|
+
if (Lt(n.accountLimitedUntilStorageKey))
|
|
2009
2009
|
return g = !0, "account_limited";
|
|
2010
2010
|
try {
|
|
2011
2011
|
return await i.post(n.sessionOpenUrl, {
|
|
2012
2012
|
client_id: o,
|
|
2013
2013
|
user_agent: n.userAgentResolver()
|
|
2014
|
-
}), ea(n.accountLimitedUntilStorageKey), g = !1, h = !1, l = !0,
|
|
2014
|
+
}), ea(n.accountLimitedUntilStorageKey), g = !1, h = !1, l = !0, M = null, "opened";
|
|
2015
2015
|
} catch (I) {
|
|
2016
|
-
return
|
|
2016
|
+
return xt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : kt(I) ? (h = !0, l = !1, M = null, y(), w(), "account_suspended") : "failed";
|
|
2017
2017
|
}
|
|
2018
2018
|
}, H = async () => {
|
|
2019
2019
|
for (let I = 0; I < Jo; I += 1)
|
|
@@ -2025,16 +2025,16 @@ function Ya() {
|
|
|
2025
2025
|
try {
|
|
2026
2026
|
await i.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2027
2027
|
} catch (I) {
|
|
2028
|
-
if (
|
|
2028
|
+
if (xt(I)) {
|
|
2029
2029
|
f("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2030
2030
|
return;
|
|
2031
2031
|
}
|
|
2032
|
-
|
|
2032
|
+
kt(I) && (h = !0, l = !1, M = null, y(), w());
|
|
2033
2033
|
}
|
|
2034
|
-
},
|
|
2034
|
+
}, J = () => {
|
|
2035
2035
|
if (!l)
|
|
2036
2036
|
return;
|
|
2037
|
-
l = !1,
|
|
2037
|
+
l = !1, M = null, w();
|
|
2038
2038
|
const I = na(
|
|
2039
2039
|
n.sessionCloseUrl,
|
|
2040
2040
|
o,
|
|
@@ -2047,188 +2047,188 @@ function Ya() {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
i.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2049
2049
|
});
|
|
2050
|
-
},
|
|
2051
|
-
if (!
|
|
2052
|
-
if (await H(),
|
|
2053
|
-
|
|
2050
|
+
}, me = async () => {
|
|
2051
|
+
if (!x) {
|
|
2052
|
+
if (await H(), x) {
|
|
2053
|
+
J();
|
|
2054
2054
|
return;
|
|
2055
2055
|
}
|
|
2056
2056
|
l && (C(), m("online"), v());
|
|
2057
2057
|
}
|
|
2058
|
-
},
|
|
2059
|
-
if (!
|
|
2058
|
+
}, ee = () => {
|
|
2059
|
+
if (!x) {
|
|
2060
2060
|
if (document.visibilityState === "hidden") {
|
|
2061
|
-
|
|
2061
|
+
J(), y(), w();
|
|
2062
2062
|
return;
|
|
2063
2063
|
}
|
|
2064
2064
|
if (document.visibilityState === "visible" && !l) {
|
|
2065
|
-
g =
|
|
2065
|
+
g = Lt(n.accountLimitedUntilStorageKey), !g && !h && me();
|
|
2066
2066
|
return;
|
|
2067
2067
|
}
|
|
2068
2068
|
document.visibilityState === "visible" && l && !g && !h && N();
|
|
2069
2069
|
}
|
|
2070
2070
|
}, b = () => {
|
|
2071
|
-
|
|
2071
|
+
x || (J(), y(), w());
|
|
2072
2072
|
};
|
|
2073
|
-
|
|
2073
|
+
zt(async () => {
|
|
2074
2074
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2075
|
-
if (await H(),
|
|
2076
|
-
|
|
2075
|
+
if (await H(), x) {
|
|
2076
|
+
J();
|
|
2077
2077
|
return;
|
|
2078
2078
|
}
|
|
2079
|
-
l && (C(), m("online"), v()),
|
|
2079
|
+
l && (C(), m("online"), v()), G(), document.addEventListener("visibilitychange", ee), window.addEventListener("pagehide", b), window.addEventListener("beforeunload", b);
|
|
2080
2080
|
}
|
|
2081
2081
|
}), De(() => {
|
|
2082
|
-
|
|
2082
|
+
x = !0, k(), w(), y(), J(), document.removeEventListener("visibilitychange", ee), window.removeEventListener("pagehide", b), window.removeEventListener("beforeunload", b);
|
|
2083
2083
|
});
|
|
2084
2084
|
}
|
|
2085
2085
|
const sa = 12e3;
|
|
2086
2086
|
function Za(e) {
|
|
2087
|
-
const n =
|
|
2087
|
+
const n = Wt(), i = Fe()(), o = ve(!1), u = ve(null), d = ve(null), l = ve([]), g = /* @__PURE__ */ new Map(), h = qt(), x = h !== null, M = 20, _ = 250;
|
|
2088
2088
|
let T = !1, y = null, w = 0, C = null;
|
|
2089
|
-
const f =
|
|
2090
|
-
const
|
|
2091
|
-
if (
|
|
2092
|
-
return
|
|
2089
|
+
const f = ie(() => i.currentUser?.id), m = () => Bn(e)?.trim() ?? "", v = () => {
|
|
2090
|
+
const R = d.value?.trim() ?? "";
|
|
2091
|
+
if (R.length > 0)
|
|
2092
|
+
return R;
|
|
2093
2093
|
const U = m();
|
|
2094
2094
|
return U.length > 0 && (d.value = U), U;
|
|
2095
|
-
}, N = (
|
|
2096
|
-
const U = N(
|
|
2095
|
+
}, N = (R) => n.getTypingUsers(R), q = (R) => {
|
|
2096
|
+
const U = N(R);
|
|
2097
2097
|
for (const re of U)
|
|
2098
|
-
n.removeTypingUser(
|
|
2098
|
+
n.removeTypingUser(R, re.id);
|
|
2099
2099
|
l.value = [];
|
|
2100
|
-
},
|
|
2101
|
-
const U = g.get(
|
|
2102
|
-
U && (clearTimeout(U), g.delete(
|
|
2103
|
-
},
|
|
2104
|
-
for (const
|
|
2105
|
-
clearTimeout(
|
|
2100
|
+
}, G = (R) => {
|
|
2101
|
+
const U = g.get(R);
|
|
2102
|
+
U && (clearTimeout(U), g.delete(R));
|
|
2103
|
+
}, k = () => {
|
|
2104
|
+
for (const R of g.values())
|
|
2105
|
+
clearTimeout(R);
|
|
2106
2106
|
g.clear();
|
|
2107
2107
|
}, O = () => {
|
|
2108
2108
|
C && (clearTimeout(C), C = null), w = 0;
|
|
2109
2109
|
}, H = () => {
|
|
2110
|
-
!
|
|
2111
|
-
C = null, w += 1,
|
|
2110
|
+
!x || o.value || C || w >= M || (C = setTimeout(() => {
|
|
2111
|
+
C = null, w += 1, ee();
|
|
2112
2112
|
}, _));
|
|
2113
|
-
}, F = (
|
|
2114
|
-
|
|
2113
|
+
}, F = (R, U) => {
|
|
2114
|
+
G(R);
|
|
2115
2115
|
const re = setTimeout(() => {
|
|
2116
|
-
g.delete(
|
|
2116
|
+
g.delete(R), n.removeTypingUser(U, R), l.value = l.value.filter((fe) => fe.id !== R);
|
|
2117
2117
|
}, sa);
|
|
2118
|
-
g.set(
|
|
2119
|
-
},
|
|
2118
|
+
g.set(R, re);
|
|
2119
|
+
}, J = () => {
|
|
2120
2120
|
T = !0, O();
|
|
2121
|
-
},
|
|
2121
|
+
}, me = (R) => {
|
|
2122
2122
|
try {
|
|
2123
|
-
y && (y(), y = null), y = Mi(
|
|
2123
|
+
y && (y(), y = null), y = Mi(R, {
|
|
2124
2124
|
onTypingStart: I,
|
|
2125
2125
|
onTypingStop: ae
|
|
2126
|
-
}), O(), o.value = !0, d.value =
|
|
2126
|
+
}), O(), o.value = !0, d.value = R;
|
|
2127
2127
|
} catch (U) {
|
|
2128
2128
|
u.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
|
|
2129
2129
|
}
|
|
2130
|
-
},
|
|
2131
|
-
const
|
|
2132
|
-
if (!(o.value || !
|
|
2133
|
-
if (u.value = null, Pe() &&
|
|
2134
|
-
|
|
2130
|
+
}, ee = () => {
|
|
2131
|
+
const R = m();
|
|
2132
|
+
if (!(o.value || !R)) {
|
|
2133
|
+
if (u.value = null, Pe() && wn() === "connected") {
|
|
2134
|
+
me(R);
|
|
2135
2135
|
return;
|
|
2136
2136
|
}
|
|
2137
2137
|
T = !1, Ci().then((U) => {
|
|
2138
2138
|
if (T || o.value || !U)
|
|
2139
2139
|
return;
|
|
2140
2140
|
const re = m();
|
|
2141
|
-
if (re && re ===
|
|
2142
|
-
|
|
2141
|
+
if (re && re === R && Pe() && wn() === "connected") {
|
|
2142
|
+
me(re);
|
|
2143
2143
|
return;
|
|
2144
2144
|
}
|
|
2145
2145
|
H();
|
|
2146
2146
|
}), H();
|
|
2147
2147
|
}
|
|
2148
2148
|
}, b = () => {
|
|
2149
|
-
const
|
|
2150
|
-
if (
|
|
2149
|
+
const R = d.value;
|
|
2150
|
+
if (J(), !(!o.value || !R))
|
|
2151
2151
|
try {
|
|
2152
|
-
y && (y(), y = null), xi(
|
|
2152
|
+
y && (y(), y = null), xi(R), k(), q(R), o.value = !1, d.value = null, u.value = null;
|
|
2153
2153
|
} catch (U) {
|
|
2154
2154
|
u.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2155
2155
|
}
|
|
2156
2156
|
};
|
|
2157
|
-
function I(
|
|
2158
|
-
if (
|
|
2157
|
+
function I(R) {
|
|
2158
|
+
if (R.user_id === f.value)
|
|
2159
2159
|
return;
|
|
2160
2160
|
const U = v();
|
|
2161
2161
|
if (!U)
|
|
2162
2162
|
return;
|
|
2163
2163
|
const re = {
|
|
2164
|
-
id:
|
|
2165
|
-
name:
|
|
2166
|
-
...
|
|
2164
|
+
id: R.user.id,
|
|
2165
|
+
name: R.user.name,
|
|
2166
|
+
...R.user.avatar !== void 0 ? { avatar: R.user.avatar } : {}
|
|
2167
2167
|
};
|
|
2168
|
-
l.value.some((
|
|
2168
|
+
l.value.some((fe) => fe.id === re.id) || (l.value = [...l.value, re]), n.addTypingUser(U, re), F(R.user_id, U);
|
|
2169
2169
|
}
|
|
2170
|
-
function ae(
|
|
2171
|
-
if (
|
|
2170
|
+
function ae(R) {
|
|
2171
|
+
if (R.user_id === f.value)
|
|
2172
2172
|
return;
|
|
2173
|
-
|
|
2173
|
+
G(R.user_id);
|
|
2174
2174
|
const U = v();
|
|
2175
|
-
U && (l.value = l.value.filter((re) => re.id !==
|
|
2175
|
+
U && (l.value = l.value.filter((re) => re.id !== R.user_id), n.removeTypingUser(U, R.user_id));
|
|
2176
2176
|
}
|
|
2177
|
-
const B =
|
|
2178
|
-
const
|
|
2179
|
-
if (!
|
|
2177
|
+
const B = ie(() => {
|
|
2178
|
+
const R = v();
|
|
2179
|
+
if (!R)
|
|
2180
2180
|
return l.value;
|
|
2181
|
-
const U = N(
|
|
2181
|
+
const U = N(R);
|
|
2182
2182
|
if (l.value.length === 0)
|
|
2183
2183
|
return U;
|
|
2184
2184
|
if (U.length === 0)
|
|
2185
2185
|
return l.value;
|
|
2186
2186
|
const re = /* @__PURE__ */ new Map();
|
|
2187
|
-
for (const
|
|
2188
|
-
re.set(
|
|
2189
|
-
for (const
|
|
2190
|
-
re.set(
|
|
2187
|
+
for (const fe of U)
|
|
2188
|
+
re.set(fe.id, fe);
|
|
2189
|
+
for (const fe of l.value)
|
|
2190
|
+
re.set(fe.id, fe);
|
|
2191
2191
|
return [...re.values()];
|
|
2192
|
-
}),
|
|
2193
|
-
const
|
|
2194
|
-
if (
|
|
2192
|
+
}), A = ie(() => {
|
|
2193
|
+
const R = B.value;
|
|
2194
|
+
if (R.length === 0)
|
|
2195
2195
|
return "";
|
|
2196
|
-
const U =
|
|
2196
|
+
const U = R[0];
|
|
2197
2197
|
if (!U)
|
|
2198
2198
|
return "";
|
|
2199
|
-
if (
|
|
2199
|
+
if (R.length === 1)
|
|
2200
2200
|
return `${U.name} is typing...`;
|
|
2201
|
-
const re =
|
|
2201
|
+
const re = R[1];
|
|
2202
2202
|
if (!re)
|
|
2203
|
-
return `${
|
|
2204
|
-
if (
|
|
2203
|
+
return `${R.length} people are typing...`;
|
|
2204
|
+
if (R.length === 2)
|
|
2205
2205
|
return `${U.name} and ${re.name} are typing...`;
|
|
2206
|
-
const
|
|
2207
|
-
return
|
|
2208
|
-
}), V =
|
|
2209
|
-
o.value ||
|
|
2206
|
+
const fe = R[2];
|
|
2207
|
+
return fe ? R.length === 3 ? `${U.name}, ${re.name} and ${fe.name} are typing...` : `${R.length} people are typing...` : `${R.length} people are typing...`;
|
|
2208
|
+
}), V = ie(() => B.value.length > 0), ne = () => {
|
|
2209
|
+
o.value || ee();
|
|
2210
2210
|
};
|
|
2211
|
-
typeof window < "u" && window.addEventListener(We(),
|
|
2212
|
-
const _e =
|
|
2213
|
-
if (
|
|
2214
|
-
o.value ||
|
|
2211
|
+
typeof window < "u" && window.addEventListener(We(), ne);
|
|
2212
|
+
const _e = ht((R) => {
|
|
2213
|
+
if (R === "connected") {
|
|
2214
|
+
o.value || ee();
|
|
2215
2215
|
return;
|
|
2216
2216
|
}
|
|
2217
|
-
if (
|
|
2218
|
-
|
|
2217
|
+
if (R === "disconnected" || R === "error") {
|
|
2218
|
+
J(), y && (y(), y = null);
|
|
2219
2219
|
const U = v();
|
|
2220
|
-
U &&
|
|
2220
|
+
U && q(U), o.value = !1, d.value = null, k();
|
|
2221
2221
|
}
|
|
2222
2222
|
});
|
|
2223
2223
|
return h !== null && De(() => {
|
|
2224
|
-
|
|
2224
|
+
J(), _e(), k(), b(), typeof window < "u" && window.removeEventListener(We(), ne);
|
|
2225
2225
|
}), {
|
|
2226
|
-
isSubscribed:
|
|
2227
|
-
error:
|
|
2226
|
+
isSubscribed: ie(() => o.value),
|
|
2227
|
+
error: ie(() => u.value),
|
|
2228
2228
|
typingUsers: B,
|
|
2229
|
-
formatTypingIndicator:
|
|
2229
|
+
formatTypingIndicator: A,
|
|
2230
2230
|
hasTypingUsers: V,
|
|
2231
|
-
subscribe:
|
|
2231
|
+
subscribe: ee,
|
|
2232
2232
|
unsubscribe: b
|
|
2233
2233
|
};
|
|
2234
2234
|
}
|
|
@@ -2238,7 +2238,7 @@ function ec(e) {
|
|
|
2238
2238
|
function tc() {
|
|
2239
2239
|
zi(), Ro(), $i(), Vi(), wo(), Uo(), Li(), _o(), jo();
|
|
2240
2240
|
}
|
|
2241
|
-
class
|
|
2241
|
+
class Yt {
|
|
2242
2242
|
constructor() {
|
|
2243
2243
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2244
2244
|
}
|
|
@@ -2267,7 +2267,7 @@ class Qt {
|
|
|
2267
2267
|
return this.stopListening(".client-" + n, i);
|
|
2268
2268
|
}
|
|
2269
2269
|
}
|
|
2270
|
-
class
|
|
2270
|
+
class ys {
|
|
2271
2271
|
/**
|
|
2272
2272
|
* Create a new class instance.
|
|
2273
2273
|
*/
|
|
@@ -2296,12 +2296,12 @@ function ra(e) {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
return !0;
|
|
2298
2298
|
}
|
|
2299
|
-
class
|
|
2299
|
+
class Zt extends Yt {
|
|
2300
2300
|
/**
|
|
2301
2301
|
* Create a new class instance.
|
|
2302
2302
|
*/
|
|
2303
2303
|
constructor(n, i, o) {
|
|
2304
|
-
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2304
|
+
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new ys(this.options.namespace), this.subscribe();
|
|
2305
2305
|
}
|
|
2306
2306
|
/**
|
|
2307
2307
|
* Subscribe to a Pusher channel.
|
|
@@ -2373,7 +2373,7 @@ class Yt extends Qt {
|
|
|
2373
2373
|
return this.subscription.bind(n, i), this;
|
|
2374
2374
|
}
|
|
2375
2375
|
}
|
|
2376
|
-
class
|
|
2376
|
+
class _s extends Zt {
|
|
2377
2377
|
/**
|
|
2378
2378
|
* Send a whisper event to other clients in the channel.
|
|
2379
2379
|
*/
|
|
@@ -2384,7 +2384,7 @@ class ys extends Yt {
|
|
|
2384
2384
|
), this;
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
2387
|
-
class ia extends
|
|
2387
|
+
class ia extends Zt {
|
|
2388
2388
|
/**
|
|
2389
2389
|
* Send a whisper event to other clients in the channel.
|
|
2390
2390
|
*/
|
|
@@ -2395,7 +2395,7 @@ class ia extends Yt {
|
|
|
2395
2395
|
), this;
|
|
2396
2396
|
}
|
|
2397
2397
|
}
|
|
2398
|
-
class oa extends
|
|
2398
|
+
class oa extends _s {
|
|
2399
2399
|
/**
|
|
2400
2400
|
* Register a callback to be called anytime the member list changes.
|
|
2401
2401
|
*/
|
|
@@ -2430,12 +2430,12 @@ class oa extends ys {
|
|
|
2430
2430
|
}), this;
|
|
2431
2431
|
}
|
|
2432
2432
|
}
|
|
2433
|
-
class
|
|
2433
|
+
class Ss extends Yt {
|
|
2434
2434
|
/**
|
|
2435
2435
|
* Create a new class instance.
|
|
2436
2436
|
*/
|
|
2437
2437
|
constructor(n, i, o) {
|
|
2438
|
-
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2438
|
+
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new ys(this.options.namespace), this.subscribe();
|
|
2439
2439
|
}
|
|
2440
2440
|
/**
|
|
2441
2441
|
* Subscribe to a Socket.io channel.
|
|
@@ -2506,7 +2506,7 @@ class _s extends Qt {
|
|
|
2506
2506
|
)), (!i || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
|
-
class
|
|
2509
|
+
class Cs extends Ss {
|
|
2510
2510
|
/**
|
|
2511
2511
|
* Send a whisper event to other clients in the channel.
|
|
2512
2512
|
*/
|
|
@@ -2518,7 +2518,7 @@ class Ss extends _s {
|
|
|
2518
2518
|
}), this;
|
|
2519
2519
|
}
|
|
2520
2520
|
}
|
|
2521
|
-
class aa extends
|
|
2521
|
+
class aa extends Cs {
|
|
2522
2522
|
/**
|
|
2523
2523
|
* Register a callback to be called anytime the member list changes.
|
|
2524
2524
|
*/
|
|
@@ -2556,7 +2556,7 @@ class aa extends Ss {
|
|
|
2556
2556
|
), this;
|
|
2557
2557
|
}
|
|
2558
2558
|
}
|
|
2559
|
-
class
|
|
2559
|
+
class dt extends Yt {
|
|
2560
2560
|
/**
|
|
2561
2561
|
* Subscribe to a channel.
|
|
2562
2562
|
*/
|
|
@@ -2604,7 +2604,7 @@ class lt extends Qt {
|
|
|
2604
2604
|
return this;
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
2607
|
-
class
|
|
2607
|
+
class ws extends dt {
|
|
2608
2608
|
/**
|
|
2609
2609
|
* Send a whisper event to other clients in the channel.
|
|
2610
2610
|
*/
|
|
@@ -2612,7 +2612,7 @@ class Cs extends lt {
|
|
|
2612
2612
|
return this;
|
|
2613
2613
|
}
|
|
2614
2614
|
}
|
|
2615
|
-
class ca extends
|
|
2615
|
+
class ca extends dt {
|
|
2616
2616
|
/**
|
|
2617
2617
|
* Send a whisper event to other clients in the channel.
|
|
2618
2618
|
*/
|
|
@@ -2620,7 +2620,7 @@ class ca extends lt {
|
|
|
2620
2620
|
return this;
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
|
-
class ua extends
|
|
2623
|
+
class ua extends ws {
|
|
2624
2624
|
/**
|
|
2625
2625
|
* Register a callback to be called anytime the member list changes.
|
|
2626
2626
|
*/
|
|
@@ -2646,7 +2646,7 @@ class ua extends Cs {
|
|
|
2646
2646
|
return this;
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
|
-
const
|
|
2649
|
+
const Ts = class Es {
|
|
2650
2650
|
/**
|
|
2651
2651
|
* Create a new class instance.
|
|
2652
2652
|
*/
|
|
@@ -2658,7 +2658,7 @@ const ws = class Ts {
|
|
|
2658
2658
|
*/
|
|
2659
2659
|
setOptions(n) {
|
|
2660
2660
|
this.options = {
|
|
2661
|
-
...
|
|
2661
|
+
...Es._defaultOptions,
|
|
2662
2662
|
...n,
|
|
2663
2663
|
broadcaster: n.broadcaster
|
|
2664
2664
|
};
|
|
@@ -2673,7 +2673,7 @@ const ws = class Ts {
|
|
|
2673
2673
|
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;
|
|
2674
2674
|
}
|
|
2675
2675
|
};
|
|
2676
|
-
|
|
2676
|
+
Ts._defaultOptions = {
|
|
2677
2677
|
auth: {
|
|
2678
2678
|
headers: {}
|
|
2679
2679
|
},
|
|
@@ -2688,8 +2688,8 @@ ws._defaultOptions = {
|
|
|
2688
2688
|
key: null,
|
|
2689
2689
|
namespace: "App.Events"
|
|
2690
2690
|
};
|
|
2691
|
-
let
|
|
2692
|
-
class
|
|
2691
|
+
let en = Ts;
|
|
2692
|
+
class ot extends en {
|
|
2693
2693
|
constructor() {
|
|
2694
2694
|
super(...arguments), this.channels = {};
|
|
2695
2695
|
}
|
|
@@ -2727,7 +2727,7 @@ class it extends Zt {
|
|
|
2727
2727
|
* Get a channel instance by name.
|
|
2728
2728
|
*/
|
|
2729
2729
|
channel(n) {
|
|
2730
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2730
|
+
return this.channels[n] || (this.channels[n] = new Zt(
|
|
2731
2731
|
this.pusher,
|
|
2732
2732
|
n,
|
|
2733
2733
|
this.options
|
|
@@ -2737,7 +2737,7 @@ class it extends Zt {
|
|
|
2737
2737
|
* Get a private channel instance by name.
|
|
2738
2738
|
*/
|
|
2739
2739
|
privateChannel(n) {
|
|
2740
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2740
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new _s(
|
|
2741
2741
|
this.pusher,
|
|
2742
2742
|
"private-" + n,
|
|
2743
2743
|
this.options
|
|
@@ -2826,7 +2826,7 @@ class it extends Zt {
|
|
|
2826
2826
|
this.pusher.disconnect();
|
|
2827
2827
|
}
|
|
2828
2828
|
}
|
|
2829
|
-
class la extends
|
|
2829
|
+
class la extends en {
|
|
2830
2830
|
constructor() {
|
|
2831
2831
|
super(...arguments), this.channels = {};
|
|
2832
2832
|
}
|
|
@@ -2866,7 +2866,7 @@ class la extends Zt {
|
|
|
2866
2866
|
* Get a channel instance by name.
|
|
2867
2867
|
*/
|
|
2868
2868
|
channel(n) {
|
|
2869
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2869
|
+
return this.channels[n] || (this.channels[n] = new Ss(
|
|
2870
2870
|
this.socket,
|
|
2871
2871
|
n,
|
|
2872
2872
|
this.options
|
|
@@ -2876,7 +2876,7 @@ class la extends Zt {
|
|
|
2876
2876
|
* Get a private channel instance by name.
|
|
2877
2877
|
*/
|
|
2878
2878
|
privateChannel(n) {
|
|
2879
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2879
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Cs(
|
|
2880
2880
|
this.socket,
|
|
2881
2881
|
"private-" + n,
|
|
2882
2882
|
this.options
|
|
@@ -2948,7 +2948,7 @@ class la extends Zt {
|
|
|
2948
2948
|
this.socket.disconnect();
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
|
-
class
|
|
2951
|
+
class jn extends en {
|
|
2952
2952
|
constructor() {
|
|
2953
2953
|
super(...arguments), this.channels = {};
|
|
2954
2954
|
}
|
|
@@ -2961,19 +2961,19 @@ class zn extends Zt {
|
|
|
2961
2961
|
* Listen for an event on a channel instance.
|
|
2962
2962
|
*/
|
|
2963
2963
|
listen(n, i, o) {
|
|
2964
|
-
return new
|
|
2964
|
+
return new dt();
|
|
2965
2965
|
}
|
|
2966
2966
|
/**
|
|
2967
2967
|
* Get a channel instance by name.
|
|
2968
2968
|
*/
|
|
2969
2969
|
channel(n) {
|
|
2970
|
-
return new
|
|
2970
|
+
return new dt();
|
|
2971
2971
|
}
|
|
2972
2972
|
/**
|
|
2973
2973
|
* Get a private channel instance by name.
|
|
2974
2974
|
*/
|
|
2975
2975
|
privateChannel(n) {
|
|
2976
|
-
return new
|
|
2976
|
+
return new ws();
|
|
2977
2977
|
}
|
|
2978
2978
|
/**
|
|
2979
2979
|
* Get a private encrypted channel instance by name.
|
|
@@ -3040,14 +3040,14 @@ class da {
|
|
|
3040
3040
|
*/
|
|
3041
3041
|
connect() {
|
|
3042
3042
|
if (this.options.broadcaster === "reverb")
|
|
3043
|
-
this.connector = new
|
|
3043
|
+
this.connector = new ot({
|
|
3044
3044
|
...this.options,
|
|
3045
3045
|
cluster: ""
|
|
3046
3046
|
});
|
|
3047
3047
|
else if (this.options.broadcaster === "pusher")
|
|
3048
|
-
this.connector = new
|
|
3048
|
+
this.connector = new ot(this.options);
|
|
3049
3049
|
else if (this.options.broadcaster === "ably")
|
|
3050
|
-
this.connector = new
|
|
3050
|
+
this.connector = new ot({
|
|
3051
3051
|
...this.options,
|
|
3052
3052
|
cluster: "",
|
|
3053
3053
|
broadcaster: "pusher"
|
|
@@ -3055,7 +3055,7 @@ class da {
|
|
|
3055
3055
|
else if (this.options.broadcaster === "socket.io")
|
|
3056
3056
|
this.connector = new la(this.options);
|
|
3057
3057
|
else if (this.options.broadcaster === "null")
|
|
3058
|
-
this.connector = new
|
|
3058
|
+
this.connector = new jn(this.options);
|
|
3059
3059
|
else if (typeof this.options.broadcaster == "function" && ra(this.options.broadcaster))
|
|
3060
3060
|
this.connector = new this.options.broadcaster(this.options);
|
|
3061
3061
|
else
|
|
@@ -3119,7 +3119,7 @@ class da {
|
|
|
3119
3119
|
);
|
|
3120
3120
|
}
|
|
3121
3121
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3122
|
-
return n instanceof
|
|
3122
|
+
return n instanceof ot || n instanceof jn;
|
|
3123
3123
|
}
|
|
3124
3124
|
/**
|
|
3125
3125
|
* Get the Socket ID for the connection.
|
|
@@ -3183,10 +3183,10 @@ class da {
|
|
|
3183
3183
|
function ha(e) {
|
|
3184
3184
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3185
3185
|
}
|
|
3186
|
-
var
|
|
3187
|
-
var
|
|
3186
|
+
var It = { exports: {} };
|
|
3187
|
+
var $n;
|
|
3188
3188
|
function fa() {
|
|
3189
|
-
return
|
|
3189
|
+
return $n || ($n = 1, (function(e, n) {
|
|
3190
3190
|
(function(o, u) {
|
|
3191
3191
|
e.exports = u();
|
|
3192
3192
|
})(window, function() {
|
|
@@ -3215,8 +3215,8 @@ function fa() {
|
|
|
3215
3215
|
}, u.t = function(d, l) {
|
|
3216
3216
|
if (l & 1 && (d = u(d)), l & 8 || l & 4 && typeof d == "object" && d && d.__esModule) return d;
|
|
3217
3217
|
var g = /* @__PURE__ */ Object.create(null);
|
|
3218
|
-
if (u.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: d }), l & 2 && typeof d != "string") for (var h in d) u.d(g, h, (function(
|
|
3219
|
-
return d[
|
|
3218
|
+
if (u.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: d }), l & 2 && typeof d != "string") for (var h in d) u.d(g, h, (function(x) {
|
|
3219
|
+
return d[x];
|
|
3220
3220
|
}).bind(null, h));
|
|
3221
3221
|
return g;
|
|
3222
3222
|
}, u.n = function(d) {
|
|
@@ -3244,7 +3244,7 @@ function fa() {
|
|
|
3244
3244
|
return C = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(v, N) {
|
|
3245
3245
|
v.__proto__ = N;
|
|
3246
3246
|
} || function(v, N) {
|
|
3247
|
-
for (var
|
|
3247
|
+
for (var q in N) N.hasOwnProperty(q) && (v[q] = N[q]);
|
|
3248
3248
|
}, C(f, m);
|
|
3249
3249
|
};
|
|
3250
3250
|
return function(f, m) {
|
|
@@ -3269,10 +3269,10 @@ function fa() {
|
|
|
3269
3269
|
var N = f[v] << 16 | f[v + 1] << 8 | f[v + 2];
|
|
3270
3270
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), m += this._encodeByte(N >>> 6 & 63), m += this._encodeByte(N >>> 0 & 63);
|
|
3271
3271
|
}
|
|
3272
|
-
var
|
|
3273
|
-
if (
|
|
3274
|
-
var N = f[v] << 16 | (
|
|
3275
|
-
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63),
|
|
3272
|
+
var q = f.length - v;
|
|
3273
|
+
if (q > 0) {
|
|
3274
|
+
var N = f[v] << 16 | (q === 2 ? f[v + 1] << 8 : 0);
|
|
3275
|
+
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 || "";
|
|
3276
3276
|
}
|
|
3277
3277
|
return m;
|
|
3278
3278
|
}, C.prototype.maxDecodedLength = function(f) {
|
|
@@ -3282,9 +3282,9 @@ function fa() {
|
|
|
3282
3282
|
}, C.prototype.decode = function(f) {
|
|
3283
3283
|
if (f.length === 0)
|
|
3284
3284
|
return new Uint8Array(0);
|
|
3285
|
-
for (var m = this._getPaddingLength(f), v = f.length - m, N = new Uint8Array(this.maxDecodedLength(v)),
|
|
3286
|
-
O = this._decodeChar(f.charCodeAt(
|
|
3287
|
-
if (
|
|
3285
|
+
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)
|
|
3286
|
+
O = this._decodeChar(f.charCodeAt(G + 0)), H = this._decodeChar(f.charCodeAt(G + 1)), F = this._decodeChar(f.charCodeAt(G + 2)), J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = O << 2 | H >>> 4, N[q++] = H << 4 | F >>> 2, N[q++] = F << 6 | J, k |= O & l, k |= H & l, k |= F & l, k |= J & l;
|
|
3287
|
+
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 & l, k |= H & l), G < v - 2 && (F = this._decodeChar(f.charCodeAt(G + 2)), N[q++] = H << 4 | F >>> 2, k |= F & l), G < v - 3 && (J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = F << 6 | J, k |= J & l), k !== 0)
|
|
3288
3288
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3289
3289
|
return N;
|
|
3290
3290
|
}, C.prototype._encodeByte = function(f) {
|
|
@@ -3307,14 +3307,14 @@ function fa() {
|
|
|
3307
3307
|
);
|
|
3308
3308
|
o.Coder = g;
|
|
3309
3309
|
var h = new g();
|
|
3310
|
-
function
|
|
3310
|
+
function x(C) {
|
|
3311
3311
|
return h.encode(C);
|
|
3312
3312
|
}
|
|
3313
|
-
o.encode =
|
|
3314
|
-
function
|
|
3313
|
+
o.encode = x;
|
|
3314
|
+
function M(C) {
|
|
3315
3315
|
return h.decode(C);
|
|
3316
3316
|
}
|
|
3317
|
-
o.decode =
|
|
3317
|
+
o.decode = M;
|
|
3318
3318
|
var _ = (
|
|
3319
3319
|
/** @class */
|
|
3320
3320
|
(function(C) {
|
|
@@ -3353,17 +3353,17 @@ function fa() {
|
|
|
3353
3353
|
(function(i, o, u) {
|
|
3354
3354
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3355
3355
|
var d = "utf8: invalid string", l = "utf8: invalid source encoding";
|
|
3356
|
-
function g(
|
|
3357
|
-
for (var _ = new Uint8Array(h(
|
|
3358
|
-
var w =
|
|
3359
|
-
w < 128 ? _[T++] = w : w < 2048 ? (_[T++] = 192 | w >> 6, _[T++] = 128 | w & 63) : w < 55296 ? (_[T++] = 224 | w >> 12, _[T++] = 128 | w >> 6 & 63, _[T++] = 128 | w & 63) : (y++, w = (w & 1023) << 10, w |=
|
|
3356
|
+
function g(M) {
|
|
3357
|
+
for (var _ = new Uint8Array(h(M)), T = 0, y = 0; y < M.length; y++) {
|
|
3358
|
+
var w = M.charCodeAt(y);
|
|
3359
|
+
w < 128 ? _[T++] = w : w < 2048 ? (_[T++] = 192 | w >> 6, _[T++] = 128 | w & 63) : w < 55296 ? (_[T++] = 224 | w >> 12, _[T++] = 128 | w >> 6 & 63, _[T++] = 128 | w & 63) : (y++, w = (w & 1023) << 10, w |= M.charCodeAt(y) & 1023, w += 65536, _[T++] = 240 | w >> 18, _[T++] = 128 | w >> 12 & 63, _[T++] = 128 | w >> 6 & 63, _[T++] = 128 | w & 63);
|
|
3360
3360
|
}
|
|
3361
3361
|
return _;
|
|
3362
3362
|
}
|
|
3363
3363
|
o.encode = g;
|
|
3364
|
-
function h(
|
|
3365
|
-
for (var _ = 0, T = 0; T <
|
|
3366
|
-
var y =
|
|
3364
|
+
function h(M) {
|
|
3365
|
+
for (var _ = 0, T = 0; T < M.length; T++) {
|
|
3366
|
+
var y = M.charCodeAt(T);
|
|
3367
3367
|
if (y < 128)
|
|
3368
3368
|
_ += 1;
|
|
3369
3369
|
else if (y < 2048)
|
|
@@ -3371,7 +3371,7 @@ function fa() {
|
|
|
3371
3371
|
else if (y < 55296)
|
|
3372
3372
|
_ += 3;
|
|
3373
3373
|
else if (y <= 57343) {
|
|
3374
|
-
if (T >=
|
|
3374
|
+
if (T >= M.length - 1)
|
|
3375
3375
|
throw new Error(d);
|
|
3376
3376
|
T++, _ += 4;
|
|
3377
3377
|
} else
|
|
@@ -3380,29 +3380,29 @@ function fa() {
|
|
|
3380
3380
|
return _;
|
|
3381
3381
|
}
|
|
3382
3382
|
o.encodedLength = h;
|
|
3383
|
-
function M
|
|
3384
|
-
for (var _ = [], T = 0; T <
|
|
3385
|
-
var y =
|
|
3383
|
+
function x(M) {
|
|
3384
|
+
for (var _ = [], T = 0; T < M.length; T++) {
|
|
3385
|
+
var y = M[T];
|
|
3386
3386
|
if (y & 128) {
|
|
3387
3387
|
var w = void 0;
|
|
3388
3388
|
if (y < 224) {
|
|
3389
|
-
if (T >=
|
|
3389
|
+
if (T >= M.length)
|
|
3390
3390
|
throw new Error(l);
|
|
3391
|
-
var C =
|
|
3391
|
+
var C = M[++T];
|
|
3392
3392
|
if ((C & 192) !== 128)
|
|
3393
3393
|
throw new Error(l);
|
|
3394
3394
|
y = (y & 31) << 6 | C & 63, w = 128;
|
|
3395
3395
|
} else if (y < 240) {
|
|
3396
|
-
if (T >=
|
|
3396
|
+
if (T >= M.length - 1)
|
|
3397
3397
|
throw new Error(l);
|
|
3398
|
-
var C =
|
|
3398
|
+
var C = M[++T], f = M[++T];
|
|
3399
3399
|
if ((C & 192) !== 128 || (f & 192) !== 128)
|
|
3400
3400
|
throw new Error(l);
|
|
3401
3401
|
y = (y & 15) << 12 | (C & 63) << 6 | f & 63, w = 2048;
|
|
3402
3402
|
} else if (y < 248) {
|
|
3403
|
-
if (T >=
|
|
3403
|
+
if (T >= M.length - 2)
|
|
3404
3404
|
throw new Error(l);
|
|
3405
|
-
var C =
|
|
3405
|
+
var C = M[++T], f = M[++T], m = M[++T];
|
|
3406
3406
|
if ((C & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
|
|
3407
3407
|
throw new Error(l);
|
|
3408
3408
|
y = (y & 15) << 18 | (C & 63) << 12 | (f & 63) << 6 | m & 63, w = 65536;
|
|
@@ -3420,7 +3420,7 @@ function fa() {
|
|
|
3420
3420
|
}
|
|
3421
3421
|
return _.join("");
|
|
3422
3422
|
}
|
|
3423
|
-
o.decode =
|
|
3423
|
+
o.decode = x;
|
|
3424
3424
|
}),
|
|
3425
3425
|
/* 2 */
|
|
3426
3426
|
/***/
|
|
@@ -3474,7 +3474,7 @@ function fa() {
|
|
|
3474
3474
|
cdn_https: "https://js.pusher.com",
|
|
3475
3475
|
dependency_suffix: ""
|
|
3476
3476
|
}, h = g;
|
|
3477
|
-
class
|
|
3477
|
+
class x {
|
|
3478
3478
|
constructor(t) {
|
|
3479
3479
|
this.options = t, this.receivers = t.receivers || l, this.loading = {};
|
|
3480
3480
|
}
|
|
@@ -3486,12 +3486,12 @@ function fa() {
|
|
|
3486
3486
|
c.loading[t] = [a];
|
|
3487
3487
|
var p = j.createScriptRequest(c.getPath(t, s)), S = c.receivers.create(function(L) {
|
|
3488
3488
|
if (c.receivers.remove(S), c.loading[t]) {
|
|
3489
|
-
var
|
|
3489
|
+
var z = c.loading[t];
|
|
3490
3490
|
delete c.loading[t];
|
|
3491
|
-
for (var
|
|
3491
|
+
for (var Q = function(ce) {
|
|
3492
3492
|
ce || p.cleanup();
|
|
3493
|
-
},
|
|
3494
|
-
|
|
3493
|
+
}, te = 0; te < z.length; te++)
|
|
3494
|
+
z[te](L, Q);
|
|
3495
3495
|
}
|
|
3496
3496
|
});
|
|
3497
3497
|
p.send(S);
|
|
@@ -3505,12 +3505,12 @@ function fa() {
|
|
|
3505
3505
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3506
3506
|
}
|
|
3507
3507
|
}
|
|
3508
|
-
var
|
|
3508
|
+
var M = new d("_pusher_dependencies", "Pusher.DependenciesReceivers"), _ = new x({
|
|
3509
3509
|
cdn_http: h.cdn_http,
|
|
3510
3510
|
cdn_https: h.cdn_https,
|
|
3511
3511
|
version: h.VERSION,
|
|
3512
3512
|
suffix: h.dependency_suffix,
|
|
3513
|
-
receivers:
|
|
3513
|
+
receivers: M
|
|
3514
3514
|
});
|
|
3515
3515
|
const T = {
|
|
3516
3516
|
baseUrl: "https://pusher.com",
|
|
@@ -3562,17 +3562,17 @@ function fa() {
|
|
|
3562
3562
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3563
3563
|
}
|
|
3564
3564
|
}
|
|
3565
|
-
class
|
|
3565
|
+
class q extends Error {
|
|
3566
3566
|
constructor(t) {
|
|
3567
3567
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3568
3568
|
}
|
|
3569
3569
|
}
|
|
3570
|
-
class
|
|
3570
|
+
class G extends Error {
|
|
3571
3571
|
constructor(t) {
|
|
3572
3572
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3573
3573
|
}
|
|
3574
3574
|
}
|
|
3575
|
-
class
|
|
3575
|
+
class k extends Error {
|
|
3576
3576
|
constructor(t) {
|
|
3577
3577
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3578
3578
|
}
|
|
@@ -3587,7 +3587,7 @@ function fa() {
|
|
|
3587
3587
|
super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
|
|
3588
3588
|
}
|
|
3589
3589
|
}
|
|
3590
|
-
var
|
|
3590
|
+
var J = function(r, t, s, a, c) {
|
|
3591
3591
|
const p = j.createXHR();
|
|
3592
3592
|
p.open("POST", s.endpoint, !0), p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
3593
3593
|
for (var S in s.headers)
|
|
@@ -3600,13 +3600,13 @@ function fa() {
|
|
|
3600
3600
|
return p.onreadystatechange = function() {
|
|
3601
3601
|
if (p.readyState === 4)
|
|
3602
3602
|
if (p.status === 200) {
|
|
3603
|
-
let L,
|
|
3603
|
+
let L, z = !1;
|
|
3604
3604
|
try {
|
|
3605
|
-
L = JSON.parse(p.responseText),
|
|
3605
|
+
L = JSON.parse(p.responseText), z = !0;
|
|
3606
3606
|
} catch {
|
|
3607
3607
|
c(new H(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
|
|
3608
3608
|
}
|
|
3609
|
-
|
|
3609
|
+
z && c(null, L);
|
|
3610
3610
|
} else {
|
|
3611
3611
|
let L = "";
|
|
3612
3612
|
switch (a) {
|
|
@@ -3621,12 +3621,12 @@ function fa() {
|
|
|
3621
3621
|
}
|
|
3622
3622
|
}, p.send(t), p;
|
|
3623
3623
|
};
|
|
3624
|
-
function
|
|
3625
|
-
return
|
|
3624
|
+
function me(r) {
|
|
3625
|
+
return A(ae(r));
|
|
3626
3626
|
}
|
|
3627
|
-
var
|
|
3627
|
+
var ee = String.fromCharCode, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(r) {
|
|
3628
3628
|
var t = r.charCodeAt(0);
|
|
3629
|
-
return t < 128 ? r : t < 2048 ?
|
|
3629
|
+
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);
|
|
3630
3630
|
}, ae = function(r) {
|
|
3631
3631
|
return r.replace(/[^\x00-\x7F]/g, I);
|
|
3632
3632
|
}, B = function(r) {
|
|
@@ -3637,7 +3637,7 @@ function fa() {
|
|
|
3637
3637
|
t >= 1 ? "=" : b.charAt(s & 63)
|
|
3638
3638
|
];
|
|
3639
3639
|
return a.join("");
|
|
3640
|
-
},
|
|
3640
|
+
}, A = window.btoa || function(r) {
|
|
3641
3641
|
return r.replace(/[\s\S]{1,3}/g, B);
|
|
3642
3642
|
};
|
|
3643
3643
|
class V {
|
|
@@ -3653,28 +3653,28 @@ function fa() {
|
|
|
3653
3653
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
3654
3654
|
}
|
|
3655
3655
|
}
|
|
3656
|
-
var
|
|
3656
|
+
var ne = V;
|
|
3657
3657
|
function _e(r) {
|
|
3658
3658
|
window.clearTimeout(r);
|
|
3659
3659
|
}
|
|
3660
|
-
function
|
|
3660
|
+
function R(r) {
|
|
3661
3661
|
window.clearInterval(r);
|
|
3662
3662
|
}
|
|
3663
|
-
class U extends
|
|
3663
|
+
class U extends ne {
|
|
3664
3664
|
constructor(t, s) {
|
|
3665
3665
|
super(setTimeout, _e, t, function(a) {
|
|
3666
3666
|
return s(), null;
|
|
3667
3667
|
});
|
|
3668
3668
|
}
|
|
3669
3669
|
}
|
|
3670
|
-
class re extends
|
|
3670
|
+
class re extends ne {
|
|
3671
3671
|
constructor(t, s) {
|
|
3672
|
-
super(setInterval,
|
|
3672
|
+
super(setInterval, R, t, function(a) {
|
|
3673
3673
|
return s(), a;
|
|
3674
3674
|
});
|
|
3675
3675
|
}
|
|
3676
3676
|
}
|
|
3677
|
-
var
|
|
3677
|
+
var fe = {
|
|
3678
3678
|
now() {
|
|
3679
3679
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3680
3680
|
},
|
|
@@ -3687,21 +3687,21 @@ function fa() {
|
|
|
3687
3687
|
return a[r].apply(a, s.concat(arguments));
|
|
3688
3688
|
};
|
|
3689
3689
|
}
|
|
3690
|
-
},
|
|
3691
|
-
function
|
|
3690
|
+
}, ue = fe;
|
|
3691
|
+
function pe(r, ...t) {
|
|
3692
3692
|
for (var s = 0; s < t.length; s++) {
|
|
3693
3693
|
var a = t[s];
|
|
3694
3694
|
for (var c in a)
|
|
3695
|
-
a[c] && a[c].constructor && a[c].constructor === Object ? r[c] =
|
|
3695
|
+
a[c] && a[c].constructor && a[c].constructor === Object ? r[c] = pe(r[c] || {}, a[c]) : r[c] = a[c];
|
|
3696
3696
|
}
|
|
3697
3697
|
return r;
|
|
3698
3698
|
}
|
|
3699
|
-
function
|
|
3699
|
+
function Je() {
|
|
3700
3700
|
for (var r = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3701
|
-
typeof arguments[t] == "string" ? r.push(arguments[t]) : r.push(
|
|
3701
|
+
typeof arguments[t] == "string" ? r.push(arguments[t]) : r.push(Ye(arguments[t]));
|
|
3702
3702
|
return r.join(" : ");
|
|
3703
3703
|
}
|
|
3704
|
-
function
|
|
3704
|
+
function E(r, t) {
|
|
3705
3705
|
var s = Array.prototype.indexOf;
|
|
3706
3706
|
if (r === null)
|
|
3707
3707
|
return -1;
|
|
@@ -3712,38 +3712,38 @@ function fa() {
|
|
|
3712
3712
|
return a;
|
|
3713
3713
|
return -1;
|
|
3714
3714
|
}
|
|
3715
|
-
function
|
|
3715
|
+
function P(r, t) {
|
|
3716
3716
|
for (var s in r)
|
|
3717
3717
|
Object.prototype.hasOwnProperty.call(r, s) && t(r[s], s, r);
|
|
3718
3718
|
}
|
|
3719
|
-
function
|
|
3719
|
+
function D(r) {
|
|
3720
3720
|
var t = [];
|
|
3721
|
-
return
|
|
3721
|
+
return P(r, function(s, a) {
|
|
3722
3722
|
t.push(a);
|
|
3723
3723
|
}), t;
|
|
3724
3724
|
}
|
|
3725
|
-
function
|
|
3725
|
+
function X(r) {
|
|
3726
3726
|
var t = [];
|
|
3727
|
-
return
|
|
3727
|
+
return P(r, function(s) {
|
|
3728
3728
|
t.push(s);
|
|
3729
3729
|
}), t;
|
|
3730
3730
|
}
|
|
3731
|
-
function
|
|
3731
|
+
function Y(r, t, s) {
|
|
3732
3732
|
for (var a = 0; a < r.length; a++)
|
|
3733
3733
|
t.call(s || window, r[a], a, r);
|
|
3734
3734
|
}
|
|
3735
|
-
function
|
|
3735
|
+
function ge(r, t) {
|
|
3736
3736
|
for (var s = [], a = 0; a < r.length; a++)
|
|
3737
3737
|
s.push(t(r[a], a, r, s));
|
|
3738
3738
|
return s;
|
|
3739
3739
|
}
|
|
3740
|
-
function
|
|
3740
|
+
function we(r, t) {
|
|
3741
3741
|
var s = {};
|
|
3742
|
-
return
|
|
3742
|
+
return P(r, function(a, c) {
|
|
3743
3743
|
s[c] = t(a);
|
|
3744
3744
|
}), s;
|
|
3745
3745
|
}
|
|
3746
|
-
function
|
|
3746
|
+
function Ke(r, t) {
|
|
3747
3747
|
t = t || function(c) {
|
|
3748
3748
|
return !!c;
|
|
3749
3749
|
};
|
|
@@ -3751,45 +3751,45 @@ function fa() {
|
|
|
3751
3751
|
t(r[a], a, r, s) && s.push(r[a]);
|
|
3752
3752
|
return s;
|
|
3753
3753
|
}
|
|
3754
|
-
function
|
|
3754
|
+
function Qe(r, t) {
|
|
3755
3755
|
var s = {};
|
|
3756
|
-
return
|
|
3756
|
+
return P(r, function(a, c) {
|
|
3757
3757
|
(t && t(a, c, r, s) || a) && (s[c] = a);
|
|
3758
3758
|
}), s;
|
|
3759
3759
|
}
|
|
3760
|
-
function
|
|
3760
|
+
function ft(r) {
|
|
3761
3761
|
var t = [];
|
|
3762
|
-
return
|
|
3762
|
+
return P(r, function(s, a) {
|
|
3763
3763
|
t.push([a, s]);
|
|
3764
3764
|
}), t;
|
|
3765
3765
|
}
|
|
3766
|
-
function
|
|
3766
|
+
function ye(r, t) {
|
|
3767
3767
|
for (var s = 0; s < r.length; s++)
|
|
3768
3768
|
if (t(r[s], s, r))
|
|
3769
3769
|
return !0;
|
|
3770
3770
|
return !1;
|
|
3771
3771
|
}
|
|
3772
|
-
function
|
|
3772
|
+
function Ce(r, t) {
|
|
3773
3773
|
for (var s = 0; s < r.length; s++)
|
|
3774
3774
|
if (!t(r[s], s, r))
|
|
3775
3775
|
return !1;
|
|
3776
3776
|
return !0;
|
|
3777
3777
|
}
|
|
3778
|
-
function
|
|
3779
|
-
return
|
|
3780
|
-
return typeof t == "object" && (t =
|
|
3778
|
+
function xe(r) {
|
|
3779
|
+
return we(r, function(t) {
|
|
3780
|
+
return typeof t == "object" && (t = Ye(t)), encodeURIComponent(me(t.toString()));
|
|
3781
3781
|
});
|
|
3782
3782
|
}
|
|
3783
|
-
function
|
|
3784
|
-
var t =
|
|
3783
|
+
function K(r) {
|
|
3784
|
+
var t = Qe(r, function(a) {
|
|
3785
3785
|
return a !== void 0;
|
|
3786
|
-
}), s =
|
|
3786
|
+
}), s = ge(ft(xe(t)), ue.method("join", "=")).join("&");
|
|
3787
3787
|
return s;
|
|
3788
3788
|
}
|
|
3789
|
-
function
|
|
3789
|
+
function qe(r) {
|
|
3790
3790
|
var t = [], s = [];
|
|
3791
3791
|
return (function a(c, p) {
|
|
3792
|
-
var S, L,
|
|
3792
|
+
var S, L, z;
|
|
3793
3793
|
switch (typeof c) {
|
|
3794
3794
|
case "object":
|
|
3795
3795
|
if (!c)
|
|
@@ -3798,14 +3798,14 @@ function fa() {
|
|
|
3798
3798
|
if (t[S] === c)
|
|
3799
3799
|
return { $ref: s[S] };
|
|
3800
3800
|
if (t.push(c), s.push(p), Object.prototype.toString.apply(c) === "[object Array]")
|
|
3801
|
-
for (
|
|
3802
|
-
|
|
3801
|
+
for (z = [], S = 0; S < c.length; S += 1)
|
|
3802
|
+
z[S] = a(c[S], p + "[" + S + "]");
|
|
3803
3803
|
else {
|
|
3804
|
-
|
|
3804
|
+
z = {};
|
|
3805
3805
|
for (L in c)
|
|
3806
|
-
Object.prototype.hasOwnProperty.call(c, L) && (
|
|
3806
|
+
Object.prototype.hasOwnProperty.call(c, L) && (z[L] = a(c[L], p + "[" + JSON.stringify(L) + "]"));
|
|
3807
3807
|
}
|
|
3808
|
-
return
|
|
3808
|
+
return z;
|
|
3809
3809
|
case "number":
|
|
3810
3810
|
case "string":
|
|
3811
3811
|
case "boolean":
|
|
@@ -3813,11 +3813,11 @@ function fa() {
|
|
|
3813
3813
|
}
|
|
3814
3814
|
})(r, "$");
|
|
3815
3815
|
}
|
|
3816
|
-
function
|
|
3816
|
+
function Ye(r) {
|
|
3817
3817
|
try {
|
|
3818
3818
|
return JSON.stringify(r);
|
|
3819
3819
|
} catch {
|
|
3820
|
-
return JSON.stringify(
|
|
3820
|
+
return JSON.stringify(qe(r));
|
|
3821
3821
|
}
|
|
3822
3822
|
}
|
|
3823
3823
|
class As {
|
|
@@ -3842,8 +3842,8 @@ function fa() {
|
|
|
3842
3842
|
window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
|
|
3843
3843
|
}
|
|
3844
3844
|
log(t, ...s) {
|
|
3845
|
-
var a =
|
|
3846
|
-
|
|
3845
|
+
var a = Je.apply(this, arguments);
|
|
3846
|
+
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
3847
3847
|
}
|
|
3848
3848
|
}
|
|
3849
3849
|
var oe = new As(), Rs = function(r, t, s, a, c) {
|
|
@@ -3851,13 +3851,13 @@ function fa() {
|
|
|
3851
3851
|
var p = r.nextAuthCallbackID.toString();
|
|
3852
3852
|
r.nextAuthCallbackID++;
|
|
3853
3853
|
var S = r.getDocument(), L = S.createElement("script");
|
|
3854
|
-
r.auth_callbacks[p] = function(
|
|
3855
|
-
c(null,
|
|
3854
|
+
r.auth_callbacks[p] = function(te) {
|
|
3855
|
+
c(null, te);
|
|
3856
3856
|
};
|
|
3857
|
-
var
|
|
3858
|
-
L.src = s.endpoint + "?callback=" + encodeURIComponent(
|
|
3859
|
-
var
|
|
3860
|
-
|
|
3857
|
+
var z = "Pusher.auth_callbacks['" + p + "']";
|
|
3858
|
+
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
3859
|
+
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3860
|
+
Q.insertBefore(L, Q.firstChild);
|
|
3861
3861
|
}, Ps = Rs;
|
|
3862
3862
|
class Ms {
|
|
3863
3863
|
constructor(t) {
|
|
@@ -3885,7 +3885,7 @@ function fa() {
|
|
|
3885
3885
|
}
|
|
3886
3886
|
send(t) {
|
|
3887
3887
|
if (!this.request) {
|
|
3888
|
-
var s =
|
|
3888
|
+
var s = K(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
3889
3889
|
this.request = j.createScriptRequest(a), this.request.send(t);
|
|
3890
3890
|
}
|
|
3891
3891
|
}
|
|
@@ -3895,8 +3895,8 @@ function fa() {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
var ks = function(r, t) {
|
|
3897
3897
|
return function(s, a) {
|
|
3898
|
-
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(
|
|
3899
|
-
l.remove(L), S.cleanup(),
|
|
3898
|
+
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
3899
|
+
l.remove(L), S.cleanup(), Q && Q.host && (r.host = Q.host), a && a(z, Q);
|
|
3900
3900
|
});
|
|
3901
3901
|
S.send(L);
|
|
3902
3902
|
};
|
|
@@ -3904,30 +3904,30 @@ function fa() {
|
|
|
3904
3904
|
name: "jsonp",
|
|
3905
3905
|
getAgent: ks
|
|
3906
3906
|
}, Is = Ls;
|
|
3907
|
-
function
|
|
3907
|
+
function pt(r, t, s) {
|
|
3908
3908
|
var a = r + (t.useTLS ? "s" : ""), c = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
3909
3909
|
return a + "://" + c + s;
|
|
3910
3910
|
}
|
|
3911
|
-
function
|
|
3911
|
+
function gt(r, t) {
|
|
3912
3912
|
var s = "/app/" + r, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
3913
3913
|
return s + a;
|
|
3914
3914
|
}
|
|
3915
3915
|
var Us = {
|
|
3916
3916
|
getInitial: function(r, t) {
|
|
3917
|
-
var s = (t.httpPath || "") +
|
|
3918
|
-
return
|
|
3917
|
+
var s = (t.httpPath || "") + gt(r, "flash=false");
|
|
3918
|
+
return pt("ws", t, s);
|
|
3919
3919
|
}
|
|
3920
3920
|
}, Os = {
|
|
3921
3921
|
getInitial: function(r, t) {
|
|
3922
|
-
var s = (t.httpPath || "/pusher") +
|
|
3923
|
-
return
|
|
3922
|
+
var s = (t.httpPath || "/pusher") + gt(r);
|
|
3923
|
+
return pt("http", t, s);
|
|
3924
3924
|
}
|
|
3925
3925
|
}, Fs = {
|
|
3926
3926
|
getInitial: function(r, t) {
|
|
3927
|
-
return
|
|
3927
|
+
return pt("http", t, t.httpPath || "/pusher");
|
|
3928
3928
|
},
|
|
3929
3929
|
getPath: function(r, t) {
|
|
3930
|
-
return
|
|
3930
|
+
return gt(r);
|
|
3931
3931
|
}
|
|
3932
3932
|
};
|
|
3933
3933
|
class Ns {
|
|
@@ -3935,10 +3935,10 @@ function fa() {
|
|
|
3935
3935
|
this._callbacks = {};
|
|
3936
3936
|
}
|
|
3937
3937
|
get(t) {
|
|
3938
|
-
return this._callbacks[
|
|
3938
|
+
return this._callbacks[mt(t)];
|
|
3939
3939
|
}
|
|
3940
3940
|
add(t, s, a) {
|
|
3941
|
-
var c =
|
|
3941
|
+
var c = mt(t);
|
|
3942
3942
|
this._callbacks[c] = this._callbacks[c] || [], this._callbacks[c].push({
|
|
3943
3943
|
fn: s,
|
|
3944
3944
|
context: a
|
|
@@ -3949,23 +3949,23 @@ function fa() {
|
|
|
3949
3949
|
this._callbacks = {};
|
|
3950
3950
|
return;
|
|
3951
3951
|
}
|
|
3952
|
-
var c = t ? [
|
|
3952
|
+
var c = t ? [mt(t)] : D(this._callbacks);
|
|
3953
3953
|
s || a ? this.removeCallback(c, s, a) : this.removeAllCallbacks(c);
|
|
3954
3954
|
}
|
|
3955
3955
|
removeCallback(t, s, a) {
|
|
3956
|
-
|
|
3957
|
-
this._callbacks[c] =
|
|
3956
|
+
Y(t, function(c) {
|
|
3957
|
+
this._callbacks[c] = Ke(this._callbacks[c] || [], function(p) {
|
|
3958
3958
|
return s && s !== p.fn || a && a !== p.context;
|
|
3959
3959
|
}), this._callbacks[c].length === 0 && delete this._callbacks[c];
|
|
3960
3960
|
}, this);
|
|
3961
3961
|
}
|
|
3962
3962
|
removeAllCallbacks(t) {
|
|
3963
|
-
|
|
3963
|
+
Y(t, function(s) {
|
|
3964
3964
|
delete this._callbacks[s];
|
|
3965
3965
|
}, this);
|
|
3966
3966
|
}
|
|
3967
3967
|
}
|
|
3968
|
-
function
|
|
3968
|
+
function mt(r) {
|
|
3969
3969
|
return "_" + r;
|
|
3970
3970
|
}
|
|
3971
3971
|
class Te {
|
|
@@ -3982,7 +3982,7 @@ function fa() {
|
|
|
3982
3982
|
return this.callbacks.remove(t, s, a), this;
|
|
3983
3983
|
}
|
|
3984
3984
|
unbind_global(t) {
|
|
3985
|
-
return t ? (this.global_callbacks =
|
|
3985
|
+
return t ? (this.global_callbacks = Ke(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
|
|
3986
3986
|
}
|
|
3987
3987
|
unbind_all() {
|
|
3988
3988
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -4015,7 +4015,7 @@ function fa() {
|
|
|
4015
4015
|
try {
|
|
4016
4016
|
this.socket = this.hooks.getSocket(t, this.options);
|
|
4017
4017
|
} catch (s) {
|
|
4018
|
-
return
|
|
4018
|
+
return ue.defer(() => {
|
|
4019
4019
|
this.onError(s), this.changeState("closed");
|
|
4020
4020
|
}), !1;
|
|
4021
4021
|
}
|
|
@@ -4025,7 +4025,7 @@ function fa() {
|
|
|
4025
4025
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
4026
4026
|
}
|
|
4027
4027
|
send(t) {
|
|
4028
|
-
return this.state === "open" ? (
|
|
4028
|
+
return this.state === "open" ? (ue.defer(() => {
|
|
4029
4029
|
this.socket && this.socket.send(t);
|
|
4030
4030
|
}), !0) : !1;
|
|
4031
4031
|
}
|
|
@@ -4074,7 +4074,7 @@ function fa() {
|
|
|
4074
4074
|
})), this.emit(t, s);
|
|
4075
4075
|
}
|
|
4076
4076
|
buildTimelineMessage(t) {
|
|
4077
|
-
return
|
|
4077
|
+
return pe({ cid: this.id }, t);
|
|
4078
4078
|
}
|
|
4079
4079
|
}
|
|
4080
4080
|
class Ne {
|
|
@@ -4101,30 +4101,30 @@ function fa() {
|
|
|
4101
4101
|
getSocket: function(r) {
|
|
4102
4102
|
return j.createWebSocket(r);
|
|
4103
4103
|
}
|
|
4104
|
-
}),
|
|
4104
|
+
}), tn = {
|
|
4105
4105
|
urls: Os,
|
|
4106
4106
|
handlesActivityChecks: !1,
|
|
4107
4107
|
supportsPing: !0,
|
|
4108
4108
|
isInitialized: function() {
|
|
4109
4109
|
return !0;
|
|
4110
4110
|
}
|
|
4111
|
-
},
|
|
4111
|
+
}, nn = pe({
|
|
4112
4112
|
getSocket: function(r) {
|
|
4113
4113
|
return j.HTTPFactory.createStreamingSocket(r);
|
|
4114
4114
|
}
|
|
4115
|
-
},
|
|
4115
|
+
}, tn), sn = pe({
|
|
4116
4116
|
getSocket: function(r) {
|
|
4117
4117
|
return j.HTTPFactory.createPollingSocket(r);
|
|
4118
4118
|
}
|
|
4119
|
-
},
|
|
4119
|
+
}, tn), rn = {
|
|
4120
4120
|
isSupported: function() {
|
|
4121
4121
|
return j.isXHRSupported();
|
|
4122
4122
|
}
|
|
4123
|
-
}, zs = new Ne(
|
|
4123
|
+
}, zs = new Ne(pe({}, nn, rn)), js = new Ne(pe({}, sn, rn)), $s = {
|
|
4124
4124
|
ws: qs,
|
|
4125
4125
|
xhr_streaming: zs,
|
|
4126
4126
|
xhr_polling: js
|
|
4127
|
-
},
|
|
4127
|
+
}, Ze = $s, Hs = new Ne({
|
|
4128
4128
|
file: "sockjs",
|
|
4129
4129
|
urls: Fs,
|
|
4130
4130
|
handlesActivityChecks: !0,
|
|
@@ -4148,14 +4148,14 @@ function fa() {
|
|
|
4148
4148
|
path: t
|
|
4149
4149
|
}));
|
|
4150
4150
|
}
|
|
4151
|
-
}),
|
|
4151
|
+
}), on = {
|
|
4152
4152
|
isSupported: function(r) {
|
|
4153
4153
|
var t = j.isXDRSupported(r.useTLS);
|
|
4154
4154
|
return t;
|
|
4155
4155
|
}
|
|
4156
|
-
}, Bs = new Ne(
|
|
4157
|
-
|
|
4158
|
-
var Xs =
|
|
4156
|
+
}, Bs = new Ne(pe({}, nn, on)), Vs = new Ne(pe({}, sn, on));
|
|
4157
|
+
Ze.xdr_streaming = Bs, Ze.xdr_polling = Vs, Ze.sockjs = Hs;
|
|
4158
|
+
var Xs = Ze;
|
|
4159
4159
|
class Ws extends Te {
|
|
4160
4160
|
constructor() {
|
|
4161
4161
|
super();
|
|
@@ -4176,17 +4176,17 @@ function fa() {
|
|
|
4176
4176
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4177
4177
|
}
|
|
4178
4178
|
createConnection(t, s, a, c) {
|
|
4179
|
-
c =
|
|
4179
|
+
c = pe({}, c, {
|
|
4180
4180
|
activityTimeout: this.pingDelay
|
|
4181
4181
|
});
|
|
4182
4182
|
var p = this.transport.createConnection(t, s, a, c), S = null, L = function() {
|
|
4183
|
-
p.unbind("open", L), p.bind("closed",
|
|
4184
|
-
},
|
|
4185
|
-
if (p.unbind("closed",
|
|
4183
|
+
p.unbind("open", L), p.bind("closed", z), S = ue.now();
|
|
4184
|
+
}, z = (Q) => {
|
|
4185
|
+
if (p.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
|
|
4186
4186
|
this.manager.reportDeath();
|
|
4187
|
-
else if (!
|
|
4188
|
-
var
|
|
4189
|
-
|
|
4187
|
+
else if (!Q.wasClean && S) {
|
|
4188
|
+
var te = ue.now() - S;
|
|
4189
|
+
te < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(te / 2, this.minPingDelay));
|
|
4190
4190
|
}
|
|
4191
4191
|
};
|
|
4192
4192
|
return p.bind("open", L), p;
|
|
@@ -4195,7 +4195,7 @@ function fa() {
|
|
|
4195
4195
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4196
4196
|
}
|
|
4197
4197
|
}
|
|
4198
|
-
const
|
|
4198
|
+
const an = {
|
|
4199
4199
|
decodeMessage: function(r) {
|
|
4200
4200
|
try {
|
|
4201
4201
|
var t = JSON.parse(r.data), s = t.data;
|
|
@@ -4218,7 +4218,7 @@ function fa() {
|
|
|
4218
4218
|
return JSON.stringify(r);
|
|
4219
4219
|
},
|
|
4220
4220
|
processHandshake: function(r) {
|
|
4221
|
-
var t =
|
|
4221
|
+
var t = an.decodeMessage(r);
|
|
4222
4222
|
if (t.event === "pusher:connection_established") {
|
|
4223
4223
|
if (!t.data.activity_timeout)
|
|
4224
4224
|
throw "No activity timeout specified in handshake";
|
|
@@ -4249,7 +4249,7 @@ function fa() {
|
|
|
4249
4249
|
} : null;
|
|
4250
4250
|
}
|
|
4251
4251
|
};
|
|
4252
|
-
var ke =
|
|
4252
|
+
var ke = an;
|
|
4253
4253
|
class Ks extends Te {
|
|
4254
4254
|
constructor(t, s) {
|
|
4255
4255
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
@@ -4311,11 +4311,11 @@ function fa() {
|
|
|
4311
4311
|
s(), a && a.code && this.handleCloseEvent(a), this.transport = null, this.emit("closed");
|
|
4312
4312
|
}
|
|
4313
4313
|
}, s = () => {
|
|
4314
|
-
|
|
4314
|
+
P(t, (a, c) => {
|
|
4315
4315
|
this.transport.unbind(c, a);
|
|
4316
4316
|
});
|
|
4317
4317
|
};
|
|
4318
|
-
|
|
4318
|
+
P(t, (a, c) => {
|
|
4319
4319
|
this.transport.bind(c, a);
|
|
4320
4320
|
});
|
|
4321
4321
|
}
|
|
@@ -4355,7 +4355,7 @@ function fa() {
|
|
|
4355
4355
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
4356
4356
|
}
|
|
4357
4357
|
finish(t, s) {
|
|
4358
|
-
this.callback(
|
|
4358
|
+
this.callback(pe({ transport: this.transport, action: t }, s));
|
|
4359
4359
|
}
|
|
4360
4360
|
}
|
|
4361
4361
|
class Ys {
|
|
@@ -4366,7 +4366,7 @@ function fa() {
|
|
|
4366
4366
|
this.timeline.isEmpty() || this.timeline.send(j.TimelineTransport.getAgent(this, t), s);
|
|
4367
4367
|
}
|
|
4368
4368
|
}
|
|
4369
|
-
class
|
|
4369
|
+
class vt extends Te {
|
|
4370
4370
|
constructor(t, s) {
|
|
4371
4371
|
super(function(a, c) {
|
|
4372
4372
|
oe.debug("No callbacks on " + t + " for " + a);
|
|
@@ -4428,7 +4428,7 @@ function fa() {
|
|
|
4428
4428
|
this.subscriptionCancelled = !1;
|
|
4429
4429
|
}
|
|
4430
4430
|
}
|
|
4431
|
-
class
|
|
4431
|
+
class bt extends vt {
|
|
4432
4432
|
authorize(t, s) {
|
|
4433
4433
|
return this.pusher.config.channelAuthorizer({
|
|
4434
4434
|
channelName: this.name,
|
|
@@ -4447,7 +4447,7 @@ function fa() {
|
|
|
4447
4447
|
} : null;
|
|
4448
4448
|
}
|
|
4449
4449
|
each(t) {
|
|
4450
|
-
|
|
4450
|
+
P(this.members, (s, a) => {
|
|
4451
4451
|
t(this.get(a));
|
|
4452
4452
|
});
|
|
4453
4453
|
}
|
|
@@ -4475,27 +4475,27 @@ function fa() {
|
|
|
4475
4475
|
});
|
|
4476
4476
|
}
|
|
4477
4477
|
return new (s || (s = Promise))(function(p, S) {
|
|
4478
|
-
function L(
|
|
4478
|
+
function L(te) {
|
|
4479
4479
|
try {
|
|
4480
|
-
|
|
4480
|
+
Q(a.next(te));
|
|
4481
4481
|
} catch (ce) {
|
|
4482
4482
|
S(ce);
|
|
4483
4483
|
}
|
|
4484
4484
|
}
|
|
4485
|
-
function
|
|
4485
|
+
function z(te) {
|
|
4486
4486
|
try {
|
|
4487
|
-
|
|
4487
|
+
Q(a.throw(te));
|
|
4488
4488
|
} catch (ce) {
|
|
4489
4489
|
S(ce);
|
|
4490
4490
|
}
|
|
4491
4491
|
}
|
|
4492
|
-
function
|
|
4493
|
-
|
|
4492
|
+
function Q(te) {
|
|
4493
|
+
te.done ? p(te.value) : c(te.value).then(L, z);
|
|
4494
4494
|
}
|
|
4495
|
-
|
|
4495
|
+
Q((a = a.apply(r, t || [])).next());
|
|
4496
4496
|
});
|
|
4497
4497
|
};
|
|
4498
|
-
class tr extends
|
|
4498
|
+
class tr extends bt {
|
|
4499
4499
|
constructor(t, s) {
|
|
4500
4500
|
super(t, s), this.members = new Zs();
|
|
4501
4501
|
}
|
|
@@ -4550,8 +4550,8 @@ function fa() {
|
|
|
4550
4550
|
this.members.reset(), super.disconnect();
|
|
4551
4551
|
}
|
|
4552
4552
|
}
|
|
4553
|
-
var nr = u(1),
|
|
4554
|
-
class sr extends
|
|
4553
|
+
var nr = u(1), yt = u(0);
|
|
4554
|
+
class sr extends bt {
|
|
4555
4555
|
constructor(t, s, a) {
|
|
4556
4556
|
super(t, s), this.key = null, this.nacl = a;
|
|
4557
4557
|
}
|
|
@@ -4566,11 +4566,11 @@ function fa() {
|
|
|
4566
4566
|
s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4567
4567
|
return;
|
|
4568
4568
|
}
|
|
4569
|
-
this.key = Object(
|
|
4569
|
+
this.key = Object(yt.decode)(p), delete c.shared_secret, s(null, c);
|
|
4570
4570
|
});
|
|
4571
4571
|
}
|
|
4572
4572
|
trigger(t, s) {
|
|
4573
|
-
throw new
|
|
4573
|
+
throw new G("Client events are not currently supported for encrypted channels");
|
|
4574
4574
|
}
|
|
4575
4575
|
handleEvent(t) {
|
|
4576
4576
|
var s = t.event, a = t.data;
|
|
@@ -4589,12 +4589,12 @@ function fa() {
|
|
|
4589
4589
|
oe.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4590
4590
|
return;
|
|
4591
4591
|
}
|
|
4592
|
-
let a = Object(
|
|
4592
|
+
let a = Object(yt.decode)(s.ciphertext);
|
|
4593
4593
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4594
4594
|
oe.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4595
4595
|
return;
|
|
4596
4596
|
}
|
|
4597
|
-
let c = Object(
|
|
4597
|
+
let c = Object(yt.decode)(s.nonce);
|
|
4598
4598
|
if (c.length < this.nacl.secretbox.nonceLength) {
|
|
4599
4599
|
oe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${c.length}`);
|
|
4600
4600
|
return;
|
|
@@ -4711,7 +4711,7 @@ function fa() {
|
|
|
4711
4711
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
4712
4712
|
}
|
|
4713
4713
|
buildConnectionCallbacks(t) {
|
|
4714
|
-
return
|
|
4714
|
+
return pe({}, t, {
|
|
4715
4715
|
message: (s) => {
|
|
4716
4716
|
this.resetActivityCheck(), this.emit("message", s);
|
|
4717
4717
|
},
|
|
@@ -4730,7 +4730,7 @@ function fa() {
|
|
|
4730
4730
|
});
|
|
4731
4731
|
}
|
|
4732
4732
|
buildHandshakeCallbacks(t) {
|
|
4733
|
-
return
|
|
4733
|
+
return pe({}, t, {
|
|
4734
4734
|
connected: (s) => {
|
|
4735
4735
|
this.activityTimeout = Math.min(this.options.activityTimeout, s.activityTimeout, s.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(s.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
|
|
4736
4736
|
}
|
|
@@ -4789,7 +4789,7 @@ function fa() {
|
|
|
4789
4789
|
return this.channels[t] || (this.channels[t] = or(t, s)), this.channels[t];
|
|
4790
4790
|
}
|
|
4791
4791
|
all() {
|
|
4792
|
-
return
|
|
4792
|
+
return X(this.channels);
|
|
4793
4793
|
}
|
|
4794
4794
|
find(t) {
|
|
4795
4795
|
return this.channels[t];
|
|
@@ -4799,7 +4799,7 @@ function fa() {
|
|
|
4799
4799
|
return delete this.channels[t], s;
|
|
4800
4800
|
}
|
|
4801
4801
|
disconnect() {
|
|
4802
|
-
|
|
4802
|
+
P(this.channels, function(t) {
|
|
4803
4803
|
t.disconnect();
|
|
4804
4804
|
});
|
|
4805
4805
|
}
|
|
@@ -4809,7 +4809,7 @@ function fa() {
|
|
|
4809
4809
|
if (t.config.nacl)
|
|
4810
4810
|
return Ee.createEncryptedChannel(r, t, t.config.nacl);
|
|
4811
4811
|
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = w.buildLogSuffix("encryptedChannelSupport");
|
|
4812
|
-
throw new
|
|
4812
|
+
throw new G(`${s}. ${a}`);
|
|
4813
4813
|
} else {
|
|
4814
4814
|
if (r.indexOf("private-") === 0)
|
|
4815
4815
|
return Ee.createPrivateChannel(r, t);
|
|
@@ -4828,10 +4828,10 @@ function fa() {
|
|
|
4828
4828
|
return new rr(r, t);
|
|
4829
4829
|
},
|
|
4830
4830
|
createChannel(r, t) {
|
|
4831
|
-
return new
|
|
4831
|
+
return new vt(r, t);
|
|
4832
4832
|
},
|
|
4833
4833
|
createPrivateChannel(r, t) {
|
|
4834
|
-
return new
|
|
4834
|
+
return new bt(r, t);
|
|
4835
4835
|
},
|
|
4836
4836
|
createPresenceChannel(r, t) {
|
|
4837
4837
|
return new tr(r, t);
|
|
@@ -4849,7 +4849,7 @@ function fa() {
|
|
|
4849
4849
|
return new Js(r, t, s);
|
|
4850
4850
|
}
|
|
4851
4851
|
}, Ee = ar;
|
|
4852
|
-
class
|
|
4852
|
+
class cn {
|
|
4853
4853
|
constructor(t) {
|
|
4854
4854
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
4855
4855
|
}
|
|
@@ -4871,18 +4871,18 @@ function fa() {
|
|
|
4871
4871
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
4872
4872
|
}
|
|
4873
4873
|
isSupported() {
|
|
4874
|
-
return
|
|
4874
|
+
return ye(this.strategies, ue.method("isSupported"));
|
|
4875
4875
|
}
|
|
4876
4876
|
connect(t, s) {
|
|
4877
|
-
var a = this.strategies, c = 0, p = this.timeout, S = null, L = (
|
|
4878
|
-
|
|
4877
|
+
var a = this.strategies, c = 0, p = this.timeout, S = null, L = (z, Q) => {
|
|
4878
|
+
Q ? s(null, Q) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, L)) : s(!0));
|
|
4879
4879
|
};
|
|
4880
4880
|
return S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, L), {
|
|
4881
4881
|
abort: function() {
|
|
4882
4882
|
S.abort();
|
|
4883
4883
|
},
|
|
4884
|
-
forceMinPriority: function(
|
|
4885
|
-
t =
|
|
4884
|
+
forceMinPriority: function(z) {
|
|
4885
|
+
t = z, S && S.forceMinPriority(z);
|
|
4886
4886
|
}
|
|
4887
4887
|
};
|
|
4888
4888
|
}
|
|
@@ -4890,8 +4890,8 @@ function fa() {
|
|
|
4890
4890
|
var p = null, S = null;
|
|
4891
4891
|
return a.timeout > 0 && (p = new U(a.timeout, function() {
|
|
4892
4892
|
S.abort(), c(!0);
|
|
4893
|
-
})), S = t.connect(s, function(L,
|
|
4894
|
-
L && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(L,
|
|
4893
|
+
})), S = t.connect(s, function(L, z) {
|
|
4894
|
+
L && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(L, z));
|
|
4895
4895
|
}), {
|
|
4896
4896
|
abort: function() {
|
|
4897
4897
|
p && p.ensureAborted(), S.abort();
|
|
@@ -4902,12 +4902,12 @@ function fa() {
|
|
|
4902
4902
|
};
|
|
4903
4903
|
}
|
|
4904
4904
|
}
|
|
4905
|
-
class
|
|
4905
|
+
class _t {
|
|
4906
4906
|
constructor(t) {
|
|
4907
4907
|
this.strategies = t;
|
|
4908
4908
|
}
|
|
4909
4909
|
isSupported() {
|
|
4910
|
-
return
|
|
4910
|
+
return ye(this.strategies, ue.method("isSupported"));
|
|
4911
4911
|
}
|
|
4912
4912
|
connect(t, s) {
|
|
4913
4913
|
return cr(this.strategies, t, function(a, c) {
|
|
@@ -4916,7 +4916,7 @@ function fa() {
|
|
|
4916
4916
|
ur(c) && s(!0);
|
|
4917
4917
|
return;
|
|
4918
4918
|
}
|
|
4919
|
-
|
|
4919
|
+
Y(c, function(L) {
|
|
4920
4920
|
L.forceMinPriority(S.transport.priority);
|
|
4921
4921
|
}), s(null, S);
|
|
4922
4922
|
};
|
|
@@ -4924,22 +4924,22 @@ function fa() {
|
|
|
4924
4924
|
}
|
|
4925
4925
|
}
|
|
4926
4926
|
function cr(r, t, s) {
|
|
4927
|
-
var a =
|
|
4927
|
+
var a = ge(r, function(c, p, S, L) {
|
|
4928
4928
|
return c.connect(t, s(p, L));
|
|
4929
4929
|
});
|
|
4930
4930
|
return {
|
|
4931
4931
|
abort: function() {
|
|
4932
|
-
|
|
4932
|
+
Y(a, lr);
|
|
4933
4933
|
},
|
|
4934
4934
|
forceMinPriority: function(c) {
|
|
4935
|
-
|
|
4935
|
+
Y(a, function(p) {
|
|
4936
4936
|
p.forceMinPriority(c);
|
|
4937
4937
|
});
|
|
4938
4938
|
}
|
|
4939
4939
|
};
|
|
4940
4940
|
}
|
|
4941
4941
|
function ur(r) {
|
|
4942
|
-
return
|
|
4942
|
+
return Ce(r, function(t) {
|
|
4943
4943
|
return !!t.error;
|
|
4944
4944
|
});
|
|
4945
4945
|
}
|
|
@@ -4955,7 +4955,7 @@ function fa() {
|
|
|
4955
4955
|
}
|
|
4956
4956
|
connect(t, s) {
|
|
4957
4957
|
var a = this.usingTLS, c = hr(a), p = c && c.cacheSkipCount ? c.cacheSkipCount : 0, S = [this.strategy];
|
|
4958
|
-
if (c && c.timestamp + this.ttl >=
|
|
4958
|
+
if (c && c.timestamp + this.ttl >= ue.now()) {
|
|
4959
4959
|
var L = this.transports[c.transport];
|
|
4960
4960
|
L && (["ws", "wss"].includes(c.transport) || p > 3 ? (this.timeline.info({
|
|
4961
4961
|
cached: !0,
|
|
@@ -4966,31 +4966,31 @@ function fa() {
|
|
|
4966
4966
|
failFast: !0
|
|
4967
4967
|
}))) : p++);
|
|
4968
4968
|
}
|
|
4969
|
-
var
|
|
4970
|
-
ce ? (
|
|
4969
|
+
var z = ue.now(), Q = S.pop().connect(t, function te(ce, nt) {
|
|
4970
|
+
ce ? (un(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, te)) : s(ce)) : (fr(a, nt.transport.name, ue.now() - z, p), s(null, nt));
|
|
4971
4971
|
});
|
|
4972
4972
|
return {
|
|
4973
4973
|
abort: function() {
|
|
4974
|
-
|
|
4974
|
+
Q.abort();
|
|
4975
4975
|
},
|
|
4976
|
-
forceMinPriority: function(
|
|
4977
|
-
t =
|
|
4976
|
+
forceMinPriority: function(te) {
|
|
4977
|
+
t = te, Q && Q.forceMinPriority(te);
|
|
4978
4978
|
}
|
|
4979
4979
|
};
|
|
4980
4980
|
}
|
|
4981
4981
|
}
|
|
4982
|
-
function
|
|
4982
|
+
function St(r) {
|
|
4983
4983
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
4984
4984
|
}
|
|
4985
4985
|
function hr(r) {
|
|
4986
4986
|
var t = j.getLocalStorage();
|
|
4987
4987
|
if (t)
|
|
4988
4988
|
try {
|
|
4989
|
-
var s = t[
|
|
4989
|
+
var s = t[St(r)];
|
|
4990
4990
|
if (s)
|
|
4991
4991
|
return JSON.parse(s);
|
|
4992
4992
|
} catch {
|
|
4993
|
-
|
|
4993
|
+
un(r);
|
|
4994
4994
|
}
|
|
4995
4995
|
return null;
|
|
4996
4996
|
}
|
|
@@ -4998,8 +4998,8 @@ function fa() {
|
|
|
4998
4998
|
var c = j.getLocalStorage();
|
|
4999
4999
|
if (c)
|
|
5000
5000
|
try {
|
|
5001
|
-
c[
|
|
5002
|
-
timestamp:
|
|
5001
|
+
c[St(r)] = Ye({
|
|
5002
|
+
timestamp: ue.now(),
|
|
5003
5003
|
transport: t,
|
|
5004
5004
|
latency: s,
|
|
5005
5005
|
cacheSkipCount: a
|
|
@@ -5007,15 +5007,15 @@ function fa() {
|
|
|
5007
5007
|
} catch {
|
|
5008
5008
|
}
|
|
5009
5009
|
}
|
|
5010
|
-
function
|
|
5010
|
+
function un(r) {
|
|
5011
5011
|
var t = j.getLocalStorage();
|
|
5012
5012
|
if (t)
|
|
5013
5013
|
try {
|
|
5014
|
-
delete t[
|
|
5014
|
+
delete t[St(r)];
|
|
5015
5015
|
} catch {
|
|
5016
5016
|
}
|
|
5017
5017
|
}
|
|
5018
|
-
class
|
|
5018
|
+
class et {
|
|
5019
5019
|
constructor(t, { delay: s }) {
|
|
5020
5020
|
this.strategy = t, this.options = { delay: s };
|
|
5021
5021
|
}
|
|
@@ -5070,9 +5070,9 @@ function fa() {
|
|
|
5070
5070
|
}
|
|
5071
5071
|
var gr = function(r, t, s) {
|
|
5072
5072
|
var a = {};
|
|
5073
|
-
function c(
|
|
5074
|
-
var
|
|
5075
|
-
return a[
|
|
5073
|
+
function c(_n, pi, gi, mi, vi) {
|
|
5074
|
+
var Sn = s(r, _n, pi, gi, mi, vi);
|
|
5075
|
+
return a[_n] = Sn, Sn;
|
|
5076
5076
|
}
|
|
5077
5077
|
var p = Object.assign({}, t, {
|
|
5078
5078
|
hostNonTLS: r.wsHost + ":" + r.wsPort,
|
|
@@ -5084,35 +5084,35 @@ function fa() {
|
|
|
5084
5084
|
hostNonTLS: r.httpHost + ":" + r.httpPort,
|
|
5085
5085
|
hostTLS: r.httpHost + ":" + r.httpsPort,
|
|
5086
5086
|
httpPath: r.httpPath
|
|
5087
|
-
}),
|
|
5087
|
+
}), z = {
|
|
5088
5088
|
loop: !0,
|
|
5089
5089
|
timeout: 15e3,
|
|
5090
5090
|
timeoutLimit: 6e4
|
|
5091
|
-
},
|
|
5091
|
+
}, Q = new cn({
|
|
5092
5092
|
minPingDelay: 1e4,
|
|
5093
5093
|
maxPingDelay: r.activityTimeout
|
|
5094
|
-
}),
|
|
5094
|
+
}), te = new cn({
|
|
5095
5095
|
lives: 2,
|
|
5096
5096
|
minPingDelay: 1e4,
|
|
5097
5097
|
maxPingDelay: r.activityTimeout
|
|
5098
|
-
}), ce = c("ws", "ws", 3, p,
|
|
5099
|
-
new ze(je(
|
|
5100
|
-
],
|
|
5101
|
-
new ze(je(
|
|
5102
|
-
],
|
|
5103
|
-
new ze(je(
|
|
5104
|
-
|
|
5105
|
-
new
|
|
5106
|
-
]),
|
|
5107
|
-
],
|
|
5108
|
-
return t.useTLS ?
|
|
5109
|
-
|
|
5110
|
-
new
|
|
5111
|
-
]) :
|
|
5112
|
-
|
|
5113
|
-
new
|
|
5114
|
-
new
|
|
5115
|
-
]), new dr(new pr(new ze(je(ce),
|
|
5098
|
+
}), ce = c("ws", "ws", 3, p, Q), nt = c("wss", "ws", 3, S, Q), ui = c("sockjs", "sockjs", 1, L), pn = c("xhr_streaming", "xhr_streaming", 1, L, te), li = c("xdr_streaming", "xdr_streaming", 1, L, te), gn = c("xhr_polling", "xhr_polling", 1, L), di = c("xdr_polling", "xdr_polling", 1, L), mn = new Le([ce], z), hi = new Le([nt], z), fi = new Le([ui], z), vn = new Le([
|
|
5099
|
+
new ze(je(pn), pn, li)
|
|
5100
|
+
], z), bn = new Le([
|
|
5101
|
+
new ze(je(gn), gn, di)
|
|
5102
|
+
], z), yn = new Le([
|
|
5103
|
+
new ze(je(vn), new _t([
|
|
5104
|
+
vn,
|
|
5105
|
+
new et(bn, { delay: 4e3 })
|
|
5106
|
+
]), bn)
|
|
5107
|
+
], z), Et = new ze(je(yn), yn, fi), At;
|
|
5108
|
+
return t.useTLS ? At = new _t([
|
|
5109
|
+
mn,
|
|
5110
|
+
new et(Et, { delay: 2e3 })
|
|
5111
|
+
]) : At = new _t([
|
|
5112
|
+
mn,
|
|
5113
|
+
new et(hi, { delay: 2e3 }),
|
|
5114
|
+
new et(Et, { delay: 5e3 })
|
|
5115
|
+
]), new dr(new pr(new ze(je(ce), At, Et)), a, {
|
|
5116
5116
|
ttl: 18e5,
|
|
5117
5117
|
timeline: t.timeline,
|
|
5118
5118
|
useTLS: t.useTLS
|
|
@@ -5173,14 +5173,14 @@ function fa() {
|
|
|
5173
5173
|
return this.position === t.length && t.length > _r;
|
|
5174
5174
|
}
|
|
5175
5175
|
}
|
|
5176
|
-
var
|
|
5176
|
+
var Ct;
|
|
5177
5177
|
(function(r) {
|
|
5178
5178
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5179
|
-
})(
|
|
5180
|
-
var Ie =
|
|
5179
|
+
})(Ct || (Ct = {}));
|
|
5180
|
+
var Ie = Ct, Cr = 1;
|
|
5181
5181
|
class wr {
|
|
5182
5182
|
constructor(t, s) {
|
|
5183
|
-
this.hooks = t, this.session =
|
|
5183
|
+
this.hooks = t, this.session = dn(1e3) + "/" + Rr(8), this.location = Tr(s), this.readyState = Ie.CONNECTING, this.openStream();
|
|
5184
5184
|
}
|
|
5185
5185
|
send(t) {
|
|
5186
5186
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5194,7 +5194,7 @@ function fa() {
|
|
|
5194
5194
|
sendRaw(t) {
|
|
5195
5195
|
if (this.readyState === Ie.OPEN)
|
|
5196
5196
|
try {
|
|
5197
|
-
return j.createSocketRequest("POST",
|
|
5197
|
+
return j.createSocketRequest("POST", ln(Er(this.location, this.session))).start(t), !0;
|
|
5198
5198
|
} catch {
|
|
5199
5199
|
return !1;
|
|
5200
5200
|
}
|
|
@@ -5249,7 +5249,7 @@ function fa() {
|
|
|
5249
5249
|
this.onerror && this.onerror(t);
|
|
5250
5250
|
}
|
|
5251
5251
|
openStream() {
|
|
5252
|
-
this.stream = j.createSocketRequest("POST",
|
|
5252
|
+
this.stream = j.createSocketRequest("POST", ln(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5253
5253
|
this.onChunk(t);
|
|
5254
5254
|
}), this.stream.bind("finished", (t) => {
|
|
5255
5255
|
this.hooks.onFinished(this, t);
|
|
@@ -5259,7 +5259,7 @@ function fa() {
|
|
|
5259
5259
|
try {
|
|
5260
5260
|
this.stream.start();
|
|
5261
5261
|
} catch (t) {
|
|
5262
|
-
|
|
5262
|
+
ue.defer(() => {
|
|
5263
5263
|
this.onError(t), this.onClose(1006, "Could not start streaming", !1);
|
|
5264
5264
|
});
|
|
5265
5265
|
}
|
|
@@ -5278,7 +5278,7 @@ function fa() {
|
|
|
5278
5278
|
function Er(r, t) {
|
|
5279
5279
|
return r.base + "/" + t + "/xhr_send";
|
|
5280
5280
|
}
|
|
5281
|
-
function
|
|
5281
|
+
function ln(r) {
|
|
5282
5282
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5283
5283
|
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + Cr++;
|
|
5284
5284
|
}
|
|
@@ -5286,12 +5286,12 @@ function fa() {
|
|
|
5286
5286
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5287
5287
|
return s[1] + t + s[3];
|
|
5288
5288
|
}
|
|
5289
|
-
function
|
|
5289
|
+
function dn(r) {
|
|
5290
5290
|
return j.randomInt(r);
|
|
5291
5291
|
}
|
|
5292
5292
|
function Rr(r) {
|
|
5293
5293
|
for (var t = [], s = 0; s < r; s++)
|
|
5294
|
-
t.push(
|
|
5294
|
+
t.push(dn(32).toString(32));
|
|
5295
5295
|
return t.join("");
|
|
5296
5296
|
}
|
|
5297
5297
|
var Pr = wr, Mr = {
|
|
@@ -5352,15 +5352,15 @@ function fa() {
|
|
|
5352
5352
|
createRequest(r, t, s) {
|
|
5353
5353
|
return new Sr(r, t, s);
|
|
5354
5354
|
}
|
|
5355
|
-
},
|
|
5356
|
-
|
|
5355
|
+
}, hn = Or;
|
|
5356
|
+
hn.createXDR = function(r, t) {
|
|
5357
5357
|
return this.createRequest(yr, r, t);
|
|
5358
5358
|
};
|
|
5359
|
-
var Fr =
|
|
5359
|
+
var Fr = hn, Nr = {
|
|
5360
5360
|
nextAuthCallbackID: 1,
|
|
5361
5361
|
auth_callbacks: {},
|
|
5362
5362
|
ScriptReceivers: l,
|
|
5363
|
-
DependenciesReceivers:
|
|
5363
|
+
DependenciesReceivers: M,
|
|
5364
5364
|
getDefaultStrategy: mr,
|
|
5365
5365
|
Transports: Xs,
|
|
5366
5366
|
transportConnectionInitializer: vr,
|
|
@@ -5386,7 +5386,7 @@ function fa() {
|
|
|
5386
5386
|
return this.getDocument().location.protocol;
|
|
5387
5387
|
},
|
|
5388
5388
|
getAuthorizers() {
|
|
5389
|
-
return { ajax:
|
|
5389
|
+
return { ajax: J, jsonp: Ps };
|
|
5390
5390
|
},
|
|
5391
5391
|
onDocumentBody(r) {
|
|
5392
5392
|
document.body ? r() : setTimeout(() => {
|
|
@@ -5449,32 +5449,32 @@ function fa() {
|
|
|
5449
5449
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5450
5450
|
}() * r);
|
|
5451
5451
|
}
|
|
5452
|
-
}, j = Nr,
|
|
5452
|
+
}, j = Nr, wt;
|
|
5453
5453
|
(function(r) {
|
|
5454
5454
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5455
|
-
})(
|
|
5456
|
-
var
|
|
5455
|
+
})(wt || (wt = {}));
|
|
5456
|
+
var tt = wt;
|
|
5457
5457
|
class Dr {
|
|
5458
5458
|
constructor(t, s, a) {
|
|
5459
5459
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5460
5460
|
}
|
|
5461
5461
|
log(t, s) {
|
|
5462
|
-
t <= this.options.level && (this.events.push(
|
|
5462
|
+
t <= this.options.level && (this.events.push(pe({}, s, { timestamp: ue.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5463
5463
|
}
|
|
5464
5464
|
error(t) {
|
|
5465
|
-
this.log(
|
|
5465
|
+
this.log(tt.ERROR, t);
|
|
5466
5466
|
}
|
|
5467
5467
|
info(t) {
|
|
5468
|
-
this.log(
|
|
5468
|
+
this.log(tt.INFO, t);
|
|
5469
5469
|
}
|
|
5470
5470
|
debug(t) {
|
|
5471
|
-
this.log(
|
|
5471
|
+
this.log(tt.DEBUG, t);
|
|
5472
5472
|
}
|
|
5473
5473
|
isEmpty() {
|
|
5474
5474
|
return this.events.length === 0;
|
|
5475
5475
|
}
|
|
5476
5476
|
send(t, s) {
|
|
5477
|
-
var a =
|
|
5477
|
+
var a = pe({
|
|
5478
5478
|
session: this.session,
|
|
5479
5479
|
bundle: this.sent + 1,
|
|
5480
5480
|
key: this.key,
|
|
@@ -5504,26 +5504,26 @@ function fa() {
|
|
|
5504
5504
|
connect(t, s) {
|
|
5505
5505
|
if (this.isSupported()) {
|
|
5506
5506
|
if (this.priority < t)
|
|
5507
|
-
return
|
|
5508
|
-
} else return
|
|
5507
|
+
return fn(new N(), s);
|
|
5508
|
+
} else return fn(new O(), s);
|
|
5509
5509
|
var a = !1, c = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5510
5510
|
c.unbind("initialized", S), c.connect();
|
|
5511
5511
|
}, L = function() {
|
|
5512
5512
|
p = Ee.createHandshake(c, function(ce) {
|
|
5513
|
-
a = !0,
|
|
5513
|
+
a = !0, te(), s(null, ce);
|
|
5514
5514
|
});
|
|
5515
|
-
},
|
|
5516
|
-
|
|
5517
|
-
},
|
|
5518
|
-
|
|
5515
|
+
}, z = function(ce) {
|
|
5516
|
+
te(), s(ce);
|
|
5517
|
+
}, Q = function() {
|
|
5518
|
+
te();
|
|
5519
5519
|
var ce;
|
|
5520
|
-
ce =
|
|
5521
|
-
},
|
|
5522
|
-
c.unbind("initialized", S), c.unbind("open", L), c.unbind("error",
|
|
5520
|
+
ce = Ye(c), s(new q(ce));
|
|
5521
|
+
}, te = function() {
|
|
5522
|
+
c.unbind("initialized", S), c.unbind("open", L), c.unbind("error", z), c.unbind("closed", Q);
|
|
5523
5523
|
};
|
|
5524
|
-
return c.bind("initialized", S), c.bind("open", L), c.bind("error",
|
|
5524
|
+
return c.bind("initialized", S), c.bind("open", L), c.bind("error", z), c.bind("closed", Q), c.initialize(), {
|
|
5525
5525
|
abort: () => {
|
|
5526
|
-
a || (
|
|
5526
|
+
a || (te(), p ? p.close() : c.close());
|
|
5527
5527
|
},
|
|
5528
5528
|
forceMinPriority: (ce) => {
|
|
5529
5529
|
a || this.priority < ce && (p ? p.close() : c.close());
|
|
@@ -5531,8 +5531,8 @@ function fa() {
|
|
|
5531
5531
|
};
|
|
5532
5532
|
}
|
|
5533
5533
|
}
|
|
5534
|
-
function
|
|
5535
|
-
return
|
|
5534
|
+
function fn(r, t) {
|
|
5535
|
+
return ue.defer(function() {
|
|
5536
5536
|
t(r);
|
|
5537
5537
|
}), {
|
|
5538
5538
|
abort: function() {
|
|
@@ -5545,15 +5545,15 @@ function fa() {
|
|
|
5545
5545
|
var jr = function(r, t, s, a, c, p) {
|
|
5546
5546
|
var S = zr[s];
|
|
5547
5547
|
if (!S)
|
|
5548
|
-
throw new
|
|
5549
|
-
var L = (!r.enabledTransports ||
|
|
5550
|
-
return L ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c),
|
|
5548
|
+
throw new k(s);
|
|
5549
|
+
var L = (!r.enabledTransports || E(r.enabledTransports, t) !== -1) && (!r.disabledTransports || E(r.disabledTransports, t) === -1), z;
|
|
5550
|
+
return L ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c), z = new qr(t, a, p ? p.getAssistant(S) : S, c)) : z = $r, z;
|
|
5551
5551
|
}, $r = {
|
|
5552
5552
|
isSupported: function() {
|
|
5553
5553
|
return !1;
|
|
5554
5554
|
},
|
|
5555
5555
|
connect: function(r, t) {
|
|
5556
|
-
var s =
|
|
5556
|
+
var s = ue.defer(function() {
|
|
5557
5557
|
t(new O());
|
|
5558
5558
|
});
|
|
5559
5559
|
return {
|
|
@@ -5747,7 +5747,7 @@ function fa() {
|
|
|
5747
5747
|
const t = (s) => {
|
|
5748
5748
|
s.subscriptionPending && s.subscriptionCancelled ? s.reinstateSubscription() : !s.subscriptionPending && this.pusher.connection.state === "connected" && s.subscribe();
|
|
5749
5749
|
};
|
|
5750
|
-
this.serverToUserChannel = new
|
|
5750
|
+
this.serverToUserChannel = new vt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
|
|
5751
5751
|
s.indexOf("pusher_internal:") === 0 || s.indexOf("pusher:") === 0 || this.emit(s, a);
|
|
5752
5752
|
}), t(this.serverToUserChannel);
|
|
5753
5753
|
}
|
|
@@ -5772,7 +5772,7 @@ function fa() {
|
|
|
5772
5772
|
de.instances[t].connect();
|
|
5773
5773
|
}
|
|
5774
5774
|
static getClientFeatures() {
|
|
5775
|
-
return
|
|
5775
|
+
return D(Qe({ ws: j.Transports.ws }, function(t) {
|
|
5776
5776
|
return t.isSupported({});
|
|
5777
5777
|
}));
|
|
5778
5778
|
}
|
|
@@ -5782,7 +5782,7 @@ function fa() {
|
|
|
5782
5782
|
features: de.getClientFeatures(),
|
|
5783
5783
|
params: this.config.timelineParams || {},
|
|
5784
5784
|
limit: 50,
|
|
5785
|
-
level:
|
|
5785
|
+
level: tt.INFO,
|
|
5786
5786
|
version: h.VERSION
|
|
5787
5787
|
}), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
|
|
5788
5788
|
host: this.config.statsHost,
|
|
@@ -5869,7 +5869,7 @@ function fa() {
|
|
|
5869
5869
|
}
|
|
5870
5870
|
}
|
|
5871
5871
|
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;
|
|
5872
|
-
var
|
|
5872
|
+
var Tt = o.default = de;
|
|
5873
5873
|
function ci(r) {
|
|
5874
5874
|
if (r == null)
|
|
5875
5875
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
@@ -5880,17 +5880,17 @@ function fa() {
|
|
|
5880
5880
|
])
|
|
5881
5881
|
);
|
|
5882
5882
|
});
|
|
5883
|
-
})(
|
|
5883
|
+
})(It)), It.exports;
|
|
5884
5884
|
}
|
|
5885
5885
|
var pa = fa();
|
|
5886
5886
|
const ga = /* @__PURE__ */ ha(pa), ma = "/v1/messenger/bootstrap", va = 3e4, ba = 3e4, ya = 5 * 6e4;
|
|
5887
|
-
function
|
|
5887
|
+
function se(e) {
|
|
5888
5888
|
return typeof e == "object" && e !== null;
|
|
5889
5889
|
}
|
|
5890
|
-
function
|
|
5890
|
+
function le(e, n) {
|
|
5891
5891
|
return typeof e[n] == "string";
|
|
5892
5892
|
}
|
|
5893
|
-
function
|
|
5893
|
+
function Se(e, n) {
|
|
5894
5894
|
const i = e[n];
|
|
5895
5895
|
if (typeof i != "string" || i.trim() === "")
|
|
5896
5896
|
throw new Error(`Invalid messenger bootstrap payload: missing string ${n}`);
|
|
@@ -5924,39 +5924,39 @@ function Ca(e) {
|
|
|
5924
5924
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5925
5925
|
}
|
|
5926
5926
|
function wa(e) {
|
|
5927
|
-
const n =
|
|
5928
|
-
if (!
|
|
5927
|
+
const n = se(e) && se(e.data) ? e.data : e;
|
|
5928
|
+
if (!se(n))
|
|
5929
5929
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
5930
5930
|
const i = n.auth, o = n.service;
|
|
5931
|
-
if (!
|
|
5931
|
+
if (!se(i) || !se(o))
|
|
5932
5932
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
5933
5933
|
const u = i.user, d = o.reverb;
|
|
5934
|
-
if (!
|
|
5934
|
+
if (!se(u) || !se(d))
|
|
5935
5935
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5936
5936
|
const l = Ca(Ve(d, "path"));
|
|
5937
5937
|
return {
|
|
5938
5938
|
auth: {
|
|
5939
|
-
token:
|
|
5940
|
-
tokenType:
|
|
5939
|
+
token: Se(i, "token"),
|
|
5940
|
+
tokenType: Se(i, "token_type"),
|
|
5941
5941
|
expiresAt: Ve(i, "expires_at"),
|
|
5942
5942
|
tenantId: Ve(i, "tenant_id"),
|
|
5943
5943
|
user: {
|
|
5944
|
-
id:
|
|
5945
|
-
handle:
|
|
5946
|
-
name:
|
|
5944
|
+
id: Se(u, "id"),
|
|
5945
|
+
handle: Se(u, "handle"),
|
|
5946
|
+
name: Se(u, "name"),
|
|
5947
5947
|
avatarUrl: Ve(u, "avatar_url"),
|
|
5948
5948
|
email: Ve(u, "email")
|
|
5949
5949
|
}
|
|
5950
5950
|
},
|
|
5951
5951
|
service: {
|
|
5952
|
-
baseUrl:
|
|
5953
|
-
apiBaseUrl:
|
|
5954
|
-
broadcastingAuthUrl:
|
|
5952
|
+
baseUrl: Se(o, "base_url"),
|
|
5953
|
+
apiBaseUrl: Se(o, "api_base_url"),
|
|
5954
|
+
broadcastingAuthUrl: Se(o, "broadcasting_auth_url"),
|
|
5955
5955
|
reverb: {
|
|
5956
|
-
appKey:
|
|
5957
|
-
host:
|
|
5956
|
+
appKey: Se(d, "app_key"),
|
|
5957
|
+
host: Se(d, "host"),
|
|
5958
5958
|
port: _a(d, "port"),
|
|
5959
|
-
scheme: Sa(
|
|
5959
|
+
scheme: Sa(Se(d, "scheme")),
|
|
5960
5960
|
...l ? { path: l } : {}
|
|
5961
5961
|
}
|
|
5962
5962
|
}
|
|
@@ -5966,21 +5966,21 @@ function Ta(e) {
|
|
|
5966
5966
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
5967
5967
|
}
|
|
5968
5968
|
function Ea(e) {
|
|
5969
|
-
if (!
|
|
5969
|
+
if (!se(e))
|
|
5970
5970
|
return !1;
|
|
5971
|
-
const n =
|
|
5971
|
+
const n = se(e.response) ? e.response : null;
|
|
5972
5972
|
if (n?.status !== 403)
|
|
5973
5973
|
return !1;
|
|
5974
5974
|
const i = n.data;
|
|
5975
5975
|
return i?.code === "ACCOUNT_SUSPENDED" || i?.errors?.reason === "account_suspended" ? !0 : typeof i?.message == "string" && i.message.toLowerCase().includes("suspended");
|
|
5976
5976
|
}
|
|
5977
|
-
function
|
|
5978
|
-
if (e.headers instanceof
|
|
5977
|
+
function Hn(e, n) {
|
|
5978
|
+
if (e.headers instanceof Cn) {
|
|
5979
5979
|
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"));
|
|
5980
5980
|
return;
|
|
5981
5981
|
}
|
|
5982
|
-
const i =
|
|
5983
|
-
e.headers = new
|
|
5982
|
+
const i = se(e.headers) ? e.headers : {};
|
|
5983
|
+
e.headers = new Cn({
|
|
5984
5984
|
...i,
|
|
5985
5985
|
Authorization: `Bearer ${n}`,
|
|
5986
5986
|
Accept: "application/json",
|
|
@@ -6001,7 +6001,7 @@ function Aa(e) {
|
|
|
6001
6001
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
6002
6002
|
}
|
|
6003
6003
|
function Ra(e, n) {
|
|
6004
|
-
if (!
|
|
6004
|
+
if (!se(e))
|
|
6005
6005
|
return null;
|
|
6006
6006
|
const i = Ae(e, "user_id", "userId"), o = Aa(e.status);
|
|
6007
6007
|
if (!i || !o)
|
|
@@ -6017,12 +6017,12 @@ function Ra(e, n) {
|
|
|
6017
6017
|
return typeof l == "string" ? u.last_seen_at = l : l === null && (u.last_seen_at = null), u;
|
|
6018
6018
|
}
|
|
6019
6019
|
function Pa(e) {
|
|
6020
|
-
if (!
|
|
6020
|
+
if (!se(e))
|
|
6021
6021
|
return null;
|
|
6022
6022
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
6023
6023
|
if (!n || !i)
|
|
6024
6024
|
return null;
|
|
6025
|
-
const o = e.user, u =
|
|
6025
|
+
const o = e.user, u = se(o) ? {
|
|
6026
6026
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
6027
6027
|
name: typeof o.name == "string" ? o.name : "",
|
|
6028
6028
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
@@ -6038,12 +6038,12 @@ function Pa(e) {
|
|
|
6038
6038
|
};
|
|
6039
6039
|
}
|
|
6040
6040
|
function Ma(e) {
|
|
6041
|
-
if (!
|
|
6041
|
+
if (!se(e))
|
|
6042
6042
|
return null;
|
|
6043
6043
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
6044
6044
|
if (!n || !i)
|
|
6045
6045
|
return null;
|
|
6046
|
-
const o =
|
|
6046
|
+
const o = se(e.user) ? {
|
|
6047
6047
|
...typeof e.user.id == "string" && e.user.id !== "" ? { id: e.user.id } : {},
|
|
6048
6048
|
...typeof e.user.name == "string" ? { name: e.user.name } : {},
|
|
6049
6049
|
...typeof e.user.avatar == "string" && e.user.avatar !== "" ? { avatar: e.user.avatar } : {}
|
|
@@ -6057,7 +6057,7 @@ function Ma(e) {
|
|
|
6057
6057
|
};
|
|
6058
6058
|
}
|
|
6059
6059
|
function xa(e) {
|
|
6060
|
-
if (!
|
|
6060
|
+
if (!se(e))
|
|
6061
6061
|
return null;
|
|
6062
6062
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
6063
6063
|
return !n || !i ? null : {
|
|
@@ -6068,31 +6068,31 @@ function xa(e) {
|
|
|
6068
6068
|
};
|
|
6069
6069
|
}
|
|
6070
6070
|
function ka(e) {
|
|
6071
|
-
return
|
|
6071
|
+
return se(e) && le(e, "id") && le(e, "name");
|
|
6072
6072
|
}
|
|
6073
6073
|
function La(e) {
|
|
6074
|
-
return !
|
|
6074
|
+
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ka(n));
|
|
6075
6075
|
}
|
|
6076
6076
|
function Ia(e) {
|
|
6077
|
-
return
|
|
6077
|
+
return se(e) && se(e.message) && le(e.message, "id") && le(e.message, "conversation_id") && le(e.message, "author_id");
|
|
6078
6078
|
}
|
|
6079
6079
|
function Ua(e) {
|
|
6080
|
-
return
|
|
6080
|
+
return se(e) && le(e, "conversation_id") && le(e, "user_id") && le(e, "message_id");
|
|
6081
6081
|
}
|
|
6082
6082
|
function Oa(e) {
|
|
6083
|
-
return
|
|
6083
|
+
return se(e) && le(e, "conversation_id") && se(e.message) && le(e.message, "id");
|
|
6084
6084
|
}
|
|
6085
6085
|
function Fa(e) {
|
|
6086
|
-
return
|
|
6086
|
+
return se(e) && le(e, "conversation_id") && le(e, "message_id");
|
|
6087
6087
|
}
|
|
6088
6088
|
function Na(e) {
|
|
6089
|
-
return
|
|
6089
|
+
return se(e) && le(e, "conversation_id") && le(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => La(n));
|
|
6090
6090
|
}
|
|
6091
6091
|
function Da(e) {
|
|
6092
|
-
return
|
|
6092
|
+
return se(e) && le(e, "conversation_id");
|
|
6093
6093
|
}
|
|
6094
6094
|
function qa(e) {
|
|
6095
|
-
return
|
|
6095
|
+
return se(e) && le(e, "conversation_id") && le(e, "removed_user_id");
|
|
6096
6096
|
}
|
|
6097
6097
|
function Oe(e, n, i, o) {
|
|
6098
6098
|
const u = (d) => {
|
|
@@ -6101,112 +6101,123 @@ function Oe(e, n, i, o) {
|
|
|
6101
6101
|
return e.listen(n, u), u;
|
|
6102
6102
|
}
|
|
6103
6103
|
function nc(e) {
|
|
6104
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ma, o = e.bootstrapRefreshSkewMs ?? va, u = e.presenceFreshnessTtlMs ?? ya, d = (e.createLogger ??
|
|
6104
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ma, o = e.bootstrapRefreshSkewMs ?? va, u = e.presenceFreshnessTtlMs ?? ya, d = (e.createLogger ?? Jt())("MessengerEcho");
|
|
6105
6105
|
typeof window < "u" && (window.Pusher = ga);
|
|
6106
|
-
let l = null, g = null, h = null,
|
|
6107
|
-
const w = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (
|
|
6108
|
-
|
|
6109
|
-
for (const
|
|
6110
|
-
|
|
6111
|
-
}, v = (
|
|
6112
|
-
_ =
|
|
6113
|
-
for (const
|
|
6114
|
-
|
|
6106
|
+
let l = null, g = null, h = null, x = null, M = "disconnected", _ = "available", T = null, y = null;
|
|
6107
|
+
const w = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (E) => {
|
|
6108
|
+
M = E;
|
|
6109
|
+
for (const P of w)
|
|
6110
|
+
P(E);
|
|
6111
|
+
}, v = (E) => {
|
|
6112
|
+
_ = E;
|
|
6113
|
+
for (const P of C)
|
|
6114
|
+
P(E);
|
|
6115
6115
|
}, N = () => {
|
|
6116
6116
|
y !== null && (clearTimeout(y), y = null);
|
|
6117
|
-
},
|
|
6118
|
-
h !== null && (h.disconnect(), h = null),
|
|
6119
|
-
},
|
|
6120
|
-
N(), l = null, g = null, T = null, v("available"),
|
|
6121
|
-
},
|
|
6117
|
+
}, q = (E = !0) => {
|
|
6118
|
+
h !== null && (h.disconnect(), h = null), x = null, E && m("disconnected");
|
|
6119
|
+
}, G = () => {
|
|
6120
|
+
N(), l = null, g = null, T = null, v("available"), q(), f.clear();
|
|
6121
|
+
}, k = () => {
|
|
6122
6122
|
if (!e.getSourceToken)
|
|
6123
6123
|
return null;
|
|
6124
|
-
const
|
|
6125
|
-
return
|
|
6126
|
-
}, O = (
|
|
6127
|
-
if (
|
|
6124
|
+
const E = e.getSourceToken();
|
|
6125
|
+
return E === null ? (G(), null) : (T !== null && T !== E && (N(), l = null, g = null, v("available"), q()), T = E, E);
|
|
6126
|
+
}, O = (E) => {
|
|
6127
|
+
if (E === null)
|
|
6128
6128
|
return !1;
|
|
6129
|
-
if (
|
|
6130
|
-
return
|
|
6131
|
-
const
|
|
6132
|
-
return Number.isNaN(
|
|
6133
|
-
}, H = (
|
|
6134
|
-
if (N(),
|
|
6129
|
+
if (E.auth.expiresAt === null)
|
|
6130
|
+
return E.auth.token !== "";
|
|
6131
|
+
const P = Date.parse(E.auth.expiresAt);
|
|
6132
|
+
return Number.isNaN(P) ? !1 : P - Date.now() > o;
|
|
6133
|
+
}, H = (E) => {
|
|
6134
|
+
if (N(), E.auth.expiresAt === null)
|
|
6135
6135
|
return;
|
|
6136
|
-
const
|
|
6137
|
-
if (Number.isNaN(
|
|
6136
|
+
const P = Date.parse(E.auth.expiresAt);
|
|
6137
|
+
if (Number.isNaN(P))
|
|
6138
6138
|
return;
|
|
6139
|
-
const
|
|
6139
|
+
const D = Math.max(0, P - Date.now() - o);
|
|
6140
6140
|
y = setTimeout(() => {
|
|
6141
|
-
|
|
6142
|
-
},
|
|
6143
|
-
}, F = async (
|
|
6141
|
+
J();
|
|
6142
|
+
}, D);
|
|
6143
|
+
}, F = async (E = !1) => e.getSourceToken && k() === null || !E && _ === "account_suspended" ? null : !E && O(l) ? l : !E && g !== null ? await g : (g = (async () => {
|
|
6144
6144
|
try {
|
|
6145
|
-
const
|
|
6145
|
+
const D = await e.bootstrapClient.get(
|
|
6146
6146
|
i,
|
|
6147
|
-
|
|
6148
|
-
),
|
|
6149
|
-
return l =
|
|
6150
|
-
} catch (
|
|
6151
|
-
if (Ea(
|
|
6152
|
-
return l = null, N(), v("account_suspended"),
|
|
6153
|
-
throw
|
|
6147
|
+
E ? { params: { refresh: 1 } } : void 0
|
|
6148
|
+
), X = wa(D.data);
|
|
6149
|
+
return l = X, v("available"), H(X), X;
|
|
6150
|
+
} catch (D) {
|
|
6151
|
+
if (Ea(D))
|
|
6152
|
+
return l = null, N(), v("account_suspended"), q(), m("disconnected"), null;
|
|
6153
|
+
throw D;
|
|
6154
6154
|
}
|
|
6155
6155
|
})().finally(() => {
|
|
6156
6156
|
g = null;
|
|
6157
|
-
}), await g),
|
|
6158
|
-
const
|
|
6157
|
+
}), await g), J = async () => {
|
|
6158
|
+
const E = h !== null;
|
|
6159
6159
|
try {
|
|
6160
|
-
if (await F(!0), !
|
|
6160
|
+
if (await F(!0), !E)
|
|
6161
6161
|
return;
|
|
6162
|
-
|
|
6163
|
-
} catch (
|
|
6164
|
-
d.warn("Failed to refresh messenger bootstrap",
|
|
6162
|
+
q(!1), await ee(!0);
|
|
6163
|
+
} catch (P) {
|
|
6164
|
+
d.warn("Failed to refresh messenger bootstrap", P);
|
|
6165
6165
|
}
|
|
6166
|
-
},
|
|
6167
|
-
const
|
|
6168
|
-
if (!
|
|
6166
|
+
}, me = (E) => {
|
|
6167
|
+
const P = E.connector?.pusher?.connection;
|
|
6168
|
+
if (!P) {
|
|
6169
6169
|
d.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6170
6170
|
return;
|
|
6171
6171
|
}
|
|
6172
|
-
|
|
6172
|
+
P.bind("connecting", () => {
|
|
6173
6173
|
m("connecting");
|
|
6174
|
-
}),
|
|
6174
|
+
}), P.bind("connected", () => {
|
|
6175
6175
|
m("connected");
|
|
6176
|
-
}),
|
|
6176
|
+
}), P.bind("disconnected", () => {
|
|
6177
6177
|
m("disconnected");
|
|
6178
|
-
}),
|
|
6178
|
+
}), P.bind("unavailable", () => {
|
|
6179
6179
|
m("disconnected");
|
|
6180
|
-
}),
|
|
6180
|
+
}), P.bind("error", () => {
|
|
6181
6181
|
m("error");
|
|
6182
|
-
}),
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6182
|
+
}), P.bind("state_change", (D) => {
|
|
6183
|
+
const X = typeof D == "object" && D !== null && "current" in D && typeof D.current == "string" ? D.current : P.state;
|
|
6184
|
+
if (X === "connected") {
|
|
6185
|
+
m("connected");
|
|
6186
|
+
return;
|
|
6187
|
+
}
|
|
6188
|
+
if (X === "connecting") {
|
|
6189
|
+
m("connecting");
|
|
6190
|
+
return;
|
|
6191
|
+
}
|
|
6192
|
+
(X === "unavailable" || X === "failed" || X === "disconnected") && m("disconnected");
|
|
6193
|
+
}), P.state === "connected" && m("connected");
|
|
6194
|
+
}, ee = async (E = !1) => !E && h !== null && O(l) ? h : !E && x !== null ? await x : (x = (async () => {
|
|
6195
|
+
const D = await F(E);
|
|
6196
|
+
if (D === null)
|
|
6186
6197
|
return null;
|
|
6187
|
-
h !== null &&
|
|
6188
|
-
const
|
|
6198
|
+
h !== null && q(!1);
|
|
6199
|
+
const X = D.service.reverb.scheme === "https", Y = {
|
|
6189
6200
|
broadcaster: "reverb",
|
|
6190
|
-
key:
|
|
6191
|
-
wsHost: Ta(
|
|
6192
|
-
wsPort:
|
|
6193
|
-
wssPort:
|
|
6194
|
-
forceTLS:
|
|
6195
|
-
encrypted:
|
|
6201
|
+
key: D.service.reverb.appKey,
|
|
6202
|
+
wsHost: Ta(D.service.reverb.host),
|
|
6203
|
+
wsPort: D.service.reverb.port,
|
|
6204
|
+
wssPort: D.service.reverb.port,
|
|
6205
|
+
forceTLS: X,
|
|
6206
|
+
encrypted: X,
|
|
6196
6207
|
disableStats: !0,
|
|
6197
6208
|
enabledTransports: ["ws", "wss"],
|
|
6198
|
-
authEndpoint:
|
|
6209
|
+
authEndpoint: D.service.broadcastingAuthUrl,
|
|
6199
6210
|
auth: {
|
|
6200
6211
|
headers: {
|
|
6201
|
-
Authorization: `Bearer ${
|
|
6212
|
+
Authorization: `Bearer ${D.auth.token}`,
|
|
6202
6213
|
Accept: "application/json"
|
|
6203
6214
|
}
|
|
6204
6215
|
}
|
|
6205
6216
|
};
|
|
6206
|
-
return
|
|
6217
|
+
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new da(Y), me(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6207
6218
|
})().finally(() => {
|
|
6208
|
-
|
|
6209
|
-
}), await
|
|
6219
|
+
x = null;
|
|
6220
|
+
}), await x), b = jt.create({
|
|
6210
6221
|
timeout: e.requestTimeoutMs ?? ba,
|
|
6211
6222
|
withCredentials: !1,
|
|
6212
6223
|
headers: {
|
|
@@ -6214,220 +6225,228 @@ function nc(e) {
|
|
|
6214
6225
|
"X-Requested-With": "XMLHttpRequest"
|
|
6215
6226
|
}
|
|
6216
6227
|
});
|
|
6217
|
-
b.interceptors.request.use(async (
|
|
6218
|
-
const
|
|
6219
|
-
if (
|
|
6228
|
+
b.interceptors.request.use(async (E) => {
|
|
6229
|
+
const P = await F();
|
|
6230
|
+
if (P === null)
|
|
6220
6231
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6221
|
-
return
|
|
6232
|
+
return E.baseURL = P.service.apiBaseUrl, Hn(E, P.auth.token), E;
|
|
6222
6233
|
}), b.interceptors.response.use(
|
|
6223
|
-
(
|
|
6224
|
-
async (
|
|
6225
|
-
const
|
|
6226
|
-
if (
|
|
6227
|
-
|
|
6228
|
-
const
|
|
6229
|
-
if (
|
|
6230
|
-
return
|
|
6234
|
+
(E) => E,
|
|
6235
|
+
async (E) => {
|
|
6236
|
+
const P = E.config;
|
|
6237
|
+
if (E.response?.status === 401 && P && P._messengerRetry !== !0) {
|
|
6238
|
+
P._messengerRetry = !0;
|
|
6239
|
+
const D = await F(!0);
|
|
6240
|
+
if (D !== null)
|
|
6241
|
+
return P.baseURL = D.service.apiBaseUrl, Hn(P, D.auth.token), await b(P);
|
|
6231
6242
|
}
|
|
6232
|
-
return Promise.reject(
|
|
6243
|
+
return Promise.reject(E);
|
|
6233
6244
|
}
|
|
6234
6245
|
);
|
|
6235
|
-
const I = () => _ === "account_suspended" ? null : (
|
|
6236
|
-
d.warn("Failed to initialize messenger echo",
|
|
6237
|
-
}), h), ae = (
|
|
6238
|
-
w.delete(
|
|
6239
|
-
}), B = (
|
|
6240
|
-
C.delete(
|
|
6241
|
-
}),
|
|
6242
|
-
const
|
|
6243
|
-
if (
|
|
6246
|
+
const I = () => _ === "account_suspended" ? null : (ee().catch((E) => {
|
|
6247
|
+
d.warn("Failed to initialize messenger echo", E);
|
|
6248
|
+
}), h), ae = (E) => (w.add(E), E(M), () => {
|
|
6249
|
+
w.delete(E);
|
|
6250
|
+
}), B = (E) => (C.add(E), E(_), () => {
|
|
6251
|
+
C.delete(E);
|
|
6252
|
+
}), A = () => l?.auth.tenantId ?? "global", V = (E) => {
|
|
6253
|
+
const P = Dt(E.ts)?.getTime() ?? Dt(E.last_seen_at)?.getTime() ?? null;
|
|
6254
|
+
if (P === null)
|
|
6244
6255
|
return !0;
|
|
6245
|
-
const
|
|
6246
|
-
if (
|
|
6256
|
+
const D = `${E.tenant_scope ?? "global"}:${E.user_id}`, X = f.get(D);
|
|
6257
|
+
if (X && P < X.timestampMs)
|
|
6247
6258
|
return !1;
|
|
6248
|
-
const
|
|
6249
|
-
f.set(
|
|
6250
|
-
timestampMs:
|
|
6251
|
-
seenAt:
|
|
6259
|
+
const Y = Date.now();
|
|
6260
|
+
f.set(D, {
|
|
6261
|
+
timestampMs: P,
|
|
6262
|
+
seenAt: Y
|
|
6252
6263
|
});
|
|
6253
|
-
for (const [
|
|
6254
|
-
|
|
6264
|
+
for (const [ge, we] of f.entries())
|
|
6265
|
+
Y - we.seenAt > u && f.delete(ge);
|
|
6255
6266
|
return !0;
|
|
6256
|
-
}
|
|
6267
|
+
}, ne = (E) => {
|
|
6268
|
+
const P = I();
|
|
6269
|
+
if (!P || typeof P.join != "function")
|
|
6270
|
+
return;
|
|
6271
|
+
const D = P.join(`online-users.${A()}`), X = [
|
|
6272
|
+
".PresenceStatusChanged",
|
|
6273
|
+
"PresenceStatusChanged",
|
|
6274
|
+
".presence.status.changed",
|
|
6275
|
+
"presence.status.changed",
|
|
6276
|
+
".Presence.StatusChanged",
|
|
6277
|
+
"Presence.StatusChanged",
|
|
6278
|
+
".Modules\\Presence\\Events\\UserPresenceStatusChanged",
|
|
6279
|
+
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6280
|
+
];
|
|
6281
|
+
for (const Y of X)
|
|
6282
|
+
D.listen(Y, (ge) => {
|
|
6283
|
+
const we = Ra(ge, A());
|
|
6284
|
+
!we || !V(we) || E(we);
|
|
6285
|
+
});
|
|
6286
|
+
}, _e = () => {
|
|
6287
|
+
h?.leave(`online-users.${A()}`);
|
|
6288
|
+
}, R = (E, P) => {
|
|
6289
|
+
const D = I();
|
|
6290
|
+
if (!D)
|
|
6291
|
+
return () => {
|
|
6292
|
+
};
|
|
6293
|
+
const X = D.private(`conversation.${E}`), Y = [];
|
|
6294
|
+
return P.onMessageSent && Y.push({
|
|
6295
|
+
event: ".ConversationMessageSent",
|
|
6296
|
+
handler: Oe(X, ".ConversationMessageSent", Ia, P.onMessageSent)
|
|
6297
|
+
}), P.onMessageRead && Y.push({
|
|
6298
|
+
event: ".ConversationMessageRead",
|
|
6299
|
+
handler: Oe(X, ".ConversationMessageRead", Ua, P.onMessageRead)
|
|
6300
|
+
}), P.onMessageEdited && Y.push({
|
|
6301
|
+
event: ".ConversationMessageEdited",
|
|
6302
|
+
handler: Oe(X, ".ConversationMessageEdited", Oa, P.onMessageEdited)
|
|
6303
|
+
}), P.onMessageDeleted && Y.push({
|
|
6304
|
+
event: ".ConversationMessageDeleted",
|
|
6305
|
+
handler: Oe(X, ".ConversationMessageDeleted", Fa, P.onMessageDeleted)
|
|
6306
|
+
}), P.onReactionToggled && Y.push({
|
|
6307
|
+
event: ".MessageReactionToggled",
|
|
6308
|
+
handler: Oe(X, ".MessageReactionToggled", Na, P.onReactionToggled)
|
|
6309
|
+
}), P.onRequestAccepted && Y.push({
|
|
6310
|
+
event: ".ConversationRequestAccepted",
|
|
6311
|
+
handler: Oe(X, ".ConversationRequestAccepted", Da, P.onRequestAccepted)
|
|
6312
|
+
}), P.onParticipantRemoved && Y.push({
|
|
6313
|
+
event: ".ConversationParticipantRemoved",
|
|
6314
|
+
handler: Oe(X, ".ConversationParticipantRemoved", qa, P.onParticipantRemoved)
|
|
6315
|
+
}), () => {
|
|
6316
|
+
if (typeof X.stopListening == "function")
|
|
6317
|
+
for (const ge of Y)
|
|
6318
|
+
X.stopListening(ge.event, ge.handler);
|
|
6319
|
+
};
|
|
6320
|
+
}, U = (E) => {
|
|
6321
|
+
h?.leave(`conversation.${E}`);
|
|
6322
|
+
}, re = (E, P, D) => {
|
|
6323
|
+
const X = E.private(`typing-conversation.${P}`), Y = [], ge = [
|
|
6324
|
+
".TypingStateChanged",
|
|
6325
|
+
"TypingStateChanged",
|
|
6326
|
+
".typing.changed",
|
|
6327
|
+
"typing.changed",
|
|
6328
|
+
".typing.state.changed",
|
|
6329
|
+
"typing.state.changed",
|
|
6330
|
+
".Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged",
|
|
6331
|
+
"Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged"
|
|
6332
|
+
], 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"]);
|
|
6333
|
+
for (const ye of ge) {
|
|
6334
|
+
const Ce = (xe) => {
|
|
6335
|
+
const K = Pa(xe);
|
|
6336
|
+
if (K) {
|
|
6337
|
+
if (Qe.has(K.state)) {
|
|
6338
|
+
D.onTypingStart?.({
|
|
6339
|
+
user_id: K.user_id,
|
|
6340
|
+
user: K.user ?? {
|
|
6341
|
+
id: K.user_id,
|
|
6342
|
+
name: ""
|
|
6343
|
+
},
|
|
6344
|
+
conversation_id: K.conversation_id,
|
|
6345
|
+
started_at: K.started_at ?? K.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6346
|
+
});
|
|
6347
|
+
return;
|
|
6348
|
+
}
|
|
6349
|
+
ft.has(K.state) && D.onTypingStop?.({
|
|
6350
|
+
user_id: K.user_id,
|
|
6351
|
+
conversation_id: K.conversation_id,
|
|
6352
|
+
stopped_at: K.stopped_at ?? K.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6353
|
+
});
|
|
6354
|
+
}
|
|
6355
|
+
};
|
|
6356
|
+
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6357
|
+
}
|
|
6358
|
+
for (const ye of we) {
|
|
6359
|
+
const Ce = (xe) => {
|
|
6360
|
+
const K = Ma(xe);
|
|
6361
|
+
if (!K)
|
|
6362
|
+
return;
|
|
6363
|
+
const qe = {
|
|
6364
|
+
user_id: K.user_id,
|
|
6365
|
+
user: {
|
|
6366
|
+
id: K.user?.id ?? K.user_id,
|
|
6367
|
+
name: K.user?.name ?? "",
|
|
6368
|
+
...K.user?.avatar ? { avatar: K.user.avatar } : {}
|
|
6369
|
+
},
|
|
6370
|
+
conversation_id: K.conversation_id,
|
|
6371
|
+
started_at: K.started_at ?? K.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6372
|
+
};
|
|
6373
|
+
D.onTypingStart?.(qe);
|
|
6374
|
+
};
|
|
6375
|
+
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6376
|
+
}
|
|
6377
|
+
for (const ye of Ke) {
|
|
6378
|
+
const Ce = (xe) => {
|
|
6379
|
+
const K = xa(xe);
|
|
6380
|
+
if (!K)
|
|
6381
|
+
return;
|
|
6382
|
+
const qe = {
|
|
6383
|
+
user_id: K.user_id,
|
|
6384
|
+
conversation_id: K.conversation_id,
|
|
6385
|
+
stopped_at: K.stopped_at ?? K.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6386
|
+
};
|
|
6387
|
+
D.onTypingStop?.(qe);
|
|
6388
|
+
};
|
|
6389
|
+
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6390
|
+
}
|
|
6391
|
+
return () => {
|
|
6392
|
+
if (typeof X.stopListening == "function")
|
|
6393
|
+
for (const ye of Y)
|
|
6394
|
+
X.stopListening(ye.event, ye.handler);
|
|
6395
|
+
};
|
|
6396
|
+
}, fe = (E, P) => {
|
|
6397
|
+
const D = I();
|
|
6398
|
+
if (D)
|
|
6399
|
+
return re(D, E, P);
|
|
6400
|
+
let X = !1, Y = null;
|
|
6401
|
+
return Je().then((ge) => {
|
|
6402
|
+
X || !ge || (Y = re(ge, E, P));
|
|
6403
|
+
}).catch((ge) => {
|
|
6404
|
+
d.warn("Failed to defer typing subscription", ge);
|
|
6405
|
+
}), () => {
|
|
6406
|
+
X = !0, Y?.();
|
|
6407
|
+
};
|
|
6408
|
+
}, ue = (E) => {
|
|
6409
|
+
h?.leave(`typing-conversation.${E}`);
|
|
6410
|
+
}, pe = async () => {
|
|
6411
|
+
v("available"), q(), await ee(!0);
|
|
6412
|
+
}, Je = async () => _ === "account_suspended" ? null : await ee();
|
|
6257
6413
|
return {
|
|
6258
6414
|
apiClient: b,
|
|
6259
6415
|
initializedEvent: n,
|
|
6260
6416
|
getEcho: I,
|
|
6261
|
-
waitForEcho:
|
|
6262
|
-
getConnectionStatus: () =>
|
|
6417
|
+
waitForEcho: Je,
|
|
6418
|
+
getConnectionStatus: () => M,
|
|
6263
6419
|
getAccessState: () => _,
|
|
6264
6420
|
onConnectionStatusChange: ae,
|
|
6265
6421
|
onAccessStateChange: B,
|
|
6266
|
-
reconnect:
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
".PresenceStatusChanged",
|
|
6275
|
-
"PresenceStatusChanged",
|
|
6276
|
-
".presence.status.changed",
|
|
6277
|
-
"presence.status.changed",
|
|
6278
|
-
".Presence.StatusChanged",
|
|
6279
|
-
"Presence.StatusChanged",
|
|
6280
|
-
".Modules\\Presence\\Events\\UserPresenceStatusChanged",
|
|
6281
|
-
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6282
|
-
];
|
|
6283
|
-
for (const ie of Q)
|
|
6284
|
-
z.listen(ie, (be) => {
|
|
6285
|
-
const we = Ra(be, E());
|
|
6286
|
-
!we || !V(we) || R(we);
|
|
6287
|
-
});
|
|
6288
|
-
},
|
|
6289
|
-
unsubscribeFromPresenceStatus: () => {
|
|
6290
|
-
h?.leave(`online-users.${E()}`);
|
|
6291
|
-
},
|
|
6292
|
-
subscribeToConversation: (R, k) => {
|
|
6293
|
-
const z = I();
|
|
6294
|
-
if (!z)
|
|
6295
|
-
return () => {
|
|
6296
|
-
};
|
|
6297
|
-
const Q = z.private(`conversation.${R}`), ie = [];
|
|
6298
|
-
return k.onMessageSent && ie.push({
|
|
6299
|
-
event: ".ConversationMessageSent",
|
|
6300
|
-
handler: Oe(Q, ".ConversationMessageSent", Ia, k.onMessageSent)
|
|
6301
|
-
}), k.onMessageRead && ie.push({
|
|
6302
|
-
event: ".ConversationMessageRead",
|
|
6303
|
-
handler: Oe(Q, ".ConversationMessageRead", Ua, k.onMessageRead)
|
|
6304
|
-
}), k.onMessageEdited && ie.push({
|
|
6305
|
-
event: ".ConversationMessageEdited",
|
|
6306
|
-
handler: Oe(Q, ".ConversationMessageEdited", Oa, k.onMessageEdited)
|
|
6307
|
-
}), k.onMessageDeleted && ie.push({
|
|
6308
|
-
event: ".ConversationMessageDeleted",
|
|
6309
|
-
handler: Oe(Q, ".ConversationMessageDeleted", Fa, k.onMessageDeleted)
|
|
6310
|
-
}), k.onReactionToggled && ie.push({
|
|
6311
|
-
event: ".MessageReactionToggled",
|
|
6312
|
-
handler: Oe(Q, ".MessageReactionToggled", Na, k.onReactionToggled)
|
|
6313
|
-
}), k.onRequestAccepted && ie.push({
|
|
6314
|
-
event: ".ConversationRequestAccepted",
|
|
6315
|
-
handler: Oe(Q, ".ConversationRequestAccepted", Da, k.onRequestAccepted)
|
|
6316
|
-
}), k.onParticipantRemoved && ie.push({
|
|
6317
|
-
event: ".ConversationParticipantRemoved",
|
|
6318
|
-
handler: Oe(Q, ".ConversationParticipantRemoved", qa, k.onParticipantRemoved)
|
|
6319
|
-
}), () => {
|
|
6320
|
-
if (typeof Q.stopListening == "function")
|
|
6321
|
-
for (const be of ie)
|
|
6322
|
-
Q.stopListening(be.event, be.handler);
|
|
6323
|
-
};
|
|
6324
|
-
},
|
|
6325
|
-
unsubscribeFromConversation: (R) => {
|
|
6326
|
-
h?.leave(`conversation.${R}`);
|
|
6327
|
-
},
|
|
6328
|
-
subscribeToTyping: (R, k) => {
|
|
6329
|
-
const z = I();
|
|
6330
|
-
if (!z)
|
|
6331
|
-
return () => {
|
|
6332
|
-
};
|
|
6333
|
-
const Q = z.private(`typing-conversation.${R}`), ie = [], be = [
|
|
6334
|
-
".TypingStateChanged",
|
|
6335
|
-
"TypingStateChanged",
|
|
6336
|
-
".typing.changed",
|
|
6337
|
-
"typing.changed",
|
|
6338
|
-
".typing.state.changed",
|
|
6339
|
-
"typing.state.changed",
|
|
6340
|
-
".Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged",
|
|
6341
|
-
"Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged"
|
|
6342
|
-
], we = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], ht = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Je = /* @__PURE__ */ new Set(["start", "typing"]), Ke = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6343
|
-
for (const ye of be) {
|
|
6344
|
-
const Se = (xe) => {
|
|
6345
|
-
const J = Pa(xe);
|
|
6346
|
-
if (J) {
|
|
6347
|
-
if (Je.has(J.state)) {
|
|
6348
|
-
k.onTypingStart?.({
|
|
6349
|
-
user_id: J.user_id,
|
|
6350
|
-
user: J.user ?? {
|
|
6351
|
-
id: J.user_id,
|
|
6352
|
-
name: ""
|
|
6353
|
-
},
|
|
6354
|
-
conversation_id: J.conversation_id,
|
|
6355
|
-
started_at: J.started_at ?? J.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6356
|
-
});
|
|
6357
|
-
return;
|
|
6358
|
-
}
|
|
6359
|
-
Ke.has(J.state) && k.onTypingStop?.({
|
|
6360
|
-
user_id: J.user_id,
|
|
6361
|
-
conversation_id: J.conversation_id,
|
|
6362
|
-
stopped_at: J.stopped_at ?? J.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6363
|
-
});
|
|
6364
|
-
}
|
|
6365
|
-
};
|
|
6366
|
-
Q.listen(ye, Se), ie.push({ event: ye, handler: Se });
|
|
6367
|
-
}
|
|
6368
|
-
for (const ye of we) {
|
|
6369
|
-
const Se = (xe) => {
|
|
6370
|
-
const J = Ma(xe);
|
|
6371
|
-
if (!J)
|
|
6372
|
-
return;
|
|
6373
|
-
const qe = {
|
|
6374
|
-
user_id: J.user_id,
|
|
6375
|
-
user: {
|
|
6376
|
-
id: J.user?.id ?? J.user_id,
|
|
6377
|
-
name: J.user?.name ?? "",
|
|
6378
|
-
...J.user?.avatar ? { avatar: J.user.avatar } : {}
|
|
6379
|
-
},
|
|
6380
|
-
conversation_id: J.conversation_id,
|
|
6381
|
-
started_at: J.started_at ?? J.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6382
|
-
};
|
|
6383
|
-
k.onTypingStart?.(qe);
|
|
6384
|
-
};
|
|
6385
|
-
Q.listen(ye, Se), ie.push({ event: ye, handler: Se });
|
|
6386
|
-
}
|
|
6387
|
-
for (const ye of ht) {
|
|
6388
|
-
const Se = (xe) => {
|
|
6389
|
-
const J = xa(xe);
|
|
6390
|
-
if (!J)
|
|
6391
|
-
return;
|
|
6392
|
-
const qe = {
|
|
6393
|
-
user_id: J.user_id,
|
|
6394
|
-
conversation_id: J.conversation_id,
|
|
6395
|
-
stopped_at: J.stopped_at ?? J.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6396
|
-
};
|
|
6397
|
-
k.onTypingStop?.(qe);
|
|
6398
|
-
};
|
|
6399
|
-
Q.listen(ye, Se), ie.push({ event: ye, handler: Se });
|
|
6400
|
-
}
|
|
6401
|
-
return () => {
|
|
6402
|
-
if (typeof Q.stopListening == "function")
|
|
6403
|
-
for (const ye of ie)
|
|
6404
|
-
Q.stopListening(ye.event, ye.handler);
|
|
6405
|
-
};
|
|
6406
|
-
},
|
|
6407
|
-
unsubscribeFromTyping: (R) => {
|
|
6408
|
-
h?.leave(`typing-conversation.${R}`);
|
|
6409
|
-
},
|
|
6410
|
-
clearRuntime: W
|
|
6422
|
+
reconnect: pe,
|
|
6423
|
+
subscribeToPresenceStatus: ne,
|
|
6424
|
+
unsubscribeFromPresenceStatus: _e,
|
|
6425
|
+
subscribeToConversation: R,
|
|
6426
|
+
unsubscribeFromConversation: U,
|
|
6427
|
+
subscribeToTyping: fe,
|
|
6428
|
+
unsubscribeFromTyping: ue,
|
|
6429
|
+
clearRuntime: G
|
|
6411
6430
|
};
|
|
6412
6431
|
}
|
|
6413
6432
|
export {
|
|
6414
6433
|
Po as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6415
6434
|
ec as configureMessengerClient,
|
|
6416
6435
|
nc as createMessengerEcho,
|
|
6417
|
-
|
|
6436
|
+
W as getApi,
|
|
6418
6437
|
Fe as getAuthStore,
|
|
6419
|
-
|
|
6438
|
+
wn as getConnectionStatus,
|
|
6420
6439
|
Pe as getEcho,
|
|
6421
|
-
|
|
6440
|
+
ts as getEchoConnectionStatus,
|
|
6422
6441
|
We as getEchoInitializedEvent,
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6442
|
+
Z as getErrorMessage,
|
|
6443
|
+
Jt as getLoggerFactory,
|
|
6444
|
+
hs as getMainApi,
|
|
6426
6445
|
go as getMainEcho,
|
|
6427
6446
|
mo as getMainEchoConnectionStatus,
|
|
6428
6447
|
po as getMainEchoInitializedEvent,
|
|
6429
6448
|
Hi as getMediaApi,
|
|
6430
|
-
|
|
6449
|
+
Ot as getMessagingAccessState,
|
|
6431
6450
|
qo as getPresenceRuntimeConfig,
|
|
6432
6451
|
$o as hasConfiguredPresenceAuthTokenResolver,
|
|
6433
6452
|
Wa as hasResponse,
|
|
@@ -6441,11 +6460,11 @@ export {
|
|
|
6441
6460
|
Di as isValidRequestAcceptedEvent,
|
|
6442
6461
|
Re as messagingApi,
|
|
6443
6462
|
xo as normalizePresenceStatus,
|
|
6444
|
-
|
|
6445
|
-
|
|
6463
|
+
fs as normalizePresenceTimestamp,
|
|
6464
|
+
ht as onConnectionStatusChange,
|
|
6446
6465
|
vo as onMainEchoConnectionStatusChange,
|
|
6447
6466
|
wi as onMessagingAccessStateChange,
|
|
6448
|
-
|
|
6467
|
+
Dt as parsePresenceTimestamp,
|
|
6449
6468
|
Ti as reconnectEcho,
|
|
6450
6469
|
bo as reconnectMainEcho,
|
|
6451
6470
|
Li as resetEchoRuntimeConfig,
|
|
@@ -6458,7 +6477,7 @@ export {
|
|
|
6458
6477
|
tc as resetMessengerClientConfig,
|
|
6459
6478
|
jo as resetPresenceRuntimeConfig,
|
|
6460
6479
|
ko as resolveFreshPresenceStatus,
|
|
6461
|
-
|
|
6480
|
+
zn as resolvePresenceSnapshot,
|
|
6462
6481
|
ki as setEchoRuntimeConfig,
|
|
6463
6482
|
Co as setLoggerFactory,
|
|
6464
6483
|
Ao as setMainApiClient,
|
|
@@ -6477,7 +6496,7 @@ export {
|
|
|
6477
6496
|
Ga as useConversationChannel,
|
|
6478
6497
|
Ka as useGlobalMessaging,
|
|
6479
6498
|
Qa as useMessagingAccessState,
|
|
6480
|
-
|
|
6499
|
+
Wt as useMessagingStore,
|
|
6481
6500
|
Ya as usePresence,
|
|
6482
6501
|
Za as useTypingChannel,
|
|
6483
6502
|
Ci as waitForEcho
|