@vkontakte/calls-sdk 2.8.13-dev.957e6761.0 → 2.8.13-dev.992d27aa.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.13-dev.957e6761.0
3
- * Thu, 22 Oct 2026 10:03:29 GMT
2
+ * @vkontakte/calls-sdk v2.8.13-dev.992d27aa.0
3
+ * Fri, 30 Oct 2026 09:35:28 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -1649,17 +1649,21 @@ var O = /* @__PURE__ */ function(e) {
1649
1649
  let t = this._audioEffectParams;
1650
1650
  this._audioEffectParams = e;
1651
1651
  try {
1652
- let e = this._micAudioTrack.clone(), t = new MediaStream([e]);
1652
+ let e = this._cloneMicAudioTrack(this._micAudioTrack), t = new MediaStream([e]);
1653
1653
  await this._changeAudioInput(t);
1654
1654
  } catch (e) {
1655
1655
  if (this._destroyed) throw e;
1656
1656
  this._audioEffectParams = t;
1657
- let n = this._micAudioTrack.clone(), r = new MediaStream([n]);
1657
+ let n = this._cloneMicAudioTrack(this._micAudioTrack), r = new MediaStream([n]);
1658
1658
  throw await this._changeAudioInput(r), e;
1659
1659
  }
1660
1660
  }
1661
1661
  }
1662
1662
  }
1663
+ _cloneMicAudioTrack(e) {
1664
+ let t = e.clone();
1665
+ return t.enabled = !0, t;
1666
+ }
1663
1667
  getAudioShareTrack() {
1664
1668
  return this._audioShareTrack;
1665
1669
  }
@@ -2302,7 +2306,7 @@ var wn = Cn.getInstance(), N = class e {
2302
2306
  return 1.1;
2303
2307
  }
2304
2308
  static get sdkVersion() {
2305
- return "2.8.13-dev.957e6761.0";
2309
+ return "2.8.13-dev.992d27aa.0";
2306
2310
  }
