@codingfactory/messenger-client 0.2.29 → 0.2.30

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 +874 -850
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as be, getCurrentInstance as zt, computed as se, watch as ot, onUnmounted as qe, toValue as is, onMounted as jt } from "vue";
1
+ import { ref as ye, getCurrentInstance as zt, computed as re, watch as ot, onUnmounted as qe, toValue as is, onMounted as jt } from "vue";
2
2
  import { defineStore as Di, storeToRefs as Ni } from "pinia";
3
3
  import $t, { isAxiosError as qi, AxiosHeaders as An } from "axios";
4
4
  import { isAxiosError as vc } from "axios";
@@ -14,7 +14,7 @@ const os = () => () => {
14
14
  throw new Error("messenger-client subscribeToConversation is not configured");
15
15
  }, ps = () => {
16
16
  throw new Error("messenger-client subscribeToTyping is not configured");
17
- }, gs = async () => null, H = {
17
+ }, gs = async () => null, $ = {
18
18
  ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
19
19
  getEcho: () => null,
20
20
  waitForEcho: gs,
@@ -29,14 +29,14 @@ const os = () => () => {
29
29
  unsubscribeFromConversation: ds,
30
30
  subscribeToTyping: ps,
31
31
  unsubscribeFromTyping: hs
32
- }, Je = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ms = async () => H.waitForEcho(), vs = () => H.getConnectionStatus(), Rn = () => vs(), Ot = () => H.getAccessState(), ht = (e) => H.onConnectionStatusChange(e), ji = (e) => H.onAccessStateChange(e), $i = async () => {
33
- await H.reconnect();
34
- }, Hi = (e) => H.subscribeToPresenceStatus(e), Bi = () => H.unsubscribeFromPresenceStatus(), Vi = (e, n) => H.subscribeToConversation(e, n), Xi = (e) => H.unsubscribeFromConversation(e), Wi = (e, n) => H.subscribeToTyping(e, n), Gi = (e) => H.unsubscribeFromTyping(e);
32
+ }, Je = () => $.ECHO_INITIALIZED_EVENT, Ae = () => $.getEcho(), ms = async () => $.waitForEcho(), vs = () => $.getConnectionStatus(), Rn = () => vs(), Ot = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), ji = (e) => $.onAccessStateChange(e), $i = async () => {
33
+ await $.reconnect();
34
+ }, Hi = (e) => $.subscribeToPresenceStatus(e), Bi = () => $.unsubscribeFromPresenceStatus(), Vi = (e, n) => $.subscribeToConversation(e, n), Xi = (e) => $.unsubscribeFromConversation(e), Wi = (e, n) => $.subscribeToTyping(e, n), Gi = (e) => $.unsubscribeFromTyping(e);
35
35
  function Ji(e) {
36
- e.initializedEvent && (H.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (H.getEcho = e.getEcho), e.waitForEcho && (H.waitForEcho = e.waitForEcho), e.getConnectionStatus && (H.getConnectionStatus = e.getConnectionStatus), e.getAccessState && (H.getAccessState = e.getAccessState), e.onConnectionStatusChange && (H.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && (H.onAccessStateChange = e.onAccessStateChange), e.reconnect && (H.reconnect = e.reconnect), e.subscribeToPresenceStatus && (H.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (H.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (H.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (H.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (H.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (H.unsubscribeFromTyping = e.unsubscribeFromTyping);
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 Ki() {
39
- H.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", H.getEcho = () => null, H.waitForEcho = gs, H.getConnectionStatus = () => "disconnected", H.getAccessState = () => "available", H.onConnectionStatusChange = os, H.onAccessStateChange = as, H.reconnect = cs, H.subscribeToPresenceStatus = us, H.unsubscribeFromPresenceStatus = ls, H.subscribeToConversation = fs, H.unsubscribeFromConversation = ds, H.subscribeToTyping = ps, H.unsubscribeFromTyping = hs;
39
+ $.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = gs, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = os, $.onAccessStateChange = as, $.reconnect = cs, $.subscribeToPresenceStatus = us, $.unsubscribeFromPresenceStatus = ls, $.subscribeToConversation = fs, $.unsubscribeFromConversation = ds, $.subscribeToTyping = ps, $.unsubscribeFromTyping = hs;
40
40
  }
41
41
  function xe(e) {
42
42
  return typeof e == "object" && e !== null;
@@ -61,7 +61,7 @@ function no(e) {
61
61
  }
62
62
  const bs = $t;
63
63
  let Ht = bs;
64
- function X() {
64
+ function W() {
65
65
  return Ht;
66
66
  }
67
67
  function so(e) {
@@ -94,7 +94,7 @@ function ao(e) {
94
94
  function co() {
95
95
  Xt = () => _s;
96
96
  }
97
- function Y(e) {
97
+ function Z(e) {
98
98
  if (qi(e)) {
99
99
  const n = e.response?.data?.message || e.message || "An error occurred";
100
100
  return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
@@ -183,35 +183,35 @@ function Mn(e) {
183
183
  }
184
184
  const Pe = {
185
185
  async fetchFolders() {
186
- const e = await X().get("/v1/messaging/folders");
186
+ const e = await W().get("/v1/messaging/folders");
187
187
  return po($e(e.data));
188
188
  },
189
189
  async createFolder(e) {
190
- const n = await X().post("/v1/messaging/folders", e);
190
+ const n = await W().post("/v1/messaging/folders", e);
191
191
  return Ft($e(n.data));
192
192
  },
193
193
  async updateFolder(e, n) {
194
- const r = await X().patch(`/v1/messaging/folders/${e}`, n);
194
+ const r = await W().patch(`/v1/messaging/folders/${e}`, n);
195
195
  return Ft($e(r.data));
196
196
  },
197
197
  async deleteFolder(e) {
198
- await X().delete(`/v1/messaging/folders/${e}`);
198
+ await W().delete(`/v1/messaging/folders/${e}`);
199
199
  },
200
200
  async reorderFolders(e) {
201
- await X().patch("/v1/messaging/folders/reorder", { order: e });
201
+ await W().patch("/v1/messaging/folders/reorder", { order: e });
202
202
  },
203
203
  async assignFolder(e, n) {
204
- const r = await X().patch(`/v1/messaging/conversations/${e}/folder`, {
204
+ const r = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
205
205
  folder_id: n
206
206
  });
207
207
  return Mn($e(r.data));
208
208
  },
209
209
  async acceptRequest(e) {
210
- const n = await X().post(`/v1/messaging/conversations/${e}/accept`);
210
+ const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
211
211
  return Mn($e(n.data));
212
212
  },
213
213
  async declineRequest(e) {
214
- await X().post(`/v1/messaging/conversations/${e}/decline`);
214
+ await W().post(`/v1/messaging/conversations/${e}/decline`);
215
215
  }
216
216
  }, go = 6e4;
217
217
  function mo(e) {
@@ -288,9 +288,9 @@ const kn = 1e3, Gt = 4e3, yo = 12e4, _o = 300, So = 1, Co = 1600, Jt = (e) => {
288
288
  data: [],
289
289
  has_more: !1
290
290
  }), Un = () => Ot() === "account_suspended", Eo = (e) => {
291
- if (!le(e))
291
+ if (!he(e))
292
292
  return !1;
293
- const r = (le(e.data) ? e.data : e).throttled;
293
+ const r = (he(e.data) ? e.data : e).throttled;
294
294
  if (typeof r == "boolean")
295
295
  return r;
296
296
  if (typeof r == "number")
@@ -373,12 +373,12 @@ function at(e) {
373
373
  };
374
374
  }
375
375
  function xo(e) {
376
- if (!e || !le(e))
376
+ if (!e || !he(e))
377
377
  return;
378
378
  const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
379
379
  if (n.length === 0 || r.length === 0 || o.length === 0)
380
380
  return;
381
- const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = le(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", P = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
381
+ const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", 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,7 +389,7 @@ function xo(e) {
389
389
  author: {
390
390
  id: f,
391
391
  name: h,
392
- ...P ? { avatar: P } : {},
392
+ ...R ? { avatar: R } : {},
393
393
  ...C ? { handle: C } : {}
394
394
  }
395
395
  } : {}
@@ -449,7 +449,7 @@ function Uo(e, n) {
449
449
  return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : n?.folder_id;
450
450
  }
451
451
  function He(e, n) {
452
- const r = Io(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, P = Uo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
452
+ const r = Io(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, R = Uo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
453
453
  if (!n || n.unread_count !== 0 || d <= 0)
454
454
  return !1;
455
455
  const E = n.last_message?.id, b = e.last_message?.id;
@@ -463,7 +463,7 @@ function He(e, n) {
463
463
  muted_until: r,
464
464
  is_pinned: f,
465
465
  is_archived: h,
466
- folder_id: P,
466
+ folder_id: R,
467
467
  created_at: C,
468
468
  ...c ? { last_message: c } : {},
469
469
  ...u ? { last_message_at: u } : {}
@@ -485,20 +485,20 @@ function Fn(e, n) {
485
485
  }
486
486
  return qt(e.last_message?.id) ? e.last_message.id : null;
487
487
  }
488
- function le(e) {
488
+ function he(e) {
489
489
  return typeof e == "object" && e !== null;
490
490
  }
491
491
  function Fo(e) {
492
- return le(e) ? (le(e.response) ? e.response : null)?.status === 401 : !1;
492
+ return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
493
493
  }
494
494
  function Dn(e) {
495
495
  if (!Array.isArray(e))
496
496
  return [];
497
497
  const n = [];
498
498
  for (const r of e) {
499
- if (!le(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
499
+ if (!he(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
500
500
  continue;
501
- const o = r.users.filter((c) => le(c)).filter(
501
+ const o = r.users.filter((c) => he(c)).filter(
502
502
  (c) => typeof c.id == "string" && typeof c.name == "string"
503
503
  ).map((c) => ({
504
504
  id: c.id,
@@ -513,23 +513,23 @@ function Dn(e) {
513
513
  return n;
514
514
  }
515
515
  function Do(e, n) {
516
- const r = le(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
516
+ const r = he(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
517
517
  if (!(typeof o != "string" || o.length === 0))
518
518
  return o;
519
519
  }
520
520
  function st(e, n) {
521
- const r = le(e) ? e : {}, o = r.data ?? e;
521
+ const r = he(e) ? e : {}, o = r.data ?? e;
522
522
  let c = [];
523
- return Array.isArray(o) ? c = o : le(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
523
+ return Array.isArray(o) ? c = o : he(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
524
524
  items: c,
525
525
  nextCursor: Do(r, o)
526
526
  };
527
527
  }
528
528
  function Nn(e) {
529
- return le(e) && typeof e.id == "string" && e.id.length > 0;
529
+ return he(e) && typeof e.id == "string" && e.id.length > 0;
530
530
  }
531
531
  function qn(e) {
532
- return le(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
532
+ return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
533
533
  }
534
534
  function Kt(e, n) {
535
535
  if (e.type !== "dm")
@@ -541,7 +541,7 @@ function Kt(e, n) {
541
541
  return r.user.id === n && o.length > 0 && o.toLowerCase() !== "pending user";
542
542
  }
543
543
  function zn(e) {
544
- if (!le(e) || typeof e.id != "string" || typeof e.name != "string")
544
+ if (!he(e) || typeof e.id != "string" || typeof e.name != "string")
545
545
  return null;
546
546
  const n = {
547
547
  id: e.id,
@@ -552,8 +552,8 @@ function zn(e) {
552
552
  return c && (n.avatar = c, n.avatar_url = c), n;
553
553
  }
554
554
  function No(e) {
555
- const r = (le(e) ? e : {}).data ?? e;
556
- return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : le(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
555
+ const r = (he(e) ? e : {}).data ?? e;
556
+ return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : he(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
557
557
  }
558
558
  function As(e) {
559
559
  if (e.type !== "dm")
@@ -738,7 +738,7 @@ const Qt = Di("messaging", {
738
738
  const e = await Pe.fetchFolders();
739
739
  return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
740
740
  } catch (e) {
741
- throw this.error = Y(e), e;
741
+ throw this.error = Z(e), e;
742
742
  }
743
743
  },
744
744
  async createFolder(e) {
@@ -746,7 +746,7 @@ const Qt = Di("messaging", {
746
746
  const n = await Pe.createFolder(e);
747
747
  return this.folders = Be([...this.folders, n]), n;
748
748
  } catch (n) {
749
- throw this.error = Y(n), n;
749
+ throw this.error = Z(n), n;
750
750
  }
751
751
  },
752
752
  async updateFolder(e, n) {
@@ -756,14 +756,14 @@ const Qt = Di("messaging", {
756
756
  this.folders.map((o) => o.id === e ? r : o)
757
757
  ), r;
758
758
  } catch (r) {
759
- throw this.error = Y(r), r;
759
+ throw this.error = Z(r), r;
760
760
  }
761
761
  },
762
762
  async deleteFolder(e) {
763
763
  try {
764
764
  await Pe.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
765
765
  } catch (n) {
766
- throw this.error = Y(n), n;
766
+ throw this.error = Z(n), n;
767
767
  }
768
768
  },
769
769
  async reorderFolders(e) {
@@ -785,7 +785,7 @@ const Qt = Di("messaging", {
785
785
  });
786
786
  this.folders = r;
787
787
  } catch (n) {
788
- throw this.error = Y(n), n;
788
+ throw this.error = Z(n), n;
789
789
  }
790
790
  },
791
791
  async assignToFolder(e, n) {
@@ -812,7 +812,7 @@ const Qt = Di("messaging", {
812
812
  u
813
813
  );
814
814
  } catch (r) {
815
- throw this.error = Y(r), r;
815
+ throw this.error = Z(r), r;
816
816
  }
817
817
  },
818
818
  async fetchConversations(e, n, r, o) {
@@ -822,15 +822,15 @@ const Qt = Di("messaging", {
822
822
  return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), In();
823
823
  const c = o?.includePresence ?? !0, u = {};
824
824
  c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
825
- const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
825
+ const d = await W().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
826
826
  d.data,
827
827
  "conversations"
828
- ), P = f.map((E) => {
828
+ ), R = f.map((E) => {
829
829
  const b = this.conversations.find(
830
830
  (A) => A.id === E.id
831
831
  );
832
832
  return He(E, b);
833
- }), C = await $n(P);
833
+ }), C = await $n(R);
834
834
  e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
835
835
  const v = {
836
836
  data: C,
@@ -838,7 +838,7 @@ const Qt = Di("messaging", {
838
838
  };
839
839
  return h !== void 0 && (v.next_cursor = h), v;
840
840
  } catch (c) {
841
- throw o?.background && xn(c) || (this.error = Y(c)), c;
841
+ throw o?.background && xn(c) || (this.error = Z(c)), c;
842
842
  } finally {
843
843
  this.loading = !1;
844
844
  }
@@ -859,7 +859,7 @@ const Qt = Di("messaging", {
859
859
  async fetchConversation(e) {
860
860
  this.loading = !0, this.error = null;
861
861
  try {
862
- const n = await X().get(`/v1/messaging/conversations/${e}`, {
862
+ const n = await W().get(`/v1/messaging/conversations/${e}`, {
863
863
  params: { include_presence: 1 }
864
864
  }), r = this.conversations.find((f) => f.id === e);
865
865
  let o = He(n.data.data || n.data, r);
@@ -870,7 +870,7 @@ const Qt = Di("messaging", {
870
870
  const d = this.requests.findIndex((f) => f.id === e);
871
871
  return d >= 0 && (this.requests[d] = o), this.normalizeFolderAssignmentsState(), o;
872
872
  } catch (n) {
873
- throw this.error = Y(n), n;
873
+ throw this.error = Z(n), n;
874
874
  } finally {
875
875
  this.loading = !1;
876
876
  }
@@ -885,12 +885,12 @@ const Qt = Di("messaging", {
885
885
  filter: "requests"
886
886
  };
887
887
  e && (n.cursor = e);
888
- const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
888
+ const r = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
889
889
  r.data,
890
890
  "conversations"
891
891
  ), u = o.map((h) => {
892
- const P = this.requests.find((C) => C.id === h.id);
893
- return He(h, P);
892
+ const R = this.requests.find((C) => C.id === h.id);
893
+ return He(h, R);
894
894
  }), d = await $n(u);
895
895
  e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
896
896
  const f = {
@@ -899,7 +899,7 @@ const Qt = Di("messaging", {
899
899
  };
900
900
  return c !== void 0 && (f.next_cursor = c), f;
901
901
  } catch (n) {
902
- throw this.error = Y(n), n;
902
+ throw this.error = Z(n), n;
903
903
  } finally {
904
904
  this.loading = !1;
905
905
  }
@@ -911,7 +911,7 @@ const Qt = Di("messaging", {
911
911
  let o = 0, c;
912
912
  for (; ; )
913
913
  try {
914
- c = await X().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
914
+ c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
915
915
  break;
916
916
  } catch (v) {
917
917
  if (!(o < So && xn(v)))
@@ -936,19 +936,19 @@ const Qt = Di("messaging", {
936
936
  };
937
937
  return d !== void 0 && (C.next_cursor = d), C;
938
938
  } catch (r) {
939
- throw this.error = Y(r), r;
939
+ throw this.error = Z(r), r;
940
940
  } finally {
941
941
  this.loadingMessages[e] = !1, this.loading = !1;
942
942
  }
943
943
  },
944
944
  async sendMessage(e, n, r, o, c, u, d) {
945
- const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, P = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = xo(d), v = f.currentUser, E = {
945
+ const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, R = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = xo(d), v = f.currentUser, E = {
946
946
  id: h,
947
947
  conversation_id: e,
948
948
  author_id: v?.id || "",
949
949
  body: n || "",
950
950
  attachments: [],
951
- meta: P ? { shared_post_id: P } : {},
951
+ meta: R ? { shared_post_id: R } : {},
952
952
  ...C ? { shared_post: C } : {},
953
953
  is_deleted: !1,
954
954
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -965,11 +965,11 @@ const Qt = Di("messaging", {
965
965
  const A = {
966
966
  body: n || "",
967
967
  ...o ? { reply_to_id: o } : {},
968
- ...P ? { shared_post_id: P } : {},
968
+ ...R ? { shared_post_id: R } : {},
969
969
  ...C ? { shared_post_preview: C } : {}
970
970
  };
971
971
  if (r && r.length > 0) {
972
- const W = await Promise.all(
972
+ const G = await Promise.all(
973
973
  r.map(async (te) => {
974
974
  const k = await uo().uploadImage(te);
975
975
  return {
@@ -979,31 +979,31 @@ const Qt = Di("messaging", {
979
979
  };
980
980
  })
981
981
  );
982
- b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
982
+ b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
983
983
  ...A,
984
- attachments: W
984
+ attachments: G
985
985
  });
986
986
  } else
987
- b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
987
+ b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
988
988
  ...A,
989
989
  type: "text"
990
990
  });
991
- const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
992
- O >= 0 && (y[O] = m), this._pendingSendIds.delete(h);
993
- const z = m.id;
991
+ const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], F = y.findIndex((G) => G.id === h);
992
+ F >= 0 && (y[F] = m), this._pendingSendIds.delete(h);
993
+ const q = m.id;
994
994
  let J = 0;
995
- for (let W = y.length - 1; W >= 0; W--) {
996
- const te = y[W];
997
- te && te.id === z && (J++, J > 1 && y.splice(W, 1));
995
+ for (let G = y.length - 1; G >= 0; G--) {
996
+ const te = y[G];
997
+ te && te.id === q && (J++, J > 1 && y.splice(G, 1));
998
998
  }
999
999
  return this.updateConversationLastMessage(e, m), m;
1000
1000
  } catch (b) {
1001
- throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Y(b), b;
1001
+ throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Z(b), b;
1002
1002
  }
1003
1003
  },
1004
1004
  async editMessage(e, n, r) {
1005
1005
  try {
1006
- const o = await X().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
1006
+ const o = await W().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
1007
1007
  body: r
1008
1008
  }), c = o.data.data || o.data, u = this.messages[e] || [], d = u.findIndex((f) => f.id === n);
1009
1009
  if (d >= 0) {
@@ -1012,12 +1012,12 @@ const Qt = Di("messaging", {
1012
1012
  }
1013
1013
  return c;
1014
1014
  } catch (o) {
1015
- throw this.error = Y(o), o;
1015
+ throw this.error = Z(o), o;
1016
1016
  }
1017
1017
  },
1018
1018
  async deleteMessage(e, n) {
1019
1019
  try {
1020
- await X().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
1020
+ await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
1021
1021
  const r = this.messages[e] || [], o = r.findIndex((c) => c.id === n);
1022
1022
  if (o >= 0) {
1023
1023
  const c = r[o];
@@ -1027,7 +1027,7 @@ const Qt = Di("messaging", {
1027
1027
  delete u.body, r[o] = u;
1028
1028
  }
1029
1029
  } catch (r) {
1030
- throw this.error = Y(r), r;
1030
+ throw this.error = Z(r), r;
1031
1031
  }
1032
1032
  },
1033
1033
  async markAsRead(e) {
@@ -1045,7 +1045,7 @@ const Qt = Di("messaging", {
1045
1045
  })(), o = n ? Fn(n, this.messages) : r;
1046
1046
  if (!o)
1047
1047
  return;
1048
- await X().post(`/v1/messaging/conversations/${e}/read`, {
1048
+ await W().post(`/v1/messaging/conversations/${e}/read`, {
1049
1049
  message_id: o
1050
1050
  }), this.conversations.forEach((c) => {
1051
1051
  c.id === e && (c.unread_count = 0);
@@ -1053,7 +1053,7 @@ const Qt = Di("messaging", {
1053
1053
  c.id === e && (c.unread_count = 0);
1054
1054
  });
1055
1055
  } catch (n) {
1056
- throw this.error = Y(n), n;
1056
+ throw this.error = Z(n), n;
1057
1057
  }
1058
1058
  },
1059
1059
  async markAllAsRead() {
@@ -1071,7 +1071,7 @@ const Qt = Di("messaging", {
1071
1071
  return;
1072
1072
  const r = await Promise.allSettled(
1073
1073
  n.map(
1074
- (c) => X().post(`/v1/messaging/conversations/${c.conversationId}/read`, {
1074
+ (c) => W().post(`/v1/messaging/conversations/${c.conversationId}/read`, {
1075
1075
  message_id: c.messageId
1076
1076
  })
1077
1077
  )
@@ -1088,39 +1088,39 @@ const Qt = Di("messaging", {
1088
1088
  o === null && (o = c.reason);
1089
1089
  }
1090
1090
  }), o !== null)
1091
- throw this.error = Y(o), o;
1091
+ throw this.error = Z(o), o;
1092
1092
  },
1093
1093
  async sendTyping(e, n = "start") {
1094
1094
  try {
1095
- const r = await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1095
+ const r = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1096
1096
  if (n !== "start" || !Eo(r.data))
1097
1097
  return;
1098
- await Ln(Co), await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1098
+ await Ln(Co), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1099
1099
  } catch (r) {
1100
1100
  console.warn("Failed to send typing indicator:", r);
1101
1101
  }
1102
1102
  },
1103
1103
  async muteConversation(e, n) {
1104
1104
  try {
1105
- const r = { minutes: n }, o = await X().patch(`/v1/messaging/conversations/${e}/mute`, r), u = (o.data.data || o.data).muted_until || null, d = this.conversations.find((f) => f.id === e);
1105
+ const r = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, r), u = (o.data.data || o.data).muted_until || null, d = this.conversations.find((f) => f.id === e);
1106
1106
  d && (d.is_muted = u !== null, d.muted_until = u);
1107
1107
  } catch (r) {
1108
- throw this.error = Y(r), r;
1108
+ throw this.error = Z(r), r;
1109
1109
  }
1110
1110
  },
1111
1111
  async unmuteConversation(e) {
1112
1112
  try {
1113
- const n = await X().patch(`/v1/messaging/conversations/${e}/mute`, {
1113
+ const n = await W().patch(`/v1/messaging/conversations/${e}/mute`, {
1114
1114
  minutes: 0
1115
1115
  }), o = (n.data.data || n.data).muted_until || null, c = this.conversations.find((u) => u.id === e);
1116
1116
  c && (c.is_muted = o !== null, c.muted_until = o);
1117
1117
  } catch (n) {
1118
- throw this.error = Y(n), n;
1118
+ throw this.error = Z(n), n;
1119
1119
  }
1120
1120
  },
1121
1121
  async updateConversationTitle(e, n) {
1122
1122
  try {
1123
- const r = await X().patch(`/v1/messaging/conversations/${e}`, {
1123
+ const r = await W().patch(`/v1/messaging/conversations/${e}`, {
1124
1124
  title: n
1125
1125
  }), o = r.data.data || r.data, c = typeof o?.title == "string" ? o.title : n, u = (d) => d.map((f) => f.id !== e ? f : {
1126
1126
  ...f,
@@ -1128,32 +1128,32 @@ const Qt = Di("messaging", {
1128
1128
  });
1129
1129
  this.conversations = u(this.conversations), this.requests = u(this.requests);
1130
1130
  } catch (r) {
1131
- throw this.error = Y(r), r;
1131
+ throw this.error = Z(r), r;
1132
1132
  }
1133
1133
  },
1134
1134
  async pinConversation(e, n) {
1135
1135
  const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
1136
1136
  r && (r.is_pinned = n), this.conversations.sort(Xe);
1137
1137
  try {
1138
- await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
1138
+ await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
1139
1139
  } catch (c) {
1140
- throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Y(c), c;
1140
+ throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Z(c), c;
1141
1141
  }
1142
1142
  },
1143
1143
  async archiveConversation(e, n) {
1144
1144
  try {
1145
- await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
1145
+ await W().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
1146
1146
  const r = this.conversations.find((o) => o.id === e);
1147
1147
  r && (r.is_archived = n);
1148
1148
  } catch (r) {
1149
- throw this.error = Y(r), r;
1149
+ throw this.error = Z(r), r;
1150
1150
  }
1151
1151
  },
1152
1152
  async deleteConversation(e) {
1153
1153
  try {
1154
- await X().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];
1154
+ 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];
1155
1155
  } catch (n) {
1156
- throw this.error = Y(n), n;
1156
+ throw this.error = Z(n), n;
1157
1157
  }
1158
1158
  },
1159
1159
  async createDMConversation(e, n) {
@@ -1162,18 +1162,18 @@ const Qt = Di("messaging", {
1162
1162
  user_id: e
1163
1163
  };
1164
1164
  n && (r.message = n);
1165
- const o = await X().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
1165
+ const o = await W().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
1166
1166
  if (!Nn(c))
1167
1167
  throw new Error("Invalid conversation payload from DM create endpoint.");
1168
1168
  let u = qn(c) && Kt(c, e) ? He(c) : await this.fetchConversation(c.id);
1169
1169
  return u = await jn(u, e), u.is_request === !0 ? (this.requests = rt(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = rt(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
1170
1170
  } catch (r) {
1171
- throw this.error = Y(r), r;
1171
+ throw this.error = Z(r), r;
1172
1172
  }
1173
1173
  },
1174
1174
  async createGroupConversation(e, n) {
1175
1175
  try {
1176
- const r = await X().post("/v1/messaging/conversations/group", {
1176
+ const r = await W().post("/v1/messaging/conversations/group", {
1177
1177
  title: e,
1178
1178
  participant_ids: n
1179
1179
  }), o = r.data.data || r.data;
@@ -1182,22 +1182,22 @@ const Qt = Di("messaging", {
1182
1182
  const c = qn(o) ? o : await this.fetchConversation(o.id);
1183
1183
  return this.conversations = rt(this.conversations, c), c;
1184
1184
  } catch (r) {
1185
- throw this.error = Y(r), r;
1185
+ throw this.error = Z(r), r;
1186
1186
  }
1187
1187
  },
1188
1188
  async addParticipants(e, n) {
1189
1189
  try {
1190
- await X().post(`/v1/messaging/conversations/${e}/participants`, {
1190
+ await W().post(`/v1/messaging/conversations/${e}/participants`, {
1191
1191
  user_ids: n
1192
1192
  // Changed from participant_ids to user_ids to match backend
1193
1193
  }), await this.fetchConversation(e);
1194
1194
  } catch (r) {
1195
- throw this.error = Y(r), r;
1195
+ throw this.error = Z(r), r;
1196
1196
  }
1197
1197
  },
1198
1198
  async removeParticipant(e, n) {
1199
1199
  try {
1200
- await X().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
1200
+ await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
1201
1201
  const r = ke()();
1202
1202
  if (n === r.currentUser?.id) {
1203
1203
  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];
@@ -1205,7 +1205,7 @@ const Qt = Di("messaging", {
1205
1205
  }
1206
1206
  await this.fetchConversation(e);
1207
1207
  } catch (r) {
1208
- throw this.error = Y(r), r;
1208
+ throw this.error = Z(r), r;
1209
1209
  }
1210
1210
  },
1211
1211
  applyParticipantReadState(e) {
@@ -1229,28 +1229,28 @@ const Qt = Di("messaging", {
1229
1229
  return;
1230
1230
  this.messages[n] || (this.messages[n] = []);
1231
1231
  const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1232
- if (o.find((P) => P.id === r.id))
1232
+ if (o.find((R) => R.id === r.id))
1233
1233
  return;
1234
1234
  const u = ke()();
1235
1235
  if (r.author_id === u.currentUser?.id) {
1236
- const P = o.findIndex((C) => C.id.startsWith("temp-"));
1237
- if (P >= 0) {
1238
- const C = o[P]?.id ?? "";
1236
+ const R = o.findIndex((C) => C.id.startsWith("temp-"));
1237
+ if (R >= 0) {
1238
+ const C = o[R]?.id ?? "";
1239
1239
  this.messages[n] = [
1240
- ...o.slice(0, P),
1240
+ ...o.slice(0, R),
1241
1241
  r,
1242
- ...o.slice(P + 1)
1242
+ ...o.slice(R + 1)
1243
1243
  ], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
1244
1244
  return;
1245
1245
  }
1246
1246
  }
1247
1247
  const d = r.created_at;
1248
1248
  let f = o.length;
1249
- for (let P = o.length - 1; P >= 0; P--) {
1250
- const C = o[P];
1249
+ for (let R = o.length - 1; R >= 0; R--) {
1250
+ const C = o[R];
1251
1251
  if (C && C.created_at <= d)
1252
1252
  break;
1253
- f = P;
1253
+ f = R;
1254
1254
  }
1255
1255
  const h = f === o.length;
1256
1256
  this.messages[n] = [
@@ -1265,8 +1265,8 @@ const Qt = Di("messaging", {
1265
1265
  },
1266
1266
  removeMessage(e, n) {
1267
1267
  const r = (h) => {
1268
- const P = { ...h, is_deleted: !0 };
1269
- return delete P.body, P;
1268
+ const R = { ...h, is_deleted: !0 };
1269
+ return delete R.body, R;
1270
1270
  };
1271
1271
  let o = null;
1272
1272
  const c = this.conversations.find((h) => h.id === e);
@@ -1294,25 +1294,25 @@ const Qt = Di("messaging", {
1294
1294
  try {
1295
1295
  let f;
1296
1296
  try {
1297
- f = await X().post(o, c);
1297
+ f = await W().post(o, c);
1298
1298
  } catch (v) {
1299
1299
  if (!Fo(v))
1300
1300
  throw v;
1301
- f = await X().post(o, c);
1301
+ f = await W().post(o, c);
1302
1302
  }
1303
- const h = le(f.data) && "data" in f.data ? f.data.data : f.data, P = Dn(
1304
- le(h) ? h.reactions : void 0
1303
+ const h = he(f.data) && "data" in f.data ? f.data.data : f.data, R = Dn(
1304
+ he(h) ? h.reactions : void 0
1305
1305
  );
1306
- (P.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, P);
1306
+ (R.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, R);
1307
1307
  try {
1308
- const v = await X().get(o), E = le(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
1309
- le(E) ? E.reactions : void 0
1308
+ const v = await W().get(o), E = he(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
1309
+ he(E) ? E.reactions : void 0
1310
1310
  );
1311
1311
  this.updateMessageReactions(e, n, b);
1312
1312
  } catch {
1313
1313
  }
1314
1314
  } catch (f) {
1315
- throw this.error = Y(f), f;
1315
+ throw this.error = Z(f), f;
1316
1316
  }
1317
1317
  },
1318
1318
  updateMessageReactions(e, n, r) {
@@ -1335,8 +1335,8 @@ const Qt = Di("messaging", {
1335
1335
  if (!f) return;
1336
1336
  const h = { ...f };
1337
1337
  r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), u[d] = h;
1338
- const P = this.conversations.find((v) => v.id === e);
1339
- P?.last_message?.id === n && (P.last_message = h);
1338
+ const R = this.conversations.find((v) => v.id === e);
1339
+ R?.last_message?.id === n && (R.last_message = h);
1340
1340
  const C = this.requests.find((v) => v.id === e);
1341
1341
  C?.last_message?.id === n && (C.last_message = h);
1342
1342
  },
@@ -1367,7 +1367,7 @@ const Qt = Di("messaging", {
1367
1367
  )];
1368
1368
  if (n.length === 0)
1369
1369
  return;
1370
- const r = await X().get("/v1/presence/users", {
1370
+ const r = await W().get("/v1/presence/users", {
1371
1371
  params: { ids: n }
1372
1372
  }), o = r.data?.data?.items ?? r.data?.items ?? [];
1373
1373
  for (const c of o) {
@@ -1387,14 +1387,14 @@ const Qt = Di("messaging", {
1387
1387
  });
1388
1388
  this.conversations = rt(this.conversations, r);
1389
1389
  } catch (n) {
1390
- throw this.error = Y(n), n;
1390
+ throw this.error = Z(n), n;
1391
1391
  }
1392
1392
  },
1393
1393
  async declineRequest(e) {
1394
1394
  try {
1395
1395
  await Pe.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
1396
1396
  } catch (n) {
1397
- throw this.error = Y(n), n;
1397
+ throw this.error = Z(n), n;
1398
1398
  }
1399
1399
  },
1400
1400
  async searchConversations(e, n, r) {
@@ -1402,7 +1402,7 @@ const Qt = Di("messaging", {
1402
1402
  try {
1403
1403
  const o = { search: e, limit: 20 };
1404
1404
  n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
1405
- const c = await X().get("/v1/messaging/conversations", {
1405
+ const c = await W().get("/v1/messaging/conversations", {
1406
1406
  params: o
1407
1407
  }), { items: u } = st(
1408
1408
  c.data,
@@ -1410,7 +1410,7 @@ const Qt = Di("messaging", {
1410
1410
  );
1411
1411
  return u;
1412
1412
  } catch (o) {
1413
- return this.error = Y(o), [];
1413
+ return this.error = Z(o), [];
1414
1414
  } finally {
1415
1415
  this.searchLoading = !1;
1416
1416
  }
@@ -1418,12 +1418,12 @@ const Qt = Di("messaging", {
1418
1418
  async searchMessages(e, n) {
1419
1419
  this.searchLoading = !0;
1420
1420
  try {
1421
- const r = await X().get(`/v1/messaging/conversations/${e}/search`, {
1421
+ const r = await W().get(`/v1/messaging/conversations/${e}/search`, {
1422
1422
  params: { q: n }
1423
1423
  }), o = r.data.data || r.data || [];
1424
1424
  return this.searchResults = o, o;
1425
1425
  } catch (r) {
1426
- return this.error = Y(r), [];
1426
+ return this.error = Z(r), [];
1427
1427
  } finally {
1428
1428
  this.searchLoading = !1;
1429
1429
  }
@@ -1464,28 +1464,28 @@ const Qt = Di("messaging", {
1464
1464
  }
1465
1465
  });
1466
1466
  function oc(e) {
1467
- const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = zt(), f = d !== null, h = 20, P = 250;
1467
+ const n = Qt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = zt(), f = d !== null, h = 20, R = 250;
1468
1468
  let C = 0, v = null, E = null;
1469
- const b = se(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
1469
+ const b = re(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
1470
1470
  function w() {
1471
1471
  v && (clearTimeout(v), v = null), C = 0;
1472
1472
  }
1473
1473
  function p() {
1474
1474
  !f || o.value || v || C >= h || (v = setTimeout(() => {
1475
- v = null, C += 1, I();
1476
- }, P));
1475
+ v = null, C += 1, L();
1476
+ }, R));
1477
1477
  }
1478
1478
  function m(_) {
1479
1479
  if (n.addMessage(_.message), _.message.author_id !== b.value) {
1480
- const L = n.getConversationById(_.conversation_id);
1481
- L && (L.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
1480
+ const I = n.getConversationById(_.conversation_id);
1481
+ I && (I.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
1482
1482
  });
1483
1483
  }
1484
1484
  }
1485
1485
  function y(_) {
1486
1486
  n.applyParticipantReadState(_);
1487
1487
  }
1488
- function O(_) {
1488
+ function F(_) {
1489
1489
  n.applyMessageEdit(
1490
1490
  _.conversation_id,
1491
1491
  _.message.id,
@@ -1494,7 +1494,7 @@ function oc(e) {
1494
1494
  _.message.meta
1495
1495
  );
1496
1496
  }
1497
- function z(_) {
1497
+ function q(_) {
1498
1498
  n.removeMessage(_.conversation_id, _.message_id);
1499
1499
  }
1500
1500
  function J(_) {
@@ -1504,21 +1504,21 @@ function oc(e) {
1504
1504
  _.reactions
1505
1505
  );
1506
1506
  }
1507
- function W(_) {
1508
- const L = n.getConversationById(_.conversation_id);
1509
- L && (L.is_request = !1), n.requests = n.requests.filter(
1510
- (he) => he.id !== _.conversation_id
1507
+ function G(_) {
1508
+ const I = n.getConversationById(_.conversation_id);
1509
+ I && (I.is_request = !1), n.requests = n.requests.filter(
1510
+ (fe) => fe.id !== _.conversation_id
1511
1511
  );
1512
1512
  }
1513
1513
  function te(_) {
1514
- _.removed_user_id === b.value && (G(), n.deleteConversation(_.conversation_id).catch(() => {
1514
+ _.removed_user_id === b.value && (X(), n.deleteConversation(_.conversation_id).catch(() => {
1515
1515
  }));
1516
1516
  }
1517
1517
  function k(_) {
1518
- const L = u.value;
1519
- E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Xi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
1518
+ const I = u.value;
1519
+ E && (E(), E = null), I && (_ && !n.hasGlobalConversationSubscription(I) && Xi(I), n.unregisterDetailSubscription(I), u.value = null), o.value = !1;
1520
1520
  }
1521
- function I() {
1521
+ function L() {
1522
1522
  const _ = A();
1523
1523
  if (!(o.value || !_)) {
1524
1524
  if (!Ae()) {
@@ -1530,29 +1530,29 @@ function oc(e) {
1530
1530
  E = Vi(_, {
1531
1531
  onMessageSent: m,
1532
1532
  onMessageRead: y,
1533
- onMessageEdited: O,
1534
- onMessageDeleted: z,
1533
+ onMessageEdited: F,
1534
+ onMessageDeleted: q,
1535
1535
  onReactionToggled: J,
1536
- onRequestAccepted: W,
1536
+ onRequestAccepted: G,
1537
1537
  onParticipantRemoved: te
1538
1538
  }), o.value = !0, u.value = _, n.registerDetailSubscription(_), w();
1539
- } catch (L) {
1540
- c.value = L instanceof Error ? L.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", L);
1539
+ } catch (I) {
1540
+ c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
1541
1541
  }
1542
1542
  }
1543
1543
  }
1544
- function K() {
1545
- o.value || I();
1544
+ function V() {
1545
+ o.value || L();
1546
1546
  }
1547
- typeof window < "u" && window.addEventListener(Je(), K);
1548
- const V = ht((_) => {
1547
+ typeof window < "u" && window.addEventListener(Je(), V);
1548
+ const H = ht((_) => {
1549
1549
  if (_ === "connected") {
1550
- o.value || I();
1550
+ o.value || L();
1551
1551
  return;
1552
1552
  }
1553
1553
  (_ === "disconnected" || _ === "error") && (w(), k(!1));
1554
1554
  });
1555
- function G() {
1555
+ function X() {
1556
1556
  if (w(), !(!o.value || !u.value))
1557
1557
  try {
1558
1558
  k(!0), c.value = null;
@@ -1562,27 +1562,27 @@ function oc(e) {
1562
1562
  }
1563
1563
  return ot(
1564
1564
  () => A(),
1565
- (_, L) => {
1566
- if (_ !== L) {
1565
+ (_, I) => {
1566
+ if (_ !== I) {
1567
1567
  if (w(), o.value && k(!0), !_) {
1568
1568
  c.value = null;
1569
1569
  return;
1570
1570
  }
1571
- I();
1571
+ L();
1572
1572
  }
1573
1573
  }
1574
1574
  ), d !== null && qe(() => {
1575
- w(), V(), G(), typeof window < "u" && window.removeEventListener(Je(), K);
1575
+ w(), H(), X(), typeof window < "u" && window.removeEventListener(Je(), V);
1576
1576
  }), {
1577
- isSubscribed: se(() => o.value),
1578
- error: se(() => c.value),
1579
- subscribe: I,
1580
- unsubscribe: G
1577
+ isSubscribed: re(() => o.value),
1578
+ error: re(() => c.value),
1579
+ subscribe: L,
1580
+ unsubscribe: X
1581
1581
  };
1582
1582
  }
1583
1583
  const Ps = () => () => {
1584
1584
  }, Ms = async () => {
1585
- }, ye = {
1585
+ }, _e = {
1586
1586
  initializedEvent: "messenger-client:main-echo-initialized",
1587
1587
  getEcho: () => null,
1588
1588
  getConnectionStatus: () => "disconnected",
@@ -1590,25 +1590,25 @@ const Ps = () => () => {
1590
1590
  reconnect: Ms
1591
1591
  };
1592
1592
  function ct() {
1593
- return ye.initializedEvent;
1593
+ return _e.initializedEvent;
1594
1594
  }
1595
1595
  function ut() {
1596
- return ye.getEcho();
1596
+ return _e.getEcho();
1597
1597
  }
1598
1598
  function $o() {
1599
- return ye.getConnectionStatus();
1599
+ return _e.getConnectionStatus();
1600
1600
  }
1601
1601
  function Ho(e) {
1602
- return ye.onConnectionStatusChange(e);
1602
+ return _e.onConnectionStatusChange(e);
1603
1603
  }
1604
1604
  async function Bo() {
1605
- await ye.reconnect();
1605
+ await _e.reconnect();
1606
1606
  }
1607
1607
  function Vo(e) {
1608
- e.initializedEvent && (ye.initializedEvent = e.initializedEvent), e.getEcho && (ye.getEcho = e.getEcho), e.getConnectionStatus && (ye.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (ye.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (ye.reconnect = e.reconnect);
1608
+ e.initializedEvent && (_e.initializedEvent = e.initializedEvent), e.getEcho && (_e.getEcho = e.getEcho), e.getConnectionStatus && (_e.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (_e.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (_e.reconnect = e.reconnect);
1609
1609
  }
1610
1610
  function Xo() {
1611
- ye.initializedEvent = "messenger-client:main-echo-initialized", ye.getEcho = () => null, ye.getConnectionStatus = () => "disconnected", ye.onConnectionStatusChange = Ps, ye.reconnect = Ms;
1611
+ _e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange = Ps, _e.reconnect = Ms;
1612
1612
  }
1613
1613
  const Wo = {
1614
1614
  debug: () => {
@@ -1662,9 +1662,9 @@ function ac(e = {}) {
1662
1662
  const o = Qo(e.source ?? "app"), c = {
1663
1663
  ...Ko,
1664
1664
  ...e.icons
1665
- }, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), P = be(!1), C = be(!1), v = be(!1);
1665
+ }, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), R = ye(!1), C = ye(!1), v = ye(!1);
1666
1666
  let E = null, b = null, A = null, w = null, p = null, m = null, y = null;
1667
- const O = se(() => u.value === "connected"), z = se(() => u.value === "connecting"), J = se(() => u.value === "disconnected"), W = se(() => u.value === "error"), te = se(() => J.value || W.value), k = se(() => {
1667
+ const F = re(() => u.value === "connected"), q = re(() => u.value === "connecting"), J = re(() => u.value === "disconnected"), G = re(() => u.value === "error"), te = re(() => J.value || G.value), k = re(() => {
1668
1668
  switch (u.value) {
1669
1669
  case "connecting":
1670
1670
  return f.value > 0 ? "Reconnecting..." : "Connecting...";
@@ -1677,7 +1677,7 @@ function ac(e = {}) {
1677
1677
  default:
1678
1678
  return "Unknown connection state";
1679
1679
  }
1680
- }), I = se(() => {
1680
+ }), L = re(() => {
1681
1681
  switch (u.value) {
1682
1682
  case "connected":
1683
1683
  return "success";
@@ -1689,7 +1689,7 @@ function ac(e = {}) {
1689
1689
  default:
1690
1690
  return "medium";
1691
1691
  }
1692
- }), K = se(() => {
1692
+ }), V = re(() => {
1693
1693
  switch (u.value) {
1694
1694
  case "connected":
1695
1695
  return c.connected;
@@ -1702,12 +1702,12 @@ function ac(e = {}) {
1702
1702
  default:
1703
1703
  return c.unknown;
1704
1704
  }
1705
- }), V = async () => {
1705
+ }), H = async () => {
1706
1706
  Vn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
1707
- }, G = (B, D = u.value) => {
1707
+ }, X = (B, K = u.value) => {
1708
1708
  if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
1709
- const q = !v.value && D === B, _e = !P.value && (q || D === "connected" || D === "connecting");
1710
- if (C.value = !0, _e) {
1709
+ const N = !v.value && K === B, Y = !R.value && (N || K === "connected" || K === "connecting");
1710
+ if (C.value = !0, Y) {
1711
1711
  h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
1712
1712
  A = null, u.value !== "connected" && (h.value = !0);
1713
1713
  }, 5e3);
@@ -1717,11 +1717,11 @@ function ac(e = {}) {
1717
1717
  return;
1718
1718
  }
1719
1719
  if (B === "connected") {
1720
- A && (clearTimeout(A), A = null), h.value = !1, P.value = !1, C.value = !1;
1720
+ A && (clearTimeout(A), A = null), h.value = !1, R.value = !1, C.value = !1;
1721
1721
  return;
1722
1722
  }
1723
1723
  if (B === "connecting") {
1724
- if (A && (clearTimeout(A), A = null), P.value) {
1724
+ if (A && (clearTimeout(A), A = null), R.value) {
1725
1725
  h.value = !0;
1726
1726
  return;
1727
1727
  }
@@ -1733,34 +1733,34 @@ function ac(e = {}) {
1733
1733
  _("connected");
1734
1734
  return;
1735
1735
  }
1736
- P.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1736
+ R.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1737
1737
  }
1738
1738
  }, 1e4);
1739
1739
  }
1740
1740
  }, _ = (B) => {
1741
- const D = u.value;
1742
- if (B === "connecting" && P.value) {
1743
- u.value = "disconnected", G("disconnected", D);
1741
+ const K = u.value;
1742
+ if (B === "connecting" && R.value) {
1743
+ u.value = "disconnected", X("disconnected", K);
1744
1744
  return;
1745
1745
  }
1746
- u.value = B, B === "connecting" && (D === "disconnected" || D === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), G(B, D);
1747
- }, L = () => {
1748
- const B = Wn(o), D = u.value;
1749
- if (B === "connected" && D !== "connected") {
1746
+ u.value = B, B === "connecting" && (K === "disconnected" || K === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), X(B, K);
1747
+ }, I = () => {
1748
+ const B = Wn(o), K = u.value;
1749
+ if (B === "connected" && K !== "connected") {
1750
1750
  _("connected");
1751
1751
  return;
1752
1752
  }
1753
- if (B === "connecting" && D !== "connecting") {
1753
+ if (B === "connecting" && K !== "connecting") {
1754
1754
  _("connecting");
1755
1755
  return;
1756
1756
  }
1757
- if ((B === "unavailable" || B === "failed" || B === "disconnected") && D !== "disconnected") {
1757
+ if ((B === "unavailable" || B === "failed" || B === "disconnected") && K !== "disconnected") {
1758
1758
  _("disconnected");
1759
1759
  return;
1760
1760
  }
1761
- const q = o.getConnectionStatus();
1762
- !B && q === "connected" && D !== "connected" && _("connected");
1763
- }, he = () => {
1761
+ const N = o.getConnectionStatus();
1762
+ !B && N === "connected" && K !== "connected" && _("connected");
1763
+ }, fe = () => {
1764
1764
  if (p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = o.getEchoConnection(), y = null, !p?.bind)
1765
1765
  return;
1766
1766
  y = {
@@ -1769,17 +1769,17 @@ function ac(e = {}) {
1769
1769
  disconnected: () => _("disconnected"),
1770
1770
  unavailable: () => _("disconnected"),
1771
1771
  error: () => _("error"),
1772
- stateChange: (D) => {
1773
- const q = D?.current;
1774
- if (q === "connected") {
1772
+ stateChange: (K) => {
1773
+ const N = K?.current;
1774
+ if (N === "connected") {
1775
1775
  _("connected");
1776
1776
  return;
1777
1777
  }
1778
- if (q === "connecting") {
1778
+ if (N === "connecting") {
1779
1779
  _("connecting");
1780
1780
  return;
1781
1781
  }
1782
- (q === "unavailable" || q === "failed" || q === "disconnected") && _("disconnected");
1782
+ (N === "unavailable" || N === "failed" || N === "disconnected") && _("disconnected");
1783
1783
  }
1784
1784
  }, p.bind("connected", y.connected), p.bind("connecting", y.connecting), p.bind("disconnected", y.disconnected), p.bind("unavailable", y.unavailable), p.bind("error", y.error), p.bind("state_change", y.stateChange);
1785
1785
  const B = p.state ?? null;
@@ -1792,35 +1792,35 @@ function ac(e = {}) {
1792
1792
  return;
1793
1793
  }
1794
1794
  (B === "unavailable" || B === "failed" || B === "disconnected") && _("disconnected");
1795
- }, Se = se(() => {
1796
- if (!d.value || !O.value)
1795
+ }, Se = re(() => {
1796
+ if (!d.value || !F.value)
1797
1797
  return null;
1798
- const B = Date.now() - d.value.getTime(), D = Math.floor(B / 6e4), q = Math.floor(B % 6e4 / 1e3);
1799
- return D > 0 ? `${D}m ${q}s` : `${q}s`;
1798
+ const B = Date.now() - d.value.getTime(), K = Math.floor(B / 6e4), N = Math.floor(B % 6e4 / 1e3);
1799
+ return K > 0 ? `${K}m ${N}s` : `${N}s`;
1800
1800
  });
1801
1801
  return jt(() => {
1802
- u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, he(), m = () => {
1803
- he(), L();
1804
- }, window.addEventListener(o.initializedEvent, m), L(), w = setInterval(() => {
1805
- L();
1802
+ u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), F.value && (d.value = /* @__PURE__ */ new Date()), X(u.value, u.value), v.value = !0, fe(), m = () => {
1803
+ fe(), I();
1804
+ }, window.addEventListener(o.initializedEvent, m), I(), w = setInterval(() => {
1805
+ I();
1806
1806
  }, 3e3);
1807
1807
  }), qe(() => {
1808
1808
  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;
1809
1809
  }), {
1810
- connectionStatus: se(() => u.value),
1811
- isConnected: O,
1812
- isConnecting: z,
1810
+ connectionStatus: re(() => u.value),
1811
+ isConnected: F,
1812
+ isConnecting: q,
1813
1813
  isDisconnected: J,
1814
- isError: W,
1814
+ isError: G,
1815
1815
  hasConnectionIssues: te,
1816
1816
  statusMessage: k,
1817
- statusColor: I,
1818
- statusIcon: K,
1819
- showConnectionBanner: se(() => h.value),
1820
- lastConnectionTime: se(() => d.value),
1817
+ statusColor: L,
1818
+ statusIcon: V,
1819
+ showConnectionBanner: re(() => h.value),
1820
+ lastConnectionTime: re(() => d.value),
1821
1821
  connectionUptime: Se,
1822
- reconnectAttempts: se(() => f.value),
1823
- reconnect: V
1822
+ reconnectAttempts: re(() => f.value),
1823
+ reconnect: H
1824
1824
  };
1825
1825
  }
1826
1826
  const xs = () => {
@@ -1837,16 +1837,28 @@ function ea() {
1837
1837
  }
1838
1838
  const Me = Zt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1839
1839
  function cc() {
1840
- const e = Qt(), n = ke()(), r = Yo(), o = Vt(), c = zi(), u = zt(), { conversations: d, requestConversations: f } = Ni(e), h = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map();
1840
+ const e = Qt(), n = ke()(), r = Yo(), o = Vt(), c = zi(), u = zt(), { conversations: d, requestConversations: f } = Ni(e), h = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map();
1841
1841
  let C = !1;
1842
1842
  function v(k) {
1843
- const I = P.get(k);
1844
- if (I && (P.delete(k), typeof I.channel.stopListening == "function"))
1845
- for (const K of I.bindings)
1846
- try {
1847
- I.channel.stopListening(K.event, K.handler);
1848
- } catch {
1849
- }
1843
+ const L = R.get(k);
1844
+ if (L) {
1845
+ if (R.delete(k), L.directBound) {
1846
+ const V = L.channel.subscription;
1847
+ if (V)
1848
+ for (const H of L.bindings)
1849
+ try {
1850
+ V.unbind(H.event, H.handler);
1851
+ } catch {
1852
+ }
1853
+ return;
1854
+ }
1855
+ if (typeof L.channel.stopListening == "function")
1856
+ for (const V of L.bindings)
1857
+ try {
1858
+ L.channel.stopListening(V.event, V.handler);
1859
+ } catch {
1860
+ }
1861
+ }
1850
1862
  }
1851
1863
  function E() {
1852
1864
  for (const k of h)
@@ -1854,84 +1866,96 @@ function cc() {
1854
1866
  h.clear();
1855
1867
  }
1856
1868
  function b(k) {
1857
- const I = Ae();
1858
- if (!I || h.has(k)) return;
1859
- const K = `conversation.${k}`;
1869
+ const L = Ae();
1870
+ if (!L || h.has(k)) return;
1871
+ const V = `conversation.${k}`;
1860
1872
  v(k);
1861
- const V = I.private(K), G = (D) => {
1862
- if (!Qi(D)) {
1863
- Me.warn("Dropping malformed ConversationMessageSent event", D);
1873
+ const H = L.private(V), X = (N) => {
1874
+ if (!Qi(N)) {
1875
+ Me.warn("Dropping malformed ConversationMessageSent event", N);
1864
1876
  return;
1865
1877
  }
1866
- const q = D, _e = n.currentUser?.id;
1867
- if (!_e || q.message.author_id === _e) return;
1868
- e.addMessage(q.message);
1869
- const M = e.hasDetailSubscription(q.conversation_id), F = sa(q.conversation_id);
1870
- if (M || F) {
1871
- const ie = e.getConversationById(q.conversation_id);
1872
- ie && (ie.unread_count = 0), e.markAsRead(q.conversation_id).catch(() => {
1878
+ const Y = N, M = n.currentUser?.id;
1879
+ if (!M || Y.message.author_id === M) return;
1880
+ e.addMessage(Y.message);
1881
+ const U = e.hasDetailSubscription(Y.conversation_id), ne = sa(Y.conversation_id);
1882
+ if (U || ne) {
1883
+ const oe = e.getConversationById(Y.conversation_id);
1884
+ oe && (oe.unread_count = 0), e.markAsRead(Y.conversation_id).catch(() => {
1873
1885
  });
1874
1886
  return;
1875
1887
  }
1876
- const Z = e.getConversationById(q.conversation_id);
1877
- if (Z) {
1878
- const ie = ra(Z);
1879
- ie || Z.unread_count++, r(ie);
1888
+ const ue = e.getConversationById(Y.conversation_id);
1889
+ if (ue) {
1890
+ const oe = ra(ue);
1891
+ oe || ue.unread_count++, r(oe);
1880
1892
  }
1881
- }, _ = (D) => {
1882
- if (!Yi(D)) {
1883
- Me.warn("Dropping malformed ConversationMessageRead event", D);
1893
+ }, _ = (N) => {
1894
+ if (!Yi(N)) {
1895
+ Me.warn("Dropping malformed ConversationMessageRead event", N);
1884
1896
  return;
1885
1897
  }
1886
- e.applyParticipantReadState(D);
1887
- }, L = (D) => {
1888
- if (!to(D)) {
1889
- Me.warn("Dropping malformed MessageReactionToggled event", D);
1898
+ e.applyParticipantReadState(N);
1899
+ }, I = (N) => {
1900
+ if (!to(N)) {
1901
+ Me.warn("Dropping malformed MessageReactionToggled event", N);
1890
1902
  return;
1891
1903
  }
1892
- const q = D;
1893
- e.updateMessageReactions(q.conversation_id, q.message_id, q.reactions);
1894
- }, he = (D) => {
1895
- if (!Zi(D)) {
1896
- Me.warn("Dropping malformed ConversationMessageEdited event", D);
1904
+ const Y = N;
1905
+ e.updateMessageReactions(Y.conversation_id, Y.message_id, Y.reactions);
1906
+ }, fe = (N) => {
1907
+ if (!Zi(N)) {
1908
+ Me.warn("Dropping malformed ConversationMessageEdited event", N);
1897
1909
  return;
1898
1910
  }
1899
- const q = D;
1911
+ const Y = N;
1900
1912
  e.applyMessageEdit(
1901
- q.conversation_id,
1902
- q.message.id,
1903
- q.message.body,
1904
- q.message.edited_at,
1905
- q.message.meta
1913
+ Y.conversation_id,
1914
+ Y.message.id,
1915
+ Y.message.body,
1916
+ Y.message.edited_at,
1917
+ Y.message.meta
1906
1918
  );
1907
- }, Se = (D) => {
1908
- if (!eo(D)) {
1909
- Me.warn("Dropping malformed ConversationMessageDeleted event", D);
1919
+ }, Se = (N) => {
1920
+ if (!eo(N)) {
1921
+ Me.warn("Dropping malformed ConversationMessageDeleted event", N);
1910
1922
  return;
1911
1923
  }
1912
- const q = D;
1913
- e.removeMessage(q.conversation_id, q.message_id);
1914
- }, B = (D) => {
1915
- if (!no(D)) {
1916
- Me.warn("Dropping malformed ConversationRequestAccepted event", D);
1924
+ const Y = N;
1925
+ e.removeMessage(Y.conversation_id, Y.message_id);
1926
+ }, B = (N) => {
1927
+ if (!no(N)) {
1928
+ Me.warn("Dropping malformed ConversationRequestAccepted event", N);
1917
1929
  return;
1918
1930
  }
1919
- const q = D, _e = e.getConversationById(q.conversation_id);
1920
- _e && (_e.is_request = !1), e.requests = e.requests.filter(
1921
- (M) => M.id !== q.conversation_id
1931
+ const Y = N, M = e.getConversationById(Y.conversation_id);
1932
+ M && (M.is_request = !1), e.requests = e.requests.filter(
1933
+ (U) => U.id !== Y.conversation_id
1922
1934
  );
1923
- };
1924
- V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", he), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), P.set(k, {
1925
- channel: V,
1935
+ }, K = H.subscription;
1936
+ K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", I), K.bind("ConversationRequestAccepted", B), R.set(k, {
1937
+ channel: H,
1938
+ directBound: !0,
1926
1939
  bindings: [
1927
- { event: ".ConversationMessageSent", handler: G },
1940
+ { event: "ConversationMessageSent", handler: X },
1941
+ { event: "ConversationMessageRead", handler: _ },
1942
+ { event: "ConversationMessageEdited", handler: fe },
1943
+ { event: "ConversationMessageDeleted", handler: Se },
1944
+ { event: "MessageReactionToggled", handler: I },
1945
+ { event: "ConversationRequestAccepted", handler: B }
1946
+ ]
1947
+ })) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", I), H.listen(".ConversationRequestAccepted", B), R.set(k, {
1948
+ channel: H,
1949
+ directBound: !1,
1950
+ bindings: [
1951
+ { event: ".ConversationMessageSent", handler: X },
1928
1952
  { event: ".ConversationMessageRead", handler: _ },
1929
- { event: ".ConversationMessageEdited", handler: he },
1953
+ { event: ".ConversationMessageEdited", handler: fe },
1930
1954
  { event: ".ConversationMessageDeleted", handler: Se },
1931
- { event: ".MessageReactionToggled", handler: L },
1955
+ { event: ".MessageReactionToggled", handler: I },
1932
1956
  { event: ".ConversationRequestAccepted", handler: B }
1933
1957
  ]
1934
- }), h.add(k), e.registerGlobalConversationSubscription(k);
1958
+ })), h.add(k), e.registerGlobalConversationSubscription(k);
1935
1959
  }
1936
1960
  function A() {
1937
1961
  const k = Ae();
@@ -1939,72 +1963,72 @@ function cc() {
1939
1963
  E();
1940
1964
  return;
1941
1965
  }
1942
- for (const I of h) {
1943
- v(I);
1966
+ for (const L of h) {
1967
+ v(L);
1944
1968
  try {
1945
- k.leave(`conversation.${I}`);
1969
+ k.leave(`conversation.${L}`);
1946
1970
  } catch {
1947
1971
  }
1948
- e.unregisterGlobalConversationSubscription(I);
1972
+ e.unregisterGlobalConversationSubscription(L);
1949
1973
  }
1950
1974
  h.clear();
1951
1975
  }
1952
1976
  function w() {
1953
1977
  const k = Ae();
1954
1978
  if (!k) return;
1955
- const I = (() => {
1956
- const V = [...e.conversations, ...e.requestConversations], G = /* @__PURE__ */ new Set(), _ = [];
1957
- for (const L of V)
1958
- if (!G.has(L.id) && (G.add(L.id), _.push(L), _.length >= ta))
1979
+ const L = (() => {
1980
+ const H = [...e.conversations, ...e.requestConversations], X = /* @__PURE__ */ new Set(), _ = [];
1981
+ for (const I of H)
1982
+ if (!X.has(I.id) && (X.add(I.id), _.push(I), _.length >= ta))
1959
1983
  break;
1960
1984
  return _;
1961
- })(), K = new Set(I.map((V) => V.id));
1962
- for (const V of h)
1963
- if (!K.has(V) && !e.hasDetailSubscription(V)) {
1985
+ })(), V = new Set(L.map((H) => H.id));
1986
+ for (const H of h)
1987
+ if (!V.has(H) && !e.hasDetailSubscription(H)) {
1964
1988
  try {
1965
- v(V), k.leave(`conversation.${V}`);
1989
+ v(H), k.leave(`conversation.${H}`);
1966
1990
  } catch {
1967
1991
  }
1968
- h.delete(V), e.unregisterGlobalConversationSubscription(V);
1992
+ h.delete(H), e.unregisterGlobalConversationSubscription(H);
1969
1993
  }
1970
- for (const V of I)
1971
- b(V.id);
1994
+ for (const H of L)
1995
+ b(H.id);
1972
1996
  }
1973
1997
  function p(k) {
1974
- const I = Nt({
1998
+ const L = Nt({
1975
1999
  status: k.status,
1976
2000
  last_seen_at: k.last_seen_at ?? null
1977
2001
  });
1978
- I.status !== null && e.updatePresenceForUser(
2002
+ L.status !== null && e.updatePresenceForUser(
1979
2003
  k.user_id,
1980
- I.status,
1981
- I.lastSeenAt
2004
+ L.status,
2005
+ L.lastSeenAt
1982
2006
  );
1983
2007
  }
1984
2008
  async function m() {
1985
2009
  const k = [...new Set(
1986
- e.conversations.filter((I) => I.type === "dm" && typeof I.other_user_id == "string" && I.other_user_id.length > 0).map((I) => I.other_user_id)
2010
+ e.conversations.filter((L) => L.type === "dm" && typeof L.other_user_id == "string" && L.other_user_id.length > 0).map((L) => L.other_user_id)
1987
2011
  )];
1988
2012
  if (k.length !== 0)
1989
2013
  try {
1990
- const I = await o.get("/v1/presence/users", {
2014
+ const L = await o.get("/v1/presence/users", {
1991
2015
  params: { ids: k }
1992
- }), K = I.data?.data?.items ?? I.data?.items ?? [];
1993
- for (const V of K) {
1994
- const G = Nt(V);
1995
- G.status !== null && e.updatePresenceForUser(V.id, G.status, G.lastSeenAt);
2016
+ }), V = L.data?.data?.items ?? L.data?.items ?? [];
2017
+ for (const H of V) {
2018
+ const X = Nt(H);
2019
+ X.status !== null && e.updatePresenceForUser(H.id, X.status, X.lastSeenAt);
1996
2020
  }
1997
- } catch (I) {
1998
- Me.warn("Failed to refresh messaging presence snapshot", I);
2021
+ } catch (L) {
2022
+ Me.warn("Failed to refresh messaging presence snapshot", L);
1999
2023
  }
2000
2024
  }
2001
2025
  function y() {
2002
2026
  !Ae() || C || (Hi(p), C = !0);
2003
2027
  }
2004
- function O() {
2028
+ function F() {
2005
2029
  C && (Bi(), C = !1);
2006
2030
  }
2007
- const z = ot(
2031
+ const q = ot(
2008
2032
  d,
2009
2033
  () => {
2010
2034
  w();
@@ -2016,24 +2040,24 @@ function cc() {
2016
2040
  w();
2017
2041
  },
2018
2042
  { deep: !1, immediate: !0 }
2019
- ), W = ot(
2043
+ ), G = ot(
2020
2044
  () => c.fullPath,
2021
2045
  () => {
2022
2046
  w();
2023
2047
  }
2024
2048
  ), te = ht((k) => {
2025
- k === "connected" ? (E(), w(), O(), y(), m()) : (k === "disconnected" || k === "error") && (E(), O());
2049
+ k === "connected" ? (E(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (E(), F());
2026
2050
  });
2027
2051
  w(), y(), m(), Ae() || ms().then((k) => {
2028
- k && (E(), w(), O(), y(), m());
2052
+ k && (E(), w(), F(), y(), m());
2029
2053
  }).catch((k) => {
2030
2054
  Me.warn("Failed to eagerly initialize messenger echo", k);
2031
2055
  }), u !== null && qe(() => {
2032
- z(), J(), W(), te(), A(), O();
2056
+ q(), J(), G(), te(), A(), F();
2033
2057
  });
2034
2058
  }
2035
2059
  function uc() {
2036
- const e = be(Ot());
2060
+ const e = ye(Ot());
2037
2061
  let n = null;
2038
2062
  return jt(() => {
2039
2063
  e.value = Ot(), n = ji((r) => {
@@ -2042,9 +2066,9 @@ function uc() {
2042
2066
  }), qe(() => {
2043
2067
  n?.(), n = null;
2044
2068
  }), {
2045
- accessState: se(() => e.value),
2046
- isBlocked: se(() => e.value !== "available"),
2047
- isSuspended: se(() => e.value === "account_suspended")
2069
+ accessState: re(() => e.value),
2070
+ isBlocked: re(() => e.value !== "available"),
2071
+ isSuspended: re(() => e.value === "account_suspended")
2048
2072
  };
2049
2073
  }
2050
2074
  const Ls = () => null, Is = {
@@ -2186,43 +2210,43 @@ function Ta(e, n, r) {
2186
2210
  }
2187
2211
  function lc() {
2188
2212
  const e = ke()(), n = ia(), r = Vt(), o = va(n.clientIdStorageKey);
2189
- let c = null, u = null, d = !1, f = It(n.accountLimitedUntilStorageKey), h = !1, P = !1, C = null, v = 0;
2213
+ let c = null, u = null, d = !1, f = It(n.accountLimitedUntilStorageKey), h = !1, R = !1, C = null, v = 0;
2190
2214
  const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
2191
2215
  c && (clearInterval(c), c = null);
2192
2216
  }, A = () => {
2193
2217
  u && (clearTimeout(u), u = null);
2194
2218
  }, w = () => {
2195
2219
  b(), c = setInterval(() => {
2196
- I();
2220
+ L();
2197
2221
  }, n.heartbeatIntervalMs);
2198
- }, p = (L) => {
2199
- f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
2200
- }, m = async (L) => {
2201
- if (!(!d || P || f || h) && E() && C !== L)
2222
+ }, p = (I) => {
2223
+ f || console.warn(I), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
2224
+ }, m = async (I) => {
2225
+ if (!(!d || R || f || h) && E() && C !== I)
2202
2226
  try {
2203
- await r.patch(n.statusUrl, { status: L }), C = L;
2204
- } catch (he) {
2205
- if (xt(he)) {
2227
+ await r.patch(n.statusUrl, { status: I }), C = I;
2228
+ } catch (fe) {
2229
+ if (xt(fe)) {
2206
2230
  p("[Presence] Presence updates paused: account is temporarily limited");
2207
2231
  return;
2208
2232
  }
2209
- Lt(he) && (h = !0, d = !1, C = null, b(), A());
2233
+ Lt(fe) && (h = !0, d = !1, C = null, b(), A());
2210
2234
  }
2211
2235
  }, y = () => {
2212
- A(), !(!d || P || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2236
+ A(), !(!d || R || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2213
2237
  u = null, m("idle");
2214
2238
  }, n.idleAfterMs));
2215
- }, O = () => {
2216
- if (P || !d || f || h || document.visibilityState !== "visible")
2239
+ }, F = () => {
2240
+ if (R || !d || f || h || document.visibilityState !== "visible")
2217
2241
  return;
2218
- const L = Date.now();
2219
- L - v < n.activityDebounceMs || (v = L, m("online"), y());
2220
- }, z = () => {
2221
- O();
2242
+ const I = Date.now();
2243
+ I - v < n.activityDebounceMs || (v = I, m("online"), y());
2244
+ }, q = () => {
2245
+ F();
2222
2246
  }, J = () => {
2223
- typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", z, { passive: !0 }), document.addEventListener("keydown", z), document.addEventListener("touchstart", z, { passive: !0 }), window.addEventListener("focus", z));
2224
- }, W = () => {
2225
- typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", z), document.removeEventListener("keydown", z), document.removeEventListener("touchstart", z), window.removeEventListener("focus", z));
2247
+ 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));
2248
+ }, G = () => {
2249
+ typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
2226
2250
  }, te = async () => {
2227
2251
  if (It(n.accountLimitedUntilStorageKey))
2228
2252
  return f = !0, "account_limited";
@@ -2231,134 +2255,134 @@ function lc() {
2231
2255
  client_id: o,
2232
2256
  user_agent: n.userAgentResolver()
2233
2257
  }), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
2234
- } catch (L) {
2235
- return xt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(L) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
2258
+ } catch (I) {
2259
+ return xt(I) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
2236
2260
  }
2237
2261
  }, k = async () => {
2238
- for (let L = 0; L < ga; L += 1)
2262
+ for (let I = 0; I < ga; I += 1)
2239
2263
  if (await te() !== "failed")
2240
2264
  return;
2241
2265
  console.warn("[Presence] Failed to open session");
2242
- }, I = async () => {
2266
+ }, L = async () => {
2243
2267
  if (d && E())
2244
2268
  try {
2245
2269
  await r.post(n.sessionHeartbeatUrl, { client_id: o });
2246
- } catch (L) {
2247
- if (xt(L)) {
2270
+ } catch (I) {
2271
+ if (xt(I)) {
2248
2272
  p("[Presence] Heartbeat paused: account is temporarily limited");
2249
2273
  return;
2250
2274
  }
2251
- Lt(L) && (h = !0, d = !1, C = null, b(), A());
2275
+ Lt(I) && (h = !0, d = !1, C = null, b(), A());
2252
2276
  }
2253
- }, K = () => {
2277
+ }, V = () => {
2254
2278
  if (!d)
2255
2279
  return;
2256
2280
  d = !1, C = null, A();
2257
- const L = Ta(
2281
+ const I = Ta(
2258
2282
  n.sessionCloseUrl,
2259
2283
  o,
2260
2284
  n.authTokenResolver()
2261
2285
  );
2262
- if (L) {
2263
- L.catch(() => {
2286
+ if (I) {
2287
+ I.catch(() => {
2264
2288
  });
2265
2289
  return;
2266
2290
  }
2267
2291
  r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
2268
2292
  });
2269
- }, V = async () => {
2270
- if (!P) {
2271
- if (await k(), P) {
2272
- K();
2293
+ }, H = async () => {
2294
+ if (!R) {
2295
+ if (await k(), R) {
2296
+ V();
2273
2297
  return;
2274
2298
  }
2275
2299
  d && (w(), m("online"), y());
2276
2300
  }
2277
- }, G = () => {
2278
- if (!P) {
2301
+ }, X = () => {
2302
+ if (!R) {
2279
2303
  if (document.visibilityState === "hidden") {
2280
- K(), b(), A();
2304
+ V(), b(), A();
2281
2305
  return;
2282
2306
  }
2283
2307
  if (document.visibilityState === "visible" && !d) {
2284
- f = It(n.accountLimitedUntilStorageKey), !f && !h && V();
2308
+ f = It(n.accountLimitedUntilStorageKey), !f && !h && H();
2285
2309
  return;
2286
2310
  }
2287
- document.visibilityState === "visible" && d && !f && !h && O();
2311
+ document.visibilityState === "visible" && d && !f && !h && F();
2288
2312
  }
2289
2313
  }, _ = () => {
2290
- P || (K(), b(), A());
2314
+ R || (V(), b(), A());
2291
2315
  };
2292
2316
  jt(async () => {
2293
2317
  if (e.isAuthenticated ?? e.currentUser !== null) {
2294
- if (await k(), P) {
2295
- K();
2318
+ if (await k(), R) {
2319
+ V();
2296
2320
  return;
2297
2321
  }
2298
- d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2322
+ d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", X), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2299
2323
  }
2300
2324
  }), qe(() => {
2301
- P = !0, W(), A(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2325
+ R = !0, G(), A(), b(), V(), document.removeEventListener("visibilitychange", X), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2302
2326
  });
2303
2327
  }
2304
2328
  const Ea = 12e3;
2305
2329
  function dc(e) {
2306
- const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = zt(), P = h !== null, C = 20, v = 250;
2330
+ const n = Qt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = zt(), R = h !== null, C = 20, v = 250;
2307
2331
  let E = !1, b = null, A = 0, w = null;
2308
- const p = se(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
2332
+ const p = re(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
2309
2333
  const M = u.value?.trim() ?? "";
2310
2334
  if (M.length > 0)
2311
2335
  return M;
2312
- const F = m();
2313
- return F.length > 0 && (u.value = F), F;
2314
- }, O = (M) => n.getTypingUsers(M), z = (M) => {
2315
- const F = O(M);
2316
- for (const Z of F)
2317
- n.removeTypingUser(M, Z.id);
2336
+ const U = m();
2337
+ return U.length > 0 && (u.value = U), U;
2338
+ }, F = (M) => n.getTypingUsers(M), q = (M) => {
2339
+ const U = F(M);
2340
+ for (const ne of U)
2341
+ n.removeTypingUser(M, ne.id);
2318
2342
  d.value = [];
2319
2343
  }, J = (M) => {
2320
- const F = f.get(M);
2321
- F && (clearTimeout(F), f.delete(M));
2322
- }, W = () => {
2344
+ const U = f.get(M);
2345
+ U && (clearTimeout(U), f.delete(M));
2346
+ }, G = () => {
2323
2347
  for (const M of f.values())
2324
2348
  clearTimeout(M);
2325
2349
  f.clear();
2326
2350
  }, te = () => {
2327
2351
  w && (clearTimeout(w), w = null), A = 0;
2328
2352
  }, k = () => {
2329
- !P || o.value || w || A >= C || (w = setTimeout(() => {
2330
- w = null, A += 1, G();
2353
+ !R || o.value || w || A >= C || (w = setTimeout(() => {
2354
+ w = null, A += 1, X();
2331
2355
  }, v));
2332
- }, I = (M, F) => {
2356
+ }, L = (M, U) => {
2333
2357
  J(M);
2334
- const Z = setTimeout(() => {
2335
- f.delete(M), n.removeTypingUser(F, M), d.value = d.value.filter((ie) => ie.id !== M);
2358
+ const ne = setTimeout(() => {
2359
+ f.delete(M), n.removeTypingUser(U, M), d.value = d.value.filter((ue) => ue.id !== M);
2336
2360
  }, Ea);
2337
- f.set(M, Z);
2338
- }, K = () => {
2361
+ f.set(M, ne);
2362
+ }, V = () => {
2339
2363
  E = !0, te();
2340
- }, V = (M) => {
2364
+ }, H = (M) => {
2341
2365
  try {
2342
2366
  b && (b(), b = null), b = Wi(M, {
2343
- onTypingStart: L,
2344
- onTypingStop: he
2367
+ onTypingStart: I,
2368
+ onTypingStop: fe
2345
2369
  }), te(), o.value = !0, u.value = M;
2346
- } catch (F) {
2347
- c.value = F instanceof Error ? F.message : "Failed to subscribe to typing channel";
2370
+ } catch (U) {
2371
+ c.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
2348
2372
  }
2349
- }, G = () => {
2373
+ }, X = () => {
2350
2374
  const M = m();
2351
2375
  if (!(o.value || !M)) {
2352
2376
  if (c.value = null, Ae() && Rn() === "connected") {
2353
- V(M);
2377
+ H(M);
2354
2378
  return;
2355
2379
  }
2356
- E = !1, ms().then((F) => {
2357
- if (E || o.value || !F)
2380
+ E = !1, ms().then((U) => {
2381
+ if (E || o.value || !U)
2358
2382
  return;
2359
- const Z = m();
2360
- if (Z && Z === M && Ae() && Rn() === "connected") {
2361
- V(Z);
2383
+ const ne = m();
2384
+ if (ne && ne === M && Ae() && Rn() === "connected") {
2385
+ H(ne);
2362
2386
  return;
2363
2387
  }
2364
2388
  k();
@@ -2366,88 +2390,88 @@ function dc(e) {
2366
2390
  }
2367
2391
  }, _ = () => {
2368
2392
  const M = u.value;
2369
- if (K(), !(!o.value || !M))
2393
+ if (V(), !(!o.value || !M))
2370
2394
  try {
2371
- b && (b(), b = null), Gi(M), W(), z(M), o.value = !1, u.value = null, c.value = null;
2372
- } catch (F) {
2373
- c.value = F instanceof Error ? F.message : "Failed to unsubscribe from typing channel";
2395
+ b && (b(), b = null), Gi(M), G(), q(M), o.value = !1, u.value = null, c.value = null;
2396
+ } catch (U) {
2397
+ c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
2374
2398
  }
2375
2399
  };
2376
- function L(M) {
2400
+ function I(M) {
2377
2401
  if (M.user_id === p.value)
2378
2402
  return;
2379
- const F = y();
2380
- if (!F)
2403
+ const U = y();
2404
+ if (!U)
2381
2405
  return;
2382
- const Z = {
2406
+ const ne = {
2383
2407
  id: M.user.id,
2384
2408
  name: M.user.name,
2385
2409
  ...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
2386
2410
  };
2387
- d.value.some((ie) => ie.id === Z.id) || (d.value = [...d.value, Z]), n.addTypingUser(F, Z), I(M.user_id, F);
2411
+ d.value.some((ue) => ue.id === ne.id) || (d.value = [...d.value, ne]), n.addTypingUser(U, ne), L(M.user_id, U);
2388
2412
  }
2389
- function he(M) {
2413
+ function fe(M) {
2390
2414
  if (M.user_id === p.value)
2391
2415
  return;
2392
2416
  J(M.user_id);
2393
- const F = y();
2394
- F && (d.value = d.value.filter((Z) => Z.id !== M.user_id), n.removeTypingUser(F, M.user_id));
2417
+ const U = y();
2418
+ U && (d.value = d.value.filter((ne) => ne.id !== M.user_id), n.removeTypingUser(U, M.user_id));
2395
2419
  }
2396
- const Se = se(() => {
2420
+ const Se = re(() => {
2397
2421
  const M = y();
2398
2422
  if (!M)
2399
2423
  return d.value;
2400
- const F = O(M);
2424
+ const U = F(M);
2401
2425
  if (d.value.length === 0)
2402
- return F;
2403
- if (F.length === 0)
2426
+ return U;
2427
+ if (U.length === 0)
2404
2428
  return d.value;
2405
- const Z = /* @__PURE__ */ new Map();
2406
- for (const ie of F)
2407
- Z.set(ie.id, ie);
2408
- for (const ie of d.value)
2409
- Z.set(ie.id, ie);
2410
- return [...Z.values()];
2411
- }), B = se(() => {
2429
+ const ne = /* @__PURE__ */ new Map();
2430
+ for (const ue of U)
2431
+ ne.set(ue.id, ue);
2432
+ for (const ue of d.value)
2433
+ ne.set(ue.id, ue);
2434
+ return [...ne.values()];
2435
+ }), B = re(() => {
2412
2436
  const M = Se.value;
2413
2437
  if (M.length === 0)
2414
2438
  return "";
2415
- const F = M[0];
2416
- if (!F)
2439
+ const U = M[0];
2440
+ if (!U)
2417
2441
  return "";
2418
2442
  if (M.length === 1)
2419
- return `${F.name} is typing...`;
2420
- const Z = M[1];
2421
- if (!Z)
2443
+ return `${U.name} is typing...`;
2444
+ const ne = M[1];
2445
+ if (!ne)
2422
2446
  return `${M.length} people are typing...`;
2423
2447
  if (M.length === 2)
2424
- return `${F.name} and ${Z.name} are typing...`;
2425
- const ie = M[2];
2426
- return ie ? M.length === 3 ? `${F.name}, ${Z.name} and ${ie.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
2427
- }), D = se(() => Se.value.length > 0), q = () => {
2428
- m() && (b && (b(), b = null), o.value = !1, u.value = null, G());
2448
+ return `${U.name} and ${ne.name} are typing...`;
2449
+ const ue = M[2];
2450
+ return ue ? M.length === 3 ? `${U.name}, ${ne.name} and ${ue.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
2451
+ }), K = re(() => Se.value.length > 0), N = () => {
2452
+ m() && (b && (b(), b = null), o.value = !1, u.value = null, X());
2429
2453
  };
2430
- typeof window < "u" && window.addEventListener(Je(), q);
2431
- const _e = ht((M) => {
2454
+ typeof window < "u" && window.addEventListener(Je(), N);
2455
+ const Y = ht((M) => {
2432
2456
  if (M === "connected") {
2433
- o.value || G();
2457
+ o.value || X();
2434
2458
  return;
2435
2459
  }
2436
2460
  if (M === "disconnected" || M === "error") {
2437
- K(), b && (b(), b = null);
2438
- const F = y();
2439
- F && z(F), o.value = !1, u.value = null, W();
2461
+ V(), b && (b(), b = null);
2462
+ const U = y();
2463
+ U && q(U), o.value = !1, u.value = null, G();
2440
2464
  }
2441
2465
  });
2442
2466
  return h !== null && qe(() => {
2443
- K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(Je(), q);
2467
+ V(), Y(), G(), _(), typeof window < "u" && window.removeEventListener(Je(), N);
2444
2468
  }), {
2445
- isSubscribed: se(() => o.value),
2446
- error: se(() => c.value),
2469
+ isSubscribed: re(() => o.value),
2470
+ error: re(() => c.value),
2447
2471
  typingUsers: Se,
2448
2472
  formatTypingIndicator: B,
2449
- hasTypingUsers: D,
2450
- subscribe: G,
2473
+ hasTypingUsers: K,
2474
+ subscribe: X,
2451
2475
  unsubscribe: _
2452
2476
  };
2453
2477
  }
@@ -3434,8 +3458,8 @@ function Oa() {
3434
3458
  }, c.t = function(u, d) {
3435
3459
  if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
3436
3460
  var f = /* @__PURE__ */ Object.create(null);
3437
- if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(P) {
3438
- return u[P];
3461
+ 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) {
3462
+ return u[R];
3439
3463
  }).bind(null, h));
3440
3464
  return f;
3441
3465
  }, c.n = function(u) {
@@ -3460,10 +3484,10 @@ function Oa() {
3460
3484
  (function(r, o, c) {
3461
3485
  var u = this && this.__extends || /* @__PURE__ */ (function() {
3462
3486
  var w = function(p, m) {
3463
- return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, O) {
3464
- y.__proto__ = O;
3465
- } || function(y, O) {
3466
- for (var z in O) O.hasOwnProperty(z) && (y[z] = O[z]);
3487
+ return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, F) {
3488
+ y.__proto__ = F;
3489
+ } || function(y, F) {
3490
+ for (var q in F) F.hasOwnProperty(q) && (y[q] = F[q]);
3467
3491
  }, w(p, m);
3468
3492
  };
3469
3493
  return function(p, m) {
@@ -3485,13 +3509,13 @@ function Oa() {
3485
3509
  return this._paddingCharacter ? (p + 2) / 3 * 4 | 0 : (p * 8 + 5) / 6 | 0;
3486
3510
  }, w.prototype.encode = function(p) {
3487
3511
  for (var m = "", y = 0; y < p.length - 2; y += 3) {
3488
- var O = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
3489
- m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), m += this._encodeByte(O >>> 6 & 63), m += this._encodeByte(O >>> 0 & 63);
3512
+ var F = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
3513
+ m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), m += this._encodeByte(F >>> 6 & 63), m += this._encodeByte(F >>> 0 & 63);
3490
3514
  }
3491
- var z = p.length - y;
3492
- if (z > 0) {
3493
- var O = p[y] << 16 | (z === 2 ? p[y + 1] << 8 : 0);
3494
- 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 || "";
3515
+ var q = p.length - y;
3516
+ if (q > 0) {
3517
+ var F = p[y] << 16 | (q === 2 ? p[y + 1] << 8 : 0);
3518
+ m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), q === 2 ? m += this._encodeByte(F >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
3495
3519
  }
3496
3520
  return m;
3497
3521
  }, w.prototype.maxDecodedLength = function(p) {
@@ -3501,11 +3525,11 @@ function Oa() {
3501
3525
  }, w.prototype.decode = function(p) {
3502
3526
  if (p.length === 0)
3503
3527
  return new Uint8Array(0);
3504
- 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)
3505
- te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)), I = this._decodeChar(p.charCodeAt(J + 2)), K = this._decodeChar(p.charCodeAt(J + 3)), O[z++] = te << 2 | k >>> 4, O[z++] = k << 4 | I >>> 2, O[z++] = I << 6 | K, W |= te & d, W |= k & d, W |= I & d, W |= K & d;
3506
- 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)
3528
+ for (var m = this._getPaddingLength(p), y = p.length - m, F = new Uint8Array(this.maxDecodedLength(y)), q = 0, J = 0, G = 0, te = 0, k = 0, L = 0, V = 0; J < y - 4; J += 4)
3529
+ te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)), L = this._decodeChar(p.charCodeAt(J + 2)), V = this._decodeChar(p.charCodeAt(J + 3)), F[q++] = te << 2 | k >>> 4, F[q++] = k << 4 | L >>> 2, F[q++] = L << 6 | V, G |= te & d, G |= k & d, G |= L & d, G |= V & d;
3530
+ if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), F[q++] = te << 2 | k >>> 4, G |= te & d, G |= k & d), J < y - 2 && (L = this._decodeChar(p.charCodeAt(J + 2)), F[q++] = k << 4 | L >>> 2, G |= L & d), J < y - 3 && (V = this._decodeChar(p.charCodeAt(J + 3)), F[q++] = L << 6 | V, G |= V & d), G !== 0)
3507
3531
  throw new Error("Base64Coder: incorrect characters for decoding");
3508
- return O;
3532
+ return F;
3509
3533
  }, w.prototype._encodeByte = function(p) {
3510
3534
  var m = p;
3511
3535
  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);
@@ -3526,10 +3550,10 @@ function Oa() {
3526
3550
  );
3527
3551
  o.Coder = f;
3528
3552
  var h = new f();
3529
- function P(w) {
3553
+ function R(w) {
3530
3554
  return h.encode(w);
3531
3555
  }
3532
- o.encode = P;
3556
+ o.encode = R;
3533
3557
  function C(w) {
3534
3558
  return h.decode(w);
3535
3559
  }
@@ -3599,7 +3623,7 @@ function Oa() {
3599
3623
  return v;
3600
3624
  }
3601
3625
  o.encodedLength = h;
3602
- function P(C) {
3626
+ function R(C) {
3603
3627
  for (var v = [], E = 0; E < C.length; E++) {
3604
3628
  var b = C[E];
3605
3629
  if (b & 128) {
@@ -3639,7 +3663,7 @@ function Oa() {
3639
3663
  }
3640
3664
  return v.join("");
3641
3665
  }
3642
- o.decode = P;
3666
+ o.decode = R;
3643
3667
  }),
3644
3668
  /* 2 */
3645
3669
  /***/
@@ -3693,7 +3717,7 @@ function Oa() {
3693
3717
  cdn_https: "https://js.pusher.com",
3694
3718
  dependency_suffix: ""
3695
3719
  }, h = f;
3696
- class P {
3720
+ class R {
3697
3721
  constructor(t) {
3698
3722
  this.options = t, this.receivers = t.receivers || d, this.loading = {};
3699
3723
  }
@@ -3703,28 +3727,28 @@ function Oa() {
3703
3727
  l.loading[t].push(a);
3704
3728
  else {
3705
3729
  l.loading[t] = [a];
3706
- var g = $.createScriptRequest(l.getPath(t, s)), S = l.receivers.create(function(x) {
3730
+ var g = j.createScriptRequest(l.getPath(t, s)), S = l.receivers.create(function(x) {
3707
3731
  if (l.receivers.remove(S), l.loading[t]) {
3708
- var j = l.loading[t];
3732
+ var z = l.loading[t];
3709
3733
  delete l.loading[t];
3710
- for (var Q = function(ue) {
3711
- ue || g.cleanup();
3712
- }, ee = 0; ee < j.length; ee++)
3713
- j[ee](x, Q);
3734
+ for (var Q = function(de) {
3735
+ de || g.cleanup();
3736
+ }, ee = 0; ee < z.length; ee++)
3737
+ z[ee](x, Q);
3714
3738
  }
3715
3739
  });
3716
3740
  g.send(S);
3717
3741
  }
3718
3742
  }
3719
3743
  getRoot(t) {
3720
- var s, a = $.getDocument().location.protocol;
3744
+ var s, a = j.getDocument().location.protocol;
3721
3745
  return t && t.useTLS || a === "https:" ? s = this.options.cdn_https : s = this.options.cdn_http, s.replace(/\/*$/, "") + "/" + this.options.version;
3722
3746
  }
3723
3747
  getPath(t, s) {
3724
3748
  return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
3725
3749
  }
3726
3750
  }
3727
- var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
3751
+ var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new R({
3728
3752
  cdn_http: h.cdn_http,
3729
3753
  cdn_https: h.cdn_https,
3730
3754
  version: h.VERSION,
@@ -3776,12 +3800,12 @@ function Oa() {
3776
3800
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3777
3801
  }
3778
3802
  }
3779
- class O extends Error {
3803
+ class F extends Error {
3780
3804
  constructor(t) {
3781
3805
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3782
3806
  }
3783
3807
  }
3784
- class z extends Error {
3808
+ class q extends Error {
3785
3809
  constructor(t) {
3786
3810
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3787
3811
  }
@@ -3791,7 +3815,7 @@ function Oa() {
3791
3815
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3792
3816
  }
3793
3817
  }
3794
- class W extends Error {
3818
+ class G extends Error {
3795
3819
  constructor(t) {
3796
3820
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3797
3821
  }
@@ -3806,8 +3830,8 @@ function Oa() {
3806
3830
  super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
3807
3831
  }
3808
3832
  }
3809
- var K = function(i, t, s, a, l) {
3810
- const g = $.createXHR();
3833
+ var V = function(i, t, s, a, l) {
3834
+ const g = j.createXHR();
3811
3835
  g.open("POST", s.endpoint, !0), g.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
3812
3836
  for (var S in s.headers)
3813
3837
  g.setRequestHeader(S, s.headers[S]);
@@ -3819,13 +3843,13 @@ function Oa() {
3819
3843
  return g.onreadystatechange = function() {
3820
3844
  if (g.readyState === 4)
3821
3845
  if (g.status === 200) {
3822
- let x, j = !1;
3846
+ let x, z = !1;
3823
3847
  try {
3824
- x = JSON.parse(g.responseText), j = !0;
3848
+ x = JSON.parse(g.responseText), z = !0;
3825
3849
  } catch {
3826
3850
  l(new k(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${g.responseText}`), null);
3827
3851
  }
3828
- j && l(null, x);
3852
+ z && l(null, x);
3829
3853
  } else {
3830
3854
  let x = "";
3831
3855
  switch (a) {
@@ -3840,14 +3864,14 @@ function Oa() {
3840
3864
  }
3841
3865
  }, g.send(t), g;
3842
3866
  };
3843
- function V(i) {
3844
- return B(he(i));
3867
+ function H(i) {
3868
+ return B(fe(i));
3845
3869
  }
3846
- var G = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = function(i) {
3870
+ var X = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(i) {
3847
3871
  var t = i.charCodeAt(0);
3848
- return t < 128 ? i : t < 2048 ? G(192 | t >>> 6) + G(128 | t & 63) : G(224 | t >>> 12 & 15) + G(128 | t >>> 6 & 63) + G(128 | t & 63);
3849
- }, he = function(i) {
3850
- return i.replace(/[^\x00-\x7F]/g, L);
3872
+ return t < 128 ? i : t < 2048 ? X(192 | t >>> 6) + X(128 | t & 63) : X(224 | t >>> 12 & 15) + X(128 | t >>> 6 & 63) + X(128 | t & 63);
3873
+ }, fe = function(i) {
3874
+ return i.replace(/[^\x00-\x7F]/g, I);
3851
3875
  }, Se = function(i) {
3852
3876
  var t = [0, 2, 1][i.length % 3], s = i.charCodeAt(0) << 16 | (i.length > 1 ? i.charCodeAt(1) : 0) << 8 | (i.length > 2 ? i.charCodeAt(2) : 0), a = [
3853
3877
  _.charAt(s >>> 18),
@@ -3859,7 +3883,7 @@ function Oa() {
3859
3883
  }, B = window.btoa || function(i) {
3860
3884
  return i.replace(/[\s\S]{1,3}/g, Se);
3861
3885
  };
3862
- class D {
3886
+ class K {
3863
3887
  constructor(t, s, a, l) {
3864
3888
  this.clear = s, this.timer = t(() => {
3865
3889
  this.timer && (this.timer = l(this.timer));
@@ -3872,33 +3896,33 @@ function Oa() {
3872
3896
  this.timer && (this.clear(this.timer), this.timer = null);
3873
3897
  }
3874
3898
  }
3875
- var q = D;
3876
- function _e(i) {
3899
+ var N = K;
3900
+ function Y(i) {
3877
3901
  window.clearTimeout(i);
3878
3902
  }
3879
3903
  function M(i) {
3880
3904
  window.clearInterval(i);
3881
3905
  }
3882
- class F extends q {
3906
+ class U extends N {
3883
3907
  constructor(t, s) {
3884
- super(setTimeout, _e, t, function(a) {
3908
+ super(setTimeout, Y, t, function(a) {
3885
3909
  return s(), null;
3886
3910
  });
3887
3911
  }
3888
3912
  }
3889
- class Z extends q {
3913
+ class ne extends N {
3890
3914
  constructor(t, s) {
3891
3915
  super(setInterval, M, t, function(a) {
3892
3916
  return s(), a;
3893
3917
  });
3894
3918
  }
3895
3919
  }
3896
- var ie = {
3920
+ var ue = {
3897
3921
  now() {
3898
3922
  return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
3899
3923
  },
3900
3924
  defer(i) {
3901
- return new F(0, i);
3925
+ return new U(0, i);
3902
3926
  },
3903
3927
  method(i, ...t) {
3904
3928
  var s = Array.prototype.slice.call(arguments, 1);
@@ -3906,12 +3930,12 @@ function Oa() {
3906
3930
  return a[i].apply(a, s.concat(arguments));
3907
3931
  };
3908
3932
  }
3909
- }, fe = ie;
3910
- function me(i, ...t) {
3933
+ }, oe = ue;
3934
+ function ve(i, ...t) {
3911
3935
  for (var s = 0; s < t.length; s++) {
3912
3936
  var a = t[s];
3913
3937
  for (var l in a)
3914
- a[l] && a[l].constructor && a[l].constructor === Object ? i[l] = me(i[l] || {}, a[l]) : i[l] = a[l];
3938
+ a[l] && a[l].constructor && a[l].constructor === Object ? i[l] = ve(i[l] || {}, a[l]) : i[l] = a[l];
3915
3939
  }
3916
3940
  return i;
3917
3941
  }
@@ -3935,34 +3959,34 @@ function Oa() {
3935
3959
  for (var s in i)
3936
3960
  Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
3937
3961
  }
3938
- function R(i) {
3962
+ function P(i) {
3939
3963
  var t = [];
3940
3964
  return T(i, function(s, a) {
3941
3965
  t.push(a);
3942
3966
  }), t;
3943
3967
  }
3944
- function N(i) {
3968
+ function D(i) {
3945
3969
  var t = [];
3946
3970
  return T(i, function(s) {
3947
3971
  t.push(s);
3948
3972
  }), t;
3949
3973
  }
3950
- function U(i, t, s) {
3974
+ function O(i, t, s) {
3951
3975
  for (var a = 0; a < i.length; a++)
3952
3976
  t.call(s || window, i[a], a, i);
3953
3977
  }
3954
- function ne(i, t) {
3978
+ function se(i, t) {
3955
3979
  for (var s = [], a = 0; a < i.length; a++)
3956
3980
  s.push(t(i[a], a, i, s));
3957
3981
  return s;
3958
3982
  }
3959
- function oe(i, t) {
3983
+ function ae(i, t) {
3960
3984
  var s = {};
3961
3985
  return T(i, function(a, l) {
3962
3986
  s[l] = t(a);
3963
3987
  }), s;
3964
3988
  }
3965
- function ce(i, t) {
3989
+ function le(i, t) {
3966
3990
  t = t || function(l) {
3967
3991
  return !!l;
3968
3992
  };
@@ -3988,27 +4012,27 @@ function Oa() {
3988
4012
  return !0;
3989
4013
  return !1;
3990
4014
  }
3991
- function pe(i, t) {
4015
+ function ge(i, t) {
3992
4016
  for (var s = 0; s < i.length; s++)
3993
4017
  if (!t(i[s], s, i))
3994
4018
  return !1;
3995
4019
  return !0;
3996
4020
  }
3997
- function ve(i) {
3998
- return oe(i, function(t) {
3999
- return typeof t == "object" && (t = Qe(t)), encodeURIComponent(V(t.toString()));
4021
+ function be(i) {
4022
+ return ae(i, function(t) {
4023
+ return typeof t == "object" && (t = Qe(t)), encodeURIComponent(H(t.toString()));
4000
4024
  });
4001
4025
  }
4002
4026
  function Hs(i) {
4003
4027
  var t = Re(i, function(a) {
4004
4028
  return a !== void 0;
4005
- }), s = ne(Le(ve(t)), fe.method("join", "=")).join("&");
4029
+ }), s = se(Le(be(t)), oe.method("join", "=")).join("&");
4006
4030
  return s;
4007
4031
  }
4008
4032
  function Bs(i) {
4009
4033
  var t = [], s = [];
4010
4034
  return (function a(l, g) {
4011
- var S, x, j;
4035
+ var S, x, z;
4012
4036
  switch (typeof l) {
4013
4037
  case "object":
4014
4038
  if (!l)
@@ -4017,14 +4041,14 @@ function Oa() {
4017
4041
  if (t[S] === l)
4018
4042
  return { $ref: s[S] };
4019
4043
  if (t.push(l), s.push(g), Object.prototype.toString.apply(l) === "[object Array]")
4020
- for (j = [], S = 0; S < l.length; S += 1)
4021
- j[S] = a(l[S], g + "[" + S + "]");
4044
+ for (z = [], S = 0; S < l.length; S += 1)
4045
+ z[S] = a(l[S], g + "[" + S + "]");
4022
4046
  else {
4023
- j = {};
4047
+ z = {};
4024
4048
  for (x in l)
4025
- Object.prototype.hasOwnProperty.call(l, x) && (j[x] = a(l[x], g + "[" + JSON.stringify(x) + "]"));
4049
+ Object.prototype.hasOwnProperty.call(l, x) && (z[x] = a(l[x], g + "[" + JSON.stringify(x) + "]"));
4026
4050
  }
4027
- return j;
4051
+ return z;
4028
4052
  case "number":
4029
4053
  case "string":
4030
4054
  case "boolean":
@@ -4065,16 +4089,16 @@ function Oa() {
4065
4089
  Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
4066
4090
  }
4067
4091
  }
4068
- var ae = new Vs(), Xs = function(i, t, s, a, l) {
4069
- (s.headers !== void 0 || s.headersProvider != null) && ae.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
4092
+ var ce = new Vs(), Xs = function(i, t, s, a, l) {
4093
+ (s.headers !== void 0 || s.headersProvider != null) && ce.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
4070
4094
  var g = i.nextAuthCallbackID.toString();
4071
4095
  i.nextAuthCallbackID++;
4072
4096
  var S = i.getDocument(), x = S.createElement("script");
4073
4097
  i.auth_callbacks[g] = function(ee) {
4074
4098
  l(null, ee);
4075
4099
  };
4076
- var j = "Pusher.auth_callbacks['" + g + "']";
4077
- x.src = s.endpoint + "?callback=" + encodeURIComponent(j) + "&" + t;
4100
+ var z = "Pusher.auth_callbacks['" + g + "']";
4101
+ x.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
4078
4102
  var Q = S.getElementsByTagName("head")[0] || S.documentElement;
4079
4103
  Q.insertBefore(x, Q.firstChild);
4080
4104
  }, Ws = Xs;
@@ -4105,7 +4129,7 @@ function Oa() {
4105
4129
  send(t) {
4106
4130
  if (!this.request) {
4107
4131
  var s = Hs(this.data), a = this.url + "/" + t.number + "?" + s;
4108
- this.request = $.createScriptRequest(a), this.request.send(t);
4132
+ this.request = j.createScriptRequest(a), this.request.send(t);
4109
4133
  }
4110
4134
  }
4111
4135
  cleanup() {
@@ -4114,8 +4138,8 @@ function Oa() {
4114
4138
  }
4115
4139
  var Ks = function(i, t) {
4116
4140
  return function(s, a) {
4117
- var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = $.createJSONPRequest(g, s), x = $.ScriptReceivers.create(function(j, Q) {
4118
- d.remove(x), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(j, Q);
4141
+ var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = j.createJSONPRequest(g, s), x = j.ScriptReceivers.create(function(z, Q) {
4142
+ d.remove(x), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(z, Q);
4119
4143
  });
4120
4144
  S.send(x);
4121
4145
  };
@@ -4168,18 +4192,18 @@ function Oa() {
4168
4192
  this._callbacks = {};
4169
4193
  return;
4170
4194
  }
4171
- var l = t ? [mt(t)] : R(this._callbacks);
4195
+ var l = t ? [mt(t)] : P(this._callbacks);
4172
4196
  s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
4173
4197
  }
4174
4198
  removeCallback(t, s, a) {
4175
- U(t, function(l) {
4176
- this._callbacks[l] = ce(this._callbacks[l] || [], function(g) {
4199
+ O(t, function(l) {
4200
+ this._callbacks[l] = le(this._callbacks[l] || [], function(g) {
4177
4201
  return s && s !== g.fn || a && a !== g.context;
4178
4202
  }), this._callbacks[l].length === 0 && delete this._callbacks[l];
4179
4203
  }, this);
4180
4204
  }
4181
4205
  removeAllCallbacks(t) {
4182
- U(t, function(s) {
4206
+ O(t, function(s) {
4183
4207
  delete this._callbacks[s];
4184
4208
  }, this);
4185
4209
  }
@@ -4201,7 +4225,7 @@ function Oa() {
4201
4225
  return this.callbacks.remove(t, s, a), this;
4202
4226
  }
4203
4227
  unbind_global(t) {
4204
- return t ? (this.global_callbacks = ce(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
4228
+ return t ? (this.global_callbacks = le(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
4205
4229
  }
4206
4230
  unbind_all() {
4207
4231
  return this.unbind(), this.unbind_global(), this;
@@ -4219,7 +4243,7 @@ function Oa() {
4219
4243
  }
4220
4244
  class sr extends Te {
4221
4245
  constructor(t, s, a, l, g) {
4222
- super(), this.initialize = $.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = l, this.options = g, this.state = "new", this.timeline = g.timeline, this.activityTimeout = g.activityTimeout, this.id = this.timeline.generateUniqueID();
4246
+ super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = l, this.options = g, this.state = "new", this.timeline = g.timeline, this.activityTimeout = g.activityTimeout, this.id = this.timeline.generateUniqueID();
4223
4247
  }
4224
4248
  handlesActivityChecks() {
4225
4249
  return !!this.hooks.handlesActivityChecks;
@@ -4234,17 +4258,17 @@ function Oa() {
4234
4258
  try {
4235
4259
  this.socket = this.hooks.getSocket(t, this.options);
4236
4260
  } catch (s) {
4237
- return fe.defer(() => {
4261
+ return oe.defer(() => {
4238
4262
  this.onError(s), this.changeState("closed");
4239
4263
  }), !1;
4240
4264
  }
4241
- return this.bindListeners(), ae.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
4265
+ return this.bindListeners(), ce.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
4242
4266
  }
4243
4267
  close() {
4244
4268
  return this.socket ? (this.socket.close(), !0) : !1;
4245
4269
  }
4246
4270
  send(t) {
4247
- return this.state === "open" ? (fe.defer(() => {
4271
+ return this.state === "open" ? (oe.defer(() => {
4248
4272
  this.socket && this.socket.send(t);
4249
4273
  }), !0) : !1;
4250
4274
  }
@@ -4293,7 +4317,7 @@ function Oa() {
4293
4317
  })), this.emit(t, s);
4294
4318
  }
4295
4319
  buildTimelineMessage(t) {
4296
- return me({ cid: this.id }, t);
4320
+ return ve({ cid: this.id }, t);
4297
4321
  }
4298
4322
  }
4299
4323
  class De {
@@ -4312,13 +4336,13 @@ function Oa() {
4312
4336
  handlesActivityChecks: !1,
4313
4337
  supportsPing: !1,
4314
4338
  isInitialized: function() {
4315
- return !!$.getWebSocketAPI();
4339
+ return !!j.getWebSocketAPI();
4316
4340
  },
4317
4341
  isSupported: function() {
4318
- return !!$.getWebSocketAPI();
4342
+ return !!j.getWebSocketAPI();
4319
4343
  },
4320
4344
  getSocket: function(i) {
4321
- return $.createWebSocket(i);
4345
+ return j.createWebSocket(i);
4322
4346
  }
4323
4347
  }), on = {
4324
4348
  urls: er,
@@ -4327,19 +4351,19 @@ function Oa() {
4327
4351
  isInitialized: function() {
4328
4352
  return !0;
4329
4353
  }
4330
- }, an = me({
4354
+ }, an = ve({
4331
4355
  getSocket: function(i) {
4332
- return $.HTTPFactory.createStreamingSocket(i);
4356
+ return j.HTTPFactory.createStreamingSocket(i);
4333
4357
  }
4334
- }, on), cn = me({
4358
+ }, on), cn = ve({
4335
4359
  getSocket: function(i) {
4336
- return $.HTTPFactory.createPollingSocket(i);
4360
+ return j.HTTPFactory.createPollingSocket(i);
4337
4361
  }
4338
4362
  }, on), un = {
4339
4363
  isSupported: function() {
4340
- return $.isXHRSupported();
4364
+ return j.isXHRSupported();
4341
4365
  }
4342
- }, ir = new De(me({}, an, un)), or = new De(me({}, cn, un)), ar = {
4366
+ }, ir = new De(ve({}, an, un)), or = new De(ve({}, cn, un)), ar = {
4343
4367
  ws: rr,
4344
4368
  xhr_streaming: ir,
4345
4369
  xhr_polling: or
@@ -4369,10 +4393,10 @@ function Oa() {
4369
4393
  }
4370
4394
  }), ln = {
4371
4395
  isSupported: function(i) {
4372
- var t = $.isXDRSupported(i.useTLS);
4396
+ var t = j.isXDRSupported(i.useTLS);
4373
4397
  return t;
4374
4398
  }
4375
- }, ur = new De(me({}, an, ln)), lr = new De(me({}, cn, ln));
4399
+ }, ur = new De(ve({}, an, ln)), lr = new De(ve({}, cn, ln));
4376
4400
  Ye.xdr_streaming = ur, Ye.xdr_polling = lr, Ye.sockjs = cr;
4377
4401
  var dr = Ye;
4378
4402
  class hr extends Te {
@@ -4395,16 +4419,16 @@ function Oa() {
4395
4419
  this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
4396
4420
  }
4397
4421
  createConnection(t, s, a, l) {
4398
- l = me({}, l, {
4422
+ l = ve({}, l, {
4399
4423
  activityTimeout: this.pingDelay
4400
4424
  });
4401
4425
  var g = this.transport.createConnection(t, s, a, l), S = null, x = function() {
4402
- g.unbind("open", x), g.bind("closed", j), S = fe.now();
4403
- }, j = (Q) => {
4404
- if (g.unbind("closed", j), Q.code === 1002 || Q.code === 1003)
4426
+ g.unbind("open", x), g.bind("closed", z), S = oe.now();
4427
+ }, z = (Q) => {
4428
+ if (g.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
4405
4429
  this.manager.reportDeath();
4406
4430
  else if (!Q.wasClean && S) {
4407
- var ee = fe.now() - S;
4431
+ var ee = oe.now() - S;
4408
4432
  ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
4409
4433
  }
4410
4434
  };
@@ -4481,7 +4505,7 @@ function Oa() {
4481
4505
  }
4482
4506
  send_event(t, s, a) {
4483
4507
  var l = { event: t, data: s };
4484
- return a && (l.channel = a), ae.debug("Event sent", l), this.send(Ie.encodeMessage(l));
4508
+ return a && (l.channel = a), ce.debug("Event sent", l), this.send(Ie.encodeMessage(l));
4485
4509
  }
4486
4510
  ping() {
4487
4511
  this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
@@ -4503,7 +4527,7 @@ function Oa() {
4503
4527
  });
4504
4528
  }
4505
4529
  if (l !== void 0) {
4506
- switch (ae.debug("Event recd", l), l.event) {
4530
+ switch (ce.debug("Event recd", l), l.event) {
4507
4531
  case "pusher:error":
4508
4532
  this.emit("error", {
4509
4533
  type: "PusherError",
@@ -4574,7 +4598,7 @@ function Oa() {
4574
4598
  this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
4575
4599
  }
4576
4600
  finish(t, s) {
4577
- this.callback(me({ transport: this.transport, action: t }, s));
4601
+ this.callback(ve({ transport: this.transport, action: t }, s));
4578
4602
  }
4579
4603
  }
4580
4604
  class vr {
@@ -4582,13 +4606,13 @@ function Oa() {
4582
4606
  this.timeline = t, this.options = s || {};
4583
4607
  }
4584
4608
  send(t, s) {
4585
- this.timeline.isEmpty() || this.timeline.send($.TimelineTransport.getAgent(this, t), s);
4609
+ this.timeline.isEmpty() || this.timeline.send(j.TimelineTransport.getAgent(this, t), s);
4586
4610
  }
4587
4611
  }
4588
4612
  class vt extends Te {
4589
4613
  constructor(t, s) {
4590
4614
  super(function(a, l) {
4591
- ae.debug("No callbacks on " + t + " for " + a);
4615
+ ce.debug("No callbacks on " + t + " for " + a);
4592
4616
  }), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
4593
4617
  }
4594
4618
  authorize(t, s) {
@@ -4599,7 +4623,7 @@ function Oa() {
4599
4623
  throw new p("Event '" + t + "' does not start with 'client-'");
4600
4624
  if (!this.subscribed) {
4601
4625
  var a = A.buildLogSuffix("triggeringClientEvents");
4602
- ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4626
+ ce.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4603
4627
  }
4604
4628
  return this.pusher.send_event(t, s, this.name);
4605
4629
  }
@@ -4625,7 +4649,7 @@ function Oa() {
4625
4649
  }
4626
4650
  subscribe() {
4627
4651
  this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (t, s) => {
4628
- t ? (this.subscriptionPending = !1, ae.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4652
+ t ? (this.subscriptionPending = !1, ce.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4629
4653
  type: "AuthError",
4630
4654
  error: t.message
4631
4655
  }, t instanceof k ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
@@ -4697,19 +4721,19 @@ function Oa() {
4697
4721
  function x(ee) {
4698
4722
  try {
4699
4723
  Q(a.next(ee));
4700
- } catch (ue) {
4701
- S(ue);
4724
+ } catch (de) {
4725
+ S(de);
4702
4726
  }
4703
4727
  }
4704
- function j(ee) {
4728
+ function z(ee) {
4705
4729
  try {
4706
4730
  Q(a.throw(ee));
4707
- } catch (ue) {
4708
- S(ue);
4731
+ } catch (de) {
4732
+ S(de);
4709
4733
  }
4710
4734
  }
4711
4735
  function Q(ee) {
4712
- ee.done ? g(ee.value) : l(ee.value).then(x, j);
4736
+ ee.done ? g(ee.value) : l(ee.value).then(x, z);
4713
4737
  }
4714
4738
  Q((a = a.apply(i, t || [])).next());
4715
4739
  });
@@ -4728,7 +4752,7 @@ function Oa() {
4728
4752
  this.members.setMyID(this.pusher.user.user_data.id);
4729
4753
  else {
4730
4754
  let S = A.buildLogSuffix("authorizationEndpoint");
4731
- 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");
4755
+ ce.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
4732
4756
  return;
4733
4757
  }
4734
4758
  s(a, l);
@@ -4801,32 +4825,32 @@ function Oa() {
4801
4825
  }
4802
4826
  handleEncryptedEvent(t, s) {
4803
4827
  if (!this.key) {
4804
- ae.debug("Received encrypted event before key has been retrieved from the authEndpoint");
4828
+ ce.debug("Received encrypted event before key has been retrieved from the authEndpoint");
4805
4829
  return;
4806
4830
  }
4807
4831
  if (!s.ciphertext || !s.nonce) {
4808
- ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4832
+ ce.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4809
4833
  return;
4810
4834
  }
4811
4835
  let a = Object(yt.decode)(s.ciphertext);
4812
4836
  if (a.length < this.nacl.secretbox.overheadLength) {
4813
- ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4837
+ ce.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4814
4838
  return;
4815
4839
  }
4816
4840
  let l = Object(yt.decode)(s.nonce);
4817
4841
  if (l.length < this.nacl.secretbox.nonceLength) {
4818
- ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
4842
+ ce.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
4819
4843
  return;
4820
4844
  }
4821
4845
  let g = this.nacl.secretbox.open(a, l, this.key);
4822
4846
  if (g === null) {
4823
- ae.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, x) => {
4847
+ ce.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, x) => {
4824
4848
  if (S) {
4825
- ae.error(`Failed to make a request to the authEndpoint: ${x}. Unable to fetch new key, so dropping encrypted event`);
4849
+ ce.error(`Failed to make a request to the authEndpoint: ${x}. Unable to fetch new key, so dropping encrypted event`);
4826
4850
  return;
4827
4851
  }
4828
4852
  if (g = this.nacl.secretbox.open(a, l, this.key), g === null) {
4829
- ae.error("Failed to decrypt event with new key. Dropping encrypted event");
4853
+ ce.error("Failed to decrypt event with new key. Dropping encrypted event");
4830
4854
  return;
4831
4855
  }
4832
4856
  this.emit(t, this.getDataToEmit(g));
@@ -4847,7 +4871,7 @@ function Oa() {
4847
4871
  class wr extends Te {
4848
4872
  constructor(t, s) {
4849
4873
  super(), this.state = "initialized", this.connection = null, this.key = t, this.options = s, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
4850
- var a = $.getNetwork();
4874
+ var a = j.getNetwork();
4851
4875
  a.bind("online", () => {
4852
4876
  this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
4853
4877
  }), a.bind("offline", () => {
@@ -4901,7 +4925,7 @@ function Oa() {
4901
4925
  });
4902
4926
  }
4903
4927
  retryIn(t) {
4904
- this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new F(t || 0, () => {
4928
+ this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new U(t || 0, () => {
4905
4929
  this.disconnectInternally(), this.connect();
4906
4930
  });
4907
4931
  }
@@ -4909,7 +4933,7 @@ function Oa() {
4909
4933
  this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
4910
4934
  }
4911
4935
  setUnavailableTimer() {
4912
- this.unavailableTimer = new F(this.options.unavailableTimeout, () => {
4936
+ this.unavailableTimer = new U(this.options.unavailableTimeout, () => {
4913
4937
  this.updateState("unavailable");
4914
4938
  });
4915
4939
  }
@@ -4917,12 +4941,12 @@ function Oa() {
4917
4941
  this.unavailableTimer && this.unavailableTimer.ensureAborted();
4918
4942
  }
4919
4943
  sendActivityCheck() {
4920
- this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new F(this.options.pongTimeout, () => {
4944
+ this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new U(this.options.pongTimeout, () => {
4921
4945
  this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
4922
4946
  });
4923
4947
  }
4924
4948
  resetActivityCheck() {
4925
- this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new F(this.activityTimeout, () => {
4949
+ this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new U(this.activityTimeout, () => {
4926
4950
  this.sendActivityCheck();
4927
4951
  }));
4928
4952
  }
@@ -4930,7 +4954,7 @@ function Oa() {
4930
4954
  this.activityTimer && this.activityTimer.ensureAborted();
4931
4955
  }
4932
4956
  buildConnectionCallbacks(t) {
4933
- return me({}, t, {
4957
+ return ve({}, t, {
4934
4958
  message: (s) => {
4935
4959
  this.resetActivityCheck(), this.emit("message", s);
4936
4960
  },
@@ -4949,7 +4973,7 @@ function Oa() {
4949
4973
  });
4950
4974
  }
4951
4975
  buildHandshakeCallbacks(t) {
4952
- return me({}, t, {
4976
+ return ve({}, t, {
4953
4977
  connected: (s) => {
4954
4978
  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 });
4955
4979
  }
@@ -4993,7 +5017,7 @@ function Oa() {
4993
5017
  var a = this.state;
4994
5018
  if (this.state = t, a !== t) {
4995
5019
  var l = t;
4996
- l === "connected" && (l += " with new socket ID " + s.socket_id), ae.debug("State changed", a + " -> " + l), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
5020
+ l === "connected" && (l += " with new socket ID " + s.socket_id), ce.debug("State changed", a + " -> " + l), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
4997
5021
  }
4998
5022
  }
4999
5023
  shouldRetry() {
@@ -5008,7 +5032,7 @@ function Oa() {
5008
5032
  return this.channels[t] || (this.channels[t] = Er(t, s)), this.channels[t];
5009
5033
  }
5010
5034
  all() {
5011
- return N(this.channels);
5035
+ return D(this.channels);
5012
5036
  }
5013
5037
  find(t) {
5014
5038
  return this.channels[t];
@@ -5090,27 +5114,27 @@ function Oa() {
5090
5114
  this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
5091
5115
  }
5092
5116
  isSupported() {
5093
- return we(this.strategies, fe.method("isSupported"));
5117
+ return we(this.strategies, oe.method("isSupported"));
5094
5118
  }
5095
5119
  connect(t, s) {
5096
- var a = this.strategies, l = 0, g = this.timeout, S = null, x = (j, Q) => {
5120
+ var a = this.strategies, l = 0, g = this.timeout, S = null, x = (z, Q) => {
5097
5121
  Q ? s(null, Q) : (l = l + 1, this.loop && (l = l % a.length), l < a.length ? (g && (g = g * 2, this.timeoutLimit && (g = Math.min(g, this.timeoutLimit))), S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, x)) : s(!0));
5098
5122
  };
5099
5123
  return S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, x), {
5100
5124
  abort: function() {
5101
5125
  S.abort();
5102
5126
  },
5103
- forceMinPriority: function(j) {
5104
- t = j, S && S.forceMinPriority(j);
5127
+ forceMinPriority: function(z) {
5128
+ t = z, S && S.forceMinPriority(z);
5105
5129
  }
5106
5130
  };
5107
5131
  }
5108
5132
  tryStrategy(t, s, a, l) {
5109
5133
  var g = null, S = null;
5110
- return a.timeout > 0 && (g = new F(a.timeout, function() {
5134
+ return a.timeout > 0 && (g = new U(a.timeout, function() {
5111
5135
  S.abort(), l(!0);
5112
- })), S = t.connect(s, function(x, j) {
5113
- x && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(x, j));
5136
+ })), S = t.connect(s, function(x, z) {
5137
+ x && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(x, z));
5114
5138
  }), {
5115
5139
  abort: function() {
5116
5140
  g && g.ensureAborted(), S.abort();
@@ -5126,7 +5150,7 @@ function Oa() {
5126
5150
  this.strategies = t;
5127
5151
  }
5128
5152
  isSupported() {
5129
- return we(this.strategies, fe.method("isSupported"));
5153
+ return we(this.strategies, oe.method("isSupported"));
5130
5154
  }
5131
5155
  connect(t, s) {
5132
5156
  return Rr(this.strategies, t, function(a, l) {
@@ -5135,7 +5159,7 @@ function Oa() {
5135
5159
  Pr(l) && s(!0);
5136
5160
  return;
5137
5161
  }
5138
- U(l, function(x) {
5162
+ O(l, function(x) {
5139
5163
  x.forceMinPriority(S.transport.priority);
5140
5164
  }), s(null, S);
5141
5165
  };
@@ -5143,22 +5167,22 @@ function Oa() {
5143
5167
  }
5144
5168
  }
5145
5169
  function Rr(i, t, s) {
5146
- var a = ne(i, function(l, g, S, x) {
5170
+ var a = se(i, function(l, g, S, x) {
5147
5171
  return l.connect(t, s(g, x));
5148
5172
  });
5149
5173
  return {
5150
5174
  abort: function() {
5151
- U(a, Mr);
5175
+ O(a, Mr);
5152
5176
  },
5153
5177
  forceMinPriority: function(l) {
5154
- U(a, function(g) {
5178
+ O(a, function(g) {
5155
5179
  g.forceMinPriority(l);
5156
5180
  });
5157
5181
  }
5158
5182
  };
5159
5183
  }
5160
5184
  function Pr(i) {
5161
- return pe(i, function(t) {
5185
+ return ge(i, function(t) {
5162
5186
  return !!t.error;
5163
5187
  });
5164
5188
  }
@@ -5174,7 +5198,7 @@ function Oa() {
5174
5198
  }
5175
5199
  connect(t, s) {
5176
5200
  var a = this.usingTLS, l = xr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
5177
- if (l && l.timestamp + this.ttl >= fe.now()) {
5201
+ if (l && l.timestamp + this.ttl >= oe.now()) {
5178
5202
  var x = this.transports[l.transport];
5179
5203
  x && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
5180
5204
  cached: !0,
@@ -5185,8 +5209,8 @@ function Oa() {
5185
5209
  failFast: !0
5186
5210
  }))) : g++);
5187
5211
  }
5188
- var j = fe.now(), Q = S.pop().connect(t, function ee(ue, tt) {
5189
- ue ? (fn(a), S.length > 0 ? (j = fe.now(), Q = S.pop().connect(t, ee)) : s(ue)) : (Lr(a, tt.transport.name, fe.now() - j, g), s(null, tt));
5212
+ var z = oe.now(), Q = S.pop().connect(t, function ee(de, tt) {
5213
+ de ? (fn(a), S.length > 0 ? (z = oe.now(), Q = S.pop().connect(t, ee)) : s(de)) : (Lr(a, tt.transport.name, oe.now() - z, g), s(null, tt));
5190
5214
  });
5191
5215
  return {
5192
5216
  abort: function() {
@@ -5202,7 +5226,7 @@ function Oa() {
5202
5226
  return "pusherTransport" + (i ? "TLS" : "NonTLS");
5203
5227
  }
5204
5228
  function xr(i) {
5205
- var t = $.getLocalStorage();
5229
+ var t = j.getLocalStorage();
5206
5230
  if (t)
5207
5231
  try {
5208
5232
  var s = t[St(i)];
@@ -5214,11 +5238,11 @@ function Oa() {
5214
5238
  return null;
5215
5239
  }
5216
5240
  function Lr(i, t, s, a) {
5217
- var l = $.getLocalStorage();
5241
+ var l = j.getLocalStorage();
5218
5242
  if (l)
5219
5243
  try {
5220
5244
  l[St(i)] = Qe({
5221
- timestamp: fe.now(),
5245
+ timestamp: oe.now(),
5222
5246
  transport: t,
5223
5247
  latency: s,
5224
5248
  cacheSkipCount: a
@@ -5227,7 +5251,7 @@ function Oa() {
5227
5251
  }
5228
5252
  }
5229
5253
  function fn(i) {
5230
- var t = $.getLocalStorage();
5254
+ var t = j.getLocalStorage();
5231
5255
  if (t)
5232
5256
  try {
5233
5257
  delete t[St(i)];
@@ -5242,7 +5266,7 @@ function Oa() {
5242
5266
  return this.strategy.isSupported();
5243
5267
  }
5244
5268
  connect(t, s) {
5245
- var a = this.strategy, l, g = new F(this.options.delay, function() {
5269
+ var a = this.strategy, l, g = new U(this.options.delay, function() {
5246
5270
  l = a.connect(t, s);
5247
5271
  });
5248
5272
  return {
@@ -5303,7 +5327,7 @@ function Oa() {
5303
5327
  hostNonTLS: i.httpHost + ":" + i.httpPort,
5304
5328
  hostTLS: i.httpHost + ":" + i.httpsPort,
5305
5329
  httpPath: i.httpPath
5306
- }), j = {
5330
+ }), z = {
5307
5331
  loop: !0,
5308
5332
  timeout: 15e3,
5309
5333
  timeoutLimit: 6e4
@@ -5314,16 +5338,16 @@ function Oa() {
5314
5338
  lives: 2,
5315
5339
  minPingDelay: 1e4,
5316
5340
  maxPingDelay: i.activityTimeout
5317
- }), ue = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Pi = l("sockjs", "sockjs", 1, x), bn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Mi = l("xdr_streaming", "xdr_streaming", 1, x, ee), yn = l("xhr_polling", "xhr_polling", 1, x), ki = l("xdr_polling", "xdr_polling", 1, x), _n = new Ue([ue], j), xi = new Ue([tt], j), Li = new Ue([Pi], j), Sn = new Ue([
5341
+ }), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Pi = l("sockjs", "sockjs", 1, x), bn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Mi = l("xdr_streaming", "xdr_streaming", 1, x, ee), yn = l("xhr_polling", "xhr_polling", 1, x), ki = l("xdr_polling", "xdr_polling", 1, x), _n = new Ue([de], z), xi = new Ue([tt], z), Li = new Ue([Pi], z), Sn = new Ue([
5318
5342
  new ze(je(bn), bn, Mi)
5319
- ], j), Cn = new Ue([
5343
+ ], z), Cn = new Ue([
5320
5344
  new ze(je(yn), yn, ki)
5321
- ], j), wn = new Ue([
5345
+ ], z), wn = new Ue([
5322
5346
  new ze(je(Sn), new _t([
5323
5347
  Sn,
5324
5348
  new Ze(Cn, { delay: 4e3 })
5325
5349
  ]), Cn)
5326
- ], j), Et = new ze(je(wn), wn, Li), At;
5350
+ ], z), Et = new ze(je(wn), wn, Li), At;
5327
5351
  return t.useTLS ? At = new _t([
5328
5352
  _n,
5329
5353
  new Ze(Et, { delay: 2e3 })
@@ -5331,7 +5355,7 @@ function Oa() {
5331
5355
  _n,
5332
5356
  new Ze(xi, { delay: 2e3 }),
5333
5357
  new Ze(Et, { delay: 5e3 })
5334
- ]), new kr(new Ir(new ze(je(ue), At, Et)), a, {
5358
+ ]), new kr(new Ir(new ze(je(de), At, Et)), a, {
5335
5359
  ttl: 18e5,
5336
5360
  timeline: t.timeline,
5337
5361
  useTLS: t.useTLS
@@ -5368,10 +5392,10 @@ function Oa() {
5368
5392
  start(t) {
5369
5393
  this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
5370
5394
  this.close();
5371
- }, $.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(t);
5395
+ }, j.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(t);
5372
5396
  }
5373
5397
  close() {
5374
- this.unloader && ($.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
5398
+ this.unloader && (j.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
5375
5399
  }
5376
5400
  onChunk(t, s) {
5377
5401
  for (; ; ) {
@@ -5413,7 +5437,7 @@ function Oa() {
5413
5437
  sendRaw(t) {
5414
5438
  if (this.readyState === Oe.OPEN)
5415
5439
  try {
5416
- return $.createSocketRequest("POST", pn(Br(this.location, this.session))).start(t), !0;
5440
+ return j.createSocketRequest("POST", pn(Br(this.location, this.session))).start(t), !0;
5417
5441
  } catch {
5418
5442
  return !1;
5419
5443
  }
@@ -5468,7 +5492,7 @@ function Oa() {
5468
5492
  this.onerror && this.onerror(t);
5469
5493
  }
5470
5494
  openStream() {
5471
- this.stream = $.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
5495
+ this.stream = j.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
5472
5496
  this.onChunk(t);
5473
5497
  }), this.stream.bind("finished", (t) => {
5474
5498
  this.hooks.onFinished(this, t);
@@ -5478,7 +5502,7 @@ function Oa() {
5478
5502
  try {
5479
5503
  this.stream.start();
5480
5504
  } catch (t) {
5481
- fe.defer(() => {
5505
+ oe.defer(() => {
5482
5506
  this.onError(t), this.onClose(1006, "Could not start streaming", !1);
5483
5507
  });
5484
5508
  }
@@ -5506,7 +5530,7 @@ function Oa() {
5506
5530
  return s[1] + t + s[3];
5507
5531
  }
5508
5532
  function gn(i) {
5509
- return $.randomInt(i);
5533
+ return j.randomInt(i);
5510
5534
  }
5511
5535
  function Xr(i) {
5512
5536
  for (var t = [], s = 0; s < i; s++)
@@ -5540,7 +5564,7 @@ function Oa() {
5540
5564
  }
5541
5565
  }, Qr = Kr, Yr = {
5542
5566
  getRequest: function(i) {
5543
- var t = $.getXHRAPI(), s = new t();
5567
+ var t = j.getXHRAPI(), s = new t();
5544
5568
  return s.onreadystatechange = s.onprogress = function() {
5545
5569
  switch (s.readyState) {
5546
5570
  case 3:
@@ -5605,7 +5629,7 @@ function Oa() {
5605
5629
  return this.getDocument().location.protocol;
5606
5630
  },
5607
5631
  getAuthorizers() {
5608
- return { ajax: K, jsonp: Ws };
5632
+ return { ajax: V, jsonp: Ws };
5609
5633
  },
5610
5634
  onDocumentBody(i) {
5611
5635
  document.body ? i() : setTimeout(() => {
@@ -5668,7 +5692,7 @@ function Oa() {
5668
5692
  return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
5669
5693
  }() * i);
5670
5694
  }
5671
- }, $ = ni, wt;
5695
+ }, j = ni, wt;
5672
5696
  (function(i) {
5673
5697
  i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
5674
5698
  })(wt || (wt = {}));
@@ -5678,7 +5702,7 @@ function Oa() {
5678
5702
  this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
5679
5703
  }
5680
5704
  log(t, s) {
5681
- t <= this.options.level && (this.events.push(me({}, s, { timestamp: fe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5705
+ t <= this.options.level && (this.events.push(ve({}, s, { timestamp: oe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5682
5706
  }
5683
5707
  error(t) {
5684
5708
  this.log(et.ERROR, t);
@@ -5693,7 +5717,7 @@ function Oa() {
5693
5717
  return this.events.length === 0;
5694
5718
  }
5695
5719
  send(t, s) {
5696
- var a = me({
5720
+ var a = ve({
5697
5721
  session: this.session,
5698
5722
  bundle: this.sent + 1,
5699
5723
  key: this.key,
@@ -5723,35 +5747,35 @@ function Oa() {
5723
5747
  connect(t, s) {
5724
5748
  if (this.isSupported()) {
5725
5749
  if (this.priority < t)
5726
- return vn(new O(), s);
5750
+ return vn(new F(), s);
5727
5751
  } else return vn(new te(), s);
5728
5752
  var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
5729
5753
  l.unbind("initialized", S), l.connect();
5730
5754
  }, x = function() {
5731
- g = Ee.createHandshake(l, function(ue) {
5732
- a = !0, ee(), s(null, ue);
5755
+ g = Ee.createHandshake(l, function(de) {
5756
+ a = !0, ee(), s(null, de);
5733
5757
  });
5734
- }, j = function(ue) {
5735
- ee(), s(ue);
5758
+ }, z = function(de) {
5759
+ ee(), s(de);
5736
5760
  }, Q = function() {
5737
5761
  ee();
5738
- var ue;
5739
- ue = Qe(l), s(new z(ue));
5762
+ var de;
5763
+ de = Qe(l), s(new q(de));
5740
5764
  }, ee = function() {
5741
- l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", j), l.unbind("closed", Q);
5765
+ l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", z), l.unbind("closed", Q);
5742
5766
  };
5743
- return l.bind("initialized", S), l.bind("open", x), l.bind("error", j), l.bind("closed", Q), l.initialize(), {
5767
+ return l.bind("initialized", S), l.bind("open", x), l.bind("error", z), l.bind("closed", Q), l.initialize(), {
5744
5768
  abort: () => {
5745
5769
  a || (ee(), g ? g.close() : l.close());
5746
5770
  },
5747
- forceMinPriority: (ue) => {
5748
- a || this.priority < ue && (g ? g.close() : l.close());
5771
+ forceMinPriority: (de) => {
5772
+ a || this.priority < de && (g ? g.close() : l.close());
5749
5773
  }
5750
5774
  };
5751
5775
  }
5752
5776
  }
5753
5777
  function vn(i, t) {
5754
- return fe.defer(function() {
5778
+ return oe.defer(function() {
5755
5779
  t(i);
5756
5780
  }), {
5757
5781
  abort: function() {
@@ -5760,19 +5784,19 @@ function Oa() {
5760
5784
  }
5761
5785
  };
5762
5786
  }
5763
- const { Transports: ii } = $;
5787
+ const { Transports: ii } = j;
5764
5788
  var oi = function(i, t, s, a, l, g) {
5765
5789
  var S = ii[s];
5766
5790
  if (!S)
5767
- throw new W(s);
5768
- var x = (!i.enabledTransports || ft(i.enabledTransports, t) !== -1) && (!i.disabledTransports || ft(i.disabledTransports, t) === -1), j;
5769
- return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), j = new ri(t, a, g ? g.getAssistant(S) : S, l)) : j = ai, j;
5791
+ throw new G(s);
5792
+ var x = (!i.enabledTransports || ft(i.enabledTransports, t) !== -1) && (!i.disabledTransports || ft(i.disabledTransports, t) === -1), z;
5793
+ return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), z = new ri(t, a, g ? g.getAssistant(S) : S, l)) : z = ai, z;
5770
5794
  }, ai = {
5771
5795
  isSupported: function() {
5772
5796
  return !1;
5773
5797
  },
5774
5798
  connect: function(i, t) {
5775
- var s = fe.defer(function() {
5799
+ var s = oe.defer(function() {
5776
5800
  t(new te());
5777
5801
  });
5778
5802
  return {
@@ -5789,7 +5813,7 @@ function Oa() {
5789
5813
  throw "You must pass an options object";
5790
5814
  if (i.cluster == null)
5791
5815
  throw "Options object must provide a cluster";
5792
- "disableStats" in i && ae.warn("The disableStats option is deprecated in favor of enableStats");
5816
+ "disableStats" in i && ce.warn("The disableStats option is deprecated in favor of enableStats");
5793
5817
  }
5794
5818
  const ui = (i, t) => {
5795
5819
  var s = "socket_id=" + encodeURIComponent(i.socketId);
@@ -5803,11 +5827,11 @@ function Oa() {
5803
5827
  return s;
5804
5828
  };
5805
5829
  var li = (i) => {
5806
- if (typeof $.getAuthorizers()[i.transport] > "u")
5830
+ if (typeof j.getAuthorizers()[i.transport] > "u")
5807
5831
  throw `'${i.transport}' is not a recognized auth transport`;
5808
5832
  return (t, s) => {
5809
5833
  const a = ui(t, i);
5810
- $.getAuthorizers()[i.transport]($, a, i, w.UserAuthentication, s);
5834
+ j.getAuthorizers()[i.transport](j, a, i, w.UserAuthentication, s);
5811
5835
  };
5812
5836
  };
5813
5837
  const di = (i, t) => {
@@ -5823,11 +5847,11 @@ function Oa() {
5823
5847
  return s;
5824
5848
  };
5825
5849
  var hi = (i) => {
5826
- if (typeof $.getAuthorizers()[i.transport] > "u")
5850
+ if (typeof j.getAuthorizers()[i.transport] > "u")
5827
5851
  throw `'${i.transport}' is not a recognized auth transport`;
5828
5852
  return (t, s) => {
5829
5853
  const a = di(t, i);
5830
- $.getAuthorizers()[i.transport]($, a, i, w.ChannelAuthorization, s);
5854
+ j.getAuthorizers()[i.transport](j, a, i, w.ChannelAuthorization, s);
5831
5855
  };
5832
5856
  };
5833
5857
  const fi = (i, t, s) => {
@@ -5876,7 +5900,7 @@ function Oa() {
5876
5900
  return `ws-${i}.pusher.com`;
5877
5901
  }
5878
5902
  function bi(i) {
5879
- return $.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
5903
+ return j.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
5880
5904
  }
5881
5905
  function yi(i) {
5882
5906
  return "enableStats" in i ? i.enableStats : "disableStats" in i ? !i.disableStats : !1;
@@ -5899,7 +5923,7 @@ function Oa() {
5899
5923
  class wi extends Te {
5900
5924
  constructor(t) {
5901
5925
  super(function(s, a) {
5902
- ae.debug(`No callbacks on watchlist events for ${s}`);
5926
+ ce.debug(`No callbacks on watchlist events for ${s}`);
5903
5927
  }), this.pusher = t, this.bindWatchlistInternalEvent();
5904
5928
  }
5905
5929
  handleEvent(t) {
@@ -5924,10 +5948,10 @@ function Oa() {
5924
5948
  class Ai extends Te {
5925
5949
  constructor(t) {
5926
5950
  super(function(s, a) {
5927
- ae.debug("No callbacks on user for " + s);
5951
+ ce.debug("No callbacks on user for " + s);
5928
5952
  }), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (s, a) => {
5929
5953
  if (s) {
5930
- ae.warn(`Error during signin: ${s}`), this._cleanup();
5954
+ ce.warn(`Error during signin: ${s}`), this._cleanup();
5931
5955
  return;
5932
5956
  }
5933
5957
  this.pusher.send_event("pusher:signin", {
@@ -5953,11 +5977,11 @@ function Oa() {
5953
5977
  try {
5954
5978
  this.user_data = JSON.parse(t.user_data);
5955
5979
  } catch {
5956
- ae.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
5980
+ ce.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
5957
5981
  return;
5958
5982
  }
5959
5983
  if (typeof this.user_data.id != "string" || this.user_data.id === "") {
5960
- ae.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
5984
+ ce.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
5961
5985
  return;
5962
5986
  }
5963
5987
  this._signinDoneResolve(), this._subscribeChannels();
@@ -5984,30 +6008,30 @@ function Oa() {
5984
6008
  t.then(a).catch(a), this.signinDonePromise = t, this._signinDoneResolve = s;
5985
6009
  }
5986
6010
  }
5987
- class ge {
6011
+ class me {
5988
6012
  static ready() {
5989
- ge.isReady = !0;
5990
- for (var t = 0, s = ge.instances.length; t < s; t++)
5991
- ge.instances[t].connect();
6013
+ me.isReady = !0;
6014
+ for (var t = 0, s = me.instances.length; t < s; t++)
6015
+ me.instances[t].connect();
5992
6016
  }
5993
6017
  static getClientFeatures() {
5994
- return R(Re({ ws: $.Transports.ws }, function(t) {
6018
+ return P(Re({ ws: j.Transports.ws }, function(t) {
5995
6019
  return t.isSupported({});
5996
6020
  }));
5997
6021
  }
5998
6022
  constructor(t, s) {
5999
- Ri(t), ci(s), this.key = t, this.config = pi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = $.randomInt(1e9), this.timeline = new si(this.key, this.sessionID, {
6023
+ Ri(t), ci(s), this.key = t, this.config = pi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new si(this.key, this.sessionID, {
6000
6024
  cluster: this.config.cluster,
6001
- features: ge.getClientFeatures(),
6025
+ features: me.getClientFeatures(),
6002
6026
  params: this.config.timelineParams || {},
6003
6027
  limit: 50,
6004
6028
  level: et.INFO,
6005
6029
  version: h.VERSION
6006
6030
  }), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
6007
6031
  host: this.config.statsHost,
6008
- path: "/timeline/v2/" + $.TimelineTransport.name
6032
+ path: "/timeline/v2/" + j.TimelineTransport.name
6009
6033
  }));
6010
- var a = (l) => $.getDefaultStrategy(this.config, l, oi);
6034
+ var a = (l) => j.getDefaultStrategy(this.config, l, oi);
6011
6035
  this.connection = Ee.createConnectionManager(this.key, {
6012
6036
  getStrategy: a,
6013
6037
  timeline: this.timeline,
@@ -6029,8 +6053,8 @@ function Oa() {
6029
6053
  }), this.connection.bind("disconnected", () => {
6030
6054
  this.channels.disconnect();
6031
6055
  }), this.connection.bind("error", (l) => {
6032
- ae.warn(l);
6033
- }), ge.instances.push(this), this.timeline.info({ instances: ge.instances.length }), this.user = new Ai(this), ge.isReady && this.connect();
6056
+ ce.warn(l);
6057
+ }), me.instances.push(this), this.timeline.info({ instances: me.instances.length }), this.user = new Ai(this), me.isReady && this.connect();
6034
6058
  }
6035
6059
  channel(t) {
6036
6060
  return this.channels.find(t);
@@ -6041,7 +6065,7 @@ function Oa() {
6041
6065
  connect() {
6042
6066
  if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
6043
6067
  var t = this.connection.isUsingTLS(), s = this.timelineSender;
6044
- this.timelineSenderTimer = new Z(6e4, function() {
6068
+ this.timelineSenderTimer = new ne(6e4, function() {
6045
6069
  s.send(t);
6046
6070
  });
6047
6071
  }
@@ -6087,13 +6111,13 @@ function Oa() {
6087
6111
  this.user.signin();
6088
6112
  }
6089
6113
  }
6090
- ge.instances = [], ge.isReady = !1, ge.logToConsole = !1, ge.Runtime = $, ge.ScriptReceivers = $.ScriptReceivers, ge.DependenciesReceivers = $.DependenciesReceivers, ge.auth_callbacks = $.auth_callbacks;
6091
- var Tt = o.default = ge;
6114
+ me.instances = [], me.isReady = !1, me.logToConsole = !1, me.Runtime = j, me.ScriptReceivers = j.ScriptReceivers, me.DependenciesReceivers = j.DependenciesReceivers, me.auth_callbacks = j.auth_callbacks;
6115
+ var Tt = o.default = me;
6092
6116
  function Ri(i) {
6093
6117
  if (i == null)
6094
6118
  throw "You must pass your app key when you instantiate Pusher.";
6095
6119
  }
6096
- $.setup(ge);
6120
+ j.setup(me);
6097
6121
  })
6098
6122
  /******/
6099
6123
  ])
@@ -6103,10 +6127,10 @@ function Oa() {
6103
6127
  }
6104
6128
  var Fa = Oa();
6105
6129
  const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
6106
- function re(e) {
6130
+ function ie(e) {
6107
6131
  return typeof e == "object" && e !== null;
6108
6132
  }
6109
- function de(e, n) {
6133
+ function pe(e, n) {
6110
6134
  return typeof e[n] == "string";
6111
6135
  }
6112
6136
  function Ce(e, n) {
@@ -6143,14 +6167,14 @@ function Ba(e) {
6143
6167
  return e.startsWith("/") ? e : `/${e}`;
6144
6168
  }
6145
6169
  function Va(e) {
6146
- const n = re(e) && re(e.data) ? e.data : e;
6147
- if (!re(n))
6170
+ const n = ie(e) && ie(e.data) ? e.data : e;
6171
+ if (!ie(n))
6148
6172
  throw new Error("Invalid messenger bootstrap payload: expected object");
6149
6173
  const r = n.auth, o = n.service;
6150
- if (!re(r) || !re(o))
6174
+ if (!ie(r) || !ie(o))
6151
6175
  throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
6152
6176
  const c = r.user, u = o.reverb;
6153
- if (!re(c) || !re(u))
6177
+ if (!ie(c) || !ie(u))
6154
6178
  throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
6155
6179
  const d = Ba(Ve(u, "path"));
6156
6180
  return {
@@ -6185,9 +6209,9 @@ function Xa(e) {
6185
6209
  return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
6186
6210
  }
6187
6211
  function Wa(e) {
6188
- if (!re(e))
6212
+ if (!ie(e))
6189
6213
  return !1;
6190
- const n = re(e.response) ? e.response : null;
6214
+ const n = ie(e.response) ? e.response : null;
6191
6215
  if (n?.status !== 403)
6192
6216
  return !1;
6193
6217
  const r = n.data;
@@ -6198,7 +6222,7 @@ function Kn(e, n) {
6198
6222
  e.headers.set("Authorization", `Bearer ${n}`), e.headers.set("Accept", "application/json"), e.headers.set("X-Requested-With", "XMLHttpRequest"), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
6199
6223
  return;
6200
6224
  }
6201
- const r = re(e.headers) ? e.headers : {};
6225
+ const r = ie(e.headers) ? e.headers : {};
6202
6226
  e.headers = new An({
6203
6227
  ...r,
6204
6228
  Authorization: `Bearer ${n}`,
@@ -6220,7 +6244,7 @@ function Ga(e) {
6220
6244
  return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
6221
6245
  }
6222
6246
  function Ja(e, n) {
6223
- if (!re(e))
6247
+ if (!ie(e))
6224
6248
  return null;
6225
6249
  const r = Ge(e, "user_id", "userId"), o = Ga(e.status);
6226
6250
  if (!r || !o)
@@ -6236,12 +6260,12 @@ function Ja(e, n) {
6236
6260
  return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
6237
6261
  }
6238
6262
  function Qn(e) {
6239
- if (!re(e))
6263
+ if (!ie(e))
6240
6264
  return null;
6241
6265
  const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
6242
6266
  if (!n || !r)
6243
6267
  return null;
6244
- const o = e.user, c = re(o) ? {
6268
+ const o = e.user, c = ie(o) ? {
6245
6269
  id: typeof o.id == "string" && o.id !== "" ? o.id : n,
6246
6270
  name: typeof o.name == "string" ? o.name : "",
6247
6271
  ...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
@@ -6257,31 +6281,31 @@ function Qn(e) {
6257
6281
  };
6258
6282
  }
6259
6283
  function Ka(e) {
6260
- return re(e) && de(e, "id") && de(e, "name");
6284
+ return ie(e) && pe(e, "id") && pe(e, "name");
6261
6285
  }
6262
6286
  function Qa(e) {
6263
- return !re(e) || !de(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
6287
+ return !ie(e) || !pe(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
6264
6288
  }
6265
6289
  function Yn(e) {
6266
- return re(e) && re(e.message) && de(e.message, "id") && de(e.message, "conversation_id") && de(e.message, "author_id");
6290
+ return ie(e) && ie(e.message) && pe(e.message, "id") && pe(e.message, "conversation_id") && pe(e.message, "author_id");
6267
6291
  }
6268
6292
  function Zn(e) {
6269
- return re(e) && de(e, "conversation_id") && de(e, "user_id") && de(e, "message_id");
6293
+ return ie(e) && pe(e, "conversation_id") && pe(e, "user_id") && pe(e, "message_id");
6270
6294
  }
6271
6295
  function es(e) {
6272
- return re(e) && de(e, "conversation_id") && re(e.message) && de(e.message, "id");
6296
+ return ie(e) && pe(e, "conversation_id") && ie(e.message) && pe(e.message, "id");
6273
6297
  }
6274
6298
  function ts(e) {
6275
- return re(e) && de(e, "conversation_id") && de(e, "message_id");
6299
+ return ie(e) && pe(e, "conversation_id") && pe(e, "message_id");
6276
6300
  }
6277
6301
  function ns(e) {
6278
- return re(e) && de(e, "conversation_id") && de(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
6302
+ return ie(e) && pe(e, "conversation_id") && pe(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
6279
6303
  }
6280
6304
  function ss(e) {
6281
- return re(e) && de(e, "conversation_id");
6305
+ return ie(e) && pe(e, "conversation_id");
6282
6306
  }
6283
6307
  function rs(e) {
6284
- return re(e) && de(e, "conversation_id") && de(e, "removed_user_id");
6308
+ return ie(e) && pe(e, "conversation_id") && pe(e, "removed_user_id");
6285
6309
  }
6286
6310
  function Fe(e, n, r, o) {
6287
6311
  const c = (u) => {
@@ -6292,121 +6316,121 @@ function Fe(e, n, r, o) {
6292
6316
  function pc(e) {
6293
6317
  const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Zt())("MessengerEcho");
6294
6318
  typeof window < "u" && (window.Pusher = Da);
6295
- let d = null, f = null, h = null, P = null, C = "disconnected", v = "available", E = null, b = null;
6319
+ let d = null, f = null, h = null, R = null, C = "disconnected", v = "available", E = null, b = null;
6296
6320
  const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
6297
6321
  C = T;
6298
- for (const R of A)
6299
- R(T);
6322
+ for (const P of A)
6323
+ P(T);
6300
6324
  }, y = (T) => {
6301
6325
  v = T;
6302
- for (const R of w)
6303
- R(T);
6304
- }, O = () => {
6326
+ for (const P of w)
6327
+ P(T);
6328
+ }, F = () => {
6305
6329
  b !== null && (clearTimeout(b), b = null);
6306
- }, z = (T = !0) => {
6307
- h !== null && (h.disconnect(), h = null), P = null, T && m("disconnected");
6330
+ }, q = (T = !0) => {
6331
+ h !== null && (h.disconnect(), h = null), R = null, T && m("disconnected");
6308
6332
  }, J = () => {
6309
- O(), d = null, f = null, E = null, y("available"), z(), p.clear();
6310
- }, W = () => {
6333
+ F(), d = null, f = null, E = null, y("available"), q(), p.clear();
6334
+ }, G = () => {
6311
6335
  if (!e.getSourceToken)
6312
6336
  return null;
6313
6337
  const T = e.getSourceToken();
6314
- return T === null ? (J(), null) : (E !== null && E !== T && (O(), d = null, f = null, y("available"), z()), E = T, T);
6338
+ return T === null ? (J(), null) : (E !== null && E !== T && (F(), d = null, f = null, y("available"), q()), E = T, T);
6315
6339
  }, te = (T) => {
6316
6340
  if (T === null)
6317
6341
  return !1;
6318
6342
  if (T.auth.expiresAt === null)
6319
6343
  return T.auth.token !== "";
6320
- const R = Date.parse(T.auth.expiresAt);
6321
- return Number.isNaN(R) ? !1 : R - Date.now() > o;
6344
+ const P = Date.parse(T.auth.expiresAt);
6345
+ return Number.isNaN(P) ? !1 : P - Date.now() > o;
6322
6346
  }, k = (T) => {
6323
- if (O(), T.auth.expiresAt === null)
6347
+ if (F(), T.auth.expiresAt === null)
6324
6348
  return;
6325
- const R = Date.parse(T.auth.expiresAt);
6326
- if (Number.isNaN(R))
6349
+ const P = Date.parse(T.auth.expiresAt);
6350
+ if (Number.isNaN(P))
6327
6351
  return;
6328
- const N = Math.max(0, R - Date.now() - o);
6352
+ const D = Math.max(0, P - Date.now() - o);
6329
6353
  b = setTimeout(() => {
6330
- K();
6331
- }, N);
6332
- }, I = async (T = !1) => e.getSourceToken && W() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
6354
+ V();
6355
+ }, D);
6356
+ }, L = async (T = !1) => e.getSourceToken && G() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
6333
6357
  try {
6334
- const N = await e.bootstrapClient.get(
6358
+ const D = await e.bootstrapClient.get(
6335
6359
  r,
6336
6360
  T ? { params: { refresh: 1 } } : void 0
6337
- ), U = Va(N.data);
6338
- return d = U, y("available"), k(U), U;
6339
- } catch (N) {
6340
- if (Wa(N))
6341
- return d = null, O(), y("account_suspended"), z(), m("disconnected"), null;
6342
- throw N;
6361
+ ), O = Va(D.data);
6362
+ return d = O, y("available"), k(O), O;
6363
+ } catch (D) {
6364
+ if (Wa(D))
6365
+ return d = null, F(), y("account_suspended"), q(), m("disconnected"), null;
6366
+ throw D;
6343
6367
  }
6344
6368
  })().finally(() => {
6345
6369
  f = null;
6346
- }), await f), K = async () => {
6370
+ }), await f), V = async () => {
6347
6371
  const T = h !== null;
6348
6372
  try {
6349
- if (await I(!0), !T)
6373
+ if (await L(!0), !T)
6350
6374
  return;
6351
- z(!1), await G(!0);
6352
- } catch (R) {
6353
- u.warn("Failed to refresh messenger bootstrap", R);
6375
+ q(!1), await X(!0);
6376
+ } catch (P) {
6377
+ u.warn("Failed to refresh messenger bootstrap", P);
6354
6378
  }
6355
- }, V = (T) => {
6356
- const R = T.connector?.pusher?.connection;
6357
- if (!R) {
6379
+ }, H = (T) => {
6380
+ const P = T.connector?.pusher?.connection;
6381
+ if (!P) {
6358
6382
  u.warn("Messenger echo connector does not expose a Pusher connection");
6359
6383
  return;
6360
6384
  }
6361
- R.bind("connecting", () => {
6385
+ P.bind("connecting", () => {
6362
6386
  m("connecting");
6363
- }), R.bind("connected", () => {
6387
+ }), P.bind("connected", () => {
6364
6388
  m("connected");
6365
- }), R.bind("disconnected", () => {
6389
+ }), P.bind("disconnected", () => {
6366
6390
  m("disconnected");
6367
- }), R.bind("unavailable", () => {
6391
+ }), P.bind("unavailable", () => {
6368
6392
  m("disconnected");
6369
- }), R.bind("error", () => {
6393
+ }), P.bind("error", () => {
6370
6394
  m("error");
6371
- }), R.bind("state_change", (N) => {
6372
- const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : R.state;
6373
- if (U === "connected") {
6395
+ }), P.bind("state_change", (D) => {
6396
+ const O = typeof D == "object" && D !== null && "current" in D && typeof D.current == "string" ? D.current : P.state;
6397
+ if (O === "connected") {
6374
6398
  m("connected");
6375
6399
  return;
6376
6400
  }
6377
- if (U === "connecting") {
6401
+ if (O === "connecting") {
6378
6402
  m("connecting");
6379
6403
  return;
6380
6404
  }
6381
- (U === "unavailable" || U === "failed" || U === "disconnected") && m("disconnected");
6382
- }), R.state === "connected" && m("connected");
6383
- }, G = async (T = !1) => !T && h !== null && te(d) ? h : !T && P !== null ? await P : (P = (async () => {
6384
- const N = await I(T);
6385
- if (N === null)
6405
+ (O === "unavailable" || O === "failed" || O === "disconnected") && m("disconnected");
6406
+ }), P.state === "connected" && m("connected");
6407
+ }, X = async (T = !1) => !T && h !== null && te(d) ? h : !T && R !== null ? await R : (R = (async () => {
6408
+ const D = await L(T);
6409
+ if (D === null)
6386
6410
  return null;
6387
- h !== null && z(!1);
6388
- const U = N.service.reverb.scheme === "https", ne = {
6411
+ h !== null && q(!1);
6412
+ const O = D.service.reverb.scheme === "https", se = {
6389
6413
  broadcaster: "reverb",
6390
- key: N.service.reverb.appKey,
6391
- wsHost: Xa(N.service.reverb.host),
6392
- wsPort: N.service.reverb.port,
6393
- wssPort: N.service.reverb.port,
6394
- forceTLS: U,
6395
- encrypted: U,
6414
+ key: D.service.reverb.appKey,
6415
+ wsHost: Xa(D.service.reverb.host),
6416
+ wsPort: D.service.reverb.port,
6417
+ wssPort: D.service.reverb.port,
6418
+ forceTLS: O,
6419
+ encrypted: O,
6396
6420
  disableStats: !0,
6397
6421
  enabledTransports: ["ws", "wss"],
6398
- authEndpoint: N.service.broadcastingAuthUrl,
6422
+ authEndpoint: D.service.broadcastingAuthUrl,
6399
6423
  auth: {
6400
6424
  headers: {
6401
- Authorization: `Bearer ${N.auth.token}`,
6425
+ Authorization: `Bearer ${D.auth.token}`,
6402
6426
  Accept: "application/json"
6403
6427
  }
6404
6428
  }
6405
6429
  };
6406
- return N.service.reverb.path && (ne.wsPath = N.service.reverb.path), h = new Ia(ne), V(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6430
+ return D.service.reverb.path && (se.wsPath = D.service.reverb.path), h = new Ia(se), H(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6407
6431
  })().finally(() => {
6408
- P = null;
6409
- }), await P), _ = $t.create({
6432
+ R = null;
6433
+ }), await R), _ = $t.create({
6410
6434
  timeout: e.requestTimeoutMs ?? za,
6411
6435
  withCredentials: !1,
6412
6436
  headers: {
@@ -6415,47 +6439,47 @@ function pc(e) {
6415
6439
  }
6416
6440
  });
6417
6441
  _.interceptors.request.use(async (T) => {
6418
- const R = await I();
6419
- if (R === null)
6442
+ const P = await L();
6443
+ if (P === null)
6420
6444
  throw new Error("Messenger bootstrap is unavailable.");
6421
- return T.baseURL = R.service.apiBaseUrl, Kn(T, R.auth.token), T;
6445
+ return T.baseURL = P.service.apiBaseUrl, Kn(T, P.auth.token), T;
6422
6446
  }), _.interceptors.response.use(
6423
6447
  (T) => T,
6424
6448
  async (T) => {
6425
- const R = T.config;
6426
- if (T.response?.status === 401 && R && R._messengerRetry !== !0) {
6427
- R._messengerRetry = !0;
6428
- const N = await I(!0);
6429
- if (N !== null)
6430
- return R.baseURL = N.service.apiBaseUrl, Kn(R, N.auth.token), await _(R);
6449
+ const P = T.config;
6450
+ if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
6451
+ P._messengerRetry = !0;
6452
+ const D = await L(!0);
6453
+ if (D !== null)
6454
+ return P.baseURL = D.service.apiBaseUrl, Kn(P, D.auth.token), await _(P);
6431
6455
  }
6432
6456
  return Promise.reject(T);
6433
6457
  }
6434
6458
  );
6435
- const L = () => v === "account_suspended" ? null : h, he = (T) => (A.add(T), T(C), () => {
6459
+ const I = () => v === "account_suspended" ? null : h, fe = (T) => (A.add(T), T(C), () => {
6436
6460
  A.delete(T);
6437
6461
  }), Se = (T) => (w.add(T), T(v), () => {
6438
6462
  w.delete(T);
6439
- }), B = () => d?.auth.tenantId ?? "global", D = (T) => {
6440
- const R = Dt(T.ts)?.getTime() ?? Dt(T.last_seen_at)?.getTime() ?? null;
6441
- if (R === null)
6463
+ }), B = () => d?.auth.tenantId ?? "global", K = (T) => {
6464
+ const P = Dt(T.ts)?.getTime() ?? Dt(T.last_seen_at)?.getTime() ?? null;
6465
+ if (P === null)
6442
6466
  return !0;
6443
- const N = `${T.tenant_scope ?? "global"}:${T.user_id}`, U = p.get(N);
6444
- if (U && R < U.timestampMs)
6467
+ const D = `${T.tenant_scope ?? "global"}:${T.user_id}`, O = p.get(D);
6468
+ if (O && P < O.timestampMs)
6445
6469
  return !1;
6446
- const ne = Date.now();
6447
- p.set(N, {
6448
- timestampMs: R,
6449
- seenAt: ne
6470
+ const se = Date.now();
6471
+ p.set(D, {
6472
+ timestampMs: P,
6473
+ seenAt: se
6450
6474
  });
6451
- for (const [oe, ce] of p.entries())
6452
- ne - ce.seenAt > c && p.delete(oe);
6475
+ for (const [ae, le] of p.entries())
6476
+ se - le.seenAt > c && p.delete(ae);
6453
6477
  return !0;
6454
- }, q = (T) => {
6455
- const R = L();
6456
- if (!R || typeof R.join != "function")
6478
+ }, N = (T) => {
6479
+ const P = I();
6480
+ if (!P || typeof P.join != "function")
6457
6481
  return;
6458
- const N = R.join(`online-users.${B()}`), U = [
6482
+ const D = P.join(`online-users.${B()}`), O = [
6459
6483
  ".PresenceStatusChanged",
6460
6484
  "PresenceStatusChanged",
6461
6485
  ".presence.status.changed",
@@ -6465,152 +6489,152 @@ function pc(e) {
6465
6489
  ".Modules\\Presence\\Events\\UserPresenceStatusChanged",
6466
6490
  "Modules\\Presence\\Events\\UserPresenceStatusChanged"
6467
6491
  ];
6468
- for (const ne of U)
6469
- N.listen(ne, (oe) => {
6470
- const ce = Ja(oe, B());
6471
- !ce || !D(ce) || T(ce);
6492
+ for (const se of O)
6493
+ D.listen(se, (ae) => {
6494
+ const le = Ja(ae, B());
6495
+ !le || !K(le) || T(le);
6472
6496
  });
6473
- }, _e = () => {
6497
+ }, Y = () => {
6474
6498
  h?.leave(`online-users.${B()}`);
6475
6499
  };
6476
- function M(T, R) {
6477
- const N = [];
6478
- function U(ne, oe, ce) {
6479
- if (!ce)
6500
+ function M(T, P) {
6501
+ const D = [];
6502
+ function O(se, ae, le) {
6503
+ if (!le)
6480
6504
  return;
6481
6505
  const Re = (Le) => {
6482
- oe(Le) && ce(Le);
6506
+ ae(Le) && le(Le);
6483
6507
  };
6484
- T.bind(ne, Re), N.push({ event: ne, handler: Re });
6508
+ T.bind(se, Re), D.push({ event: se, handler: Re });
6485
6509
  }
6486
- return U("ConversationMessageSent", Yn, R.onMessageSent), U("ConversationMessageRead", Zn, R.onMessageRead), U("ConversationMessageEdited", es, R.onMessageEdited), U("ConversationMessageDeleted", ts, R.onMessageDeleted), U("MessageReactionToggled", ns, R.onReactionToggled), U("ConversationRequestAccepted", ss, R.onRequestAccepted), U("ConversationParticipantRemoved", rs, R.onParticipantRemoved), () => {
6487
- for (const ne of N)
6488
- T.unbind(ne.event, ne.handler);
6510
+ return O("ConversationMessageSent", Yn, P.onMessageSent), O("ConversationMessageRead", Zn, P.onMessageRead), O("ConversationMessageEdited", es, P.onMessageEdited), O("ConversationMessageDeleted", ts, P.onMessageDeleted), O("MessageReactionToggled", ns, P.onReactionToggled), O("ConversationRequestAccepted", ss, P.onRequestAccepted), O("ConversationParticipantRemoved", rs, P.onParticipantRemoved), () => {
6511
+ for (const se of D)
6512
+ T.unbind(se.event, se.handler);
6489
6513
  };
6490
6514
  }
6491
- const F = (T, R) => {
6492
- const N = L();
6493
- if (!N)
6515
+ const U = (T, P) => {
6516
+ const D = I();
6517
+ if (!D)
6494
6518
  return () => {
6495
6519
  };
6496
- const U = N.private(`conversation.${T}`), ne = U.subscription;
6497
- if (ne)
6498
- return M(ne, R);
6499
- const oe = [];
6500
- return R.onMessageSent && oe.push({
6520
+ const O = D.private(`conversation.${T}`), se = O.subscription;
6521
+ if (se)
6522
+ return M(se, P);
6523
+ const ae = [];
6524
+ return P.onMessageSent && ae.push({
6501
6525
  event: ".ConversationMessageSent",
6502
- handler: Fe(U, ".ConversationMessageSent", Yn, R.onMessageSent)
6503
- }), R.onMessageRead && oe.push({
6526
+ handler: Fe(O, ".ConversationMessageSent", Yn, P.onMessageSent)
6527
+ }), P.onMessageRead && ae.push({
6504
6528
  event: ".ConversationMessageRead",
6505
- handler: Fe(U, ".ConversationMessageRead", Zn, R.onMessageRead)
6506
- }), R.onMessageEdited && oe.push({
6529
+ handler: Fe(O, ".ConversationMessageRead", Zn, P.onMessageRead)
6530
+ }), P.onMessageEdited && ae.push({
6507
6531
  event: ".ConversationMessageEdited",
6508
- handler: Fe(U, ".ConversationMessageEdited", es, R.onMessageEdited)
6509
- }), R.onMessageDeleted && oe.push({
6532
+ handler: Fe(O, ".ConversationMessageEdited", es, P.onMessageEdited)
6533
+ }), P.onMessageDeleted && ae.push({
6510
6534
  event: ".ConversationMessageDeleted",
6511
- handler: Fe(U, ".ConversationMessageDeleted", ts, R.onMessageDeleted)
6512
- }), R.onReactionToggled && oe.push({
6535
+ handler: Fe(O, ".ConversationMessageDeleted", ts, P.onMessageDeleted)
6536
+ }), P.onReactionToggled && ae.push({
6513
6537
  event: ".MessageReactionToggled",
6514
- handler: Fe(U, ".MessageReactionToggled", ns, R.onReactionToggled)
6515
- }), R.onRequestAccepted && oe.push({
6538
+ handler: Fe(O, ".MessageReactionToggled", ns, P.onReactionToggled)
6539
+ }), P.onRequestAccepted && ae.push({
6516
6540
  event: ".ConversationRequestAccepted",
6517
- handler: Fe(U, ".ConversationRequestAccepted", ss, R.onRequestAccepted)
6518
- }), R.onParticipantRemoved && oe.push({
6541
+ handler: Fe(O, ".ConversationRequestAccepted", ss, P.onRequestAccepted)
6542
+ }), P.onParticipantRemoved && ae.push({
6519
6543
  event: ".ConversationParticipantRemoved",
6520
- handler: Fe(U, ".ConversationParticipantRemoved", rs, R.onParticipantRemoved)
6544
+ handler: Fe(O, ".ConversationParticipantRemoved", rs, P.onParticipantRemoved)
6521
6545
  }), () => {
6522
- if (typeof U.stopListening == "function")
6523
- for (const ce of oe)
6524
- U.stopListening(ce.event, ce.handler);
6546
+ if (typeof O.stopListening == "function")
6547
+ for (const le of ae)
6548
+ O.stopListening(le.event, le.handler);
6525
6549
  };
6526
- }, Z = (T) => {
6550
+ }, ne = (T) => {
6527
6551
  h?.leave(`conversation.${T}`);
6528
- }, ie = (T, R, N) => {
6529
- const U = T.private(`typing-conversation.${R}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), oe = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), ce = U.subscription;
6530
- if (ce) {
6531
- const we = (pe) => {
6532
- const ve = Qn(pe);
6533
- if (ve) {
6534
- if (ne.has(ve.state)) {
6535
- N.onTypingStart?.({
6536
- user_id: ve.user_id,
6537
- user: ve.user ?? {
6538
- id: ve.user_id,
6552
+ }, ue = (T, P, D) => {
6553
+ const O = T.private(`typing-conversation.${P}`), se = /* @__PURE__ */ new Set(["start", "typing"]), ae = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), le = O.subscription;
6554
+ if (le) {
6555
+ const we = (ge) => {
6556
+ const be = Qn(ge);
6557
+ if (be) {
6558
+ if (se.has(be.state)) {
6559
+ D.onTypingStart?.({
6560
+ user_id: be.user_id,
6561
+ user: be.user ?? {
6562
+ id: be.user_id,
6539
6563
  name: ""
6540
6564
  },
6541
- conversation_id: ve.conversation_id,
6542
- started_at: ve.started_at ?? ve.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6565
+ conversation_id: be.conversation_id,
6566
+ started_at: be.started_at ?? be.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6543
6567
  });
6544
6568
  return;
6545
6569
  }
6546
- oe.has(ve.state) && N.onTypingStop?.({
6547
- user_id: ve.user_id,
6548
- conversation_id: ve.conversation_id,
6549
- stopped_at: ve.stopped_at ?? ve.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6570
+ ae.has(be.state) && D.onTypingStop?.({
6571
+ user_id: be.user_id,
6572
+ conversation_id: be.conversation_id,
6573
+ stopped_at: be.stopped_at ?? be.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6550
6574
  });
6551
6575
  }
6552
6576
  };
6553
- return ce.bind("TypingStateChanged", we), () => {
6554
- ce.unbind("TypingStateChanged", we);
6577
+ return le.bind("TypingStateChanged", we), () => {
6578
+ le.unbind("TypingStateChanged", we);
6555
6579
  };
6556
6580
  }
6557
6581
  const Re = [], Le = (we) => {
6558
- const pe = Qn(we);
6559
- if (pe) {
6560
- if (ne.has(pe.state)) {
6561
- N.onTypingStart?.({
6562
- user_id: pe.user_id,
6563
- user: pe.user ?? {
6564
- id: pe.user_id,
6582
+ const ge = Qn(we);
6583
+ if (ge) {
6584
+ if (se.has(ge.state)) {
6585
+ D.onTypingStart?.({
6586
+ user_id: ge.user_id,
6587
+ user: ge.user ?? {
6588
+ id: ge.user_id,
6565
6589
  name: ""
6566
6590
  },
6567
- conversation_id: pe.conversation_id,
6568
- started_at: pe.started_at ?? pe.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6591
+ conversation_id: ge.conversation_id,
6592
+ started_at: ge.started_at ?? ge.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6569
6593
  });
6570
6594
  return;
6571
6595
  }
6572
- oe.has(pe.state) && N.onTypingStop?.({
6573
- user_id: pe.user_id,
6574
- conversation_id: pe.conversation_id,
6575
- stopped_at: pe.stopped_at ?? pe.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6596
+ ae.has(ge.state) && D.onTypingStop?.({
6597
+ user_id: ge.user_id,
6598
+ conversation_id: ge.conversation_id,
6599
+ stopped_at: ge.stopped_at ?? ge.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6576
6600
  });
6577
6601
  }
6578
6602
  };
6579
- return U.listen(".TypingStateChanged", Le), Re.push({ event: ".TypingStateChanged", handler: Le }), () => {
6580
- if (typeof U.stopListening == "function")
6603
+ return O.listen(".TypingStateChanged", Le), Re.push({ event: ".TypingStateChanged", handler: Le }), () => {
6604
+ if (typeof O.stopListening == "function")
6581
6605
  for (const we of Re)
6582
- U.stopListening(we.event, we.handler);
6606
+ O.stopListening(we.event, we.handler);
6583
6607
  };
6584
6608
  };
6585
6609
  return {
6586
6610
  apiClient: _,
6587
6611
  initializedEvent: n,
6588
- getEcho: L,
6589
- waitForEcho: async () => v === "account_suspended" ? null : await G(),
6612
+ getEcho: I,
6613
+ waitForEcho: async () => v === "account_suspended" ? null : await X(),
6590
6614
  getConnectionStatus: () => C,
6591
6615
  getAccessState: () => v,
6592
- onConnectionStatusChange: he,
6616
+ onConnectionStatusChange: fe,
6593
6617
  onAccessStateChange: Se,
6594
6618
  reconnect: async () => {
6595
- y("available"), z(), await G(!0);
6619
+ y("available"), q(), await X(!0);
6596
6620
  },
6597
- subscribeToPresenceStatus: q,
6598
- unsubscribeFromPresenceStatus: _e,
6599
- subscribeToConversation: F,
6600
- unsubscribeFromConversation: Z,
6601
- subscribeToTyping: (T, R) => {
6602
- const N = ut();
6603
- if (N)
6604
- return ie(N, T, R);
6605
- let U = !1, ne = null;
6606
- const oe = () => {
6607
- if (U)
6621
+ subscribeToPresenceStatus: N,
6622
+ unsubscribeFromPresenceStatus: Y,
6623
+ subscribeToConversation: U,
6624
+ unsubscribeFromConversation: ne,
6625
+ subscribeToTyping: (T, P) => {
6626
+ const D = ut();
6627
+ if (D)
6628
+ return ue(D, T, P);
6629
+ let O = !1, se = null;
6630
+ const ae = () => {
6631
+ if (O)
6608
6632
  return;
6609
- const ce = ut();
6610
- ce && (ne = ie(ce, T, R), typeof window < "u" && window.removeEventListener(ct(), oe));
6633
+ const le = ut();
6634
+ le && (se = ue(le, T, P), typeof window < "u" && window.removeEventListener(ct(), ae));
6611
6635
  };
6612
- return typeof window < "u" && window.addEventListener(ct(), oe), () => {
6613
- U = !0, typeof window < "u" && window.removeEventListener(ct(), oe), ne?.();
6636
+ return typeof window < "u" && window.addEventListener(ct(), ae), () => {
6637
+ O = !0, typeof window < "u" && window.removeEventListener(ct(), ae), se?.();
6614
6638
  };
6615
6639
  },
6616
6640
  unsubscribeFromTyping: (T) => {
@@ -6623,13 +6647,13 @@ export {
6623
6647
  go as DEFAULT_PRESENCE_STALE_AFTER_MS,
6624
6648
  hc as configureMessengerClient,
6625
6649
  pc as createMessengerEcho,
6626
- X as getApi,
6650
+ W as getApi,
6627
6651
  ke as getAuthStore,
6628
6652
  Rn as getConnectionStatus,
6629
6653
  Ae as getEcho,
6630
6654
  vs as getEchoConnectionStatus,
6631
6655
  Je as getEchoInitializedEvent,
6632
- Y as getErrorMessage,
6656
+ Z as getErrorMessage,
6633
6657
  Zt as getLoggerFactory,
6634
6658
  Vt as getMainApi,
6635
6659
  ut as getMainEcho,