@vkontakte/calls-sdk 2.8.12-beta.1 → 2.8.12-dev.a3089173.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/calls-sdk.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @vkontakte/calls-sdk v2.8.12-beta.1
3
- * Fri, 24 Jul 2026 10:37:01 GMT
2
+ * @vkontakte/calls-sdk v2.8.12-dev.a3089173.0
3
+ * Mon, 27 Jul 2026 07:24:37 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -2159,7 +2159,7 @@ var mn = pn.getInstance(), M = class e {
2159
2159
  return 1.1;
2160
2160
  }
2161
2161
  static get sdkVersion() {
2162
- return "2.8.12-beta.1";
2162
+ return "2.8.12-dev.a3089173.0";
2163
2163
  }
2164
2164
  static get debug() {
2165
2165
  return e._params.debug;
@@ -7920,7 +7920,7 @@ var oo = 90, so = 3, co = class extends y {
7920
7920
  this._pendingRequests = null, this._pendingPromises = [];
7921
7921
  let r = {};
7922
7922
  try {
7923
- r = await this._getRequestLayouts(t);
7923
+ r = this._getRequestLayouts(t);
7924
7924
  let i = this._forceNextFlush || Object.keys(this._uncertainLayouts).length > 0;
7925
7925
  this._forceNextFlush = !1;
7926
7926
  let a = this._getDiff(r, i);
@@ -7934,8 +7934,8 @@ var oo = 90, so = 3, co = class extends y {
7934
7934
  e === this._generation && (this._lastFlushAt = Date.now(), this._inFlight = !1, this._pendingRequests && this._schedule());
7935
7935
  }
7936
7936
  }
7937
- async _getRequestLayouts(e) {
7938
- let t = {}, n = await this._getParticipants();
7937
+ _getRequestLayouts(e) {
7938
+ let t = {}, n = this._getParticipants();
7939
7939
  for (let r of e) {
7940
7940
  let e = typeof r.uid == "object" ? r.uid : Z.fromId(r.uid), i = this._api.getCachedOkIdByExternalId(e);
7941
7941
  if (!i) {
@@ -8791,12 +8791,12 @@ var Eo = class {
8791
8791
  conversationId: u
8792
8792
  });
8793
8793
  if (!this._conversation) throw new O(D.UNKNOWN_ERROR);
8794
- if (this._participantState = X.ACCEPTED, this._changeMediaSettings(l), await this._processConnection(d), await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), this._signaling.readyToSend(), this._delayedHangup) throw new O(D.CANCELED);
8794
+ if (this._participantState = X.ACCEPTED, this._changeMediaSettings(l), await this._processConnection(d), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._signaling.readyToSend(), this._delayedHangup) throw new O(D.CANCELED);
8795
8795
  return this._debug.debug("Outgoing call", {
8796
8796
  opponentIds: e,
8797
8797
  opponentType: t,
8798
8798
  mediaOptions: n
8799
- }), await this._processConnectionSharedMovieInfo(d), await this._processConversationUrlSharingInfo(d), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), void 0, this.id), await this._onConversationParticipantListChunk(d), await this._processPinnedParticipants(d), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), zo = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
8799
+ }), this._processConnectionSharedMovieInfo(d), this._processConversationUrlSharingInfo(d), L.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), void 0, this.id), this._onConversationParticipantListChunk(d), this._processPinnedParticipants(d), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), z.add(this), await z.setActive(this.id), zo = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
8800
8800
  this._calleeUnavailableTimer = null, this._signaling.ready && this._signaling.hangup(D.CANCELED), this._close(new O(D.CALLEE_UNAVAILABLE));
8801
8801
  }, f)), this._conversation;
8802
8802
  } catch (e) {
@@ -8825,28 +8825,27 @@ var Eo = class {
8825
8825
  this._debug.debug("Join conversation part 2");
8826
8826
  try {
8827
8827
  if (this._participantState = X.ACCEPTED, !this._conversation || !this._mediaSource) throw new O(D.UNKNOWN_ERROR);
8828
- if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), !n && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), await this._processConnection(e), t && (await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener()), this._signaling.readyToSend(), this._state === "CLOSE") return this._conversation;
8828
+ if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), !n && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), await this._processConnection(e), t && (this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener()), this._signaling.readyToSend(), this._state === "CLOSE") return this._conversation;
8829
8829
  if (this._delayedHangup) throw new O(D.CANCELED);
8830
- await this._processConnectionSharedMovieInfo(e), await this._processConversationUrlSharingInfo(e), await this._processConnectionAsrInfo(e);
8831
- let r = await this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
8832
- L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), r, this.id), await this._onConversationParticipantListChunk(e), await this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.has(this.id) || z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), zo = null);
8830
+ this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
8831
+ let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
8832
+ L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.has(this.id) || z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), zo = null);
8833
8833
  let i = this._extractLocalParticipantFromConnection(e);
8834
8834
  if (i) {
8835
8835
  let e = j.mapParticipantState(i);
8836
8836
  Object.keys(e).length > 0 && L.onLocalParticipantState(e, !1, this.id);
8837
8837
  }
8838
- return t && this._openTransport(Object.values(await this._getParticipants()), !1), this._conversation;
8838
+ return t && this._openTransport(Object.values(this._getParticipants()), !1), this._conversation;
8839
8839
  } catch (e) {
8840
8840
  throw zo = null, this._close(e, "Unable to join conversation"), e;
8841
8841
  }
8842
8842
  }
8843
- async _extractExternalRooms(e) {
8844
- let t = e.map(this._convertRoomToExternal.bind(this));
8845
- return (await Promise.all(t)).filter((e) => !!e);
8843
+ _extractExternalRooms(e) {
8844
+ return e.map(this._convertRoomToExternal.bind(this)).filter((e) => !!e);
8846
8845
  }
8847
- async _extractExternalRoomsData(e, t) {
8846
+ _extractExternalRoomsData(e, t) {
8848
8847
  if (!e || !e.length) return;
8849
- let n = { rooms: await this._extractExternalRooms(e) };
8848
+ let n = { rooms: this._extractExternalRooms(e) };
8850
8849
  return t && (n.roomId = t), n;
8851
8850
  }
8852
8851
  async onPush(e, t = A.USER, n, r, i) {
@@ -8860,7 +8859,7 @@ var Eo = class {
8860
8859
  let a = await this._prepareConversation(e, t, n, r, i);
8861
8860
  if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new O(D.UNKNOWN_ERROR);
8862
8861
  if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(S.PUSH, "rejected"), new O(D.REJECTED);
8863
- if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), await this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(S.PUSH, "accepted"), z.add(this), zo = null, this._delayedHangup) throw new O(D.CANCELED);
8862
+ if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(S.PUSH, "accepted"), z.add(this), zo = null, this._delayedHangup) throw new O(D.CANCELED);
8864
8863
  } catch (e) {
8865
8864
  throw zo = null, this._close(e, "Unable to handle inbound call push"), e;
8866
8865
  }
@@ -8889,13 +8888,13 @@ var Eo = class {
8889
8888
  let e = this._mediaSource.mediaSettings;
8890
8889
  this._logWithMediaSettings(S.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
8891
8890
  try {
8892
- this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(this._mediaSource.mediaSettings), this._stats.lifecycle.markIncomingAccepted(!0), L.onCallAccepted(this.id), this._state = "ACTIVE", this._participantState = X.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(await this._getParticipants()), !0);
8891
+ this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(this._mediaSource.mediaSettings), this._stats.lifecycle.markIncomingAccepted(!0), L.onCallAccepted(this.id), this._state = "ACTIVE", this._participantState = X.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(this._getParticipants()), !0);
8893
8892
  } catch (e) {
8894
8893
  this._close(e, "Unable to accept concurrent call");
8895
8894
  }
8896
8895
  }
8897
- async _getMainRoomParticipants() {
8898
- let e = await this._getParticipants();
8896
+ _getMainRoomParticipants() {
8897
+ let e = this._getParticipants();
8899
8898
  return j.mapSharedParticipants(Object.values(e).filter((e) => !e.isInRoom));
8900
8899
  }
8901
8900
  _decodeExternalConversationParams(e) {
@@ -8938,7 +8937,7 @@ var Eo = class {
8938
8937
  }), this._registerParticipantLocalMuteState({ muteStates: this._conversation.muteStatesPersonal });
8939
8938
  let i = await this._signaling.getRooms(this._isCallAdmin());
8940
8939
  if (i.rooms?.rooms) {
8941
- let e = await this._getParticipants();
8940
+ let e = this._getParticipants();
8942
8941
  i.rooms.rooms.forEach((t) => {
8943
8942
  t.participantIds?.forEach((t) => {
8944
8943
  e[t] && (e[t].isInRoom = !0);
@@ -8946,15 +8945,15 @@ var Eo = class {
8946
8945
  });
8947
8946
  }
8948
8947
  this._conversation.roomId = i.rooms?.roomId || null;
8949
- let a = await this._extractExternalRoomsData(i.rooms?.rooms, i.rooms?.roomId);
8950
- if (L.onCallAccepted(this.id), L.onLocalStream(this._mediaSource.getStream(), t, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), await this._getMainRoomParticipants(), a, this.id), await this._emitHeldParticipantsStatus(), M.useParticipantListChunk) {
8951
- let e = await this._getInitialParticiapntListChunk(), t = await this._getParticipants();
8948
+ let a = this._extractExternalRoomsData(i.rooms?.rooms, i.rooms?.roomId);
8949
+ if (L.onCallAccepted(this.id), L.onLocalStream(this._mediaSource.getStream(), t, this.id), L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), a, this.id), await this._emitHeldParticipantsStatus(), M.useParticipantListChunk) {
8950
+ let e = await this._getInitialParticiapntListChunk(), t = this._getParticipants();
8952
8951
  e?.participants?.forEach((e) => {
8953
8952
  let n = t[j.composeId(e)];
8954
8953
  n && (n.movieShareInfos = e.movieShareInfos);
8955
- }), await this._onConversationParticipantListChunk({ participants: e });
8954
+ }), this._onConversationParticipantListChunk({ participants: e });
8956
8955
  }
8957
- return L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(await this._getParticipants()), !0), await this._processConversationUrlSharingInfo(), await this._processConnectionAsrInfo(), z.setActive(this.id).catch((e) => {
8956
+ return L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(this._getParticipants()), !0), this._processConversationUrlSharingInfo(), this._processConnectionAsrInfo(), z.setActive(this.id).catch((e) => {
8958
8957
  this._debug.error(e), this._close(e, "Unable to activated accepted call");
8959
8958
  }), this._conversation;
8960
8959
  } catch (e) {
@@ -9052,12 +9051,12 @@ var Eo = class {
9052
9051
  this._cleanupSignaling(), this._cleanupMediaSource();
9053
9052
  return;
9054
9053
  }
9055
- this._state = "CLOSE", this._participantState = X.HUNGUP, this._changeFeatureSet(), this._cleanupMediaSource(), await this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._cleanupSignaling(), this._api.cleanup(), this._api.setAbortSignal(void 0), this._signaling.setAbortSignal(void 0), this._stats.destroy(), z.remove(this.id), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null, L.onHangup(e || new O(D.UNKNOWN_ERROR), n);
9054
+ this._state = "CLOSE", this._participantState = X.HUNGUP, this._changeFeatureSet(), this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._cleanupSignaling(), this._api.cleanup(), this._api.setAbortSignal(void 0), this._signaling.setAbortSignal(void 0), this._stats.destroy(), z.remove(this.id), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null, L.onHangup(e || new O(D.UNKNOWN_ERROR), n);
9056
9055
  }