2307
2311
  static get debug() {
2308
2312
  return e._params.debug;
@@ -4443,7 +4447,7 @@ var ei = class {
4443
4447
  worst: 320,
4444
4448
  bad: 640,
4445
4449
  good: 1280
4446
- }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ha(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new fi(n, this._debug), this._sdpStats = new Mr(this._statAggregator), this._peerConnectionStats = new Jr(this._statAggregator), this._networkAdaptationStats = new Zr(this._statAggregator), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
4450
+ }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ua(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new fi(n, this._debug), this._sdpStats = new Mr(this._statAggregator), this._peerConnectionStats = new Jr(this._statAggregator), this._networkAdaptationStats = new Zr(this._statAggregator), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
4447
4451
  try {
4448
4452
  this._pc = this._createPeerConnection();
4449
4453
  } catch (e) {
@@ -6311,7 +6315,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6311
6315
  await this._simulcast.sync();
6312
6316
  }
6313
6317
  _createPerfStatsReporter() {
6314
- this._perfStatReporter?.destroy(), this._perfStatReporter = new Ha(this, this._signaling, this._statAggregator, !1, this._debug);
6318
+ this._perfStatReporter?.destroy(), this._perfStatReporter = new Ua(this, this._signaling, this._statAggregator, !1, this._debug);
6315
6319
  }
6316
6320
  _closeConnection() {
6317
6321
  this._signaling.resetProducerConnection(), this._ssrcMap = {}, this._ssrcMapUpdated = !0, this._disposeFirstMediaSentProbe(), this._stopStatInterval(), this._stopSettingsInterval(), this._stopMonitorRtpShareInterval(), this._removeAsrTrack(), this._removeCaptureSender(), this._removeCaptureReceiver(), this._simulcast.reset(), this._pc && (this._rtpReceiversByStreamId = {}, this._disabledSenders.forEach((e) => e.track?.stop()), this._disabledSenders.clear(), this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._sdpStats.stop(), this._peerConnectionStats.stop(), this._participantIdRegistry = null, e._closeDataChannel(this._producerNotification), e._closeDataChannel(this._producerCommand), e._closeDataChannel(this._producerScreen), e._closeDataChannel(this._consumerScreen), e._closeDataChannel(this._asr), e._closeDataChannel(this._animojiDataChannel), this._pc.close(), this._pc = null, this._producerOfferIsProcessing = !1, this._producerNextOffer = null), this._triggerEvent(Y.PEER_CONNECTION_CLOSED);
@@ -6526,7 +6530,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6526
6530
  }
6527
6531
  _allocateConsumer() {
6528
6532
  if (!this._signaling.ready) return;
6529
- let e = Ja.get();
6533
+ let e = Ya.get();
6530
6534
  !N.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
6531
6535
  e instanceof kn || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
6532
6536
  });
@@ -6735,13 +6739,71 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6735
6739
  _stopMonitorRtpShareInterval() {
6736
6740
  this._monitorRtpShareInterval && (window.clearTimeout(this._monitorRtpShareInterval), this._monitorRtpShareInterval = null);
6737
6741
  }
6742
+ }, Ma = class {
6743
+ constructor(e, t = z) {
6744
+ h(this, "_topology", void 0), h(this, "_participantsCount", 0), h(this, "_taTrackIds", /* @__PURE__ */ new Set()), h(this, "_sendTrack", null), h(this, "_controller", null), h(this, "_enabled", !1), h(this, "_updateTimer", null), h(this, "_initFailed", !1), h(this, "_destroyed", !1), h(this, "_debug", void 0), this._topology = e, this._debug = t;
6745
+ }
6746
+ setTopology(e) {
6747
+ this._topology = e, this._update();
6748
+ }
6749
+ setParticipantsCount(e) {
6750
+ this._participantsCount = e, this._update();
6751
+ }
6752
+ addRemoteTrack(e) {
6753
+ if (e.endsWith(hi.AUDIO_MIX)) this._taTrackIds.clear();
6754
+ else if (e.startsWith(`${hi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) this._taTrackIds.add(e);
6755
+ else return;
6756
+ this._update();
6757
+ }
6758
+ removeRemoteTrack(e) {
6759
+ this._taTrackIds.delete(e) && this._update();
6760
+ }
6761
+ resetRemoteTracks() {
6762
+ this._taTrackIds.size !== 0 && (this._taTrackIds.clear(), this._update());
6763
+ }
6764
+ setSendTrack(e) {
6765
+ this._sendTrack = e, this._enabled && this._controller?.setSendTrack(e);
6766
+ }
6767
+ destroy() {
6768
+ this._destroyed = !0, this._enabled = !1, this._updateTimer !== null && (window.clearTimeout(this._updateTimer), this._updateTimer = null), this._controller?.destroy(), this._controller = null;
6769
+ }
6770
+ _isAllowed() {
6771
+ let e = this._taTrackIds.size;
6772
+ return this._topology !== J.DIRECT && e > 0 && this._participantsCount > e;
6773
+ }
6774
+ _update() {
6775
+ this._destroyed || this._updateTimer !== null || (this._updateTimer = window.setTimeout(() => {
6776
+ this._updateTimer = null, this._applyConditions();
6777
+ }, 0));
6778
+ }
6779
+ _applyConditions() {
6780
+ let e = this._isAllowed();
6781
+ e !== this._enabled && (this._enabled = e, this._debug.log(`[VadGate] VAD ${e ? "enabled" : "disabled"}`, {
6782
+ topology: this._topology,
6783
+ taTracks: this._taTrackIds.size,
6784
+ participants: this._participantsCount
6785
+ }), e && !this._controller ? this._createController() : this._applyState());
6786
+ }
6787
+ _createController() {
6788
+ if (!N.vad || this._initFailed) return;
6789
+ let e = new N.vad.VadController(this._sendTrack, N.vadOptions);
6790
+ e.setLogger((e, ...t) => z.send(e, ...t), "VAD"), this._controller = e, e.init().then(() => {
6791
+ this._controller === e && this._applyState();
6792
+ }, (t) => {
6793
+ this._debug.warn("[VadGate] VAD init failed, continuing without VAD", t), this._initFailed = !0, e.destroy(), this._controller === e && (this._controller = null);
6794
+ });
6795
+ }
6796
+ _applyState() {
6797
+ let e = this._controller;
6798
+ e && (this._enabled ? (e.resume(), e.setSendTrack(this._sendTrack)) : (e.setSendTrack(null), e.pause()));
6799
+ }
6738
6800
  }, Y = /* @__PURE__ */ function(e) {
6739
6801
  return e.REMOTE_TRACK_ADDED = "REMOTE_TRACK_ADDED", e.REMOTE_TRACK_REMOVED = "REMOTE_TRACK_REMOVED", e.REMOTE_STREAM_SECOND = "REMOTE_STREAM_SECOND", e.AUDIO_MIX_STALL = "AUDIO_MIX_STALL", e.REMOTE_DATA_STATS = "REMOTE_DATA_STATS", e.STATE_CHANGED = "STATE_CHANGED", e.LOCAL_STATE_CHANGED = "LOCAL_STATE_CHANGED", e.SIGNALLED_ACTIVE_PARTICIPANTS = "SIGNALLED_ACTIVE_PARTICIPANTS", e.SIGNALLED_SPEAKER_CHANGED = "SIGNALLED_SPEAKER_CHANGED", e.SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS", e.TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED", e.NETWORK_STATUS = "NETWORK_STATUS", e.PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED", e.ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION", e.ANIMOJI_STREAM = "ANIMOJI_STREAM", e.ANIMOJI_ERROR = "ANIMOJI_ERROR", e.SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT", e;
6740
- }({}), Ma = class extends Ye {
6741
- constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
6742
- super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "_vadController", null), h(this, "_updateVadTrack", () => {
6743
- this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
6744
- }), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_READY, this._updateVadTrack), this._createVad(), this._createAnimojiTransport(), e === J.SERVER && (this._serverTransport = this._createServerTransport());
6802
+ }({}), Na = class extends Ye {
6803
+ constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null, l = () => !0) {
6804
+ super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "_isParticipantAccepted", void 0), h(this, "_vadGate", void 0), h(this, "_updateVadTrack", () => {
6805
+ this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack());
6806
+ }), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this._isParticipantAccepted = l, this._vadGate = new Ma(e, i), this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack()), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_READY, this._updateVadTrack), this._createAnimojiTransport(), e === J.SERVER && (this._serverTransport = this._createServerTransport());
6745
6807
  }
6746
6808
  updateSettings(e) {
6747
6809
  this._debug.log("Update transport settings", e), this._serverSettings = e, this._directTransport && this._directTransport.updateSettings(e), this._serverTransport && this._serverTransport.updateSettings(e);
@@ -6770,17 +6832,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6770
6832
  }
6771
6833
  this._opened.push(t), i = !0;
6772
6834
  }
6773
- i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
6835
+ this._updateVadParticipants(), i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
6774
6836
  }
6775
6837
  close(e) {
6776
6838
  let t = this._allocated.indexOf(e), n = this._opened.indexOf(e);
6777
- t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e];
6839
+ t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e], this._updateVadParticipants();
6778
6840
  }
6779
6841
  destroy() {
6780
6842
  this.stopFirstMediaSentProbe(), this.unsubscribe();
6781
6843
  for (let e of this._dtListeners) e.dispose();
6782
6844
  for (let e of this._stListeners) e.dispose();
6783
- this._removeAnimojiTransport(), N.audioEffects?.destroy(), this._vadController?.destroy(), this._vadController = null, this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6845
+ this._removeAnimojiTransport(), N.audioEffects?.destroy(), this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6784
6846
  }
6785
6847
  stopFirstMediaSentProbe() {
6786
6848
  this._firstMediaSentProbeStopped || (this._firstMediaSentProbeStopped = !0, this._directTransport?.stopFirstMediaSentProbe(), this._serverTransport?.stopFirstMediaSentProbe());
@@ -6789,7 +6851,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6789
6851
  this.unsubscribe();
6790
6852
  for (let e of this._dtListeners) e.dispose();
6791
6853
  for (let e of this._stListeners) e.dispose();
6792
- this._vadController?.destroy(), this._vadController = null, this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6854
+ this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6793
6855
  }
6794
6856
  setRemoteHold(e) {
6795
6857
  this._directTransport?.setRemoteHold(e);
@@ -6839,7 +6901,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6839
6901
  }
6840
6902
  _onTopologyChanged(e) {
6841
6903
  if (e.topology !== this._topology) {
6842
- if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
6904
+ if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._vadGate.setTopology(this._topology), this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
6843
6905
  let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? M.composeParticipantId(t[0], n[0], r[0]) : null;
6844
6906
  if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
6845
6907
  this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
@@ -6871,7 +6933,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6871
6933
  this._dtListeners = [];
6872
6934
  }
6873
6935
  _releaseServerTransport() {
6874
- this._serverTransport?.close(), this._serverTransport = null;
6936
+ this._serverTransport?.close(), this._serverTransport = null, this._vadGate.resetRemoteTracks();
6875
6937
  for (let e of this._stListeners) e.dispose();
6876
6938
  this._stListeners = [];
6877
6939
  }
@@ -6881,13 +6943,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6881
6943
  let e = this._opened.indexOf(t);
6882
6944
  e >= 0 && this._opened.splice(e, 1);
6883
6945
  let n = this._allocated.indexOf(t);
6884
- n >= 0 && this._allocated.splice(n, 1);
6946
+ n >= 0 && this._allocated.splice(n, 1), this._updateVadParticipants();
6885
6947
  }
6886
6948
  this._topology === J.DIRECT && t && (this._setStates([t], e), this._setLocalState(e));
6887
6949
  }
6888
6950
  _onServerTransportChanged(e) {
6889
6951
  let t = this._opened.slice();
6890
- e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [])), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
6952
+ e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [], this._updateVadParticipants())), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
6891
6953
  }
6892
6954
  _onTransportActiveParticipants(e) {
6893
6955
  this._topology === J.SERVER && this._triggerEvent("SIGNALLED_ACTIVE_PARTICIPANTS", e);
@@ -6914,10 +6976,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6914
6976
  this._triggerEvent("REMOTE_DATA_STATS", e);
6915
6977
  }
6916
6978
  _onRemoteTrackAdded(e, t, n) {
6917
- this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
6979
+ this._vadGate.addRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
6918
6980
  }
6919
6981
  _onRemoteTrackRemoved(e, t, n) {
6920
- this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
6982
+ this._vadGate.removeRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
6921
6983
  }
6922
6984
  _onAsrTranscription(e) {
6923
6985
  this._triggerEvent("ASR_TRANSCRIPTION", e);
@@ -6932,10 +6994,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6932
6994
  _onAnimojiStatus(e) {
6933
6995
  e ? this._animojiSender?.resume() : this._animojiSender?.pause(), this._mediaSource.onAnimojiSender(e);
6934
6996
  }
6935
- _createVad() {
6936
- N.vad && (this._vadController = new N.vad.VadController(this._mediaSource.getSendAudioTrack(), N.vadOptions), this._vadController.setLogger((e, ...t) => z.send(e, ...t), "VAD"), this._vadController.init().catch((e) => {
6937
- z.warn("[Transport] VAD init failed, continuing without VAD", e), this._vadController?.destroy(), this._vadController = null;
6938
- }));
6997
+ _updateVadParticipants() {
6998
+ this._vadGate.setParticipantsCount(this._opened.filter(this._isParticipantAccepted).length);
6939
6999
  }
6940
7000
  _createAnimojiTransport() {
6941
7001
  if (!N.vmoji) return;
@@ -6954,7 +7014,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6954
7014
  getStreamWaitingTimeMs(e, t) {
6955
7015
  return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(x.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(x.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
6956
7016
  }
6957
- }, Na = "videochat-epi", Pa = 32767, Fa = 1e4, Ia = 5e3, La = 500, Ra = 6e4, za = 1e4, Ba = 1e3, Va = 3e5, Ha = class extends Ye {
7017
+ }, Pa = "videochat-epi", Fa = 32767, Ia = 1e4, La = 5e3, Ra = 500, za = 6e4, Ba = 1e4, Va = 1e3, Ha = 3e5, Ua = class extends Ye {
6958
7018
  constructor(e, t, n = null, r = !1, i = z) {
6959
7019
  super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCounters", /* @__PURE__ */ new Map()), h(this, "_previousRemoteInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousOutboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousCandidatePair", null), h(this, "_screenShareStats", []), h(this, "_signaling", void 0), h(this, "_directTopology", void 0), h(this, "_debug", void 0), h(this, "_statAggregator", void 0), h(this, "_handleScreenSharingStat", (e) => {
6960
7020
  this._screenShareStats.push(e);
@@ -6967,7 +7027,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6967
7027
  }
6968
7028
  static getEstimatedPerformanceIndex() {
6969
7029
  try {
6970
- let e = parseInt(localStorage.getItem(Na) || "", 10);
7030
+ let e = parseInt(localStorage.getItem(Pa) || "", 10);
6971
7031
  return isNaN(e) ? 0 : e;
6972
7032
  } catch {
6973
7033
  return 0;
@@ -6976,9 +7036,9 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6976
7036
  async _handleStats(e) {
6977
7037
  if (!e.inbound || !e.inbound.rtps) return;
6978
7038
  let t = Date.now();
6979
- this._reportCandidatePair(e.inbound.transport.local, e.inbound.transport.remote), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t), !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + Ia <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
7039
+ this._reportCandidatePair(e.inbound.transport.local, e.inbound.transport.remote), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t), !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + La <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
6980
7040
  let n = e.outbound.transport.local?.protocol === "tcp";
6981
- !this._directTopology && n && this._previousNetworkStatReportTimestamp + La <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t);
7041
+ !this._directTopology && n && this._previousNetworkStatReportTimestamp + Ra <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t);
6982
7042
  }
6983
7043
  async reportPerfStats(e) {
6984
7044
  let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
@@ -6987,7 +7047,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6987
7047
  });
6988
7048
  if (t.framesDecoded) try {
6989
7049
  let e = await this._signaling.reportPerfStat(t);
6990
- localStorage.setItem(Na, e.estimatedPerformanceIndex);
7050
+ localStorage.setItem(Pa, e.estimatedPerformanceIndex);
6991
7051
  } catch {}
6992
7052
  }
6993
7053
  async reportNetworkStats(e) {
@@ -7027,11 +7087,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
7027
7087
  rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
7028
7088
  ss_freeze_count: 0,
7029
7089
  ss_total_freezes_duration: 0,
7030
- local_address: Wa(e.inbound.transport.local),
7090
+ local_address: Ga(e.inbound.transport.local),
7031
7091
  local_connection_type: e.inbound.transport.local?.type,
7032
7092
  network_type: e.inbound.transport.local?.networkType,
7033
7093
  transport: e.inbound.transport.local?.protocol,
7034
- remote_address: Wa(e.inbound.transport.remote),
7094
+ remote_address: Ga(e.inbound.transport.remote),
7035
7095
  remote_connection_type: e.inbound.transport.remote?.type
7036
7096
  }, n = /* @__PURE__ */ new Map(), r = (e, t, r) => {
7037
7097
  let i = `${e}:${t.kind}:${t.ssrc}`, a = this._previousCounters.get(i);
@@ -7052,24 +7112,24 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
7052
7112
  fir_received: t.fir_received,
7053
7113
  frames_dropped: t.frames_dropped
7054
7114
  };
7055
- if (t.rtt >= 0 && t.rtt <= Ra && (s.rtt = t.rtt), N.simulcast && (s.is_simulcast = !0), navigator.hardwareConcurrency && (s.cpu_hardware_concurrency = Number(navigator.hardwareConcurrency)), o > 0 && (s.audio_tracks = o), i && !Ga(t.jitter_video) && t.jitter_video <= za && (s.jitter_video = Math.round(t.jitter_video)), a && !Ga(t.jitter_audio) && t.jitter_audio <= za && (s.jitter_audio = Math.round(t.jitter_audio)), i && !Ga(t.interframe_delay_variance) && (s.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (s.freeze_count = t.freeze_count, s.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (s.ss_freeze_count = t.ss_freeze_count, s.ss_total_freezes_duration = t.ss_total_freezes_duration), a && !Ga(t.total_audio_samples_received)) {
7115
+ if (t.rtt >= 0 && t.rtt <= za && (s.rtt = t.rtt), N.simulcast && (s.is_simulcast = !0), navigator.hardwareConcurrency && (s.cpu_hardware_concurrency = Number(navigator.hardwareConcurrency)), o > 0 && (s.audio_tracks = o), i && !Ka(t.jitter_video) && t.jitter_video <= Ba && (s.jitter_video = Math.round(t.jitter_video)), a && !Ka(t.jitter_audio) && t.jitter_audio <= Ba && (s.jitter_audio = Math.round(t.jitter_audio)), i && !Ka(t.interframe_delay_variance) && (s.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (s.freeze_count = t.freeze_count, s.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (s.ss_freeze_count = t.ss_freeze_count, s.ss_total_freezes_duration = t.ss_total_freezes_duration), a && !Ka(t.total_audio_samples_received)) {
7056
7116
  let e = t.total_audio_samples_received, n = t.inserted_audio_samples_for_deceleration, r = t.removed_audio_samples_for_acceleration, i = t.concealed_audio_samples, a = t.silent_concealed_audio_samples, o = t.audio_concealment_events;
7057
- s.inserted_audio_samples_for_deceleration = Ka(n / e * 1e3), s.removed_audio_samples_for_acceleration = Ka(r / e * 1e3), s.concealed_audio_samples = Ka(i / e * 1e3), s.concealed_silent_audio_samples = Ka(a / e * 1e3), s.concealment_audio_avg_size = Ka(i / o), s.total_audio_energy = t.total_audio_energy;
7117
+ s.inserted_audio_samples_for_deceleration = qa(n / e * 1e3), s.removed_audio_samples_for_acceleration = qa(r / e * 1e3), s.concealed_audio_samples = qa(i / e * 1e3), s.concealed_silent_audio_samples = qa(a / e * 1e3), s.concealment_audio_avg_size = qa(i / o), s.total_audio_energy = t.total_audio_energy;
7058
7118
  }
7059
- Ua(t, "local_address", "local_connection_type", "network_type", "transport") && (s.local_address = t.local_address, s.local_connection_type = t.local_connection_type, s.network_type = t.network_type, s.transport = t.transport), Ua(t, "remote_address", "remote_connection_type") && (s.remote_address = t.remote_address, s.remote_connection_type = t.remote_connection_type);
7119
+ Wa(t, "local_address", "local_connection_type", "network_type", "transport") && (s.local_address = t.local_address, s.local_connection_type = t.local_connection_type, s.network_type = t.network_type, s.transport = t.transport), Wa(t, "remote_address", "remote_connection_type") && (s.remote_address = t.remote_address, s.remote_connection_type = t.remote_connection_type);
7060
7120
  let c = this._calculateRemotePacketLoss(e.remoteInbound.rtps, e.outbound.rtps);
7061
7121
  c.video !== void 0 && (s.video_loss = c.video), c.audio !== void 0 && (s.audio_loss = c.audio);
7062
7122
  let l = this._calculatePacketLoss(e.inbound.rtps, this._previousInboundRtps);
7063
7123
  this._previousInboundRtps = l.rtps, l.video !== void 0 && (s.in_video_loss = l.video), l.audio !== void 0 && (s.in_audio_loss = l.audio);
7064
7124
  let u = this._calculateOutboundDeltas(e.outbound.rtps);
7065
- if (u.audioLevel !== void 0 && (s.audio_level = Math.round(u.audioLevel * Pa)), u.hasAudio && (s.audio_bytes_sent = u.audioBytesSent), u.hasCamera && (u.framesEncoded <= Fa && (s.frames_encoded = u.framesEncoded), s.stat_time_delta > 0)) {
7125
+ if (u.audioLevel !== void 0 && (s.audio_level = Math.round(u.audioLevel * Fa)), u.hasAudio && (s.audio_bytes_sent = u.audioBytesSent), u.hasCamera && (u.framesEncoded <= Ia && (s.frames_encoded = u.framesEncoded), s.stat_time_delta > 0)) {
7066
7126
  let e = (e) => Math.round(e * 8 * 1e3 / (s.stat_time_delta * 1024));
7067
7127
  s.br_transmit = e(u.cameraBytesSent), s.br_retransmit = e(u.cameraRetransmittedBytesSent), s.br_encode = e(Math.max(0, u.cameraBytesSent - u.cameraRetransmittedBytesSent));
7068
7128
  }
7069
- s.stat_time_delta >= Ba && s.stat_time_delta <= Va && (this._statAggregator?.logCallStat(s), N.enableLogPerfStatReport && this._debug.log("Sent call stats", s)), this._previousCounters = n;
7129
+ s.stat_time_delta >= Va && s.stat_time_delta <= Ha && (this._statAggregator?.logCallStat(s), N.enableLogPerfStatReport && this._debug.log("Sent call stats", s)), this._previousCounters = n;
7070
7130
  }
7071
7131
  _reportCandidatePair(e, t) {
7072
- let n = Wa(e), r = Wa(t);
7132
+ let n = Ga(e), r = Ga(t);
7073
7133
  if (!n || !r) return;
7074
7134
  let i = JSON.stringify({
7075
7135
  local: e,
@@ -7172,26 +7232,26 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
7172
7232
  return this._previousOutboundRtps = t, n;
7173
7233
  }
7174
7234
  };
7175
- function Ua(e, ...t) {
7235
+ function Wa(e, ...t) {
7176
7236
  for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
7177
7237
  return !0;
7178
7238
  }
7179
- function Wa(e, t = !1) {
7239
+ function Ga(e, t = !1) {
7180
7240
  if (!(!e?.address || !Lr(e.address))) return e.address + (t ? `:${e.port}` : "");
7181
7241
  }
7182
- function Ga(e) {
7242
+ function Ka(e) {
7183
7243
  return e === void 0;
7184
7244
  }
7185
- function Ka(e) {
7245
+ function qa(e) {
7186
7246
  return Number.isNaN(e) ? 0 : e;
7187
7247
  }
7188
7248
  //#endregion
7189
7249
  //#region src/static/Capabilities.ts
7190
- var qa;
7250
+ var Ja;
7191
7251
  (function(e) {
7192
7252
  function t() {
7193
7253
  return {
7194
- estimatedPerformanceIndex: Ha.getEstimatedPerformanceIndex(),
7254
+ estimatedPerformanceIndex: Ua.getEstimatedPerformanceIndex(),
7195
7255
  audioMix: !0,
7196
7256
  consumerUpdate: !0,
7197
7257
  producerNotificationDataChannelVersion: 8,
@@ -7217,8 +7277,8 @@ var qa;
7217
7277
  };
7218
7278
  }
7219
7279
  e.get = t;
7220
- })(qa || (qa = {}));
7221
- var Ja = qa, Ya = {
7280
+ })(Ja || (Ja = {}));
7281
+ var Ya = Ja, Xa = {
7222
7282
  producerScreenTrack: () => !0,
7223
7283
  videoTracksCount: () => N.videoTracksCount > 0,
7224
7284
  waitingHall: () => !0,
@@ -7238,28 +7298,28 @@ var Ja = qa, Ya = {
7238
7298
  p2pRelay: () => !1,
7239
7299
  waitForAdmin: () => N.waitForAdminInGroupCalls,
7240
7300
  hold: () => N.hold
7241
- }, Xa = class {
7301
+ }, Za = class {
7242
7302
  static getFlags() {
7243
- let e = Object.values(Ya), t = 0;
7303
+ let e = Object.values(Xa), t = 0;
7244
7304
  for (let n = 0; n < e.length; n++) e[n]() && (t |= 1 << n);
7245
7305
  return t.toString(16).toUpperCase();
7246
7306
  }
7247
7307
  static parseCapabilities(e) {
7248
7308
  let t = parseInt(e || "0", 16);
7249
- return Object.keys(Ya).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
7309
+ return Object.keys(Xa).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
7250
7310
  }
7251
- }, Za = 63n, Qa = 16383n, $a = 1073741823, eo = 4611686018427387903n, to = class {
7311
+ }, Qa = 63n, $a = 16383n, eo = 1073741823, to = 4611686018427387903n, no = class {
7252
7312
  encode(e) {
7253
7313
  let t = typeof e == "number" ? BigInt(e) : e;
7254
- if (t <= Za) return new Uint8Array([Number(t)]);
7255
- if (t <= Qa) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
7256
- if (t <= BigInt($a)) return new Uint8Array([
7314
+ if (t <= Qa) return new Uint8Array([Number(t)]);
7315
+ if (t <= $a) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
7316
+ if (t <= BigInt(eo)) return new Uint8Array([
7257
7317
  128 | Number(t >> 24n),
7258
7318
  Number(t >> 16n & 255n),
7259
7319
  Number(t >> 8n & 255n),
7260
7320
  Number(t & 255n)
7261
7321
  ]);
7262
- if (t <= eo) return new Uint8Array([
7322
+ if (t <= to) return new Uint8Array([
7263
7323
  192 | Number(t >> 56n),
7264
7324
  Number(t >> 48n & 255n),
7265
7325
  Number(t >> 40n & 255n),
@@ -7271,7 +7331,7 @@ var Ja = qa, Ya = {
7271
7331
  ]);
7272
7332
  throw RangeError("Number is too large to encode using varint");
7273
7333
  }
7274
- }, no = class {
7334
+ }, ro = class {
7275
7335
  decode(e) {
7276
7336
  let t = this.getNumBytesForLengthInteger(e);
7277
7337
  if (t < 0) throw Error("Invalid length prefix");
@@ -7297,9 +7357,9 @@ var Ja = qa, Ya = {
7297
7357
  let t = e[0] & 192;
7298
7358
  return t === 0 ? 1 : t === 64 ? 2 : t === 128 ? 4 : t === 192 ? 8 : -1;
7299
7359
  }
7300
- }, ro = class {
7360
+ }, io = class {
7301
7361
  constructor(e) {
7302
- h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new to(), this.compression = e ?? null;
7362
+ h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new no(), this.compression = e ?? null;
7303
7363
  }
7304
7364
  encode(e) {
7305
7365
  let t = this.encoder.encode(e);
@@ -7316,9 +7376,9 @@ var Ja = qa, Ya = {
7316
7376
  default: return e;
7317
7377
  }
7318
7378
  }
7319
- }, io = class {
7379
+ }, ao = class {
7320
7380
  constructor(e) {
7321
- h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new no(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
7381
+ h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new ro(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
7322
7382
  }
7323
7383
  decode(e) {
7324
7384
  let t = [];
@@ -7348,12 +7408,12 @@ var Ja = qa, Ya = {
7348
7408
  default: return e;
7349
7409
  }
7350
7410
  }
7351
- }, ao = class {
7411
+ }, oo = class {
7352
7412
  static isBrowserSupported() {
7353
7413
  return !(!("WebTransport" in window && typeof WebTransport == "function") || C.browserName() === "Safari");
7354
7414
  }
7355
7415
  constructor(e, t = {}, n = z) {
7356
- h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new ro(this.compression), this.decoder = new io(this.compression), this.connect();
7416
+ h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new io(this.compression), this.decoder = new ao(this.compression), this.connect();
7357
7417
  }
7358
7418
  async send(e) {
7359
7419
  if (this.readyState !== WebSocket.OPEN) {
@@ -7479,9 +7539,9 @@ var Ja = qa, Ya = {
7479
7539
  compression: this.compression
7480
7540
  }, n;
7481
7541
  }
7482
- }, oo = /* @__PURE__ */ function(e) {
7542
+ }, so = /* @__PURE__ */ function(e) {
7483
7543
  return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT", e.ABORTED = "ABORTED", e;
7484
- }({}), so = class {
7544
+ }({}), co = class {
7485
7545
  constructor(e = z, t) {
7486
7546
  h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "reconnectDeadlineTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", Tr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
7487
7547
  }
@@ -7531,7 +7591,7 @@ var Ja = qa, Ya = {
7531
7591
  return;
7532
7592
  }
7533
7593
  let e = this._buildUrl(this.wtEndpoint, !0);
7534
- this.currentType = Tr.WEBTRANSPORT, this.socket = new ao(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
7594
+ this.currentType = Tr.WEBTRANSPORT, this.socket = new oo(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
7535
7595
  }
7536
7596
  _connectWebSocket() {
7537
7597
  if (!this.endpoint) {
@@ -7554,10 +7614,10 @@ var Ja = qa, Ya = {
7554
7614
  }
7555
7615
  _buildUrl(e, t) {
7556
7616
  let n = new URL(e), r = n.searchParams;
7557
- return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Xa.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === Cr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
7617
+ return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Za.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === Cr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
7558
7618
  }
7559
7619
  _canUseWebTransport() {
7560
- return !this.forceWebSocket && ao.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
7620
+ return !this.forceWebSocket && oo.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
7561
7621
  }
7562
7622
  _onOpen() {
7563
7623
  this._startDoctor(), this.handlers.onOpen();
@@ -7623,31 +7683,31 @@ var Ja = qa, Ya = {
7623
7683
  _stopDoctor() {
7624
7684
  window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
7625
7685
  }
7626
- }, co = "open", lo = 300, uo = 10, fo = {
7686
+ }, lo = "open", uo = 300, fo = 10, po = {
7627
7687
  CONVERSATION_ENDED: "conversation-ended",
7628
7688
  OBSOLETE_CLIENT: "gen.obsoleteClient",
7629
7689
  INVALID_TOKEN: "invalid-token",
7630
7690
  PARTICIPANT_NOT_FOUND: "participant-not-found",
7631
7691
  ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
7632
7692
  SERVICE_UNAVAILABLE: "service-unavailable"
7633
- }, po = {
7634
- [fo.CONVERSATION_ENDED]: "conversation-ended",
7635
- [fo.OBSOLETE_CLIENT]: "obsolete-client",
7636
- [fo.INVALID_TOKEN]: "invalid-token",
7637
- [fo.PARTICIPANT_NOT_FOUND]: "participant-not-found",
7638
- [fo.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
7639
- [fo.SERVICE_UNAVAILABLE]: "service-unavailable"
7693
+ }, mo = {
7694
+ [po.CONVERSATION_ENDED]: "conversation-ended",
7695
+ [po.OBSOLETE_CLIENT]: "obsolete-client",
7696
+ [po.INVALID_TOKEN]: "invalid-token",
7697
+ [po.PARTICIPANT_NOT_FOUND]: "participant-not-found",
7698
+ [po.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
7699
+ [po.SERVICE_UNAVAILABLE]: "service-unavailable"
7640
7700
  };
7641
- function mo(e, t) {
7701
+ function ho(e, t) {
7642
7702
  return e.errorMessage ?? e.message ?? e.error ?? t;
7643
7703
  }
7644
- var ho = new Set([
7704
+ var go = new Set([
7645
7705
  O.CALLER_IS_BLOCKED,
7646
7706
  O.ENDED,
7647
7707
  O.NOT_FOUND,
7648
7708
  O.PARTICIPANT_LIMIT_REACHED,
7649
7709
  O.SERVICE_UNAVAILABLE
7650
- ]), go = class e extends jn {
7710
+ ]), _o = class e extends jn {
7651
7711
  static get WAIT_CONNECTION_DELAY() {
7652
7712
  return N.waitConnectionDelay;
7653
7713
  }
@@ -7658,7 +7718,7 @@ var ho = new Set([
7658
7718
  return !this.disposed && this.transport.readyState !== null;
7659
7719
  }
7660
7720
  constructor(e = z, t = null, n = null, r = null, i = null) {
7661
- super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new ir(e), this.transport = new so(e, {
7721
+ super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new ir(e), this.transport = new co(e, {
7662
7722
  onConnecting: this._onTransportConnecting.bind(this),
7663
7723
  onOpen: this._onOpen.bind(this),
7664
7724
  onMessage: this._onMessage.bind(this),
@@ -7745,20 +7805,20 @@ var ho = new Set([
7745
7805
  return this._send(V.TRANSMIT_DATA, {
7746
7806
  participantId: e,
7747
7807
  data: r
7748
- }, !0, uo);
7808
+ }, !0, fo);
7749
7809
  }
7750
7810
  async acceptCall(e) {
7751
7811
  return this._send(V.ACCEPT_CALL, { mediaSettings: e });
7752
7812
  }
7753
7813
  async changeMediaSettings(e) {
7754
- return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, uo);
7814
+ return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, fo);
7755
7815
  }
7756
7816
  async changeParticipantState(e, t) {
7757
7817
  let n = { participantState: { state: e } };
7758
7818
  return t && (n.participantId = t), this._sendRaw(V.CHANGE_PARTICIPANT_STATE, n);
7759
7819
  }
7760
7820
  async hold(e) {
7761
- let t = Ja.get();
7821
+ let t = Ya.get();
7762
7822
  return this._send(V.HOLD, {
7763
7823
  hold: e,
7764
7824
  capabilities: e ? void 0 : t
@@ -7990,7 +8050,7 @@ var ho = new Set([
7990
8050
  if (this.disposed) throw new kn(e);
7991
8051
  switch (t.route) {
7992
8052
  case "producer":
7993
- this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === co && this._handleCommandsQueue(this.datachannelCommandsQueue);
8053
+ this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === lo && this._handleCommandsQueue(this.datachannelCommandsQueue);
7994
8054
  break;
7995
8055
  case "websocket":
7996
8056
  if (this.transport.readyState === null) {
@@ -8060,9 +8120,9 @@ var ho = new Set([
8060
8120
  }
8061
8121
  _handleErrorMessage(e) {
8062
8122
  this._logger?.log(x.SOCKET_ACTION, `error-${e.error}`);
8063
- let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = mo(e, "Unknown signaling error");
8123
+ let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = ho(e, "Unknown signaling error");
8064
8124
  switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
8065
- case fo.SERVICE_UNAVAILABLE:
8125
+ case po.SERVICE_UNAVAILABLE:
8066
8126
  let i = new k(O.SERVICE_UNAVAILABLE, {
8067
8127
  callError: n,
8068
8128
  message: r,
@@ -8074,7 +8134,7 @@ var ho = new Set([
8074
8134
  reason: O.SERVICE_UNAVAILABLE
8075
8135
  });
8076
8136
  break;
8077
- case fo.CONVERSATION_ENDED:
8137
+ case po.CONVERSATION_ENDED:
8078
8138
  this.conversationReject ? this.conversationReject(new k(e.reason || y.SIGNALING_FAILED, {
8079
8139
  callError: n,
8080
8140
  message: r,
@@ -8085,22 +8145,22 @@ var ho = new Set([
8085
8145
  reason: e.reason
8086
8146
  });
8087
8147
  break;
8088
- case fo.ILLEGAL_PARTICIPANT_STATE:
8089
- case fo.PARTICIPANT_NOT_FOUND:
8148
+ case po.ILLEGAL_PARTICIPANT_STATE:
8149
+ case po.PARTICIPANT_NOT_FOUND:
8090
8150
  this._throwError(new k(y.SIGNALING_FAILED, {
8091
8151
  callError: n,
8092
8152
  message: r,
8093
8153
  remote: !0
8094
8154
  }));
8095
8155
  break;
8096
- case fo.OBSOLETE_CLIENT:
8156
+ case po.OBSOLETE_CLIENT:
8097
8157
  this.conversationReject?.(new k(e.reason || O.OBSOLETE_CLIENT, {
8098
8158
  callError: n,
8099
8159
  message: r,
8100
8160
  remote: !0
8101
8161
  }));
8102
8162
  break;
8103
- case fo.INVALID_TOKEN:
8163
+ case po.INVALID_TOKEN:
8104
8164
  default:
8105
8165
  if (e.sequence || t === Tr.WEBTRANSPORT) break;
8106
8166
  if (this.connected) this._throwError(new k(e.reason || y.SIGNALING_FAILED, {
@@ -8139,7 +8199,7 @@ var ho = new Set([
8139
8199
  }
8140
8200
  _describeErrorEvent(e) {
8141
8201
  let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
8142
- return (i ? `${i}: ${r}` : r).slice(0, lo);
8202
+ return (i ? `${i}: ${r}` : r).slice(0, uo);
8143
8203
  }
8144
8204
  _onClose(e) {
8145
8205
  this._logger?.log(x.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
@@ -8194,13 +8254,13 @@ var ho = new Set([
8194
8254
  let r = this.responseHandlers[n.sequence];
8195
8255
  window.clearTimeout(r.responseTimer);
8196
8256
  let i = G.measureMark(r.statMarkName);
8197
- i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-error"), r.reject(Error(mo(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-timeout"), r.reject(Error(mo(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
8257
+ i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-error"), r.reject(Error(ho(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-timeout"), r.reject(Error(ho(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
8198
8258
  }
8199
8259
  _handleCommandsQueue(e) {
8200
8260
  for (; e.length > 0;) {
8201
8261
  let t = e.shift();
8202
8262
  if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), t.route === "producer") {
8203
- if (this.producerCommandDataChannel?.readyState !== co) {
8263
+ if (this.producerCommandDataChannel?.readyState !== lo) {
8204
8264
  t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
8205
8265
  return;
8206
8266
  }
@@ -8285,7 +8345,7 @@ var ho = new Set([
8285
8345
  }
8286
8346
  _onTransportFailed(e) {
8287
8347
  switch (e.failure) {
8288
- case oo.EMPTY_ENDPOINT:
8348
+ case so.EMPTY_ENDPOINT:
8289
8349
  this.conversationReject?.(new k(y.SIGNALING_FAILED, {
8290
8350
  callError: {
8291
8351
  scope: "internal",
@@ -8296,7 +8356,7 @@ var ho = new Set([
8296
8356
  remote: e.remote
8297
8357
  }));
8298
8358
  break;
8299
- case oo.NETWORK_ERROR:
8359
+ case so.NETWORK_ERROR:
8300
8360
  this._logReconnectTimeout(), this._fail(new k(O.NETWORK_ERROR, { callError: {
8301
8361
  scope: "network",
8302
8362
  source: e.source,
@@ -8304,7 +8364,7 @@ var ho = new Set([
8304
8364
  description: "connection-failed"
8305
8365
  } }));
8306
8366
  break;
8307
- case oo.RECONNECT_TIMEOUT:
8367
+ case so.RECONNECT_TIMEOUT:
8308
8368
  this._logReconnectTimeout(), this._fail(new k(O.NETWORK_ERROR, { callError: {
8309
8369
  scope: "network",
8310
8370
  source: e.source,
@@ -8312,7 +8372,7 @@ var ho = new Set([
8312
8372
  description: "connection-failed"
8313
8373
  } }));
8314
8374
  break;
8315
- case oo.ABORTED:
8375
+ case so.ABORTED:
8316
8376
  this._debug.debug("[signaling] aborted reconnect"), this._fail(new k(O.CANCELED));
8317
8377
  break;
8318
8378
  }
@@ -8327,7 +8387,7 @@ var ho = new Set([
8327
8387
  this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(Er.FAILED_PINGS);
8328
8388
  }
8329
8389
  _attachNotificationCallError(e) {
8330
- e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !ho.has(e.reason) && !e.errorCode || (e.callError = {
8390
+ e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !go.has(e.reason) && !e.errorCode || (e.callError = {
8331
8391
  scope: "server",
8332
8392
  source: this._getSocketType(),
8333
8393
  code: e.errorCode || "protocol",
@@ -8335,7 +8395,7 @@ var ho = new Set([
8335
8395
  });
8336
8396
  }
8337
8397
  _createSignalingCallError(e, t, n) {
8338
- let r = po[e];
8398
+ let r = mo[e];
8339
8399
  if (r) return {
8340
8400
  scope: "server",
8341
8401
  source: n,
@@ -8361,39 +8421,39 @@ var ho = new Set([
8361
8421
  let t = this._getSocketType(), n = Dr[e][t];
8362
8422
  this._statAggregator?.logEventualStatSinceMark({ name: n });
8363
8423
  }
8364
- }, _o = /* @__PURE__ */ function(e) {
8424
+ }, vo = /* @__PURE__ */ function(e) {
8365
8425
  return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
8366
- }(_o || {}), vo = /* @__PURE__ */ function(e) {
8367
- return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
8368
8426
  }(vo || {}), yo = /* @__PURE__ */ function(e) {
8369
- return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
8427
+ return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
8370
8428
  }(yo || {}), bo = /* @__PURE__ */ function(e) {
8371
- return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
8429
+ return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
8372
8430
  }(bo || {}), xo = /* @__PURE__ */ function(e) {
8431
+ return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
8432
+ }(xo || {}), So = /* @__PURE__ */ function(e) {
8373
8433
  return e.REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN", e.AUDIENCE_MODE = "AUDIENCE_MODE", e.WAITING_HALL = "WAITING_HALL", e.WAIT_FOR_ADMIN = "WAIT_FOR_ADMIN", e.ADMIN_IS_HERE = "ADMIN_IS_HERE", e.ASR = "ASR", e.FEEDBACK = "FEEDBACK", e.RECURRING = "RECURRING", e;
8374
- }(xo || {});
8375
- function So(e, t) {
8434
+ }(So || {});
8435
+ function Co(e, t) {
8376
8436
  if (e.length !== t.length) return !1;
8377
8437
  for (let n of e) if (!t.includes(n)) return !1;
8378
8438
  return !0;
8379
8439
  }
8380
- function Co(e, t) {
8440
+ function wo(e, t) {
8381
8441
  let n = new Set(e);
8382
8442
  for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
8383
8443
  return Array.from(n);
8384
8444
  }
8385
8445
  //#endregion
8386
8446
  //#region src/enums/MuteState.ts
8387
- var wo = /* @__PURE__ */ function(e) {
8447
+ var To = /* @__PURE__ */ function(e) {
8388
8448
  return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
8389
- }(wo || {}), X = /* @__PURE__ */ function(e) {
8449
+ }(To || {}), X = /* @__PURE__ */ function(e) {
8390
8450
  return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
8391
- }(X || {}), To = /* @__PURE__ */ function(e) {
8451
+ }(X || {}), Eo = /* @__PURE__ */ function(e) {
8392
8452
  return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
8393
- }(To || {}), Eo = /* @__PURE__ */ function(e) {
8453
+ }(Eo || {}), Do = /* @__PURE__ */ function(e) {
8394
8454
  return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
8395
- }(Eo || {});
8396
- function Do(e) {
8455
+ }(Do || {});
8456
+ function Oo(e) {
8397
8457
  switch (e) {
8398
8458
  case 1: return "no-available-tracks";
8399
8459
  default: return "unknown-error";
@@ -8401,17 +8461,17 @@ function Do(e) {
8401
8461
  }
8402
8462
  //#endregion
8403
8463
  //#region src/enums/UserRole.ts
8404
- var Oo = /* @__PURE__ */ function(e) {
8464
+ var ko = /* @__PURE__ */ function(e) {
8405
8465
  return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
8406
- }(Oo || {});
8407
- function ko(e, t) {
8466
+ }(ko || {});
8467
+ function Ao(e, t) {
8408
8468
  if (e.length !== t.length) return !1;
8409
8469
  for (let n of e) if (!t.includes(n)) return !1;
8410
8470
  return !0;
8411
8471
  }
8412
8472
  //#endregion
8413
8473
  //#region src/static/ParticipantConnectionStatusUtils.ts
8414
- var Ao;
8474
+ var jo;
8415
8475
  (function(e) {
8416
8476
  function t(e) {
8417
8477
  let t = e?.transport ?? e?.lastEffective ?? P.WAITING, n = {
@@ -8463,8 +8523,8 @@ var Ao;
8463
8523
  shouldNotify: !0
8464
8524
  });
8465
8525
  }
8466
- })(Ao || (Ao = {}));
8467
- var jo = Ao, Mo = /* @__PURE__ */ function(e) {
8526
+ })(jo || (jo = {}));
8527
+ var Mo = jo, No = /* @__PURE__ */ function(e) {
8468
8528
  return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
8469
8529
  }({}), Z;
8470
8530
  (function(e) {
@@ -8527,7 +8587,7 @@ var jo = Ao, Mo = /* @__PURE__ */ function(e) {
8527
8587
  })(Z || (Z = {}));
8528
8588
  //#endregion
8529
8589
  //#region src/types/WaitingHall.ts
8530
- function No(e) {
8590
+ function Po(e) {
8531
8591
  try {
8532
8592
  return btoa(JSON.stringify(e));
8533
8593
  } catch (t) {
@@ -8535,7 +8595,7 @@ function No(e) {
8535
8595
  }
8536
8596
  return null;
8537
8597
  }
8538
- function Po(e) {
8598
+ function Fo(e) {
8539
8599
  try {
8540
8600
  return JSON.parse(atob(e));
8541
8601
  } catch (t) {
@@ -8545,12 +8605,12 @@ function Po(e) {
8545
8605
  }
8546
8606
  //#endregion
8547
8607
  //#region src/utils/Conversation.ts
8548
- var Fo = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
8549
- function Io(e) {
8608
+ var Io = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
8609
+ function Lo(e) {
8550
8610
  if (e.conversation?.muteStates) return e.conversation.muteStates;
8551
8611
  if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
8552
8612
  }
8553
- function Lo(e, t) {
8613
+ function Ro(e, t) {
8554
8614
  switch (e) {
8555
8615
  case b.AUDIO: return !!t.isAudioEnabled;
8556
8616
  case b.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
@@ -8559,12 +8619,12 @@ function Lo(e, t) {
8559
8619
  default: return !1;
8560
8620
  }
8561
8621
  }
8562
- function Ro(e, t) {
8622
+ function zo(e, t) {
8563
8623
  return M.objectReduce(e, (e, n, r) => {
8564
8624
  switch (n) {
8565
- case wo.MUTE:
8566
- case wo.MUTE_PERMANENT:
8567
- Lo(r, t) || (e[r] = n);
8625
+ case To.MUTE:
8626
+ case To.MUTE_PERMANENT:
8627
+ Ro(r, t) || (e[r] = n);
8568
8628
  break;
8569
8629
  default:
8570
8630
  e[r] = n;
@@ -8573,19 +8633,19 @@ function Ro(e, t) {
8573
8633
  return e;
8574
8634
  }, {});
8575
8635
  }
8576
- function zo(e) {
8636
+ function Bo(e) {
8577
8637
  let { muteStates: t = {}, mediaSettings: n } = e;
8578
- return Ro(t, n);
8638
+ return zo(t, n);
8579
8639
  }
8580
- function Bo(e, t) {
8640
+ function Vo(e, t) {
8581
8641
  let n = e.conversation.participants.find((t) => M.comparePeerId(t.peerId, e.peerId));
8582
8642
  if (!n) return t;
8583
8643
  let { mediaSettings: r } = n;
8584
- return Ro(t, r);
8644
+ return zo(t, r);
8585
8645
  }
8586
8646
  //#endregion
8587
8647
  //#region src/utils/IceServers.ts
8588
- function Vo(e) {
8648
+ function Ho(e) {
8589
8649
  if (!e) return null;
8590
8650
  let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
8591
8651
  return t.length ? {
@@ -8593,8 +8653,8 @@ function Vo(e) {
8593
8653
  urls: t
8594
8654
  } : null;
8595
8655
  }
8596
- function Ho(e, t) {
8597
- let n = [], r = Vo(e), i = Vo(t);
8656
+ function Uo(e, t) {
8657
+ let n = [], r = Ho(e), i = Ho(t);
8598
8658
  if (r && n.push(r), i) {
8599
8659
  let e = [...i.urls];
8600
8660
  e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
@@ -8606,7 +8666,7 @@ function Ho(e, t) {
8606
8666
  }
8607
8667
  //#endregion
8608
8668
  //#region src/utils/Lz4.ts
8609
- function Uo(e, t) {
8669
+ function Wo(e, t) {
8610
8670
  let n = new Uint8Array(t), r = 0, i = 0;
8611
8671
  for (; r < e.length && i < t;) {
8612
8672
  let a = e[r++], o = a >> 4, s = a & 15;
@@ -8633,7 +8693,7 @@ function Uo(e, t) {
8633
8693
  }
8634
8694
  //#endregion
8635
8695
  //#region src/utils/SerializeLatest.ts
8636
- function Wo(e) {
8696
+ function Go(e) {
8637
8697
  let t, n = !1, r, i = async () => {
8638
8698
  let t = !1, i;
8639
8699
  for (; n;) {
@@ -8654,7 +8714,7 @@ function Wo(e) {
8654
8714
  }
8655
8715
  //#endregion
8656
8716
  //#region src/classes/AudioFix.ts
8657
- var Go = class {
8717
+ var Ko = class {
8658
8718
  constructor(e, t = z, n = null) {
8659
8719
  h(this, "_fixNoPacketsApplied", !1), h(this, "_fixNoPacketsChecked", !1), h(this, "_fixTooManyPacketsApplied", !1), h(this, "_fixTooManyPacketsSucceeded", !1), h(this, "_fixTooManyPacketsFailed", !1), h(this, "_fixTooManyPacketsTime", void 0), h(this, "_mediaSource", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_lastPacketsSent", void 0), h(this, "_lastPacketsSentTime", void 0), h(this, "_toggleAudioPromise", null), h(this, "_fixNoPacketsAppliedVideo", !1), this._mediaSource = e, this._debug = t, this._logger = n;
8660
8720
  }
@@ -8692,9 +8752,9 @@ var Go = class {
8692
8752
  this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
8693
8753
  }));
8694
8754
  }
8695
- }, Ko = class {
8755
+ }, qo = class {
8696
8756
  constructor(e, t = !1, n = z, r = null) {
8697
- h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
8757
+ h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), h(this, "_autoplayRecoveryController", null), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
8698
8758
  }
8699
8759
  add(e, t) {
8700
8760
  this._allowMultipleTracks || this._clearTracks();
@@ -8746,30 +8806,48 @@ var Go = class {
8746
8806
  let t = this._preparedAudioElement ?? this._prepareAudioElement() ?? this._createAudioElement();
8747
8807
  t.muted = !1, t.volume = this._volume, t.preload = "auto";
8748
8808
  let n = () => {
8749
- this._debug.warn("[audio] Error on play audio"), R.onAutoplayError();
8809
+ this._audioElement === t && this._stopAutoplayRecovery();
8750
8810
  }, r = (e) => {
8751
- this._debug.debug("[audio] Play audio"), t.srcObject = null, t.srcObject = new MediaStream(e), t.load();
8752
- let r = t.play();
8753
- r && r.catch(n);
8811
+ if (this._audioElement === t) {
8812
+ if (this._debug.warn("[audio] Error on play audio", e), e?.name === "NotAllowedError" && !this._autoplayRecoveryController) {
8813
+ this._autoplayRecoveryController = new AbortController();
8814
+ for (let e of [
8815
+ "touchend",
8816
+ "click",
8817
+ "keydown"
8818
+ ]) document.addEventListener(e, i, {
8819
+ capture: !0,
8820
+ signal: this._autoplayRecoveryController.signal
8821
+ });
8822
+ }
8823
+ R.onAutoplayError();
8824
+ }
8754
8825
  }, i = () => {
8826
+ t.play()?.then(n, r);
8827
+ }, a = (e) => {
8828
+ this._debug.debug("[audio] Play audio"), t.srcObject = null, t.srcObject = new MediaStream(e), t.load(), i();
8829
+ }, o = () => {
8755
8830
  this._debug.debug("[audio] Recover audio playback");
8756
8831
  let e = this._getTracks();
8757
- e.length ? r(e) : this._debug.warn("[audio] Broken audio tracks");
8832
+ e.length ? a(e) : this._debug.warn("[audio] Broken audio tracks");
8758
8833
  };
8759
- t.onpause = i, t.onstalled = i, t.onerror = i, t.onloadeddata = () => {
8834
+ t.onpause = o, t.onstalled = o, t.onerror = o, t.onloadeddata = () => {
8760
8835
  this._statFirstMediaReceived.measure();
8761
- }, r(e), this._audioElement = t;
8762
- let a = E.getChosenOutput();
8763
- a ? t.setSinkId?.(a.deviceId).then(() => {
8764
- this._debug.debug("[audio] Output device", a);
8836
+ }, this._audioElement = t, a(e);
8837
+ let s = E.getChosenOutput();
8838
+ s ? t.setSinkId?.(s.deviceId).then(() => {
8839
+ this._debug.debug("[audio] Output device", s);
8765
8840
  }).catch((e) => {
8766
- this._debug.warn("[audio] Failed to set output device", a, e);
8841
+ this._debug.warn("[audio] Failed to set output device", s, e);
8767
8842
  }) : this._debug.debug("[audio] Output device: system default");
8768
8843
  }
8769
8844
  _stopAudioElement() {
8770
- this._audioElement && (this._audioElement.onpause = null, this._audioElement.onstalled = null, this._audioElement.onerror = null, this._audioElement.onloadeddata = null, this._audioElement.pause(), this._audioElement.srcObject = null);
8845
+ this._stopAutoplayRecovery(), this._audioElement && (this._audioElement.onpause = null, this._audioElement.onstalled = null, this._audioElement.onerror = null, this._audioElement.onloadeddata = null, this._audioElement.pause(), this._audioElement.srcObject = null);
8771
8846
  for (let e of this._audioTracks.values()) e.stop();
8772
8847
  }
8848
+ _stopAutoplayRecovery() {
8849
+ this._autoplayRecoveryController?.abort(), this._autoplayRecoveryController = null;
8850
+ }
8773
8851
  _createAudioElement() {
8774
8852
  let e = C.browserName() !== "Safari" || C.isMobile() || N.safariAudioElement;
8775
8853
  return document.createElement(e ? "audio" : "video");
@@ -8795,13 +8873,13 @@ var Go = class {
8795
8873
  };
8796
8874
  //#endregion
8797
8875
  //#region src/classes/conversation/ConversationResponseValidator.ts
8798
- function qo(e, t) {
8799
- e || Yo(t, "response-empty"), e.id || Yo(t, "id-empty"), e.endpoint || Yo(t, "endpoint-empty"), !Jo(e.stun_server) && !Jo(e.turn_server) && Yo(t, "ice-servers-empty");
8876
+ function Jo(e, t) {
8877
+ e || Xo(t, "response-empty"), e.id || Xo(t, "id-empty"), e.endpoint || Xo(t, "endpoint-empty"), !Yo(e.stun_server) && !Yo(e.turn_server) && Xo(t, "ice-servers-empty");
8800
8878
  }
8801
- function Jo(e) {
8879
+ function Yo(e) {
8802
8880
  return Array.isArray(e?.urls) && e.urls.length > 0;
8803
8881
  }
8804
- function Yo(e, t) {
8882
+ function Xo(e, t) {
8805
8883
  let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
8806
8884
  throw new k(r ? e === "fastStart" ? O.FAST_START_ERROR : O.FAST_JOIN_ERROR : O.UNKNOWN_ERROR, {
8807
8885
  message: `Invalid ${e} response: ${t}`,
@@ -8820,7 +8898,7 @@ function Yo(e, t) {
8820
8898
  }
8821
8899
  //#endregion
8822
8900
  //#region src/classes/DebugInfo.ts
8823
- var Xo = 90, Zo = 3, Qo = class extends Ye {
8901
+ var Zo = 90, Qo = 3, $o = class extends Ye {
8824
8902
  constructor(e = z) {
8825
8903
  super(), h(this, "_lastMemoryStat", {
8826
8904
  percent: 0,
@@ -8836,9 +8914,9 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
8836
8914
  let e = window?.performance?.memory;
8837
8915
  if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
8838
8916
  let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
8839
- t > Xo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Zo) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
8917
+ t > Zo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Qo) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
8840
8918
  }
8841
- }, $o = class {
8919
+ }, es = class {
8842
8920
  constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
8843
8921
  h(this, "_api", void 0), h(this, "_debug", void 0), h(this, "_getParticipants", void 0), h(this, "_isMe", void 0), h(this, "_updateDisplayLayout", void 0), h(this, "_onNonFatalError", void 0), h(this, "_requestedLayouts", {}), h(this, "_uncertainLayouts", {}), h(this, "_pendingRequests", null), h(this, "_pendingPromises", []), h(this, "_lastRequests", null), h(this, "_timer", null), h(this, "_inFlight", !1), h(this, "_lastFlushAt", null), h(this, "_generation", 0), h(this, "_forceNextFlush", !1), this._api = e, this._debug = t, this._getParticipants = n, this._isMe = r, this._updateDisplayLayout = i, this._onNonFatalError = a;
8844
8922
  }
@@ -8953,7 +9031,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
8953
9031
  let n = e, r = t;
8954
9032
  return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
8955
9033
  }
8956
- }, es = 44100, ts = class {
9034
+ }, ts = 44100, ns = class {
8957
9035
  constructor(e, t) {
8958
9036
  h(this, "_analyser", null), h(this, "_gainNode", null), h(this, "_fftBins", null), h(this, "_mediaStreamSource", null), h(this, "_lastSmoothedLevel", 0), h(this, "_trackId", void 0), h(this, "_track", void 0), h(this, "_stream", void 0), this._trackId = e, this._track = t, this._stream = new MediaStream([t]);
8959
9037
  try {
@@ -8973,7 +9051,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
8973
9051
  _getBins() {
8974
9052
  if (!this._fftBins || !this._analyser) return new Uint8Array();
8975
9053
  this._analyser.getByteFrequencyData(this._fftBins);
8976
- let e = es / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
9054
+ let e = ts / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
8977
9055
  return this._fftBins.subarray(t, n);
8978
9056
  }
8979
9057
  getLevel() {
@@ -8986,7 +9064,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
8986
9064
  destroy() {
8987
9065
  this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track), E.releaseAudioContext(this);
8988
9066
  }
8989
- }, ns = class extends Ye {
9067
+ }, rs = class extends Ye {
8990
9068
  constructor(e) {
8991
9069
  super(), h(this, "_detector", null), h(this, "_interval", null);
8992
9070
  let t = () => {
@@ -9002,7 +9080,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9002
9080
  }), this.subscribe(e, Xt.SOURCE_READY, n), n();
9003
9081
  }
9004
9082
  init(e) {
9005
- this._stopDetector(), this._detector = new ts("local", e.clone());
9083
+ this._stopDetector(), this._detector = new ns("local", e.clone());
9006
9084
  }
9007
9085
  _stopDetector() {
9008
9086
  this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
@@ -9010,7 +9088,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9010
9088
  destroy() {
9011
9089
  this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
9012
9090
  }
9013
- }, rs = class {
9091
+ }, is = class {
9014
9092
  constructor(e, t = z) {
9015
9093
  h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
9016
9094
  }
@@ -9030,9 +9108,9 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9030
9108
  this.isProcessing = !1;
9031
9109
  }
9032
9110
  }
9033
- }, is = /* @__PURE__ */ function(e) {
9111
+ }, as = /* @__PURE__ */ function(e) {
9034
9112
  return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
9035
- }({}), as = class extends Ye {
9113
+ }({}), os = class extends Ye {
9036
9114
  constructor(e) {
9037
9115
  super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, Y.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
9038
9116
  }
@@ -9040,7 +9118,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9040
9118
  this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
9041
9119
  }
9042
9120
  _onRemoteTrackAdded(e, t, n) {
9043
- if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new ts(e, n)), !this._interval)) {
9121
+ if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new ns(e, n)), !this._interval)) {
9044
9122
  let e = () => {
9045
9123
  this._collectVolumes(), this._interval = window.setTimeout(e, N.voiceParams.interval);
9046
9124
  };
@@ -9094,11 +9172,11 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9094
9172
  e.destroy();
9095
9173
  }), this._detectors.clear();
9096
9174
  }
9097
- }, os = /* @__PURE__ */ function(e) {
9175
+ }, ss = /* @__PURE__ */ function(e) {
9098
9176
  return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
9099
- }({}), ss = class extends Ye {
9177
+ }({}), cs = class extends Ye {
9100
9178
  constructor(e, t, n) {
9101
- super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, is.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, Y.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
9179
+ super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, as.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, Y.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
9102
9180
  }
9103
9181
  destroy() {
9104
9182
  this.unsubscribe();
@@ -9120,9 +9198,9 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9120
9198
  _onTopologyChanged(e) {
9121
9199
  this._serverSideSpeakerDetection = e === J.SERVER;
9122
9200
  }
9123
- }, cs = 15e3, ls = 15e3, us = class extends Ye {
9201
+ }, ls = 15e3, us = 15e3, ds = class extends Ye {
9124
9202
  constructor(e, t, n, r = z, i = null) {
9125
- super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, is.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
9203
+ super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, as.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
9126
9204
  }
9127
9205
  destroy() {
9128
9206
  this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
@@ -9134,10 +9212,10 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9134
9212
  this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
9135
9213
  }
9136
9214
  _getConnectionTimeout() {
9137
- return this._transport.getTopology() === J.DIRECT ? cs : N.specListenerParams.connectionTimeout;
9215
+ return this._transport.getTopology() === J.DIRECT ? ls : N.specListenerParams.connectionTimeout;
9138
9216
  }
9139
9217
  _getVolumeTimeout() {
9140
- return this._transport.getTopology() === J.DIRECT ? ls : N.specListenerParams.volumeTimeout;
9218
+ return this._transport.getTopology() === J.DIRECT ? us : N.specListenerParams.volumeTimeout;
9141
9219
  }
9142
9220
  _onTransportStateChanged(e, t) {
9143
9221
  t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
@@ -9170,15 +9248,15 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
9170
9248
  r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
9171
9249
  }), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
9172
9250
  }
9173
- }, ds = /* @__PURE__ */ function(e) {
9251
+ }, fs = /* @__PURE__ */ function(e) {
9174
9252
  return e[e.PARAM_SESSION_EXPIRED = 102] = "PARAM_SESSION_EXPIRED", e[e.PARAM_SESSION_KEY = 103] = "PARAM_SESSION_KEY", e[e.PARAM_SIGNATURE = 104] = "PARAM_SIGNATURE", e[e.AUTH_LOGIN = 401] = "AUTH_LOGIN", e;
9175
- }(ds || {});
9176
- function fs(e) {
9253
+ }(fs || {});
9254
+ function ps(e) {
9177
9255
  return e === 102 || e === 103 || e === 104;
9178
9256
  }
9179
9257
  //#endregion
9180
9258
  //#region src/classes/stat/StatQueue.ts
9181
- var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys = 10080 * 60 * 1e3, bs = 5e3, xs = 6e4, Q = class e {
9259
+ var ms, hs = "ok-calls-sdk-stats", gs = 1, _s = "events", vs = 100, ys = 5e3, bs = 10080 * 60 * 1e3, xs = 5e3, Ss = 6e4, Q = class e {
9182
9260
  static isSupported() {
9183
9261
  return e._supported;
9184
9262
  }
@@ -9191,7 +9269,7 @@ var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys
9191
9269
  n.onsuccess = () => e(n.result);
9192
9270
  });
9193
9271
  }).catch((e) => (z.error("[StatQueue] failed to append event", e), null));
9194
- return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >= _s && (e._appendsSinceEvictCheck = 0, await e.evictToLimit(vs)), r);
9272
+ return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >= vs && (e._appendsSinceEvictCheck = 0, await e.evictToLimit(ys)), r);
9195
9273
  }
9196
9274
  static async fillDelta(t, n) {
9197
9275
  if (t.length === 0) return;
@@ -9292,7 +9370,7 @@ var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys
9292
9370
  });
9293
9371
  }
9294
9372
  static async __resetForTests() {
9295
- if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === ms && (e._dbName = `${ms}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
9373
+ if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === hs && (e._dbName = `${hs}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
9296
9374
  let t = await e._open();
9297
9375
  t && await e._runTransaction(t, "readwrite", (e) => {
9298
9376
  e.clear();
@@ -9307,18 +9385,18 @@ var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys
9307
9385
  static _open() {
9308
9386
  if (!e._checkSupport()) return e._supported = !1, Promise.resolve(null);
9309
9387
  if (e._dbPromise) return e._dbPromise;
9310
- if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < xs) return Promise.resolve(null);
9388
+ if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < Ss) return Promise.resolve(null);
9311
9389
  let t = !1, n = new Promise((n) => {
9312
9390
  let r = (r, i) => {
9313
9391
  t || (t = !0, z.error(r, i), e._supported = !1, e._dbPromise = null, e._lastOpenFailureAt = Date.now(), n(null));
9314
9392
  }, i;
9315
9393
  try {
9316
- i = window.indexedDB.open(e._dbName, hs);
9394
+ i = window.indexedDB.open(e._dbName, gs);
9317
9395
  } catch (e) {
9318
9396
  r("[StatQueue] storage is not accessible", e);
9319
9397
  return;
9320
9398
  }
9321
- let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), bs);
9399
+ let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), xs);
9322
9400
  i.onupgradeneeded = () => {
9323
9401
  e._createSchema(i.result);
9324
9402
  }, i.onsuccess = () => {
@@ -9339,8 +9417,8 @@ var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys
9339
9417
  e._db && (e._db.close(), e._db = null), e._dbPromise = null;
9340
9418
  }
9341
9419
  static _createSchema(e) {
9342
- if (e.objectStoreNames.contains(gs)) return;
9343
- let t = e.createObjectStore(gs, {
9420
+ if (e.objectStoreNames.contains(_s)) return;
9421
+ let t = e.createObjectStore(_s, {
9344
9422
  keyPath: "id",
9345
9423
  autoIncrement: !0
9346
9424
  });
@@ -9348,8 +9426,8 @@ var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys
9348
9426
  }
9349
9427
  static _runTransaction(e, t, n) {
9350
9428
  return new Promise((r, i) => {
9351
- let a = e.transaction(gs, t), o;
9352
- a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(gs))).then((e) => {
9429
+ let a = e.transaction(_s, t), o;
9430
+ a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(_s))).then((e) => {
9353
9431
  o = e;
9354
9432
  }).catch((e) => {
9355
9433
  try {
@@ -9374,18 +9452,18 @@ var ps, ms = "ok-calls-sdk-stats", hs = 1, gs = "events", _s = 100, vs = 5e3, ys
9374
9452
  });
9375
9453
  }
9376
9454
  };
9377
- ps = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", ms), h(Q, "_supported", ps._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
9455
+ ms = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", hs), h(Q, "_supported", ms._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
9378
9456
  //#endregion
9379
9457
  //#region src/static/ApiTransport.ts
9380
- var Ss = null, Cs = null, ws = 64 * 1024;
9381
- function Ts() {
9382
- Ss = null, Cs = null;
9458
+ var Cs = null, ws = null, Ts = 64 * 1024;
9459
+ function Es() {
9460
+ Cs = null, ws = null;
9383
9461
  }
9384
- function Es(e) {
9462
+ function Ds(e) {
9385
9463
  return e?.endsWith("/") ? e.slice(0, -1) : e;
9386
9464
  }
9387
- async function Ds(e = null, t) {
9388
- let n = Es(e ?? N.apiBaseUrl);
9465
+ async function Os(e = null, t) {
9466
+ let n = Ds(e ?? N.apiBaseUrl);
9389
9467
  if (n) return n;
9390
9468
  if ((t ?? N.apiEnv) !== "AUTO") return N.apiEndpoint(t);
9391
9469
  try {
@@ -9400,25 +9478,25 @@ async function Ds(e = null, t) {
9400
9478
  return z.warn("Failed to resolve API endpoint using DNS, default is used", e), N.apiEndpoint(t);
9401
9479
  }
9402
9480
  }
9403
- async function Os() {
9404
- return Ss || Cs || (Cs = Ds(), Ss = await Cs, Cs = null, Ss);
9481
+ async function ks() {
9482
+ return Cs || ws || (ws = Os(), Cs = await ws, ws = null, Cs);
9405
9483
  }
9406
- async function ks(e, t = {}, n = !1) {
9484
+ async function As(e, t = {}, n = !1) {
9407
9485
  if (!window.Blob || !window.navigator.sendBeacon) return;
9408
- await Os();
9409
- let r = Fs(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
9410
- window.navigator.sendBeacon(`${Ss}/fb.do`, i);
9486
+ await ks();
9487
+ let r = Is(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
9488
+ window.navigator.sendBeacon(`${Cs}/fb.do`, i);
9411
9489
  }
9412
- async function As(e, t = {}, n = !1, r) {
9413
- return await Os(), Ms(Fs(e, t, n), r);
9490
+ async function js(e, t = {}, n = !1, r) {
9491
+ return await ks(), Ns(Is(e, t, n), r);
9414
9492
  }
9415
- async function js(e, t = {}, n = !1) {
9416
- await Os();
9417
- let r = Fs(e, t, n);
9418
- return Ms(r, void 0, new Blob([r]).size <= ws);
9493
+ async function Ms(e, t = {}, n = !1) {
9494
+ await ks();
9495
+ let r = Is(e, t, n);
9496
+ return Ns(r, void 0, new Blob([r]).size <= Ts);
9419
9497
  }
9420
- async function Ms(e, t, n = !1) {
9421
- let r = `${t ?? Ss}/fb.do`, i = new AbortController(), a = new k(y.NETWORK, { callError: {
9498
+ async function Ns(e, t, n = !1) {
9499
+ let r = `${t ?? Cs}/fb.do`, i = new AbortController(), a = new k(y.NETWORK, { callError: {
9422
9500
  scope: "network",
9423
9501
  source: "api",
9424
9502
  code: "timeout",
@@ -9437,16 +9515,16 @@ async function Ms(e, t, n = !1) {
9437
9515
  } catch {
9438
9516
  o = { result: a };
9439
9517
  }
9440
- if (!t.ok && !Ns(o)) throw new k(y.API, { callError: {
9518
+ if (!t.ok && !Ps(o)) throw new k(y.API, { callError: {
9441
9519
  scope: "server",
9442
9520
  source: "api",
9443
9521
  code: `http-${t.status}`,
9444
9522
  description: "http-error"
9445
9523
  } });
9446
- if (Ns(o)) throw o;
9524
+ if (Ps(o)) throw o;
9447
9525
  return o;
9448
9526
  } catch (e) {
9449
- throw e instanceof k ? e : i.signal.aborted ? a : Ns(e) ? e : new k(y.NETWORK, { callError: {
9527
+ throw e instanceof k ? e : i.signal.aborted ? a : Ps(e) ? e : new k(y.NETWORK, { callError: {
9450
9528
  scope: "network",
9451
9529
  source: "api",
9452
9530
  code: "fetch-failed",
@@ -9456,12 +9534,12 @@ async function Ms(e, t, n = !1) {
9456
9534
  clearTimeout(o);
9457
9535
  }
9458
9536
  }
9459
- function Ns(e) {
9537
+ function Ps(e) {
9460
9538
  if (typeof e != "object" || !e) return !1;
9461
9539
  let t = e;
9462
9540
  return typeof t.error_code == "number" && typeof t.error_msg == "string";
9463
9541
  }
9464
- async function Ps(e, t) {
9542
+ async function Fs(e, t) {
9465
9543
  try {
9466
9544
  let n = await fetch(e, {
9467
9545
  method: "POST",
@@ -9474,7 +9552,7 @@ async function Ps(e, t) {
9474
9552
  throw z.warn("Failed to send form data", e), e;
9475
9553
  }
9476
9554
  }
9477
- function Fs(e, t = {}, n = !1) {
9555
+ function Is(e, t = {}, n = !1) {
9478
9556
  t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (v.sessionKey ? t.session_key = v.sessionKey : v.accessToken && (t.access_token = v.accessToken));
9479
9557
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
9480
9558
  let r = "";
@@ -9483,7 +9561,7 @@ function Fs(e, t = {}, n = !1) {
9483
9561
  }
9484
9562
  //#endregion
9485
9563
  //#region src/static/SessionStore.ts
9486
- var Is = "sessions", Ls = 5, Rs = class e {
9564
+ var Ls = "sessions", Rs = 5, zs = class e {
9487
9565
  static remember(t, n) {
9488
9566
  let r = e._read();
9489
9567
  r[String(t)] = {
@@ -9491,7 +9569,7 @@ var Is = "sessions", Ls = 5, Rs = class e {
9491
9569
  savedAt: Date.now()
9492
9570
  };
9493
9571
  let i = Object.keys(r);
9494
- i.length > Ls && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - Ls).forEach((e) => delete r[e]), e._write(r);
9572
+ i.length > Rs && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - Rs).forEach((e) => delete r[e]), e._write(r);
9495
9573
  }
9496
9574
  static get(t) {
9497
9575
  return e._read()[String(t)] ?? null;
@@ -9507,10 +9585,10 @@ var Is = "sessions", Ls = 5, Rs = class e {
9507
9585
  }), r && e._write(n);
9508
9586
  }
9509
9587
  static currentEndpoint() {
9510
- return String(Es(N.apiBaseUrl) || N.apiEndpoint());
9588
+ return String(Ds(N.apiBaseUrl) || N.apiEndpoint());
9511
9589
  }
9512
9590
  static _read() {
9513
- let t = ht.get(Is);
9591
+ let t = ht.get(Ls);
9514
9592
  if (!t || typeof t != "object" || Array.isArray(t)) return {};
9515
9593
  let n = {};
9516
9594
  return Object.entries(t).forEach(([t, r]) => {
@@ -9519,16 +9597,16 @@ var Is = "sessions", Ls = 5, Rs = class e {
9519
9597
  }
9520
9598
  static _write(e) {
9521
9599
  if (Object.keys(e).length === 0) {
9522
- ht.remove(Is);
9600
+ ht.remove(Ls);
9523
9601
  return;
9524
9602
  }
9525
- ht.set(Is, e);
9603
+ ht.set(Ls, e);
9526
9604
  }
9527
9605
  static _isValid(e) {
9528
9606
  let t = e;
9529
9607
  return typeof t == "object" && !!t && typeof t.sessionKey == "string" && t.sessionKey.length > 0 && typeof t.endpoint == "string" && typeof t.savedAt == "number";
9530
9608
  }
9531
- }, zs = 15e3, Bs = class e {
9609
+ }, Bs = 15e3, Vs = class e {
9532
9610
  static setApi(t) {
9533
9611
  e._api = t;
9534
9612
  }
@@ -9539,7 +9617,7 @@ var Is = "sessions", Ls = 5, Rs = class e {
9539
9617
  e._delta === null && e._api && e.get();
9540
9618
  }
9541
9619
  static get() {
9542
- return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt < zs ? Promise.resolve(0) : (e._pending || (e._pending = e._measure().finally(() => {
9620
+ return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt < Bs ? Promise.resolve(0) : (e._pending || (e._pending = e._measure().finally(() => {
9543
9621
  e._pending = null;
9544
9622
  })), e._pending) : Promise.resolve(e._delta);
9545
9623
  }
@@ -9569,10 +9647,10 @@ var Is = "sessions", Ls = 5, Rs = class e {
9569
9647
  return e._idsAwaitingDelta = [], await Q.fillDelta(n, t), t;
9570
9648
  }
9571
9649
  };
9572
- h(Bs, "_api", null), h(Bs, "_delta", null), h(Bs, "_pending", null), h(Bs, "_idsAwaitingDelta", []), h(Bs, "_lastFailureAt", null);
9650
+ h(Vs, "_api", null), h(Vs, "_delta", null), h(Vs, "_pending", null), h(Vs, "_idsAwaitingDelta", []), h(Vs, "_lastFailureAt", null);
9573
9651
  //#endregion
9574
9652
  //#region src/classes/stat/StatUnloadJournal.ts
9575
- var Vs = "okcls-stat-unload.", Hs = class e {
9653
+ var Hs = "okcls-stat-unload.", Us = class e {
9576
9654
  static beginTabSession() {
9577
9655
  e._tabKey = null, e._entries = [];
9578
9656
  }
@@ -9580,7 +9658,7 @@ var Vs = "okcls-stat-unload.", Hs = class e {
9580
9658
  let n = e._storage();
9581
9659
  if (!n) return !1;
9582
9660
  try {
9583
- return e._tabKey || (e._tabKey = Vs + M.uuid()), e._entries.length > 0 && n.getItem(e._tabKey) === null && (e._entries = []), e._entries.push(t), n.setItem(e._tabKey, JSON.stringify(e._entries)), !0;
9661
+ return e._tabKey || (e._tabKey = Hs + M.uuid()), e._entries.length > 0 && n.getItem(e._tabKey) === null && (e._entries = []), e._entries.push(t), n.setItem(e._tabKey, JSON.stringify(e._entries)), !0;
9584
9662
  } catch (e) {
9585
9663
  return z.error("[StatUnloadJournal] failed to write", e), !1;
9586
9664
  }
@@ -9592,7 +9670,7 @@ var Vs = "okcls-stat-unload.", Hs = class e {
9592
9670
  try {
9593
9671
  for (let e = 0; e < t.length; e += 1) {
9594
9672
  let r = t.key(e);
9595
- r && r.startsWith(Vs) && n.push(r);
9673
+ r && r.startsWith(Hs) && n.push(r);
9596
9674
  }
9597
9675
  } catch (e) {
9598
9676
  return z.error("[StatUnloadJournal] failed to scan journals", e), 0;
@@ -9635,32 +9713,32 @@ var Vs = "okcls-stat-unload.", Hs = class e {
9635
9713
  return typeof t == "object" && !!t && typeof t.uid == "number" && (t.vcid === null || typeof t.vcid == "string") && typeof t.ts == "number" && (t.delta === void 0 || t.delta === null || typeof t.delta == "number") && typeof t.ev == "object" && t.ev !== null;
9636
9714
  }
9637
9715
  };
9638
- h(Hs, "_tabKey", null), h(Hs, "_entries", []);
9716
+ h(Us, "_tabKey", null), h(Us, "_entries", []);
9639
9717
  //#endregion
9640
9718
  //#region src/classes/stat/StatDrainScheduler.ts
9641
- var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat-drain", Xs = class e {
9719
+ var Ws = 500, Gs = 100, Ks = 3e4, qs = 1e3, Js = 5e3, Ys = 3e3, Xs = "okcls-stat-drain", Zs = class e {
9642
9720
  static setApi(t) {
9643
- e._api = t, Bs.setApi(t);
9721
+ e._api = t, Vs.setApi(t);
9644
9722
  }
9645
9723
  static start(t) {
9646
- e.setApi(t), Hs.drainToQueue().catch((e) => z.error("[StatDrainScheduler] failed to import unload journal", e)).then(async () => (Rs.prune(), await Q.evictOlderThan(ys), await Q.evictToLimit(vs), e._drain())).catch((e) => z.error("[StatDrainScheduler] failed to start", e));
9724
+ e.setApi(t), Us.drainToQueue().catch((e) => z.error("[StatDrainScheduler] failed to import unload journal", e)).then(async () => (zs.prune(), await Q.evictOlderThan(bs), await Q.evictToLimit(ys), e._drain())).catch((e) => z.error("[StatDrainScheduler] failed to start", e));
9647
9725
  }
9648
9726
  static notifyAppended() {
9649
9727
  if (e._api) {
9650
- if (e._localCount += 1, e._localCount >= Ws) {
9728
+ if (e._localCount += 1, e._localCount >= Gs) {
9651
9729
  e._drain();
9652
9730
  return;
9653
9731
  }
9654
- e._state === "IDLE" && e._arm(Gs);
9732
+ e._state === "IDLE" && e._arm(Ks);
9655
9733
  }
9656
9734
  }
9657
9735
  static notifyCallFinished() {
9658
9736
  if (e._api) {
9659
- if (e._directBuffer.length > 0 && e._armDirect(Ks), e._state === "DRAINING") {
9737
+ if (e._directBuffer.length > 0 && e._armDirect(qs), e._state === "DRAINING") {
9660
9738
  e._callFinishedDuringDrain = !0;
9661
9739
  return;
9662
9740
  }
9663
- e._arm(Ks);
9741
+ e._arm(qs);
9664
9742
  }
9665
9743
  }
9666
9744
  static drainOnce() {
@@ -9669,7 +9747,7 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
9669
9747
  if (!t) return !1;
9670
9748
  let n = e._currentUserId(), r = await Q.listUids(), i = !1, a = null;
9671
9749
  for (let o of r) try {
9672
- (o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === Us && (i = !0);
9750
+ (o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === Ws && (i = !0);
9673
9751
  } catch (e) {
9674
9752
  a === null && (a = e);
9675
9753
  }
@@ -9683,20 +9761,20 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
9683
9761
  z.error("[StatDrainScheduler] direct send skipped: event belongs to another user");
9684
9762
  return;
9685
9763
  }
9686
- e._directBuffer.push(t), e._directTimer === null && e._armDirect(Js);
9764
+ e._directBuffer.push(t), e._directTimer === null && e._armDirect(Ys);
9687
9765
  }
9688
9766
  }
9689
9767
  static __resetForTests() {
9690
- Bs.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
9768
+ Vs.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
9691
9769
  }
9692
9770
  static _currentUserId() {
9693
9771
  return v.userId;
9694
9772
  }
9695
9773
  static async _drainCurrent(t, n) {
9696
9774
  if (e._isSessionBlocked()) return 0;
9697
- let r = await Q.readOldest(n, Us);
9775
+ let r = await Q.readOldest(n, Ws);
9698
9776
  if (r.length === 0) return 0;
9699
- let i = await Bs.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
9777
+ let i = await Vs.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
9700
9778
  try {
9701
9779
  await t.logClientStats(a);
9702
9780
  } catch (t) {
@@ -9707,25 +9785,25 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
9707
9785
  return await Q.remove(o), r.length;
9708
9786
  }
9709
9787
  static async _drainStored(t, n) {
9710
- let r = Rs.get(n);
9711
- if (!r || r.endpoint !== Rs.currentEndpoint()) return 0;
9712
- let i = await Q.readOldest(n, Us);
9788
+ let r = zs.get(n);
9789
+ if (!r || r.endpoint !== zs.currentEndpoint()) return 0;
9790
+ let i = await Q.readOldest(n, Ws);
9713
9791
  if (i.length === 0) return 0;
9714
- let a = await Bs.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
9792
+ let a = await Vs.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
9715
9793
  try {
9716
9794
  await t.logClientStatsWith(r.sessionKey, o), z.debug("[StatDrainScheduler] delivered", i.length, "stored events of uid", n);
9717
9795
  } catch (t) {
9718
- if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), Rs.forget(n), 0;
9796
+ if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), zs.forget(n), 0;
9719
9797
  if (e._isRetryable(t)) throw t;
9720
9798
  return z.error("[StatDrainScheduler] batch rejected, dropping", t), await Q.remove(s), i.length;
9721
9799
  }
9722
9800
  return await Q.remove(s), i.length;
9723
9801
  }
9724
9802
  static _withLock(e) {
9725
- return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(Ys, e);
9803
+ return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(Xs, e);
9726
9804
  }
9727
9805
  static _isSessionError(e) {
9728
- return fs(e?.error_code);
9806
+ return ps(e?.error_code);
9729
9807
  }
9730
9808
  static _isReauthorizeFailure(e) {
9731
9809
  return e?.error === y.AUTH;
@@ -9738,7 +9816,7 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
9738
9816
  }
9739
9817
  static _isAuthError(t) {
9740
9818
  let n = t?.error_code;
9741
- return e._isSessionError(t) || n === ds.AUTH_LOGIN;
9819
+ return e._isSessionError(t) || n === fs.AUTH_LOGIN;
9742
9820
  }
9743
9821
  static _isRetryable(t) {
9744
9822
  if (e._isSessionError(t)) return !0;
@@ -9763,7 +9841,7 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
9763
9841
  static async _flushDirect() {
9764
9842
  let t = e._api, n = e._directBuffer;
9765
9843
  if (e._directBuffer = [], !(!t || n.length === 0)) try {
9766
- let r = await Bs.get();
9844
+ let r = await Vs.get();
9767
9845
  await t.logClientStats(n.map((t) => e._toClientStats(t, r)));
9768
9846
  } catch (e) {
9769
9847
  z.error("[StatDrainScheduler] direct send failed, events lost", e);
@@ -9782,28 +9860,28 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
9782
9860
  e._clearTimer(), e._state = "DRAINING", e._localCount = 0, e._callFinishedDuringDrain = !1;
9783
9861
  try {
9784
9862
  if (await e.drainOnce()) {
9785
- e._arm(qs);
9863
+ e._arm(Js);
9786
9864
  return;
9787
9865
  }
9788
9866
  if (e._callFinishedDuringDrain) {
9789
- e._arm(Ks);
9867
+ e._arm(qs);
9790
9868
  return;
9791
9869
  }
9792
9870
  if (e._localCount > 0) {
9793
- e._arm(Gs);
9871
+ e._arm(Ks);
9794
9872
  return;
9795
9873
  }
9796
9874
  e._state = "IDLE";
9797
9875
  } catch (t) {
9798
- z.error("[StatDrainScheduler] drain failed", t), e._arm(Gs);
9876
+ z.error("[StatDrainScheduler] drain failed", t), e._arm(Ks);
9799
9877
  }
9800
9878
  }
9801
9879
  }
9802
9880
  };
9803
- h(Xs, "_api", null), h(Xs, "_state", "IDLE"), h(Xs, "_timer", null), h(Xs, "_localCount", 0), h(Xs, "_callFinishedDuringDrain", !1), h(Xs, "_blockedSession", null), h(Xs, "_directBuffer", []), h(Xs, "_directTimer", null);
9881
+ h(Zs, "_api", null), h(Zs, "_state", "IDLE"), h(Zs, "_timer", null), h(Zs, "_localCount", 0), h(Zs, "_callFinishedDuringDrain", !1), h(Zs, "_blockedSession", null), h(Zs, "_directBuffer", []), h(Zs, "_directTimer", null);
9804
9882
  //#endregion
9805
9883
  //#region src/classes/StatsLogger.ts
9806
- var Zs = class extends f {
9884
+ var Qs = class extends f {
9807
9885
  constructor(e, t, n, r = () => void 0) {
9808
9886
  super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), h(this, "_waitingForServerTime", !0), h(this, "_deferredClientStats", []), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._calculateServerTimeDelta();
9809
9887
  }
@@ -9883,7 +9961,7 @@ var Zs = class extends f {
9883
9961
  _now() {
9884
9962
  return Date.now() - this._serverTimeDelta;
9885
9963
  }
9886
- }, Qs = class e extends f {
9964
+ }, $s = class e extends f {
9887
9965
  static __resetForTests() {
9888
9966
  e._pending = [], e._pendingOverflow = !1;
9889
9967
  }
@@ -9899,17 +9977,17 @@ var Zs = class extends f {
9899
9977
  return e._pending = [], e._pendingOverflow = !1, t;
9900
9978
  }
9901
9979
  constructor(e, t, n, r = () => void 0) {
9902
- super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_unloadMode", !1), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new Zs(e, t, n, r);
9980
+ super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_unloadMode", !1), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new Qs(e, t, n, r);
9903
9981
  }
9904
9982
  log(e, t, n = !1) {
9905
9983
  this._externalLogger && this._externalLogger.log(e, t, n);
9906
9984
  }
9907
9985
  enterUnloadMode() {
9908
- this._legacy || (this._unloadMode = !0, Hs.beginTabSession());
9986
+ this._legacy || (this._unloadMode = !0, Us.beginTabSession());
9909
9987
  }
9910
9988
  exitUnloadMode() {
9911
- this._legacy || !this._unloadMode || (this._unloadMode = !1, Hs.drainToQueue().then((e) => {
9912
- e > 0 && Xs.notifyAppended();
9989
+ this._legacy || !this._unloadMode || (this._unloadMode = !1, Us.drainToQueue().then((e) => {
9990
+ e > 0 && Zs.notifyAppended();
9913
9991
  }).catch((e) => z.error("[StatEventCollector] failed to import unload journal", e)));
9914
9992
  }
9915
9993
  logClientStats(t, n = {}) {
@@ -9927,11 +10005,11 @@ var Zs = class extends f {
9927
10005
  this._legacy.logClientStats(t, n);
9928
10006
  return;
9929
10007
  }
9930
- Bs.ensure();
10008
+ Vs.ensure();
9931
10009
  let o = {
9932
10010
  vcid: r,
9933
10011
  ts: i,
9934
- delta: Bs.delta(),
10012
+ delta: Vs.delta(),
9935
10013
  ev: a
9936
10014
  }, s = v.userId;
9937
10015
  if (s === null) {
@@ -9954,12 +10032,12 @@ var Zs = class extends f {
9954
10032
  }
9955
10033
  }
9956
10034
  _store(e) {
9957
- this._unloadMode && Hs.writeSync(e) || Q.append(e).then((t) => {
10035
+ this._unloadMode && Us.writeSync(e) || Q.append(e).then((t) => {
9958
10036
  if (t !== null) {
9959
- typeof e.delta != "number" && Bs.noteAppended(t), Xs.notifyAppended();
10037
+ typeof e.delta != "number" && Vs.noteAppended(t), Zs.notifyAppended();
9960
10038
  return;
9961
10039
  }
9962
- z.error("[StatEventCollector] failed to store event, sending directly"), Xs.sendDirect(e);
10040
+ z.error("[StatEventCollector] failed to store event, sending directly"), Zs.sendDirect(e);
9963
10041
  }).catch((e) => z.error("[StatEventCollector] failed to store event", e));
9964
10042
  }
9965
10043
  _getConversationId() {
@@ -9977,10 +10055,10 @@ var Zs = class extends f {
9977
10055
  }
9978
10056
  }
9979
10057
  };
9980
- h(Qs, "_pending", []), h(Qs, "_pendingOverflow", !1);
10058
+ h($s, "_pending", []), h($s, "_pendingOverflow", !1);
9981
10059
  //#endregion
9982
10060
  //#region src/classes/stat/ApiCallStats.ts
9983
- var $s = class {
10061
+ var ec = class {
9984
10062
  constructor(e) {
9985
10063
  h(this, "_statAggregator", void 0), this._statAggregator = e;
9986
10064
  }
@@ -9992,8 +10070,8 @@ var $s = class {
9992
10070
  string_value: n
9993
10071
  });
9994
10072
  }
9995
- }, ec = { monotonicNow: () => performance.now() }, tc = class {
9996
- constructor(e, t = ec) {
10073
+ }, tc = { monotonicNow: () => performance.now() }, nc = class {
10074
+ constructor(e, t = tc) {
9997
10075
  h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_battery", null), h(this, "_previous", null), h(this, "_destroyed", !1), h(this, "_handleChargingChange", () => {
9998
10076
  this._previous = null;
9999
10077
  }), h(this, "_handleLevelChange", () => {
@@ -10027,7 +10105,7 @@ var $s = class {
10027
10105
  }
10028
10106
  this._destroyed || (this._battery = t, t.addEventListener("levelchange", this._handleLevelChange), t.addEventListener("chargingchange", this._handleChargingChange));
10029
10107
  }
10030
- }, nc = "invalid-error-metadata", rc = 64, ic = new Set(Object.values(O)), ac = new Set(Object.values(y)), oc = {
10108
+ }, rc = "invalid-error-metadata", ic = 64, ac = new Set(Object.values(O)), oc = new Set(Object.values(y)), sc = {
10031
10109
  [O.CANCELED]: {
10032
10110
  type: "semantic",
10033
10111
  reason: "canceled"
@@ -10148,7 +10226,7 @@ var $s = class {
10148
10226
  type: "semantic",
10149
10227
  reason: "obsolete_client"
10150
10228
  }
10151
- }, sc = {
10229
+ }, cc = {
10152
10230
  [y.MIC_CAMERA_PERMISSION]: {
10153
10231
  type: "direct-error",
10154
10232
  error: {
@@ -10237,14 +10315,14 @@ var $s = class {
10237
10315
  }
10238
10316
  }
10239
10317
  };
10240
- function cc(e) {
10241
- if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return nc;
10318
+ function lc(e) {
10319
+ if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return rc;
10242
10320
  let t = String(e).trim();
10243
- if (!t) return nc;
10321
+ if (!t) return rc;
10244
10322
  let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
10245
- return !n || !/^[a-z0-9.-]+$/.test(n) ? nc : n.length > rc ? `${n.slice(0, rc - 3)}...` : n;
10323
+ return !n || !/^[a-z0-9.-]+$/.test(n) ? rc : n.length > ic ? `${n.slice(0, ic - 3)}...` : n;
10246
10324
  }
10247
- function lc(e) {
10325
+ function uc(e) {
10248
10326
  if (!e || typeof e != "object") return !1;
10249
10327
  let t = e;
10250
10328
  switch (t.scope) {
@@ -10256,49 +10334,49 @@ function lc(e) {
10256
10334
  default: return !1;
10257
10335
  }
10258
10336
  }
10259
- function uc(e) {
10260
- let t = cc(e.description);
10337
+ function dc(e) {
10338
+ let t = lc(e.description);
10261
10339
  if (e.scope === "unknown") return `unknown:${t}`;
10262
- let n = cc(e.code);
10340
+ let n = lc(e.code);
10263
10341
  return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
10264
10342
  }
10265
- function dc(e, t) {
10343
+ function fc(e, t) {
10266
10344
  return t === null ? e.type === "direct-error" ? {
10267
10345
  reason: "error",
10268
- string_value: uc(e.error)
10269
- } : { reason: "failed" } : lc(t) ? {
10346
+ string_value: dc(e.error)
10347
+ } : { reason: "failed" } : uc(t) ? {
10270
10348
  reason: "error",
10271
- string_value: uc(t)
10349
+ string_value: dc(t)
10272
10350
  } : { reason: "failed" };
10273
10351
  }
10274
- function fc(e) {
10352
+ function pc(e) {
10275
10353
  if (e.hangup) {
10276
- let t = oc[e.hangup];
10354
+ let t = sc[e.hangup];
10277
10355
  return t ? t.type === "semantic" ? e.hangup === O.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
10278
10356
  reason: t.reason,
10279
10357
  string_value: e.custom_error.vchat_detailed_api_error.code
10280
- } : { reason: t.reason } : dc(t, e.callError) : { reason: "failed" };
10358
+ } : { reason: t.reason } : fc(t, e.callError) : { reason: "failed" };
10281
10359
  }
10282
10360
  if (e.error) {
10283
- let t = sc[e.error];
10284
- return t ? dc(t, e.callError) : { reason: "failed" };
10361
+ let t = cc[e.error];
10362
+ return t ? fc(t, e.callError) : { reason: "failed" };
10285
10363
  }
10286
10364
  return { reason: "failed" };
10287
10365
  }
10288
- function pc(e) {
10289
- return e instanceof k ? fc(e) : typeof e == "string" && (ic.has(e) || ac.has(e)) ? fc(new k(e)) : { reason: "failed" };
10366
+ function mc(e) {
10367
+ return e instanceof k ? pc(e) : typeof e == "string" && (ac.has(e) || oc.has(e)) ? pc(new k(e)) : { reason: "failed" };
10290
10368
  }
10291
10369
  //#endregion
10292
10370
  //#region src/classes/stat/CallLifecycleStats.ts
10293
- var mc = {
10371
+ var hc = {
10294
10372
  wallNow: () => Date.now(),
10295
10373
  monotonicNow: () => performance.now()
10296
10374
  };
10297
- function hc(e) {
10375
+ function gc(e) {
10298
10376
  return e === "anonym_join" ? "join" : e;
10299
10377
  }
10300
- var gc = class {
10301
- constructor(e, t = mc) {
10378
+ var _c = class {
10379
+ constructor(e, t = hc) {
10302
10380
  h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_conversationId", null), h(this, "_callStartLabel", null), h(this, "_lifecycleStartedAtMonotonic", 0), h(this, "_pendingEvents", []), h(this, "_callStarted", !1), h(this, "_accepted", !1), h(this, "_firstMediaSent", !1), h(this, "_finished", !1), h(this, "_destroyed", !1), this._logger = e, this._clock = t;
10303
10381
  }
10304
10382
  get firstMediaSentReported() {
@@ -10310,7 +10388,7 @@ var gc = class {
10310
10388
  markInitializationStarted({ source: e, conversationId: t }) {
10311
10389
  if (this._destroyed || this._callStartLabel !== null) return;
10312
10390
  let n = this._clock.wallNow();
10313
- this._callStartLabel = hc(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
10391
+ this._callStartLabel = gc(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
10314
10392
  name: U.CALL_INIT,
10315
10393
  source: e
10316
10394
  }, n);
@@ -10338,7 +10416,7 @@ var gc = class {
10338
10416
  !this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: U.FIRST_MEDIA_SENT }));
10339
10417
  }
10340
10418
  markFinished(e) {
10341
- this._finish(pc(e));
10419
+ this._finish(mc(e));
10342
10420
  }
10343
10421
  markTerminated() {
10344
10422
  this._finish({ reason: "terminated" });
@@ -10389,7 +10467,7 @@ var gc = class {
10389
10467
  ...n && { immediately: !0 }
10390
10468
  });
10391
10469
  }
10392
- }, _c = 1e3, vc = class {
10470
+ }, vc = 1e3, yc = class {
10393
10471
  constructor(e, t = z) {
10394
10472
  h(this, "_sources", void 0), h(this, "_debug", void 0), h(this, "_timer", null), h(this, "_participantsMax", 0), h(this, "_areaMpxMax", 0), h(this, "_features", /* @__PURE__ */ new Set()), h(this, "_sample", () => {
10395
10473
  try {
@@ -10398,7 +10476,7 @@ var gc = class {
10398
10476
  } catch (e) {
10399
10477
  this._debug.warn("ClientResourceStats sample error", e);
10400
10478
  }
10401
- }), this._sources = e, this._debug = t, this._timer = window.setInterval(this._sample, _c);
10479
+ }), this._sources = e, this._debug = t, this._timer = window.setInterval(this._sample, vc);
10402
10480
  }
10403
10481
  takeReport() {
10404
10482
  this._sample();
@@ -10412,7 +10490,7 @@ var gc = class {
10412
10490
  let e = window.devicePixelRatio || 1, t = window.innerWidth * window.innerHeight * e * e;
10413
10491
  return Math.round(t / 1e6);
10414
10492
  }
10415
- }, yc = class {
10493
+ }, bc = class {
10416
10494
  constructor(e, t) {
10417
10495
  h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
10418
10496
  }
@@ -10475,7 +10553,7 @@ var gc = class {
10475
10553
  this.report(e);
10476
10554
  }), this._codecUsages.clear();
10477
10555
  }
10478
- }, bc = class {
10556
+ }, xc = class {
10479
10557
  constructor(e, t = null) {
10480
10558
  h(this, "_logger", void 0), h(this, "_resources", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e, this._resources = t;
10481
10559
  }
@@ -10522,7 +10600,7 @@ var gc = class {
10522
10600
  for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
10523
10601
  this._logger.logClientStats(n, { occurredAt: t });
10524
10602
  }
10525
- }, xc = class {
10603
+ }, Sc = class {
10526
10604
  constructor(e) {
10527
10605
  if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
10528
10606
  1,
@@ -10581,7 +10659,7 @@ var gc = class {
10581
10659
  5
10582
10660
  ];
10583
10661
  }
10584
- }, Sc = class {
10662
+ }, Cc = class {
10585
10663
  constructor() {
10586
10664
  h(this, "n", 0), h(this, "mean", 0);
10587
10665
  }
@@ -10593,9 +10671,9 @@ var gc = class {
10593
10671
  get avg() {
10594
10672
  return this.n ? this.mean : NaN;
10595
10673
  }
10596
- }, Cc = class {
10674
+ }, wc = class {
10597
10675
  constructor() {
10598
- h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Sc()), h(this, "p50", new xc(.5)), h(this, "p95", new xc(.95));
10676
+ h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Cc()), h(this, "p50", new Sc(.5)), h(this, "p95", new Sc(.95));
10599
10677
  }
10600
10678
  add(e) {
10601
10679
  e < this.minVal && (this.minVal = e), e > this.maxVal && (this.maxVal = e), this.mean.add(e), this.p50.add(e), this.p95.add(e), this.count++;
@@ -10613,18 +10691,18 @@ var gc = class {
10613
10691
  get hasData() {
10614
10692
  return this.count > 0;
10615
10693
  }
10616
- }, wc = 120 * 1e3, Tc = class {
10694
+ }, Tc = 120 * 1e3, Ec = class {
10617
10695
  constructor(e) {
10618
10696
  h(this, "_logger", void 0), h(this, "trackerByTransport", {
10619
- ws: new Cc(),
10620
- wt: new Cc()
10697
+ ws: new wc(),
10698
+ wt: new wc()
10621
10699
  }), h(this, "lastSeen", {}), this._logger = e;
10622
10700
  }
10623
10701
  mark(e) {
10624
10702
  let t = Date.now(), n = this.lastSeen[e];
10625
10703
  if (typeof n == "number") {
10626
10704
  let r = t - n;
10627
- r >= 0 && r <= wc && this.trackerByTransport[e].add(r);
10705
+ r >= 0 && r <= Tc && this.trackerByTransport[e].add(r);
10628
10706
  }
10629
10707
  this.lastSeen[e] = t;
10630
10708
  }
@@ -10649,17 +10727,17 @@ var gc = class {
10649
10727
  }
10650
10728
  destroy() {
10651
10729
  this.trackerByTransport = {
10652
- ws: new Cc(),
10653
- wt: new Cc()
10730
+ ws: new wc(),
10731
+ wt: new wc()
10654
10732
  }, this.lastSeen = {};
10655
10733
  }
10656
- }, Ec = class {
10734
+ }, Dc = class {
10657
10735
  constructor(e) {
10658
10736
  h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
10659
10737
  }
10660
10738
  mark(e, t, n) {
10661
10739
  let r = `${e}|${n}`, i;
10662
- this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new Cc(), this.trackerByCommand.set(r, i)), i.add(t);
10740
+ this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new wc(), this.trackerByCommand.set(r, i)), i.add(t);
10663
10741
  }
10664
10742
  logMetrics() {
10665
10743
  for (let [e, t] of this.trackerByCommand.entries()) {
@@ -10681,9 +10759,9 @@ var gc = class {
10681
10759
  destroy() {
10682
10760
  this.trackerByCommand.clear();
10683
10761
  }
10684
- }, Dc = class {
10762
+ }, Oc = class {
10685
10763
  constructor(e, t, n, r, i) {
10686
- h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "resources", void 0), h(this, "battery", void 0), h(this, "_api", void 0), h(this, "_unloading", !1), this.logger = new Qs(e, t, n, r), this.lifecycle = new gc(this.logger), this.resources = new vc(i), this.statAggregator = new bc(this.logger, this.resources), this.codecStatsAggregator = new yc(this.logger, r), this.pings = new Tc(this.logger), this.signalingCommands = new Ec(this.logger), this.apiCalls = new $s(this.statAggregator), this._api = e, this._api.setApiCallStats(this.apiCalls), this.battery = new tc(this.logger);
10764
+ h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "resources", void 0), h(this, "battery", void 0), h(this, "_api", void 0), h(this, "_unloading", !1), this.logger = new $s(e, t, n, r), this.lifecycle = new _c(this.logger), this.resources = new yc(i), this.statAggregator = new xc(this.logger, this.resources), this.codecStatsAggregator = new bc(this.logger, r), this.pings = new Ec(this.logger), this.signalingCommands = new Dc(this.logger), this.apiCalls = new ec(this.statAggregator), this._api = e, this._api.setApiCallStats(this.apiCalls), this.battery = new nc(this.logger);
10687
10765
  }
10688
10766
  prepareForUnload() {
10689
10767
  N.statQueueEnabled && (this._unloading = !0, this.logger.enterUnloadMode(), this.pings.logMetrics(), this.signalingCommands.logMetrics());
@@ -10701,9 +10779,9 @@ var gc = class {
10701
10779
  this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy();
10702
10780
  }
10703
10781
  destroy() {
10704
- this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.resources.destroy(), this.battery.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading && Xs.notifyCallFinished();
10782
+ this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.resources.destroy(), this.battery.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading && Zs.notifyCallFinished();
10705
10783
  }
10706
- }, Oc = class {
10784
+ }, kc = class {
10707
10785
  constructor(e) {
10708
10786
  h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
10709
10787
  }
@@ -10728,8 +10806,8 @@ var gc = class {
10728
10806
  call_type: this._callType
10729
10807
  }));
10730
10808
  }
10731
- }, kc = 1e3, Ac = 1e4;
10732
- function jc(e, t, n, r) {
10809
+ }, Ac = 1e3, jc = 1e4;
10810
+ function Mc(e, t, n, r) {
10733
10811
  return new k(e, {
10734
10812
  callError: {
10735
10813
  scope: "external",
@@ -10740,13 +10818,13 @@ function jc(e, t, n, r) {
10740
10818
  message: r
10741
10819
  });
10742
10820
  }
10743
- var Mc = 15, $ = class e extends Ye {
10821
+ var Nc = 15, $ = class e extends Ye {
10744
10822
  constructor(e, t) {
10745
10823
  super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Gr()), h(this, "_serverTimeOffset", 0), h(this, "_serverConversationId", null), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_hangupReason", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_pendingId", null), h(this, "_resolveSignalingInitialization", void 0), h(this, "_signalingInitialization", new Promise((e) => {
10746
10824
  this._resolveSignalingInitialization = e;
10747
- })), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Wo((e) => {
10825
+ })), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Go((e) => {
10748
10826
  if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
10749
- })), h(this, "_toggleLocalAudio", Wo((e) => {
10827
+ })), h(this, "_toggleLocalAudio", Go((e) => {
10750
10828
  if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
10751
10829
  })), h(this, "_changeMediaSettings", M.debounce(async (e) => {
10752
10830
  if (!(!this._signaling.ready || !this._transport || this.isCallHeld)) try {
@@ -10758,10 +10836,10 @@ var Mc = 15, $ = class e extends Ye {
10758
10836
  captureAudio: !1
10759
10837
  });
10760
10838
  }
10761
- }, 100)), this._stats = new Dc(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology, {
10839
+ }, 100)), this._stats = new Oc(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology, {
10762
10840
  getActiveFeatures: () => this._mediaSource?.activeFeatures ?? [],
10763
10841
  getParticipantsCount: () => this._getParticipantsCount()
10764
- }), this._api = e, this._signaling = new go(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new rs(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new $o({
10842
+ }), this._api = e, this._signaling = new _o(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new is(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new es({
10765
10843
  api: this._api,
10766
10844
  debug: this._debug,
10767
10845
  getParticipants: () => this._participants,
@@ -10774,7 +10852,7 @@ var Mc = 15, $ = class e extends Ye {
10774
10852
  this._stats.resetPingBaseline(), this._stats.restoreAfterUnload();
10775
10853
  }, this._onVisibilityChange = () => {
10776
10854
  document.visibilityState === "hidden" && this._stats.resetPingBaseline();
10777
- }, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), document.addEventListener("visibilitychange", this._onVisibilityChange), this._statFirstMediaReceived = new Oc(this._stats.statAggregator), this._audioOutput = new Ko(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), kc));
10855
+ }, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), document.addEventListener("visibilitychange", this._onVisibilityChange), this._statFirstMediaReceived = new kc(this._stats.statAggregator), this._audioOutput = new qo(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Ac));
10778
10856
  }
10779
10857
  static current() {
10780
10858
  return B.getActive() ?? (N.hold ? null : B.getFirst());
@@ -10795,7 +10873,7 @@ var Mc = 15, $ = class e extends Ye {
10795
10873
  return this._state === "HELD";
10796
10874
  }
10797
10875
  get isIncomingRinging() {
10798
- return this._conversation?.direction === _o.INCOMING && this._state === "IDLE";
10876
+ return this._conversation?.direction === vo.INCOMING && this._state === "IDLE";
10799
10877
  }
10800
10878
  static debugSessionId() {
10801
10879
  return e.current()?.debugSessionId ?? null;
@@ -10821,7 +10899,7 @@ var Mc = 15, $ = class e extends Ye {
10821
10899
  R.onNonFatalError(Error(e), this.id);
10822
10900
  }
10823
10901
  getIncomingCallerExternalId() {
10824
- return this._conversation?.direction === _o.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
10902
+ return this._conversation?.direction === vo.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
10825
10903
  }
10826
10904
  _buildInternalParams() {
10827
10905
  let e = {
@@ -10831,12 +10909,12 @@ var Mc = 15, $ = class e extends Ye {
10831
10909
  platform: N.platform,
10832
10910
  protocolVersion: N.protocolVersion,
10833
10911
  domainId: N.domain,
10834
- capabilities: Xa.getFlags()
10912
+ capabilities: Za.getFlags()
10835
10913
  };
10836
10914
  return JSON.stringify(e);
10837
10915
  }
10838
10916
  async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
10839
- let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === vo.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
10917
+ let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === yo.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
10840
10918
  this._stats.lifecycle.markInitializationStarted({
10841
10919
  source: "outgoing",
10842
10920
  conversationId: u
@@ -10846,11 +10924,11 @@ var Mc = 15, $ = class e extends Ye {
10846
10924
  let l = await this._requestLocalMedia(n);
10847
10925
  this._throwIfClosed();
10848
10926
  let d = this._mediaSource.mediaSettings;
10849
- t === vo.CHAT || e && e.length > 1 ? this._logWithMediaSettings(x.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(x.OUTGOING_CALL, d);
10927
+ t === yo.CHAT || e && e.length > 1 ? this._logWithMediaSettings(x.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(x.OUTGOING_CALL, d);
10850
10928
  let p = await this._startConversation({
10851
10929
  opponentIds: e,
10852
10930
  opponentType: t,
10853
- direction: _o.OUTGOING,
10931
+ direction: vo.OUTGOING,
10854
10932
  mediaOptions: l,
10855
10933
  payload: r,
10856
10934
  joiningAllowed: i,
@@ -10969,11 +11047,11 @@ var Mc = 15, $ = class e extends Ye {
10969
11047
  }
10970
11048
  }
10971
11049
  _isInWaitingHall(e) {
10972
- return !e.conversation || !e.conversation.options.includes(xo.WAITING_HALL) ? !1 : this._isRestricted(e);
11050
+ return !e.conversation || !e.conversation.options.includes(So.WAITING_HALL) ? !1 : this._isRestricted(e);
10973
11051
  }
10974
11052
  _isWaitForAdmin(e) {
10975
11053
  if (!e.conversation) return !1;
10976
- let t = e.conversation.options.includes(xo.WAIT_FOR_ADMIN), n = e.conversation.options.includes(xo.ADMIN_IS_HERE);
11054
+ let t = e.conversation.options.includes(So.WAIT_FOR_ADMIN), n = e.conversation.options.includes(So.ADMIN_IS_HERE);
10977
11055
  return !t || t && n ? !1 : this._isRestricted(e);
10978
11056
  }
10979
11057
  _isRestricted(e) {
@@ -10981,7 +11059,7 @@ var Mc = 15, $ = class e extends Ye {
10981
11059
  return t && t.restricted || !1;
10982
11060
  }
10983
11061
  _isAudienceMode(e) {
10984
- return e.conversation?.options?.includes(xo.AUDIENCE_MODE) || !1;
11062
+ return e.conversation?.options?.includes(So.AUDIENCE_MODE) || !1;
10985
11063
  }
10986
11064
  _isAudienceModeListener() {
10987
11065
  return this._conversation?.audienceMode && this._conversation?.restricted;
@@ -11011,7 +11089,7 @@ var Mc = 15, $ = class e extends Ye {
11011
11089
  let i = atob(n), a = new Uint8Array(i.length);
11012
11090
  for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
11013
11091
  try {
11014
- let e = Uo(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
11092
+ let e = Wo(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
11015
11093
  return {
11016
11094
  token: i,
11017
11095
  endpoint: l,
@@ -11120,7 +11198,8 @@ var Mc = 15, $ = class e extends Ye {
11120
11198
  n.type === "error" && (r = n.error === "call-unfeasible" ? n.status : O.UNKNOWN_ERROR);
11121
11199
  let i = n.participants;
11122
11200
  if (!i && n.rejectedParticipants?.length) throw Error(n.rejectedParticipants[0].reason);
11123
- for (let e of i) await this._onAddParticipant(M.composeId(e), e, r);
11201
+ for (let e of i) this._onAddParticipant(M.composeId(e), e, r);
11202
+ return this._participantsToExternal(i);
11124
11203
  }
11125
11204
  async addParticipantLegacy(e, t) {
11126
11205
  if (!this._signaling.ready) {
@@ -11134,7 +11213,7 @@ var Mc = 15, $ = class e extends Ye {
11134
11213
  let n = await this._signaling.addParticipantLegacy(e, t), r = null;
11135
11214
  n.type === "error" && (r = n.error === "call-unfeasible" ? n.status : O.UNKNOWN_ERROR);
11136
11215
  let i = n.participants;
11137
- for (let e of i) await this._onAddParticipant(M.composeId(e), e, r);
11216
+ for (let e of i) this._onAddParticipant(M.composeId(e), e, r);
11138
11217
  }
11139
11218
  async removeParticipant(e, t = !1) {
11140
11219
  this._signaling.ready && (await this._signaling.removeParticipant(e, t), this._onRemoveParticipant(e));
@@ -11247,10 +11326,10 @@ var Mc = 15, $ = class e extends Ye {
11247
11326
  let t = await this._api.getConversationParams(e);
11248
11327
  this._throwIfClosed(), this._debug.debug("Api.getConversationParams", t);
11249
11328
  let { turn_server: n, stun_server: r } = t;
11250
- return N.iceServers = Ho(r, n), N.wssBase = t.endpoint, t.wt_endpoint && (N.wtsBase = t.wt_endpoint), N.wssToken = t.token, t.client_type && (N.clientType = t.client_type), t.external_user_type && (N.externalUserType = t.external_user_type), t;
11329
+ return N.iceServers = Uo(r, n), N.wssBase = t.endpoint, t.wt_endpoint && (N.wtsBase = t.wt_endpoint), N.wssToken = t.token, t.client_type && (N.clientType = t.client_type), t.external_user_type && (N.externalUserType = t.external_user_type), t;
11251
11330
  }
11252
11331
  _setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
11253
- N.iceServers = Ho(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
11332
+ N.iceServers = Uo(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
11254
11333
  }
11255
11334
  _buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
11256
11335
  let s = new URL(e), c = s.searchParams;
@@ -11282,10 +11361,10 @@ var Mc = 15, $ = class e extends Ye {
11282
11361
  isVideo: f,
11283
11362
  joiningAllowed: a,
11284
11363
  requireAuthToJoin: o
11285
- }, this._abortController?.signal), !e) throw jc(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
11364
+ }, this._abortController?.signal), !e) throw Mc(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
11286
11365
  if (!e.internalCallerParams) {
11287
11366
  let t = e.rejectedParticipants[0]?.status;
11288
- throw jc(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
11367
+ throw Mc(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
11289
11368
  }
11290
11369
  } catch (e) {
11291
11370
  throw this._state === "CLOSE" ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_START_ERROR, { message: e.message }) : new k(O.FAST_START_ERROR, { message: String(e) });
@@ -11307,10 +11386,10 @@ var Mc = 15, $ = class e extends Ye {
11307
11386
  token: new URL(t.endpoint).searchParams.get("token") ?? ""
11308
11387
  }, this._debug.debug("FastStart", p), m = "fastStart";
11309
11388
  } catch {
11310
- throw jc(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
11389
+ throw Mc(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
11311
11390
  }
11312
11391
  } else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
11313
- qo(p, m), this._applyServerConversation(p.id), this._pendingId = p.id, this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
11392
+ Jo(p, m), this._applyServerConversation(p.id), this._pendingId = p.id, this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
11314
11393
  let ee = await this._connectSignaling(Cr.START, p);
11315
11394
  return this._throwIfClosed(), this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
11316
11395
  }
@@ -11335,9 +11414,9 @@ var Mc = 15, $ = class e extends Ye {
11335
11414
  joinLink: i,
11336
11415
  isVideo: c,
11337
11416
  internalParams: this._buildInternalParams()
11338
- }, this._abortController?.signal), !e) throw jc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
11339
- if (!e.internalCallerParams) throw jc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
11340
- if (!e.conversationId) throw jc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
11417
+ }, this._abortController?.signal), !e) throw Mc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
11418
+ if (!e.internalCallerParams) throw Mc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
11419
+ if (!e.conversationId) throw Mc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
11341
11420
  } catch (e) {
11342
11421
  throw this._state === "CLOSE" ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_JOIN_ERROR, { message: e.message }) : new k(O.FAST_JOIN_ERROR, { message: String(e) });
11343
11422
  }
@@ -11355,7 +11434,7 @@ var Mc = 15, $ = class e extends Ye {
11355
11434
  token: new URL(t.endpoint).searchParams.get("token") ?? ""
11356
11435
  }, this._debug.debug("FastJoin", l), u = "fastJoin";
11357
11436
  } catch (e) {
11358
- throw e instanceof k ? e : jc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
11437
+ throw e instanceof k ? e : Mc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
11359
11438
  }
11360
11439
  } else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
11361
11440
  else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
@@ -11364,13 +11443,13 @@ var Mc = 15, $ = class e extends Ye {
11364
11443
  code: "join",
11365
11444
  description: "target-missing"
11366
11445
  } });
11367
- if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), qo(l, u), l.id) {
11446
+ if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), Jo(l, u), l.id) {
11368
11447
  if (B.has(l.id, this)) throw new k(O.HAS_ACTIVE_CALL);
11369
11448
  this._pendingId = l.id;
11370
11449
  }
11371
11450
  this._setConversationParams(l);
11372
11451
  let d = await this._connectSignaling(Cr.JOIN, l);
11373
- return this._throwIfClosed(), this._setConversation(l, d, _o.JOINING), this._stats.lifecycle.markCallStarted(), d;
11452
+ return this._throwIfClosed(), this._setConversation(l, d, vo.JOINING), this._stats.lifecycle.markCallStarted(), d;
11374
11453
  }
11375
11454
  async _prepareConversation(e, t = j.USER, n, r, i) {
11376
11455
  G.setMark(U.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
@@ -11432,7 +11511,7 @@ var Mc = 15, $ = class e extends Ye {
11432
11511
  }), l.wt_endpoint = c);
11433
11512
  }
11434
11513
  let u = await this._connectSignaling(Cr.ACCEPT, l);
11435
- return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(x.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._throwIfClosed(), this._setConversation(l, u, _o.INCOMING, t), u);
11514
+ return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(x.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._throwIfClosed(), this._setConversation(l, u, vo.INCOMING, t), u);
11436
11515
  }
11437
11516
  _createParticipant(e, t, n = !0) {
11438
11517
  let r = Object.assign({
@@ -11459,7 +11538,7 @@ var Mc = 15, $ = class e extends Ye {
11459
11538
  let e = this._getParticipantId(t ?? r.id);
11460
11539
  e && (r.externalId = e);
11461
11540
  }
11462
- return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = jo.create(r.connectionStatus), r;
11541
+ return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = Mo.create(r.connectionStatus), r;
11463
11542
  }
11464
11543
  _getParticipantId(e) {
11465
11544
  let t = this._api.userId(e);
@@ -11576,7 +11655,7 @@ var Mc = 15, $ = class e extends Ye {
11576
11655
  }
11577
11656
  _createMediaSource() {
11578
11657
  let e = new Qt(this._debug, this._stats.logger);
11579
- return this.subscribe(e, Xt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Go(e, this._debug, this._stats.logger), e;
11658
+ return this.subscribe(e, Xt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Ko(e, this._debug, this._stats.logger), e;
11580
11659
  }
11581
11660
  async _connectSignaling(e, t) {
11582
11661
  this._throwIfClosed(), this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, wr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, wr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, wr.RECONNECT, this._onSignalingReconnect.bind(this));
@@ -11587,7 +11666,7 @@ var Mc = 15, $ = class e extends Ye {
11587
11666
  this._throwIfClosed(), R.onSignalingConnected(this.id), this._resolveSignalingInitialization(!0);
11588
11667
  }
11589
11668
  async _processConnection(e) {
11590
- this._throwIfClosed(), await this._registerConnectionParticipants(e), this._throwIfClosed(), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(yo.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
11669
+ this._throwIfClosed(), await this._registerConnectionParticipants(e), this._throwIfClosed(), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(bo.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
11591
11670
  }
11592
11671
  _onConversationParticipantListChunk(e) {
11593
11672
  let t = e.participants;
@@ -11612,6 +11691,26 @@ var Mc = 15, $ = class e extends Ye {
11612
11691
  participants: n
11613
11692
  };
11614
11693
  }
11694
+ _participantsToExternal(e) {
11695
+ let t = this._transport?.getState();
11696
+ return M.mapSharedParticipants(e.map((e) => {
11697
+ let n = M.composeId(e);
11698
+ return this._createParticipant({
11699
+ id: n,
11700
+ externalId: Z.fromSignalingParticipant(e, !0, !0),
11701
+ mediaSettings: D(e.mediaSettings),
11702
+ participantState: M.mapParticipantState(e),
11703
+ state: e.state,
11704
+ roles: e.roles || [],
11705
+ connectionStatus: this._buildConnectionStatus(n, e.sessionState, t, e.onHold),
11706
+ isOnHold: !!e.onHold,
11707
+ muteStates: e.muteStates || {},
11708
+ unmuteOptions: e.unmuteOptions || [],
11709
+ observedIds: e.observedIds || [],
11710
+ markers: this._denormalizeMarkers(n, e.markers)
11711
+ }, M.composeDecorativeId(e));
11712
+ }));
11713
+ }
11615
11714
  async _registerConnectionParticipants(e) {
11616
11715
  await this._registerParticipants(e.conversation.participants), e.participants?.participants && await this._registerParticipants(e.participants?.participants);
11617
11716
  let t = e?.rooms?.rooms ?? [];
@@ -11630,7 +11729,7 @@ var Mc = 15, $ = class e extends Ye {
11630
11729
  continue;
11631
11730
  }
11632
11731
  if (n.state === X.HUNGUP || n.state === X.REJECTED) {
11633
- r[n.id] && await this._removeParticipant(r[n.id], O.HUNGUP);
11732
+ r[n.id] && this._removeParticipant(r[n.id], O.HUNGUP);
11634
11733
  continue;
11635
11734
  }
11636
11735
  let i = M.composeDecorativeId(n);
@@ -11657,7 +11756,7 @@ var Mc = 15, $ = class e extends Ye {
11657
11756
  _registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
11658
11757
  if (!e) return;
11659
11758
  let n = async () => {
11660
- let n = Fo(e, wo.MUTE), r = Fo(e, wo.MUTE_PERMANENT);
11759
+ let n = Io(e, To.MUTE), r = Io(e, To.MUTE_PERMANENT);
11661
11760
  for (let i of [n, r]) i.length && await this._onMuteParticipant({
11662
11761
  muteStates: e,
11663
11762
  unmuteOptions: t,
@@ -11671,8 +11770,8 @@ var Mc = 15, $ = class e extends Ye {
11671
11770
  if (!(!N.enableSessionStateUpdates || this._isMe(e))) return t;
11672
11771
  }
11673
11772
  _buildConnectionStatus(e, t, n, r = !1) {
11674
- return jo.create({
11675
- transport: r ? P.ONHOLD : jo.fromTransportState(n) ?? P.WAITING,
11773
+ return Mo.create({
11774
+ transport: r ? P.ONHOLD : Mo.fromTransportState(n) ?? P.WAITING,
11676
11775
  sessionState: this._remoteParticipantSessionState(e, t),
11677
11776
  sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
11678
11777
  });
@@ -11681,12 +11780,12 @@ var Mc = 15, $ = class e extends Ye {
11681
11780
  return N.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
11682
11781
  }
11683
11782
  _setTransportStatus(e, t) {
11684
- return jo.setTransport(e.connectionStatus, t);
11783
+ return Mo.setTransport(e.connectionStatus, t);
11685
11784
  }
11686
11785
  _setSessionState(e, t) {
11687
- let n = jo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
11786
+ let n = Mo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
11688
11787
  this._emitParticipantTransition(e, n);
11689
- let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = jo.setSessionState(e.connectionStatus, t, r);
11788
+ let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = Mo.setSessionState(e.connectionStatus, t, r);
11690
11789
  return this._emitParticipantTransition(e, i), i;
11691
11790
  }
11692
11791
  _emitParticipantTransition(e, t, n = null) {
@@ -11757,11 +11856,11 @@ var Mc = 15, $ = class e extends Ye {
11757
11856
  this._onRoomSwitched(t, !0);
11758
11857
  }
11759
11858
  _processMuteStates(e, t = !1) {
11760
- let n = Io(e);
11859
+ let n = Lo(e);
11761
11860
  this._setMuteStatesForRoomId(n, null);
11762
11861
  for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
11763
11862
  let r = this._getMuteStatesForCurrentRoom();
11764
- t && (r = Bo(e, r));
11863
+ t && (r = Vo(e, r));
11765
11864
  let i = Object.keys(r), a = this._conversation?.roomId;
11766
11865
  i.length && this._onMuteParticipant({
11767
11866
  muteStates: r,
@@ -11781,15 +11880,15 @@ var Mc = 15, $ = class e extends Ye {
11781
11880
  }
11782
11881
  _allocateTransport() {
11783
11882
  if (!this._conversation || !this._mediaSource || this.isCallHeld || this._transport) return;
11784
- this._transport = new Ma(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 Qo(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));
11785
- let e = this._conversation.direction === _o.OUTGOING && !this._conversation.concurrent, t = this._participants;
11883
+ 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(), (e) => this._participants[e]?.state === X.ACCEPTED), this._debugInfo = new $o(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));
11884
+ let e = this._conversation.direction === vo.OUTGOING && !this._conversation.concurrent, t = this._participants;
11786
11885
  for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
11787
11886
  }
11788
11887
  _createSpeakerDetector() {
11789
- this._transport && this._conversation && (this._volumesDetector = new as(this._transport), this.subscribe(this._volumesDetector, is.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new ss(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, os.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new ns(this._mediaSource));
11888
+ this._transport && this._conversation && (this._volumesDetector = new os(this._transport), this.subscribe(this._volumesDetector, as.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new cs(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, ss.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new rs(this._mediaSource));
11790
11889
  }
11791
11890
  _createSpecListener() {
11792
- this._transport && this._volumesDetector && (this._specListener = new us(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
11891
+ this._transport && this._volumesDetector && (this._specListener = new ds(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
11793
11892
  }
11794
11893
  _logDevices() {
11795
11894
  let e = E.getCameras().length, t = E.getMicrophones().length;
@@ -11798,7 +11897,7 @@ var Mc = 15, $ = class e extends Ye {
11798
11897
  _logWithMediaSettings(e, t) {
11799
11898
  this._stats.logger.log(e, [t?.isAudioEnabled && "audio", t?.isVideoEnabled && "video"].filter(Boolean).join("_"));
11800
11899
  }
11801
- async _removeParticipant(e, t) {
11900
+ _removeParticipant(e, t) {
11802
11901
  if (e.state === X.CALLED || e.state === X.ACCEPTED || this._state === "CLOSE") return;
11803
11902
  e.id === this._lastSignalledActiveSpeakerId && (this._lastSignalledActiveSpeakerId = null);
11804
11903
  let n = this._participants;
@@ -11859,7 +11958,7 @@ var Mc = 15, $ = class e extends Ye {
11859
11958
  e instanceof kn || this._debug.warn("[signaling] unable to send hangup", e);
11860
11959
  }).finally(() => this._signaling.dispose());
11861
11960
  }
11862
- async _onAddParticipant(e, t, n) {
11961
+ _onAddParticipant(e, t, n) {
11863
11962
  this._debug.debug(`Add new participant [${e}]`);
11864
11963
  let r = this._getParticipant(e);
11865
11964
  r && this._updateParticipantExternalId(r, Z.fromSignalingParticipant(t, !0, !0));
@@ -11883,12 +11982,12 @@ var Mc = 15, $ = class e extends Ye {
11883
11982
  observedIds: t.observedIds || []
11884
11983
  }, n), r = this._getParticipant(e);
11885
11984
  }
11886
- this._setParticipantsStatus([r], P.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(x.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
11985
+ this._setParticipantsStatus([r], P.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = X.HUNGUP, this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(x.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
11887
11986
  }
11888
11987
  _onRemoveParticipant(e) {
11889
11988
  this._debug.debug(`Remove participant [${e}]`);
11890
11989
  let t = [], n = this._participants;
11891
- for (let r = 0; r <= Mc; r++) {
11990
+ for (let r = 0; r <= Nc; r++) {
11892
11991
  let i = n[M.compose(e, r)];
11893
11992
  i && t.push(i);
11894
11993
  }
@@ -11982,11 +12081,11 @@ var Mc = 15, $ = class e extends Ye {
11982
12081
  this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus()), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener();
11983
12082
  return;
11984
12083
  }
11985
- let n = Ja.get();
12084
+ let n = Ya.get();
11986
12085
  await this._signaling.hold(!1, n), this._throwIfClosed(), this._restoreStateAfterHold();
11987
12086
  let r = null;
11988
12087
  if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._participants), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
11989
- let e = this._conversation?.direction === _o.OUTGOING && !this._conversation.concurrent;
12088
+ let e = this._conversation?.direction === vo.OUTGOING && !this._conversation.concurrent;
11990
12089
  this._openTransport(r ?? Object.values(this._participants), e);
11991
12090
  }
11992
12091
  }
@@ -12109,13 +12208,13 @@ var Mc = 15, $ = class e extends Ye {
12109
12208
  let n = Rn(e), a = i[n.participantId];
12110
12209
  if (a) {
12111
12210
  let e;
12112
- typeof t == "number" ? e = Do(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Eo.UNKNOWN_ERROR), r.push({
12211
+ typeof t == "number" ? e = Oo(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Do.UNKNOWN_ERROR), r.push({
12113
12212
  externalId: a.externalId,
12114
12213
  errorReason: e
12115
12214
  });
12116
12215
  }
12117
12216
  }
12118
- if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Nc("Could not allocate one or more participants", r);
12217
+ if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Pc("Could not allocate one or more participants", r);
12119
12218
  }
12120
12219
  async _cleanupCooldownQueue() {
12121
12220
  let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
@@ -12123,7 +12222,7 @@ var Mc = 15, $ = class e extends Ye {
12123
12222
  let n = t.next();
12124
12223
  if (n.done) break;
12125
12224
  let r = n.value;
12126
- if (r[1] + Ac > Date.now()) break;
12225
+ if (r[1] + jc > Date.now()) break;
12127
12226
  let i = r[0];
12128
12227
  await this._stopStreaming(i), e[i] = { stopStream: !0 };
12129
12228
  } while (!0);
@@ -12327,10 +12426,10 @@ var Mc = 15, $ = class e extends Ye {
12327
12426
  throw Error("transport is not initialized");
12328
12427
  }
12329
12428
  _isCallAdmin() {
12330
- return this._conversation ? M.includesOneOf(this._conversation.roles, [Oo.ADMIN, Oo.CREATOR]) : !1;
12429
+ return this._conversation ? M.includesOneOf(this._conversation.roles, [ko.ADMIN, ko.CREATOR]) : !1;
12331
12430
  }
12332
12431
  _checkAdminRole() {
12333
- if (this._conversation && !M.includesOneOf(this._conversation.roles, [Oo.ADMIN, Oo.CREATOR])) throw Error("You don't have the required permission");
12432
+ if (this._conversation && !M.includesOneOf(this._conversation.roles, [ko.ADMIN, ko.CREATOR])) throw Error("You don't have the required permission");
12334
12433
  }
12335
12434
  _isCalledState() {
12336
12435
  return this._participantState === X.CALLED;
@@ -12368,21 +12467,21 @@ var Mc = 15, $ = class e extends Ye {
12368
12467
  async changeOptions(e) {
12369
12468
  if (this._signaling.ready && this._conversation) {
12370
12469
  this._checkAdminRole(), await this._signaling.changeOptions(e);
12371
- let t = Co(this._conversation.options, e);
12470
+ let t = wo(this._conversation.options, e);
12372
12471
  this._onOptionsChanged(t);
12373
12472
  }
12374
12473
  }
12375
12474
  async getWaitingHall(e, t, n) {
12376
12475
  if (!this._signaling) return Promise.reject();
12377
12476
  let r = null;
12378
- if (e && (r = Po(e), r)) {
12477
+ if (e && (r = Fo(e), r)) {
12379
12478
  let e = this._api.getDecorativeIdByInitialId(r.id);
12380
12479
  r.id = e ?? r.id;
12381
12480
  }
12382
12481
  let i = await this._signaling.getWaitingHall(r, t, n);
12383
12482
  if (i.error) return Promise.reject(i.message);
12384
12483
  let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
12385
- return a.length && i.hasMore && (s = No(a[a.length - 1].id)), {
12484
+ return a.length && i.hasMore && (s = Po(a[a.length - 1].id)), {
12386
12485
  participants: o,
12387
12486
  pageMarker: s,
12388
12487
  totalCount: i.totalCount || 0
@@ -12416,7 +12515,7 @@ var Mc = 15, $ = class e extends Ye {
12416
12515
  }
12417
12516
  async promoteParticipant(e, t) {
12418
12517
  if (this._signaling && this._conversation) try {
12419
- if (!M.includesOneOf(this._conversation.options, [xo.WAITING_HALL, xo.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
12518
+ if (!M.includesOneOf(this._conversation.options, [So.WAITING_HALL, So.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
12420
12519
  if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
12421
12520
  await this._signaling.promoteParticipant(e, t);
12422
12521
  } catch (t) {
@@ -12560,24 +12659,7 @@ var Mc = 15, $ = class e extends Ye {
12560
12659
  async getParticipants(e) {
12561
12660
  let t = this._convertExternalIdsToServerExternalIds(e.externalIds), n = await this._signaling.getParticipants(t);
12562
12661
  if (n.error) throw Error(n.error);
12563
- let r = n.participants, i = this._transport?.getState();
12564
- return M.mapSharedParticipants(r.map((e) => {
12565
- let t = M.composeId(e);
12566
- return this._createParticipant({
12567
- id: t,
12568
- externalId: Z.fromSignalingParticipant(e, !0, !0),
12569
- mediaSettings: D(e.mediaSettings),
12570
- participantState: M.mapParticipantState(e),
12571
- state: e.state,
12572
- roles: e.roles || [],
12573
- connectionStatus: this._buildConnectionStatus(t, e.sessionState, i, e.onHold),
12574
- isOnHold: !!e.onHold,
12575
- muteStates: e.muteStates || {},
12576
- unmuteOptions: e.unmuteOptions || [],
12577
- observedIds: e.observedIds || [],
12578
- markers: this._denormalizeMarkers(t, e.markers)
12579
- }, M.composeDecorativeId(e));
12580
- }));
12662
+ return this._participantsToExternal(n.participants);
12581
12663
  }
12582
12664
  async getParticipantListChunk(e) {
12583
12665
  this._debug.log("Request participant list chunk", e);
@@ -12588,7 +12670,7 @@ var Mc = 15, $ = class e extends Ye {
12588
12670
  let a = this._transport?.getState();
12589
12671
  return n.participants.forEach((e) => {
12590
12672
  let t = M.composeId(e), n = r[t];
12591
- this._updateParticipantExternalId(n, Z.fromSignalingParticipant(e, !0, !0)), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, jo.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, D(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
12673
+ this._updateParticipantExternalId(n, Z.fromSignalingParticipant(e, !0, !0)), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, Mo.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, D(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
12592
12674
  }), this._participantListChunkToExternalChunk(n);
12593
12675
  }
12594
12676
  async _getInitialParticiapntListChunk() {
@@ -12602,7 +12684,7 @@ var Mc = 15, $ = class e extends Ye {
12602
12684
  _onLocalMediaStreamChanged(e) {
12603
12685
  if (!this._mediaSource) return;
12604
12686
  let t = this._mediaSource.mediaSettings;
12605
- this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Go(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), e.kind === A.video && !this._requestingLocalMedia && this._state !== "CLOSE" && R.onLocalStream(this._mediaSource.getStream(), t, this.id), this._conversation && !this._conversation.waitingHall && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
12687
+ this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Ko(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), e.kind === A.video && !this._requestingLocalMedia && this._state !== "CLOSE" && R.onLocalStream(this._mediaSource.getStream(), t, this.id), this._conversation && !this._conversation.waitingHall && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
12606
12688
  }
12607
12689
  _onScreenSharingStatus(e) {
12608
12690
  let t = this.mediaSettings;
@@ -12732,9 +12814,9 @@ var Mc = 15, $ = class e extends Ye {
12732
12814
  for (let n of e.conversation.participants) {
12733
12815
  let e = M.composeId(n), i = n.roles || [];
12734
12816
  if (this._isMe(e)) {
12735
- ko(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
12817
+ Ao(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
12736
12818
  this._registerParticipantLocalMuteState({
12737
- muteStates: zo(n),
12819
+ muteStates: Bo(n),
12738
12820
  unmuteOptions: n.unmuteOptions
12739
12821
  });
12740
12822
  };
@@ -12748,7 +12830,7 @@ var Mc = 15, $ = class e extends Ye {
12748
12830
  qt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
12749
12831
  let r = M.mapParticipantState(n), o = a.participantState;
12750
12832
  if (!M.isEqualParticipantState(r, o) && (await this._changeRemoteParticipantState(e, r), !this._conversation)) return;
12751
- ko(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? P.ONHOLD : P.CONNECTED));
12833
+ Ao(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? P.ONHOLD : P.CONNECTED));
12752
12834
  } else if (await this._onJoinedParticipant({
12753
12835
  participantId: n.id,
12754
12836
  participant: n,
@@ -12776,7 +12858,7 @@ var Mc = 15, $ = class e extends Ye {
12776
12858
  this._close(new k(O.ANOTHER_DEVICE), { errorText: "Call accepted on other device" });
12777
12859
  return;
12778
12860
  }
12779
- this._conversation?.direction === _o.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
12861
+ this._conversation?.direction === vo.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
12780
12862
  let r = this._getParticipant(t);
12781
12863
  if (!r) {
12782
12864
  let n = this._api.getDecorativeIdByInitialId(t);
@@ -12789,7 +12871,7 @@ var Mc = 15, $ = class e extends Ye {
12789
12871
  let t = Z.fromSignaling(e.externalId, e.deviceIdx);
12790
12872
  r.externalId = t, this._api.cacheExternalId(r.id, t);
12791
12873
  }
12792
- r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === _o.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);
12874
+ r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === vo.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);
12793
12875
  let i = Object.keys(r.muteStates);
12794
12876
  if (i.length && this._onMuteParticipant({
12795
12877
  muteStates: r.muteStates,
@@ -12801,7 +12883,7 @@ var Mc = 15, $ = class e extends Ye {
12801
12883
  this._reportMissingExternalIds([t], "ACCEPTED_CALL");
12802
12884
  return;
12803
12885
  }
12804
- R.onAcceptedCall(r.externalId, Xa.parseCapabilities(e.capabilities), this.id);
12886
+ R.onAcceptedCall(r.externalId, Za.parseCapabilities(e.capabilities), this.id);
12805
12887
  }
12806
12888
  }
12807
12889
  async _onHungup(e) {
@@ -12838,7 +12920,7 @@ var Mc = 15, $ = class e extends Ye {
12838
12920
  return;
12839
12921
  }
12840
12922
  if (e.connected) {
12841
- let e = jo.fromTransportState(this._transport?.getState());
12923
+ let e = Mo.fromTransportState(this._transport?.getState());
12842
12924
  e && this._setTransportStatus(n, e);
12843
12925
  }
12844
12926
  this._setSessionState(n, { connected: e.connected });
@@ -12914,7 +12996,7 @@ var Mc = 15, $ = class e extends Ye {
12914
12996
  isOnHold: !!r.onHold
12915
12997
  }, i), n = this._getParticipant(t);
12916
12998
  }
12917
- this._conversation && this._conversation.direction === _o.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = D(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], P.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.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)), R.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
12999
+ this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = D(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], P.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.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)), R.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
12918
13000
  let i = Object.keys(n.muteStates);
12919
13001
  i.length && this._onMuteParticipant({
12920
13002
  muteStates: n.muteStates,
@@ -13105,15 +13187,15 @@ var Mc = 15, $ = class e extends Ye {
13105
13187
  R.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
13106
13188
  }
13107
13189
  async _onRolesChanged(e, t) {
13108
- if (this._conversation && this._isMe(e) && !ko(this._conversation.roles, t)) {
13190
+ if (this._conversation && this._isMe(e) && !Ao(this._conversation.roles, t)) {
13109
13191
  this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, R.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
13110
- mediaOptions: Fo(this._getMuteStatesForCurrentRoom(), wo.MUTE_PERMANENT),
13192
+ mediaOptions: Io(this._getMuteStatesForCurrentRoom(), To.MUTE_PERMANENT),
13111
13193
  stateUpdated: !0
13112
- }), M.includesOneOf(t, [Oo.ADMIN, Oo.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
13194
+ }), M.includesOneOf(t, [ko.ADMIN, ko.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
13113
13195
  return;
13114
13196
  }
13115
13197
  let n = this._getParticipant(e);
13116
- n && !ko(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
13198
+ n && !Ao(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
13117
13199
  }
13118
13200
  async _onMuteParticipant(e, t = !1) {
13119
13201
  if (!this._conversation) return;
@@ -13162,7 +13244,7 @@ var Mc = 15, $ = class e extends Ye {
13162
13244
  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);
13163
13245
  for (let [e, i] of d) {
13164
13246
  let a = this._isCallAdmin() && n;
13165
- if (!(i !== wo.MUTE && i !== wo.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === wo.MUTE_PERMANENT && !n && (l[e] = wo.MUTE), !(!t.includes(e) || r))) switch (e) {
13247
+ if (!(i !== To.MUTE && i !== To.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === To.MUTE_PERMANENT && !n && (l[e] = To.MUTE), !(!t.includes(e) || r))) switch (e) {
13166
13248
  case b.VIDEO:
13167
13249
  u.isVideoEnabled && (R.onDeviceSwitched(b.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
13168
13250
  break;
@@ -13199,7 +13281,7 @@ var Mc = 15, $ = class e extends Ye {
13199
13281
  this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
13200
13282
  }
13201
13283
  _onOptionsChanged(e) {
13202
- this._conversation && !So(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(xo.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(xo.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
13284
+ this._conversation && !Co(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(So.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(So.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
13203
13285
  }
13204
13286
  async _onNetworkStatus(e) {
13205
13287
  if (this._conversation) {
@@ -13254,7 +13336,7 @@ var Mc = 15, $ = class e extends Ye {
13254
13336
  }
13255
13337
  _changeFeatureSet() {
13256
13338
  if (this._conversation) {
13257
- let e = this._state === "ACTIVE", t = this._conversation.features.includes(bo.ADD_PARTICIPANT);
13339
+ let e = this._state === "ACTIVE", t = this._conversation.features.includes(xo.ADD_PARTICIPANT);
13258
13340
  R.onCallState(e, t, this._conversation, this.id);
13259
13341
  }
13260
13342
  }
@@ -13288,7 +13370,7 @@ var Mc = 15, $ = class e extends Ye {
13288
13370
  let n = this._getParticipant(e);
13289
13371
  if (n) {
13290
13372
  if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
13291
- let e = jo.fromTransportState(this._transport?.getState());
13373
+ let e = Mo.fromTransportState(this._transport?.getState());
13292
13374
  e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
13293
13375
  let t = this._setTransportStatus(n, n.connectionStatus.transport);
13294
13376
  this._emitParticipantTransition(n, t);
@@ -13298,7 +13380,7 @@ var Mc = 15, $ = class e extends Ye {
13298
13380
  }
13299
13381
  async _onTransportStateChanged(e, t) {
13300
13382
  this._debug.debug(`Transport state has changed: ${t}`, e);
13301
- let n = jo.fromTransportState(t);
13383
+ let n = Mo.fromTransportState(t);
13302
13384
  if (!n) return;
13303
13385
  let r = this._participants, i = [], a = e.reduce((e, n) => {
13304
13386
  if (n in r) {
@@ -13376,7 +13458,7 @@ var Mc = 15, $ = class e extends Ye {
13376
13458
  if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
13377
13459
  this._conversation.topology = e;
13378
13460
  for (let e of Object.values(this._participants)) {
13379
- let t = jo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
13461
+ let t = Mo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
13380
13462
  this._emitParticipantTransition(e, t);
13381
13463
  }
13382
13464
  this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
@@ -13432,7 +13514,7 @@ var Mc = 15, $ = class e extends Ye {
13432
13514
  ].includes(t) ? null : this._setTransportStatus(e, t), n);
13433
13515
  }
13434
13516
  _setParticipantsStalled(e, t) {
13435
- this._updateParticipantsStatus(e, (e) => jo.setStalled(e.connectionStatus, t));
13517
+ this._updateParticipantsStatus(e, (e) => Mo.setStalled(e.connectionStatus, t));
13436
13518
  }
13437
13519
  _updateParticipantsStatus(e, t, n = null) {
13438
13520
  let r = e.reduce((e, n) => {
@@ -13451,7 +13533,7 @@ var Mc = 15, $ = class e extends Ye {
13451
13533
  _onRoomsUpdated(e) {
13452
13534
  if (this._isCalledState()) return;
13453
13535
  let t = {}, n = [], r = [];
13454
- for (let i of Object.keys(To)) {
13536
+ for (let i of Object.keys(Eo)) {
13455
13537
  let a = e.updates[i];
13456
13538
  a && (a?.rooms?.forEach((e) => {
13457
13539
  let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
@@ -13466,7 +13548,7 @@ var Mc = 15, $ = class e extends Ye {
13466
13548
  }
13467
13549
  _onRoomUpdated(e) {
13468
13550
  let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
13469
- e.events.some((e) => e === To.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() || (this._reportMissingExternalIds(n, "ROOM_UPDATED"), R.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id));
13551
+ e.events.some((e) => e === Eo.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() || (this._reportMissingExternalIds(n, "ROOM_UPDATED"), R.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id));
13470
13552
  }
13471
13553
  _convertRoomToExternal(e) {
13472
13554
  if (!e) return {
@@ -13577,7 +13659,7 @@ var Mc = 15, $ = class e extends Ye {
13577
13659
  n && r.push(n);
13578
13660
  }
13579
13661
  }
13580
- r.length && !this._isCalledState() && R.onRoomsUpdated({ [To.UPDATE]: { rooms: r } }, this.id);
13662
+ r.length && !this._isCalledState() && R.onRoomsUpdated({ [Eo.UPDATE]: { rooms: r } }, this.id);
13581
13663
  }
13582
13664
  _onFeedback(e) {
13583
13665
  let t = [];
@@ -13656,11 +13738,11 @@ var Mc = 15, $ = class e extends Ye {
13656
13738
  _getParticipant(e) {
13657
13739
  return this._participants[e];
13658
13740
  }
13659
- }, Nc = class e extends Error {
13741
+ }, Pc = class e extends Error {
13660
13742
  constructor(t, n) {
13661
13743
  super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
13662
13744
  }
13663
- }, Pc = class {
13745
+ }, Fc = class {
13664
13746
  constructor() {
13665
13747
  h(this, "_abortSignal", void 0), h(this, "_apiCallStats", null);
13666
13748
  }
@@ -13705,14 +13787,14 @@ var Mc = 15, $ = class e extends Ye {
13705
13787
  async getInbounds() {
13706
13788
  return [];
13707
13789
  }
13708
- }, Fc = class e {
13790
+ }, Ic = class e {
13709
13791
  constructor() {
13710
13792
  h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
13711
13793
  }
13712
13794
  static _normalizeType(e) {
13713
- return e.type === Mo.GROUP ? {
13795
+ return e.type === No.GROUP ? {
13714
13796
  ...e,
13715
- type: Mo.USER
13797
+ type: No.USER
13716
13798
  } : e;
13717
13799
  }
13718
13800
  getExternalId(e) {
@@ -13740,27 +13822,27 @@ var Mc = 15, $ = class e extends Ye {
13740
13822
  clear() {
13741
13823
  this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
13742
13824
  }
13743
- }, Ic = "anonymLogin:", Lc = 700, Rc = 3e3;
13744
- function zc(e) {
13825
+ }, Lc = "anonymLogin:", Rc = 700, zc = 3e3;
13826
+ function Bc(e) {
13745
13827
  let t = e.error_code;
13746
13828
  switch (t) {
13747
- case 2: return Bc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
13748
- case 4: return e.error_msg.includes("participants.limit.exceeded") ? Bc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Bc(y.API, t, "request-error");
13749
- case 300: return Bc(O.NOT_FOUND, t, "not-found");
13750
- case 1101: return Bc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
13751
- case 1102: return Bc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
13752
- case 1103: return Bc(O.NOT_FRIENDS, t, "friendship-required");
13753
- case 1104: return Hc(t, "youla-api-error");
13754
- case 1106: return Hc(t, "vk-api-error");
13755
- case 1113: return Bc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
13829
+ case 2: return Vc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
13830
+ case 4: return e.error_msg.includes("participants.limit.exceeded") ? Vc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Vc(y.API, t, "request-error");
13831
+ case 300: return Vc(O.NOT_FOUND, t, "not-found");
13832
+ case 1101: return Vc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
13833
+ case 1102: return Vc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
13834
+ case 1103: return Vc(O.NOT_FRIENDS, t, "friendship-required");
13835
+ case 1104: return Uc(t, "youla-api-error");
13836
+ case 1106: return Uc(t, "vk-api-error");
13837
+ case 1113: return Vc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
13756
13838
  case 1114: {
13757
13839
  let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
13758
- return Bc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
13840
+ return Vc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
13759
13841
  }
13760
- default: return Bc(y.API, t, "api-error");
13842
+ default: return Vc(y.API, t, "api-error");
13761
13843
  }
13762
13844
  }
13763
- function Bc(e, t, n, r) {
13845
+ function Vc(e, t, n, r) {
13764
13846
  return {
13765
13847
  type: e,
13766
13848
  callError: {
@@ -13772,10 +13854,10 @@ function Bc(e, t, n, r) {
13772
13854
  message: r
13773
13855
  };
13774
13856
  }
13775
- function Vc(e) {
13857
+ function Hc(e) {
13776
13858
  return e?.error_code === void 0 ? e instanceof k && e.callError && "code" in e.callError ? String(e.callError.code) : e instanceof Error ? e.name : "network" : String(e.error_code);
13777
13859
  }
13778
- function Hc(e, t) {
13860
+ function Uc(e, t) {
13779
13861
  return {
13780
13862
  type: O.EXTERNAL_API_ERROR,
13781
13863
  callError: {
@@ -13786,21 +13868,21 @@ function Hc(e, t) {
13786
13868
  }
13787
13869
  };
13788
13870
  }
13789
- var Uc = class extends Pc {
13871
+ var Wc = class extends Fc {
13790
13872
  constructor() {
13791
- super(), h(this, "_uuid", void 0), h(this, "_idCache", new Fc()), this._cacheSelfExternalId();
13873
+ super(), h(this, "_uuid", void 0), h(this, "_idCache", new Ic()), this._cacheSelfExternalId();
13792
13874
  }
13793
13875
  async _callUnsafe(e, t = {}, n = !1) {
13794
13876
  let r = async (i) => {
13795
13877
  let a = performance.now();
13796
13878
  try {
13797
- let r = await As(e, t, n);
13879
+ let r = await js(e, t, n);
13798
13880
  return this._apiCallStats?.log(e, performance.now() - a), r;
13799
13881
  } catch (t) {
13800
- if (this._apiCallStats?.log(e, performance.now() - a, Vc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
13882
+ if (this._apiCallStats?.log(e, performance.now() - a, Hc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
13801
13883
  i++;
13802
13884
  let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
13803
- if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * Lc, Rc), { signal: this._abortSignal }), r(i);
13885
+ if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * Rc, zc), { signal: this._abortSignal }), r(i);
13804
13886
  }
13805
13887
  throw z.warn(e, "error", t), t;
13806
13888
  }
@@ -13812,13 +13894,13 @@ var Uc = class extends Pc {
13812
13894
  return await this._callUnsafe(e, t, n);
13813
13895
  } catch (i) {
13814
13896
  if (z.warn("Api call error", i), i instanceof k) throw i;
13815
- if (fs(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
13897
+ if (ps(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
13816
13898
  let a = {
13817
13899
  message: i?.error_msg,
13818
13900
  code: i?.error_code
13819
13901
  };
13820
- if (i.custom_error && (a.custom_error = i.custom_error), Wc(i)) {
13821
- let e = zc(i);
13902
+ if (i.custom_error && (a.custom_error = i.custom_error), Gc(i)) {
13903
+ let e = Bc(i);
13822
13904
  throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
13823
13905
  }
13824
13906
  throw new k(y.API, a);
@@ -13848,7 +13930,7 @@ var Uc = class extends Pc {
13848
13930
  return this._anonymLogin(N.authToken).then((e) => {
13849
13931
  this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
13850
13932
  }).catch((e) => {
13851
- throw e instanceof k ? e : (e?.error_code === ds.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(y.AUTH, {
13933
+ throw e instanceof k ? e : (e?.error_code === fs.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(y.AUTH, {
13852
13934
  message: e?.error_msg,
13853
13935
  code: e?.error_code,
13854
13936
  callError: {
@@ -13870,22 +13952,22 @@ var Uc = class extends Pc {
13870
13952
  return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
13871
13953
  }
13872
13954
  _getAnonymLoginCacheKey() {
13873
- return N.authToken ? `${Ic}${N.authToken}` : null;
13955
+ return N.authToken ? `${Lc}${N.authToken}` : null;
13874
13956
  }
13875
13957
  _getCachedAnonymLogin() {
13876
13958
  let e = this._getAnonymLoginCacheKey();
13877
13959
  if (!e) return null;
13878
13960
  let t = ht.get(e);
13879
- return qc(t) ? t : (t && ht.remove(e), null);
13961
+ return Jc(t) ? t : (t && ht.remove(e), null);
13880
13962
  }
13881
13963
  _setCachedAnonymLogin(e) {
13882
13964
  let t = this._getAnonymLoginCacheKey();
13883
- if (!t || !Gc(e)) return;
13965
+ if (!t || !Kc(e)) return;
13884
13966
  let n = {
13885
13967
  session_key: e.session_key,
13886
13968
  session_secret_key: e.session_secret_key,
13887
13969
  uid: e.uid,
13888
- external_user_id: Kc(e)
13970
+ external_user_id: qc(e)
13889
13971
  };
13890
13972
  ht.set(t, n);
13891
13973
  }
@@ -13898,13 +13980,13 @@ var Uc = class extends Pc {
13898
13980
  }
13899
13981
  _applyAnonymLogin(e) {
13900
13982
  e.uid && (v.userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
13901
- let t = Kc(e);
13983
+ let t = qc(e);
13902
13984
  v.selfExternalId = e.uid && t !== null ? {
13903
13985
  participantId: M.composeParticipantId(Number(e.uid), j.USER, 0),
13904
- externalId: Z.fromId(t, Mo.USER, 0)
13905
- } : null, this._cacheSelfExternalId(), N.statQueueEnabled && e.uid && Rs.remember(Number(e.uid), {
13986
+ externalId: Z.fromId(t, No.USER, 0)
13987
+ } : null, this._cacheSelfExternalId(), N.statQueueEnabled && e.uid && zs.remember(Number(e.uid), {
13906
13988
  sessionKey: e.session_key,
13907
- endpoint: Rs.currentEndpoint()
13989
+ endpoint: zs.currentEndpoint()
13908
13990
  });
13909
13991
  }
13910
13992
  _cacheSelfExternalId() {
@@ -13927,7 +14009,7 @@ var Uc = class extends Pc {
13927
14009
  });
13928
14010
  }
13929
14011
  async _sendClientStatsWith(e, t) {
13930
- let n = await As("vchat.clientStats", {
14012
+ let n = await js("vchat.clientStats", {
13931
14013
  ...t,
13932
14014
  session_key: e
13933
14015
  }, !0);
@@ -13935,10 +14017,10 @@ var Uc = class extends Pc {
13935
14017
  }
13936
14018
  async _sendClientStats(e, t, n = !0) {
13937
14019
  try {
13938
- let n = t ? await js("vchat.clientStats", e) : await As("vchat.clientStats", e);
14020
+ let n = t ? await Ms("vchat.clientStats", e) : await js("vchat.clientStats", e);
13939
14021
  this._reportClientStatsItemErrors(n);
13940
14022
  } catch (r) {
13941
- if (!n || !fs(r?.error_code)) throw r;
14023
+ if (!n || !ps(r?.error_code)) throw r;
13942
14024
  await this._reauthorize(), await this._sendClientStats(e, t, !1);
13943
14025
  }
13944
14026
  }
@@ -13962,14 +14044,14 @@ var Uc = class extends Pc {
13962
14044
  }, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
13963
14045
  o.append("file", s, "log.json");
13964
14046
  let c = new URL(a.upload_url);
13965
- return c.searchParams.append("size", s.size.toString()), Ps(c.toString(), o);
14047
+ return c.searchParams.append("size", s.size.toString()), Fs(c.toString(), o);
13966
14048
  }
13967
14049
  async joinConversation(e, t = !1, n) {
13968
14050
  let r = {
13969
14051
  conversationId: e,
13970
14052
  isVideo: t,
13971
14053
  protocolVersion: N.protocolVersion,
13972
- capabilities: Xa.getFlags()
14054
+ capabilities: Za.getFlags()
13973
14055
  };
13974
14056
  return n && (r.chatId = n), this._call("vchat.joinConversation", r);
13975
14057
  }
@@ -14001,13 +14083,13 @@ var Uc = class extends Pc {
14001
14083
  externalIds: l
14002
14084
  });
14003
14085
  if (t && t.length) switch (n) {
14004
- case vo.USER:
14086
+ case yo.USER:
14005
14087
  u.uids = t.join(",");
14006
14088
  break;
14007
- case vo.GROUP:
14089
+ case yo.GROUP:
14008
14090
  u.gid = t[0];
14009
14091
  break;
14010
- case vo.CHAT:
14092
+ case yo.CHAT:
14011
14093
  u.chatId = t[0];
14012
14094
  break;
14013
14095
  }
@@ -14050,7 +14132,7 @@ var Uc = class extends Pc {
14050
14132
  joinLink: e,
14051
14133
  isVideo: t,
14052
14134
  protocolVersion: N.protocolVersion,
14053
- capabilities: Xa.getFlags()
14135
+ capabilities: Za.getFlags()
14054
14136
  };
14055
14137
  return n?.length && (i.observedIds = n.join(",")), N.anonymToken && (i.anonymToken = N.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
14056
14138
  }
@@ -14080,9 +14162,9 @@ var Uc = class extends Pc {
14080
14162
  return v.userId;
14081
14163
  }
14082
14164
  setUserId(e) {
14083
- v.userId = e, N.statQueueEnabled && v.sessionKey && Rs.remember(Number(e), {
14165
+ v.userId = e, N.statQueueEnabled && v.sessionKey && zs.remember(Number(e), {
14084
14166
  sessionKey: v.sessionKey,
14085
- endpoint: Rs.currentEndpoint()
14167
+ endpoint: zs.currentEndpoint()
14086
14168
  });
14087
14169
  }
14088
14170
  hangupConversation(e, t = O.HUNGUP, n) {
@@ -14090,7 +14172,7 @@ var Uc = class extends Pc {
14090
14172
  conversationId: e,
14091
14173
  reason: t
14092
14174
  };
14093
- N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), ks("vchat.hangupConversation", r);
14175
+ N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), As("vchat.hangupConversation", r);
14094
14176
  }
14095
14177
  async removeHistoryRecords(e) {
14096
14178
  await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
@@ -14106,26 +14188,26 @@ var Uc = class extends Pc {
14106
14188
  return Array.isArray(e?.inbounds) ? e.inbounds : [];
14107
14189
  }
14108
14190
  };
14109
- function Wc(e) {
14191
+ function Gc(e) {
14110
14192
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
14111
14193
  }
14112
- function Gc(e) {
14194
+ function Kc(e) {
14113
14195
  return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
14114
14196
  }
14115
- function Kc(e) {
14197
+ function qc(e) {
14116
14198
  let t = e?.external_user_id;
14117
14199
  return typeof t == "string" && t.length > 0 ? t : null;
14118
14200
  }
14119
- function qc(e) {
14120
- return Gc(e) && "external_user_id" in e && (typeof e.external_user_id == "string" || e.external_user_id === null);
14201
+ function Jc(e) {
14202
+ return Kc(e) && "external_user_id" in e && (typeof e.external_user_id == "string" || e.external_user_id === null);
14121
14203
  }
14122
14204
  //#endregion
14123
14205
  //#region src/enums/RecordRole.ts
14124
- var Jc = /* @__PURE__ */ function(e) {
14206
+ var Yc = /* @__PURE__ */ function(e) {
14125
14207
  return e.KING = "KING", e.PAWN = "PAWN", e;
14126
- }(Jc || {}), Yc = /* @__PURE__ */ function(e) {
14208
+ }(Yc || {}), Xc = /* @__PURE__ */ function(e) {
14127
14209
  return e.OFF = "0", e.ON = "1", e;
14128
- }({}), Xc = class {
14210
+ }({}), Zc = class {
14129
14211
  constructor(e) {
14130
14212
  h(this, "_queue", void 0), h(this, "_readCursor", void 0), h(this, "_writeCursor", void 0), h(this, "_moveReadCursor", void 0), h(this, "_left", void 0), this._queue = Array(e).fill(null), this._readCursor = this._writeCursor = this._left = 0, this._moveReadCursor = !1;
14131
14213
  }
@@ -14148,12 +14230,12 @@ var Jc = /* @__PURE__ */ function(e) {
14148
14230
  let e = this._queue[this._readCursor];
14149
14231
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
14150
14232
  }
14151
- }, Zc = class {
14233
+ }, Qc = class {
14152
14234
  constructor(e, t, n, r = null) {
14153
14235
  h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
14154
14236
  }
14155
14237
  async authorize() {
14156
- let e = await As("auth.anonymLogin", {
14238
+ let e = await js("auth.anonymLogin", {
14157
14239
  session_data: {
14158
14240
  device_id: this._uuid,
14159
14241
  client_version: N.apiClientVersion,
@@ -14162,7 +14244,7 @@ var Jc = /* @__PURE__ */ function(e) {
14162
14244
  version: 3
14163
14245
  },
14164
14246
  application_key: this._apiKey
14165
- }, !0, await Ds(this._baseApiUrl, this._apiEnv));
14247
+ }, !0, await Os(this._baseApiUrl, this._apiEnv));
14166
14248
  return M.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
14167
14249
  }
14168
14250
  async hangupConversation(e, t) {
@@ -14172,9 +14254,9 @@ var Jc = /* @__PURE__ */ function(e) {
14172
14254
  application_key: this._apiKey,
14173
14255
  session_key: this._sessionKey
14174
14256
  };
14175
- t?.peerId && (n.peerId = t.peerId), await As("vchat.hangupConversation", n, !0, await Ds(this._baseApiUrl, this._apiEnv));
14257
+ t?.peerId && (n.peerId = t.peerId), await js("vchat.hangupConversation", n, !0, await Os(this._baseApiUrl, this._apiEnv));
14176
14258
  }
14177
- }, Qc, $c = null, el = !1, tl = {
14259
+ }, $c, el = null, tl = !1, nl = {
14178
14260
  getCameras: E.getCameras,
14179
14261
  getMicrophones: E.getMicrophones,
14180
14262
  getOutput: E.getOutput,
@@ -14202,27 +14284,27 @@ var Jc = /* @__PURE__ */ function(e) {
14202
14284
  baseChromeVersion: C.baseChromeVersion,
14203
14285
  getAudioContext: E.getAudioContext,
14204
14286
  isAudioShareSupported: C.isAudioShareSupported
14205
- }, nl = { participantMarkerCompare: M.participantMarkerCompare };
14206
- function rl(e) {
14207
- $c = e;
14208
- }
14287
+ }, rl = { participantMarkerCompare: M.participantMarkerCompare };
14209
14288
  function il(e) {
14210
- N.videoEffects = e;
14289
+ el = e;
14211
14290
  }
14212
14291
  function al(e) {
14292
+ N.videoEffects = e;
14293
+ }
14294
+ function ol(e) {
14213
14295
  N.audioEffects = e;
14214
14296
  }
14215
- function ol(e, t = {}) {
14297
+ function sl(e, t = {}) {
14216
14298
  N.vad = e, N.vadOptions = t;
14217
14299
  }
14218
- function sl(e, t = null, n = {}, r = 1) {
14300
+ function cl(e, t = null, n = {}, r = 1) {
14219
14301
  N.vmoji = e, N.vmojiOptions = {
14220
14302
  protocolVersion: r,
14221
14303
  renderingOptions: n
14222
14304
  }, t && e.setSDK(t);
14223
14305
  }
14224
- async function cl(t) {
14225
- N.set(t), Qc || (Qc = new Uc()), N.statQueueEnabled && (Bs.setApi(Qc), N.autoStartStats && hl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
14306
+ async function ll(t) {
14307
+ N.set(t), $c || ($c = new Wc()), N.statQueueEnabled && (Vs.setApi($c), N.autoStartStats && gl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
14226
14308
  let n = C.getBrowserSupportFailure();
14227
14309
  if (n) throw new k(y.UNSUPPORTED, { callError: {
14228
14310
  scope: "internal",
@@ -14231,19 +14313,19 @@ async function cl(t) {
14231
14313
  } });
14232
14314
  z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${E.hasCameraPermission()}, Mic: ${E.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
14233
14315
  }
14234
- async function ll(e, t = [b.AUDIO], n = "", r = !1, i = !1, a, o, s) {
14316
+ async function ul(e, t = [b.AUDIO], n = "", r = !1, i = !1, a, o, s) {
14235
14317
  let c = [];
14236
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), dl([], vo.USER, t, n, r, i, a, c, o, s);
14318
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), fl([], yo.USER, t, n, r, i, a, c, o, s);
14237
14319
  }
14238
- function ul(e, t = []) {
14320
+ function dl(e, t = []) {
14239
14321
  let n = e.getIncomingCallerExternalId();
14240
14322
  return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
14241
14323
  }
14242
- async function dl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
14324
+ async function fl(e, t = yo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
14243
14325
  if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
14244
14326
  let u = B.getAll().find((e) => e.isIncomingRinging);
14245
- if (!N.hold && u && !ul(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
14246
- return new $(new Uc(), $c).onStart({
14327
+ if (!N.hold && u && !dl(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
14328
+ return new $(new Wc(), el).onStart({
14247
14329
  opponentIds: e,
14248
14330
  opponentType: t,
14249
14331
  mediaOptions: n,
@@ -14256,49 +14338,49 @@ async function dl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
14256
14338
  conversationId: l
14257
14339
  });
14258
14340
  }
14259
- async function fl(e, t) {
14260
- return pl(e, j.USER, void 0, t);
14341
+ async function pl(e, t) {
14342
+ return ml(e, j.USER, void 0, t);
14261
14343
  }
14262
- async function pl(e, t = j.USER, n, r, i, a) {
14344
+ async function ml(e, t = j.USER, n, r, i, a) {
14263
14345
  if (e === $.id()) throw Error("Push has already been processed");
14264
- return new $(new Uc(), $c).onPush(e, t, n, r, i, a);
14346
+ return new $(new Wc(), el).onPush(e, t, n, r, i, a);
14265
14347
  }
14266
- async function ml() {
14267
- return Qc.getInbounds();
14348
+ async function hl() {
14349
+ return $c.getInbounds();
14268
14350
  }
14269
- function hl() {
14351
+ function gl() {
14270
14352
  if (N.statQueueEnabled) {
14271
- if (!Qc) {
14353
+ if (!$c) {
14272
14354
  z.error("[CallsSDK] startStats() called before init()");
14273
14355
  return;
14274
14356
  }
14275
- el || (el = !0, Xs.start(Qc));
14357
+ tl || (tl = !0, Zs.start($c));
14276
14358
  }
14277
14359
  }
14278
- async function gl(e, t) {
14279
- return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Ts()), Qc.authorize();
14360
+ async function _l(e, t) {
14361
+ return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Es()), $c.authorize();
14280
14362
  }
14281
- async function _l(e = [b.AUDIO], t) {
14282
- return Hu(t).accept(e);
14363
+ async function vl(e = [b.AUDIO], t) {
14364
+ return Uu(t).accept(e);
14283
14365
  }
14284
- async function vl(e) {
14285
- let t = zu(e?.conversationId);
14366
+ async function yl(e) {
14367
+ let t = Bu(e?.conversationId);
14286
14368
  if (t) return t.decline(e);
14287
14369
  }
14288
- async function yl(e, t = [b.AUDIO]) {
14289
- return bl(e, t);
14370
+ async function bl(e, t = [b.AUDIO]) {
14371
+ return xl(e, t);
14290
14372
  }
14291
- async function bl(e, t, n) {
14373
+ async function xl(e, t, n) {
14292
14374
  if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
14293
- return new $(new Uc(), $c).onJoin({
14375
+ return new $(new Wc(), el).onJoin({
14294
14376
  conversationId: e,
14295
14377
  mediaOptions: t,
14296
14378
  chatId: n
14297
14379
  });
14298
14380
  }
14299
- async function xl(e, t = [b.AUDIO], n, r, i, a) {
14381
+ async function Sl(e, t = [b.AUDIO], n, r, i, a) {
14300
14382
  if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
14301
- return n && (N.anonymToken = n), new $(new Uc(), $c).onJoin({
14383
+ return n && (N.anonymToken = n), new $(new Wc(), el).onJoin({
14302
14384
  joinLink: e,
14303
14385
  mediaOptions: t,
14304
14386
  observedIds: r,
@@ -14307,30 +14389,30 @@ async function xl(e, t = [b.AUDIO], n, r, i, a) {
14307
14389
  anonymous: !!N.anonymToken
14308
14390
  });
14309
14391
  }
14310
- function Sl(e) {
14392
+ function Cl(e) {
14311
14393
  let t = B.getLocal(e?.conversationId);
14312
14394
  return t ? t.hangup(e) : B.getHangup(e?.conversationId) ?? Promise.resolve();
14313
14395
  }
14314
- async function Cl(e, t) {
14396
+ async function wl(e, t) {
14315
14397
  let n = Array.isArray(e) ? e : [e], r = $.current();
14316
- r && await r.addParticipant(n, t);
14398
+ if (r) return r.addParticipant(n, t);
14317
14399
  }
14318
- async function wl(e, t) {
14400
+ async function Tl(e, t) {
14319
14401
  let n = $.current();
14320
14402
  if (n) {
14321
14403
  let r = e.map((e) => M.composeUserId(e));
14322
14404
  await n.addParticipantLegacy(r, t);
14323
14405
  }
14324
14406
  }
14325
- async function Tl(e, t = !1) {
14326
- let n = Uu(e, "removeParticipant");
14407
+ async function El(e, t = !1) {
14408
+ let n = Wu(e, "removeParticipant");
14327
14409
  if (n) try {
14328
14410
  await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
14329
14411
  } catch (e) {
14330
14412
  z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
14331
14413
  }
14332
14414
  }
14333
- async function El(e, t = !1) {
14415
+ async function Dl(e, t = !1) {
14334
14416
  let n = $.current();
14335
14417
  if (n) try {
14336
14418
  await n.removeParticipant(M.composeUserId(e), t);
@@ -14338,13 +14420,13 @@ async function El(e, t = !1) {
14338
14420
  z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
14339
14421
  }
14340
14422
  }
14341
- async function Dl(e, t) {
14423
+ async function Ol(e, t) {
14342
14424
  let n = $.current();
14343
14425
  if (e === "videoinput" && It.contains(t)) return N.videoFacingMode = t, n ? (C.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
14344
14426
  if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
14345
14427
  if (n) return n.changeDevice(e);
14346
14428
  }
14347
- async function Ol(e, t) {
14429
+ async function kl(e, t) {
14348
14430
  let n = typeof e == "object" ? {
14349
14431
  ...e,
14350
14432
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -14356,37 +14438,37 @@ async function Ol(e, t) {
14356
14438
  }, r = B.getLocal(t);
14357
14439
  return r ? r.toggleScreenCapturing(n) : Promise.reject();
14358
14440
  }
14359
- function kl(e) {
14441
+ function Al(e) {
14360
14442
  let t = $.current();
14361
14443
  t && t.toggleAnimojiCapturing(e);
14362
14444
  }
14363
- async function Al(e, t = !1) {
14445
+ async function jl(e, t = !1) {
14364
14446
  let n = $.current();
14365
14447
  n && await n.setVideoStream(e, t);
14366
14448
  }
14367
- async function jl(e, t) {
14449
+ async function Ml(e, t) {
14368
14450
  let n = B.getLocal(t);
14369
14451
  n && await n.toggleLocalVideo(e);
14370
14452
  }
14371
- async function Ml(e, t) {
14453
+ async function Nl(e, t) {
14372
14454
  let n = B.getLocal(t);
14373
14455
  n && await n.toggleLocalAudio(e);
14374
14456
  }
14375
- async function Nl(e) {
14457
+ async function Pl(e) {
14376
14458
  let t = $.current();
14377
14459
  if (t) return t.setLocalResolution(e);
14378
14460
  }
14379
- async function Pl(e) {
14461
+ async function Fl(e) {
14380
14462
  let t = $.current();
14381
14463
  t && await t.changePriorities(e);
14382
14464
  }
14383
- async function Fl(e, t) {
14465
+ async function Il(e, t) {
14384
14466
  let n = $.current();
14385
14467
  if (n) {
14386
14468
  if (t) {
14387
14469
  let r = n.getCachedParticipantIdByExternalId(t);
14388
14470
  if (!r) {
14389
- Bu(t, "changeParticipantState", n);
14471
+ Vu(t, "changeParticipantState", n);
14390
14472
  return;
14391
14473
  }
14392
14474
  await n.changeParticipantState(e, r);
@@ -14395,161 +14477,161 @@ async function Fl(e, t) {
14395
14477
  await n.changeParticipantState(e);
14396
14478
  }
14397
14479
  }
14398
- async function Il() {
14480
+ async function Ll() {
14399
14481
  let e = $.current();
14400
14482
  e && await e.putHandsDown();
14401
14483
  }
14402
- async function Ll(e) {
14484
+ async function Rl(e) {
14403
14485
  let t = $.current();
14404
14486
  t && await t.updateDisplayLayout(e);
14405
14487
  }
14406
- async function Rl(e) {
14488
+ async function zl(e) {
14407
14489
  let t = $.current();
14408
14490
  t && await t.requestDisplayLayout(e);
14409
14491
  }
14410
- async function zl(e, t, n = !1) {
14411
- let r = Uu(e, "grantRoles");
14492
+ async function Bl(e, t, n = !1) {
14493
+ let r = Wu(e, "grantRoles");
14412
14494
  r && await r.conversation.grantRoles(r.participantId, t, n);
14413
14495
  }
14414
- async function Bl(e, t, n, r = !1) {
14496
+ async function Vl(e, t, n, r = !1) {
14415
14497
  let i = $.current();
14416
14498
  i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
14417
14499
  }
14418
- async function Vl({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
14500
+ async function Hl({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
14419
14501
  if (e) {
14420
- let i = Uu(e, "muteParticipant");
14502
+ let i = Wu(e, "muteParticipant");
14421
14503
  return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
14422
14504
  }
14423
14505
  let i = $.current();
14424
14506
  i && await i.muteParticipant(null, t, n, r);
14425
14507
  }
14426
- async function Hl({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
14508
+ async function Ul({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
14427
14509
  let a = $.current();
14428
14510
  if (a) {
14429
14511
  let o = e ? M.composeParticipantId(e, j.USER, r) : null;
14430
14512
  await a.muteParticipant(o, t, n, i);
14431
14513
  }
14432
14514
  }
14433
- async function Ul(e, t = !1, n = null) {
14434
- let r = Uu(e, "pinParticipant");
14515
+ async function Wl(e, t = !1, n = null) {
14516
+ let r = Wu(e, "pinParticipant");
14435
14517
  r && await r.conversation.pinParticipant(r.participantId, t, n);
14436
14518
  }
14437
- async function Wl(e, t = !1, n = 0, r = null) {
14519
+ async function Gl(e, t = !1, n = 0, r = null) {
14438
14520
  let i = $.current();
14439
14521
  i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
14440
14522
  }
14441
- async function Gl(e) {
14523
+ async function Kl(e) {
14442
14524
  let t = $.current();
14443
14525
  t && await t.updateMediaModifiers(e);
14444
14526
  }
14445
- async function Kl(e) {
14527
+ async function ql(e) {
14446
14528
  let t = $.current();
14447
14529
  t && await t.enableVideoSuspend(e);
14448
14530
  }
14449
- async function ql(e) {
14531
+ async function Jl(e) {
14450
14532
  let t = $.current();
14451
14533
  t && await t.enableVideoSuspendSuggest(e);
14452
14534
  }
14453
- async function Jl(e) {
14535
+ async function Yl(e) {
14454
14536
  let t = $.current();
14455
14537
  t && await t.changeOptions(e);
14456
14538
  }
14457
- async function Yl(e, t = null) {
14539
+ async function Xl(e, t = null) {
14458
14540
  if (t) {
14459
- let n = Uu(t, "chatMessage");
14541
+ let n = Wu(t, "chatMessage");
14460
14542
  return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
14461
14543
  }
14462
14544
  let n = $.current();
14463
14545
  n && await n.chatMessage(e, null);
14464
14546
  }
14465
- async function Xl(e, t = null) {
14547
+ async function Zl(e, t = null) {
14466
14548
  let n = $.current();
14467
14549
  if (n) {
14468
14550
  let r = t ? M.composeUserId(t) : null;
14469
14551
  await n.chatMessage(e, r);
14470
14552
  }
14471
14553
  }
14472
- async function Zl(e = 10) {
14554
+ async function Ql(e = 10) {
14473
14555
  let t = $.current();
14474
14556
  if (t) return t.chatHistory(e);
14475
14557
  }
14476
- async function Ql(e, t = null) {
14558
+ async function $l(e, t = null) {
14477
14559
  if (t) {
14478
- let n = Uu(t, "customData");
14560
+ let n = Wu(t, "customData");
14479
14561
  return n ? n.conversation.customData(e, n.participantId) : void 0;
14480
14562
  }
14481
14563
  let n = $.current();
14482
14564
  n && await n.customData(e, null);
14483
14565
  }
14484
- async function $l(e, t = null, n = 0) {
14566
+ async function eu(e, t = null, n = 0) {
14485
14567
  let r = $.current();
14486
14568
  if (r) {
14487
14569
  let i = t ? M.composeParticipantId(t, j.USER, n) : null;
14488
14570
  await r.customData(e, i);
14489
14571
  }
14490
14572
  }
14491
- async function eu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
14492
- return (await Qc.createConversation(a ?? M.uuid(), e, t, {
14573
+ async function tu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
14574
+ return (await $c.createConversation(a ?? M.uuid(), e, t, {
14493
14575
  onlyAdminCanShareMovie: n,
14494
14576
  waitForAdmin: r,
14495
14577
  closedConversation: i
14496
14578
  })).join_link;
14497
14579
  }
14498
- async function tu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
14580
+ async function nu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
14499
14581
  let a = i.map((e) => Z.fromId(e));
14500
- return (await Qc.createConversation(M.uuid(), e, t, {
14582
+ return (await $c.createConversation(M.uuid(), e, t, {
14501
14583
  onlyAdminCanShareMovie: n,
14502
14584
  audienceMode: !0,
14503
14585
  audioOnly: r
14504
14586
  }, a)).join_link;
14505
14587
  }
14506
- async function nu() {
14588
+ async function ru() {
14507
14589
  let e = $.current();
14508
14590
  return e ? e.createJoinLink() : Promise.reject();
14509
14591
  }
14510
- async function ru() {
14592
+ async function iu() {
14511
14593
  let e = $.current();
14512
14594
  return e ? e.removeJoinLink() : Promise.reject();
14513
14595
  }
14514
- async function iu(e, t) {
14515
- return Qc.getAnonymTokenByLink(e, t);
14596
+ async function au(e, t) {
14597
+ return $c.getAnonymTokenByLink(e, t);
14516
14598
  }
14517
- function au(e) {
14599
+ function ou(e) {
14518
14600
  let t = $.current();
14519
14601
  t && t.setVolume(e);
14520
14602
  }
14521
- function ou(e) {
14603
+ function su(e) {
14522
14604
  N.forceRelayPolicy = e;
14523
14605
  }
14524
- async function su(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
14606
+ async function cu(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
14525
14607
  let o = $.current();
14526
14608
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
14527
14609
  }
14528
- async function cu(e = null, t) {
14610
+ async function lu(e = null, t) {
14529
14611
  let n = $.current();
14530
14612
  return n ? n.stopStream(e, t) : Promise.reject();
14531
14613
  }
14532
- async function lu(e = null) {
14614
+ async function uu(e = null) {
14533
14615
  let t = $.current();
14534
14616
  return t ? t.publishStream(e) : Promise.reject();
14535
14617
  }
14536
- async function uu() {
14618
+ async function du() {
14537
14619
  let e = $.current();
14538
14620
  return e ? e.getStreamInfo() : Promise.reject();
14539
14621
  }
14540
- async function du(e) {
14622
+ async function fu(e) {
14541
14623
  let t = $.current();
14542
14624
  return t ? t.addMovie(e) : Promise.reject();
14543
14625
  }
14544
- async function fu(e) {
14626
+ async function pu(e) {
14545
14627
  let t = $.current();
14546
14628
  return t ? t.updateMovie(e) : Promise.reject();
14547
14629
  }
14548
- async function pu(e) {
14630
+ async function mu(e) {
14549
14631
  let t = $.current();
14550
14632
  return t ? t.removeMovie(e) : Promise.reject();
14551
14633
  }
14552
- async function mu(e, t) {
14634
+ async function hu(e, t) {
14553
14635
  let n = $.current();
14554
14636
  if (n) {
14555
14637
  let r = [], i = [];
@@ -14571,46 +14653,46 @@ async function mu(e, t) {
14571
14653
  });
14572
14654
  }
14573
14655
  if (i.length) {
14574
- Vu(i, "updateRooms", n);
14656
+ Hu(i, "updateRooms", n);
14575
14657
  return;
14576
14658
  }
14577
14659
  return n.updateRooms(r, t);
14578
14660
  }
14579
14661
  return Promise.reject();
14580
14662
  }
14581
- async function hu(e, t) {
14663
+ async function gu(e, t) {
14582
14664
  let n = $.current();
14583
14665
  return n ? n.activateRooms(e, t) : Promise.reject();
14584
14666
  }
14585
- async function gu(e = null, t = null) {
14667
+ async function _u(e = null, t = null) {
14586
14668
  let n = $.current();
14587
14669
  if (!n) return Promise.reject();
14588
14670
  let r;
14589
14671
  if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
14590
- Bu(t, "switchRoom", n);
14672
+ Vu(t, "switchRoom", n);
14591
14673
  return;
14592
14674
  }
14593
14675
  return n.switchRoom(e, r);
14594
14676
  }
14595
- async function _u(e) {
14677
+ async function vu(e) {
14596
14678
  let t = $.current();
14597
14679
  return t ? t.removeRooms(e) : Promise.reject();
14598
14680
  }
14599
- function vu(e) {
14681
+ function yu(e) {
14600
14682
  N.statisticsInterval = e;
14601
14683
  let t = $.current();
14602
14684
  if (t) return t.updateStatisticsInterval();
14603
14685
  }
14604
- function yu(t) {
14686
+ function bu(t) {
14605
14687
  e.disableLog(!t), z.toggle(t);
14606
14688
  }
14607
- function bu(e, ...t) {
14689
+ function xu(e, ...t) {
14608
14690
  N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
14609
14691
  }
14610
- function xu(e, t, ...n) {
14692
+ function Su(e, t, ...n) {
14611
14693
  N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
14612
14694
  }
14613
- var Su = {
14695
+ var Cu = {
14614
14696
  list: Pe,
14615
14697
  get: Fe,
14616
14698
  getJson: Ie,
@@ -14618,7 +14700,7 @@ var Su = {
14618
14700
  clear: Re,
14619
14701
  stats: ze
14620
14702
  };
14621
- function Cu() {
14703
+ function wu() {
14622
14704
  let e = [
14623
14705
  [`Calls SDK ${N.sdkVersion}`, N.toJSON()],
14624
14706
  ["UserAgent:", navigator.userAgent],
@@ -14636,139 +14718,139 @@ function Cu() {
14636
14718
  d: e
14637
14719
  }));
14638
14720
  }
14639
- async function wu() {
14721
+ async function Tu() {
14640
14722
  let e = $.id(), t = $.debugSessionId();
14641
14723
  if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
14642
14724
  let n = await Fe({ sessionId: t });
14643
14725
  if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
14644
14726
  let r = n[0].t, i = n[n.length - 1].t;
14645
14727
  try {
14646
- return Qc?.uploadDebugLogs(e, r, i, JSON.stringify([...Cu(), ...n]));
14728
+ return $c?.uploadDebugLogs(e, r, i, JSON.stringify([...wu(), ...n]));
14647
14729
  } catch (e) {
14648
14730
  throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
14649
14731
  }
14650
14732
  }
14651
- async function Tu(e) {
14733
+ async function Eu(e) {
14652
14734
  let t = $.current();
14653
14735
  if (t) return t.videoEffect(e);
14654
14736
  }
14655
- async function Eu(e, t) {
14737
+ async function Du(e, t) {
14656
14738
  let n = $.current();
14657
14739
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
14658
14740
  }
14659
- async function Du(e) {
14741
+ async function Ou(e) {
14660
14742
  let t = $.current();
14661
14743
  t && await t.setAudioStream(e);
14662
14744
  }
14663
- async function Ou(e, t = null, n = null) {
14745
+ async function ku(e, t = null, n = null) {
14664
14746
  let r = $.current();
14665
14747
  if (!r) return;
14666
14748
  let i = n ?? t?.id, a = null;
14667
14749
  if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
14668
- Bu(t, "setVmojiSvg", r);
14750
+ Vu(t, "setVmojiSvg", r);
14669
14751
  return;
14670
14752
  }
14671
14753
  r.setAnimojiSvg(e, a, i);
14672
14754
  }
14673
- function ku(e) {
14755
+ function Au(e) {
14674
14756
  let t = $.current();
14675
14757
  t && t.setAnimojiFill(e);
14676
14758
  }
14677
- async function Au(e = null, t, n = !1) {
14678
- return Hu().getWaitingHall(e, t, n);
14759
+ async function ju(e = null, t, n = !1) {
14760
+ return Uu().getWaitingHall(e, t, n);
14679
14761
  }
14680
- async function ju() {
14681
- return Hu().getAudienceModeHands();
14762
+ async function Mu() {
14763
+ return Uu().getAudienceModeHands();
14682
14764
  }
14683
- async function Mu(e, t = !1) {
14684
- let n = Hu(), r;
14765
+ async function Nu(e, t = !1) {
14766
+ let n = Uu(), r;
14685
14767
  if (e) {
14686
14768
  let t = n.getCachedParticipantIdByExternalId(e);
14687
14769
  if (!t) {
14688
- Bu(e, "promoteParticipant", n);
14770
+ Vu(e, "promoteParticipant", n);
14689
14771
  return;
14690
14772
  }
14691
14773
  r = M.decomposeParticipantId(t).compositeUserId;
14692
14774
  }
14693
14775
  return n.promoteParticipant(r, t);
14694
14776
  }
14695
- async function Nu(e = !1) {
14696
- return Hu().requestPromotion(e);
14697
- }
14698
14777
  async function Pu(e = !1) {
14699
- return Hu().acceptPromotion(e);
14778
+ return Uu().requestPromotion(e);
14700
14779
  }
14701
- async function Fu(e) {
14702
- return Hu().getParticipantListChunk(e);
14780
+ async function Fu(e = !1) {
14781
+ return Uu().acceptPromotion(e);
14703
14782
  }
14704
14783
  async function Iu(e) {
14705
- return Hu().getParticipants(e);
14784
+ return Uu().getParticipantListChunk(e);
14706
14785
  }
14707
14786
  async function Lu(e) {
14708
- return Hu().feedback(e);
14787
+ return Uu().getParticipants(e);
14709
14788
  }
14710
- async function Ru(e, t, n) {
14711
- return Hu(n).enableFeatureForRoles(e, t);
14789
+ async function Ru(e) {
14790
+ return Uu().feedback(e);
14712
14791
  }
14713
- function zu(e) {
14792
+ async function zu(e, t, n) {
14793
+ return Uu(n).enableFeatureForRoles(e, t);
14794
+ }
14795
+ function Bu(e) {
14714
14796
  return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
14715
14797
  }
14716
- function Bu(e, t, n) {
14798
+ function Vu(e, t, n) {
14717
14799
  R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
14718
14800
  }
14719
- function Vu(e, t, n) {
14801
+ function Hu(e, t, n) {
14720
14802
  let r = Array.from(new Set(e));
14721
14803
  R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
14722
14804
  }
14723
- function Hu(e) {
14724
- let t = zu(e);
14805
+ function Uu(e) {
14806
+ let t = Bu(e);
14725
14807
  if (!t) throw Error("Conversation not found");
14726
14808
  return t;
14727
14809
  }
14728
- function Uu(e, t) {
14810
+ function Wu(e, t) {
14729
14811
  let n = $.current();
14730
14812
  if (!n) return null;
14731
14813
  let r = n.getCachedParticipantIdByExternalId(e);
14732
14814
  return r ? {
14733
14815
  conversation: n,
14734
14816
  participantId: r
14735
- } : (Bu(e, t, n), null);
14736
- }
14737
- async function Wu(e) {
14738
- await Qc.removeHistoryRecords(e);
14817
+ } : (Vu(e, t, n), null);
14739
14818
  }
14740
14819
  async function Gu(e) {
14820
+ await $c.removeHistoryRecords(e);
14821
+ }
14822
+ async function Ku(e) {
14741
14823
  let t = $.current() ?? B.getFirst();
14742
14824
  t && await t.startAsr(e);
14743
14825
  }
14744
- async function Ku(e) {
14826
+ async function qu(e) {
14745
14827
  let t = $.current() ?? B.getFirst();
14746
14828
  t && await t.stopAsr(e);
14747
14829
  }
14748
- async function qu(e) {
14830
+ async function Ju(e) {
14749
14831
  let t = $.current() ?? B.getFirst();
14750
14832
  t && await t.requestAsr(e);
14751
14833
  }
14752
- async function Ju(e) {
14834
+ async function Yu(e) {
14753
14835
  let t = $.current();
14754
14836
  return t ? t.startUrlSharing(e) : Promise.reject();
14755
14837
  }
14756
- async function Yu() {
14838
+ async function Xu() {
14757
14839
  let e = $.current();
14758
14840
  return e ? e.stopUrlSharing() : Promise.reject();
14759
14841
  }
14760
- async function Xu(e) {
14842
+ async function Zu(e) {
14761
14843
  await B.switchCall(e);
14762
14844
  }
14763
- function Zu() {
14845
+ function Qu() {
14764
14846
  return B.getActiveId();
14765
14847
  }
14766
- function Qu() {
14848
+ function $u() {
14767
14849
  return $.getSyncedTime();
14768
14850
  }
14769
- function $u() {
14851
+ function ed() {
14770
14852
  return N.sdkVersion;
14771
14853
  }
14772
14854
  typeof window < "u" && (window.__CALLS_SDK = wn);
14773
14855
  //#endregion
14774
- export { Uc as Api, Zc as ApiExternal, Xc as ArrayDequeue, v as AuthData, f as BaseLogger, _o as CallDirection, vo as CallType, yo as ChatRoomEventType, bo as ConversationFeature, xo as ConversationOption, Dn as DebugMessageType, Mo as ExternalIdType, It as FacingMode, y as FatalError, k as HangupReason, O as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, wo as MuteState, X as ParticipantState, Yc as ParticipantStateDataValue, P as ParticipantStatus, Jc as RecordRole, To as RoomsEventType, go as Signaling, V as SignalingCommandType, Cr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, Oo as UserRole, j as UserType, ts as VolumeDetector, _l as acceptCall, Pu as acceptPromotion, hu as activateRooms, du as addMovie, Cl as addParticipant, wl as addParticipantInternal, gl as authorize, tl as browser, dl as callInternal, ll as callTo, Ol as captureScreen, kl as captureVmoji, Eu as changeAudioEffect, Jl as changeConversationOptions, Dl as changeDevice, Fl as changeParticipantState, Pl as changePriorities, Tu as changeVideoEffect, Zl as chatHistory, Yl as chatMessage, Xl as chatMessageInternal, nu as createJoinLink, Ql as customData, $l as customDataInternal, yu as debug, Su as debugLogs, bu as debugMessage, xu as debugMessageWithContext, vl as declineCall, Ru as enableFeatureForRoles, Kl as enableVideoSuspend, ql as enableVideoSuspendSuggest, Lu as feedback, ou as forceRelayPolicy, Zu as getActiveCallId, iu as getAnonymTokenByLink, ju as getAudienceModeHands, ml as getInbounds, Fu as getParticipantListChunk, Iu as getParticipants, uu as getStreamInfo, Qu as getSyncedTime, Au as getWaitingHall, zl as grantRoles, Bl as grantRolesInternal, Sl as hangup, cl as init, yl as joinCall, xl as joinCallByLink, bl as joinCallInternal, Vl as muteParticipant, Hl as muteParticipantInternal, Ul as pinParticipant, Wl as pinParticipantInternal, fl as processPush, pl as processPushInternal, Mu as promoteParticipant, lu as publishStream, Il as putHandsDown, Wu as removeHistoryRecords, ru as removeJoinLink, pu as removeMovie, Tl as removeParticipant, El as removeParticipantInternal, _u as removeRooms, qu as requestAsr, Rl as requestDisplayLayout, Nu as requestPromotion, al as setAudioEffects, Du as setAudioStream, Nl as setLocalResolution, rl as setLogger, Gl as setMediaModifiers, vu as setStatisticsInterval, ol as setVad, il as setVideoEffects, Al as setVideoStream, sl as setVmoji, ku as setVmojiFill, Ou as setVmojiSvg, au as setVolume, Gu as startAsr, tu as startAudienceConversation, eu as startConversation, hl as startStats, su as startStream, Ju as startUrlSharing, Ku as stopAsr, cu as stopStream, Yu as stopUrlSharing, Xu as switchCall, gu as switchRoom, Ml as toggleLocalAudio, jl as toggleLocalVideo, Ll as updateDisplayLayout, fu as updateMovie, mu as updateRooms, wu as uploadDebugLogs, nl as utils, $u as version };
14856
+ export { Wc as Api, Qc as ApiExternal, Zc as ArrayDequeue, v as AuthData, f as BaseLogger, vo as CallDirection, yo as CallType, bo as ChatRoomEventType, xo as ConversationFeature, So as ConversationOption, Dn as DebugMessageType, No as ExternalIdType, It as FacingMode, y as FatalError, k as HangupReason, O as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, To as MuteState, X as ParticipantState, Xc as ParticipantStateDataValue, P as ParticipantStatus, Yc as RecordRole, Eo as RoomsEventType, _o as Signaling, V as SignalingCommandType, Cr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, ko as UserRole, j as UserType, ns as VolumeDetector, vl as acceptCall, Fu as acceptPromotion, gu as activateRooms, fu as addMovie, wl as addParticipant, Tl as addParticipantInternal, _l as authorize, nl as browser, fl as callInternal, ul as callTo, kl as captureScreen, Al as captureVmoji, Du as changeAudioEffect, Yl as changeConversationOptions, Ol as changeDevice, Il as changeParticipantState, Fl as changePriorities, Eu as changeVideoEffect, Ql as chatHistory, Xl as chatMessage, Zl as chatMessageInternal, ru as createJoinLink, $l as customData, eu as customDataInternal, bu as debug, Cu as debugLogs, xu as debugMessage, Su as debugMessageWithContext, yl as declineCall, zu as enableFeatureForRoles, ql as enableVideoSuspend, Jl as enableVideoSuspendSuggest, Ru as feedback, su as forceRelayPolicy, Qu as getActiveCallId, au as getAnonymTokenByLink, Mu as getAudienceModeHands, hl as getInbounds, Iu as getParticipantListChunk, Lu as getParticipants, du as getStreamInfo, $u as getSyncedTime, ju as getWaitingHall, Bl as grantRoles, Vl as grantRolesInternal, Cl as hangup, ll as init, bl as joinCall, Sl as joinCallByLink, xl as joinCallInternal, Hl as muteParticipant, Ul as muteParticipantInternal, Wl as pinParticipant, Gl as pinParticipantInternal, pl as processPush, ml as processPushInternal, Nu as promoteParticipant, uu as publishStream, Ll as putHandsDown, Gu as removeHistoryRecords, iu as removeJoinLink, mu as removeMovie, El as removeParticipant, Dl as removeParticipantInternal, vu as removeRooms, Ju as requestAsr, zl as requestDisplayLayout, Pu as requestPromotion, ol as setAudioEffects, Ou as setAudioStream, Pl as setLocalResolution, il as setLogger, Kl as setMediaModifiers, yu as setStatisticsInterval, sl as setVad, al as setVideoEffects, jl as setVideoStream, cl as setVmoji, Au as setVmojiFill, ku as setVmojiSvg, ou as setVolume, Ku as startAsr, nu as startAudienceConversation, tu as startConversation, gl as startStats, cu as startStream, Yu as startUrlSharing, qu as stopAsr, lu as stopStream, Xu as stopUrlSharing, Zu as switchCall, _u as switchRoom, Nl as toggleLocalAudio, Ml as toggleLocalVideo, Rl as updateDisplayLayout, pu as updateMovie, hu as updateRooms, Tu as uploadDebugLogs, rl as utils, ed as version };