@vkontakte/calls-sdk 2.8.13-beta.2 → 2.8.13-dev.10d918e8.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-beta.2
3
- * Mon, 21 Sep 2026 13:06:29 GMT
2
+ * @vkontakte/calls-sdk v2.8.13-dev.10d918e8.0
3
+ * Tue, 22 Sep 2026 16:57:26 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -2162,7 +2162,7 @@ var vn = _n.getInstance(), N = class e {
2162
2162
  return 1.1;
2163
2163
  }
2164
2164
  static get sdkVersion() {
2165
- return "2.8.13-beta.2";
2165
+ return "2.8.13-dev.10d918e8.0";
2166
2166
  }
2167
2167
  static get debug() {
2168
2168
  return e._params.debug;
@@ -2408,6 +2408,9 @@ var vn = _n.getInstance(), N = class e {
2408
2408
  static get transportConnectionWaitTime() {
2409
2409
  return e._params.transportConnectionWaitTime;
2410
2410
  }
2411
+ static get switchTopologyOnReconnectFromAnySide() {
2412
+ return e._params.switchTopologyOnReconnectFromAnySide;
2413
+ }
2411
2414
  static get statisticsInterval() {
2412
2415
  return e._params.statisticsInterval;
2413
2416
  }
@@ -2657,6 +2660,7 @@ h(N, "_params", {
2657
2660
  vmojiOptions: null,
2658
2661
  iceRestartWaitTime: 2e4,
2659
2662
  transportConnectionWaitTime: 5e3,
2663
+ switchTopologyOnReconnectFromAnySide: !1,
2660
2664
  statisticsInterval: 5e3,
2661
2665
  networkStatisticsInterval: 2e4,
2662
2666
  perfStatReportEnabled: !0,
@@ -3604,7 +3608,7 @@ var Ln = 0, Rn = 1, zn = 2, Bn = 3, Vn = 4, Hn = 5, Un = 6, Wn = 7, Gn = 0, Kn =
3604
3608
  };
3605
3609
  }
3606
3610
  }, U = /* @__PURE__ */ function(e) {
3607
- return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
3611
+ return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
3608
3612
  }(U || {}), $n = 1e3;
3609
3613
  function W(e, t, n = 0) {
3610
3614
  return t in e && e[t] ? e[t] : n;
@@ -3842,14 +3846,136 @@ function kr() {
3842
3846
  };
3843
3847
  }
3844
3848
  //#endregion
3849
+ //#region src/classes/stat/SdpStats.ts
3850
+ var Ar = {
3851
+ offer: U.SDP_CREATE_OFFER,
3852
+ answer: U.SDP_CREATE_ANSWER
3853
+ }, jr = {
3854
+ offer: U.SDP_SET_LOCAL_OFFER,
3855
+ pranswer: U.SDP_SET_LOCAL_PRANSWER,
3856
+ answer: U.SDP_SET_LOCAL_ANSWER,
3857
+ rollback: U.SDP_SET_LOCAL_ROLLBACK
3858
+ }, Mr = {
3859
+ offer: U.SDP_SET_REMOTE_OFFER,
3860
+ pranswer: U.SDP_SET_REMOTE_PRANSWER,
3861
+ answer: U.SDP_SET_REMOTE_ANSWER,
3862
+ rollback: U.SDP_SET_REMOTE_ROLLBACK
3863
+ }, Nr = {
3864
+ local_address: null,
3865
+ remote_address: null,
3866
+ transport: null
3867
+ }, Pr = class {
3868
+ constructor(e) {
3869
+ h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_gatheringStartedAt", 0), h(this, "_remoteSdpReceivedAt", 0), h(this, "_handleGatheringStateChange", () => {
3870
+ this._pc?.iceGatheringState === "gathering" && (this._gatheringStartedAt = Date.now());
3871
+ }), this._statAggregator = e;
3872
+ }
3873
+ observe(e) {
3874
+ this.stop(), this._pc = e, this._gatheringStartedAt = Date.now(), this._remoteSdpReceivedAt = 0, e.addEventListener("icegatheringstatechange", this._handleGatheringStateChange);
3875
+ }
3876
+ stop() {
3877
+ this._pc?.removeEventListener("icegatheringstatechange", this._handleGatheringStateChange), this._pc = null;
3878
+ }
3879
+ logSdpGenerated(e) {
3880
+ this._log({
3881
+ name: U.SDP_GENERATED,
3882
+ value: 0,
3883
+ string_value: e,
3884
+ ...Nr
3885
+ });
3886
+ }
3887
+ logCandidateGenerated(e) {
3888
+ let t = Ir(e.candidate);
3889
+ t && this._log({
3890
+ name: U.SDP_GENERATED,
3891
+ value: Math.max(0, Date.now() - this._gatheringStartedAt),
3892
+ string_value: t.type,
3893
+ local_address: t.address,
3894
+ remote_address: null,
3895
+ transport: t.protocol
3896
+ });
3897
+ }
3898
+ logSdpReceived(e) {
3899
+ this._remoteSdpReceivedAt = Date.now(), this._log({
3900
+ name: U.SDP_RECEIVED,
3901
+ value: 0,
3902
+ string_value: e,
3903
+ ...Nr
3904
+ });
3905
+ }
3906
+ logCandidateReceived(e) {
3907
+ let t = Ir(e.candidate);
3908
+ t && this._log({
3909
+ name: U.SDP_RECEIVED,
3910
+ value: this._remoteSdpReceivedAt > 0 ? Math.max(0, Date.now() - this._remoteSdpReceivedAt) : 0,
3911
+ string_value: t.type,
3912
+ local_address: null,
3913
+ remote_address: t.address,
3914
+ transport: t.protocol
3915
+ });
3916
+ }
3917
+ logCreateFailed(e, t) {
3918
+ let n = Ar[e];
3919
+ n && this._logFailure(n, t, { remote: e === "answer" ? this._pc?.remoteDescription : void 0 });
3920
+ }
3921
+ logSetLocalFailed(e, t) {
3922
+ this._logFailure(jr[e.type], t, {
3923
+ local: e,
3924
+ remote: this._pc?.remoteDescription
3925
+ });
3926
+ }
3927
+ logSetRemoteFailed(e, t) {
3928
+ this._logFailure(Mr[e.type], t, {
3929
+ local: this._pc?.localDescription,
3930
+ remote: e
3931
+ });
3932
+ }
3933
+ destroy() {
3934
+ this.stop();
3935
+ }
3936
+ _logFailure(e, t, n) {
3937
+ this._log({
3938
+ name: e,
3939
+ value: 0,
3940
+ string_value: JSON.stringify({
3941
+ error: t instanceof Error ? t.message : String(t),
3942
+ local: Fr(n.local),
3943
+ remote: Fr(n.remote)
3944
+ }),
3945
+ ...Nr
3946
+ });
3947
+ }
3948
+ _log(e) {
3949
+ this._statAggregator?.logEventualStat(e);
3950
+ }
3951
+ };
3952
+ function Fr(e) {
3953
+ return e ? {
3954
+ type: e.type,
3955
+ sdp: e.sdp
3956
+ } : void 0;
3957
+ }
3958
+ function Ir(e) {
3959
+ let t = e?.split(" ") ?? [], n = t.indexOf("typ"), r = t[2]?.toLowerCase(), i = t[4], a = n === -1 ? void 0 : t[n + 1];
3960
+ return r === void 0 || i === void 0 || a === void 0 || !zr(i) ? null : {
3961
+ protocol: r,
3962
+ address: i,
3963
+ type: a
3964
+ };
3965
+ }
3966
+ var Lr = /^\d{1,3}(\.\d{1,3}){3}$/, Rr = /^[0-9a-f:]+$/i;
3967
+ function zr(e) {
3968
+ return Lr.test(e) || e.includes(":") && Rr.test(e);
3969
+ }
3970
+ //#endregion
3845
3971
  //#region src/classes/stat/FirstMediaSentProbe.ts