9057
- async destroy() {
9056
+ destroy() {
9058
9057
  this._clearCalleeUnavailableWatchdog();
9059
9058
  let e = this._conversation && this._conversation.id;
9060
- if (this._debug.debug("Destroy conversation", { conversationId: e }), this._stopFirstMediaSentProbe(), this._cooldownQueueCleanupTimer !== null && (window.clearInterval(this._cooldownQueueCleanupTimer), this._cooldownQueueCleanupTimer = null), this._state = "CLOSE", this._participantState = X.HUNGUP, this._cleanupMediaSource(), await this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._cleanupSignaling(), this._api.cleanup(), this._api.setAbortSignal(void 0), this._signaling.setAbortSignal(void 0), this._delayedHangup && e) try {
9059
+ if (this._debug.debug("Destroy conversation", { conversationId: e }), this._stopFirstMediaSentProbe(), this._cooldownQueueCleanupTimer !== null && (window.clearInterval(this._cooldownQueueCleanupTimer), this._cooldownQueueCleanupTimer = null), this._state = "CLOSE", this._participantState = X.HUNGUP, this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._cleanupSignaling(), this._api.cleanup(), this._api.setAbortSignal(void 0), this._signaling.setAbortSignal(void 0), this._delayedHangup && e) try {
9061
9060
  this._api.hangupConversation(e, D.CANCELED);
9062
9061
  } catch {}
9063
9062
  this._cleanupListeners(), this._stats.destroy(), z.remove(this.id), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null;
@@ -9152,7 +9151,7 @@ var Eo = class {
9152
9151
  } else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p);
9153
9152
  this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id), this._stats.lifecycle.markWarmupCompleted();
9154
9153
  let m = await this._connectSignaling(dr.START, p);
9155
- return await this._setConversation(p, m, n), this._stats.lifecycle.markCallStarted(), m;
9154
+ return this._setConversation(p, m, n), this._stats.lifecycle.markCallStarted(), m;
9156
9155
  }
9157
9156
  async _joinConversation(e) {
9158
9157
  W.setMark(H.SIGNALING_CONNECTED);
@@ -9205,7 +9204,7 @@ var Eo = class {
9205
9204
  if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), ro(l, u), l.id && z.has(l.id)) throw new O(D.HAS_ACTIVE_CALL);
9206
9205
  this._setConversationParams(l), this._stats.lifecycle.markWarmupCompleted();
9207
9206
  let d = await this._connectSignaling(dr.JOIN, l);
9208
- return await this._setConversation(l, d, Aa.JOINING), this._stats.lifecycle.markCallStarted(), d;
9207
+ return this._setConversation(l, d, Aa.JOINING), this._stats.lifecycle.markCallStarted(), d;
9209
9208
  }
9210
9209
  async _prepareConversation(e, t = A.USER, n, r, i) {
9211
9210
  W.setMark(H.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
@@ -9264,9 +9263,9 @@ var Eo = class {
9264
9263
  }
9265
9264
  this._stats.lifecycle.markWarmupCompleted();
9266
9265
  let u = await this._connectSignaling(dr.ACCEPT, l);
9267
- return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(S.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(D.BUSY), Promise.reject(new O(D.BUSY))) : (await this._setConversation(l, u, Aa.INCOMING, t), u);
9266
+ return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(S.PUSH, "busy"), this._signaling.ready && this._signaling.hangup(D.BUSY), Promise.reject(new O(D.BUSY))) : (this._setConversation(l, u, Aa.INCOMING, t), u);
9268
9267
  }
9269
- async _createParticipant(e, t, n = !0) {
9268
+ _createParticipant(e, t, n = !0) {
9270
9269
  let r = Object.assign({
9271
9270
  id: null,
9272
9271
  externalId: null,
@@ -9286,12 +9285,12 @@ var Eo = class {
9286
9285
  observedIds: [],
9287
9286
  isInRoom: !1,
9288
9287
  markers: null
9289
- }, e);
9290
- return r.externalId || (r.externalId = await this._getParticipantId(t ?? r.id)), n && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = Wa.create(r.connectionStatus), r;
9288
+ }, e), i = !!r.externalId;
9289
+ return i || (r.externalId = this._getParticipantId(t ?? r.id)), n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = Wa.create(r.connectionStatus), r;
9291
9290
  }
9292
- async _getParticipantId(e) {
9291
+ _getParticipantId(e) {
9293
9292
  try {
9294
- return await this._api.userId(e);
9293
+ return this._api.userId(e);
9295
9294
  } catch (e) {
9296
9295
  throw this._close(new O(D.NETWORK_ERROR), e), e;
9297
9296
  }
@@ -9306,7 +9305,7 @@ var Eo = class {
9306
9305
  }
9307
9306
  });
9308
9307
  }
