@vkontakte/calls-sdk 2.8.13-dev.b18b02e0.0 → 2.8.13-dev.b9b0c10d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/calls-sdk.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @vkontakte/calls-sdk v2.8.13-dev.b18b02e0.0
3
- * Tue, 27 Oct 2026 11:59:33 GMT
2
+ * @vkontakte/calls-sdk v2.8.13-dev.b9b0c10d.0
3
+ * Tue, 27 Oct 2026 16:14:44 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -828,10 +828,18 @@ var mt;
828
828
  }
829
829
  e.remove = r;
830
830
  })(mt || (mt = {}));
831
- var ht = mt, gt = null, _t = null, vt = null, yt = [], bt = [], xt = [], St = [], Ct = null, wt = null, Tt = null, Et = !1, Dt = !1, Ot, kt, At, jt = null, Mt = null, Nt = {}, Pt = /* @__PURE__ */ new Set();
832
- function Ft(e, t) {
831
+ var T = mt, ht = null, gt = null, _t = null, vt = [], yt = [], bt = [], xt = [], St = null, Ct = null, wt = null, Tt = !1, Et = !1, Dt, Ot, kt, At = null, jt = null, Mt = {}, Nt = /* @__PURE__ */ new Set();
832
+ function Pt(e, t) {
833
833
  return Number(t.deviceId === "default") - Number(e.deviceId === "default");
834
834
  }
835
+ function Ft(e, t) {
836
+ let n = T.get(e), r = typeof n == "string" && n.length > 0 ? "explicit" : "default";
837
+ return {
838
+ mode: r,
839
+ device: t,
840
+ deviceId: r === "explicit" ? n : t?.deviceId ?? null
841
+ };
842
+ }
835
843
  var It = /* @__PURE__ */ function(e) {
836
844
  return e.USER = "user", e.ENVIRONMENT = "environment", e;
837
845
  }({});
@@ -851,9 +859,9 @@ var Lt = class {
851
859
  echoCancellation: !0,
852
860
  autoGainControl: !0
853
861
  };
854
- let t = T.getMicrophones(), n, r;
855
- if (wt && (r = wt.groupId, n = wt.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
856
- else if (!wt && C.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
862
+ let t = E.getMicrophones(), n, r;
863
+ if (Ct && (r = Ct.groupId, n = Ct.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
864
+ else if (!Ct && C.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
857
865
  let e = t.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
858
866
  e && (r = e.groupId, n = e.deviceId);
859
867
  }
@@ -875,9 +883,9 @@ var Lt = class {
875
883
  aspectRatio: { ideal: N.videoAspectRatio },
876
884
  frameRate: { ideal: i }
877
885
  };
878
- let e = T.getCameras(), a, s;
879
- if (Ct && (s = Ct.groupId, a = Ct.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
880
- else if (!Ct && C.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
886
+ let e = E.getCameras(), a, s;
887
+ if (St && (s = St.groupId, a = St.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
888
+ else if (!St && C.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
881
889
  let t = e.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
882
890
  t && (s = t.groupId, a = t.deviceId);
883
891
  }
@@ -937,50 +945,49 @@ var Lt = class {
937
945
  };
938
946
  h(zt, "_lockId", 0);
939
947
  async function Bt() {
940
- Dt = !1, Et = !1, gt = null;
948
+ Et = !1, Tt = !1, ht = null;
941
949
  let e = {
942
- camera: T.getSavedCamera(),
943
- microphone: T.getSavedMicrophone(),
944
- output: T.getSavedOutput()
950
+ camera: E.getSavedCamera(),
951
+ microphone: E.getSavedMicrophone(),
952
+ output: E.getSavedOutput()
945
953
  };
946
954
  await Ht(), Vt("devicechange", e), R.onDeviceChange();
947
955
  }
948
956
  function Vt(e, ...t) {
949
- if (Nt[e]) for (let n of Nt[e]) n(...t);
957
+ if (Mt[e]) for (let n of Mt[e]) n(...t);
950
958
  }
951
959
  async function Ht() {
952
- return gt || (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? [] : (!_t && navigator.mediaDevices.addEventListener && (_t = M.debounce(Bt, N.enumerateDevicesDelay), navigator.mediaDevices.addEventListener("devicechange", _t)), !vt && ct.isSupported() && (vt = new ct(), await vt.init((e, t) => {
960
+ return ht || (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? [] : (!gt && navigator.mediaDevices.addEventListener && (gt = M.debounce(Bt, N.enumerateDevicesDelay), navigator.mediaDevices.addEventListener("devicechange", gt)), !_t && ct.isSupported() && (_t = new ct(), await _t.init((e, t) => {
953
961
  switch (t) {
954
962
  case "denied":
955
963
  case "prompt":
956
- _t?.();
964
+ gt?.();
957
965
  break;
958
966
  }
959
- })), gt = navigator.mediaDevices.enumerateDevices().then((e) => {
960
- yt = e, z.debug("Devices", e), bt = e.filter((e) => e.kind === "videoinput" ? ((e.label || vt?.getPermissionState("camera") === "granted") && (Et = !0), !0) : !1), bt.sort(Ft), xt = e.filter((e) => e.kind === "audioinput" ? ((e.label || vt?.getPermissionState("microphone") === "granted") && (Dt = !0), !0) : !1), xt.sort(Ft), St = e.filter((e) => e.kind === "audiooutput"), St.sort(Ft);
961
- let t = Ct?.deviceId ?? ht.get("videoinput"), n = wt?.deviceId ?? ht.get("audioinput"), r = Tt?.deviceId ?? ht.get("audiooutput");
962
- return Ct = bt.find((e) => e.deviceId === t) || null, wt = xt.find((e) => e.deviceId === n) || null, Tt = St.find((e) => e.deviceId === r) || St[0] || null, gt = Promise.resolve(e), e;
963
- }).catch(() => (gt = null, []))));
967
+ })), ht = navigator.mediaDevices.enumerateDevices().then((e) => {
968
+ vt = e, z.debug("Devices", e), yt = e.filter((e) => e.kind === "videoinput" ? ((e.label || _t?.getPermissionState("camera") === "granted") && (Tt = !0), !0) : !1), yt.sort(Pt), bt = e.filter((e) => e.kind === "audioinput" ? ((e.label || _t?.getPermissionState("microphone") === "granted") && (Et = !0), !0) : !1), bt.sort(Pt), xt = e.filter((e) => e.kind === "audiooutput"), xt.sort(Pt);
969
+ let t = St?.deviceId ?? T.get("videoinput"), n = Ct?.deviceId ?? T.get("audioinput"), r = wt?.deviceId ?? T.get("audiooutput");
970
+ return St = yt.find((e) => e.deviceId === t) || null, Ct = bt.find((e) => e.deviceId === n) || null, wt = xt.find((e) => e.deviceId === r) || xt[0] || null, ht = Promise.resolve(e), e;
971
+ }).catch(() => (ht = null, []))));
964
972
  }
965
973
  function Ut(e) {
966
- if (Ct && wt) return;
967
- let t = (e, t) => {
974
+ let t = T.get("videoinput") !== null, n = T.get("audioinput") !== null, r = (e, t) => {
968
975
  let n = t.getSettings()?.deviceId;
969
976
  return e.find((e) => e.deviceId === n || e.label === t.label) || null;
970
977
  };
971
978
  e?.getTracks().forEach((e) => {
972
- !wt && e.kind === A.audio ? wt = t(T.getMicrophones(), e) : !Ct && e.kind === A.video && (Ct = t(T.getCameras(), e));
979
+ !n && e.kind === A.audio ? Ct = r(E.getMicrophones(), e) : !t && e.kind === A.video && (St = r(E.getCameras(), e));
973
980
  });
974
981
  }
975
982
  async function Wt(e, t, n = z, r = null) {
976
983
  n.debug("Try to get media", JSON.parse(JSON.stringify(e.getNative())));
977
- let i = (!e.isVideo() || T.hasCameraPermission()) && (!e.isAudio() || T.hasMicrophonePermission());
984
+ let i = (!e.isVideo() || E.hasCameraPermission()) && (!e.isAudio() || E.hasMicrophonePermission());
978
985
  !i && !t && R.onPermissionsRequested();
979
986
  let a = new zt();
980
987
  try {
981
988
  a.busy(r);
982
989
  let t = await navigator.mediaDevices.getUserMedia(e.getNative());
983
- return T.releaseFirefoxMicrophonePermissionWarmup(), a.free(), n.debug("Got media", t.getTracks().map((e) => `${e.kind}: ${e.label}`)), i || await Bt(), Ut(t), t;
990
+ return E.releaseFirefoxMicrophonePermissionWarmup(), a.free(), n.debug("Got media", t.getTracks().map((e) => `${e.kind}: ${e.label}`)), i || await Bt(), Ut(t), t;
984
991
  } catch (i) {
985
992
  switch (a.free(), n.error("getUserMedia error", i), i.name) {
986
993
  case "PermissionDeniedError":
@@ -1012,8 +1019,8 @@ async function Wt(e, t, n = z, r = null) {
1012
1019
  }
1013
1020
  }
1014
1021
  async function Gt(e = z) {
1015
- if (!(jt || C.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
1016
- T.hasMicrophonePermission() || R.onPermissionsRequested(), jt = await navigator.mediaDevices.getUserMedia({
1022
+ if (!(At || C.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
1023
+ E.hasMicrophonePermission() || R.onPermissionsRequested(), At = await navigator.mediaDevices.getUserMedia({
1017
1024
  audio: !0,
1018
1025
  video: !1
1019
1026
  });
@@ -1049,78 +1056,90 @@ async function Kt(e, t = z, n = null) {
1049
1056
  r.free();
1050
1057
  }
1051
1058
  }
1052
- var T;
1059
+ var E;
1053
1060
  (function(e) {
1054
1061
  async function t() {
1055
1062
  await Ht(), await C.initOsVersion(z.warn);
1056
1063
  }
1057
1064
  e.init = t;
1058
1065
  function n() {
1059
- return bt;
1066
+ return yt;
1060
1067
  }
1061
1068
  e.getCameras = n;
1062
1069
  function r() {
1063
- return xt;
1070
+ return bt;
1064
1071
  }
1065
1072
  e.getMicrophones = r;
1066
1073
  function i() {
1067
- return St;
1074
+ return xt;
1068
1075
  }
1069
1076
  e.getOutput = i;
1070
1077
  function a() {
1071
- return bt.length > 0;
1078
+ return yt.length > 0;
1072
1079
  }
1073
1080
  e.hasCamera = a;
1074
1081
  function o() {
1075
- return xt.length > 0;
1082
+ return bt.length > 0;
1076
1083
  }
1077
1084
  e.hasMicrophone = o;
1078
1085
  function s() {
1079
- return Ct;
1086
+ return St;
1080
1087
  }
1081
1088
  e.getSavedCamera = s;
1082
1089
  function c() {
1083
- return wt;
1090
+ return Ct;
1084
1091
  }
1085
1092
  e.getSavedMicrophone = c;
1086
1093
  function l() {
1087
- return Tt;
1094
+ return wt;
1088
1095
  }
1089
1096
  e.getSavedOutput = l;
1090
1097
  function u() {
1091
- let e = T.getSavedOutput();
1092
- return e && e.deviceId === ht.get("audiooutput") ? e : null;
1098
+ return Ft("videoinput", St);
1093
1099
  }
1094
- e.getChosenOutput = u;
1100
+ e.getCameraSelection = u;
1095
1101
  function d() {
1096
- return yt;
1102
+ return Ft("audioinput", Ct);
1097
1103
  }
1098
- e.getDevices = d;
1104
+ e.getMicrophoneSelection = d;
1099
1105
  function f() {
1100
- return N.videoFacingMode;
1106
+ return Ft("audiooutput", wt);
1101
1107
  }
1102
- e.getVideoFacingMode = f;
1108
+ e.getOutputSelection = f;
1103
1109
  function p() {
1104
- return Et;
1110
+ let e = E.getSavedOutput();
1111
+ return e && e.deviceId === T.get("audiooutput") ? e : null;
1105
1112
  }
1106
- e.hasCameraPermission = p;
1113
+ e.getChosenOutput = p;
1107
1114
  function m() {
1108
- return Dt;
1115
+ return vt;
1109
1116
  }
1110
- e.hasMicrophonePermission = m;
1117
+ e.getDevices = m;
1111
1118
  function ee() {
1112
- return vt?.getPermissionState("microphone") ?? null;
1119
+ return N.videoFacingMode;
1113
1120
  }
1114
- e.getMicrophonePermissionState = ee;
1115
- function h(e = !1) {
1116
- return m() ? a() && e ? p() : !0 : !1;
1121
+ e.getVideoFacingMode = ee;
1122
+ function h() {
1123
+ return Tt;
1117
1124
  }
1118
- e.hasPermissions = h;
1125
+ e.hasCameraPermission = h;
1119
1126
  function te() {
1120
- jt && (w(jt), jt = null);
1127
+ return Et;
1121
1128
  }
1122
- e.releaseFirefoxMicrophonePermissionWarmup = te;
1123
- async function ne(e = !1, t = !0, n = !0, r = z, i = null) {
1129
+ e.hasMicrophonePermission = te;
1130
+ function ne() {
1131
+ return _t?.getPermissionState("microphone") ?? null;
1132
+ }
1133
+ e.getMicrophonePermissionState = ne;
1134
+ function re(e = !1) {
1135
+ return te() ? a() && e ? h() : !0 : !1;
1136
+ }
1137
+ e.hasPermissions = re;
1138
+ function ie() {
1139
+ At && (w(At), At = null);
1140
+ }
1141
+ e.releaseFirefoxMicrophonePermissionWarmup = ie;
1142
+ async function ae(e = !1, t = !0, n = !0, r = z, i = null) {
1124
1143
  !e && !t && await Gt(r);
1125
1144
  let s = o() && t, c = a() && e, l;
1126
1145
  if (!s && !c) l = new MediaStream();
@@ -1129,87 +1148,89 @@ var T;
1129
1148
  } catch {
1130
1149
  l = new MediaStream();
1131
1150
  }
1132
- return !l.getVideoTracks().length && n && l.addTrack(T.getBlackMediaTrack()), !l.getAudioTracks().length && n && l.addTrack(T.getSilentMediaTrack()), l;
1151
+ return !l.getVideoTracks().length && n && l.addTrack(E.getBlackMediaTrack()), !l.getAudioTracks().length && n && l.addTrack(E.getSilentMediaTrack()), l;
1133
1152
  }
1134
- e.getUserMedia = ne;
1135
- async function re(e, t, n = z, r = null) {
1153
+ e.getUserMedia = ae;
1154
+ async function oe(e, t, n = z, r = null) {
1136
1155
  return Kt(new Rt(e && !N.consumerFastScreenShare ? N.fastScreenShareWidth : 0, e && !N.consumerFastScreenShare ? N.fastScreenShareHeight : 0, N.getScreenFrameRate(e), t), n, r);
1137
1156
  }
1138
- e.getScreenMedia = re;
1139
- async function ie(e = !1, t, n = z, r = null) {
1157
+ e.getScreenMedia = oe;
1158
+ async function g(e = !1, t, n = z, r = null) {
1140
1159
  return Wt(new Lt(!1, !0, e ? N.videoEffectMaxWidth : N.videoMaxWidth, e ? N.videoEffectMaxHeight : N.videoMaxHeight, t), void 0, n, r);
1141
1160
  }
1142
- e._getUserVideo = ie;
1143
- async function ae(e, t, n = z, r = null) {
1161
+ e._getUserVideo = g;
1162
+ async function se(e, t, n = z, r = null) {
1144
1163
  let i = t?.width || N.videoMaxWidth, a = t?.height || N.videoMaxHeight;
1145
1164
  return Wt(new Lt(!1, e || !0, i, a), void 0, n, r);
1146
1165
  }
1147
- e.getUserVideo = ae;
1148
- async function oe(e, t = z, n = null) {
1166
+ e.getUserVideo = se;
1167
+ async function ce(e, t = z, n = null) {
1149
1168
  return Wt(new Lt(e || !0, !1), void 0, t, n);
1150
1169
  }
1151
- e.getUserAudio = oe;
1152
- async function g(e, t) {
1170
+ e.getUserAudio = ce;
1171
+ async function le(e, t) {
1153
1172
  let [n] = e.getVideoTracks();
1154
1173
  if (!n) throw Error("Video track not found in stream");
1155
1174
  return st(n, t);
1156
1175
  }
1157
- e.setResolution = g;
1158
- async function se(e, t) {
1159
- let n = (await Ht()).find((n) => n.kind === e && n.deviceId === t);
1160
- return n ? (e === "videoinput" ? Ct = n : e === "audioinput" ? wt = n : e === "audiooutput" && (Tt = n), ht.set(e, t), n) : null;
1176
+ e.setResolution = le;
1177
+ async function ue(e, t) {
1178
+ let n = await Ht();
1179
+ if (t === "default" && (e === "videoinput" || e === "audioinput" || e === "audiooutput")) return e === "videoinput" ? St = null : e === "audioinput" ? Ct = null : wt = xt[0] || null, T.remove(e), n.find((t) => t.kind === e && t.deviceId === "default") || n.find((t) => t.kind === e) || null;
1180
+ let r = n.find((n) => n.kind === e && n.deviceId === t);
1181
+ return r ? (e === "videoinput" ? St = r : e === "audioinput" ? Ct = r : e === "audiooutput" && (wt = r), T.set(e, t), r) : null;
1161
1182
  }
1162
- e._saveDeviceId = se;
1163
- function ce() {
1164
- if (!At || At.readyState === "ended") {
1165
- let e = T.getAudioContext(), t = e.createMediaStreamDestination(), n = e.createGain();
1183
+ e._saveDeviceId = ue;
1184
+ function de() {
1185
+ if (!kt || kt.readyState === "ended") {
1186
+ let e = E.getAudioContext(), t = e.createMediaStreamDestination(), n = e.createGain();
1166
1187
  n.gain.value = 1e-5, n.connect(t), C.browserName() === "Safari" && n.connect(e.destination);
1167
1188
  let r = e.createOscillator();
1168
- r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), At = t.stream.getAudioTracks()[0];
1189
+ r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), kt = t.stream.getAudioTracks()[0];
1169
1190
  }
1170
- return Object.assign(At.clone(), { enabled: !1 });
1191
+ return Object.assign(kt.clone(), { enabled: !1 });
1171
1192
  }
1172
- e.getSilentMediaTrack = ce;
1173
- function le(e = N.videoMinWidth, t = N.videoMinHeight) {
1174
- kt || (kt = document.createElement("canvas")), kt.width = e, kt.height = t;
1175
- let n = kt.getContext("2d");
1176
- return n.rect(0, 0, e, t), n.fillStyle = "black", n.fill(), (!Ot || Ot.readyState === "ended") && (Ot = kt.captureStream(N.videoFrameRate).getVideoTracks()[0]), Object.assign(Ot.clone(), { enabled: !1 });
1193
+ e.getSilentMediaTrack = de;
1194
+ function fe(e = N.videoMinWidth, t = N.videoMinHeight) {
1195
+ Ot || (Ot = document.createElement("canvas")), Ot.width = e, Ot.height = t;
1196
+ let n = Ot.getContext("2d");
1197
+ return n.rect(0, 0, e, t), n.fillStyle = "black", n.fill(), (!Dt || Dt.readyState === "ended") && (Dt = Ot.captureStream(N.videoFrameRate).getVideoTracks()[0]), Object.assign(Dt.clone(), { enabled: !1 });
1177
1198
  }
1178
- e.getBlackMediaTrack = le;
1179
- function ue(e) {
1180
- Pt.add(e), Mt && T.getAudioContext();
1199
+ e.getBlackMediaTrack = fe;
1200
+ function pe(e) {
1201
+ Nt.add(e), jt && E.getAudioContext();
1181
1202
  }
1182
- e.retainAudioContext = ue;
1183
- function de(e) {
1184
- Pt.delete(e) && Pt.size === 0 && Mt?.suspend().catch((e) => z.warn("Failed to suspend AudioContext", e));
1203
+ e.retainAudioContext = pe;
1204
+ function me(e) {
1205
+ Nt.delete(e) && Nt.size === 0 && jt?.suspend().catch((e) => z.warn("Failed to suspend AudioContext", e));
1185
1206
  }
1186
- e.releaseAudioContext = de;
1187
- function fe() {
1188
- return Mt || (Mt = new (window.AudioContext || window.webkitAudioContext)()), Mt.resume().catch(() => {
1207
+ e.releaseAudioContext = me;
1208
+ function he() {
1209
+ return jt || (jt = new (window.AudioContext || window.webkitAudioContext)()), jt.resume().catch(() => {
1189
1210
  z.warn("Failed to resume AudioContext");
1190
- }), Mt;
1211
+ }), jt;
1191
1212
  }
1192
- e.getAudioContext = fe;
1193
- function pe(e, t) {
1194
- Nt[e] || (Nt[e] = []), Nt[e].push(t);
1213
+ e.getAudioContext = he;
1214
+ function ge(e, t) {
1215
+ Mt[e] || (Mt[e] = []), Mt[e].push(t);
1195
1216
  }
1196
- e.addEventListener = pe;
1197
- function me(e, t) {
1198
- if (Nt[e]) if (!t) delete Nt[e];
1217
+ e.addEventListener = ge;
1218
+ function _e(e, t) {
1219
+ if (Mt[e]) if (!t) delete Mt[e];
1199
1220
  else {
1200
- let n = Nt[e].indexOf(t);
1201
- n > -1 && Nt[e].splice(n, 1);
1221
+ let n = Mt[e].indexOf(t);
1222
+ n > -1 && Mt[e].splice(n, 1);
1202
1223
  }
1203
1224
  }
1204
- e.removeEventListener = me;
1205
- })(T || (T = {}));
1206
- var E = T;
1225
+ e.removeEventListener = _e;
1226
+ })(E || (E = {}));
1227
+ var D = E;
1207
1228
  //#endregion
1208
1229
  //#region src/types/MediaSettings.ts
1209
1230
  function qt(e, t) {
1210
1231
  return !(e.isAudioEnabled !== t.isAudioEnabled || e.isVideoEnabled !== t.isVideoEnabled || e.isScreenSharingEnabled !== t.isScreenSharingEnabled || e.isFastScreenSharingEnabled !== t.isFastScreenSharingEnabled || e.isAudioSharingEnabled !== t.isAudioSharingEnabled || e.isAnimojiEnabled !== t.isAnimojiEnabled);
1211
1232
  }
1212
- function D(e) {
1233
+ function Jt(e) {
1213
1234
  return Object.assign({
1214
1235
  isAudioEnabled: !1,
1215
1236
  isVideoEnabled: !1,
@@ -1229,9 +1250,9 @@ var O = /* @__PURE__ */ function(e) {
1229
1250
  let r = [];
1230
1251
  this.error && r.push("error"), this.remote && r.push("remote"), this.code && r.push(`code: ${this.code}`), n && n.message && r.push(`message: '${n.message}'`), this.message = t + (r.length ? ` (${r.join(", ")})` : ""), Error.captureStackTrace && Error.captureStackTrace(this, e);
1231
1252
  }
1232
- }, Jt = /* @__PURE__ */ function(e) {
1253
+ }, Yt = /* @__PURE__ */ function(e) {
1233
1254
  return e.FpsLimit = "fps-limit", e;
1234
- }({}), Yt = class extends Ye {
1255
+ }({}), Xt = class extends Ye {
1235
1256
  constructor(e = z) {
1236
1257
  super(), h(this, "FPS_LIMITS", [
1237
1258
  13,
@@ -1271,15 +1292,15 @@ var O = /* @__PURE__ */ function(e) {
1271
1292
  destroy() {
1272
1293
  this._cleanup(), super.unsubscribe();
1273
1294
  }
1274
- }, Xt = /* @__PURE__ */ function(e) {
1295
+ }, Zt = /* @__PURE__ */ function(e) {
1275
1296
  return e.SOURCE_CHANGED = "SOURCE_CHANGED", e.SOURCE_READY = "SOURCE_READY", e.TRACK_REPLACED = "TRACK_REPLACED", e.SCREEN_STATUS = "SCREEN_STATUS", e.ANIMOJI_STATUS = "ANIMOJI_STATUS", e;
1276
1297
  }({}), A = /* @__PURE__ */ function(e) {
1277
1298
  return e.audio = "audio", e.video = "video", e.screen = "screen", e.audioshare = "audioshare", e;
1278
- }({}), Zt = /* @__PURE__ */ function(e) {
1299
+ }({}), Qt = /* @__PURE__ */ function(e) {
1279
1300
  return e[e.CAMERA = 1] = "CAMERA", e[e.SCREEN = 2] = "SCREEN", e;
1280
- }({}), Qt = class extends Ye {
1301
+ }({}), $t = class extends Ye {
1281
1302
  constructor(e = z, t = null) {
1282
- super(), h(this, "_stream", null), h(this, "_screenTrack", null), h(this, "_audioShareTrack", null), h(this, "_screenShareTrack", null), h(this, "_screenCaptureRequest", 0), h(this, "_destroyed", !1), h(this, "_sendVideoTrack", null), h(this, "_cameraVideoTrack", null), h(this, "_micAudioTrack", null), h(this, "_audioEffectsTrack", null), h(this, "_mediaSettings", D()), h(this, "_lastMediaSettings", null), h(this, "_videoStatusOnScreenCapturingEnabled", !1), h(this, "_effect", null), h(this, "_audioEffectParams", null), h(this, "_onDeviceChange", void 0), h(this, "_animojiEnabled", !1), h(this, "_videoEffectsFpsLimiter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_cameraTrackSetAt", 0), h(this, "_cameraMuteRecoveredAt", 0), h(this, "_micTrackSetAt", 0), h(this, "_micMuteRecoveredAt", 0), h(this, "videoTrackMuteHandler", () => {
1303
+ super(), h(this, "_stream", null), h(this, "_screenTrack", null), h(this, "_audioShareTrack", null), h(this, "_screenShareTrack", null), h(this, "_screenCaptureRequest", 0), h(this, "_destroyed", !1), h(this, "_sendVideoTrack", null), h(this, "_cameraVideoTrack", null), h(this, "_micAudioTrack", null), h(this, "_audioEffectsTrack", null), h(this, "_mediaSettings", Jt()), h(this, "_lastMediaSettings", null), h(this, "_videoStatusOnScreenCapturingEnabled", !1), h(this, "_effect", null), h(this, "_audioEffectParams", null), h(this, "_onDeviceChange", void 0), h(this, "_animojiEnabled", !1), h(this, "_videoEffectsFpsLimiter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_cameraTrackSetAt", 0), h(this, "_cameraMuteRecoveredAt", 0), h(this, "_micTrackSetAt", 0), h(this, "_micMuteRecoveredAt", 0), h(this, "videoTrackMuteHandler", () => {
1283
1304
  !this._mediaSettings.isVideoEnabled || this._cameraMuteRecoveredAt >= this._cameraTrackSetAt || C.browserName() !== "Safari" || (this._cameraMuteRecoveredAt = Date.now(), this._logger?.log(x.ERROR, "camera_mute_recover"), this._debug.log("[MediaSource] Safari camera mute recovery"), this.toggleVideo(!0).then(() => this._logger?.log(x.ERROR, "camera_mute_recover_success")).catch((e) => {
1284
1305
  this._logger?.log(x.ERROR, "camera_mute_recover_fail"), this._debug.warn("[MediaSource] Camera mute recovery failed", e);
1285
1306
  }));
@@ -1287,7 +1308,7 @@ var O = /* @__PURE__ */ function(e) {
1287
1308
  !this._mediaSettings.isAudioEnabled || this._micMuteRecoveredAt >= this._micTrackSetAt || C.browserName() !== "Safari" || (this._micMuteRecoveredAt = Date.now(), this._logger?.log(x.ERROR, "mic_mute_recover"), this._debug.log("[MediaSource] Safari mic mute recovery"), this.toggleAudio(!0).then(() => this._logger?.log(x.ERROR, "mic_mute_recover_success")).catch((e) => {
1288
1309
  this._logger?.log(x.ERROR, "mic_mute_recover_fail"), this._debug.warn("[MediaSource] Mic mute recovery failed", e);
1289
1310
  }));
1290
- }), this._debug = e, this._logger = t, this._initDeviceChangeListener(), N.audioShare && (this._audioShareTrack = this.getSilentAudioShareTrack()), N.enableVideoEffectsFpsDegradation && (this._videoEffectsFpsLimiter = new Yt(this._debug), this._videoEffectsFpsLimiter.addEventListener(Jt.FpsLimit, this.handleVideoEffectsLowFps.bind(this))), E.retainAudioContext(this);
1311
+ }), this._debug = e, this._logger = t, this._initDeviceChangeListener(), N.audioShare && (this._audioShareTrack = this.getSilentAudioShareTrack()), N.enableVideoEffectsFpsDegradation && (this._videoEffectsFpsLimiter = new Xt(this._debug), this._videoEffectsFpsLimiter.addEventListener(Yt.FpsLimit, this.handleVideoEffectsLowFps.bind(this))), D.retainAudioContext(this);
1291
1312
  }
1292
1313
  get cameraVideoTrack() {
1293
1314
  return this._cameraVideoTrack;
@@ -1304,7 +1325,7 @@ var O = /* @__PURE__ */ function(e) {
1304
1325
  description: a
1305
1326
  } });
1306
1327
  try {
1307
- let e = await E.getUserMedia(n, r, t, this._debug, this._logger);
1328
+ let e = await D.getUserMedia(n, r, t, this._debug, this._logger);
1308
1329
  if (this._destroyed) {
1309
1330
  w(e);
1310
1331
  return;
@@ -1368,14 +1389,14 @@ var O = /* @__PURE__ */ function(e) {
1368
1389
  _initDeviceChangeListener() {
1369
1390
  !navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices || !navigator.mediaDevices.addEventListener || (this._onDeviceChange = async (e) => {
1370
1391
  if (!this._stream) return;
1371
- let t = E.getSavedMicrophone(), n = E.getSavedCamera(), r = this._mediaSettings.isAudioEnabled && t?.groupId !== e.microphone?.groupId, i = this._mediaSettings.isVideoEnabled && n?.groupId !== e.camera?.groupId;
1392
+ let t = D.getSavedMicrophone(), n = D.getSavedCamera(), r = this._mediaSettings.isAudioEnabled && t?.groupId !== e.microphone?.groupId, i = this._mediaSettings.isVideoEnabled && n?.groupId !== e.camera?.groupId;
1372
1393
  try {
1373
1394
  r && await this._changeAudioInput(), i && await this._changeVideoInput();
1374
1395
  } catch {}
1375
- }, E.addEventListener("devicechange", this._onDeviceChange));
1396
+ }, D.addEventListener("devicechange", this._onDeviceChange));
1376
1397
  }
1377
1398
  _destroyDeviceChangeListener() {
1378
- this._onDeviceChange && E.removeEventListener("devicechange", this._onDeviceChange);
1399
+ this._onDeviceChange && D.removeEventListener("devicechange", this._onDeviceChange);
1379
1400
  }
1380
1401
  async _changeVideoInput(e) {
1381
1402
  if (this._destroyed) {
@@ -1383,7 +1404,7 @@ var O = /* @__PURE__ */ function(e) {
1383
1404
  return;
1384
1405
  }
1385
1406
  try {
1386
- let t = e ? "stream" : "video", n = e || await E._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
1407
+ let t = e ? "stream" : "video", n = e || await D._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
1387
1408
  if (this._destroyed) {
1388
1409
  w(n);
1389
1410
  return;
@@ -1411,7 +1432,7 @@ var O = /* @__PURE__ */ function(e) {
1411
1432
  return;
1412
1433
  }
1413
1434
  try {
1414
- let t = e || await E.getUserAudio(void 0, this._debug, this._logger);
1435
+ let t = e || await D.getUserAudio(void 0, this._debug, this._logger);
1415
1436
  if (this._destroyed) {
1416
1437
  w(t);
1417
1438
  return;
@@ -1437,7 +1458,7 @@ var O = /* @__PURE__ */ function(e) {
1437
1458
  return;
1438
1459
  }
1439
1460
  try {
1440
- if (n = n || await E.getScreenMedia(e, t, this._debug, this._logger), r !== this._screenCaptureRequest || this._destroyed) {
1461
+ if (n = n || await D.getScreenMedia(e, t, this._debug, this._logger), r !== this._screenCaptureRequest || this._destroyed) {
1441
1462
  w(n);
1442
1463
  return;
1443
1464
  }
@@ -1482,11 +1503,11 @@ var O = /* @__PURE__ */ function(e) {
1482
1503
  return (!this._audioEffectsTrack || this._audioEffectsTrack.id !== e.id) && (this._audioEffectsTrack = e), this._audioEffectsTrack;
1483
1504
  }
1484
1505
  getSilentAudioShareTrack() {
1485
- let e = E.getSilentMediaTrack();
1506
+ let e = D.getSilentMediaTrack();
1486
1507
  return e.contentHint = "music", e.stop(), e;
1487
1508
  }
1488
1509
  getBlackScreenShareTrack() {
1489
- let e = E.getBlackMediaTrack();
1510
+ let e = D.getBlackMediaTrack();
1490
1511
  return e.contentHint = "motion", e.stop(), e;
1491
1512
  }
1492
1513
  async _replaceLocalTrack(e, t) {
@@ -1528,7 +1549,7 @@ var O = /* @__PURE__ */ function(e) {
1528
1549
  }
1529
1550
  }
1530
1551
  destroy() {
1531
- this._destroyed || (this._destroyed = !0, this._screenCaptureRequest++, this._destroyDeviceChangeListener(), E.releaseFirefoxMicrophonePermissionWarmup(), N.videoEffects && (this._effect = null, N.videoEffects.destroy()), N.audioEffects && N.audioEffects.destroy(), this._stream && (w(this._stream), this._stream = null), this.cameraVideoTrack?.stop(), this._micAudioTrack?.stop(), this._audioEffectsTrack?.stop(), this._disableScreenCapture(), E.releaseAudioContext(this), this._videoEffectsFpsLimiter?.destroy());
1552
+ this._destroyed || (this._destroyed = !0, this._screenCaptureRequest++, this._destroyDeviceChangeListener(), D.releaseFirefoxMicrophonePermissionWarmup(), N.videoEffects && (this._effect = null, N.videoEffects.destroy()), N.audioEffects && N.audioEffects.destroy(), this._stream && (w(this._stream), this._stream = null), this.cameraVideoTrack?.stop(), this._micAudioTrack?.stop(), this._audioEffectsTrack?.stop(), this._disableScreenCapture(), D.releaseAudioContext(this), this._videoEffectsFpsLimiter?.destroy());
1532
1553
  }
1533
1554
  async stopLocalMedia() {
1534
1555
  this._screenCaptureRequest++, (this._screenTrack || this._mediaSettings.isScreenSharingEnabled) && await this.disableScreenCapturing(), this._stream && (this._lastMediaSettings ?? (this._lastMediaSettings = { ...this._mediaSettings }), this._stream.getAudioTracks().length > 0 && await this.toggleAudio(!1), this._stream.getVideoTracks().length > 0 && await this.toggleVideo(!1), this.cameraVideoTrack = null, this._setMicAudioTrack(null));
@@ -1557,13 +1578,13 @@ var O = /* @__PURE__ */ function(e) {
1557
1578
  this.cameraVideoTrack?.stop();
1558
1579
  let t;
1559
1580
  if (e) {
1560
- let e = await E._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
1581
+ let e = await D._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
1561
1582
  if (this._destroyed) {
1562
1583
  w(e);
1563
1584
  return;
1564
1585
  }
1565
1586
  this.cameraVideoTrack = e.getVideoTracks()[0], t = await this._setEffect(this._effect, this.cameraVideoTrack);
1566
- } else t = E.getBlackMediaTrack(N.videoMinWidth, N.videoMinHeight), this._stopEffect();
1587
+ } else t = D.getBlackMediaTrack(N.videoMinWidth, N.videoMinHeight), this._stopEffect();
1567
1588
  if (this._destroyed) {
1568
1589
  t.stop();
1569
1590
  return;
@@ -1583,16 +1604,16 @@ var O = /* @__PURE__ */ function(e) {
1583
1604
  await this._replaceLocalTrack(e), !this._destroyed && (this._mediaSettings.isAudioEnabled = t, this._triggerEvent("SOURCE_CHANGED", { kind: "audio" }));
1584
1605
  };
1585
1606
  if (e) try {
1586
- let e = await E.getUserAudio(void 0, this._debug, this._logger);
1607
+ let e = await D.getUserAudio(void 0, this._debug, this._logger);
1587
1608
  if (this._destroyed) {
1588
1609
  w(e);
1589
1610
  return;
1590
1611
  }
1591
1612
  this._setMicAudioTrack(e.getAudioTracks()[0]), await t(await this._applyAudioEffect(), !0);
1592
1613
  } catch (e) {
1593
- throw this._destroyed ? e : (N.audioEffects?.pause(), await t(E.getSilentMediaTrack(), !1), typeof e == "string" ? Error(e) : e);
1614
+ throw this._destroyed ? e : (N.audioEffects?.pause(), await t(D.getSilentMediaTrack(), !1), typeof e == "string" ? Error(e) : e);
1594
1615
  }
1595
- else N.audioEffects?.pause(), await t(E.getSilentMediaTrack(), !1);
1616
+ else N.audioEffects?.pause(), await t(D.getSilentMediaTrack(), !1);
1596
1617
  }
1597
1618
  toggleAnimojiCapturing(e) {
1598
1619
  this._animojiEnabled = e, this._mediaSettings.isVideoEnabled || this._triggerEvent("ANIMOJI_STATUS", e);
@@ -1685,12 +1706,12 @@ var O = /* @__PURE__ */ function(e) {
1685
1706
  }
1686
1707
  }, j = /* @__PURE__ */ function(e) {
1687
1708
  return e.USER = "USER", e.GROUP = "GROUP", e;
1688
- }(j || {}), $t = {
1709
+ }(j || {}), en = {
1689
1710
  HEIGHT: 720,
1690
1711
  WIDTH: 1280,
1691
1712
  BITRATE: 1e6,
1692
1713
  FPS: 30
1693
- }, en = 60, tn = "L1T2", nn = 1.35, rn = [
1714
+ }, tn = 60, nn = "L1T2", rn = 1.35, an = [
1694
1715
  {
1695
1716
  dimension: 320,
1696
1717
  bitrate: 18e4
@@ -1724,27 +1745,27 @@ var O = /* @__PURE__ */ function(e) {
1724
1745
  bitrate: 5e6
1725
1746
  }
1726
1747
  ];
1727
- function an(e, t) {
1748
+ function on(e, t) {
1728
1749
  return !e || !t ? e === t : e.streams.length === t.streams.length ? e.streams.every((e, n) => {
1729
1750
  let r = t.streams[n];
1730
1751
  return e.rid === r.rid && e.width === r.width && e.height === r.height && e.fps === r.fps && e.bitrate === r.bitrate;
1731
1752
  }) : !1;
1732
1753
  }
1733
- function on(e, t) {
1754
+ function sn(e, t) {
1734
1755
  for (let n of t) if (e <= n.dimension) return n.bitrate;
1735
- return t.length > 0 ? t[t.length - 1].bitrate : rn[0].bitrate;
1756
+ return t.length > 0 ? t[t.length - 1].bitrate : an[0].bitrate;
1736
1757
  }
1737
- function sn(e) {
1738
- return !Number.isFinite(e) || e <= 0 ? $t.FPS : Math.min(Math.round(e), en);
1758
+ function cn(e) {
1759
+ return !Number.isFinite(e) || e <= 0 ? en.FPS : Math.min(Math.round(e), tn);
1739
1760
  }
1740
- function cn(e = $t.WIDTH, t = $t.HEIGHT, n = rn, r = $t.FPS) {
1741
- let i = Math.max(e, t), a = sn(r), o = 1;
1761
+ function ln(e = en.WIDTH, t = en.HEIGHT, n = an, r = en.FPS) {
1762
+ let i = Math.max(e, t), a = cn(r), o = 1;
1742
1763
  i >= 960 ? o = 3 : i >= 480 && (o = 2);
1743
1764
  let s = [
1744
1765
  "h",
1745
1766
  "m",
1746
1767
  "l"
1747
- ].slice(3 - o), c = [], l = on(i, n);
1768
+ ].slice(3 - o), c = [], l = sn(i, n);
1748
1769
  for (let r = 0; r < o; r++) {
1749
1770
  let i = s[r];
1750
1771
  c.push({
@@ -1753,19 +1774,19 @@ function cn(e = $t.WIDTH, t = $t.HEIGHT, n = rn, r = $t.FPS) {
1753
1774
  height: t,
1754
1775
  fps: a,
1755
1776
  bitrate: l
1756
- }), e = Math.round(e / 2), t = Math.round(t / 2), l = on(Math.max(e, t), n);
1777
+ }), e = Math.round(e / 2), t = Math.round(t / 2), l = sn(Math.max(e, t), n);
1757
1778
  }
1758
1779
  return { streams: c.reverse() };
1759
1780
  }
1760
- function ln(e, t) {
1781
+ function un(e, t) {
1761
1782
  let n = t.streams.findIndex((t) => t.rid === e);
1762
1783
  return n >= 0 ? 2 ** (t.streams.length - n - 1) : 1;
1763
1784
  }
1764
- function un(e, t, n, r) {
1765
- let i = n ? Math.round(n * nn) : Infinity;
1785
+ function dn(e, t, n, r) {
1786
+ let i = n ? Math.round(n * rn) : Infinity;
1766
1787
  if (e.forEach((e) => {
1767
1788
  let n = t.streams.find((t) => t.rid === e.rid);
1768
- e.scaleResolutionDownBy = ln(e.rid, t), e.scalabilityMode = tn, n ? (e.active = n.rid === "l" || Math.max(n.width, n.height) < i, e.maxBitrate = n.bitrate, e.maxFramerate = n.fps) : (e.active = !1, e.maxBitrate = 0, delete e.maxFramerate);
1789
+ e.scaleResolutionDownBy = un(e.rid, t), e.scalabilityMode = nn, n ? (e.active = n.rid === "l" || Math.max(n.width, n.height) < i, e.maxBitrate = n.bitrate, e.maxFramerate = n.fps) : (e.active = !1, e.maxBitrate = 0, delete e.maxFramerate);
1769
1790
  }), r) for (let n = t.streams.length - 1; n >= 0; n--) {
1770
1791
  let { rid: i } = t.streams[n], a = e.find((e) => e.rid === i);
1771
1792
  if (a?.active) {
@@ -1776,13 +1797,13 @@ function un(e, t, n, r) {
1776
1797
  }
1777
1798
  //#endregion
1778
1799
  //#region src/static/Polyfills.ts
1779
- var dn = typeof Object.fromEntries == "function" ? Object.fromEntries : function(e) {
1800
+ var fn = typeof Object.fromEntries == "function" ? Object.fromEntries : function(e) {
1780
1801
  if (!e || !e[Symbol.iterator]) throw Error("Object.fromEntries() requires a single iterable argument");
1781
1802
  let t = {};
1782
1803
  for (let [n, r] of e) t[n] = r;
1783
1804
  return t;
1784
1805
  };
1785
- async function fn(e) {
1806
+ async function pn(e) {
1786
1807
  return new Promise((t, n) => {
1787
1808
  let r = new FileReader();
1788
1809
  r.onload = (e) => {
@@ -1790,16 +1811,16 @@ async function fn(e) {
1790
1811
  }, r.onerror = n, r.readAsArrayBuffer(e);
1791
1812
  });
1792
1813
  }
1793
- var pn = /\r?\n/;
1794
- function mn(e) {
1795
- return e.split(pn);
1796
- }
1814
+ var mn = /\r?\n/;
1797
1815
  function hn(e) {
1816
+ return e.split(mn);
1817
+ }
1818
+ function gn(e) {
1798
1819
  return e.join("\r\n");
1799
1820
  }
1800
1821
  //#endregion
1801
1822
  //#region src/static/Utils.ts
1802
- var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
1823
+ var _n = 533, vn = "a=fmtp:", yn = "sps-pps-idr-in-keyframe=1", bn;
1803
1824
  (function(e) {
1804
1825
  function t(e, t) {
1805
1826
  let n = /* @__PURE__ */ RegExp("a=rtpmap:(\\d+) ([a-zA-Z0-9-]+)\\/\\d+"), r, i = [];
@@ -1824,8 +1845,8 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
1824
1845
  for (let r = 0; r < e.length; ++r) {
1825
1846
  let i = e[r].match(n);
1826
1847
  if (i && i.length === 2 && t.includes(i[1])) {
1827
- let t = e[r].trim() === _n + i[1] ? " " : ";";
1828
- e[r] += t + vn;
1848
+ let t = e[r].trim() === vn + i[1] ? " " : ";";
1849
+ e[r] += t + yn;
1829
1850
  }
1830
1851
  }
1831
1852
  }
@@ -1895,22 +1916,22 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
1895
1916
  });
1896
1917
  }
1897
1918
  function f(e, n, i, a, o = !1) {
1898
- let s = mn(e);
1899
- if (d(s), !n && !i && !a && !o) return hn(s);
1919
+ let s = hn(e);
1920
+ if (d(s), !n && !i && !a && !o) return gn(s);
1900
1921
  function f(e) {
1901
1922
  let t = ["a=rtcp-fb:111 nack", "a=rtcp-fb:111 nack pli"], n = e.findIndex((e) => e.startsWith("a=rtcp-fb:111"));
1902
- return ~n && (e[n] = e[n] + "\r\n" + hn(t)), e;
1923
+ return ~n && (e[n] = e[n] + "\r\n" + gn(t)), e;
1903
1924
  }
1904
1925
  function p(e) {
1905
1926
  let n = t(e, "red");
1906
1927
  n.length > 0 && r(e, "audio", [], n);
1907
1928
  }
1908
- return i ? c(s, "H264", "local", "decoder") : l(s, n), a && u(s), p(s), o && f(s), hn(s);
1929
+ return i ? c(s, "H264", "local", "decoder") : l(s, n), a && u(s), p(s), o && f(s), gn(s);
1909
1930
  }
1910
1931
  e.patchLocalSDP = f;
1911
1932
  function p(e, t, n, r, i, o) {
1912
- let s = mn(e);
1913
- return n ? a(s, "H264") : t && l(s, t), i && o ? a(s, "VP9") : i ? c(s, "VP9", "remote", "encoder") : o ? c(s, "VP9", "remote", "decoder") : r && u(s), d(s), hn(s);
1933
+ let s = hn(e);
1934
+ return n ? a(s, "H264") : t && l(s, t), i && o ? a(s, "VP9") : i ? c(s, "VP9", "remote", "encoder") : o ? c(s, "VP9", "remote", "decoder") : r && u(s), d(s), gn(s);
1914
1935
  }
1915
1936
  e.patchRemoteSDP = p;
1916
1937
  function m(e) {
@@ -2023,7 +2044,7 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
2023
2044
  e.debounce = fe;
2024
2045
  function pe(e) {
2025
2046
  if (!window.BigInt) return null;
2026
- let t = "", n = mn(e);
2047
+ let t = "", n = hn(e);
2027
2048
  for (let e of n) if (e.startsWith("a=fingerprint")) {
2028
2049
  let n = e.split(" ");
2029
2050
  if (n.length === 2) {
@@ -2063,7 +2084,7 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
2063
2084
  if (!o) return;
2064
2085
  let s = e.maxBitrateK ? e.maxBitrateK * 1024 : null, c = o.width, l = o.height, u = c && l && e.maxDimension ? Math.max(1, Math.max(c, l) / e.maxDimension) : null, d = e.maxFramerate || null;
2065
2086
  if (c && l && e.maxDimension && e.maxDimension > Math.max(c, l)) {
2066
- let e = Math.round(c * l / 256), t = (Math.round(e * gn / 1e4) + 1) * 1e4;
2087
+ let e = Math.round(c * l / 256), t = (Math.round(e * _n / 1e4) + 1) * 1e4;
2067
2088
  s = s === null ? t : Math.min(t, s);
2068
2089
  }
2069
2090
  let f = e.degradationPreference || "balanced", p = r[n.id];
@@ -2079,8 +2100,8 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
2079
2100
  };
2080
2101
  let m = t.getParameters();
2081
2102
  if (m.encodings || (m.encodings = [{}]), m.encodings.length > 1 && c && l && e.maxDimension) {
2082
- let t = Math.round(e.maxDimension * 1.35), n = e.bitrates?.generic?.length ? e.bitrates.generic : void 0, r = o.frameRate || 30, i = cn(c, l, n, d ? Math.min(r, d) : r);
2083
- a.log(`applyVideoTrackSettings: maxDim=${e.maxDimension} targetDim=${t} track=${c}x${l} sim=${JSON.stringify(i)}`), un(m.encodings, i, e.maxDimension, n ? void 0 : s ?? void 0);
2103
+ let t = Math.round(e.maxDimension * 1.35), n = e.bitrates?.generic?.length ? e.bitrates.generic : void 0, r = o.frameRate || 30, i = ln(c, l, n, d ? Math.min(r, d) : r);
2104
+ a.log(`applyVideoTrackSettings: maxDim=${e.maxDimension} targetDim=${t} track=${c}x${l} sim=${JSON.stringify(i)}`), dn(m.encodings, i, e.maxDimension, n ? void 0 : s ?? void 0);
2084
2105
  } else m.encodings.forEach((t) => {
2085
2106
  e?.scalabilityMode && (t.scalabilityMode = e.scalabilityMode), s ? t.maxBitrate = s : delete t.maxBitrate, u ? t.scaleResolutionDownBy = u : delete t.scaleResolutionDownBy, d ? t.maxFramerate = d : delete t.maxFramerate;
2086
2107
  });
@@ -2166,7 +2187,7 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
2166
2187
  }
2167
2188
  e.participantMarkerCompare = Ce;
2168
2189
  function we(e, t) {
2169
- return dn(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
2190
+ return fn(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
2170
2191
  }
2171
2192
  e.objectFilterOutValues = we;
2172
2193
  function Te(e, t, n) {
@@ -2194,18 +2215,18 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
2194
2215
  return typeof e == "object" && !!e && !Array.isArray(e);
2195
2216
  }
2196
2217
  e.isObject = Ee;
2197
- })(yn || (yn = {}));
2198
- var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
2218
+ })(bn || (bn = {}));
2219
+ var M = bn, xn = "__CALLS_SDK_DEVTOOLS_", Sn = class {
2199
2220
  set(e, t) {
2200
2221
  try {
2201
- this.getStorage().setItem(bn + e, JSON.stringify(t));
2222
+ this.getStorage().setItem(xn + e, JSON.stringify(t));
2202
2223
  } catch (t) {
2203
2224
  z.warn("DevTools: Failed to save option", e, t);
2204
2225
  }
2205
2226
  }
2206
2227
  get(e) {
2207
2228
  try {
2208
- let t = this.getStorage().getItem(bn + e);
2229
+ let t = this.getStorage().getItem(xn + e);
2209
2230
  return t === null ? null : JSON.parse(t);
2210
2231
  } catch (t) {
2211
2232
  return z.warn("DevTools: Failed to read option", e, t), null;
@@ -2213,7 +2234,7 @@ var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
2213
2234
  }
2214
2235
  remove(e) {
2215
2236
  try {
2216
- this.getStorage().removeItem(bn + e);
2237
+ this.getStorage().removeItem(xn + e);
2217
2238
  } catch (t) {
2218
2239
  z.warn("DevTools: Failed to remove option", e, t);
2219
2240
  }
@@ -2221,7 +2242,7 @@ var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
2221
2242
  clear() {
2222
2243
  try {
2223
2244
  let e = this.getStorage(), t = Object.keys(e);
2224
- for (let n of t) n.startsWith(bn) && e.removeItem(n);
2245
+ for (let n of t) n.startsWith(xn) && e.removeItem(n);
2225
2246
  } catch (e) {
2226
2247
  z.warn("DevTools: Failed to clear options", e);
2227
2248
  }
@@ -2229,7 +2250,7 @@ var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
2229
2250
  getAll() {
2230
2251
  try {
2231
2252
  let e = this.getStorage(), t = Object.keys(e), n = {};
2232
- for (let r of t) if (r.startsWith(bn)) {
2253
+ for (let r of t) if (r.startsWith(xn)) {
2233
2254
  let t = r.substring(21), i = e.getItem(r);
2234
2255
  if (i !== null) try {
2235
2256
  n[t] = JSON.parse(i);
@@ -2243,7 +2264,7 @@ var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
2243
2264
  getStorage() {
2244
2265
  return window.localStorage;
2245
2266
  }
2246
- }, Sn = class {
2267
+ }, Cn = class {
2247
2268
  constructor(e) {
2248
2269
  h(this, "storage", void 0), this.storage = e;
2249
2270
  }
@@ -2271,19 +2292,19 @@ var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
2271
2292
  }
2272
2293
  return n;
2273
2294
  }
2274
- }, Cn = class e {
2295
+ }, wn = class e {
2275
2296
  static getInstance() {
2276
2297
  return e.instance || (e.instance = new e()), e.instance;
2277
2298
  }
2278
2299
  constructor() {
2279
- h(this, "params", void 0), h(this, "storage", void 0), this.storage = new xn(), this.params = new Sn(this.storage);
2300
+ h(this, "params", void 0), h(this, "storage", void 0), this.storage = new Sn(), this.params = new Cn(this.storage);
2280
2301
  }
2281
2302
  };
2282
- h(Cn, "instance", null);
2283
- var wn = Cn.getInstance(), N = class e {
2303
+ h(wn, "instance", null);
2304
+ var Tn = wn.getInstance(), N = class e {
2284
2305
  static set(t) {
2285
2306
  Object.hasOwn(t, "voiceParams") && (Object.assign(e._params.voiceParams, t.voiceParams), delete t.voiceParams), Object.hasOwn(t, "specListenerParams") && (Object.assign(e._params.specListenerParams, t.specListenerParams), delete t.specListenerParams), Object.hasOwn(t, "apiAuth") && (v.accessToken = t.apiAuth.accessToken, v.sessionKey = t.apiAuth.sessionKey, v.sessionSecretKey = t.apiAuth.sessionSecretKey, v.selfExternalId = null);
2286
- let n = wn.params.applyOverrides(t);
2307
+ let n = Tn.params.applyOverrides(t);
2287
2308
  Object.assign(e._params, M.objectFilterOutValues(n, void 0));
2288
2309
  }
2289
2310
  static getScreenFrameRate(t) {
@@ -2302,7 +2323,7 @@ var wn = Cn.getInstance(), N = class e {
2302
2323
  return 1.1;
2303
2324
  }
2304
2325
  static get sdkVersion() {
2305
- return "2.8.13-dev.b18b02e0.0";
2326
+ return "2.8.13-dev.b9b0c10d.0";
2306
2327
  }
2307
2328
  static get debug() {
2308
2329
  return e._params.debug;
@@ -2897,10 +2918,10 @@ function I(e, t, ...n) {
2897
2918
  function L(e) {
2898
2919
  return Object.assign({}, e);
2899
2920
  }
2900
- function Tn(e) {
2921
+ function En(e) {
2901
2922
  return e.slice();
2902
2923
  }
2903
- var En;
2924
+ var Dn;
2904
2925
  (function(e) {
2905
2926
  function t(e, t, n) {
2906
2927
  F("onLocalStream", e, L(t), n);
@@ -3039,16 +3060,16 @@ var En;
3039
3060
  }
3040
3061
  e.onDeviceSwitched = _e;
3041
3062
  function _(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
3042
- let d = c ? Tn(c) : void 0;
3043
- F("onMuteStates", L(e), Tn(t), Tn(n), r, i, a, o, s, d, l, u);
3063
+ let d = c ? En(c) : void 0;
3064
+ F("onMuteStates", L(e), En(t), En(n), r, i, a, o, s, d, l, u);
3044
3065
  }
3045
3066
  e.onMuteStates = _;
3046
3067
  function ve(e, t, n = !1, r) {
3047
- I("onRolesChanged", e, Tn(t), n, r);
3068
+ I("onRolesChanged", e, En(t), n, r);
3048
3069
  }
3049
3070
  e.onRolesChanged = ve;
3050
3071
  function ye(e, t = !1, n) {
3051
- F("onLocalRolesChanged", Tn(e), t, n);
3072
+ F("onLocalRolesChanged", En(e), t, n);
3052
3073
  }
3053
3074
  e.onLocalRolesChanged = ye;
3054
3075
  function be(e, t, n, r, i) {
@@ -3060,7 +3081,7 @@ var En;
3060
3081
  }
3061
3082
  e.onLocalPin = xe;
3062
3083
  function Se(e, t) {
3063
- F("onOptionsChanged", Tn(e), t);
3084
+ F("onOptionsChanged", En(e), t);
3064
3085
  }
3065
3086
  e.onOptionsChanged = Se;
3066
3087
  function Ce(e) {
@@ -3084,7 +3105,7 @@ var En;
3084
3105
  }
3085
3106
  e.onSpeakerChanged = De;
3086
3107
  function Oe(e, t) {
3087
- F("onVolumesDetected", Tn(e), t);
3108
+ F("onVolumesDetected", En(e), t);
3088
3109
  }
3089
3110
  e.onVolumesDetected = Oe;
3090
3111
  function ke(e, t) {
@@ -3256,10 +3277,10 @@ var En;
3256
3277
  F("onNonFatalError", e, t);
3257
3278
  }
3258
3279
  e.onNonFatalError = ct;
3259
- })(En || (En = {}));
3260
- var R = En, Dn = /* @__PURE__ */ function(e) {
3280
+ })(Dn || (Dn = {}));
3281
+ var R = Dn, On = /* @__PURE__ */ function(e) {
3261
3282
  return e.DEBUG = "DEBUG", e.LOG = "LOG", e.WARN = "WARN", e.ERROR = "ERROR", e;
3262
- }({}), On;
3283
+ }({}), kn;
3263
3284
  (function(e) {
3264
3285
  let t = "📞", n = () => ({
3265
3286
  sessionId: null,
@@ -3372,8 +3393,8 @@ var R = En, Dn = /* @__PURE__ */ function(e) {
3372
3393
  e.createSessionLogger = re;
3373
3394
  function ie(e, ...t) {}
3374
3395
  e.test = ie;
3375
- })(On || (On = {}));
3376
- var z = On, B = new class {
3396
+ })(kn || (kn = {}));
3397
+ var z = kn, B = new class {
3377
3398
  constructor() {
3378
3399
  h(this, "_conversations", /* @__PURE__ */ new Map()), h(this, "_pending", /* @__PURE__ */ new Set()), h(this, "_initialIds", /* @__PURE__ */ new Map()), h(this, "_hangups", /* @__PURE__ */ new Map()), h(this, "_activeId", null), h(this, "_selected", null), h(this, "_mutex", !1), h(this, "_pendingRemovals", /* @__PURE__ */ new Map());
3379
3400
  }
@@ -3515,15 +3536,15 @@ var z = On, B = new class {
3515
3536
  this._pendingRemovals.clear();
3516
3537
  }
3517
3538
  }
3518
- }(), kn = class extends Error {
3539
+ }(), An = class extends Error {
3519
3540
  constructor(e) {
3520
3541
  super(e ? `Signaling disposed. Command ${e}` : "Signaling disposed"), this.name = "SignalingDisposedError";
3521
3542
  }
3522
- }, An = class extends Error {
3543
+ }, jn = class extends Error {
3523
3544
  constructor(e) {
3524
3545
  super(e ? `Producer connection closed. Command ${e}` : "Producer connection closed"), this.name = "ProducerConnectionClosedError";
3525
3546
  }
3526
- }, jn = class extends Ye {
3547
+ }, Mn = class extends Ye {
3527
3548
  constructor(...e) {
3528
3549
  super(...e), h(this, "_abortSignal", void 0);
3529
3550
  }
@@ -3545,15 +3566,15 @@ var z = On, B = new class {
3545
3566
  }, V = /* @__PURE__ */ function(e) {
3546
3567
  return e.RECOVER = "recover", e.ACCEPT_CALL = "accept-call", e.ADD_PARTICIPANT = "add-participant", e.REMOVE_PARTICIPANT = "remove-participant", e.HANGUP = "hangup", e.TRANSMIT_DATA = "transmit-data", e.ACCEPT_PRODUCER = "accept-producer", e.ALLOCATE_CONSUMER = "allocate-consumer", e.CHANGE_MEDIA_SETTINGS = "change-media-settings", e.CHANGE_PARTICIPANT_STATE = "change-participant-state", e.CHANGE_STREAM_PRIORITIES = "change-streams-priorities", e.UPDATE_DISPLAY_LAYOUT = "update-display-layout", e.REPORT_PERF_STAT = "report-perf-stat", e.REPORT_SHARING_STAT = "report-sharing-stat", e.REPORT_NETWORK_STAT = "report-network-stat", e.RECORD_START = "record-start", e.RECORD_STOP = "record-stop", e.RECORD_PUBLISH = "record-publish", e.RECORD_SET_CONF = "record-set-conf", e.RECORD_GET_STATUS = "record-get-status", e.SWITCH_MICRO = "switch-micro", e.SWITCH_TOPOLOGY = "switch-topology", e.REQUEST_REALLOC = "request-realloc", e.CHAT_MESSAGE = "chat-message", e.CHAT_HISTORY = "chat-history", e.CUSTOM_DATA = "custom-data", e.GRANT_ROLES = "grant-roles", e.MUTE_PARTICIPANT = "mute-participant", e.ENABLE_FEATURE_FOR_ROLES = "enable-feature-for-roles", e.PIN_PARTICIPANT = "pin-participant", e.UPDATE_MEDIA_MODIFIERS = "update-media-modifiers", e.CHANGE_OPTIONS = "change-options", e.GET_WAITING_HALL = "get-waiting-hall", e.GET_PARTICIPANT_LIST_CHUNK = "get-participant-list-chunk", e.GET_PARTICIPANTS = "get-participants", e.PROMOTE_PARTICIPANT = "promote-participant", e.REQUEST_TEST_MODE = "request-test-mode", e.ADD_MOVIE = "add-movie", e.UPDATE_MOVIE = "update-movie", e.REMOVE_MOVIE = "remove-movie", e.START_URL_SHARING = "start-url-sharing", e.STOP_URL_SHARING = "stop-url-sharing", e.GET_ROOMS = "get-rooms", e.UPDATE_ROOMS = "update-rooms", e.ACTIVATE_ROOMS = "activate-rooms", e.REMOVE_ROOMS = "remove-rooms", e.SWITCH_ROOM = "switch-room", e.FEEDBACK = "feedback", e.ASR_START = "asr-start", e.ASR_STOP = "asr-stop", e.REQUEST_ASR = "request-asr", e.REQUEST_PROMOTION = "request-promotion", e.ACCEPT_PROMOTION = "accept-promotion", e.GET_HAND_QUEUE = "get-hand-queue", e.ENABLE_VIDEO_SUSPEND = "enable-video-suspend", e.ENABLE_VIDEO_SUSPEND_SUGGEST = "enable-video-suspend-suggest", e.HOLD = "hold", e.PUT_HANDS_DOWN = "put-hands-down", e.CHANGE_SIMULCAST = "change-simulcast", e;
3547
3568
  }(V || {});
3548
- function Mn(e) {
3569
+ function Nn(e) {
3549
3570
  return e.stopStream;
3550
3571
  }
3551
- function Nn(e) {
3572
+ function Pn(e) {
3552
3573
  return e.keyFrameRequested;
3553
3574
  }
3554
- function Pn(e) {
3555
- if (Mn(e)) return "ss";
3556
- if (Nn(e)) return "kf";
3575
+ function Fn(e) {
3576
+ if (Nn(e)) return "ss";
3577
+ if (Pn(e)) return "kf";
3557
3578
  let t = "";
3558
3579
  return e.priority !== void 0 && (t += "p=" + e.priority), e.width !== void 0 && e.height !== void 0 && (t !== "" && (t += ":"), t += "sz=" + Math.round(e.width) + "x" + Math.round(e.height)), e.fit !== void 0 && (t !== "" && (t += ":"), t += "fit=" + e.fit), t;
3559
3580
  }
@@ -3561,19 +3582,19 @@ function Pn(e) {
3561
3582
  //#region src/types/ParticipantStreamDescription.ts
3562
3583
  var H = /* @__PURE__ */ function(e) {
3563
3584
  return e.CAMERA = "CAMERA", e.SCREEN = "SCREEN", e.STREAM = "STREAM", e.MOVIE = "MOVIE", e.ANIMOJI = "ANIMOJI", e.SHARED_URL = "SHARED_URL", e;
3564
- }({}), Fn = "s", In = "m";
3565
- function Ln(e) {
3566
- return e.participantId + (e.mediaType ? ":" + Fn + e.mediaType : "") + (e.streamName ? ":" + In + e.streamName : "");
3567
- }
3585
+ }({}), In = "s", Ln = "m";
3568
3586
  function Rn(e) {
3587
+ return e.participantId + (e.mediaType ? ":" + In + e.mediaType : "") + (e.streamName ? ":" + Ln + e.streamName : "");
3588
+ }
3589
+ function zn(e) {
3569
3590
  let t = e.split(":"), n = t.shift();
3570
3591
  if (!n) throw Error("Illegal stream description: " + e);
3571
3592
  let r = null, i, a = 0;
3572
3593
  for (let n of t) switch (n.charAt(0)) {
3573
- case Fn:
3574
- r = zn(n.slice(1));
3575
- break;
3576
3594
  case In:
3595
+ r = Bn(n.slice(1));
3596
+ break;
3597
+ case Ln:
3577
3598
  i = n.slice(1);
3578
3599
  break;
3579
3600
  case "d":
@@ -3587,13 +3608,13 @@ function Rn(e) {
3587
3608
  streamName: i
3588
3609
  };
3589
3610
  }
3590
- function zn(e) {
3611
+ function Bn(e) {
3591
3612
  for (let t of Object.keys(H)) if (t === e) return H[t];
3592
3613
  return null;
3593
3614
  }
3594
3615
  //#endregion
3595
3616
  //#region src/utils/MsgPackerBufferUtils.ts
3596
- function Bn() {
3617
+ function Vn() {
3597
3618
  let e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(64)), t = 0;
3598
3619
  function n(n) {
3599
3620
  if (t + n > e.byteLength) {
@@ -3603,7 +3624,7 @@ function Bn() {
3603
3624
  }
3604
3625
  return {
3605
3626
  put(r) {
3606
- if (n(r.byteLength), Vn(r)) {
3627
+ if (n(r.byteLength), Hn(r)) {
3607
3628
  let n = r.buffer;
3608
3629
  new Uint8Array(e.buffer).set(new Uint8Array(n), t);
3609
3630
  } else new Uint8Array(e.buffer).set(new Uint8Array(r), t);
@@ -3645,10 +3666,10 @@ function Bn() {
3645
3666
  }
3646
3667
  };
3647
3668
  }
3648
- function Vn(e) {
3669
+ function Hn(e) {
3649
3670
  return e.buffer !== void 0;
3650
3671
  }
3651
- function Hn(e) {
3672
+ function Un(e) {
3652
3673
  let t = ArrayBuffer.isView(e) ? new DataView(e.buffer, e.byteOffset, e.byteLength) : new DataView(e), n = 0;
3653
3674
  return {
3654
3675
  peek() {
@@ -3697,7 +3718,7 @@ function Hn(e) {
3697
3718
  }
3698
3719
  //#endregion
3699
3720
  //#region src/classes/ProducerCommandSerializationService.ts
3700
- var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn = 1, $n = 2, er = 0, tr = 0, nr = 0, rr = 1, ir = class {
3721
+ var Wn = 0, Gn = 1, Kn = 2, qn = 3, Jn = 4, Yn = 5, Xn = 6, Zn = 7, Qn = 0, $n = 1, er = 2, tr = 0, nr = 0, rr = 0, ir = 1, ar = class {
3701
3722
  constructor(e = z) {
3702
3723
  h(this, "participantIdRegistry", null), h(this, "_debug", void 0), this._debug = e;
3703
3724
  }
@@ -3705,22 +3726,22 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
3705
3726
  this.participantIdRegistry = e;
3706
3727
  }
3707
3728
  serializeUpdateDisplayLayout(e, t) {
3708
- let r = Bn();
3709
- i.enc(r, Un), i.enc(r, er), i.enc(r, e), a.enc(r, null);
3729
+ let r = Vn();
3730
+ i.enc(r, Wn), i.enc(r, tr), i.enc(r, e), a.enc(r, null);
3710
3731
  let o = [];
3711
3732
  for (let e in t) Object.hasOwn(t, e) && this.writeLayout(t, e, o);
3712
3733
  return n.enc(r, o), a.enc(r, null), r.ui8array().buffer;
3713
3734
  }
3714
3735
  writeLayout(e, t, n) {
3715
- let r = e[t], o = Bn();
3716
- if (this.writeStreamDesc(t, o), Mn(r)) i.enc(o, Qn);
3717
- else if (Nn(r)) i.enc(o, $n);
3718
- else if (i.enc(o, Zn), r.priority === void 0 ? a.enc(o, null) : i.enc(o, r.priority), r.width !== void 0 && r.height !== void 0 ? (i.enc(o, Math.round(r.width)), i.enc(o, Math.round(r.height))) : (a.enc(o, null), a.enc(o, null)), r.fit !== void 0) switch (r.fit) {
3736
+ let r = e[t], o = Vn();
3737
+ if (this.writeStreamDesc(t, o), Nn(r)) i.enc(o, $n);
3738
+ else if (Pn(r)) i.enc(o, er);
3739
+ else if (i.enc(o, Qn), r.priority === void 0 ? a.enc(o, null) : i.enc(o, r.priority), r.width !== void 0 && r.height !== void 0 ? (i.enc(o, Math.round(r.width)), i.enc(o, Math.round(r.height))) : (a.enc(o, null), a.enc(o, null)), r.fit !== void 0) switch (r.fit) {
3719
3740
  case "cv":
3720
- i.enc(o, nr);
3741
+ i.enc(o, rr);
3721
3742
  break;
3722
3743
  case "cn":
3723
- i.enc(o, rr);
3744
+ i.enc(o, ir);
3724
3745
  break;
3725
3746
  default: a.enc(o, null);
3726
3747
  }
@@ -3738,32 +3759,32 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
3738
3759
  o.enc(t, e);
3739
3760
  }
3740
3761
  serializePerfStatReport(e, t) {
3741
- let n = Bn();
3742
- return i.enc(n, Wn), i.enc(n, er), i.enc(n, e), i.enc(n, t.framesDecoded), i.enc(n, t.framesReceived), n.ui8array().buffer;
3762
+ let n = Vn();
3763
+ return i.enc(n, Gn), i.enc(n, tr), i.enc(n, e), i.enc(n, t.framesDecoded), i.enc(n, t.framesReceived), n.ui8array().buffer;
3743
3764
  }
3744
3765
  serializeSharingStatReport(e, t) {
3745
- let n = Bn();
3746
- return i.enc(n, Gn), i.enc(n, er), i.enc(n, e), i.enc(n, t.minDelay), i.enc(n, t.maxDelay), i.enc(n, t.avgDelay), i.enc(n, t.largeDelayDuration), n.ui8array().buffer;
3766
+ let n = Vn();
3767
+ return i.enc(n, Kn), i.enc(n, tr), i.enc(n, e), i.enc(n, t.minDelay), i.enc(n, t.maxDelay), i.enc(n, t.avgDelay), i.enc(n, t.largeDelayDuration), n.ui8array().buffer;
3747
3768
  }
3748
3769
  serializeRequestAsr(e, t) {
3749
- let n = Bn();
3750
- return i.enc(n, Kn), i.enc(n, er), i.enc(n, e), r.enc(n, t.request), n.ui8array().buffer;
3770
+ let n = Vn();
3771
+ return i.enc(n, qn), i.enc(n, tr), i.enc(n, e), r.enc(n, t.request), n.ui8array().buffer;
3751
3772
  }
3752
3773
  serializeNetworkStatReport(e, t) {
3753
- let n = Bn();
3754
- return i.enc(n, qn), i.enc(n, er), i.enc(n, e), i.enc(n, t.timestamp), i.enc(n, t.sendBitrate), n.ui8array().buffer;
3774
+ let n = Vn();
3775
+ return i.enc(n, Jn), i.enc(n, tr), i.enc(n, e), i.enc(n, t.timestamp), i.enc(n, t.sendBitrate), n.ui8array().buffer;
3755
3776
  }
3756
3777
  serializeEnableVideoSuspend(e, t) {
3757
- let n = Bn();
3758
- return i.enc(n, Jn), i.enc(n, er), i.enc(n, e), r.enc(n, t.enabled), n.ui8array().buffer;
3778
+ let n = Vn();
3779
+ return i.enc(n, Yn), i.enc(n, tr), i.enc(n, e), r.enc(n, t.enabled), n.ui8array().buffer;
3759
3780
  }
3760
3781
  serializeEnableVideoSuspendSuggest(e, t) {
3761
- let n = Bn();
3762
- return i.enc(n, Yn), i.enc(n, er), i.enc(n, e), r.enc(n, t.enabled), n.ui8array().buffer;
3782
+ let n = Vn();
3783
+ return i.enc(n, Xn), i.enc(n, tr), i.enc(n, e), r.enc(n, t.enabled), n.ui8array().buffer;
3763
3784
  }
3764
3785
  serializeChangeSimulcast(e, t) {
3765
- let n = Bn();
3766
- i.enc(n, Xn), i.enc(n, er), i.enc(n, e);
3786
+ let n = Vn();
3787
+ i.enc(n, Zn), i.enc(n, tr), i.enc(n, e);
3767
3788
  let r = t.simulcastInfo.streams.length;
3768
3789
  i.enc(n, t.mediaSource), i.enc(n, r);
3769
3790
  for (let e of t.simulcastInfo.streams) o.enc(n, e.rid), i.enc(n, e.width), i.enc(n, e.height), i.enc(n, e.fps), i.enc(n, e.bitrate / 1e3);
@@ -3771,19 +3792,19 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
3771
3792
  }
3772
3793
  async deserializeCommandResponse(e) {
3773
3794
  let t;
3774
- t = e instanceof Blob ? Hn("arrayBuffer" in Blob.prototype ? await e.arrayBuffer() : await fn(e)) : Hn(e);
3795
+ t = e instanceof Blob ? Un("arrayBuffer" in Blob.prototype ? await e.arrayBuffer() : await pn(e)) : Un(e);
3775
3796
  let n = i.dec(t), r = i.dec(t);
3776
- if (r !== er) {
3797
+ if (r !== tr) {
3777
3798
  this._debug.warn("Unsupported version for command type: " + n + ", version " + r);
3778
3799
  return;
3779
3800
  }
3780
- if (i.dec(t) !== tr) {
3801
+ if (i.dec(t) !== nr) {
3781
3802
  this._debug.warn("Error code: " + n + "received for command type: " + n + ", version " + r);
3782
3803
  return;
3783
3804
  }
3784
3805
  switch (n) {
3785
- case Un: return this.deserializeUpdateDisplayLayoutResponse(t);
3786
- case Wn: return this.deserializeReportPerfStatResponse(t);
3806
+ case Wn: return this.deserializeUpdateDisplayLayoutResponse(t);
3807
+ case Gn: return this.deserializeReportPerfStatResponse(t);
3787
3808
  default:
3788
3809
  this._debug.warn("unsupported command response commandType: " + n);
3789
3810
  return;
@@ -3792,10 +3813,10 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
3792
3813
  deserializeUpdateDisplayLayoutResponse(e) {
3793
3814
  let r = i.dec(e), a = n.dec(e), o = {};
3794
3815
  return a.forEach((e) => {
3795
- let n = Hn(e), r = t.dec(n);
3816
+ let n = Un(e), r = t.dec(n);
3796
3817
  if (typeof r == "string") o[r] = i.dec(n);
3797
3818
  else {
3798
- let e = r, t = Ln(this.participantIdRegistry?.getStreamDescription(e));
3819
+ let e = r, t = Rn(this.participantIdRegistry?.getStreamDescription(e));
3799
3820
  o[t] = i.dec(n);
3800
3821
  }
3801
3822
  }), {
@@ -3816,44 +3837,44 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
3816
3837
  }
3817
3838
  }, U = /* @__PURE__ */ function(e) {
3818
3839
  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.API_CALL = "api_call", e.CONNECTION_STATE_CHANGED = "connection_state_changed", e.SIGNALING_STATE_CHANGED = "signaling_state_changed", e.GATHERING_STATE_CHANGED = "gathering_state_changed", e.ICE_RESTART = "ice_restart", e.ICE_CANDIDATES_CHANGED = "ice_candidates_changed", e.ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed", e.ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed", 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.CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology", e.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter", 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;
3819
- }(U || {}), ar = 1e3;
3840
+ }(U || {}), or = 1e3;
3820
3841
  function W(e, t, n = 0) {
3821
3842
  return t in e && e[t] ? e[t] : n;
3822
3843
  }
3823
- function or(...e) {
3844
+ function sr(...e) {
3824
3845
  return (t) => {
3825
3846
  for (let n of e) if (n(t)) return !0;
3826
3847
  return !1;
3827
3848
  };
3828
3849
  }
3829
- function sr(e, t) {
3850
+ function cr(e, t) {
3830
3851
  return (n) => n[e] === t;
3831
3852
  }
3832
- function cr(e) {
3853
+ function lr(e) {
3833
3854
  return (t, n) => n[e] - t[e];
3834
3855
  }
3835
- function lr(e, t) {
3856
+ function ur(e, t) {
3836
3857
  return t.reduce((t, n) => (t[n[e]] = n, t), {});
3837
3858
  }
3838
- function ur(e) {
3859
+ function dr(e) {
3839
3860
  let t = {}, n = [];
3840
3861
  for (let r of e) t[r.id] || (t[r.id] = !0, n.push(r));
3841
3862
  return n;
3842
3863
  }
3843
- function dr(e) {
3844
- return Object.keys(e).filter((t) => e[t] !== void 0).map((t) => [t, e[t]]).reduce((e, t) => (e[t[0]] = M.isObject(t[1]) ? dr(t[1]) : t[1], e), {});
3845
- }
3846
3864
  function fr(e) {
3865
+ return Object.keys(e).filter((t) => e[t] !== void 0).map((t) => [t, e[t]]).reduce((e, t) => (e[t[0]] = M.isObject(t[1]) ? fr(t[1]) : t[1], e), {});
3866
+ }
3867
+ function pr(e) {
3847
3868
  let t = [];
3848
3869
  for (let n of e) n.forEach((e) => t.push(e));
3849
3870
  return t;
3850
3871
  }
3851
- async function pr(e) {
3872
+ async function mr(e) {
3852
3873
  let t = [];
3853
- return RTCRtpReceiver.prototype.getStats ? (t.push(...e.getReceivers().map((e) => e.getStats())), t.push(...e.getSenders().map((e) => e.getStats()))) : t.push(e.getStats()), Promise.all(t).then(fr).then(ur);
3874
+ return RTCRtpReceiver.prototype.getStats ? (t.push(...e.getReceivers().map((e) => e.getStats())), t.push(...e.getSenders().map((e) => e.getStats()))) : t.push(e.getStats()), Promise.all(t).then(pr).then(dr);
3854
3875
  }
3855
- function mr(e) {
3856
- let t = e.filter(sr("type", "candidate-pair")).sort(cr("priority")).find(or(sr("nominated", !0), sr("selected", !0)));
3876
+ function hr(e) {
3877
+ let t = e.filter(cr("type", "candidate-pair")).sort(lr("priority")).find(sr(cr("nominated", !0), cr("selected", !0)));
3857
3878
  if (!t) return {
3858
3879
  timestamp: 0,
3859
3880
  availableOutgoingBitrate: 0,
@@ -3869,14 +3890,14 @@ function mr(e) {
3869
3890
  currentRoundTripTime: t.currentRoundTripTime || 0,
3870
3891
  bytesSent: t.bytesSent || 0,
3871
3892
  bytesReceived: t.bytesReceived || 0
3872
- }, r = e.find(sr("id", t.remoteCandidateId));
3893
+ }, r = e.find(cr("id", t.remoteCandidateId));
3873
3894
  r && Object.assign(n, { remote: {
3874
3895
  type: r.candidateType,
3875
3896
  address: r.ip || r.address,
3876
3897
  port: r.port,
3877
3898
  protocol: r.protocol
3878
3899
  } });
3879
- let i = e.find(sr("id", t.localCandidateId));
3900
+ let i = e.find(cr("id", t.localCandidateId));
3880
3901
  return i && Object.assign(n, { local: {
3881
3902
  type: i.candidateType,
3882
3903
  address: i.ip || i.address,
@@ -3884,11 +3905,11 @@ function mr(e) {
3884
3905
  protocol: i.protocol,
3885
3906
  relayProtocol: i.relayProtocol,
3886
3907
  networkType: i.networkType
3887
- } }), dr(n);
3908
+ } }), fr(n);
3888
3909
  }
3889
- function hr(e, t, n = !1) {
3890
- let r = lr("id", e);
3891
- return (n ? e.filter(or(sr("type", "remote-inbound-rtp"))) : e.filter(or(sr("type", "inbound-rtp"), sr("type", "outbound-rtp")))).map((e) => {
3910
+ function gr(e, t, n = !1) {
3911
+ let r = ur("id", e);
3912
+ return (n ? e.filter(sr(cr("type", "remote-inbound-rtp"))) : e.filter(sr(cr("type", "inbound-rtp"), cr("type", "outbound-rtp")))).map((e) => {
3892
3913
  let n = Number(e.ssrc), i = e.mediaType || e.kind, a = e.type, o = e.codecId;
3893
3914
  if (!a || !n || !i) return null;
3894
3915
  let s = {
@@ -3928,14 +3949,14 @@ function hr(e, t, n = !1) {
3928
3949
  let e = r[o];
3929
3950
  s.clockRate = e.clockRate, s.mimeType = e.mimeType, i === "audio" && e.sdpFmtpLine && (s.sdpFmtpLine = e.sdpFmtpLine);
3930
3951
  }
3931
- return dr(s);
3952
+ return fr(s);
3932
3953
  }).filter((e) => !!e);
3933
3954
  }
3934
- function gr(e, t, n = !1) {
3955
+ function _r(e, t, n = !1) {
3935
3956
  if (!t || !t.rtps.length || !e.rtps.length) return e;
3936
3957
  let r, i;
3937
- n && (r = lr("ssrc", e?.remoteRtps || []), i = lr("ssrc", t?.remoteRtps || []));
3938
- let a = lr("ssrc", e.rtps), o = lr("ssrc", t.rtps), s = (e.timestamp - t.timestamp) / 1e3;
3958
+ n && (r = ur("ssrc", e?.remoteRtps || []), i = ur("ssrc", t?.remoteRtps || []));
3959
+ let a = ur("ssrc", e.rtps), o = ur("ssrc", t.rtps), s = (e.timestamp - t.timestamp) / 1e3;
3939
3960
  return !a || !o || Object.keys(a).forEach((c) => {
3940
3961
  let l = a[c], u = o[c];
3941
3962
  if (!(!l || !u)) {
@@ -3953,54 +3974,54 @@ function gr(e, t, n = !1) {
3953
3974
  }
3954
3975
  }), e;
3955
3976
  }
3956
- async function _r(e, t, n = {}, r = !1) {
3957
- let i = await pr(e), a = {
3977
+ async function vr(e, t, n = {}, r = !1) {
3978
+ let i = await mr(e), a = {
3958
3979
  timestamp: Date.now(),
3959
- transport: mr(i),
3960
- rtps: hr(i, n)
3980
+ transport: hr(i),
3981
+ rtps: gr(i, n)
3961
3982
  };
3962
- return r && (a.remoteRtps = hr(i, n, !0)), t ? gr(a, t, r) : (await M.delay(ar), _r(e, a, n, r));
3983
+ return r && (a.remoteRtps = gr(i, n, !0)), t ? _r(a, t, r) : (await M.delay(or), vr(e, a, n, r));
3963
3984
  }
3964
- function vr(e) {
3985
+ function yr(e) {
3965
3986
  performance.clearMarks(e), performance.mark(e);
3966
3987
  }
3967
- function yr(e) {
3988
+ function br(e) {
3968
3989
  performance.clearMarks(e);
3969
3990
  }
3970
- function br(e) {
3991
+ function xr(e) {
3971
3992
  let t = performance.getEntriesByName(e)[0];
3972
3993
  if (t === void 0) return null;
3973
3994
  let n = Math.round(performance.now() - t.startTime);
3974
3995
  return performance.clearMarks(e), !Number.isSafeInteger(n) || n < 0 ? null : n;
3975
3996
  }
3976
- function xr(e) {
3977
- return `${U.SCREENSHARE_FIRST_FRAME}_${Sr(e)}`;
3978
- }
3979
3997
  function Sr(e) {
3998
+ return `${U.SCREENSHARE_FIRST_FRAME}_${Cr(e)}`;
3999
+ }
4000
+ function Cr(e) {
3980
4001
  return typeof e == "string" ? e : JSON.stringify(e);
3981
4002
  }
3982
4003
  var G = {
3983
- distinctById: ur,
3984
- rtcStatsToArray: fr,
3985
- extractTransport: mr,
3986
- extractRtps: hr,
3987
- delta: gr,
3988
- collectStats: _r,
3989
- setMark: vr,
3990
- clearMark: yr,
3991
- measureMark: br,
3992
- getMarkNameScreenshareFirstFrame: xr
3993
- }, Cr = /* @__PURE__ */ function(e) {
4004
+ distinctById: dr,
4005
+ rtcStatsToArray: pr,
4006
+ extractTransport: hr,
4007
+ extractRtps: gr,
4008
+ delta: _r,
4009
+ collectStats: vr,
4010
+ setMark: yr,
4011
+ clearMark: br,
4012
+ measureMark: xr,
4013
+ getMarkNameScreenshareFirstFrame: Sr
4014
+ }, wr = /* @__PURE__ */ function(e) {
3994
4015
  return e.START = "start", e.ACCEPT = "accept", e.JOIN = "join", e.RETRY = "retry", e;
3995
- }(Cr || {}), wr = /* @__PURE__ */ function(e) {
4016
+ }(wr || {}), Tr = /* @__PURE__ */ function(e) {
3996
4017
  return e.NOTIFICATION = "NOTIFICATION", e.FAILED = "FAILED", e.RECONNECT = "RECONNECT", e;
3997
- }(wr || {}), K = /* @__PURE__ */ function(e) {
4018
+ }(Tr || {}), K = /* @__PURE__ */ function(e) {
3998
4019
  return e.TRANSMITTED_DATA = "transmitted-data", e.ACCEPTED_CALL = "accepted-call", e.HUNGUP = "hungup", e.PARTICIPANT_ADDED = "participant-added", e.PARTICIPANT_JOINED = "participant-joined", e.CLOSED_CONVERSATION = "closed-conversation", e.MEDIA_SETTINGS_CHANGED = "media-settings-changed", e.PARTICIPANT_STATE_CHANGED = "participant-state-changed", e.PARTICIPANTS_STATE_CHANGED = "participants-state-changed", e.RATE_CALL_DATA = "rate-call-data", e.FEATURE_SET_CHANGED = "feature-set-changed", e.TOPOLOGY_CHANGED = "topology-changed", e.PRODUCER_UPDATED = "producer-updated", e.CONSUMER_ANSWERED = "consumer-answered", e.MULTIPARTY_CHAT_CREATED = "multiparty-chat-created", e.FORCE_MEDIA_SETTINGS_CHANGE = "force-media-settings-change", e.SETTINGS_UPDATE = "settings-update", e.VIDEO_QUALITY_UPDATE = "video-quality-update", e.REGISTERED_PEER = "registered-peer", e.SWITCH_MICRO = "switch-micro", e.RECORD_STARTED = "record-started", e.RECORD_STOPPED = "record-stopped", e.REALLOC_CON = "realloc-con", e.AUDIO_ACTIVITY = "audio-activity", e.SPEAKER_CHANGED = "speaker-changed", e.SESSION_STATE = "session-state", e.STALLED_ACTIVITY = "stalled-activity", e.CHAT_MESSAGE = "chat-message", e.CUSTOM_DATA = "custom-data", e.ROLES_CHANGED = "roles-changed", e.MUTE_PARTICIPANT = "mute-participant", e.PIN_PARTICIPANT = "pin-participant", e.OPTIONS_CHANGED = "options-changed", e.NETWORK_STATUS = "network-status", e.PARTICIPANT_SOURCES_UPDATE = "participant-sources-update", e.PROMOTE_PARTICIPANT = "promote-participant", e.CHAT_ROOM_UPDATED = "chat-room-updated", e.PROMOTION_APPROVED = "promotion-approved", e.JOIN_LINK_CHANGED = "join-link-changed", e.FEEDBACK = "feedback", e.MOVIE_UPDATE_NOTIFICATION = "movie-update-notification", e.MOVIE_SHARE_STARTED = "movie-share-started", e.MOVIE_SHARE_STOPPED = "movie-share-stopped", e.URL_SHARING_INFO_UPDATED = "url-sharing-info-updated", e.ROOM_UPDATED = "room-updated", e.ROOMS_UPDATED = "rooms-updated", e.ROOM_PARTICIPANTS_UPDATED = "room-participants-updated", e.FEATURES_PER_ROLE_CHANGED = "features-per-role-changed", e.PARTICIPANT_ANIMOJI_CHANGED = "participant-animoji-changed", e.ASR_STARTED = "asr-started", e.ASR_STOPPED = "asr-stopped", e.DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed", e.VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest", e.HOLD = "hold", e;
3999
- }(K || {}), Tr = /* @__PURE__ */ function(e) {
4020
+ }(K || {}), Er = /* @__PURE__ */ function(e) {
4000
4021
  return e.WEBSOCKET = "ws", e.WEBTRANSPORT = "wt", e;
4001
- }({}), Er = /* @__PURE__ */ function(e) {
4022
+ }({}), Dr = /* @__PURE__ */ function(e) {
4002
4023
  return e.CONNECTED = "connected", e.RECONNECTED = "reconnected", e.FAILED_PINGS = "failed_pings", e.FAILED_EXCEPTIONS = "failed_exception", e.TIMEOUT = "timeout", e.RESTART = "restart", e;
4003
- }({}), Dr = {
4024
+ }({}), Or = {
4004
4025
  connected: {
4005
4026
  wt: U.WEBTRANSPORT_CONNECTED,
4006
4027
  ws: U.WEBSOCKET_CONNECTED
@@ -4027,24 +4048,24 @@ var G = {
4027
4048
  }
4028
4049
  }, q = /* @__PURE__ */ function(e) {
4029
4050
  return e.IDLE = "IDLE", e.OPENED = "OPENED", e.CONNECTING = "CONNECTING", e.RECONNECTING = "RECONNECTING", e.CONNECTED = "CONNECTED", e.CLOSED = "CLOSED", e.FAILED = "FAILED", e;
4030
- }(q || {}), Or = {
4051
+ }(q || {}), kr = {
4031
4052
  offer: U.SDP_CREATE_OFFER,
4032
4053
  answer: U.SDP_CREATE_ANSWER
4033
- }, kr = {
4054
+ }, Ar = {
4034
4055
  offer: U.SDP_SET_LOCAL_OFFER,
4035
4056
  pranswer: U.SDP_SET_LOCAL_PRANSWER,
4036
4057
  answer: U.SDP_SET_LOCAL_ANSWER,
4037
4058
  rollback: U.SDP_SET_LOCAL_ROLLBACK
4038
- }, Ar = {
4059
+ }, jr = {
4039
4060
  offer: U.SDP_SET_REMOTE_OFFER,
4040
4061
  pranswer: U.SDP_SET_REMOTE_PRANSWER,
4041
4062
  answer: U.SDP_SET_REMOTE_ANSWER,
4042
4063
  rollback: U.SDP_SET_REMOTE_ROLLBACK
4043
- }, jr = {
4064
+ }, Mr = {
4044
4065
  local_address: null,
4045
4066
  remote_address: null,
4046
4067
  transport: null
4047
- }, Mr = class {
4068
+ }, Nr = class {
4048
4069
  constructor(e) {
4049
4070
  h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_gatheringStartedAt", 0), h(this, "_remoteSdpReceivedAt", 0), h(this, "_handleGatheringStateChange", () => {
4050
4071
  this._pc?.iceGatheringState === "gathering" && (this._gatheringStartedAt = Date.now());
@@ -4061,11 +4082,11 @@ var G = {
4061
4082
  name: U.SDP_GENERATED,
4062
4083
  value: 0,
4063
4084
  string_value: e,
4064
- ...jr
4085
+ ...Mr
4065
4086
  });
4066
4087
  }
4067
4088
  logCandidateGenerated(e) {
4068
- let t = Pr(e.candidate);
4089
+ let t = Fr(e.candidate);
4069
4090
  t && this._log({
4070
4091
  name: U.SDP_GENERATED,
4071
4092
  value: Math.max(0, Date.now() - this._gatheringStartedAt),
@@ -4080,11 +4101,11 @@ var G = {
4080
4101
  name: U.SDP_RECEIVED,
4081
4102
  value: 0,
4082
4103
  string_value: e,
4083
- ...jr
4104
+ ...Mr
4084
4105
  });
4085
4106
  }
4086
4107
  logCandidateReceived(e) {
4087
- let t = Pr(e.candidate);
4108
+ let t = Fr(e.candidate);
4088
4109
  t && this._log({
4089
4110
  name: U.SDP_RECEIVED,
4090
4111
  value: this._remoteSdpReceivedAt > 0 ? Math.max(0, Date.now() - this._remoteSdpReceivedAt) : 0,
@@ -4095,17 +4116,17 @@ var G = {
4095
4116
  });
4096
4117
  }
4097
4118
  logCreateFailed(e, t) {
4098
- let n = Or[e];
4119
+ let n = kr[e];
4099
4120
  n && this._logFailure(n, t, { remote: e === "answer" ? this._pc?.remoteDescription : void 0 });
4100
4121
  }
4101
4122
  logSetLocalFailed(e, t) {
4102
- this._logFailure(kr[e.type], t, {
4123
+ this._logFailure(Ar[e.type], t, {
4103
4124
  local: e,
4104
4125
  remote: this._pc?.remoteDescription
4105
4126
  });
4106
4127
  }
4107
4128
  logSetRemoteFailed(e, t) {
4108
- this._logFailure(Ar[e.type], t, {
4129
+ this._logFailure(jr[e.type], t, {
4109
4130
  local: this._pc?.localDescription,
4110
4131
  remote: e
4111
4132
  });
@@ -4118,60 +4139,60 @@ var G = {
4118
4139
  name: e,
4119
4140
  string_value: JSON.stringify({
4120
4141
  error: t instanceof Error ? t.message : String(t),
4121
- local: Nr(n.local),
4122
- remote: Nr(n.remote)
4142
+ local: Pr(n.local),
4143
+ remote: Pr(n.remote)
4123
4144
  }),
4124
- ...jr
4145
+ ...Mr
4125
4146
  });
4126
4147
  }
4127
4148
  _log(e) {
4128
4149
  this._statAggregator?.logEventualStat(e);
4129
4150
  }
4130
4151
  };
4131
- function Nr(e) {
4152
+ function Pr(e) {
4132
4153
  return e ? {
4133
4154
  type: e.type,
4134
4155
  sdp: e.sdp
4135
4156
  } : void 0;
4136
4157
  }
4137
- function Pr(e) {
4158
+ function Fr(e) {
4138
4159
  let t = e?.split(" ") ?? [], n = t.indexOf("typ"), r = t[2]?.toLowerCase(), i = t[4], a = n === -1 ? void 0 : t[n + 1];
4139
- return r === void 0 || i === void 0 || a === void 0 || !Lr(i) ? null : {
4160
+ return r === void 0 || i === void 0 || a === void 0 || !Rr(i) ? null : {
4140
4161
  protocol: r,
4141
4162
  address: i,
4142
4163
  type: a
4143
4164
  };
4144
4165
  }
4145
- var Fr = /^\d{1,3}(\.\d{1,3}){3}$/, Ir = /^[0-9a-f:]+$/i;
4146
- function Lr(e) {
4147
- return Fr.test(e) || e.includes(":") && Ir.test(e);
4166
+ var Ir = /^\d{1,3}(\.\d{1,3}){3}$/, Lr = /^[0-9a-f:]+$/i;
4167
+ function Rr(e) {
4168
+ return Ir.test(e) || e.includes(":") && Lr.test(e);
4148
4169
  }
4149
4170
  //#endregion
4150
4171
  //#region src/enums/TransportTopology.ts
4151
4172
  var J = /* @__PURE__ */ function(e) {
4152
4173
  return e.DIRECT = "DIRECT", e.SERVER = "SERVER", e;
4153
- }(J || {}), Rr = /* @__PURE__ */ function(e) {
4174
+ }(J || {}), zr = /* @__PURE__ */ function(e) {
4154
4175
  return e.producerNotification = "producerNotification", e.producerCommand = "producerCommand", e.consumerScreenShare = "consumerScreenShare", e.producerScreenShare = "producerScreenShare", e.asr = "asr", e.animoji = "animoji", e;
4155
- }(Rr || {}), { isObject: zr, isObjectsEquals: Br } = M;
4156
- function Vr(e, t) {
4157
- return e === null || t === null ? e === null && t === null : e.maxDimension !== t.maxDimension || e.maxBitrateK !== t.maxBitrateK || e.maxFramerate !== t.maxFramerate || e.degradationPreference !== t.degradationPreference || e.scalabilityMode !== t.scalabilityMode || zr(e.bitrates) && zr(t.bitrates) && !Br(e.bitrates, t.bitrates, !0) ? !1 : e.bitrates === t.bitrates;
4176
+ }(zr || {}), { isObject: Br, isObjectsEquals: Vr } = M;
4177
+ function Hr(e, t) {
4178
+ return e === null || t === null ? e === null && t === null : e.maxDimension !== t.maxDimension || e.maxBitrateK !== t.maxBitrateK || e.maxFramerate !== t.maxFramerate || e.degradationPreference !== t.degradationPreference || e.scalabilityMode !== t.scalabilityMode || Br(e.bitrates) && Br(t.bitrates) && !Vr(e.bitrates, t.bitrates, !0) ? !1 : e.bitrates === t.bitrates;
4158
4179
  }
4159
- var Hr = /* @__PURE__ */ function(e) {
4180
+ var Ur = /* @__PURE__ */ function(e) {
4160
4181
  return e.L1T1 = "L1T1", e.L1T2 = "L1T2", e.L1T3 = "L1T3", e;
4161
4182
  }({});
4162
4183
  //#endregion
4163
4184
  //#region src/types/ServerSettings.ts
4164
- function Ur(e, t) {
4165
- return !(!Vr(e.camera, t.camera) || !Vr(e.screenSharing, t.screenSharing) || !Vr(e.fastScreenSharing, t.fastScreenSharing));
4166
- }
4167
4185
  function Wr(e, t) {
4186
+ return !(!Hr(e.camera, t.camera) || !Hr(e.screenSharing, t.screenSharing) || !Hr(e.fastScreenSharing, t.fastScreenSharing));
4187
+ }
4188
+ function Gr(e, t) {
4168
4189
  return {
4169
4190
  camera: Object.assign({}, e.camera, t.camera),
4170
4191
  screenSharing: Object.assign({}, e.screenSharing, t.screenSharing),
4171
4192
  fastScreenSharing: Object.assign({}, e.fastScreenSharing, t.fastScreenSharing)
4172
4193
  };
4173
4194
  }
4174
- function Gr() {
4195
+ function Kr() {
4175
4196
  return {
4176
4197
  camera: null,
4177
4198
  screenSharing: null,
@@ -4180,14 +4201,14 @@ function Gr() {
4180
4201
  }
4181
4202
  //#endregion
4182
4203
  //#region src/classes/stat/PeerConnectionStats.ts
4183
- var Kr = /[?&]transport=(tcp|udp)/i, qr = {
4204
+ var qr = /[?&]transport=(tcp|udp)/i, Jr = {
4184
4205
  stable: "stable",
4185
4206
  "have-local-offer": "have.local.offer",
4186
4207
  "have-local-pranswer": "have.local.answer",
4187
4208
  "have-remote-offer": "have.remote.offer",
4188
4209
  "have-remote-pranswer": "have.remote.answer",
4189
4210
  closed: "closed"
4190
- }, Jr = class {
4211
+ }, Yr = class {
4191
4212
  constructor(e) {
4192
4213
  h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_lastSignalingStateChange", 0), h(this, "_lastGatheringStateChange", 0), h(this, "_lastConnectionState", null), h(this, "_handleConnectionStateChange", () => {
4193
4214
  this._pc && this._logConnectionState(this._pc.connectionState);
@@ -4196,7 +4217,7 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
4196
4217
  this._log({
4197
4218
  name: U.SIGNALING_STATE_CHANGED,
4198
4219
  value: this._sinceLastChange("_lastSignalingStateChange"),
4199
- string_value: e ? qr[e] : void 0
4220
+ string_value: e ? Jr[e] : void 0
4200
4221
  });
4201
4222
  }), h(this, "_handleGatheringStateChange", () => {
4202
4223
  let e = this._pc?.iceGatheringState, t = this._sinceLastChange("_lastGatheringStateChange");
@@ -4214,7 +4235,7 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
4214
4235
  string_value: t.errorText,
4215
4236
  local_address: t.address ?? "",
4216
4237
  remote_url: t.url,
4217
- transport: Kr.exec(t.url ?? "")?.[1]?.toLowerCase() ?? null
4238
+ transport: qr.exec(t.url ?? "")?.[1]?.toLowerCase() ?? null
4218
4239
  });
4219
4240
  }), this._statAggregator = e;
4220
4241
  }
@@ -4248,11 +4269,11 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
4248
4269
  _log(e) {
4249
4270
  this._statAggregator?.logEventualStat(e);
4250
4271
  }
4251
- }, Yr = /* @__PURE__ */ function(e) {
4272
+ }, Xr = /* @__PURE__ */ function(e) {
4252
4273
  return e.NO_CONNECTION_TIMEOUT = "no_connection_timeout", e.CONNECTION_FAILED = "connection_failed", e.SUCCESS_CONNECTION = "success_connection", e.NO_DATA_TIMEOUT = "no_data_timeout", e.SUCCESS_AUDIO = "success_audio", e.CONNECTION_ACCEPTED_FAILED = "connection_accepted_failed", e;
4253
- }({}), Xr = /* @__PURE__ */ function(e) {
4274
+ }({}), Zr = /* @__PURE__ */ function(e) {
4254
4275
  return e.GOOD = "good", e.BAD_1 = "bad_1", e.BAD_2 = "bad_2", e;
4255
- }({}), Zr = class {
4276
+ }({}), Qr = class {
4256
4277
  constructor(e) {
4257
4278
  h(this, "_statAggregator", void 0), this._statAggregator = e;
4258
4279
  }
@@ -4277,13 +4298,13 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
4277
4298
  })
4278
4299
  });
4279
4300
  }
4280
- }, Qr = 200;
4281
- function $r(e) {
4301
+ }, $r = 200;
4302
+ function ei(e) {
4282
4303
  for (let t of e.values()) if (t.type === "outbound-rtp" && (t.packetsSent ?? 0) > 0) return !0;
4283
4304
  return !1;
4284
4305
  }
4285
- var ei = class {
4286
- constructor(e, t, n = Qr) {
4306
+ var ti = class {
4307
+ constructor(e, t, n = $r) {
4287
4308
  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;
4288
4309
  }
4289
4310
  start() {
@@ -4306,7 +4327,7 @@ var ei = class {
4306
4327
  try {
4307
4328
  let e = await this._getStatsReports();
4308
4329
  if (this._state !== "polling") return;
4309
- if (e.some($r)) {
4330
+ if (e.some(ei)) {
4310
4331
  this._state = "stopped", this._onFirstMediaSent();
4311
4332
  return;
4312
4333
  }
@@ -4319,7 +4340,7 @@ var ei = class {
4319
4340
  this._timer = null, this._poll();
4320
4341
  }, this._pollIntervalMs));
4321
4342
  }
4322
- }, ti = class extends Ye {
4343
+ }, ni = class extends Ye {
4323
4344
  constructor(e, t, n = null) {
4324
4345
  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;
4325
4346
  }
@@ -4330,12 +4351,12 @@ var ei = class {
4330
4351
  this._firstMediaSentProbeStopped = !0, this._disposeFirstMediaSentProbe();
4331
4352
  }
4332
4353
  _startFirstMediaSentProbe() {
4333
- this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new ei(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
4354
+ this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new ti(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
4334
4355
  }
4335
4356
  _disposeFirstMediaSentProbe() {
4336
4357
  this._firstMediaSentProbe?.destroy(), this._firstMediaSentProbe = null;
4337
4358
  }
4338
- }, ni = class {
4359
+ }, ri = class {
4339
4360
  constructor(e, t = null) {
4340
4361
  h(this, "weightUp", void 0), h(this, "weightDown", void 0), h(this, "value", NaN), this.weightUp = e, this.weightDown = t ?? e;
4341
4362
  }
@@ -4353,7 +4374,7 @@ var ei = class {
4353
4374
  getValue() {
4354
4375
  return this.value;
4355
4376
  }
4356
- }, ri = .25, ii = .35, ai = 85, oi = .1, si = 1.5, ci = .1, li = 1, ui = .6, di = .3, fi = class extends Ye {
4377
+ }, ii = .25, ai = .35, oi = 85, si = .1, ci = 1.5, li = .1, ui = 1, di = .6, fi = .3, pi = class extends Ye {
4357
4378
  constructor(e, t = z) {
4358
4379
  super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
4359
4380
  badNet: {
@@ -4365,8 +4386,8 @@ var ei = class {
4365
4386
  rtt: 600
4366
4387
  }
4367
4388
  }), h(this, "_lastStatSentTimestamp", 0), h(this, "_currentState", "good"), h(this, "_debug", void 0), this._debug = t, this._signaling = e, this._localNetworkStat = {
4368
- rtt: new ni(ri, ri),
4369
- loss: new ni(ii, ii),
4389
+ rtt: new ri(ii, ii),
4390
+ loss: new ri(ai, ai),
4370
4391
  bitrate: 0
4371
4392
  }, this._remoteNetworkStat = {
4372
4393
  rtt: 0,
@@ -4381,20 +4402,20 @@ var ei = class {
4381
4402
  _calcRttRating(e) {
4382
4403
  let t = typeof e == "number" ? e : e.getValue(), n = 1;
4383
4404
  if (isNaN(t)) return n;
4384
- let r = Math.round((t - this._networkLimits.goodNet.rtt) / ai);
4385
- for (let e = 0; e < r; e++) n *= 1 - oi;
4405
+ let r = Math.round((t - this._networkLimits.goodNet.rtt) / oi);
4406
+ for (let e = 0; e < r; e++) n *= 1 - si;
4386
4407
  return n;
4387
4408
  }
4388
4409
  _calcLossRating(e) {
4389
4410
  let t = typeof e == "number" ? e : e.getValue(), n = 1;
4390
4411
  if (isNaN(t)) return n;
4391
- let r = Math.round((t - this._networkLimits.goodNet.loss) / si);
4392
- for (let e = 0; e < r; e++) n *= 1 - ci;
4412
+ let r = Math.round((t - this._networkLimits.goodNet.loss) / ci);
4413
+ for (let e = 0; e < r; e++) n *= 1 - li;
4393
4414
  return n;
4394
4415
  }
4395
4416
  _calcBitrateRating(e, t) {
4396
4417
  if (!e || !t) return 1;
4397
- let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * li;
4418
+ let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * ui;
4398
4419
  return Math.min(n, 1);
4399
4420
  }
4400
4421
  _calcUDPRating({ rtt: e, loss: t }) {
@@ -4404,7 +4425,7 @@ var ei = class {
4404
4425
  return n ? this._calcBitrateRating(e.bitrate, t.bitrate) : this._calcUDPRating(e) * this._calcUDPRating(t);
4405
4426
  }
4406
4427
  _getNetworkState(e) {
4407
- return isNaN(e) || e >= ui ? "good" : e >= di ? "medium" : "bad";
4428
+ return isNaN(e) || e >= di ? "good" : e >= fi ? "medium" : "bad";
4408
4429
  }
4409
4430
  updateSettings(e) {
4410
4431
  Object.assign(this._networkLimits.badNet, e?.badNet || {}), Object.assign(this._networkLimits.goodNet, e?.goodNet || {});
@@ -4428,7 +4449,7 @@ var ei = class {
4428
4449
  let { rtt: t, loss: n, bitrate: r } = e || {};
4429
4450
  this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
4430
4451
  }
4431
- }, pi = 30 * 1e3, mi = class e extends ti {
4452
+ }, mi = 30 * 1e3, hi = class e extends ni {
4432
4453
  constructor(e, t, n, r, i, a = z, o = null, s = null, c = null, l = null) {
4433
4454
  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, "_connectionStartedAt", 0), h(this, "_connectionLostAt", 0), h(this, "_serverRequestedOnNoConnection", !1), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_networkLimitsForVideo", {
4434
4455
  bad: {
@@ -4443,7 +4464,7 @@ var ei = class {
4443
4464
  worst: 320,
4444
4465
  bad: 640,
4445
4466
  good: 1280
4446
- }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ua(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new fi(n, this._debug), this._sdpStats = new Mr(this._statAggregator), this._peerConnectionStats = new Jr(this._statAggregator), this._networkAdaptationStats = new Zr(this._statAggregator), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
4467
+ }), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ua(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new pi(n, this._debug), this._sdpStats = new Nr(this._statAggregator), this._peerConnectionStats = new Yr(this._statAggregator), this._networkAdaptationStats = new Qr(this._statAggregator), this.subscribe(this._signaling, Tr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Zt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
4447
4468
  try {
4448
4469
  this._pc = this._createPeerConnection();
4449
4470
  } catch (e) {
@@ -4506,7 +4527,7 @@ var ei = class {
4506
4527
  this._remoteSDP = {}, this._remoteCandidates = {};
4507
4528
  }
4508
4529
  updateSettings(e) {
4509
- Ur(e, this._serverSettings) || (this._serverSettings = e, this._applySettings());
4530
+ Wr(e, this._serverSettings) || (this._serverSettings = e, this._applySettings());
4510
4531
  }
4511
4532
  preventRestart() {
4512
4533
  this._reconnectionPrevented = !0;
@@ -4547,7 +4568,7 @@ var ei = class {
4547
4568
  iceServers: N.iceServers,
4548
4569
  iceTransportPolicy: N.forceRelayPolicy ? "relay" : "all"
4549
4570
  });
4550
- 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._peerConnectionStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, Rr.animoji, (e) => {
4571
+ 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._peerConnectionStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, zr.animoji, (e) => {
4551
4572
  this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(this._animojiDataChannel), this._animojiSender?.setDataChannel(this._animojiDataChannel);
4552
4573
  }), e;
4553
4574
  }
@@ -4688,7 +4709,7 @@ var ei = class {
4688
4709
  }
4689
4710
  }
4690
4711
  _markConnected() {
4691
- this._serverRequestedOnNoConnection && (this._networkAdaptationStats.logServerTopologyRequested(Yr.SUCCESS_CONNECTION, Date.now() - this._connectionStartedAt), this._serverRequestedOnNoConnection = !1), this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
4712
+ this._serverRequestedOnNoConnection && (this._networkAdaptationStats.logServerTopologyRequested(Xr.SUCCESS_CONNECTION, Date.now() - this._connectionStartedAt), this._serverRequestedOnNoConnection = !1), this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
4692
4713
  e?.local && (this._logger?.log(x.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
4693
4714
  }), this._startStatInterval();
4694
4715
  }
@@ -4708,15 +4729,15 @@ var ei = class {
4708
4729
  }
4709
4730
  _startReconnection() {
4710
4731
  this._reconnectionTimeout || this._iceRestartTimeout || (this._debug.log("Waiting for reconnection...", { participantId: this._participantId }), this._connectionLostAt = Date.now(), this._reconnectionTimeout = window.setTimeout(() => {
4711
- this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch({ reason: Yr.NO_CONNECTION_TIMEOUT }) : this._startIceRestart();
4732
+ this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch({ reason: Xr.NO_CONNECTION_TIMEOUT }) : this._startIceRestart();
4712
4733
  }, N.transportConnectionWaitTime));
4713
4734
  }
4714
4735
  _requestTopologySwitch({ reason: e, fromAnySide: t = !1 }) {
4715
4736
  if ((this._isMaster || t) && this._signaling.ready) {
4716
4737
  this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId });
4717
- let t = e === Yr.CONNECTION_FAILED ? this._connectionLostAt : this._connectionStartedAt;
4718
- this._networkAdaptationStats.logServerTopologyRequested(e, Date.now() - t), e === Yr.NO_CONNECTION_TIMEOUT && (this._serverRequestedOnNoConnection = !0), this._signaling.switchTopology(J.SERVER).catch((e) => {
4719
- e instanceof kn || this._debug.warn("Unable to switch topology DIRECT to SERVER", e);
4738
+ let t = e === Xr.CONNECTION_FAILED ? this._connectionLostAt : this._connectionStartedAt;
4739
+ this._networkAdaptationStats.logServerTopologyRequested(e, Date.now() - t), e === Xr.NO_CONNECTION_TIMEOUT && (this._serverRequestedOnNoConnection = !0), this._signaling.switchTopology(J.SERVER).catch((e) => {
4740
+ e instanceof An || this._debug.warn("Unable to switch topology DIRECT to SERVER", e);
4720
4741
  });
4721
4742
  }
4722
4743
  }
@@ -4726,7 +4747,7 @@ var ei = class {
4726
4747
  _startIceRestart() {
4727
4748
  this._isMaster ? (this._peerConnectionStats.logIceRestart(), this._logger?.log(x.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(() => {
4728
4749
  this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(x.ERROR, "iceRestart-direct"), this._requestTopologySwitch({
4729
- reason: Yr.CONNECTION_FAILED,
4750
+ reason: Xr.CONNECTION_FAILED,
4730
4751
  fromAnySide: N.switchTopologyOnReconnectFromAnySide
4731
4752
  });
4732
4753
  }, N.iceRestartWaitTime);
@@ -4848,8 +4869,8 @@ var ei = class {
4848
4869
  }
4849
4870
  async _checkPPTNetwork(e) {
4850
4871
  if (!N.switchVideoAtBadNetwork || !e.inbound.transport.averageNetStat) return;
4851
- 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 = Hr.L1T1, s = Xr.GOOD;
4852
- if (r ? (this._lastBadConnection = Date.now(), i ? (s = Xr.BAD_1, a = this._videoMaxDimensionsForNet.bad, o = Hr.L1T2) : (s = Xr.BAD_2, a = this._videoMaxDimensionsForNet.worst, o = Hr.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Hr.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > pi) || this._lastVideoMaxDimension === a) return;
4872
+ 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 = Ur.L1T1, s = Zr.GOOD;
4873
+ if (r ? (this._lastBadConnection = Date.now(), i ? (s = Zr.BAD_1, a = this._videoMaxDimensionsForNet.bad, o = Ur.L1T2) : (s = Zr.BAD_2, a = this._videoMaxDimensionsForNet.worst, o = Ur.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Ur.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > mi) || this._lastVideoMaxDimension === a) return;
4853
4874
  let c = this._serverSettings.camera;
4854
4875
  if (!c || !await this._isSVCSupported(e, o)) return;
4855
4876
  this._debug.debug("Switch outbound video frame size and scalabilityMode", {
@@ -4922,9 +4943,9 @@ var ei = class {
4922
4943
  }, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
4923
4944
  };
4924
4945
  }
4925
- }, hi = /* @__PURE__ */ function(e) {
4946
+ }, gi = /* @__PURE__ */ function(e) {
4926
4947
  return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
4927
- }({}), gi = 16, _i = class e {
4948
+ }({}), _i = 16, vi = class e {
4928
4949
  constructor(e, t, n, r = z) {
4929
4950
  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);
4930
4951
  }
@@ -4938,7 +4959,7 @@ var ei = class {
4938
4959
  ssrc: a,
4939
4960
  timestamp: o,
4940
4961
  duration: s,
4941
- data: e.slice(gi)
4962
+ data: e.slice(_i)
4942
4963
  };
4943
4964
  }
4944
4965
  _onDataChannelMessage(t) {
@@ -4958,7 +4979,7 @@ var ei = class {
4958
4979
  destroy() {
4959
4980
  this._datachannel.onmessage = null;
4960
4981
  }
4961
- }, vi, yi = class {
4982
+ }, yi, bi = class {
4962
4983
  constructor() {
4963
4984
  h(this, "_value", 1);
4964
4985
  }
@@ -4969,10 +4990,10 @@ var ei = class {
4969
4990
  this._value = e;
4970
4991
  }
4971
4992
  };
4972
- vi = yi, h(yi, "_instance", null), h(yi, "getInstance", () => (vi._instance || (vi._instance = new vi()), vi._instance));
4993
+ yi = bi, h(bi, "_instance", null), h(bi, "getInstance", () => (yi._instance || (yi._instance = new yi()), yi._instance));
4973
4994
  //#endregion
4974
4995
  //#region src/classes/ParticipantIdRegistry.ts
4975
- var bi = class {
4996
+ var xi = class {
4976
4997
  constructor(e = z) {
4977
4998
  h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
4978
4999
  }
@@ -4988,7 +5009,7 @@ var bi = class {
4988
5009
  case 1:
4989
5010
  let e = s(r);
4990
5011
  return Object.entries(e).forEach(([e, t]) => {
4991
- let n = Rn(e);
5012
+ let n = zn(e);
4992
5013
  this.streamDescriptionByCompactId.set(t, n), this.compactIdByStreamDescription.set(e, t);
4993
5014
  }), null;
4994
5015
  case 2:
@@ -5088,7 +5109,7 @@ var bi = class {
5088
5109
  this._debug.error("unexpected null sequenceNumber", e, r);
5089
5110
  continue;
5090
5111
  }
5091
- let l = hi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
5112
+ let l = gi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
5092
5113
  n.push({
5093
5114
  participantStreamDescription: c,
5094
5115
  streamId: l,
@@ -5104,9 +5125,9 @@ var bi = class {
5104
5125
  participantUpdateInfos: n
5105
5126
  };
5106
5127
  }
5107
- }, xi = /* @__PURE__ */ function(e) {
5128
+ }, Si = /* @__PURE__ */ function(e) {
5108
5129
  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;
5109
- }({}), Si = class {
5130
+ }({}), Ci = class {
5110
5131
  constructor(e = z, t = null) {
5111
5132
  h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
5112
5133
  }
@@ -5122,7 +5143,7 @@ var bi = class {
5122
5143
  return;
5123
5144
  }
5124
5145
  t({
5125
- type: xi.FRAME,
5146
+ type: Si.FRAME,
5126
5147
  error: e
5127
5148
  });
5128
5149
  };
@@ -5132,23 +5153,23 @@ var bi = class {
5132
5153
  e.preventDefault?.(), m(this._formatWorkerMessageError(e));
5133
5154
  }, f.onmessage = (e) => {
5134
5155
  switch (e.data.type) {
5135
- case xi.READY:
5156
+ case Si.READY:
5136
5157
  s = !0, c || (c = !0, a());
5137
5158
  break;
5138
- case xi.ERROR:
5159
+ case Si.ERROR:
5139
5160
  s ? m(e.data.error) : p(e.data.error);
5140
5161
  break;
5141
- case xi.FRAME:
5162
+ case Si.FRAME:
5142
5163
  t(e.data);
5143
5164
  break;
5144
- case xi.DEBUG:
5165
+ case Si.DEBUG:
5145
5166
  this._debug.debug(e.data.message);
5146
5167
  break;
5147
- case xi.LOG_ERROR:
5168
+ case Si.LOG_ERROR:
5148
5169
  this._logger?.log(x.ERROR, e.data.message);
5149
5170
  break;
5150
5171
  }
5151
- }, this._sendToWorker(xi.INIT, r, i);
5172
+ }, this._sendToWorker(Si.INIT, r, i);
5152
5173
  });
5153
5174
  }
5154
5175
  _removeWorker() {
@@ -5171,7 +5192,7 @@ var bi = class {
5171
5192
  static isBrowserSupported() {
5172
5193
  throw Error("Not implemented");
5173
5194
  }
5174
- }, Ci = class extends Si {
5195
+ }, wi = class extends Ci {
5175
5196
  constructor(e = z, t = null) {
5176
5197
  super(e, t);
5177
5198
  }
@@ -5181,7 +5202,7 @@ var bi = class {
5181
5202
  }, [c, c.getUrl]);
5182
5203
  }
5183
5204
  decodeFrame(e, t, n, r) {
5184
- this._sendToWorker(xi.FRAME, {
5205
+ this._sendToWorker(Si.FRAME, {
5185
5206
  timestamp: e,
5186
5207
  data: t.buffer,
5187
5208
  isVP9: n,
@@ -5195,7 +5216,7 @@ var bi = class {
5195
5216
  static isBrowserSupported() {
5196
5217
  return "WebAssembly" in window && "Worker" in window;
5197
5218
  }
5198
- }, wi = class extends Si {
5219
+ }, Ti = class extends Ci {
5199
5220
  constructor(e = z, t = null) {
5200
5221
  super(e, t);
5201
5222
  }
@@ -5205,7 +5226,7 @@ var bi = class {
5205
5226
  }, [!0]);
5206
5227
  }
5207
5228
  decodeFrame(e, t, n, r = !1) {
5208
- this._sendToWorker(xi.FRAME, {
5229
+ this._sendToWorker(Si.FRAME, {
5209
5230
  timestamp: e,
5210
5231
  data: t.buffer,
5211
5232
  isVP9: n,
@@ -5218,7 +5239,7 @@ var bi = class {
5218
5239
  static isBrowserSupported() {
5219
5240
  return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !C.isBrokenVP9Decoder() && C.browserName() !== "Firefox";
5220
5241
  }
5221
- }, Ti = class {
5242
+ }, Ei = class {
5222
5243
  constructor(e = null, t = 0) {
5223
5244
  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));
5224
5245
  }
@@ -5232,7 +5253,7 @@ var bi = class {
5232
5253
  destroy() {
5233
5254
  window.clearInterval(this._interval), this._interval = 0;
5234
5255
  }
5235
- }, Ei = class {
5256
+ }, Di = class {
5236
5257
  constructor(e, t) {
5237
5258
  h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
5238
5259
  }
@@ -5247,14 +5268,14 @@ var bi = class {
5247
5268
  height: t
5248
5269
  });
5249
5270
  }
5250
- }, Di = 65536, Oi = "MARK_SCREENSHARE_FREEZE_DURATION", ki = class e {
5271
+ }, Oi = 65536, ki = "MARK_SCREENSHARE_FREEZE_DURATION", Ai = class e {
5251
5272
  constructor(e, t, n, r, i, a = z) {
5252
- 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 Ei(e, r), this._debug = a;
5273
+ 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 Di(e, r), this._debug = a;
5253
5274
  }
5254
5275
  appendChunk(t) {
5255
5276
  let n = this._chunks.length;
5256
5277
  if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
5257
- else if (!n || (this._chunks[n - 1].sequence + 1) % Di !== t.sequence) {
5278
+ else if (!n || (this._chunks[n - 1].sequence + 1) % Oi !== t.sequence) {
5258
5279
  this._debug.warn("[FrameBuilder] Got incorrect chunk");
5259
5280
  return;
5260
5281
  }
@@ -5271,7 +5292,7 @@ var bi = class {
5271
5292
  }
5272
5293
  }
5273
5294
  destroy() {
5274
- G.clearMark(Oi), G.clearMark(G.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
5295
+ G.clearMark(ki), G.clearMark(G.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
5275
5296
  }
5276
5297
  _processFrameData() {
5277
5298
  let e = this._chunks;
@@ -5294,13 +5315,13 @@ var bi = class {
5294
5315
  }
5295
5316
  _measureFreezeDuration(e) {
5296
5317
  if (e) {
5297
- G.setMark(Oi);
5318
+ G.setMark(ki);
5298
5319
  return;
5299
5320
  }
5300
- let t = G.measureMark(Oi);
5321
+ let t = G.measureMark(ki);
5301
5322
  t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
5302
5323
  }
5303
- }, Ai = class {
5324
+ }, ji = class {
5304
5325
  constructor(e) {
5305
5326
  h(this, "_onStream", void 0), this._onStream = e;
5306
5327
  }
@@ -5313,7 +5334,7 @@ var bi = class {
5313
5334
  static isBrowserSupported() {
5314
5335
  throw Error("Method `isBrowserSupported` is not implemented");
5315
5336
  }
5316
- }, ji = class extends Ai {
5337
+ }, Mi = class extends ji {
5317
5338
  constructor(e, t = z) {
5318
5339
  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;
5319
5340
  }
@@ -5373,7 +5394,7 @@ var bi = class {
5373
5394
  static isBrowserSupported() {
5374
5395
  return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(C.browserName() === "Safari" && Number(C.browserVersion()) === 15);
5375
5396
  }
5376
- }, Mi = class extends Ai {
5397
+ }, Ni = class extends ji {
5377
5398
  constructor(e, t = z) {
5378
5399
  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);
5379
5400
  }
@@ -5384,9 +5405,9 @@ var bi = class {
5384
5405
  this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
5385
5406
  }
5386
5407
  static isBrowserSupported() {
5387
- return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && wi.isBrowserSupported();
5408
+ return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && Ti.isBrowserSupported();
5388
5409
  }
5389
- }, Ni = class extends ki {
5410
+ }, Pi = class extends Ai {
5390
5411
  constructor(e, t, n, r, i, a = z, o = null) {
5391
5412
  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();
5392
5413
  }
@@ -5394,16 +5415,16 @@ var bi = class {
5394
5415
  e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
5395
5416
  }
5396
5417
  _initFpsMeter() {
5397
- this._fpsMeter = new Ti((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
5418
+ this._fpsMeter = new Ei((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
5398
5419
  }
5399
5420
  _initRenderer(e = !1) {
5400
- e || !Mi.isBrowserSupported() ? this._renderer = new ji(this._onStream, this._debug) : this._renderer = new Mi(this._onStream, this._debug);
5421
+ e || !Ni.isBrowserSupported() ? this._renderer = new Mi(this._onStream, this._debug) : this._renderer = new Ni(this._onStream, this._debug);
5401
5422
  }
5402
5423
  _initDecoder(e = !1) {
5403
- e || !wi.isBrowserSupported() ? this._decoder = new Ci(this._debug, this._logger) : this._decoder = new wi(this._debug, this._logger), this._decoder.init(async (e) => {
5424
+ e || !Ti.isBrowserSupported() ? this._decoder = new wi(this._debug, this._logger) : this._decoder = new Ti(this._debug, this._logger), this._decoder.init(async (e) => {
5404
5425
  this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
5405
5426
  }, (e) => {
5406
- if (this._decoderBusy = !1, this._decoder instanceof wi && typeof e == "string" && e.includes("EncodingError")) {
5427
+ if (this._decoderBusy = !1, this._decoder instanceof Ti && typeof e == "string" && e.includes("EncodingError")) {
5407
5428
  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();
5408
5429
  return;
5409
5430
  }
@@ -5411,7 +5432,7 @@ var bi = class {
5411
5432
  }, this._onKeyFrameRequested).then(() => {
5412
5433
  this._decoderReady = !0, this._decodeQueue();
5413
5434
  }).catch((e) => {
5414
- this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof wi && this._switchToLibVPXDecoder();
5435
+ this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof Ti && this._switchToLibVPXDecoder();
5415
5436
  });
5416
5437
  }
5417
5438
  _switchToLibVPXDecoder() {
@@ -5426,20 +5447,20 @@ var bi = class {
5426
5447
  super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
5427
5448
  }
5428
5449
  static isBrowserSupported() {
5429
- return ji.isBrowserSupported() || Mi.isBrowserSupported();
5450
+ return Mi.isBrowserSupported() || Ni.isBrowserSupported();
5430
5451
  }
5431
- }, Pi = 1, Fi = 1, Ii = 2, Li = 0, Ri = 1, zi = 2, Bi = 4, Vi = 8;
5432
- function Hi(e, t, n, r, i, a, o) {
5452
+ }, Fi = 1, Ii = 1, Li = 2, Ri = 0, zi = 1, Bi = 2, Vi = 4, Hi = 8;
5453
+ function Ui(e, t, n, r, i, a, o) {
5433
5454
  let s = 0;
5434
- t && (s |= Ri), n && (s |= zi), r && (s |= Bi), o || (s |= Vi);
5455
+ t && (s |= zi), n && (s |= Bi), r && (s |= Vi), o || (s |= Hi);
5435
5456
  let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
5436
- if (l.setUint8(0, Pi), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, Li), l.setUint8(10, s), !o) return c;
5457
+ if (l.setUint8(0, Fi), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, Ri), l.setUint8(10, s), !o) return c;
5437
5458
  let u = new Uint8Array(c.byteLength + o.byteLength);
5438
5459
  return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
5439
5460
  }
5440
- function Ui(e) {
5441
- 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 & Ri), l = !!(s & zi), u = !!(s & Bi), d = !!(s & Vi);
5442
- if (n !== Pi) throw Error(`Unexpected protocol version. Got ${n}, expected ${Pi}`);
5461
+ function Wi(e) {
5462
+ 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 & zi), l = !!(s & Bi), u = !!(s & Vi), d = !!(s & Hi);
5463
+ if (n !== Fi) throw Error(`Unexpected protocol version. Got ${n}, expected ${Fi}`);
5443
5464
  return {
5444
5465
  timestamp: i,
5445
5466
  start: c,
@@ -5452,26 +5473,26 @@ function Ui(e) {
5452
5473
  data: e.slice(11)
5453
5474
  };
5454
5475
  }
5455
- function Wi(e) {
5476
+ function Gi(e) {
5456
5477
  if (!e || !e.byteLength || e.byteLength !== 4) return !1;
5457
5478
  let t = new DataView(e);
5458
- return !(t.getUint8(0) !== Pi || t.getUint8(1) !== Fi || t.getUint16(2) !== Li);
5479
+ return !(t.getUint8(0) !== Fi || t.getUint8(1) !== Ii || t.getUint16(2) !== Ri);
5459
5480
  }
5460
- function Gi(e) {
5481
+ function Ki(e) {
5461
5482
  if (!e || !e.byteLength || e.byteLength !== 10) return null;
5462
5483
  let t = new DataView(e);
5463
- return t.getUint8(0) !== Pi || t.getUint8(1) !== Ii || t.getUint16(2) !== Li ? null : {
5484
+ return t.getUint8(0) !== Fi || t.getUint8(1) !== Li || t.getUint16(2) !== Ri ? null : {
5464
5485
  seq: t.getUint16(4),
5465
5486
  ts2: t.getUint32(6)
5466
5487
  };
5467
5488
  }
5468
- function Ki(e) {
5489
+ function qi(e) {
5469
5490
  let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
5470
- return n.setUint8(0, Pi), n.setUint8(1, Fi), n.setUint16(2, e), t;
5491
+ return n.setUint8(0, Fi), n.setUint8(1, Ii), n.setUint16(2, e), t;
5471
5492
  }
5472
5493
  //#endregion
5473
5494
  //#region src/classes/screenshare/WebmBuilder.ts
5474
- var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5495
+ var Ji = 2 ** 15 - 1, Yi = 1, Xi = 5, Zi = 5, Qi = class e {
5475
5496
  constructor(e, t = z) {
5476
5497
  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;
5477
5498
  let n = () => {
@@ -5514,8 +5535,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5514
5535
  this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
5515
5536
  let e = this._sourceBuffer?.buffered, t = e?.length;
5516
5537
  if (!t) return;
5517
- let n = e.start(0), r = Math.max(0, e.end(t - 1) - Yi);
5518
- r - n > Xi && (this._clearBufferTill = r);
5538
+ let n = e.start(0), r = Math.max(0, e.end(t - 1) - Xi);
5539
+ r - n > Zi && (this._clearBufferTill = r);
5519
5540
  }
5520
5541
  destroy() {
5521
5542
  this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
@@ -5529,7 +5550,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5529
5550
  get buffered() {
5530
5551
  return this._sourceBuffer?.buffered;
5531
5552
  }
5532
- }, Qi = class e extends ki {
5553
+ }, $i = class e extends Ai {
5533
5554
  constructor(e, t, n, r, i = z) {
5534
5555
  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}]`);
5535
5556
  }
@@ -5553,8 +5574,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5553
5574
  u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
5554
5575
  u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
5555
5576
  ]), 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, [
5556
- u.element(u.ID.TrackNumber, u.number(Ji)),
5557
- u.element(u.ID.TrackUID, u.number(Ji)),
5577
+ u.element(u.ID.TrackNumber, u.number(Yi)),
5578
+ u.element(u.ID.TrackUID, u.number(Yi)),
5558
5579
  u.element(u.ID.TrackType, u.number(1)),
5559
5580
  u.element(u.ID.FlagLacing, u.number(0)),
5560
5581
  u.element(u.ID.DefaultDuration, u.number(1e9)),
@@ -5567,7 +5588,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5567
5588
  return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
5568
5589
  }
5569
5590
  _createVideo(e) {
5570
- 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);
5591
+ this._mediaBuffer = new Qi(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);
5571
5592
  let t = () => {
5572
5593
  if (this._video?.src) {
5573
5594
  this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
@@ -5594,13 +5615,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5594
5615
  this._mediaBuffer?.append(a);
5595
5616
  }
5596
5617
  let i = Math.round(r - this._clusterStartTime);
5597
- if (i > qi && (this._clusterStartTime = r, i = 0), i === 0) {
5618
+ if (i > Ji && (this._clusterStartTime = r, i = 0), i === 0) {
5598
5619
  this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
5599
5620
  let t = e._genClusterHeader(this._clusterStartTime);
5600
5621
  this._mediaBuffer?.append(t);
5601
5622
  }
5602
5623
  let a = u.element(u.ID.SimpleBlock, [
5603
- u.vintEncodedNumber(Ji),
5624
+ u.vintEncodedNumber(Yi),
5604
5625
  u.bytes(e._intToU16BE(i)),
5605
5626
  u.number(!!t.keyframe << 7),
5606
5627
  u.bytes(t.frameData)
@@ -5613,12 +5634,12 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5613
5634
  static isBrowserSupported() {
5614
5635
  return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
5615
5636
  }
5616
- }, $i = class {
5637
+ }, ea = class {
5617
5638
  constructor(e, t, n, r, i, a = null, o = z, s = null) {
5618
5639
  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);
5619
5640
  }
5620
5641
  _onDataChannelMessage(e) {
5621
- let t = Ui(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
5642
+ let t = Wi(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
5622
5643
  if (!n) {
5623
5644
  this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
5624
5645
  return;
@@ -5630,7 +5651,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5630
5651
  let r = this._streamBuilders[n];
5631
5652
  if (!r) {
5632
5653
  let e = (e) => this._onStream(n, e);
5633
- r = N.screenShareWebmBuilder && Qi.isBrowserSupported() ? new Qi(n, e, this._onStat, this._statAggregator, this._debug) : new Ni(n, e, this._onStat, this._statAggregator, () => {
5654
+ r = N.screenShareWebmBuilder && $i.isBrowserSupported() ? new $i(n, e, this._onStat, this._statAggregator, this._debug) : new Pi(n, e, this._onStat, this._statAggregator, () => {
5634
5655
  this._requestKeyFrame(t.ssrc);
5635
5656
  }, this._debug, this._logger), this._streamBuilders[n] = r;
5636
5657
  }
@@ -5638,7 +5659,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5638
5659
  }
5639
5660
  _requestKeyFrame(e) {
5640
5661
  if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
5641
- let t = Ki(e);
5662
+ let t = qi(e);
5642
5663
  this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
5643
5664
  } catch (e) {
5644
5665
  this._debug.warn("Failed to send keyframe request", e);
@@ -5651,7 +5672,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5651
5672
  destroy() {
5652
5673
  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");
5653
5674
  }
5654
- }, ea = class {
5675
+ }, ta = class {
5655
5676
  constructor(e, t, n) {
5656
5677
  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;
5657
5678
  }
@@ -5670,7 +5691,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5670
5691
  get data() {
5671
5692
  return this._data;
5672
5693
  }
5673
- }, ta = class {
5694
+ }, na = class {
5674
5695
  constructor() {
5675
5696
  h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
5676
5697
  }
@@ -5678,7 +5699,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5678
5699
  return this._length;
5679
5700
  }
5680
5701
  push(...e) {
5681
- for (let t of e) this._tail = new ea(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
5702
+ for (let t of e) this._tail = new ta(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
5682
5703
  }
5683
5704
  merge(e) {
5684
5705
  this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
@@ -5708,7 +5729,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5708
5729
  for (; t !== null;) e.push(t.data), t = t.next;
5709
5730
  return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
5710
5731
  }
5711
- }, na = 1e3, ra = class extends Si {
5732
+ }, ra = 1e3, ia = class extends Ci {
5712
5733
  constructor(e, t, n, r, i = z, a = null) {
5713
5734
  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);
5714
5735
  }
@@ -5777,7 +5798,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5777
5798
  }
5778
5799
  _encode(e, t) {
5779
5800
  let n = e.data.buffer;
5780
- this._sendToWorker(xi.FRAME, {
5801
+ this._sendToWorker(Si.FRAME, {
5781
5802
  width: e.width,
5782
5803
  height: e.height,
5783
5804
  imageData: n,
@@ -5794,7 +5815,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5794
5815
  let t = this._drawFrameData(this._lastFrame);
5795
5816
  this._encode(t, e);
5796
5817
  } else this._onFrame(null);
5797
- }, na), this._getFrameBitmap().then((t) => {
5818
+ }, ra), this._getFrameBitmap().then((t) => {
5798
5819
  window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
5799
5820
  let n = this._drawFrameData(t);
5800
5821
  this._encode(n, e);
@@ -5804,7 +5825,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5804
5825
  this._useImageCapture ? this._requestFrameBitmap(e) : this._requestFrameVideo(e);
5805
5826
  }
5806
5827
  setBitrate(e, t, n) {
5807
- this._sendToWorker(xi.SET_BITRATE, {
5828
+ this._sendToWorker(Si.SET_BITRATE, {
5808
5829
  bitrate: e,
5809
5830
  useCbr: t
5810
5831
  });
@@ -5815,7 +5836,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5815
5836
  destroy() {
5816
5837
  this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
5817
5838
  }
5818
- }, ia = class extends Si {
5839
+ }, aa = class extends Ci {
5819
5840
  constructor(e, t, n, r, i, a, o = z, s = null) {
5820
5841
  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 });
5821
5842
  }
@@ -5843,10 +5864,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5843
5864
  }, [n]);
5844
5865
  }
5845
5866
  requestFrame(e = !1) {
5846
- this._sendToWorker(xi.FRAME, { keyFrame: e });
5867
+ this._sendToWorker(Si.FRAME, { keyFrame: e });
5847
5868
  }
5848
5869
  setBitrate(e, t, n) {
5849
- this._sendToWorker(xi.SET_BITRATE, {
5870
+ this._sendToWorker(Si.SET_BITRATE, {
5850
5871
  bitrate: e,
5851
5872
  useCbr: t,
5852
5873
  fps: n
@@ -5861,11 +5882,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5861
5882
  static isBrowserSupported() {
5862
5883
  return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
5863
5884
  }
5864
- }, aa = 2100, oa = 600, sa = 1.2, ca = .8, la = 2e3, ua = 8e3, da = 8e3, fa = 16e3, pa = 4, ma = 2e3, ha = /* @__PURE__ */ function(e) {
5885
+ }, oa = 2100, sa = 600, ca = 1.2, la = .8, ua = 2e3, da = 8e3, fa = 8e3, pa = 16e3, ma = 4, ha = 2e3, ga = /* @__PURE__ */ function(e) {
5865
5886
  return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
5866
- }(ha || {}), ga = class {
5887
+ }(ga || {}), _a = class {
5867
5888
  constructor(e, t, n, r, i, a, o, s = z) {
5868
- 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 = aa, i && (this._highDelayThreshold = oa), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
5889
+ 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 = oa, i && (this._highDelayThreshold = sa), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
5869
5890
  let c = Date.now();
5870
5891
  this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
5871
5892
  }
@@ -5875,27 +5896,27 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5875
5896
  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;
5876
5897
  s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
5877
5898
  let l = Math.round(this._targetBitrate / 1e3), u = n;
5878
- e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ha[i]} tr=${l} br=${n}`);
5899
+ e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ga[i]} tr=${l} br=${n}`);
5879
5900
  let d = r - this._lastDown;
5880
- if (i === 2 && d > la) {
5881
- this._probing && (this._upPenalty = Math.min(++this._upPenalty, pa), this._probing = !1);
5882
- let n = ca * u * 1e3;
5883
- if (n >= this._targetBitrate && (n = this._targetBitrate * ca), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
5884
- let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * da / 1e3);
5885
- this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ha[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;
5901
+ if (i === 2 && d > ua) {
5902
+ this._probing && (this._upPenalty = Math.min(++this._upPenalty, ma), this._probing = !1);
5903
+ let n = la * u * 1e3;
5904
+ if (n >= this._targetBitrate && (n = this._targetBitrate * la), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
5905
+ let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * fa / 1e3);
5906
+ this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ga[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;
5886
5907
  }
5887
5908
  this._lastDown = r;
5888
5909
  }
5889
- let f = r - this._lastUp, p = ua + this._upPenalty * da;
5910
+ let f = r - this._lastUp, p = da + this._upPenalty * fa;
5890
5911
  if (i === 1 && f > p && d > p) {
5891
- let n = Math.min(this._targetBitrate * sa, this._maxBitrate);
5912
+ let n = Math.min(this._targetBitrate * ca, this._maxBitrate);
5892
5913
  if (n > this._targetBitrate) {
5893
- let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * da / 1e3);
5894
- this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ha[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;
5914
+ let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * fa / 1e3);
5915
+ this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ga[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;
5895
5916
  }
5896
5917
  }
5897
5918
  let m = r - this._lastProbing;
5898
- this._probing && m > fa && (this._probing = !1);
5919
+ this._probing && m > pa && (this._probing = !1);
5899
5920
  let ee = r - this._lastDown;
5900
5921
  this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
5901
5922
  }
@@ -5906,7 +5927,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5906
5927
  }
5907
5928
  _calcDelay(e, t) {
5908
5929
  if (!(e <= 0)) {
5909
- 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 > ma) {
5930
+ 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 > ha) {
5910
5931
  let e = t - this._lastCheckDelay;
5911
5932
  this._largeDelayDuration += e;
5912
5933
  }
@@ -5935,7 +5956,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
5935
5956
  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}`);
5936
5957
  }
5937
5958
  }
5938
- }, _a = class {
5959
+ }, va = class {
5939
5960
  constructor(e) {
5940
5961
  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);
5941
5962
  }
@@ -6009,11 +6030,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6009
6030
  clear() {
6010
6031
  this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
6011
6032
  }
6012
- }, va = 65536, ya = 50, ba = 400, xa = 1e6, Sa = 3e5, Ca = 3e4, wa = 2e3, Ta = 5, Ea = 0, Da = class {
6033
+ }, ya = 65536, ba = 50, xa = 400, Sa = 1e6, Ca = 3e5, wa = 3e4, Ta = 2e3, Ea = 5, Da = 0, Oa = class {
6013
6034
  constructor(e, t, n, r, i = z, a = null) {
6014
- 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 _a(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 ta()), 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;
6035
+ 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 va(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 na()), 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;
6015
6036
  let o = N.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
6016
- 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 ga(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
6037
+ 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 _a(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
6017
6038
  let u = (e, t) => {
6018
6039
  if (this._destroyed) return;
6019
6040
  if (!e) {
@@ -6024,23 +6045,23 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6024
6045
  let n = this._sliceFrame(e);
6025
6046
  this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
6026
6047
  };
6027
- if (ia.isBrowserSupported()) {
6048
+ if (aa.isBrowserSupported()) {
6028
6049
  let t = this._fastSharing;
6029
- this._encoder = new ia(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
6030
- } else this._encoder = new ra(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
6050
+ this._encoder = new aa(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
6051
+ } else this._encoder = new ia(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
6031
6052
  this._datachannel.onmessage = (e) => {
6032
- Wi(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
6033
- let t = Gi(e.data);
6053
+ Gi(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
6054
+ let t = Ki(e.data);
6034
6055
  t !== null && this._checkCcFeedback(t);
6035
- }, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new Ti((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
6056
+ }, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new Ei((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
6036
6057
  }
6037
6058
  _handleQueue() {
6038
6059
  if (this._destroyed) return;
6039
6060
  let e = this._queue.shift();
6040
6061
  if (!e) {
6041
- if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + va) % va > Ta && this._lastFrameDelay > this._maxFrameDelay) {
6062
+ if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + ya) % ya > Ea && this._lastFrameDelay > this._maxFrameDelay) {
6042
6063
  let e = Date.now();
6043
- e - this._lastFramerateReduced > wa && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
6064
+ e - this._lastFramerateReduced > Ta && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
6044
6065
  } else this._requestFrame();
6045
6066
  return;
6046
6067
  }
@@ -6066,7 +6087,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6066
6087
  this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
6067
6088
  }
6068
6089
  _sliceFrame(e) {
6069
- let t = e.type === "key", n = e.data.byteLength, r = new ta();
6090
+ let t = e.type === "key", n = e.data.byteLength, r = new na();
6070
6091
  for (let i = 0; i < n; i += this.DATA_SIZE) {
6071
6092
  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);
6072
6093
  r.push({
@@ -6082,11 +6103,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6082
6103
  return r;
6083
6104
  }
6084
6105
  _wrapHeader(e, t, n, r, i) {
6085
- let a = Hi(e, t, n, r, Ea, this._encoder.isVP9(), i), o = {
6086
- sequence: Ea,
6106
+ let a = Ui(e, t, n, r, Da, this._encoder.isVP9(), i), o = {
6107
+ sequence: Da,
6087
6108
  data: a
6088
6109
  };
6089
- return Ea = (Ea + 1) % va, o;
6110
+ return Da = (Da + 1) % ya, o;
6090
6111
  }
6091
6112
  _stopPacket() {
6092
6113
  return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
@@ -6103,7 +6124,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6103
6124
  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");
6104
6125
  }
6105
6126
  static isBrowserSupported() {
6106
- return ia.isBrowserSupported() || ra.isBrowserSupported();
6127
+ return aa.isBrowserSupported() || ia.isBrowserSupported();
6107
6128
  }
6108
6129
  _onCongestionCallback(e, t, n) {
6109
6130
  this._encoder.setBitrate(e, t, n);
@@ -6116,8 +6137,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6116
6137
  (e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
6117
6138
  let n = e * t / 256;
6118
6139
  return {
6119
- minBitrate: Math.max(Sa, Math.min(xa, Math.round(n * ya))),
6120
- maxBitrate: Math.round(n * ba)
6140
+ minBitrate: Math.max(Ca, Math.min(Sa, Math.round(n * ba))),
6141
+ maxBitrate: Math.round(n * xa)
6121
6142
  };
6122
6143
  }
6123
6144
  _checkCcFeedback(e) {
@@ -6131,14 +6152,14 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6131
6152
  }
6132
6153
  _sendSharingStat() {
6133
6154
  let e = Date.now();
6134
- if (e - this._lastSharingStat > Ca) {
6155
+ if (e - this._lastSharingStat > wa) {
6135
6156
  let t = this._congestionControl.getStat();
6136
6157
  t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t).catch((e) => {
6137
- !(e instanceof kn) && !(e instanceof An) && this._debug.warn("Unable to send sharing stats", e);
6158
+ !(e instanceof An) && !(e instanceof jn) && this._debug.warn("Unable to send sharing stats", e);
6138
6159
  })), this._lastSharingStat = e;
6139
6160
  }
6140
6161
  }
6141
- }, Oa = class {
6162
+ }, ka = class {
6142
6163
  constructor(e, t, n, r = z, i = null) {
6143
6164
  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;
6144
6165
  }
@@ -6161,14 +6182,14 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6161
6182
  this._pc.getTransceivers().forEach((e) => {
6162
6183
  e.mid === null && e.stop();
6163
6184
  });
6164
- let t = mn(e), n = this._findMediaSection(t, this._transceiver.mid);
6185
+ let t = hn(e), n = this._findMediaSection(t, this._transceiver.mid);
6165
6186
  if (n) {
6166
6187
  for (let e = n.start; e < n.end; e++) if (t[e].startsWith("a=simulcast:send ")) {
6167
6188
  t[e] = t[e].replaceAll("~", "");
6168
6189
  break;
6169
6190
  }
6170
6191
  let e = this._mediaSource.getStream()?.getVideoTracks()[0];
6171
- e && this._getConfig($t.WIDTH, $t.HEIGHT, e.getSettings().frameRate).simulcastInfo.streams.forEach((e) => {
6192
+ e && this._getConfig(en.WIDTH, en.HEIGHT, e.getSettings().frameRate).simulcastInfo.streams.forEach((e) => {
6172
6193
  let r = `a=rid:${e.rid} send`;
6173
6194
  for (let i = n.start; i < n.end; i++) if (t[i] === r || t[i].startsWith(r + " ")) {
6174
6195
  t[i] = `${r} max-width=${e.width};max-height=${e.height};max-fps=${e.fps};max-br=${e.bitrate}`;
@@ -6176,17 +6197,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6176
6197
  }
6177
6198
  });
6178
6199
  }
6179
- return hn(t);
6200
+ return gn(t);
6180
6201
  }
6181
6202
  async sync({ force: e = !1 } = {}) {
6182
6203
  if (!this._transceiver || !this._currentSimulcastInfo || !this._mediaSource.mediaSettings.isVideoEnabled) return;
6183
6204
  let t = this._mediaSource.getStream()?.getVideoTracks()[0];
6184
6205
  if (!t) return;
6185
6206
  let n = this._getTrackConfig(t);
6186
- if (!e && an(this._currentSimulcastInfo, n.simulcastInfo)) return;
6207
+ if (!e && on(this._currentSimulcastInfo, n.simulcastInfo)) return;
6187
6208
  let r = await this._applyConfig(n, !0);
6188
6209
  r && (this._debug.log(`SimulcastSender: Sync ${n.width}x${n.height} encodings=${JSON.stringify(r.encodings)}`), await this._changeSimulcast({
6189
- mediaSource: Zt.CAMERA,
6210
+ mediaSource: Qt.CAMERA,
6190
6211
  simulcastInfo: n.simulcastInfo
6191
6212
  }));
6192
6213
  }
@@ -6228,21 +6249,21 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6228
6249
  return {
6229
6250
  width: e,
6230
6251
  height: t,
6231
- simulcastInfo: cn(e, t, a, i),
6252
+ simulcastInfo: ln(e, t, a, i),
6232
6253
  maxDimension: r?.maxDimension,
6233
6254
  maxBitrate: !a && r?.maxBitrateK ? r.maxBitrateK * 1024 : void 0
6234
6255
  };
6235
6256
  }
6236
6257
  _getTrackConfig(e) {
6237
6258
  let t = e.getSettings();
6238
- return this._getConfig(t.width ?? $t.WIDTH, t.height ?? $t.HEIGHT, t.frameRate);
6259
+ return this._getConfig(t.width ?? en.WIDTH, t.height ?? en.HEIGHT, t.frameRate);
6239
6260
  }
6240
6261
  async _applyConfig(e, t = !1) {
6241
6262
  let n = this._transceiver;
6242
6263
  if (!n) return null;
6243
6264
  let r = n.sender.getParameters();
6244
6265
  if (r.encodings.length <= 1) return null;
6245
- un(r.encodings, e.simulcastInfo, e.maxDimension, e.maxBitrate);
6266
+ dn(r.encodings, e.simulcastInfo, e.maxDimension, e.maxBitrate);
6246
6267
  try {
6247
6268
  await n.sender.setParameters(r);
6248
6269
  } catch (e) {
@@ -6259,7 +6280,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6259
6280
  async _syncReplacedTrack(e) {
6260
6281
  let t = this._getTrackConfig(e);
6261
6282
  this._currentSimulcastInfo = t.simulcastInfo, await this._changeSimulcast({
6262
- mediaSource: Zt.CAMERA,
6283
+ mediaSource: Qt.CAMERA,
6263
6284
  simulcastInfo: t.simulcastInfo
6264
6285
  });
6265
6286
  }
@@ -6267,12 +6288,12 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6267
6288
  try {
6268
6289
  await this._signaling.changeSimulcast(e);
6269
6290
  } catch (e) {
6270
- if (!(e instanceof An)) throw e;
6291
+ if (!(e instanceof jn)) throw e;
6271
6292
  }
6272
6293
  }
6273
- }, ka = 90, Aa = 4294967295, ja = class e extends ti {
6294
+ }, Aa = 90, ja = 4294967295, Ma = class e extends ni {
6274
6295
  constructor(e, t, n, r = z, i = null, a = null, o = null, s = null) {
6275
- 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, "_peerConnectionStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new Mr(a), this._peerConnectionStats = new Jr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new Oa(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._debug.debug("ServerTransport: Created");
6296
+ 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, "_peerConnectionStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new Nr(a), this._peerConnectionStats = new Yr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new ka(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, Tr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Zt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, Zt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._debug.debug("ServerTransport: Created");
6276
6297
  }
6277
6298
  updateStatisticsInterval() {
6278
6299
  this._stopStatInterval();
@@ -6299,7 +6320,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6299
6320
  this._reconnectionPrevented = !1;
6300
6321
  }
6301
6322
  updateSettings(e) {
6302
- Ur(e, this._serverSettings) || (this._serverSettings = e, this._applyConsumerSettings());
6323
+ Wr(e, this._serverSettings) || (this._serverSettings = e, this._applyConsumerSettings());
6303
6324
  }
6304
6325
  setAnimojiTransport(e, t) {
6305
6326
  if (N.vmoji && (this._animojiReceiver = e, this._animojiSender = t, this._participantIdRegistry && e.setParticipantIdRegistry(this._participantIdRegistry), this._animojiDataChannel)) {
@@ -6340,17 +6361,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6340
6361
  }
6341
6362
  this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = M.debounce((e) => {
6342
6363
  this._pc && this._onConnectionStateChange(this._pc, e);
6343
- }, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._peerConnectionStats.observe(this._pc), this._participantIdRegistry = new bi(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Rr.producerNotification, (e) => {
6364
+ }, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._peerConnectionStats.observe(this._pc), this._participantIdRegistry = new xi(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, zr.producerNotification, (e) => {
6344
6365
  this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
6345
- }), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, Rr.producerCommand, (e) => {
6366
+ }), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, zr.producerCommand, (e) => {
6346
6367
  this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
6347
- }), this._createDataChannel(this._pc, Rr.producerScreenShare, (e) => {
6368
+ }), this._createDataChannel(this._pc, zr.producerScreenShare, (e) => {
6348
6369
  this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
6349
- }), N.asrDataChannel && this._createDataChannel(this._pc, Rr.asr, (e) => {
6350
- this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new _i(e, this._participantIdRegistry, (e) => {
6370
+ }), N.asrDataChannel && this._createDataChannel(this._pc, zr.asr, (e) => {
6371
+ this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new vi(e, this._participantIdRegistry, (e) => {
6351
6372
  this._onAsrTranscription(e);
6352
6373
  }, this._debug);
6353
- }), N.vmoji && this._createDataChannel(this._pc, Rr.animoji, (e) => {
6374
+ }), N.vmoji && this._createDataChannel(this._pc, zr.animoji, (e) => {
6354
6375
  this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(e), this._animojiReceiver?.setParticipantIdRegistry(this._participantIdRegistry), this._animojiSender?.setDataChannel(e), this._animojiSender?.setProtocolVersion(N.vmojiOptions.protocolVersion || 1);
6355
6376
  }), this._newAudioShareTrack = this._mediaSource.getAudioShareTrack();
6356
6377
  try {
@@ -6359,7 +6380,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6359
6380
  this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(x.ERROR, "addTrack-single"), this.close(e);
6360
6381
  return;
6361
6382
  }
6362
- this._startFirstMediaSentProbe(), this._createDataChannel(this._pc, Rr.consumerScreenShare, (e) => {
6383
+ this._startFirstMediaSentProbe(), this._createDataChannel(this._pc, zr.consumerScreenShare, (e) => {
6363
6384
  this._consumerScreen = e, this._consumerScreen.binaryType = "arraybuffer";
6364
6385
  let t = this._mediaSource.getScreenTrack();
6365
6386
  t && (!N.consumerFastScreenShare || !this._mediaSource.mediaSettings.isFastScreenSharingEnabled) && this._createCaptureSender(t);
@@ -6384,20 +6405,20 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6384
6405
  this._triggerEvent(Y.NETWORK_STATUS, e);
6385
6406
  }
6386
6407
  _updateSSRCMap(e) {
6387
- e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, mn(e.sdp).forEach((e) => {
6388
- let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${hi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${hi.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
6408
+ e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, hn(e.sdp).forEach((e) => {
6409
+ let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${gi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${gi.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
6389
6410
  n && (this._ssrcMap[n[1]] = n[3]);
6390
6411
  }));
6391
6412
  }
6392
6413
  _createCaptureSender(e) {
6393
6414
  let t = this._mediaSource.mediaSettings;
6394
- !e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new Da(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
6415
+ !e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new Oa(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
6395
6416
  }
6396
6417
  _removeCaptureSender() {
6397
6418
  this._captureSender?.destroy(), this._captureSender = null;
6398
6419
  }
6399
6420
  _createCaptureReceiver() {
6400
- this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new $i(this._producerScreen, this._participantIdRegistry, (e, t) => {
6421
+ this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new ea(this._producerScreen, this._participantIdRegistry, (e, t) => {
6401
6422
  this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, t);
6402
6423
  }, (e) => {
6403
6424
  this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, null);
@@ -6416,7 +6437,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6416
6437
  if (!n.track || n.track.kind !== A.video || n.track.contentHint === "motion") return;
6417
6438
  let r = !this._disabledSenders.has(n), i = e.maxDimension !== 0;
6418
6439
  if (r && !i) {
6419
- this._debug.log("Disabling video upload"), this._disabledSenders.add(n), n.replaceTrack(E.getBlackMediaTrack()).catch((e) => {
6440
+ this._debug.log("Disabling video upload"), this._disabledSenders.add(n), n.replaceTrack(D.getBlackMediaTrack()).catch((e) => {
6420
6441
  this._debug.error("Could not disable video upload", e);
6421
6442
  });
6422
6443
  return;
@@ -6514,7 +6535,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6514
6535
  _detectStaleTracks(e) {
6515
6536
  let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
6516
6537
  if (!t) return;
6517
- let n = hi.AUDIO_MIX, r = this._statBytes[n], i = !1;
6538
+ let n = gi.AUDIO_MIX, r = this._statBytes[n], i = !1;
6518
6539
  if (r) {
6519
6540
  let e = t.bytesReceived - r.bytesReceived;
6520
6541
  e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(Y.AUDIO_MIX_STALL, i);
@@ -6528,7 +6549,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6528
6549
  if (!this._signaling.ready) return;
6529
6550
  let e = Ya.get();
6530
6551
  !N.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
6531
- e instanceof kn || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
6552
+ e instanceof An || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
6532
6553
  });
6533
6554
  }
6534
6555
  async _processOffer(e, t) {
@@ -6640,7 +6661,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6640
6661
  }
6641
6662
  async _onProducerUpdated(e) {
6642
6663
  this._producerSessionId && this._producerSessionId !== e.sessionId && this._reconnect(), N.breakVideoPayloadTypes && (this._debug.log("test mode enabled, video switched off"), this._signaling.requestTestMode("breakVideoPayloadTypes", null).catch((e) => {
6643
- e instanceof kn || this._debug.warn("Unable to enable signaling test mode", e);
6664
+ e instanceof An || this._debug.warn("Unable to enable signaling test mode", e);
6644
6665
  })), this._producerSessionId = e.sessionId, await this._acceptProducer(e.description, e.sessionId);
6645
6666
  }
6646
6667
  _onAddTrack(e, t) {
@@ -6702,11 +6723,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6702
6723
  if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
6703
6724
  let i = r[0].rtpTimestamp;
6704
6725
  if (!Number.isInteger(i)) return this._logger?.log(x.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
6705
- let a = t - i & Aa, o = Math.ceil(a / ka);
6726
+ let a = t - i & ja, o = Math.ceil(a / Aa);
6706
6727
  return Math.min(100, Math.max(0, o));
6707
6728
  }
6708
6729
  async _monitorRtpShare() {
6709
- let e = yi.getInstance().value;
6730
+ let e = bi.getInstance().value;
6710
6731
  if (!this._mediaSource.mediaSettings.isFastScreenSharingEnabled || !N.consumerFastScreenShare || e < .6) return;
6711
6732
  let t = this._pc?.getSenders().find((e) => e.track?.kind === A.video && e.track?.contentHint === "motion");
6712
6733
  t && (await t.getStats()).forEach((e) => {
@@ -6735,71 +6756,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6735
6756
  _stopMonitorRtpShareInterval() {
6736
6757
  this._monitorRtpShareInterval && (window.clearTimeout(this._monitorRtpShareInterval), this._monitorRtpShareInterval = null);
6737
6758
  }
6738
- }, Ma = class {
6739
- constructor(e, t = z) {
6740
- h(this, "_topology", void 0), h(this, "_participantsCount", 0), h(this, "_taTrackIds", /* @__PURE__ */ new Set()), h(this, "_sendTrack", null), h(this, "_controller", null), h(this, "_enabled", !1), h(this, "_updateTimer", null), h(this, "_initFailed", !1), h(this, "_destroyed", !1), h(this, "_debug", void 0), this._topology = e, this._debug = t;
6741
- }
6742
- setTopology(e) {
6743
- this._topology = e, this._update();
6744
- }
6745
- setParticipantsCount(e) {
6746
- this._participantsCount = e, this._update();
6747
- }
6748
- addRemoteTrack(e) {
6749
- if (e.endsWith(hi.AUDIO_MIX)) this._taTrackIds.clear();
6750
- else if (e.startsWith(`${hi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) this._taTrackIds.add(e);
6751
- else return;
6752
- this._update();
6753
- }
6754
- removeRemoteTrack(e) {
6755
- this._taTrackIds.delete(e) && this._update();
6756
- }
6757
- resetRemoteTracks() {
6758
- this._taTrackIds.size !== 0 && (this._taTrackIds.clear(), this._update());
6759
- }
6760
- setSendTrack(e) {
6761
- this._sendTrack = e, this._enabled && this._controller?.setSendTrack(e);
6762
- }
6763
- destroy() {
6764
- this._destroyed = !0, this._enabled = !1, this._updateTimer !== null && (window.clearTimeout(this._updateTimer), this._updateTimer = null), this._controller?.destroy(), this._controller = null;
6765
- }
6766
- _isAllowed() {
6767
- let e = this._taTrackIds.size;
6768
- return this._topology !== J.DIRECT && e > 0 && this._participantsCount > e;
6769
- }
6770
- _update() {
6771
- this._destroyed || this._updateTimer !== null || (this._updateTimer = window.setTimeout(() => {
6772
- this._updateTimer = null, this._applyConditions();
6773
- }, 0));
6774
- }
6775
- _applyConditions() {
6776
- let e = this._isAllowed();
6777
- e !== this._enabled && (this._enabled = e, this._debug.log(`[VadGate] VAD ${e ? "enabled" : "disabled"}`, {
6778
- topology: this._topology,
6779
- taTracks: this._taTrackIds.size,
6780
- participants: this._participantsCount
6781
- }), e && !this._controller ? this._createController() : this._applyState());
6782
- }
6783
- _createController() {
6784
- if (!N.vad || this._initFailed) return;
6785
- let e = new N.vad.VadController(this._sendTrack, N.vadOptions);
6786
- e.setLogger((e, ...t) => z.send(e, ...t), "VAD"), this._controller = e, e.init().then(() => {
6787
- this._controller === e && this._applyState();
6788
- }, (t) => {
6789
- this._debug.warn("[VadGate] VAD init failed, continuing without VAD", t), this._initFailed = !0, e.destroy(), this._controller === e && (this._controller = null);
6790
- });
6791
- }
6792
- _applyState() {
6793
- let e = this._controller;
6794
- e && (this._enabled ? (e.resume(), e.setSendTrack(this._sendTrack)) : (e.setSendTrack(null), e.pause()));
6795
- }
6796
6759
  }, Y = /* @__PURE__ */ function(e) {
6797
6760
  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;
6798
6761
  }({}), Na = class extends Ye {
6799
- constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null, l = () => !0) {
6800
- super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "_isParticipantAccepted", void 0), h(this, "_vadGate", void 0), h(this, "_updateVadTrack", () => {
6801
- this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack());
6802
- }), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this._isParticipantAccepted = l, this._vadGate = new Ma(e, i), this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack()), this.subscribe(this._signaling, wr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_READY, this._updateVadTrack), this._createAnimojiTransport(), e === J.SERVER && (this._serverTransport = this._createServerTransport());
6762
+ constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
6763
+ 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", () => {
6764
+ this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
6765
+ }), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this.subscribe(this._signaling, Tr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Zt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Zt.SOURCE_READY, this._updateVadTrack), this._createVad(), this._createAnimojiTransport(), e === J.SERVER && (this._serverTransport = this._createServerTransport());
6803
6766
  }
6804
6767
  updateSettings(e) {
6805
6768
  this._debug.log("Update transport settings", e), this._serverSettings = e, this._directTransport && this._directTransport.updateSettings(e), this._serverTransport && this._serverTransport.updateSettings(e);
@@ -6828,17 +6791,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6828
6791
  }
6829
6792
  this._opened.push(t), i = !0;
6830
6793
  }
6831
- this._updateVadParticipants(), i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
6794
+ i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
6832
6795
  }
6833
6796
  close(e) {
6834
6797
  let t = this._allocated.indexOf(e), n = this._opened.indexOf(e);
6835
- t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e], this._updateVadParticipants();
6798
+ t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e];
6836
6799
  }
6837
6800
  destroy() {
6838
6801
  this.stopFirstMediaSentProbe(), this.unsubscribe();
6839
6802
  for (let e of this._dtListeners) e.dispose();
6840
6803
  for (let e of this._stListeners) e.dispose();
6841
- this._removeAnimojiTransport(), N.audioEffects?.destroy(), this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6804
+ this._removeAnimojiTransport(), N.audioEffects?.destroy(), this._vadController?.destroy(), this._vadController = null, this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6842
6805
  }
6843
6806
  stopFirstMediaSentProbe() {
6844
6807
  this._firstMediaSentProbeStopped || (this._firstMediaSentProbeStopped = !0, this._directTransport?.stopFirstMediaSentProbe(), this._serverTransport?.stopFirstMediaSentProbe());
@@ -6847,7 +6810,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6847
6810
  this.unsubscribe();
6848
6811
  for (let e of this._dtListeners) e.dispose();
6849
6812
  for (let e of this._stListeners) e.dispose();
6850
- this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6813
+ this._vadController?.destroy(), this._vadController = null, this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
6851
6814
  }
6852
6815
  setRemoteHold(e) {
6853
6816
  this._directTransport?.setRemoteHold(e);
@@ -6897,7 +6860,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6897
6860
  }
6898
6861
  _onTopologyChanged(e) {
6899
6862
  if (e.topology !== this._topology) {
6900
- if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._vadGate.setTopology(this._topology), this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
6863
+ if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
6901
6864
  let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? M.composeParticipantId(t[0], n[0], r[0]) : null;
6902
6865
  if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
6903
6866
  this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
@@ -6916,11 +6879,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6916
6879
  }
6917
6880
  }
6918
6881
  _createDirectTransport(e, t = !1) {
6919
- let n = new mi(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6882
+ let n = new hi(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6920
6883
  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;
6921
6884
  }
6922
6885
  _createServerTransport() {
6923
- let e = new ja(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6886
+ let e = new Ma(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
6924
6887
  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;
6925
6888
  }
6926
6889
  _releaseDirectTransport() {
@@ -6929,7 +6892,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6929
6892
  this._dtListeners = [];
6930
6893
  }
6931
6894
  _releaseServerTransport() {
6932
- this._serverTransport?.close(), this._serverTransport = null, this._vadGate.resetRemoteTracks();
6895
+ this._serverTransport?.close(), this._serverTransport = null;
6933
6896
  for (let e of this._stListeners) e.dispose();
6934
6897
  this._stListeners = [];
6935
6898
  }
@@ -6939,13 +6902,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6939
6902
  let e = this._opened.indexOf(t);
6940
6903
  e >= 0 && this._opened.splice(e, 1);
6941
6904
  let n = this._allocated.indexOf(t);
6942
- n >= 0 && this._allocated.splice(n, 1), this._updateVadParticipants();
6905
+ n >= 0 && this._allocated.splice(n, 1);
6943
6906
  }
6944
6907
  this._topology === J.DIRECT && t && (this._setStates([t], e), this._setLocalState(e));
6945
6908
  }
6946
6909
  _onServerTransportChanged(e) {
6947
6910
  let t = this._opened.slice();
6948
- e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [], this._updateVadParticipants())), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
6911
+ e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [])), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
6949
6912
  }
6950
6913
  _onTransportActiveParticipants(e) {
6951
6914
  this._topology === J.SERVER && this._triggerEvent("SIGNALLED_ACTIVE_PARTICIPANTS", e);
@@ -6972,10 +6935,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6972
6935
  this._triggerEvent("REMOTE_DATA_STATS", e);
6973
6936
  }
6974
6937
  _onRemoteTrackAdded(e, t, n) {
6975
- this._vadGate.addRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
6938
+ this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
6976
6939
  }
6977
6940
  _onRemoteTrackRemoved(e, t, n) {
6978
- this._vadGate.removeRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
6941
+ this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
6979
6942
  }
6980
6943
  _onAsrTranscription(e) {
6981
6944
  this._triggerEvent("ASR_TRANSCRIPTION", e);
@@ -6990,8 +6953,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
6990
6953
  _onAnimojiStatus(e) {
6991
6954
  e ? this._animojiSender?.resume() : this._animojiSender?.pause(), this._mediaSource.onAnimojiSender(e);
6992
6955
  }
6993
- _updateVadParticipants() {
6994
- this._vadGate.setParticipantsCount(this._opened.filter(this._isParticipantAccepted).length);
6956
+ _createVad() {
6957
+ N.vad && (this._vadController = new N.vad.VadController(this._mediaSource.getSendAudioTrack(), N.vadOptions), this._vadController.setLogger((e, ...t) => z.send(e, ...t), "VAD"), this._vadController.init().catch((e) => {
6958
+ z.warn("[Transport] VAD init failed, continuing without VAD", e), this._vadController?.destroy(), this._vadController = null;
6959
+ }));
6995
6960
  }
6996
6961
  _createAnimojiTransport() {
6997
6962
  if (!N.vmoji) return;
@@ -7233,7 +7198,7 @@ function Wa(e, ...t) {
7233
7198
  return !0;
7234
7199
  }
7235
7200
  function Ga(e, t = !1) {
7236
- if (!(!e?.address || !Lr(e.address))) return e.address + (t ? `:${e.port}` : "");
7201
+ if (!(!e?.address || !Rr(e.address))) return e.address + (t ? `:${e.port}` : "");
7237
7202
  }
7238
7203
  function Ka(e) {
7239
7204
  return e === void 0;
@@ -7539,7 +7504,7 @@ var Ya = Ja, Xa = {
7539
7504
  return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT", e.ABORTED = "ABORTED", e;
7540
7505
  }({}), co = class {
7541
7506
  constructor(e = z, t) {
7542
- h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "reconnectDeadlineTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", Tr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
7507
+ h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "reconnectDeadlineTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", Er.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
7543
7508
  }
7544
7509
  get readyState() {
7545
7510
  return this.socket?.readyState ?? null;
@@ -7566,7 +7531,7 @@ var Ya = Ja, Xa = {
7566
7531
  this.reconnectCount = 0, this._stopReconnectDeadline();
7567
7532
  }
7568
7533
  connect(e) {
7569
- this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== Cr.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
7534
+ this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== wr.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
7570
7535
  }
7571
7536
  close(e) {
7572
7537
  this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this._stopReconnectDeadline(), this.lastStamp = 0;
@@ -7587,20 +7552,20 @@ var Ya = Ja, Xa = {
7587
7552
  return;
7588
7553
  }
7589
7554
  let e = this._buildUrl(this.wtEndpoint, !0);
7590
- this.currentType = Tr.WEBTRANSPORT, this.socket = new oo(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
7555
+ this.currentType = Er.WEBTRANSPORT, this.socket = new oo(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
7591
7556
  }
7592
7557
  _connectWebSocket() {
7593
7558
  if (!this.endpoint) {
7594
7559
  this.handlers.onFailed({
7595
7560
  failure: "EMPTY_ENDPOINT",
7596
7561
  message: "Unable to connect to the signaling: endpoint is not set",
7597
- source: Tr.WEBSOCKET,
7562
+ source: Er.WEBSOCKET,
7598
7563
  remote: !0
7599
7564
  });
7600
7565
  return;
7601
7566
  }
7602
7567
  let e = this._buildUrl(this.endpoint, !1);
7603
- this.currentType = Tr.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
7568
+ this.currentType = Er.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
7604
7569
  }
7605
7570
  _setSocketHandlers() {
7606
7571
  this.socket && (this.handlers.onConnecting({
@@ -7610,7 +7575,7 @@ var Ya = Ja, Xa = {
7610
7575
  }
7611
7576
  _buildUrl(e, t) {
7612
7577
  let n = new URL(e), r = n.searchParams;
7613
- return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Za.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === Cr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
7578
+ return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Za.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === wr.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();
7614
7579
  }
7615
7580
  _canUseWebTransport() {
7616
7581
  return !this.forceWebSocket && oo.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
@@ -7634,7 +7599,7 @@ var Ya = Ja, Xa = {
7634
7599
  });
7635
7600
  return;
7636
7601
  }
7637
- this.forceWebSocket = !0, this._scheduleReconnect(this.currentType === Tr.WEBTRANSPORT ? 0 : void 0);
7602
+ this.forceWebSocket = !0, this._scheduleReconnect(this.currentType === Er.WEBTRANSPORT ? 0 : void 0);
7638
7603
  }
7639
7604
  }
7640
7605
  _disconnect(e) {
@@ -7653,7 +7618,7 @@ var Ya = Ja, Xa = {
7653
7618
  count: this.reconnectCount,
7654
7619
  delay: e
7655
7620
  }), this.reconnectTimer = window.setTimeout(() => {
7656
- this.connectionType = Cr.RETRY, this._connect();
7621
+ this.connectionType = wr.RETRY, this._connect();
7657
7622
  }, e);
7658
7623
  }
7659
7624
  _startReconnectDeadline() {
@@ -7703,7 +7668,7 @@ var go = new Set([
7703
7668
  O.NOT_FOUND,
7704
7669
  O.PARTICIPANT_LIMIT_REACHED,
7705
7670
  O.SERVICE_UNAVAILABLE
7706
- ]), _o = class e extends jn {
7671
+ ]), _o = class e extends Mn {
7707
7672
  static get WAIT_CONNECTION_DELAY() {
7708
7673
  return N.waitConnectionDelay;
7709
7674
  }
@@ -7714,7 +7679,7 @@ var go = new Set([
7714
7679
  return !this.disposed && this.transport.readyState !== null;
7715
7680
  }
7716
7681
  constructor(e = z, t = null, n = null, r = null, i = null) {
7717
- super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new ir(e), this.transport = new co(e, {
7682
+ super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new ar(e), this.transport = new co(e, {
7718
7683
  onConnecting: this._onTransportConnecting.bind(this),
7719
7684
  onOpen: this._onOpen.bind(this),
7720
7685
  onMessage: this._onMessage.bind(this),
@@ -7756,13 +7721,13 @@ var go = new Set([
7756
7721
  useCommandDataChannel(e) {
7757
7722
  this.producerCommandDataChannelEnabled = e;
7758
7723
  }
7759
- resetProducerConnection(e = new An()) {
7724
+ resetProducerConnection(e = new jn()) {
7760
7725
  this.producerCommandDataChannelEnabled = !1, this.producerNotificationDataChannel && (this.producerNotificationDataChannel.onmessage = null, this.producerNotificationDataChannel = null), this.producerCommandDataChannel && (this.producerCommandDataChannel.onmessage = null, this.producerCommandDataChannel = null);
7761
7726
  let t = [...this.datachannelCommandsQueue];
7762
7727
  this.datachannelCommandsQueue = [];
7763
7728
  for (let e of Object.values(this.responseHandlers)) e.route === "producer" && (t.push(e), delete this.responseHandlers[e.sequence]);
7764
7729
  t.forEach((t) => {
7765
- window.clearTimeout(t.responseTimer), t.reject(e instanceof An ? new An(t.name) : e, !0);
7730
+ window.clearTimeout(t.responseTimer), t.reject(e instanceof jn ? new jn(t.name) : e, !0);
7766
7731
  });
7767
7732
  }
7768
7733
  async connect(e) {
@@ -8007,7 +7972,7 @@ var go = new Set([
8007
7972
  async getHandQueue() {
8008
7973
  return this._send(V.GET_HAND_QUEUE);
8009
7974
  }
8010
- dispose(e = new kn()) {
7975
+ dispose(e = new An()) {
8011
7976
  this._terminate(e);
8012
7977
  }
8013
7978
  readyToSend(e = !0) {
@@ -8043,7 +8008,7 @@ var go = new Set([
8043
8008
  }
8044
8009
  async _sendRaw(e, t = {}, n = !0, r = 0) {
8045
8010
  let i = (t) => {
8046
- if (this.disposed) throw new kn(e);
8011
+ if (this.disposed) throw new An(e);
8047
8012
  switch (t.route) {
8048
8013
  case "producer":
8049
8014
  this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === lo && this._handleCommandsQueue(this.datachannelCommandsQueue);
@@ -8079,11 +8044,11 @@ var go = new Set([
8079
8044
  return this.producerCommandDataChannelEnabled ? e === V.UPDATE_DISPLAY_LAYOUT || e === V.REPORT_PERF_STAT || e === V.REPORT_SHARING_STAT || e === V.REQUEST_ASR || e === V.ENABLE_VIDEO_SUSPEND || e === V.ENABLE_VIDEO_SUSPEND_SUGGEST || e === V.REPORT_NETWORK_STAT || e === V.CHANGE_SIMULCAST : !1;
8080
8045
  }
8081
8046
  _onOpen() {
8082
- this._debug.debug("[signaling] socket opened"), this._logger?.log(x.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStatSinceMark(this.connectionType === Cr.RETRY ? Er.RECONNECTED : Er.CONNECTED);
8047
+ this._debug.debug("[signaling] socket opened"), this._logger?.log(x.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStatSinceMark(this.connectionType === wr.RETRY ? Dr.RECONNECTED : Dr.CONNECTED);
8083
8048
  }
8084
8049
  _onMessage(e) {
8085
8050
  if (e.data === "ping") {
8086
- this._statPings?.mark(this._getSocketType()), this._markTransportStat(Er.FAILED_PINGS), R.onSignalingMessage(e.data), this.transport.readyState === WebSocket.OPEN && this.transport.send("pong").catch((e) => this._debug.warn("[signaling] unable to send pong", e));
8051
+ this._statPings?.mark(this._getSocketType()), this._markTransportStat(Dr.FAILED_PINGS), R.onSignalingMessage(e.data), this.transport.readyState === WebSocket.OPEN && this.transport.send("pong").catch((e) => this._debug.warn("[signaling] unable to send pong", e));
8087
8052
  return;
8088
8053
  }
8089
8054
  try {
@@ -8096,13 +8061,13 @@ var go = new Set([
8096
8061
  _handleMessage(e) {
8097
8062
  switch (e.type) {
8098
8063
  case "notification":
8099
- this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.onConnectionRestored(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._triggerEvent(wr.RECONNECT, e), e.conversation.topology && this._triggerEvent(wr.NOTIFICATION, {
8064
+ this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.onConnectionRestored(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._triggerEvent(Tr.RECONNECT, e), e.conversation.topology && this._triggerEvent(Tr.NOTIFICATION, {
8100
8065
  type: "notification",
8101
8066
  notification: K.TOPOLOGY_CHANGED,
8102
8067
  topology: e.conversation.topology
8103
8068
  }), this._resolvePendingRecordCommands(e)), this.lastStamp && this._handleCachedMessages(), e.recoverMessages?.forEach((e) => {
8104
8069
  e.notification === K.ACCEPTED_CALL && e.peerId.id === this.peerId && e.peerId.type === "WEB_TRANSPORT" || this._handleMessage(e);
8105
- }), this._handleCommandsQueue(this.websocketCommandsQueue)) : !this.connected || !this.listenersReady ? this.incomingCache.push(e) : this._triggerEvent(wr.NOTIFICATION, e);
8070
+ }), this._handleCommandsQueue(this.websocketCommandsQueue)) : !this.connected || !this.listenersReady ? this.incomingCache.push(e) : this._triggerEvent(Tr.NOTIFICATION, e);
8106
8071
  break;
8107
8072
  case "response":
8108
8073
  this._handleCommandResponse(!0, e);
@@ -8124,7 +8089,7 @@ var go = new Set([
8124
8089
  message: r,
8125
8090
  remote: !0
8126
8091
  });
8127
- this.conversationReject ? this.conversationReject(i) : this._triggerEvent(wr.NOTIFICATION, {
8092
+ this.conversationReject ? this.conversationReject(i) : this._triggerEvent(Tr.NOTIFICATION, {
8128
8093
  notification: K.CLOSED_CONVERSATION,
8129
8094
  callError: n,
8130
8095
  reason: O.SERVICE_UNAVAILABLE
@@ -8135,7 +8100,7 @@ var go = new Set([
8135
8100
  callError: n,
8136
8101
  message: r,
8137
8102
  remote: !0
8138
- })) : this._triggerEvent(wr.NOTIFICATION, {
8103
+ })) : this._triggerEvent(Tr.NOTIFICATION, {
8139
8104
  notification: K.CLOSED_CONVERSATION,
8140
8105
  callError: n,
8141
8106
  reason: e.reason
@@ -8158,7 +8123,7 @@ var go = new Set([
8158
8123
  break;
8159
8124
  case po.INVALID_TOKEN:
8160
8125
  default:
8161
- if (e.sequence || t === Tr.WEBTRANSPORT) break;
8126
+ if (e.sequence || t === Er.WEBTRANSPORT) break;
8162
8127
  if (this.connected) this._throwError(new k(e.reason || y.SIGNALING_FAILED, {
8163
8128
  callError: n ?? {
8164
8129
  scope: "unknown",
@@ -8188,10 +8153,10 @@ var go = new Set([
8188
8153
  }
8189
8154
  }
8190
8155
  _throwError(e) {
8191
- this._triggerEvent(wr.FAILED, e);
8156
+ this._triggerEvent(Tr.FAILED, e);
8192
8157
  }
8193
8158
  _onError(e) {
8194
- this._logger?.log(x.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(Er.FAILED_EXCEPTIONS, { string_value: this._describeErrorEvent(e) });
8159
+ this._logger?.log(x.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(Dr.FAILED_EXCEPTIONS, { string_value: this._describeErrorEvent(e) });
8195
8160
  }
8196
8161
  _describeErrorEvent(e) {
8197
8162
  let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
@@ -8212,7 +8177,7 @@ var go = new Set([
8212
8177
  ...Object.values(this.responseHandlers)
8213
8178
  ], n = this.conversationReject;
8214
8179
  return this.websocketCommandsQueue = [], this.datachannelCommandsQueue = [], this.responseHandlers = {}, this.incomingCache = [], this.conversationResolve = null, this.conversationReject = null, this.connected = !1, this.listenersReady = !1, this.lastStamp = 0, this.producerCommandDataChannelEnabled = !1, this.producerNotificationDataChannel && (this.producerNotificationDataChannel.onmessage = null, this.producerNotificationDataChannel = null), this.producerCommandDataChannel && (this.producerCommandDataChannel.onmessage = null, this.producerCommandDataChannel = null), super.setAbortSignal(void 0), this.transport.setAbortSignal(void 0), t.forEach((t) => {
8215
- window.clearTimeout(t.responseTimer), t.reject(e instanceof kn ? new kn(t.name) : e, !0);
8180
+ window.clearTimeout(t.responseTimer), t.reject(e instanceof An ? new An(t.name) : e, !0);
8216
8181
  }), n?.(e), !0;
8217
8182
  }
8218
8183
  _fail(e) {
@@ -8239,7 +8204,7 @@ var go = new Set([
8239
8204
  }
8240
8205
  _handleCommandResponse(t, n) {
8241
8206
  if (!Object.hasOwn(this.responseHandlers, n.sequence)) {
8242
- if (n.participants) for (let e of n.participants) this._triggerEvent(wr.NOTIFICATION, {
8207
+ if (n.participants) for (let e of n.participants) this._triggerEvent(Tr.NOTIFICATION, {
8243
8208
  ...n,
8244
8209
  notification: K.PARTICIPANT_ADDED,
8245
8210
  type: "notification",
@@ -8314,7 +8279,7 @@ var go = new Set([
8314
8279
  }
8315
8280
  _convertDisplayLayout(e) {
8316
8281
  let t = e, n = {};
8317
- for (let e in t) Object.hasOwn(t, e) && (n[e] = Pn(t[e]));
8282
+ for (let e in t) Object.hasOwn(t, e) && (n[e] = Fn(t[e]));
8318
8283
  return { layouts: n };
8319
8284
  }
8320
8285
  _waitConnectionMessage() {
@@ -8336,7 +8301,7 @@ var go = new Set([
8336
8301
  window.clearTimeout(this.connectionMessageWaitTimer), this.connectionMessageWaitTimer = 0;
8337
8302
  }
8338
8303
  _onTransportConnecting(e) {
8339
- let t = e.connectionType === Cr.RETRY ? Er.RECONNECTED : Er.CONNECTED;
8304
+ let t = e.connectionType === wr.RETRY ? Dr.RECONNECTED : Dr.CONNECTED;
8340
8305
  this._markTransportStat(t, e.source);
8341
8306
  }
8342
8307
  _onTransportFailed(e) {
@@ -8374,13 +8339,13 @@ var go = new Set([
8374
8339
  }
8375
8340
  }
8376
8341
  _onTransportReconnectScheduled(e) {
8377
- this.connectionType = Cr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(x.SOCKET_ACTION, "reconnect"), e.count === 1 && (this.reconnectStartedAt = performance.now());
8342
+ this.connectionType = wr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(x.SOCKET_ACTION, "reconnect"), e.count === 1 && (this.reconnectStartedAt = performance.now());
8378
8343
  }
8379
8344
  _logReconnectTimeout() {
8380
- this.reconnectStartedAt !== null && (this._logTransportStat(Er.TIMEOUT, { value: Math.round(performance.now() - this.reconnectStartedAt) }), this.reconnectStartedAt = null);
8345
+ this.reconnectStartedAt !== null && (this._logTransportStat(Dr.TIMEOUT, { value: Math.round(performance.now() - this.reconnectStartedAt) }), this.reconnectStartedAt = null);
8381
8346
  }
8382
8347
  _onTransportConnectionDead() {
8383
- this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(Er.FAILED_PINGS);
8348
+ this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(Dr.FAILED_PINGS);
8384
8349
  }
8385
8350
  _attachNotificationCallError(e) {
8386
8351
  e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !go.has(e.reason) && !e.errorCode || (e.callError = {
@@ -8403,18 +8368,18 @@ var go = new Set([
8403
8368
  return this.transport.type;
8404
8369
  }
8405
8370
  _markTransportStat(e, t = this._getSocketType()) {
8406
- let n = Dr[e][t];
8371
+ let n = Or[e][t];
8407
8372
  G.setMark(n);
8408
8373
  }
8409
8374
  _logTransportStat(e, t) {
8410
- let n = this._getSocketType(), r = Dr[e][n];
8375
+ let n = this._getSocketType(), r = Or[e][n];
8411
8376
  this._statAggregator?.logEventualStat({
8412
8377
  name: r,
8413
8378
  ...t
8414
8379
  });
8415
8380
  }
8416
8381
  _logTransportStatSinceMark(e) {
8417
- let t = this._getSocketType(), n = Dr[e][t];
8382
+ let t = this._getSocketType(), n = Or[e][t];
8418
8383
  this._statAggregator?.logEventualStatSinceMark({ name: n });
8419
8384
  }
8420
8385
  }, vo = /* @__PURE__ */ function(e) {
@@ -8720,7 +8685,7 @@ var Ko = class {
8720
8685
  this._fixNoPacketsChecked = !0, this._logger?.log(x.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
8721
8686
  return;
8722
8687
  }
8723
- !this._fixNoPacketsApplied && !e.bandwidth && e.packetsSent > 0 && (this._fixNoPacketsApplied = !0, this._logger?.log(x.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (no packets)"), this._toggleAudioPromise = this._mediaSource.toggleAudio(E.getMicrophonePermissionState() !== "denied"), this._toggleAudioPromise.catch(() => void 0));
8688
+ !this._fixNoPacketsApplied && !e.bandwidth && e.packetsSent > 0 && (this._fixNoPacketsApplied = !0, this._logger?.log(x.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (no packets)"), this._toggleAudioPromise = this._mediaSource.toggleAudio(D.getMicrophonePermissionState() !== "denied"), this._toggleAudioPromise.catch(() => void 0));
8724
8689
  }
8725
8690
  }
8726
8691
  _fixAudioDeviceTooManyPackets(e) {
@@ -8786,7 +8751,7 @@ var Ko = class {
8786
8751
  try {
8787
8752
  if (!this._features.setSinkId) throw Error("Feature \"setSinkId\" is not supported");
8788
8753
  if (!this._audioElement) return;
8789
- let e = E.getSavedOutput();
8754
+ let e = D.getSavedOutput();
8790
8755
  e && (await this._audioElement.setSinkId?.(e.deviceId), this._debug.debug("[audio] Output device changed", e));
8791
8756
  } catch (e) {
8792
8757
  throw this._logger?.log(x.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
@@ -8830,7 +8795,7 @@ var Ko = class {
8830
8795
  t.onpause = o, t.onstalled = o, t.onerror = o, t.onloadeddata = () => {
8831
8796
  this._statFirstMediaReceived.measure();
8832
8797
  }, this._audioElement = t, a(e);
8833
- let s = E.getChosenOutput();
8798
+ let s = D.getChosenOutput();
8834
8799
  s ? t.setSinkId?.(s.deviceId).then(() => {
8835
8800
  this._debug.debug("[audio] Output device", s);
8836
8801
  }).catch((e) => {
@@ -8930,8 +8895,8 @@ var Zo = 90, Qo = 3, $o = class extends Ye {
8930
8895
  this._lastRequests && (this._pendingRequests = this._lastRequests.slice(), this._forceNextFlush = !0, this._schedule());
8931
8896
  }
8932
8897
  cleanupParticipant(e) {
8933
- for (let t of Object.keys(this._requestedLayouts)) Rn(t).participantId === e && delete this._requestedLayouts[t];
8934
- for (let t of Object.keys(this._uncertainLayouts)) Rn(t).participantId === e && delete this._uncertainLayouts[t];
8898
+ for (let t of Object.keys(this._requestedLayouts)) zn(t).participantId === e && delete this._requestedLayouts[t];
8899
+ for (let t of Object.keys(this._uncertainLayouts)) zn(t).participantId === e && delete this._uncertainLayouts[t];
8935
8900
  }
8936
8901
  clear() {
8937
8902
  this._generation++, this._timer !== null && (window.clearTimeout(this._timer), this._timer = null), this._pendingPromises.forEach(({ resolve: e }) => e()), this._requestedLayouts = {}, this._uncertainLayouts = {}, this._pendingRequests = null, this._pendingPromises = [], this._lastRequests = null, this._inFlight = !1, this._lastFlushAt = null, this._forceNextFlush = !1;
@@ -8978,7 +8943,7 @@ var Zo = 90, Qo = 3, $o = class extends Ye {
8978
8943
  continue;
8979
8944
  }
8980
8945
  if (!r[a] && !this._isMe(a)) continue;
8981
- let o = Ln({
8946
+ let o = Rn({
8982
8947
  participantId: a,
8983
8948
  mediaType: i.mediaType,
8984
8949
  streamName: i.streamName
@@ -9031,8 +8996,8 @@ var Zo = 90, Qo = 3, $o = class extends Ye {
9031
8996
  constructor(e, t) {
9032
8997
  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]);
9033
8998
  try {
9034
- E.retainAudioContext(this);
9035
- let e = E.getAudioContext();
8999
+ D.retainAudioContext(this);
9000
+ let e = D.getAudioContext();
9036
9001
  this._analyser = e.createAnalyser(), this._analyser.fftSize = 1024, this._analyser.smoothingTimeConstant = 0, C.browserName() === "Safari" && (this._gainNode = e.createGain(), this._gainNode.gain.value = 1e-5, this._gainNode.connect(e.destination), this._analyser.connect(this._gainNode)), this._fftBins = new Uint8Array(this._analyser.frequencyBinCount), this._mediaStreamSource = e.createMediaStreamSource(this._stream), this._mediaStreamSource.connect(this._analyser);
9037
9002
  } catch {
9038
9003
  this.destroy();
@@ -9058,7 +9023,7 @@ var Zo = 90, Qo = 3, $o = class extends Ye {
9058
9023
  };
9059
9024
  }
9060
9025
  destroy() {
9061
- this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track), E.releaseAudioContext(this);
9026
+ 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), D.releaseAudioContext(this);
9062
9027
  }
9063
9028
  }, rs = class extends Ye {
9064
9029
  constructor(e) {
@@ -9071,9 +9036,9 @@ var Zo = 90, Qo = 3, $o = class extends Ye {
9071
9036
  let t = e.getSendAudioTrack();
9072
9037
  t && this.init(t);
9073
9038
  };
9074
- this.subscribe(e, Xt.SOURCE_CHANGED, (t) => {
9039
+ this.subscribe(e, Zt.SOURCE_CHANGED, (t) => {
9075
9040
  t.kind === A.audio && e.mediaSettings.isAudioEnabled && n();
9076
- }), this.subscribe(e, Xt.SOURCE_READY, n), n();
9041
+ }), this.subscribe(e, Zt.SOURCE_READY, n), n();
9077
9042
  }
9078
9043
  init(e) {
9079
9044
  this._stopDetector(), this._detector = new ns("local", e.clone());
@@ -9145,14 +9110,14 @@ var Zo = 90, Qo = 3, $o = class extends Ye {
9145
9110
  this._triggerEvent("VOLUMES_DETECTED", e);
9146
9111
  }
9147
9112
  _getAudioTrackLevelByParticipantId(e) {
9148
- let t = this._detectors.get(hi.AUDIO_MIX);
9113
+ let t = this._detectors.get(gi.AUDIO_MIX);
9149
9114
  return t ? t.getLevel() : this._getTransparentAudioLevelByParticipantId(e);
9150
9115
  }
9151
9116
  _getTransparentAudioLevelByParticipantId(e) {
9152
9117
  if (!this._activeParticipants?.includes(e)) return null;
9153
9118
  let t = null;
9154
9119
  return this._detectors.forEach((e, n) => {
9155
- if (!n.startsWith(`${hi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
9120
+ if (!n.startsWith(`${gi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
9156
9121
  let r = e.getLevel();
9157
9122
  (!t || r.real > t.real) && (t = r);
9158
9123
  }), t;
@@ -9584,7 +9549,7 @@ var Ls = "sessions", Rs = 5, zs = class e {
9584
9549
  return String(Ds(N.apiBaseUrl) || N.apiEndpoint());
9585
9550
  }
9586
9551
  static _read() {
9587
- let t = ht.get(Ls);
9552
+ let t = T.get(Ls);
9588
9553
  if (!t || typeof t != "object" || Array.isArray(t)) return {};
9589
9554
  let n = {};
9590
9555
  return Object.entries(t).forEach(([t, r]) => {
@@ -9593,10 +9558,10 @@ var Ls = "sessions", Rs = 5, zs = class e {
9593
9558
  }
9594
9559
  static _write(e) {
9595
9560
  if (Object.keys(e).length === 0) {
9596
- ht.remove(Ls);
9561
+ T.remove(Ls);
9597
9562
  return;
9598
9563
  }
9599
- ht.set(Ls, e);
9564
+ T.set(Ls, e);
9600
9565
  }
9601
9566
  static _isValid(e) {
9602
9567
  let t = e;
@@ -10703,7 +10668,7 @@ var _c = class {
10703
10668
  this.lastSeen[e] = t;
10704
10669
  }
10705
10670
  logMetrics() {
10706
- [Tr.WEBSOCKET, Tr.WEBTRANSPORT].forEach((e) => {
10671
+ [Er.WEBSOCKET, Er.WEBTRANSPORT].forEach((e) => {
10707
10672
  if (!this.trackerByTransport[e].hasData) return;
10708
10673
  let t = this.trackerByTransport[e].snapshot();
10709
10674
  this._logger.logClientStats({
@@ -10816,7 +10781,7 @@ function Mc(e, t, n, r) {
10816
10781
  }
10817
10782
  var Nc = 15, $ = class e extends Ye {
10818
10783
  constructor(e, t) {
10819
- super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Gr()), h(this, "_serverTimeOffset", 0), h(this, "_serverConversationId", null), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_hangupReason", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_pendingId", null), h(this, "_resolveSignalingInitialization", void 0), h(this, "_signalingInitialization", new Promise((e) => {
10784
+ super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Kr()), h(this, "_serverTimeOffset", 0), h(this, "_serverConversationId", null), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_hangupReason", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_pendingId", null), h(this, "_resolveSignalingInitialization", void 0), h(this, "_signalingInitialization", new Promise((e) => {
10820
10785
  this._resolveSignalingInitialization = e;
10821
10786
  })), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Go((e) => {
10822
10787
  if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
@@ -11161,7 +11126,7 @@ var Nc = 15, $ = class e extends Ye {
11161
11126
  return this._onFastHangup = e?.onFastHangup ?? this._onFastHangup, this._hangupPromise = Promise.resolve().then(async () => {
11162
11127
  let e = [];
11163
11128
  a && e.push(Promise.resolve().then(() => this._signaling.hangup(t)).catch((e) => {
11164
- if (!(e instanceof kn)) throw e;
11129
+ if (!(e instanceof An)) throw e;
11165
11130
  })), i && e.push(this._sendHangup(i, t, this._onFastHangup, o.signal));
11166
11131
  let n = (await this._waitForHangup(Promise.allSettled(e), o)).find((e) => e.status === "rejected");
11167
11132
  if (n?.status === "rejected") throw n.reason;
@@ -11386,7 +11351,7 @@ var Nc = 15, $ = class e extends Ye {
11386
11351
  }
11387
11352
  } else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
11388
11353
  Jo(p, m), this._applyServerConversation(p.id), this._pendingId = p.id, this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
11389
- let ee = await this._connectSignaling(Cr.START, p);
11354
+ let ee = await this._connectSignaling(wr.START, p);
11390
11355
  return this._throwIfClosed(), this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
11391
11356
  }
11392
11357
  async _joinConversation(e) {
@@ -11444,7 +11409,7 @@ var Nc = 15, $ = class e extends Ye {
11444
11409
  this._pendingId = l.id;
11445
11410
  }
11446
11411
  this._setConversationParams(l);
11447
- let d = await this._connectSignaling(Cr.JOIN, l);
11412
+ let d = await this._connectSignaling(wr.JOIN, l);
11448
11413
  return this._throwIfClosed(), this._setConversation(l, d, vo.JOINING), this._stats.lifecycle.markCallStarted(), d;
11449
11414
  }
11450
11415
  async _prepareConversation(e, t = j.USER, n, r, i) {
@@ -11506,14 +11471,14 @@ var Nc = 15, $ = class e extends Ye {
11506
11471
  conversationParams: n
11507
11472
  }), l.wt_endpoint = c);
11508
11473
  }
11509
- let u = await this._connectSignaling(Cr.ACCEPT, l);
11474
+ let u = await this._connectSignaling(wr.ACCEPT, l);
11510
11475
  return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(x.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._throwIfClosed(), this._setConversation(l, u, vo.INCOMING, t), u);
11511
11476
  }
11512
11477
  _createParticipant(e, t, n = !0) {
11513
11478
  let r = Object.assign({
11514
11479
  id: null,
11515
11480
  externalId: null,
11516
- mediaSettings: D(),
11481
+ mediaSettings: Jt(),
11517
11482
  participantState: {},
11518
11483
  state: X.CALLED,
11519
11484
  connectionStatus: null,
@@ -11650,11 +11615,11 @@ var Nc = 15, $ = class e extends Ye {
11650
11615
  }
11651
11616
  }
11652
11617
  _createMediaSource() {
11653
- let e = new Qt(this._debug, this._stats.logger);
11654
- return this.subscribe(e, Xt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Ko(e, this._debug, this._stats.logger), e;
11618
+ let e = new $t(this._debug, this._stats.logger);
11619
+ return this.subscribe(e, Zt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Zt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Ko(e, this._debug, this._stats.logger), e;
11655
11620
  }
11656
11621
  async _connectSignaling(e, t) {
11657
- this._throwIfClosed(), this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, wr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, wr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, wr.RECONNECT, this._onSignalingReconnect.bind(this));
11622
+ this._throwIfClosed(), this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, Tr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, Tr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, Tr.RECONNECT, this._onSignalingReconnect.bind(this));
11658
11623
  let n = await this._signaling.connect(e, t);
11659
11624
  return this._throwIfClosed(), this._stats.statAggregator.logEventualStatSinceMark({ name: U.SIGNALING_CONNECTED }), n;
11660
11625
  }
@@ -11694,7 +11659,7 @@ var Nc = 15, $ = class e extends Ye {
11694
11659
  return this._createParticipant({
11695
11660
  id: n,
11696
11661
  externalId: Z.fromSignalingParticipant(e, !0, !0),
11697
- mediaSettings: D(e.mediaSettings),
11662
+ mediaSettings: Jt(e.mediaSettings),
11698
11663
  participantState: M.mapParticipantState(e),
11699
11664
  state: e.state,
11700
11665
  roles: e.roles || [],
@@ -11732,7 +11697,7 @@ var Nc = 15, $ = class e extends Ye {
11732
11697
  this._registerParticipant({
11733
11698
  id: e,
11734
11699
  externalId: Z.fromSignalingParticipant(n, !0, !0),
11735
- mediaSettings: D(n.mediaSettings),
11700
+ mediaSettings: Jt(n.mediaSettings),
11736
11701
  participantState: M.mapParticipantState(n),
11737
11702
  state: n.state,
11738
11703
  roles: n.roles || [],
@@ -11876,7 +11841,7 @@ var Nc = 15, $ = class e extends Ye {
11876
11841
  }
11877
11842
  _allocateTransport() {
11878
11843
  if (!this._conversation || !this._mediaSource || this.isCallHeld || this._transport) return;
11879
- this._transport = new Na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback(), (e) => this._participants[e]?.state === X.ACCEPTED), this._debugInfo = new $o(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
11844
+ this._transport = new Na(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new $o(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
11880
11845
  let e = this._conversation.direction === vo.OUTGOING && !this._conversation.concurrent, t = this._participants;
11881
11846
  for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
11882
11847
  }
@@ -11887,8 +11852,8 @@ var Nc = 15, $ = class e extends Ye {
11887
11852
  this._transport && this._volumesDetector && (this._specListener = new ds(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
11888
11853
  }
11889
11854
  _logDevices() {
11890
- let e = E.getCameras().length, t = E.getMicrophones().length;
11891
- this._debug.debug("Cameras: " + e + (E.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (E.hasMicrophonePermission() ? "✔" : "✖")), this._debug.debug("Devices", E.getDevices()), this._stats.logger.log(x.DEVICES, `${e}_${t}`);
11855
+ let e = D.getCameras().length, t = D.getMicrophones().length;
11856
+ this._debug.debug("Cameras: " + e + (D.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (D.hasMicrophonePermission() ? "✔" : "✖")), this._debug.debug("Devices", D.getDevices()), this._stats.logger.log(x.DEVICES, `${e}_${t}`);
11892
11857
  }
11893
11858
  _logWithMediaSettings(e, t) {
11894
11859
  this._stats.logger.log(e, [t?.isAudioEnabled && "audio", t?.isVideoEnabled && "video"].filter(Boolean).join("_"));
@@ -11951,7 +11916,7 @@ var Nc = 15, $ = class e extends Ye {
11951
11916
  return;
11952
11917
  }
11953
11918
  e.catch((e) => {
11954
- e instanceof kn || this._debug.warn("[signaling] unable to send hangup", e);
11919
+ e instanceof An || this._debug.warn("[signaling] unable to send hangup", e);
11955
11920
  }).finally(() => this._signaling.dispose());
11956
11921
  }
11957
11922
  _onAddParticipant(e, t, n) {
@@ -11968,7 +11933,7 @@ var Nc = 15, $ = class e extends Ye {
11968
11933
  this._registerParticipant({
11969
11934
  id: e,
11970
11935
  externalId: Z.fromSignalingParticipant(t, !0, !0),
11971
- mediaSettings: D(t.mediaSettings),
11936
+ mediaSettings: Jt(t.mediaSettings),
11972
11937
  state: t.state,
11973
11938
  roles: t.roles || [],
11974
11939
  connectionStatus: this._buildConnectionStatus(e, t.sessionState, this._transport?.getState(), t.onHold),
@@ -12107,7 +12072,7 @@ var Nc = 15, $ = class e extends Ye {
12107
12072
  }
12108
12073
  async requestKeyFrame(e) {
12109
12074
  let t = {};
12110
- return t[Ln(e)] = { keyFrameRequested: !0 }, this._signaling.updateDisplayLayout(t);
12075
+ return t[Rn(e)] = { keyFrameRequested: !0 }, this._signaling.updateDisplayLayout(t);
12111
12076
  }
12112
12077
  async requestTestMode(e, t) {
12113
12078
  return this._signaling.requestTestMode(e, t);
@@ -12123,7 +12088,7 @@ var Nc = 15, $ = class e extends Ye {
12123
12088
  this._debug.log(`Unknown participant external ID ${t}`), r.push(e.id);
12124
12089
  continue;
12125
12090
  }
12126
- let s = Ln({
12091
+ let s = Rn({
12127
12092
  participantId: o,
12128
12093
  mediaType: a.mediaType,
12129
12094
  streamName: a.streamName
@@ -12132,9 +12097,9 @@ var Nc = 15, $ = class e extends Ye {
12132
12097
  c.lastRequestedLayouts[s] = a;
12133
12098
  }) : this._isMe(o) && n.push(() => {
12134
12099
  this._myLastRequestedLayouts[s] = a;
12135
- }), Mn(a) ? (this._isMe(o) && n.push(() => {
12100
+ }), Nn(a) ? (this._isMe(o) && n.push(() => {
12136
12101
  delete this._myLastRequestedLayouts[s];
12137
- }), this._streamIdByStreamDescription.has(s) && !this._cooldownTimestampByStreamDescription.has(s) && this._cooldownTimestampByStreamDescription.set(s, Date.now())) : (this._cooldownTimestampByStreamDescription.delete(s), !this._streamIdByStreamDescription.has(s) && N.videoTracksCount > 0 && this._streamIdByStreamDescription.set(s, null), t[s] = a), a.mediaType === H.SCREEN && !Mn(a) && G.setMark(G.getMarkNameScreenshareFirstFrame(o));
12102
+ }), this._streamIdByStreamDescription.has(s) && !this._cooldownTimestampByStreamDescription.has(s) && this._cooldownTimestampByStreamDescription.set(s, Date.now())) : (this._cooldownTimestampByStreamDescription.delete(s), !this._streamIdByStreamDescription.has(s) && N.videoTracksCount > 0 && this._streamIdByStreamDescription.set(s, null), t[s] = a), a.mediaType === H.SCREEN && !Nn(a) && G.setMark(G.getMarkNameScreenshareFirstFrame(o));
12138
12103
  }
12139
12104
  if (r.length) {
12140
12105
  this._reportMissingExternalIdsById(r, "updateDisplayLayout");
@@ -12163,7 +12128,7 @@ var Nc = 15, $ = class e extends Ye {
12163
12128
  }
12164
12129
  _stopStreaming(e) {
12165
12130
  if (this._cooldownTimestampByStreamDescription.delete(e), this._sequenceNumberByStreamDescription.set(e, this._signaling.getNextCommandSequenceNumber()), this._streamWaitTimerByStreamDescription.has(e) && (this._debug.log("Client asked to stop streaming before stream became available", e), window.clearTimeout(this._streamWaitTimerByStreamDescription.get(e)), this._streamWaitTimerByStreamDescription.delete(e)), this._streamIdByStreamDescription.get(e)) {
12166
- let t = this._participants, n = Rn(e), r = t[n.participantId], i = this._conversation?.externalId, a = this._isMe(n.participantId);
12131
+ let t = this._participants, n = zn(e), r = t[n.participantId], i = this._conversation?.externalId, a = this._isMe(n.participantId);
12167
12132
  if (r || a) {
12168
12133
  switch (n.mediaType) {
12169
12134
  case H.STREAM:
@@ -12201,7 +12166,7 @@ var Nc = 15, $ = class e extends Ye {
12201
12166
  }
12202
12167
  let r = [], i = this._participants;
12203
12168
  for (let [e, t] of Object.entries(n.errorCodeByParticipantId || {})) {
12204
- let n = Rn(e), a = i[n.participantId];
12169
+ let n = zn(e), a = i[n.participantId];
12205
12170
  if (a) {
12206
12171
  let e;
12207
12172
  typeof t == "number" ? e = Oo(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Do.UNKNOWN_ERROR), r.push({
@@ -12338,7 +12303,7 @@ var Nc = 15, $ = class e extends Ye {
12338
12303
  if (e.fastScreenShare && !e.participantStreamDescription) {
12339
12304
  let t = this._getStreamDescriptionById(e.streamId);
12340
12305
  if (t) {
12341
- let e = Rn(t), n = this._getParticipant(e.participantId);
12306
+ let e = zn(t), n = this._getParticipant(e.participantId);
12342
12307
  R.onRemoteScreenStream(n.externalId, null, this.id);
12343
12308
  return;
12344
12309
  }
@@ -12352,7 +12317,7 @@ var Nc = 15, $ = class e extends Ye {
12352
12317
  this._debug.log("skipping participant-sources-update notification since screenshare will be received over datachannel");
12353
12318
  return;
12354
12319
  }
12355
- let a = Ln(t), o = this._sequenceNumberByStreamDescription.get(a);
12320
+ let a = Rn(t), o = this._sequenceNumberByStreamDescription.get(a);
12356
12321
  if (o && o > e.sequenceNumber) {
12357
12322
  this._debug.warn(`Participant ${r} received outdated PAT response: sequence number ${e.sequenceNumber}; last sent sequence number for given participant is ${o}`), this._stats.logger.log(x.PAT_OUTDATED_RESPONSE);
12358
12323
  return;
@@ -12395,25 +12360,25 @@ var Nc = 15, $ = class e extends Ye {
12395
12360
  }
12396
12361
  _matchStreamDescription(e) {
12397
12362
  if (!e) return null;
12398
- if (this._streamIdByStreamDescription.has(Ln(e))) return e;
12363
+ if (this._streamIdByStreamDescription.has(Rn(e))) return e;
12399
12364
  let t = e.participantId;
12400
12365
  if (e.mediaType) {
12401
12366
  let e = {
12402
12367
  participantId: t,
12403
12368
  mediaType: null
12404
12369
  };
12405
- if (this._streamIdByStreamDescription.has(Ln(e))) return e;
12370
+ if (this._streamIdByStreamDescription.has(Rn(e))) return e;
12406
12371
  } else {
12407
12372
  let e = {
12408
12373
  participantId: t,
12409
12374
  mediaType: H.CAMERA
12410
12375
  };
12411
- if (this._streamIdByStreamDescription.has(Ln(e))) return e;
12376
+ if (this._streamIdByStreamDescription.has(Rn(e))) return e;
12412
12377
  let n = {
12413
12378
  participantId: t,
12414
12379
  mediaType: H.SCREEN
12415
12380
  };
12416
- if (this._streamIdByStreamDescription.has(Ln(n))) return n;
12381
+ if (this._streamIdByStreamDescription.has(Rn(n))) return n;
12417
12382
  }
12418
12383
  return this._debug.error("Received unrequested allocation", e), null;
12419
12384
  }
@@ -12666,7 +12631,7 @@ var Nc = 15, $ = class e extends Ye {
12666
12631
  let a = this._transport?.getState();
12667
12632
  return n.participants.forEach((e) => {
12668
12633
  let t = M.composeId(e), n = r[t];
12669
- this._updateParticipantExternalId(n, Z.fromSignalingParticipant(e, !0, !0)), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, Mo.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, D(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
12634
+ this._updateParticipantExternalId(n, Z.fromSignalingParticipant(e, !0, !0)), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, Mo.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, Jt(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
12670
12635
  }), this._participantListChunkToExternalChunk(n);
12671
12636
  }
12672
12637
  async _getInitialParticiapntListChunk() {
@@ -12822,7 +12787,7 @@ var Nc = 15, $ = class e extends Ye {
12822
12787
  let a = this._getParticipant(e);
12823
12788
  if (a) {
12824
12789
  this._updateParticipantSessionState(a, e, n.sessionState);
12825
- let t = D(n.mediaSettings);
12790
+ let t = Jt(n.mediaSettings);
12826
12791
  qt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
12827
12792
  let r = M.mapParticipantState(n), o = a.participantState;
12828
12793
  if (!M.isEqualParticipantState(r, o) && (await this._changeRemoteParticipantState(e, r), !this._conversation)) return;
@@ -12861,13 +12826,13 @@ var Nc = 15, $ = class e extends Ye {
12861
12826
  r = this._registerParticipantInCache(this._createParticipant({
12862
12827
  id: t,
12863
12828
  externalId: e.externalId ? Z.fromSignaling(e.externalId, e.deviceIdx) : void 0,
12864
- mediaSettings: D(e.mediaSettings)
12829
+ mediaSettings: Jt(e.mediaSettings)
12865
12830
  }, n));
12866
12831
  } else if (e.externalId) {
12867
12832
  let t = Z.fromSignaling(e.externalId, e.deviceIdx);
12868
12833
  r.externalId = t, this._api.cacheExternalId(r.id, t);
12869
12834
  }
12870
- r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
12835
+ r.state = X.ACCEPTED, r.mediaSettings = Jt(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
12871
12836
  let i = Object.keys(r.muteStates);
12872
12837
  if (i.length && this._onMuteParticipant({
12873
12838
  muteStates: r.muteStates,
@@ -12952,7 +12917,7 @@ var Nc = 15, $ = class e extends Ye {
12952
12917
  this._registerParticipant({
12953
12918
  id: t,
12954
12919
  externalId: Z.fromSignalingParticipant(r, !0, !0),
12955
- mediaSettings: D(r.mediaSettings),
12920
+ mediaSettings: Jt(r.mediaSettings),
12956
12921
  state: r.state,
12957
12922
  participantState: M.mapParticipantState(r),
12958
12923
  roles: r.roles || [],
@@ -12963,7 +12928,7 @@ var Nc = 15, $ = class e extends Ye {
12963
12928
  observedIds: r.observedIds || []
12964
12929
  }, i), n = this._getParticipant(t);
12965
12930
  }
12966
- n.state = X.CALLED, n.mediaSettings = D(e.participant?.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._allocateParticipantTransport(n.id, !0), R.onParticipantAdded(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
12931
+ n.state = X.CALLED, n.mediaSettings = Jt(e.participant?.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant?.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && this._allocateParticipantTransport(n.id, !0), R.onParticipantAdded(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
12967
12932
  }
12968
12933
  async _onJoinedParticipant(e) {
12969
12934
  this._debug.debug(`Participant joined [${e.participantId}]`), this._statFirstMediaReceived.markOnJoin(this._transport?.getTopology());
@@ -12979,7 +12944,7 @@ var Nc = 15, $ = class e extends Ye {
12979
12944
  this._registerParticipant({
12980
12945
  id: t,
12981
12946
  externalId: Z.fromSignalingParticipant(r, !0, !0),
12982
- mediaSettings: D(r.mediaSettings),
12947
+ mediaSettings: Jt(r.mediaSettings),
12983
12948
  state: r.state,
12984
12949
  participantState: M.mapParticipantState(r),
12985
12950
  roles: r.roles || [],
@@ -12992,7 +12957,7 @@ var Nc = 15, $ = class e extends Ye {
12992
12957
  isOnHold: !!r.onHold
12993
12958
  }, i), n = this._getParticipant(t);
12994
12959
  }
12995
- this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = D(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], P.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), R.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
12960
+ this._conversation && this._conversation.direction === vo.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = Jt(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);
12996
12961
  let i = Object.keys(n.muteStates);
12997
12962
  i.length && this._onMuteParticipant({
12998
12963
  muteStates: n.muteStates,
@@ -13009,7 +12974,7 @@ var Nc = 15, $ = class e extends Ye {
13009
12974
  }
13010
12975
  _onMediaSettingsChanged(e) {
13011
12976
  let t = M.composeMessageId(e);
13012
- this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), this._changeRemoteMediaSettings(t, D(e.mediaSettings));
12977
+ this._registerParticipantAndSetMarkersIfChunkEnabled(t, e.markers), this._changeRemoteMediaSettings(t, Jt(e.mediaSettings));
13013
12978
  }
13014
12979
  async _onParticipantStateChanged(e) {
13015
12980
  let t = M.composeMessageId(e), n = M.mapParticipantState(e);
@@ -13038,7 +13003,7 @@ var Nc = 15, $ = class e extends Ye {
13038
13003
  }
13039
13004
  async _onForceMediaSettingsChange(e) {
13040
13005
  if (!this._mediaSource || this._state === "HELD") return;
13041
- let t = this._mediaSource.mediaSettings, n = D(e.mediaSettings);
13006
+ let t = this._mediaSource.mediaSettings, n = Jt(e.mediaSettings);
13042
13007
  t.isAudioEnabled !== n.isAudioEnabled && await this._mediaSource.toggleAudio(n.isAudioEnabled), t.isVideoEnabled !== n.isVideoEnabled && await this._mediaSource.toggleVideo(n.isVideoEnabled), t.isScreenSharingEnabled !== n.isScreenSharingEnabled && await this._mediaSource.toggleScreenCapturing({
13043
13008
  captureScreen: n.isScreenSharingEnabled,
13044
13009
  fastScreenSharing: n.isFastScreenSharingEnabled,
@@ -13052,7 +13017,7 @@ var Nc = 15, $ = class e extends Ye {
13052
13017
  screenSharing: e.screenSharing,
13053
13018
  fastScreenSharing: e.fastScreenSharing
13054
13019
  };
13055
- this._serverSettings = Wr(this._serverSettings, t), this._transport && this._transport.updateSettings(this._serverSettings);
13020
+ this._serverSettings = Gr(this._serverSettings, t), this._transport && this._transport.updateSettings(this._serverSettings);
13056
13021
  }
13057
13022
  _onVideoQualityUpdate(e) {
13058
13023
  this._debug.debug("Got video quality update notification", e);
@@ -13068,7 +13033,7 @@ var Nc = 15, $ = class e extends Ye {
13068
13033
  camera: Object.assign({}, this._serverSettings.camera, t),
13069
13034
  screenSharing: null,
13070
13035
  fastScreenSharing: null
13071
- }, this._serverSettings = Wr(this._serverSettings, n), this._transport && this._transport.updateSettings(this._serverSettings);
13036
+ }, this._serverSettings = Gr(this._serverSettings, n), this._transport && this._transport.updateSettings(this._serverSettings);
13072
13037
  }
13073
13038
  async _onPeerRegistered(e) {
13074
13039
  this._registeredPeerReceived = !0, this._clearCalleeUnavailableWatchdog();
@@ -13287,7 +13252,7 @@ var Nc = 15, $ = class e extends Ye {
13287
13252
  if (this._isMe(r) || r === "") e = this._conversation.networkRating;
13288
13253
  else if (n[r]) e = n[r].networkRating;
13289
13254
  else continue;
13290
- if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, yi.getInstance().value = i, R.onLocalNetworkStatusChanged(i, this.id);
13255
+ if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, bi.getInstance().value = i, R.onLocalNetworkStatusChanged(i, this.id);
13291
13256
  else {
13292
13257
  let e = n[r];
13293
13258
  e.networkRating = i, t.push({
@@ -13388,7 +13353,7 @@ var Nc = 15, $ = class e extends Ye {
13388
13353
  a.length && (this._updateDisplayLayoutFromCache(i), this._setParticipantsStatus(a, n));
13389
13354
  }
13390
13355
  async _onTransportLocalStateChanged(e) {
13391
- if (this._debug.debug(`Local transport state has changed: ${e}`), e === q.CONNECTED && (E.releaseFirefoxMicrophonePermissionWarmup(), R.onLocalStatus(P.CONNECTED, this.id), this._transport?.getTopology() === J.SERVER)) {
13356
+ if (this._debug.debug(`Local transport state has changed: ${e}`), e === q.CONNECTED && (D.releaseFirefoxMicrophonePermissionWarmup(), R.onLocalStatus(P.CONNECTED, this.id), this._transport?.getTopology() === J.SERVER)) {
13392
13357
  let e = Object.values(this._myLastRequestedLayouts);
13393
13358
  await this.updateDisplayLayout(e), this._displayLayoutRequester.resend();
13394
13359
  }
@@ -13410,9 +13375,9 @@ var Nc = 15, $ = class e extends Ye {
13410
13375
  return e.every((e) => t[e]?.isOnHold);
13411
13376
  }
13412
13377
  _onRemoteTrackAdded(e, t, n) {
13413
- if (e.endsWith(hi.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t, this.id);
13414
- else if (e.startsWith(hi.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
13415
- else if (e.startsWith(hi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
13378
+ if (e.endsWith(gi.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t, this.id);
13379
+ else if (e.startsWith(gi.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
13380
+ else if (e.startsWith(gi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
13416
13381
  else {
13417
13382
  this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
13418
13383
  let r = this._getParticipant(e);
@@ -13439,7 +13404,7 @@ var Nc = 15, $ = class e extends Ye {
13439
13404
  }
13440
13405
  }
13441
13406
  async _removeAudioTrack(e, t, n) {
13442
- if (e !== hi.AUDIO_MIX) {
13407
+ if (e !== gi.AUDIO_MIX) {
13443
13408
  let n = this._getParticipant(e);
13444
13409
  if (!n || n.remoteStream && n.remoteStream !== t) return;
13445
13410
  }
@@ -13483,10 +13448,10 @@ var Nc = 15, $ = class e extends Ye {
13483
13448
  this._debugInfo && this._debugInfo.onRemoteDataStats(e, this._participants), this._fixAudioDevice(e.outbound.rtps), this._fixVideoDevice(e.outbound.rtps);
13484
13449
  }
13485
13450
  _fixAudioDevice(e) {
13486
- !E.hasMicrophone() || !this._audioFix || !this.mediaSettings?.isAudioEnabled || this._audioFix.fix(e);
13451
+ !D.hasMicrophone() || !this._audioFix || !this.mediaSettings?.isAudioEnabled || this._audioFix.fix(e);
13487
13452
  }
13488
13453
  _fixVideoDevice(e) {
13489
- !E.hasCamera() || !this._audioFix || !this.mediaSettings?.isVideoEnabled || this._audioFix.fixVideo(e);
13454
+ !D.hasCamera() || !this._audioFix || !this.mediaSettings?.isVideoEnabled || this._audioFix.fixVideo(e);
13490
13455
  }
13491
13456
  _toggleJoinAvailability() {
13492
13457
  let e = this._conversation && this._conversation.chatId, t = e && this._state !== "CLOSE" || !1;
@@ -13589,7 +13554,7 @@ var Nc = 15, $ = class e extends Ye {
13589
13554
  return this._createParticipant({
13590
13555
  id: r,
13591
13556
  externalId: Z.fromSignalingParticipant(e, !0, !0),
13592
- mediaSettings: D(e.mediaSettings),
13557
+ mediaSettings: Jt(e.mediaSettings),
13593
13558
  participantState: M.mapParticipantState(e),
13594
13559
  state: e.state,
13595
13560
  roles: e.roles || [],
@@ -13953,8 +13918,8 @@ var Wc = class extends Fc {
13953
13918
  _getCachedAnonymLogin() {
13954
13919
  let e = this._getAnonymLoginCacheKey();
13955
13920
  if (!e) return null;
13956
- let t = ht.get(e);
13957
- return Jc(t) ? t : (t && ht.remove(e), null);
13921
+ let t = T.get(e);
13922
+ return Jc(t) ? t : (t && T.remove(e), null);
13958
13923
  }
13959
13924
  _setCachedAnonymLogin(e) {
13960
13925
  let t = this._getAnonymLoginCacheKey();
@@ -13965,11 +13930,11 @@ var Wc = class extends Fc {
13965
13930
  uid: e.uid,
13966
13931
  external_user_id: qc(e)
13967
13932
  };
13968
- ht.set(t, n);
13933
+ T.set(t, n);
13969
13934
  }
13970
13935
  _removeCachedAnonymLogin() {
13971
13936
  let e = this._getAnonymLoginCacheKey();
13972
- e && ht.remove(e);
13937
+ e && T.remove(e);
13973
13938
  }
13974
13939
  _reauthorize() {
13975
13940
  return this._removeCachedAnonymLogin(), v.reauthorize(() => this.authorize());
@@ -14093,8 +14058,8 @@ var Wc = class extends Fc {
14093
14058
  }
14094
14059
  _ensureUuid() {
14095
14060
  if (!this._uuid) {
14096
- let e = ht.get("uuid");
14097
- e || (e = M.uuid(), ht.set("uuid", e)), this._uuid = String(e);
14061
+ let e = T.get("uuid");
14062
+ e || (e = M.uuid(), T.set("uuid", e)), this._uuid = String(e);
14098
14063
  }
14099
14064
  }
14100
14065
  deviceId() {
@@ -14253,22 +14218,25 @@ var Yc = /* @__PURE__ */ function(e) {
14253
14218
  t?.peerId && (n.peerId = t.peerId), await js("vchat.hangupConversation", n, !0, await Os(this._baseApiUrl, this._apiEnv));
14254
14219
  }
14255
14220
  }, $c, el = null, tl = !1, nl = {
14256
- getCameras: E.getCameras,
14257
- getMicrophones: E.getMicrophones,
14258
- getOutput: E.getOutput,
14259
- getVideoFacingMode: E.getVideoFacingMode,
14260
- hasCamera: E.hasCamera,
14261
- hasMicrophone: E.hasMicrophone,
14262
- getSavedCamera: E.getSavedCamera,
14263
- getSavedMicrophone: E.getSavedMicrophone,
14264
- getSavedOutput: E.getSavedOutput,
14265
- hasCameraPermission: E.hasCameraPermission,
14266
- hasMicrophonePermission: E.hasMicrophonePermission,
14267
- hasPermissions: E.hasPermissions,
14268
- getUserMedia: E.getUserMedia,
14269
- getUserVideo: E.getUserVideo,
14270
- getUserAudio: E.getUserAudio,
14271
- setResolution: E.setResolution,
14221
+ getCameras: D.getCameras,
14222
+ getMicrophones: D.getMicrophones,
14223
+ getOutput: D.getOutput,
14224
+ getVideoFacingMode: D.getVideoFacingMode,
14225
+ hasCamera: D.hasCamera,
14226
+ hasMicrophone: D.hasMicrophone,
14227
+ getSavedCamera: D.getSavedCamera,
14228
+ getSavedMicrophone: D.getSavedMicrophone,
14229
+ getSavedOutput: D.getSavedOutput,
14230
+ getCameraSelection: D.getCameraSelection,
14231
+ getMicrophoneSelection: D.getMicrophoneSelection,
14232
+ getOutputSelection: D.getOutputSelection,
14233
+ hasCameraPermission: D.hasCameraPermission,
14234
+ hasMicrophonePermission: D.hasMicrophonePermission,
14235
+ hasPermissions: D.hasPermissions,
14236
+ getUserMedia: D.getUserMedia,
14237
+ getUserVideo: D.getUserVideo,
14238
+ getUserAudio: D.getUserAudio,
14239
+ setResolution: D.setResolution,
14272
14240
  isBrowserSupported: C.isBrowserSupported,
14273
14241
  isScreenCapturingSupported: C.isScreenCapturingSupported,
14274
14242
  canSelectAudioInput: C.canSelectAudioInput,
@@ -14278,7 +14246,7 @@ var Yc = /* @__PURE__ */ function(e) {
14278
14246
  browserName: C.browserName,
14279
14247
  browserVersion: C.browserVersion,
14280
14248
  baseChromeVersion: C.baseChromeVersion,
14281
- getAudioContext: E.getAudioContext,
14249
+ getAudioContext: D.getAudioContext,
14282
14250
  isAudioShareSupported: C.isAudioShareSupported
14283
14251
  }, rl = { participantMarkerCompare: M.participantMarkerCompare };
14284
14252
  function il(e) {
@@ -14300,14 +14268,14 @@ function cl(e, t = null, n = {}, r = 1) {
14300
14268
  }, t && e.setSDK(t);
14301
14269
  }
14302
14270
  async function ll(t) {
14303
- N.set(t), $c || ($c = new Wc()), N.statQueueEnabled && (Vs.setApi($c), N.autoStartStats && gl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
14271
+ N.set(t), $c || ($c = new Wc()), N.statQueueEnabled && (Vs.setApi($c), N.autoStartStats && gl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await D.init();
14304
14272
  let n = C.getBrowserSupportFailure();
14305
14273
  if (n) throw new k(y.UNSUPPORTED, { callError: {
14306
14274
  scope: "internal",
14307
14275
  code: "environment",
14308
14276
  description: n
14309
14277
  } });
14310
- 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}`);
14278
+ z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${D.hasCameraPermission()}, Mic: ${D.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
14311
14279
  }
14312
14280
  async function ul(e, t = [b.AUDIO], n = "", r = !1, i = !1, a, o, s) {
14313
14281
  let c = [];
@@ -14419,7 +14387,7 @@ async function Dl(e, t = !1) {
14419
14387
  async function Ol(e, t) {
14420
14388
  let n = $.current();
14421
14389
  if (e === "videoinput" && It.contains(t)) return N.videoFacingMode = t, n ? (C.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
14422
- if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
14390
+ if (!await D._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
14423
14391
  if (n) return n.changeDevice(e);
14424
14392
  }
14425
14393
  async function kl(e, t) {
@@ -14701,8 +14669,8 @@ function wu() {
14701
14669
  [`Calls SDK ${N.sdkVersion}`, N.toJSON()],
14702
14670
  ["UserAgent:", navigator.userAgent],
14703
14671
  ["Screen resolution:", `${window.screen.width}x${window.screen.height}`],
14704
- ["Permissions:", `Camera: ${E.hasCameraPermission()}, Mic: ${E.hasMicrophonePermission()}`],
14705
- ["Devices:", E.getDevices()]
14672
+ ["Permissions:", `Camera: ${D.hasCameraPermission()}, Mic: ${D.hasMicrophonePermission()}`],
14673
+ ["Devices:", D.getDevices()]
14706
14674
  ], t = /* @__PURE__ */ new Date(), n = t.getTime(), r = t.toLocaleString("ru-RU", {
14707
14675
  dateStyle: "short",
14708
14676
  timeStyle: "long"
@@ -14710,7 +14678,7 @@ function wu() {
14710
14678
  return e.map((e) => ({
14711
14679
  h: r,
14712
14680
  t: n,
14713
- l: Dn.LOG,
14681
+ l: On.LOG,
14714
14682
  d: e
14715
14683
  }));
14716
14684
  }
@@ -14847,6 +14815,6 @@ function $u() {
14847
14815
  function ed() {
14848
14816
  return N.sdkVersion;
14849
14817
  }
14850
- typeof window < "u" && (window.__CALLS_SDK = wn);
14818
+ typeof window < "u" && (window.__CALLS_SDK = Tn);
14851
14819
  //#endregion
14852
- export { Wc as Api, Qc as ApiExternal, Zc as ArrayDequeue, v as AuthData, f as BaseLogger, vo as CallDirection, yo as CallType, bo as ChatRoomEventType, xo as ConversationFeature, So as ConversationOption, Dn as DebugMessageType, No as ExternalIdType, It as FacingMode, y as FatalError, k as HangupReason, O as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, To as MuteState, X as ParticipantState, Xc as ParticipantStateDataValue, P as ParticipantStatus, Yc as RecordRole, Eo as RoomsEventType, _o as Signaling, V as SignalingCommandType, Cr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, ko as UserRole, j as UserType, ns as VolumeDetector, vl as acceptCall, Fu as acceptPromotion, gu as activateRooms, fu as addMovie, wl as addParticipant, Tl as addParticipantInternal, _l as authorize, nl as browser, fl as callInternal, ul as callTo, kl as captureScreen, Al as captureVmoji, Du as changeAudioEffect, Yl as changeConversationOptions, Ol as changeDevice, Il as changeParticipantState, Fl as changePriorities, Eu as changeVideoEffect, Ql as chatHistory, Xl as chatMessage, Zl as chatMessageInternal, ru as createJoinLink, $l as customData, eu as customDataInternal, bu as debug, Cu as debugLogs, xu as debugMessage, Su as debugMessageWithContext, yl as declineCall, zu as enableFeatureForRoles, ql as enableVideoSuspend, Jl as enableVideoSuspendSuggest, Ru as feedback, su as forceRelayPolicy, Qu as getActiveCallId, au as getAnonymTokenByLink, Mu as getAudienceModeHands, hl as getInbounds, Iu as getParticipantListChunk, Lu as getParticipants, du as getStreamInfo, $u as getSyncedTime, ju as getWaitingHall, Bl as grantRoles, Vl as grantRolesInternal, Cl as hangup, ll as init, bl as joinCall, Sl as joinCallByLink, xl as joinCallInternal, Hl as muteParticipant, Ul as muteParticipantInternal, Wl as pinParticipant, Gl as pinParticipantInternal, pl as processPush, ml as processPushInternal, Nu as promoteParticipant, uu as publishStream, Ll as putHandsDown, Gu as removeHistoryRecords, iu as removeJoinLink, mu as removeMovie, El as removeParticipant, Dl as removeParticipantInternal, vu as removeRooms, Ju as requestAsr, zl as requestDisplayLayout, Pu as requestPromotion, ol as setAudioEffects, Ou as setAudioStream, Pl as setLocalResolution, il as setLogger, Kl as setMediaModifiers, yu as setStatisticsInterval, sl as setVad, al as setVideoEffects, jl as setVideoStream, cl as setVmoji, Au as setVmojiFill, ku as setVmojiSvg, ou as setVolume, Ku as startAsr, nu as startAudienceConversation, tu as startConversation, gl as startStats, cu as startStream, Yu as startUrlSharing, qu as stopAsr, lu as stopStream, Xu as stopUrlSharing, Zu as switchCall, _u as switchRoom, Nl as toggleLocalAudio, Ml as toggleLocalVideo, Rl as updateDisplayLayout, pu as updateMovie, hu as updateRooms, Tu as uploadDebugLogs, rl as utils, ed as version };
14820
+ export { Wc as Api, Qc as ApiExternal, Zc as ArrayDequeue, v as AuthData, f as BaseLogger, vo as CallDirection, yo as CallType, bo as ChatRoomEventType, xo as ConversationFeature, So as ConversationOption, On as DebugMessageType, No as ExternalIdType, It as FacingMode, y as FatalError, k as HangupReason, O as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, To as MuteState, X as ParticipantState, Xc as ParticipantStateDataValue, P as ParticipantStatus, Yc as RecordRole, Eo as RoomsEventType, _o as Signaling, V as SignalingCommandType, wr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, ko as UserRole, j as UserType, ns as VolumeDetector, vl as acceptCall, Fu as acceptPromotion, gu as activateRooms, fu as addMovie, wl as addParticipant, Tl as addParticipantInternal, _l as authorize, nl as browser, fl as callInternal, ul as callTo, kl as captureScreen, Al as captureVmoji, Du as changeAudioEffect, Yl as changeConversationOptions, Ol as changeDevice, Il as changeParticipantState, Fl as changePriorities, Eu as changeVideoEffect, Ql as chatHistory, Xl as chatMessage, Zl as chatMessageInternal, ru as createJoinLink, $l as customData, eu as customDataInternal, bu as debug, Cu as debugLogs, xu as debugMessage, Su as debugMessageWithContext, yl as declineCall, zu as enableFeatureForRoles, ql as enableVideoSuspend, Jl as enableVideoSuspendSuggest, Ru as feedback, su as forceRelayPolicy, Qu as getActiveCallId, au as getAnonymTokenByLink, Mu as getAudienceModeHands, hl as getInbounds, Iu as getParticipantListChunk, Lu as getParticipants, du as getStreamInfo, $u as getSyncedTime, ju as getWaitingHall, Bl as grantRoles, Vl as grantRolesInternal, Cl as hangup, ll as init, bl as joinCall, Sl as joinCallByLink, xl as joinCallInternal, Hl as muteParticipant, Ul as muteParticipantInternal, Wl as pinParticipant, Gl as pinParticipantInternal, pl as processPush, ml as processPushInternal, Nu as promoteParticipant, uu as publishStream, Ll as putHandsDown, Gu as removeHistoryRecords, iu as removeJoinLink, mu as removeMovie, El as removeParticipant, Dl as removeParticipantInternal, vu as removeRooms, Ju as requestAsr, zl as requestDisplayLayout, Pu as requestPromotion, ol as setAudioEffects, Ou as setAudioStream, Pl as setLocalResolution, il as setLogger, Kl as setMediaModifiers, yu as setStatisticsInterval, sl as setVad, al as setVideoEffects, jl as setVideoStream, cl as setVmoji, Au as setVmojiFill, ku as setVmojiSvg, ou as setVolume, Ku as startAsr, nu as startAudienceConversation, tu as startConversation, gl as startStats, cu as startStream, Yu as startUrlSharing, qu as stopAsr, lu as stopStream, Xu as stopUrlSharing, Zu as switchCall, _u as switchRoom, Nl as toggleLocalAudio, Ml as toggleLocalVideo, Rl as updateDisplayLayout, pu as updateMovie, hu as updateRooms, Tu as uploadDebugLogs, rl as utils, ed as version };