@codingfactory/messenger-client 0.2.26 → 0.2.27

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.
Files changed (2) hide show
  1. package/dist/index.js +340 -331
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -378,7 +378,7 @@ function Mo(e) {
378
378
  const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
379
379
  if (n.length === 0 || r.length === 0 || o.length === 0)
380
380
  return;
381
- const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = ue(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", P = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, A = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
381
+ const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = ue(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", R = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
382
382
  return {
383
383
  id: n,
384
384
  title: r,
@@ -389,8 +389,8 @@ function Mo(e) {
389
389
  author: {
390
390
  id: f,
391
391
  name: h,
392
- ...P ? { avatar: P } : {},
393
- ...A ? { handle: A } : {}
392
+ ...R ? { avatar: R } : {},
393
+ ...C ? { handle: C } : {}
394
394
  }
395
395
  } : {}
396
396
  };
@@ -449,11 +449,11 @@ function Lo(e, n) {
449
449
  return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : n?.folder_id;
450
450
  }
451
451
  function Be(e, n) {
452
- const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, P = Lo(e, n), A = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
452
+ const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, R = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
453
453
  if (!n || n.unread_count !== 0 || d <= 0)
454
454
  return !1;
455
- const T = n.last_message?.id, b = e.last_message?.id;
456
- return !T || !b ? !1 : T === b;
455
+ const E = n.last_message?.id, b = e.last_message?.id;
456
+ return !E || !b ? !1 : E === b;
457
457
  })();
458
458
  return {
459
459
  ...e,
@@ -463,8 +463,8 @@ function Be(e, n) {
463
463
  muted_until: r,
464
464
  is_pinned: f,
465
465
  is_archived: h,
466
- folder_id: P,
467
- created_at: A,
466
+ folder_id: R,
467
+ created_at: C,
468
468
  ...c ? { last_message: c } : {},
469
469
  ...u ? { last_message_at: u } : {}
470
470
  };
@@ -824,15 +824,15 @@ const Kt = Oi("messaging", {
824
824
  const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
825
825
  d.data,
826
826
  "conversations"
827
- ), P = f.map((T) => {
827
+ ), R = f.map((E) => {
828
828
  const b = this.conversations.find(
829
- (E) => E.id === T.id
829
+ (A) => A.id === E.id
830
830
  );
831
- return Be(T, b);
832
- }), A = await zn(P);
833
- e ? this.conversations.push(...A) : this.conversations = A, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
831
+ return Be(E, b);
832
+ }), C = await zn(R);
833
+ e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
834
834
  const v = {
835
- data: A,
835
+ data: C,
836
836
  has_more: !!h
837
837
  };
838
838
  return h !== void 0 && (v.next_cursor = h), v;
@@ -888,8 +888,8 @@ const Kt = Oi("messaging", {
888
888
  r.data,
889
889
  "conversations"
890
890
  ), u = o.map((h) => {
891
- const P = this.requests.find((A) => A.id === h.id);
892
- return Be(h, P);
891
+ const R = this.requests.find((C) => C.id === h.id);
892
+ return Be(h, R);
893
893
  }), d = await zn(u);
894
894
  e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
895
895
  const f = {
@@ -922,18 +922,18 @@ const Kt = Oi("messaging", {
922
922
  "messages"
923
923
  ), f = u.map(at), h = [...f].reverse();
924
924
  if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
925
- const v = this.conversations.find((T) => T.id === e) ?? this.requests.find((T) => T.id === e);
925
+ const v = this.conversations.find((E) => E.id === e) ?? this.requests.find((E) => E.id === e);
926
926
  return v ? !v.last_message || !v.last_message_at : !1;
927
927
  })()) {
928
928
  const v = this.messages[e]?.at(-1);
929
929
  v && this.updateConversationLastMessage(e, v);
930
930
  }
931
931
  d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
932
- const A = {
932
+ const C = {
933
933
  data: f,
934
934
  has_more: !!d
935
935
  };
936
- return d !== void 0 && (A.next_cursor = d), A;
936
+ return d !== void 0 && (C.next_cursor = d), C;
937
937
  } catch (r) {
938
938
  throw this.error = Y(r), r;
939
939
  } finally {
@@ -941,31 +941,31 @@ const Kt = Oi("messaging", {
941
941
  }
942
942
  },
943
943
  async sendMessage(e, n, r, o, c, u, d) {
944
- const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, P = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, A = Mo(d), v = f.currentUser, T = {
944
+ const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, R = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = Mo(d), v = f.currentUser, E = {
945
945
  id: h,
946
946
  conversation_id: e,
947
947
  author_id: v?.id || "",
948
948
  body: n || "",
949
949
  attachments: [],
950
- meta: P ? { shared_post_id: P } : {},
951
- ...A ? { shared_post: A } : {},
950
+ meta: R ? { shared_post_id: R } : {},
951
+ ...C ? { shared_post: C } : {},
952
952
  is_deleted: !1,
953
953
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
954
954
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
955
955
  };
956
- v && (T.author = {
956
+ v && (E.author = {
957
957
  id: v.id,
958
958
  name: v.name,
959
959
  ...v.avatar ? { avatar: v.avatar } : {},
960
960
  ...v.handle ? { handle: v.handle } : {}
961
- }), o != null && (T.reply_to_id = o), c != null && (T.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(T), this._pendingSendIds.add(h);
961
+ }), o != null && (E.reply_to_id = o), c != null && (E.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(E), this._pendingSendIds.add(h);
962
962
  try {
963
963
  let b;
964
- const E = {
964
+ const A = {
965
965
  body: n || "",
966
966
  ...o ? { reply_to_id: o } : {},
967
- ...P ? { shared_post_id: P } : {},
968
- ...A ? { shared_post_preview: A } : {}
967
+ ...R ? { shared_post_id: R } : {},
968
+ ...C ? { shared_post_preview: C } : {}
969
969
  };
970
970
  if (r && r.length > 0) {
971
971
  const W = await Promise.all(
@@ -979,15 +979,15 @@ const Kt = Oi("messaging", {
979
979
  })
980
980
  );
981
981
  b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
982
- ...E,
982
+ ...A,
983
983
  attachments: W
984
984
  });
985
985
  } else
986
986
  b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
987
- ...E,
987
+ ...A,
988
988
  type: "text"
989
989
  });
990
- const C = b.data.data || b.data, p = { ...T, ...C, attachments: C.attachments ?? T.attachments }, m = at(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
990
+ const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
991
991
  O >= 0 && (y[O] = m), this._pendingSendIds.delete(h);
992
992
  const z = m.id;
993
993
  let J = 0;
@@ -997,7 +997,7 @@ const Kt = Oi("messaging", {
997
997
  }
998
998
  return this.updateConversationLastMessage(e, m), m;
999
999
  } catch (b) {
1000
- throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((E) => E.id !== h), this.error = Y(b), b;
1000
+ throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Y(b), b;
1001
1001
  }
1002
1002
  },
1003
1003
  async editMessage(e, n, r) {
@@ -1226,26 +1226,35 @@ const Kt = Oi("messaging", {
1226
1226
  return;
1227
1227
  this.messages[n] || (this.messages[n] = []);
1228
1228
  const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1229
- if (o.find((h) => h.id === r.id))
1229
+ if (o.find((R) => R.id === r.id))
1230
1230
  return;
1231
1231
  const u = ke()();
1232
1232
  if (r.author_id === u.currentUser?.id) {
1233
- const h = o.findIndex((P) => P.id.startsWith("temp-"));
1234
- if (h >= 0) {
1235
- const P = o[h]?.id ?? "";
1236
- o[h] = r, this._pendingSendIds.delete(P), this.updateConversationLastMessage(n, r);
1233
+ const R = o.findIndex((C) => C.id.startsWith("temp-"));
1234
+ if (R >= 0) {
1235
+ const C = o[R]?.id ?? "";
1236
+ this.messages[n] = [
1237
+ ...o.slice(0, R),
1238
+ r,
1239
+ ...o.slice(R + 1)
1240
+ ], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
1237
1241
  return;
1238
1242
  }
1239
1243
  }
1240
1244
  const d = r.created_at;
1241
1245
  let f = o.length;
1242
- for (let h = o.length - 1; h >= 0; h--) {
1243
- const P = o[h];
1244
- if (P && P.created_at <= d)
1246
+ for (let R = o.length - 1; R >= 0; R--) {
1247
+ const C = o[R];
1248
+ if (C && C.created_at <= d)
1245
1249
  break;
1246
- f = h;
1250
+ f = R;
1247
1251
  }
1248
- o.splice(f, 0, r), f === o.length - 1 && this.updateConversationLastMessage(n, r);
1252
+ const h = f === o.length;
1253
+ this.messages[n] = [
1254
+ ...o.slice(0, f),
1255
+ r,
1256
+ ...o.slice(f)
1257
+ ], h && this.updateConversationLastMessage(n, r);
1249
1258
  },
1250
1259
  updateMessage(e) {
1251
1260
  const n = this.messages[e.conversation_id] || [], r = n.findIndex((o) => o.id === e.id);
@@ -1253,8 +1262,8 @@ const Kt = Oi("messaging", {
1253
1262
  },
1254
1263
  removeMessage(e, n) {
1255
1264
  const r = (h) => {
1256
- const P = { ...h, is_deleted: !0 };
1257
- return delete P.body, P;
1265
+ const R = { ...h, is_deleted: !0 };
1266
+ return delete R.body, R;
1258
1267
  };
1259
1268
  let o = null;
1260
1269
  const c = this.conversations.find((h) => h.id === e);
@@ -1288,13 +1297,13 @@ const Kt = Oi("messaging", {
1288
1297
  throw v;
1289
1298
  f = await X().post(o, c);
1290
1299
  }
1291
- const h = ue(f.data) && "data" in f.data ? f.data.data : f.data, P = On(
1300
+ const h = ue(f.data) && "data" in f.data ? f.data.data : f.data, R = On(
1292
1301
  ue(h) ? h.reactions : void 0
1293
1302
  );
1294
- (P.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, P);
1303
+ (R.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, R);
1295
1304
  try {
1296
- const v = await X().get(o), T = ue(v.data) && "data" in v.data ? v.data.data : v.data, b = On(
1297
- ue(T) ? T.reactions : void 0
1305
+ const v = await X().get(o), E = ue(v.data) && "data" in v.data ? v.data.data : v.data, b = On(
1306
+ ue(E) ? E.reactions : void 0
1298
1307
  );
1299
1308
  this.updateMessageReactions(e, n, b);
1300
1309
  } catch {
@@ -1323,10 +1332,10 @@ const Kt = Oi("messaging", {
1323
1332
  if (!f) return;
1324
1333
  const h = { ...f };
1325
1334
  r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), u[d] = h;
1326
- const P = this.conversations.find((v) => v.id === e);
1327
- P?.last_message?.id === n && (P.last_message = h);
1328
- const A = this.requests.find((v) => v.id === e);
1329
- A?.last_message?.id === n && (A.last_message = h);
1335
+ const R = this.conversations.find((v) => v.id === e);
1336
+ R?.last_message?.id === n && (R.last_message = h);
1337
+ const C = this.requests.find((v) => v.id === e);
1338
+ C?.last_message?.id === n && (C.last_message = h);
1330
1339
  },
1331
1340
  addTypingUser(e, n) {
1332
1341
  const r = this.typingUsers[e] ?? [];
@@ -1452,16 +1461,16 @@ const Kt = Oi("messaging", {
1452
1461
  }
1453
1462
  });
1454
1463
  function oc(e) {
1455
- const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = qt(), f = d !== null, h = 20, P = 250;
1456
- let A = 0, v = null, T = null;
1457
- const b = se(() => r.currentUser?.id), E = () => ss(e)?.trim() ?? "";
1458
- function C() {
1459
- v && (clearTimeout(v), v = null), A = 0;
1464
+ const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = qt(), f = d !== null, h = 20, R = 250;
1465
+ let C = 0, v = null, E = null;
1466
+ const b = se(() => r.currentUser?.id), A = () => ss(e)?.trim() ?? "";
1467
+ function w() {
1468
+ v && (clearTimeout(v), v = null), C = 0;
1460
1469
  }
1461
1470
  function p() {
1462
- !f || o.value || v || A >= h || (v = setTimeout(() => {
1463
- v = null, A += 1, I();
1464
- }, P));
1471
+ !f || o.value || v || C >= h || (v = setTimeout(() => {
1472
+ v = null, C += 1, I();
1473
+ }, R));
1465
1474
  }
1466
1475
  function m(_) {
1467
1476
  if (n.addMessage(_.message), _.message.author_id !== b.value) {
@@ -1504,10 +1513,10 @@ function oc(e) {
1504
1513
  }
1505
1514
  function k(_) {
1506
1515
  const L = u.value;
1507
- T && (T(), T = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Bi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
1516
+ E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Bi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
1508
1517
  }
1509
1518
  function I() {
1510
- const _ = E();
1519
+ const _ = A();
1511
1520
  if (!(o.value || !_)) {
1512
1521
  if (!Ae()) {
1513
1522
  p();
@@ -1515,7 +1524,7 @@ function oc(e) {
1515
1524
  }
1516
1525
  c.value = null;
1517
1526
  try {
1518
- T = Hi(_, {
1527
+ E = Hi(_, {
1519
1528
  onMessageSent: m,
1520
1529
  onMessageRead: y,
1521
1530
  onMessageEdited: O,
@@ -1523,7 +1532,7 @@ function oc(e) {
1523
1532
  onReactionToggled: J,
1524
1533
  onRequestAccepted: W,
1525
1534
  onParticipantRemoved: te
1526
- }), o.value = !0, u.value = _, n.registerDetailSubscription(_), C();
1535
+ }), o.value = !0, u.value = _, n.registerDetailSubscription(_), w();
1527
1536
  } catch (L) {
1528
1537
  c.value = L instanceof Error ? L.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", L);
1529
1538
  }
@@ -1538,10 +1547,10 @@ function oc(e) {
1538
1547
  o.value || I();
1539
1548
  return;
1540
1549
  }
1541
- (_ === "disconnected" || _ === "error") && (C(), k(!1));
1550
+ (_ === "disconnected" || _ === "error") && (w(), k(!1));
1542
1551
  });
1543
1552
  function G() {
1544
- if (C(), !(!o.value || !u.value))
1553
+ if (w(), !(!o.value || !u.value))
1545
1554
  try {
1546
1555
  k(!0), c.value = null;
1547
1556
  } catch (_) {
@@ -1549,10 +1558,10 @@ function oc(e) {
1549
1558
  }
1550
1559
  }
1551
1560
  return ot(
1552
- () => E(),
1561
+ () => A(),
1553
1562
  (_, L) => {
1554
1563
  if (_ !== L) {
1555
- if (C(), o.value && k(!0), !_) {
1564
+ if (w(), o.value && k(!0), !_) {
1556
1565
  c.value = null;
1557
1566
  return;
1558
1567
  }
@@ -1560,7 +1569,7 @@ function oc(e) {
1560
1569
  }
1561
1570
  }
1562
1571
  ), d !== null && qe(() => {
1563
- C(), V(), G(), typeof window < "u" && window.removeEventListener(Je(), K);
1572
+ w(), V(), G(), typeof window < "u" && window.removeEventListener(Je(), K);
1564
1573
  }), {
1565
1574
  isSubscribed: se(() => o.value),
1566
1575
  error: se(() => c.value),
@@ -1650,8 +1659,8 @@ function ac(e = {}) {
1650
1659
  const o = Qo(e.source ?? "app"), c = {
1651
1660
  ...Ko,
1652
1661
  ...e.icons
1653
- }, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), P = be(!1), A = be(!1), v = be(!1);
1654
- let T = null, b = null, E = null, C = null, p = null, m = null, y = null;
1662
+ }, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), R = be(!1), C = be(!1), v = be(!1);
1663
+ let E = null, b = null, A = null, w = null, p = null, m = null, y = null;
1655
1664
  const O = se(() => u.value === "connected"), z = se(() => u.value === "connecting"), J = se(() => u.value === "disconnected"), W = se(() => u.value === "error"), te = se(() => J.value || W.value), k = se(() => {
1656
1665
  switch (u.value) {
1657
1666
  case "connecting":
@@ -1694,26 +1703,26 @@ function ac(e = {}) {
1694
1703
  Hn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
1695
1704
  }, G = (B, D = u.value) => {
1696
1705
  if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
1697
- const q = !v.value && D === B, _e = !P.value && (q || D === "connected" || D === "connecting");
1698
- if (A.value = !0, _e) {
1699
- h.value = !1, E && clearTimeout(E), E = setTimeout(() => {
1700
- E = null, u.value !== "connected" && (h.value = !0);
1706
+ const q = !v.value && D === B, _e = !R.value && (q || D === "connected" || D === "connecting");
1707
+ if (C.value = !0, _e) {
1708
+ h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
1709
+ A = null, u.value !== "connected" && (h.value = !0);
1701
1710
  }, 5e3);
1702
1711
  return;
1703
1712
  }
1704
- E && (clearTimeout(E), E = null), h.value = !0;
1713
+ A && (clearTimeout(A), A = null), h.value = !0;
1705
1714
  return;
1706
1715
  }
1707
1716
  if (B === "connected") {
1708
- E && (clearTimeout(E), E = null), h.value = !1, P.value = !1, A.value = !1;
1717
+ A && (clearTimeout(A), A = null), h.value = !1, R.value = !1, C.value = !1;
1709
1718
  return;
1710
1719
  }
1711
1720
  if (B === "connecting") {
1712
- if (E && (clearTimeout(E), E = null), P.value) {
1721
+ if (A && (clearTimeout(A), A = null), R.value) {
1713
1722
  h.value = !0;
1714
1723
  return;
1715
1724
  }
1716
- if (A.value || (h.value = !1), b)
1725
+ if (C.value || (h.value = !1), b)
1717
1726
  return;
1718
1727
  b = setTimeout(() => {
1719
1728
  if (b = null, u.value === "connecting") {
@@ -1721,13 +1730,13 @@ function ac(e = {}) {
1721
1730
  _("connected");
1722
1731
  return;
1723
1732
  }
1724
- P.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1733
+ R.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1725
1734
  }
1726
1735
  }, 1e4);
1727
1736
  }
1728
1737
  }, _ = (B) => {
1729
1738
  const D = u.value;
1730
- if (B === "connecting" && P.value) {
1739
+ if (B === "connecting" && R.value) {
1731
1740
  u.value = "disconnected", G("disconnected", D);
1732
1741
  return;
1733
1742
  }
@@ -1787,13 +1796,13 @@ function ac(e = {}) {
1787
1796
  return D > 0 ? `${D}m ${q}s` : `${q}s`;
1788
1797
  });
1789
1798
  return zt(() => {
1790
- u.value = o.getConnectionStatus(), T = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, fe(), m = () => {
1799
+ u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, fe(), m = () => {
1791
1800
  fe(), L();
1792
- }, window.addEventListener(o.initializedEvent, m), L(), C = setInterval(() => {
1801
+ }, window.addEventListener(o.initializedEvent, m), L(), w = setInterval(() => {
1793
1802
  L();
1794
1803
  }, 3e3);
1795
1804
  }), qe(() => {
1796
- T?.(), b && (clearTimeout(b), b = null), E && (clearTimeout(E), E = null), C && (clearInterval(C), C = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
1805
+ E?.(), b && (clearTimeout(b), b = null), A && (clearTimeout(A), A = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
1797
1806
  }), {
1798
1807
  connectionStatus: se(() => u.value),
1799
1808
  isConnected: O,
@@ -1825,18 +1834,18 @@ function ea() {
1825
1834
  }
1826
1835
  const Me = Yt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1827
1836
  function cc() {
1828
- const e = Kt(), n = ke()(), r = Yo(), o = Bt(), c = Ni(), u = qt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map();
1829
- let A = !1;
1837
+ const e = Kt(), n = ke()(), r = Yo(), o = Bt(), c = Ni(), u = qt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map();
1838
+ let C = !1;
1830
1839
  function v(k) {
1831
- const I = P.get(k);
1832
- if (I && (P.delete(k), typeof I.channel.stopListening == "function"))
1840
+ const I = R.get(k);
1841
+ if (I && (R.delete(k), typeof I.channel.stopListening == "function"))
1833
1842
  for (const K of I.bindings)
1834
1843
  try {
1835
1844
  I.channel.stopListening(K.event, K.handler);
1836
1845
  } catch {
1837
1846
  }
1838
1847
  }
1839
- function T() {
1848
+ function E() {
1840
1849
  for (const k of h)
1841
1850
  v(k), e.unregisterGlobalConversationSubscription(k);
1842
1851
  h.clear();
@@ -1909,7 +1918,7 @@ function cc() {
1909
1918
  (M) => M.id !== q.conversation_id
1910
1919
  );
1911
1920
  };
1912
- V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", fe), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), P.set(k, {
1921
+ V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", fe), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), R.set(k, {
1913
1922
  channel: V,
1914
1923
  bindings: [
1915
1924
  { event: ".ConversationMessageSent", handler: G },
@@ -1921,10 +1930,10 @@ function cc() {
1921
1930
  ]
1922
1931
  }), h.add(k), e.registerGlobalConversationSubscription(k);
1923
1932
  }
1924
- function E() {
1933
+ function A() {
1925
1934
  const k = Ae();
1926
1935
  if (!k) {
1927
- T();
1936
+ E();
1928
1937
  return;
1929
1938
  }
1930
1939
  for (const I of h) {
@@ -1937,7 +1946,7 @@ function cc() {
1937
1946
  }
1938
1947
  h.clear();
1939
1948
  }
1940
- function C() {
1949
+ function w() {
1941
1950
  const k = Ae();
1942
1951
  if (!k) return;
1943
1952
  const I = (() => {
@@ -1987,37 +1996,37 @@ function cc() {
1987
1996
  }
1988
1997
  }
1989
1998
  function y() {
1990
- !Ae() || A || (ji(p), A = !0);
1999
+ !Ae() || C || (ji(p), C = !0);
1991
2000
  }
1992
2001
  function O() {
1993
- A && ($i(), A = !1);
2002
+ C && ($i(), C = !1);
1994
2003
  }
1995
2004
  const z = ot(
1996
2005
  d,
1997
2006
  () => {
1998
- C();
2007
+ w();
1999
2008
  },
2000
2009
  { deep: !1, immediate: !0 }
2001
2010
  ), J = ot(
2002
2011
  f,
2003
2012
  () => {
2004
- C();
2013
+ w();
2005
2014
  },
2006
2015
  { deep: !1, immediate: !0 }
2007
2016
  ), W = ot(
2008
2017
  () => c.fullPath,
2009
2018
  () => {
2010
- C();
2019
+ w();
2011
2020
  }
2012
2021
  ), te = dt((k) => {
2013
- k === "connected" ? (T(), C(), O(), y(), m()) : (k === "disconnected" || k === "error") && (T(), O());
2022
+ k === "connected" ? (E(), w(), O(), y(), m()) : (k === "disconnected" || k === "error") && (E(), O());
2014
2023
  });
2015
- C(), y(), m(), Ae() || ps().then((k) => {
2016
- k && (T(), C(), O(), y(), m());
2024
+ w(), y(), m(), Ae() || ps().then((k) => {
2025
+ k && (E(), w(), O(), y(), m());
2017
2026
  }).catch((k) => {
2018
2027
  Me.warn("Failed to eagerly initialize messenger echo", k);
2019
2028
  }), u !== null && qe(() => {
2020
- z(), J(), W(), te(), E(), O();
2029
+ z(), J(), W(), te(), A(), O();
2021
2030
  });
2022
2031
  }
2023
2032
  function uc() {
@@ -2174,34 +2183,34 @@ function Ta(e, n, r) {
2174
2183
  }
2175
2184
  function lc() {
2176
2185
  const e = ke()(), n = ia(), r = Bt(), o = va(n.clientIdStorageKey);
2177
- let c = null, u = null, d = !1, f = Lt(n.accountLimitedUntilStorageKey), h = !1, P = !1, A = null, v = 0;
2178
- const T = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
2186
+ let c = null, u = null, d = !1, f = Lt(n.accountLimitedUntilStorageKey), h = !1, R = !1, C = null, v = 0;
2187
+ const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
2179
2188
  c && (clearInterval(c), c = null);
2180
- }, E = () => {
2189
+ }, A = () => {
2181
2190
  u && (clearTimeout(u), u = null);
2182
- }, C = () => {
2191
+ }, w = () => {
2183
2192
  b(), c = setInterval(() => {
2184
2193
  I();
2185
2194
  }, n.heartbeatIntervalMs);
2186
2195
  }, p = (L) => {
2187
- f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, A = null, b(), E();
2196
+ f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
2188
2197
  }, m = async (L) => {
2189
- if (!(!d || P || f || h) && T() && A !== L)
2198
+ if (!(!d || R || f || h) && E() && C !== L)
2190
2199
  try {
2191
- await r.patch(n.statusUrl, { status: L }), A = L;
2200
+ await r.patch(n.statusUrl, { status: L }), C = L;
2192
2201
  } catch (fe) {
2193
2202
  if (kt(fe)) {
2194
2203
  p("[Presence] Presence updates paused: account is temporarily limited");
2195
2204
  return;
2196
2205
  }
2197
- xt(fe) && (h = !0, d = !1, A = null, b(), E());
2206
+ xt(fe) && (h = !0, d = !1, C = null, b(), A());
2198
2207
  }
2199
2208
  }, y = () => {
2200
- E(), !(!d || P || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2209
+ A(), !(!d || R || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2201
2210
  u = null, m("idle");
2202
2211
  }, n.idleAfterMs));
2203
2212
  }, O = () => {
2204
- if (P || !d || f || h || document.visibilityState !== "visible")
2213
+ if (R || !d || f || h || document.visibilityState !== "visible")
2205
2214
  return;
2206
2215
  const L = Date.now();
2207
2216
  L - v < n.activityDebounceMs || (v = L, m("online"), y());
@@ -2218,9 +2227,9 @@ function lc() {
2218
2227
  return await r.post(n.sessionOpenUrl, {
2219
2228
  client_id: o,
2220
2229
  user_agent: n.userAgentResolver()
2221
- }), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, A = null, "opened";
2230
+ }), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
2222
2231
  } catch (L) {
2223
- return kt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : xt(L) ? (h = !0, d = !1, A = null, b(), E(), "account_suspended") : "failed";
2232
+ return kt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : xt(L) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
2224
2233
  }
2225
2234
  }, k = async () => {
2226
2235
  for (let L = 0; L < ga; L += 1)
@@ -2228,7 +2237,7 @@ function lc() {
2228
2237
  return;
2229
2238
  console.warn("[Presence] Failed to open session");
2230
2239
  }, I = async () => {
2231
- if (d && T())
2240
+ if (d && E())
2232
2241
  try {
2233
2242
  await r.post(n.sessionHeartbeatUrl, { client_id: o });
2234
2243
  } catch (L) {
@@ -2236,12 +2245,12 @@ function lc() {
2236
2245
  p("[Presence] Heartbeat paused: account is temporarily limited");
2237
2246
  return;
2238
2247
  }
2239
- xt(L) && (h = !0, d = !1, A = null, b(), E());
2248
+ xt(L) && (h = !0, d = !1, C = null, b(), A());
2240
2249
  }
2241
2250
  }, K = () => {
2242
2251
  if (!d)
2243
2252
  return;
2244
- d = !1, A = null, E();
2253
+ d = !1, C = null, A();
2245
2254
  const L = Ta(
2246
2255
  n.sessionCloseUrl,
2247
2256
  o,
@@ -2255,17 +2264,17 @@ function lc() {
2255
2264
  r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
2256
2265
  });
2257
2266
  }, V = async () => {
2258
- if (!P) {
2259
- if (await k(), P) {
2267
+ if (!R) {
2268
+ if (await k(), R) {
2260
2269
  K();
2261
2270
  return;
2262
2271
  }
2263
- d && (C(), m("online"), y());
2272
+ d && (w(), m("online"), y());
2264
2273
  }
2265
2274
  }, G = () => {
2266
- if (!P) {
2275
+ if (!R) {
2267
2276
  if (document.visibilityState === "hidden") {
2268
- K(), b(), E();
2277
+ K(), b(), A();
2269
2278
  return;
2270
2279
  }
2271
2280
  if (document.visibilityState === "visible" && !d) {
@@ -2275,24 +2284,24 @@ function lc() {
2275
2284
  document.visibilityState === "visible" && d && !f && !h && O();
2276
2285
  }
2277
2286
  }, _ = () => {
2278
- P || (K(), b(), E());
2287
+ R || (K(), b(), A());
2279
2288
  };
2280
2289
  zt(async () => {
2281
2290
  if (e.isAuthenticated ?? e.currentUser !== null) {
2282
- if (await k(), P) {
2291
+ if (await k(), R) {
2283
2292
  K();
2284
2293
  return;
2285
2294
  }
2286
- d && (C(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2295
+ d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2287
2296
  }
2288
2297
  }), qe(() => {
2289
- P = !0, W(), E(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2298
+ R = !0, W(), A(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2290
2299
  });
2291
2300
  }
2292
2301
  const Ea = 12e3;
2293
2302
  function dc(e) {
2294
- const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = qt(), P = h !== null, A = 20, v = 250;
2295
- let T = !1, b = null, E = 0, C = null;
2303
+ const n = Kt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = qt(), R = h !== null, C = 20, v = 250;
2304
+ let E = !1, b = null, A = 0, w = null;
2296
2305
  const p = se(() => r.currentUser?.id), m = () => ss(e)?.trim() ?? "", y = () => {
2297
2306
  const M = u.value?.trim() ?? "";
2298
2307
  if (M.length > 0)
@@ -2312,10 +2321,10 @@ function dc(e) {
2312
2321
  clearTimeout(M);
2313
2322
  f.clear();
2314
2323
  }, te = () => {
2315
- C && (clearTimeout(C), C = null), E = 0;
2324
+ w && (clearTimeout(w), w = null), A = 0;
2316
2325
  }, k = () => {
2317
- !P || o.value || C || E >= A || (C = setTimeout(() => {
2318
- C = null, E += 1, G();
2326
+ !R || o.value || w || A >= C || (w = setTimeout(() => {
2327
+ w = null, A += 1, G();
2319
2328
  }, v));
2320
2329
  }, I = (M, F) => {
2321
2330
  J(M);
@@ -2324,7 +2333,7 @@ function dc(e) {
2324
2333
  }, Ea);
2325
2334
  f.set(M, Z);
2326
2335
  }, K = () => {
2327
- T = !0, te();
2336
+ E = !0, te();
2328
2337
  }, V = (M) => {
2329
2338
  try {
2330
2339
  b && (b(), b = null), b = Vi(M, {
@@ -2341,8 +2350,8 @@ function dc(e) {
2341
2350
  V(M);
2342
2351
  return;
2343
2352
  }
2344
- T = !1, ps().then((F) => {
2345
- if (T || o.value || !F)
2353
+ E = !1, ps().then((F) => {
2354
+ if (E || o.value || !F)
2346
2355
  return;
2347
2356
  const Z = m();
2348
2357
  if (Z && Z === M && Ae() && En() === "connected") {
@@ -3422,8 +3431,8 @@ function Oa() {
3422
3431
  }, c.t = function(u, d) {
3423
3432
  if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
3424
3433
  var f = /* @__PURE__ */ Object.create(null);
3425
- if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(P) {
3426
- return u[P];
3434
+ if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(R) {
3435
+ return u[R];
3427
3436
  }).bind(null, h));
3428
3437
  return f;
3429
3438
  }, c.n = function(u) {
@@ -3447,15 +3456,15 @@ function Oa() {
3447
3456
  /***/
3448
3457
  (function(r, o, c) {
3449
3458
  var u = this && this.__extends || /* @__PURE__ */ (function() {
3450
- var C = function(p, m) {
3451
- return C = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, O) {
3459
+ var w = function(p, m) {
3460
+ return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, O) {
3452
3461
  y.__proto__ = O;
3453
3462
  } || function(y, O) {
3454
3463
  for (var z in O) O.hasOwnProperty(z) && (y[z] = O[z]);
3455
- }, C(p, m);
3464
+ }, w(p, m);
3456
3465
  };
3457
3466
  return function(p, m) {
3458
- C(p, m);
3467
+ w(p, m);
3459
3468
  function y() {
3460
3469
  this.constructor = p;
3461
3470
  }
@@ -3466,12 +3475,12 @@ function Oa() {
3466
3475
  var d = 256, f = (
3467
3476
  /** @class */
3468
3477
  (function() {
3469
- function C(p) {
3478
+ function w(p) {
3470
3479
  p === void 0 && (p = "="), this._paddingCharacter = p;
3471
3480
  }
3472
- return C.prototype.encodedLength = function(p) {
3481
+ return w.prototype.encodedLength = function(p) {
3473
3482
  return this._paddingCharacter ? (p + 2) / 3 * 4 | 0 : (p * 8 + 5) / 6 | 0;
3474
- }, C.prototype.encode = function(p) {
3483
+ }, w.prototype.encode = function(p) {
3475
3484
  for (var m = "", y = 0; y < p.length - 2; y += 3) {
3476
3485
  var O = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
3477
3486
  m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), m += this._encodeByte(O >>> 6 & 63), m += this._encodeByte(O >>> 0 & 63);
@@ -3482,11 +3491,11 @@ function Oa() {
3482
3491
  m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), z === 2 ? m += this._encodeByte(O >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
3483
3492
  }
3484
3493
  return m;
3485
- }, C.prototype.maxDecodedLength = function(p) {
3494
+ }, w.prototype.maxDecodedLength = function(p) {
3486
3495
  return this._paddingCharacter ? p / 4 * 3 | 0 : (p * 6 + 7) / 8 | 0;
3487
- }, C.prototype.decodedLength = function(p) {
3496
+ }, w.prototype.decodedLength = function(p) {
3488
3497
  return this.maxDecodedLength(p.length - this._getPaddingLength(p));
3489
- }, C.prototype.decode = function(p) {
3498
+ }, w.prototype.decode = function(p) {
3490
3499
  if (p.length === 0)
3491
3500
  return new Uint8Array(0);
3492
3501
  for (var m = this._getPaddingLength(p), y = p.length - m, O = new Uint8Array(this.maxDecodedLength(y)), z = 0, J = 0, W = 0, te = 0, k = 0, I = 0, K = 0; J < y - 4; J += 4)
@@ -3494,13 +3503,13 @@ function Oa() {
3494
3503
  if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), O[z++] = te << 2 | k >>> 4, W |= te & d, W |= k & d), J < y - 2 && (I = this._decodeChar(p.charCodeAt(J + 2)), O[z++] = k << 4 | I >>> 2, W |= I & d), J < y - 3 && (K = this._decodeChar(p.charCodeAt(J + 3)), O[z++] = I << 6 | K, W |= K & d), W !== 0)
3495
3504
  throw new Error("Base64Coder: incorrect characters for decoding");
3496
3505
  return O;
3497
- }, C.prototype._encodeByte = function(p) {
3506
+ }, w.prototype._encodeByte = function(p) {
3498
3507
  var m = p;
3499
3508
  return m += 65, m += 25 - p >>> 8 & 6, m += 51 - p >>> 8 & -75, m += 61 - p >>> 8 & -15, m += 62 - p >>> 8 & 3, String.fromCharCode(m);
3500
- }, C.prototype._decodeChar = function(p) {
3509
+ }, w.prototype._decodeChar = function(p) {
3501
3510
  var m = d;
3502
3511
  return m += (42 - p & p - 44) >>> 8 & -d + p - 43 + 62, m += (46 - p & p - 48) >>> 8 & -d + p - 47 + 63, m += (47 - p & p - 58) >>> 8 & -d + p - 48 + 52, m += (64 - p & p - 91) >>> 8 & -d + p - 65 + 0, m += (96 - p & p - 123) >>> 8 & -d + p - 97 + 26, m;
3503
- }, C.prototype._getPaddingLength = function(p) {
3512
+ }, w.prototype._getPaddingLength = function(p) {
3504
3513
  var m = 0;
3505
3514
  if (this._paddingCharacter) {
3506
3515
  for (var y = p.length - 1; y >= 0 && p[y] === this._paddingCharacter; y--)
@@ -3509,25 +3518,25 @@ function Oa() {
3509
3518
  throw new Error("Base64Coder: incorrect padding");
3510
3519
  }
3511
3520
  return m;
3512
- }, C;
3521
+ }, w;
3513
3522
  })()
3514
3523
  );
3515
3524
  o.Coder = f;
3516
3525
  var h = new f();
3517
- function P(C) {
3518
- return h.encode(C);
3526
+ function R(w) {
3527
+ return h.encode(w);
3519
3528
  }
3520
- o.encode = P;
3521
- function A(C) {
3522
- return h.decode(C);
3529
+ o.encode = R;
3530
+ function C(w) {
3531
+ return h.decode(w);
3523
3532
  }
3524
- o.decode = A;
3533
+ o.decode = C;
3525
3534
  var v = (
3526
3535
  /** @class */
3527
- (function(C) {
3528
- u(p, C);
3536
+ (function(w) {
3537
+ u(p, w);
3529
3538
  function p() {
3530
- return C !== null && C.apply(this, arguments) || this;
3539
+ return w !== null && w.apply(this, arguments) || this;
3531
3540
  }
3532
3541
  return p.prototype._encodeByte = function(m) {
3533
3542
  var y = m;
@@ -3539,20 +3548,20 @@ function Oa() {
3539
3548
  })(f)
3540
3549
  );
3541
3550
  o.URLSafeCoder = v;
3542
- var T = new v();
3543
- function b(C) {
3544
- return T.encode(C);
3551
+ var E = new v();
3552
+ function b(w) {
3553
+ return E.encode(w);
3545
3554
  }
3546
3555
  o.encodeURLSafe = b;
3547
- function E(C) {
3548
- return T.decode(C);
3556
+ function A(w) {
3557
+ return E.decode(w);
3549
3558
  }
3550
- o.decodeURLSafe = E, o.encodedLength = function(C) {
3551
- return h.encodedLength(C);
3552
- }, o.maxDecodedLength = function(C) {
3553
- return h.maxDecodedLength(C);
3554
- }, o.decodedLength = function(C) {
3555
- return h.decodedLength(C);
3559
+ o.decodeURLSafe = A, o.encodedLength = function(w) {
3560
+ return h.encodedLength(w);
3561
+ }, o.maxDecodedLength = function(w) {
3562
+ return h.maxDecodedLength(w);
3563
+ }, o.decodedLength = function(w) {
3564
+ return h.decodedLength(w);
3556
3565
  };
3557
3566
  }),
3558
3567
  /* 1 */
@@ -3560,17 +3569,17 @@ function Oa() {
3560
3569
  (function(r, o, c) {
3561
3570
  Object.defineProperty(o, "__esModule", { value: !0 });
3562
3571
  var u = "utf8: invalid string", d = "utf8: invalid source encoding";
3563
- function f(A) {
3564
- for (var v = new Uint8Array(h(A)), T = 0, b = 0; b < A.length; b++) {
3565
- var E = A.charCodeAt(b);
3566
- E < 128 ? v[T++] = E : E < 2048 ? (v[T++] = 192 | E >> 6, v[T++] = 128 | E & 63) : E < 55296 ? (v[T++] = 224 | E >> 12, v[T++] = 128 | E >> 6 & 63, v[T++] = 128 | E & 63) : (b++, E = (E & 1023) << 10, E |= A.charCodeAt(b) & 1023, E += 65536, v[T++] = 240 | E >> 18, v[T++] = 128 | E >> 12 & 63, v[T++] = 128 | E >> 6 & 63, v[T++] = 128 | E & 63);
3572
+ function f(C) {
3573
+ for (var v = new Uint8Array(h(C)), E = 0, b = 0; b < C.length; b++) {
3574
+ var A = C.charCodeAt(b);
3575
+ A < 128 ? v[E++] = A : A < 2048 ? (v[E++] = 192 | A >> 6, v[E++] = 128 | A & 63) : A < 55296 ? (v[E++] = 224 | A >> 12, v[E++] = 128 | A >> 6 & 63, v[E++] = 128 | A & 63) : (b++, A = (A & 1023) << 10, A |= C.charCodeAt(b) & 1023, A += 65536, v[E++] = 240 | A >> 18, v[E++] = 128 | A >> 12 & 63, v[E++] = 128 | A >> 6 & 63, v[E++] = 128 | A & 63);
3567
3576
  }
3568
3577
  return v;
3569
3578
  }
3570
3579
  o.encode = f;
3571
- function h(A) {
3572
- for (var v = 0, T = 0; T < A.length; T++) {
3573
- var b = A.charCodeAt(T);
3580
+ function h(C) {
3581
+ for (var v = 0, E = 0; E < C.length; E++) {
3582
+ var b = C.charCodeAt(E);
3574
3583
  if (b < 128)
3575
3584
  v += 1;
3576
3585
  else if (b < 2048)
@@ -3578,44 +3587,44 @@ function Oa() {
3578
3587
  else if (b < 55296)
3579
3588
  v += 3;
3580
3589
  else if (b <= 57343) {
3581
- if (T >= A.length - 1)
3590
+ if (E >= C.length - 1)
3582
3591
  throw new Error(u);
3583
- T++, v += 4;
3592
+ E++, v += 4;
3584
3593
  } else
3585
3594
  throw new Error(u);
3586
3595
  }
3587
3596
  return v;
3588
3597
  }
3589
3598
  o.encodedLength = h;
3590
- function P(A) {
3591
- for (var v = [], T = 0; T < A.length; T++) {
3592
- var b = A[T];
3599
+ function R(C) {
3600
+ for (var v = [], E = 0; E < C.length; E++) {
3601
+ var b = C[E];
3593
3602
  if (b & 128) {
3594
- var E = void 0;
3603
+ var A = void 0;
3595
3604
  if (b < 224) {
3596
- if (T >= A.length)
3605
+ if (E >= C.length)
3597
3606
  throw new Error(d);
3598
- var C = A[++T];
3599
- if ((C & 192) !== 128)
3607
+ var w = C[++E];
3608
+ if ((w & 192) !== 128)
3600
3609
  throw new Error(d);
3601
- b = (b & 31) << 6 | C & 63, E = 128;
3610
+ b = (b & 31) << 6 | w & 63, A = 128;
3602
3611
  } else if (b < 240) {
3603
- if (T >= A.length - 1)
3612
+ if (E >= C.length - 1)
3604
3613
  throw new Error(d);
3605
- var C = A[++T], p = A[++T];
3606
- if ((C & 192) !== 128 || (p & 192) !== 128)
3614
+ var w = C[++E], p = C[++E];
3615
+ if ((w & 192) !== 128 || (p & 192) !== 128)
3607
3616
  throw new Error(d);
3608
- b = (b & 15) << 12 | (C & 63) << 6 | p & 63, E = 2048;
3617
+ b = (b & 15) << 12 | (w & 63) << 6 | p & 63, A = 2048;
3609
3618
  } else if (b < 248) {
3610
- if (T >= A.length - 2)
3619
+ if (E >= C.length - 2)
3611
3620
  throw new Error(d);
3612
- var C = A[++T], p = A[++T], m = A[++T];
3613
- if ((C & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
3621
+ var w = C[++E], p = C[++E], m = C[++E];
3622
+ if ((w & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
3614
3623
  throw new Error(d);
3615
- b = (b & 15) << 18 | (C & 63) << 12 | (p & 63) << 6 | m & 63, E = 65536;
3624
+ b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63, A = 65536;
3616
3625
  } else
3617
3626
  throw new Error(d);
3618
- if (b < E || b >= 55296 && b <= 57343)
3627
+ if (b < A || b >= 55296 && b <= 57343)
3619
3628
  throw new Error(d);
3620
3629
  if (b >= 65536) {
3621
3630
  if (b > 1114111)
@@ -3627,7 +3636,7 @@ function Oa() {
3627
3636
  }
3628
3637
  return v.join("");
3629
3638
  }
3630
- o.decode = P;
3639
+ o.decode = R;
3631
3640
  }),
3632
3641
  /* 2 */
3633
3642
  /***/
@@ -3681,7 +3690,7 @@ function Oa() {
3681
3690
  cdn_https: "https://js.pusher.com",
3682
3691
  dependency_suffix: ""
3683
3692
  }, h = f;
3684
- class P {
3693
+ class R {
3685
3694
  constructor(t) {
3686
3695
  this.options = t, this.receivers = t.receivers || d, this.loading = {};
3687
3696
  }
@@ -3712,14 +3721,14 @@ function Oa() {
3712
3721
  return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
3713
3722
  }
3714
3723
  }
3715
- var A = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
3724
+ var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new R({
3716
3725
  cdn_http: h.cdn_http,
3717
3726
  cdn_https: h.cdn_https,
3718
3727
  version: h.VERSION,
3719
3728
  suffix: h.dependency_suffix,
3720
- receivers: A
3729
+ receivers: C
3721
3730
  });
3722
- const T = {
3731
+ const E = {
3723
3732
  baseUrl: "https://pusher.com",
3724
3733
  urls: {
3725
3734
  authenticationEndpoint: {
@@ -3739,16 +3748,16 @@ function Oa() {
3739
3748
  }
3740
3749
  }
3741
3750
  };
3742
- var E = { buildLogSuffix: function(i) {
3743
- const t = "See:", s = T.urls[i];
3751
+ var A = { buildLogSuffix: function(i) {
3752
+ const t = "See:", s = E.urls[i];
3744
3753
  if (!s)
3745
3754
  return "";
3746
3755
  let a;
3747
- return s.fullUrl ? a = s.fullUrl : s.path && (a = T.baseUrl + s.path), a ? `${t} ${a}` : "";
3748
- } }, C;
3756
+ return s.fullUrl ? a = s.fullUrl : s.path && (a = E.baseUrl + s.path), a ? `${t} ${a}` : "";
3757
+ } }, w;
3749
3758
  (function(i) {
3750
3759
  i.UserAuthentication = "user-authentication", i.ChannelAuthorization = "channel-authorization";
3751
- })(C || (C = {}));
3760
+ })(w || (w = {}));
3752
3761
  class p extends Error {
3753
3762
  constructor(t) {
3754
3763
  super(t), Object.setPrototypeOf(this, new.target.prototype);
@@ -3817,11 +3826,11 @@ function Oa() {
3817
3826
  } else {
3818
3827
  let x = "";
3819
3828
  switch (a) {
3820
- case C.UserAuthentication:
3821
- x = E.buildLogSuffix("authenticationEndpoint");
3829
+ case w.UserAuthentication:
3830
+ x = A.buildLogSuffix("authenticationEndpoint");
3822
3831
  break;
3823
- case C.ChannelAuthorization:
3824
- x = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
3832
+ case w.ChannelAuthorization:
3833
+ x = `Clients must be authorized to join private or presence channels. ${A.buildLogSuffix("authorizationEndpoint")}`;
3825
3834
  break;
3826
3835
  }
3827
3836
  l(new k(g.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${g.status} from ${s.endpoint}. ${x}`), null);
@@ -3919,19 +3928,19 @@ function Oa() {
3919
3928
  return a;
3920
3929
  return -1;
3921
3930
  }
3922
- function w(i, t) {
3931
+ function T(i, t) {
3923
3932
  for (var s in i)
3924
3933
  Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
3925
3934
  }
3926
- function R(i) {
3935
+ function P(i) {
3927
3936
  var t = [];
3928
- return w(i, function(s, a) {
3937
+ return T(i, function(s, a) {
3929
3938
  t.push(a);
3930
3939
  }), t;
3931
3940
  }
3932
3941
  function N(i) {
3933
3942
  var t = [];
3934
- return w(i, function(s) {
3943
+ return T(i, function(s) {
3935
3944
  t.push(s);
3936
3945
  }), t;
3937
3946
  }
@@ -3946,7 +3955,7 @@ function Oa() {
3946
3955
  }
3947
3956
  function re(i, t) {
3948
3957
  var s = {};
3949
- return w(i, function(a, l) {
3958
+ return T(i, function(a, l) {
3950
3959
  s[l] = t(a);
3951
3960
  }), s;
3952
3961
  }
@@ -3960,13 +3969,13 @@ function Oa() {
3960
3969
  }
3961
3970
  function Re(i, t) {
3962
3971
  var s = {};
3963
- return w(i, function(a, l) {
3972
+ return T(i, function(a, l) {
3964
3973
  (t && t(a, l, i, s) || a) && (s[l] = a);
3965
3974
  }), s;
3966
3975
  }
3967
3976
  function Le(i) {
3968
3977
  var t = [];
3969
- return w(i, function(s, a) {
3978
+ return T(i, function(s, a) {
3970
3979
  t.push([a, s]);
3971
3980
  }), t;
3972
3981
  }
@@ -4156,7 +4165,7 @@ function Oa() {
4156
4165
  this._callbacks = {};
4157
4166
  return;
4158
4167
  }
4159
- var l = t ? [gt(t)] : R(this._callbacks);
4168
+ var l = t ? [gt(t)] : P(this._callbacks);
4160
4169
  s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
4161
4170
  }
4162
4171
  removeCallback(t, s, a) {
@@ -4518,11 +4527,11 @@ function Oa() {
4518
4527
  s(), a && a.code && this.handleCloseEvent(a), this.transport = null, this.emit("closed");
4519
4528
  }
4520
4529
  }, s = () => {
4521
- w(t, (a, l) => {
4530
+ T(t, (a, l) => {
4522
4531
  this.transport.unbind(l, a);
4523
4532
  });
4524
4533
  };
4525
- w(t, (a, l) => {
4534
+ T(t, (a, l) => {
4526
4535
  this.transport.bind(l, a);
4527
4536
  });
4528
4537
  }
@@ -4586,7 +4595,7 @@ function Oa() {
4586
4595
  if (t.indexOf("client-") !== 0)
4587
4596
  throw new p("Event '" + t + "' does not start with 'client-'");
4588
4597
  if (!this.subscribed) {
4589
- var a = E.buildLogSuffix("triggeringClientEvents");
4598
+ var a = A.buildLogSuffix("triggeringClientEvents");
4590
4599
  ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4591
4600
  }
4592
4601
  return this.pusher.send_event(t, s, this.name);
@@ -4654,7 +4663,7 @@ function Oa() {
4654
4663
  } : null;
4655
4664
  }
4656
4665
  each(t) {
4657
- w(this.members, (s, a) => {
4666
+ T(this.members, (s, a) => {
4658
4667
  t(this.get(a));
4659
4668
  });
4660
4669
  }
@@ -4715,7 +4724,7 @@ function Oa() {
4715
4724
  } else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
4716
4725
  this.members.setMyID(this.pusher.user.user_data.id);
4717
4726
  else {
4718
- let S = E.buildLogSuffix("authorizationEndpoint");
4727
+ let S = A.buildLogSuffix("authorizationEndpoint");
4719
4728
  ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
4720
4729
  return;
4721
4730
  }
@@ -5006,7 +5015,7 @@ function Oa() {
5006
5015
  return delete this.channels[t], s;
5007
5016
  }
5008
5017
  disconnect() {
5009
- w(this.channels, function(t) {
5018
+ T(this.channels, function(t) {
5010
5019
  t.disconnect();
5011
5020
  });
5012
5021
  }
@@ -5015,7 +5024,7 @@ function Oa() {
5015
5024
  if (i.indexOf("private-encrypted-") === 0) {
5016
5025
  if (t.config.nacl)
5017
5026
  return Ee.createEncryptedChannel(i, t, t.config.nacl);
5018
- let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = E.buildLogSuffix("encryptedChannelSupport");
5027
+ let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = A.buildLogSuffix("encryptedChannelSupport");
5019
5028
  throw new J(`${s}. ${a}`);
5020
5029
  } else {
5021
5030
  if (i.indexOf("private-") === 0)
@@ -5567,7 +5576,7 @@ function Oa() {
5567
5576
  nextAuthCallbackID: 1,
5568
5577
  auth_callbacks: {},
5569
5578
  ScriptReceivers: d,
5570
- DependenciesReceivers: A,
5579
+ DependenciesReceivers: C,
5571
5580
  getDefaultStrategy: Ir,
5572
5581
  Transports: ur,
5573
5582
  transportConnectionInitializer: Ur,
@@ -5795,7 +5804,7 @@ function Oa() {
5795
5804
  throw `'${i.transport}' is not a recognized auth transport`;
5796
5805
  return (t, s) => {
5797
5806
  const a = ai(t, i);
5798
- $.getAuthorizers()[i.transport]($, a, i, C.UserAuthentication, s);
5807
+ $.getAuthorizers()[i.transport]($, a, i, w.UserAuthentication, s);
5799
5808
  };
5800
5809
  };
5801
5810
  const ui = (i, t) => {
@@ -5815,7 +5824,7 @@ function Oa() {
5815
5824
  throw `'${i.transport}' is not a recognized auth transport`;
5816
5825
  return (t, s) => {
5817
5826
  const a = ui(t, i);
5818
- $.getAuthorizers()[i.transport]($, a, i, C.ChannelAuthorization, s);
5827
+ $.getAuthorizers()[i.transport]($, a, i, w.ChannelAuthorization, s);
5819
5828
  };
5820
5829
  };
5821
5830
  const di = (i, t, s) => {
@@ -5979,7 +5988,7 @@ function Oa() {
5979
5988
  ge.instances[t].connect();
5980
5989
  }
5981
5990
  static getClientFeatures() {
5982
- return R(Re({ ws: $.Transports.ws }, function(t) {
5991
+ return P(Re({ ws: $.Transports.ws }, function(t) {
5983
5992
  return t.isSupported({});
5984
5993
  }));
5985
5994
  }
@@ -6280,48 +6289,48 @@ function Fe(e, n, r, o) {
6280
6289
  function pc(e) {
6281
6290
  const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Yt())("MessengerEcho");
6282
6291
  typeof window < "u" && (window.Pusher = Da);
6283
- let d = null, f = null, h = null, P = null, A = "disconnected", v = "available", T = null, b = null;
6284
- const E = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (w) => {
6285
- A = w;
6286
- for (const R of E)
6287
- R(w);
6288
- }, y = (w) => {
6289
- v = w;
6290
- for (const R of C)
6291
- R(w);
6292
+ let d = null, f = null, h = null, R = null, C = "disconnected", v = "available", E = null, b = null;
6293
+ const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
6294
+ C = T;
6295
+ for (const P of A)
6296
+ P(T);
6297
+ }, y = (T) => {
6298
+ v = T;
6299
+ for (const P of w)
6300
+ P(T);
6292
6301
  }, O = () => {
6293
6302
  b !== null && (clearTimeout(b), b = null);
6294
- }, z = (w = !0) => {
6295
- h !== null && (h.disconnect(), h = null), P = null, w && m("disconnected");
6303
+ }, z = (T = !0) => {
6304
+ h !== null && (h.disconnect(), h = null), R = null, T && m("disconnected");
6296
6305
  }, J = () => {
6297
- O(), d = null, f = null, T = null, y("available"), z(), p.clear();
6306
+ O(), d = null, f = null, E = null, y("available"), z(), p.clear();
6298
6307
  }, W = () => {
6299
6308
  if (!e.getSourceToken)
6300
6309
  return null;
6301
- const w = e.getSourceToken();
6302
- return w === null ? (J(), null) : (T !== null && T !== w && (O(), d = null, f = null, y("available"), z()), T = w, w);
6303
- }, te = (w) => {
6304
- if (w === null)
6310
+ const T = e.getSourceToken();
6311
+ return T === null ? (J(), null) : (E !== null && E !== T && (O(), d = null, f = null, y("available"), z()), E = T, T);
6312
+ }, te = (T) => {
6313
+ if (T === null)
6305
6314
  return !1;
6306
- if (w.auth.expiresAt === null)
6307
- return w.auth.token !== "";
6308
- const R = Date.parse(w.auth.expiresAt);
6309
- return Number.isNaN(R) ? !1 : R - Date.now() > o;
6310
- }, k = (w) => {
6311
- if (O(), w.auth.expiresAt === null)
6315
+ if (T.auth.expiresAt === null)
6316
+ return T.auth.token !== "";
6317
+ const P = Date.parse(T.auth.expiresAt);
6318
+ return Number.isNaN(P) ? !1 : P - Date.now() > o;
6319
+ }, k = (T) => {
6320
+ if (O(), T.auth.expiresAt === null)
6312
6321
  return;
6313
- const R = Date.parse(w.auth.expiresAt);
6314
- if (Number.isNaN(R))
6322
+ const P = Date.parse(T.auth.expiresAt);
6323
+ if (Number.isNaN(P))
6315
6324
  return;
6316
- const N = Math.max(0, R - Date.now() - o);
6325
+ const N = Math.max(0, P - Date.now() - o);
6317
6326
  b = setTimeout(() => {
6318
6327
  K();
6319
6328
  }, N);
6320
- }, I = async (w = !1) => e.getSourceToken && W() === null || !w && v === "account_suspended" ? null : !w && te(d) ? d : !w && f !== null ? await f : (f = (async () => {
6329
+ }, I = async (T = !1) => e.getSourceToken && W() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
6321
6330
  try {
6322
6331
  const N = await e.bootstrapClient.get(
6323
6332
  r,
6324
- w ? { params: { refresh: 1 } } : void 0
6333
+ T ? { params: { refresh: 1 } } : void 0
6325
6334
  ), U = Va(N.data);
6326
6335
  return d = U, y("available"), k(U), U;
6327
6336
  } catch (N) {
@@ -6332,32 +6341,32 @@ function pc(e) {
6332
6341
  })().finally(() => {
6333
6342
  f = null;
6334
6343
  }), await f), K = async () => {
6335
- const w = h !== null;
6344
+ const T = h !== null;
6336
6345
  try {
6337
- if (await I(!0), !w)
6346
+ if (await I(!0), !T)
6338
6347
  return;
6339
6348
  z(!1), await G(!0);
6340
- } catch (R) {
6341
- u.warn("Failed to refresh messenger bootstrap", R);
6349
+ } catch (P) {
6350
+ u.warn("Failed to refresh messenger bootstrap", P);
6342
6351
  }
6343
- }, V = (w) => {
6344
- const R = w.connector?.pusher?.connection;
6345
- if (!R) {
6352
+ }, V = (T) => {
6353
+ const P = T.connector?.pusher?.connection;
6354
+ if (!P) {
6346
6355
  u.warn("Messenger echo connector does not expose a Pusher connection");
6347
6356
  return;
6348
6357
  }
6349
- R.bind("connecting", () => {
6358
+ P.bind("connecting", () => {
6350
6359
  m("connecting");
6351
- }), R.bind("connected", () => {
6360
+ }), P.bind("connected", () => {
6352
6361
  m("connected");
6353
- }), R.bind("disconnected", () => {
6362
+ }), P.bind("disconnected", () => {
6354
6363
  m("disconnected");
6355
- }), R.bind("unavailable", () => {
6364
+ }), P.bind("unavailable", () => {
6356
6365
  m("disconnected");
6357
- }), R.bind("error", () => {
6366
+ }), P.bind("error", () => {
6358
6367
  m("error");
6359
- }), R.bind("state_change", (N) => {
6360
- const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : R.state;
6368
+ }), P.bind("state_change", (N) => {
6369
+ const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : P.state;
6361
6370
  if (U === "connected") {
6362
6371
  m("connected");
6363
6372
  return;
@@ -6367,9 +6376,9 @@ function pc(e) {
6367
6376
  return;
6368
6377
  }
6369
6378
  (U === "unavailable" || U === "failed" || U === "disconnected") && m("disconnected");
6370
- }), R.state === "connected" && m("connected");
6371
- }, G = async (w = !1) => !w && h !== null && te(d) ? h : !w && P !== null ? await P : (P = (async () => {
6372
- const N = await I(w);
6379
+ }), P.state === "connected" && m("connected");
6380
+ }, G = async (T = !1) => !T && h !== null && te(d) ? h : !T && R !== null ? await R : (R = (async () => {
6381
+ const N = await I(T);
6373
6382
  if (N === null)
6374
6383
  return null;
6375
6384
  h !== null && z(!1);
@@ -6393,8 +6402,8 @@ function pc(e) {
6393
6402
  };
6394
6403
  return N.service.reverb.path && (ne.wsPath = N.service.reverb.path), h = new Ia(ne), V(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6395
6404
  })().finally(() => {
6396
- P = null;
6397
- }), await P), _ = jt.create({
6405
+ R = null;
6406
+ }), await R), _ = jt.create({
6398
6407
  timeout: e.requestTimeoutMs ?? za,
6399
6408
  withCredentials: !1,
6400
6409
  headers: {
@@ -6402,48 +6411,48 @@ function pc(e) {
6402
6411
  "X-Requested-With": "XMLHttpRequest"
6403
6412
  }
6404
6413
  });
6405
- _.interceptors.request.use(async (w) => {
6406
- const R = await I();
6407
- if (R === null)
6414
+ _.interceptors.request.use(async (T) => {
6415
+ const P = await I();
6416
+ if (P === null)
6408
6417
  throw new Error("Messenger bootstrap is unavailable.");
6409
- return w.baseURL = R.service.apiBaseUrl, Gn(w, R.auth.token), w;
6418
+ return T.baseURL = P.service.apiBaseUrl, Gn(T, P.auth.token), T;
6410
6419
  }), _.interceptors.response.use(
6411
- (w) => w,
6412
- async (w) => {
6413
- const R = w.config;
6414
- if (w.response?.status === 401 && R && R._messengerRetry !== !0) {
6415
- R._messengerRetry = !0;
6420
+ (T) => T,
6421
+ async (T) => {
6422
+ const P = T.config;
6423
+ if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
6424
+ P._messengerRetry = !0;
6416
6425
  const N = await I(!0);
6417
6426
  if (N !== null)
6418
- return R.baseURL = N.service.apiBaseUrl, Gn(R, N.auth.token), await _(R);
6427
+ return P.baseURL = N.service.apiBaseUrl, Gn(P, N.auth.token), await _(P);
6419
6428
  }
6420
- return Promise.reject(w);
6429
+ return Promise.reject(T);
6421
6430
  }
6422
6431
  );
6423
- const L = () => v === "account_suspended" ? null : h, fe = (w) => (E.add(w), w(A), () => {
6424
- E.delete(w);
6425
- }), Se = (w) => (C.add(w), w(v), () => {
6426
- C.delete(w);
6427
- }), B = () => d?.auth.tenantId ?? "global", D = (w) => {
6428
- const R = Ft(w.ts)?.getTime() ?? Ft(w.last_seen_at)?.getTime() ?? null;
6429
- if (R === null)
6432
+ const L = () => v === "account_suspended" ? null : h, fe = (T) => (A.add(T), T(C), () => {
6433
+ A.delete(T);
6434
+ }), Se = (T) => (w.add(T), T(v), () => {
6435
+ w.delete(T);
6436
+ }), B = () => d?.auth.tenantId ?? "global", D = (T) => {
6437
+ const P = Ft(T.ts)?.getTime() ?? Ft(T.last_seen_at)?.getTime() ?? null;
6438
+ if (P === null)
6430
6439
  return !0;
6431
- const N = `${w.tenant_scope ?? "global"}:${w.user_id}`, U = p.get(N);
6432
- if (U && R < U.timestampMs)
6440
+ const N = `${T.tenant_scope ?? "global"}:${T.user_id}`, U = p.get(N);
6441
+ if (U && P < U.timestampMs)
6433
6442
  return !1;
6434
6443
  const ne = Date.now();
6435
6444
  p.set(N, {
6436
- timestampMs: R,
6445
+ timestampMs: P,
6437
6446
  seenAt: ne
6438
6447
  });
6439
6448
  for (const [re, de] of p.entries())
6440
6449
  ne - de.seenAt > c && p.delete(re);
6441
6450
  return !0;
6442
- }, q = (w) => {
6443
- const R = L();
6444
- if (!R || typeof R.join != "function")
6451
+ }, q = (T) => {
6452
+ const P = L();
6453
+ if (!P || typeof P.join != "function")
6445
6454
  return;
6446
- const N = R.join(`online-users.${B()}`), U = [
6455
+ const N = P.join(`online-users.${B()}`), U = [
6447
6456
  ".PresenceStatusChanged",
6448
6457
  "PresenceStatusChanged",
6449
6458
  ".presence.status.changed",
@@ -6456,12 +6465,12 @@ function pc(e) {
6456
6465
  for (const ne of U)
6457
6466
  N.listen(ne, (re) => {
6458
6467
  const de = Ja(re, B());
6459
- !de || !D(de) || w(de);
6468
+ !de || !D(de) || T(de);
6460
6469
  });
6461
6470
  }, _e = () => {
6462
6471
  h?.leave(`online-users.${B()}`);
6463
6472
  };
6464
- function M(w, R) {
6473
+ function M(T, P) {
6465
6474
  const N = [];
6466
6475
  function U(ne, re, de) {
6467
6476
  if (!de)
@@ -6469,52 +6478,52 @@ function pc(e) {
6469
6478
  const Re = (Le) => {
6470
6479
  re(Le) && de(Le);
6471
6480
  };
6472
- w.bind(ne, Re), N.push({ event: ne, handler: Re });
6481
+ T.bind(ne, Re), N.push({ event: ne, handler: Re });
6473
6482
  }
6474
- return U("ConversationMessageSent", Kn, R.onMessageSent), U("ConversationMessageRead", Qn, R.onMessageRead), U("ConversationMessageEdited", Yn, R.onMessageEdited), U("ConversationMessageDeleted", Zn, R.onMessageDeleted), U("MessageReactionToggled", es, R.onReactionToggled), U("ConversationRequestAccepted", ts, R.onRequestAccepted), U("ConversationParticipantRemoved", ns, R.onParticipantRemoved), () => {
6483
+ return U("ConversationMessageSent", Kn, P.onMessageSent), U("ConversationMessageRead", Qn, P.onMessageRead), U("ConversationMessageEdited", Yn, P.onMessageEdited), U("ConversationMessageDeleted", Zn, P.onMessageDeleted), U("MessageReactionToggled", es, P.onReactionToggled), U("ConversationRequestAccepted", ts, P.onRequestAccepted), U("ConversationParticipantRemoved", ns, P.onParticipantRemoved), () => {
6475
6484
  for (const ne of N)
6476
- w.unbind(ne.event, ne.handler);
6485
+ T.unbind(ne.event, ne.handler);
6477
6486
  };
6478
6487
  }
6479
- const F = (w, R) => {
6488
+ const F = (T, P) => {
6480
6489
  const N = L();
6481
6490
  if (!N)
6482
6491
  return () => {
6483
6492
  };
6484
- const U = N.private(`conversation.${w}`), ne = U.subscription;
6493
+ const U = N.private(`conversation.${T}`), ne = U.subscription;
6485
6494
  if (ne)
6486
- return M(ne, R);
6495
+ return M(ne, P);
6487
6496
  const re = [];
6488
- return R.onMessageSent && re.push({
6497
+ return P.onMessageSent && re.push({
6489
6498
  event: ".ConversationMessageSent",
6490
- handler: Fe(U, ".ConversationMessageSent", Kn, R.onMessageSent)
6491
- }), R.onMessageRead && re.push({
6499
+ handler: Fe(U, ".ConversationMessageSent", Kn, P.onMessageSent)
6500
+ }), P.onMessageRead && re.push({
6492
6501
  event: ".ConversationMessageRead",
6493
- handler: Fe(U, ".ConversationMessageRead", Qn, R.onMessageRead)
6494
- }), R.onMessageEdited && re.push({
6502
+ handler: Fe(U, ".ConversationMessageRead", Qn, P.onMessageRead)
6503
+ }), P.onMessageEdited && re.push({
6495
6504
  event: ".ConversationMessageEdited",
6496
- handler: Fe(U, ".ConversationMessageEdited", Yn, R.onMessageEdited)
6497
- }), R.onMessageDeleted && re.push({
6505
+ handler: Fe(U, ".ConversationMessageEdited", Yn, P.onMessageEdited)
6506
+ }), P.onMessageDeleted && re.push({
6498
6507
  event: ".ConversationMessageDeleted",
6499
- handler: Fe(U, ".ConversationMessageDeleted", Zn, R.onMessageDeleted)
6500
- }), R.onReactionToggled && re.push({
6508
+ handler: Fe(U, ".ConversationMessageDeleted", Zn, P.onMessageDeleted)
6509
+ }), P.onReactionToggled && re.push({
6501
6510
  event: ".MessageReactionToggled",
6502
- handler: Fe(U, ".MessageReactionToggled", es, R.onReactionToggled)
6503
- }), R.onRequestAccepted && re.push({
6511
+ handler: Fe(U, ".MessageReactionToggled", es, P.onReactionToggled)
6512
+ }), P.onRequestAccepted && re.push({
6504
6513
  event: ".ConversationRequestAccepted",
6505
- handler: Fe(U, ".ConversationRequestAccepted", ts, R.onRequestAccepted)
6506
- }), R.onParticipantRemoved && re.push({
6514
+ handler: Fe(U, ".ConversationRequestAccepted", ts, P.onRequestAccepted)
6515
+ }), P.onParticipantRemoved && re.push({
6507
6516
  event: ".ConversationParticipantRemoved",
6508
- handler: Fe(U, ".ConversationParticipantRemoved", ns, R.onParticipantRemoved)
6517
+ handler: Fe(U, ".ConversationParticipantRemoved", ns, P.onParticipantRemoved)
6509
6518
  }), () => {
6510
6519
  if (typeof U.stopListening == "function")
6511
6520
  for (const de of re)
6512
6521
  U.stopListening(de.event, de.handler);
6513
6522
  };
6514
- }, Z = (w) => {
6515
- h?.leave(`conversation.${w}`);
6516
- }, oe = (w, R, N) => {
6517
- const U = w.private(`typing-conversation.${R}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), re = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), de = U.subscription;
6523
+ }, Z = (T) => {
6524
+ h?.leave(`conversation.${T}`);
6525
+ }, oe = (T, P, N) => {
6526
+ const U = T.private(`typing-conversation.${P}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), re = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), de = U.subscription;
6518
6527
  if (de) {
6519
6528
  const we = (pe) => {
6520
6529
  const ve = Jn(pe);
@@ -6569,20 +6578,20 @@ function pc(e) {
6569
6578
  for (const we of Re)
6570
6579
  U.stopListening(we.event, we.handler);
6571
6580
  };
6572
- }, le = (w, R) => {
6581
+ }, le = (T, P) => {
6573
6582
  const N = L();
6574
6583
  if (N)
6575
- return oe(N, w, R);
6584
+ return oe(N, T, P);
6576
6585
  let U = !1, ne = null;
6577
6586
  return ze().then((re) => {
6578
- U || !re || (ne = oe(re, w, R));
6587
+ U || !re || (ne = oe(re, T, P));
6579
6588
  }).catch((re) => {
6580
6589
  u.warn("Failed to defer typing subscription", re);
6581
6590
  }), () => {
6582
6591
  U = !0, ne?.();
6583
6592
  };
6584
- }, me = (w) => {
6585
- h?.leave(`typing-conversation.${w}`);
6593
+ }, me = (T) => {
6594
+ h?.leave(`typing-conversation.${T}`);
6586
6595
  }, ht = async () => {
6587
6596
  y("available"), z(), await G(!0);
6588
6597
  }, ze = async () => v === "account_suspended" ? null : await G();
@@ -6591,7 +6600,7 @@ function pc(e) {
6591
6600
  initializedEvent: n,
6592
6601
  getEcho: L,
6593
6602
  waitForEcho: ze,
6594
- getConnectionStatus: () => A,
6603
+ getConnectionStatus: () => C,
6595
6604
  getAccessState: () => v,
6596
6605
  onConnectionStatusChange: fe,
6597
6606
  onAccessStateChange: Se,