9309
- async _setConversation(e, t, n, r = A.USER) {
9308
+ _setConversation(e, t, n, r = A.USER) {
9310
9309
  let { participants: i } = t.conversation;
9311
9310
  t.conversationParams?.serverTime && (this._serverTimeOffset = t.conversationParams.serverTime - Date.now()), this._cacheParticipantExternalIds(i);
9312
9311
  let a = this._api.getUserId(), o = this._extractLocalParticipantFromConnection(t), s = e.device_idx || 0;
@@ -9318,7 +9317,7 @@ var Eo = class {
9318
9317
  this._conversation = {
9319
9318
  userId: a,
9320
9319
  compositeUserId: c,
9321
- externalId: await this._getExternalIdByParticipantId(c),
9320
+ externalId: this._getExternalIdByParticipantId(c),
9322
9321
  acceptTime: t.conversation.acceptTime,
9323
9322
  features: t.conversation.features || [],
9324
9323
  featuresPerRole: t.conversation.featuresPerRole,
@@ -9365,9 +9364,9 @@ var Eo = class {
9365
9364
  async _processConnection(e) {
9366
9365
  await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(Ma.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
9367
9366
  }
9368
- async _onConversationParticipantListChunk(e) {
9367
+ _onConversationParticipantListChunk(e) {
9369
9368
  let t = e.participants;
9370
- t && L.onConversationParticipantListChunk(await this._participantListChunkToExternalChunk(this._createParticipantListChunk(t)), this.id);
9369
+ t && L.onConversationParticipantListChunk(this._participantListChunkToExternalChunk(this._createParticipantListChunk(t)), this.id);
9371
9370
  }
9372
9371
  _createParticipantListChunk(e) {
9373
9372
  return {
@@ -9378,8 +9377,8 @@ var Eo = class {
9378
9377
  ...e
9379
9378
  };
9380
9379
  }
9381
- async _participantListChunkToExternalChunk(e) {
9382
- let t = await this._getParticipants(), n = j.mapSharedParticipants(e.participants.reduce((e, n) => {
9380
+ _participantListChunkToExternalChunk(e) {
9381
+ let t = this._getParticipants(), n = j.mapSharedParticipants(e.participants.reduce((e, n) => {
9383
9382
  let r = j.composeId(n);
9384
9383
  return t[r] && e.push(t[r]), e;
9385
9384
  }, []));
@@ -9397,7 +9396,7 @@ var Eo = class {
9397
9396
  if (!this._conversation) return;
9398
9397
  let n = e[0]?.externalId?.type;
9399
9398
  n && (M.externalUserType = n);
9400
- let r = await this._getParticipants();
9399
+ let r = this._getParticipants();
9401
9400
  for (let n of e) {
9402
9401
  let e = j.composeId(n);
9403
9402
  if (R.test("Conversation:RegisterParticipant", e), this._isMe(e)) {
@@ -9425,7 +9424,7 @@ var Eo = class {
9425
9424
  movieShareInfos: n.movieShareInfos,
9426
9425
  isInRoom: t
9427
9426
  }, i);
9428
- let a = await this._getParticipant(e);
9427
+ let a = this._getParticipant(e);
9429
9428
  a && n.roles && n.roles.length && (this._debug.debug(`Roles for participant [${e}] changed: ${n.roles}`), L.onRolesChanged(a.externalId, n.roles, !0, this.id)), a && a.isOnHold && L.onRemoteStatus([a.externalId], N.ONHOLD, null, this.id);
9430
9429
  }
9431
9430
  }
@@ -9470,10 +9469,10 @@ var Eo = class {
9470
9469
  _registerParticipantInCache(e) {
9471
9470
  return this._participants[e.id] = e, e;
9472
9471
  }
9473
- async _getExistedParticipantByIdOrCreate(e) {
9474
- let t = (await this._getParticipants())[e];
9472
+ _getExistedParticipantByIdOrCreate(e) {
9473
+ let t = this._getParticipants()[e];
9475
9474
  if (t) return t;
9476
- let n = this._api.getDecorativeIdByInitialId(j.decomposeId(e).id), r = n ? j.composeUserId(n) : void 0, i = await this._getParticipantId(e), { deviceIdx: a } = j.decomposeParticipantId(e);
9475
+ let n = this._api.getDecorativeIdByInitialId(j.decomposeId(e).id), r = n ? j.composeUserId(n) : void 0, i = this._getParticipantId(e), { deviceIdx: a } = j.decomposeParticipantId(e);
9477
9476
  return this._createParticipant({
9478
9477
  id: e,
9479
9478
  externalId: {
@@ -9482,25 +9481,31 @@ var Eo = class {
9482
9481
  }
9483
9482
  }, r, !1);
9484
9483
  }
9485
- async _getExternalIdByParticipantId(e) {
9484
+ _getExternalIdByParticipantId(e) {
9486
9485
  if (this._isMe(e)) return this._conversation?.externalId;
9487
- if (M.useParticipantListChunk) return (await this._getExistedParticipantByIdOrCreate(e)).externalId;
9488
- let t = await this._getParticipants();
9486
+ if (M.useParticipantListChunk) return this._getExistedParticipantByIdOrCreate(e).externalId;
9487
+ let t = this._getParticipants();
9489
9488
  if (t[e]?.externalId) return t[e].externalId;
9490
9489
  {
9491
- let t = await this._getParticipantId(e);
9490
+ let t = this._getParticipantId(e);
9492
9491
  return this._api.cacheExternalId(e, t), t;
9493
9492
  }
9494
9493
  }
9495
9494
  _getExternalIdsByOkIdsFromCache(e) {
9496
9495
  return e.map((e) => this._api.getCachedExternalIdByOkId(e) ?? Z.fromId(String(e)));
9497
9496
  }
9498
- async _registerParticipantAndSetMarkersIfChunkEnabled(e, t) {
9497
+ _getOrCacheExternalIdByCompositeId(e) {
9498
+ let t = j.extractOkId(e), n = this._api.getCachedExternalIdByOkId(t);
9499
+ if (n) return n;
9500
+ let { type: r } = j.decomposeId(e), i = Z.fromId(String(t), r === A.GROUP ? Ga.GROUP : Ga.USER);
9501
+ return this._api.cacheExternalId(e, i), i;
9502
+ }
9503
+ _registerParticipantAndSetMarkersIfChunkEnabled(e, t) {
9499
9504
  if (M.useParticipantListChunk) {
9500
- let n = this._registerParticipantInCache(await this._getExistedParticipantByIdOrCreate(e));
9505
+ let n = this._registerParticipantInCache(this._getExistedParticipantByIdOrCreate(e));
9501
9506
  return n.markers = this._denormalizeMarkers(n.id, t), n;
9502
9507
  }
9503
- return (await this._getParticipants())[e];
9508
+ return this._getParticipants()[e];
9504
9509
  }
9505
9510
  _warnParticipantNotInConversation(e) {
9506
9511
  this._debug.warn(`Participant [${e}] isn't in conversation`);
@@ -9537,21 +9542,21 @@ var Eo = class {
9537
9542
  this._onRecordInfo(e.conversation?.recordInfo ?? null);
9538
9543
  for (let t of e.rooms?.rooms ?? []) this._onRecordInfo(t.recordInfo ?? null, t.id);
9539
9544
  }
9540
- async _processPinnedParticipants(e) {
9541
- e.conversation.pinnedParticipantId ? await this._onPinParticipant(e.conversation.pinnedParticipantId) : this._conversation?.pinnedParticipantIdByRoom.delete(null);
9542
- for (let t of e.rooms?.rooms ?? []) t.pinnedParticipantId ? await this._onPinParticipant(t.pinnedParticipantId, !1, void 0, t.id) : this._conversation?.pinnedParticipantIdByRoom.delete(t.id);
9545
+ _processPinnedParticipants(e) {
9546
+ e.conversation.pinnedParticipantId ? this._onPinParticipant(e.conversation.pinnedParticipantId) : this._conversation?.pinnedParticipantIdByRoom.delete(null);
9547
+ for (let t of e.rooms?.rooms ?? []) t.pinnedParticipantId ? this._onPinParticipant(t.pinnedParticipantId, !1, void 0, t.id) : this._conversation?.pinnedParticipantIdByRoom.delete(t.id);
9543
9548
  }
9544
- async _allocateTransport() {
9549
+ _allocateTransport() {
9545
9550
  if (!this._conversation || !this._mediaSource) return;
9546
9551
  this._transport = new na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new co(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
9547
- let e = this._conversation.direction === Aa.OUTGOING && !this._conversation.concurrent, t = await this._getParticipants();
9552
+ let e = this._conversation.direction === Aa.OUTGOING && !this._conversation.concurrent, t = this._getParticipants();
9548
9553
  for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
9549
9554
  }
9550
9555
  _createSpeakerDetector() {
9551
9556
  this._transport && this._conversation && (this._volumesDetector = new go(this._transport), this.subscribe(this._volumesDetector, ho.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new vo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, _o.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new po(this._mediaSource));
9552
9557
  }
9553
- async _createSpecListener() {
9554
- this._transport && this._volumesDetector && (this._specListener = new xo(this._transport, this._volumesDetector, await this._getParticipants(), this._debug, this._stats.logger));
9558
+ _createSpecListener() {
9559
+ this._transport && this._volumesDetector && (this._specListener = new xo(this._transport, this._volumesDetector, this._getParticipants(), this._debug, this._stats.logger));
9555
9560
  }
9556
9561
  _logDevices() {
9557
9562
  let e = T.getCameras().length, t = T.getMicrophones().length;
@@ -9563,7 +9568,7 @@ var Eo = class {
9563
9568
  async _removeParticipant(e, t) {
9564
9569
  if (e.state === X.CALLED || e.state === X.ACCEPTED || this._state === "CLOSE") return;
9565
9570
  e.id === this._lastSignalledActiveSpeakerId && (this._lastSignalledActiveSpeakerId = null);
9566
- let n = await this._getParticipants();
9571
+ let n = this._getParticipants();
9567
9572
  if (n[e.id]) {
9568
9573
  t === D.HUNGUP ? this._setParticipantsStatus([e], N.HANGUP) : this._setParticipantsStatus([e], N.ERROR, t), e.mediaSource?.disconnect(), this._displayLayoutRequester.cleanupParticipant(e.id), this._conversation && this._conversation.pinnedParticipantIdByRoom.get(null) === e.id && this._conversation.pinnedParticipantIdByRoom.delete(null), this._conversation && this._conversation.roomId && this._conversation.pinnedParticipantIdByRoom.get(this._conversation.roomId) === e.id && this._conversation.pinnedParticipantIdByRoom.delete(this._conversation.roomId);
9569
9574
  for (let [t, n] of Object.entries(e.lastRequestedLayouts)) this._streamIdByStreamDescription.delete(t), this._sequenceNumberByStreamDescription.delete(t), this._cooldownTimestampByStreamDescription.delete(t), this._streamWaitTimerByStreamDescription.has(t) && (window.clearTimeout(this._streamWaitTimerByStreamDescription.get(t)), this._streamWaitTimerByStreamDescription.delete(t)), this._sendUpdateDisplayLayout({ [t]: { stopStream: !0 } }, !1);
@@ -9576,8 +9581,8 @@ var Eo = class {
9576
9581
  _cleanupMediaSource() {
9577
9582
  this._mediaSource && (this._mediaSource.destroy(), this._mediaSource = null);
9578
9583
  }
9579
- async _cleanupParticipants() {
9580
- Object.values(await this._getParticipants()).forEach((e) => {
9584
+ _cleanupParticipants() {
9585
+ Object.values(this._getParticipants()).forEach((e) => {
9581
9586
  e.remoteStream?.getTracks().forEach((e) => e.stop()), e.remoteAudioTrack?.stop(), e.secondStream?.getTracks().forEach((e) => e.stop()), e.mediaSource?.disconnect();
9582
9587
  }), this._participants = {}, this._audioOutput && this._audioOutput.destroy();
9583
9588
  }
@@ -9617,7 +9622,7 @@ var Eo = class {
9617
9622
  }
9618
9623
  async _onAddParticipant(e, t, n) {
9619
9624
  this._debug.debug(`Add new participant [${e}]`);
9620
- let r = await this._getParticipant(e);
9625
+ let r = this._getParticipant(e);
9621
9626
  r && this._updateParticipantExternalId(r, t);
9622
9627
  let i = !r;
9623
9628
  if (r && (r.state === X.ACCEPTED || r.state === X.CALLED)) {
@@ -9637,13 +9642,13 @@ var Eo = class {
9637
9642
  muteStates: t.muteStates || {},
9638
9643
  unmuteOptions: t.unmuteOptions || [],
9639
9644
  observedIds: t.observedIds || []
9640
- }, n), r = await this._getParticipant(e);
9645
+ }, n), r = this._getParticipant(e);
9641
9646
  }
9642
9647
  this._setParticipantsStatus([r], N.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = X.HUNGUP, await this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(S.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
9643
9648
  }
9644
- async _onRemoveParticipant(e) {
9649
+ _onRemoveParticipant(e) {
9645
9650
  this._debug.debug(`Remove participant [${e}]`);
9646
- let t = [], n = await this._getParticipants();
9651
+ let t = [], n = this._getParticipants();
9647
9652
  for (let r = 0; r <= Ro; r++) {
9648
9653
  let i = n[j.compose(e, r)];
9649
9654
  i && t.push(i);
@@ -9709,7 +9714,7 @@ var Eo = class {
9709
9714
  let e = typeof t.uid == "object" ? t.uid : Z.fromId(t.uid), r = Z.toString(e);
9710
9715
  n[r] = t.priority;
9711
9716
  }
9712
- let r = await this._getParticipants();
9717
+ let r = this._getParticipants();
9713
9718
  for (let e of Object.values(r)) {
9714
9719
  let r = Z.toString(e.externalId);
9715
9720
  Object.hasOwn(n, r) && (t[e.id] = n[r]);
@@ -9731,15 +9736,15 @@ var Eo = class {
9731
9736
  return;
9732
9737
  }
9733
9738
  if (this._isWaitingForPromotion()) {
9734
- this._waitingHallHoldPending = !1, await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus());
9739
+ this._waitingHallHoldPending = !1, this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus());
9735
9740
  return;
9736
9741
  }
9737
9742
  let n = fa.get();
9738
9743
  await this._signaling.hold(!1, n), this._restoreStateAfterHold();
9739
9744
  let r = null;
9740
- if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(await this._getParticipants()), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._allocateTransport(), this._createSpeakerDetector(), await this._createSpecListener(), await this._resumeLocalMedia(t, N.WAITING), this._state === "ACTIVE") {
9745
+ if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._getParticipants()), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), await this._resumeLocalMedia(t, N.WAITING), this._state === "ACTIVE") {
9741
9746
  let e = this._conversation?.direction === Aa.OUTGOING && !this._conversation.concurrent;
9742
- this._openTransport(r ?? Object.values(await this._getParticipants()), e);
9747
+ this._openTransport(r ?? Object.values(this._getParticipants()), e);
9743
9748
  }
9744
9749
  }
9745
9750
  async _holdLocally() {
@@ -9772,7 +9777,7 @@ var Eo = class {
9772
9777
  async updateDisplayLayout(e) {
9773
9778
  if (e.length < 1 || !this._signaling.ready) return;
9774
9779
  this._debug.log(`Update display layout request [${this._signaling.getNextCommandSequenceNumber()}]`, e);
9775
- let t = {}, n = [], r = await this._getParticipants();
9780
+ let t = {}, n = [], r = this._getParticipants();
9776
9781
  for (let i of e) {
9777
9782
  let e = typeof i.uid == "object" ? i.uid : Z.fromId(i.uid), a = this._api.getCachedOkIdByExternalId(e);
9778
9783
  if (!a) {
@@ -9800,7 +9805,7 @@ var Eo = class {
9800
9805
  this._debug.error("Cannot accommodate all streaming requests: tracks available " + M.videoTracksCount + "; requested streams: " + Array.from(this._streamIdByStreamDescription.keys()));
9801
9806
  break;
9802
9807
  }
9803
- await this._stopStreaming(e.value), t[e.value] = { stopStream: !0 };
9808
+ this._stopStreaming(e.value), t[e.value] = { stopStream: !0 };
9804
9809
  }
9805
9810
  if (this._transport?.getTopology() !== J.SERVER) {
9806
9811
  n.forEach((e) => e());
@@ -9814,9 +9819,9 @@ var Eo = class {
9814
9819
  async feedback(e) {
9815
9820
  return this._signaling.feedback(e);
9816
9821
  }
9817
- async _stopStreaming(e) {
9822
+ _stopStreaming(e) {
9818
9823
  if (this._cooldownTimestampByStreamDescription.delete(e), this._sequenceNumberByStreamDescription.set(e, this._signaling.getNextCommandSequenceNumber()), this._streamWaitTimerByStreamDescription.has(e) && (this._debug.log("Client asked to stop streaming before stream became available", e), window.clearTimeout(this._streamWaitTimerByStreamDescription.get(e)), this._streamWaitTimerByStreamDescription.delete(e)), this._streamIdByStreamDescription.get(e)) {
9819
- let t = await this._getParticipants(), n = En(e), r = t[n.participantId], i = this._conversation?.externalId, a = this._isMe(n.participantId);
9824
+ let t = this._getParticipants(), n = En(e), r = t[n.participantId], i = this._conversation?.externalId, a = this._isMe(n.participantId);
9820
9825
  if (r || a) {
9821
9826
  switch (n.mediaType) {
9822
9827
  case V.STREAM:
@@ -9852,7 +9857,7 @@ var Eo = class {
9852
9857
  if (this._debug.warn(`Failed to update display layout ${JSON.stringify(e)}. ${n}`), t) throw n;
9853
9858
  return;
9854
9859
  }
9855
- let r = [], i = await this._getParticipants();
9860
+ let r = [], i = this._getParticipants();
9856
9861
  for (let [e, t] of Object.entries(n.errorCodeByParticipantId || {})) {
9857
9862
  let n = En(e), a = i[n.participantId];
9858
9863
  if (a) {
@@ -9889,74 +9894,61 @@ var Eo = class {
9889
9894
  }
9890
9895
  async _onChatRoomUpdated(e, t = 0, n = [], r, i) {
9891
9896
  this._debug.log(`Chat room updated: ${e}`);
9892
- let a = [], o = [], s = [], c = [], l = [];
9893
- if (n.length && n.forEach((e) => {
9897
+ let a = [];
9898
+ n.length && n.forEach((e) => {
9894
9899
  if (e.externalId) {
9895
9900
  let t = Z.fromSignaling(e.externalId);
9896
- l.push(t), this._api.cacheExternalId(e.id.id, t);
9897
- } else {
9898
- let t = j.decomposeId(e.id.id).id;
9899
- a.push(t), c.push(t);
9900
- }
9901
- }), r?.length && r.forEach((e) => {
9902
- let t = j.decomposeId(e).id;
9903
- a.push(t), o.push(t);
9904
- }), i?.length && i.forEach((e) => {
9905
- let t = j.decomposeId(e).id;
9906
- a.push(t), s.push(t);
9907
- }), !a.length) {
9908
- L.onChatRoomUpdated(e, t, l, [], [], this.id);
9909
- return;
9910
- }
9911
- c.length && l.push(...this._getExternalIdsByOkIdsFromCache(c));
9912
- let u = this._getExternalIdsByOkIdsFromCache(o), d = this._getExternalIdsByOkIdsFromCache(s);
9913
- L.onChatRoomUpdated(e, t, l, u, d, this.id);
9901
+ a.push(t), this._api.cacheExternalId(e.id.id, t);
9902
+ } else a.push(this._getOrCacheExternalIdByCompositeId(e.id.id));
9903
+ });
9904
+ let o = r?.map((e) => this._getOrCacheExternalIdByCompositeId(e)) ?? [], s = i?.map((e) => this._getOrCacheExternalIdByCompositeId(e)) ?? [];
9905
+ L.onChatRoomUpdated(e, t, a, o, s, this.id);
9914
9906
  }
9915
- async _onSharedMovieUpdate(e) {
9907
+ _onSharedMovieUpdate(e) {
9916
9908
  let t = this._conversation?.externalId;
9917
9909
  for (let n of e.data) if (this._isMe(n.participantId)) L.onLocalLiveUpdate(t, n, this.id);
9918
9910
  else {
9919
- let e = await this._getExternalIdByParticipantId(n.participantId);
9911
+ let e = this._getExternalIdByParticipantId(n.participantId);
9920
9912
  e && L.onRemoteLiveUpdate(e, n, this.id);
9921
9913
  }
9922
9914
  }
9923
- async _onSharedMovieInfoStarted(e) {
9924
- this._debug.log(`Shared movie started data received: ${e.notification}`), await this._processSharedMovieInfo(e.movieShareInfo, e.roomId);
9915
+ _onSharedMovieInfoStarted(e) {
9916
+ this._debug.log(`Shared movie started data received: ${e.notification}`), this._processSharedMovieInfo(e.movieShareInfo, e.roomId);
9925
9917
  }
9926
- async _processSharedMovieInfos(e, t = null) {
9927
- e && await Promise.all(e.map((e) => this._processSharedMovieInfo(e, t)));
9918
+ _processSharedMovieInfos(e, t = null) {
9919
+ e && e.forEach((e) => this._processSharedMovieInfo(e, t));
9928
9920
  }
9929
- async _processSharedMovieInfo(e, t = null) {
9921
+ _processSharedMovieInfo(e, t = null) {
9930
9922
  if (!e) return;
9931
9923
  let n = this._conversation?.externalId;
9932
9924
  if (this._isMe(e.initiatorId)) L.onLocalSharedMovieInfo(n, e, t, this.id);
9933
9925
  else {
9934
- let n = await this._getExternalIdByParticipantId(e.initiatorId);
9926
+ let n = this._getExternalIdByParticipantId(e.initiatorId);
9935
9927
  n && L.onRemoteSharedMovieInfo(n, e, t, this.id);
9936
9928
  }
9937
9929
  }
9938
- async _processConnectionSharedMovieInfo(e) {
9930
+ _processConnectionSharedMovieInfo(e) {
9939
9931
  let t = e.conversation.participants.find((e) => this._isMe(j.composeId(e)));
9940
- await this._processSharedMovieInfos(t?.movieShareInfos, e?.rooms?.roomId ?? null);
9932
+ this._processSharedMovieInfos(t?.movieShareInfos, e?.rooms?.roomId ?? null);
9941
9933
  }
9942
- async _processConnectionAsrInfo(e) {
9934
+ _processConnectionAsrInfo(e) {
9943
9935
  let t = e?.conversation.asrInfo ?? this._conversation?.asrInfo;
9944
9936
  if (t && this._conversation?.asrInfoByRoom.set(null, t), e?.rooms?.rooms) for (let t of e.rooms.rooms) t.asrInfo && this._conversation?.asrInfoByRoom.set(t.id, t.asrInfo);
9945
9937
  let n = e?.rooms?.roomId ?? this._conversation?.roomId ?? null, r = this._conversation?.asrInfoByRoom.get(n);
9946
9938
  if (r) {
9947
- let e = await this._getExternalIdByParticipantId(r.initiatorId);
9939
+ let e = this._getExternalIdByParticipantId(r.initiatorId);
9948
9940
  e && L.onAsrSet({
9949
9941
  externalId: e,
9950
9942
  movieId: r.movieId
9951
9943
  }, n, this.id);
9952
9944
  } else n && L.onAsrSet(null, n, this.id);
9953
9945
  }
9954
- async _processConversationUrlSharingInfo(e) {
9946
+ _processConversationUrlSharingInfo(e) {
9955
9947
  if (!this._conversation) return;
9956
9948
  e && this._extractConnectionUrlSharingInfo(e);
9957
9949
  let { urlSharingInfoByRoom: t } = this._conversation, n = this._conversation.roomId, r = t.get(n);
9958
9950
  if (r && !this._isMe(r.initiatorId)) {
9959
- let e = await this._getExternalIdByParticipantId(r.initiatorId);
9951
+ let e = this._getExternalIdByParticipantId(r.initiatorId);
9960
9952
  e && L.onRemoteSharedUrl(e, r.sharedUrl, n, this.id);
9961
9953
  }
9962
9954
  }
@@ -9965,7 +9957,7 @@ var Eo = class {
9965
9957
  let { urlSharingInfoByRoom: t } = this._conversation;
9966
9958
  if (e.conversation.urlSharingInfo ? t.set(null, e.conversation.urlSharingInfo) : t.delete(null), e.rooms?.rooms) for (let n of e.rooms.rooms) n.urlSharingInfo ? t.set(n.id, n.urlSharingInfo) : t.delete(n.id);
9967
9959
  }
9968
- async _onSharedMovieInfoStopped(e) {
9960
+ _onSharedMovieInfoStopped(e) {
9969
9961
  this._debug.log(`Shared movie stopped data received: ${e.notification}`);
9970
9962
  let t = this._conversation?.externalId, { initiatorId: n, movieId: r, source: i, roomId: a = null } = e, o = {
9971
9963
  initiatorId: n,
@@ -9974,21 +9966,21 @@ var Eo = class {
9974
9966
  };
9975
9967
  if (this._isMe(n)) L.onLocalSharedMovieStoppedInfo(t, o, a, this.id);
9976
9968
  else {
9977
- let e = await this._getExternalIdByParticipantId(n);
9969
+ let e = this._getExternalIdByParticipantId(n);
9978
9970
  if (e) {
9979
- let t = (await this._getParticipants())[n];
9971
+ let t = this._getParticipants()[n];
9980
9972
  t?.movieShareInfos && (t.movieShareInfos = t.movieShareInfos.filter((e) => e && e.movieId !== r)), L.onRemoteSharedMovieStoppedInfo(e, o, a, this.id);
9981
9973
  }
9982
9974
  }
9983
9975
  }
9984
- async _onUrlSharingInfoUpdated(e) {
9976
+ _onUrlSharingInfoUpdated(e) {
9985
9977
  if (this._debug.log(`Shared URL data received: ${e.notification}`), !this._conversation) return;
9986
9978
  let { urlSharingInfoByRoom: t, roomId: n } = this._conversation, { initiatorId: r, sharedUrl: i, roomId: a = null } = e;
9987
9979
  if (i ? t.set(a, {
9988
9980
  sharedUrl: i,
9989
9981
  initiatorId: r
9990
9982
  }) : t.delete(a), !(!i && a !== n && t.has(n)) && (!i || !this._isMe(r))) {
9991
- let e = await this._getExternalIdByParticipantId(r);
9983
+ let e = this._getExternalIdByParticipantId(r);
9992
9984
  e && L.onRemoteSharedUrl(e, i, a, this.id);
9993
9985
  }
9994
9986
  }
@@ -9999,7 +9991,7 @@ var Eo = class {
9999
9991
  if (e.fastScreenShare && !e.participantStreamDescription) {
10000
9992
  let t = this._getStreamDescriptionById(e.streamId);
10001
9993
  if (t) {
10002
- let e = En(t), n = await this._getParticipant(e.participantId);
9994
+ let e = En(t), n = this._getParticipant(e.participantId);
10003
9995
  L.onRemoteScreenStream(n.externalId, null, this.id);
10004
9996
  return;
10005
9997
  }
@@ -10008,7 +10000,7 @@ var Eo = class {
10008
10000
  if (!t) return;
10009
10001
  let { mediaType: n, participantId: r } = t;
10010
10002
  if (n === V.ANIMOJI) return;
10011
- let i = await this._getParticipant(r);
10003
+ let i = this._getParticipant(r);
10012
10004
  if (n === V.SCREEN && !e.fastScreenShare) {
10013
10005
  this._debug.log("skipping participant-sources-update notification since screenshare will be received over datachannel");
10014
10006
  return;
@@ -10145,22 +10137,15 @@ var Eo = class {
10145
10137
  };
10146
10138
  }
10147
10139
  async _resolveWaitingHallExternalIds(e) {
10148
- let t = /* @__PURE__ */ new Map(), n = [], r = [];
10149
- if (e.length) {
10150
- let i = [];
10151
- e.forEach((e) => {
10152
- if (t.set(e.id.id, e.id.addedTs), e.externalId) {
10153
- let t = Z.fromSignaling(e.externalId);
10154
- n.push(e.id.addedTs), r.push(t), this._api.cacheExternalId(e.id.id, t);
10155
- } else i.push(j.decomposeId(e.id.id).id);
10156
- }), i.length && !r.length && (r = this._getExternalIdsByOkIdsFromCache(i), n = r.map((e) => {
10157
- let n = this._api.getCachedOkIdByExternalId(e);
10158
- return (n ? t.get(n) : void 0) || Date.now();
10159
- }));
10160
- }
10161
- return {
10162
- externalIds: r,
10163
- timestamps: n
10140
+ let t = [], n = [];
10141
+ return e.length && e.forEach((e) => {
10142
+ if (e.externalId) {
10143
+ let r = Z.fromSignaling(e.externalId);
10144
+ t.push(e.id.addedTs), n.push(r), this._api.cacheExternalId(e.id.id, r);
10145
+ } else n.push(this._getOrCacheExternalIdByCompositeId(e.id.id)), t.push(e.id.addedTs);
10146
+ }), {
10147
+ externalIds: n,
10148
+ timestamps: t
10164
10149
  };
10165
10150
  }
10166
10151
  async getAudienceModeHands() {
@@ -10197,7 +10182,7 @@ var Eo = class {
10197
10182
  let t = await this._signaling.chatHistory(e);
10198
10183
  for (let e = t.messages.length - 1; e >= 0; e--) {
10199
10184
  let n = t.messages[e];
10200
- await this._onChatMessage(n);
10185
+ this._onChatMessage(n);
10201
10186
  }
10202
10187
  }
10203
10188
  }
@@ -10321,7 +10306,7 @@ var Eo = class {
10321
10306
  let t = this._convertExternalIdsToServerExternalIds(e.externalIds), n = await this._signaling.getParticipants(t);
10322
10307
  if (n.error) throw Error(n.error);
10323
10308
  let r = n.participants, i = this._transport?.getState();
10324
- return Promise.all(r.map(async (e) => {
10309
+ return j.mapSharedParticipants(r.map((e) => {
10325
10310
  let t = j.composeId(e);
10326
10311
  return this._createParticipant({
10327
10312
  id: t,
@@ -10337,13 +10322,13 @@ var Eo = class {
10337
10322
  observedIds: e.observedIds || [],
10338
10323
  markers: this._denormalizeMarkers(t, e.markers)
10339
10324
  }, e.decorativeUserId);
10340
- })).then(j.mapSharedParticipants);
10325
+ }));
10341
10326
  }
10342
10327
  async getParticipantListChunk(e) {
10343
10328
  this._debug.log("Request participant list chunk", e);
10344
10329
  let t = await this._signaling.getParticipantListChunk(e);
10345
10330
  if (t.error) throw Error(t.error);
10346
- let n = this._createParticipantListChunk(t.chunk), r = await this._getParticipants(), i = n.participants.filter((e) => !r[j.composeId(e)]);
10331
+ let n = this._createParticipantListChunk(t.chunk), r = this._getParticipants(), i = n.participants.filter((e) => !r[j.composeId(e)]);
10347
10332
  await this._registerParticipants(i);
10348
10333
  let a = this._transport?.getState();
10349
10334
  return n.participants.forEach((e) => {
@@ -10370,14 +10355,14 @@ var Eo = class {
10370
10355
  let n = e.track ? new MediaStream([e.track]) : null;
10371
10356
  L.onScreenStream(n, t, this.id);
10372
10357
  }
10373
- async _changeRemoteMediaSettings(e, t) {
10358
+ _changeRemoteMediaSettings(e, t) {
10374
10359
  this._debug.debug(`Remote media settings changed [${e}]`, t);
10375
10360
  let n = this._conversation?.externalId;
10376
10361
  if (this._isMe(e) && n) {
10377
10362
  L.onLocalMediaSettings(n, t, this.id);
10378
10363
  return;
10379
10364
  }
10380
- let r = await this._getParticipant(e);
10365
+ let r = this._getParticipant(e);
10381
10366
  if (!r) {
10382
10367
  this._warnParticipantNotInConversation(e);
10383
10368
  return;
@@ -10393,16 +10378,16 @@ var Eo = class {
10393
10378
  }
10394
10379
  async _changeRemoteParticipantState(e, t) {
10395
10380
  this._debug.debug(`Remote participant state changed [${e}]`, t);
10396
- let n = await this._getParticipant(e);
10381
+ let n = this._getParticipant(e);
10397
10382
  if (!n) {
10398
10383
  this._warnParticipantNotInConversation(e);
10399
10384
  return;
10400
10385
  }
10401
10386
  n.participantState = t || {}, ["ACTIVE", "HELD"].includes(this._state) && L.onRemoteParticipantState(n.externalId, n.participantState, n.markers, this.id);
10402
10387
  }
10403
- async _changeMultipleParticipantState(e, t) {
10388
+ _changeMultipleParticipantState(e, t) {
10404
10389
  this._debug.debug("Multiple participants state changed", e);
10405
- let n = [], r, i = await this._getParticipants();
10390
+ let n = [], r, i = this._getParticipants();
10406
10391
  e.forEach((e, t) => {
10407
10392
  if (this._isMe(t)) r = e;
10408
10393
  else {
@@ -10475,8 +10460,8 @@ var Eo = class {
10475
10460
  _onSignalingTopologyChanged(e) {
10476
10461
  this._conversation && e.topology !== this._conversation.topology && (this._debug.log(`Signaling topology changed while transport is down: ${this._conversation.topology} -> ${e.topology}`), this._conversation.topology = e.topology);
10477
10462
  }
10478
- async _onPromotionApproved(e) {
10479
- let t = await this._getExternalIdByParticipantId(e.adminId);
10463
+ _onPromotionApproved(e) {
10464
+ let t = this._getExternalIdByParticipantId(e.adminId);
10480
10465
  if (!t) {
10481
10466
  this._warnParticipantNotInConversation(e.adminId);
10482
10467
  return;
@@ -10485,10 +10470,10 @@ var Eo = class {
10485
10470
  }
10486
10471
  async _onSignalingReconnect(e) {
10487
10472
  if (!this._conversation) return;
10488
- e.conversationParams?.serverTime && (this._serverTimeOffset = e.conversationParams.serverTime - Date.now()), e.conversation.acceptTime && (this._conversation.acceptTime = e.conversation.acceptTime), e.conversation.participantsLimit && (this._conversation.participantsLimit = e.conversation.participantsLimit), e.conversation.features && (this._conversation.features = e.conversation.features, this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._changeFeatureSet(), this._changeFeaturesPerRole()), await this._processPinnedParticipants(e), e.conversation.state;
10473
+ e.conversationParams?.serverTime && (this._serverTimeOffset = e.conversationParams.serverTime - Date.now()), e.conversation.acceptTime && (this._conversation.acceptTime = e.conversation.acceptTime), e.conversation.participantsLimit && (this._conversation.participantsLimit = e.conversation.participantsLimit), e.conversation.features && (this._conversation.features = e.conversation.features, this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._changeFeatureSet(), this._changeFeaturesPerRole()), this._processPinnedParticipants(e), e.conversation.state;
10489
10474
  let t = null;
10490
10475
  if (e.conversation.participants) {
10491
- let n = Object.keys(await this._getParticipants()), r = [];
10476
+ let n = Object.keys(this._getParticipants()), r = [];
10492
10477
  for (let n of e.conversation.participants) {
10493
10478
  let e = j.composeId(n), i = n.roles || [];
10494
10479
  if (this._isMe(e)) {
@@ -10501,7 +10486,7 @@ var Eo = class {
10501
10486
  continue;
10502
10487
  }
10503
10488
  r.push(e);
10504
- let a = await this._getParticipant(e);
10489
+ let a = this._getParticipant(e);
10505
10490
  if (!a) await this._onJoinedParticipant({
10506
10491
  participantId: n.id,
10507
10492
  participant: n,
@@ -10510,12 +10495,12 @@ var Eo = class {
10510
10495
  else {
10511
10496
  this._updateParticipantSessionState(a, e, n.sessionState);
10512
10497
  let t = E(n.mediaSettings);
10513
- Ut(t, a.mediaSettings) || await this._changeRemoteMediaSettings(e, t);
10498
+ Ut(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
10514
10499
  let r = j.mapParticipantState(n), o = a.participantState;
10515
10500
  j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), Ha(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? N.ONHOLD : N.CONNECTED));
10516
10501
  }
10517
10502
  }
10518
- let i = await this._getParticipants();
10503
+ let i = this._getParticipants();
10519
10504
  for (let e of n) r.indexOf(e) < 0 && i[e] && this._removeParticipant(i[e], D.HUNGUP);
10520
10505
  }
10521
10506
  let n = [...e.participants?.participants ?? [], ...e.rooms?.rooms.flatMap((e) => e.participants?.participants ?? []) ?? []];
@@ -10537,15 +10522,15 @@ var Eo = class {
10537
10522
  return;
10538
10523
  }
10539
10524
  this._conversation?.direction === Aa.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
10540
- let r = await this._getParticipant(t);
10525
+ let r = this._getParticipant(t);
10541
10526
  if (!r) {
10542
10527
  let n = this._api.getDecorativeIdByInitialId(t), i = n ? j.composeUserId(n, e.participantType) : void 0;
10543
- r = this._registerParticipantInCache(await this._createParticipant({
10528
+ r = this._registerParticipantInCache(this._createParticipant({
10544
10529
  id: t,
10545
10530
  mediaSettings: E(e.mediaSettings)
10546
10531
  }, i));
10547
10532
  }
10548
- r.state = X.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(S.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), await this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
10533
+ r.state = X.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(S.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
10549
10534
  let i = Object.keys(r.muteStates);
10550
10535
  i.length && this._onMuteParticipant({
10551
10536
  muteStates: r.muteStates,
@@ -10562,8 +10547,8 @@ var Eo = class {
10562
10547
  e.reason === D.OBSOLETE_CLIENT && e.errorCode && (t.message = e.errorCode), this._close(new O(e.reason, t));
10563
10548
  return;
10564
10549
  }
10565
- await this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
10566
- let n = await this._getParticipant(t);
10550
+ this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
10551
+ let n = this._getParticipant(t);
10567
10552
  if (!n) {
10568
10553
  this._warnParticipantNotInConversation(t);
10569
10554
  return;
@@ -10573,12 +10558,12 @@ var Eo = class {
10573
10558
  this._removeParticipant(n, t);
10574
10559
  }
10575
10560
  }
10576
- async _onSessionState(e) {
10561
+ _onSessionState(e) {
10577
10562
  if (!M.enableSessionStateUpdates) return;
10578
10563
  let t = j.composeMessageId(e);
10579
10564
  if (this._isMe(t)) return;
10580
- await this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
10581
- let n = await this._getParticipant(t);
10565
+ this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers);
10566
+ let n = this._getParticipant(t);
10582
10567
  if (!n) {
10583
10568
  this._warnParticipantNotInConversation(t);
10584
10569
  return;
@@ -10591,7 +10576,7 @@ var Eo = class {
10591
10576
  }
10592
10577
  async _reconcileParticipantSessionStates(e) {
10593
10578
  if (!M.enableSessionStateUpdates || !e.length) return;
10594
- let t = await this._getParticipants();
10579
+ let t = this._getParticipants();
10595
10580
  for (let n of e) {
10596
10581
  let e = j.composeId(n), r = t[e];
10597
10582
  r && !this._isMe(e) && (this._updateParticipantExternalId(r, n), this._updateParticipantSessionState(r, e, n.sessionState));
@@ -10609,7 +10594,7 @@ var Eo = class {
10609
10594
  }
10610
10595
  async _onAddedParticipant(e) {
10611
10596
  this._debug.debug(`Participant added [${e.participantId}]`);
10612
- let t = j.composeMessageId(e), n = await this._getParticipant(t);
10597
+ let t = j.composeMessageId(e), n = this._getParticipant(t);
10613
10598
  n && this._updateParticipantExternalId(n, e.participant);
10614
10599
  let r = !n;
10615
10600
  if (n && n.state !== X.HUNGUP && n.state !== X.REJECTED) {
@@ -10630,13 +10615,13 @@ var Eo = class {
10630
10615
  muteStates: r.muteStates || {},
10631
10616
  unmuteOptions: r.unmuteOptions || [],
10632
10617
  observedIds: r.observedIds || []
10633
- }, i), n = await this._getParticipant(t);
10618
+ }, i), n = this._getParticipant(t);
10634
10619
  }
10635
- n.state = X.CALLED, n.mediaSettings = E(e.participant?.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._allocateParticipantTransport(n.id, !0), L.onParticipantAdded(n.externalId, n.markers, this.id), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10620
+ n.state = X.CALLED, n.mediaSettings = E(e.participant?.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._allocateParticipantTransport(n.id, !0), L.onParticipantAdded(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10636
10621
  }
10637
10622
  async _onJoinedParticipant(e) {
10638
10623
  this._debug.debug(`Participant joined [${e.participantId}]`), this._statFirstMediaReceived.markOnJoin(this._transport?.getTopology());
10639
- let t = j.composeMessageId(e), n = await this._getParticipant(t);
10624
+ let t = j.composeMessageId(e), n = this._getParticipant(t);
10640
10625
  n && this._updateParticipantExternalId(n, e.participant);
10641
10626
  let r = !n;
10642
10627
  if (n && n.state === X.ACCEPTED) {
@@ -10659,36 +10644,36 @@ var Eo = class {
10659
10644
  connectionStatus: this._buildConnectionStatus(t, r.sessionState, this._transport?.getState(), r.onHold),
10660
10645
  markers: this._denormalizeMarkers(t, r.markers),
10661
10646
  isOnHold: !!r.onHold
10662
- }, i), n = await this._getParticipant(t);
10647
+ }, i), n = this._getParticipant(t);
10663
10648
  }
10664
- this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], N.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), L.onParticipantJoined(n.externalId, n.markers, this.id), await this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10649
+ this._conversation && this._conversation.direction === Aa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], N.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), L.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
10665
10650
  let i = Object.keys(n.muteStates);
10666
10651
  i.length && this._onMuteParticipant({
10667
10652
  muteStates: n.muteStates,
10668
10653
  mediaOptions: i,
10669
10654
  stateUpdated: !0,
10670
10655
  participantId: t
10671
- }), await this._processSharedMovieInfos(n.movieShareInfos);
10656
+ }), this._processSharedMovieInfos(n.movieShareInfos);
10672
10657
  }
10673
10658
  _onClosedConversation(e) {
10674
10659
  this._toggleJoinAvailability(), this._close(new O(e.reason, { remote: !0 }));
10675
10660
  }
10676
- async _onMediaSettingsChanged(e) {
10661
+ _onMediaSettingsChanged(e) {
10677
10662
  let t = j.composeMessageId(e);
10678
- await this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), await this._changeRemoteMediaSettings(t, E(e.mediaSettings));
10663
+ this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), this._changeRemoteMediaSettings(t, E(e.mediaSettings));
10679
10664
  }
10680
10665
  async _onParticipantStateChanged(e) {
10681
10666
  let t = j.composeMessageId(e), n = j.mapParticipantState(e);
10682
- this._isMe(t) ? this._changeLocalParticipantState(n) : (await this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), await this._changeRemoteParticipantState(t, n));
10667
+ this._isMe(t) ? this._changeLocalParticipantState(n) : (this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), await this._changeRemoteParticipantState(t, n));
10683
10668
  }
10684
- async _onParticipantsStateChanged(e) {
10685
- let { participants: t, roomId: n } = e, r = t.map(({ id: e, markers: t }) => this._registerParticipantAndSetMarkersIfChunkEnabled(e, t));
10686
- await Promise.all(r);
10687
- let i = /* @__PURE__ */ new Map(), a = t.map(({ id: e, participantState: t }) => this._getExternalIdByParticipantId(e).then((n) => [e, n && j.mapParticipantState({ participantState: t })]));
10669
+ _onParticipantsStateChanged(e) {
10670
+ let { participants: t, roomId: n } = e;
10671
+ t.map(({ id: e, markers: t }) => this._registerParticipantAndSetMarkersIfChunkEnabled(e, t));
10672
+ let r = /* @__PURE__ */ new Map(), i = t.map(({ id: e, participantState: t }) => [e, this._getExternalIdByParticipantId(e) && j.mapParticipantState({ participantState: t })]);
10688
10673
  try {
10689
- (await Promise.all(a)).forEach(([e, t]) => {
10690
- t && i.set(e, t);
10691
- }), await this._changeMultipleParticipantState(i, n);
10674
+ i.forEach(([e, t]) => {
10675
+ t && r.set(e, t);
10676
+ }), this._changeMultipleParticipantState(r, n);
10692
10677
  } catch (e) {
10693
10678
  this._debug.warn(`_onParticipantsStateChanged: Failed to get external ids. ${e}`);
10694
10679
  }
@@ -10738,84 +10723,84 @@ var Eo = class {
10738
10723
  }
10739
10724
  async _onPeerRegistered(e) {
10740
10725
  this._registeredPeerReceived = !0, this._clearCalleeUnavailableWatchdog();
10741
- let t = j.composeMessageId(e), n = await this._getParticipant(t);
10726
+ let t = j.composeMessageId(e), n = this._getParticipant(t);
10742
10727
  n && (n.clientType = e.clientType, n.platform = e.platform), L.onPeerRegistered(this.id);
10743
10728
  }
10744
10729
  async _onMicSwitched(e) {
10745
10730
  L.onDeviceSwitched(x.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
10746
10731
  }
10747
- async _onChatMessage(e) {
10748
- let t = j.composeMessageId(e), n = await this._getExternalIdByParticipantId(t);
10732
+ _onChatMessage(e) {
10733
+ let t = j.composeMessageId(e), n = this._getExternalIdByParticipantId(t);
10749
10734
  if (!n) {
10750
10735
  this._warnParticipantNotInConversation(t);
10751
10736
  return;
10752
10737
  }
10753
10738
  L.onChatMessage(e.message, n, e.direct, this.id);
10754
10739
  }
10755
- async _onCustomData(e) {
10740
+ _onCustomData(e) {
10756
10741
  if (Object.hasOwn(e.data, "sdk")) return;
10757
- let t = j.composeMessageId(e), n = await this._getExternalIdByParticipantId(t);
10742
+ let t = j.composeMessageId(e), n = this._getExternalIdByParticipantId(t);
10758
10743
  if (!n) {
10759
10744
  this._warnParticipantNotInConversation(t);
10760
10745
  return;
10761
10746
  }
10762
10747
  L.onCustomData(e.data, n, e.direct, this.id);
10763
10748
  }
10764
- async _onRecordInfo(e, t = null) {
10749
+ _onRecordInfo(e, t = null) {
10765
10750
  if (!this._conversation || !e) return;
10766
10751
  let n = this._conversation.recordsInfoByRoom.get(t);
10767
10752
  if (n?.recordMovieId !== e?.recordMovieId || n?.recordStartTime !== e?.recordStartTime) {
10768
10753
  this._conversation.recordsInfoByRoom.set(t, e);
10769
- let n = await this._getExternalIdByParticipantId(e.initiator);
10754
+ let n = this._getExternalIdByParticipantId(e.initiator);
10770
10755
  n ? L.onRecordStarted(n, e.recordMovieId, e.recordStartTime, e.recordType, e.recordExternalMovieId, e.recordExternalOwnerId, t, this.id) : this._warnParticipantNotInConversation(e.initiator);
10771
10756
  }
10772
10757
  }
10773
- async _onStopRecordInfo({ participant: e, recordMovieId: t }, n = null) {
10758
+ _onStopRecordInfo({ participant: e, recordMovieId: t }, n = null) {
10774
10759
  if (!this._conversation) return;
10775
10760
  let r = this._conversation.recordsInfoByRoom.get(n);
10776
10761
  if (!(!r || r.recordMovieId !== t)) if (this._conversation.recordsInfoByRoom.set(n, null), e) {
10777
- let t = await this._getExternalIdByParticipantId(e);
10762
+ let t = this._getExternalIdByParticipantId(e);
10778
10763
  L.onRecordStopped(n, t ?? null, this.id);
10779
10764
  } else L.onRecordStopped(n, null, this.id);
10780
10765
  }
10781
- async _changePinnedParticipantForRoom() {
10766
+ _changePinnedParticipantForRoom() {
10782
10767
  if (!this._conversation) return;
10783
10768
  let e = this._conversation.roomId, t = this._conversation.pinnedParticipantIdByRoom.get(e);
10784
10769
  if (t && !this._isMe(t)) {
10785
- let n = await this._getExternalIdByParticipantId(t);
10770
+ let n = this._getExternalIdByParticipantId(t);
10786
10771
  n && L.onPinnedParticipant(n, !1, null, e, this.id);
10787
10772
  }
10788
10773
  }
10789
- async _changeRecordInfoForRoom() {
10774
+ _changeRecordInfoForRoom() {
10790
10775
  if (!this._conversation) return;
10791
10776
  let e = this._conversation.roomId, t = this._conversation.recordsInfoByRoom.get(e);
10792
10777
  if (t) {
10793
- let n = await this._getExternalIdByParticipantId(t.initiator);
10778
+ let n = this._getExternalIdByParticipantId(t.initiator);
10794
10779
  n ? L.onRecordStarted(n, t.recordMovieId, t.recordStartTime, t.recordType, t.recordExternalMovieId, t.recordExternalOwnerId, e, this.id) : this._warnParticipantNotInConversation(t.initiator);
10795
10780
  } else L.onRecordStopped(e, null, this.id);
10796
10781
  }
10797
- async _changeAsrInfoForRoom() {
10782
+ _changeAsrInfoForRoom() {
10798
10783
  if (!this._conversation) return;
10799
10784
  let e = this._conversation.roomId, t = this._conversation.asrInfoByRoom.get(e);
10800
10785
  if (t) {
10801
- let n = await this._getExternalIdByParticipantId(t.initiatorId);
10786
+ let n = this._getExternalIdByParticipantId(t.initiatorId);
10802
10787
  n && L.onAsrSet({
10803
10788
  externalId: n,
10804
10789
  movieId: t.movieId
10805
10790
  }, e, this.id);
10806
10791
  } else L.onAsrSet(null, e, this.id);
10807
10792
  }
10808
- async _changeUrlSharingInfoForRoom() {
10793
+ _changeUrlSharingInfoForRoom() {
10809
10794
  if (!this._conversation) return;
10810
10795
  let { roomId: e } = this._conversation, { urlSharingInfoByRoom: t } = this._conversation, n = t.get(e);
10811
10796
  if (n) {
10812
- let t = await this._getExternalIdByParticipantId(n.initiatorId);
10797
+ let t = this._getExternalIdByParticipantId(n.initiatorId);
10813
10798
  t && L.onRemoteSharedUrl(t, n.sharedUrl, e, this.id);
10814
10799
  }
10815
10800
  }
10816
- async _onParticipantAnimojiChanged(e) {
10801
+ _onParticipantAnimojiChanged(e) {
10817
10802
  if (this._conversation) {
10818
- let t = await this._getExternalIdByParticipantId(e.participantId);
10803
+ let t = this._getExternalIdByParticipantId(e.participantId);
10819
10804
  if (!t) {
10820
10805
  this._warnParticipantNotInConversation(e.participantId);
10821
10806
  return;
@@ -10823,11 +10808,11 @@ var Eo = class {
10823
10808
  L.onParticipantVmojiUpdate(t, this.id);
10824
10809
  }
10825
10810
  }
10826
- async _onAsrStart(e) {
10811
+ _onAsrStart(e) {
10827
10812
  if (!this._conversation) return;
10828
10813
  let t = e.asrInfo, n = e.roomId || null;
10829
10814
  this._conversation.asrInfoByRoom.set(n, t);
10830
- let r = await this._getExternalIdByParticipantId(t.initiatorId);
10815
+ let r = this._getExternalIdByParticipantId(t.initiatorId);
10831
10816
  if (!r) {
10832
10817
  this._warnParticipantNotInConversation(t.initiatorId);
10833
10818
  return;
@@ -10839,9 +10824,9 @@ var Eo = class {
10839
10824
  let t = e.roomId || null;
10840
10825
  t === null && (this._conversation.asrInfo = null), this._conversation.asrInfoByRoom.delete(t), L.onAsrStopped(t, this.id);
10841
10826
  }
10842
- async _onAsrTranscription(e) {
10827
+ _onAsrTranscription(e) {
10843
10828
  if (!this._conversation) return;
10844
- let t = await this._getExternalIdByParticipantId(e.participantId);
10829
+ let t = this._getExternalIdByParticipantId(e.participantId);
10845
10830
  if (!t) {
10846
10831
  this._warnParticipantNotInConversation(e.participantId);
10847
10832
  return;
@@ -10856,7 +10841,7 @@ var Eo = class {
10856
10841
  }), j.includesOneOf(t, [Va.ADMIN, Va.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
10857
10842
  return;
10858
10843
  }
10859
- let n = await this._getParticipant(e);
10844
+ let n = this._getParticipant(e);
10860
10845
  n && !Ha(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, L.onRolesChanged(n.externalId, t, !1, this.id));
10861
10846
  }
10862
10847
  async _onMuteParticipant(e, t = !1) {
@@ -10867,10 +10852,10 @@ var Eo = class {
10867
10852
  this._debug.warn(`Not admin got mute states for participant [${e.participantId}]`);
10868
10853
  return;
10869
10854
  }
10870
- let t = await this._getParticipant(e.participantId);
10855
+ let t = this._getParticipant(e.participantId);
10871
10856
  if (t) {
10872
10857
  this._debug.debug(`Mute states for participant [${e.participantId}] changed`, r);
10873
- let o = e.adminId ? await this._getExternalIdByParticipantId(e.adminId) : null;
10858
+ let o = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null;
10874
10859
  L.onMuteStates(r, i, a, n, e.unmute, t.externalId, o, e.stateUpdated, e.requestedMedia, e.roomId, this.id);
10875
10860
  }
10876
10861
  return;
@@ -10903,7 +10888,7 @@ var Eo = class {
10903
10888
  }
10904
10889
  async _processMuteState(e) {
10905
10890
  if (!this._conversation || !this._mediaSource || this._participantState !== X.ACCEPTED) return;
10906
- let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? await this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
10891
+ let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
10907
10892
  for (let [e, i] of d) {
10908
10893
  let a = this._isCallAdmin() && n;
10909
10894
  if (!(i !== La.MUTE && i !== La.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === La.MUTE_PERMANENT && !n && (l[e] = La.MUTE), !(!t.includes(e) || r))) switch (e) {
@@ -10927,17 +10912,17 @@ var Eo = class {
10927
10912
  }
10928
10913
  L.onMuteStates(l, s, t, n, r, null, c, i, a, o, this.id);
10929
10914
  }
10930
- async _onPinParticipant(e, t = !1, n, r = null) {
10915
+ _onPinParticipant(e, t = !1, n, r = null) {
10931
10916
  if (!this._conversation) return;
10932
10917
  let i = this._conversation.pinnedParticipantIdByRoom.get(r);
10933
10918
  if (i && i !== e) if (this._isMe(i)) L.onLocalPin(!0, r, this.id);
10934
10919
  else {
10935
- let t = await this._getExternalIdByParticipantId(i);
10920
+ let t = this._getExternalIdByParticipantId(i);
10936
10921
  t && L.onPinnedParticipant(t, !0, this._denormalizeMarkers(e, n), r, this.id);
10937
10922
  }
10938
10923
  if (this._isMe(e)) L.onLocalPin(t, r, this.id);
10939
10924
  else {
10940
- let i = await this._getExternalIdByParticipantId(e);
10925
+ let i = this._getExternalIdByParticipantId(e);
10941
10926
  i && L.onPinnedParticipant(i, t, this._denormalizeMarkers(e, n), r, this.id);
10942
10927
  }
10943
10928
  this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
@@ -10947,7 +10932,7 @@ var Eo = class {
10947
10932
  }
10948
10933
  async _onNetworkStatus(e) {
10949
10934
  if (this._conversation) {
10950
- let t = [], n = await this._getParticipants();
10935
+ let t = [], n = this._getParticipants();
10951
10936
  for (let [r, i] of Object.entries(e)) {
10952
10937
  let e;
10953
10938
  if (this._isMe(r) || r === "") e = this._conversation.networkRating;
@@ -10967,11 +10952,11 @@ var Eo = class {
10967
10952
  }
10968
10953
  }
10969
10954
  async _emitHeldParticipantsStatus() {
10970
- let e = Object.values(await this._getParticipants()).filter((e) => e.isOnHold).map((e) => e.externalId);
10955
+ let e = Object.values(this._getParticipants()).filter((e) => e.isOnHold).map((e) => e.externalId);
10971
10956
  e.length && L.onRemoteStatus(e, N.ONHOLD, null, this.id);
10972
10957
  }
10973
10958
  async _onRemoteStreamSecond(e, t) {
10974
- let n = await this._getParticipant(e);
10959
+ let n = this._getParticipant(e);
10975
10960
  n && L.onRemoteScreenStream(n.externalId, t, this.id);
10976
10961
  }
10977
10962
  async _onAnimojiStream(e, t) {
@@ -10979,12 +10964,12 @@ var Eo = class {
10979
10964
  L.onVmojiStream(t, this._mediaSource.mediaSettings, this.id);
10980
10965
  return;
10981
10966
  }
10982
- let n = await this._getParticipant(e);
10967
+ let n = this._getParticipant(e);
10983
10968
  n && L.onRemoteVmojiStream(n.externalId, t, this.id);
10984
10969
  }
10985
- async _onAnimojiError(e) {
10970
+ _onAnimojiError(e) {
10986
10971
  try {
10987
- let t = await this._getExternalIdByParticipantId(e.participantId);
10972
+ let t = this._getExternalIdByParticipantId(e.participantId);
10988
10973
  t && (delete e.participantId, L.onVmojiError({
10989
10974
  ...e,
10990
10975
  externalId: t
@@ -11011,7 +10996,7 @@ var Eo = class {
11011
10996
  async _onVolumesDetected(e) {
11012
10997
  let t = [];
11013
10998
  for (let [n, r] of Object.entries(e)) {
11014
- let e = await this._getParticipant(n);
10999
+ let e = this._getParticipant(n);
11015
11000
  e && e.externalId && t.push({
11016
11001
  uid: e.externalId,
11017
11002
  volume: r.real
@@ -11022,14 +11007,14 @@ var Eo = class {
11022
11007
  async _onSpeakerChanged(e) {
11023
11008
  let t = this._activeSpeakerId;
11024
11009
  if (this._activeSpeakerId = e, t && t !== e) {
11025
- let e = await this._getParticipant(t);
11010
+ let e = this._getParticipant(t);
11026
11011
  if (e?.connectionStatus.sessionStateConnectedBySpeaker) {
11027
11012
  e.connectionStatus.sessionStateConnectedBySpeaker = !1;
11028
11013
  let t = this._setTransportStatus(e, e.connectionStatus.transport);
11029
11014
  this._emitParticipantTransition(e, t);
11030
11015
  }
11031
11016
  }
11032
- let n = await this._getParticipant(e);
11017
+ let n = this._getParticipant(e);
11033
11018
  if (n) {
11034
11019
  if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
11035
11020
  let e = Wa.fromTransportState(this._transport?.getState());
@@ -11044,7 +11029,7 @@ var Eo = class {
11044
11029
  this._debug.debug(`Transport state has changed: ${t}`, e);
11045
11030
  let n = Wa.fromTransportState(t);
11046
11031
  if (!n) return;
11047
- let r = await this._getParticipants(), i = [], a = e.reduce((e, n) => {
11032
+ let r = this._getParticipants(), i = [], a = e.reduce((e, n) => {
11048
11033
  if (n in r) {
11049
11034
  let a = r[n];
11050
11035
  e.push(a), t === q.CONNECTED && (a.remoteStream || (a.mediaSettings && this._changeRemoteMediaSettings(n, a.mediaSettings), this._changeRemoteParticipantState(n, a.participantState)), i.push(...Object.values(a.lastRequestedLayouts)));
@@ -11058,25 +11043,25 @@ var Eo = class {
11058
11043
  let e = Object.values(this._myLastRequestedLayouts);
11059
11044
  await this.updateDisplayLayout(e), this._displayLayoutRequester.resend();
11060
11045
  }
11061
- this._state !== "HELD" && ((e === q.CONNECTING || e === q.RECONNECTING) && await this._areTransportParticipantsOnHold() || (e === q.CONNECTING && L.onLocalStatus(N.CONNECTING, this.id), e === q.RECONNECTING && L.onLocalStatus(N.RECONNECT, this.id), e === q.FAILED && this._transport && this._transport.allocated().length === 0 && (this._signaling.ready && await this._signaling.hangup(D.FAILED), this._close(new O(D.FAILED), "Transport failed"))));
11046
+ this._state !== "HELD" && ((e === q.CONNECTING || e === q.RECONNECTING) && this._areTransportParticipantsOnHold() || (e === q.CONNECTING && L.onLocalStatus(N.CONNECTING, this.id), e === q.RECONNECTING && L.onLocalStatus(N.RECONNECT, this.id), e === q.FAILED && this._transport && this._transport.allocated().length === 0 && (this._signaling.ready && await this._signaling.hangup(D.FAILED), this._close(new O(D.FAILED), "Transport failed"))));
11062
11047
  }
11063
- async _areTransportParticipantsOnHold() {
11048
+ _areTransportParticipantsOnHold() {
11064
11049
  if (!M.hold || !this._transport) return !1;
11065
11050
  let e = this._transport.opened().length ? this._transport.opened() : this._transport.allocated();
11066
11051
  if (!e.length) return !1;
11067
- let t = await this._getParticipants();
11052
+ let t = this._getParticipants();
11068
11053
  return e.every((e) => t[e]?.isOnHold);
11069
11054
  }
11070
- async _onRemoteTrackAdded(e, t, n) {
11055
+ _onRemoteTrackAdded(e, t, n) {
11071
11056
  if (e.endsWith(Br.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), L.onRemoteMixedAudioStream(t, this.id);
11072
11057
  else if (e.startsWith(Br.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
11073
11058
  else if (e.startsWith(Br.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
11074
11059
  else {
11075
11060
  this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
11076
- let r = await this._getParticipant(e);
11061
+ let r = this._getParticipant(e);
11077
11062
  if (!r) {
11078
11063
  let t = this._api.getDecorativeIdByInitialId(e), n = t ? j.composeUserId(t) : void 0;
11079
- this._debug.warn(`Conversation: track added before participant [id: ${e}, decorativeId: ${n}]`), this._registerParticipant({ id: e }, n), r = await this._getParticipant(e), this._setParticipantsStatus([r], N.WAITING), this._activeSpeakerId === e && this._lastSignalledActiveSpeakerId !== e && (L.onSpeakerChanged(r.externalId, this.id), this._lastSignalledActiveSpeakerId = e);
11064
+ this._debug.warn(`Conversation: track added before participant [id: ${e}, decorativeId: ${n}]`), this._registerParticipant({ id: e }, n), r = this._getParticipant(e), this._setParticipantsStatus([r], N.WAITING), this._activeSpeakerId === e && this._lastSignalledActiveSpeakerId !== e && (L.onSpeakerChanged(r.externalId, this.id), this._lastSignalledActiveSpeakerId = e);
11080
11065
  }
11081
11066
  if (this._transport && !this._transport.isAllocated(r.id) && this._allocateParticipantTransport(r.id, !1), n.kind === k.audio && (this._audioOutput.add(e, n), M.preserveAudioTracks || (r.remoteAudioTrack = n, t.removeTrack(n))), r.remoteStream !== t && t.getTracks().length) {
11082
11067
  if (r.remoteStream = t, r.secondStream) return;
@@ -11098,7 +11083,7 @@ var Eo = class {
11098
11083
  }
11099
11084
  async _removeAudioTrack(e, t, n) {
11100
11085
  if (e !== Br.AUDIO_MIX) {
11101
- let n = await this._getParticipant(e);
11086
+ let n = this._getParticipant(e);
11102
11087
  if (!n || n.remoteStream && n.remoteStream !== t) return;
11103
11088
  }
11104
11089
  this._audioOutput.remove(e, n);
@@ -11122,10 +11107,10 @@ var Eo = class {
11122
11107
  _onAudioMixStall(e) {
11123
11108
  this._audioMixStalled !== e && !this.isCallHeld && (this._audioMixStalled = e, this._debug.debug("Audio mix stalled:", e), L.onLocalStatus(e ? N.RECONNECT : N.CONNECTED, this.id));
11124
11109
  }
11125
- async _onRemoteSignalledStall(e) {
11110
+ _onRemoteSignalledStall(e) {
11126
11111
  let t = {}, n = [], r = [];
11127
11112
  this._debug.debug("Participants stalled:", e);
11128
- let i = await this._getParticipants();
11113
+ let i = this._getParticipants();
11129
11114
  for (let r of e) {
11130
11115
  if (t[r] = !0, !this._lastStalled[r]) {
11131
11116
  let e = i[r];
@@ -11139,8 +11124,8 @@ var Eo = class {
11139
11124
  }
11140
11125
  n.length && this._setParticipantsStatus(n, N.RECONNECT), r.length && this._setParticipantsStatus(r, N.CONNECTED), this._lastStalled = t;
11141
11126
  }
11142
- async _onRemoteDataStats(e) {
11143
- this._debugInfo && this._debugInfo.onRemoteDataStats(e, await this._getParticipants()), this._fixAudioDevice(e.outbound.rtps), this._fixVideoDevice(e.outbound.rtps);
11127
+ _onRemoteDataStats(e) {
11128
+ this._debugInfo && this._debugInfo.onRemoteDataStats(e, this._getParticipants()), this._fixAudioDevice(e.outbound.rtps), this._fixVideoDevice(e.outbound.rtps);
11144
11129
  }
11145
11130
  _fixAudioDevice(e) {
11146
11131
  !T.hasMicrophone() || !this._audioFix || !this.mediaSettings?.isAudioEnabled || this._audioFix.fix(e);
@@ -11179,26 +11164,26 @@ var Eo = class {
11179
11164
  _onJoinLinkChanged(e) {
11180
11165
  this._conversation && e.joinLink && (this._conversation.joinLink = e.joinLink), L.onJoinLinkChanged(e.joinLink, this.id);
11181
11166
  }
11182
- async _onRoomsUpdated(e) {
11167
+ _onRoomsUpdated(e) {
11183
11168
  if (this._isCalledState()) return;
11184
11169
  let t = {};
11185
11170
  for (let n of Object.keys(Ra)) {
11186
11171
  let r = e.updates[n];
11187
11172
  r && (t[n] = {
11188
- rooms: await Promise.all(r?.rooms?.map(this._convertRoomToExternal.bind(this)) || []),
11173
+ rooms: r?.rooms?.map(this._convertRoomToExternal.bind(this)) || [],
11189
11174
  roomIds: r?.roomIds,
11190
11175
  deactivated: r?.deactivated
11191
11176
  });
11192
11177
  }
11193
11178
  L.onRoomsUpdated(t, this.id);
11194
11179
  }
11195
- async _onRoomUpdated(e) {
11196
- let t = await this._convertRoomToExternal(e.room || null);
11180
+ _onRoomUpdated(e) {
11181
+ let t = this._convertRoomToExternal(e.room || null);
11197
11182
  e.events.some((e) => e === Ra.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || L.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id);
11198
11183
  }
11199
- async _convertRoomToExternal(e) {
11184
+ _convertRoomToExternal(e) {
11200
11185
  if (!e) return null;
11201
- let t = await Promise.all(e.participantIds?.map((e) => this._getExternalIdByParticipantId(e)) || []), n = await Promise.all(e.addParticipantIds?.map((e) => this._getExternalIdByParticipantId(e)) || []), r = await Promise.all(e.removeParticipantIds?.map?.((e) => this._getExternalIdByParticipantId(e)) || []), i = e.pinnedParticipantId ? await this._getExternalIdByParticipantId(e.pinnedParticipantId) : void 0;
11186
+ let t = e.participantIds?.map((e) => this._getExternalIdByParticipantId(e)) || [], n = e.addParticipantIds?.map((e) => this._getExternalIdByParticipantId(e)) || [], r = e.removeParticipantIds?.map?.((e) => this._getExternalIdByParticipantId(e)) || [], i = e.pinnedParticipantId ? this._getExternalIdByParticipantId(e.pinnedParticipantId) : void 0;
11202
11187
  return {
11203
11188
  id: e.id,
11204
11189
  name: e.name,
@@ -11206,7 +11191,7 @@ var Eo = class {
11206
11191
  participantIds: t,
11207
11192
  addParticipantIds: n,
11208
11193
  removeParticipantIds: r,
11209
- participants: e.participants?.participants ? await this._participantListChunkToExternalChunk(e.participants) : void 0,
11194
+ participants: e.participants?.participants ? this._participantListChunkToExternalChunk(e.participants) : void 0,
11210
11195
  active: e.active,
11211
11196
  muteStates: e.muteStates,
11212
11197
  pinnedParticipantId: i,
@@ -11220,7 +11205,7 @@ var Eo = class {
11220
11205
  let e = this._convertExternalIdsToServerExternalIds(i);
11221
11206
  a = (await this._signaling.getParticipants(e)).participants;
11222
11207
  }
11223
- let o = await Promise.all(a?.map(async (e) => {
11208
+ let o = a?.map((e) => {
11224
11209
  let r = j.composeId(e);
11225
11210
  return this._createParticipant({
11226
11211
  id: r,
@@ -11237,21 +11222,20 @@ var Eo = class {
11237
11222
  markers: this._denormalizeMarkers(r, e.markers),
11238
11223
  isInRoom: n !== null
11239
11224
  }, e.decorativeUserId);
11240
- }) || []), s = !1;
11225
+ }) || [], s = !1;
11241
11226
  for (let e of o) e.id === this._conversation?.compositeUserId && (s = !0), this._registerParticipantInCache(e);
11242
11227
  this._transport?.getState() === q.IDLE && !this._isCalledState() && this._openTransport(o, !0);
11243
- let c = [], l = [];
11228
+ let c = [];
11244
11229
  if (e?.removedParticipantMarkers) {
11245
11230
  for (let t of e.removedParticipantMarkers) if (t.GRID?.id) {
11246
11231
  let e = this._getExternalIdByParticipantId(t.GRID.id);
11247
- l.push(e);
11232
+ c.push(e);
11248
11233
  }
11249
- c = await Promise.all(l);
11250
11234
  }
11251
11235
  if (s && await this._onRoomSwitched(n), c) {
11252
11236
  let e = this._conversation?.pinnedParticipantIdByRoom.get(n);
11253
11237
  if (e) {
11254
- let t = await this._getExternalIdByParticipantId(e);
11238
+ let t = this._getExternalIdByParticipantId(e);
11255
11239
  if (t) {
11256
11240
  for (let e of c) if (Z.compare(t, e)) {
11257
11241
  this._conversation?.pinnedParticipantIdByRoom.delete(n);
@@ -11260,7 +11244,7 @@ var Eo = class {
11260
11244
  }
11261
11245
  }
11262
11246
  }
11263
- let u = {
11247
+ let l = {
11264
11248
  roomId: n,
11265
11249
  participantCount: e.participantCount,
11266
11250
  addedParticipantIds: i,
@@ -11268,7 +11252,7 @@ var Eo = class {
11268
11252
  removedParticipantMarkers: e?.removedParticipantMarkers,
11269
11253
  removedParticipantIds: c
11270
11254
  };
11271
- this._isCalledState() || L.onRoomParticipantsUpdated(u, this.id);
11255
+ this._isCalledState() || L.onRoomParticipantsUpdated(l, this.id);
11272
11256
  }
11273
11257
  async _onRoomSwitched(e, t = !1) {
11274
11258
  if (!this._conversation || this._conversation.roomId === e) return;
@@ -11277,7 +11261,7 @@ var Eo = class {
11277
11261
  L.onRoomStart(e, this.id);
11278
11262
  return;
11279
11263
  }
11280
- this._isCalledState() || L.onRoomSwitched(e, this.id), e !== null && !this._isCallAdmin() && await this._refreshRooms(!1), this._changePinnedParticipantForRoom(), this._changeRecordInfoForRoom(), this._changeMuteStatesForRoom(e, n), await this._changeAsrInfoForRoom(), await this._changeUrlSharingInfoForRoom();
11264
+ this._isCalledState() || L.onRoomSwitched(e, this.id), e !== null && !this._isCallAdmin() && await this._refreshRooms(!1), this._changePinnedParticipantForRoom(), this._changeRecordInfoForRoom(), this._changeMuteStatesForRoom(e, n), this._changeAsrInfoForRoom(), this._changeUrlSharingInfoForRoom();
11281
11265
  }
11282
11266
  async _refreshRooms(e) {
11283
11267
  let t;
@@ -11286,15 +11270,15 @@ var Eo = class {
11286
11270
  for (let t of n) {
11287
11271
  let n = t.id ?? null;
11288
11272
  if (this._setMuteStatesForRoomId(t.muteStates, n), this._conversation?.recordsInfoByRoom.set(n, t.recordInfo ?? null), this._conversation?.pinnedParticipantIdByRoom.set(n, t.pinnedParticipantId ?? null), t.asrInfo && this._conversation?.asrInfoByRoom.set(n, t.asrInfo), t.urlSharingInfo ? this._conversation?.urlSharingInfoByRoom.set(n, t.urlSharingInfo) : this._conversation?.urlSharingInfoByRoom.delete(n), e) {
11289
- let e = await this._getParticipants();
11273
+ let e = this._getParticipants();
11290
11274
  await this._registerParticipants(t?.participants?.participants?.filter((t) => !e[j.composeId(t)]) || [], !0);
11291
- let n = await this._convertRoomToExternal(t);
11275
+ let n = this._convertRoomToExternal(t);
11292
11276
  n && r.push(n);
11293
11277
  }
11294
11278
  }
11295
11279
  r.length && !this._isCalledState() && L.onRoomsUpdated({ [Ra.UPDATE]: { rooms: r } }, this.id);
11296
11280
  }
11297
- async _onFeedback(e) {
11281
+ _onFeedback(e) {
11298
11282
  let t = [];
11299
11283
  for (let n of e.feedback) {
11300
11284
  let e = {
@@ -11302,7 +11286,7 @@ var Eo = class {
11302
11286
  items: []
11303
11287
  };
11304
11288
  for (let t of n.items) {
11305
- let n = await this._getExternalIdByParticipantId(t.participantId);
11289
+ let n = this._getExternalIdByParticipantId(t.participantId);
11306
11290
  n ? e.items.push({
11307
11291
  ...t,
11308
11292
  participantId: n
@@ -11312,11 +11296,11 @@ var Eo = class {
11312
11296
  }
11313
11297
  L.onFeedback(t, e.roomId, this.id);
11314
11298
  }
11315
- async _onDecorativeParticipantIdChanged(e) {
11299
+ _onDecorativeParticipantIdChanged(e) {
11316
11300
  if (!this._conversation || !e.decorativeParticipantId || !e.decorativeExternalParticipantId) return;
11317
11301
  let { participantId: t, decorativeParticipantId: n, decorativeExternalParticipantId: r } = e, i = this._isMe(t);
11318
11302
  this._debug.debug(`Decorative participant id changed [${t}]`, e);
11319
- let a = await this._getExternalIdByParticipantId(t);
11303
+ let a = this._getExternalIdByParticipantId(t);
11320
11304
  if (!a) {
11321
11305
  this._warnParticipantNotInConversation(t);
11322
11306
  return;
@@ -11324,7 +11308,7 @@ var Eo = class {
11324
11308
  let o = Z.fromSignaling(r, a.deviceIdx);
11325
11309
  if (L.onParticipantIdChanged(a, o, this.id), this._api.cacheExternalId(n, o), this._api.mapDecorativeId(n, t), i) this._conversation.externalId = o;
11326
11310
  else {
11327
- let e = await this._getParticipants();
11311
+ let e = this._getParticipants();
11328
11312
  e[t].externalId = o;
11329
11313
  }
11330
11314
  }
@@ -11333,7 +11317,7 @@ var Eo = class {
11333
11317
  }
11334
11318
  async _onParticipantHold(e) {
11335
11319
  this._debug.debug("Participant hold suggested", e);
11336
- let t = await this._getParticipant(e.participantId);
11320
+ let t = this._getParticipant(e.participantId);
11337
11321
  if (!t) {
11338
11322
  this._warnParticipantNotInConversation(e.participantId);
11339
11323
  return;
@@ -11361,28 +11345,17 @@ var Eo = class {
11361
11345
  }
11362
11346
  _registerParticipant(e, t) {
11363
11347
  let n = this._createParticipant(e, t);
11364
- n.catch(() => void 0), this._pendingParticipants.set(e.id, n);
11348
+ this._pendingParticipants.set(e.id, n);
11365
11349
  }
11366
- async _getParticipants() {
11350
+ _getParticipants() {
11367
11351
  if (this._pendingParticipants.size) {
11368
- let e = Array.from(this._pendingParticipants.entries()), t = await Promise.allSettled(e.map((e) => e[1])), n = null;
11369
- for (let r = 0; r < t.length; r++) {
11370
- let [i] = e[r];
11371
- this._pendingParticipants.delete(i);
11372
- let a = t[r];
11373
- if (a.status === "fulfilled") {
11374
- let e = a.value;
11375
- this._participants[e.id] = e;
11376
- continue;
11377
- }
11378
- n = n ?? a.reason, this._debug.warn(`Failed to resolve pending participant [${i}]`, a.reason);
11379
- }
11380
- if (n) throw n;
11352
+ for (let e of this._pendingParticipants.values()) this._participants[e.id] = e;
11353
+ this._pendingParticipants.clear();
11381
11354
  }
11382
11355
  return this._participants;
11383
11356
  }
11384
- async _getParticipant(e) {
11385
- return (await this._getParticipants())[e];
11357
+ _getParticipant(e) {
11358
+ return this._getParticipants()[e];
11386
11359
  }
11387
11360
  }, zo = null, Bo = class e extends Error {
11388
11361
  constructor(t, n) {
@@ -11618,7 +11591,7 @@ var Qo = class {
11618
11591
  throw new O(i, a);
11619
11592
  }
11620
11593
  }
11621
- async userId(e) {
11594
+ userId(e) {
11622
11595
  let t = j.extractOkId(e);
11623
11596
  return v.isEmpty() ? Z.fromId(String(t)) : this._idCache.getExternalId(t) || Z.fromId(String(t));
11624
11597
  }
@@ -12386,7 +12359,8 @@ async function zc(e, t = !1) {
12386
12359
  R.warn("promoteParticipant: externalId not found in cache", e);
12387
12360
  return;
12388
12361
  }
12389
- r = j.composeUserId(t);
12362
+ let n = e.type === Ga.GROUP ? A.GROUP : A.USER;
12363
+ r = j.composeUserId(t, n);
12390
12364
  }
12391
12365
  return n.promoteParticipant(r, t);
12392
12366
  }