@ethora/chat-component 26.7.9 → 26.8.1

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.
@@ -1,6 +1,6 @@
1
1
  import { jsxs as O, jsx as h, Fragment as Ee } from "react/jsx-runtime";
2
2
  import * as ct from "react";
3
- import Te, { useRef as X, useState as K, useCallback as G, useEffect as Y, useDebugValue as Zd, createElement as Fg, useContext as Ko, useMemo as ge, createContext as Qo, Fragment as Os, Suspense as Nl, useSyncExternalStore as jg, useLayoutEffect as Ug, forwardRef as Tp, lazy as xr, PureComponent as Bg } from "react";
3
+ import Te, { useRef as X, useState as K, useCallback as G, useEffect as Z, useDebugValue as Zd, createElement as Fg, useContext as Ko, useMemo as ge, createContext as Qo, Fragment as Os, Suspense as Nl, useSyncExternalStore as jg, useLayoutEffect as Ug, forwardRef as Tp, lazy as xr, PureComponent as Bg } from "react";
4
4
  import { createPortal as Pp } from "react-dom";
5
5
  function Yo(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -2427,8 +2427,8 @@ function l4() {
2427
2427
  }
2428
2428
  return io.xml = e, io.jid = t, io.client = w, io;
2429
2429
  }
2430
- var oe = l4();
2431
- const d4 = /* @__PURE__ */ Yo(oe);
2430
+ var te = l4();
2431
+ const d4 = /* @__PURE__ */ Yo(te);
2432
2432
  function u4(e, t, r, o) {
2433
2433
  const n = {
2434
2434
  senderJID: e.jid?.toString(),
@@ -2463,7 +2463,7 @@ function u4(e, t, r, o) {
2463
2463
  push: "true"
2464
2464
  };
2465
2465
  r?.attachments && (n.attachments = r.attachments);
2466
- const i = oe.xml(
2466
+ const i = te.xml(
2467
2467
  "message",
2468
2468
  {
2469
2469
  id: o,
@@ -2471,9 +2471,9 @@ function u4(e, t, r, o) {
2471
2471
  from: e.jid?.toString(),
2472
2472
  to: t
2473
2473
  },
2474
- oe.xml("body", {}, "media"),
2475
- oe.xml("store", { xmlns: "urn:xmpp:hints" }),
2476
- oe.xml("data", n)
2474
+ te.xml("body", {}, "media"),
2475
+ te.xml("store", { xmlns: "urn:xmpp:hints" }),
2476
+ te.xml("data", n)
2477
2477
  );
2478
2478
  e.send(i);
2479
2479
  }
@@ -2515,13 +2515,13 @@ async function Fp(e) {
2515
2515
  r(null);
2516
2516
  }
2517
2517
  }, e?.on?.("stanza", n);
2518
- const c = oe.xml(
2518
+ const c = te.xml(
2519
2519
  "iq",
2520
2520
  { id: t, type: "get" },
2521
- oe.xml(
2521
+ te.xml(
2522
2522
  "query",
2523
2523
  { xmlns: "jabber:iq:private" },
2524
- oe.xml("chatjson", { xmlns: "chatjson:store" })
2524
+ te.xml("chatjson", { xmlns: "chatjson:store" })
2525
2525
  )
2526
2526
  ), l = e?.send?.(c);
2527
2527
  if (!l || typeof l.catch != "function") {
@@ -2568,16 +2568,16 @@ async function u1(e, t) {
2568
2568
  o = (d) => {
2569
2569
  d.is("iq") && d.attrs.id === r && a(!0);
2570
2570
  }, e?.on("stanza", o);
2571
- const l = oe.xml(
2571
+ const l = te.xml(
2572
2572
  "iq",
2573
2573
  {
2574
2574
  id: r,
2575
2575
  type: "set"
2576
2576
  },
2577
- oe.xml(
2577
+ te.xml(
2578
2578
  "query",
2579
2579
  { xmlns: "jabber:iq:private" },
2580
- oe.xml("chatjson", { xmlns: "chatjson:store", value: t })
2580
+ te.xml("chatjson", { xmlns: "chatjson:store", value: t })
2581
2581
  )
2582
2582
  );
2583
2583
  e?.send(l);
@@ -2603,17 +2603,17 @@ function h4(e, t, r, o) {
2603
2603
  if (!t || typeof t != "string" || !t.includes("@"))
2604
2604
  return;
2605
2605
  let n = o ? `typing-${Date.now()}` : `stop-typing-${Date.now()}`;
2606
- const i = oe.xml(
2606
+ const i = te.xml(
2607
2607
  "message",
2608
2608
  {
2609
2609
  type: "groupchat",
2610
2610
  id: n,
2611
2611
  to: t
2612
2612
  },
2613
- oe.xml(o ? "composing" : "paused", {
2613
+ te.xml(o ? "composing" : "paused", {
2614
2614
  xmlns: "http://jabber.org/protocol/chatstates"
2615
2615
  }),
2616
- oe.xml("data", {
2616
+ te.xml("data", {
2617
2617
  fullName: r
2618
2618
  })
2619
2619
  );
@@ -2645,14 +2645,14 @@ const f1 = (e) => (e || "").replace(/^https?:\/\//, "").replace(/\/.*$/, "").tri
2645
2645
  }, v4 = (e, t) => e ? e.includes("@") ? e : t ? `${e}@${t}` : e : "", b4 = {}, w4 = b4 || {}, en = m4(w4), x4 = en.apiUrl, h1 = en.webUrl, S4 = en.xmppBaseDomain, jp = S4, No = en.xmppConference, Mo = en.service, C4 = (e, t, r, o, n, i, s, a, c, l, d, u, f, p) => {
2646
2646
  const m = f || (c ? `send-reply-message-${Date.now().toString()}` : `send-text-message-${Date.now().toString()}`);
2647
2647
  try {
2648
- const y = oe.xml(
2648
+ const y = te.xml(
2649
2649
  "message",
2650
2650
  {
2651
2651
  to: t,
2652
2652
  type: "groupchat",
2653
2653
  id: m
2654
2654
  },
2655
- oe.xml("data", {
2655
+ te.xml("data", {
2656
2656
  xmlns: u || Mo,
2657
2657
  senderFirstName: r,
2658
2658
  senderLastName: o,
@@ -2682,7 +2682,7 @@ const f1 = (e) => (e || "").replace(/^https?:\/\//, "").replace(/\/.*$/, "").tri
2682
2682
  ...p && p.length > 0 ? { mentions: JSON.stringify(p) } : {},
2683
2683
  push: "true"
2684
2684
  }),
2685
- oe.xml("body", {}, s)
2685
+ te.xml("body", {}, s)
2686
2686
  );
2687
2687
  return e.send(y), !0;
2688
2688
  } catch (y) {
@@ -2690,7 +2690,7 @@ const f1 = (e) => (e || "").replace(/^https?:\/\//, "").replace(/\/.*$/, "").tri
2690
2690
  }
2691
2691
  };
2692
2692
  function E4(e, t, r) {
2693
- const o = oe.xml(
2693
+ const o = te.xml(
2694
2694
  "message",
2695
2695
  {
2696
2696
  from: e.jid?.toString(),
@@ -2698,8 +2698,8 @@ function E4(e, t, r) {
2698
2698
  id: "deleteMessageStanza",
2699
2699
  type: "groupchat"
2700
2700
  },
2701
- oe.xml("body", "wow"),
2702
- oe.xml("delete", {
2701
+ te.xml("body", "wow"),
2702
+ te.xml("delete", {
2703
2703
  id: r
2704
2704
  })
2705
2705
  );
@@ -2735,14 +2735,14 @@ const T4 = () => `presenceInRoom-${Date.now().toString(36)}-${(++R4).toString(36
2735
2735
  u(a, p);
2736
2736
  }
2737
2737
  }, e.on("stanza", n);
2738
- const f = oe.xml(
2738
+ const f = te.xml(
2739
2739
  "presence",
2740
2740
  {
2741
2741
  from: e.jid?.toString(),
2742
2742
  to: `${t}/${e.jid?.getLocal()}`,
2743
2743
  id: s
2744
2744
  },
2745
- oe.xml("x", { xmlns: "http://jabber.org/protocol/muc" })
2745
+ te.xml("x", { xmlns: "http://jabber.org/protocol/muc" })
2746
2746
  );
2747
2747
  e.send(f).then(() => {
2748
2748
  const { promise: p, cancel: m } = Bl(
@@ -2762,21 +2762,21 @@ const T4 = () => `presenceInRoom-${Date.now().toString(36)}-${(++R4).toString(36
2762
2762
  });
2763
2763
  };
2764
2764
  function P4(e, t) {
2765
- const r = oe.xml(
2765
+ const r = te.xml(
2766
2766
  "iq",
2767
2767
  {
2768
2768
  type: "set",
2769
2769
  to: t,
2770
2770
  id: "GetArchive"
2771
2771
  },
2772
- oe.xml(
2772
+ te.xml(
2773
2773
  "query",
2774
2774
  { xmlns: "urn:xmpp:mam:2" },
2775
- oe.xml(
2775
+ te.xml(
2776
2776
  "set",
2777
2777
  { xmlns: "http://jabber.org/protocol/rsm" },
2778
- oe.xml("max", {}, "1"),
2779
- oe.xml("before")
2778
+ te.xml("max", {}, "1"),
2779
+ te.xml("before")
2780
2780
  )
2781
2781
  )
2782
2782
  );
@@ -5498,11 +5498,11 @@ const {
5498
5498
  editRoomMessage: jc,
5499
5499
  setMessageTranslation: ry,
5500
5500
  setComposing: oy,
5501
- setIsLoading: Ue,
5501
+ setIsLoading: je,
5502
5502
  setLastViewedTimestamp: Uc,
5503
5503
  setRoomNoMessages: uM,
5504
5504
  setRoomsLoadResolved: ny,
5505
- setCurrentRoom: je,
5505
+ setCurrentRoom: Ue,
5506
5506
  setMemberOnline: iy,
5507
5507
  setMemberOffline: sy,
5508
5508
  setChatUiVisible: O1,
@@ -8075,7 +8075,16 @@ const df = () => {
8075
8075
  // reopen a report dialog by itself.
8076
8076
  "presenceByRoom",
8077
8077
  "isLoading",
8078
- "reportRoom"
8078
+ "reportRoom",
8079
+ // Per-session facts about THIS page load's rooms fetch, for the same
8080
+ // reason isLoading is here. Rehydrating roomsLoadedOnce: true from a
8081
+ // previous session tells ChatRoom "the room list is final" before this
8082
+ // session has asked the server anything, which re-opens the empty-state
8083
+ // flash the flag exists to close (the persisted rooms map can come back
8084
+ // empty while the flag comes back true: eviction by the size cap, a
8085
+ // sanitized-away ghost room, or a different account signing in).
8086
+ "roomsLoadedOnce",
8087
+ "roomsLoadError"
8079
8088
  ],
8080
8089
  transforms: [W6, V6, Fm]
8081
8090
  }, Q6 = Bp({
@@ -8185,12 +8194,12 @@ function jm(e, t) {
8185
8194
  }
8186
8195
  }
8187
8196
  }, t.on("stanza", r);
8188
- const c = oe.xml(
8197
+ const c = te.xml(
8189
8198
  "presence",
8190
8199
  {
8191
8200
  to: `${e}/${t.jid.getLocal()}`
8192
8201
  },
8193
- oe.xml("x", "http://jabber.org/protocol/muc")
8202
+ te.xml("x", "http://jabber.org/protocol/muc")
8194
8203
  );
8195
8204
  t.send(c);
8196
8205
  }), i = Zi(2e3, o);
@@ -8205,17 +8214,17 @@ function Um(e, t) {
8205
8214
  o = (l) => {
8206
8215
  l.is("iq") && l.attrs.id === r && l.attrs.type === "result" && (n(), a(!0));
8207
8216
  }, t.on("stanza", o);
8208
- const c = oe.xml(
8217
+ const c = te.xml(
8209
8218
  "iq",
8210
8219
  {
8211
8220
  to: e,
8212
8221
  id: r,
8213
8222
  type: "set"
8214
8223
  },
8215
- oe.xml(
8224
+ te.xml(
8216
8225
  "query",
8217
8226
  { xmlns: "http://jabber.org/protocol/muc#owner" },
8218
- oe.xml("x", { xmlns: "jabber:x:data", type: "submit" })
8227
+ te.xml("x", { xmlns: "jabber:x:data", type: "submit" })
8219
8228
  )
8220
8229
  );
8221
8230
  t.send(c);
@@ -8231,33 +8240,33 @@ function Bm(e, t, r, o) {
8231
8240
  i = (u) => {
8232
8241
  u.attrs.id === n && u.attrs.type === "result" && (s(), l(!0));
8233
8242
  }, o.on("stanza", i);
8234
- const d = oe.xml(
8243
+ const d = te.xml(
8235
8244
  "iq",
8236
8245
  {
8237
8246
  id: n,
8238
8247
  to: e,
8239
8248
  type: "set"
8240
8249
  },
8241
- oe.xml(
8250
+ te.xml(
8242
8251
  "query",
8243
8252
  { xmlns: "http://jabber.org/protocol/muc#owner" },
8244
- oe.xml(
8253
+ te.xml(
8245
8254
  "x",
8246
8255
  { xmlns: "jabber:x:data", type: "submit" },
8247
- oe.xml(
8256
+ te.xml(
8248
8257
  "field",
8249
8258
  { var: "FORM_TYPE" },
8250
- oe.xml("value", {}, "http://jabber.org/protocol/muc#roomconfig")
8259
+ te.xml("value", {}, "http://jabber.org/protocol/muc#roomconfig")
8251
8260
  ),
8252
- oe.xml(
8261
+ te.xml(
8253
8262
  "field",
8254
8263
  { var: "muc#roomconfig_roomname" },
8255
- oe.xml("value", {}, t)
8264
+ te.xml("value", {}, t)
8256
8265
  ),
8257
- oe.xml(
8266
+ te.xml(
8258
8267
  "field",
8259
8268
  { var: "muc#roomconfig_roomdesc" },
8260
- oe.xml("value", {}, r)
8269
+ te.xml("value", {}, r)
8261
8270
  )
8262
8271
  )
8263
8272
  )
@@ -8278,13 +8287,13 @@ async function t8(e, t, r) {
8278
8287
  }
8279
8288
  function r8(e, t, r, o, n) {
8280
8289
  {
8281
- const i = oe.xml(
8290
+ const i = te.xml(
8282
8291
  "iq",
8283
8292
  {
8284
8293
  id: r === "icon" ? "setRoomImage" : "setRoomBackgroundImage",
8285
8294
  type: "set"
8286
8295
  },
8287
- oe.xml("query", {
8296
+ te.xml("query", {
8288
8297
  xmlns: "ns:getrooms:setprofile",
8289
8298
  room_thumbnail: t,
8290
8299
  room_background: n || "",
@@ -8295,24 +8304,24 @@ function r8(e, t, r, o, n) {
8295
8304
  }
8296
8305
  }
8297
8306
  const o8 = (e, t) => {
8298
- const r = oe.xml(
8307
+ const r = te.xml(
8299
8308
  "iq",
8300
8309
  {
8301
8310
  id: "roomMemberInfo",
8302
8311
  type: "get"
8303
8312
  },
8304
- oe.xml("query", { xmlns: "ns:room:last", room: e })
8313
+ te.xml("query", { xmlns: "ns:room:last", room: e })
8305
8314
  );
8306
8315
  t.send(r);
8307
8316
  }, n8 = (e, t) => {
8308
- const r = oe.xml(
8317
+ const r = te.xml(
8309
8318
  "iq",
8310
8319
  {
8311
8320
  id: "roomInfo",
8312
8321
  to: e,
8313
8322
  type: "get"
8314
8323
  },
8315
- oe.xml("query", { xmlns: "http://jabber.org/protocol/disco#info" })
8324
+ te.xml("query", { xmlns: "http://jabber.org/protocol/disco#info" })
8316
8325
  );
8317
8326
  t.send(r);
8318
8327
  }, i8 = (e, t) => {
@@ -8320,21 +8329,21 @@ const o8 = (e, t) => {
8320
8329
  throw new Error(
8321
8330
  "Client JID is not set. Ensure the client is authenticated before calling this function."
8322
8331
  );
8323
- const r = oe.xml("presence", {
8332
+ const r = te.xml("presence", {
8324
8333
  to: `${e}/${t.jid.getLocal()}`,
8325
8334
  type: "unavailable"
8326
8335
  });
8327
8336
  t.send(r);
8328
8337
  };
8329
8338
  async function s8(e, t, r, o) {
8330
- const n = `edit-message-${Date.now().toString()}`, i = oe.xml(
8339
+ const n = `edit-message-${Date.now().toString()}`, i = te.xml(
8331
8340
  "message",
8332
8341
  {
8333
8342
  to: t,
8334
8343
  type: "groupchat",
8335
8344
  id: n
8336
8345
  },
8337
- oe.xml(
8346
+ te.xml(
8338
8347
  "replace",
8339
8348
  {
8340
8349
  id: r,
@@ -8345,44 +8354,44 @@ async function s8(e, t, r, o) {
8345
8354
  e.send(i);
8346
8355
  }
8347
8356
  async function a8(e, t, r) {
8348
- const o = `invite-rooms:${Date.now().toString()}`, n = oe.xml(
8357
+ const o = `invite-rooms:${Date.now().toString()}`, n = te.xml(
8349
8358
  "message",
8350
8359
  {
8351
8360
  to: r,
8352
8361
  id: o
8353
8362
  },
8354
- oe.xml(
8363
+ te.xml(
8355
8364
  "x",
8356
8365
  "http://jabber.org/protocol/muc#user",
8357
- oe.xml("invite", { to: t + e8 })
8366
+ te.xml("invite", { to: t + e8 })
8358
8367
  )
8359
8368
  );
8360
8369
  e.send(n);
8361
8370
  }
8362
8371
  const Hm = "ethora:chats:members-refresh";
8363
8372
  async function c8(e, t, r, o = "member") {
8364
- const n = `members-changed-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`, i = oe.xml(
8373
+ const n = `members-changed-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`, i = te.xml(
8365
8374
  "message",
8366
8375
  { to: t, type: "groupchat", id: n },
8367
- oe.xml("members-refresh", { xmlns: Hm }),
8368
- oe.xml("no-store", "urn:xmpp:hints"),
8369
- oe.xml(
8376
+ te.xml("members-refresh", { xmlns: Hm }),
8377
+ te.xml("no-store", "urn:xmpp:hints"),
8378
+ te.xml(
8370
8379
  "x",
8371
8380
  "http://jabber.org/protocol/muc#user",
8372
- oe.xml("item", { affiliation: o, nick: r })
8381
+ te.xml("item", { affiliation: o, nick: r })
8373
8382
  )
8374
8383
  );
8375
8384
  e.send(i);
8376
8385
  }
8377
8386
  const l8 = async (e) => {
8378
- const t = oe.xml(
8387
+ const t = te.xml(
8379
8388
  "iq",
8380
8389
  {
8381
8390
  type: "get",
8382
8391
  from: e.jid?.toString(),
8383
8392
  id: "getUserRooms"
8384
8393
  },
8385
- oe.xml("query", { xmlns: "ns:getrooms" })
8394
+ te.xml("query", { xmlns: "ns:getrooms" })
8386
8395
  );
8387
8396
  try {
8388
8397
  return await e.send(t), null;
@@ -11092,7 +11101,7 @@ async function ps(e) {
11092
11101
  } catch (i) {
11093
11102
  if (Pe.isCancel(i))
11094
11103
  throw i;
11095
- return q.log("Error loading rooms"), { items: [] };
11104
+ return q.log("Error loading rooms"), { items: [], failed: !0 };
11096
11105
  } finally {
11097
11106
  Un = null, Ja = "";
11098
11107
  }
@@ -11763,7 +11772,7 @@ const zi = new Uv(), fi = (e) => e ? String(e).split("@")[0] : "", D2 = (e) => {
11763
11772
  lastViewedTimestamp: 0,
11764
11773
  historyPreloadState: "idle"
11765
11774
  };
11766
- j.dispatch(mm({ roomData: c })), j.getState().rooms.activeRoomJID || j.dispatch(je({ roomJID: r }));
11775
+ j.dispatch(mm({ roomData: c })), j.getState().rooms.activeRoomJID || j.dispatch(Ue({ roomJID: r }));
11767
11776
  }
11768
11777
  await t.presenceInRoomStanza(r, 0, 1500, !0).catch(() => !1) || t.prioritizeRoomPresence(r).catch(() => {
11769
11778
  }), t.getHistoryStanza(r, 20, void 0, void 0, {
@@ -11829,7 +11838,7 @@ const zi = new Uv(), fi = (e) => e ? String(e).split("@")[0] : "", D2 = (e) => {
11829
11838
  );
11830
11839
  }
11831
11840
  }, r9 = (e, t) => {
11832
- j.dispatch(je({ roomJID: e.attrs.from })), t.getRoomsStanza();
11841
+ j.dispatch(Ue({ roomJID: e.attrs.from })), t.getRoomsStanza();
11833
11842
  }, o9 = (e, t) => {
11834
11843
  e.attrs.id === "getUserRooms" && Array.isArray(e.getChild("query")?.children) && e.getChild("query")?.children.forEach(async (r) => {
11835
11844
  const o = j.getState().rooms.rooms;
@@ -11849,7 +11858,7 @@ const zi = new Uv(), fi = (e) => e ? String(e).split("@")[0] : "", D2 = (e) => {
11849
11858
  lastViewedTimestamp: 0,
11850
11859
  historyPreloadState: "idle"
11851
11860
  };
11852
- j.dispatch(mm({ roomData: { ...i } })), j.getState().rooms.activeRoomJID || j.dispatch(je({ roomJID: i.jid })), i.jid && t.presencesReady && t.presenceInRoomStanza(i.jid, 0, 5e3, !1);
11861
+ j.dispatch(mm({ roomData: { ...i } })), j.getState().rooms.activeRoomJID || j.dispatch(Ue({ roomJID: i.jid })), i.jid && t.presencesReady && t.presenceInRoomStanza(i.jid, 0, 5e3, !1);
11853
11862
  } catch {
11854
11863
  }
11855
11864
  });
@@ -12211,14 +12220,14 @@ const zi = new Uv(), fi = (e) => e ? String(e).split("@")[0] : "", D2 = (e) => {
12211
12220
  if (!i) return;
12212
12221
  const s = o.callId || "", a = o.roomBareName || (o.roomJid || "").split("@")[0] || "";
12213
12222
  try {
12214
- const c = oe.xml(
12223
+ const c = te.xml(
12215
12224
  "message",
12216
12225
  {
12217
12226
  to: n.includes("@") ? n : `${n}@${i}`,
12218
12227
  type: "chat",
12219
12228
  id: `call-state-${Date.now()}`
12220
12229
  },
12221
- oe.xml("data", {
12230
+ te.xml("data", {
12222
12231
  type: "call-state",
12223
12232
  state: e,
12224
12233
  callId: s,
@@ -12236,14 +12245,14 @@ const zi = new Uv(), fi = (e) => e ? String(e).split("@")[0] : "", D2 = (e) => {
12236
12245
  const n = r.host || "";
12237
12246
  if (n)
12238
12247
  try {
12239
- const i = oe.xml(
12248
+ const i = te.xml(
12240
12249
  "message",
12241
12250
  {
12242
12251
  to: o.includes("@") ? o : `${o}@${n}`,
12243
12252
  type: "chat",
12244
12253
  id: `call-invite-${Date.now()}`
12245
12254
  },
12246
- oe.xml("data", {
12255
+ te.xml("data", {
12247
12256
  type: "call-invite",
12248
12257
  kind: e,
12249
12258
  room: t.roomBareName || "",
@@ -12280,18 +12289,18 @@ function T9(e, t) {
12280
12289
  }
12281
12290
  }
12282
12291
  function P9(e, t) {
12283
- const r = oe.xml(
12292
+ const r = te.xml(
12284
12293
  "iq",
12285
12294
  {
12286
12295
  type: "set",
12287
12296
  id: "setVcard"
12288
12297
  },
12289
- oe.xml(
12298
+ te.xml(
12290
12299
  "vCard",
12291
12300
  {
12292
12301
  xmlns: "vcard-temp"
12293
12302
  },
12294
- oe.xml("FN", null, e)
12303
+ te.xml("FN", null, e)
12295
12304
  )
12296
12305
  );
12297
12306
  t.send(r);
@@ -12310,7 +12319,7 @@ function M9(e, t, r, o, n, i) {
12310
12319
  const s = `message-reaction:${Date.now().toString()}`, a = {
12311
12320
  senderFirstName: n.firstName,
12312
12321
  senderLastName: n.lastName
12313
- }, c = oe.xml(
12322
+ }, c = te.xml(
12314
12323
  "message",
12315
12324
  {
12316
12325
  id: s,
@@ -12318,40 +12327,40 @@ function M9(e, t, r, o, n, i) {
12318
12327
  from: e.jid?.toString(),
12319
12328
  to: r
12320
12329
  },
12321
- oe.xml(
12330
+ te.xml(
12322
12331
  "reactions",
12323
12332
  {
12324
12333
  id: t,
12325
12334
  from: e.jid?.toString(),
12326
12335
  xmlns: "urn:xmpp:reactions:0"
12327
12336
  },
12328
- ...o.map((l) => oe.xml("reaction", {}, l ?? ""))
12337
+ ...o.map((l) => te.xml("reaction", {}, l ?? ""))
12329
12338
  // xml('reaction', {}, reactionSymbol ?? '👋'),
12330
12339
  ),
12331
- oe.xml("data", a),
12332
- oe.xml("store", { xmlns: "urn:xmpp:hints" })
12340
+ te.xml("data", a),
12341
+ te.xml("store", { xmlns: "urn:xmpp:hints" })
12333
12342
  );
12334
12343
  e.send(c);
12335
12344
  }
12336
12345
  const I9 = (e, t, r, o) => {
12337
12346
  const n = o || `get-translate-messsage:${Date.now().toString()}`;
12338
12347
  try {
12339
- const { mentions: i, ...s } = t, a = oe.xml(
12348
+ const { mentions: i, ...s } = t, a = te.xml(
12340
12349
  "message",
12341
12350
  {
12342
12351
  to: t.roomJID,
12343
12352
  type: "groupchat",
12344
12353
  id: n
12345
12354
  },
12346
- oe.xml("data", {
12355
+ te.xml("data", {
12347
12356
  ...s,
12348
12357
  // Same side-channel encoding as sendTextMessage.xmpp.ts: a JSON
12349
12358
  // array of {jid, name, offset, length} spans into `userMessage`.
12350
12359
  ...i && i.length > 0 ? { mentions: JSON.stringify(i) } : {},
12351
12360
  push: "true"
12352
12361
  }),
12353
- oe.xml("body", {}, t.userMessage),
12354
- oe.xml("translate", { source: r })
12362
+ te.xml("body", {}, t.userMessage),
12363
+ te.xml("translate", { source: r })
12355
12364
  );
12356
12365
  return e.send(a), !0;
12357
12366
  } catch (i) {
@@ -12367,13 +12376,13 @@ const I9 = (e, t, r, o) => {
12367
12376
  o = (m) => {
12368
12377
  m.is("iq") && m.attrs.id === "getUserRoomsPaged" && (a = !0, c?.(), n(), i(m));
12369
12378
  }, e.on("stanza", o);
12370
- const l = oe.xml("query", { xmlns: "ns:getrooms" }), d = oe.xml(
12379
+ const l = te.xml("query", { xmlns: "ns:getrooms" }), d = te.xml(
12371
12380
  "set",
12372
12381
  { xmlns: "http://jabber.org/protocol/rsm" },
12373
- oe.xml("max", {}, t.toString())
12382
+ te.xml("max", {}, t.toString())
12374
12383
  );
12375
- r && d.append(oe.xml("before", {}, r)), l.append(d);
12376
- const u = oe.xml(
12384
+ r && d.append(te.xml("before", {}, r)), l.append(d);
12385
+ const u = te.xml(
12377
12386
  "iq",
12378
12387
  { type: "get", from: e.jid?.toString(), id: "getUserRoomsPaged" },
12379
12388
  l
@@ -12457,10 +12466,10 @@ async function O9(e, t) {
12457
12466
  function Qa(e, t, r) {
12458
12467
  if (e.status !== "online" || e._status === "closing" || e._status === "closed")
12459
12468
  return null;
12460
- const o = "ping-" + Date.now() + "-" + Math.floor(Math.random() * 1e4), n = oe.xml(
12469
+ const o = "ping-" + Date.now() + "-" + Math.floor(Math.random() * 1e4), n = te.xml(
12461
12470
  "iq",
12462
12471
  { type: "get", to: t, id: o },
12463
- oe.xml("ping", "urn:xmpp:ping")
12472
+ te.xml("ping", "urn:xmpp:ping")
12464
12473
  );
12465
12474
  return e.send(n), o;
12466
12475
  }
@@ -12818,7 +12827,7 @@ class U9 {
12818
12827
  this.resource = t.resource || "default", q.log("Client is online.", /* @__PURE__ */ new Date()), this.status = "online", this.authFailureDetected = !1, this.authRecoveryAttempts = 0, this.reconnectAttempts = 0, this.offlineReconnectAttempts = 0, this.pausedDueToOfflineCap = !1, this.reconnectTimer && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
12819
12828
  try {
12820
12829
  const o = Date.now();
12821
- q.log("[XMPP] online: sendPresence:start"), this.client.send(oe.xml("presence")), q.log("[XMPP] online: sendPresence:done"), q.log(
12830
+ q.log("[XMPP] online: sendPresence:start"), this.client.send(te.xml("presence")), q.log("[XMPP] online: sendPresence:done"), q.log(
12822
12831
  `[InitTiming] online:send_presence ${Date.now() - o}ms`
12823
12832
  );
12824
12833
  } catch (o) {
@@ -13353,21 +13362,21 @@ class U9 {
13353
13362
  timeout: c,
13354
13363
  resolve: a
13355
13364
  });
13356
- const l = oe.xml(
13365
+ const l = te.xml(
13357
13366
  "iq",
13358
13367
  {
13359
13368
  type: "set",
13360
13369
  to: s,
13361
13370
  id: n
13362
13371
  },
13363
- oe.xml(
13372
+ te.xml(
13364
13373
  "query",
13365
13374
  { xmlns: "urn:xmpp:mam:2", queryid: n },
13366
- oe.xml(
13375
+ te.xml(
13367
13376
  "set",
13368
13377
  { xmlns: "http://jabber.org/protocol/rsm" },
13369
- oe.xml("max", {}, r.toString()),
13370
- o ? oe.xml("before", {}, o.toString()) : oe.xml("before")
13378
+ te.xml("max", {}, r.toString()),
13379
+ o ? te.xml("before", {}, o.toString()) : te.xml("before")
13371
13380
  )
13372
13381
  )
13373
13382
  );
@@ -14230,17 +14239,17 @@ async function eb(e, t, r) {
14230
14239
  }
14231
14240
  }
14232
14241
  }, e.on("stanza", n);
14233
- const u = e.jid?.getLocal() || "", f = oe.xml(
14242
+ const u = e.jid?.getLocal() || "", f = te.xml(
14234
14243
  "iq",
14235
14244
  {
14236
14245
  to: t,
14237
14246
  type: "set",
14238
14247
  id: o
14239
14248
  },
14240
- oe.xml(
14249
+ te.xml(
14241
14250
  "subscribe",
14242
14251
  { xmlns: "urn:xmpp:mucsub:0", nick: u },
14243
- oe.xml("event", { node: "urn:xmpp:mucsub:nodes:messages" })
14252
+ te.xml("event", { node: "urn:xmpp:mucsub:nodes:messages" })
14244
14253
  )
14245
14254
  );
14246
14255
  try {
@@ -14405,7 +14414,7 @@ const $2 = (e = {}) => {
14405
14414
  );
14406
14415
  return;
14407
14416
  }
14408
- N && l(je({ roomJID: N })), q.log(
14417
+ N && l(Ue({ roomJID: N })), q.log(
14409
14418
  "[PushNotifications] incoming call push without LiveKit token; awaiting XMPP call-token",
14410
14419
  { callId: _.callId, roomJid: N }
14411
14420
  );
@@ -14442,7 +14451,7 @@ const $2 = (e = {}) => {
14442
14451
  }
14443
14452
  return;
14444
14453
  }
14445
- B && (l(je({ roomJID: B })), M(B, J ? String(J) : void 0));
14454
+ B && (l(Ue({ roomJID: B })), M(B, J ? String(J) : void 0));
14446
14455
  },
14447
14456
  [a?.pushNotifications?.onClick, l, M, x, e.onClick, I]
14448
14457
  ), E = G(async () => {
@@ -14498,7 +14507,7 @@ const $2 = (e = {}) => {
14498
14507
  i,
14499
14508
  o
14500
14509
  ]);
14501
- return Y(() => {
14510
+ return Z(() => {
14502
14511
  if (!r || typeof window > "u") return;
14503
14512
  const k = (_) => {
14504
14513
  const N = _.data ?? {};
@@ -14506,14 +14515,14 @@ const $2 = (e = {}) => {
14506
14515
  I(N);
14507
14516
  return;
14508
14517
  }
14509
- const F = _.notification?.title || N.title || "New message", B = _.notification?.body || N.body || "You have a new message.", J = x(N.jid || ""), z = N.userJid || "", ie = _.messageId || N.msgID || String(Date.now()), L = D2(_), $ = document.visibilityState === "visible", U = Date.now(), D = _.messageId || N.msgID || `${J}|${z}|${F}|${B}`, H = m.current.get(D), re = _.messageId || N.msgID, Z = Wv(s, re), ee = !!(H && U - H < 3e4), te = window._ethoraAppLoadTime || Date.now(), ue = Date.now() - te < 2e3, Q = L ? !1 : !!_.isHistory, de = qv({
14518
+ const F = _.notification?.title || N.title || "New message", B = _.notification?.body || N.body || "You have a new message.", J = x(N.jid || ""), z = N.userJid || "", ie = _.messageId || N.msgID || String(Date.now()), L = D2(_), $ = document.visibilityState === "visible", U = Date.now(), D = _.messageId || N.msgID || `${J}|${z}|${F}|${B}`, H = m.current.get(D), ee = _.messageId || N.msgID, re = Wv(s, ee), oe = !!(H && U - H < 3e4), Q = window._ethoraAppLoadTime || Date.now(), ce = Date.now() - Q < 2e3, Y = L ? !1 : !!_.isHistory, ue = qv({
14510
14519
  config: a,
14511
14520
  tabVisible: $,
14512
- alreadyInStore: Z,
14513
- deduped: ee,
14521
+ alreadyInStore: re,
14522
+ deduped: oe,
14514
14523
  isSystem: L,
14515
- isHistory: Q,
14516
- isCatchup: ue
14524
+ isHistory: Y,
14525
+ isCatchup: ce
14517
14526
  }), se = L && a?.inAppNotifications?.enabled === !0 && $, pe = {
14518
14527
  id: ie,
14519
14528
  user: {
@@ -14525,12 +14534,12 @@ const $2 = (e = {}) => {
14525
14534
  body: B,
14526
14535
  roomJid: J
14527
14536
  }, ve = L ? "System" : J || F, Ie = L ? "System" : z || "Ethora";
14528
- if ((se || de.show) && zi.showNotification(
14537
+ if ((se || ue.show) && zi.showNotification(
14529
14538
  pe,
14530
14539
  ve,
14531
14540
  Ie,
14532
14541
  J
14533
- ), m.current.set(D, U), J && !Z && M(J, re), a?.useStoreConsoleEnabled) {
14542
+ ), m.current.set(D, U), J && !re && M(J, ee), a?.useStoreConsoleEnabled) {
14534
14543
  const ze = N2({ config: a, tabVisible: $ });
14535
14544
  q.log(`[NotifyPolicy] source=push action=check_os_delegated show=${ze.show} reason=${ze.reason} msgId=${ie}`);
14536
14545
  }
@@ -14540,7 +14549,7 @@ const $2 = (e = {}) => {
14540
14549
  }, e.firebaseConfig || a?.pushNotifications?.firebaseConfig)), yo.add(k), () => {
14541
14550
  yo.delete(k), yo.size === 0 && vo && (vo(), vo = null);
14542
14551
  };
14543
- }, [a, r, s, x, M, I]), Y(() => {
14552
+ }, [a, r, s, x, M, I]), Z(() => {
14544
14553
  if (!r || typeof window > "u" || !("serviceWorker" in navigator)) return;
14545
14554
  const k = (_) => {
14546
14555
  const N = _?.data;
@@ -14563,7 +14572,7 @@ const $2 = (e = {}) => {
14563
14572
  return navigator.serviceWorker.addEventListener("message", k), () => {
14564
14573
  navigator.serviceWorker.removeEventListener("message", k);
14565
14574
  };
14566
- }, [r, T]), Y(() => {
14575
+ }, [r, T]), Z(() => {
14567
14576
  if (!r || typeof window > "u") return;
14568
14577
  const k = new URL(window.location.href);
14569
14578
  if (k.searchParams.get("fromPush") !== "1") return;
@@ -14584,11 +14593,11 @@ const $2 = (e = {}) => {
14584
14593
  k.searchParams.delete("fromPush"), window.history.replaceState({}, document.title, k.toString());
14585
14594
  } catch {
14586
14595
  }
14587
- }, [r, T]), Y(() => {
14596
+ }, [r, T]), Z(() => {
14588
14597
  (!n || b.current !== i) && (d.current = !1, u.current = null, p(null), el(""), y.current = "", g.current = !1, go = !1, Cr = null), b.current = i || "";
14589
- }, [n, i]), Y(() => {
14598
+ }, [n, i]), Z(() => {
14590
14599
  n && (t || d.current || (d.current = !0, E()));
14591
- }, [n, t, E]), Y(() => {
14600
+ }, [n, t, E]), Z(() => {
14592
14601
  if (!r || !n || t || typeof window > "u" || typeof Notification > "u") return;
14593
14602
  const k = () => {
14594
14603
  go || Notification.permission === "granted" && E();
@@ -14596,7 +14605,7 @@ const $2 = (e = {}) => {
14596
14605
  return window.addEventListener("focus", k), document.addEventListener("visibilitychange", k), () => {
14597
14606
  window.removeEventListener("focus", k), document.removeEventListener("visibilitychange", k);
14598
14607
  };
14599
- }, [r, t, n, E]), Y(() => {
14608
+ }, [r, t, n, E]), Z(() => {
14600
14609
  if (!r || !f) return;
14601
14610
  const k = Object.keys(s || {}).filter(fn).sort(), _ = k.map((B) => `${B}:${c[B] || "idle"}`).join(",");
14602
14611
  if (_ === y.current)
@@ -16259,17 +16268,17 @@ function $w(e, t, r) {
16259
16268
  return (function(x, R, M) {
16260
16269
  var I = x.attrs, T = x.componentStyle, E = x.defaultProps, P = x.foldedComponentIds, k = x.styledComponentId, _ = x.target, N = Te.useContext(p0), F = mh(), B = x.shouldForwardProp || F.shouldForwardProp;
16261
16270
  process.env.NODE_ENV !== "production" && Zd(k);
16262
- var J = ow(R, N, E) || Wr, z = (function(H, re, Z) {
16263
- for (var ee, te = tt(tt({}, re), { className: void 0, theme: Z }), ue = 0; ue < H.length; ue += 1) {
16264
- var Q = Jr(ee = H[ue]) ? ee(te) : ee;
16265
- for (var de in Q) te[de] = de === "className" ? nr(te[de], Q[de]) : de === "style" ? tt(tt({}, te[de]), Q[de]) : Q[de];
16271
+ var J = ow(R, N, E) || Wr, z = (function(H, ee, re) {
16272
+ for (var oe, Q = tt(tt({}, ee), { className: void 0, theme: re }), ce = 0; ce < H.length; ce += 1) {
16273
+ var Y = Jr(oe = H[ce]) ? oe(Q) : oe;
16274
+ for (var ue in Y) Q[ue] = ue === "className" ? nr(Q[ue], Y[ue]) : ue === "style" ? tt(tt({}, Q[ue]), Y[ue]) : Y[ue];
16266
16275
  }
16267
- return re.className && (te.className = nr(te.className, re.className)), te;
16276
+ return ee.className && (Q.className = nr(Q.className, ee.className)), Q;
16268
16277
  })(I, R, J), ie = z.as || _, L = {};
16269
16278
  for (var $ in z) z[$] === void 0 || $[0] === "$" || $ === "as" || $ === "theme" && z.theme === J || ($ === "forwardedAs" ? L.as = z.forwardedAs : B && !B($, ie) || (L[$] = z[$], B || process.env.NODE_ENV !== "development" || Ob($) || yh.has($) || !sl.has(ie) || (yh.add($), console.warn('styled-components: it looks like an unknown prop "'.concat($, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
16270
- var U = (function(H, re) {
16271
- var Z = mh(), ee = H.generateAndInjectStyles(re, Z.styleSheet, Z.stylis);
16272
- return process.env.NODE_ENV !== "production" && Zd(ee), ee;
16279
+ var U = (function(H, ee) {
16280
+ var re = mh(), oe = H.generateAndInjectStyles(ee, re.styleSheet, re.stylis);
16281
+ return process.env.NODE_ENV !== "production" && Zd(oe), oe;
16273
16282
  })(T, z);
16274
16283
  process.env.NODE_ENV !== "production" && x.warnTooManyClasses && x.warnTooManyClasses(U);
16275
16284
  var D = nr(P, k);
@@ -16590,7 +16599,7 @@ const Fw = 10, jw = /<bot-data\b[^>]*\btype\s*=\s*["']?buttons["']?[^>]*>([\s\S]
16590
16599
  ] });
16591
16600
  }, y0 = () => {
16592
16601
  const [e, t] = K(() => typeof document > "u" ? !1 : !document.hidden);
16593
- return Y(() => {
16602
+ return Z(() => {
16594
16603
  if (typeof document > "u")
16595
16604
  return;
16596
16605
  const r = () => {
@@ -16645,20 +16654,20 @@ const ax = Qo(void 0), cx = 3, lx = 3e4, dx = ({ children: e, config: t }) => {
16645
16654
  (B) => B.filter((J) => F - J.timestamp < y)
16646
16655
  );
16647
16656
  }, [y]);
16648
- Y(() => {
16657
+ Z(() => {
16649
16658
  const F = setInterval(() => {
16650
16659
  n && I();
16651
16660
  }, 1e3);
16652
16661
  return () => clearInterval(F);
16653
- }, [n, I]), Y(() => {
16662
+ }, [n, I]), Z(() => {
16654
16663
  n && I();
16655
16664
  }, [n, I]);
16656
16665
  const T = G((F) => {
16657
16666
  F && o((B) => B.filter((J) => J.roomJID !== F));
16658
16667
  }, []);
16659
- Y(() => {
16668
+ Z(() => {
16660
16669
  s && T(s);
16661
- }, [s, T]), Y(() => {
16670
+ }, [s, T]), Z(() => {
16662
16671
  p && typeof window < "u" && "Notification" in window && Notification.permission === "default" && Notification.requestPermission();
16663
16672
  }, [p]);
16664
16673
  const E = G(() => {
@@ -16679,7 +16688,7 @@ const ax = Qo(void 0), cx = 3, lx = 3e4, dx = ({ children: e, config: t }) => {
16679
16688
  });
16680
16689
  return;
16681
16690
  }
16682
- F && (i(je({ roomJID: F })), setTimeout(() => {
16691
+ F && (i(Ue({ roomJID: F })), setTimeout(() => {
16683
16692
  const $ = document.querySelector(`[data-message-id="${B}"]`);
16684
16693
  $ && ($.scrollIntoView({ behavior: "smooth", block: "center" }), $.classList.add(Et), setTimeout(() => $.classList.remove(Et), 2e3));
16685
16694
  }, 100));
@@ -16696,11 +16705,11 @@ const ax = Qo(void 0), cx = 3, lx = 3e4, dx = ({ children: e, config: t }) => {
16696
16705
  timestamp: Date.now()
16697
16706
  };
16698
16707
  o((U) => {
16699
- const D = Date.now(), H = U.filter((Z) => D - Z.timestamp < y);
16700
- if (ie !== `${z}:` && H.some((ee) => `${ee.roomJID}:${String(ee.message?.xmppId || ee.message?.id || "").trim()}` === ie))
16708
+ const D = Date.now(), H = U.filter((re) => D - re.timestamp < y);
16709
+ if (ie !== `${z}:` && H.some((oe) => `${oe.roomJID}:${String(oe.message?.xmppId || oe.message?.id || "").trim()}` === ie))
16701
16710
  return H;
16702
- const re = [...H, $];
16703
- return re.length > m ? re.slice(-m) : re;
16711
+ const ee = [...H, $];
16712
+ return ee.length > m ? ee.slice(-m) : ee;
16704
16713
  });
16705
16714
  },
16706
16715
  [m, y]
@@ -16733,7 +16742,7 @@ const ax = Qo(void 0), cx = 3, lx = 3e4, dx = ({ children: e, config: t }) => {
16733
16742
  },
16734
16743
  [u, p, n, a, d, k, P]
16735
16744
  );
16736
- Y(() => {
16745
+ Z(() => {
16737
16746
  if (!p || !d) return;
16738
16747
  const F = zi.addCallback(
16739
16748
  _
@@ -18536,7 +18545,7 @@ class v0 extends Te.Component {
18536
18545
  }
18537
18546
  }
18538
18547
  const Ix = Te.lazy(
18539
- () => import("./VideoCallOverlay-D2u_n0s-.js").then((e) => ({
18548
+ () => import("./VideoCallOverlay-BXHNEhdX.js").then((e) => ({
18540
18549
  default: e.VideoCallOverlay
18541
18550
  }))
18542
18551
  ), b0 = Qo(null), _x = ({ pushNotifications: e }) => ($2({
@@ -18656,10 +18665,10 @@ const Ix = Te.lazy(
18656
18665
  console.error("Reconnection failed:", R);
18657
18666
  })));
18658
18667
  };
18659
- return Y(() => (o && (o.status === "offline" || o.status === "error") && u < 3 && x(), () => {
18660
- }), [o?.status, u]), Y(() => {
18668
+ return Z(() => (o && (o.status === "offline" || o.status === "error") && u < 3 && x(), () => {
18669
+ }), [o?.status, u]), Z(() => {
18661
18670
  j.dispatch(ql(t));
18662
- }, [t]), Y(() => {
18671
+ }, [t]), Z(() => {
18663
18672
  if (!t?.initBeforeLoad) {
18664
18673
  s("idle");
18665
18674
  return;
@@ -18758,9 +18767,9 @@ const Ix = Te.lazy(
18758
18767
  t?.baseUrl,
18759
18768
  t?.customAppToken,
18760
18769
  t?.appId
18761
- ]), Y(() => {
18770
+ ]), Z(() => {
18762
18771
  t?.initBeforeLoad && o && (o.status === "online" || o.status === "connecting") && s("ready");
18763
- }, [o, o?.status, t?.initBeforeLoad]), Y(() => {
18772
+ }, [o, o?.status, t?.initBeforeLoad]), Z(() => {
18764
18773
  if (typeof window > "u")
18765
18774
  return;
18766
18775
  const R = () => {
@@ -20775,7 +20784,7 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20775
20784
  return e.__ethoraLoaderStats || (e.__ethoraLoaderStats = {}), e.__ethoraLoaderStats;
20776
20785
  }, _t = (e, t) => {
20777
20786
  const r = X(!1);
20778
- Y(() => {
20787
+ Z(() => {
20779
20788
  const o = kh();
20780
20789
  o[e] || (o[e] = {
20781
20790
  count: 0,
@@ -20788,7 +20797,7 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20788
20797
  n.totalVisibleMs += i, n.activeSince = null;
20789
20798
  }
20790
20799
  r.current = t;
20791
- }, [e, t]), Y(() => () => {
20800
+ }, [e, t]), Z(() => () => {
20792
20801
  if (!r.current) return;
20793
20802
  const n = kh()[e];
20794
20803
  if (!n) return;
@@ -20808,15 +20817,15 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20808
20817
  _t("chat-room-load-more-loader", n);
20809
20818
  const [v, w] = K(!1), [S, g] = K(0), [b, C] = K(null), x = X(d.length), R = X(null), M = X({}), I = X(!0), T = ge(() => {
20810
20819
  const ne = /* @__PURE__ */ new Map();
20811
- for (const le of d) {
20812
- const Ce = Gi(le.mainMessage)?.id;
20820
+ for (const de of d) {
20821
+ const Ce = Gi(de.mainMessage)?.id;
20813
20822
  if (!Ce) continue;
20814
20823
  const Fe = ne.get(Ce);
20815
- Fe ? Fe.push(le) : ne.set(Ce, [le]);
20824
+ Fe ? Fe.push(de) : ne.set(Ce, [de]);
20816
20825
  }
20817
- return d.map((le) => {
20818
- const Ce = ne.get(le.id) ?? [];
20819
- return { ...le, reply: Ce };
20826
+ return d.map((de) => {
20827
+ const Ce = ne.get(de.id) ?? [];
20828
+ return { ...de, reply: Ce };
20820
20829
  });
20821
20830
  }, [d]), E = ge(() => i ? T.filter(
20822
20831
  (ne) => ne.roomJid === r && ne.isReply && ne.isReply === "true" && Gi(ne.mainMessage)?.id === s.id
@@ -20830,41 +20839,41 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20830
20839
  (Ce) => Ce.id === "delimiter-new"
20831
20840
  );
20832
20841
  if (ne === -1) return Rh;
20833
- const le = E.length - ne + 10;
20834
- return Math.max(Rh, le);
20842
+ const de = E.length - ne + 10;
20843
+ return Math.max(Rh, de);
20835
20844
  }), N = X(!1), F = X(null), B = X(null), J = X(
20836
20845
  E[E.length - 1]
20837
- ), z = X(!1), ie = X(null), L = X(0), $ = X(null), U = X(!0), D = X(!1), H = X(!1), re = X(null), Z = X(0), ee = G(() => {
20838
- if (re.current = null, o?.disableLastRead || !y || !m || !r) return;
20839
- const ne = d[d.length - 1], le = ne ? xe(ne.date) || xe(ne?.timestamp) || xe(ne.id) : 0;
20840
- !le || le <= Z.current || (Z.current = le, m.actionSetTimestampToPrivateStoreStanza(r, Date.now())?.catch?.(() => {
20846
+ ), z = X(!1), ie = X(null), L = X(0), $ = X(null), U = X(!0), D = X(!1), H = X(!1), ee = X(null), re = X(0), oe = G(() => {
20847
+ if (ee.current = null, o?.disableLastRead || !y || !m || !r) return;
20848
+ const ne = d[d.length - 1], de = ne ? xe(ne.date) || xe(ne?.timestamp) || xe(ne.id) : 0;
20849
+ !de || de <= re.current || (re.current = de, m.actionSetTimestampToPrivateStoreStanza(r, Date.now())?.catch?.(() => {
20841
20850
  }));
20842
- }, [o?.disableLastRead, y, m, r, d]), te = G(() => {
20843
- o?.disableLastRead || y && (re.current && clearTimeout(re.current), re.current = setTimeout(ee, KS));
20844
- }, [o?.disableLastRead, y, ee]);
20845
- Y(() => (Z.current = 0, () => {
20846
- re.current && clearTimeout(re.current);
20851
+ }, [o?.disableLastRead, y, m, r, d]), Q = G(() => {
20852
+ o?.disableLastRead || y && (ee.current && clearTimeout(ee.current), ee.current = setTimeout(oe, KS));
20853
+ }, [o?.disableLastRead, y, oe]);
20854
+ Z(() => (re.current = 0, () => {
20855
+ ee.current && clearTimeout(ee.current);
20847
20856
  }), [r]);
20848
- const ue = () => {
20857
+ const ce = () => {
20849
20858
  const ne = F.current;
20850
20859
  return ne ? {
20851
20860
  top: ne.scrollTop,
20852
20861
  height: ne.scrollHeight
20853
20862
  } : null;
20854
- }, Q = G(() => {
20863
+ }, Y = G(() => {
20855
20864
  const ne = F.current;
20856
20865
  if (!ne) return Promise.resolve();
20857
- const le = ne.getElementsByTagName("img");
20858
- if (le.length === 0) return Promise.resolve();
20859
- const Ce = Array.from(le).map((Fe) => Fe.complete ? Promise.resolve() : new Promise((Ye) => {
20866
+ const de = ne.getElementsByTagName("img");
20867
+ if (de.length === 0) return Promise.resolve();
20868
+ const Ce = Array.from(de).map((Fe) => Fe.complete ? Promise.resolve() : new Promise((Ye) => {
20860
20869
  Fe.onload = Ye, Fe.onerror = Ye;
20861
20870
  }));
20862
20871
  return Promise.all(Ce).then(() => {
20863
20872
  });
20864
- }, []), de = G(async () => {
20873
+ }, []), ue = G(async () => {
20865
20874
  const ne = F.current;
20866
20875
  if (ne)
20867
- if (await Q(), I.current)
20876
+ if (await Y(), I.current)
20868
20877
  E.findIndex(
20869
20878
  (Ce) => Ce.id === "delimiter-new"
20870
20879
  ) !== -1 ? setTimeout(() => {
@@ -20877,32 +20886,32 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20877
20886
  }) : ne.scrollTop = ne.scrollHeight;
20878
20887
  }, 100) : ne.scrollTop = ne.scrollHeight, I.current = !1;
20879
20888
  else {
20880
- const le = M.current[r];
20881
- le !== void 0 ? ne.scrollTop = le : ne.scrollTop = ne.scrollHeight;
20889
+ const de = M.current[r];
20890
+ de !== void 0 ? ne.scrollTop = de : ne.scrollTop = ne.scrollHeight;
20882
20891
  }
20883
- }, [r, E, Q]);
20884
- Y(() => {
20892
+ }, [r, E, Y]);
20893
+ Z(() => {
20885
20894
  E.length > 0 && C(
20886
20895
  new Date(E[E.length - 1].date).getTime()
20887
20896
  );
20888
- }, []), Y(() => {
20897
+ }, []), Z(() => {
20889
20898
  if (P) return;
20890
20899
  new Date(
20891
20900
  E[E.length - 1]?.date
20892
- )?.getTime() > b && g((le) => le += 1);
20893
- }, [E.length]), Y(() => {
20894
- de(), ie.current = null;
20901
+ )?.getTime() > b && g((de) => de += 1);
20902
+ }, [E.length]), Z(() => {
20903
+ ue(), ie.current = null;
20895
20904
  }, [r]);
20896
20905
  const se = G(() => {
20897
- const ne = ue();
20906
+ const ne = ce();
20898
20907
  if (!ne || ne.top >= 150 || z.current) return;
20899
20908
  if (E.length > k) {
20900
20909
  if (N.current) return;
20901
- N.current = !0, $.current = ue(), _((Ye) => Ye + QS);
20910
+ N.current = !0, $.current = ce(), _((Ye) => Ye + QS);
20902
20911
  return;
20903
20912
  }
20904
- const [le, Ce] = E, Fe = le?.id === "delimiter-new" ? Ce?.id : le?.id;
20905
- Fe && Fe !== ie.current && ($.current = ue(), z.current = !0, ie.current = Fe, t(le.roomJid, 30, Number(Fe)).finally(
20913
+ const [de, Ce] = E, Fe = de?.id === "delimiter-new" ? Ce?.id : de?.id;
20914
+ Fe && Fe !== ie.current && ($.current = ce(), z.current = !0, ie.current = Fe, t(de.roomJid, 30, Number(Fe)).finally(
20906
20915
  () => {
20907
20916
  z.current = !1, J.current = E[E.length - 1];
20908
20917
  }
@@ -20911,23 +20920,23 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20911
20920
  if (E.length <= k) return E;
20912
20921
  const ne = E.findIndex(
20913
20922
  (Ce) => Ce.id === "delimiter-new"
20914
- ), le = ne === -1 ? k : Math.max(k, E.length - ne + 10);
20915
- return le >= E.length ? E : E.slice(-le);
20923
+ ), de = ne === -1 ? k : Math.max(k, E.length - ne + 10);
20924
+ return de >= E.length ? E : E.slice(-de);
20916
20925
  }, [E, k]), ve = X(E.length);
20917
- Y(() => {
20926
+ Z(() => {
20918
20927
  const ne = E.length - ve.current;
20919
- ve.current = E.length, ne > 0 && D.current && E.length > k && _((le) => le + ne);
20928
+ ve.current = E.length, ne > 0 && D.current && E.length > k && _((de) => de + ne);
20920
20929
  }, [E.length, k]);
20921
20930
  const Ie = G(() => {
20922
20931
  const ne = F.current;
20923
20932
  ne && (ne.scrollTo({
20924
20933
  top: ne.scrollHeight,
20925
20934
  behavior: "smooth"
20926
- }), w(!1), g(0), te());
20927
- }, [te]), ze = () => {
20935
+ }), w(!1), g(0), Q());
20936
+ }, [Q]), ze = () => {
20928
20937
  const ne = F.current;
20929
20938
  if (ne) {
20930
- const le = ne.scrollTop, Ce = ne.scrollHeight, Fe = ne.clientHeight, Ye = Ce - Fe - le, vn = Ye <= 150, ro = Ye <= 5;
20939
+ const de = ne.scrollTop, Ce = ne.scrollHeight, Fe = ne.clientHeight, Ye = Ce - Fe - de, vn = Ye <= 150, ro = Ye <= 5;
20931
20940
  U.current = ro, D.current = !vn, Ye > 150 ? w(!0) : ro && (Ie(), w(!1), g(0)), x.current = d.length, se();
20932
20941
  } else
20933
20942
  L.current = null;
@@ -20936,43 +20945,43 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20936
20945
  Qt.current();
20937
20946
  }, 50));
20938
20947
  }, Qt = X(ze);
20939
- Qt.current = ze, Y(() => {
20948
+ Qt.current = ze, Z(() => {
20940
20949
  const ne = B.current;
20941
20950
  return ne && ne.addEventListener("scroll", Kt, !0), () => {
20942
20951
  ne && ne.removeEventListener("scroll", Kt, !0);
20943
20952
  };
20944
- }, []), Y(() => {
20953
+ }, []), Z(() => {
20945
20954
  if (pe.length > 30) {
20946
20955
  const ne = F.current;
20947
20956
  if (ne && $.current) {
20948
- const le = $.current.top + (ne.scrollHeight - $.current.height);
20949
- ne.scrollTop = le;
20957
+ const de = $.current.top + (ne.scrollHeight - $.current.height);
20958
+ ne.scrollTop = de;
20950
20959
  }
20951
20960
  $.current = null;
20952
20961
  }
20953
20962
  N.current = !1;
20954
- }, [pe.length, l, k]), Y(() => {
20963
+ }, [pe.length, l, k]), Z(() => {
20955
20964
  if (d.length > 0) {
20956
- const ne = d[d.length - 1], le = ne && P;
20957
- ne && ne.id !== R.current && le && (R.current = ne.id, Ie());
20965
+ const ne = d[d.length - 1], de = ne && P;
20966
+ ne && ne.id !== R.current && de && (R.current = ne.id, Ie());
20958
20967
  }
20959
- }, [d, P]), Y(() => {
20968
+ }, [d, P]), Z(() => {
20960
20969
  if (!F.current) return;
20961
- const le = E.length > x.current, Ce = u?.length > 0 && !H.current;
20962
- H.current = u?.length > 0, D.current || (le || Ce) && Q().then(() => {
20970
+ const de = E.length > x.current, Ce = u?.length > 0 && !H.current;
20971
+ H.current = u?.length > 0, D.current || (de || Ce) && Y().then(() => {
20963
20972
  Ie(), w(!1), g(0);
20964
20973
  });
20965
20974
  }, [
20966
20975
  E.length,
20967
20976
  u,
20968
20977
  Ie,
20969
- Q
20978
+ Y
20970
20979
  ]);
20971
20980
  const mt = (ne) => {
20972
- let le = null;
20981
+ let de = null;
20973
20982
  return ne.map((Ce) => {
20974
- const Fe = new Date(Ce.date).toDateString(), Ye = Fe !== le;
20975
- return le = Fe, { message: Ce, showDateLabel: Ye };
20983
+ const Fe = new Date(Ce.date).toDateString(), Ye = Fe !== de;
20984
+ return de = Fe, { message: Ce, showDateLabel: Ye };
20976
20985
  });
20977
20986
  }, Yt = ge(
20978
20987
  () => mt(E),
@@ -20982,28 +20991,28 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
20982
20991
  [pe, E, Yt]
20983
20992
  ), Qe = G(
20984
20993
  (ne) => {
20985
- const { message: le, showDateLabel: Ce } = ne;
20986
- return le.id === "delimiter-new" ? /* @__PURE__ */ h(
20994
+ const { message: de, showDateLabel: Ce } = ne;
20995
+ return de.id === "delimiter-new" ? /* @__PURE__ */ h(
20987
20996
  "div",
20988
20997
  {
20989
20998
  "data-message-id": "delimiter-new",
20990
20999
  className: "message-container",
20991
21000
  children: c ? /* @__PURE__ */ h(c, { color: o?.colors?.primary }) : /* @__PURE__ */ h(R0, { color: o?.colors?.primary })
20992
21001
  },
20993
- le.id
21002
+ de.id
20994
21003
  ) : /* @__PURE__ */ h(
20995
21004
  P0,
20996
21005
  {
20997
21006
  CustomMessage: e,
20998
- message: le,
21007
+ message: de,
20999
21008
  activeMessage: s,
21000
21009
  config: o,
21001
21010
  xmppUsername: f.xmppUsername,
21002
21011
  isReply: i,
21003
21012
  showDateLabel: Ce,
21004
- "data-message-id": le.id
21013
+ "data-message-id": de.id
21005
21014
  },
21006
- le.id
21015
+ de.id
21007
21016
  );
21008
21017
  },
21009
21018
  [
@@ -21040,7 +21049,7 @@ const gS = (e) => e.length === 0 ? "" : e.length === 1 ? `${e[0]} is typing` : e
21040
21049
  renderMessage: Qe,
21041
21050
  scrollController: {
21042
21051
  scrollToBottom: Ie,
21043
- waitForImagesLoaded: Q,
21052
+ waitForImagesLoaded: Y,
21044
21053
  showScrollButton: v,
21045
21054
  newMessagesCount: S,
21046
21055
  resetNewMessageCounter: Ms
@@ -21597,12 +21606,12 @@ const z0 = [], AC = () => new Promise((e) => {
21597
21606
  }, []), S = G(() => {
21598
21607
  y(!0), p((g) => g + 1);
21599
21608
  }, []);
21600
- return Y(
21609
+ return Z(
21601
21610
  () => () => {
21602
21611
  v.current && (URL.revokeObjectURL(v.current), v.current = void 0);
21603
21612
  },
21604
21613
  []
21605
- ), Y(() => {
21614
+ ), Z(() => {
21606
21615
  if (!e || !t) return;
21607
21616
  if (!m && typeof n == "number" && n > o) {
21608
21617
  a("skipped");
@@ -21773,7 +21782,7 @@ const z0 = [], AC = () => new Promise((e) => {
21773
21782
  )}">${q0(s)}</mention>${a}`;
21774
21783
  }
21775
21784
  return o;
21776
- }, BC = Te.lazy(() => import("./MarkdownBody-DJuU5j5G.js")), zC = {
21785
+ }, BC = Te.lazy(() => import("./MarkdownBody-BYUK4GVM.js")), zC = {
21777
21786
  fontFamily: 'var(--ethora-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)',
21778
21787
  fontSize: "var(--ethora-font-size, 16px)",
21779
21788
  color: "#24292f",
@@ -22237,7 +22246,7 @@ const Ts = ({
22237
22246
  online: l = !1
22238
22247
  }) => {
22239
22248
  const { config: d } = ke(), u = be(), f = d?.colors?.iconsBg, p = d?.colors?.icons, { backgroundColor: m } = Q0(e), y = f || m, [v, w] = K(!1);
22240
- Y(() => {
22249
+ Z(() => {
22241
22250
  w(!1);
22242
22251
  }, [t]);
22243
22252
  const S = e ? u("avatar.altWithName", { name: e }) : u("avatar.altGeneric"), g = (M) => {
@@ -22359,9 +22368,9 @@ const Ts = ({
22359
22368
  }, 100),
22360
22369
  [g, b]
22361
22370
  );
22362
- Y(() => {
22371
+ Z(() => {
22363
22372
  x(p), S(Ih);
22364
- }, [p, x]), Y(() => {
22373
+ }, [p, x]), Z(() => {
22365
22374
  const E = b ? g.filter((P) => (P.jid || P.xmppUsername || "").split("@")[0] !== b) : g;
22366
22375
  v(E);
22367
22376
  }, [g, b]);
@@ -22466,7 +22475,7 @@ const Ts = ({
22466
22475
  const s = X(e);
22467
22476
  s.current = e;
22468
22477
  const a = X(i);
22469
- a.current = i, Y(() => {
22478
+ a.current = i, Z(() => {
22470
22479
  if (!t || typeof document > "u") return;
22471
22480
  const l = {
22472
22481
  token: /* @__PURE__ */ Symbol("dismiss-layer"),
@@ -22567,53 +22576,53 @@ const Ts = ({
22567
22576
  }) => {
22568
22577
  const S = be(), [g, b] = K(""), [C, x] = K(!1), [R, M] = K(40), [I, T] = K(!1), [E, P] = K([]), [k, _] = K(null), [N, F] = K(!1), B = X(null), J = X(null), z = X(null), ie = X(null), L = X(null), $ = X(
22569
22578
  null
22570
- ), U = X(null), D = X(0), H = ae((W) => Z6(W)), re = ae((W) => W.rooms.usersSet), Z = ae(
22579
+ ), U = X(null), D = X(0), H = ae((W) => Z6(W)), ee = ae((W) => W.rooms.usersSet), re = ae(
22571
22580
  (W) => W.chatSettingStore.user
22572
- ), ee = ge(() => (Array.isArray(H?.members) ? H.members : []).map((ce) => {
22573
- const fe = String(ce?.xmppUsername || ""), me = fe.split("@")[0], Ae = re?.[fe] || re?.[me];
22581
+ ), oe = ge(() => (Array.isArray(H?.members) ? H.members : []).map((le) => {
22582
+ const fe = String(le?.xmppUsername || ""), me = fe.split("@")[0], Ae = ee?.[fe] || ee?.[me];
22574
22583
  return Ae ? {
22575
- ...ce,
22576
- firstName: ce.firstName || Ae.firstName || "",
22577
- lastName: ce.lastName || Ae.lastName || ""
22578
- } : ce;
22579
- }), [H?.members, re]), te = HC({
22580
- roomMembers: ee,
22581
- selfId: Z?.xmppUsername || Z?.id
22582
- }), ue = !v, Q = Rs(), de = X(null);
22583
- Y(() => {
22584
- if (!ue) return;
22584
+ ...le,
22585
+ firstName: le.firstName || Ae.firstName || "",
22586
+ lastName: le.lastName || Ae.lastName || ""
22587
+ } : le;
22588
+ }), [H?.members, ee]), Q = HC({
22589
+ roomMembers: oe,
22590
+ selfId: re?.xmppUsername || re?.id
22591
+ }), ce = !v, Y = Rs(), ue = X(null);
22592
+ Z(() => {
22593
+ if (!ce) return;
22585
22594
  const W = H?.jid;
22586
- W && (Array.isArray(H?.members) && H.members.length > 0 || de.current !== W && (de.current = W, T2(W.split("@")[0]).then((ce) => {
22587
- !ce || !Array.isArray(ce.members) || Q(it({ jid: W, updates: { members: ce.members } }));
22595
+ W && (Array.isArray(H?.members) && H.members.length > 0 || ue.current !== W && (ue.current = W, T2(W.split("@")[0]).then((le) => {
22596
+ !le || !Array.isArray(le.members) || Y(it({ jid: W, updates: { members: le.members } }));
22588
22597
  }).catch(() => {
22589
22598
  })));
22590
- }, [ue, H?.jid, H?.members, Q]);
22599
+ }, [ce, H?.jid, H?.members, Y]);
22591
22600
  const se = G((W) => {
22592
22601
  U.current = W;
22593
22602
  }, []);
22594
- Y(() => {
22603
+ Z(() => {
22595
22604
  if (U.current == null) return;
22596
- const W = $.current, ce = U.current;
22597
- U.current = null, W && (W.focus(), W.setSelectionRange(ce, ce));
22605
+ const W = $.current, le = U.current;
22606
+ U.current = null, W && (W.focus(), W.setSelectionRange(le, le));
22598
22607
  }, [g]);
22599
22608
  const pe = Math.min(
22600
22609
  Math.max(1, n?.attachments?.maxFiles ?? sE),
22601
22610
  is
22602
22611
  ), ve = n?.attachments?.maxFileSizeMb, Ie = X(/* @__PURE__ */ new Map()), [ze, Kt] = K({});
22603
- Y(() => {
22604
- const W = Ie.current, ce = new Set(E.map(Tr));
22612
+ Z(() => {
22613
+ const W = Ie.current, le = new Set(E.map(Tr));
22605
22614
  E.forEach((fe) => {
22606
22615
  const me = Tr(fe);
22607
22616
  if (W.has(me)) return;
22608
22617
  const Ae = pn(fe.type, fe.name);
22609
22618
  (Ae === "image" || Ae === "video" || Ae === "pdf") && W.set(me, URL.createObjectURL(fe));
22610
22619
  }), W.forEach((fe, me) => {
22611
- ce.has(me) || (URL.revokeObjectURL(fe), W.delete(me));
22620
+ le.has(me) || (URL.revokeObjectURL(fe), W.delete(me));
22612
22621
  }), Kt(Object.fromEntries(W));
22613
- }, [E]), Y(() => {
22622
+ }, [E]), Z(() => {
22614
22623
  const W = Ie.current;
22615
22624
  return () => {
22616
- W.forEach((ce) => URL.revokeObjectURL(ce)), W.clear();
22625
+ W.forEach((le) => URL.revokeObjectURL(le)), W.clear();
22617
22626
  };
22618
22627
  }, []);
22619
22628
  const Qt = G(() => {
@@ -22621,12 +22630,12 @@ const Ts = ({
22621
22630
  }, []), mt = G(
22622
22631
  (W) => {
22623
22632
  if (W.length === 0) return;
22624
- const ce = ve ? ve * 1024 * 1024 : null, fe = new Set(E.map(Tr)), me = [], Ae = [];
22633
+ const le = ve ? ve * 1024 * 1024 : null, fe = new Set(E.map(Tr)), me = [], Ae = [];
22625
22634
  let _e = 0;
22626
22635
  W.forEach((wr) => {
22627
22636
  const Yd = Tr(wr);
22628
22637
  if (!fe.has(Yd)) {
22629
- if (ce && wr.size > ce) {
22638
+ if (le && wr.size > le) {
22630
22639
  Ae.push(wr.name);
22631
22640
  return;
22632
22641
  }
@@ -22648,42 +22657,42 @@ const Ts = ({
22648
22657
  [E, pe, ve, S]
22649
22658
  ), Yt = G(
22650
22659
  (W) => {
22651
- const ce = Array.from(W.target.files || []);
22652
- B.current && (B.current.value = ""), mt(ce);
22660
+ const le = Array.from(W.target.files || []);
22661
+ B.current && (B.current.value = ""), mt(le);
22653
22662
  },
22654
22663
  [mt]
22655
- ), yr = !n?.disableMedia, [Qe, yn] = K(null), [Ms, ne] = K(!1), le = X(0);
22656
- Y(() => {
22664
+ ), yr = !n?.disableMedia, [Qe, yn] = K(null), [Ms, ne] = K(!1), de = X(0);
22665
+ Z(() => {
22657
22666
  const W = ie.current;
22658
22667
  W && yn(
22659
22668
  W.closest(`[${cE}]`) ?? W
22660
22669
  );
22661
- }, []), Y(() => {
22670
+ }, []), Z(() => {
22662
22671
  if (!Qe || !yr) return;
22663
22672
  const W = () => {
22664
- le.current = 0, ne(!1);
22665
- }, ce = (_e) => {
22666
- xo(_e) && (_e.preventDefault(), le.current += 1, ne(!0));
22673
+ de.current = 0, ne(!1);
22674
+ }, le = (_e) => {
22675
+ xo(_e) && (_e.preventDefault(), de.current += 1, ne(!0));
22667
22676
  }, fe = (_e) => {
22668
22677
  xo(_e) && (_e.preventDefault(), _e.dataTransfer && (_e.dataTransfer.dropEffect = "copy"));
22669
22678
  }, me = (_e) => {
22670
- xo(_e) && (le.current = Math.max(0, le.current - 1), le.current === 0 && ne(!1));
22679
+ xo(_e) && (de.current = Math.max(0, de.current - 1), de.current === 0 && ne(!1));
22671
22680
  }, Ae = (_e) => {
22672
22681
  xo(_e) && (_e.preventDefault(), W(), mt(Array.from(_e.dataTransfer?.files || [])));
22673
22682
  };
22674
- return Qe.addEventListener("dragenter", ce), Qe.addEventListener("dragover", fe), Qe.addEventListener("dragleave", me), Qe.addEventListener("drop", Ae), () => {
22675
- Qe.removeEventListener("dragenter", ce), Qe.removeEventListener("dragover", fe), Qe.removeEventListener("dragleave", me), Qe.removeEventListener("drop", Ae);
22683
+ return Qe.addEventListener("dragenter", le), Qe.addEventListener("dragover", fe), Qe.addEventListener("dragleave", me), Qe.addEventListener("drop", Ae), () => {
22684
+ Qe.removeEventListener("dragenter", le), Qe.removeEventListener("dragover", fe), Qe.removeEventListener("dragleave", me), Qe.removeEventListener("drop", Ae);
22676
22685
  };
22677
- }, [Qe, yr, mt]), Y(() => {
22686
+ }, [Qe, yr, mt]), Z(() => {
22678
22687
  const W = (me) => {
22679
22688
  me.defaultPrevented || xo(me) && me.preventDefault();
22680
- }, ce = (me) => {
22681
- W(me), le.current = 0, ne(!1);
22689
+ }, le = (me) => {
22690
+ W(me), de.current = 0, ne(!1);
22682
22691
  }, fe = () => {
22683
- le.current = 0, ne(!1);
22692
+ de.current = 0, ne(!1);
22684
22693
  };
22685
- return window.addEventListener("dragover", W), window.addEventListener("drop", ce), window.addEventListener("dragend", fe), () => {
22686
- window.removeEventListener("dragover", W), window.removeEventListener("drop", ce), window.removeEventListener("dragend", fe);
22694
+ return window.addEventListener("dragover", W), window.addEventListener("drop", le), window.addEventListener("dragend", fe), () => {
22695
+ window.removeEventListener("dragover", W), window.removeEventListener("drop", le), window.removeEventListener("dragend", fe);
22687
22696
  };
22688
22697
  }, []);
22689
22698
  const Ce = G(
@@ -22700,56 +22709,56 @@ const Ts = ({
22700
22709
  }, Ye = () => {
22701
22710
  T(!1), o?.();
22702
22711
  }, vn = G((W) => {
22703
- P((ce) => ce.filter((fe) => fe !== W)), _(null);
22712
+ P((le) => le.filter((fe) => fe !== W)), _(null);
22704
22713
  }, []), ro = G(
22705
22714
  (W) => {
22706
22715
  if (!l) return 40;
22707
- const ce = (W.match(/\n/g) || []).length, fe = 40, me = 13, Ae = 92, _e = fe + ce * me;
22716
+ const le = (W.match(/\n/g) || []).length, fe = 40, me = 13, Ae = 92, _e = fe + le * me;
22708
22717
  return Math.min(Math.max(_e, fe), Ae);
22709
22718
  },
22710
22719
  [l]
22711
22720
  ), st = G(
22712
22721
  (W) => {
22713
- const ce = ro(W);
22714
- M(ce);
22722
+ const le = ro(W);
22723
+ M(le);
22715
22724
  },
22716
22725
  [ro]
22717
22726
  ), Vd = G(
22718
22727
  (W) => {
22719
- const ce = W.target.value, fe = W.target.selectionStart ?? ce.length;
22720
- ue && te.handleTextChange(g, ce, fe), b(ce), st(ce);
22728
+ const le = W.target.value, fe = W.target.selectionStart ?? le.length;
22729
+ ce && Q.handleTextChange(g, le, fe), b(le), st(le);
22721
22730
  },
22722
- [st, ue, te, g]
22731
+ [st, ce, Q, g]
22723
22732
  ), bn = G(
22724
- (W, ce) => {
22725
- const fe = $.current, me = ce ?? fe?.selectionStart ?? g.length, Ae = te.selectCandidate(W, g, me);
22733
+ (W, le) => {
22734
+ const fe = $.current, me = le ?? fe?.selectionStart ?? g.length, Ae = Q.selectCandidate(W, g, me);
22726
22735
  Ae && (b(Ae.text), st(Ae.text), se(Ae.caret));
22727
22736
  },
22728
- [te, g, st, se]
22737
+ [Q, g, st, se]
22729
22738
  ), Is = G(() => {
22730
- D.current = $.current?.selectionStart ?? g.length, te.setOverflowOpen(!0);
22731
- }, [te, g]), Og = G(
22739
+ D.current = $.current?.selectionStart ?? g.length, Q.setOverflowOpen(!0);
22740
+ }, [Q, g]), Og = G(
22732
22741
  (W) => {
22733
22742
  if (!W) return;
22734
- const ce = $.current, fe = ce?.selectionStart ?? g.length, me = ce?.selectionEnd ?? fe, Ae = g.slice(0, fe) + W + g.slice(me), _e = fe + W.length;
22735
- ue && (te.handleTextChange(g, Ae, _e), te.closeDropdown()), b(Ae), st(Ae), se(_e);
22743
+ const le = $.current, fe = le?.selectionStart ?? g.length, me = le?.selectionEnd ?? fe, Ae = g.slice(0, fe) + W + g.slice(me), _e = fe + W.length;
22744
+ ce && (Q.handleTextChange(g, Ae, _e), Q.closeDropdown()), b(Ae), st(Ae), se(_e);
22736
22745
  },
22737
- [g, ue, te, st, se]
22746
+ [g, ce, Q, st, se]
22738
22747
  ), Lg = G(() => {
22739
- F((W) => (!W && ue && te.closeDropdown(), !W));
22740
- }, [ue, te]);
22741
- Y(() => {
22748
+ F((W) => (!W && ce && Q.closeDropdown(), !W));
22749
+ }, [ce, Q]);
22750
+ Z(() => {
22742
22751
  if (!N) return;
22743
22752
  const W = (fe) => {
22744
22753
  const me = fe.target;
22745
22754
  me && (J.current?.contains(me) || z.current?.contains(me) || F(!1));
22746
- }, ce = (fe) => {
22755
+ }, le = (fe) => {
22747
22756
  fe.key === "Escape" && (F(!1), $.current?.focus());
22748
22757
  };
22749
- return document.addEventListener("mousedown", W), document.addEventListener("keydown", ce), () => {
22750
- document.removeEventListener("mousedown", W), document.removeEventListener("keydown", ce);
22758
+ return document.addEventListener("mousedown", W), document.addEventListener("keydown", le), () => {
22759
+ document.removeEventListener("mousedown", W), document.removeEventListener("keydown", le);
22751
22760
  };
22752
- }, [N]), Y(() => {
22761
+ }, [N]), Z(() => {
22753
22762
  b(i ?? ""), i && st(i);
22754
22763
  }, [i, st]);
22755
22764
  const Tt = !w, gt = H?.jid, qd = ae(
@@ -22759,14 +22768,14 @@ const Ts = ({
22759
22768
  const wt = X(null), vr = X(null), _s = X(!1), Jd = X(null), Xd = X(!1), wn = G(() => {
22760
22769
  wt.current && (clearTimeout(wt.current), wt.current = null);
22761
22770
  const W = vr.current;
22762
- vr.current = null, W && Q($1(W));
22763
- }, [Q]), xn = G(() => {
22771
+ vr.current = null, W && Y($1(W));
22772
+ }, [Y]), xn = G(() => {
22764
22773
  const W = Wd.current || "";
22765
- _s.current = !0, b(W), st(W), ue && te.resetMentions(), W && se(W.length);
22766
- }, [st, ue, te, se]), oo = G(() => {
22767
- wt.current && (clearTimeout(wt.current), wt.current = null), vr.current = null, !(!Tt || !gt) && Q(dy({ jid: gt }));
22768
- }, [Tt, gt, Q]);
22769
- Y(() => {
22774
+ _s.current = !0, b(W), st(W), ce && Q.resetMentions(), W && se(W.length);
22775
+ }, [st, ce, Q, se]), oo = G(() => {
22776
+ wt.current && (clearTimeout(wt.current), wt.current = null), vr.current = null, !(!Tt || !gt) && Y(dy({ jid: gt }));
22777
+ }, [Tt, gt, Y]);
22778
+ Z(() => {
22770
22779
  Tt && Jd.current !== (gt ?? null) && (wn(), Jd.current = gt ?? null, !i && xn());
22771
22780
  }, [
22772
22781
  Tt,
@@ -22774,10 +22783,10 @@ const Ts = ({
22774
22783
  i,
22775
22784
  wn,
22776
22785
  xn
22777
- ]), Y(() => {
22778
- const W = !!i, ce = Xd.current;
22779
- Xd.current = W, !(!Tt || !ce || W) && xn();
22780
- }, [i, Tt, xn]), Y(() => {
22786
+ ]), Z(() => {
22787
+ const W = !!i, le = Xd.current;
22788
+ Xd.current = W, !(!Tt || !le || W) && xn();
22789
+ }, [i, Tt, xn]), Z(() => {
22781
22790
  if (!(!Tt || !gt)) {
22782
22791
  if (_s.current) {
22783
22792
  _s.current = !1;
@@ -22786,12 +22795,12 @@ const Ts = ({
22786
22795
  i || (vr.current = { jid: gt, text: g }, wt.current && clearTimeout(wt.current), wt.current = setTimeout(() => {
22787
22796
  wt.current = null;
22788
22797
  const W = vr.current;
22789
- vr.current = null, W && Q($1(W));
22798
+ vr.current = null, W && Y($1(W));
22790
22799
  }, aE));
22791
22800
  }
22792
- }, [g, gt, Tt, i, Q]);
22801
+ }, [g, gt, Tt, i, Y]);
22793
22802
  const Gd = X(wn);
22794
- Gd.current = wn, Y(() => () => Gd.current(), []);
22803
+ Gd.current = wn, Z(() => () => Gd.current(), []);
22795
22804
  const no = p || e, Ds = m || t, br = G(
22796
22805
  (W) => /\S/.test(String(W || "")),
22797
22806
  []
@@ -22799,7 +22808,7 @@ const Ts = ({
22799
22808
  // AudioRecorder hands over the recorded Blob, not a URL - the old name
22800
22809
  // stuck around from when it did.
22801
22810
  async (W) => {
22802
- const ce = c ? c(g) : g, fe = br(ce) ? ce : null;
22811
+ const le = c ? c(g) : g, fe = br(le) ? le : null;
22803
22812
  let me;
22804
22813
  if (E.length > 0)
22805
22814
  me = Ds(E, "media"), x(!1);
@@ -22808,15 +22817,15 @@ const Ts = ({
22808
22817
  else {
22809
22818
  if (!fe)
22810
22819
  return;
22811
- no(fe, te.mentionSpans), te.resetMentions(), oo(), b(""), P([]), _(null), M(40);
22820
+ no(fe, Q.mentionSpans), Q.resetMentions(), oo(), b(""), P([]), _(null), M(40);
22812
22821
  return;
22813
22822
  }
22814
- if (te.resetMentions(), oo(), b(""), P([]), _(null), M(40), fe) {
22823
+ if (Q.resetMentions(), oo(), b(""), P([]), _(null), M(40), fe) {
22815
22824
  try {
22816
22825
  await me;
22817
22826
  } catch {
22818
22827
  }
22819
- no(fe, te.mentionSpans);
22828
+ no(fe, Q.mentionSpans);
22820
22829
  }
22821
22830
  },
22822
22831
  [
@@ -22826,50 +22835,50 @@ const Ts = ({
22826
22835
  c,
22827
22836
  br,
22828
22837
  g,
22829
- te,
22838
+ Q,
22830
22839
  oo
22831
22840
  ]
22832
22841
  ), Ns = G(() => {
22833
- const W = n.secondarySendButton.messageEdit + g, ce = c ? c(W) : W;
22834
- br(ce) && (no(ce, te.mentionSpans), te.resetMentions(), oo(), b(""), P([]), _(null), M(40));
22842
+ const W = n.secondarySendButton.messageEdit + g, le = c ? c(W) : W;
22843
+ br(le) && (no(le, Q.mentionSpans), Q.resetMentions(), oo(), b(""), P([]), _(null), M(40));
22835
22844
  }, [
22836
22845
  no,
22837
22846
  g,
22838
22847
  n?.secondarySendButton?.messageEdit,
22839
22848
  c,
22840
22849
  br,
22841
- te,
22850
+ Q,
22842
22851
  oo
22843
- ]), Kd = ue && te.isDropdownOpen && !te.overflowOpen && (te.visibleCandidates.length > 0 || te.hasOverflow), Qd = G(
22852
+ ]), Kd = ce && Q.isDropdownOpen && !Q.overflowOpen && (Q.visibleCandidates.length > 0 || Q.hasOverflow), Qd = G(
22844
22853
  (W) => {
22845
22854
  if (Kd) {
22846
22855
  if (W.key === "Escape") {
22847
- W.preventDefault(), te.closeDropdown();
22856
+ W.preventDefault(), Q.closeDropdown();
22848
22857
  return;
22849
22858
  }
22850
22859
  if (W.key === "ArrowDown") {
22851
- W.preventDefault(), te.moveHighlight(1);
22860
+ W.preventDefault(), Q.moveHighlight(1);
22852
22861
  return;
22853
22862
  }
22854
22863
  if (W.key === "ArrowUp") {
22855
- W.preventDefault(), te.moveHighlight(-1);
22864
+ W.preventDefault(), Q.moveHighlight(-1);
22856
22865
  return;
22857
22866
  }
22858
22867
  if (W.key === "Enter" || W.key === "Tab") {
22859
- const fe = te.visibleCandidates.length;
22860
- if (te.hasOverflow && te.highlightedIndex === fe) {
22868
+ const fe = Q.visibleCandidates.length;
22869
+ if (Q.hasOverflow && Q.highlightedIndex === fe) {
22861
22870
  W.preventDefault(), Is();
22862
22871
  return;
22863
22872
  }
22864
- const me = te.visibleCandidates[te.highlightedIndex];
22873
+ const me = Q.visibleCandidates[Q.highlightedIndex];
22865
22874
  if (me) {
22866
22875
  W.preventDefault(), bn(me);
22867
22876
  return;
22868
22877
  }
22869
22878
  }
22870
22879
  }
22871
- if (ue && W.key === "Backspace" && !te.isDropdownOpen) {
22872
- const fe = W.target, me = fe.selectionStart ?? 0, Ae = fe.selectionEnd ?? 0, _e = te.handleBackspace(g, me, Ae);
22880
+ if (ce && W.key === "Backspace" && !Q.isDropdownOpen) {
22881
+ const fe = W.target, me = fe.selectionStart ?? 0, Ae = fe.selectionEnd ?? 0, _e = Q.handleBackspace(g, me, Ae);
22873
22882
  if (_e) {
22874
22883
  W.preventDefault(), b(_e.text), st(_e.text), se(_e.caret);
22875
22884
  return;
@@ -22891,9 +22900,9 @@ const Ts = ({
22891
22900
  br,
22892
22901
  g,
22893
22902
  l,
22894
- ue,
22903
+ ce,
22895
22904
  Kd,
22896
- te,
22905
+ Q,
22897
22906
  bn,
22898
22907
  Is,
22899
22908
  st,
@@ -22918,27 +22927,27 @@ const Ts = ({
22918
22927
  /* @__PURE__ */ h(tC, { role: "status", "aria-live": "polite", children: /* @__PURE__ */ h(rC, { children: S("attachment.dropHint") }) }),
22919
22928
  Qe
22920
22929
  ),
22921
- ue && te.isDropdownOpen && !te.overflowOpen && /* @__PURE__ */ h(
22930
+ ce && Q.isDropdownOpen && !Q.overflowOpen && /* @__PURE__ */ h(
22922
22931
  WC,
22923
22932
  {
22924
- candidates: te.visibleCandidates,
22925
- totalCount: te.candidates.length,
22926
- hasOverflow: te.hasOverflow,
22927
- highlightedIndex: te.highlightedIndex,
22928
- onHoverIndex: te.setHighlightedIndex,
22933
+ candidates: Q.visibleCandidates,
22934
+ totalCount: Q.candidates.length,
22935
+ hasOverflow: Q.hasOverflow,
22936
+ highlightedIndex: Q.highlightedIndex,
22937
+ onHoverIndex: Q.setHighlightedIndex,
22929
22938
  onSelect: bn,
22930
22939
  onShowAll: Is
22931
22940
  }
22932
22941
  ),
22933
- ue && te.overflowOpen && /* @__PURE__ */ h(
22942
+ ce && Q.overflowOpen && /* @__PURE__ */ h(
22934
22943
  iE,
22935
22944
  {
22936
- members: ee,
22937
- selfId: Z?.xmppUsername || Z?.id,
22945
+ members: oe,
22946
+ selfId: re?.xmppUsername || re?.id,
22938
22947
  onSelect: (W) => {
22939
- bn(W, D.current), te.setOverflowOpen(!1);
22948
+ bn(W, D.current), Q.setOverflowOpen(!1);
22940
22949
  },
22941
- onClose: () => te.closeDropdown()
22950
+ onClose: () => Q.closeDropdown()
22942
22951
  }
22943
22952
  ),
22944
22953
  N && /* @__PURE__ */ h(eC, { ref: J, children: /* @__PURE__ */ h(
@@ -23187,7 +23196,7 @@ const Ts = ({
23187
23196
  }, f = (p) => {
23188
23197
  c(!!p.target.value);
23189
23198
  };
23190
- return Y(() => {
23199
+ return Z(() => {
23191
23200
  if (i && t) {
23192
23201
  const p = setTimeout(() => {
23193
23202
  l.current?.focus();
@@ -23353,13 +23362,13 @@ const Ts = ({
23353
23362
  `;
23354
23363
  function Go(e, t) {
23355
23364
  const [r, o] = K(e ? "open" : "closed"), n = X();
23356
- return Y(() => {
23365
+ return Z(() => {
23357
23366
  if (n.current && clearTimeout(n.current), e) {
23358
23367
  o("open");
23359
23368
  return;
23360
23369
  }
23361
23370
  o((i) => i === "closed" ? "closed" : "closing");
23362
- }, [e]), Y(() => {
23371
+ }, [e]), Z(() => {
23363
23372
  if (r === "closing") {
23364
23373
  if (t <= 0 || S0()) {
23365
23374
  o("closed");
@@ -23557,7 +23566,7 @@ const vE = A.div`
23557
23566
  { name: "Members-only", id: "group" }
23558
23567
  ], og = (e = 480) => {
23559
23568
  const t = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(`(max-width: ${e}px)`).matches, [r, o] = K(t);
23560
- return Y(() => {
23569
+ return Z(() => {
23561
23570
  if (typeof window > "u" || typeof window.matchMedia != "function")
23562
23571
  return;
23563
23572
  const n = window.matchMedia(`(max-width: ${e}px)`), i = () => o(n.matches);
@@ -23635,7 +23644,7 @@ const vE = A.div`
23635
23644
  name: "Members-only",
23636
23645
  id: "group"
23637
23646
  }, [l, d] = K(!1), [u, f] = K(!1), [p, m] = K(""), [y, v] = K(""), [w, S] = K(s), [g, b] = K(null), [C, x] = K({ name: "", description: "" }), [R, M] = K([]), I = X(null), T = w.id === "group", [E, P] = K(!1);
23638
- Y(() => {
23647
+ Z(() => {
23639
23648
  if (!T) {
23640
23649
  P(!1);
23641
23650
  return;
@@ -23648,10 +23657,10 @@ const vE = A.div`
23648
23657
  () => p.length >= 3,
23649
23658
  [p, y]
23650
23659
  ), _ = (H) => H.trim().length < 3 ? "Room name must be at least 3 characters." : "", N = (H) => {
23651
- const re = H.target.value;
23652
- m(re), x((Z) => ({
23653
- ...Z,
23654
- name: _(re)
23660
+ const ee = H.target.value;
23661
+ m(ee), x((re) => ({
23662
+ ...re,
23663
+ name: _(ee)
23655
23664
  }));
23656
23665
  }, F = () => d(!0), B = () => {
23657
23666
  d(!1), m(""), v(""), S(s), b(null), x({ name: "", description: "" }), M([]);
@@ -23665,35 +23674,35 @@ const vE = A.div`
23665
23674
  b(H);
23666
23675
  }, L = async () => {
23667
23676
  b(null);
23668
- }, $ = async (H, re) => {
23677
+ }, $ = async (H, ee) => {
23669
23678
  try {
23670
- const Z = un(
23679
+ const re = un(
23671
23680
  H,
23672
23681
  e?.xmppSettings?.conference,
23673
- re
23682
+ ee
23674
23683
  );
23675
- return !Z || !Z.jid ? (console.error(
23684
+ return !re || !re.jid ? (console.error(
23676
23685
  "handleRoomCreation: failed to normalize the new room",
23677
23686
  H
23678
23687
  ), null) : (t(
23679
23688
  rn({
23680
- room: Z,
23689
+ room: re,
23681
23690
  xmpp: r
23682
23691
  })
23683
- ), t(je({ roomJID: Z.jid })), Z.jid);
23684
- } catch (Z) {
23685
- return console.error("Error handling room creation:", Z), null;
23692
+ ), t(Ue({ roomJID: re.jid })), re.jid);
23693
+ } catch (re) {
23694
+ return console.error("Error handling room creation:", re), null;
23686
23695
  }
23687
23696
  }, U = async (H) => {
23688
23697
  if (g)
23689
23698
  try {
23690
- const re = new FormData();
23691
- re.append("files", g);
23692
- const ee = (await B2(re, H))?.data?.results?.[0]?.location;
23693
- if (!ee) return;
23694
- r.setRoomImageStanza(H, ee, "icon", "none"), t(it({ jid: H, updates: { icon: ee } }));
23695
- } catch (re) {
23696
- console.error("Room avatar upload failed:", re);
23699
+ const ee = new FormData();
23700
+ ee.append("files", g);
23701
+ const oe = (await B2(ee, H))?.data?.results?.[0]?.location;
23702
+ if (!oe) return;
23703
+ r.setRoomImageStanza(H, oe, "icon", "none"), t(it({ jid: H, updates: { icon: oe } }));
23704
+ } catch (ee) {
23705
+ console.error("Room avatar upload failed:", ee);
23697
23706
  }
23698
23707
  }, D = async () => {
23699
23708
  if (o({
@@ -23704,20 +23713,20 @@ const vE = A.div`
23704
23713
  duration: 3e3
23705
23714
  }), f(!0), k) {
23706
23715
  if (e?.newArch !== !1) {
23707
- const H = R.map((ee) => ee.xmppUsername), re = await Ev({
23716
+ const H = R.map((oe) => oe.xmppUsername), ee = await Ev({
23708
23717
  title: p,
23709
23718
  description: y && y !== "" ? y : "No description",
23710
23719
  picture: "",
23711
23720
  type: w.id || "public",
23712
23721
  members: H
23713
- }), Z = await $(re, H.length);
23714
- Z && await U(Z);
23722
+ }), re = await $(ee, H.length);
23723
+ re && await U(re);
23715
23724
  } else {
23716
23725
  const H = await r.createRoomStanza(
23717
23726
  p,
23718
23727
  y && y !== "" ? y : "No description"
23719
23728
  );
23720
- r.getRoomsStanza(), t(je({ roomJID: H })), await U(H);
23729
+ r.getRoomsStanza(), t(Ue({ roomJID: H })), await U(H);
23721
23730
  }
23722
23731
  d(!1), x({ name: "", description: "" }), b(null), m(""), v(""), f(!1), o({
23723
23732
  id: Date.now().toString(),
@@ -23798,9 +23807,9 @@ const vE = A.div`
23798
23807
  onKeyDown: (H) => {
23799
23808
  if (H.key !== "ArrowLeft" && H.key !== "ArrowRight") return;
23800
23809
  H.preventDefault();
23801
- const re = T ? a : c;
23802
- S(re), H.currentTarget.querySelector(
23803
- `#ethora-chattype-${re.id}`
23810
+ const ee = T ? a : c;
23811
+ S(ee), H.currentTarget.querySelector(
23812
+ `#ethora-chattype-${ee.id}`
23804
23813
  )?.focus();
23805
23814
  },
23806
23815
  children: [
@@ -24326,7 +24335,7 @@ const uk = () => (dc || (dc = import("./native-CDi4YD_s.js").then((e) => (Qi = e
24326
24335
  return t ? t.skins?.[0]?.native ?? "" : dk[e] ?? "";
24327
24336
  }, Ud = () => {
24328
24337
  const [e, t] = K(Qi !== null);
24329
- return Y(() => {
24338
+ return Z(() => {
24330
24339
  if (e) return;
24331
24340
  let r = !0;
24332
24341
  return uk().then(() => {
@@ -24449,7 +24458,7 @@ const uk = () => (dc || (dc = import("./native-CDi4YD_s.js").then((e) => (Qi = e
24449
24458
  myXmppUsername: r
24450
24459
  }) => {
24451
24460
  const o = be(), [n, i] = K(!1), s = X(null), a = ae((l) => l.rooms.usersSet);
24452
- Y(() => {
24461
+ Z(() => {
24453
24462
  if (!n) return;
24454
24463
  const l = (d) => {
24455
24464
  s.current && !s.current.contains(d.target) && i(!1);
@@ -24808,7 +24817,7 @@ const uk = () => (dc || (dc = import("./native-CDi4YD_s.js").then((e) => (Qi = e
24808
24817
  window.dispatchEvent(new Event("ethora-xmpp-logout"));
24809
24818
  } catch {
24810
24819
  }
24811
- j.dispatch(je({ roomJID: null }));
24820
+ j.dispatch(Ue({ roomJID: null }));
24812
24821
  try {
24813
24822
  e?.setActiveRoomJid?.(null);
24814
24823
  } catch {
@@ -24917,7 +24926,7 @@ function Ok(e) {
24917
24926
  },
24918
24927
  [S]
24919
24928
  );
24920
- Y(() => (o || g(0, !0), () => {
24929
+ Z(() => (o || g(0, !0), () => {
24921
24930
  v.current?.abort();
24922
24931
  }), [r]);
24923
24932
  const b = G(() => {
@@ -25557,7 +25566,7 @@ const dR = 6, Gh = (e) => {
25557
25566
  U ? x.current.set(L, U) : x.current.delete(L);
25558
25567
  }, P.current.set(L, $)), $;
25559
25568
  }, []);
25560
- Y(() => {
25569
+ Z(() => {
25561
25570
  const L = (e || []).filter(($) => !Kh($)).map(uR).filter(Boolean);
25562
25571
  if (L.length && (L.forEach(($) => {
25563
25572
  f(Kl({ jid: $ }));
@@ -25565,9 +25574,9 @@ const dR = 6, Gh = (e) => {
25565
25574
  const $ = (e || []).find(
25566
25575
  (U) => Kh(U) && U.jid !== y
25567
25576
  )?.jid || null;
25568
- f(je({ roomJID: $ }));
25577
+ f(Ue({ roomJID: $ }));
25569
25578
  }
25570
- }, [y, e, f]), Y(() => {
25579
+ }, [y, e, f]), Z(() => {
25571
25580
  !g && d === "files" && u("chats");
25572
25581
  }, [g, d]);
25573
25582
  const _ = G((L) => {
@@ -25589,9 +25598,9 @@ const dR = 6, Gh = (e) => {
25589
25598
  (H) => !!H && typeof H == "object" && typeof H.jid == "string" && H.jid.length > 0 && !Bd(H, p)
25590
25599
  ).filter(
25591
25600
  (H) => lg(H).toLowerCase().includes(L)
25592
- ).sort((H, re) => {
25593
- const Z = Gh(H);
25594
- return Gh(re) - Z;
25601
+ ).sort((H, ee) => {
25602
+ const re = Gh(H);
25603
+ return Gh(ee) - re;
25595
25604
  });
25596
25605
  $.set(L, D);
25597
25606
  }
@@ -25599,24 +25608,24 @@ const dR = 6, Gh = (e) => {
25599
25608
  }, [e, c, p?.hiddenRooms]);
25600
25609
  Ug(() => {
25601
25610
  const L = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, $ = R.current, U = /* @__PURE__ */ new Map(), D = M.current?.scrollTop ?? 0, H = D - I.current;
25602
- B.forEach((re, Z) => {
25603
- const ee = re.jid || `${re.id}-${Z}`, te = x.current.get(ee);
25604
- if (!te) return;
25605
- const ue = E.current.get(ee);
25606
- ue !== void 0 && (cancelAnimationFrame(ue), E.current.delete(ee)), (te.style.transform || te.style.transition) && (te.style.transition = "none", te.style.transform = "");
25607
- const Q = te.getBoundingClientRect().top;
25608
- if (U.set(ee, Q), !T.current || L) return;
25609
- const de = $.get(ee);
25610
- if (de === void 0) return;
25611
- const se = de - Q - H;
25611
+ B.forEach((ee, re) => {
25612
+ const oe = ee.jid || `${ee.id}-${re}`, Q = x.current.get(oe);
25613
+ if (!Q) return;
25614
+ const ce = E.current.get(oe);
25615
+ ce !== void 0 && (cancelAnimationFrame(ce), E.current.delete(oe)), (Q.style.transform || Q.style.transition) && (Q.style.transition = "none", Q.style.transform = "");
25616
+ const Y = Q.getBoundingClientRect().top;
25617
+ if (U.set(oe, Y), !T.current || L) return;
25618
+ const ue = $.get(oe);
25619
+ if (ue === void 0) return;
25620
+ const se = ue - Y - H;
25612
25621
  if (!se) return;
25613
- te.style.transition = "none", te.style.transform = `translateY(${se}px)`, te.getBoundingClientRect();
25622
+ Q.style.transition = "none", Q.style.transform = `translateY(${se}px)`, Q.getBoundingClientRect();
25614
25623
  const pe = requestAnimationFrame(() => {
25615
- E.current.delete(ee), te.style.transition = "transform var(--ethora-motion-base, 220ms) var(--ethora-motion-ease, cubic-bezier(.2,.8,.2,1))", te.style.transform = "";
25624
+ E.current.delete(oe), Q.style.transition = "transform var(--ethora-motion-base, 220ms) var(--ethora-motion-ease, cubic-bezier(.2,.8,.2,1))", Q.style.transform = "";
25616
25625
  });
25617
- E.current.set(ee, pe);
25626
+ E.current.set(oe, pe);
25618
25627
  }), R.current = U, I.current = D, T.current = !0;
25619
- }, [B]), Y(() => {
25628
+ }, [B]), Z(() => {
25620
25629
  if (t)
25621
25630
  return document.addEventListener("mousedown", _), () => {
25622
25631
  document.removeEventListener("mousedown", _);
@@ -25801,15 +25810,15 @@ const dR = 6, Gh = (e) => {
25801
25810
  /* @__PURE__ */ h($h, { $width: "70%" })
25802
25811
  ] })
25803
25812
  ] }, `skeleton-${$}`)) : B.map((L, $) => {
25804
- const U = $ === B.length - 1, D = J(L) || !U && J(B[$ + 1]), H = L.jid || `${L.id}-${$}`, re = C.current;
25805
- let Z = !0, ee = 0;
25806
- return re.has(H) ? ee = re.get(H) : (ee = re.size * 24, re.set(H, ee), Z = !1), /* @__PURE__ */ O(Te.Fragment, { children: [
25813
+ const U = $ === B.length - 1, D = J(L) || !U && J(B[$ + 1]), H = L.jid || `${L.id}-${$}`, ee = C.current;
25814
+ let re = !0, oe = 0;
25815
+ return ee.has(H) ? oe = ee.get(H) : (oe = ee.size * 24, ee.set(H, oe), re = !1), /* @__PURE__ */ O(Te.Fragment, { children: [
25807
25816
  /* @__PURE__ */ h(
25808
25817
  JE,
25809
25818
  {
25810
25819
  ref: k(H),
25811
- $delay: ee,
25812
- $skipAnimation: Z,
25820
+ $delay: oe,
25821
+ $skipAnimation: re,
25813
25822
  children: /* @__PURE__ */ h(
25814
25823
  Tk,
25815
25824
  {
@@ -26171,7 +26180,7 @@ function SR({
26171
26180
  JSON.stringify(e?.typography?.weights ?? {})
26172
26181
  ]
26173
26182
  ), r = ge(() => xR++, []);
26174
- return Y(() => (Cl.set(r, t), Qh(), () => {
26183
+ return Z(() => (Cl.set(r, t), Qh(), () => {
26175
26184
  Cl.delete(r), Qh();
26176
26185
  }), [r, t]), null;
26177
26186
  }
@@ -26210,7 +26219,7 @@ const CR = [
26210
26219
  checked: n
26211
26220
  }) => {
26212
26221
  const [i, s] = K(n ?? !1);
26213
- return Y(() => {
26222
+ return Z(() => {
26214
26223
  n !== void 0 && s(n);
26215
26224
  }, [n]), /* @__PURE__ */ h(
26216
26225
  kR,
@@ -26547,7 +26556,7 @@ const CR = [
26547
26556
  }, N = (D) => {
26548
26557
  r(
26549
26558
  it({ jid: D.jid, updates: { ...D, unreadMessages: 0 } })
26550
- ), r(je({ roomJID: D.jid })), r(Ue({ chatJID: D.jid, loading: !0 }));
26559
+ ), r(Ue({ roomJID: D.jid })), r(je({ chatJID: D.jid, loading: !0 }));
26551
26560
  }, F = G(() => {
26552
26561
  i(!0);
26553
26562
  }, []), B = G(() => {
@@ -26557,29 +26566,29 @@ const CR = [
26557
26566
  i(!1);
26558
26567
  return;
26559
26568
  }
26560
- o.leaveTheRoomStanza(a), r(Kl({ jid: a })), typeof window < "u" && window.history.pushState(null, "", window.location.pathname), r(je({ roomJID: null })), i(!1);
26569
+ o.leaveTheRoomStanza(a), r(Kl({ jid: a })), typeof window < "u" && window.history.pushState(null, "", window.location.pathname), r(Ue({ roomJID: null })), i(!1);
26561
26570
  }, [a, r, o]), z = G(
26562
26571
  async (D) => {
26563
26572
  if (!E || T || !e?.jid)
26564
26573
  return;
26565
26574
  const H = e.jid.split("@")[0];
26566
26575
  if (!H) return;
26567
- const re = String(d?.xmppUsername || "").split("@")[0], Z = (e.members || []).find((se) => {
26576
+ const ee = String(d?.xmppUsername || "").split("@")[0], re = (e.members || []).find((se) => {
26568
26577
  const pe = String(se?.xmppUsername || "").split("@")[0];
26569
- return pe && pe !== re;
26570
- }), ee = Z?.xmppUsername || null, te = String(e.name || "").trim(), ue = !te || ["deleted", "deleted user", "unknown", "null"].includes(
26571
- te.toLowerCase()
26572
- ), Q = Z && (`${Z.firstName || ""} ${Z.lastName || ""}`.trim() || Z.name) || "", de = (ue ? Q : te) || Q || H;
26578
+ return pe && pe !== ee;
26579
+ }), oe = re?.xmppUsername || null, Q = String(e.name || "").trim(), ce = !Q || ["deleted", "deleted user", "unknown", "null"].includes(
26580
+ Q.toLowerCase()
26581
+ ), Y = re && (`${re.firstName || ""} ${re.lastName || ""}`.trim() || re.name) || "", ue = (ce ? Y : Q) || Y || H;
26573
26582
  r(
26574
26583
  py({
26575
26584
  roomJid: e.jid,
26576
- roomName: de,
26585
+ roomName: ue,
26577
26586
  roomBareName: H,
26578
26587
  kind: D,
26579
- peerXmppUsername: ee
26588
+ peerXmppUsername: oe
26580
26589
  })
26581
- ), ee && k9(D, {
26582
- peerXmppUsername: ee,
26590
+ ), oe && k9(D, {
26591
+ peerXmppUsername: oe,
26583
26592
  roomBareName: H
26584
26593
  });
26585
26594
  try {
@@ -26924,14 +26933,14 @@ const CR = [
26924
26933
  ] });
26925
26934
  }, lT = (e, t, r) => {
26926
26935
  const o = Me();
26927
- Y(() => {
26936
+ Z(() => {
26928
26937
  if (!(typeof window > "u")) {
26929
26938
  if (r?.setRoomJidInPath && e && typeof e == "string") {
26930
26939
  const n = e.split("@")[0], i = new URLSearchParams(window.location.search);
26931
26940
  i.set("chatId", n);
26932
26941
  const s = `${window.location.pathname}?${i.toString()}`;
26933
26942
  window.history.pushState(null, "", s);
26934
- } else !e && Object.values(t).length > 0 && o(je({ roomJID: t[0]?.jid }));
26943
+ } else !e && Object.values(t).length > 0 && o(Ue({ roomJID: t[0]?.jid }));
26935
26944
  return () => {
26936
26945
  if (r?.setRoomJidInPath && typeof window < "u") {
26937
26946
  const n = new URLSearchParams(window.location.search);
@@ -27062,11 +27071,11 @@ const pT = (e) => {
27062
27071
  },
27063
27072
  [w, g, S, o, c]
27064
27073
  );
27065
- Y(() => () => {
27074
+ Z(() => () => {
27066
27075
  f.current.forEach((P) => clearTimeout(P)), f.current.clear(), p.current.clear();
27067
- }, []), Y(() => {
27076
+ }, []), Z(() => {
27068
27077
  w()?.enabled || (f.current.forEach((k) => clearTimeout(k)), f.current.clear(), p.current.clear(), v(/* @__PURE__ */ new Set()));
27069
- }, [w]), Y(() => {
27078
+ }, [w]), Z(() => {
27070
27079
  w()?.enabled && Object.keys(u || {}).forEach((k) => {
27071
27080
  if (!y.has(k)) return;
27072
27081
  const _ = u[k];
@@ -27102,7 +27111,7 @@ const pT = (e) => {
27102
27111
  },
27103
27112
  [o]
27104
27113
  );
27105
- Y(() => {
27114
+ Z(() => {
27106
27115
  const P = m.current;
27107
27116
  return () => {
27108
27117
  P.forEach((k) => clearTimeout(k)), P.clear();
@@ -27461,59 +27470,59 @@ const pT = (e) => {
27461
27470
  );
27462
27471
  try {
27463
27472
  const D = new FormData();
27464
- J.forEach((Q) => D.append("files", Q));
27465
- const H = await B2(D, _), re = Array.isArray(H?.data?.results) ? H.data.results : [];
27466
- if (re.length === 0)
27473
+ J.forEach((Y) => D.append("files", Y));
27474
+ const H = await B2(D, _), ee = Array.isArray(H?.data?.results) ? H.data.results : [];
27475
+ if (ee.length === 0)
27467
27476
  throw new Error("media_upload_empty_response");
27468
- const Z = re.map((Q) => ({
27469
- attachmentId: Q?._id,
27470
- location: Q?.location,
27471
- locationPreview: Q?.locationPreview,
27472
- mimetype: Q?.mimetype,
27473
- originalName: Q?.originalname,
27474
- fileName: Q?.filename,
27475
- size: Q?.size?.toString?.() ?? Q?.size,
27476
- duration: Q?.duration,
27477
- ownerKey: Q?.ownerKey,
27478
- userId: Q?.userId,
27479
- createdAt: Q?.createdAt,
27480
- updatedAt: Q?.updatedAt,
27481
- expiresAt: Q?.expiresAt,
27482
- isVisible: Q?.isVisible,
27483
- isPrivate: Q?.isPrivate
27484
- })), [ee] = re, te = {
27477
+ const re = ee.map((Y) => ({
27478
+ attachmentId: Y?._id,
27479
+ location: Y?.location,
27480
+ locationPreview: Y?.locationPreview,
27481
+ mimetype: Y?.mimetype,
27482
+ originalName: Y?.originalname,
27483
+ fileName: Y?.filename,
27484
+ size: Y?.size?.toString?.() ?? Y?.size,
27485
+ duration: Y?.duration,
27486
+ ownerKey: Y?.ownerKey,
27487
+ userId: Y?.userId,
27488
+ createdAt: Y?.createdAt,
27489
+ updatedAt: Y?.updatedAt,
27490
+ expiresAt: Y?.expiresAt,
27491
+ isVisible: Y?.isVisible,
27492
+ isPrivate: Y?.isPrivate
27493
+ })), [oe] = ee, Q = {
27485
27494
  firstName: l.firstName,
27486
27495
  lastName: l.lastName,
27487
27496
  walletAddress: l.walletAddress,
27488
- createdAt: ee.createdAt,
27489
- expiresAt: ee.expiresAt,
27490
- fileName: ee.filename,
27491
- isVisible: ee?.isVisible,
27492
- location: ee.location,
27493
- locationPreview: ee.locationPreview,
27494
- mimetype: ee.mimetype,
27495
- originalName: ee?.originalname,
27496
- ownerKey: ee?.ownerKey,
27497
- size: ee.size,
27498
- duration: ee?.duration,
27499
- updatedAt: ee?.updatedAt,
27500
- userId: ee?.userId,
27501
- attachmentId: ee?._id,
27497
+ createdAt: oe.createdAt,
27498
+ expiresAt: oe.expiresAt,
27499
+ fileName: oe.filename,
27500
+ isVisible: oe?.isVisible,
27501
+ location: oe.location,
27502
+ locationPreview: oe.locationPreview,
27503
+ mimetype: oe.mimetype,
27504
+ originalName: oe?.originalname,
27505
+ ownerKey: oe?.ownerKey,
27506
+ size: oe.size,
27507
+ duration: oe?.duration,
27508
+ updatedAt: oe?.updatedAt,
27509
+ userId: oe?.userId,
27510
+ attachmentId: oe?._id,
27502
27511
  // Only stamped when there is genuinely more than one file, so
27503
27512
  // single-file stanzas stay byte-identical to what we sent before.
27504
- attachments: Z.length > 1 ? y8(Z) : void 0,
27513
+ attachments: re.length > 1 ? y8(re) : void 0,
27505
27514
  wrappable: !0,
27506
27515
  roomJid: _,
27507
27516
  showInChannel: F,
27508
27517
  isReply: N,
27509
27518
  mainMessage: B,
27510
- isPrivate: ee?.isPrivate,
27511
- __v: ee.__v
27519
+ isPrivate: oe?.isPrivate,
27520
+ __v: oe.__v
27512
27521
  };
27513
27522
  if (!await M(
27514
27523
  _,
27515
27524
  z,
27516
- () => o?.sendMediaMessageStanza(_, te, z)
27525
+ () => o?.sendMediaMessageStanza(_, Q, z)
27517
27526
  ))
27518
27527
  throw new Error("media_send_failed");
27519
27528
  a({
@@ -27528,7 +27537,7 @@ const pT = (e) => {
27528
27537
  fileData: Array.isArray(P) ? P : $,
27529
27538
  fileType: k,
27530
27539
  messageId: z,
27531
- uploadResults: re
27540
+ uploadResults: ee
27532
27541
  }
27533
27542
  });
27534
27543
  } catch (D) {
@@ -27566,7 +27575,10 @@ const pT = (e) => {
27566
27575
  return G(
27567
27576
  async (o, n, i) => {
27568
27577
  i?.force && hs();
27569
- const a = (await ps())?.items || [];
27578
+ const s = await ps();
27579
+ if (s?.failed)
27580
+ throw new Error("Failed to load rooms");
27581
+ const a = s?.items || [];
27570
27582
  return a.forEach((c) => {
27571
27583
  t(
27572
27584
  rn({
@@ -27574,7 +27586,7 @@ const pT = (e) => {
27574
27586
  xmpp: o
27575
27587
  })
27576
27588
  );
27577
- }), t(Ue({ loading: !1, loadingText: void 0 })), t(Ql({ rooms: a })), a;
27589
+ }), t(je({ loading: !1, loadingText: void 0 })), t(Ql({ rooms: a })), a;
27578
27590
  },
27579
27591
  [t]
27580
27592
  );
@@ -27592,7 +27604,7 @@ const pT = (e) => {
27592
27604
  const { client: n } = pt(), i = Me(), s = bg(), a = X(
27593
27605
  null
27594
27606
  ), c = X(/* @__PURE__ */ new Set());
27595
- Y(() => {
27607
+ Z(() => {
27596
27608
  if (n && e) {
27597
27609
  n.setActiveRoomJid(e), n.promoteRoomHistory(e);
27598
27610
  const d = n.presenceInRoomStanza(
@@ -27610,7 +27622,7 @@ const pT = (e) => {
27610
27622
  });
27611
27623
  }
27612
27624
  n && !e && n.setActiveRoomJid(null);
27613
- }, [n, e]), Y(() => {
27625
+ }, [n, e]), Z(() => {
27614
27626
  const d = t?.[e], u = !!e && !mT(d), f = async () => {
27615
27627
  if (!n || !e) return;
27616
27628
  await ((a.current?.jid === e ? a.current.promise : null) || n.presenceInRoomStanza(
@@ -27619,10 +27631,10 @@ const pT = (e) => {
27619
27631
  sp,
27620
27632
  !0
27621
27633
  )).catch(() => !1) || n.prioritizeRoomPresence(e).catch(() => {
27622
- }), i(Ue({ loading: !0, chatJID: e }));
27634
+ }), i(je({ loading: !0, chatJID: e }));
27623
27635
  let v = !1;
27624
27636
  const w = setTimeout(() => {
27625
- v = !0, i(Ue({ loading: !1, chatJID: e }));
27637
+ v = !0, i(je({ loading: !1, chatJID: e }));
27626
27638
  }, yT);
27627
27639
  try {
27628
27640
  const S = await n.getHistoryStanza(
@@ -27637,7 +27649,7 @@ const pT = (e) => {
27637
27649
  }
27638
27650
  );
27639
27651
  S?.length || n.prioritizeRoomPresence(e).catch(() => {
27640
- }), S && op(S) > 0 && (i(Ue({ loading: !1, chatJID: e })), await n.getHistoryStanza(
27652
+ }), S && op(S) > 0 && (i(je({ loading: !1, chatJID: e })), await n.getHistoryStanza(
27641
27653
  e,
27642
27654
  20 + op(S),
27643
27655
  Number(S[0].id),
@@ -27649,7 +27661,7 @@ const pT = (e) => {
27649
27661
  ));
27650
27662
  } finally {
27651
27663
  clearTimeout(w), v || i(
27652
- Ue({
27664
+ je({
27653
27665
  loading: !1,
27654
27666
  chatJID: e,
27655
27667
  loadingText: void 0
@@ -27667,7 +27679,9 @@ const pT = (e) => {
27667
27679
  await n.getRoomsStanza();
27668
27680
  else {
27669
27681
  const m = e, y = String(m).split("@")[0];
27670
- !(await s(n, r, { force: !0 }))?.some((S) => S?.name === y) && !c.current.has(m) && (c.current.add(m), (async () => {
27682
+ !(await s(n, r, { force: !0 }).catch(
27683
+ () => []
27684
+ ))?.some((S) => S?.name === y) && !c.current.has(m) && (c.current.add(m), (async () => {
27671
27685
  for (const S of vT)
27672
27686
  if (await new Promise((b) => setTimeout(b, S)), (await s(n, r, {
27673
27687
  force: !0
@@ -27678,13 +27692,13 @@ const pT = (e) => {
27678
27692
  } else
27679
27693
  await f();
27680
27694
  };
27681
- Object.keys(t)?.length > 0 ? e && !t?.[e] && Object.keys(t).length > 0 ? (i(Ue({ loading: !0, chatJID: e })), p()) : e && u ? (i(Ue({ loading: !0, chatJID: e })), f()) : i(Ue({ loading: !1, chatJID: e })) : t?.[e] || p();
27695
+ Object.keys(t)?.length > 0 ? e && !t?.[e] && Object.keys(t).length > 0 ? (i(je({ loading: !0, chatJID: e })), p()) : e && u ? (i(je({ loading: !0, chatJID: e })), f()) : i(je({ loading: !1, chatJID: e })) : t?.[e] || p();
27682
27696
  }, [
27683
27697
  e,
27684
27698
  Object.keys(t).length,
27685
27699
  o,
27686
27700
  t?.[e]?.messages?.length
27687
- ]), Y(() => {
27701
+ ]), Z(() => {
27688
27702
  if (!n || !e || typeof window > "u") return;
27689
27703
  const d = typeof localStorage < "u" ? localStorage.getItem(np) : null, u = typeof localStorage < "u" ? localStorage.getItem(ip) : null;
27690
27704
  d && (!u || u === e) && n.getHistoryStanza(e, 30, void 0, void 0, {
@@ -27696,7 +27710,7 @@ const pT = (e) => {
27696
27710
  });
27697
27711
  }, [n, e]);
27698
27712
  const l = X(/* @__PURE__ */ new Set());
27699
- Y(() => {
27713
+ Z(() => {
27700
27714
  const d = Array.isArray(r?.defaultRooms) ? r.defaultRooms : [];
27701
27715
  if (!n || !d.length || !t) return;
27702
27716
  const u = d.filter(
@@ -27722,7 +27736,7 @@ const pT = (e) => {
27722
27736
  !1
27723
27737
  );
27724
27738
  }, [r]);
27725
- return Y(() => {
27739
+ return Z(() => {
27726
27740
  const s = setTimeout(() => {
27727
27741
  i();
27728
27742
  }, 100);
@@ -27736,7 +27750,7 @@ const pT = (e) => {
27736
27750
  let n = r.key, i = r.phase;
27737
27751
  n !== e && (n = e, i = "opening"), (n !== r.key || i !== r.phase) && o({ key: n, phase: i });
27738
27752
  const s = X(null);
27739
- return Y(() => {
27753
+ return Z(() => {
27740
27754
  if (s.current && (clearTimeout(s.current), s.current = null), !(i !== "opening" || !e) && !t)
27741
27755
  return s.current = setTimeout(() => {
27742
27756
  o(
@@ -27820,20 +27834,20 @@ const pT = (e) => {
27820
27834
  sendEditMessage: C,
27821
27835
  isLastMessageFromUserAndProcessing: x
27822
27836
  } = zd(), { sendStartComposing: R, sendEndComposing: M } = xT(d), I = G(
27823
- (Q, de) => {
27824
- g(Q, f, void 0, void 0, void 0, de);
27837
+ (Y, ue) => {
27838
+ g(Y, f, void 0, void 0, void 0, ue);
27825
27839
  },
27826
27840
  [f, g]
27827
27841
  ), T = G(
27828
- (Q, de) => b(Q, de, f),
27842
+ (Y, ue) => b(Y, ue, f),
27829
27843
  [f]
27830
27844
  ), E = G(
27831
- async (Q, de, se) => {
27832
- if (!a && !u?.[Q]?.historyComplete) {
27845
+ async (Y, ue, se) => {
27846
+ if (!a && !u?.[Y]?.historyComplete) {
27833
27847
  const pe = typeof se != "string" ? se : Number(
27834
- u[Q].messages[u[Q].messages.length - 2].id
27848
+ u[Y].messages[u[Y].messages.length - 2].id
27835
27849
  );
27836
- c(!0), o?.getHistoryStanza(Q, de, pe, void 0, {
27850
+ c(!0), o?.getHistoryStanza(Y, ue, pe, void 0, {
27837
27851
  source: "active"
27838
27852
  }).then(() => {
27839
27853
  c(!1);
@@ -27844,20 +27858,20 @@ const pT = (e) => {
27844
27858
  ), P = () => {
27845
27859
  s(zt({ isEdit: !1 }));
27846
27860
  };
27847
- Y(() => {
27848
- const Q = Date.now();
27861
+ Z(() => {
27862
+ const Y = Date.now();
27849
27863
  return s(
27850
27864
  Uc({
27851
27865
  chatJID: f,
27852
- timestamp: Q
27866
+ timestamp: Y
27853
27867
  })
27854
27868
  ), c(!1), () => {
27855
- const de = Date.now();
27856
- o && !d?.disableLastRead && o.actionSetTimestampToPrivateStoreStanza(f, de)?.catch?.(() => {
27869
+ const ue = Date.now();
27870
+ o && !d?.disableLastRead && o.actionSetTimestampToPrivateStoreStanza(f, ue)?.catch?.(() => {
27857
27871
  }), s(
27858
27872
  Uc({
27859
27873
  chatJID: f,
27860
- timestamp: de
27874
+ timestamp: ue
27861
27875
  })
27862
27876
  ), s(
27863
27877
  Jl({
@@ -27873,8 +27887,8 @@ const pT = (e) => {
27873
27887
  v.length
27874
27888
  );
27875
27889
  const k = f ? u?.[f] : void 0, _ = d?.noMessagesPlaceholder, N = (k?.messages?.length || 0) > 0, F = !!y, B = !!m, J = !!k?.isLoading, z = !N && k?.historyPreloadState === "loading", ie = F || B || J || z, $ = CT(f, !N && (B || J || z)), U = k?.lastMessage, D = !!U && (k?.messages || []).some(
27876
- (Q) => !!U.id && Q.id === U.id || !!U.xmppId && !!Q.xmppId && Q.xmppId === U.xmppId
27877
- ), re = !N && !!U?.body && !D ? {
27890
+ (Y) => !!U.id && Y.id === U.id || !!U.xmppId && !!Y.xmppId && Y.xmppId === U.xmppId
27891
+ ), ee = !N && !!U?.body && !D ? {
27878
27892
  ...U,
27879
27893
  id: U.id || U.xmppId || "seed-last-message",
27880
27894
  roomJid: U.roomJid || f,
@@ -27895,17 +27909,17 @@ const pT = (e) => {
27895
27909
  "chat-room-history-loader:(!hasMessages&&historyPreloadState==='loading')",
27896
27910
  z
27897
27911
  );
27898
- const Z = i === "provider" && n !== "ready" && n !== "failed", ee = !o || o.status !== "online" && o.status !== "auth_failed", te = w && !S && !m && !y && !Z && !ee, ue = w && S && !m && !y && !Z && !ee;
27899
- return Object.keys(u)?.length < 1 && ue ? /* @__PURE__ */ h(Sh, { children: "Couldn't load your chats. Retrying..." }) : Object.keys(u)?.length < 1 && te ? /* @__PURE__ */ O(Sh, { children: [
27912
+ const re = i === "provider" && n !== "ready" && n !== "failed", oe = !o || o.status !== "online" && o.status !== "auth_failed", Q = w && !S && !m && !y && !re && !oe, ce = w && S && !m && !y && !re && !oe;
27913
+ return Object.keys(u)?.length < 1 ? Q ? /* @__PURE__ */ O(Sh, { children: [
27900
27914
  "No room. Let's create one!",
27901
27915
  /* @__PURE__ */ h(ng, {})
27902
- ] }) : !f || !u?.[f] ? Object.keys(u).length < 1 && !w ? /* @__PURE__ */ h(
27916
+ ] }) : S ? /* @__PURE__ */ h(Sh, { children: "Couldn't load your chats. Retrying..." }) : /* @__PURE__ */ h(
27903
27917
  vt,
27904
27918
  {
27905
27919
  "data-testid": "chat-room-rooms-loader",
27906
27920
  color: d?.colors?.primary
27907
27921
  }
27908
- ) : /* @__PURE__ */ h(cT, { unavailable: !!f && (te || ue) }) : /* @__PURE__ */ O(
27922
+ ) : !f || !u?.[f] ? /* @__PURE__ */ h(cT, { unavailable: !!f && (Q || ce) }) : /* @__PURE__ */ O(
27909
27923
  C0,
27910
27924
  {
27911
27925
  "data-ethora-drop-zone": "",
@@ -27922,10 +27936,10 @@ const pT = (e) => {
27922
27936
  }
27923
27937
  ),
27924
27938
  d?.chatHeaderAdditional?.enabled && d.chatHeaderAdditional.element(),
27925
- re ? /* @__PURE__ */ h(
27939
+ ee ? /* @__PURE__ */ h(
27926
27940
  ET,
27927
27941
  {
27928
- seedMessage: re,
27942
+ seedMessage: ee,
27929
27943
  config: d,
27930
27944
  xmppUsername: l?.xmppUsername,
27931
27945
  isReply: !1,
@@ -27959,7 +27973,7 @@ const pT = (e) => {
27959
27973
  ) : _ ? /* @__PURE__ */ h(_, {}) : /* @__PURE__ */ h(ZR, {}),
27960
27974
  p.isEdit && /* @__PURE__ */ h(yg, { text: p.text, onClose: P }),
27961
27975
  (() => {
27962
- const Q = {
27976
+ const Y = {
27963
27977
  editMessage: p.text,
27964
27978
  sendMessage: p.isEdit ? C : I,
27965
27979
  sendMedia: T,
@@ -27974,12 +27988,12 @@ const pT = (e) => {
27974
27988
  // string overrode that - the composer stayed "Type message" in
27975
27989
  // every language. Hosts can still pass their own via
27976
27990
  // CustomInputComponent.
27977
- }, de = {
27978
- ...Q,
27979
- onSendMessage: Q.sendMessage,
27980
- onSendMedia: Q.sendMedia
27991
+ }, ue = {
27992
+ ...Y,
27993
+ onSendMessage: Y.sendMessage,
27994
+ onSendMedia: Y.sendMedia
27981
27995
  };
27982
- return r ? /* @__PURE__ */ h(r, { ...de }) : /* @__PURE__ */ h(eg, { ...Q });
27996
+ return r ? /* @__PURE__ */ h(r, { ...ue }) : /* @__PURE__ */ h(eg, { ...Y });
27983
27997
  })(),
27984
27998
  d?.customTypingIndicator?.enabled && (d.customTypingIndicator.position === "overlay" || d.customTypingIndicator.position === "floating") && u[f]?.composing && /* @__PURE__ */ h(
27985
27999
  Pd,
@@ -28216,7 +28230,7 @@ const RT = A.button`
28216
28230
  locationPreview: o
28217
28231
  }) => {
28218
28232
  const n = Me(), [i, s] = K("loading");
28219
- Y(() => {
28233
+ Z(() => {
28220
28234
  if (!o) {
28221
28235
  s("loading");
28222
28236
  return;
@@ -28299,7 +28313,7 @@ const jT = ({
28299
28313
  mimetype: r
28300
28314
  }) => {
28301
28315
  const o = Me(), [n, i] = K(!1);
28302
- Y(() => {
28316
+ Z(() => {
28303
28317
  if (i(!1), !t) return;
28304
28318
  let a = !1;
28305
28319
  const c = document.createElement("video");
@@ -28328,7 +28342,7 @@ const jT = ({
28328
28342
  const t = ae(
28329
28343
  (d) => d.chatSettingStore.config
28330
28344
  ), r = X(null), o = X(null), [n, i] = K(!1), [s, a] = K(1);
28331
- Y(() => {
28345
+ Z(() => {
28332
28346
  let d = !1;
28333
28347
  return import("./wavesurfer.esm-D_a19qBW.js").then(({ default: u }) => {
28334
28348
  if (d || !r.current) return;
@@ -28414,7 +28428,7 @@ const jT = ({
28414
28428
  const r = X(null), [o, n] = K(
28415
28429
  () => typeof IntersectionObserver > "u"
28416
28430
  );
28417
- return Y(() => {
28431
+ return Z(() => {
28418
28432
  if (typeof IntersectionObserver > "u") return;
28419
28433
  const i = r.current;
28420
28434
  if (!i || o && t) return;
@@ -28821,7 +28835,7 @@ const jT = ({
28821
28835
  let N = I, F = T;
28822
28836
  return I + 320 > k && (N = k - 320 - 10), T + 435 > _ && (F = _ - 435 - 10), { adjustedX: N, adjustedY: F };
28823
28837
  };
28824
- return Y(() => {
28838
+ return Z(() => {
28825
28839
  if (typeof window > "u" || !o)
28826
28840
  return;
28827
28841
  const I = () => {
@@ -29364,7 +29378,7 @@ const jT = ({
29364
29378
  return xc.set(e, o), o;
29365
29379
  }, _P = ({ url: e }) => {
29366
29380
  const [t, r] = K(null), [o, n] = K(!0), [i, s] = K(null);
29367
- if (Y(() => {
29381
+ if (Z(() => {
29368
29382
  let c = !0;
29369
29383
  return e && (e.startsWith("http://") || e.startsWith("https://")) ? (n(!0), s(null), r(null), IP(e).then((l) => {
29370
29384
  c && (l ? r(l) : s("Preview data not found"), n(!1));
@@ -29666,7 +29680,7 @@ const HP = A.span`
29666
29680
  y: 0
29667
29681
  }
29668
29682
  ), [k, _] = K(null);
29669
- Y(() => {
29683
+ Z(() => {
29670
29684
  if (e && e.body && typeof e.body == "string") {
29671
29685
  const se = e.body.match(WP);
29672
29686
  _(se ? se[0] : null);
@@ -29768,18 +29782,18 @@ const HP = A.span`
29768
29782
  [...e.reaction[a.xmppUsername]?.emoji || [], se],
29769
29783
  { firstName: a.firstName, lastName: a.lastName }
29770
29784
  );
29771
- }, re = f.has(e.id) || e?.pending || !1, Z = !c?.disableSentLogic, ee = !!(Z && t && e?.failed), te = ge(
29785
+ }, ee = f.has(e.id) || e?.pending || !1, re = !c?.disableSentLogic, oe = !!(re && t && e?.failed), Q = ge(
29772
29786
  () => t ? null : g0(e.body),
29773
29787
  [t, e.body]
29774
- ), ue = ge(() => {
29788
+ ), ce = ge(() => {
29775
29789
  if (t) return [];
29776
- const se = Ym(e.quickReplies), pe = te?.buttons ?? [];
29790
+ const se = Ym(e.quickReplies), pe = Q?.buttons ?? [];
29777
29791
  if (!pe.length) return se;
29778
29792
  const ve = new Set(se.map((ze) => ze.value)), Ie = [...se];
29779
29793
  for (const ze of pe)
29780
29794
  ve.has(ze.value) || (ve.add(ze.value), Ie.push(ze));
29781
29795
  return Ie;
29782
- }, [t, e.quickReplies, te]), Q = G(
29796
+ }, [t, e.quickReplies, Q]), Y = G(
29783
29797
  (se, pe) => {
29784
29798
  i(se.value, e.roomJid);
29785
29799
  try {
@@ -29797,8 +29811,8 @@ const HP = A.span`
29797
29811
  }
29798
29812
  },
29799
29813
  [c?.eventHandlers, e.id, e.roomJid, i]
29800
- ), de = () => {
29801
- ee && zP(
29814
+ ), ue = () => {
29815
+ oe && zP(
29802
29816
  {
29803
29817
  originalMessageId: e.id,
29804
29818
  body: e.body,
@@ -29883,7 +29897,7 @@ const HP = A.span`
29883
29897
  // Muted while unsent so the bubble reads as "not landed yet"
29884
29898
  // without shouting - the danger tone belongs on the notice below,
29885
29899
  // which is the part carrying the action.
29886
- /* @__PURE__ */ h(k0, { style: { opacity: ee ? 0.6 : 1 }, children: e.isDeleted && e.id !== "delimiter-new" ? /* @__PURE__ */ h(pP, {}) : (() => {
29900
+ /* @__PURE__ */ h(k0, { style: { opacity: oe ? 0.6 : 1 }, children: e.isDeleted && e.id !== "delimiter-new" ? /* @__PURE__ */ h(pP, {}) : (() => {
29887
29901
  const se = c?.messageTextFilter?.enabled ? c.messageTextFilter.filterFunction(
29888
29902
  g.displayText
29889
29903
  ) : g.displayText, pe = t ? se : Xo(se), ve = pe === e.body ? e.mentions : void 0, Ie = /* @__PURE__ */ h("div", { className: "message-body", children: G0({
@@ -29911,31 +29925,31 @@ const HP = A.span`
29911
29925
  }
29912
29926
  ),
29913
29927
  /* @__PURE__ */ O(Kx, { children: [
29914
- Z && t && re && !ee && "sending...",
29928
+ re && t && ee && !oe && "sending...",
29915
29929
  e.isEdited && !e.isDeleted && /* @__PURE__ */ h(HP, { children: s("message.edited") }),
29916
29930
  new Date(e.date).toLocaleTimeString([], {
29917
29931
  hour: "2-digit",
29918
29932
  minute: "2-digit"
29919
29933
  }),
29920
- Z && t && !re && /* @__PURE__ */ h(GS, {})
29934
+ re && t && !ee && /* @__PURE__ */ h(GS, {})
29921
29935
  ] }),
29922
- ue.length > 0 && !e.isDeleted && /* @__PURE__ */ h(
29936
+ ce.length > 0 && !e.isDeleted && /* @__PURE__ */ h(
29923
29937
  BP,
29924
29938
  {
29925
- replies: ue,
29939
+ replies: ce,
29926
29940
  messageId: e.id,
29927
29941
  accentColor: c?.colors?.primary,
29928
29942
  answered: S8(e.id),
29929
- onSelect: Q
29943
+ onSelect: Y
29930
29944
  }
29931
29945
  ),
29932
- ee && /* @__PURE__ */ O(VP, { children: [
29946
+ oe && /* @__PURE__ */ O(VP, { children: [
29933
29947
  /* @__PURE__ */ h("span", { children: s("message.notDelivered") }),
29934
29948
  /* @__PURE__ */ h(
29935
29949
  qP,
29936
29950
  {
29937
29951
  type: "button",
29938
- onClick: de,
29952
+ onClick: ue,
29939
29953
  "aria-label": s("message.retryAriaLabel"),
29940
29954
  children: s("message.retry")
29941
29955
  }
@@ -30238,22 +30252,22 @@ const HP = A.span`
30238
30252
  }
30239
30253
  `, YP = {
30240
30254
  [Le.SETTINGS]: xr(
30241
- () => import("./UserSettingsModal-CjkqSAhD.js")
30255
+ () => import("./UserSettingsModal-J7uJfki1.js")
30242
30256
  ),
30243
30257
  [Le.PROFILE]: xr(
30244
- () => import("./UserProfileModal-BTmSeeuM.js")
30258
+ () => import("./UserProfileModal-CD2IB5SD.js")
30245
30259
  ),
30246
30260
  [Le.CHAT_PROFILE]: xr(
30247
- () => import("./ChatProfileModal-D4B6nVkl.js")
30261
+ () => import("./ChatProfileModal-DZVi2WRb.js")
30248
30262
  ),
30249
30263
  [Le.MANAGE_DATA]: xr(
30250
- () => import("./ManageDataModal-P_5uJrLo.js")
30264
+ () => import("./ManageDataModal-Bs_0SHBL.js")
30251
30265
  ),
30252
30266
  [Le.VISIBILITY]: xr(
30253
- () => import("./VisibilityModal-BsbvHoF6.js")
30267
+ () => import("./VisibilityModal-4QJnWpAL.js")
30254
30268
  ),
30255
30269
  [Le.FILE_PREVIEW]: xr(
30256
- () => import("./FilePreviewModal-DxXBzYVJ.js")
30270
+ () => import("./FilePreviewModal-BelSYN5e.js")
30257
30271
  )
30258
30272
  }, Mg = ({ modal: e, setOpenModal: t }) => {
30259
30273
  const r = Me(), o = () => t(), n = () => r(Ke(Le.SETTINGS)), i = sg.includes(e), s = X(null), a = X(0);
@@ -30261,7 +30275,7 @@ const HP = A.span`
30261
30275
  enabled: !!e,
30262
30276
  onClose: i ? n : o,
30263
30277
  containerRef: s
30264
- }), Y(() => {
30278
+ }), Z(() => {
30265
30279
  if (!e) return;
30266
30280
  const d = s.current;
30267
30281
  if (!d) return;
@@ -30387,7 +30401,7 @@ function nA(e, t) {
30387
30401
  const [r, o] = K(!1), n = X(e);
30388
30402
  n.current = e;
30389
30403
  const i = X(), s = X(!1);
30390
- return Y(() => () => clearTimeout(i.current), []), { requestAction: () => {
30404
+ return Z(() => () => clearTimeout(i.current), []), { requestAction: () => {
30391
30405
  if (!s.current) {
30392
30406
  if (S0()) {
30393
30407
  n.current();
@@ -30772,9 +30786,9 @@ const iA = A(C0)`
30772
30786
  return o ? `${r}@${o}` : "";
30773
30787
  }, hA = (e, t, r) => {
30774
30788
  const [o, n] = K(!1), [i, s] = K(null), a = r?.rooms, c = r?.activeRoomJID, l = r?.isReady, d = X(e);
30775
- return d.current = e, Y(() => {
30789
+ return d.current = e, Z(() => {
30776
30790
  typeof window < "u" && uA();
30777
- }, []), Y(() => {
30791
+ }, []), Z(() => {
30778
30792
  if (!(typeof window > "u"))
30779
30793
  try {
30780
30794
  const u = dA();
@@ -30798,7 +30812,7 @@ const iA = A(C0)`
30798
30812
  dispatch: o
30799
30813
  }) => {
30800
30814
  if (e) {
30801
- o(je({ roomJID: e }));
30815
+ o(Ue({ roomJID: e }));
30802
30816
  return;
30803
30817
  }
30804
30818
  if (!t && typeof window < "u") {
@@ -30808,7 +30822,7 @@ const iA = A(C0)`
30808
30822
  if (!a) return;
30809
30823
  const c = i.includes("@") ? i : `${i}@${a}`;
30810
30824
  s && typeof localStorage < "u" && (localStorage.setItem(pA, s), localStorage.setItem(mA, c)), o(
30811
- je({
30825
+ Ue({
30812
30826
  roomJID: c
30813
30827
  })
30814
30828
  );
@@ -31011,16 +31025,16 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31011
31025
  const { roomsList: M, activeRoomJID: I } = Ot(), { user: T } = ke(), E = X({}), P = X({}), k = (D) => {
31012
31026
  E.current[D] = Date.now();
31013
31027
  }, _ = (D, H) => {
31014
- const re = E.current[H];
31015
- if (!re) return;
31016
- const Z = Date.now() - re;
31017
- P.current[D] = Z, q.log(`[InitTiming] ${D} ${Z}ms`);
31028
+ const ee = E.current[H];
31029
+ if (!ee) return;
31030
+ const re = Date.now() - ee;
31031
+ P.current[D] = re, q.log(`[InitTiming] ${D} ${re}ms`);
31018
31032
  }, N = () => {
31019
31033
  v.current || (v.current = setTimeout(() => {
31020
- const D = E.current, H = P.current, re = {};
31021
- Object.keys(H).forEach((Z) => {
31022
- re[Z] = H[Z];
31023
- }), Object.keys(re).length === 0 && [
31034
+ const D = E.current, H = P.current, ee = {};
31035
+ Object.keys(H).forEach((re) => {
31036
+ ee[re] = H[re];
31037
+ }), Object.keys(ee).length === 0 && [
31024
31038
  "xmpp:initClient:start",
31025
31039
  "initClient:create_instance:start",
31026
31040
  "initClient:wait_online:start",
@@ -31030,63 +31044,63 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31030
31044
  "bg:getChatsPrivateStore:start",
31031
31045
  "bg:stagedPreload:start",
31032
31046
  "bg:updateMessagesTillLast:start"
31033
- ].forEach((Z) => {
31034
- D[Z] && (re[Z] = Date.now() - D[Z]);
31035
- }), q.log("[InitTiming] startup_summary", re);
31047
+ ].forEach((re) => {
31048
+ D[re] && (ee[re] = Date.now() - D[re]);
31049
+ }), q.log("[InitTiming] startup_summary", ee);
31036
31050
  }, 1e4));
31037
31051
  }, F = async (D, H = 3e4) => {
31038
- const re = Date.now();
31039
- return new Promise((Z) => {
31040
- const ee = () => {
31052
+ const ee = Date.now();
31053
+ return new Promise((re) => {
31054
+ const oe = () => {
31041
31055
  if (D?.checkOnline?.()) {
31042
- Z(!0);
31056
+ re(!0);
31043
31057
  return;
31044
31058
  }
31045
- if (Date.now() - re > H) {
31046
- Z(!1);
31059
+ if (Date.now() - ee > H) {
31060
+ re(!1);
31047
31061
  return;
31048
31062
  }
31049
- setTimeout(ee, 200);
31063
+ setTimeout(oe, 200);
31050
31064
  };
31051
- ee();
31065
+ oe();
31052
31066
  });
31053
31067
  }, B = async (D, H = 12e3) => {
31054
- const re = Date.now();
31055
- return new Promise((Z) => {
31056
- const ee = () => {
31068
+ const ee = Date.now();
31069
+ return new Promise((re) => {
31070
+ const oe = () => {
31057
31071
  if (D.presencesReady) {
31058
- Z(!0);
31072
+ re(!0);
31059
31073
  return;
31060
31074
  }
31061
- if (Date.now() - re > H) {
31062
- Z(!1);
31075
+ if (Date.now() - ee > H) {
31076
+ re(!1);
31063
31077
  return;
31064
31078
  }
31065
- setTimeout(ee, 150);
31079
+ setTimeout(oe, 150);
31066
31080
  };
31067
- ee();
31081
+ oe();
31068
31082
  });
31069
31083
  }, J = async (D = 6e3) => {
31070
31084
  const H = Date.now();
31071
- return new Promise((re) => {
31072
- const Z = () => {
31073
- const ee = j.getState().rooms, te = ee.activeRoomJID, ue = te ? ee.rooms?.[te] : null;
31074
- if (!te || !ue) {
31075
- re(!0);
31085
+ return new Promise((ee) => {
31086
+ const re = () => {
31087
+ const oe = j.getState().rooms, Q = oe.activeRoomJID, ce = Q ? oe.rooms?.[Q] : null;
31088
+ if (!Q || !ce) {
31089
+ ee(!0);
31076
31090
  return;
31077
31091
  }
31078
- const Q = (ue.messages?.length || 0) > 0, de = ue.historyPreloadState === "done" || ue.historyPreloadState === "partial" || ue.historyPreloadState === "error";
31079
- if (!ue.isLoading || Q || de) {
31080
- re(!0);
31092
+ const Y = (ce.messages?.length || 0) > 0, ue = ce.historyPreloadState === "done" || ce.historyPreloadState === "partial" || ce.historyPreloadState === "error";
31093
+ if (!ce.isLoading || Y || ue) {
31094
+ ee(!0);
31081
31095
  return;
31082
31096
  }
31083
31097
  if (Date.now() - H > D) {
31084
- re(!1);
31098
+ ee(!1);
31085
31099
  return;
31086
31100
  }
31087
- setTimeout(Z, 120);
31101
+ setTimeout(re, 120);
31088
31102
  };
31089
- Z();
31103
+ re();
31090
31104
  });
31091
31105
  }, z = (D) => {
31092
31106
  const H = D.client?.jid?.toString() || D.username || "xmpp-client";
@@ -31100,8 +31114,8 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31100
31114
  k("bg:initRoomsPresence:start");
31101
31115
  try {
31102
31116
  await yA(D, M), _("bg:initRoomsPresence", "bg:initRoomsPresence:start");
31103
- } catch (Z) {
31104
- console.warn("[InitTiming] bg:initRoomsPresence:error", Z);
31117
+ } catch (re) {
31118
+ console.warn("[InitTiming] bg:initRoomsPresence:error", re);
31105
31119
  }
31106
31120
  }
31107
31121
  })(), (async () => {
@@ -31112,77 +31126,77 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31112
31126
  else {
31113
31127
  m.current.add(H), k("bg:getChatsPrivateStore:start");
31114
31128
  try {
31115
- const de = await D.getChatsPrivateStoreRequestStanza();
31129
+ const ue = await D.getChatsPrivateStoreRequestStanza();
31116
31130
  F2(
31117
- de,
31131
+ ue,
31118
31132
  o
31119
31133
  ), _("bg:getChatsPrivateStore", "bg:getChatsPrivateStore:start");
31120
- } catch (de) {
31121
- m.current.delete(H), console.warn("[InitTiming] bg:getChatsPrivateStore:error", de);
31134
+ } catch (ue) {
31135
+ m.current.delete(H), console.warn("[InitTiming] bg:getChatsPrivateStore:error", ue);
31122
31136
  }
31123
31137
  }
31124
31138
  if (f.current || y.current.has(H)) return;
31125
31139
  y.current.add(H);
31126
- const Z = !!r?.historyQoS?.stagedPreloadEnabled, ee = Math.max(
31140
+ const re = !!r?.historyQoS?.stagedPreloadEnabled, oe = Math.max(
31127
31141
  1,
31128
31142
  Number(r?.historyQoS?.stagedPreloadFirstPassSize || 1)
31129
- ), te = Math.max(
31143
+ ), Q = Math.max(
31130
31144
  1,
31131
31145
  Number(r?.historyQoS?.stagedPreloadSecondPassSize || 15)
31132
- ), ue = Math.max(
31146
+ ), ce = Math.max(
31133
31147
  1,
31134
31148
  Number(r?.historyQoS?.stagedPreloadConcurrency || 3)
31135
- ), Q = Math.max(
31149
+ ), Y = Math.max(
31136
31150
  1,
31137
31151
  Number(r?.historyQoS?.preloadTopKRooms || 20)
31138
31152
  );
31139
31153
  k(
31140
- Z ? "bg:stagedPreload:start" : "bg:updateMessagesTillLast:start"
31154
+ re ? "bg:stagedPreload:start" : "bg:updateMessagesTillLast:start"
31141
31155
  );
31142
31156
  try {
31143
- if (await J(), Z) {
31144
- const de = (r?.defaultRooms || []).map(
31157
+ if (await J(), re) {
31158
+ const ue = (r?.defaultRooms || []).map(
31145
31159
  (ve) => ve.jid
31146
- ), pe = !!j.getState().rooms.activeRoomJID ? 1 : ue;
31160
+ ), pe = !!j.getState().rooms.activeRoomJID ? 1 : ce;
31147
31161
  await tl({
31148
31162
  client: D,
31149
31163
  concurrency: pe,
31150
- pageSize: ee,
31164
+ pageSize: oe,
31151
31165
  retryLimit: 2,
31152
- roomLimit: Q,
31166
+ roomLimit: Y,
31153
31167
  selectedRoomJid: j.getState().rooms.activeRoomJID || null,
31154
- defaultRoomJids: de,
31168
+ defaultRoomJids: ue,
31155
31169
  // Teaser pass: mark rooms 'partial' so the second pass below
31156
31170
  // still fetches the real page (marking them 'done' here made
31157
31171
  // the second pass skip every room, leaving 1-message rooms).
31158
31172
  completionState: "partial"
31159
31173
  }), await tl({
31160
31174
  client: D,
31161
- concurrency: ue,
31162
- pageSize: te,
31175
+ concurrency: ce,
31176
+ pageSize: Q,
31163
31177
  retryLimit: 2,
31164
31178
  selectedRoomJid: j.getState().rooms.activeRoomJID || null,
31165
- defaultRoomJids: de
31179
+ defaultRoomJids: ue
31166
31180
  });
31167
31181
  } else {
31168
- const de = j.getState().rooms.rooms || {}, se = j.getState().rooms.activeRoomJID ? 1 : 2;
31169
- await vA(de, D, se);
31182
+ const ue = j.getState().rooms.rooms || {}, se = j.getState().rooms.activeRoomJID ? 1 : 2;
31183
+ await vA(ue, D, se);
31170
31184
  }
31171
- f.current = !0, Z ? _("bg:stagedPreload", "bg:stagedPreload:start") : _("bg:updateMessagesTillLast", "bg:updateMessagesTillLast:start");
31172
- } catch (de) {
31185
+ f.current = !0, re ? _("bg:stagedPreload", "bg:stagedPreload:start") : _("bg:updateMessagesTillLast", "bg:updateMessagesTillLast:start");
31186
+ } catch (ue) {
31173
31187
  y.current.delete(H), console.warn(
31174
- Z ? "[InitTiming] bg:stagedPreload:error" : "[InitTiming] bg:updateMessagesTillLast:error",
31175
- de
31188
+ re ? "[InitTiming] bg:stagedPreload:error" : "[InitTiming] bg:updateMessagesTillLast:error",
31189
+ ue
31176
31190
  );
31177
31191
  }
31178
31192
  })();
31179
31193
  };
31180
- Y(() => () => {
31194
+ Z(() => () => {
31181
31195
  w && T.xmppPassword === "" && (q.log("closing client"), w.close(), g(null));
31182
- }, [w, g, T.xmppPassword]), Y(() => {
31196
+ }, [w, g, T.xmppPassword]), Z(() => {
31183
31197
  o(ql(r));
31184
31198
  const { changed: D } = V2(r);
31185
- D && (f.current = !1, p.current.clear(), m.current.clear(), y.current.clear(), o(Gl()), o(bm()), o(je({ roomJID: null })), Or.pause(), Or.purge().catch((H) => {
31199
+ D && (f.current = !1, p.current.clear(), m.current.clear(), y.current.clear(), o(Gl()), o(bm()), o(Ue({ roomJID: null })), Or.pause(), Or.purge().catch((H) => {
31186
31200
  console.warn("[CacheScope] Persist purge failed", H);
31187
31201
  }).finally(() => {
31188
31202
  Or.persist();
@@ -31201,10 +31215,10 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31201
31215
  u(!1);
31202
31216
  }, L = async (D, H = !1) => {
31203
31217
  !H && o(
31204
- Ue({ loading: !0, loadingText: "Loading chats..." })
31218
+ je({ loading: !0, loadingText: "Loading chats..." })
31205
31219
  ), k("loadRooms:start");
31206
- const re = await x(D, r);
31207
- return _("loadRooms", "loadRooms:start"), await D.sendAllPresencesAndMarkReady(), o(Ue({ loading: !1, loadingText: void 0 })), re;
31220
+ const ee = await x(D, r);
31221
+ return _("loadRooms", "loadRooms:start"), await D.sendAllPresencesAndMarkReady(), o(je({ loading: !1, loadingText: void 0 })), ee;
31208
31222
  }, $ = G((D) => {
31209
31223
  if (!D) return "";
31210
31224
  if (D.jid) return D.jid;
@@ -31213,64 +31227,71 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31213
31227
  }, [r?.xmppSettings?.conference]), U = G((D) => {
31214
31228
  const H = (D || []).map($).filter(Boolean);
31215
31229
  if (H.length === 0) return;
31216
- const re = e || null;
31217
- if (re && H.includes(re)) {
31218
- I !== re && o(je({ roomJID: re }));
31230
+ const ee = e || null;
31231
+ if (ee && H.includes(ee)) {
31232
+ I !== ee && o(Ue({ roomJID: ee }));
31219
31233
  return;
31220
31234
  }
31221
31235
  I && H.includes(I);
31222
31236
  }, [I, o, $, e]);
31223
- return Y(() => {
31237
+ return Z(() => {
31224
31238
  const D = SA(
31225
31239
  r?.translates?.readerLocale
31226
31240
  );
31227
31241
  D && o(Dc(D));
31228
- }, [r?.translates?.readerLocale, o]), Y(() => {
31229
- let D;
31230
- const H = async () => {
31231
- const re = xA(r?.translates);
31232
- re && o(Dc(re));
31242
+ }, [r?.translates?.readerLocale, o]), Z(() => {
31243
+ let D, H = !1;
31244
+ const ee = async (oe) => {
31245
+ try {
31246
+ const Q = await L(oe);
31247
+ return H = !1, R(!0), Q;
31248
+ } catch (Q) {
31249
+ return q.log("loadRooms failed", Q), H = !0, R(!1), o(je({ loading: !1, loadingText: void 0 })), clearTimeout(D), D = setTimeout(re, 5e3), null;
31250
+ }
31251
+ }, re = async () => {
31252
+ const oe = xA(r?.translates);
31253
+ oe && o(Dc(oe));
31233
31254
  try {
31234
31255
  if (T.xmppUsername)
31235
31256
  if (gA({ roomJID: e, wasAutoSelected: t, config: r, dispatch: o }), w) {
31236
31257
  if (r?.newArch !== !1) {
31237
- let Z = [];
31258
+ let Q = [];
31238
31259
  if (!M || Object.keys(M).length === 0) {
31239
31260
  i(!1);
31240
- const ee = await L(w);
31241
- U(ee), Z = Array.isArray(ee) ? ee : [];
31261
+ const ce = await ee(w);
31262
+ U(ce), Q = Array.isArray(ce) ? ce : [];
31242
31263
  } else
31243
- U(Object.values(M)), Z = Object.values(M), L(w, !0).catch((ee) => {
31244
- q.log("background loadRooms failed", ee);
31264
+ U(Object.values(M)), Q = Object.values(M), L(w, !0).catch((ce) => {
31265
+ q.log("background loadRooms failed", ce);
31245
31266
  });
31246
31267
  r?.enableRoomsRetry?.enabled && (Tl(
31247
31268
  e,
31248
- Z
31269
+ Q
31249
31270
  ) || await ie());
31250
31271
  }
31251
- i(!0), R(!0), g(w), l(!1), o(Ue({ loading: !1 })), N(), z(w), r?.refreshTokens?.enabled && Xc();
31272
+ i(!0), H || R(!0), g(w), l(!1), o(je({ loading: !1 })), N(), z(w), r?.refreshTokens?.enabled && Xc();
31252
31273
  } else {
31253
31274
  if (r?.initBeforeLoad && C === "provider" && b !== "idle") {
31254
31275
  if (b === "failed") {
31255
- o(Ue({ loading: !1, loadingText: void 0 })), l(!0), i(!1), q.log(
31276
+ o(je({ loading: !1, loadingText: void 0 })), l(!0), i(!1), q.log(
31256
31277
  "[InitPolicy] initBeforeLoad=true and provider bootstrap failed. ChatWrapper init is locked."
31257
- ), D = setTimeout(H, 2e3);
31278
+ ), D = setTimeout(re, 2e3);
31258
31279
  return;
31259
31280
  }
31260
31281
  o(
31261
- Ue({ loading: !0, loadingText: "Connecting..." })
31282
+ je({ loading: !0, loadingText: "Connecting..." })
31262
31283
  ), l(!1), q.log(
31263
31284
  `[InitPolicy] initBeforeLoad=true, waiting provider client (status=${b})`
31264
- ), D = setTimeout(H, 400);
31285
+ ), D = setTimeout(re, 400);
31265
31286
  return;
31266
31287
  }
31267
31288
  try {
31268
31289
  o(
31269
- Ue({ loading: !0, loadingText: "Connecting..." })
31290
+ je({ loading: !0, loadingText: "Connecting..." })
31270
31291
  ), i(!1), a(!1), o(
31271
- Ue({ loading: !0, loadingText: "Connecting..." })
31292
+ je({ loading: !0, loadingText: "Connecting..." })
31272
31293
  ), q.log("No client, so initing one"), k("xmpp:initClient:start"), k("initClient:create_instance:start"), k("initClient:wait_online:start");
31273
- const Z = await S(
31294
+ const Q = await S(
31274
31295
  T.xmppUsername || T?.defaultWallet?.walletAddress,
31275
31296
  T?.xmppPassword,
31276
31297
  {
@@ -31279,35 +31300,35 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31279
31300
  historyQoS: r?.historyQoS
31280
31301
  },
31281
31302
  M
31282
- ).then((ee) => ee);
31303
+ ).then((ce) => ce);
31283
31304
  if (_("xmpp:initClient", "xmpp:initClient:start"), _("initClient:create_instance", "initClient:create_instance:start"), M && Object.keys(M).length > 0)
31284
- i(!0), R(!0), r?.newArch !== !1 && L(Z, !0).catch((ee) => {
31285
- q.log("background loadRooms failed", ee);
31305
+ i(!0), R(!0), r?.newArch !== !1 && L(Q, !0).catch((ce) => {
31306
+ q.log("background loadRooms failed", ce);
31286
31307
  });
31287
31308
  else if (r?.newArch === !1)
31288
- k("xmpp:getRoomsStanza:start"), await Z.getRoomsStanza(), _("xmpp:getRoomsStanza", "xmpp:getRoomsStanza:start");
31309
+ k("xmpp:getRoomsStanza:start"), await Q.getRoomsStanza(), _("xmpp:getRoomsStanza", "xmpp:getRoomsStanza:start");
31289
31310
  else {
31290
- const ee = await L(Z);
31291
- U(ee), r?.enableRoomsRetry?.enabled && (Tl(
31311
+ const ce = await ee(Q);
31312
+ ce && (U(ce), r?.enableRoomsRetry?.enabled && (Tl(
31292
31313
  e,
31293
- ee
31294
- ) || await ie()), i(!0), R(!0);
31314
+ ce
31315
+ ) || await ie()), i(!0));
31295
31316
  }
31296
- g(Z), l(!1), o(Ue({ loading: !1 })), N(), z(Z), r?.refreshTokens?.enabled && Xc();
31297
- } catch (Z) {
31298
- q.log("err", Z), l(!0), R(!1), D = setTimeout(H, 5e3);
31317
+ g(Q), l(!1), o(je({ loading: !1 })), N(), z(Q), r?.refreshTokens?.enabled && Xc();
31318
+ } catch (Q) {
31319
+ q.log("err", Q), l(!0), R(!1), D = setTimeout(re, 5e3);
31299
31320
  }
31300
31321
  }
31301
31322
  else {
31302
- a(!1), o(Ue({ loading: !1, loadingText: void 0 })), q.log("No user yet, waiting for login");
31323
+ a(!1), o(je({ loading: !1, loadingText: void 0 })), q.log("No user yet, waiting for login");
31303
31324
  return;
31304
31325
  }
31305
- o(Ue({ loading: !1 }));
31306
- } catch (Z) {
31307
- a(!1), l(!0), i(!1), o(Ue({ loading: !1 })), R(!1), q.log(Z), D = setTimeout(H, 5e3);
31326
+ o(je({ loading: !1 }));
31327
+ } catch (Q) {
31328
+ a(!1), l(!0), i(!1), o(je({ loading: !1 })), R(!1), q.log(Q), D = setTimeout(re, 5e3);
31308
31329
  }
31309
31330
  };
31310
- return H(), () => {
31331
+ return re(), () => {
31311
31332
  clearTimeout(D), v.current && (clearTimeout(v.current), v.current = null);
31312
31333
  };
31313
31334
  }, [
@@ -31317,21 +31338,21 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31317
31338
  r?.initBeforeLoad,
31318
31339
  C,
31319
31340
  b
31320
- ]), Y(() => {
31341
+ ]), Z(() => {
31321
31342
  w && E.current["initClient:wait_online:start"] && w.status === "online" && _("initClient:wait_online", "initClient:wait_online:start");
31322
- }, [w?.status]), Y(() => {
31343
+ }, [w?.status]), Z(() => {
31323
31344
  if (!w) return;
31324
31345
  l(Cp(w.status));
31325
31346
  const D = setInterval(() => {
31326
31347
  l((H) => {
31327
- const re = Cp(w.status);
31328
- return H === re ? H : re;
31348
+ const ee = Cp(w.status);
31349
+ return H === ee ? H : ee;
31329
31350
  });
31330
31351
  }, 1e3);
31331
31352
  return () => clearInterval(D);
31332
- }, [w]), Y(() => {
31353
+ }, [w]), Z(() => {
31333
31354
  U(Object.values(M));
31334
- }, [M, I, U]), Y(() => (o(O1(!0)), () => {
31355
+ }, [M, I, U]), Z(() => (o(O1(!0)), () => {
31335
31356
  o(O1(!1));
31336
31357
  }), [o]), {
31337
31358
  client: w,
@@ -31436,7 +31457,7 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31436
31457
  const s = X(
31437
31458
  null
31438
31459
  );
31439
- Y(() => {
31460
+ Z(() => {
31440
31461
  const a = s.current;
31441
31462
  if (s.current = { threadOpen: e, panelOpen: t }, !(!e || !t)) {
31442
31463
  if (!a) {
@@ -31458,23 +31479,23 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31458
31479
  const { CustomMessageComponent: o } = ks(), n = o || XP, { user: i, activeModal: s, deleteModal: a } = ke(), [c, l] = K(!1), [d, u] = K(
31459
31480
  () => typeof window < "u" && window.innerWidth < 768
31460
31481
  ), [f, p] = K(!0), m = t?.xmppSettings?.conference, y = Me();
31461
- Y(() => {
31482
+ Z(() => {
31462
31483
  if (typeof window > "u")
31463
31484
  return;
31464
- const Q = () => {
31485
+ const Y = () => {
31465
31486
  u(window.innerWidth < 768);
31466
31487
  };
31467
- return Q(), window.addEventListener("resize", Q), () => {
31468
- typeof window < "u" && window.removeEventListener("resize", Q);
31488
+ return Y(), window.addEventListener("resize", Y), () => {
31489
+ typeof window < "u" && window.removeEventListener("resize", Y);
31469
31490
  };
31470
31491
  }, []);
31471
- const v = (Q) => {
31472
- l(Q);
31473
- }, w = ae((Q) => Q.rooms.rooms), S = ae((Q) => Q.rooms.activeRoomJID), g = ae((Q) => Q.rooms.isLoading), b = ae(
31474
- (Q) => !!Q.rooms?.reportRoom?.isOpen
31492
+ const v = (Y) => {
31493
+ l(Y);
31494
+ }, w = ae((Y) => Y.rooms.rooms), S = ae((Y) => Y.rooms.activeRoomJID), g = ae((Y) => Y.rooms.isLoading), b = ae(
31495
+ (Y) => !!Y.rooms?.reportRoom?.isOpen
31475
31496
  ), { loadingText: C } = Ot(), { wasAutoSelected: x } = hA(
31476
31497
  G(
31477
- (Q) => y(je(Q)),
31498
+ (Y) => y(Ue(Y)),
31478
31499
  [y]
31479
31500
  ),
31480
31501
  m,
@@ -31484,7 +31505,7 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31484
31505
  isReady: !g && Object.keys(w || {}).length > 0
31485
31506
  }
31486
31507
  ), R = X(null);
31487
- Y(() => {
31508
+ Z(() => {
31488
31509
  d && S && (!x && !r || R.current !== S && (R.current = S, l(!0)));
31489
31510
  }, [d, S, x, r]);
31490
31511
  const M = Go(
@@ -31493,10 +31514,10 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31493
31514
  ), I = Go(b, pl), T = ge(() => Object.values(w), [w]), E = ge(() => {
31494
31515
  if (S)
31495
31516
  return w[S]?.messages?.find(
31496
- (Q) => Q?.activeMessage
31517
+ (Y) => Y?.activeMessage
31497
31518
  );
31498
- }, [w, S]), P = (Q) => {
31499
- y(je({ roomJID: null })), y(Ue({ chatJID: Q.jid, loading: !0 })), y(je({ roomJID: Q.jid })), y(zt({ isEdit: !1 })), z?.promoteRoomHistory(Q.jid), v(!0), !Q?.historyComplete && Q.messages?.length < 30 && z?.getHistoryStanza(Q.jid, 30, void 0, void 0, {
31519
+ }, [w, S]), P = (Y) => {
31520
+ y(Ue({ roomJID: null })), y(je({ chatJID: Y.jid, loading: !0 })), y(Ue({ roomJID: Y.jid })), y(zt({ isEdit: !1 })), z?.promoteRoomHistory(Y.jid), v(!0), !Y?.historyComplete && Y.messages?.length < 30 && z?.getHistoryStanza(Y.jid, 30, void 0, void 0, {
31500
31521
  source: "active",
31501
31522
  coalesceRoom: !0,
31502
31523
  skipIfPreloaded: !0
@@ -31525,17 +31546,17 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31525
31546
  roomJID: r,
31526
31547
  wasAutoSelected: x,
31527
31548
  config: t
31528
- }), H = Object.keys(w || {}).length > 0, Z = (ie || !!z && !D && H) && !(g && !H), ee = D && !ie, te = !!(t?.enableRoomsRetry?.enabled && L && L !== "norooms"), ue = !$ && !ee && !te && i.xmppPassword !== "" && i.xmppUsername !== "" && f && !Z;
31529
- return _t("chat-wrapper-connecting-loader", ee), _t("chat-wrapper-retry-loader", te), _t("chat-wrapper-startup-loader", ue), Y(() => {
31549
+ }), H = Object.keys(w || {}).length > 0, re = (ie || !!z && !D && H) && !(g && !H), oe = D && !ie, Q = !!(t?.enableRoomsRetry?.enabled && L && L !== "norooms"), ce = !$ && !oe && !Q && i.xmppPassword !== "" && i.xmppUsername !== "" && f && !re;
31550
+ return _t("chat-wrapper-connecting-loader", oe), _t("chat-wrapper-retry-loader", Q), _t("chat-wrapper-startup-loader", ce), Z(() => {
31530
31551
  if (typeof window > "u") return;
31531
- const Q = window.location.pathname, de = () => {
31532
- const pe = window.location.pathname === Q;
31533
- p(pe), !pe && S && y(je({ roomJID: null }));
31552
+ const Y = window.location.pathname, ue = () => {
31553
+ const pe = window.location.pathname === Y;
31554
+ p(pe), !pe && S && y(Ue({ roomJID: null }));
31534
31555
  };
31535
- de();
31536
- const se = window.setInterval(de, 250);
31537
- return window.addEventListener("popstate", de), window.addEventListener("hashchange", de), () => {
31538
- window.clearInterval(se), window.removeEventListener("popstate", de), window.removeEventListener("hashchange", de);
31556
+ ue();
31557
+ const se = window.setInterval(ue, 250);
31558
+ return window.addEventListener("popstate", ue), window.addEventListener("hashchange", ue), () => {
31559
+ window.clearInterval(se), window.removeEventListener("popstate", ue), window.removeEventListener("hashchange", ue);
31539
31560
  };
31540
31561
  }, [S, y]), $ ? /* @__PURE__ */ h(
31541
31562
  Dg,
@@ -31581,7 +31602,7 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31581
31602
  ]
31582
31603
  }
31583
31604
  ) : i.xmppPassword === "" && i.xmppUsername === "" ? t?.fallbackScreens?.noUser != null ? /* @__PURE__ */ h(tr, { style: { ...e }, children: /* @__PURE__ */ h(Ir, { content: t.fallbackScreens.noUser }) }) : /* @__PURE__ */ h(Ag, { config: t }) : f ? t?.fallbackScreens?.noRoom != null && ie && !g && !H ? /* @__PURE__ */ h(tr, { style: { ...e }, children: /* @__PURE__ */ h(Ir, { content: t.fallbackScreens.noRoom }) }) : /* @__PURE__ */ O(Ee, { children: [
31584
- Z ? /* @__PURE__ */ h(
31605
+ re ? /* @__PURE__ */ h(
31585
31606
  tr,
31586
31607
  {
31587
31608
  style: {
@@ -31639,14 +31660,14 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31639
31660
  rA,
31640
31661
  {
31641
31662
  modal: s,
31642
- setOpenModal: (Q) => y(Ke(Q))
31663
+ setOpenModal: (Y) => y(Ke(Y))
31643
31664
  }
31644
31665
  ),
31645
31666
  /* @__PURE__ */ h(
31646
31667
  ZP,
31647
31668
  {
31648
31669
  modal: s,
31649
- setOpenModal: (Q) => y(Ke(Q))
31670
+ setOpenModal: (Y) => y(Ke(Y))
31650
31671
  }
31651
31672
  )
31652
31673
  ]
@@ -31699,7 +31720,7 @@ const xA = (e) => e?.enabled && e?.translations ? e.translations : void 0, SA =
31699
31720
  return console.error("Login failed:", d), null;
31700
31721
  }
31701
31722
  }, [e?.user?.email, e?.user?.password]), l = Me();
31702
- return Y(() => {
31723
+ return Z(() => {
31703
31724
  let d = !1;
31704
31725
  return (async () => {
31705
31726
  o?.baseUrl && pd(o.baseUrl, o.customAppToken);
@@ -31873,10 +31894,10 @@ Ci(Ng, "defaultProps", {
31873
31894
  });
31874
31895
  const LA = () => {
31875
31896
  const e = Me();
31876
- return Y(() => () => {
31897
+ return Z(() => () => {
31877
31898
  }, []), {
31878
31899
  navigateToMessage: (t, r) => {
31879
- e(je({ roomJID: t })), setTimeout(() => {
31900
+ e(Ue({ roomJID: t })), setTimeout(() => {
31880
31901
  const o = document.querySelector(
31881
31902
  `[data-message-id="${r}"]`
31882
31903
  );
@@ -31915,7 +31936,7 @@ const LA = () => {
31915
31936
  return !1;
31916
31937
  }
31917
31938
  }), [c, l] = K(!1);
31918
- Y(() => {
31939
+ Z(() => {
31919
31940
  if (typeof window > "u" || typeof Notification > "u")
31920
31941
  return;
31921
31942
  const g = () => i(Notification.permission);
@@ -32114,7 +32135,7 @@ function mI() {
32114
32135
  }));
32115
32136
  }
32116
32137
  function WA(e) {
32117
- Y(() => {
32138
+ Z(() => {
32118
32139
  qA(e);
32119
32140
  }, [
32120
32141
  e?.fontFamily,
@@ -32225,7 +32246,7 @@ const JA = { display: "contents" }, XA = () => (LA(), null), GA = ({ config: e }
32225
32246
  const f = j.getState().rooms.rooms, p = Ec(), m = !e.current;
32226
32247
  return { ...eM(f, p), loading: m, isLoading: m };
32227
32248
  }, [d, u] = K(() => l());
32228
- return Y(() => {
32249
+ return Z(() => {
32229
32250
  const f = () => {
32230
32251
  const v = l(), w = `${v.loading ? 1 : 0}#${Rp(
32231
32252
  j.getState().rooms.rooms,
@@ -32259,7 +32280,7 @@ const JA = { display: "contents" }, XA = () => (LA(), null), GA = ({ config: e }
32259
32280
  };
32260
32281
  typeof window < "u" && (window._ethoraAppLoadTime = Date.now());
32261
32282
  export {
32262
- je as $,
32283
+ Ue as $,
32263
32284
  US as A,
32264
32285
  Re as B,
32265
32286
  Rs as C,