3846
- var Ar = 200;
3847
- function jr(e) {
3972
+ var Br = 200;
3973
+ function Vr(e) {
3848
3974
  for (let t of e.values()) if (t.type === "outbound-rtp" && (t.packetsSent ?? 0) > 0) return !0;
3849
3975
  return !1;
3850
3976
  }
3851
- var Mr = class {
3852
- constructor(e, t, n = Ar) {
3977
+ var Hr = class {
3978
+ constructor(e, t, n = Br) {
3853
3979
  h(this, "_peerConnection", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_pollIntervalMs", void 0), h(this, "_timer", null), h(this, "_state", "idle"), this._peerConnection = e, this._onFirstMediaSent = t, this._pollIntervalMs = n;
3854
3980
  }
3855
3981
  start() {
@@ -3872,7 +3998,7 @@ var Mr = class {
3872
3998
  try {
3873
3999
  let e = await this._getStatsReports();
3874
4000
  if (this._state !== "polling") return;
3875
- if (e.some(jr)) {
4001
+ if (e.some(Vr)) {
3876
4002
  this._state = "stopped", this._onFirstMediaSent();
3877
4003
  return;
3878
4004
  }
@@ -3885,7 +4011,7 @@ var Mr = class {
3885
4011
  this._timer = null, this._poll();
3886
4012
  }, this._pollIntervalMs));
3887
4013
  }
3888
- }, Nr = class extends b {
4014
+ }, Ur = class extends b {
3889
4015
  constructor(e, t, n = null) {
3890
4016
  super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", q.IDLE), h(this, "_pc", null), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbe", null), h(this, "_firstMediaSentProbeStopped", !1), this._signaling = e, this._mediaSource = t, this._onFirstMediaSent = n;
3891
4017
  }
@@ -3896,12 +4022,12 @@ var Mr = class {
3896
4022
  this._firstMediaSentProbeStopped = !0, this._disposeFirstMediaSentProbe();
3897
4023
  }
3898
4024
  _startFirstMediaSentProbe() {
3899
- this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new Mr(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
4025
+ this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new Hr(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
3900
4026
  }
3901
4027
  _disposeFirstMediaSentProbe() {
3902
4028
  this._firstMediaSentProbe?.destroy(), this._firstMediaSentProbe = null;
3903
4029
  }
3904
- }, Pr = class {
4030
+ }, Wr = class {
3905
4031
  constructor(e, t = null) {
3906
4032
  h(this, "weightUp", void 0), h(this, "weightDown", void 0), h(this, "value", NaN), this.weightUp = e, this.weightDown = t ?? e;
3907
4033
  }
@@ -3919,7 +4045,7 @@ var Mr = class {
3919
4045
  getValue() {
3920
4046
  return this.value;
3921
4047
  }
3922
- }, Fr = .25, Ir = .35, Lr = 85, Rr = .1, zr = 1.5, Br = .1, Vr = 1, Hr = .6, Ur = .3, Wr = class extends b {
4048
+ }, Gr = .25, Kr = .35, qr = 85, Jr = .1, Yr = 1.5, Xr = .1, Zr = 1, Qr = .6, $r = .3, ei = class extends b {
3923
4049
  constructor(e, t = z) {
3924
4050
  super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
3925
4051
  badNet: {
@@ -3931,8 +4057,8 @@ var Mr = class {
3931
4057
  rtt: 600
3932
4058
  }
3933
4059
  }), h(this, "_lastStatSentTimestamp", 0), h(this, "_currentState", "good"), h(this, "_debug", void 0), this._debug = t, this._signaling = e, this._localNetworkStat = {
3934
- rtt: new Pr(Fr, Fr),
3935
- loss: new Pr(Ir, Ir),
4060
+ rtt: new Wr(Gr, Gr),
4061
+ loss: new Wr(Kr, Kr),
3936
4062
  bitrate: 0
3937
4063
  }, this._remoteNetworkStat = {
3938
4064
  rtt: 0,
@@ -3947,20 +4073,20 @@ var Mr = class {
3947
4073
  _calcRttRating(e) {
3948
4074
  let t = typeof e == "number" ? e : e.getValue(), n = 1;
3949
4075
  if (isNaN(t)) return n;
3950
- let r = Math.round((t - this._networkLimits.goodNet.rtt) / Lr);
3951
- for (let e = 0; e < r; e++) n *= 1 - Rr;
4076
+ let r = Math.round((t - this._networkLimits.goodNet.rtt) / qr);
4077
+ for (let e = 0; e < r; e++) n *= 1 - Jr;
3952
4078
  return n;
3953
4079
  }
3954
4080
  _calcLossRating(e) {
3955
4081
  let t = typeof e == "number" ? e : e.getValue(), n = 1;
3956
4082
  if (isNaN(t)) return n;
3957
- let r = Math.round((t - this._networkLimits.goodNet.loss) / zr);
3958
- for (let e = 0; e < r; e++) n *= 1 - Br;
4083
+ let r = Math.round((t - this._networkLimits.goodNet.loss) / Yr);
4084
+ for (let e = 0; e < r; e++) n *= 1 - Xr;
3959
4085
  return n;
3960
4086
  }
3961
4087
  _calcBitrateRating(e, t) {
3962
4088
  if (!e || !t) return 1;
3963
- let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * Vr;
4089
+ let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * Zr;
3964
4090
  return Math.min(n, 1);
3965
4091
  }
3966
4092
  _calcUDPRating({ rtt: e, loss: t }) {
@@ -3970,7 +4096,7 @@ var Mr = class {
3970
4096
  return n ? this._calcBitrateRating(e.bitrate, t.bitrate) : this._calcUDPRating(e) * this._calcUDPRating(t);
3971
4097
  }
3972
4098
  _getNetworkState(e) {
3973
- return isNaN(e) || e >= Hr ? "good" : e >= Ur ? "medium" : "bad";
4099
+ return isNaN(e) || e >= Qr ? "good" : e >= $r ? "medium" : "bad";
3974
4100
  }
3975
4101
  updateSettings(e) {
3976
4102
  Object.assign(this._networkLimits.badNet, e?.badNet || {}), Object.assign(this._networkLimits.goodNet, e?.goodNet || {});
@@ -3994,7 +4120,7 @@ var Mr = class {
3994
4120
  let { rtt: t, loss: n, bitrate: r } = e || {};
3995
4121
  this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
3996
4122
  }
3997
- }, Gr = 30 * 1e3, Kr = class e extends Nr {
4123
+ }, ti = 30 * 1e3, ni = class e extends Ur {
3998
4124
  constructor(e, t, n, r, i, a = z, o = null, s = null, c = null, l = null) {
3999
4125
  super(n, r, l), h(this, "_participantId", void 0), h(this, "_isMaster", void 0), h(this, "_remoteSDP", {}), h(this, "_remoteCandidates", {}), h(this, "_lastRemoteSDP", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_remoteAnimojiVersion", 1), h(this, "_isOpen", !1), h(this, "_remotePeerId", null), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_failedOnCreate", null), h(this, "_remoteStream", null), h(this, "_iceRestartTimeout", null), h(this, "_reconnectionTimeout", null), h(this, "_reconnectionPrevented", !1), h(this, "_remoteHold", !1), h(this, "_lastStat", null), h(this, "_fingerprint", null), h(this, "_neverConnected", !0), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_networkLimitsForVideo", {
4000
4126
  bad: {
@@ -4009,7 +4135,7 @@ var Mr = class {
4009
4135
  worst: 320,
4010
4136
  bad: 640,
4011
4137
  good: 1280
4012
- }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", 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 ma(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new Wr(n, this._debug), this.subscribe(this._signaling, vr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Kt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Kt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
4138
+ }), 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, "_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 wa(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new ei(n, this._debug), this._sdpStats = new Pr(this._statAggregator), this.subscribe(this._signaling, vr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Kt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Kt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
4013
4139
  try {
4014
4140
  this._pc = this._createPeerConnection();
4015
4141
  } catch (e) {
@@ -4113,12 +4239,12 @@ var Mr = class {
4113
4239
  iceServers: N.iceServers,
4114
4240
  iceTransportPolicy: N.forceRelayPolicy ? "relay" : "all"
4115
4241
  });
4116
- return e.onicecandidate = this._handleIceCandidate.bind(this), e.ontrack = this._onAddTrack.bind(this), e.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), e.onconnectionstatechange = this._onConnectionStateChange.bind(this), e.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, Sr.animoji, (e) => {
4242
+ return e.onicecandidate = this._handleIceCandidate.bind(this), e.ontrack = this._onAddTrack.bind(this), e.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), e.onconnectionstatechange = this._onConnectionStateChange.bind(this), e.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._sdpStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, Sr.animoji, (e) => {
4117
4243
  this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(this._animojiDataChannel), this._animojiSender?.setDataChannel(this._animojiDataChannel);
4118
4244
  }), e;
4119
4245
  }
4120
4246
  _disposePeerConnection() {
4121
- if (this._disposeFirstMediaSentProbe(), this._lastStat = null, this._remoteStream) {
4247
+ if (this._disposeFirstMediaSentProbe(), this._sdpStats.stop(), this._lastStat = null, this._remoteStream) {
4122
4248
  let e = this._remoteStream;
4123
4249
  e.getTracks().forEach((t) => {
4124
4250
  t.stop(), this._triggerEvent(Y.REMOTE_TRACK_REMOVED, e, t);
@@ -4156,7 +4282,7 @@ var Mr = class {
4156
4282
  }
4157
4283
  _handleTransmittedData(e) {
4158
4284
  let t = e.data, n = M.getPeerIdString(e.peerId);
4159
- M.composeMessageId(e) === this._participantId && (t.candidate && t.candidate.candidate ? this._addIceCandidate(n, t.candidate).catch(this.close.bind(this)) : t.sdp && (this._remoteAnimojiVersion = t.animojiVersion || 1, this._setRemoteDescription(n, t.sdp).catch(this.close.bind(this))));
4285
+ M.composeMessageId(e) === this._participantId && (t.candidate && t.candidate.candidate ? (this._sdpStats.logCandidateReceived(t.candidate), this._addIceCandidate(n, t.candidate).catch(this.close.bind(this))) : t.sdp && (this._sdpStats.logSdpReceived(t.sdp.type), this._remoteAnimojiVersion = t.animojiVersion || 1, this._setRemoteDescription(n, t.sdp).catch(this.close.bind(this))));
4160
4286
  }
4161
4287
  async _addIceCandidate(e, t) {
4162
4288
  if (this._isOpen && (!this._remotePeerId || this._remotePeerId === e) && this._pc && this._pc.remoteDescription) {
@@ -4198,7 +4324,7 @@ var Mr = class {
4198
4324
  try {
4199
4325
  await this._pc.setRemoteDescription(n), await this._setRemoteCandidates(t), this._processAnimojiProtocolVersion(this._remoteAnimojiVersion);
4200
4326
  } catch (e) {
4201
- throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
4327
+ throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._sdpStats.logSetRemoteFailed(n, e), this._debug.error("Unable to set remote description", e, {
4202
4328
  participantId: this._participantId,
4203
4329
  sdp: n
4204
4330
  }), e;
@@ -4221,7 +4347,7 @@ var Mr = class {
4221
4347
  this._signaling.ready && (e.candidate ? (this._debug.debug("Local ice candidate", {
4222
4348
  participantId: this._participantId,
4223
4349
  candidate: e.candidate
4224
- }), await this._signaling.sendCandidate(this._participantId, e.candidate)) : N.forwardEmptyIceCandidate && (this._debug.debug("ICE gathering complete, forwarding empty candidate", { participantId: this._participantId }), await this._signaling.sendCandidate(this._participantId, { candidate: "" })));
4350
+ }), this._sdpStats.logCandidateGenerated(e.candidate), await this._signaling.sendCandidate(this._participantId, e.candidate)) : N.forwardEmptyIceCandidate && (this._debug.debug("ICE gathering complete, forwarding empty candidate", { participantId: this._participantId }), await this._signaling.sendCandidate(this._participantId, { candidate: "" })));
4225
4351
  }
4226
4352
  _onSignalingStateChange() {
4227
4353
  this._debug.debug(`DirectTransport: Signaling state changed to ${this._pc?.signalingState}`, { participantId: this._participantId });
@@ -4277,8 +4403,8 @@ var Mr = class {
4277
4403
  this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch() : this._startIceRestart();
4278
4404
  }, N.transportConnectionWaitTime));
4279
4405
  }
4280
- _requestTopologySwitch() {
4281
- this._isMaster && this._signaling.ready && (this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId }), this._signaling.switchTopology(J.SERVER).catch((e) => {
4406
+ _requestTopologySwitch(e = !1) {
4407
+ (this._isMaster || e) && this._signaling.ready && (this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId }), this._signaling.switchTopology(J.SERVER).catch((e) => {
4282
4408
  e instanceof Cn || this._debug.warn("Unable to switch topology DIRECT to SERVER", e);
4283
4409
  }));
4284
4410
  }
@@ -4287,7 +4413,7 @@ var Mr = class {
4287
4413
  }
4288
4414
  _startIceRestart() {
4289
4415
  this._isMaster ? (this._logger?.log(C.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
4290
- this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
4416
+ this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch(N.switchTopologyOnReconnectFromAnySide);
4291
4417
  }, N.iceRestartWaitTime);
4292
4418
  }
4293
4419
  async _createOffer(t) {
@@ -4305,9 +4431,9 @@ var Mr = class {
4305
4431
  r = await this._pc?.createOffer(n), this._debug.debug("Created offer", {
4306
4432
  participantId: this._participantId,
4307
4433
  offer: r
4308
- }), r = e._patchLocalDescription(r);
4434
+ }), this._sdpStats.logSdpGenerated("offer"), r = e._patchLocalDescription(r);
4309
4435
  } catch (e) {
4310
- throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), e;
4436
+ throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), this._sdpStats.logCreateFailed("offer", e), e;
4311
4437
  }
4312
4438
  try {
4313
4439
  return this._debug.debug("Set local description", {
@@ -4315,7 +4441,7 @@ var Mr = class {
4315
4441
  offer: r
4316
4442
  }), this._calcFingerprint(r.sdp), await this._pc?.setLocalDescription(r), r;
4317
4443
  } catch (e) {
4318
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4444
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), this._sdpStats.logSetLocalFailed(r, e), e;
4319
4445
  }
4320
4446
  }
4321
4447
  async _createAnswer() {
@@ -4325,9 +4451,9 @@ var Mr = class {
4325
4451
  t = await this._pc?.createAnswer(), this._debug.debug("Created answer", {
4326
4452
  participantId: this._participantId,
4327
4453
  answer: t
4328
- }), t = e._patchLocalDescription(t);
4454
+ }), this._sdpStats.logSdpGenerated("answer"), t = e._patchLocalDescription(t);
4329
4455
  } catch (e) {
4330
- throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), e;
4456
+ throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), this._sdpStats.logCreateFailed("answer", e), e;
4331
4457
  }
4332
4458
  try {
4333
4459
  return this._debug.debug("Set local description", {
@@ -4335,7 +4461,7 @@ var Mr = class {
4335
4461
  answer: t
4336
4462
  }), this._calcFingerprint(t.sdp), await this._pc?.setLocalDescription(t), t;
4337
4463
  } catch (e) {
4338
- throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
4464
+ throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), this._sdpStats.logSetLocalFailed(t, e), e;
4339
4465
  }
4340
4466
  }
4341
4467
  static _patchLocalDescription(e) {
@@ -4408,7 +4534,7 @@ var Mr = class {
4408
4534
  async _checkPPTNetwork(e) {
4409
4535
  if (!N.switchVideoAtBadNetwork || !e.inbound.transport.averageNetStat) return;
4410
4536
  let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o = Er.L1T1;
4411
- if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = Er.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = Er.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Er.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > Gr) || this._lastVideoMaxDimension === a) return;
4537
+ if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = Er.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = Er.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Er.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > ti) || this._lastVideoMaxDimension === a) return;
4412
4538
  let s = this._serverSettings.camera;
4413
4539
  if (!s || !await this._isSVCSupported(e, o)) return;
4414
4540
  this._debug.debug("Switch outbound video frame size and scalabilityMode", {
@@ -4473,9 +4599,9 @@ var Mr = class {
4473
4599
  }, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
4474
4600
  };
4475
4601
  }
4476
- }, qr = /* @__PURE__ */ function(e) {
4602
+ }, ri = /* @__PURE__ */ function(e) {
4477
4603
  return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
4478
- }({}), Jr = 16, Yr = class e {
4604
+ }({}), ii = 16, ai = class e {
4479
4605
  constructor(e, t, n, r = z) {
4480
4606
  h(this, "_datachannel", void 0), h(this, "_participantIdRegistry", void 0), h(this, "_asrCallback", void 0), h(this, "_textDecoder", void 0), h(this, "_debug", void 0), this._debug = r, this._debug.debug("AsrReceiver started"), this._datachannel = e, this._participantIdRegistry = t, this._asrCallback = n, this._textDecoder = new TextDecoder(), this._datachannel.onmessage = (e) => this._onDataChannelMessage(e.data);
4481
4607
  }
@@ -4489,7 +4615,7 @@ var Mr = class {
4489
4615
  ssrc: a,
4490
4616
  timestamp: o,
4491
4617
  duration: s,
4492
- data: e.slice(Jr)
4618
+ data: e.slice(ii)
4493
4619
  };
4494
4620
  }
4495
4621
  _onDataChannelMessage(t) {
@@ -4509,7 +4635,7 @@ var Mr = class {
4509
4635
  destroy() {
4510
4636
  this._datachannel.onmessage = null;
4511
4637
  }
4512
- }, Xr, Zr = class {
4638
+ }, oi, si = class {
4513
4639
  constructor() {
4514
4640
  h(this, "_value", 1);
4515
4641
  }
@@ -4520,10 +4646,10 @@ var Mr = class {
4520
4646
  this._value = e;
4521
4647
  }
4522
4648
  };
4523
- Xr = Zr, h(Zr, "_instance", null), h(Zr, "getInstance", () => (Xr._instance || (Xr._instance = new Xr()), Xr._instance));
4649
+ oi = si, h(si, "_instance", null), h(si, "getInstance", () => (oi._instance || (oi._instance = new oi()), oi._instance));
4524
4650
  //#endregion
4525
4651
  //#region src/classes/ParticipantIdRegistry.ts
4526
- var Qr = class {
4652
+ var ci = class {
4527
4653
  constructor(e = z) {
4528
4654
  h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
4529
4655
  }
@@ -4639,7 +4765,7 @@ var Qr = class {
4639
4765
  this._debug.error("unexpected null sequenceNumber", e, r);
4640
4766
  continue;
4641
4767
  }
4642
- let l = qr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
4768
+ let l = ri.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
4643
4769
  n.push({
4644
4770
  participantStreamDescription: c,
4645
4771
  streamId: l,
@@ -4655,9 +4781,9 @@ var Qr = class {
4655
4781
  participantUpdateInfos: n
4656
4782
  };
4657
4783
  }
4658
- }, $r = /* @__PURE__ */ function(e) {
4784
+ }, li = /* @__PURE__ */ function(e) {
4659
4785
  return e.INIT = "init", e.READY = "ready", e.FRAME = "frame", e.SET_BITRATE = "set_bitrate", e.ERROR = "error", e.DEBUG = "debug", e.LOG_ERROR = "log_error", e;
4660
- }({}), ei = class {
4786
+ }({}), ui = class {
4661
4787
  constructor(e = z, t = null) {
4662
4788
  h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
4663
4789
  }
@@ -4673,7 +4799,7 @@ var Qr = class {
4673
4799
  return;
4674
4800
  }
4675
4801
  t({
4676
- type: $r.FRAME,
4802
+ type: li.FRAME,
4677
4803
  error: e
4678
4804
  });
4679
4805
  };
@@ -4683,23 +4809,23 @@ var Qr = class {
4683
4809
  e.preventDefault?.(), m(this._formatWorkerMessageError(e));
4684
4810
  }, f.onmessage = (e) => {
4685
4811
  switch (e.data.type) {
4686
- case $r.READY:
4812
+ case li.READY:
4687
4813
  s = !0, c || (c = !0, a());
4688
4814
  break;
4689
- case $r.ERROR:
4815
+ case li.ERROR:
4690
4816
  s ? m(e.data.error) : p(e.data.error);
4691
4817
  break;
4692
- case $r.FRAME:
4818
+ case li.FRAME:
4693
4819
  t(e.data);
4694
4820
  break;
4695
- case $r.DEBUG:
4821
+ case li.DEBUG:
4696
4822
  this._debug.debug(e.data.message);
4697
4823
  break;
4698
- case $r.LOG_ERROR:
4824
+ case li.LOG_ERROR:
4699
4825
  this._logger?.log(C.ERROR, e.data.message);
4700
4826
  break;
4701
4827
  }
4702
- }, this._sendToWorker($r.INIT, r, i);
4828
+ }, this._sendToWorker(li.INIT, r, i);
4703
4829
  });
4704
4830
  }
4705
4831
  _removeWorker() {
@@ -4722,7 +4848,7 @@ var Qr = class {
4722
4848
  static isBrowserSupported() {
4723
4849
  throw Error("Not implemented");
4724
4850
  }
4725
- }, ti = class extends ei {
4851
+ }, di = class extends ui {
4726
4852
  constructor(e = z, t = null) {
4727
4853
  super(e, t);
4728
4854
  }
@@ -4732,7 +4858,7 @@ var Qr = class {
4732
4858
  }, [c, c.getUrl]);
4733
4859
  }
4734
4860
  decodeFrame(e, t, n, r) {
4735
- this._sendToWorker($r.FRAME, {
4861
+ this._sendToWorker(li.FRAME, {
4736
4862
  timestamp: e,
4737
4863
  data: t.buffer,
4738
4864
  isVP9: n,
@@ -4746,7 +4872,7 @@ var Qr = class {
4746
4872
  static isBrowserSupported() {
4747
4873
  return "WebAssembly" in window && "Worker" in window;
4748
4874
  }
4749
- }, ni = class extends ei {
4875
+ }, fi = class extends ui {
4750
4876
  constructor(e = z, t = null) {
4751
4877
  super(e, t);
4752
4878
  }
@@ -4756,7 +4882,7 @@ var Qr = class {
4756
4882
  }, [!0]);
4757
4883
  }
4758
4884
  decodeFrame(e, t, n, r = !1) {
4759
- this._sendToWorker($r.FRAME, {
4885
+ this._sendToWorker(li.FRAME, {
4760
4886
  timestamp: e,
4761
4887
  data: t.buffer,
4762
4888
  isVP9: n,
@@ -4769,7 +4895,7 @@ var Qr = class {
4769
4895
  static isBrowserSupported() {
4770
4896
  return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !E.isBrokenVP9Decoder() && E.browserName() !== "Firefox";
4771
4897
  }
4772
- }, ri = class {
4898
+ }, pi = class {
4773
4899
  constructor(e = null, t = 0) {
4774
4900
  h(this, "_counter", 0), h(this, "_interval", 0), h(this, "_lastCalculationTime", Date.now()), h(this, "_onCalculated", null), this._onCalculated = e, t && (this._interval = window.setInterval(() => this.calculate(), t));
4775
4901
  }
@@ -4783,7 +4909,7 @@ var Qr = class {
4783
4909
  destroy() {
4784
4910
  window.clearInterval(this._interval), this._interval = 0;
4785
4911
  }
4786
- }, ii = class {
4912
+ }, mi = class {
4787
4913
  constructor(e, t) {
4788
4914
  h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
4789
4915
  }
@@ -4798,14 +4924,14 @@ var Qr = class {
4798
4924
  height: t
4799
4925
  });
4800
4926
  }
4801
- }, ai = 65536, oi = "MARK_SCREENSHARE_FREEZE_DURATION", si = class e {
4927
+ }, hi = 65536, gi = "MARK_SCREENSHARE_FREEZE_DURATION", _i = class e {
4802
4928
  constructor(e, t, n, r, i, a = z) {
4803
- h(this, "_participantId", void 0), h(this, "_onStream", void 0), h(this, "_onStat", void 0), h(this, "_onKeyFrameRequested", void 0), h(this, "_statScreenShareFirstFrame", void 0), h(this, "_debug", void 0), h(this, "_chunks", []), this._participantId = e, this._onStream = t, this._onStat = n, this._onKeyFrameRequested = i, this._statScreenShareFirstFrame = new ii(e, r), this._debug = a;
4929
+ h(this, "_participantId", void 0), h(this, "_onStream", void 0), h(this, "_onStat", void 0), h(this, "_onKeyFrameRequested", void 0), h(this, "_statScreenShareFirstFrame", void 0), h(this, "_debug", void 0), h(this, "_chunks", []), this._participantId = e, this._onStream = t, this._onStat = n, this._onKeyFrameRequested = i, this._statScreenShareFirstFrame = new mi(e, r), this._debug = a;
4804
4930
  }
4805
4931
  appendChunk(t) {
4806
4932
  let n = this._chunks.length;
4807
4933
  if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
4808
- else if (!n || (this._chunks[n - 1].sequence + 1) % ai !== t.sequence) {
4934
+ else if (!n || (this._chunks[n - 1].sequence + 1) % hi !== t.sequence) {
4809
4935
  this._debug.warn("[FrameBuilder] Got incorrect chunk");
4810
4936
  return;
4811
4937
  }
@@ -4822,7 +4948,7 @@ var Qr = class {
4822
4948
  }
4823
4949
  }
4824
4950
  destroy() {
4825
- G.clearMark(oi), G.clearMark(G.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
4951
+ G.clearMark(gi), G.clearMark(G.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
4826
4952
  }
4827
4953
  _processFrameData() {
4828
4954
  let e = this._chunks;
@@ -4845,13 +4971,13 @@ var Qr = class {
4845
4971
  }
4846
4972
  _measureFreezeDuration(e) {
4847
4973
  if (e) {
4848
- G.setMark(oi);
4974
+ G.setMark(gi);
4849
4975
  return;
4850
4976
  }
4851
- let t = G.measureMark(oi);
4977
+ let t = G.measureMark(gi);
4852
4978
  t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
4853
4979
  }
4854
- }, ci = class {
4980
+ }, vi = class {
4855
4981
  constructor(e) {
4856
4982
  h(this, "_onStream", void 0), this._onStream = e;
4857
4983
  }
@@ -4864,7 +4990,7 @@ var Qr = class {
4864
4990
  static isBrowserSupported() {
4865
4991
  throw Error("Method `isBrowserSupported` is not implemented");
4866
4992
  }
4867
- }, li = class extends ci {
4993
+ }, yi = class extends vi {
4868
4994
  constructor(e, t = z) {
4869
4995
  super(e), h(this, "_useImageBitmap", void 0), h(this, "_canvas", null), h(this, "_canvasContext", null), h(this, "_stream", null), h(this, "_track", null), h(this, "_debug", void 0), this._debug = t, this._debug.debug("CanvasRenderer started"), this._useImageBitmap = "ImageBitmap" in window;
4870
4996
  }
@@ -4924,7 +5050,7 @@ var Qr = class {
4924
5050
  static isBrowserSupported() {
4925
5051
  return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(E.browserName() === "Safari" && Number(E.browserVersion()) === 15);
4926
5052
  }
4927
- }, ui = class extends ci {
5053
+ }, bi = class extends vi {
4928
5054
  constructor(e, t = z) {
4929
5055
  super(e), h(this, "_generator", void 0), h(this, "_writer", void 0), h(this, "_stream", void 0), h(this, "_debug", void 0), this._debug = t, this._debug.debug("TrackGeneratorRenderer started"), this._generator = new MediaStreamTrackGenerator({ kind: A.video }), this._writer = this._generator.writable.getWriter(), this._stream = new MediaStream([this._generator]), this._onStream(this._stream);
4930
5056
  }
@@ -4935,9 +5061,9 @@ var Qr = class {
4935
5061
  this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
4936
5062
  }
4937
5063
  static isBrowserSupported() {
4938
- return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && ni.isBrowserSupported();
5064
+ return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && fi.isBrowserSupported();
4939
5065
  }
4940
- }, di = class extends si {
5066
+ }, xi = class extends _i {
4941
5067
  constructor(e, t, n, r, i, a = z, o = null) {
4942
5068
  super(e, t, n, r, i, a), h(this, "_renderer", void 0), h(this, "_decoder", void 0), h(this, "_decoderReady", !1), h(this, "_decoderBusy", !1), h(this, "_decoderQueue", []), h(this, "_webCodecsRetryAttempted", !1), h(this, "_fpsMeter", void 0), h(this, "_logger", void 0), this._logger = o, this._debug.debug(`StreamBuilder started for participant [${e}]`), this._initFpsMeter(), this._initRenderer(), this._initDecoder();
4943
5069
  }
@@ -4945,16 +5071,16 @@ var Qr = class {
4945
5071
  e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
4946
5072
  }
4947
5073
  _initFpsMeter() {
4948
- this._fpsMeter = new ri((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
5074
+ this._fpsMeter = new pi((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
4949
5075
  }
4950
5076
  _initRenderer(e = !1) {
4951
- e || !ui.isBrowserSupported() ? this._renderer = new li(this._onStream, this._debug) : this._renderer = new ui(this._onStream, this._debug);
5077
+ e || !bi.isBrowserSupported() ? this._renderer = new yi(this._onStream, this._debug) : this._renderer = new bi(this._onStream, this._debug);
4952
5078
  }
4953
5079
  _initDecoder(e = !1) {
4954
- e || !ni.isBrowserSupported() ? this._decoder = new ti(this._debug, this._logger) : this._decoder = new ni(this._debug, this._logger), this._decoder.init(async (e) => {
5080
+ e || !fi.isBrowserSupported() ? this._decoder = new di(this._debug, this._logger) : this._decoder = new fi(this._debug, this._logger), this._decoder.init(async (e) => {
4955
5081
  this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
4956
5082
  }, (e) => {
4957
- if (this._decoderBusy = !1, this._decoder instanceof ni && typeof e == "string" && e.includes("EncodingError")) {
5083
+ if (this._decoderBusy = !1, this._decoder instanceof fi && typeof e == "string" && e.includes("EncodingError")) {
4958
5084
  this._decoderQueue = [], !this._webCodecsRetryAttempted && e.includes("reset because error during decoding") ? (this._webCodecsRetryAttempted = !0, this._debug.warn("StreamBuilder retry WebCodecs with software decoder"), this._onKeyFrameRequested?.()) : this._switchToLibVPXDecoder();
4959
5085
  return;
4960
5086
  }
@@ -4962,7 +5088,7 @@ var Qr = class {
4962
5088
  }, this._onKeyFrameRequested).then(() => {
4963
5089
  this._decoderReady = !0, this._decodeQueue();
4964
5090
  }).catch((e) => {
4965
- this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof ni && this._switchToLibVPXDecoder();
5091
+ this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof fi && this._switchToLibVPXDecoder();
4966
5092
  });
4967
5093
  }
4968
5094
  _switchToLibVPXDecoder() {
@@ -4977,20 +5103,20 @@ var Qr = class {
4977
5103
  super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
4978
5104
  }
4979
5105
  static isBrowserSupported() {
4980
- return li.isBrowserSupported() || ui.isBrowserSupported();
5106
+ return yi.isBrowserSupported() || bi.isBrowserSupported();
4981
5107
  }
4982
- }, fi = 1, pi = 1, mi = 2, hi = 0, gi = 1, _i = 2, vi = 4, yi = 8;
4983
- function bi(e, t, n, r, i, a, o) {
5108
+ }, Si = 1, Ci = 1, wi = 2, Ti = 0, Ei = 1, Di = 2, Oi = 4, ki = 8;
5109
+ function Ai(e, t, n, r, i, a, o) {
4984
5110
  let s = 0;
4985
- t && (s |= gi), n && (s |= _i), r && (s |= vi), o || (s |= yi);
5111
+ t && (s |= Ei), n && (s |= Di), r && (s |= Oi), o || (s |= ki);
4986
5112
  let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
4987
- if (l.setUint8(0, fi), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, hi), l.setUint8(10, s), !o) return c;
5113
+ if (l.setUint8(0, Si), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, Ti), l.setUint8(10, s), !o) return c;
4988
5114
  let u = new Uint8Array(c.byteLength + o.byteLength);
4989
5115
  return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
4990
5116
  }
4991
- function xi(e) {
4992
- let t = new DataView(e), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint32(3), a = t.getUint8(7) === 1, o = t.getUint16(8), s = t.getUint8(10), c = !!(s & gi), l = !!(s & _i), u = !!(s & vi), d = !!(s & yi);
4993
- if (n !== fi) throw Error(`Unexpected protocol version. Got ${n}, expected ${fi}`);
5117
+ function ji(e) {
5118
+ let t = new DataView(e), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint32(3), a = t.getUint8(7) === 1, o = t.getUint16(8), s = t.getUint8(10), c = !!(s & Ei), l = !!(s & Di), u = !!(s & Oi), d = !!(s & ki);
5119
+ if (n !== Si) throw Error(`Unexpected protocol version. Got ${n}, expected ${Si}`);
4994
5120
  return {
4995
5121
  timestamp: i,
4996
5122
  start: c,
@@ -5003,26 +5129,26 @@ function xi(e) {
5003
5129
  data: e.slice(11)
5004
5130
  };
5005
5131
  }
5006
- function Si(e) {
5132
+ function Mi(e) {
5007
5133
  if (!e || !e.byteLength || e.byteLength !== 4) return !1;
5008
5134
  let t = new DataView(e);
5009
- return !(t.getUint8(0) !== fi || t.getUint8(1) !== pi || t.getUint16(2) !== hi);
5135
+ return !(t.getUint8(0) !== Si || t.getUint8(1) !== Ci || t.getUint16(2) !== Ti);
5010
5136
  }
5011
- function Ci(e) {
5137
+ function Ni(e) {
5012
5138
  if (!e || !e.byteLength || e.byteLength !== 10) return null;
5013
5139
  let t = new DataView(e);
5014
- return t.getUint8(0) !== fi || t.getUint8(1) !== mi || t.getUint16(2) !== hi ? null : {
5140
+ return t.getUint8(0) !== Si || t.getUint8(1) !== wi || t.getUint16(2) !== Ti ? null : {
5015
5141
  seq: t.getUint16(4),
5016
5142
  ts2: t.getUint32(6)
5017
5143
  };
5018
5144
  }
5019
- function wi(e) {
5145
+ function Pi(e) {
5020
5146
  let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
5021
- return n.setUint8(0, fi), n.setUint8(1, pi), n.setUint16(2, e), t;
5147
+ return n.setUint8(0, Si), n.setUint8(1, Ci), n.setUint16(2, e), t;
5022
5148
  }
5023
5149
  //#endregion
5024
5150
  //#region src/classes/screenshare/WebmBuilder.ts
5025
- var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5151
+ var Fi = 2 ** 15 - 1, Ii = 1, Li = 5, Ri = 5, zi = class e {
5026
5152
  constructor(e, t = z) {
5027
5153
  h(this, "_mediaSource", void 0), h(this, "_codec", void 0), h(this, "_sourceBuffer", null), h(this, "_queue", []), h(this, "_clearBufferTill", 0), h(this, "_debug", void 0), this._mediaSource = new MediaSource(), this._codec = e, this._debug = t;
5028
5154
  let n = () => {
@@ -5065,8 +5191,8 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5065
5191
  this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
5066
5192
  let e = this._sourceBuffer?.buffered, t = e?.length;
5067
5193
  if (!t) return;
5068
- let n = e.start(0), r = Math.max(0, e.end(t - 1) - Di);
5069
- r - n > Oi && (this._clearBufferTill = r);
5194
+ let n = e.start(0), r = Math.max(0, e.end(t - 1) - Li);
5195
+ r - n > Ri && (this._clearBufferTill = r);
5070
5196
  }
5071
5197
  destroy() {
5072
5198
  this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
@@ -5080,7 +5206,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5080
5206
  get buffered() {
5081
5207
  return this._sourceBuffer?.buffered;
5082
5208
  }
5083
- }, Ai = class e extends si {
5209
+ }, Bi = class e extends _i {
5084
5210
  constructor(e, t, n, r, i = z) {
5085
5211
  super(e, t, n, r, void 0, i), h(this, "_mediaBuffer", null), h(this, "_video", null), h(this, "_stream", null), h(this, "_earliestTimestamp", 0), h(this, "_clusterStartTime", 0), h(this, "_lastFrameTimestamp", 0), this._debug.debug(`[WebmBuilder] started for participant [${e}]`);
5086
5212
  }
@@ -5104,8 +5230,8 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5104
5230
  u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
5105
5231
  u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
5106
5232
  ]), i = [u.element(u.ID.PixelWidth, u.number(e)), u.element(u.ID.PixelHeight, u.number(t))], a = u.element(u.ID.Tracks, u.element(u.ID.TrackEntry, [
5107
- u.element(u.ID.TrackNumber, u.number(Ei)),
5108
- u.element(u.ID.TrackUID, u.number(Ei)),
5233
+ u.element(u.ID.TrackNumber, u.number(Ii)),
5234
+ u.element(u.ID.TrackUID, u.number(Ii)),
5109
5235
  u.element(u.ID.TrackType, u.number(1)),
5110
5236
  u.element(u.ID.FlagLacing, u.number(0)),
5111
5237
  u.element(u.ID.DefaultDuration, u.number(1e9)),
@@ -5118,7 +5244,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5118
5244
  return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
5119
5245
  }
5120
5246
  _createVideo(e) {
5121
- this._mediaBuffer = new ki(e, this._debug), this._video = document.createElement("video"), this._video.autoplay = !0, this._video.controls = !1, this._video.muted = !0, this._video.style.pointerEvents = "none", this._video.style.visibility = "hidden", this._video.style.position = "absolute", this._video.style.width = "160px", this._video.style.height = "90px", this._video.style.bottom = "0", this._video.style.right = "0", this._video.style.zIndex = "5000", this._video.src = URL.createObjectURL(this._mediaBuffer.mediaSource), document.body.appendChild(this._video);
5247
+ this._mediaBuffer = new zi(e, this._debug), this._video = document.createElement("video"), this._video.autoplay = !0, this._video.controls = !1, this._video.muted = !0, this._video.style.pointerEvents = "none", this._video.style.visibility = "hidden", this._video.style.position = "absolute", this._video.style.width = "160px", this._video.style.height = "90px", this._video.style.bottom = "0", this._video.style.right = "0", this._video.style.zIndex = "5000", this._video.src = URL.createObjectURL(this._mediaBuffer.mediaSource), document.body.appendChild(this._video);
5122
5248
  let t = () => {
5123
5249
  if (this._video?.src) {
5124
5250
  this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
@@ -5145,13 +5271,13 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5145
5271
  this._mediaBuffer?.append(a);
5146
5272
  }
5147
5273
  let i = Math.round(r - this._clusterStartTime);
5148
- if (i > Ti && (this._clusterStartTime = r, i = 0), i === 0) {
5274
+ if (i > Fi && (this._clusterStartTime = r, i = 0), i === 0) {
5149
5275
  this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
5150
5276
  let t = e._genClusterHeader(this._clusterStartTime);
5151
5277
  this._mediaBuffer?.append(t);
5152
5278
  }
5153
5279
  let a = u.element(u.ID.SimpleBlock, [
5154
- u.vintEncodedNumber(Ei),
5280
+ u.vintEncodedNumber(Ii),
5155
5281
  u.bytes(e._intToU16BE(i)),
5156
5282
  u.number(!!t.keyframe << 7),
5157
5283
  u.bytes(t.frameData)
@@ -5164,12 +5290,12 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5164
5290
  static isBrowserSupported() {
5165
5291
  return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
5166
5292
  }
5167
- }, ji = class {
5293
+ }, Vi = class {
5168
5294
  constructor(e, t, n, r, i, a = null, o = z, s = null) {
5169
5295
  h(this, "_datachannel", void 0), h(this, "_participantIdRegistry", null), h(this, "_streamBuilders", {}), h(this, "_onStream", () => {}), h(this, "_onEos", () => {}), h(this, "_onStat", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), this._debug = o, this._logger = s, this._statAggregator = a, this._debug.debug("ScreenCaptureReceiver started"), this._datachannel = e, this._participantIdRegistry = t, this._onStream = n, this._onEos = r, this._onStat = i, this._datachannel.onmessage = (e) => this._onDataChannelMessage(e.data);
5170
5296
  }
5171
5297
  _onDataChannelMessage(e) {
5172
- let t = xi(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
5298
+ let t = ji(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
5173
5299
  if (!n) {
5174
5300
  this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
5175
5301
  return;
@@ -5181,7 +5307,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5181
5307
  let r = this._streamBuilders[n];
5182
5308
  if (!r) {
5183
5309
  let e = (e) => this._onStream(n, e);
5184
- r = N.screenShareWebmBuilder && Ai.isBrowserSupported() ? new Ai(n, e, this._onStat, this._statAggregator, this._debug) : new di(n, e, this._onStat, this._statAggregator, () => {
5310
+ r = N.screenShareWebmBuilder && Bi.isBrowserSupported() ? new Bi(n, e, this._onStat, this._statAggregator, this._debug) : new xi(n, e, this._onStat, this._statAggregator, () => {
5185
5311
  this._requestKeyFrame(t.ssrc);
5186
5312
  }, this._debug, this._logger), this._streamBuilders[n] = r;
5187
5313
  }
@@ -5189,7 +5315,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5189
5315
  }
5190
5316
  _requestKeyFrame(e) {
5191
5317
  if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
5192
- let t = wi(e);
5318
+ let t = Pi(e);
5193
5319
  this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
5194
5320
  } catch (e) {
5195
5321
  this._debug.warn("Failed to send keyframe request", e);
@@ -5202,7 +5328,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5202
5328
  destroy() {
5203
5329
  this._datachannel.onbufferedamountlow = null, this._datachannel.onmessage = null, this._onStream = () => {}, Object.values(this._streamBuilders).forEach((e) => e.destroy()), this._streamBuilders = {}, this._participantIdRegistry = null, this._debug.debug("ScreenCaptureReceiver destroyed");
5204
5330
  }
5205
- }, Mi = class {
5331
+ }, Hi = class {
5206
5332
  constructor(e, t, n) {
5207
5333
  h(this, "_prev", void 0), h(this, "_next", void 0), h(this, "_data", void 0), this._next = n, n && (n.prev = this), this._prev = t, t && (t.next = this), this._data = e;
5208
5334
  }
@@ -5221,7 +5347,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5221
5347
  get data() {
5222
5348
  return this._data;
5223
5349
  }
5224
- }, Ni = class {
5350
+ }, Ui = class {
5225
5351
  constructor() {
5226
5352
  h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
5227
5353
  }
@@ -5229,7 +5355,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5229
5355
  return this._length;
5230
5356
  }
5231
5357
  push(...e) {
5232
- for (let t of e) this._tail = new Mi(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
5358
+ for (let t of e) this._tail = new Hi(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
5233
5359
  }
5234
5360
  merge(e) {
5235
5361
  this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
@@ -5259,7 +5385,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5259
5385
  for (; t !== null;) e.push(t.data), t = t.next;
5260
5386
  return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
5261
5387
  }
5262
- }, Pi = 1e3, Fi = class extends ei {
5388
+ }, Wi = 1e3, Gi = class extends ui {
5263
5389
  constructor(e, t, n, r, i = z, a = null) {
5264
5390
  super(i, a), h(this, "_sourceTrack", void 0), h(this, "_onFrame", void 0), h(this, "_useCongestionControl", void 0), h(this, "_maxBitrate", void 0), h(this, "_useImageCapture", void 0), h(this, "_video", null), h(this, "_imageCapture", null), h(this, "_canvas", null), h(this, "_canvasCtx", null), h(this, "_frameReadTimeout", 0), h(this, "_lastFrame", null), this._sourceTrack = e, this._onFrame = t, this._useCongestionControl = n, this._maxBitrate = r, this._useImageCapture = "ImageCapture" in window && ImageCapture.prototype.grabFrame !== void 0 && "ImageBitmap" in window, (e.readyState !== "live" || !e.enabled || e.muted) && (this._useImageCapture = !1);
5265
5391
  }
@@ -5328,7 +5454,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5328
5454
  }
5329
5455
  _encode(e, t) {
5330
5456
  let n = e.data.buffer;
5331
- this._sendToWorker($r.FRAME, {
5457
+ this._sendToWorker(li.FRAME, {
5332
5458
  width: e.width,
5333
5459
  height: e.height,
5334
5460
  imageData: n,
@@ -5345,7 +5471,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5345
5471
  let t = this._drawFrameData(this._lastFrame);
5346
5472
  this._encode(t, e);
5347
5473
  } else this._onFrame(null);
5348
- }, Pi), this._getFrameBitmap().then((t) => {
5474
+ }, Wi), this._getFrameBitmap().then((t) => {
5349
5475
  window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
5350
5476
  let n = this._drawFrameData(t);
5351
5477
  this._encode(n, e);
@@ -5355,7 +5481,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5355
5481
  this._useImageCapture ? this._requestFrameBitmap(e) : this._requestFrameVideo(e);
5356
5482
  }
5357
5483
  setBitrate(e, t, n) {
5358
- this._sendToWorker($r.SET_BITRATE, {
5484
+ this._sendToWorker(li.SET_BITRATE, {
5359
5485
  bitrate: e,
5360
5486
  useCbr: t
5361
5487
  });
@@ -5366,7 +5492,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5366
5492
  destroy() {
5367
5493
  this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
5368
5494
  }
5369
- }, Ii = class extends ei {
5495
+ }, Ki = class extends ui {
5370
5496
  constructor(e, t, n, r, i, a, o = z, s = null) {
5371
5497
  super(o, s), h(this, "_sourceTrack", void 0), h(this, "_trackProcessor", void 0), h(this, "_onFrame", void 0), h(this, "_useCongestionControl", void 0), h(this, "_maxBitrate", void 0), h(this, "_useCbr", void 0), h(this, "_frameRate", void 0), this._sourceTrack = e, this._onFrame = t, this._useCongestionControl = n, this._maxBitrate = r, this._useCbr = i, this._frameRate = a, this._trackProcessor = new MediaStreamTrackProcessor({ track: e });
5372
5498
  }
@@ -5394,10 +5520,10 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5394
5520
  }, [n]);
5395
5521
  }
5396
5522
  requestFrame(e = !1) {
5397
- this._sendToWorker($r.FRAME, { keyFrame: e });
5523
+ this._sendToWorker(li.FRAME, { keyFrame: e });
5398
5524
  }
5399
5525
  setBitrate(e, t, n) {
5400
- this._sendToWorker($r.SET_BITRATE, {
5526
+ this._sendToWorker(li.SET_BITRATE, {
5401
5527
  bitrate: e,
5402
5528
  useCbr: t,
5403
5529
  fps: n
@@ -5412,11 +5538,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5412
5538
  static isBrowserSupported() {
5413
5539
  return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
5414
5540
  }
5415
- }, Li = 2100, Ri = 600, zi = 1.2, Bi = .8, Vi = 2e3, Hi = 8e3, Ui = 8e3, Wi = 16e3, Gi = 4, Ki = 2e3, qi = /* @__PURE__ */ function(e) {
5541
+ }, qi = 2100, Ji = 600, Yi = 1.2, Xi = .8, Zi = 2e3, Qi = 8e3, $i = 8e3, ea = 16e3, ta = 4, na = 2e3, ra = /* @__PURE__ */ function(e) {
5416
5542
  return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
5417
- }(qi || {}), Ji = class {
5543
+ }(ra || {}), ia = class {
5418
5544
  constructor(e, t, n, r, i, a, o, s = z) {
5419
- h(this, "_onCongestion", void 0), h(this, "_ccEnabled", void 0), h(this, "_fastSharing", void 0), h(this, "_trendDelayThreshold", void 0), h(this, "_highDelayThreshold", void 0), h(this, "_targetFps", void 0), h(this, "_minBitrate", void 0), h(this, "_maxBitrate", void 0), h(this, "_targetBitrate", void 0), h(this, "_lastDown", void 0), h(this, "_lastUp", void 0), h(this, "_lastProbing", void 0), h(this, "_lastCheckDelay", void 0), h(this, "_upPenalty", 0), h(this, "_probing", void 0), h(this, "_delayAvgShort", -1), h(this, "_delayAvgLong", -1), h(this, "_minDelay", Number.MAX_VALUE), h(this, "_maxDelay", 0), h(this, "_largeDelayDuration", 0), h(this, "_lastFpsCalcMs", void 0), h(this, "_frames", 0), h(this, "_fps", 0), h(this, "_debug", void 0), this._onCongestion = e, this._ccEnabled = r, this._debug = s, this._minBitrate = t, this._maxBitrate = n, this._fastSharing = i, this._targetFps = o, a > 0 ? this._highDelayThreshold = a : this._highDelayThreshold = Li, i && (this._highDelayThreshold = Ri), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
5545
+ h(this, "_onCongestion", void 0), h(this, "_ccEnabled", void 0), h(this, "_fastSharing", void 0), h(this, "_trendDelayThreshold", void 0), h(this, "_highDelayThreshold", void 0), h(this, "_targetFps", void 0), h(this, "_minBitrate", void 0), h(this, "_maxBitrate", void 0), h(this, "_targetBitrate", void 0), h(this, "_lastDown", void 0), h(this, "_lastUp", void 0), h(this, "_lastProbing", void 0), h(this, "_lastCheckDelay", void 0), h(this, "_upPenalty", 0), h(this, "_probing", void 0), h(this, "_delayAvgShort", -1), h(this, "_delayAvgLong", -1), h(this, "_minDelay", Number.MAX_VALUE), h(this, "_maxDelay", 0), h(this, "_largeDelayDuration", 0), h(this, "_lastFpsCalcMs", void 0), h(this, "_frames", 0), h(this, "_fps", 0), h(this, "_debug", void 0), this._onCongestion = e, this._ccEnabled = r, this._debug = s, this._minBitrate = t, this._maxBitrate = n, this._fastSharing = i, this._targetFps = o, a > 0 ? this._highDelayThreshold = a : this._highDelayThreshold = qi, i && (this._highDelayThreshold = Ji), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
5420
5546
  let c = Date.now();
5421
5547
  this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
5422
5548
  }
@@ -5426,27 +5552,27 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5426
5552
  let i = 0, a = this._delayAvgShort - this._delayAvgLong, o = Math.round(Math.abs(a) * 100 / this._delayAvgLong), s = a > 40 && o > 30 && this._delayAvgShort > this._trendDelayThreshold, c = this._delayAvgShort > this._highDelayThreshold;
5427
5553
  s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
5428
5554
  let l = Math.round(this._targetBitrate / 1e3), u = n;
5429
- e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${qi[i]} tr=${l} br=${n}`);
5555
+ e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ra[i]} tr=${l} br=${n}`);
5430
5556
  let d = r - this._lastDown;
5431
- if (i === 2 && d > Vi) {
5432
- this._probing && (this._upPenalty = Math.min(++this._upPenalty, Gi), this._probing = !1);
5433
- let n = Bi * u * 1e3;
5434
- if (n >= this._targetBitrate && (n = this._targetBitrate * Bi), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
5435
- let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * Ui / 1e3);
5436
- this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${qi[i]}`), this._debug.log(`#${e}: cc: DOWN delay=${t} bitrate=${u} target=${l} -> newBitrate=${r} penalty=${s}s`), this._setBitrate(n, !0), this._targetBitrate = n;
5557
+ if (i === 2 && d > Zi) {
5558
+ this._probing && (this._upPenalty = Math.min(++this._upPenalty, ta), this._probing = !1);
5559
+ let n = Xi * u * 1e3;
5560
+ if (n >= this._targetBitrate && (n = this._targetBitrate * Xi), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
5561
+ let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * $i / 1e3);
5562
+ this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ra[i]}`), this._debug.log(`#${e}: cc: DOWN delay=${t} bitrate=${u} target=${l} -> newBitrate=${r} penalty=${s}s`), this._setBitrate(n, !0), this._targetBitrate = n;
5437
5563
  }
5438
5564
  this._lastDown = r;
5439
5565
  }
5440
- let f = r - this._lastUp, p = Hi + this._upPenalty * Ui;
5566
+ let f = r - this._lastUp, p = Qi + this._upPenalty * $i;
5441
5567
  if (i === 1 && f > p && d > p) {
5442
- let n = Math.min(this._targetBitrate * zi, this._maxBitrate);
5568
+ let n = Math.min(this._targetBitrate * Yi, this._maxBitrate);
5443
5569
  if (n > this._targetBitrate) {
5444
- let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * Ui / 1e3);
5445
- this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${qi[i]}`), this._debug.log(`#${e}: cc: UP bitrate=${u} target=${c} -> newBitrate=${s} penalty=${l}s`), this._setBitrate(n, !1), this._targetBitrate = n, this._probing = !0, this._lastProbing = r, this._lastUp = r;
5570
+ let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * $i / 1e3);
5571
+ this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ra[i]}`), this._debug.log(`#${e}: cc: UP bitrate=${u} target=${c} -> newBitrate=${s} penalty=${l}s`), this._setBitrate(n, !1), this._targetBitrate = n, this._probing = !0, this._lastProbing = r, this._lastUp = r;
5446
5572
  }
5447
5573
  }
5448
5574
  let m = r - this._lastProbing;
5449
- this._probing && m > Wi && (this._probing = !1);
5575
+ this._probing && m > ea && (this._probing = !1);
5450
5576
  let ee = r - this._lastDown;
5451
5577
  this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
5452
5578
  }
@@ -5457,7 +5583,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5457
5583
  }
5458
5584
  _calcDelay(e, t) {
5459
5585
  if (!(e <= 0)) {
5460
- if (this._delayAvgShort === -1 && (this._delayAvgShort = e, this._delayAvgLong = e), this._delayAvgShort = Math.round((this._delayAvgShort * 3 + e) / 4), this._delayAvgLong = Math.round((this._delayAvgLong * 23 + e) / 24), e > 0 && e < this._minDelay ? this._minDelay = e : e > this._maxDelay && (this._maxDelay = e), this._lastCheckDelay === 0 && (this._lastCheckDelay = t), e > Ki) {
5586
+ if (this._delayAvgShort === -1 && (this._delayAvgShort = e, this._delayAvgLong = e), this._delayAvgShort = Math.round((this._delayAvgShort * 3 + e) / 4), this._delayAvgLong = Math.round((this._delayAvgLong * 23 + e) / 24), e > 0 && e < this._minDelay ? this._minDelay = e : e > this._maxDelay && (this._maxDelay = e), this._lastCheckDelay === 0 && (this._lastCheckDelay = t), e > na) {
5461
5587
  let e = t - this._lastCheckDelay;
5462
5588
  this._largeDelayDuration += e;
5463
5589
  }
@@ -5486,7 +5612,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5486
5612
  this._fps === 0 ? this._fps = Math.round(r) : this._fps = Math.round((this._fps * 3 + r) / 4), this._frames = 0, this._fps !== n && this._debug.log(`cc: fps=${this._fps}`);
5487
5613
  }
5488
5614
  }
5489
- }, Yi = class {
5615
+ }, aa = class {
5490
5616
  constructor(e) {
5491
5617
  h(this, "_maxSize", void 0), h(this, "_size", 0), h(this, "_buffer", void 0), h(this, "_head", 0), h(this, "_tail", 0), this._maxSize = e, this._buffer = Array(e);
5492
5618
  }
@@ -5560,11 +5686,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5560
5686
  clear() {
5561
5687
  this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
5562
5688
  }
5563
- }, Xi = 65536, Zi = 50, Qi = 400, $i = 1e6, ea = 3e5, ta = 3e4, na = 2e3, ra = 5, ia = 0, aa = class {
5689
+ }, oa = 65536, sa = 50, ca = 400, la = 1e6, ua = 3e5, da = 3e4, fa = 2e3, pa = 5, ma = 0, ha = class {
5564
5690
  constructor(e, t, n, r, i = z, a = null) {
5565
- h(this, "_encoder", void 0), h(this, "_datachannel", void 0), h(this, "_signaling", void 0), h(this, "_fastSharing", void 0), h(this, "_destroyed", !1), h(this, "_needKeyframe", !0), h(this, "DATA_SIZE", void 0), h(this, "_congestionControl", void 0), h(this, "_frameNum", 0), h(this, "_width", void 0), h(this, "_height", void 0), h(this, "_feedback", new Yi(1024)), h(this, "_lastSentFrameSeq", 0), h(this, "_lastDeliveredFrameSeq", 0), h(this, "_lastFrameDelay", 0), h(this, "_lastFramerateReduced", Date.now()), h(this, "_lastSharingStat", Date.now()), h(this, "_congestionControlEnabled", void 0), h(this, "_queue", new Ni()), h(this, "_fpsMeter", void 0), h(this, "_maxFrameDelay", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = i, this._logger = a, this._debug.debug("ScreenCaptureSender started"), this.DATA_SIZE = N.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = N.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? N.screenShareCongestionControlThreshold : N.screenShareCongestionControlThreshold * 2;
5691
+ h(this, "_encoder", void 0), h(this, "_datachannel", void 0), h(this, "_signaling", void 0), h(this, "_fastSharing", void 0), h(this, "_destroyed", !1), h(this, "_needKeyframe", !0), h(this, "DATA_SIZE", void 0), h(this, "_congestionControl", void 0), h(this, "_frameNum", 0), h(this, "_width", void 0), h(this, "_height", void 0), h(this, "_feedback", new aa(1024)), h(this, "_lastSentFrameSeq", 0), h(this, "_lastDeliveredFrameSeq", 0), h(this, "_lastFrameDelay", 0), h(this, "_lastFramerateReduced", Date.now()), h(this, "_lastSharingStat", Date.now()), h(this, "_congestionControlEnabled", void 0), h(this, "_queue", new Ui()), h(this, "_fpsMeter", void 0), h(this, "_maxFrameDelay", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = i, this._logger = a, this._debug.debug("ScreenCaptureSender started"), this.DATA_SIZE = N.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = N.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? N.screenShareCongestionControlThreshold : N.screenShareCongestionControlThreshold * 2;
5566
5692
  let o = N.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
5567
- this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new Ji(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
5693
+ this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new ia(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
5568
5694
  let u = (e, t) => {
5569
5695
  if (this._destroyed) return;
5570
5696
  if (!e) {
@@ -5575,23 +5701,23 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5575
5701
  let n = this._sliceFrame(e);
5576
5702
  this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
5577
5703
  };
5578
- if (Ii.isBrowserSupported()) {
5704
+ if (Ki.isBrowserSupported()) {
5579
5705
  let t = this._fastSharing;
5580
- this._encoder = new Ii(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
5581
- } else this._encoder = new Fi(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
5706
+ this._encoder = new Ki(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
5707
+ } else this._encoder = new Gi(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
5582
5708
  this._datachannel.onmessage = (e) => {
5583
- Si(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
5584
- let t = Ci(e.data);
5709
+ Mi(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
5710
+ let t = Ni(e.data);
5585
5711
  t !== null && this._checkCcFeedback(t);
5586
- }, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new ri((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
5712
+ }, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new pi((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
5587
5713
  }
5588
5714
  _handleQueue() {
5589
5715
  if (this._destroyed) return;
5590
5716
  let e = this._queue.shift();
5591
5717
  if (!e) {
5592
- if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + Xi) % Xi > ra && this._lastFrameDelay > this._maxFrameDelay) {
5718
+ if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + oa) % oa > pa && this._lastFrameDelay > this._maxFrameDelay) {
5593
5719
  let e = Date.now();
5594
- e - this._lastFramerateReduced > na && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
5720
+ e - this._lastFramerateReduced > fa && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
5595
5721
  } else this._requestFrame();
5596
5722
  return;
5597
5723
  }
@@ -5617,7 +5743,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5617
5743
  this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
5618
5744
  }
5619
5745
  _sliceFrame(e) {
5620
- let t = e.type === "key", n = e.data.byteLength, r = new Ni();
5746
+ let t = e.type === "key", n = e.data.byteLength, r = new Ui();
5621
5747
  for (let i = 0; i < n; i += this.DATA_SIZE) {
5622
5748
  let a = e.data.slice(i, i + this.DATA_SIZE), o = i === 0, s = n <= i + a.byteLength, c = this._wrapHeader(e.timestamp, o, s, t, a);
5623
5749
  r.push({
@@ -5633,11 +5759,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5633
5759
  return r;
5634
5760
  }
5635
5761
  _wrapHeader(e, t, n, r, i) {
5636
- let a = bi(e, t, n, r, ia, this._encoder.isVP9(), i), o = {
5637
- sequence: ia,
5762
+ let a = Ai(e, t, n, r, ma, this._encoder.isVP9(), i), o = {
5763
+ sequence: ma,
5638
5764
  data: a
5639
5765
  };
5640
- return ia = (ia + 1) % Xi, o;
5766
+ return ma = (ma + 1) % oa, o;
5641
5767
  }
5642
5768
  _stopPacket() {
5643
5769
  return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
@@ -5654,7 +5780,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5654
5780
  this._queue.clear(), this._fpsMeter.destroy(), this._datachannel.onmessage = null, this._feedback.clear(), this._datachannel.readyState === "open" && this._datachannel.send(this._stopPacket()), this._destroyed = !0, this._encoder.destroy(), this._debug.debug("ScreenCaptureSender destroyed");
5655
5781
  }
5656
5782
  static isBrowserSupported() {
5657
- return Ii.isBrowserSupported() || Fi.isBrowserSupported();
5783
+ return Ki.isBrowserSupported() || Gi.isBrowserSupported();
5658
5784
  }
5659
5785
  _onCongestionCallback(e, t, n) {
5660
5786
  this._encoder.setBitrate(e, t, n);
@@ -5667,8 +5793,8 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5667
5793
  (e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
5668
5794
  let n = e * t / 256;
5669
5795
  return {
5670
- minBitrate: Math.max(ea, Math.min($i, Math.round(n * Zi))),
5671
- maxBitrate: Math.round(n * Qi)
5796
+ minBitrate: Math.max(ua, Math.min(la, Math.round(n * sa))),
5797
+ maxBitrate: Math.round(n * ca)
5672
5798
  };
5673
5799
  }
5674
5800
  _checkCcFeedback(e) {
@@ -5682,14 +5808,14 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5682
5808
  }
5683
5809
  _sendSharingStat() {
5684
5810
  let e = Date.now();
5685
- if (e - this._lastSharingStat > ta) {
5811
+ if (e - this._lastSharingStat > da) {
5686
5812
  let t = this._congestionControl.getStat();
5687
5813
  t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t).catch((e) => {
5688
5814
  !(e instanceof Cn) && !(e instanceof wn) && this._debug.warn("Unable to send sharing stats", e);
5689
5815
  })), this._lastSharingStat = e;
5690
5816
  }
5691
5817
  }
5692
- }, oa = class {
5818
+ }, ga = class {
5693
5819
  constructor(e, t, n, r = z, i = null) {
5694
5820
  h(this, "_pc", null), h(this, "_transceiver", null), h(this, "_currentSimulcastInfo", null), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_getCameraSettings", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._signaling = e, this._mediaSource = t, this._getCameraSettings = n, this._debug = r, this._logger = i;
5695
5821
  }
@@ -5821,9 +5947,9 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5821
5947
  if (!(e instanceof wn)) throw e;
5822
5948
  }
5823
5949
  }
5824
- }, sa = 90, ca = 4294967295, la = class e extends Nr {
5950
+ }, _a = 90, va = 4294967295, ya = class e extends Ur {
5825
5951
  constructor(e, t, n, r = z, i = null, a = null, o = null, s = null) {
5826
- super(e, t, s), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new oa(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, vr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Kt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Kt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._debug.debug("ServerTransport: Created");
5952
+ super(e, t, s), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_sdpStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new Pr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new ga(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, vr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Kt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Kt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._debug.debug("ServerTransport: Created");
5827
5953
  }
5828
5954
  updateStatisticsInterval() {
5829
5955
  this._stopStatInterval();
@@ -5862,10 +5988,10 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5862
5988
  await this._simulcast.sync();
5863
5989
  }
5864
5990
  _createPerfStatsReporter() {
5865
- this._perfStatReporter?.destroy(), this._perfStatReporter = new ma(this, this._signaling, this._statAggregator, !1, this._debug);
5991
+ this._perfStatReporter?.destroy(), this._perfStatReporter = new wa(this, this._signaling, this._statAggregator, !1, this._debug);
5866
5992
  }
5867
5993
  _closeConnection() {
5868
- 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._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);
5994
+ 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._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);
5869
5995
  }
5870
5996
  static _closeDataChannel(e) {
5871
5997
  e && (e.onopen = null, e.onmessage = null, e.onerror = null, e.close());
@@ -5891,14 +6017,14 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5891
6017
  }
5892
6018
  this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = M.debounce((e) => {
5893
6019
  this._pc && this._onConnectionStateChange(this._pc, e);
5894
- }, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._participantIdRegistry = new Qr(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Sr.producerNotification, (e) => {
6020
+ }, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._participantIdRegistry = new ci(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Sr.producerNotification, (e) => {
5895
6021
  this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
5896
6022
  }), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, Sr.producerCommand, (e) => {
5897
6023
  this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
5898
6024
  }), this._createDataChannel(this._pc, Sr.producerScreenShare, (e) => {
5899
6025
  this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
5900
6026
  }), N.asrDataChannel && this._createDataChannel(this._pc, Sr.asr, (e) => {
5901
- this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new Yr(e, this._participantIdRegistry, (e) => {
6027
+ this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new ai(e, this._participantIdRegistry, (e) => {
5902
6028
  this._onAsrTranscription(e);
5903
6029
  }, this._debug);
5904
6030
  }), N.vmoji && this._createDataChannel(this._pc, Sr.animoji, (e) => {
@@ -5936,19 +6062,19 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
5936
6062
  }
5937
6063
  _updateSSRCMap(e) {
5938
6064
  e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, cn(e.sdp).forEach((e) => {
5939
- let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${qr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${qr.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
6065
+ let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${ri.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${ri.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
5940
6066
  n && (this._ssrcMap[n[1]] = n[3]);
5941
6067
  }));
5942
6068
  }
5943
6069
  _createCaptureSender(e) {
5944
6070
  let t = this._mediaSource.mediaSettings;
5945
- !e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new aa(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
6071
+ !e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new ha(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
5946
6072
  }
5947
6073
  _removeCaptureSender() {
5948
6074
  this._captureSender?.destroy(), this._captureSender = null;
5949
6075
  }
5950
6076
  _createCaptureReceiver() {
5951
- this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new ji(this._producerScreen, this._participantIdRegistry, (e, t) => {
6077
+ this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new Vi(this._producerScreen, this._participantIdRegistry, (e, t) => {
5952
6078
  this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, t);
5953
6079
  }, (e) => {
5954
6080
  this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, null);
@@ -6058,7 +6184,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6058
6184
  _detectStaleTracks(e) {
6059
6185
  let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
6060
6186
  if (!t) return;
6061
- let n = qr.AUDIO_MIX, r = this._statBytes[n], i = !1;
6187
+ let n = ri.AUDIO_MIX, r = this._statBytes[n], i = !1;
6062
6188
  if (r) {
6063
6189
  let e = t.bytesReceived - r.bytesReceived;
6064
6190
  e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(Y.AUDIO_MIX_STALL, i);
@@ -6070,31 +6196,31 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6070
6196
  }
6071
6197
  _allocateConsumer() {
6072
6198
  if (!this._signaling.ready) return;
6073
- let e = ba.get();
6199
+ let e = Aa.get();
6074
6200
  !N.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
6075
6201
  e instanceof Cn || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
6076
6202
  });
6077
6203
  }
6078
6204
  async _processOffer(e, t) {
6079
6205
  if (!this._pc) throw Error("Interrupt allocation");
6206
+ this._sdpStats.logSdpReceived(e.type);
6080
6207
  try {
6081
6208
  await this._pc.setRemoteDescription(e);
6082
- } catch (e) {
6083
- throw this._debug.error("[single] unable to set remote offer", e), this._logger?.log(C.ERROR, "setRemoteDescription-single"), e;
6209
+ } catch (t) {
6210
+ throw this._debug.error("[single] unable to set remote offer", t), this._logger?.log(C.ERROR, "setRemoteDescription-single"), this._sdpStats.logSetRemoteFailed(e, t), t;
6084
6211
  }
6085
- await this._simulcast.configureFromRemoteOffer(this._pc);
6212
+ if (await this._simulcast.configureFromRemoteOffer(this._pc), await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
6086
6213
  let n;
6087
6214
  try {
6088
- if (await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
6089
- n = await this._pc.createAnswer();
6215
+ n = await this._pc.createAnswer(), this._sdpStats.logSdpGenerated("answer");
6090
6216
  } catch (e) {
6091
- throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), e;
6217
+ throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), this._sdpStats.logCreateFailed("answer", e), e;
6092
6218
  }
6093
6219
  try {
6094
6220
  if (!this._pc) throw Error("Interrupt allocation");
6095
6221
  n.sdp = M.patchLocalSDP(n.sdp, !1, E.isBrokenH264Decoder(), !1), this._debug.debug("[single] set local answer", { answer: n }), await this._pc.setLocalDescription(n);
6096
6222
  } catch (e) {
6097
- throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), e;
6223
+ throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), this._sdpStats.logSetLocalFailed(n, e), e;
6098
6224
  }
6099
6225
  n.sdp = this._simulcast.finalizeAnswer(n.sdp);
6100
6226
  try {
@@ -6246,11 +6372,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6246
6372
  if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
6247
6373
  let i = r[0].rtpTimestamp;
6248
6374
  if (!Number.isInteger(i)) return this._logger?.log(C.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
6249
- let a = t - i & ca, o = Math.ceil(a / sa);
6375
+ let a = t - i & va, o = Math.ceil(a / _a);
6250
6376
  return Math.min(100, Math.max(0, o));
6251
6377
  }
6252
6378
  async _monitorRtpShare() {
6253
- let e = Zr.getInstance().value;
6379
+ let e = si.getInstance().value;
6254
6380
  if (!this._mediaSource.mediaSettings.isFastScreenSharingEnabled || !N.consumerFastScreenShare || e < .6) return;
6255
6381
  let t = this._pc?.getSenders().find((e) => e.track?.kind === A.video && e.track?.contentHint === "motion");
6256
6382
  t && (await t.getStats()).forEach((e) => {
@@ -6281,7 +6407,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6281
6407
  }
6282
6408
  }, Y = /* @__PURE__ */ function(e) {
6283
6409
  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;
6284
- }({}), ua = class extends b {
6410
+ }({}), ba = class extends b {
6285
6411
  constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
6286
6412
  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", () => {
6287
6413
  this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
@@ -6402,11 +6528,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6402
6528
  }
6403
6529
  }
6404
6530
  _createDirectTransport(e, t = !1) {
6405
- let n = new Kr(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6531
+ let n = new ni(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6406
6532
  return this._dtListeners.length > 0 && this._debug.warn(`The list of direct listeners for the participant [${e}] is not empty`), this._dtListeners = [], this._dtListeners.push(n.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this, e)), n.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this, e)), n.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), n.addEventListener("STATE_CHANGED", this._onDirectTransportChanged.bind(this)), n.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), n.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, J.DIRECT))), this._animojiReceiver && this._animojiSender && n.setAnimojiTransport(this._animojiReceiver, this._animojiSender), n;
6407
6533
  }
6408
6534
  _createServerTransport() {
6409
- let e = new la(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6535
+ let e = new ya(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6410
6536
  return this._stListeners.length > 0 && this._debug.warn("The list of server transport listeners is not empty"), this._stListeners = [], this._stListeners.push(e.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this)), e.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this)), e.addEventListener("AUDIO_MIX_STALL", this._onServerAudioMixStall.bind(this)), e.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), e.addEventListener("STATE_CHANGED", this._onServerTransportChanged.bind(this)), e.addEventListener("SIGNALLED_ACTIVE_PARTICIPANTS", this._onTransportActiveParticipants.bind(this)), e.addEventListener("SIGNALLED_SPEAKER_CHANGED", this._onTransportSpeakerChanged.bind(this)), e.addEventListener("SIGNALLED_STALLED_PARTICIPANTS", this._onTransportStalledParticipants.bind(this)), e.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), e.addEventListener("REMOTE_STREAM_SECOND", this._onRemoteStreamSecond.bind(this)), e.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, J.SERVER)), e.addEventListener("ASR_TRANSCRIPTION", this._onAsrTranscription.bind(this))), this._animojiReceiver && this._animojiSender && e.setAnimojiTransport(this._animojiReceiver, this._animojiSender), e;
6411
6537
  }
6412
6538
  _releaseDirectTransport() {
@@ -6498,7 +6624,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6498
6624
  getStreamWaitingTimeMs(e, t) {
6499
6625
  return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(C.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(C.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
6500
6626
  }
6501
- }, da = "videochat-epi", fa = 5e3, pa = 500, ma = class extends b {
6627
+ }, xa = "videochat-epi", Sa = 5e3, Ca = 500, wa = class extends b {
6502
6628
  constructor(e, t, n = null, r = !1, i = z) {
6503
6629
  super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCallStatReport", null), h(this, "_previousRemoteInboundRtps", /* @__PURE__ */ new Map()), 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) => {
6504
6630
  this._screenShareStats.push(e);
@@ -6511,7 +6637,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6511
6637
  }
6512
6638
  static getEstimatedPerformanceIndex() {
6513
6639
  try {
6514
- let e = parseInt(localStorage.getItem(da) || "", 10);
6640
+ let e = parseInt(localStorage.getItem(xa) || "", 10);
6515
6641
  return isNaN(e) ? 0 : e;
6516
6642
  } catch {
6517
6643
  return 0;
@@ -6520,9 +6646,9 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6520
6646
  async _handleStats(e) {
6521
6647
  if (!e.inbound || !e.inbound.rtps) return;
6522
6648
  let t = Date.now();
6523
- !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + fa <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
6649
+ !this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + Sa <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
6524
6650
  let n = e.outbound.transport.local?.protocol === "tcp";
6525
- !this._directTopology && n && this._previousNetworkStatReportTimestamp + pa <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
6651
+ !this._directTopology && n && this._previousNetworkStatReportTimestamp + Ca <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
6526
6652
  }
6527
6653
  async reportPerfStats(e) {
6528
6654
  let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
@@ -6531,7 +6657,7 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6531
6657
  });
6532
6658
  if (t.framesDecoded) try {
6533
6659
  let e = await this._signaling.reportPerfStat(t);
6534
- localStorage.setItem(da, e.estimatedPerformanceIndex);
6660
+ localStorage.setItem(xa, e.estimatedPerformanceIndex);
6535
6661
  } catch {}
6536
6662
  }
6537
6663
  async reportNetworkStats(e) {
@@ -6571,11 +6697,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6571
6697
  rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
6572
6698
  ss_freeze_count: 0,
6573
6699
  ss_total_freezes_duration: 0,
6574
- local_address: ga(e.inbound.transport.local),
6700
+ local_address: Ea(e.inbound.transport.local),
6575
6701
  local_connection_type: e.inbound.transport.local?.type,
6576
6702
  network_type: e.inbound.transport.local?.networkType,
6577
6703
  transport: e.inbound.transport.local?.protocol,
6578
- remote_address: ga(e.inbound.transport.remote),
6704
+ remote_address: Ea(e.inbound.transport.remote),
6579
6705
  remote_connection_type: e.inbound.transport.remote?.type
6580
6706
  };
6581
6707
  this._previousCallStatReport || (this._previousCallStatReport = Object.assign({}, t));
@@ -6596,11 +6722,11 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6596
6722
  frames_dropped: Math.max(0, t.frames_dropped - this._previousCallStatReport.frames_dropped),
6597
6723
  rtt: Math.max(0, t.rtt)
6598
6724
  };
6599
- if (N.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !_a(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !_a(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !_a(t.interframe_delay_variance) && (i.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (i.freeze_count = t.freeze_count, i.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (i.ss_freeze_count = t.ss_freeze_count, i.ss_total_freezes_duration = t.ss_total_freezes_duration), r && !_a(t.total_audio_samples_received)) {
6725
+ if (N.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !Da(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !Da(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !Da(t.interframe_delay_variance) && (i.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (i.freeze_count = t.freeze_count, i.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (i.ss_freeze_count = t.ss_freeze_count, i.ss_total_freezes_duration = t.ss_total_freezes_duration), r && !Da(t.total_audio_samples_received)) {
6600
6726
  let e = Math.max(0, t.total_audio_samples_received - this._previousCallStatReport.total_audio_samples_received), n = Math.max(0, t.inserted_audio_samples_for_deceleration - this._previousCallStatReport.inserted_audio_samples_for_deceleration), r = Math.max(0, t.removed_audio_samples_for_acceleration - this._previousCallStatReport.removed_audio_samples_for_acceleration), a = Math.max(0, t.concealed_audio_samples - this._previousCallStatReport.concealed_audio_samples), o = Math.max(0, t.silent_concealed_audio_samples - this._previousCallStatReport.silent_concealed_audio_samples), s = Math.max(0, t.audio_concealment_events - this._previousCallStatReport.audio_concealment_events);
6601
- i.inserted_audio_samples_for_deceleration = va(n / e * 1e3), i.removed_audio_samples_for_acceleration = va(r / e * 1e3), i.concealed_audio_samples = va(a / e * 1e3), i.concealed_silent_audio_samples = va(o / e * 1e3), i.concealment_audio_avg_size = va(a / s), i.total_audio_energy = t.total_audio_energy;
6727
+ i.inserted_audio_samples_for_deceleration = Oa(n / e * 1e3), i.removed_audio_samples_for_acceleration = Oa(r / e * 1e3), i.concealed_audio_samples = Oa(a / e * 1e3), i.concealed_silent_audio_samples = Oa(o / e * 1e3), i.concealment_audio_avg_size = Oa(a / s), i.total_audio_energy = t.total_audio_energy;
6602
6728
  }
6603
- ha(t, "local_address", "local_connection_type", "network_type", "transport") && (i.local_address = t.local_address, i.local_connection_type = t.local_connection_type, i.network_type = t.network_type, i.transport = t.transport), ha(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
6729
+ Ta(t, "local_address", "local_connection_type", "network_type", "transport") && (i.local_address = t.local_address, i.local_connection_type = t.local_connection_type, i.network_type = t.network_type, i.transport = t.transport), Ta(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
6604
6730
  let a = this._calculatePacketLoss(e.remoteInbound.rtps);
6605
6731
  a.video !== void 0 && (i.video_loss = a.video), a.audio !== void 0 && (i.audio_loss = a.audio), this._statAggregator?.logCallStat(i), N.enableLogPerfStatReport && this._debug.log("Sent call stats", i), this._previousCallStatReport = t;
6606
6732
  }
@@ -6632,26 +6758,26 @@ var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
6632
6758
  return r;
6633
6759
  }
6634
6760
  };
6635
- function ha(e, ...t) {
6761
+ function Ta(e, ...t) {
6636
6762
  for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
6637
6763
  return !0;
6638
6764
  }
6639
- function ga(e, t = !1) {
6765
+ function Ea(e, t = !1) {
6640
6766
  if (e?.address) return e.address + (t ? `:${e.port}` : "");
6641
6767
  }
6642
- function _a(e) {
6768
+ function Da(e) {
6643
6769
  return e === void 0;
6644
6770
  }
6645
- function va(e) {
6771
+ function Oa(e) {
6646
6772
  return Number.isNaN(e) ? 0 : e;
6647
6773
  }
6648
6774
  //#endregion
6649
6775
  //#region src/static/Capabilities.ts
6650
- var ya;
6776
+ var ka;
6651
6777
  (function(e) {
6652
6778
  function t() {
6653
6779
  return {
6654
- estimatedPerformanceIndex: ma.getEstimatedPerformanceIndex(),
6780
+ estimatedPerformanceIndex: wa.getEstimatedPerformanceIndex(),
6655
6781
  audioMix: !0,
6656
6782
  consumerUpdate: !0,
6657
6783
  producerNotificationDataChannelVersion: 8,
@@ -6677,8 +6803,8 @@ var ya;
6677
6803
  };
6678
6804
  }
6679
6805
  e.get = t;
6680
- })(ya || (ya = {}));
6681
- var ba = ya, xa = {
6806
+ })(ka || (ka = {}));
6807
+ var Aa = ka, ja = {
6682
6808
  producerScreenTrack: () => !0,
6683
6809
  videoTracksCount: () => N.videoTracksCount > 0,
6684
6810
  waitingHall: () => !0,
@@ -6698,28 +6824,28 @@ var ba = ya, xa = {
6698
6824
  p2pRelay: () => !1,
6699
6825
  waitForAdmin: () => N.waitForAdminInGroupCalls,
6700
6826
  hold: () => N.hold
6701
- }, Sa = class {
6827
+ }, Ma = class {
6702
6828
  static getFlags() {
6703
- let e = Object.values(xa), t = 0;
6829
+ let e = Object.values(ja), t = 0;
6704
6830
  for (let n = 0; n < e.length; n++) e[n]() && (t |= 1 << n);
6705
6831
  return t.toString(16).toUpperCase();
6706
6832
  }
6707
6833
  static parseCapabilities(e) {
6708
6834
  let t = parseInt(e || "0", 16);
6709
- return Object.keys(xa).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
6835
+ return Object.keys(ja).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
6710
6836
  }
6711
- }, Ca = 63n, wa = 16383n, Ta = 1073741823, Ea = 4611686018427387903n, Da = class {
6837
+ }, Na = 63n, Pa = 16383n, Fa = 1073741823, Ia = 4611686018427387903n, La = class {
6712
6838
  encode(e) {
6713
6839
  let t = typeof e == "number" ? BigInt(e) : e;
6714
- if (t <= Ca) return new Uint8Array([Number(t)]);
6715
- if (t <= wa) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
6716
- if (t <= BigInt(Ta)) return new Uint8Array([
6840
+ if (t <= Na) return new Uint8Array([Number(t)]);
6841
+ if (t <= Pa) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
6842
+ if (t <= BigInt(Fa)) return new Uint8Array([
6717
6843
  128 | Number(t >> 24n),
6718
6844
  Number(t >> 16n & 255n),
6719
6845
  Number(t >> 8n & 255n),
6720
6846
  Number(t & 255n)
6721
6847
  ]);
6722
- if (t <= Ea) return new Uint8Array([
6848
+ if (t <= Ia) return new Uint8Array([
6723
6849
  192 | Number(t >> 56n),
6724
6850
  Number(t >> 48n & 255n),
6725
6851
  Number(t >> 40n & 255n),
@@ -6731,7 +6857,7 @@ var ba = ya, xa = {
6731
6857
  ]);
6732
6858
  throw RangeError("Number is too large to encode using varint");
6733
6859
  }
6734
- }, Oa = class {
6860
+ }, Ra = class {
6735
6861
  decode(e) {
6736
6862
  let t = this.getNumBytesForLengthInteger(e);
6737
6863
  if (t < 0) throw Error("Invalid length prefix");
@@ -6757,9 +6883,9 @@ var ba = ya, xa = {
6757
6883
  let t = e[0] & 192;
6758
6884
  return t === 0 ? 1 : t === 64 ? 2 : t === 128 ? 4 : t === 192 ? 8 : -1;
6759
6885
  }
6760
- }, ka = class {
6886
+ }, za = class {
6761
6887
  constructor(e) {
6762
- h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new Da(), this.compression = e ?? null;
6888
+ h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new La(), this.compression = e ?? null;
6763
6889
  }
6764
6890
  encode(e) {
6765
6891
  let t = this.encoder.encode(e);
@@ -6776,9 +6902,9 @@ var ba = ya, xa = {
6776
6902
  default: return e;
6777
6903
  }
6778
6904
  }
6779
- }, Aa = class {
6905
+ }, Ba = class {
6780
6906
  constructor(e) {
6781
- 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 Oa(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
6907
+ 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 Ra(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
6782
6908
  }
6783
6909
  decode(e) {
6784
6910
  let t = [];
@@ -6808,12 +6934,12 @@ var ba = ya, xa = {
6808
6934
  default: return e;
6809
6935
  }
6810
6936
  }
6811
- }, ja = class {
6937
+ }, Va = class {
6812
6938
  static isBrowserSupported() {
6813
6939
  return !(!("WebTransport" in window && typeof WebTransport == "function") || E.browserName() === "Safari");
6814
6940
  }
6815
6941
  constructor(e, t = {}, n = z) {
6816
- 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 ka(this.compression), this.decoder = new Aa(this.compression), this.connect();
6942
+ 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 za(this.compression), this.decoder = new Ba(this.compression), this.connect();
6817
6943
  }
6818
6944
  async send(e) {
6819
6945
  if (this.readyState !== WebSocket.OPEN) {
@@ -6939,9 +7065,9 @@ var ba = ya, xa = {
6939
7065
  compression: this.compression
6940
7066
  }, n;
6941
7067
  }
6942
- }, Ma = /* @__PURE__ */ function(e) {
7068
+ }, Ha = /* @__PURE__ */ function(e) {
6943
7069
  return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
6944
- }({}), Na = class {
7070
+ }({}), Ua = class {
6945
7071
  constructor(e = z, t) {
6946
7072
  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, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", yr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
6947
7073
  }
@@ -6991,7 +7117,7 @@ var ba = ya, xa = {
6991
7117
  return;
6992
7118
  }
6993
7119
  let e = this._buildUrl(this.wtEndpoint, !0);
6994
- this.currentType = yr.WEBTRANSPORT, this.socket = new ja(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
7120
+ this.currentType = yr.WEBTRANSPORT, this.socket = new Va(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
6995
7121
  }
6996
7122
  _connectWebSocket() {
6997
7123
  if (!this.endpoint) {
@@ -7014,10 +7140,10 @@ var ba = ya, xa = {
7014
7140
  }
7015
7141
  _buildUrl(e, t) {
7016
7142
  let n = new URL(e), r = n.searchParams;
7017
- 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", Sa.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === _r.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();
7143
+ 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", Ma.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === _r.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();
7018
7144
  }
7019
7145
  _canUseWebTransport() {
7020
- return !this.forceWebSocket && ja.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
7146
+ return !this.forceWebSocket && Va.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
7021
7147
  }
7022
7148
  _onOpen() {
7023
7149
  this._startDoctor(), this.handlers.onOpen();
@@ -7071,31 +7197,31 @@ var ba = ya, xa = {
7071
7197
  _stopDoctor() {
7072
7198
  window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
7073
7199
  }
7074
- }, Pa = "open", Fa = 10, Ia = {
7200
+ }, Wa = "open", Ga = 10, Ka = {
7075
7201
  CONVERSATION_ENDED: "conversation-ended",
7076
7202
  OBSOLETE_CLIENT: "gen.obsoleteClient",
7077
7203
  INVALID_TOKEN: "invalid-token",
7078
7204
  PARTICIPANT_NOT_FOUND: "participant-not-found",
7079
7205
  ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
7080
7206
  SERVICE_UNAVAILABLE: "service-unavailable"
7081
- }, La = {
7082
- [Ia.CONVERSATION_ENDED]: "conversation-ended",
7083
- [Ia.OBSOLETE_CLIENT]: "obsolete-client",
7084
- [Ia.INVALID_TOKEN]: "invalid-token",
7085
- [Ia.PARTICIPANT_NOT_FOUND]: "participant-not-found",
7086
- [Ia.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
7087
- [Ia.SERVICE_UNAVAILABLE]: "service-unavailable"
7207
+ }, qa = {
7208
+ [Ka.CONVERSATION_ENDED]: "conversation-ended",
7209
+ [Ka.OBSOLETE_CLIENT]: "obsolete-client",
7210
+ [Ka.INVALID_TOKEN]: "invalid-token",
7211
+ [Ka.PARTICIPANT_NOT_FOUND]: "participant-not-found",
7212
+ [Ka.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
7213
+ [Ka.SERVICE_UNAVAILABLE]: "service-unavailable"
7088
7214
  };
7089
- function Ra(e, t) {
7215
+ function Ja(e, t) {
7090
7216
  return e.errorMessage ?? e.message ?? e.error ?? t;
7091
7217
  }
7092
- var za = new Set([
7218
+ var Ya = new Set([
7093
7219
  O.CALLER_IS_BLOCKED,
7094
7220
  O.ENDED,
7095
7221
  O.NOT_FOUND,
7096
7222
  O.PARTICIPANT_LIMIT_REACHED,
7097
7223
  O.SERVICE_UNAVAILABLE
7098
- ]), Ba = class e extends Tn {
7224
+ ]), Xa = class e extends Tn {
7099
7225
  static get WAIT_CONNECTION_DELAY() {
7100
7226
  return N.waitConnectionDelay;
7101
7227
  }
@@ -7106,7 +7232,7 @@ var za = new Set([
7106
7232
  return !this.disposed && this.transport.readyState !== null;
7107
7233
  }
7108
7234
  constructor(e = z, t = null, n = null, r = null, i = null) {
7109
- 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, "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 Qn(e), this.transport = new Na(e, {
7235
+ 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, "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 Qn(e), this.transport = new Ua(e, {
7110
7236
  onConnecting: this._onTransportConnecting.bind(this),
7111
7237
  onOpen: this._onOpen.bind(this),
7112
7238
  onMessage: this._onMessage.bind(this),
@@ -7193,20 +7319,20 @@ var za = new Set([
7193
7319
  return this._send(V.TRANSMIT_DATA, {
7194
7320
  participantId: e,
7195
7321
  data: r
7196
- }, !0, Fa);
7322
+ }, !0, Ga);
7197
7323
  }
7198
7324
  async acceptCall(e) {
7199
7325
  return this._send(V.ACCEPT_CALL, { mediaSettings: e });
7200
7326
  }
7201
7327
  async changeMediaSettings(e) {
7202
- return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Fa);
7328
+ return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Ga);
7203
7329
  }
7204
7330
  async changeParticipantState(e, t) {
7205
7331
  let n = { participantState: { state: e } };
7206
7332
  return t && (n.participantId = t), this._sendRaw(V.CHANGE_PARTICIPANT_STATE, n);
7207
7333
  }
7208
7334
  async hold(e) {
7209
- let t = ba.get();
7335
+ let t = Aa.get();
7210
7336
  return this._send(V.HOLD, {
7211
7337
  hold: e,
7212
7338
  capabilities: e ? void 0 : t
@@ -7438,7 +7564,7 @@ var za = new Set([
7438
7564
  if (this.disposed) throw new Cn(e);
7439
7565
  switch (t.route) {
7440
7566
  case "producer":
7441
- this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === Pa && this._handleCommandsQueue(this.datachannelCommandsQueue);
7567
+ this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === Wa && this._handleCommandsQueue(this.datachannelCommandsQueue);
7442
7568
  break;
7443
7569
  case "websocket":
7444
7570
  if (this.transport.readyState === null) {
@@ -7508,9 +7634,9 @@ var za = new Set([
7508
7634
  }
7509
7635
  _handleErrorMessage(e) {
7510
7636
  this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
7511
- let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = Ra(e, "Unknown signaling error");
7637
+ let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = Ja(e, "Unknown signaling error");
7512
7638
  switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
7513
- case Ia.SERVICE_UNAVAILABLE:
7639
+ case Ka.SERVICE_UNAVAILABLE:
7514
7640
  let i = new k(O.SERVICE_UNAVAILABLE, {
7515
7641
  callError: n,
7516
7642
  message: r,
@@ -7522,7 +7648,7 @@ var za = new Set([
7522
7648
  reason: O.SERVICE_UNAVAILABLE
7523
7649
  });
7524
7650
  break;
7525
- case Ia.CONVERSATION_ENDED:
7651
+ case Ka.CONVERSATION_ENDED:
7526
7652
  this.conversationReject ? this.conversationReject(new k(e.reason || x.SIGNALING_FAILED, {
7527
7653
  callError: n,
7528
7654
  message: r,
@@ -7533,22 +7659,22 @@ var za = new Set([
7533
7659
  reason: e.reason
7534
7660
  });
7535
7661
  break;
7536
- case Ia.ILLEGAL_PARTICIPANT_STATE:
7537
- case Ia.PARTICIPANT_NOT_FOUND:
7662
+ case Ka.ILLEGAL_PARTICIPANT_STATE:
7663
+ case Ka.PARTICIPANT_NOT_FOUND:
7538
7664
  this._throwError(new k(x.SIGNALING_FAILED, {
7539
7665
  callError: n,
7540
7666
  message: r,
7541
7667
  remote: !0
7542
7668
  }));
7543
7669
  break;
7544
- case Ia.OBSOLETE_CLIENT:
7670
+ case Ka.OBSOLETE_CLIENT:
7545
7671
  this.conversationReject?.(new k(e.reason || O.OBSOLETE_CLIENT, {
7546
7672
  callError: n,
7547
7673
  message: r,
7548
7674
  remote: !0
7549
7675
  }));
7550
7676
  break;
7551
- case Ia.INVALID_TOKEN:
7677
+ case Ka.INVALID_TOKEN:
7552
7678
  default:
7553
7679
  if (e.sequence || t === yr.WEBTRANSPORT) break;
7554
7680
  if (this.connected) this._throwError(new k(e.reason || x.SIGNALING_FAILED, {
@@ -7650,13 +7776,13 @@ var za = new Set([
7650
7776
  let r = this.responseHandlers[n.sequence];
7651
7777
  window.clearTimeout(r.responseTimer);
7652
7778
  let i = G.measureMark(r.statMarkName);
7653
- 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(C.SOCKET_ACTION, "response-error"), r.reject(Error(Ra(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-timeout"), r.reject(Error(Ra(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7779
+ 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(C.SOCKET_ACTION, "response-error"), r.reject(Error(Ja(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-timeout"), r.reject(Error(Ja(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
7654
7780
  }
7655
7781
  _handleCommandsQueue(e) {
7656
7782
  for (; e.length > 0;) {
7657
7783
  let t = e.shift();
7658
7784
  if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), t.route === "producer") {
7659
- if (this.producerCommandDataChannel?.readyState !== Pa) {
7785
+ if (this.producerCommandDataChannel?.readyState !== Wa) {
7660
7786
  t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
7661
7787
  return;
7662
7788
  }
@@ -7741,7 +7867,7 @@ var za = new Set([
7741
7867
  }
7742
7868
  _onTransportFailed(e) {
7743
7869
  switch (e.failure) {
7744
- case Ma.EMPTY_ENDPOINT:
7870
+ case Ha.EMPTY_ENDPOINT:
7745
7871
  this.conversationReject?.(new k(x.SIGNALING_FAILED, {
7746
7872
  callError: {
7747
7873
  scope: "internal",
@@ -7752,7 +7878,7 @@ var za = new Set([
7752
7878
  remote: e.remote
7753
7879
  }));
7754
7880
  break;
7755
- case Ma.NETWORK_ERROR:
7881
+ case Ha.NETWORK_ERROR:
7756
7882
  this._fail(new k(O.NETWORK_ERROR, { callError: {
7757
7883
  scope: "network",
7758
7884
  source: e.source,
@@ -7760,7 +7886,7 @@ var za = new Set([
7760
7886
  description: "connection-failed"
7761
7887
  } }));
7762
7888
  break;
7763
- case Ma.ABORTED:
7889
+ case Ha.ABORTED:
7764
7890
  this._debug.debug("[signaling] aborted reconnect"), this._fail(new k(O.CANCELED));
7765
7891
  break;
7766
7892
  }
@@ -7772,7 +7898,7 @@ var za = new Set([
7772
7898
  this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(br.FAILED_PINGS);
7773
7899
  }
7774
7900
  _attachNotificationCallError(e) {
7775
- e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !za.has(e.reason) && !e.errorCode || (e.callError = {
7901
+ e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !Ya.has(e.reason) && !e.errorCode || (e.callError = {
7776
7902
  scope: "server",
7777
7903
  source: this._getSocketType(),
7778
7904
  code: e.errorCode || "protocol",
@@ -7780,7 +7906,7 @@ var za = new Set([
7780
7906
  });
7781
7907
  }
7782
7908
  _createSignalingCallError(e, t, n) {
7783
- let r = La[e];
7909
+ let r = qa[e];
7784
7910
  if (r) return {
7785
7911
  scope: "server",
7786
7912
  source: n,
@@ -7802,39 +7928,39 @@ var za = new Set([
7802
7928
  ...t
7803
7929
  });
7804
7930
  }
7805
- }, Va = /* @__PURE__ */ function(e) {
7931
+ }, Za = /* @__PURE__ */ function(e) {
7806
7932
  return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
7807
- }(Va || {}), Ha = /* @__PURE__ */ function(e) {
7933
+ }(Za || {}), Qa = /* @__PURE__ */ function(e) {
7808
7934
  return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
7809
- }(Ha || {}), Ua = /* @__PURE__ */ function(e) {
7935
+ }(Qa || {}), $a = /* @__PURE__ */ function(e) {
7810
7936
  return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
7811
- }(Ua || {}), Wa = /* @__PURE__ */ function(e) {
7937
+ }($a || {}), eo = /* @__PURE__ */ function(e) {
7812
7938
  return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
7813
- }(Wa || {}), Ga = /* @__PURE__ */ function(e) {
7939
+ }(eo || {}), to = /* @__PURE__ */ function(e) {
7814
7940
  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;
7815
- }(Ga || {});
7816
- function Ka(e, t) {
7941
+ }(to || {});
7942
+ function no(e, t) {
7817
7943
  if (e.length !== t.length) return !1;
7818
7944
  for (let n of e) if (!t.includes(n)) return !1;
7819
7945
  return !0;
7820
7946
  }
7821
- function qa(e, t) {
7947
+ function ro(e, t) {
7822
7948
  let n = new Set(e);
7823
7949
  for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
7824
7950
  return Array.from(n);
7825
7951
  }
7826
7952
  //#endregion
7827
7953
  //#region src/enums/MuteState.ts
7828
- var Ja = /* @__PURE__ */ function(e) {
7954
+ var io = /* @__PURE__ */ function(e) {
7829
7955
  return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
7830
- }(Ja || {}), X = /* @__PURE__ */ function(e) {
7956
+ }(io || {}), X = /* @__PURE__ */ function(e) {
7831
7957
  return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
7832
- }(X || {}), Ya = /* @__PURE__ */ function(e) {
7958
+ }(X || {}), ao = /* @__PURE__ */ function(e) {
7833
7959
  return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
7834
- }(Ya || {}), Xa = /* @__PURE__ */ function(e) {
7960
+ }(ao || {}), oo = /* @__PURE__ */ function(e) {
7835
7961
  return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
7836
- }(Xa || {});
7837
- function Za(e) {
7962
+ }(oo || {});
7963
+ function so(e) {
7838
7964
  switch (e) {
7839
7965
  case 1: return "no-available-tracks";
7840
7966
  default: return "unknown-error";
@@ -7842,17 +7968,17 @@ function Za(e) {
7842
7968
  }
7843
7969
  //#endregion
7844
7970
  //#region src/enums/UserRole.ts
7845
- var Qa = /* @__PURE__ */ function(e) {
7971
+ var co = /* @__PURE__ */ function(e) {
7846
7972
  return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
7847
- }(Qa || {});
7848
- function $a(e, t) {
7973
+ }(co || {});
7974
+ function lo(e, t) {
7849
7975
  if (e.length !== t.length) return !1;
7850
7976
  for (let n of e) if (!t.includes(n)) return !1;
7851
7977
  return !0;
7852
7978
  }
7853
7979
  //#endregion
7854
7980
  //#region src/static/ParticipantConnectionStatusUtils.ts
7855
- var eo;
7981
+ var uo;
7856
7982
  (function(e) {
7857
7983
  function t(e) {
7858
7984
  let t = e?.transport ?? e?.lastEffective ?? P.WAITING, n = {
@@ -7904,8 +8030,8 @@ var eo;
7904
8030
  shouldNotify: !0
7905
8031
  });
7906
8032
  }
7907
- })(eo || (eo = {}));
7908
- var to = eo, no = /* @__PURE__ */ function(e) {
8033
+ })(uo || (uo = {}));
8034
+ var fo = uo, po = /* @__PURE__ */ function(e) {
7909
8035
  return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
7910
8036
  }({}), Z;
7911
8037
  (function(e) {
@@ -7968,7 +8094,7 @@ var to = eo, no = /* @__PURE__ */ function(e) {
7968
8094
  })(Z || (Z = {}));
7969
8095
  //#endregion
7970
8096
  //#region src/types/WaitingHall.ts
7971
- function ro(e) {
8097
+ function mo(e) {
7972
8098
  try {
7973
8099
  return btoa(JSON.stringify(e));
7974
8100
  } catch (t) {
@@ -7976,7 +8102,7 @@ function ro(e) {
7976
8102
  }
7977
8103
  return null;
7978
8104
  }
7979
- function io(e) {
8105
+ function ho(e) {
7980
8106
  try {
7981
8107
  return JSON.parse(atob(e));
7982
8108
  } catch (t) {
@@ -7986,12 +8112,12 @@ function io(e) {
7986
8112
  }
7987
8113
  //#endregion
7988
8114
  //#region src/utils/Conversation.ts
7989
- var ao = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
7990
- function oo(e) {
8115
+ var go = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
8116
+ function _o(e) {
7991
8117
  if (e.conversation?.muteStates) return e.conversation.muteStates;
7992
8118
  if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
7993
8119
  }
7994
- function so(e, t) {
8120
+ function vo(e, t) {
7995
8121
  switch (e) {
7996
8122
  case S.AUDIO: return !!t.isAudioEnabled;
7997
8123
  case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
@@ -8000,12 +8126,12 @@ function so(e, t) {
8000
8126
  default: return !1;
8001
8127
  }
8002
8128
  }
8003
- function co(e, t) {
8129
+ function yo(e, t) {
8004
8130
  return M.objectReduce(e, (e, n, r) => {
8005
8131
  switch (n) {
8006
- case Ja.MUTE:
8007
- case Ja.MUTE_PERMANENT:
8008
- so(r, t) || (e[r] = n);
8132
+ case io.MUTE:
8133
+ case io.MUTE_PERMANENT:
8134
+ vo(r, t) || (e[r] = n);
8009
8135
  break;
8010
8136
  default:
8011
8137
  e[r] = n;
@@ -8014,19 +8140,19 @@ function co(e, t) {
8014
8140
  return e;
8015
8141
  }, {});
8016
8142
  }
8017
- function lo(e) {
8143
+ function bo(e) {
8018
8144
  let { muteStates: t = {}, mediaSettings: n } = e;
8019
- return co(t, n);
8145
+ return yo(t, n);
8020
8146
  }
8021
- function uo(e, t) {
8147
+ function xo(e, t) {
8022
8148
  let n = e.conversation.participants.find((t) => M.comparePeerId(t.peerId, e.peerId));
8023
8149
  if (!n) return t;
8024
8150
  let { mediaSettings: r } = n;
8025
- return co(t, r);
8151
+ return yo(t, r);
8026
8152
  }
8027
8153
  //#endregion
8028
8154
  //#region src/utils/IceServers.ts
8029
- function fo(e) {
8155
+ function So(e) {
8030
8156
  if (!e) return null;
8031
8157
  let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
8032
8158
  return t.length ? {
@@ -8034,8 +8160,8 @@ function fo(e) {
8034
8160
  urls: t
8035
8161
  } : null;
8036
8162
  }
8037
- function po(e, t) {
8038
- let n = [], r = fo(e), i = fo(t);
8163
+ function Co(e, t) {
8164
+ let n = [], r = So(e), i = So(t);
8039
8165
  if (r && n.push(r), i) {
8040
8166
  let e = [...i.urls];
8041
8167
  e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
@@ -8047,7 +8173,7 @@ function po(e, t) {
8047
8173
  }
8048
8174
  //#endregion
8049
8175
  //#region src/utils/Lz4.ts
8050
- function mo(e, t) {
8176
+ function wo(e, t) {
8051
8177
  let n = new Uint8Array(t), r = 0, i = 0;
8052
8178
  for (; r < e.length && i < t;) {
8053
8179
  let a = e[r++], o = a >> 4, s = a & 15;
@@ -8074,7 +8200,7 @@ function mo(e, t) {
8074
8200
  }
8075
8201
  //#endregion
8076
8202
  //#region src/utils/SerializeLatest.ts
8077
- function ho(e) {
8203
+ function To(e) {
8078
8204
  let t, n = !1, r, i = async () => {
8079
8205
  let t = !1, i;
8080
8206
  for (; n;) {
@@ -8095,7 +8221,7 @@ function ho(e) {
8095
8221
  }
8096
8222
  //#endregion
8097
8223
  //#region src/classes/AudioFix.ts
8098
- var go = class {
8224
+ var Eo = class {
8099
8225
  constructor(e, t = z, n = null) {
8100
8226
  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;
8101
8227
  }
@@ -8133,7 +8259,7 @@ var go = class {
8133
8259
  this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
8134
8260
  }));
8135
8261
  }
8136
- }, _o = class {
8262
+ }, Do = class {
8137
8263
  constructor(e, t = !1, n = z, r = null) {
8138
8264
  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();
8139
8265
  }
@@ -8234,13 +8360,13 @@ var go = class {
8234
8360
  };
8235
8361
  //#endregion
8236
8362
  //#region src/classes/conversation/ConversationResponseValidator.ts
8237
- function vo(e, t) {
8238
- e || bo(t, "response-empty"), e.id || bo(t, "id-empty"), e.endpoint || bo(t, "endpoint-empty"), !yo(e.stun_server) && !yo(e.turn_server) && bo(t, "ice-servers-empty");
8363
+ function Oo(e, t) {
8364
+ e || Ao(t, "response-empty"), e.id || Ao(t, "id-empty"), e.endpoint || Ao(t, "endpoint-empty"), !ko(e.stun_server) && !ko(e.turn_server) && Ao(t, "ice-servers-empty");
8239
8365
  }
8240
- function yo(e) {
8366
+ function ko(e) {
8241
8367
  return Array.isArray(e?.urls) && e.urls.length > 0;
8242
8368
  }
8243
- function bo(e, t) {
8369
+ function Ao(e, t) {
8244
8370
  let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
8245
8371
  throw new k(r ? e === "fastStart" ? O.FAST_START_ERROR : O.FAST_JOIN_ERROR : O.UNKNOWN_ERROR, {
8246
8372
  message: `Invalid ${e} response: ${t}`,
@@ -8259,7 +8385,7 @@ function bo(e, t) {
8259
8385
  }
8260
8386
  //#endregion
8261
8387
  //#region src/classes/DebugInfo.ts
8262
- var xo = 90, So = 3, Co = class extends b {
8388
+ var jo = 90, Mo = 3, No = class extends b {
8263
8389
  constructor(e = z) {
8264
8390
  super(), h(this, "_lastMemoryStat", {
8265
8391
  percent: 0,
@@ -8275,9 +8401,9 @@ var xo = 90, So = 3, Co = class extends b {
8275
8401
  let e = window?.performance?.memory;
8276
8402
  if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
8277
8403
  let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
8278
- t > xo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= So) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
8404
+ t > jo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Mo) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
8279
8405
  }
8280
- }, wo = class {
8406
+ }, Po = class {
8281
8407
  constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
8282
8408
  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;
8283
8409
  }
@@ -8392,7 +8518,7 @@ var xo = 90, So = 3, Co = class extends b {
8392
8518
  let n = e, r = t;
8393
8519
  return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
8394
8520
  }
8395
- }, To = 44100, Eo = class {
8521
+ }, Fo = 44100, Io = class {
8396
8522
  constructor(e, t) {
8397
8523
  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]);
8398
8524
  try {
@@ -8409,7 +8535,7 @@ var xo = 90, So = 3, Co = class extends b {
8409
8535
  _getBins() {
8410
8536
  if (!this._fftBins || !this._analyser) return new Uint8Array();
8411
8537
  this._analyser.getByteFrequencyData(this._fftBins);
8412
- let e = To / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
8538
+ let e = Fo / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
8413
8539
  return this._fftBins.subarray(t, n);
8414
8540
  }
8415
8541
  getLevel() {
@@ -8422,7 +8548,7 @@ var xo = 90, So = 3, Co = class extends b {
8422
8548
  destroy() {
8423
8549
  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);
8424
8550
  }
8425
- }, Do = class extends b {
8551
+ }, Lo = class extends b {
8426
8552
  constructor(e) {
8427
8553
  super(), h(this, "_detector", null), h(this, "_interval", null);
8428
8554
  let t = () => {
@@ -8438,7 +8564,7 @@ var xo = 90, So = 3, Co = class extends b {
8438
8564
  }), this.subscribe(e, Kt.SOURCE_READY, n), n();
8439
8565
  }
8440
8566
  init(e) {
8441
- this._stopDetector(), this._detector = new Eo("local", e.clone());
8567
+ this._stopDetector(), this._detector = new Io("local", e.clone());
8442
8568
  }
8443
8569
  _stopDetector() {
8444
8570
  this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
@@ -8446,7 +8572,7 @@ var xo = 90, So = 3, Co = class extends b {
8446
8572
  destroy() {
8447
8573
  this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
8448
8574
  }
8449
- }, Oo = class {
8575
+ }, Ro = class {
8450
8576
  constructor(e, t = z) {
8451
8577
  h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
8452
8578
  }
@@ -8466,9 +8592,9 @@ var xo = 90, So = 3, Co = class extends b {
8466
8592
  this.isProcessing = !1;
8467
8593
  }
8468
8594
  }
8469
- }, ko = /* @__PURE__ */ function(e) {
8595
+ }, zo = /* @__PURE__ */ function(e) {
8470
8596
  return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
8471
- }({}), Ao = class extends b {
8597
+ }({}), Bo = class extends b {
8472
8598
  constructor(e) {
8473
8599
  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));
8474
8600
  }
@@ -8476,7 +8602,7 @@ var xo = 90, So = 3, Co = class extends b {
8476
8602
  this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
8477
8603
  }
8478
8604
  _onRemoteTrackAdded(e, t, n) {
8479
- if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new Eo(e, n)), !this._interval)) {
8605
+ if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new Io(e, n)), !this._interval)) {
8480
8606
  let e = () => {
8481
8607
  this._collectVolumes(), this._interval = window.setTimeout(e, N.voiceParams.interval);
8482
8608
  };
@@ -8507,14 +8633,14 @@ var xo = 90, So = 3, Co = class extends b {
8507
8633
  this._triggerEvent("VOLUMES_DETECTED", e);
8508
8634
  }
8509
8635
  _getAudioTrackLevelByParticipantId(e) {
8510
- let t = this._detectors.get(qr.AUDIO_MIX);
8636
+ let t = this._detectors.get(ri.AUDIO_MIX);
8511
8637
  return t ? t.getLevel() : this._getTransparentAudioLevelByParticipantId(e);
8512
8638
  }
8513
8639
  _getTransparentAudioLevelByParticipantId(e) {
8514
8640
  if (!this._activeParticipants?.includes(e)) return null;
8515
8641
  let t = null;
8516
8642
  return this._detectors.forEach((e, n) => {
8517
- if (!n.startsWith(`${qr.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
8643
+ if (!n.startsWith(`${ri.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
8518
8644
  let r = e.getLevel();
8519
8645
  (!t || r.real > t.real) && (t = r);
8520
8646
  }), t;
@@ -8530,11 +8656,11 @@ var xo = 90, So = 3, Co = class extends b {
8530
8656
  e.destroy();
8531
8657
  }), this._detectors.clear();
8532
8658
  }
8533
- }, jo = /* @__PURE__ */ function(e) {
8659
+ }, Vo = /* @__PURE__ */ function(e) {
8534
8660
  return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
8535
- }({}), Mo = class extends b {
8661
+ }({}), Ho = class extends b {
8536
8662
  constructor(e, t, n) {
8537
- super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, ko.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));
8663
+ super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, zo.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));
8538
8664
  }
8539
8665
  destroy() {
8540
8666
  this.unsubscribe();
@@ -8556,9 +8682,9 @@ var xo = 90, So = 3, Co = class extends b {
8556
8682
  _onTopologyChanged(e) {
8557
8683
  this._serverSideSpeakerDetection = e === J.SERVER;
8558
8684
  }
8559
- }, No = 15e3, Po = 15e3, Fo = class extends b {
8685
+ }, Uo = 15e3, Wo = 15e3, Go = class extends b {
8560
8686
  constructor(e, t, n, r = z, i = null) {
8561
- 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, ko.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
8687
+ 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, zo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
8562
8688
  }
8563
8689
  destroy() {
8564
8690
  this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
@@ -8570,10 +8696,10 @@ var xo = 90, So = 3, Co = class extends b {
8570
8696
  this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
8571
8697
  }
8572
8698
  _getConnectionTimeout() {
8573
- return this._transport.getTopology() === J.DIRECT ? No : N.specListenerParams.connectionTimeout;
8699
+ return this._transport.getTopology() === J.DIRECT ? Uo : N.specListenerParams.connectionTimeout;
8574
8700
  }
8575
8701
  _getVolumeTimeout() {
8576
- return this._transport.getTopology() === J.DIRECT ? Po : N.specListenerParams.volumeTimeout;
8702
+ return this._transport.getTopology() === J.DIRECT ? Wo : N.specListenerParams.volumeTimeout;
8577
8703
  }
8578
8704
  _onTransportStateChanged(e, t) {
8579
8705
  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(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
@@ -8606,15 +8732,15 @@ var xo = 90, So = 3, Co = class extends b {
8606
8732
  r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
8607
8733
  }), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
8608
8734
  }
8609
- }, Io = /* @__PURE__ */ function(e) {
8735
+ }, Ko = /* @__PURE__ */ function(e) {
8610
8736
  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;
8611
- }(Io || {});
8612
- function Lo(e) {
8737
+ }(Ko || {});
8738
+ function qo(e) {
8613
8739
  return e === 102 || e === 103 || e === 104;
8614
8740
  }
8615
8741
  //#endregion
8616
8742
  //#region src/classes/stat/StatQueue.ts
8617
- var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo = 10080 * 60 * 1e3, Go = 5e3, Ko = 6e4, Q = class e {
8743
+ var Jo, Yo = "ok-calls-sdk-stats", Xo = 1, Zo = "events", Qo = 100, $o = 5e3, es = 10080 * 60 * 1e3, ts = 5e3, ns = 6e4, Q = class e {
8618
8744
  static isSupported() {
8619
8745
  return e._supported;
8620
8746
  }
@@ -8627,7 +8753,7 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
8627
8753
  n.onsuccess = () => e(n.result);
8628
8754
  });
8629
8755
  }).catch((e) => (z.error("[StatQueue] failed to append event", e), null));
8630
- return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >= Ho && (e._appendsSinceEvictCheck = 0, await e.evictToLimit(Uo)), r);
8756
+ return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >= Qo && (e._appendsSinceEvictCheck = 0, await e.evictToLimit($o)), r);
8631
8757
  }
8632
8758
  static async fillDelta(t, n) {
8633
8759
  if (t.length === 0) return;
@@ -8728,7 +8854,7 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
8728
8854
  });
8729
8855
  }
8730
8856
  static async __resetForTests() {
8731
- if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === zo && (e._dbName = `${zo}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
8857
+ if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === Yo && (e._dbName = `${Yo}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
8732
8858
  let t = await e._open();
8733
8859
  t && await e._runTransaction(t, "readwrite", (e) => {
8734
8860
  e.clear();
@@ -8744,18 +8870,18 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
8744
8870
  static _open() {
8745
8871
  if (!e._checkSupport()) return e._supported = !1, Promise.resolve(null);
8746
8872
  if (e._dbPromise) return e._dbPromise;
8747
- if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < Ko) return Promise.resolve(null);
8873
+ if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < ns) return Promise.resolve(null);
8748
8874
  let t = !1, n = new Promise((n) => {
8749
8875
  let r = (r, i) => {
8750
8876
  t || (t = !0, z.error(r, i), e._supported = !1, e._dbPromise = null, e._lastOpenFailureAt = Date.now(), n(null));
8751
8877
  }, i;
8752
8878
  try {
8753
- i = window.indexedDB.open(e._dbName, Bo);
8879
+ i = window.indexedDB.open(e._dbName, Xo);
8754
8880
  } catch (e) {
8755
8881
  r("[StatQueue] storage is not accessible", e);
8756
8882
  return;
8757
8883
  }
8758
- let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), Go);
8884
+ let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), ts);
8759
8885
  i.onupgradeneeded = () => {
8760
8886
  e._createSchema(i.result);
8761
8887
  }, i.onsuccess = () => {
@@ -8776,8 +8902,8 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
8776
8902
  e._db && (e._db.close(), e._db = null), e._dbPromise = null;
8777
8903
  }
8778
8904
  static _createSchema(e) {
8779
- if (e.objectStoreNames.contains(Vo)) return;
8780
- let t = e.createObjectStore(Vo, {
8905
+ if (e.objectStoreNames.contains(Zo)) return;
8906
+ let t = e.createObjectStore(Zo, {
8781
8907
  keyPath: "id",
8782
8908
  autoIncrement: !0
8783
8909
  });
@@ -8785,8 +8911,8 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
8785
8911
  }
8786
8912
  static _runTransaction(e, t, n) {
8787
8913
  return new Promise((r, i) => {
8788
- let a = e.transaction(Vo, t), o;
8789
- a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(Vo))).then((e) => {
8914
+ let a = e.transaction(Zo, t), o;
8915
+ a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(Zo))).then((e) => {
8790
8916
  o = e;
8791
8917
  }).catch((e) => {
8792
8918
  try {
@@ -8811,18 +8937,18 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
8811
8937
  });
8812
8938
  }
8813
8939
  };
8814
- Ro = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", zo), h(Q, "_supported", Ro._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
8940
+ Jo = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", Yo), h(Q, "_supported", Jo._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
8815
8941
  //#endregion
8816
8942
  //#region src/static/ApiTransport.ts
8817
- var qo = null, Jo = null, Yo = 64 * 1024;
8818
- function Xo() {
8819
- qo = null, Jo = null;
8943
+ var rs = null, is = null, as = 64 * 1024;
8944
+ function os() {
8945
+ rs = null, is = null;
8820
8946
  }
8821
- function Zo(e) {
8947
+ function ss(e) {
8822
8948
  return e?.endsWith("/") ? e.slice(0, -1) : e;
8823
8949
  }
8824
- async function Qo(e = null, t) {
8825
- let n = Zo(e ?? N.apiBaseUrl);
8950
+ async function cs(e = null, t) {
8951
+ let n = ss(e ?? N.apiBaseUrl);
8826
8952
  if (n) return n;
8827
8953
  if ((t ?? N.apiEnv) !== "AUTO") return N.apiEndpoint(t);
8828
8954
  try {
@@ -8837,25 +8963,25 @@ async function Qo(e = null, t) {
8837
8963
  return z.warn("Failed to resolve API endpoint using DNS, default is used", e), N.apiEndpoint(t);
8838
8964
  }
8839
8965
  }
8840
- async function $o() {
8841
- return qo || Jo || (Jo = Qo(), qo = await Jo, Jo = null, qo);
8966
+ async function ls() {
8967
+ return rs || is || (is = cs(), rs = await is, is = null, rs);
8842
8968
  }
8843
- async function es(e, t = {}, n = !1) {
8969
+ async function us(e, t = {}, n = !1) {
8844
8970
  if (!window.Blob || !window.navigator.sendBeacon) return;
8845
- await $o();
8846
- let r = os(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
8847
- window.navigator.sendBeacon(`${qo}/fb.do`, i);
8971
+ await ls();
8972
+ let r = gs(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
8973
+ window.navigator.sendBeacon(`${rs}/fb.do`, i);
8848
8974
  }
8849
- async function ts(e, t = {}, n = !1, r) {
8850
- return await $o(), rs(os(e, t, n), r);
8975
+ async function ds(e, t = {}, n = !1, r) {
8976
+ return await ls(), ps(gs(e, t, n), r);
8851
8977
  }
8852
- async function ns(e, t = {}, n = !1) {
8853
- await $o();
8854
- let r = os(e, t, n);
8855
- return rs(r, void 0, new Blob([r]).size <= Yo);
8978
+ async function fs(e, t = {}, n = !1) {
8979
+ await ls();
8980
+ let r = gs(e, t, n);
8981
+ return ps(r, void 0, new Blob([r]).size <= as);
8856
8982
  }
8857
- async function rs(e, t, n = !1) {
8858
- let r = `${t ?? qo}/fb.do`, i = new AbortController(), a = new k(x.NETWORK, { callError: {
8983
+ async function ps(e, t, n = !1) {
8984
+ let r = `${t ?? rs}/fb.do`, i = new AbortController(), a = new k(x.NETWORK, { callError: {
8859
8985
  scope: "network",
8860
8986
  source: "api",
8861
8987
  code: "timeout",
@@ -8874,16 +9000,16 @@ async function rs(e, t, n = !1) {
8874
9000
  } catch {
8875
9001
  o = { result: a };
8876
9002
  }
8877
- if (!t.ok && !is(o)) throw new k(x.API, { callError: {
9003
+ if (!t.ok && !ms(o)) throw new k(x.API, { callError: {
8878
9004
  scope: "server",
8879
9005
  source: "api",
8880
9006
  code: `http-${t.status}`,
8881
9007
  description: "http-error"
8882
9008
  } });
8883
- if (is(o)) throw o;
9009
+ if (ms(o)) throw o;
8884
9010
  return o;
8885
9011
  } catch (e) {
8886
- throw e instanceof k ? e : i.signal.aborted ? a : is(e) ? e : new k(x.NETWORK, { callError: {
9012
+ throw e instanceof k ? e : i.signal.aborted ? a : ms(e) ? e : new k(x.NETWORK, { callError: {
8887
9013
  scope: "network",
8888
9014
  source: "api",
8889
9015
  code: "fetch-failed",
@@ -8893,12 +9019,12 @@ async function rs(e, t, n = !1) {
8893
9019
  clearTimeout(o);
8894
9020
  }
8895
9021
  }
8896
- function is(e) {
9022
+ function ms(e) {
8897
9023
  if (typeof e != "object" || !e) return !1;
8898
9024
  let t = e;
8899
9025
  return typeof t.error_code == "number" && typeof t.error_msg == "string";
8900
9026
  }
8901
- async function as(e, t) {
9027
+ async function hs(e, t) {
8902
9028
  try {
8903
9029
  let n = await fetch(e, {
8904
9030
  method: "POST",
@@ -8911,7 +9037,7 @@ async function as(e, t) {
8911
9037
  throw z.warn("Failed to send form data", e), e;
8912
9038
  }
8913
9039
  }
8914
- function os(e, t = {}, n = !1) {
9040
+ function gs(e, t = {}, n = !1) {
8915
9041
  t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (y.sessionKey ? t.session_key = y.sessionKey : y.accessToken && (t.access_token = y.accessToken));
8916
9042
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
8917
9043
  let r = "";
@@ -8920,7 +9046,7 @@ function os(e, t = {}, n = !1) {
8920
9046
  }
8921
9047
  //#endregion
8922
9048
  //#region src/static/SessionStore.ts
8923
- var ss = "sessions", cs = 5, ls = class e {
9049
+ var _s = "sessions", vs = 5, ys = class e {
8924
9050
  static remember(t, n) {
8925
9051
  let r = e._read();
8926
9052
  r[String(t)] = {
@@ -8928,7 +9054,7 @@ var ss = "sessions", cs = 5, ls = class e {
8928
9054
  savedAt: Date.now()
8929
9055
  };
8930
9056
  let i = Object.keys(r);
8931
- i.length > cs && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - cs).forEach((e) => delete r[e]), e._write(r);
9057
+ i.length > vs && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - vs).forEach((e) => delete r[e]), e._write(r);
8932
9058
  }
8933
9059
  static get(t) {
8934
9060
  return e._read()[String(t)] ?? null;
@@ -8944,10 +9070,10 @@ var ss = "sessions", cs = 5, ls = class e {
8944
9070
  }), r && e._write(n);
8945
9071
  }
8946
9072
  static currentEndpoint() {
8947
- return String(Zo(N.apiBaseUrl) || N.apiEndpoint());
9073
+ return String(ss(N.apiBaseUrl) || N.apiEndpoint());
8948
9074
  }
8949
9075
  static _read() {
8950
- let t = w.get(ss);
9076
+ let t = w.get(_s);
8951
9077
  if (!t || typeof t != "object" || Array.isArray(t)) return {};
8952
9078
  let n = {};
8953
9079
  return Object.entries(t).forEach(([t, r]) => {
@@ -8956,16 +9082,16 @@ var ss = "sessions", cs = 5, ls = class e {
8956
9082
  }
8957
9083
  static _write(e) {
8958
9084
  if (Object.keys(e).length === 0) {
8959
- w.remove(ss);
9085
+ w.remove(_s);
8960
9086
  return;
8961
9087
  }
8962
- w.set(ss, e);
9088
+ w.set(_s, e);
8963
9089
  }
8964
9090
  static _isValid(e) {
8965
9091
  let t = e;
8966
9092
  return typeof t == "object" && !!t && typeof t.sessionKey == "string" && t.sessionKey.length > 0 && typeof t.endpoint == "string" && typeof t.savedAt == "number";
8967
9093
  }
8968
- }, us = 15e3, ds = class e {
9094
+ }, bs = 15e3, xs = class e {
8969
9095
  static setApi(t) {
8970
9096
  e._api = t;
8971
9097
  }
@@ -8976,7 +9102,7 @@ var ss = "sessions", cs = 5, ls = class e {
8976
9102
  e._delta === null && e._api && e.get();
8977
9103
  }
8978
9104
  static get() {
8979
- return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt < us ? Promise.resolve(0) : (e._pending || (e._pending = e._measure().finally(() => {
9105
+ 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(() => {
8980
9106
  e._pending = null;
8981
9107
  })), e._pending) : Promise.resolve(e._delta);
8982
9108
  }
@@ -9006,10 +9132,10 @@ var ss = "sessions", cs = 5, ls = class e {
9006
9132
  return e._idsAwaitingDelta = [], await Q.fillDelta(n, t), t;
9007
9133
  }
9008
9134
  };
9009
- h(ds, "_api", null), h(ds, "_delta", null), h(ds, "_pending", null), h(ds, "_idsAwaitingDelta", []), h(ds, "_lastFailureAt", null);
9135
+ h(xs, "_api", null), h(xs, "_delta", null), h(xs, "_pending", null), h(xs, "_idsAwaitingDelta", []), h(xs, "_lastFailureAt", null);
9010
9136
  //#endregion
9011
9137
  //#region src/classes/stat/StatUnloadJournal.ts
9012
- var fs = "okcls-stat-unload.", ps = class e {
9138
+ var Ss = "okcls-stat-unload.", Cs = class e {
9013
9139
  static beginTabSession() {
9014
9140
  e._tabKey = null, e._entries = [];
9015
9141
  }
@@ -9017,7 +9143,7 @@ var fs = "okcls-stat-unload.", ps = class e {
9017
9143
  let n = e._storage();
9018
9144
  if (!n) return !1;
9019
9145
  try {
9020
- return e._tabKey || (e._tabKey = fs + 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;
9146
+ return e._tabKey || (e._tabKey = Ss + 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;
9021
9147
  } catch (e) {
9022
9148
  return z.error("[StatUnloadJournal] failed to write", e), !1;
9023
9149
  }
@@ -9029,7 +9155,7 @@ var fs = "okcls-stat-unload.", ps = class e {
9029
9155
  try {
9030
9156
  for (let e = 0; e < t.length; e += 1) {
9031
9157
  let r = t.key(e);
9032
- r && r.startsWith(fs) && n.push(r);
9158
+ r && r.startsWith(Ss) && n.push(r);
9033
9159
  }
9034
9160
  } catch (e) {
9035
9161
  return z.error("[StatUnloadJournal] failed to scan journals", e), 0;
@@ -9072,32 +9198,32 @@ var fs = "okcls-stat-unload.", ps = class e {
9072
9198
  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;
9073
9199
  }
9074
9200
  };
9075
- h(ps, "_tabKey", null), h(ps, "_entries", []);
9201
+ h(Cs, "_tabKey", null), h(Cs, "_entries", []);
9076
9202
  //#endregion
9077
9203
  //#region src/classes/stat/StatDrainScheduler.ts
9078
- var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat-drain", xs = class e {
9204
+ var ws = 500, Ts = 100, Es = 3e4, Ds = 1e3, Os = 5e3, ks = 3e3, As = "okcls-stat-drain", js = class e {
9079
9205
  static setApi(t) {
9080
- e._api = t, ds.setApi(t);
9206
+ e._api = t, xs.setApi(t);
9081
9207
  }
9082
9208
  static start(t) {
9083
- e.setApi(t), ps.drainToQueue().catch((e) => z.error("[StatDrainScheduler] failed to import unload journal", e)).then(async () => (ls.prune(), await Q.evictOlderThan(Wo), await Q.evictToLimit(Uo), e._drain())).catch((e) => z.error("[StatDrainScheduler] failed to start", e));
9209
+ e.setApi(t), Cs.drainToQueue().catch((e) => z.error("[StatDrainScheduler] failed to import unload journal", e)).then(async () => (ys.prune(), await Q.evictOlderThan(es), await Q.evictToLimit($o), e._drain())).catch((e) => z.error("[StatDrainScheduler] failed to start", e));
9084
9210
  }
9085
9211
  static notifyAppended() {
9086
9212
  if (e._api) {
9087
- if (e._localCount += 1, e._localCount >= hs) {
9213
+ if (e._localCount += 1, e._localCount >= Ts) {
9088
9214
  e._drain();
9089
9215
  return;
9090
9216
  }
9091
- e._state === "IDLE" && e._arm(gs);
9217
+ e._state === "IDLE" && e._arm(Es);
9092
9218
  }
9093
9219
  }
9094
9220
  static notifyCallFinished() {
9095
9221
  if (e._api) {
9096
- if (e._directBuffer.length > 0 && e._armDirect(_s), e._state === "DRAINING") {
9222
+ if (e._directBuffer.length > 0 && e._armDirect(Ds), e._state === "DRAINING") {
9097
9223
  e._callFinishedDuringDrain = !0;
9098
9224
  return;
9099
9225
  }
9100
- e._arm(_s);
9226
+ e._arm(Ds);
9101
9227
  }
9102
9228
  }
9103
9229
  static drainOnce() {
@@ -9106,7 +9232,7 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
9106
9232
  if (!t) return !1;
9107
9233
  let n = e._currentUserId(), r = await Q.listUids(), i = !1, a = null;
9108
9234
  for (let o of r) try {
9109
- (o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === ms && (i = !0);
9235
+ (o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === ws && (i = !0);
9110
9236
  } catch (e) {
9111
9237
  a === null && (a = e);
9112
9238
  }
@@ -9120,20 +9246,20 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
9120
9246
  z.error("[StatDrainScheduler] direct send skipped: event belongs to another user");
9121
9247
  return;
9122
9248
  }
9123
- e._directBuffer.push(t), e._directTimer === null && e._armDirect(ys);
9249
+ e._directBuffer.push(t), e._directTimer === null && e._armDirect(ks);
9124
9250
  }
9125
9251
  }
9126
9252
  static __resetForTests() {
9127
- ds.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
9253
+ xs.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
9128
9254
  }
9129
9255
  static _currentUserId() {
9130
9256
  return y.userId;
9131
9257
  }
9132
9258
  static async _drainCurrent(t, n) {
9133
9259
  if (e._isSessionBlocked()) return 0;
9134
- let r = await Q.readOldest(n, ms);
9260
+ let r = await Q.readOldest(n, ws);
9135
9261
  if (r.length === 0) return 0;
9136
- let i = await ds.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
9262
+ let i = await xs.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
9137
9263
  try {
9138
9264
  await t.logClientStats(a);
9139
9265
  } catch (t) {
@@ -9144,25 +9270,25 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
9144
9270
  return await Q.remove(o), r.length;
9145
9271
  }
9146
9272
  static async _drainStored(t, n) {
9147
- let r = ls.get(n);
9148
- if (!r || r.endpoint !== ls.currentEndpoint()) return 0;
9149
- let i = await Q.readOldest(n, ms);
9273
+ let r = ys.get(n);
9274
+ if (!r || r.endpoint !== ys.currentEndpoint()) return 0;
9275
+ let i = await Q.readOldest(n, ws);
9150
9276
  if (i.length === 0) return 0;
9151
- let a = await ds.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
9277
+ let a = await xs.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
9152
9278
  try {
9153
9279
  await t.logClientStatsWith(r.sessionKey, o), z.debug("[StatDrainScheduler] delivered", i.length, "stored events of uid", n);
9154
9280
  } catch (t) {
9155
- if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), ls.forget(n), 0;
9281
+ if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), ys.forget(n), 0;
9156
9282
  if (e._isRetryable(t)) throw t;
9157
9283
  return z.error("[StatDrainScheduler] batch rejected, dropping", t), await Q.remove(s), i.length;
9158
9284
  }
9159
9285
  return await Q.remove(s), i.length;
9160
9286
  }
9161
9287
  static _withLock(e) {
9162
- return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(bs, e);
9288
+ return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(As, e);
9163
9289
  }
9164
9290
  static _isSessionError(e) {
9165
- return Lo(e?.error_code);
9291
+ return qo(e?.error_code);
9166
9292
  }
9167
9293
  static _isReauthorizeFailure(e) {
9168
9294
  return e?.error === x.AUTH;
@@ -9175,7 +9301,7 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
9175
9301
  }
9176
9302
  static _isAuthError(t) {
9177
9303
  let n = t?.error_code;
9178
- return e._isSessionError(t) || n === Io.AUTH_LOGIN;
9304
+ return e._isSessionError(t) || n === Ko.AUTH_LOGIN;
9179
9305
  }
9180
9306
  static _isRetryable(t) {
9181
9307
  if (e._isSessionError(t)) return !0;
@@ -9200,7 +9326,7 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
9200
9326
  static async _flushDirect() {
9201
9327
  let t = e._api, n = e._directBuffer;
9202
9328
  if (e._directBuffer = [], !(!t || n.length === 0)) try {
9203
- let r = await ds.get();
9329
+ let r = await xs.get();
9204
9330
  await t.logClientStats(n.map((t) => e._toClientStats(t, r)));
9205
9331
  } catch (e) {
9206
9332
  z.error("[StatDrainScheduler] direct send failed, events lost", e);
@@ -9219,28 +9345,28 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
9219
9345
  e._clearTimer(), e._state = "DRAINING", e._localCount = 0, e._callFinishedDuringDrain = !1;
9220
9346
  try {
9221
9347
  if (await e.drainOnce()) {
9222
- e._arm(vs);
9348
+ e._arm(Os);
9223
9349
  return;
9224
9350
  }
9225
9351
  if (e._callFinishedDuringDrain) {
9226
- e._arm(_s);
9352
+ e._arm(Ds);
9227
9353
  return;
9228
9354
  }
9229
9355
  if (e._localCount > 0) {
9230
- e._arm(gs);
9356
+ e._arm(Es);
9231
9357
  return;
9232
9358
  }
9233
9359
  e._state = "IDLE";
9234
9360
  } catch (t) {
9235
- z.error("[StatDrainScheduler] drain failed", t), e._arm(gs);
9361
+ z.error("[StatDrainScheduler] drain failed", t), e._arm(Es);
9236
9362
  }
9237
9363
  }
9238
9364
  }
9239
9365
  };
9240
- 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);
9366
+ h(js, "_api", null), h(js, "_state", "IDLE"), h(js, "_timer", null), h(js, "_localCount", 0), h(js, "_callFinishedDuringDrain", !1), h(js, "_blockedSession", null), h(js, "_directBuffer", []), h(js, "_directTimer", null);
9241
9367
  //#endregion
9242
9368
  //#region src/classes/StatsLogger.ts
9243
- var Ss = class extends f {
9369
+ var Ms = class extends f {
9244
9370
  constructor(e, t, n, r = () => void 0) {
9245
9371
  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();
9246
9372
  }
@@ -9320,7 +9446,7 @@ var Ss = class extends f {
9320
9446
  _now() {
9321
9447
  return Date.now() - this._serverTimeDelta;
9322
9448
  }
9323
- }, Cs = class e extends f {
9449
+ }, Ns = class e extends f {
9324
9450
  static __resetForTests() {
9325
9451
  e._pending = [], e._pendingOverflow = !1;
9326
9452
  }
@@ -9336,17 +9462,17 @@ var Ss = class extends f {
9336
9462
  return e._pending = [], e._pendingOverflow = !1, t;
9337
9463
  }
9338
9464
  constructor(e, t, n, r = () => void 0) {
9339
- 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 Ss(e, t, n, r);
9465
+ 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 Ms(e, t, n, r);
9340
9466
  }
9341
9467
  log(e, t, n = !1) {
9342
9468
  this._externalLogger && this._externalLogger.log(e, t, n);
9343
9469
  }
9344
9470
  enterUnloadMode() {
9345
- this._legacy || (this._unloadMode = !0, ps.beginTabSession());
9471
+ this._legacy || (this._unloadMode = !0, Cs.beginTabSession());
9346
9472
  }
9347
9473
  exitUnloadMode() {
9348
- this._legacy || !this._unloadMode || (this._unloadMode = !1, ps.drainToQueue().then((e) => {
9349
- e > 0 && xs.notifyAppended();
9474
+ this._legacy || !this._unloadMode || (this._unloadMode = !1, Cs.drainToQueue().then((e) => {
9475
+ e > 0 && js.notifyAppended();
9350
9476
  }).catch((e) => z.error("[StatEventCollector] failed to import unload journal", e)));
9351
9477
  }
9352
9478
  logClientStats(t, n = {}) {
@@ -9360,11 +9486,11 @@ var Ss = class extends f {
9360
9486
  };
9361
9487
  Object.keys(r).forEach((e) => {
9362
9488
  r[e] === void 0 && delete r[e];
9363
- }), ds.ensure();
9489
+ }), xs.ensure();
9364
9490
  let i = {
9365
9491
  vcid: n.conversationId === void 0 ? this._getConversationId() : n.conversationId,
9366
9492
  ts: n.occurredAt === void 0 ? Date.now() : n.occurredAt,
9367
- delta: ds.delta(),
9493
+ delta: xs.delta(),
9368
9494
  ev: r
9369
9495
  }, a = y.userId;
9370
9496
  if (a === null) {
@@ -9387,12 +9513,12 @@ var Ss = class extends f {
9387
9513
  }
9388
9514
  }
9389
9515
  _store(e) {
9390
- this._unloadMode && ps.writeSync(e) || Q.append(e).then((t) => {
9516
+ this._unloadMode && Cs.writeSync(e) || Q.append(e).then((t) => {
9391
9517
  if (t !== null) {
9392
- typeof e.delta != "number" && ds.noteAppended(t), xs.notifyAppended();
9518
+ typeof e.delta != "number" && xs.noteAppended(t), js.notifyAppended();
9393
9519
  return;
9394
9520
  }
9395
- z.error("[StatEventCollector] failed to store event, sending directly"), xs.sendDirect(e);
9521
+ z.error("[StatEventCollector] failed to store event, sending directly"), js.sendDirect(e);
9396
9522
  }).catch((e) => z.error("[StatEventCollector] failed to store event", e));
9397
9523
  }
9398
9524
  _getConversationId() {
@@ -9410,10 +9536,10 @@ var Ss = class extends f {
9410
9536
  }
9411
9537
  }
9412
9538
  };
9413
- h(Cs, "_pending", []), h(Cs, "_pendingOverflow", !1);
9539
+ h(Ns, "_pending", []), h(Ns, "_pendingOverflow", !1);
9414
9540
  //#endregion
9415
9541
  //#region src/classes/stat/CallFinishClassifier.ts
9416
- var ws = "invalid-error-metadata", Ts = 64, Es = new Set(Object.values(O)), Ds = new Set(Object.values(x)), Os = {
9542
+ var Ps = "invalid-error-metadata", Fs = 64, Is = new Set(Object.values(O)), Ls = new Set(Object.values(x)), Rs = {
9417
9543
  [O.CANCELED]: {
9418
9544
  type: "semantic",
9419
9545
  reason: "canceled"
@@ -9534,7 +9660,7 @@ var ws = "invalid-error-metadata", Ts = 64, Es = new Set(Object.values(O)), Ds =
9534
9660
  type: "semantic",
9535
9661
  reason: "obsolete_client"
9536
9662
  }
9537
- }, ks = {
9663
+ }, zs = {
9538
9664
  [x.MIC_CAMERA_PERMISSION]: {
9539
9665
  type: "direct-error",
9540
9666
  error: {
@@ -9623,14 +9749,14 @@ var ws = "invalid-error-metadata", Ts = 64, Es = new Set(Object.values(O)), Ds =
9623
9749
  }
9624
9750
  }
9625
9751
  };
9626
- function As(e) {
9627
- if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return ws;
9752
+ function Bs(e) {
9753
+ if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Ps;
9628
9754
  let t = String(e).trim();
9629
- if (!t) return ws;
9755
+ if (!t) return Ps;
9630
9756
  let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
9631
- return !n || !/^[a-z0-9.-]+$/.test(n) ? ws : n.length > Ts ? `${n.slice(0, Ts - 3)}...` : n;
9757
+ return !n || !/^[a-z0-9.-]+$/.test(n) ? Ps : n.length > Fs ? `${n.slice(0, Fs - 3)}...` : n;
9632
9758
  }
9633
- function js(e) {
9759
+ function Vs(e) {
9634
9760
  if (!e || typeof e != "object") return !1;
9635
9761
  let t = e;
9636
9762
  switch (t.scope) {
@@ -9642,49 +9768,49 @@ function js(e) {
9642
9768
  default: return !1;
9643
9769
  }
9644
9770
  }
9645
- function Ms(e) {
9646
- let t = As(e.description);
9771
+ function Hs(e) {
9772
+ let t = Bs(e.description);
9647
9773
  if (e.scope === "unknown") return `unknown:${t}`;
9648
- let n = As(e.code);
9774
+ let n = Bs(e.code);
9649
9775
  return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
9650
9776
  }
9651
- function Ns(e, t) {
9777
+ function Us(e, t) {
9652
9778
  return t === null ? e.type === "direct-error" ? {
9653
9779
  reason: "error",
9654
- string_value: Ms(e.error)
9655
- } : { reason: "failed" } : js(t) ? {
9780
+ string_value: Hs(e.error)
9781
+ } : { reason: "failed" } : Vs(t) ? {
9656
9782
  reason: "error",
9657
- string_value: Ms(t)
9783
+ string_value: Hs(t)
9658
9784
  } : { reason: "failed" };
9659
9785
  }
9660
- function Ps(e) {
9786
+ function Ws(e) {
9661
9787
  if (e.hangup) {
9662
- let t = Os[e.hangup];
9788
+ let t = Rs[e.hangup];
9663
9789
  return t ? t.type === "semantic" ? e.hangup === O.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
9664
9790
  reason: t.reason,
9665
9791
  string_value: e.custom_error.vchat_detailed_api_error.code
9666
- } : { reason: t.reason } : Ns(t, e.callError) : { reason: "failed" };
9792
+ } : { reason: t.reason } : Us(t, e.callError) : { reason: "failed" };
9667
9793
  }
9668
9794
  if (e.error) {
9669
- let t = ks[e.error];
9670
- return t ? Ns(t, e.callError) : { reason: "failed" };
9795
+ let t = zs[e.error];
9796
+ return t ? Us(t, e.callError) : { reason: "failed" };
9671
9797
  }
9672
9798
  return { reason: "failed" };
9673
9799
  }
9674
- function Fs(e) {
9675
- return e instanceof k ? Ps(e) : typeof e == "string" && (Es.has(e) || Ds.has(e)) ? Ps(new k(e)) : { reason: "failed" };
9800
+ function Gs(e) {
9801
+ return e instanceof k ? Ws(e) : typeof e == "string" && (Is.has(e) || Ls.has(e)) ? Ws(new k(e)) : { reason: "failed" };
9676
9802
  }
9677
9803
  //#endregion
9678
9804
  //#region src/classes/stat/CallLifecycleStats.ts
9679
- var Is = {
9805
+ var Ks = {
9680
9806
  wallNow: () => Date.now(),
9681
9807
  monotonicNow: () => performance.now()
9682
9808
  };
9683
- function Ls(e) {
9809
+ function qs(e) {
9684
9810
  return e === "anonym_join" ? "join" : e;
9685
9811
  }
9686
- var Rs = class {
9687
- constructor(e, t = Is) {
9812
+ var Js = class {
9813
+ constructor(e, t = Ks) {
9688
9814
  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;
9689
9815
  }
9690
9816
  get firstMediaSentReported() {
@@ -9696,7 +9822,7 @@ var Rs = class {
9696
9822
  markInitializationStarted({ source: e, conversationId: t }) {
9697
9823
  if (this._destroyed || this._callStartLabel !== null) return;
9698
9824
  let n = this._clock.wallNow();
9699
- this._callStartLabel = Ls(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
9825
+ this._callStartLabel = qs(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
9700
9826
  name: U.CALL_INIT,
9701
9827
  source: e
9702
9828
  }, n);
@@ -9724,7 +9850,7 @@ var Rs = class {
9724
9850
  !this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: U.FIRST_MEDIA_SENT }));
9725
9851
  }
9726
9852
  markFinished(e) {
9727
- this._finish(Fs(e));
9853
+ this._finish(Gs(e));
9728
9854
  }
9729
9855
  markTerminated() {
9730
9856
  this._finish({ reason: "terminated" });
@@ -9775,7 +9901,7 @@ var Rs = class {
9775
9901
  ...n && { immediately: !0 }
9776
9902
  });
9777
9903
  }
9778
- }, zs = class {
9904
+ }, Ys = class {
9779
9905
  constructor(e, t) {
9780
9906
  h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
9781
9907
  }
@@ -9838,7 +9964,7 @@ var Rs = class {
9838
9964
  this.report(e);
9839
9965
  }), this._codecUsages.clear();
9840
9966
  }
9841
- }, Bs = class {
9967
+ }, Xs = class {
9842
9968
  constructor(e) {
9843
9969
  h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e;
9844
9970
  }
@@ -9871,12 +9997,11 @@ var Rs = class {
9871
9997
  for (let t of e) this._logEventualStat(t), this._eventualLogs.delete(t);
9872
9998
  }
9873
9999
  _logEventualStat({ data: e, occurredAt: t }) {
9874
- this._logger.logClientStats({
9875
- ...e,
9876
- ...this._lastCallStatContext ?? {}
9877
- }, { occurredAt: t });
10000
+ let n = { ...this._lastCallStatContext ?? {} };
10001
+ for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
10002
+ this._logger.logClientStats(n, { occurredAt: t });
9878
10003
  }
9879
- }, Vs = class {
10004
+ }, Zs = class {
9880
10005
  constructor(e) {
9881
10006
  if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
9882
10007
  1,
@@ -9935,7 +10060,7 @@ var Rs = class {
9935
10060
  5
9936
10061
  ];
9937
10062
  }
9938
- }, Hs = class {
10063
+ }, Qs = class {
9939
10064
  constructor() {
9940
10065
  h(this, "n", 0), h(this, "mean", 0);
9941
10066
  }
@@ -9947,9 +10072,9 @@ var Rs = class {
9947
10072
  get avg() {
9948
10073
  return this.n ? this.mean : NaN;
9949
10074
  }
9950
- }, Us = class {
10075
+ }, $s = class {
9951
10076
  constructor() {
9952
- h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Hs()), h(this, "p50", new Vs(.5)), h(this, "p95", new Vs(.95));
10077
+ h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Qs()), h(this, "p50", new Zs(.5)), h(this, "p95", new Zs(.95));
9953
10078
  }
9954
10079
  add(e) {
9955
10080
  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++;
@@ -9967,11 +10092,11 @@ var Rs = class {
9967
10092
  get hasData() {
9968
10093
  return this.count > 0;
9969
10094
  }
9970
- }, Ws = class {
10095
+ }, ec = class {
9971
10096
  constructor(e) {
9972
10097
  h(this, "_logger", void 0), h(this, "trackerByTransport", {
9973
- ws: new Us(),
9974
- wt: new Us()
10098
+ ws: new $s(),
10099
+ wt: new $s()
9975
10100
  }), h(this, "lastSeen", {}), this._logger = e;
9976
10101
  }
9977
10102
  mark(e) {
@@ -10000,17 +10125,17 @@ var Rs = class {
10000
10125
  }
10001
10126
  destroy() {
10002
10127
  this.trackerByTransport = {
10003
- ws: new Us(),
10004
- wt: new Us()
10128
+ ws: new $s(),
10129
+ wt: new $s()
10005
10130
  }, this.lastSeen = {};
10006
10131
  }
10007
- }, Gs = class {
10132
+ }, tc = class {
10008
10133
  constructor(e) {
10009
10134
  h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
10010
10135
  }
10011
10136
  mark(e, t, n) {
10012
10137
  let r = `${e}|${n}`, i;
10013
- this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new Us(), this.trackerByCommand.set(r, i)), i.add(t);
10138
+ this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new $s(), this.trackerByCommand.set(r, i)), i.add(t);
10014
10139
  }
10015
10140
  logMetrics() {
10016
10141
  for (let [e, t] of this.trackerByCommand.entries()) {
@@ -10032,9 +10157,9 @@ var Rs = class {
10032
10157
  destroy() {
10033
10158
  this.trackerByCommand.clear();
10034
10159
  }
10035
- }, Ks = class {
10160
+ }, nc = class {
10036
10161
  constructor(e, t, n, r) {
10037
- 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, "_unloading", !1), this.logger = new Cs(e, t, n, r), this.lifecycle = new Rs(this.logger), this.statAggregator = new Bs(this.logger), this.codecStatsAggregator = new zs(this.logger, r), this.pings = new Ws(this.logger), this.signalingCommands = new Gs(this.logger);
10162
+ 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, "_unloading", !1), this.logger = new Ns(e, t, n, r), this.lifecycle = new Js(this.logger), this.statAggregator = new Xs(this.logger), this.codecStatsAggregator = new Ys(this.logger, r), this.pings = new ec(this.logger), this.signalingCommands = new tc(this.logger);
10038
10163
  }
10039
10164
  prepareForUnload() {
10040
10165
  N.statQueueEnabled && (this._unloading = !0, this.logger.enterUnloadMode(), this.pings.logMetrics(), this.signalingCommands.logMetrics());
@@ -10049,9 +10174,9 @@ var Rs = class {
10049
10174
  this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy();
10050
10175
  }
10051
10176
  destroy() {
10052
- this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading && xs.notifyCallFinished();
10177
+ this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading && js.notifyCallFinished();
10053
10178
  }
10054
- }, qs = class {
10179
+ }, rc = class {
10055
10180
  constructor(e) {
10056
10181
  h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
10057
10182
  }
@@ -10076,8 +10201,8 @@ var Rs = class {
10076
10201
  call_type: this._callType
10077
10202
  }));
10078
10203
  }
10079
- }, Js = 1e3, Ys = 1e4;
10080
- function Xs(e, t, n, r) {
10204
+ }, ic = 1e3, ac = 1e4;
10205
+ function oc(e, t, n, r) {
10081
10206
  return new k(e, {
10082
10207
  callError: {
10083
10208
  scope: "external",
@@ -10088,11 +10213,11 @@ function Xs(e, t, n, r) {
10088
10213
  message: r
10089
10214
  });
10090
10215
  }
10091
- var Zs = 15, $ = class e extends b {
10216
+ var sc = 15, $ = class e extends b {
10092
10217
  constructor(e, t) {
10093
- 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, "_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", kr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), h(this, "_onUnload", void 0), h(this, "_onRestore", 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", ho((e) => {
10218
+ 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, "_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", kr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), h(this, "_onUnload", void 0), h(this, "_onRestore", 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", To((e) => {
10094
10219
  if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
10095
- })), h(this, "_toggleLocalAudio", ho((e) => {
10220
+ })), h(this, "_toggleLocalAudio", To((e) => {
10096
10221
  if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
10097
10222
  })), h(this, "_changeMediaSettings", M.debounce(async (e) => {
10098
10223
  if (this._signaling.ready) try {
@@ -10104,7 +10229,7 @@ var Zs = 15, $ = class e extends b {
10104
10229
  captureAudio: !1
10105
10230
  });
10106
10231
  }
10107
- }, 100)), this._stats = new Ks(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Ba(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new Oo(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new wo({
10232
+ }, 100)), this._stats = new nc(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Xa(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new Ro(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new Po({
10108
10233
  api: this._api,
10109
10234
  debug: this._debug,
10110
10235
  getParticipants: () => this._participants,
@@ -10115,13 +10240,13 @@ var Zs = 15, $ = class e extends b {
10115
10240
  this._stopFirstMediaSentProbe(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? O.CANCELED : O.HUNGUP), this._stats.prepareForUnload(), this._stats.destroy();
10116
10241
  }, this._onRestore = () => {
10117
10242
  this._stats.restoreAfterUnload();
10118
- }, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), this._statFirstMediaReceived = new qs(this._stats.statAggregator), this._audioOutput = new _o(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Js));
10243
+ }, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), this._statFirstMediaReceived = new rc(this._stats.statAggregator), this._audioOutput = new Do(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), ic));
10119
10244
  }
10120
10245
  static current() {
10121
10246
  return B.getActive() ?? (N.hold ? null : B.getFirst());
10122
10247
  }
10123
10248
  static hangupAfterInit(e) {
10124
- let t = Qs;
10249
+ let t = cc;
10125
10250
  if (t) {
10126
10251
  if (typeof e == "function" && (t._onFastHangup = e), t._delayedHangup === !1 && !t._conversation) {
10127
10252
  t._delayedHangup = !0, t._abortController?.abort(new k(O.CANCELED));
@@ -10149,7 +10274,7 @@ var Zs = 15, $ = class e extends b {
10149
10274
  return this._state === "HELD";
10150
10275
  }
10151
10276
  get isIncomingRinging() {
10152
- return this._conversation?.direction === Va.INCOMING && this._state === "IDLE";
10277
+ return this._conversation?.direction === Za.INCOMING && this._state === "IDLE";
10153
10278
  }
10154
10279
  static debugSessionId() {
10155
10280
  return e.current()?.debugSessionId ?? null;
@@ -10175,7 +10300,7 @@ var Zs = 15, $ = class e extends b {
10175
10300
  R.onNonFatalError(Error(e), this.id);
10176
10301
  }
10177
10302
  getIncomingCallerExternalId() {
10178
- return this._conversation?.direction === Va.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
10303
+ return this._conversation?.direction === Za.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
10179
10304
  }
10180
10305
  _buildInternalParams() {
10181
10306
  let e = {
@@ -10185,24 +10310,24 @@ var Zs = 15, $ = class e extends b {
10185
10310
  platform: N.platform,
10186
10311
  protocolVersion: N.protocolVersion,
10187
10312
  domainId: N.domain,
10188
- capabilities: Sa.getFlags()
10313
+ capabilities: Ma.getFlags()
10189
10314
  };
10190
10315
  return JSON.stringify(e);
10191
10316
  }
10192
10317
  async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
10193
- let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === Ha.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
10318
+ let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === Qa.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
10194
10319
  this._stats.lifecycle.markInitializationStarted({
10195
10320
  source: "outgoing",
10196
10321
  conversationId: u
10197
- }), this._debug.setConversationId(u), Qs = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
10322
+ }), this._debug.setConversationId(u), cc = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
10198
10323
  try {
10199
10324
  this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
10200
10325
  let l = this._mediaSource.mediaSettings;
10201
- t === Ha.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l);
10326
+ t === Qa.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l);
10202
10327
  let d = await this._startConversation({
10203
10328
  opponentIds: e,
10204
10329
  opponentType: t,
10205
- direction: Va.OUTGOING,
10330
+ direction: Za.OUTGOING,
10206
10331
  mediaOptions: n,
10207
10332
  payload: r,
10208
10333
  joiningAllowed: i,
@@ -10226,18 +10351,18 @@ var Zs = 15, $ = class e extends b {
10226
10351
  let e = B.get(this._conversation.id);
10227
10352
  e && e !== this && e._close(new k(O.HUNGUP, { remote: !0 }));
10228
10353
  }
10229
- return B.add(this), await B.setActive(this.id), Qs = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
10354
+ return B.add(this), await B.setActive(this.id), cc = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
10230
10355
  this._calleeUnavailableTimer = null, this._close(new k(O.CALLEE_UNAVAILABLE), { signalingReason: O.CANCELED });
10231
10356
  }, f)), this._conversation;
10232
10357
  } catch (e) {
10233
- throw Qs = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
10358
+ throw cc = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
10234
10359
  }
10235
10360
  }
10236
10361
  async onJoin(e) {
10237
10362
  this._stats.lifecycle.markInitializationStarted({
10238
10363
  source: e.anonymous ? "anonym_join" : "join",
10239
10364
  conversationId: e.conversationId
10240
- }), Qs = this, this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
10365
+ }), cc = this, this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
10241
10366
  try {
10242
10367
  let t = !!e.observedIds?.length;
10243
10368
  if (t && N.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new k(O.UNSUPPORTED, { callError: {
@@ -10254,9 +10379,9 @@ var Zs = 15, $ = class e extends b {
10254
10379
  code: "conversation",
10255
10380
  description: "not-initialized-after-join"
10256
10381
  } });
10257
- return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this), Qs = null, this._signaling.readyToSend(), R.onLocalStatus(this._conversation.waitForAdmin ? P.WAIT_FOR_ADMIN : P.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
10382
+ return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this), cc = null, this._signaling.readyToSend(), R.onLocalStatus(this._conversation.waitForAdmin ? P.WAIT_FOR_ADMIN : P.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
10258
10383
  } catch (e) {
10259
- throw Qs = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
10384
+ throw cc = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
10260
10385
  }
10261
10386
  }
10262
10387
  async _onJoinPart2(e, t = !0, n = !1) {
@@ -10271,7 +10396,7 @@ var Zs = 15, $ = class e extends b {
10271
10396
  if (this._delayedHangup) throw new k(O.CANCELED);
10272
10397
  this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
10273
10398
  let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
10274
- R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (B.add(this), n ? await this._holdLocally() : await B.setActive(this.id), Qs = null);
10399
+ R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (B.add(this), n ? await this._holdLocally() : await B.setActive(this.id), cc = null);
10275
10400
  let i = this._extractLocalParticipantFromConnection(e);
10276
10401
  if (i) {
10277
10402
  let e = M.mapParticipantState(i);
@@ -10279,7 +10404,7 @@ var Zs = 15, $ = class e extends b {
10279
10404
  }
10280
10405
  return t && this._openTransport(Object.values(this._participants), !1), this._conversation;
10281
10406
  } catch (e) {
10282
- throw Qs = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
10407
+ throw cc = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
10283
10408
  }
10284
10409
  }
10285
10410
  _extractExternalRooms(e) {
@@ -10299,7 +10424,7 @@ var Zs = 15, $ = class e extends b {
10299
10424
  B.reserve(e), this._reservedId = e, a && this._api.setUserId(a), this._stats.lifecycle.markInitializationStarted({
10300
10425
  source: "incoming",
10301
10426
  conversationId: e
10302
- }), this._debug.setConversationId(e), Qs = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
10427
+ }), this._debug.setConversationId(e), cc = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
10303
10428
  try {
10304
10429
  let a = await this._prepareConversation(e, t, n, r, i);
10305
10430
  if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
@@ -10308,20 +10433,20 @@ var Zs = 15, $ = class e extends b {
10308
10433
  description: "incoming-not-initialized"
10309
10434
  } });
10310
10435
  if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(C.PUSH, "rejected"), new k(O.REJECTED);
10311
- if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), B.add(this), Qs = null, this._delayedHangup) throw new k(O.CANCELED);
10436
+ if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), B.add(this), cc = null, this._delayedHangup) throw new k(O.CANCELED);
10312
10437
  } catch (e) {
10313
- throw Qs = null, this._cleanupRegistry(), this._close(e, {
10438
+ throw cc = null, this._cleanupRegistry(), this._close(e, {
10314
10439
  errorText: "Unable to handle inbound call push",
10315
10440
  signalingReason: e instanceof k && e.hangup === O.BUSY ? O.BUSY : void 0
10316
10441
  }), e;
10317
10442
  }
10318
10443
  }
10319
10444
  _isInWaitingHall(e) {
10320
- return !e.conversation || !e.conversation.options.includes(Ga.WAITING_HALL) ? !1 : this._isRestricted(e);
10445
+ return !e.conversation || !e.conversation.options.includes(to.WAITING_HALL) ? !1 : this._isRestricted(e);
10321
10446
  }
10322
10447
  _isWaitForAdmin(e) {
10323
10448
  if (!e.conversation) return !1;
10324
- let t = e.conversation.options.includes(Ga.WAIT_FOR_ADMIN), n = e.conversation.options.includes(Ga.ADMIN_IS_HERE);
10449
+ let t = e.conversation.options.includes(to.WAIT_FOR_ADMIN), n = e.conversation.options.includes(to.ADMIN_IS_HERE);
10325
10450
  return !t || t && n ? !1 : this._isRestricted(e);
10326
10451
  }
10327
10452
  _isRestricted(e) {
@@ -10329,7 +10454,7 @@ var Zs = 15, $ = class e extends b {
10329
10454
  return t && t.restricted || !1;
10330
10455
  }
10331
10456
  _isAudienceMode(e) {
10332
- return e.conversation?.options?.includes(Ga.AUDIENCE_MODE) || !1;
10457
+ return e.conversation?.options?.includes(to.AUDIENCE_MODE) || !1;
10333
10458
  }
10334
10459
  _isAudienceModeListener() {
10335
10460
  return this._conversation?.audienceMode && this._conversation?.restricted;
@@ -10359,7 +10484,7 @@ var Zs = 15, $ = class e extends b {
10359
10484
  let i = atob(n), a = new Uint8Array(i.length);
10360
10485
  for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
10361
10486
  try {
10362
- let e = mo(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);
10487
+ 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);
10363
10488
  return {
10364
10489
  token: i,
10365
10490
  endpoint: l,
@@ -10562,10 +10687,10 @@ var Zs = 15, $ = class e extends b {
10562
10687
  let t = await this._api.getConversationParams(e);
10563
10688
  this._debug.debug("Api.getConversationParams", t);
10564
10689
  let { turn_server: n, stun_server: r } = t;
10565
- return N.iceServers = po(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;
10690
+ return N.iceServers = Co(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;
10566
10691
  }
10567
10692
  _setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
10568
- N.iceServers = po(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
10693
+ N.iceServers = Co(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
10569
10694
  }
10570
10695
  _buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
10571
10696
  let s = new URL(e), c = s.searchParams;
@@ -10597,10 +10722,10 @@ var Zs = 15, $ = class e extends b {
10597
10722
  isVideo: f,
10598
10723
  joiningAllowed: a,
10599
10724
  requireAuthToJoin: o
10600
- }, this._abortController?.signal), !e) throw Xs(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
10725
+ }, this._abortController?.signal), !e) throw oc(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
10601
10726
  if (!e.internalCallerParams) {
10602
10727
  let t = e.rejectedParticipants[0]?.status;
10603
- throw Xs(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
10728
+ throw oc(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
10604
10729
  }
10605
10730
  } catch (e) {
10606
10731
  throw this._delayedHangup && this._abortController?.signal.aborted ? 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) });
@@ -10622,10 +10747,10 @@ var Zs = 15, $ = class e extends b {
10622
10747
  token: new URL(t.endpoint).searchParams.get("token") ?? ""
10623
10748
  }, this._debug.debug("FastStart", p), m = "fastStart";
10624
10749
  } catch {
10625
- throw Xs(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
10750
+ throw oc(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
10626
10751
  }
10627
10752
  } else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
10628
- vo(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
10753
+ Oo(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
10629
10754
  let ee = await this._connectSignaling(_r.START, p);
10630
10755
  return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
10631
10756
  }
@@ -10650,9 +10775,9 @@ var Zs = 15, $ = class e extends b {
10650
10775
  joinLink: i,
10651
10776
  isVideo: c,
10652
10777
  internalParams: this._buildInternalParams()
10653
- }, this._abortController?.signal), !e) throw Xs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
10654
- if (!e.internalCallerParams) throw Xs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
10655
- if (!e.conversationId) throw Xs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
10778
+ }, this._abortController?.signal), !e) throw oc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
10779
+ if (!e.internalCallerParams) throw oc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
10780
+ if (!e.conversationId) throw oc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
10656
10781
  } catch (e) {
10657
10782
  throw this._delayedHangup && this._abortController?.signal.aborted ? 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) });
10658
10783
  }
@@ -10670,7 +10795,7 @@ var Zs = 15, $ = class e extends b {
10670
10795
  token: new URL(t.endpoint).searchParams.get("token") ?? ""
10671
10796
  }, this._debug.debug("FastJoin", l), u = "fastJoin";
10672
10797
  } catch (e) {
10673
- throw e instanceof k ? e : Xs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
10798
+ throw e instanceof k ? e : oc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
10674
10799
  }
10675
10800
  } else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
10676
10801
  else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
@@ -10679,13 +10804,13 @@ var Zs = 15, $ = class e extends b {
10679
10804
  code: "join",
10680
10805
  description: "target-missing"
10681
10806
  } });
10682
- if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), vo(l, u), l.id) {
10807
+ if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), Oo(l, u), l.id) {
10683
10808
  if (B.has(l.id)) throw new k(O.HAS_ACTIVE_CALL);
10684
10809
  B.reserve(l.id), this._reservedId = l.id;
10685
10810
  }
10686
10811
  this._setConversationParams(l);
10687
10812
  let d = await this._connectSignaling(_r.JOIN, l);
10688
- return this._setConversation(l, d, Va.JOINING), this._stats.lifecycle.markCallStarted(), d;
10813
+ return this._setConversation(l, d, Za.JOINING), this._stats.lifecycle.markCallStarted(), d;
10689
10814
  }
10690
10815
  async _prepareConversation(e, t = j.USER, n, r, i) {
10691
10816
  G.setMark(U.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
@@ -10747,7 +10872,7 @@ var Zs = 15, $ = class e extends b {
10747
10872
  }), l.wt_endpoint = c);
10748
10873
  }
10749
10874
  let u = await this._connectSignaling(_r.ACCEPT, l);
10750
- return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._setConversation(l, u, Va.INCOMING, t), u);
10875
+ return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._setConversation(l, u, Za.INCOMING, t), u);
10751
10876
  }
10752
10877
  _createParticipant(e, t, n = !0) {
10753
10878
  let r = Object.assign({
@@ -10774,7 +10899,7 @@ var Zs = 15, $ = class e extends b {
10774
10899
  let e = this._getParticipantId(t ?? r.id);
10775
10900
  e && (r.externalId = e);
10776
10901
  }
10777
- 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 = to.create(r.connectionStatus), r;
10902
+ 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 = fo.create(r.connectionStatus), r;
10778
10903
  }
10779
10904
  _getParticipantId(e) {
10780
10905
  let t = this._api.userId(e);
@@ -10853,7 +10978,7 @@ var Zs = 15, $ = class e extends b {
10853
10978
  }
10854
10979
  _createMediaSource() {
10855
10980
  let e = new Jt(this._debug, this._stats.logger);
10856
- return this.subscribe(e, Kt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new go(e, this._debug, this._stats.logger), e;
10981
+ return this.subscribe(e, Kt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Eo(e, this._debug, this._stats.logger), e;
10857
10982
  }
10858
10983
  async _connectSignaling(e, t) {
10859
10984
  this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, vr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, vr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, vr.RECONNECT, this._onSignalingReconnect.bind(this));
@@ -10861,7 +10986,7 @@ var Zs = 15, $ = class e extends b {
10861
10986
  return this._stats.statAggregator.logEventualStat({ name: U.SIGNALING_CONNECTED }), n;
10862
10987
  }
10863
10988
  async _processConnection(e) {
10864
- await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(Ua.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
10989
+ await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated($a.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
10865
10990
  }
10866
10991
  _onConversationParticipantListChunk(e) {
10867
10992
  let t = e.participants;
@@ -10930,7 +11055,7 @@ var Zs = 15, $ = class e extends b {
10930
11055
  _registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
10931
11056
  if (!e) return;
10932
11057
  let n = async () => {
10933
- let n = ao(e, Ja.MUTE), r = ao(e, Ja.MUTE_PERMANENT);
11058
+ let n = go(e, io.MUTE), r = go(e, io.MUTE_PERMANENT);
10934
11059
  for (let i of [n, r]) i.length && await this._onMuteParticipant({
10935
11060
  muteStates: e,
10936
11061
  unmuteOptions: t,
@@ -10944,8 +11069,8 @@ var Zs = 15, $ = class e extends b {
10944
11069
  if (!(!N.enableSessionStateUpdates || this._isMe(e))) return t;
10945
11070
  }
10946
11071
  _buildConnectionStatus(e, t, n, r = !1) {
10947
- return to.create({
10948
- transport: r ? P.ONHOLD : to.fromTransportState(n) ?? P.WAITING,
11072
+ return fo.create({
11073
+ transport: r ? P.ONHOLD : fo.fromTransportState(n) ?? P.WAITING,
10949
11074
  sessionState: this._remoteParticipantSessionState(e, t),
10950
11075
  sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
10951
11076
  });
@@ -10954,12 +11079,12 @@ var Zs = 15, $ = class e extends b {
10954
11079
  return N.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
10955
11080
  }
10956
11081
  _setTransportStatus(e, t) {
10957
- return to.setTransport(e.connectionStatus, t);
11082
+ return fo.setTransport(e.connectionStatus, t);
10958
11083
  }
10959
11084
  _setSessionState(e, t) {
10960
- let n = to.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
11085
+ let n = fo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
10961
11086
  this._emitParticipantTransition(e, n);
10962
- let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = to.setSessionState(e.connectionStatus, t, r);
11087
+ let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = fo.setSessionState(e.connectionStatus, t, r);
10963
11088
  return this._emitParticipantTransition(e, i), i;
10964
11089
  }
10965
11090
  _emitParticipantTransition(e, t, n = null) {
@@ -11030,11 +11155,11 @@ var Zs = 15, $ = class e extends b {
11030
11155
  this._onRoomSwitched(t, !0);
11031
11156
  }
11032
11157
  _processMuteStates(e, t = !1) {
11033
- let n = oo(e);
11158
+ let n = _o(e);
11034
11159
  this._setMuteStatesForRoomId(n, null);
11035
11160
  for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
11036
11161
  let r = this._getMuteStatesForCurrentRoom();
11037
- t && (r = uo(e, r));
11162
+ t && (r = xo(e, r));
11038
11163
  let i = Object.keys(r), a = this._conversation?.roomId;
11039
11164
  i.length && this._onMuteParticipant({
11040
11165
  muteStates: r,
@@ -11054,15 +11179,15 @@ var Zs = 15, $ = class e extends b {
11054
11179
  }
11055
11180
  _allocateTransport() {
11056
11181
  if (!this._conversation || !this._mediaSource) return;
11057
- this._transport = new ua(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new Co(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
11058
- let e = this._conversation.direction === Va.OUTGOING && !this._conversation.concurrent, t = this._participants;
11182
+ this._transport = new ba(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 No(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));
11183
+ let e = this._conversation.direction === Za.OUTGOING && !this._conversation.concurrent, t = this._participants;
11059
11184
  for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
11060
11185
  }
11061
11186
  _createSpeakerDetector() {
11062
- this._transport && this._conversation && (this._volumesDetector = new Ao(this._transport), this.subscribe(this._volumesDetector, ko.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new Mo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, jo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new Do(this._mediaSource));
11187
+ this._transport && this._conversation && (this._volumesDetector = new Bo(this._transport), this.subscribe(this._volumesDetector, zo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new Ho(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, Vo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new Lo(this._mediaSource));
11063
11188
  }
11064
11189
  _createSpecListener() {
11065
- this._transport && this._volumesDetector && (this._specListener = new Fo(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
11190
+ this._transport && this._volumesDetector && (this._specListener = new Go(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
11066
11191
  }
11067
11192
  _logDevices() {
11068
11193
  let e = E.getCameras().length, t = E.getMicrophones().length;
@@ -11161,7 +11286,7 @@ var Zs = 15, $ = class e extends b {
11161
11286
  _onRemoveParticipant(e) {
11162
11287
  this._debug.debug(`Remove participant [${e}]`);
11163
11288
  let t = [], n = this._participants;
11164
- for (let r = 0; r <= Zs; r++) {
11289
+ for (let r = 0; r <= sc; r++) {
11165
11290
  let i = n[M.compose(e, r)];
11166
11291
  i && t.push(i);
11167
11292
  }
@@ -11251,11 +11376,11 @@ var Zs = 15, $ = class e extends b {
11251
11376
  this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus()), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener();
11252
11377
  return;
11253
11378
  }
11254
- let n = ba.get();
11379
+ let n = Aa.get();
11255
11380
  await this._signaling.hold(!1, n), this._restoreStateAfterHold();
11256
11381
  let r = null;
11257
11382
  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") {
11258
- let e = this._conversation?.direction === Va.OUTGOING && !this._conversation.concurrent;
11383
+ let e = this._conversation?.direction === Za.OUTGOING && !this._conversation.concurrent;
11259
11384
  this._openTransport(r ?? Object.values(this._participants), e);
11260
11385
  }
11261
11386
  }
@@ -11378,13 +11503,13 @@ var Zs = 15, $ = class e extends b {
11378
11503
  let n = Mn(e), a = i[n.participantId];
11379
11504
  if (a) {
11380
11505
  let e;
11381
- typeof t == "number" ? e = Za(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Xa.UNKNOWN_ERROR), r.push({
11506
+ typeof t == "number" ? e = so(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = oo.UNKNOWN_ERROR), r.push({
11382
11507
  externalId: a.externalId,
11383
11508
  errorReason: e
11384
11509
  });
11385
11510
  }
11386
11511
  }
11387
- if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new $s("Could not allocate one or more participants", r);
11512
+ if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new lc("Could not allocate one or more participants", r);
11388
11513
  }
11389
11514
  async _cleanupCooldownQueue() {
11390
11515
  let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
@@ -11392,7 +11517,7 @@ var Zs = 15, $ = class e extends b {
11392
11517
  let n = t.next();
11393
11518
  if (n.done) break;
11394
11519
  let r = n.value;
11395
- if (r[1] + Ys > Date.now()) break;
11520
+ if (r[1] + ac > Date.now()) break;
11396
11521
  let i = r[0];
11397
11522
  await this._stopStreaming(i), e[i] = { stopStream: !0 };
11398
11523
  } while (!0);
@@ -11596,10 +11721,10 @@ var Zs = 15, $ = class e extends b {
11596
11721
  throw Error("transport is not initialized");
11597
11722
  }
11598
11723
  _isCallAdmin() {
11599
- return this._conversation ? M.includesOneOf(this._conversation.roles, [Qa.ADMIN, Qa.CREATOR]) : !1;
11724
+ return this._conversation ? M.includesOneOf(this._conversation.roles, [co.ADMIN, co.CREATOR]) : !1;
11600
11725
  }
11601
11726
  _checkAdminRole() {
11602
- if (this._conversation && !M.includesOneOf(this._conversation.roles, [Qa.ADMIN, Qa.CREATOR])) throw Error("You don't have the required permission");
11727
+ if (this._conversation && !M.includesOneOf(this._conversation.roles, [co.ADMIN, co.CREATOR])) throw Error("You don't have the required permission");
11603
11728
  }
11604
11729
  _isCalledState() {
11605
11730
  return this._participantState === X.CALLED;
@@ -11637,21 +11762,21 @@ var Zs = 15, $ = class e extends b {
11637
11762
  async changeOptions(e) {
11638
11763
  if (this._signaling.ready && this._conversation) {
11639
11764
  this._checkAdminRole(), await this._signaling.changeOptions(e);
11640
- let t = qa(this._conversation.options, e);
11765
+ let t = ro(this._conversation.options, e);
11641
11766
  this._onOptionsChanged(t);
11642
11767
  }
11643
11768
  }
11644
11769
  async getWaitingHall(e, t, n) {
11645
11770
  if (!this._signaling) return Promise.reject();
11646
11771
  let r = null;
11647
- if (e && (r = io(e), r)) {
11772
+ if (e && (r = ho(e), r)) {
11648
11773
  let e = this._api.getDecorativeIdByInitialId(r.id);
11649
11774
  r.id = e ?? r.id;
11650
11775
  }
11651
11776
  let i = await this._signaling.getWaitingHall(r, t, n);
11652
11777
  if (i.error) return Promise.reject(i.message);
11653
11778
  let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
11654
- return a.length && i.hasMore && (s = ro(a[a.length - 1].id)), {
11779
+ return a.length && i.hasMore && (s = mo(a[a.length - 1].id)), {
11655
11780
  participants: o,
11656
11781
  pageMarker: s,
11657
11782
  totalCount: i.totalCount || 0
@@ -11685,7 +11810,7 @@ var Zs = 15, $ = class e extends b {
11685
11810
  }
11686
11811
  async promoteParticipant(e, t) {
11687
11812
  if (this._signaling && this._conversation) try {
11688
- if (!M.includesOneOf(this._conversation.options, [Ga.WAITING_HALL, Ga.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
11813
+ if (!M.includesOneOf(this._conversation.options, [to.WAITING_HALL, to.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
11689
11814
  if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
11690
11815
  await this._signaling.promoteParticipant(e, t);
11691
11816
  } catch (t) {
@@ -11857,7 +11982,7 @@ var Zs = 15, $ = class e extends b {
11857
11982
  let a = this._transport?.getState();
11858
11983
  return n.participants.forEach((e) => {
11859
11984
  let t = M.composeId(e), n = r[t];
11860
- this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, to.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);
11985
+ this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, fo.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);
11861
11986
  }), this._participantListChunkToExternalChunk(n);
11862
11987
  }
11863
11988
  async _getInitialParticiapntListChunk() {
@@ -11871,7 +11996,7 @@ var Zs = 15, $ = class e extends b {
11871
11996
  _onLocalMediaStreamChanged(e) {
11872
11997
  if (!this._conversation || !this._mediaSource) return;
11873
11998
  let t = this._mediaSource.mediaSettings;
11874
- 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), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
11999
+ this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Eo(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
11875
12000
  }
11876
12001
  _onScreenSharingStatus(e) {
11877
12002
  let t = this.mediaSettings;
@@ -12001,9 +12126,9 @@ var Zs = 15, $ = class e extends b {
12001
12126
  for (let n of e.conversation.participants) {
12002
12127
  let e = M.composeId(n), i = n.roles || [];
12003
12128
  if (this._isMe(e)) {
12004
- $a(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
12129
+ lo(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
12005
12130
  this._registerParticipantLocalMuteState({
12006
- muteStates: lo(n),
12131
+ muteStates: bo(n),
12007
12132
  unmuteOptions: n.unmuteOptions
12008
12133
  });
12009
12134
  };
@@ -12021,7 +12146,7 @@ var Zs = 15, $ = class e extends b {
12021
12146
  let t = D(n.mediaSettings);
12022
12147
  Ut(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
12023
12148
  let r = M.mapParticipantState(n), o = a.participantState;
12024
- M.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), $a(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));
12149
+ M.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), lo(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));
12025
12150
  }
12026
12151
  }
12027
12152
  let i = this._participants;
@@ -12046,7 +12171,7 @@ var Zs = 15, $ = class e extends b {
12046
12171
  this._close(new k(O.MISSED), { errorText: "Call accepted on other device" });
12047
12172
  return;
12048
12173
  }
12049
- this._conversation?.direction === Va.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
12174
+ this._conversation?.direction === Za.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
12050
12175
  let r = this._getParticipant(t);
12051
12176
  if (!r) {
12052
12177
  let n = this._api.getDecorativeIdByInitialId(t);
@@ -12059,7 +12184,7 @@ var Zs = 15, $ = class e extends b {
12059
12184
  let t = Z.fromSignaling(e.externalId, e.deviceIdx);
12060
12185
  r.externalId = t, this._api.cacheExternalId(r.id, t);
12061
12186
  }
12062
- r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Va.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);
12187
+ r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Za.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);
12063
12188
  let i = Object.keys(r.muteStates);
12064
12189
  if (i.length && this._onMuteParticipant({
12065
12190
  muteStates: r.muteStates,
@@ -12071,7 +12196,7 @@ var Zs = 15, $ = class e extends b {
12071
12196
  this._reportMissingExternalIds([t], "ACCEPTED_CALL");
12072
12197
  return;
12073
12198
  }
12074
- R.onAcceptedCall(r.externalId, Sa.parseCapabilities(e.capabilities), this.id);
12199
+ R.onAcceptedCall(r.externalId, Ma.parseCapabilities(e.capabilities), this.id);
12075
12200
  }
12076
12201
  }
12077
12202
  async _onHungup(e) {
@@ -12108,7 +12233,7 @@ var Zs = 15, $ = class e extends b {
12108
12233
  return;
12109
12234
  }
12110
12235
  if (e.connected) {
12111
- let e = to.fromTransportState(this._transport?.getState());
12236
+ let e = fo.fromTransportState(this._transport?.getState());
12112
12237
  e && this._setTransportStatus(n, e);
12113
12238
  }
12114
12239
  this._setSessionState(n, { connected: e.connected });
@@ -12185,7 +12310,7 @@ var Zs = 15, $ = class e extends b {
12185
12310
  isOnHold: !!r.onHold
12186
12311
  }, i), n = this._getParticipant(t);
12187
12312
  }
12188
- this._conversation && this._conversation.direction === Va.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);
12313
+ this._conversation && this._conversation.direction === Za.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);
12189
12314
  let i = Object.keys(n.muteStates);
12190
12315
  i.length && this._onMuteParticipant({
12191
12316
  muteStates: n.muteStates,
@@ -12376,15 +12501,15 @@ var Zs = 15, $ = class e extends b {
12376
12501
  R.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
12377
12502
  }
12378
12503
  async _onRolesChanged(e, t) {
12379
- if (this._conversation && this._isMe(e) && !$a(this._conversation.roles, t)) {
12504
+ if (this._conversation && this._isMe(e) && !lo(this._conversation.roles, t)) {
12380
12505
  this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, R.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
12381
- mediaOptions: ao(this._getMuteStatesForCurrentRoom(), Ja.MUTE_PERMANENT),
12506
+ mediaOptions: go(this._getMuteStatesForCurrentRoom(), io.MUTE_PERMANENT),
12382
12507
  stateUpdated: !0
12383
- }), M.includesOneOf(t, [Qa.ADMIN, Qa.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
12508
+ }), M.includesOneOf(t, [co.ADMIN, co.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
12384
12509
  return;
12385
12510
  }
12386
12511
  let n = this._getParticipant(e);
12387
- n && !$a(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
12512
+ n && !lo(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
12388
12513
  }
12389
12514
  async _onMuteParticipant(e, t = !1) {
12390
12515
  if (!this._conversation) return;
@@ -12433,7 +12558,7 @@ var Zs = 15, $ = class e extends b {
12433
12558
  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);
12434
12559
  for (let [e, i] of d) {
12435
12560
  let a = this._isCallAdmin() && n;
12436
- if (!(i !== Ja.MUTE && i !== Ja.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === Ja.MUTE_PERMANENT && !n && (l[e] = Ja.MUTE), !(!t.includes(e) || r))) switch (e) {
12561
+ if (!(i !== io.MUTE && i !== io.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === io.MUTE_PERMANENT && !n && (l[e] = io.MUTE), !(!t.includes(e) || r))) switch (e) {
12437
12562
  case S.VIDEO:
12438
12563
  u.isVideoEnabled && (R.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
12439
12564
  break;
@@ -12470,7 +12595,7 @@ var Zs = 15, $ = class e extends b {
12470
12595
  this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
12471
12596
  }
12472
12597
  _onOptionsChanged(e) {
12473
- this._conversation && !Ka(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(Ga.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(Ga.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
12598
+ this._conversation && !no(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(to.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(to.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
12474
12599
  }
12475
12600
  async _onNetworkStatus(e) {
12476
12601
  if (this._conversation) {
@@ -12480,7 +12605,7 @@ var Zs = 15, $ = class e extends b {
12480
12605
  if (this._isMe(r) || r === "") e = this._conversation.networkRating;
12481
12606
  else if (n[r]) e = n[r].networkRating;
12482
12607
  else continue;
12483
- if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, Zr.getInstance().value = i, R.onLocalNetworkStatusChanged(i, this.id);
12608
+ if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, si.getInstance().value = i, R.onLocalNetworkStatusChanged(i, this.id);
12484
12609
  else {
12485
12610
  let e = n[r];
12486
12611
  e.networkRating = i, t.push({
@@ -12525,7 +12650,7 @@ var Zs = 15, $ = class e extends b {
12525
12650
  }
12526
12651
  _changeFeatureSet() {
12527
12652
  if (this._conversation) {
12528
- let e = this._state === "ACTIVE", t = this._conversation.features.includes(Wa.ADD_PARTICIPANT);
12653
+ let e = this._state === "ACTIVE", t = this._conversation.features.includes(eo.ADD_PARTICIPANT);
12529
12654
  R.onCallState(e, t, this._conversation, this.id);
12530
12655
  }
12531
12656
  }
@@ -12559,7 +12684,7 @@ var Zs = 15, $ = class e extends b {
12559
12684
  let n = this._getParticipant(e);
12560
12685
  if (n) {
12561
12686
  if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
12562
- let e = to.fromTransportState(this._transport?.getState());
12687
+ let e = fo.fromTransportState(this._transport?.getState());
12563
12688
  e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
12564
12689
  let t = this._setTransportStatus(n, n.connectionStatus.transport);
12565
12690
  this._emitParticipantTransition(n, t);
@@ -12569,7 +12694,7 @@ var Zs = 15, $ = class e extends b {
12569
12694
  }
12570
12695
  async _onTransportStateChanged(e, t) {
12571
12696
  this._debug.debug(`Transport state has changed: ${t}`, e);
12572
- let n = to.fromTransportState(t);
12697
+ let n = fo.fromTransportState(t);
12573
12698
  if (!n) return;
12574
12699
  let r = this._participants, i = [], a = e.reduce((e, n) => {
12575
12700
  if (n in r) {
@@ -12603,9 +12728,9 @@ var Zs = 15, $ = class e extends b {
12603
12728
  return e.every((e) => t[e]?.isOnHold);
12604
12729
  }
12605
12730
  _onRemoteTrackAdded(e, t, n) {
12606
- if (e.endsWith(qr.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t, this.id);
12607
- else if (e.startsWith(qr.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
12608
- else if (e.startsWith(qr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
12731
+ if (e.endsWith(ri.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t, this.id);
12732
+ else if (e.startsWith(ri.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
12733
+ else if (e.startsWith(ri.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
12609
12734
  else {
12610
12735
  this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
12611
12736
  let r = this._getParticipant(e);
@@ -12632,7 +12757,7 @@ var Zs = 15, $ = class e extends b {
12632
12757
  }
12633
12758
  }
12634
12759
  async _removeAudioTrack(e, t, n) {
12635
- if (e !== qr.AUDIO_MIX) {
12760
+ if (e !== ri.AUDIO_MIX) {
12636
12761
  let n = this._getParticipant(e);
12637
12762
  if (!n || n.remoteStream && n.remoteStream !== t) return;
12638
12763
  }
@@ -12647,7 +12772,7 @@ var Zs = 15, $ = class e extends b {
12647
12772
  if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
12648
12773
  this._conversation.topology = e;
12649
12774
  for (let e of Object.values(this._participants)) {
12650
- let t = to.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
12775
+ let t = fo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
12651
12776
  this._emitParticipantTransition(e, t);
12652
12777
  }
12653
12778
  this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
@@ -12703,7 +12828,7 @@ var Zs = 15, $ = class e extends b {
12703
12828
  ].includes(t) ? null : this._setTransportStatus(e, t), n);
12704
12829
  }
12705
12830
  _setParticipantsStalled(e, t) {
12706
- this._updateParticipantsStatus(e, (e) => to.setStalled(e.connectionStatus, t));
12831
+ this._updateParticipantsStatus(e, (e) => fo.setStalled(e.connectionStatus, t));
12707
12832
  }
12708
12833
  _updateParticipantsStatus(e, t, n = null) {
12709
12834
  let r = e.reduce((e, n) => {
@@ -12722,7 +12847,7 @@ var Zs = 15, $ = class e extends b {
12722
12847
  _onRoomsUpdated(e) {
12723
12848
  if (this._isCalledState()) return;
12724
12849
  let t = {}, n = [], r = [];
12725
- for (let i of Object.keys(Ya)) {
12850
+ for (let i of Object.keys(ao)) {
12726
12851
  let a = e.updates[i];
12727
12852
  a && (a?.rooms?.forEach((e) => {
12728
12853
  let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
@@ -12737,7 +12862,7 @@ var Zs = 15, $ = class e extends b {
12737
12862
  }
12738
12863
  _onRoomUpdated(e) {
12739
12864
  let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
12740
- e.events.some((e) => e === Ya.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));
12865
+ e.events.some((e) => e === ao.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));
12741
12866
  }
12742
12867
  _convertRoomToExternal(e) {
12743
12868
  if (!e) return {
@@ -12848,7 +12973,7 @@ var Zs = 15, $ = class e extends b {
12848
12973
  n && r.push(n);
12849
12974
  }
12850
12975
  }
12851
- r.length && !this._isCalledState() && R.onRoomsUpdated({ [Ya.UPDATE]: { rooms: r } }, this.id);
12976
+ r.length && !this._isCalledState() && R.onRoomsUpdated({ [ao.UPDATE]: { rooms: r } }, this.id);
12852
12977
  }
12853
12978
  _onFeedback(e) {
12854
12979
  let t = [];
@@ -12924,11 +13049,11 @@ var Zs = 15, $ = class e extends b {
12924
13049
  _getParticipant(e) {
12925
13050
  return this._participants[e];
12926
13051
  }
12927
- }, Qs = null, $s = class e extends Error {
13052
+ }, cc = null, lc = class e extends Error {
12928
13053
  constructor(t, n) {
12929
13054
  super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
12930
13055
  }
12931
- }, ec = class {
13056
+ }, uc = class {
12932
13057
  constructor() {
12933
13058
  h(this, "_abortSignal", void 0);
12934
13059
  }
@@ -12970,14 +13095,14 @@ var Zs = 15, $ = class e extends b {
12970
13095
  async getInbounds() {
12971
13096
  return [];
12972
13097
  }
12973
- }, tc = class e {
13098
+ }, dc = class e {
12974
13099
  constructor() {
12975
13100
  h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
12976
13101
  }
12977
13102
  static _normalizeType(e) {
12978
- return e.type === no.GROUP ? {
13103
+ return e.type === po.GROUP ? {
12979
13104
  ...e,
12980
- type: no.USER
13105
+ type: po.USER
12981
13106
  } : e;
12982
13107
  }
12983
13108
  getExternalId(e) {
@@ -13005,27 +13130,27 @@ var Zs = 15, $ = class e extends b {
13005
13130
  clear() {
13006
13131
  this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
13007
13132
  }
13008
- }, nc = "anonymLogin:", rc = 700, ic = 3e3;
13009
- function ac(e) {
13133
+ }, fc = "anonymLogin:", pc = 700, mc = 3e3;
13134
+ function hc(e) {
13010
13135
  let t = e.error_code;
13011
13136
  switch (t) {
13012
- case 2: return oc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
13013
- case 4: return e.error_msg.includes("participants.limit.exceeded") ? oc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : oc(x.API, t, "request-error");
13014
- case 300: return oc(O.NOT_FOUND, t, "not-found");
13015
- case 1101: return oc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
13016
- case 1102: return oc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
13017
- case 1103: return oc(O.NOT_FRIENDS, t, "friendship-required");
13018
- case 1104: return sc(t, "youla-api-error");
13019
- case 1106: return sc(t, "vk-api-error");
13020
- case 1113: return oc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
13137
+ case 2: return gc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
13138
+ case 4: return e.error_msg.includes("participants.limit.exceeded") ? gc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : gc(x.API, t, "request-error");
13139
+ case 300: return gc(O.NOT_FOUND, t, "not-found");
13140
+ case 1101: return gc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
13141
+ case 1102: return gc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
13142
+ case 1103: return gc(O.NOT_FRIENDS, t, "friendship-required");
13143
+ case 1104: return _c(t, "youla-api-error");
13144
+ case 1106: return _c(t, "vk-api-error");
13145
+ case 1113: return gc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
13021
13146
  case 1114: {
13022
13147
  let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
13023
- return oc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
13148
+ return gc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
13024
13149
  }
13025
- default: return oc(x.API, t, "api-error");
13150
+ default: return gc(x.API, t, "api-error");
13026
13151
  }
13027
13152
  }
13028
- function oc(e, t, n, r) {
13153
+ function gc(e, t, n, r) {
13029
13154
  return {
13030
13155
  type: e,
13031
13156
  callError: {
@@ -13037,7 +13162,7 @@ function oc(e, t, n, r) {
13037
13162
  message: r
13038
13163
  };
13039
13164
  }
13040
- function sc(e, t) {
13165
+ function _c(e, t) {
13041
13166
  return {
13042
13167
  type: O.EXTERNAL_API_ERROR,
13043
13168
  callError: {
@@ -13048,19 +13173,19 @@ function sc(e, t) {
13048
13173
  }
13049
13174
  };
13050
13175
  }
13051
- var cc = class extends ec {
13176
+ var vc = class extends uc {
13052
13177
  constructor(...e) {
13053
- super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new tc());
13178
+ super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new dc());
13054
13179
  }
13055
13180
  async _callUnsafe(e, t = {}, n = !1) {
13056
13181
  let r = async (i) => {
13057
13182
  try {
13058
- return await ts(e, t, n);
13183
+ return await ds(e, t, n);
13059
13184
  } catch (t) {
13060
13185
  if (!t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
13061
13186
  i++;
13062
13187
  let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
13063
- 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, ic), { signal: this._abortSignal }), r(i);
13188
+ 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 * pc, mc), { signal: this._abortSignal }), r(i);
13064
13189
  }
13065
13190
  throw z.warn(e, "error", t), t;
13066
13191
  }
@@ -13072,13 +13197,13 @@ var cc = class extends ec {
13072
13197
  return await this._callUnsafe(e, t, n);
13073
13198
  } catch (i) {
13074
13199
  if (z.warn("Api call error", i), i instanceof k) throw i;
13075
- if (Lo(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
13200
+ if (qo(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
13076
13201
  let a = {
13077
13202
  message: i?.error_msg,
13078
13203
  code: i?.error_code
13079
13204
  };
13080
- if (i.custom_error && (a.custom_error = i.custom_error), lc(i)) {
13081
- let e = ac(i);
13205
+ if (i.custom_error && (a.custom_error = i.custom_error), yc(i)) {
13206
+ let e = hc(i);
13082
13207
  throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
13083
13208
  }
13084
13209
  throw new k(x.API, a);
@@ -13108,7 +13233,7 @@ var cc = class extends ec {
13108
13233
  return this._anonymLogin(N.authToken).then((e) => {
13109
13234
  this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
13110
13235
  }).catch((e) => {
13111
- throw e instanceof k ? e : (e?.error_code === Io.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(x.AUTH, {
13236
+ throw e instanceof k ? e : (e?.error_code === Ko.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(x.AUTH, {
13112
13237
  message: e?.error_msg,
13113
13238
  code: e?.error_code,
13114
13239
  callError: {
@@ -13130,17 +13255,17 @@ var cc = class extends ec {
13130
13255
  return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
13131
13256
  }
13132
13257
  _getAnonymLoginCacheKey() {
13133
- return N.authToken ? `${nc}${N.authToken}` : null;
13258
+ return N.authToken ? `${fc}${N.authToken}` : null;
13134
13259
  }
13135
13260
  _getCachedAnonymLogin() {
13136
13261
  let e = this._getAnonymLoginCacheKey();
13137
13262
  if (!e) return null;
13138
13263
  let t = w.get(e);
13139
- return uc(t) ? t : (t && w.remove(e), null);
13264
+ return bc(t) ? t : (t && w.remove(e), null);
13140
13265
  }
13141
13266
  _setCachedAnonymLogin(e) {
13142
13267
  let t = this._getAnonymLoginCacheKey();
13143
- !t || !uc(e) || w.set(t, {
13268
+ !t || !bc(e) || w.set(t, {
13144
13269
  session_key: e.session_key,
13145
13270
  session_secret_key: e.session_secret_key,
13146
13271
  uid: e.uid
@@ -13154,9 +13279,9 @@ var cc = class extends ec {
13154
13279
  return this._removeCachedAnonymLogin(), y.reauthorize(() => this.authorize());
13155
13280
  }
13156
13281
  _applyAnonymLogin(e) {
13157
- e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key, N.statQueueEnabled && e.uid && ls.remember(Number(e.uid), {
13282
+ e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key, N.statQueueEnabled && e.uid && ys.remember(Number(e.uid), {
13158
13283
  sessionKey: e.session_key,
13159
- endpoint: ls.currentEndpoint()
13284
+ endpoint: ys.currentEndpoint()
13160
13285
  });
13161
13286
  }
13162
13287
  _buildClientStatsData(e) {
@@ -13175,7 +13300,7 @@ var cc = class extends ec {
13175
13300
  });
13176
13301
  }
13177
13302
  async _sendClientStatsWith(e, t) {
13178
- let n = await ts("vchat.clientStats", {
13303
+ let n = await ds("vchat.clientStats", {
13179
13304
  ...t,
13180
13305
  session_key: e
13181
13306
  }, !0);
@@ -13183,10 +13308,10 @@ var cc = class extends ec {
13183
13308
  }
13184
13309
  async _sendClientStats(e, t, n = !0) {
13185
13310
  try {
13186
- let n = t ? await ns("vchat.clientStats", e) : await ts("vchat.clientStats", e);
13311
+ let n = t ? await fs("vchat.clientStats", e) : await ds("vchat.clientStats", e);
13187
13312
  this._reportClientStatsItemErrors(n);
13188
13313
  } catch (r) {
13189
- if (!n || !Lo(r?.error_code)) throw r;
13314
+ if (!n || !qo(r?.error_code)) throw r;
13190
13315
  await this._reauthorize(), await this._sendClientStats(e, t, !1);
13191
13316
  }
13192
13317
  }
@@ -13210,14 +13335,14 @@ var cc = class extends ec {
13210
13335
  }, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
13211
13336
  o.append("file", s, "log.json");
13212
13337
  let c = new URL(a.upload_url);
13213
- return c.searchParams.append("size", s.size.toString()), as(c.toString(), o);
13338
+ return c.searchParams.append("size", s.size.toString()), hs(c.toString(), o);
13214
13339
  }
13215
13340
  async joinConversation(e, t = !1, n) {
13216
13341
  let r = {
13217
13342
  conversationId: e,
13218
13343
  isVideo: t,
13219
13344
  protocolVersion: N.protocolVersion,
13220
- capabilities: Sa.getFlags()
13345
+ capabilities: Ma.getFlags()
13221
13346
  };
13222
13347
  return n && (r.chatId = n), this._call("vchat.joinConversation", r);
13223
13348
  }
@@ -13249,13 +13374,13 @@ var cc = class extends ec {
13249
13374
  externalIds: l
13250
13375
  });
13251
13376
  if (t && t.length) switch (n) {
13252
- case Ha.USER:
13377
+ case Qa.USER:
13253
13378
  u.uids = t.join(",");
13254
13379
  break;
13255
- case Ha.GROUP:
13380
+ case Qa.GROUP:
13256
13381
  u.gid = t[0];
13257
13382
  break;
13258
- case Ha.CHAT:
13383
+ case Qa.CHAT:
13259
13384
  u.chatId = t[0];
13260
13385
  break;
13261
13386
  }
@@ -13298,7 +13423,7 @@ var cc = class extends ec {
13298
13423
  joinLink: e,
13299
13424
  isVideo: t,
13300
13425
  protocolVersion: N.protocolVersion,
13301
- capabilities: Sa.getFlags()
13426
+ capabilities: Ma.getFlags()
13302
13427
  };
13303
13428
  return n?.length && (i.observedIds = n.join(",")), N.anonymToken && (i.anonymToken = N.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
13304
13429
  }
@@ -13328,9 +13453,9 @@ var cc = class extends ec {
13328
13453
  return y.userId;
13329
13454
  }
13330
13455
  setUserId(e) {
13331
- y.userId = e, N.statQueueEnabled && y.sessionKey && ls.remember(Number(e), {
13456
+ y.userId = e, N.statQueueEnabled && y.sessionKey && ys.remember(Number(e), {
13332
13457
  sessionKey: y.sessionKey,
13333
- endpoint: ls.currentEndpoint()
13458
+ endpoint: ys.currentEndpoint()
13334
13459
  });
13335
13460
  }
13336
13461
  hangupConversation(e, t = O.HUNGUP, n) {
@@ -13338,7 +13463,7 @@ var cc = class extends ec {
13338
13463
  conversationId: e,
13339
13464
  reason: t
13340
13465
  };
13341
- N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), es("vchat.hangupConversation", r);
13466
+ N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), us("vchat.hangupConversation", r);
13342
13467
  }
13343
13468
  async removeHistoryRecords(e) {
13344
13469
  await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
@@ -13354,19 +13479,19 @@ var cc = class extends ec {
13354
13479
  return Array.isArray(e?.inbounds) ? e.inbounds : [];
13355
13480
  }
13356
13481
  };
13357
- function lc(e) {
13482
+ function yc(e) {
13358
13483
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
13359
13484
  }
13360
- function uc(e) {
13485
+ function bc(e) {
13361
13486
  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;
13362
13487
  }
13363
13488
  //#endregion
13364
13489
  //#region src/enums/RecordRole.ts
13365
- var dc = /* @__PURE__ */ function(e) {
13490
+ var xc = /* @__PURE__ */ function(e) {
13366
13491
  return e.KING = "KING", e.PAWN = "PAWN", e;
13367
- }(dc || {}), fc = /* @__PURE__ */ function(e) {
13492
+ }(xc || {}), Sc = /* @__PURE__ */ function(e) {
13368
13493
  return e.OFF = "0", e.ON = "1", e;
13369
- }({}), pc = class {
13494
+ }({}), Cc = class {
13370
13495
  constructor(e) {
13371
13496
  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;
13372
13497
  }
@@ -13389,12 +13514,12 @@ var dc = /* @__PURE__ */ function(e) {
13389
13514
  let e = this._queue[this._readCursor];
13390
13515
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
13391
13516
  }
13392
- }, mc = class {
13517
+ }, wc = class {
13393
13518
  constructor(e, t, n, r = null) {
13394
13519
  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;
13395
13520
  }
13396
13521
  async authorize() {
13397
- let e = await ts("auth.anonymLogin", {
13522
+ let e = await ds("auth.anonymLogin", {
13398
13523
  session_data: {
13399
13524
  device_id: this._uuid,
13400
13525
  client_version: N.apiClientVersion,
@@ -13403,7 +13528,7 @@ var dc = /* @__PURE__ */ function(e) {
13403
13528
  version: 3
13404
13529
  },
13405
13530
  application_key: this._apiKey
13406
- }, !0, await Qo(this._baseApiUrl, this._apiEnv));
13531
+ }, !0, await cs(this._baseApiUrl, this._apiEnv));
13407
13532
  return M.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
13408
13533
  }
13409
13534
  async hangupConversation(e, t) {
@@ -13413,9 +13538,9 @@ var dc = /* @__PURE__ */ function(e) {
13413
13538
  application_key: this._apiKey,
13414
13539
  session_key: this._sessionKey
13415
13540
  };
13416
- t?.peerId && (n.peerId = t.peerId), await ts("vchat.hangupConversation", n, !0, await Qo(this._baseApiUrl, this._apiEnv));
13541
+ t?.peerId && (n.peerId = t.peerId), await ds("vchat.hangupConversation", n, !0, await cs(this._baseApiUrl, this._apiEnv));
13417
13542
  }
13418
- }, hc, gc = null, _c = !1, vc = {
13543
+ }, Tc, Ec = null, Dc = !1, Oc = {
13419
13544
  getCameras: E.getCameras,
13420
13545
  getMicrophones: E.getMicrophones,
13421
13546
  getOutput: E.getOutput,
@@ -13441,27 +13566,27 @@ var dc = /* @__PURE__ */ function(e) {
13441
13566
  baseChromeVersion: E.baseChromeVersion,
13442
13567
  getAudioContext: E.getAudioContext,
13443
13568
  isAudioShareSupported: E.isAudioShareSupported
13444
- }, yc = { participantMarkerCompare: M.participantMarkerCompare };
13445
- function bc(e) {
13446
- gc = e;
13569
+ }, kc = { participantMarkerCompare: M.participantMarkerCompare };
13570
+ function Ac(e) {
13571
+ Ec = e;
13447
13572
  }
13448
- function xc(e) {
13573
+ function jc(e) {
13449
13574
  N.videoEffects = e;
13450
13575
  }
13451
- function Sc(e) {
13576
+ function Mc(e) {
13452
13577
  N.audioEffects = e;
13453
13578
  }
13454
- function Cc(e, t = {}) {
13579
+ function Nc(e, t = {}) {
13455
13580
  N.vad = e, N.vadOptions = t;
13456
13581
  }
13457
- function wc(e, t = null, n = {}, r = 1) {
13582
+ function Pc(e, t = null, n = {}, r = 1) {
13458
13583
  N.vmoji = e, N.vmojiOptions = {
13459
13584
  protocolVersion: r,
13460
13585
  renderingOptions: n
13461
13586
  }, t && e.setSDK(t);
13462
13587
  }
13463
- async function Tc(t) {
13464
- N.set(t), hc || (hc = new cc()), N.statQueueEnabled && (ds.setApi(hc), N.autoStartStats && Mc()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
13588
+ async function Fc(t) {
13589
+ N.set(t), Tc || (Tc = new vc()), N.statQueueEnabled && (xs.setApi(Tc), N.autoStartStats && Hc()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
13465
13590
  let n = E.getBrowserSupportFailure();
13466
13591
  if (n) throw new k(x.UNSUPPORTED, { callError: {
13467
13592
  scope: "internal",
@@ -13470,19 +13595,19 @@ async function Tc(t) {
13470
13595
  } });
13471
13596
  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}`);
13472
13597
  }
13473
- async function Ec(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
13598
+ async function Ic(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
13474
13599
  let c = [];
13475
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), Oc([], Ha.USER, t, n, r, i, a, c, o, s);
13600
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), Rc([], Qa.USER, t, n, r, i, a, c, o, s);
13476
13601
  }
13477
- function Dc(e, t = []) {
13602
+ function Lc(e, t = []) {
13478
13603
  let n = e.getIncomingCallerExternalId();
13479
13604
  return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
13480
13605
  }
13481
- async function Oc(e, t = Ha.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
13606
+ async function Rc(e, t = Qa.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
13482
13607
  if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
13483
13608
  let u = B.getAll().find((e) => e.isIncomingRinging);
13484
- if (!N.hold && u && !Dc(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
13485
- return new $(new cc(), gc).onStart({
13609
+ if (!N.hold && u && !Lc(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
13610
+ return new $(new vc(), Ec).onStart({
13486
13611
  opponentIds: e,
13487
13612
  opponentType: t,
13488
13613
  mediaOptions: n,
@@ -13495,49 +13620,49 @@ async function Oc(e, t = Ha.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
13495
13620
  conversationId: l
13496
13621
  });
13497
13622
  }
13498
- async function kc(e, t) {
13499
- return Ac(e, j.USER, void 0, t);
13623
+ async function zc(e, t) {
13624
+ return Bc(e, j.USER, void 0, t);
13500
13625
  }
13501
- async function Ac(e, t = j.USER, n, r, i, a) {
13626
+ async function Bc(e, t = j.USER, n, r, i, a) {
13502
13627
  if (e === $.id()) throw Error("Push has already been processed");
13503
- return new $(new cc(), gc).onPush(e, t, n, r, i, a);
13628
+ return new $(new vc(), Ec).onPush(e, t, n, r, i, a);
13504
13629
  }
13505
- async function jc() {
13506
- return hc.getInbounds();
13630
+ async function Vc() {
13631
+ return Tc.getInbounds();
13507
13632
  }
13508
- function Mc() {
13633
+ function Hc() {
13509
13634
  if (N.statQueueEnabled) {
13510
- if (!hc) {
13635
+ if (!Tc) {
13511
13636
  z.error("[CallsSDK] startStats() called before init()");
13512
13637
  return;
13513
13638
  }
13514
- _c || (_c = !0, xs.start(hc));
13639
+ Dc || (Dc = !0, js.start(Tc));
13515
13640
  }
13516
13641
  }
13517
- async function Nc(e, t) {
13518
- return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Xo()), hc.authorize();
13642
+ async function Uc(e, t) {
13643
+ return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, os()), Tc.authorize();
13519
13644
  }
13520
- async function Pc(e = [S.AUDIO], t) {
13521
- return au(t).accept(e);
13645
+ async function Wc(e = [S.AUDIO], t) {
13646
+ return hu(t).accept(e);
13522
13647
  }
13523
- async function Fc(e) {
13524
- let t = nu(e?.conversationId);
13648
+ async function Gc(e) {
13649
+ let t = fu(e?.conversationId);
13525
13650
  if (t) return t.decline(e);
13526
13651
  }
13527
- async function Ic(e, t = [S.AUDIO]) {
13528
- return Lc(e, t);
13652
+ async function Kc(e, t = [S.AUDIO]) {
13653
+ return qc(e, t);
13529
13654
  }
13530
- async function Lc(e, t, n) {
13655
+ async function qc(e, t, n) {
13531
13656
  if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
13532
- return new $(new cc(), gc).onJoin({
13657
+ return new $(new vc(), Ec).onJoin({
13533
13658
  conversationId: e,
13534
13659
  mediaOptions: t,
13535
13660
  chatId: n
13536
13661
  });
13537
13662
  }
13538
- async function Rc(e, t = [S.AUDIO], n, r, i, a) {
13663
+ async function Jc(e, t = [S.AUDIO], n, r, i, a) {
13539
13664
  if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
13540
- return n && (N.anonymToken = n), new $(new cc(), gc).onJoin({
13665
+ return n && (N.anonymToken = n), new $(new vc(), Ec).onJoin({
13541
13666
  joinLink: e,
13542
13667
  mediaOptions: t,
13543
13668
  observedIds: r,
@@ -13546,30 +13671,30 @@ async function Rc(e, t = [S.AUDIO], n, r, i, a) {
13546
13671
  anonymous: !!N.anonymToken
13547
13672
  });
13548
13673
  }
13549
- function zc(e) {
13550
- let t = nu(e?.conversationId);
13674
+ function Yc(e) {
13675
+ let t = fu(e?.conversationId);
13551
13676
  return t ? t.hangup(e) : ($.hangupAfterInit(e?.onFastHangup), Promise.resolve());
13552
13677
  }
13553
- async function Bc(e, t) {
13678
+ async function Xc(e, t) {
13554
13679
  let n = Array.isArray(e) ? e : [e], r = $.current();
13555
13680
  r && await r.addParticipant(n, t);
13556
13681
  }
13557
- async function Vc(e, t) {
13682
+ async function Zc(e, t) {
13558
13683
  let n = $.current();
13559
13684
  if (n) {
13560
13685
  let r = e.map((e) => M.composeUserId(e));
13561
13686
  await n.addParticipantLegacy(r, t);
13562
13687
  }
13563
13688
  }
13564
- async function Hc(e, t = !1) {
13565
- let n = ou(e, "removeParticipant");
13689
+ async function Qc(e, t = !1) {
13690
+ let n = gu(e, "removeParticipant");
13566
13691
  if (n) try {
13567
13692
  await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
13568
13693
  } catch (e) {
13569
13694
  z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
13570
13695
  }
13571
13696
  }
13572
- async function Uc(e, t = !1) {
13697
+ async function $c(e, t = !1) {
13573
13698
  let n = $.current();
13574
13699
  if (n) try {
13575
13700
  await n.removeParticipant(M.composeUserId(e), t);
@@ -13577,13 +13702,13 @@ async function Uc(e, t = !1) {
13577
13702
  z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
13578
13703
  }
13579
13704
  }
13580
- async function Wc(e, t) {
13705
+ async function el(e, t) {
13581
13706
  let n = $.current();
13582
13707
  if (e === "videoinput" && At.contains(t)) return N.videoFacingMode = t, n ? (E.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
13583
13708
  if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
13584
13709
  if (n) return n.changeDevice(e);
13585
13710
  }
13586
- async function Gc(e, t) {
13711
+ async function tl(e, t) {
13587
13712
  let n = typeof e == "object" ? {
13588
13713
  ...e,
13589
13714
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -13592,40 +13717,40 @@ async function Gc(e, t) {
13592
13717
  captureScreen: e,
13593
13718
  fastScreenSharing: !1,
13594
13719
  captureAudio: !1
13595
- }, r = nu(t);
13720
+ }, r = fu(t);
13596
13721
  return r ? r.toggleScreenCapturing(n) : Promise.reject();
13597
13722
  }
13598
- function Kc(e) {
13723
+ function nl(e) {
13599
13724
  let t = $.current();
13600
13725
  t && t.toggleAnimojiCapturing(e);
13601
13726
  }
13602
- async function qc(e, t = !1) {
13727
+ async function rl(e, t = !1) {
13603
13728
  let n = $.current();
13604
13729
  n && await n.setVideoStream(e, t);
13605
13730
  }
13606
- async function Jc(e, t) {
13607
- let n = nu(t);
13731
+ async function il(e, t) {
13732
+ let n = fu(t);
13608
13733
  n && await n.toggleLocalVideo(e);
13609
13734
  }
13610
- async function Yc(e, t) {
13611
- let n = nu(t);
13735
+ async function al(e, t) {
13736
+ let n = fu(t);
13612
13737
  n && await n.toggleLocalAudio(e);
13613
13738
  }
13614
- async function Xc(e) {
13739
+ async function ol(e) {
13615
13740
  let t = $.current();
13616
13741
  if (t) return t.setLocalResolution(e);
13617
13742
  }
13618
- async function Zc(e) {
13743
+ async function sl(e) {
13619
13744
  let t = $.current();
13620
13745
  t && await t.changePriorities(e);
13621
13746
  }
13622
- async function Qc(e, t) {
13747
+ async function cl(e, t) {
13623
13748
  let n = $.current();
13624
13749
  if (n) {
13625
13750
  if (t) {
13626
13751
  let r = n.getCachedParticipantIdByExternalId(t);
13627
13752
  if (!r) {
13628
- ru(t, "changeParticipantState", n);
13753
+ pu(t, "changeParticipantState", n);
13629
13754
  return;
13630
13755
  }
13631
13756
  await n.changeParticipantState(e, r);
@@ -13634,161 +13759,161 @@ async function Qc(e, t) {
13634
13759
  await n.changeParticipantState(e);
13635
13760
  }
13636
13761
  }
13637
- async function $c() {
13762
+ async function ll() {
13638
13763
  let e = $.current();
13639
13764
  e && await e.putHandsDown();
13640
13765
  }
13641
- async function el(e) {
13766
+ async function ul(e) {
13642
13767
  let t = $.current();
13643
13768
  t && await t.updateDisplayLayout(e);
13644
13769
  }
13645
- async function tl(e) {
13770
+ async function dl(e) {
13646
13771
  let t = $.current();
13647
13772
  t && await t.requestDisplayLayout(e);
13648
13773
  }
13649
- async function nl(e, t, n = !1) {
13650
- let r = ou(e, "grantRoles");
13774
+ async function fl(e, t, n = !1) {
13775
+ let r = gu(e, "grantRoles");
13651
13776
  r && await r.conversation.grantRoles(r.participantId, t, n);
13652
13777
  }
13653
- async function rl(e, t, n, r = !1) {
13778
+ async function pl(e, t, n, r = !1) {
13654
13779
  let i = $.current();
13655
13780
  i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
13656
13781
  }
13657
- async function il({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
13782
+ async function ml({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
13658
13783
  if (e) {
13659
- let i = ou(e, "muteParticipant");
13784
+ let i = gu(e, "muteParticipant");
13660
13785
  return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
13661
13786
  }
13662
13787
  let i = $.current();
13663
13788
  i && await i.muteParticipant(null, t, n, r);
13664
13789
  }
13665
- async function al({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
13790
+ async function hl({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
13666
13791
  let a = $.current();
13667
13792
  if (a) {
13668
13793
  let o = e ? M.composeParticipantId(e, j.USER, r) : null;
13669
13794
  await a.muteParticipant(o, t, n, i);
13670
13795
  }
13671
13796
  }
13672
- async function ol(e, t = !1, n = null) {
13673
- let r = ou(e, "pinParticipant");
13797
+ async function gl(e, t = !1, n = null) {
13798
+ let r = gu(e, "pinParticipant");
13674
13799
  r && await r.conversation.pinParticipant(r.participantId, t, n);
13675
13800
  }
13676
- async function sl(e, t = !1, n = 0, r = null) {
13801
+ async function _l(e, t = !1, n = 0, r = null) {
13677
13802
  let i = $.current();
13678
13803
  i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
13679
13804
  }
13680
- async function cl(e) {
13805
+ async function vl(e) {
13681
13806
  let t = $.current();
13682
13807
  t && await t.updateMediaModifiers(e);
13683
13808
  }
13684
- async function ll(e) {
13809
+ async function yl(e) {
13685
13810
  let t = $.current();
13686
13811
  t && await t.enableVideoSuspend(e);
13687
13812
  }
13688
- async function ul(e) {
13813
+ async function bl(e) {
13689
13814
  let t = $.current();
13690
13815
  t && await t.enableVideoSuspendSuggest(e);
13691
13816
  }
13692
- async function dl(e) {
13817
+ async function xl(e) {
13693
13818
  let t = $.current();
13694
13819
  t && await t.changeOptions(e);
13695
13820
  }
13696
- async function fl(e, t = null) {
13821
+ async function Sl(e, t = null) {
13697
13822
  if (t) {
13698
- let n = ou(t, "chatMessage");
13823
+ let n = gu(t, "chatMessage");
13699
13824
  return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
13700
13825
  }
13701
13826
  let n = $.current();
13702
13827
  n && await n.chatMessage(e, null);
13703
13828
  }
13704
- async function pl(e, t = null) {
13829
+ async function Cl(e, t = null) {
13705
13830
  let n = $.current();
13706
13831
  if (n) {
13707
13832
  let r = t ? M.composeUserId(t) : null;
13708
13833
  await n.chatMessage(e, r);
13709
13834
  }
13710
13835
  }
13711
- async function ml(e = 10) {
13836
+ async function wl(e = 10) {
13712
13837
  let t = $.current();
13713
13838
  if (t) return t.chatHistory(e);
13714
13839
  }
13715
- async function hl(e, t = null) {
13840
+ async function Tl(e, t = null) {
13716
13841
  if (t) {
13717
- let n = ou(t, "customData");
13842
+ let n = gu(t, "customData");
13718
13843
  return n ? n.conversation.customData(e, n.participantId) : void 0;
13719
13844
  }
13720
13845
  let n = $.current();
13721
13846
  n && await n.customData(e, null);
13722
13847
  }
13723
- async function gl(e, t = null, n = 0) {
13848
+ async function El(e, t = null, n = 0) {
13724
13849
  let r = $.current();
13725
13850
  if (r) {
13726
13851
  let i = t ? M.composeParticipantId(t, j.USER, n) : null;
13727
13852
  await r.customData(e, i);
13728
13853
  }
13729
13854
  }
13730
- async function _l(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
13731
- return (await hc.createConversation(a ?? M.uuid(), e, t, {
13855
+ async function Dl(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
13856
+ return (await Tc.createConversation(a ?? M.uuid(), e, t, {
13732
13857
  onlyAdminCanShareMovie: n,
13733
13858
  waitForAdmin: r,
13734
13859
  closedConversation: i
13735
13860
  })).join_link;
13736
13861
  }
13737
- async function vl(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
13862
+ async function Ol(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
13738
13863
  let a = i.map((e) => Z.fromId(e));
13739
- return (await hc.createConversation(M.uuid(), e, t, {
13864
+ return (await Tc.createConversation(M.uuid(), e, t, {
13740
13865
  onlyAdminCanShareMovie: n,
13741
13866
  audienceMode: !0,
13742
13867
  audioOnly: r
13743
13868
  }, a)).join_link;
13744
13869
  }
13745
- async function yl() {
13870
+ async function kl() {
13746
13871
  let e = $.current();
13747
13872
  return e ? e.createJoinLink() : Promise.reject();
13748
13873
  }
13749
- async function bl() {
13874
+ async function Al() {
13750
13875
  let e = $.current();
13751
13876
  return e ? e.removeJoinLink() : Promise.reject();
13752
13877
  }
13753
- async function xl(e, t) {
13754
- return hc.getAnonymTokenByLink(e, t);
13878
+ async function jl(e, t) {
13879
+ return Tc.getAnonymTokenByLink(e, t);
13755
13880
  }
13756
- function Sl(e) {
13881
+ function Ml(e) {
13757
13882
  let t = $.current();
13758
13883
  t && t.setVolume(e);
13759
13884
  }
13760
- function Cl(e) {
13885
+ function Nl(e) {
13761
13886
  N.forceRelayPolicy = e;
13762
13887
  }
13763
- async function wl(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
13888
+ async function Pl(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
13764
13889
  let o = $.current();
13765
13890
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
13766
13891
  }
13767
- async function Tl(e = null, t) {
13892
+ async function Fl(e = null, t) {
13768
13893
  let n = $.current();
13769
13894
  return n ? n.stopStream(e, t) : Promise.reject();
13770
13895
  }
13771
- async function El(e = null) {
13896
+ async function Il(e = null) {
13772
13897
  let t = $.current();
13773
13898
  return t ? t.publishStream(e) : Promise.reject();
13774
13899
  }
13775
- async function Dl() {
13900
+ async function Ll() {
13776
13901
  let e = $.current();
13777
13902
  return e ? e.getStreamInfo() : Promise.reject();
13778
13903
  }
13779
- async function Ol(e) {
13904
+ async function Rl(e) {
13780
13905
  let t = $.current();
13781
13906
  return t ? t.addMovie(e) : Promise.reject();
13782
13907
  }
13783
- async function kl(e) {
13908
+ async function zl(e) {
13784
13909
  let t = $.current();
13785
13910
  return t ? t.updateMovie(e) : Promise.reject();
13786
13911
  }
13787
- async function Al(e) {
13912
+ async function Bl(e) {
13788
13913
  let t = $.current();
13789
13914
  return t ? t.removeMovie(e) : Promise.reject();
13790
13915
  }
13791
- async function jl(e, t) {
13916
+ async function Vl(e, t) {
13792
13917
  let n = $.current();
13793
13918
  if (n) {
13794
13919
  let r = [], i = [];
@@ -13810,46 +13935,46 @@ async function jl(e, t) {
13810
13935
  });
13811
13936
  }
13812
13937
  if (i.length) {
13813
- iu(i, "updateRooms", n);
13938
+ mu(i, "updateRooms", n);
13814
13939
  return;
13815
13940
  }
13816
13941
  return n.updateRooms(r, t);
13817
13942
  }
13818
13943
  return Promise.reject();
13819
13944
  }
13820
- async function Ml(e, t) {
13945
+ async function Hl(e, t) {
13821
13946
  let n = $.current();
13822
13947
  return n ? n.activateRooms(e, t) : Promise.reject();
13823
13948
  }
13824
- async function Nl(e = null, t = null) {
13949
+ async function Ul(e = null, t = null) {
13825
13950
  let n = $.current();
13826
13951
  if (!n) return Promise.reject();
13827
13952
  let r;
13828
13953
  if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
13829
- ru(t, "switchRoom", n);
13954
+ pu(t, "switchRoom", n);
13830
13955
  return;
13831
13956
  }
13832
13957
  return n.switchRoom(e, r);
13833
13958
  }
13834
- async function Pl(e) {
13959
+ async function Wl(e) {
13835
13960
  let t = $.current();
13836
13961
  return t ? t.removeRooms(e) : Promise.reject();
13837
13962
  }
13838
- function Fl(e) {
13963
+ function Gl(e) {
13839
13964
  N.statisticsInterval = e;
13840
13965
  let t = $.current();
13841
13966
  if (t) return t.updateStatisticsInterval();
13842
13967
  }
13843
- function Il(t) {
13968
+ function Kl(t) {
13844
13969
  e.disableLog(!t), z.toggle(t);
13845
13970
  }
13846
- function Ll(e, ...t) {
13971
+ function ql(e, ...t) {
13847
13972
  N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
13848
13973
  }
13849
- function Rl(e, t, ...n) {
13974
+ function Jl(e, t, ...n) {
13850
13975
  N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
13851
13976
  }
13852
- var zl = {
13977
+ var Yl = {
13853
13978
  list: Ne,
13854
13979
  get: Pe,
13855
13980
  getJson: Fe,
@@ -13857,7 +13982,7 @@ var zl = {
13857
13982
  clear: Le,
13858
13983
  stats: Re
13859
13984
  };
13860
- function Bl() {
13985
+ function Xl() {
13861
13986
  let e = [
13862
13987
  [`Calls SDK ${N.sdkVersion}`, N.toJSON()],
13863
13988
  ["UserAgent:", navigator.userAgent],
@@ -13874,139 +13999,139 @@ function Bl() {
13874
13999
  d: e
13875
14000
  }));
13876
14001
  }
13877
- async function Vl() {
14002
+ async function Zl() {
13878
14003
  let e = $.id(), t = $.debugSessionId();
13879
14004
  if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
13880
14005
  let n = await Pe({ sessionId: t });
13881
14006
  if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
13882
14007
  let r = n[0].t, i = n[n.length - 1].t;
13883
14008
  try {
13884
- return hc?.uploadDebugLogs(e, r, i, JSON.stringify([...Bl(), ...n]));
14009
+ return Tc?.uploadDebugLogs(e, r, i, JSON.stringify([...Xl(), ...n]));
13885
14010
  } catch (e) {
13886
14011
  throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
13887
14012
  }
13888
14013
  }
13889
- async function Hl(e) {
14014
+ async function Ql(e) {
13890
14015
  let t = $.current();
13891
14016
  if (t) return t.videoEffect(e);
13892
14017
  }
13893
- async function Ul(e, t) {
14018
+ async function $l(e, t) {
13894
14019
  let n = $.current();
13895
14020
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
13896
14021
  }
13897
- async function Wl(e) {
14022
+ async function eu(e) {
13898
14023
  let t = $.current();
13899
14024
  t && await t.setAudioStream(e);
13900
14025
  }
13901
- async function Gl(e, t = null, n = null) {
14026
+ async function tu(e, t = null, n = null) {
13902
14027
  let r = $.current();
13903
14028
  if (!r) return;
13904
14029
  let i = n ?? t?.id, a = null;
13905
14030
  if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
13906
- ru(t, "setVmojiSvg", r);
14031
+ pu(t, "setVmojiSvg", r);
13907
14032
  return;
13908
14033
  }
13909
14034
  r.setAnimojiSvg(e, a, i);
13910
14035
  }
13911
- function Kl(e) {
14036
+ function nu(e) {
13912
14037
  let t = $.current();
13913
14038
  t && t.setAnimojiFill(e);
13914
14039
  }
13915
- async function ql(e = null, t, n = !1) {
13916
- return au().getWaitingHall(e, t, n);
14040
+ async function ru(e = null, t, n = !1) {
14041
+ return hu().getWaitingHall(e, t, n);
13917
14042
  }
13918
- async function Jl() {
13919
- return au().getAudienceModeHands();
14043
+ async function iu() {
14044
+ return hu().getAudienceModeHands();
13920
14045
  }
13921
- async function Yl(e, t = !1) {
13922
- let n = au(), r;
14046
+ async function au(e, t = !1) {
14047
+ let n = hu(), r;
13923
14048
  if (e) {
13924
14049
  let t = n.getCachedParticipantIdByExternalId(e);
13925
14050
  if (!t) {
13926
- ru(e, "promoteParticipant", n);
14051
+ pu(e, "promoteParticipant", n);
13927
14052
  return;
13928
14053
  }
13929
14054
  r = M.decomposeParticipantId(t).compositeUserId;
13930
14055
  }
13931
14056
  return n.promoteParticipant(r, t);
13932
14057
  }
13933
- async function Xl(e = !1) {
13934
- return au().requestPromotion(e);
14058
+ async function ou(e = !1) {
14059
+ return hu().requestPromotion(e);
13935
14060
  }
13936
- async function Zl(e = !1) {
13937
- return au().acceptPromotion(e);
14061
+ async function su(e = !1) {
14062
+ return hu().acceptPromotion(e);
13938
14063
  }
13939
- async function Ql(e) {
13940
- return au().getParticipantListChunk(e);
14064
+ async function cu(e) {
14065
+ return hu().getParticipantListChunk(e);
13941
14066
  }
13942
- async function $l(e) {
13943
- return au().getParticipants(e);
14067
+ async function lu(e) {
14068
+ return hu().getParticipants(e);
13944
14069
  }
13945
- async function eu(e) {
13946
- return au().feedback(e);
14070
+ async function uu(e) {
14071
+ return hu().feedback(e);
13947
14072
  }
13948
- async function tu(e, t, n) {
13949
- return au(n).enableFeatureForRoles(e, t);
14073
+ async function du(e, t, n) {
14074
+ return hu(n).enableFeatureForRoles(e, t);
13950
14075
  }
13951
- function nu(e) {
14076
+ function fu(e) {
13952
14077
  return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
13953
14078
  }
13954
- function ru(e, t, n) {
14079
+ function pu(e, t, n) {
13955
14080
  R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
13956
14081
  }
13957
- function iu(e, t, n) {
14082
+ function mu(e, t, n) {
13958
14083
  let r = Array.from(new Set(e));
13959
14084
  R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
13960
14085
  }
13961
- function au(e) {
13962
- let t = nu(e);
14086
+ function hu(e) {
14087
+ let t = fu(e);
13963
14088
  if (!t) throw Error("Conversation not found");
13964
14089
  return t;
13965
14090
  }
13966
- function ou(e, t) {
14091
+ function gu(e, t) {
13967
14092
  let n = $.current();
13968
14093
  if (!n) return null;
13969
14094
  let r = n.getCachedParticipantIdByExternalId(e);
13970
14095
  return r ? {
13971
14096
  conversation: n,
13972
14097
  participantId: r
13973
- } : (ru(e, t, n), null);
14098
+ } : (pu(e, t, n), null);
13974
14099
  }
13975
- async function su(e) {
13976
- await hc.removeHistoryRecords(e);
14100
+ async function _u(e) {
14101
+ await Tc.removeHistoryRecords(e);
13977
14102
  }
13978
- async function cu(e) {
14103
+ async function vu(e) {
13979
14104
  let t = $.current() ?? B.getFirst();
13980
14105
  t && await t.startAsr(e);
13981
14106
  }
13982
- async function lu(e) {
14107
+ async function yu(e) {
13983
14108
  let t = $.current() ?? B.getFirst();
13984
14109
  t && await t.stopAsr(e);
13985
14110
  }
13986
- async function uu(e) {
14111
+ async function bu(e) {
13987
14112
  let t = $.current() ?? B.getFirst();
13988
14113
  t && await t.requestAsr(e);
13989
14114
  }
13990
- async function du(e) {
14115
+ async function xu(e) {
13991
14116
  let t = $.current();
13992
14117
  return t ? t.startUrlSharing(e) : Promise.reject();
13993
14118
  }
13994
- async function fu() {
14119
+ async function Su() {
13995
14120
  let e = $.current();
13996
14121
  return e ? e.stopUrlSharing() : Promise.reject();
13997
14122
  }
13998
- async function pu(e) {
14123
+ async function Cu(e) {
13999
14124
  await B.switchCall(e);
14000
14125
  }
14001
- function mu() {
14126
+ function wu() {
14002
14127
  return B.getActiveId();
14003
14128
  }
14004
- function hu() {
14129
+ function Tu() {
14005
14130
  return $.getSyncedTime();
14006
14131
  }
14007
- function gu() {
14132
+ function Eu() {
14008
14133
  return N.sdkVersion;
14009
14134
  }
14010
14135
  typeof window < "u" && (window.__CALLS_SDK = vn);
14011
14136
  //#endregion
14012
- export { cc as Api, mc as ApiExternal, pc as ArrayDequeue, y as AuthData, f as BaseLogger, Va as CallDirection, Ha as CallType, Ua as ChatRoomEventType, Wa as ConversationFeature, Ga as ConversationOption, xn as DebugMessageType, no as ExternalIdType, At as FacingMode, x as FatalError, k as HangupReason, O as HangupType, S as MediaOption, A as MediaTrackKind, H as MediaType, Ja as MuteState, X as ParticipantState, fc as ParticipantStateDataValue, P as ParticipantStatus, dc as RecordRole, Ya as RoomsEventType, Ba as Signaling, V as SignalingCommandType, _r as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, Qa as UserRole, j as UserType, Eo as VolumeDetector, Pc as acceptCall, Zl as acceptPromotion, Ml as activateRooms, Ol as addMovie, Bc as addParticipant, Vc as addParticipantInternal, Nc as authorize, vc as browser, Oc as callInternal, Ec as callTo, Gc as captureScreen, Kc as captureVmoji, Ul as changeAudioEffect, dl as changeConversationOptions, Wc as changeDevice, Qc as changeParticipantState, Zc as changePriorities, Hl as changeVideoEffect, ml as chatHistory, fl as chatMessage, pl as chatMessageInternal, yl as createJoinLink, hl as customData, gl as customDataInternal, Il as debug, zl as debugLogs, Ll as debugMessage, Rl as debugMessageWithContext, Fc as declineCall, tu as enableFeatureForRoles, ll as enableVideoSuspend, ul as enableVideoSuspendSuggest, eu as feedback, Cl as forceRelayPolicy, mu as getActiveCallId, xl as getAnonymTokenByLink, Jl as getAudienceModeHands, jc as getInbounds, Ql as getParticipantListChunk, $l as getParticipants, Dl as getStreamInfo, hu as getSyncedTime, ql as getWaitingHall, nl as grantRoles, rl as grantRolesInternal, zc as hangup, Tc as init, Ic as joinCall, Rc as joinCallByLink, Lc as joinCallInternal, il as muteParticipant, al as muteParticipantInternal, ol as pinParticipant, sl as pinParticipantInternal, kc as processPush, Ac as processPushInternal, Yl as promoteParticipant, El as publishStream, $c as putHandsDown, su as removeHistoryRecords, bl as removeJoinLink, Al as removeMovie, Hc as removeParticipant, Uc as removeParticipantInternal, Pl as removeRooms, uu as requestAsr, tl as requestDisplayLayout, Xl as requestPromotion, Sc as setAudioEffects, Wl as setAudioStream, Xc as setLocalResolution, bc as setLogger, cl as setMediaModifiers, Fl as setStatisticsInterval, Cc as setVad, xc as setVideoEffects, qc as setVideoStream, wc as setVmoji, Kl as setVmojiFill, Gl as setVmojiSvg, Sl as setVolume, cu as startAsr, vl as startAudienceConversation, _l as startConversation, Mc as startStats, wl as startStream, du as startUrlSharing, lu as stopAsr, Tl as stopStream, fu as stopUrlSharing, pu as switchCall, Nl as switchRoom, Yc as toggleLocalAudio, Jc as toggleLocalVideo, el as updateDisplayLayout, kl as updateMovie, jl as updateRooms, Vl as uploadDebugLogs, yc as utils, gu as version };
14137
+ export { vc as Api, wc as ApiExternal, Cc as ArrayDequeue, y as AuthData, f as BaseLogger, Za as CallDirection, Qa as CallType, $a as ChatRoomEventType, eo as ConversationFeature, to as ConversationOption, xn as DebugMessageType, po as ExternalIdType, At as FacingMode, x as FatalError, k as HangupReason, O as HangupType, S as MediaOption, A as MediaTrackKind, H as MediaType, io as MuteState, X as ParticipantState, Sc as ParticipantStateDataValue, P as ParticipantStatus, xc as RecordRole, ao as RoomsEventType, Xa as Signaling, V as SignalingCommandType, _r as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, co as UserRole, j as UserType, Io as VolumeDetector, Wc as acceptCall, su as acceptPromotion, Hl as activateRooms, Rl as addMovie, Xc as addParticipant, Zc as addParticipantInternal, Uc as authorize, Oc as browser, Rc as callInternal, Ic as callTo, tl as captureScreen, nl as captureVmoji, $l as changeAudioEffect, xl as changeConversationOptions, el as changeDevice, cl as changeParticipantState, sl as changePriorities, Ql as changeVideoEffect, wl as chatHistory, Sl as chatMessage, Cl as chatMessageInternal, kl as createJoinLink, Tl as customData, El as customDataInternal, Kl as debug, Yl as debugLogs, ql as debugMessage, Jl as debugMessageWithContext, Gc as declineCall, du as enableFeatureForRoles, yl as enableVideoSuspend, bl as enableVideoSuspendSuggest, uu as feedback, Nl as forceRelayPolicy, wu as getActiveCallId, jl as getAnonymTokenByLink, iu as getAudienceModeHands, Vc as getInbounds, cu as getParticipantListChunk, lu as getParticipants, Ll as getStreamInfo, Tu as getSyncedTime, ru as getWaitingHall, fl as grantRoles, pl as grantRolesInternal, Yc as hangup, Fc as init, Kc as joinCall, Jc as joinCallByLink, qc as joinCallInternal, ml as muteParticipant, hl as muteParticipantInternal, gl as pinParticipant, _l as pinParticipantInternal, zc as processPush, Bc as processPushInternal, au as promoteParticipant, Il as publishStream, ll as putHandsDown, _u as removeHistoryRecords, Al as removeJoinLink, Bl as removeMovie, Qc as removeParticipant, $c as removeParticipantInternal, Wl as removeRooms, bu as requestAsr, dl as requestDisplayLayout, ou as requestPromotion, Mc as setAudioEffects, eu as setAudioStream, ol as setLocalResolution, Ac as setLogger, vl as setMediaModifiers, Gl as setStatisticsInterval, Nc as setVad, jc as setVideoEffects, rl as setVideoStream, Pc as setVmoji, nu as setVmojiFill, tu as setVmojiSvg, Ml as setVolume, vu as startAsr, Ol as startAudienceConversation, Dl as startConversation, Hc as startStats, Pl as startStream, xu as startUrlSharing, yu as stopAsr, Fl as stopStream, Su as stopUrlSharing, Cu as switchCall, Ul as switchRoom, al as toggleLocalAudio, il as toggleLocalVideo, ul as updateDisplayLayout, zl as updateMovie, Vl as updateRooms, Zl as uploadDebugLogs, kc as utils, Eu as version };