sip-connector 28.2.0 → 28.4.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.
@@ -1,22 +1,22 @@
1
- import { NameAddrHeader as dn, URI as ln, SessionStatus as hn, IncomingResponse as dt, C as lt } from "@krivega/jssip";
2
- import { MediaStreamTrackMock as un, createAudioMediaStreamTrackMock as En, createVideoMediaStreamTrackMock as gn } from "webrtc-mock";
3
- import { TypedEvents as G, EventEmitterProxy as w, Events as Tn } from "events-constructor";
4
- import Le from "debug";
5
- import { resolveRequesterByTimeout as mn, requesterByTimeoutsWithFailCalls as Sn, DelayRequester as Cn, hasCanceledError as pn, SetTimeoutRequest as ht } from "@krivega/timeout-requester";
6
- import { CancelableRequest as pe, isCanceledError as ut } from "@krivega/cancelable-promise";
7
- import { createActor as Rn, setup as Z, assign as f, fromPromise as Re } from "xstate";
8
- import { repeatedCallsAsync as we, hasCanceledError as Nn } from "repeated-calls";
9
- import { createStackPromises as Et, isPromiseIsNotActualError as gt } from "stack-promises";
10
- import { UAParser as In } from "ua-parser-js";
1
+ import { NameAddrHeader as ln, URI as hn, SessionStatus as un, IncomingResponse as lt, C as ht } from "@krivega/jssip";
2
+ import { MediaStreamTrackMock as gn, createAudioMediaStreamTrackMock as En, createVideoMediaStreamTrackMock as Tn } from "webrtc-mock";
3
+ import { TypedEvents as G, EventEmitterProxy as w, Events as mn } from "events-constructor";
4
+ import we from "debug";
5
+ import { resolveRequesterByTimeout as Sn, requesterByTimeoutsWithFailCalls as pn, DelayRequester as Cn, hasCanceledError as Rn, SetTimeoutRequest as ut } from "@krivega/timeout-requester";
6
+ import { CancelableRequest as Ce, isCanceledError as gt } from "@krivega/cancelable-promise";
7
+ import { createActor as Nn, setup as Z, assign as f, fromPromise as Re } from "xstate";
8
+ import { repeatedCallsAsync as Ge, hasCanceledError as In } from "repeated-calls";
9
+ import { createStackPromises as Et, isPromiseIsNotActualError as Tt } from "stack-promises";
10
+ import { UAParser as An } from "ua-parser-js";
11
11
  import "sequent-promises";
12
- import An, { isEqual as vn } from "lodash";
13
- const Ge = "sip-connector", fn = Le(Ge), bc = () => {
14
- Le.enable(`${Ge}:*`);
15
- }, Pc = () => {
16
- Le.enable(`-${Ge}:*`);
17
- }, A = (t) => fn.extend(t), Mn = "Error decline with 603", _n = 1006, On = (t) => typeof t == "object" && t !== null && "code" in t && t.code === _n, bn = (t) => t.message === Mn;
18
- var ge = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(ge || {}), V = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.ENTER_ROOM = "application/vinteo.webrtc.roomname", t.MIC = "application/vinteo.webrtc.mic", t.USE_LICENSE = "application/vinteo.webrtc.uselic", t.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", t.NOTIFY = "application/vinteo.webrtc.notify", t))(V || {}), $ = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.CHANNELS = "application/vinteo.webrtc.channels", t.MEDIA_STATE = "application/vinteo.webrtc.mediastate", t.REFUSAL = "application/vinteo.webrtc.refusal", t.STATS = "application/vinteo.webrtc.stats", t))($ || {}), F = /* @__PURE__ */ ((t) => (t.PAUSE_MAIN_CAM = "PAUSEMAINCAM", t.RESUME_MAIN_CAM = "RESUMEMAINCAM", t.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", t.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", t.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", t))(F || {}), Te = /* @__PURE__ */ ((t) => (t.ADMIN_STOP_MIC = "ADMINSTOPMIC", t.ADMIN_START_MIC = "ADMINSTARTMIC", t))(Te || {}), Tt = /* @__PURE__ */ ((t) => (t.H264 = "H264", t.VP8 = "VP8", t.VP9 = "VP9", t.AV1 = "AV1", t))(Tt || {}), g = /* @__PURE__ */ ((t) => (t.CONTENT_TYPE = "content-type", t.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", t.CONTENT_USE_LICENSE = "x-webrtc-use-license", t.PARTICIPANT_NAME = "x-webrtc-participant-name", t.INPUT_CHANNELS = "x-webrtc-input-channels", t.OUTPUT_CHANNELS = "x-webrtc-output-channels", t.MAIN_CAM = "x-webrtc-maincam", t.MIC = "x-webrtc-mic", t.MEDIA_SYNC = "x-webrtc-sync", t.MAIN_CAM_RESOLUTION = "x-webrtc-maincam-resolution", t.MEDIA_STATE = "x-webrtc-media-state", t.MEDIA_TYPE = "x-vinteo-media-type", t.MAIN_CAM_STATE = "x-vinteo-maincam-state", t.MIC_STATE = "x-vinteo-mic-state", t.CONTENT_PARTICIPANT_STATE = "x-webrtc-partstate", t.AUDIO_ID = "x-webrtc-audioid", t.SPECTATOR_MODE = "x-webrtc-spectator-mode", t.NOTIFY = "x-vinteo-notify", t.CONTENT_ENABLE_MEDIA_DEVICE = "x-webrtc-request-enable-media-device", t.CONTENTED_STREAM_STATE = "x-webrtc-share-state", t.CONTENTED_STREAM_CODEC = "x-webrtc-share-codec", t.AVAILABLE_INCOMING_BITRATE = "x-webrtc-available-incoming-bitrate", t.AUDIO_TRACK_COUNT = "x-webrtc-audio-track-count", t.VIDEO_TRACK_COUNT = "x-webrtc-video-track-count", t.TRACKS_DIRECTION = "x-webrtc-tracks-direction", t.BEARER_TOKEN = "x-bearer-token", t.IS_DIRECT_PEER_TO_PEER = "x-webrtc-is-direct-p2p", t))(g || {}), oe = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", t.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", t))(oe || {}), K = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: CONTENTEND", t.ACK_PERMISSION_TO_START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", t.STOPPED_CLIENT_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", t.ENABLE_MAIN_CAM = "x-webrtc-request-enable-media-device: LETMESTARTMAINCAM", t))(K || {}), me = /* @__PURE__ */ ((t) => (t.ADMIN_SYNC_FORCED = "1", t.ADMIN_SYNC_NOT_FORCED = "0", t))(me || {}), ke = /* @__PURE__ */ ((t) => (t.SPECTATOR_MANUAL = "0", t.BY_STATE_CAM = "1", t.SPECTATOR_FORCED = "2", t))(ke || {}), mt = /* @__PURE__ */ ((t) => (t.AUDIO = "AUDIO", t.VIDEO = "VIDEO", t.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", t))(mt || {});
19
- const B = (t) => typeof t == "string" && t.trim().length > 0, Pn = (t) => typeof t == "object" && t !== null && !Array.isArray(t), St = (t) => typeof t == "boolean", yn = (t) => Array.isArray(t) && t.every(B), Ct = [
12
+ import vn, { isEqual as fn } from "lodash";
13
+ const ke = "sip-connector", Mn = we(ke), Pc = () => {
14
+ we.enable(`${ke}:*`);
15
+ }, yc = () => {
16
+ we.enable(`-${ke}:*`);
17
+ }, A = (t) => Mn.extend(t), _n = "Error decline with 603", On = 1006, bn = (t) => typeof t == "object" && t !== null && "code" in t && t.code === On, Pn = (t) => t.message === _n;
18
+ var Ee = /* @__PURE__ */ ((t) => (t.SPECTATOR = "SPECTATOR", t.PARTICIPANT = "PARTICIPANT", t))(Ee || {}), V = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.ENTER_ROOM = "application/vinteo.webrtc.roomname", t.MIC = "application/vinteo.webrtc.mic", t.USE_LICENSE = "application/vinteo.webrtc.uselic", t.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", t.NOTIFY = "application/vinteo.webrtc.notify", t))(V || {}), $ = /* @__PURE__ */ ((t) => (t.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", t.MAIN_CAM = "application/vinteo.webrtc.maincam", t.CHANNELS = "application/vinteo.webrtc.channels", t.MEDIA_STATE = "application/vinteo.webrtc.mediastate", t.REFUSAL = "application/vinteo.webrtc.refusal", t.STATS = "application/vinteo.webrtc.stats", t))($ || {}), F = /* @__PURE__ */ ((t) => (t.PAUSE_MAIN_CAM = "PAUSEMAINCAM", t.RESUME_MAIN_CAM = "RESUMEMAINCAM", t.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", t.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", t.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", t))(F || {}), Te = /* @__PURE__ */ ((t) => (t.ADMIN_STOP_MIC = "ADMINSTOPMIC", t.ADMIN_START_MIC = "ADMINSTARTMIC", t))(Te || {}), mt = /* @__PURE__ */ ((t) => (t.H264 = "H264", t.VP8 = "VP8", t.VP9 = "VP9", t.AV1 = "AV1", t))(mt || {}), E = /* @__PURE__ */ ((t) => (t.CONTENT_TYPE = "content-type", t.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", t.CONTENT_USE_LICENSE = "x-webrtc-use-license", t.PARTICIPANT_NAME = "x-webrtc-participant-name", t.INPUT_CHANNELS = "x-webrtc-input-channels", t.OUTPUT_CHANNELS = "x-webrtc-output-channels", t.MAIN_CAM = "x-webrtc-maincam", t.MIC = "x-webrtc-mic", t.MEDIA_SYNC = "x-webrtc-sync", t.MAIN_CAM_RESOLUTION = "x-webrtc-maincam-resolution", t.MEDIA_STATE = "x-webrtc-media-state", t.MEDIA_TYPE = "x-vinteo-media-type", t.MAIN_CAM_STATE = "x-vinteo-maincam-state", t.MIC_STATE = "x-vinteo-mic-state", t.CONTENT_PARTICIPANT_STATE = "x-webrtc-partstate", t.AUDIO_ID = "x-webrtc-audioid", t.SPECTATOR_MODE = "x-webrtc-spectator-mode", t.NOTIFY = "x-vinteo-notify", t.CONTENT_ENABLE_MEDIA_DEVICE = "x-webrtc-request-enable-media-device", t.CONTENTED_STREAM_STATE = "x-webrtc-share-state", t.CONTENTED_STREAM_CODEC = "x-webrtc-share-codec", t.AVAILABLE_INCOMING_BITRATE = "x-webrtc-available-incoming-bitrate", t.AUDIO_TRACK_COUNT = "x-webrtc-audio-track-count", t.VIDEO_TRACK_COUNT = "x-webrtc-video-track-count", t.TRACKS_DIRECTION = "x-webrtc-tracks-direction", t.BEARER_TOKEN = "x-bearer-token", t.IS_DIRECT_PEER_TO_PEER = "x-webrtc-is-direct-p2p", t))(E || {}), oe = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "CONTENTEND", t.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", t))(oe || {}), K = /* @__PURE__ */ ((t) => (t.AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: YOUCANRECEIVECONTENT", t.NOT_AVAILABLE_CONTENTED_STREAM = "x-webrtc-share-state: CONTENTEND", t.ACK_PERMISSION_TO_START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", t.STOPPED_CLIENT_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", t.ENABLE_MAIN_CAM = "x-webrtc-request-enable-media-device: LETMESTARTMAINCAM", t))(K || {}), me = /* @__PURE__ */ ((t) => (t.ADMIN_SYNC_FORCED = "1", t.ADMIN_SYNC_NOT_FORCED = "0", t))(me || {}), Ue = /* @__PURE__ */ ((t) => (t.SPECTATOR_MANUAL = "0", t.BY_STATE_CAM = "1", t.SPECTATOR_FORCED = "2", t))(Ue || {}), St = /* @__PURE__ */ ((t) => (t.AUDIO = "AUDIO", t.VIDEO = "VIDEO", t.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", t))(St || {});
19
+ const B = (t) => typeof t == "string" && t.trim().length > 0, Oe = (t) => typeof t == "number" && !Number.isNaN(t) && Number.isFinite(t), yn = (t) => typeof t == "object" && t !== null && !Array.isArray(t), pt = (t) => typeof t == "boolean", Dn = (t) => Array.isArray(t) && t.every(B), Ct = [
20
20
  "enter-room",
21
21
  "main-cam-control",
22
22
  "use-license",
@@ -46,13 +46,13 @@ const B = (t) => typeof t == "string" && t.trim().length > 0, Pn = (t) => typeof
46
46
  "admin:stop-mic",
47
47
  "admin:force-sync-media-state",
48
48
  "failed-send-room-direct-p2p"
49
- ], Dn = () => new G(Ct), Ln = (t) => !(!Pn(t) || !B(t.conference) || !B(t.participant) || !B(t.jwt)), Q = (t, e) => {
49
+ ], Ln = () => new G(Ct), wn = (t) => !(!yn(t) || !B(t.conference) || !B(t.participant) || !B(t.jwt)), Q = (t, e) => {
50
50
  const n = e.toLowerCase(), s = Object.entries(t).find(([, r]) => typeof r == "string" && r.toLowerCase() === n);
51
51
  return s ? s[1] : void 0;
52
- }, wn = (t) => typeof t == "string" && !Number.isNaN(Number(t)) && Number.isFinite(Number(t)), Gn = (t) => {
53
- if (wn(t))
52
+ }, Gn = (t) => typeof t == "string" && !Number.isNaN(Number(t)) && Number.isFinite(Number(t)), kn = (t) => {
53
+ if (Gn(t))
54
54
  return Number(t);
55
- }, kn = (t) => {
55
+ }, Un = (t) => {
56
56
  const e = t.toLowerCase();
57
57
  if (e === "true" || e === "1")
58
58
  return !0;
@@ -64,56 +64,56 @@ const B = (t) => typeof t == "string" && t.trim().length > 0, Pn = (t) => typeof
64
64
  return;
65
65
  const s = n.toLowerCase();
66
66
  switch (e) {
67
- case g.BEARER_TOKEN:
67
+ case E.BEARER_TOKEN:
68
68
  return n;
69
- case g.CONTENT_ENTER_ROOM:
70
- case g.PARTICIPANT_NAME:
71
- case g.INPUT_CHANNELS:
72
- case g.OUTPUT_CHANNELS:
73
- case g.TRACKS_DIRECTION:
74
- case g.AUDIO_ID:
75
- case g.MAIN_CAM_RESOLUTION:
76
- case g.MEDIA_STATE:
77
- case g.NOTIFY:
78
- case g.CONTENT_ENABLE_MEDIA_DEVICE:
69
+ case E.CONTENT_ENTER_ROOM:
70
+ case E.PARTICIPANT_NAME:
71
+ case E.INPUT_CHANNELS:
72
+ case E.OUTPUT_CHANNELS:
73
+ case E.TRACKS_DIRECTION:
74
+ case E.AUDIO_ID:
75
+ case E.MAIN_CAM_RESOLUTION:
76
+ case E.MEDIA_STATE:
77
+ case E.NOTIFY:
78
+ case E.CONTENT_ENABLE_MEDIA_DEVICE:
79
79
  return s;
80
- case g.MEDIA_TYPE:
81
- case g.MAIN_CAM_STATE:
82
- case g.MIC_STATE:
83
- case g.AVAILABLE_INCOMING_BITRATE:
84
- case g.AUDIO_TRACK_COUNT:
85
- case g.VIDEO_TRACK_COUNT:
86
- return Gn(s);
87
- case g.CONTENTED_STREAM_CODEC:
88
- return Q(Tt, s);
89
- case g.CONTENT_TYPE:
90
- return Q(V, s);
91
- case g.CONTENT_USE_LICENSE:
80
+ case E.MEDIA_TYPE:
81
+ case E.MAIN_CAM_STATE:
82
+ case E.MIC_STATE:
83
+ case E.AVAILABLE_INCOMING_BITRATE:
84
+ case E.AUDIO_TRACK_COUNT:
85
+ case E.VIDEO_TRACK_COUNT:
86
+ return kn(s);
87
+ case E.CONTENTED_STREAM_CODEC:
92
88
  return Q(mt, s);
93
- case g.MAIN_CAM:
89
+ case E.CONTENT_TYPE:
90
+ return Q(V, s);
91
+ case E.CONTENT_USE_LICENSE:
92
+ return Q(St, s);
93
+ case E.MAIN_CAM:
94
94
  return Q(F, s);
95
- case g.MIC:
95
+ case E.MIC:
96
96
  return Q(Te, s);
97
- case g.MEDIA_SYNC:
97
+ case E.MEDIA_SYNC:
98
98
  return Q(me, s);
99
- case g.CONTENT_PARTICIPANT_STATE:
100
- return Q(ge, s);
101
- case g.SPECTATOR_MODE:
102
- return Q(ke, s);
103
- case g.CONTENTED_STREAM_STATE:
99
+ case E.CONTENT_PARTICIPANT_STATE:
100
+ return Q(Ee, s);
101
+ case E.SPECTATOR_MODE:
102
+ return Q(Ue, s);
103
+ case E.CONTENTED_STREAM_STATE:
104
104
  return Q(oe, s);
105
- case g.IS_DIRECT_PEER_TO_PEER:
106
- return kn(s);
105
+ case E.IS_DIRECT_PEER_TO_PEER:
106
+ return Un(s);
107
107
  default:
108
108
  return;
109
109
  }
110
110
  };
111
111
  var U = /* @__PURE__ */ ((t) => (t.CHANNELS = "channels", t.WEBCAST_STARTED = "WebcastStarted", t.WEBCAST_STOPPED = "WebcastStopped", t.ACCOUNT_CHANGED = "accountChanged", t.ACCOUNT_DELETED = "accountDeleted", t.ADDED_TO_LIST_MODERATORS = "addedToListModerators", t.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", t.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", t.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", t.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", t.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", t))(U || {});
112
- const Be = A("ApiManager");
113
- class Un extends w {
112
+ const $e = A("ApiManager");
113
+ class Fn extends w {
114
114
  callManager;
115
115
  constructor() {
116
- super(Dn());
116
+ super(Ln());
117
117
  }
118
118
  subscribe({
119
119
  connectionManager: e,
@@ -146,7 +146,7 @@ class Un extends w {
146
146
  });
147
147
  }
148
148
  async sendChannels({ inputChannels: e, outputChannels: n }) {
149
- const s = this.getEstablishedRTCSessionProtected(), r = `${g.INPUT_CHANNELS}: ${e}`, i = `${g.OUTPUT_CHANNELS}: ${n}`, a = [
149
+ const s = this.getEstablishedRTCSessionProtected(), r = `${E.INPUT_CHANNELS}: ${e}`, i = `${E.OUTPUT_CHANNELS}: ${n}`, a = [
150
150
  r,
151
151
  i
152
152
  ];
@@ -158,7 +158,7 @@ class Un extends w {
158
158
  });
159
159
  }
160
160
  async sendMediaState({ cam: e, mic: n }, s = {}) {
161
- const r = this.getEstablishedRTCSessionProtected(), i = `${g.MEDIA_STATE}: currentstate`, a = `${g.MAIN_CAM_STATE}: ${Number(e)}`, o = `${g.MIC_STATE}: ${Number(n)}`, c = [
161
+ const r = this.getEstablishedRTCSessionProtected(), i = `${E.MEDIA_STATE}: currentstate`, a = `${E.MAIN_CAM_STATE}: ${Number(e)}`, o = `${E.MIC_STATE}: ${Number(n)}`, c = [
162
162
  i,
163
163
  a,
164
164
  o
@@ -172,14 +172,14 @@ class Un extends w {
172
172
  async sendStats({
173
173
  availableIncomingBitrate: e
174
174
  }) {
175
- const n = this.getEstablishedRTCSessionProtected(), r = [`${g.AVAILABLE_INCOMING_BITRATE}: ${e}`];
175
+ const n = this.getEstablishedRTCSessionProtected(), r = [`${E.AVAILABLE_INCOMING_BITRATE}: ${e}`];
176
176
  return n.sendInfo($.STATS, void 0, {
177
177
  noTerminateWhenError: !0,
178
178
  extraHeaders: r
179
179
  });
180
180
  }
181
181
  async sendRefusalToTurnOn(e, n = {}) {
182
- const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${g.MEDIA_TYPE}: ${a}`];
182
+ const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${E.MEDIA_TYPE}: ${a}`];
183
183
  return s.sendInfo($.REFUSAL, void 0, {
184
184
  noTerminateWhenError: !0,
185
185
  ...n,
@@ -219,7 +219,7 @@ class Un extends w {
219
219
  ...e,
220
220
  extraHeaders: s
221
221
  }).catch((r) => {
222
- if (bn(r))
222
+ if (Pn(r))
223
223
  throw r;
224
224
  });
225
225
  }
@@ -234,13 +234,13 @@ class Un extends w {
234
234
  };
235
235
  maybeHandleNotify = (e) => {
236
236
  try {
237
- const n = e.getHeader(g.NOTIFY);
237
+ const n = e.getHeader(E.NOTIFY);
238
238
  if (n) {
239
239
  const s = JSON.parse(n);
240
240
  this.handleNotify(s);
241
241
  }
242
242
  } catch (n) {
243
- Be("error parse notify", n);
243
+ $e("error parse notify", n);
244
244
  }
245
245
  };
246
246
  handleNotify = (e) => {
@@ -290,14 +290,14 @@ class Un extends w {
290
290
  break;
291
291
  }
292
292
  default:
293
- Be("unknown cmd", e);
293
+ $e("unknown cmd", e);
294
294
  }
295
295
  };
296
296
  handleNewInfo = (e) => {
297
297
  const { originator: n } = e;
298
298
  if (n !== "remote")
299
299
  return;
300
- const { request: s } = e, r = s, i = y(r, g.CONTENT_TYPE);
300
+ const { request: s } = e, r = s, i = y(r, E.CONTENT_TYPE);
301
301
  if (i !== void 0)
302
302
  switch (i) {
303
303
  case V.ENTER_ROOM: {
@@ -412,13 +412,13 @@ class Un extends w {
412
412
  participant: n,
413
413
  jwt: s
414
414
  };
415
- Ln(r) && this.events.trigger(
415
+ wn(r) && this.events.trigger(
416
416
  "conference:participant-token-issued",
417
417
  r
418
418
  );
419
419
  };
420
420
  maybeTriggerChannels = (e) => {
421
- const n = y(e, g.INPUT_CHANNELS), s = y(e, g.OUTPUT_CHANNELS);
421
+ const n = y(e, E.INPUT_CHANNELS), s = y(e, E.OUTPUT_CHANNELS);
422
422
  if (n !== void 0 && s !== void 0) {
423
423
  const r = {
424
424
  inputChannels: n,
@@ -428,7 +428,7 @@ class Un extends w {
428
428
  }
429
429
  };
430
430
  triggerEnterRoom = (e) => {
431
- const n = y(e, g.CONTENT_ENTER_ROOM), s = y(e, g.PARTICIPANT_NAME), r = y(e, g.BEARER_TOKEN), i = y(e, g.IS_DIRECT_PEER_TO_PEER);
431
+ const n = y(e, E.CONTENT_ENTER_ROOM), s = y(e, E.PARTICIPANT_NAME), r = y(e, E.BEARER_TOKEN), i = y(e, E.IS_DIRECT_PEER_TO_PEER);
432
432
  n !== void 0 && s !== void 0 && this.events.trigger("enter-room", {
433
433
  room: n,
434
434
  participantName: s,
@@ -437,11 +437,11 @@ class Un extends w {
437
437
  });
438
438
  };
439
439
  triggerContentedStreamState = (e) => {
440
- const n = y(e, g.CONTENTED_STREAM_STATE);
440
+ const n = y(e, E.CONTENTED_STREAM_STATE);
441
441
  if (n !== void 0)
442
442
  switch (n) {
443
443
  case oe.AVAILABLE_CONTENTED_STREAM: {
444
- const s = y(e, g.CONTENTED_STREAM_CODEC);
444
+ const s = y(e, E.CONTENTED_STREAM_CODEC);
445
445
  this.events.trigger("contented-stream:available", { codec: s });
446
446
  break;
447
447
  }
@@ -456,9 +456,9 @@ class Un extends w {
456
456
  }
457
457
  };
458
458
  maybeTriggerParticipantMoveRequest = (e) => {
459
- const n = y(e, g.CONTENT_PARTICIPANT_STATE), s = y(e, g.AUDIO_ID), r = y(e, g.SPECTATOR_MODE);
460
- if (n === ge.SPECTATOR) {
461
- const i = r === ke.BY_STATE_CAM;
459
+ const n = y(e, E.CONTENT_PARTICIPANT_STATE), s = y(e, E.AUDIO_ID), r = y(e, E.SPECTATOR_MODE);
460
+ if (n === Ee.SPECTATOR) {
461
+ const i = r === Ue.BY_STATE_CAM;
462
462
  s === void 0 ? (this.events.trigger("participant:move-request-to-spectators-synthetic", {
463
463
  isAvailableSendingMedia: i
464
464
  }), this.events.trigger("participant:move-request-to-spectators", {
@@ -473,10 +473,10 @@ class Un extends w {
473
473
  audioId: s
474
474
  }));
475
475
  }
476
- n === ge.PARTICIPANT && this.events.trigger("participant:move-request-to-participants");
476
+ n === Ee.PARTICIPANT && this.events.trigger("participant:move-request-to-participants");
477
477
  };
478
478
  triggerMainCamControl = (e) => {
479
- const n = y(e, g.MAIN_CAM), s = y(e, g.MEDIA_SYNC), r = s === me.ADMIN_SYNC_FORCED;
479
+ const n = y(e, E.MAIN_CAM), s = y(e, E.MEDIA_SYNC), r = s === me.ADMIN_SYNC_FORCED;
480
480
  if (n === F.ADMIN_START_MAIN_CAM) {
481
481
  this.events.trigger("admin:start-main-cam", { isSyncForced: r });
482
482
  return;
@@ -486,29 +486,29 @@ class Un extends w {
486
486
  return;
487
487
  }
488
488
  (n === F.RESUME_MAIN_CAM || n === F.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger("admin:force-sync-media-state", { isSyncForced: r });
489
- const i = y(e, g.MAIN_CAM_RESOLUTION);
489
+ const i = y(e, E.MAIN_CAM_RESOLUTION);
490
490
  this.events.trigger("main-cam-control", {
491
491
  mainCam: n,
492
492
  resolutionMainCam: i
493
493
  });
494
494
  };
495
495
  triggerMicControl = (e) => {
496
- const n = y(e, g.MIC), r = y(e, g.MEDIA_SYNC) === me.ADMIN_SYNC_FORCED;
496
+ const n = y(e, E.MIC), r = y(e, E.MEDIA_SYNC) === me.ADMIN_SYNC_FORCED;
497
497
  n === Te.ADMIN_START_MIC ? this.events.trigger("admin:start-mic", { isSyncForced: r }) : n === Te.ADMIN_STOP_MIC && this.events.trigger("admin:stop-mic", { isSyncForced: r });
498
498
  };
499
499
  triggerUseLicense = (e) => {
500
- const n = y(e, g.CONTENT_USE_LICENSE);
500
+ const n = y(e, E.CONTENT_USE_LICENSE);
501
501
  n !== void 0 && this.events.trigger("use-license", n);
502
502
  };
503
503
  async sendEnterRoomProtected(e) {
504
504
  return this.getEstablishedRTCSessionProtected().sendInfo(V.ENTER_ROOM, void 0, { extraHeaders: e });
505
505
  }
506
506
  }
507
- const $e = 0, Fn = 30;
508
- class Bn {
509
- countInner = $e;
510
- initialCount = $e;
511
- limitInner = Fn;
507
+ const xe = 0, Bn = 30;
508
+ class $n {
509
+ countInner = xe;
510
+ initialCount = xe;
511
+ limitInner = Bn;
512
512
  isInProgress = !1;
513
513
  onStatusChange;
514
514
  constructor({
@@ -541,7 +541,7 @@ class Bn {
541
541
  this.countInner = this.initialCount, this.finishAttempt();
542
542
  }
543
543
  }
544
- class $n {
544
+ class xn {
545
545
  connectionManager;
546
546
  interval;
547
547
  checkTelephonyByTimeout = void 0;
@@ -556,7 +556,7 @@ class $n {
556
556
  onSuccessRequest: n,
557
557
  onFailRequest: s
558
558
  }) {
559
- this.stop(), this.cancelableGetParameters = new pe(e), this.checkTelephonyByTimeout = mn({
559
+ this.stop(), this.cancelableGetParameters = new Ce(e), this.checkTelephonyByTimeout = Sn({
560
560
  isDontStopOnFail: !0,
561
561
  requestInterval: this.interval,
562
562
  request: async () => {
@@ -576,7 +576,7 @@ class $n {
576
576
  this.checkTelephonyByTimeout?.stop(), this.checkTelephonyByTimeout = void 0, this.cancelableGetParameters?.cancelRequest(), this.cancelableGetParameters = void 0;
577
577
  }
578
578
  }
579
- class pt {
579
+ class Rt {
580
580
  callManager;
581
581
  disposers = [];
582
582
  constructor({ callManager: e }) {
@@ -601,15 +601,15 @@ class pt {
601
601
  this.callManager.isCallActive ? e?.() : n();
602
602
  }
603
603
  }
604
- const xn = 15e3, Vn = 2, Ne = A("PingServerRequester");
605
- class qn {
604
+ const Vn = 15e3, qn = 2, Ne = A("PingServerRequester");
605
+ class Hn {
606
606
  connectionManager;
607
607
  pingServerByTimeoutWithFailCalls;
608
608
  constructor({ connectionManager: e }) {
609
- this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = Sn(Vn, {
609
+ this.connectionManager = e, this.pingServerByTimeoutWithFailCalls = pn(qn, {
610
610
  whenPossibleRequest: async () => {
611
611
  },
612
- requestInterval: xn,
612
+ requestInterval: Vn,
613
613
  request: async () => (Ne("ping"), this.connectionManager.ping().then(() => {
614
614
  Ne("ping success");
615
615
  }))
@@ -622,20 +622,20 @@ class qn {
622
622
  this.pingServerByTimeoutWithFailCalls.stop();
623
623
  }
624
624
  }
625
- const xe = A("PingServerIfNotActiveCallRequester");
626
- class Hn {
625
+ const Ve = A("PingServerIfNotActiveCallRequester");
626
+ class Wn {
627
627
  pingServerRequester;
628
628
  notActiveCallSubscriber;
629
629
  constructor({
630
630
  connectionManager: e,
631
631
  callManager: n
632
632
  }) {
633
- this.pingServerRequester = new qn({
633
+ this.pingServerRequester = new Hn({
634
634
  connectionManager: e
635
- }), this.notActiveCallSubscriber = new pt({ callManager: n });
635
+ }), this.notActiveCallSubscriber = new Rt({ callManager: n });
636
636
  }
637
637
  start({ onFailRequest: e }) {
638
- xe("start"), this.notActiveCallSubscriber.subscribe({
638
+ Ve("start"), this.notActiveCallSubscriber.subscribe({
639
639
  onActive: () => {
640
640
  this.pingServerRequester.stop();
641
641
  },
@@ -645,13 +645,13 @@ class Hn {
645
645
  });
646
646
  }
647
647
  stop() {
648
- xe("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
648
+ Ve("stop"), this.pingServerRequester.stop(), this.unsubscribeCallStatusChange();
649
649
  }
650
650
  unsubscribeCallStatusChange() {
651
651
  this.notActiveCallSubscriber.unsubscribe();
652
652
  }
653
653
  }
654
- class Wn {
654
+ class Qn {
655
655
  connectionManager;
656
656
  isRegistrationFailed = !1;
657
657
  disposers = [];
@@ -660,7 +660,7 @@ class Wn {
660
660
  connectionManager: e,
661
661
  callManager: n
662
662
  }) {
663
- this.connectionManager = e, this.notActiveCallSubscriber = new pt({ callManager: n });
663
+ this.connectionManager = e, this.notActiveCallSubscriber = new Rt({ callManager: n });
664
664
  }
665
665
  subscribe(e) {
666
666
  this.unsubscribe(), this.disposers.push(
@@ -687,30 +687,30 @@ class Wn {
687
687
  this.isRegistrationFailed = !1;
688
688
  }
689
689
  }
690
- const Qn = {
690
+ const Yn = {
691
691
  baseRetryDelayMs: 1e3,
692
692
  maxRetryDelayMs: 3e4,
693
693
  warningThreshold: 3,
694
694
  criticalThreshold: 5
695
- }, Ve = {
695
+ }, qe = {
696
696
  none: 0,
697
697
  warning: 1,
698
698
  critical: 2
699
699
  };
700
- class Yn {
700
+ class jn {
701
701
  failCount = 0;
702
702
  nextRetryAtMs = 0;
703
703
  escalationLevel = "none";
704
704
  options;
705
705
  constructor(e) {
706
706
  this.options = {
707
- ...Qn,
707
+ ...Yn,
708
708
  ...e
709
709
  };
710
710
  }
711
711
  registerFailure() {
712
712
  this.failCount += 1;
713
- const e = this.resolveEscalationLevel(this.failCount), n = Ve[e] > Ve[this.escalationLevel];
713
+ const e = this.resolveEscalationLevel(this.failCount), n = qe[e] > qe[this.escalationLevel];
714
714
  this.escalationLevel = e;
715
715
  const s = Date.now(), r = Math.max(this.nextRetryAtMs - s, 0);
716
716
  if (r > 0)
@@ -743,8 +743,8 @@ class Yn {
743
743
  );
744
744
  }
745
745
  }
746
- const k = A("AutoConnectorRuntime"), jn = 3e3, zn = 15e3;
747
- class Jn {
746
+ const k = A("AutoConnectorRuntime"), zn = 3e3, Jn = 15e3;
747
+ class Kn {
748
748
  connectionManager;
749
749
  connectionQueueManager;
750
750
  checkTelephonyRequester;
@@ -756,18 +756,18 @@ class Jn {
756
756
  emitters;
757
757
  reconnectActions;
758
758
  constructor(e) {
759
- this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new $n({
759
+ this.connectionManager = e.connectionManager, this.connectionQueueManager = e.connectionQueueManager, this.emitters = e.emitters, this.reconnectActions = e.reconnectActions, this.checkTelephonyRequester = new xn({
760
760
  connectionManager: this.connectionManager,
761
- interval: e.options?.checkTelephonyRequestInterval ?? zn
762
- }), this.pingServerIfNotActiveCallRequester = new Hn({
761
+ interval: e.options?.checkTelephonyRequestInterval ?? Jn
762
+ }), this.pingServerIfNotActiveCallRequester = new Wn({
763
763
  connectionManager: this.connectionManager,
764
764
  callManager: e.callManager
765
- }), this.registrationFailedOutOfCallSubscriber = new Wn({
765
+ }), this.registrationFailedOutOfCallSubscriber = new Qn({
766
766
  connectionManager: this.connectionManager,
767
767
  callManager: e.callManager
768
768
  }), this.delayBetweenAttempts = new Cn(
769
- e.options?.timeoutBetweenAttempts ?? jn
770
- ), this.telephonyFailPolicy = new Yn(e.options?.telephonyFailPolicy), this.attemptsState = new Bn({
769
+ e.options?.timeoutBetweenAttempts ?? zn
770
+ ), this.telephonyFailPolicy = new jn(e.options?.telephonyFailPolicy), this.attemptsState = new $n({
771
771
  onStatusChange: this.emitters.emitStatusChange
772
772
  });
773
773
  }
@@ -872,7 +872,7 @@ class ee {
872
872
  subscriptions = [];
873
873
  stateChangeListeners = /* @__PURE__ */ new Set();
874
874
  constructor(e) {
875
- this.actor = Rn(e), this.actor.start(), this.addSubscription(
875
+ this.actor = Nn(e), this.actor.start(), this.addSubscription(
876
876
  this.subscribe((n) => {
877
877
  const s = n.value;
878
878
  this.stateChangeListeners.forEach((r) => {
@@ -914,14 +914,14 @@ class ee {
914
914
  return this.subscriptions.push(n), n;
915
915
  }
916
916
  }
917
- const Rt = "Not ready for connection", Kn = (t) => t instanceof Error && t.message === Rt, Xn = () => new Error(Rt), Zn = async (t) => typeof t == "function" ? t() : t, es = 3;
918
- class ts {
919
- resolveParametersRequester = new pe(Zn);
917
+ const Nt = "Not ready for connection", Xn = (t) => t instanceof Error && t.message === Nt, Zn = () => new Error(Nt), es = async (t) => typeof t == "function" ? t() : t, ts = 3;
918
+ class ns {
919
+ resolveParametersRequester = new Ce(es);
920
920
  cancelableConnectWithRepeatedCalls;
921
921
  numberOfConnectionAttempts;
922
922
  dependencies;
923
923
  constructor(e, {
924
- numberOfConnectionAttempts: n = es
924
+ numberOfConnectionAttempts: n = ts
925
925
  } = {}) {
926
926
  this.dependencies = e, this.numberOfConnectionAttempts = n, this.proxyEvents();
927
927
  }
@@ -931,7 +931,7 @@ class ts {
931
931
  ...s
932
932
  }), s)).catch((s) => {
933
933
  const r = s ?? new Error("Failed to connect to server");
934
- throw ut(r) || this.dependencies.events.trigger("connect-failed", r), r;
934
+ throw gt(r) || this.dependencies.events.trigger("connect-failed", r), r;
935
935
  }));
936
936
  disconnect = async ({ cancelRequests: e = !0 } = {}) => {
937
937
  e && this.cancelRequests(), this.dependencies.events.trigger("disconnecting", {});
@@ -949,10 +949,10 @@ class ts {
949
949
  }
950
950
  connectWithDuplicatedCalls = async (e, { numberOfConnectionAttempts: n = this.numberOfConnectionAttempts } = {}) => {
951
951
  const s = async () => this.connectInner(e), r = (i) => {
952
- const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), E = i != null && !On(i);
953
- return c || E;
952
+ const c = this.dependencies.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = i != null && !bn(i);
953
+ return c || g;
954
954
  };
955
- return this.cancelableConnectWithRepeatedCalls = we({
955
+ return this.cancelableConnectWithRepeatedCalls = Ge({
956
956
  targetFunction: s,
957
957
  isComplete: r,
958
958
  callLimit: n,
@@ -978,8 +978,8 @@ class ts {
978
978
  sessionTimers: a,
979
979
  registerExpires: o,
980
980
  connectionRecoveryMinInterval: c,
981
- connectionRecoveryMaxInterval: E,
982
- userAgent: p,
981
+ connectionRecoveryMaxInterval: g,
982
+ userAgent: C,
983
983
  displayName: I = "",
984
984
  register: b = !1,
985
985
  extraHeaders: _ = []
@@ -996,8 +996,8 @@ class ts {
996
996
  sessionTimers: a,
997
997
  registerExpires: o,
998
998
  connectionRecoveryMinInterval: c,
999
- connectionRecoveryMaxInterval: E,
1000
- userAgent: p,
999
+ connectionRecoveryMaxInterval: g,
1000
+ userAgent: C,
1001
1001
  remoteAddress: i,
1002
1002
  extraHeaders: _
1003
1003
  },
@@ -1022,21 +1022,21 @@ class ts {
1022
1022
  return;
1023
1023
  }
1024
1024
  let i;
1025
- i = ((E, p) => {
1025
+ i = ((g, C) => {
1026
1026
  if (e.register === !0)
1027
- return this.dependencies.registrationManager.subscribeToStartEvents(E, p);
1027
+ return this.dependencies.registrationManager.subscribeToStartEvents(g, C);
1028
1028
  const I = "connected", b = ["disconnected"];
1029
- return this.dependencies.events.on(I, E), b.forEach((_) => {
1030
- this.dependencies.events.on(_, p);
1029
+ return this.dependencies.events.on(I, g), b.forEach((_) => {
1030
+ this.dependencies.events.on(_, C);
1031
1031
  }), () => {
1032
- this.dependencies.events.off(I, E), b.forEach((_) => {
1033
- this.dependencies.events.off(_, p);
1032
+ this.dependencies.events.off(I, g), b.forEach((_) => {
1033
+ this.dependencies.events.off(_, C);
1034
1034
  });
1035
1035
  };
1036
1036
  })(() => {
1037
1037
  i?.(), n(e);
1038
- }, (E) => {
1039
- i?.(), s(E);
1038
+ }, (g) => {
1039
+ i?.(), s(g);
1040
1040
  }), this.dependencies.stateMachine.toStartUa(e), r.start();
1041
1041
  });
1042
1042
  cancelConnectWithRepeatedCalls() {
@@ -1050,11 +1050,11 @@ class ts {
1050
1050
  }
1051
1051
  }
1052
1052
  var d = /* @__PURE__ */ ((t) => (t.IDLE = "connection:idle", t.PREPARING = "connection:preparing", t.CONNECTING = "connection:connecting", t.CONNECTED = "connection:connected", t.REGISTERED = "connection:registered", t.ESTABLISHED = "connection:established", t.DISCONNECTING = "connection:disconnecting", t.DISCONNECTED = "connection:disconnected", t))(d || {}), N = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_CONNECTION_CONFIGURATION = "setConnectionConfiguration", t.CLEAR_CONNECTION_CONFIGURATION = "clearConnectionConfiguration", t))(N || {}), T = /* @__PURE__ */ ((t) => (t.START_CONNECT = "START_CONNECT", t.START_UA = "START_UA", t.START_DISCONNECT = "START_DISCONNECT", t.UA_CONNECTED = "UA_CONNECTED", t.UA_CONNECTING = "UA_CONNECTING", t.UA_REGISTERED = "UA_REGISTERED", t.UA_UNREGISTERED = "UA_UNREGISTERED", t.UA_DISCONNECTED = "UA_DISCONNECTED", t.RESET = "RESET", t))(T || {});
1053
- const Nt = {
1053
+ const It = {
1054
1054
  connectionConfiguration: void 0
1055
- }, qe = A("ConnectionStateMachine"), ns = () => Z({
1055
+ }, He = A("ConnectionStateMachine"), ss = () => Z({
1056
1056
  types: {
1057
- context: Nt,
1057
+ context: It,
1058
1058
  events: {}
1059
1059
  },
1060
1060
  guards: {
@@ -1068,16 +1068,16 @@ const Nt = {
1068
1068
  connectionConfiguration: void 0
1069
1069
  })),
1070
1070
  [N.LOG_TRANSITION]: (t, e) => {
1071
- qe(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1071
+ He(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1072
1072
  },
1073
1073
  [N.LOG_STATE_CHANGE]: (t, e) => {
1074
- qe("ConnectionStateMachine state changed", e.state);
1074
+ He("ConnectionStateMachine state changed", e.state);
1075
1075
  }
1076
1076
  }
1077
- }), ss = () => ns().createMachine({
1077
+ }), rs = () => ss().createMachine({
1078
1078
  id: "connection",
1079
1079
  initial: d.IDLE,
1080
- context: Nt,
1080
+ context: It,
1081
1081
  states: {
1082
1082
  [d.IDLE]: {
1083
1083
  entry: [
@@ -1397,12 +1397,12 @@ const Nt = {
1397
1397
  }
1398
1398
  }
1399
1399
  }
1400
- }), rs = ss(), is = A("ConnectionStateMachine");
1401
- class as extends ee {
1400
+ }), is = rs(), as = A("ConnectionStateMachine");
1401
+ class os extends ee {
1402
1402
  events;
1403
1403
  unsubscribeFromEvents;
1404
1404
  constructor(e) {
1405
- super(rs), this.events = e, this.subscribeToEvents();
1405
+ super(is), this.events = e, this.subscribeToEvents();
1406
1406
  }
1407
1407
  get isIdle() {
1408
1408
  return this.hasState(d.IDLE);
@@ -1464,7 +1464,7 @@ class as extends ee {
1464
1464
  }
1465
1465
  sendEvent(e) {
1466
1466
  if (!this.actor.getSnapshot().can(e)) {
1467
- is(
1467
+ as(
1468
1468
  `Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
1469
1469
  );
1470
1470
  return;
@@ -1498,7 +1498,7 @@ class as extends ee {
1498
1498
  };
1499
1499
  }
1500
1500
  }
1501
- const It = [
1501
+ const At = [
1502
1502
  "connecting",
1503
1503
  "connected",
1504
1504
  "disconnected",
@@ -1508,7 +1508,7 @@ const It = [
1508
1508
  "registrationFailed",
1509
1509
  "newMessage",
1510
1510
  "sipEvent"
1511
- ], os = [
1511
+ ], cs = [
1512
1512
  "disconnecting",
1513
1513
  "connect-started",
1514
1514
  "connect-succeeded",
@@ -1516,8 +1516,8 @@ const It = [
1516
1516
  "connect-parameters-resolve-success",
1517
1517
  "connect-parameters-resolve-failed",
1518
1518
  "connected-with-configuration"
1519
- ], At = [...It, ...os], cs = () => new G(At), ds = A("RegistrationManager");
1520
- class ls {
1519
+ ], vt = [...At, ...cs], ds = () => new G(vt), ls = A("RegistrationManager");
1520
+ class hs {
1521
1521
  events;
1522
1522
  getUaProtected;
1523
1523
  constructor(e) {
@@ -1539,7 +1539,7 @@ class ls {
1539
1539
  try {
1540
1540
  await this.unregister();
1541
1541
  } catch (e) {
1542
- ds("tryRegister", e);
1542
+ ls("tryRegister", e);
1543
1543
  }
1544
1544
  return this.register();
1545
1545
  }
@@ -1554,7 +1554,7 @@ class ls {
1554
1554
  };
1555
1555
  }
1556
1556
  }
1557
- class hs {
1557
+ class us {
1558
1558
  uaFactory;
1559
1559
  getUaProtected;
1560
1560
  constructor(e) {
@@ -1600,29 +1600,29 @@ class hs {
1600
1600
  extraHeaders: a
1601
1601
  }) {
1602
1602
  return new Promise((o, c) => {
1603
- const { configuration: E } = this.uaFactory.createConfiguration({
1603
+ const { configuration: g } = this.uaFactory.createConfiguration({
1604
1604
  sipServerUrl: r,
1605
1605
  displayName: n,
1606
1606
  userAgent: e,
1607
1607
  sipServerIp: s
1608
- }), p = this.uaFactory.createUA({ ...E, remoteAddress: i, extraHeaders: a }), I = () => {
1608
+ }), C = this.uaFactory.createUA({ ...g, remoteAddress: i, extraHeaders: a }), I = () => {
1609
1609
  const _ = new Error("Telephony is not available");
1610
1610
  c(_);
1611
1611
  };
1612
- p.once("disconnected", I);
1612
+ C.once("disconnected", I);
1613
1613
  const b = () => {
1614
- p.removeAllListeners(), p.once("disconnected", () => {
1614
+ C.removeAllListeners(), C.once("disconnected", () => {
1615
1615
  o();
1616
- }), p.stop();
1616
+ }), C.stop();
1617
1617
  };
1618
- p.once("connected", b), p.start();
1618
+ C.once("connected", b), C.start();
1619
1619
  });
1620
1620
  }
1621
1621
  }
1622
- function us(t) {
1622
+ function gs(t) {
1623
1623
  return (e) => `sip:${e}@${t}`;
1624
1624
  }
1625
- const Es = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, gs = (t) => t.trim().replaceAll(" ", "_"), Ts = Es(1e5, 99999999), ms = (t) => {
1625
+ const Es = (t, e) => () => Math.floor(Math.random() * (e - t)) + t, Ts = (t) => t.trim().replaceAll(" ", "_"), ms = Es(1e5, 99999999), Ss = (t) => {
1626
1626
  const e = [];
1627
1627
  return t !== void 0 && t !== "" && e.push(`X-Vinteo-Remote: ${t}`), e;
1628
1628
  };
@@ -1651,10 +1651,10 @@ class X {
1651
1651
  throw new Error("user is required for authorized connection");
1652
1652
  }
1653
1653
  static resolveAuthorizationUser(e, n) {
1654
- return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${Ts()}`;
1654
+ return e && n !== void 0 && n.trim() !== "" ? n.trim() : `${ms()}`;
1655
1655
  }
1656
1656
  static buildExtraHeaders(e, n) {
1657
- const s = e !== void 0 && e !== "" ? ms(e) : [];
1657
+ const s = e !== void 0 && e !== "" ? Ss(e) : [];
1658
1658
  return n === void 0 ? s : [...s, ...n];
1659
1659
  }
1660
1660
  createConfiguration({
@@ -1667,8 +1667,8 @@ class X {
1667
1667
  sessionTimers: o = !1,
1668
1668
  registerExpires: c = 300,
1669
1669
  // 5 minutes in sec
1670
- connectionRecoveryMinInterval: E = 2,
1671
- connectionRecoveryMaxInterval: p = 6,
1670
+ connectionRecoveryMinInterval: g = 2,
1671
+ connectionRecoveryMaxInterval: C = 6,
1672
1672
  userAgent: I
1673
1673
  }) {
1674
1674
  X.validateParametersConnection({
@@ -1678,20 +1678,20 @@ class X {
1678
1678
  sipServerIp: i,
1679
1679
  sipServerUrl: s
1680
1680
  });
1681
- const b = X.resolveAuthorizationUser(a, e), _ = us(i), W = _(b), L = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
1681
+ const b = X.resolveAuthorizationUser(a, e), _ = gs(i), W = _(b), L = new this.JsSIP.WebSocketInterface(`wss://${s}/webrtc/wss/`);
1682
1682
  return {
1683
1683
  configuration: {
1684
1684
  password: n,
1685
1685
  register: a,
1686
1686
  uri: W,
1687
- display_name: gs(r),
1687
+ display_name: Ts(r),
1688
1688
  user_agent: I,
1689
1689
  sdpSemantics: "unified-plan",
1690
1690
  sockets: [L],
1691
1691
  session_timers: o,
1692
1692
  register_expires: c,
1693
- connection_recovery_min_interval: E,
1694
- connection_recovery_max_interval: p
1693
+ connection_recovery_min_interval: g,
1694
+ connection_recovery_max_interval: C
1695
1695
  },
1696
1696
  helpers: {
1697
1697
  socket: L,
@@ -1713,12 +1713,12 @@ class X {
1713
1713
  extraHeaders: e.extraHeaders
1714
1714
  });
1715
1715
  return n.eachTriggers((a, o) => {
1716
- const c = It.find((E) => E === o);
1716
+ const c = At.find((g) => g === o);
1717
1717
  c && i.on(c, a);
1718
1718
  }), { ua: i, helpers: r };
1719
1719
  }
1720
1720
  }
1721
- const Ss = A("ConnectionManager");
1721
+ const ps = A("ConnectionManager");
1722
1722
  class Cs extends w {
1723
1723
  stateMachine;
1724
1724
  ua;
@@ -1730,13 +1730,13 @@ class Cs extends w {
1730
1730
  constructor({ JsSIP: e }, {
1731
1731
  numberOfConnectionAttempts: n
1732
1732
  } = {}) {
1733
- super(cs()), this.uaFactory = new X(e), this.registrationManager = new ls({
1733
+ super(ds()), this.uaFactory = new X(e), this.registrationManager = new hs({
1734
1734
  events: this.events,
1735
1735
  getUaProtected: this.getUaProtected
1736
- }), this.stateMachine = new as(this.events), this.sipOperations = new hs({
1736
+ }), this.stateMachine = new os(this.events), this.sipOperations = new us({
1737
1737
  uaFactory: this.uaFactory,
1738
1738
  getUaProtected: this.getUaProtected
1739
- }), this.connectionFlow = new ts(
1739
+ }), this.connectionFlow = new ns(
1740
1740
  {
1741
1741
  events: this.events,
1742
1742
  uaFactory: this.uaFactory,
@@ -1784,7 +1784,7 @@ class Cs extends w {
1784
1784
  return this.stateMachine.isRegisterEnabled();
1785
1785
  }
1786
1786
  connect = async (e, n) => this.disconnect().catch((s) => {
1787
- Ss("connect: disconnect error", s);
1787
+ ps("connect: disconnect error", s);
1788
1788
  }).then(async () => this.connectWithProcessError(e, n));
1789
1789
  disconnect = async () => {
1790
1790
  if (this.isConfigured() || this.requested)
@@ -1824,7 +1824,7 @@ class Cs extends w {
1824
1824
  getUa = () => this.ua;
1825
1825
  connectWithProcessError = async (e, n) => {
1826
1826
  if (!(n?.hasReadyForConnection?.() ?? !0))
1827
- throw Xn();
1827
+ throw Zn();
1828
1828
  return this.connectionFlow.connect(e, n).catch(async (r) => {
1829
1829
  const i = r;
1830
1830
  return this.disconnect().then(() => {
@@ -1835,7 +1835,7 @@ class Cs extends w {
1835
1835
  });
1836
1836
  };
1837
1837
  }
1838
- class ps {
1838
+ class Rs {
1839
1839
  connectionManager;
1840
1840
  stackPromises = Et({
1841
1841
  noRunIsNotActual: !0
@@ -1852,7 +1852,7 @@ class ps {
1852
1852
  const Y = (t) => {
1853
1853
  if (t !== null && typeof t == "object" && "error" in t)
1854
1854
  return t.error;
1855
- }, O = A("AutoConnectorMachine"), He = (t) => t.parameters, Rs = (t) => Z({
1855
+ }, O = A("AutoConnectorMachine"), We = (t) => t.parameters, Ns = (t) => Z({
1856
1856
  types: {
1857
1857
  context: {},
1858
1858
  events: {}
@@ -1898,7 +1898,7 @@ const Y = (t) => {
1898
1898
  },
1899
1899
  /** Ошибка «ещё не готовы к подключению» — без ретрая. */
1900
1900
  isNotReadyForConnection: ({ event: e }) => {
1901
- const n = Kn(Y(e));
1901
+ const n = Xn(Y(e));
1902
1902
  return O("isNotReadyForConnection:", n), n;
1903
1903
  },
1904
1904
  /** Политика опций запрещает повтор для этой ошибки. */
@@ -1908,12 +1908,12 @@ const Y = (t) => {
1908
1908
  },
1909
1909
  /** Промис коннекта снят очередью (`stack-promises`) — отмена попыток. */
1910
1910
  isNotActualPromise: ({ event: e }) => {
1911
- const n = gt(Y(e));
1911
+ const n = Tt(Y(e));
1912
1912
  return O("isNotActualPromise:", n), n;
1913
1913
  },
1914
1914
  /** Отмена задержки (cancelable / timeout-requester). */
1915
1915
  isWaitRetryCancelled: ({ event: e }) => {
1916
- const n = Y(e), s = ut(n) || pn(n);
1916
+ const n = Y(e), s = gt(n) || Rn(n);
1917
1917
  return O("isWaitRetryCancelled:", s), s;
1918
1918
  }
1919
1919
  },
@@ -1948,11 +1948,11 @@ const Y = (t) => {
1948
1948
  },
1949
1949
  /** Лимит: завершить попытку, событие лимита, запуск опроса телефонии. */
1950
1950
  onLimitReachedTransition: ({ context: e }) => {
1951
- O("onLimitReachedTransition"), t.onLimitReached(He(e));
1951
+ O("onLimitReachedTransition"), t.onLimitReached(We(e));
1952
1952
  },
1953
1953
  /** Успешный invoke `connect`. */
1954
1954
  onConnectDone: ({ context: e }) => {
1955
- O("onConnectDone"), t.onConnectSucceeded(He(e));
1955
+ O("onConnectDone"), t.onConnectSucceeded(We(e));
1956
1956
  },
1957
1957
  assignHaltedError: f({
1958
1958
  stopReason: () => "halted",
@@ -2003,7 +2003,7 @@ const Y = (t) => {
2003
2003
  }
2004
2004
  });
2005
2005
  var M = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.DISCONNECTING = "disconnecting", t.ATTEMPTING_GATE = "attemptingGate", t.ATTEMPTING_CONNECT = "attemptingConnect", t.WAITING_BEFORE_RETRY = "waitingBeforeRetry", t.CONNECTED_MONITORING = "connectedMonitoring", t.TELEPHONY_CHECKING = "telephonyChecking", t.ERROR_TERMINAL = "errorTerminal", t))(M || {});
2006
- const Ns = () => ({
2006
+ const Is = () => ({
2007
2007
  parameters: void 0,
2008
2008
  afterDisconnect: "idle",
2009
2009
  stopReason: void 0,
@@ -2017,10 +2017,10 @@ const Ns = () => ({
2017
2017
  target: M.DISCONNECTING,
2018
2018
  actions: "assignRestart"
2019
2019
  }
2020
- }), Is = (t) => Rs(t).createMachine({
2020
+ }), As = (t) => Ns(t).createMachine({
2021
2021
  id: "autoConnector",
2022
2022
  initial: M.IDLE,
2023
- context: Ns,
2023
+ context: Is,
2024
2024
  states: {
2025
2025
  /** Ожидание: допустимы рестарт флоу или внешний стоп без побочных эффектов. */
2026
2026
  [M.IDLE]: {
@@ -2222,14 +2222,14 @@ const Ns = () => ({
2222
2222
  on: ne()
2223
2223
  }
2224
2224
  }
2225
- }), As = A("AutoConnectorStateMachine");
2226
- class vs extends ee {
2225
+ }), vs = A("AutoConnectorStateMachine");
2226
+ class fs extends ee {
2227
2227
  constructor(e) {
2228
2228
  super(e);
2229
2229
  }
2230
2230
  send(e) {
2231
2231
  if (!this.actor.getSnapshot().can(e)) {
2232
- As(
2232
+ vs(
2233
2233
  `[AutoConnectorStateMachine] Invalid transition: ${e.type} from ${String(this.state)}. Event cannot be processed in current state.`
2234
2234
  );
2235
2235
  return;
@@ -2249,11 +2249,11 @@ class vs extends ee {
2249
2249
  this.toTelephonyResult("stillConnected");
2250
2250
  }
2251
2251
  }
2252
- const fs = (t) => new vs(Is(t)), Ms = "Failed to reconnect", We = (t) => t instanceof Error ? t : new Error(Ms), _s = (t) => {
2252
+ const Ms = (t) => new fs(As(t)), _s = "Failed to reconnect", Qe = (t) => t instanceof Error ? t : new Error(_s), Os = (t) => {
2253
2253
  const e = ({
2254
2254
  stopReason: n,
2255
2255
  lastError: s
2256
- }) => n === "cancelled" && !gt(s) || n === "failed" ? We(s) : s;
2256
+ }) => n === "cancelled" && !Tt(s) || n === "failed" ? Qe(s) : s;
2257
2257
  return {
2258
2258
  canRetryOnError: t.canRetryOnError,
2259
2259
  shouldDisconnectBeforeAttempt: () => t.runtime.shouldDisconnectBeforeAttempt(),
@@ -2290,7 +2290,7 @@ const fs = (t) => new vs(Is(t)), Ms = "Failed to reconnect", We = (t) => t insta
2290
2290
  t.runtime.onTelephonyStillConnected();
2291
2291
  }
2292
2292
  };
2293
- }, vt = [
2293
+ }, ft = [
2294
2294
  "before-attempt",
2295
2295
  "success",
2296
2296
  "failed-all-attempts",
@@ -2300,20 +2300,20 @@ const fs = (t) => new vs(Is(t)), Ms = "Failed to reconnect", We = (t) => t insta
2300
2300
  "limit-reached-attempts",
2301
2301
  "telephony-check-failure",
2302
2302
  "telephony-check-escalated"
2303
- ], Os = () => new G(vt), se = {
2303
+ ], bs = () => new G(ft), se = {
2304
2304
  START: "start",
2305
2305
  MANUAL_RESTART: "manual-restart",
2306
2306
  REGISTRATION_FAILED_OUT_OF_CALL: "registration-failed-out-of-call",
2307
2307
  TELEPHONY_DISCONNECTED: "telephony-disconnected",
2308
2308
  TELEPHONY_CHECK_FAILED: "telephony-check-failed"
2309
- }, bs = {
2309
+ }, Ps = {
2310
2310
  [se.START]: 0,
2311
2311
  [se.TELEPHONY_DISCONNECTED]: 1,
2312
2312
  [se.TELEPHONY_CHECK_FAILED]: 1,
2313
2313
  [se.REGISTRATION_FAILED_OUT_OF_CALL]: 3,
2314
2314
  [se.MANUAL_RESTART]: 4
2315
- }, Qe = (t) => bs[t];
2316
- class Ps {
2315
+ }, Ye = (t) => Ps[t];
2316
+ class ys {
2317
2317
  generation = 0;
2318
2318
  lastRequest;
2319
2319
  coalesceWindowMs;
@@ -2321,9 +2321,9 @@ class Ps {
2321
2321
  this.coalesceWindowMs = e;
2322
2322
  }
2323
2323
  register(e) {
2324
- const n = Date.now(), s = Qe(e), { lastRequest: r } = this;
2324
+ const n = Date.now(), s = Ye(e), { lastRequest: r } = this;
2325
2325
  if (r !== void 0 && n - r.timestamp < this.coalesceWindowMs) {
2326
- const a = Qe(r.reason);
2326
+ const a = Ye(r.reason);
2327
2327
  if (s <= a)
2328
2328
  return {
2329
2329
  shouldRequest: !1,
@@ -2346,21 +2346,21 @@ class Ps {
2346
2346
  this.lastRequest = void 0;
2347
2347
  }
2348
2348
  }
2349
- const ys = 250, Ds = {
2349
+ const Ds = 250, Ls = {
2350
2350
  LIMIT_REACHED: "Limit reached"
2351
- }, Ls = (t) => !0, j = A("AutoConnectorManager"), ws = "start", Gs = "manual-restart";
2352
- class ks extends w {
2351
+ }, ws = (t) => !0, j = A("AutoConnectorManager"), Gs = "start", ks = "manual-restart";
2352
+ class Us extends w {
2353
2353
  stateMachine;
2354
2354
  runtime;
2355
- reconnectCoalescer = new Ps({
2356
- coalesceWindowMs: ys
2355
+ reconnectCoalescer = new ys({
2356
+ coalesceWindowMs: Ds
2357
2357
  });
2358
2358
  constructor({
2359
2359
  connectionQueueManager: e,
2360
2360
  connectionManager: n,
2361
2361
  callManager: s
2362
2362
  }, r) {
2363
- super(Os()), this.runtime = new Jn({
2363
+ super(bs()), this.runtime = new Kn({
2364
2364
  connectionManager: n,
2365
2365
  connectionQueueManager: e,
2366
2366
  callManager: s,
@@ -2370,7 +2370,7 @@ class ks extends w {
2370
2370
  this.events.trigger("before-attempt", {});
2371
2371
  },
2372
2372
  emitLimitReachedAttempts: () => {
2373
- this.events.trigger("limit-reached-attempts", new Error(Ds.LIMIT_REACHED));
2373
+ this.events.trigger("limit-reached-attempts", new Error(Ls.LIMIT_REACHED));
2374
2374
  },
2375
2375
  emitSuccess: () => {
2376
2376
  j("handleSucceededAttempt"), this.events.trigger("success");
@@ -2400,15 +2400,15 @@ class ks extends w {
2400
2400
  this.stateMachine.toTelephonyResultStillConnected();
2401
2401
  }
2402
2402
  }
2403
- }), this.stateMachine = fs(
2404
- _s({
2403
+ }), this.stateMachine = Ms(
2404
+ Os({
2405
2405
  runtime: this.runtime,
2406
- canRetryOnError: r?.canRetryOnError ?? Ls
2406
+ canRetryOnError: r?.canRetryOnError ?? ws
2407
2407
  })
2408
2408
  );
2409
2409
  }
2410
2410
  start(e) {
2411
- j("auto connector start"), this.requestReconnect(e, ws);
2411
+ j("auto connector start"), this.requestReconnect(e, Gs);
2412
2412
  }
2413
2413
  restart() {
2414
2414
  j("auto connector restart");
@@ -2417,7 +2417,7 @@ class ks extends w {
2417
2417
  j("auto connector restart skipped: no parameters in context");
2418
2418
  return;
2419
2419
  }
2420
- this.requestReconnect(e, Gs);
2420
+ this.requestReconnect(e, ks);
2421
2421
  }
2422
2422
  stop() {
2423
2423
  j("auto connector stop"), this.resetReconnectCoalescingState(), this.stateMachine.toStop();
@@ -2449,34 +2449,33 @@ class ks extends w {
2449
2449
  this.reconnectCoalescer.reset();
2450
2450
  }
2451
2451
  }
2452
- const Us = "incomingCall", Fs = "declinedIncomingCall", Bs = "failedIncomingCall", $s = "terminatedIncomingCall", ft = "connecting", xs = "connected", Vs = "disconnected", qs = "newRTCSession", Hs = "registered", Ws = "unregistered", Qs = "registrationFailed", Ys = "newMessage", js = "sipEvent", zs = "availableSecondRemoteStream", Js = "notAvailableSecondRemoteStream", Ks = "mustStopPresentation", Xs = "enterRoom", Zs = "useLicense", er = "peerconnection:confirmed", tr = "peerconnection:ontrack", nr = "channels", sr = "channels:notify", rr = "ended:fromserver", ir = "main-cam-control", ar = "admin:stop-main-cam", or = "admin:start-main-cam", cr = "admin:stop-mic", dr = "admin:start-mic", lr = "admin:force-sync-media-state", hr = "participant:added-to-list-moderators", ur = "participant:removed-from-list-moderators", Er = "participant:move-request-to-stream", gr = "participant:move-request-to-spectators", Tr = "participant:move-request-to-participants", mr = "participation:accepting-word-request", Sr = "participation:cancelling-word-request", Cr = "webcast:started", pr = "webcast:stopped", Rr = "account:changed", Nr = "account:deleted", Ir = "conference:participant-token-issued", Ar = "ended", vr = "sending", fr = "reinvite", Mr = "replaces", _r = "refer", Or = "progress", br = "accepted", Pr = "confirmed", yr = "peerconnection", Dr = "failed", Lr = "muted", wr = "unmuted", Gr = "newDTMF", kr = "newInfo", Ur = "hold", Fr = "unhold", Br = "update", $r = "sdp", xr = "icecandidate", Vr = "getusermediafailed", qr = "peerconnection:createofferfailed", Hr = "peerconnection:createanswerfailed", Wr = "peerconnection:setlocaldescriptionfailed", Qr = "peerconnection:setremotedescriptionfailed", Yr = "presentation:start", jr = "presentation:started", zr = "presentation:end", Jr = "presentation:ended", Kr = "presentation:failed", Xr = [
2453
- Us,
2452
+ const Fs = "incomingCall", Bs = "declinedIncomingCall", $s = "failedIncomingCall", xs = "terminatedIncomingCall", Mt = "connecting", Vs = "connected", qs = "disconnected", Hs = "newRTCSession", Ws = "registered", Qs = "unregistered", Ys = "registrationFailed", js = "newMessage", zs = "sipEvent", Js = "availableSecondRemoteStream", Ks = "notAvailableSecondRemoteStream", Xs = "mustStopPresentation", Zs = "enterRoom", er = "useLicense", tr = "peerconnection:confirmed", nr = "peerconnection:ontrack", sr = "channels", rr = "channels:notify", ir = "ended:fromserver", ar = "main-cam-control", or = "admin:stop-main-cam", cr = "admin:start-main-cam", dr = "admin:stop-mic", lr = "admin:start-mic", hr = "admin:force-sync-media-state", ur = "participant:added-to-list-moderators", gr = "participant:removed-from-list-moderators", Er = "participant:move-request-to-stream", Tr = "participant:move-request-to-spectators", mr = "participant:move-request-to-participants", Sr = "participation:accepting-word-request", pr = "participation:cancelling-word-request", Cr = "webcast:started", Rr = "webcast:stopped", Nr = "account:changed", Ir = "account:deleted", Ar = "conference:participant-token-issued", vr = "ended", fr = "sending", Mr = "reinvite", _r = "replaces", Or = "refer", br = "progress", Pr = "accepted", yr = "confirmed", Dr = "peerconnection", Lr = "failed", wr = "muted", Gr = "unmuted", kr = "newDTMF", Ur = "newInfo", Fr = "hold", Br = "unhold", $r = "update", xr = "sdp", Vr = "icecandidate", qr = "getusermediafailed", Hr = "peerconnection:createofferfailed", Wr = "peerconnection:createanswerfailed", Qr = "peerconnection:setlocaldescriptionfailed", Yr = "peerconnection:setremotedescriptionfailed", jr = "presentation:start", zr = "presentation:started", Jr = "presentation:end", Kr = "presentation:ended", Xr = "presentation:failed", Zr = [
2454
2453
  Fs,
2455
- $s,
2456
2454
  Bs,
2457
- mr,
2455
+ xs,
2456
+ $s,
2458
2457
  Sr,
2458
+ pr,
2459
2459
  Er,
2460
- sr,
2461
- Ir,
2462
- Rr,
2460
+ rr,
2461
+ Ar,
2463
2462
  Nr,
2463
+ Ir,
2464
2464
  Cr,
2465
- pr,
2466
- hr,
2467
- ur
2468
- ], Zr = [
2469
- ft,
2470
- xs,
2465
+ Rr,
2466
+ ur,
2467
+ gr
2468
+ ], ei = [
2469
+ Mt,
2471
2470
  Vs,
2472
2471
  qs,
2473
2472
  Hs,
2474
2473
  Ws,
2475
2474
  Qs,
2476
2475
  Ys,
2477
- js
2478
- ], ei = [
2479
- zs,
2476
+ js,
2477
+ zs
2478
+ ], ti = [
2480
2479
  Js,
2481
2480
  Ks,
2482
2481
  Xs,
@@ -2484,19 +2483,19 @@ const Us = "incomingCall", Fs = "declinedIncomingCall", Bs = "failedIncomingCall
2484
2483
  er,
2485
2484
  tr,
2486
2485
  nr,
2487
- rr,
2486
+ sr,
2488
2487
  ir,
2489
- or,
2490
2488
  ar,
2491
2489
  cr,
2490
+ or,
2492
2491
  dr,
2493
2492
  lr,
2494
- gr,
2495
- Tr
2496
- ], Oe = [
2497
- Ar,
2498
- ft,
2493
+ hr,
2494
+ Tr,
2495
+ mr
2496
+ ], be = [
2499
2497
  vr,
2498
+ Mt,
2500
2499
  fr,
2501
2500
  Mr,
2502
2501
  _r,
@@ -2523,15 +2522,16 @@ const Us = "incomingCall", Fs = "declinedIncomingCall", Bs = "failedIncomingCall
2523
2522
  jr,
2524
2523
  zr,
2525
2524
  Jr,
2526
- Kr
2525
+ Kr,
2526
+ Xr
2527
2527
  ];
2528
- [...Zr, ...Xr];
2528
+ [...ei, ...Zr];
2529
2529
  [
2530
- ...Oe,
2531
- ...ei
2530
+ ...be,
2531
+ ...ti
2532
2532
  ];
2533
- const ti = A("BaseSession.mock");
2534
- class ni {
2533
+ const ni = A("BaseSession.mock");
2534
+ class si {
2535
2535
  originator;
2536
2536
  connection;
2537
2537
  events;
@@ -2545,7 +2545,7 @@ class ni {
2545
2545
  eventHandlers: n,
2546
2546
  remoteIdentity: s
2547
2547
  }) {
2548
- this.originator = e, this.events = new Tn(Oe), this.initEvents(n), this.remote_identity = s;
2548
+ this.originator = e, this.events = new mn(be), this.initEvents(n), this.remote_identity = s;
2549
2549
  }
2550
2550
  get contact() {
2551
2551
  throw new Error("Method not implemented.");
@@ -2641,7 +2641,7 @@ class ni {
2641
2641
  return this.events.off(e, n), this;
2642
2642
  }
2643
2643
  removeAllListeners(e) {
2644
- return ti("Method not implemented. Event:", e), this;
2644
+ return ni("Method not implemented. Event:", e), this;
2645
2645
  }
2646
2646
  setMaxListeners(e) {
2647
2647
  throw new Error("Method not implemented.");
@@ -2676,7 +2676,7 @@ class ni {
2676
2676
  });
2677
2677
  }
2678
2678
  // @ts-expect-error
2679
- on = (e, n) => (Oe.includes(e) && this.events.on(e, n), this);
2679
+ on = (e, n) => (be.includes(e) && this.events.on(e, n), this);
2680
2680
  trigger(e, n) {
2681
2681
  this.events.trigger(e, n);
2682
2682
  }
@@ -2700,7 +2700,7 @@ class ni {
2700
2700
  return !0;
2701
2701
  }
2702
2702
  }
2703
- class Ye {
2703
+ class je {
2704
2704
  stats = (/* @__PURE__ */ new Map()).set("codec", { mimeType: "video/h264" });
2705
2705
  dtmf = null;
2706
2706
  track = null;
@@ -2743,7 +2743,7 @@ class Ye {
2743
2743
  throw new Error("Method not implemented.");
2744
2744
  }
2745
2745
  }
2746
- class je {
2746
+ class ze {
2747
2747
  currentDirection = "sendrecv";
2748
2748
  direction = "sendrecv";
2749
2749
  // eslint-disable-next-line unicorn/no-null
@@ -2761,7 +2761,7 @@ class je {
2761
2761
  stop() {
2762
2762
  }
2763
2763
  }
2764
- class si extends EventTarget {
2764
+ class ri extends EventTarget {
2765
2765
  senders = [];
2766
2766
  receivers = [];
2767
2767
  canTrickleIceCandidates;
@@ -2846,16 +2846,16 @@ class si extends EventTarget {
2846
2846
  getReceivers = () => this.receivers;
2847
2847
  getSenders = () => this.senders;
2848
2848
  addTrack = (e, ...n) => {
2849
- const s = new Ye({ track: e }), r = new je(s);
2849
+ const s = new je({ track: e }), r = new ze(s);
2850
2850
  return r.mid = e.kind === "audio" ? "0" : "1", this.senders.push(s), this.dispatchTrackInternal(e, ...n), s;
2851
2851
  };
2852
2852
  // Дополнительный метод для тестов с возможностью установки mid
2853
2853
  addTrackWithMid = (e, n) => {
2854
- const s = new Ye({ track: e }), r = new je(s);
2854
+ const s = new je({ track: e }), r = new ze(s);
2855
2855
  return n === void 0 ? r.mid = e.kind === "audio" ? "0" : "1" : r.mid = n, this.senders.push(s), this.dispatchTrackInternal(e), s;
2856
2856
  };
2857
2857
  dispatchTrack(e) {
2858
- this.dispatchTrackInternal(new un(e));
2858
+ this.dispatchTrackInternal(new gn(e));
2859
2859
  }
2860
2860
  dispatchTrackInternal(e, ...n) {
2861
2861
  const s = new Event(
@@ -2869,14 +2869,14 @@ class si extends EventTarget {
2869
2869
  }), this.dispatchEvent(s);
2870
2870
  }
2871
2871
  }
2872
- function ri(t) {
2872
+ function ii(t) {
2873
2873
  const e = t.match(/(purgatory)|[\d.]+/g);
2874
2874
  if (!e)
2875
2875
  throw new Error("wrong sip url");
2876
2876
  return e[0];
2877
2877
  }
2878
- var Mt = /* @__PURE__ */ ((t) => (t.LOCAL = "local", t.REMOTE = "remote", t.SYSTEM = "system", t))(Mt || {});
2879
- const _t = [
2878
+ var _t = /* @__PURE__ */ ((t) => (t.LOCAL = "local", t.REMOTE = "remote", t.SYSTEM = "system", t))(_t || {});
2879
+ const Ot = [
2880
2880
  "peerconnection",
2881
2881
  "connecting",
2882
2882
  "sending",
@@ -2907,7 +2907,7 @@ const _t = [
2907
2907
  "peerconnection:createanswerfailed",
2908
2908
  "peerconnection:setlocaldescriptionfailed",
2909
2909
  "peerconnection:setremotedescriptionfailed"
2910
- ], ii = [
2910
+ ], ai = [
2911
2911
  "start-call",
2912
2912
  "end-call",
2913
2913
  "peerconnection:confirmed",
@@ -2919,11 +2919,11 @@ const _t = [
2919
2919
  "recv-session-started",
2920
2920
  "recv-session-ended",
2921
2921
  "recv-quality-changed"
2922
- ], Ot = [
2923
- ..._t,
2924
- ...ii
2925
- ], ai = () => new G(Ot), ze = 400, oi = "777", ci = (t) => t.getVideoTracks().length > 0;
2926
- class x extends ni {
2922
+ ], bt = [
2923
+ ...Ot,
2924
+ ...ai
2925
+ ], oi = () => new G(bt), Je = 400, ci = "777", di = (t) => t.getVideoTracks().length > 0;
2926
+ class x extends si {
2927
2927
  static presentationError;
2928
2928
  static startPresentationError;
2929
2929
  static countStartPresentationError = Number.POSITIVE_INFINITY;
@@ -2949,7 +2949,7 @@ class x extends ni {
2949
2949
  }, 100), setTimeout(() => {
2950
2950
  this.trigger("confirmed");
2951
2951
  }, 200);
2952
- }, ze);
2952
+ }, Je);
2953
2953
  });
2954
2954
  replaceMediaStream = jest.fn(async (e) => {
2955
2955
  });
@@ -2967,8 +2967,8 @@ class x extends ni {
2967
2967
  constructor({
2968
2968
  eventHandlers: e,
2969
2969
  originator: n,
2970
- remoteIdentity: s = new dn(
2971
- new ln("sip", "caller1", "test1.com", 5060),
2970
+ remoteIdentity: s = new ln(
2971
+ new hn("sip", "caller1", "test1.com", 5060),
2972
2972
  "Test Caller 1"
2973
2973
  ),
2974
2974
  delayStartPresentation: r = 0
@@ -2976,7 +2976,7 @@ class x extends ni {
2976
2976
  super({ originator: n, eventHandlers: e, remoteIdentity: s }), this.delayStartPresentation = r;
2977
2977
  }
2978
2978
  static get C() {
2979
- return hn;
2979
+ return un;
2980
2980
  }
2981
2981
  static setPresentationError(e) {
2982
2982
  this.presentationError = e;
@@ -3015,22 +3015,22 @@ class x extends ni {
3015
3015
  const n = En();
3016
3016
  n.id = "mainaudio1";
3017
3017
  const s = [n];
3018
- if (ci(e)) {
3019
- const i = gn();
3018
+ if (di(e)) {
3019
+ const i = Tn();
3020
3020
  i.id = "mainvideo1", s.push(i);
3021
3021
  }
3022
- this.connection = new si(void 0, s), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
3022
+ this.connection = new ri(void 0, s), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
3023
3023
  }
3024
3024
  connect(e, { mediaStream: n } = {}) {
3025
- const s = ri(e);
3025
+ const s = ii(e);
3026
3026
  return this.initPeerconnection(n), this.timeoutConnect = setTimeout(() => {
3027
- e.includes(oi) ? this.trigger("failed", {
3027
+ e.includes(ci) ? this.trigger("failed", {
3028
3028
  originator: "remote",
3029
3029
  message: "IncomingResponse",
3030
3030
  cause: "Rejected"
3031
3031
  }) : (this.trigger("connecting"), this.timeoutNewInfo = setTimeout(() => {
3032
3032
  this.newInfo({
3033
- originator: Mt.REMOTE,
3033
+ originator: _t.REMOTE,
3034
3034
  // @ts-expect-error
3035
3035
  request: {
3036
3036
  getHeader: (r) => r === "content-type" ? "application/vinteo.webrtc.roomname" : r === "x-webrtc-enter-room" ? s : r === "x-webrtc-participant-name" ? "Test Caller 1" : ""
@@ -3041,7 +3041,7 @@ class x extends ni {
3041
3041
  }, 200), this.timeoutConfirmed = setTimeout(() => {
3042
3042
  this.trigger("confirmed");
3043
3043
  }, 300));
3044
- }, ze), this.connection;
3044
+ }, Je), this.connection;
3045
3045
  }
3046
3046
  terminate({ status_code: e, cause: n } = {}) {
3047
3047
  return this.status_code = e, this.trigger("ended", { status_code: e, cause: n, originator: "local" }), this.isEndedInner = !1, this;
@@ -3102,17 +3102,17 @@ class x extends ni {
3102
3102
  clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
3103
3103
  }
3104
3104
  }
3105
- const di = ["snapshot-changed"], li = () => new G(di), hi = (t) => t.type === "participant", de = (t) => t.type === "spectator_synthetic", H = (t) => t.type === "spectator", ui = (t, e) => H(t) && !H(e), Ei = (t, e) => H(e), gi = (t, e) => {
3105
+ const li = ["snapshot-changed"], hi = () => new G(li), ui = (t) => t.type === "participant", de = (t) => t.type === "spectator_synthetic", H = (t) => t.type === "spectator", gi = (t, e) => H(t) && !H(e), Ei = (t, e) => H(e), Ti = (t, e) => {
3106
3106
  const n = H(t) || de(t), s = H(e) || de(e);
3107
3107
  return n && !s;
3108
- }, Ti = (t, e) => {
3108
+ }, mi = (t, e) => {
3109
3109
  const n = H(t) || de(t), s = H(e) || de(e);
3110
3110
  return !n && s;
3111
3111
  }, Ie = {
3112
3112
  type: "participant"
3113
- }, mi = {
3113
+ }, Si = {
3114
3114
  type: "spectator_synthetic"
3115
- }, Si = (t) => ({
3115
+ }, pi = (t) => ({
3116
3116
  type: "spectator",
3117
3117
  recvParams: t
3118
3118
  });
@@ -3134,10 +3134,10 @@ class Ci {
3134
3134
  this.isAvailableSendingMedia = !0, this.changeRole(Ie);
3135
3135
  }
3136
3136
  setCallRoleSpectatorSynthetic(e = !0) {
3137
- this.isAvailableSendingMedia = e, this.changeRole(mi);
3137
+ this.isAvailableSendingMedia = e, this.changeRole(Si);
3138
3138
  }
3139
3139
  setCallRoleSpectator(e, n = !0) {
3140
- this.isAvailableSendingMedia = n, this.changeRole(Si(e));
3140
+ this.isAvailableSendingMedia = n, this.changeRole(pi(e));
3141
3141
  }
3142
3142
  changeRole(e) {
3143
3143
  const n = this.role;
@@ -3151,7 +3151,7 @@ class Ci {
3151
3151
  this.role = Ie, this.isAvailableSendingMedia = !0;
3152
3152
  }
3153
3153
  hasParticipant() {
3154
- return hi(this.role);
3154
+ return ui(this.role);
3155
3155
  }
3156
3156
  hasSpectatorSynthetic() {
3157
3157
  return de(this.role);
@@ -3171,26 +3171,32 @@ class Ci {
3171
3171
  });
3172
3172
  }
3173
3173
  }
3174
- const pi = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.type === "spectator" && t.recvParams.audioId === e.recvParams.audioId, Ri = (t, e) => t.license === e.license && pi(t.role, e.role) && t.derived.isAvailableSendingMedia === e.derived.isAvailableSendingMedia, Je = (t, e) => {
3175
- const n = t.getRole(), s = n.type === "spectator" || n.type === "spectator_synthetic";
3174
+ const Ri = (t, e) => t.type !== e.type ? !1 : t.type !== "spectator" ? !0 : e.type === "spectator" && t.recvParams.audioId === e.recvParams.audioId, Ni = (t, e) => t.license === e.license && t.isDuplexSendingMediaMode === e.isDuplexSendingMediaMode && Ri(t.role, e.role) && t.derived.isAvailableSendingMedia === e.derived.isAvailableSendingMedia, Ke = (t, e, n) => {
3175
+ const s = t.getRole(), r = s.type === "spectator" || s.type === "spectator_synthetic";
3176
3176
  return {
3177
- license: e,
3178
- role: n,
3177
+ license: n,
3178
+ isDuplexSendingMediaMode: e,
3179
+ role: s,
3179
3180
  derived: {
3180
- isSpectatorAny: s,
3181
- isRecvSessionExpected: n.type === "spectator",
3181
+ isSpectatorAny: r,
3182
+ isRecvSessionExpected: s.type === "spectator",
3182
3183
  isAvailableSendingMedia: t.getIsAvailableSendingMedia()
3183
3184
  }
3184
3185
  };
3185
3186
  };
3186
- class Ni extends w {
3187
+ class Ii extends w {
3187
3188
  roleManager = new Ci();
3188
3189
  license;
3190
+ isDuplexSendingMediaMode = !1;
3189
3191
  currentSnapshot;
3190
3192
  subscriptions = [];
3191
3193
  dedupedTotal = 0;
3192
3194
  constructor() {
3193
- super(li()), this.currentSnapshot = Je(this.roleManager, this.license);
3195
+ super(hi()), this.currentSnapshot = Ke(
3196
+ this.roleManager,
3197
+ this.isDuplexSendingMediaMode,
3198
+ this.license
3199
+ );
3194
3200
  const e = this.roleManager.subscribe(this.notifySubscribers);
3195
3201
  this.subscriptions.push({
3196
3202
  unsubscribe: e
@@ -3220,12 +3226,23 @@ class Ni extends w {
3220
3226
  this.roleManager.setCallRoleSpectator(e, n);
3221
3227
  }
3222
3228
  reset() {
3223
- this.roleManager.reset(), this.license = void 0, this.notifySubscribers();
3229
+ this.roleManager.reset(), this.license = void 0, this.isDuplexSendingMediaMode = !1, this.notifySubscribers();
3224
3230
  }
3225
3231
  subscribeToApiEvents(e) {
3226
- const n = e.on("use-license", this.handleUseLicense);
3232
+ const n = e.on("use-license", this.handleUseLicense), s = e.on(
3233
+ "admin:force-sync-media-state",
3234
+ this.handleSyncMediaState
3235
+ ), r = e.on("admin:stop-main-cam", this.handleSyncMediaState), i = e.on("admin:stop-mic", this.handleSyncMediaState), a = e.on("admin:start-mic", this.handleSyncMediaState);
3227
3236
  this.subscriptions.push({
3228
3237
  unsubscribe: n
3238
+ }), this.subscriptions.push({
3239
+ unsubscribe: s
3240
+ }), this.subscriptions.push({
3241
+ unsubscribe: r
3242
+ }), this.subscriptions.push({
3243
+ unsubscribe: i
3244
+ }), this.subscriptions.push({
3245
+ unsubscribe: a
3229
3246
  });
3230
3247
  }
3231
3248
  stop() {
@@ -3242,7 +3259,7 @@ class Ni extends w {
3242
3259
  }
3243
3260
  notifySubscribers = () => {
3244
3261
  const { previousSnapshot: e, currentSnapshot: n } = this.updateCurrentSnapshot();
3245
- if (Ri(e, n)) {
3262
+ if (Ni(e, n)) {
3246
3263
  this.dedupedTotal += 1;
3247
3264
  return;
3248
3265
  }
@@ -3253,7 +3270,11 @@ class Ni extends w {
3253
3270
  };
3254
3271
  updateCurrentSnapshot() {
3255
3272
  const e = this.currentSnapshot;
3256
- return this.currentSnapshot = Je(this.roleManager, this.license), {
3273
+ return this.currentSnapshot = Ke(
3274
+ this.roleManager,
3275
+ this.isDuplexSendingMediaMode,
3276
+ this.license
3277
+ ), {
3257
3278
  previousSnapshot: e,
3258
3279
  currentSnapshot: this.currentSnapshot
3259
3280
  };
@@ -3261,11 +3282,14 @@ class Ni extends w {
3261
3282
  handleUseLicense = (e) => {
3262
3283
  this.license = e, this.notifySubscribers();
3263
3284
  };
3285
+ handleSyncMediaState = ({ isSyncForced: e }) => {
3286
+ this.isDuplexSendingMediaMode = e, this.notifySubscribers();
3287
+ };
3264
3288
  }
3265
- const Ii = (t, e) => {
3289
+ const Ai = (t, e) => {
3266
3290
  const n = e.major === t.major, s = e.minor === t.minor, r = e.major > t.major, i = n && e.minor > t.minor, a = n && s && e.patch > t.patch;
3267
3291
  return r || i || a;
3268
- }, Ai = (t) => t.major !== void 0 && t.minor !== void 0 && t.patch !== void 0, vi = (t) => (e) => Ai(t) && Ii(t, e), fi = (t = "") => {
3292
+ }, vi = (t) => t.major !== void 0 && t.minor !== void 0 && t.patch !== void 0, fi = (t) => (e) => vi(t) && Ai(t, e), Mi = (t = "") => {
3269
3293
  const e = t.split(".");
3270
3294
  if (e.length <= 1)
3271
3295
  return {
@@ -3275,10 +3299,10 @@ const Ii = (t, e) => {
3275
3299
  };
3276
3300
  const [n, s, r] = e.map((i) => Number.parseInt(i, 10));
3277
3301
  return { major: n, minor: s, patch: r };
3278
- }, Mi = () => globalThis.process?.versions?.electron !== void 0, bt = () => {
3279
- const t = new In(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i = Mi(), a = r === "mobile", o = fi(n);
3302
+ }, _i = () => globalThis.process?.versions?.electron !== void 0, Pt = () => {
3303
+ const t = new An(), { name: e, version: n } = t.getBrowser(), { name: s } = t.getOS(), { type: r } = t.getDevice(), i = _i(), a = r === "mobile", o = Mi(n);
3280
3304
  return {
3281
- hasGreaterThanBrowserVersion: vi(o),
3305
+ hasGreaterThanBrowserVersion: fi(o),
3282
3306
  isMobileDevice: a,
3283
3307
  isChrome: e === "Chrome" || i,
3284
3308
  isYandexBrowser: e === "Yandex",
@@ -3286,19 +3310,19 @@ const Ii = (t, e) => {
3286
3310
  isOpera: e === "Opera",
3287
3311
  isWindows: s === "Windows"
3288
3312
  };
3289
- }, _i = A("stringifyMessage"), yc = (t) => {
3313
+ }, Oi = A("stringifyMessage"), Dc = (t) => {
3290
3314
  let e = "";
3291
3315
  try {
3292
3316
  e = JSON.stringify(t);
3293
3317
  } catch (n) {
3294
- _i("failed to stringify message", n);
3318
+ Oi("failed to stringify message", n);
3295
3319
  }
3296
3320
  return e;
3297
- }, Oi = /^p2p.+to.+$/i, be = (t) => t !== void 0 && t.length > 0 && Oi.test(t), bi = "purgatory", Se = (t) => t === bi, Pi = (t, e) => {
3321
+ }, bi = /^p2p.+to.+$/i, Pe = (t) => t !== void 0 && t.length > 0 && bi.test(t), Pi = "purgatory", Se = (t) => t === Pi, yi = (t, e) => {
3298
3322
  t.getVideoTracks().forEach((s) => {
3299
3323
  "contentHint" in s && s.contentHint !== e && (s.contentHint = e);
3300
3324
  });
3301
- }, Ee = (t, {
3325
+ }, ge = (t, {
3302
3326
  directionVideo: e,
3303
3327
  directionAudio: n,
3304
3328
  contentHint: s
@@ -3306,8 +3330,8 @@ const Ii = (t, e) => {
3306
3330
  if (!t || e === "recvonly" && n === "recvonly")
3307
3331
  return;
3308
3332
  const r = n === "recvonly" ? [] : t.getAudioTracks(), i = e === "recvonly" ? [] : t.getVideoTracks(), a = [...r, ...i], o = new MediaStream(a);
3309
- return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Pi(o, s), o;
3310
- }, yi = "api/v2/rtp2webrtc/offer", Di = async ({
3333
+ return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && yi(o, s), o;
3334
+ }, Di = "api/v2/rtp2webrtc/offer", Li = async ({
3311
3335
  serverUrl: t,
3312
3336
  conferenceNumber: e,
3313
3337
  quality: n,
@@ -3316,7 +3340,7 @@ const Ii = (t, e) => {
3316
3340
  token: i
3317
3341
  }) => {
3318
3342
  const a = new URL(
3319
- `https://${t.replace(/\/$/, "")}/${yi}/${encodeURIComponent(e)}`
3343
+ `https://${t.replace(/\/$/, "")}/${Di}/${encodeURIComponent(e)}`
3320
3344
  );
3321
3345
  a.searchParams.set("quality", n), a.searchParams.set("audio", String(s));
3322
3346
  const o = {
@@ -3330,47 +3354,47 @@ const Ii = (t, e) => {
3330
3354
  });
3331
3355
  if (!c.ok)
3332
3356
  throw new Error(`sendOffer failed with status ${c.status}`);
3333
- const E = await c.json();
3357
+ const g = await c.json();
3334
3358
  return {
3335
- type: E.type,
3336
- sdp: E.sdp,
3359
+ type: g.type,
3360
+ sdp: g.sdp,
3337
3361
  toJSON() {
3338
- return E;
3362
+ return g;
3339
3363
  }
3340
3364
  };
3341
- }, Li = (t, e) => (t.degradationPreference = e.degradationPreference, t), wi = (t, e) => {
3365
+ }, wi = (t, e) => (t.degradationPreference = e.degradationPreference, t), Gi = (t, e) => {
3342
3366
  t.encodings ??= [];
3343
3367
  for (let n = t.encodings.length; n < e; n += 1)
3344
3368
  t.encodings.push({});
3345
3369
  return t;
3346
- }, Pt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t, Gi = Pt(), ki = (t, e) => {
3347
- if (Gi(t, e))
3370
+ }, yt = (t) => (e, n) => n !== void 0 && e !== n || n === void 0 && e !== t, ki = yt(), Ui = (t, e) => {
3371
+ if (ki(t, e))
3348
3372
  return t;
3349
- }, Ui = (t, e, { isResetAllowed: n = !1 } = {}) => {
3350
- const s = t.maxBitrate, r = ki(e, s);
3373
+ }, Fi = (t, e, { isResetAllowed: n = !1 } = {}) => {
3374
+ const s = t.maxBitrate, r = Ui(e, s);
3351
3375
  return (r !== void 0 || n) && (t.maxBitrate = r ?? e), t;
3352
- }, yt = 1, Fi = Pt(
3353
- yt
3354
- ), Bi = (t, e) => {
3355
- const n = t === void 0 ? void 0 : Math.max(t, yt);
3356
- if (n !== void 0 && Fi(
3376
+ }, Dt = 1, Bi = yt(
3377
+ Dt
3378
+ ), $i = (t, e) => {
3379
+ const n = t === void 0 ? void 0 : Math.max(t, Dt);
3380
+ if (n !== void 0 && Bi(
3357
3381
  n,
3358
3382
  e
3359
3383
  ))
3360
3384
  return n;
3361
- }, $i = (t, e) => {
3362
- const n = t.scaleResolutionDownBy, s = Bi(
3385
+ }, xi = (t, e) => {
3386
+ const n = t.scaleResolutionDownBy, s = $i(
3363
3387
  e,
3364
3388
  n
3365
3389
  );
3366
3390
  return s !== void 0 && (t.scaleResolutionDownBy = s), t;
3367
- }, xi = (t, e, { isResetAllowed: n } = {}) => {
3391
+ }, Vi = (t, e, { isResetAllowed: n } = {}) => {
3368
3392
  const s = e.encodings?.length ?? 0;
3369
- return wi(t, s), t.encodings.forEach((r, i) => {
3393
+ return Gi(t, s), t.encodings.forEach((r, i) => {
3370
3394
  const a = (e?.encodings ?? [])[i], o = a?.maxBitrate, c = a?.scaleResolutionDownBy;
3371
- Ui(r, o, { isResetAllowed: n }), $i(r, c);
3395
+ Fi(r, o, { isResetAllowed: n }), xi(r, c);
3372
3396
  }), t;
3373
- }, Vi = (t, e) => {
3397
+ }, qi = (t, e) => {
3374
3398
  if (t.codecs?.length !== e.codecs?.length)
3375
3399
  return !0;
3376
3400
  for (let n = 0; n < (t.codecs?.length ?? 0); n++)
@@ -3387,15 +3411,15 @@ const Ii = (t, e) => {
3387
3411
  if (JSON.stringify(t.encodings[n]) !== JSON.stringify(e.encodings[n]))
3388
3412
  return !0;
3389
3413
  return t.rtcp?.cname !== e.rtcp?.cname || t.rtcp?.reducedSize !== e.rtcp?.reducedSize || t.degradationPreference !== e.degradationPreference;
3390
- }, Pe = async (t, e, { isResetAllowed: n } = {}) => {
3414
+ }, ye = async (t, e, { isResetAllowed: n } = {}) => {
3391
3415
  const s = t.getParameters(), r = JSON.parse(
3392
3416
  JSON.stringify(s)
3393
3417
  );
3394
- xi(s, e, { isResetAllowed: n }), Li(s, e);
3395
- const i = Vi(r, s);
3418
+ Vi(s, e, { isResetAllowed: n }), wi(s, e);
3419
+ const i = qi(r, s);
3396
3420
  return i && await t.setParameters(s), { parameters: s, isChanged: i };
3397
- }, Dt = async (t, e, n) => {
3398
- const { isChanged: s, parameters: r } = await Pe(t, {
3421
+ }, Lt = async (t, e, n) => {
3422
+ const { isChanged: s, parameters: r } = await ye(t, {
3399
3423
  encodings: [
3400
3424
  {
3401
3425
  scaleResolutionDownBy: e.scaleResolutionDownBy,
@@ -3404,12 +3428,12 @@ const Ii = (t, e) => {
3404
3428
  ]
3405
3429
  });
3406
3430
  return s && n && n(r), { isChanged: s, parameters: r };
3407
- }, qi = (t, e) => t.find((n) => n.track !== null && e.getTracks().includes(n.track)), Hi = async (t, e, n) => {
3408
- const s = qi(t, e);
3431
+ }, Hi = (t, e) => t.find((n) => n.track !== null && e.getTracks().includes(n.track)), Wi = async (t, e, n) => {
3432
+ const s = Hi(t, e);
3409
3433
  if (s)
3410
- return Dt(s, { maxBitrate: n });
3411
- }, Wi = A("resolveOnStartMainCam"), Dc = (t) => (n) => (Wi("onStartMainCam"), t.on("api:admin:start-main-cam", n)), Qi = A("resolveOnStartMic"), Lc = (t) => (n) => (Qi("onStartMic"), t.on("api:admin:start-mic", n)), Yi = A("resolveOnStopMainCam"), wc = (t) => (n) => (Yi("onStopMainCam"), t.on("api:admin:stop-main-cam", n)), ji = A("resolveOnStopMic"), Gc = (t) => (n) => (ji("onStopMic"), t.on("api:admin:stop-mic", n));
3412
- class zi {
3434
+ return Lt(s, { maxBitrate: n });
3435
+ }, Qi = A("resolveOnStartMainCam"), Lc = (t) => (n) => (Qi("onStartMainCam"), t.on("api:admin:start-main-cam", n)), Yi = A("resolveOnStartMic"), wc = (t) => (n) => (Yi("onStartMic"), t.on("api:admin:start-mic", n)), ji = A("resolveOnStopMainCam"), Gc = (t) => (n) => (ji("onStopMainCam"), t.on("api:admin:stop-main-cam", n)), zi = A("resolveOnStopMic"), kc = (t) => (n) => (zi("onStopMic"), t.on("api:admin:stop-mic", n));
3436
+ class Ji {
3413
3437
  command = void 0;
3414
3438
  unsubscribe;
3415
3439
  options;
@@ -3427,18 +3451,19 @@ class zi {
3427
3451
  }
3428
3452
  const v = "evaluate";
3429
3453
  var u = /* @__PURE__ */ ((t) => (t.IDLE = "call:idle", t.CONNECTING = "call:connecting", t.PRESENTATION_CALL = "call:presentationCall", t.ROOM_PENDING_AUTH = "call:roomPendingAuth", t.PURGATORY = "call:purgatory", t.P2P_ROOM = "call:p2pRoom", t.DIRECT_P2P_ROOM = "call:directP2pRoom", t.IN_ROOM = "call:inRoom", t.DISCONNECTING = "call:disconnecting", t))(u || {});
3430
- const Lt = {
3454
+ const wt = {
3431
3455
  raw: {},
3432
3456
  state: {}
3433
- }, wt = (t) => "number" in t && B(t.number) && St(t.answer), Gt = (t) => "room" in t && B(t.room) && B(t.participantName), Ji = (t) => "token" in t && B(t.token), kt = (t) => Ji(t) && "conferenceForToken" in t && B(t.conferenceForToken), ae = (t) => wt(t) && Gt(t), Ut = (t) => !kt(t) || !Gt(t) ? !1 : t.conferenceForToken === t.room, Ft = ({
3457
+ }, Gt = (t) => "number" in t && B(t.number) && pt(t.answer), kt = (t) => "room" in t && B(t.room) && B(t.participantName) && Oe(t.startedTimestamp), Ki = (t) => "token" in t && B(t.token), Ut = (t) => Ki(t) && "conferenceForToken" in t && B(t.conferenceForToken), ae = (t) => Gt(t) && kt(t), Ft = (t) => !Ut(t) || !kt(t) ? !1 : t.conferenceForToken === t.room, Bt = ({
3434
3458
  isDirectPeerToPeer: t
3435
- }) => t === !0, Ae = (t) => "isDirectPeerToPeer" in t && Ft(t), Ki = "x-vinteo-presentation-call: yes", Xi = (t) => yn(t) && t.some((e) => e.trim().toLowerCase() === Ki), Zi = (t) => "extraHeaders" in t && Xi(t.extraHeaders) && "isConfirmed" in t && t.isConfirmed === !0, he = (t) => ae(t) && !Se(t.room) && kt(t) && Ut(t), re = (t) => {
3459
+ }) => t === !0, Ae = (t) => "isDirectPeerToPeer" in t && Bt(t), Xi = "x-vinteo-presentation-call: yes", Zi = (t) => Dn(t) && t.some((e) => e.trim().toLowerCase() === Xi), ea = (t) => "extraHeaders" in t && Zi(t.extraHeaders) && "isConfirmed" in t && t.isConfirmed === !0, he = (t) => ae(t) && !Se(t.room) && Ut(t) && Ft(t), re = (t) => {
3436
3460
  const e = t;
3437
3461
  return {
3438
3462
  number: e.number,
3439
3463
  answer: e.answer,
3440
3464
  room: e.room,
3441
- participantName: e.participantName
3465
+ participantName: e.participantName,
3466
+ startedTimestamp: e.startedTimestamp
3442
3467
  };
3443
3468
  }, D = {
3444
3469
  [u.IDLE]: {
@@ -3446,21 +3471,21 @@ const Lt = {
3446
3471
  buildContext: () => ({})
3447
3472
  },
3448
3473
  [u.CONNECTING]: {
3449
- guard: wt,
3474
+ guard: Gt,
3450
3475
  buildContext: (t) => {
3451
3476
  const { number: e, answer: n, extraHeaders: s } = t;
3452
3477
  return { number: e, answer: n, extraHeaders: s };
3453
3478
  }
3454
3479
  },
3455
3480
  [u.PRESENTATION_CALL]: {
3456
- guard: Zi,
3481
+ guard: ea,
3457
3482
  buildContext: (t) => {
3458
- const { number: e, answer: n } = t;
3459
- return { number: e, answer: n };
3483
+ const { number: e, answer: n, startedTimestamp: s } = t;
3484
+ return { number: e, answer: n, startedTimestamp: s };
3460
3485
  }
3461
3486
  },
3462
3487
  [u.ROOM_PENDING_AUTH]: {
3463
- guard: (t) => ae(t) && !Se(t.room) && !be(t.room) && !Ae(t) && !Ut(t),
3488
+ guard: (t) => ae(t) && !Se(t.room) && !Pe(t.room) && !Ae(t) && !Ft(t),
3464
3489
  buildContext: re
3465
3490
  },
3466
3491
  /** Токен из TOKEN_ISSUED может уже лежать в context — это не переводит в IN_ROOM. */
@@ -3469,7 +3494,7 @@ const Lt = {
3469
3494
  buildContext: re
3470
3495
  },
3471
3496
  [u.P2P_ROOM]: {
3472
- guard: (t) => ae(t) && be(t.room) && !Ae(t) && !he(t),
3497
+ guard: (t) => ae(t) && Pe(t.room) && !Ae(t) && !he(t),
3473
3498
  buildContext: re
3474
3499
  },
3475
3500
  [u.DIRECT_P2P_ROOM]: {
@@ -3488,9 +3513,9 @@ const Lt = {
3488
3513
  guard: (t) => t.pendingDisconnect === !0,
3489
3514
  buildContext: () => ({})
3490
3515
  }
3491
- }, ea = (t) => Se(t.room) || be(t.room) || Ft(t), ve = () => ({}), ta = () => Z({
3516
+ }, ta = (t) => Se(t.room) || Pe(t.room) || Bt(t), ve = () => ({}), na = () => Z({
3492
3517
  types: {
3493
- context: Lt,
3518
+ context: wt,
3494
3519
  events: {}
3495
3520
  },
3496
3521
  actions: {
@@ -3509,10 +3534,13 @@ const Lt = {
3509
3534
  room: t.room,
3510
3535
  participantName: t.participantName
3511
3536
  };
3512
- return B(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) : ea(t) && (n.token = void 0, n.conferenceForToken = void 0), St(t.isDirectPeerToPeer) && (n.isDirectPeerToPeer = t.isDirectPeerToPeer), {
3537
+ B(t.token) ? (n.token = t.token, n.conferenceForToken = t.room) : ta(t) && (n.token = void 0, n.conferenceForToken = void 0), pt(t.isDirectPeerToPeer) && (n.isDirectPeerToPeer = t.isDirectPeerToPeer);
3538
+ const r = e.raw.startedTimestamp, i = Oe(r) ? r : Date.now();
3539
+ return {
3513
3540
  raw: {
3514
3541
  ...e.raw,
3515
- ...n
3542
+ ...n,
3543
+ startedTimestamp: i
3516
3544
  }
3517
3545
  };
3518
3546
  }),
@@ -3524,11 +3552,17 @@ const Lt = {
3524
3552
  participantName: t.participantName
3525
3553
  }
3526
3554
  }),
3527
- setConfirmed: f(({ event: t, context: e }) => t.type !== "CALL.PRESENTATION_CALL" ? e : {
3528
- raw: {
3529
- ...e.raw,
3530
- isConfirmed: !0
3531
- }
3555
+ setConfirmed: f(({ event: t, context: e }) => {
3556
+ if (t.type !== "CALL.PRESENTATION_CALL")
3557
+ return e;
3558
+ const s = e.raw.startedTimestamp, r = Oe(s) ? s : Date.now();
3559
+ return {
3560
+ raw: {
3561
+ ...e.raw,
3562
+ isConfirmed: !0,
3563
+ startedTimestamp: r
3564
+ }
3565
+ };
3532
3566
  }),
3533
3567
  reset: f(() => ({ raw: ve() })),
3534
3568
  prepareDisconnect: f(() => ({
@@ -3538,10 +3572,10 @@ const Lt = {
3538
3572
  }
3539
3573
  }))
3540
3574
  }
3541
- }), na = () => ta().createMachine({
3575
+ }), sa = () => na().createMachine({
3542
3576
  id: "call",
3543
3577
  initial: u.IDLE,
3544
- context: Lt,
3578
+ context: wt,
3545
3579
  states: {
3546
3580
  [u.IDLE]: {
3547
3581
  entry: f(() => ({ state: D[u.IDLE].buildContext() })),
@@ -3745,11 +3779,11 @@ const Lt = {
3745
3779
  }
3746
3780
  }
3747
3781
  });
3748
- function sa(t) {
3782
+ function ra(t) {
3749
3783
  return t !== v;
3750
3784
  }
3751
- const ra = A("CallStateMachine");
3752
- class ia extends ee {
3785
+ const ia = A("CallStateMachine");
3786
+ class aa extends ee {
3753
3787
  constructor(e, n) {
3754
3788
  super(e), this.subscribeToEvents(n);
3755
3789
  }
@@ -3822,6 +3856,10 @@ class ia extends ee {
3822
3856
  if (this.state === u.IN_ROOM)
3823
3857
  return this.context.state;
3824
3858
  }
3859
+ get presentationCallContext() {
3860
+ if (this.state === u.PRESENTATION_CALL)
3861
+ return this.context.state;
3862
+ }
3825
3863
  /** Только в DISCONNECTING (контекст сброшен, опционально `pendingDisconnect`). */
3826
3864
  get disconnectingContext() {
3827
3865
  if (this.state === u.DISCONNECTING)
@@ -3830,6 +3868,14 @@ class ia extends ee {
3830
3868
  get isActive() {
3831
3869
  return this.isInRoom || this.isPresentationCall || this.isRoomPendingAuth || this.isInPurgatory || this.isP2PRoom || this.isDirectP2PRoom;
3832
3870
  }
3871
+ /**
3872
+ * Время первого попадания в одно из состояний «активной» фазы звонка:
3873
+ * `ROOM_PENDING_AUTH`, `PRESENTATION_CALL`, `PURGATORY`, `P2P_ROOM`, `DIRECT_P2P_ROOM`, `IN_ROOM`.
3874
+ * Сохраняется при переходах между ними; сбрасывается при `CALL.RESET` / disconnect.
3875
+ */
3876
+ get startedTimestamp() {
3877
+ return this.inRoomContext?.startedTimestamp ?? this.roomPendingAuthContext?.startedTimestamp ?? this.presentationCallContext?.startedTimestamp ?? this.purgatoryContext?.startedTimestamp ?? this.p2pRoomContext?.startedTimestamp ?? this.directP2pRoomContext?.startedTimestamp;
3878
+ }
3833
3879
  get number() {
3834
3880
  const { raw: e } = this.context;
3835
3881
  if ("number" in e)
@@ -3880,7 +3926,7 @@ class ia extends ee {
3880
3926
  (o !== a.token || c !== a.conferenceForToken) && (n = a, e(a));
3881
3927
  return;
3882
3928
  }
3883
- sa(r.value) && (n = void 0);
3929
+ ra(r.value) && (n = void 0);
3884
3930
  });
3885
3931
  return () => {
3886
3932
  s.unsubscribe();
@@ -3891,7 +3937,7 @@ class ia extends ee {
3891
3937
  }
3892
3938
  send(e) {
3893
3939
  if (!this.actor.getSnapshot().can(e)) {
3894
- ra(
3940
+ ia(
3895
3941
  `[CallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
3896
3942
  );
3897
3943
  return;
@@ -3947,15 +3993,15 @@ class ia extends ee {
3947
3993
  );
3948
3994
  }
3949
3995
  }
3950
- const aa = (t) => new ia(na(), t), oa = (t) => [...t.keys()].map((e) => t.get(e)), ca = (t, e) => oa(t).find((n) => n?.type === e), Bt = async (t) => t.getStats().then((e) => ca(e, "codec")?.mimeType);
3951
- class da {
3996
+ const oa = (t) => new aa(sa(), t), ca = (t) => [...t.keys()].map((e) => t.get(e)), da = (t, e) => ca(t).find((n) => n?.type === e), $t = async (t) => t.getStats().then((e) => da(e, "codec")?.mimeType);
3997
+ class la {
3952
3998
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this
3953
3999
  async getCodecFromSender(e) {
3954
- return await Bt(e) ?? "";
4000
+ return await $t(e) ?? "";
3955
4001
  }
3956
4002
  }
3957
- const la = A("TaskQueue");
3958
- class ha {
4003
+ const ha = A("TaskQueue");
4004
+ class ua {
3959
4005
  stackPromises = Et({
3960
4006
  noRunIsNotActual: !0
3961
4007
  });
@@ -3976,26 +4022,26 @@ class ha {
3976
4022
  */
3977
4023
  async run() {
3978
4024
  return this.stackPromises().catch((e) => {
3979
- la("TaskQueue: error", e);
4025
+ ha("TaskQueue: error", e);
3980
4026
  });
3981
4027
  }
3982
4028
  }
3983
- class ua {
4029
+ class ga {
3984
4030
  taskQueue;
3985
4031
  onSetParameters;
3986
4032
  constructor(e) {
3987
- this.onSetParameters = e, this.taskQueue = new ha();
4033
+ this.onSetParameters = e, this.taskQueue = new ua();
3988
4034
  }
3989
4035
  async setEncodingsToSender(e, n) {
3990
- return this.taskQueue.add(async () => Dt(e, n, this.onSetParameters));
4036
+ return this.taskQueue.add(async () => Lt(e, n, this.onSetParameters));
3991
4037
  }
3992
4038
  stop() {
3993
4039
  this.taskQueue.stop();
3994
4040
  }
3995
4041
  }
3996
- const ye = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()), Ea = 1e6, q = (t) => t * Ea, $t = q(0.06), xt = q(4), ga = (t) => t <= 64 ? $t : t <= 128 ? q(0.12) : t <= 256 ? q(0.25) : t <= 384 ? q(0.32) : t <= 426 ? q(0.38) : t <= 640 ? q(0.5) : t <= 848 ? q(0.7) : t <= 1280 ? q(1) : t <= 1920 ? q(2) : xt, Ta = "av1", ma = (t) => ye(t, Ta), Sa = 0.6, Ue = (t, e) => ma(e) ? t * Sa : t, Vt = (t) => Ue($t, t), qt = (t) => Ue(xt, t), Ke = (t, e) => {
3997
- const n = ga(t);
3998
- return Ue(n, e);
4042
+ const De = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.toLowerCase()), Ea = 1e6, q = (t) => t * Ea, xt = q(0.06), Vt = q(4), Ta = (t) => t <= 64 ? xt : t <= 128 ? q(0.12) : t <= 256 ? q(0.25) : t <= 384 ? q(0.32) : t <= 426 ? q(0.38) : t <= 640 ? q(0.5) : t <= 848 ? q(0.7) : t <= 1280 ? q(1) : t <= 1920 ? q(2) : Vt, ma = "av1", Sa = (t) => De(t, ma), pa = 0.6, Fe = (t, e) => Sa(e) ? t * pa : t, qt = (t) => Fe(xt, t), Ht = (t) => Fe(Vt, t), Xe = (t, e) => {
4043
+ const n = Ta(t);
4044
+ return Fe(n, e);
3999
4045
  }, fe = 1, Ca = ({
4000
4046
  videoTrack: t,
4001
4047
  targetSize: e
@@ -4003,7 +4049,7 @@ const ye = (t, e) => t !== void 0 && e !== void 0 && t.toLowerCase().includes(e.
4003
4049
  const n = t.getSettings(), s = n.width, r = n.height, i = s === void 0 ? fe : s / e.width, a = r === void 0 ? fe : r / e.height;
4004
4050
  return Math.max(i, a, fe);
4005
4051
  };
4006
- class pa {
4052
+ class Ra {
4007
4053
  ignoreForCodec;
4008
4054
  senderFinder;
4009
4055
  codecProvider;
@@ -4036,7 +4082,7 @@ class pa {
4036
4082
  if (!r?.track)
4037
4083
  return { ...this.resultNoChanged, sender: r };
4038
4084
  const i = await this.codecProvider.getCodecFromSender(r);
4039
- if (ye(i, this.ignoreForCodec))
4085
+ if (De(i, this.ignoreForCodec))
4040
4086
  return { ...this.resultNoChanged, sender: r };
4041
4087
  const { mainCam: a, resolutionMainCam: o } = n ?? {};
4042
4088
  return this.processSender(
@@ -4058,7 +4104,7 @@ class pa {
4058
4104
  if (!s?.track)
4059
4105
  return { ...this.resultNoChanged, sender: s };
4060
4106
  const r = await this.codecProvider.getCodecFromSender(s);
4061
- if (ye(r, this.ignoreForCodec))
4107
+ if (De(r, this.ignoreForCodec))
4062
4108
  return { ...this.resultNoChanged, sender: s };
4063
4109
  const i = {
4064
4110
  sender: s,
@@ -4097,7 +4143,7 @@ class pa {
4097
4143
  async downgradeResolutionSender(e) {
4098
4144
  const { sender: n, codec: s } = e, r = {
4099
4145
  scaleResolutionDownBy: 200,
4100
- maxBitrate: Vt(s)
4146
+ maxBitrate: qt(s)
4101
4147
  };
4102
4148
  return this.parametersSetter.setEncodingsToSender(n, r);
4103
4149
  }
@@ -4107,7 +4153,7 @@ class pa {
4107
4153
  * @returns Promise с результатом
4108
4154
  */
4109
4155
  async setBitrateByTrackResolution(e) {
4110
- const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ? qt(r) : Ke(a, r);
4156
+ const { sender: n, videoTrack: s, codec: r } = e, a = s.getSettings().width, o = a === void 0 ? Ht(r) : Xe(a, r);
4111
4157
  return this.parametersSetter.setEncodingsToSender(n, {
4112
4158
  scaleResolutionDownBy: 1,
4113
4159
  maxBitrate: o
@@ -4123,24 +4169,24 @@ class pa {
4123
4169
  const [s, r] = e.split("x"), { sender: i, videoTrack: a, codec: o } = n, c = {
4124
4170
  width: Number(s),
4125
4171
  height: Number(r)
4126
- }, E = Ca({
4172
+ }, g = Ca({
4127
4173
  videoTrack: a,
4128
4174
  targetSize: c
4129
- }), p = Ke(c.width, o), I = {
4130
- scaleResolutionDownBy: E,
4131
- maxBitrate: p
4175
+ }), C = Xe(c.width, o), I = {
4176
+ scaleResolutionDownBy: g,
4177
+ maxBitrate: C
4132
4178
  };
4133
4179
  return this.parametersSetter.setEncodingsToSender(i, I);
4134
4180
  }
4135
4181
  }
4136
- const Ra = (t) => t.find((e) => e.track?.kind === "video");
4137
- class Na {
4182
+ const Na = (t) => t.find((e) => e.track?.kind === "video");
4183
+ class Ia {
4138
4184
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this
4139
4185
  findVideoSender(e) {
4140
- return Ra(e);
4186
+ return Na(e);
4141
4187
  }
4142
4188
  }
4143
- class Ia {
4189
+ class Aa {
4144
4190
  currentSender;
4145
4191
  originalReplaceTrack;
4146
4192
  lastWidth;
@@ -4153,7 +4199,7 @@ class Ia {
4153
4199
  pollIntervalMs: e = 1e3,
4154
4200
  maxPollIntervalMs: n
4155
4201
  }) {
4156
- this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ht();
4202
+ this.pollIntervalMs = e, this.maxPollIntervalMs = n ?? e * 16, this.currentPollIntervalMs = this.pollIntervalMs, this.setTimeoutRequest = new ut();
4157
4203
  }
4158
4204
  /**
4159
4205
  * Проверяет актуальный video-sender и (при необходимости) перенастраивает наблюдение.
@@ -4204,7 +4250,7 @@ class Ia {
4204
4250
  this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
4205
4251
  }
4206
4252
  }
4207
- class Aa {
4253
+ class va {
4208
4254
  apiManager;
4209
4255
  currentHandler;
4210
4256
  constructor(e) {
@@ -4225,7 +4271,7 @@ class Aa {
4225
4271
  }
4226
4272
  }
4227
4273
  const Me = A("VideoSendingBalancer");
4228
- class va {
4274
+ class fa {
4229
4275
  eventHandler;
4230
4276
  senderBalancer;
4231
4277
  parametersSetterWithQueue;
@@ -4237,16 +4283,16 @@ class va {
4237
4283
  onSetParameters: r,
4238
4284
  pollIntervalMs: i
4239
4285
  } = {}) {
4240
- this.getConnection = n, this.eventHandler = new Aa(e), this.parametersSetterWithQueue = new ua(r), this.senderBalancer = new pa(
4286
+ this.getConnection = n, this.eventHandler = new va(e), this.parametersSetterWithQueue = new ga(r), this.senderBalancer = new Ra(
4241
4287
  {
4242
- senderFinder: new Na(),
4243
- codecProvider: new da(),
4288
+ senderFinder: new Ia(),
4289
+ codecProvider: new la(),
4244
4290
  parametersSetter: this.parametersSetterWithQueue
4245
4291
  },
4246
4292
  {
4247
4293
  ignoreForCodec: s
4248
4294
  }
4249
- ), this.trackMonitor = new Ia({ pollIntervalMs: i });
4295
+ ), this.trackMonitor = new Aa({ pollIntervalMs: i });
4250
4296
  }
4251
4297
  /**
4252
4298
  * Подписывается на события управления главной камерой
@@ -4300,8 +4346,8 @@ class va {
4300
4346
  });
4301
4347
  };
4302
4348
  }
4303
- const fa = 6e3, Ma = 52e4, ue = (t, e) => t.getSenders().filter((n) => n.track?.kind === e), _a = (t, e) => t === "audio" ? fa : Vt(e), Oa = (t) => t.track !== null;
4304
- class ba {
4349
+ const Ma = 6e3, _a = 52e4, ue = (t, e) => t.getSenders().filter((n) => n.track?.kind === e), Oa = (t, e) => t === "audio" ? Ma : qt(e), ba = (t) => t.track !== null;
4350
+ class Pa {
4305
4351
  previousBitrates = /* @__PURE__ */ new Map();
4306
4352
  /**
4307
4353
  * Устанавливает минимальный битрейт для указанных типов потоков
@@ -4313,17 +4359,17 @@ class ba {
4313
4359
  if (!e)
4314
4360
  return;
4315
4361
  (n === "audio" || n === "all") && s.push(...ue(e, "audio")), (n === "video" || n === "all") && s.push(...ue(e, "video"));
4316
- const r = s.filter(Oa).map(async (i) => {
4362
+ const r = s.filter(ba).map(async (i) => {
4317
4363
  const a = i.getParameters();
4318
4364
  this.saveCurrentBitrate(i, a);
4319
4365
  const o = {
4320
4366
  ...a,
4321
4367
  encodings: a.encodings.map((c) => ({
4322
4368
  ...c,
4323
- maxBitrate: _a(i.track.kind)
4369
+ maxBitrate: Oa(i.track.kind)
4324
4370
  }))
4325
4371
  };
4326
- await Pe(i, o);
4372
+ await ye(i, o);
4327
4373
  });
4328
4374
  await Promise.all(r);
4329
4375
  }
@@ -4340,10 +4386,10 @@ class ba {
4340
4386
  const r = s.map(async (i) => {
4341
4387
  const a = this.getSavedBitrate(i);
4342
4388
  if (a) {
4343
- const o = i.getParameters(), c = i.track?.kind === "video", E = c ? await Bt(i) : void 0, p = {
4389
+ const o = i.getParameters(), c = i.track?.kind === "video", g = c ? await $t(i) : void 0, C = {
4344
4390
  ...o,
4345
4391
  encodings: a.map((I) => {
4346
- const b = c ? qt(E) : Ma;
4392
+ const b = c ? Ht(g) : _a;
4347
4393
  return {
4348
4394
  ...I,
4349
4395
  // В Safari и некоторых браузерах encodings изначально не содержат maxBitrate.
@@ -4355,7 +4401,7 @@ class ba {
4355
4401
  };
4356
4402
  })
4357
4403
  };
4358
- await Pe(i, p, { isResetAllowed: !0 }), this.clearSavedBitrate(i);
4404
+ await ye(i, C, { isResetAllowed: !0 }), this.clearSavedBitrate(i);
4359
4405
  }
4360
4406
  });
4361
4407
  await Promise.all(r);
@@ -4398,16 +4444,16 @@ class ba {
4398
4444
  this.previousBitrates.set(e, s);
4399
4445
  }
4400
4446
  }
4401
- var Ht = /* @__PURE__ */ ((t) => (t.BYE = "Terminated", t.WEBRTC_ERROR = "WebRTC Error", t.CANCELED = "Canceled", t.REQUEST_TIMEOUT = "Request Timeout", t.REJECTED = "Rejected", t.REDIRECTED = "Redirected", t.UNAVAILABLE = "Unavailable", t.NOT_FOUND = "Not Found", t.ADDRESS_INCOMPLETE = "Address Incomplete", t.INCOMPATIBLE_SDP = "Incompatible SDP", t.BAD_MEDIA_DESCRIPTION = "Bad Media Description", t))(Ht || {});
4402
- const Xe = A("MCUSession");
4403
- class Pa {
4447
+ var Wt = /* @__PURE__ */ ((t) => (t.BYE = "Terminated", t.WEBRTC_ERROR = "WebRTC Error", t.CANCELED = "Canceled", t.REQUEST_TIMEOUT = "Request Timeout", t.REJECTED = "Rejected", t.REDIRECTED = "Redirected", t.UNAVAILABLE = "Unavailable", t.NOT_FOUND = "Not Found", t.ADDRESS_INCOMPLETE = "Address Incomplete", t.INCOMPATIBLE_SDP = "Incompatible SDP", t.BAD_MEDIA_DESCRIPTION = "Bad Media Description", t))(Wt || {});
4448
+ const Ze = A("MCUSession");
4449
+ class ya {
4404
4450
  events;
4405
4451
  rtcSession;
4406
4452
  disposers = /* @__PURE__ */ new Set();
4407
4453
  onReset;
4408
4454
  pcConfig;
4409
4455
  // Менеджер состояния битрейта
4410
- bitrateStateManager = new ba();
4456
+ bitrateStateManager = new Pa();
4411
4457
  constructor(e, { onReset: n }) {
4412
4458
  this.events = e, this.onReset = n, e.on("failed", this.handleEnded), e.on("ended", this.handleEnded);
4413
4459
  }
@@ -4433,8 +4479,8 @@ class Pa {
4433
4479
  iceServers: a,
4434
4480
  directionVideo: o,
4435
4481
  directionAudio: c,
4436
- contentHint: E,
4437
- offerToReceiveAudio: p = !0,
4482
+ contentHint: g,
4483
+ offerToReceiveAudio: C = !0,
4438
4484
  offerToReceiveVideo: I = !0,
4439
4485
  degradationPreference: b,
4440
4486
  sendEncodings: _,
@@ -4443,16 +4489,16 @@ class Pa {
4443
4489
  this.handleCall().then(L).catch((te) => {
4444
4490
  z(te);
4445
4491
  }), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(n(s), {
4446
- mediaStream: Ee(r, {
4492
+ mediaStream: ge(r, {
4447
4493
  directionVideo: o,
4448
4494
  directionAudio: c,
4449
- contentHint: E
4495
+ contentHint: g
4450
4496
  }),
4451
4497
  pcConfig: {
4452
4498
  iceServers: a
4453
4499
  },
4454
4500
  rtcOfferConstraints: {
4455
- offerToReceiveAudio: p,
4501
+ offerToReceiveAudio: C,
4456
4502
  offerToReceiveVideo: I
4457
4503
  },
4458
4504
  // необходимо передавать в методе call, чтобы подписаться на события peerconnection,
@@ -4471,7 +4517,7 @@ class Pa {
4471
4517
  const { rtcSession: e } = this;
4472
4518
  if (e && !e.isEnded())
4473
4519
  return e.terminateAsync({
4474
- cause: Ht.CANCELED
4520
+ cause: Wt.CANCELED
4475
4521
  }).finally(() => {
4476
4522
  this.reset();
4477
4523
  });
@@ -4485,8 +4531,8 @@ class Pa {
4485
4531
  directionAudio: a,
4486
4532
  offerToReceiveAudio: o,
4487
4533
  offerToReceiveVideo: c,
4488
- contentHint: E,
4489
- degradationPreference: p,
4534
+ contentHint: g,
4535
+ degradationPreference: C,
4490
4536
  sendEncodings: I,
4491
4537
  onAddedTransceiver: b
4492
4538
  }) => new Promise((_, W) => {
@@ -4501,15 +4547,15 @@ class Pa {
4501
4547
  offerToReceiveAudio: o,
4502
4548
  offerToReceiveVideo: c
4503
4549
  },
4504
- mediaStream: Ee(n, {
4550
+ mediaStream: ge(n, {
4505
4551
  directionVideo: i,
4506
4552
  directionAudio: a,
4507
- contentHint: E
4553
+ contentHint: g
4508
4554
  }),
4509
4555
  extraHeaders: s,
4510
4556
  directionVideo: i,
4511
4557
  directionAudio: a,
4512
- degradationPreference: p,
4558
+ degradationPreference: C,
4513
4559
  sendEncodings: I,
4514
4560
  onAddedTransceiver: b
4515
4561
  });
@@ -4520,7 +4566,7 @@ class Pa {
4520
4566
  async replaceMediaStream(e, n) {
4521
4567
  if (!this.rtcSession)
4522
4568
  throw new Error("No rtcSession established");
4523
- const { contentHint: s } = n ?? {}, r = Ee(e, { contentHint: s });
4569
+ const { contentHint: s } = n ?? {}, r = ge(e, { contentHint: s });
4524
4570
  if (r === void 0)
4525
4571
  throw new Error("No preparedMediaStream");
4526
4572
  return this.rtcSession.replaceMediaStream(r, n);
@@ -4536,7 +4582,7 @@ class Pa {
4536
4582
  */
4537
4583
  setMinBitrateForSenders(e = "all") {
4538
4584
  this.bitrateStateManager.setMinBitrateForSenders(this.connection, e).catch((n) => {
4539
- Xe("setMinBitrateForSenders", n);
4585
+ Ze("setMinBitrateForSenders", n);
4540
4586
  });
4541
4587
  }
4542
4588
  /**
@@ -4545,14 +4591,14 @@ class Pa {
4545
4591
  */
4546
4592
  restoreBitrateForSenders(e = "all") {
4547
4593
  this.bitrateStateManager.restoreBitrateForSenders(this.connection, e).catch((n) => {
4548
- Xe("restoreBitrateForSenders", n);
4594
+ Ze("restoreBitrateForSenders", n);
4549
4595
  });
4550
4596
  }
4551
4597
  handleCall = async () => new Promise((e, n) => {
4552
4598
  const s = () => {
4553
- this.events.on("peerconnection", E), this.events.on("confirmed", p);
4599
+ this.events.on("peerconnection", g), this.events.on("confirmed", C);
4554
4600
  }, r = () => {
4555
- this.events.off("peerconnection", E), this.events.off("confirmed", p);
4601
+ this.events.off("peerconnection", g), this.events.off("confirmed", C);
4556
4602
  }, i = () => {
4557
4603
  this.events.on("failed", o), this.events.on("ended", o);
4558
4604
  }, a = () => {
@@ -4561,7 +4607,7 @@ class Pa {
4561
4607
  r(), a(), n(I);
4562
4608
  };
4563
4609
  let c;
4564
- const E = ({ peerconnection: I }) => {
4610
+ const g = ({ peerconnection: I }) => {
4565
4611
  c = I;
4566
4612
  const b = (_) => {
4567
4613
  this.events.trigger("peerconnection:ontrack", _);
@@ -4569,14 +4615,14 @@ class Pa {
4569
4615
  I.addEventListener("track", b), this.disposers.add(() => {
4570
4616
  I.removeEventListener("track", b);
4571
4617
  });
4572
- }, p = () => {
4618
+ }, C = () => {
4573
4619
  c !== void 0 && this.events.trigger("peerconnection:confirmed", c), r(), a(), e(c);
4574
4620
  };
4575
4621
  s(), i();
4576
4622
  });
4577
4623
  subscribeToSessionEvents(e) {
4578
4624
  this.events.eachTriggers((n, s) => {
4579
- const r = _t.find((i) => i === s);
4625
+ const r = Ot.find((i) => i === s);
4580
4626
  r && (e.on(r, n), this.disposers.add(() => {
4581
4627
  e.off(r, n);
4582
4628
  }));
@@ -4595,8 +4641,8 @@ class Pa {
4595
4641
  delete this.rtcSession, delete this.pcConfig, this.unsubscribeFromSessionEvents(), this.bitrateStateManager.clearAll(), this.onReset();
4596
4642
  };
4597
4643
  }
4598
- const De = (t) => t === "auto" ? "high" : t, ya = 10, Da = 500, La = 5e3;
4599
- class wa {
4644
+ const Le = (t) => t === "auto" ? "high" : t, Da = 10, La = 500, wa = 5e3;
4645
+ class Ga {
4600
4646
  /**
4601
4647
  * Текущая операция отправки offer с повторными попытками при ошибках.
4602
4648
  * Может быть отменена при новом renegotiate для предотвращения конфликтов.
@@ -4617,7 +4663,7 @@ class wa {
4617
4663
  this.config = {
4618
4664
  ...e,
4619
4665
  quality: s,
4620
- effectiveQuality: De(s)
4666
+ effectiveQuality: Le(s)
4621
4667
  }, this.tools = n, this.connection = new RTCPeerConnection(e.pcConfig), this.addTransceivers();
4622
4668
  }
4623
4669
  get settings() {
@@ -4646,7 +4692,7 @@ class wa {
4646
4692
  async setQuality(e) {
4647
4693
  if (!this.lastCallParams)
4648
4694
  return !1;
4649
- const n = this.config.effectiveQuality, s = this.config.quality, r = De(e);
4695
+ const n = this.config.effectiveQuality, s = this.config.quality, r = Le(e);
4650
4696
  return e === s && r === n ? !1 : (this.config.quality = e, this.config.effectiveQuality = r, r !== n && await this.renegotiate(this.lastCallParams), !0);
4651
4697
  }
4652
4698
  async applyQuality(e) {
@@ -4722,11 +4768,11 @@ class wa {
4722
4768
  },
4723
4769
  s
4724
4770
  ), i = (o) => !(o instanceof Error);
4725
- this.cancelableSendOfferWithRepeatedCalls = we({
4771
+ this.cancelableSendOfferWithRepeatedCalls = Ge({
4726
4772
  targetFunction: r,
4727
4773
  isComplete: i,
4728
- callLimit: ya,
4729
- delay: Da,
4774
+ callLimit: Da,
4775
+ delay: La,
4730
4776
  isRejectAsValid: !0,
4731
4777
  isCheckBeforeCall: !1
4732
4778
  });
@@ -4804,23 +4850,23 @@ class wa {
4804
4850
  return new Promise((s, r) => {
4805
4851
  let i, a = !1;
4806
4852
  const o = () => {
4807
- a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange", E), this.connection.removeEventListener("connectionstatechange", E), s());
4808
- }, c = (p) => {
4809
- a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange", E), this.connection.removeEventListener("connectionstatechange", E), r(p));
4853
+ a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange", g), this.connection.removeEventListener("connectionstatechange", g), s());
4854
+ }, c = (C) => {
4855
+ a || (a = !0, clearTimeout(i), this.connection.removeEventListener("signalingstatechange", g), this.connection.removeEventListener("connectionstatechange", g), r(C));
4810
4856
  };
4811
- function E() {
4812
- const p = n();
4813
- if (p === "error") {
4857
+ function g() {
4858
+ const C = n();
4859
+ if (C === "error") {
4814
4860
  c(e());
4815
4861
  return;
4816
4862
  }
4817
- p === "success" && o();
4863
+ C === "success" && o();
4818
4864
  }
4819
4865
  i = setTimeout(() => {
4820
4866
  c(
4821
4867
  new Error("Timed out waiting for stable signaling state and ready connection state")
4822
4868
  );
4823
- }, La), this.connection.addEventListener("signalingstatechange", E), this.connection.addEventListener("connectionstatechange", E), E();
4869
+ }, wa), this.connection.addEventListener("signalingstatechange", g), this.connection.addEventListener("connectionstatechange", g), g();
4824
4870
  });
4825
4871
  }
4826
4872
  async waitForTracks() {
@@ -4853,18 +4899,18 @@ class wa {
4853
4899
  this.cancelableSendOfferWithRepeatedCalls?.cancel();
4854
4900
  }
4855
4901
  }
4856
- const Wt = (t) => t.getSettings(), Ga = (t, e) => {
4857
- const n = Wt(t);
4902
+ const Qt = (t) => t.getSettings(), ka = (t, e) => {
4903
+ const n = Qt(t);
4858
4904
  let s = e;
4859
4905
  s ??= t.label;
4860
4906
  let r = n?.msid;
4861
4907
  return r ??= s, r ??= t.id, r;
4862
- }, ka = (t, e) => {
4863
- const n = Wt(t);
4908
+ }, Ua = (t, e) => {
4909
+ const n = Qt(t);
4864
4910
  let s = e;
4865
4911
  return s ??= n?.msid, s ??= t.label, (s && s.length > 0 ? s : void 0) ?? t.id;
4866
4912
  };
4867
- class Ze {
4913
+ class et {
4868
4914
  participantGroups = /* @__PURE__ */ new Map();
4869
4915
  trackToGroup = /* @__PURE__ */ new Map();
4870
4916
  trackDisposers = /* @__PURE__ */ new Map();
@@ -4881,18 +4927,18 @@ class Ze {
4881
4927
  onRemoved: n,
4882
4928
  streamHint: s
4883
4929
  } = {}) {
4884
- const r = ka(e, s), i = Ga(e, s);
4930
+ const r = Ua(e, s), i = ka(e, s);
4885
4931
  if (this.trackToGroup.has(e.id))
4886
4932
  return { isAddedTrack: !1, isAddedStream: !1 };
4887
4933
  const a = this.getParticipantGroups(r), o = a.get(i), c = !o;
4888
- let E = o;
4889
- E || (E = {
4934
+ let g = o;
4935
+ g || (g = {
4890
4936
  participantId: r,
4891
4937
  groupId: i,
4892
4938
  stream: new MediaStream(),
4893
4939
  trackIds: /* @__PURE__ */ new Set()
4894
- }, a.set(i, E)), E.stream.addTrack(e), E.trackIds.add(e.id), this.trackToGroup.set(e.id, { participantId: r, groupId: i });
4895
- const p = () => {
4940
+ }, a.set(i, g)), g.stream.addTrack(e), g.trackIds.add(e.id), this.trackToGroup.set(e.id, { participantId: r, groupId: i });
4941
+ const C = () => {
4896
4942
  this.disposeTrackListener(e.id);
4897
4943
  const I = this.removeTrack(e.id);
4898
4944
  I.isRemovedTrack && n?.({
@@ -4901,8 +4947,8 @@ class Ze {
4901
4947
  isRemovedStream: I.isRemovedStream
4902
4948
  });
4903
4949
  };
4904
- return e.addEventListener("ended", p), this.trackDisposers.set(e.id, () => {
4905
- e.removeEventListener("ended", p);
4950
+ return e.addEventListener("ended", C), this.trackDisposers.set(e.id, () => {
4951
+ e.removeEventListener("ended", C);
4906
4952
  }), { isAddedTrack: !0, isAddedStream: c, participantId: r };
4907
4953
  }
4908
4954
  removeTrack(e) {
@@ -4913,7 +4959,7 @@ class Ze {
4913
4959
  const { participantId: s, groupId: r } = n, i = this.participantGroups.get(s), a = i?.get(r);
4914
4960
  if (!a)
4915
4961
  return this.trackToGroup.delete(e), { isRemovedTrack: !1, isRemovedStream: !1 };
4916
- const o = a.stream.getTracks().find((E) => E.id === e);
4962
+ const o = a.stream.getTracks().find((g) => g.id === e);
4917
4963
  o && a.stream.removeTrack(o), a.trackIds.delete(e), this.trackToGroup.delete(e);
4918
4964
  const c = a.trackIds.size === 0;
4919
4965
  return c && (i?.delete(r), i?.size === 0 && this.participantGroups.delete(s)), { isRemovedTrack: !0, isRemovedStream: c };
@@ -4925,8 +4971,8 @@ class Ze {
4925
4971
  let r = !1;
4926
4972
  return [...s.values()].forEach((a) => {
4927
4973
  [...a.trackIds].filter((c) => !n.includes(c)).forEach((c) => {
4928
- const E = this.removeTrack(c);
4929
- r ||= E.isRemovedTrack;
4974
+ const g = this.removeTrack(c);
4975
+ r ||= g.isRemovedTrack;
4930
4976
  });
4931
4977
  }), r;
4932
4978
  }
@@ -4949,13 +4995,13 @@ class Ze {
4949
4995
  return this.participantGroups.set(e, s), s;
4950
4996
  }
4951
4997
  }
4952
- const Ua = (t, e) => {
4998
+ const Fa = (t, e) => {
4953
4999
  if (!t || !e)
4954
5000
  return t === e;
4955
5001
  const n = t.mainStream?.id, s = e.mainStream?.id, r = t.contentedStream?.id, i = e.contentedStream?.id;
4956
5002
  return n === s && r === i;
4957
5003
  };
4958
- class Fa {
5004
+ class Ba {
4959
5005
  lastEmittedStreams;
4960
5006
  /**
4961
5007
  * Проверяет, изменились ли streams с последнего сохраненного состояния
@@ -4963,7 +5009,7 @@ class Fa {
4963
5009
  * @returns true, если streams изменились
4964
5010
  */
4965
5011
  hasChanged(e) {
4966
- return !Ua(this.lastEmittedStreams, e);
5012
+ return !Fa(this.lastEmittedStreams, e);
4967
5013
  }
4968
5014
  /**
4969
5015
  * Сохраняет текущие streams как последнее эмитнутое состояние
@@ -4986,8 +5032,8 @@ class Fa {
4986
5032
  this.lastEmittedStreams = void 0;
4987
5033
  }
4988
5034
  }
4989
- const Ba = "default", $a = "dual", xa = "content_", Va = (t) => `${xa}${t.toLowerCase()}`, qa = (t) => [...t.getTracks()].some((e) => e.label.includes($a));
4990
- class Ha {
5035
+ const $a = "default", xa = "dual", Va = "content_", qa = (t) => `${Va}${t.toLowerCase()}`, Ha = (t) => [...t.getTracks()].some((e) => e.label.includes(xa));
5036
+ class Wa {
4991
5037
  mainRemoteStreamsManager;
4992
5038
  recvRemoteStreamsManager;
4993
5039
  constructor(e, n) {
@@ -5004,7 +5050,7 @@ class Ha {
5004
5050
  }) {
5005
5051
  const n = this.mainRemoteStreamsManager;
5006
5052
  return { manager: n, getRemoteStreams: () => {
5007
- const r = n.getStreams(), i = r.find((o) => !qa(o)), a = e.isAvailable ? r.find((o) => o !== i) : void 0;
5053
+ const r = n.getStreams(), i = r.find((o) => !Ha(o)), a = e.isAvailable ? r.find((o) => o !== i) : void 0;
5008
5054
  return { mainStream: i, contentedStream: a };
5009
5055
  } };
5010
5056
  }
@@ -5013,7 +5059,7 @@ class Ha {
5013
5059
  }) {
5014
5060
  const n = this.recvRemoteStreamsManager;
5015
5061
  return { manager: n, getRemoteStreams: () => {
5016
- const i = n.getStreams(Ba)[0], a = this.getRecvRemoteContentedStream({ stateInfo: e });
5062
+ const i = n.getStreams($a)[0], a = this.getRecvRemoteContentedStream({ stateInfo: e });
5017
5063
  return { mainStream: i, contentedStream: a };
5018
5064
  } };
5019
5065
  }
@@ -5022,21 +5068,21 @@ class Ha {
5022
5068
  }) {
5023
5069
  if (!e.isAvailable || e.codec === void 0)
5024
5070
  return;
5025
- const n = Va(e.codec);
5071
+ const n = qa(e.codec);
5026
5072
  return this.recvRemoteStreamsManager.getStreams(n)[0];
5027
5073
  }
5028
5074
  }
5029
- const Wa = "udp", Qa = (t) => t.transport?.iceTransport ? t.transport.iceTransport.getLocalCandidates() : [], Ya = (t) => t.getReceivers().flatMap(Qa), ja = (t) => {
5030
- const s = Ya(t).filter(({ protocol: r, port: i }) => i !== null && Wa === r).map(({ port: r }) => r);
5075
+ const Qa = "udp", Ya = (t) => t.transport?.iceTransport ? t.transport.iceTransport.getLocalCandidates() : [], ja = (t) => t.getReceivers().flatMap(Ya), za = (t) => {
5076
+ const s = ja(t).filter(({ protocol: r, port: i }) => i !== null && Qa === r).map(({ port: r }) => r);
5031
5077
  return [...new Set(s)];
5032
- }, et = (t) => t.streams[0]?.id;
5033
- class za extends w {
5078
+ }, tt = (t) => t.streams[0]?.id;
5079
+ class Ja extends w {
5034
5080
  stateMachine;
5035
5081
  sessionState;
5036
5082
  isPendingCall = !1;
5037
5083
  isPendingAnswer = !1;
5038
- mainRemoteStreamsManager = new Ze();
5039
- recvRemoteStreamsManager = new Ze();
5084
+ mainRemoteStreamsManager = new et();
5085
+ recvRemoteStreamsManager = new et();
5040
5086
  streamsManagerProvider;
5041
5087
  contentedStreamManager;
5042
5088
  tools;
@@ -5051,12 +5097,12 @@ class za extends w {
5051
5097
  disposeRecvSessionTrackListener;
5052
5098
  disposeInRoomCredentialsListener;
5053
5099
  deferredStartRecvSessionRunner;
5054
- streamsChangeTracker = new Fa();
5100
+ streamsChangeTracker = new Ba();
5055
5101
  constructor({ contentedStreamManager: e }, n, { callSessionState: s }) {
5056
- super(ai()), this.contentedStreamManager = e, this.tools = n, this.mcuSession = new Pa(this.events, { onReset: this.reset }), this.stateMachine = aa(this.events), this.sessionState = s, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new Ha(
5102
+ super(oi()), this.contentedStreamManager = e, this.tools = n, this.mcuSession = new ya(this.events, { onReset: this.reset }), this.stateMachine = oa(this.events), this.sessionState = s, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new Wa(
5057
5103
  this.mainRemoteStreamsManager,
5058
5104
  this.recvRemoteStreamsManager
5059
- ), this.deferredStartRecvSessionRunner = new zi({
5105
+ ), this.deferredStartRecvSessionRunner = new Ji({
5060
5106
  subscribe: (r) => this.stateMachine.onStateChange(r),
5061
5107
  isReady: (r) => r === u.IN_ROOM,
5062
5108
  isCancelled: (r) => r === u.IDLE,
@@ -5092,7 +5138,7 @@ class za extends w {
5092
5138
  }
5093
5139
  get localPorts() {
5094
5140
  const e = this.getActivePeerConnection();
5095
- return e ? ja(e) : [];
5141
+ return e ? za(e) : [];
5096
5142
  }
5097
5143
  // For testing purposes
5098
5144
  getStreamsManagerProvider() {
@@ -5174,7 +5220,7 @@ class za extends w {
5174
5220
  const { recvSession: n } = this;
5175
5221
  if (!this.hasSpectator() || !n)
5176
5222
  return !1;
5177
- const s = n.getQuality(), r = n.getEffectiveQuality(), i = n.getAudioChannel(), a = De(e);
5223
+ const s = n.getQuality(), r = n.getEffectiveQuality(), i = n.getAudioChannel(), a = Le(e);
5178
5224
  if (e === s && a === r)
5179
5225
  return !1;
5180
5226
  if (a === r)
@@ -5188,11 +5234,11 @@ class za extends w {
5188
5234
  { silent: !0 }
5189
5235
  );
5190
5236
  if (c) {
5191
- const E = o.getEffectiveQuality();
5237
+ const g = o.getEffectiveQuality();
5192
5238
  this.events.trigger("recv-quality-changed", {
5193
5239
  previousQuality: s,
5194
5240
  quality: e,
5195
- effectiveQuality: E
5241
+ effectiveQuality: g
5196
5242
  });
5197
5243
  }
5198
5244
  return c;
@@ -5231,7 +5277,7 @@ class za extends w {
5231
5277
  }
5232
5278
  subscribeMcuRemoteTrackEvents() {
5233
5279
  this.on("peerconnection:ontrack", (e) => {
5234
- this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, et(e));
5280
+ this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, tt(e));
5235
5281
  });
5236
5282
  }
5237
5283
  addRemoteTrack(e, n, s) {
@@ -5287,7 +5333,7 @@ class za extends w {
5287
5333
  }
5288
5334
  attachRecvSessionTracks(e) {
5289
5335
  const { peerConnection: n } = e, s = (r) => {
5290
- this.addRemoteTrack(this.recvRemoteStreamsManager, r.track, et(r));
5336
+ this.addRemoteTrack(this.recvRemoteStreamsManager, r.track, tt(r));
5291
5337
  };
5292
5338
  n.addEventListener("track", s), this.disposeRecvSessionTrackListener = () => {
5293
5339
  n.removeEventListener("track", s);
@@ -5311,7 +5357,7 @@ class za extends w {
5311
5357
  audioChannel: e,
5312
5358
  quality: n,
5313
5359
  pcConfig: this.mcuSession.getPcConfig()
5314
- }, a = new wa(i, { sendOffer: this.tools.sendOffer });
5360
+ }, a = new Ga(i, { sendOffer: this.tools.sendOffer });
5315
5361
  return this.recvSession = a, this.recvRemoteStreamsManager.reset(), this.attachRecvSessionTracks(a), a.call({
5316
5362
  conferenceNumber: r.conferenceForToken,
5317
5363
  token: r.token
@@ -5322,10 +5368,10 @@ class za extends w {
5322
5368
  }
5323
5369
  )), { session: a, callResult: c })).catch(async (c) => {
5324
5370
  this.stopRecvSession();
5325
- const E = new dt();
5326
- E.body = c instanceof Error ? c.message : String(c);
5327
- const p = lt.causes.INTERNAL_ERROR;
5328
- throw await this.failed(E, p), c;
5371
+ const g = new lt();
5372
+ g.body = c instanceof Error ? c.message : String(c);
5373
+ const C = ht.causes.INTERNAL_ERROR;
5374
+ throw await this.failed(g, C), c;
5329
5375
  });
5330
5376
  }
5331
5377
  stopRecvSession({ silent: e } = {}) {
@@ -5336,14 +5382,14 @@ class za extends w {
5336
5382
  previous: e,
5337
5383
  next: n
5338
5384
  }) => {
5339
- if (ui(e, n) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), Ei(e, n)) {
5385
+ if (gi(e, n) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), Ei(e, n)) {
5340
5386
  const s = n.recvParams;
5341
5387
  this.stateMachine.getInRoomCredentials() === void 0 ? this.deferredStartRecvSessionRunner.set({
5342
5388
  audioId: s.audioId
5343
5389
  }) : this.startRecvSession({ audioChannel: s.audioId }).catch(() => {
5344
5390
  });
5345
5391
  }
5346
- gi(e, n) && this.mcuSession.restoreBitrateForSenders(), Ti(e, n) && this.mcuSession.setMinBitrateForSenders();
5392
+ Ti(e, n) && this.mcuSession.restoreBitrateForSenders(), mi(e, n) && this.mcuSession.setMinBitrateForSenders();
5347
5393
  };
5348
5394
  subscribeContentedStreamEvents() {
5349
5395
  this.contentedStreamManager.on("available", this.emitEventChangedRemoteStreamsConnected), this.contentedStreamManager.on("not-available", this.emitEventChangedRemoteStreamsConnected);
@@ -5359,39 +5405,39 @@ class za extends w {
5359
5405
  return this.mcuSession.renegotiate();
5360
5406
  }
5361
5407
  }
5362
- const Qt = [
5408
+ const Yt = [
5363
5409
  "presentation:start",
5364
5410
  "presentation:started",
5365
5411
  "presentation:end",
5366
5412
  "presentation:ended",
5367
5413
  "presentation:failed"
5368
- ], Ja = () => new G(Qt);
5414
+ ], Ka = () => new G(Yt);
5369
5415
  var h = /* @__PURE__ */ ((t) => (t.IDLE = "presentation:idle", t.STARTING = "presentation:starting", t.ACTIVE = "presentation:active", t.STOPPING = "presentation:stopping", t.FAILED = "presentation:failed", t))(h || {}), S = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.SET_ERROR = "setError", t.CLEAR_ERROR = "clearError", t))(S || {}), m = /* @__PURE__ */ ((t) => (t.SCREEN_STARTING = "SCREEN.STARTING", t.SCREEN_STARTED = "SCREEN.STARTED", t.SCREEN_ENDING = "SCREEN.ENDING", t.SCREEN_ENDED = "SCREEN.ENDED", t.SCREEN_FAILED = "SCREEN.FAILED", t.CALL_ENDED = "CALL.ENDED", t.CALL_FAILED = "CALL.FAILED", t.PRESENTATION_RESET = "PRESENTATION.RESET", t))(m || {});
5370
- const Yt = {
5416
+ const jt = {
5371
5417
  lastError: void 0
5372
- }, tt = A("PresentationStateMachine"), Ka = (t) => t instanceof Error ? t : new Error(JSON.stringify(t)), Xa = () => Z({
5418
+ }, nt = A("PresentationStateMachine"), Xa = (t) => t instanceof Error ? t : new Error(JSON.stringify(t)), Za = () => Z({
5373
5419
  types: {
5374
- context: Yt,
5420
+ context: jt,
5375
5421
  events: {}
5376
5422
  },
5377
5423
  actions: {
5378
5424
  [S.LOG_TRANSITION]: (t, e) => {
5379
- tt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
5425
+ nt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
5380
5426
  },
5381
5427
  [S.LOG_STATE_CHANGE]: (t, e) => {
5382
- tt("PresentationStateMachine state changed", e.state);
5428
+ nt("PresentationStateMachine state changed", e.state);
5383
5429
  },
5384
5430
  [S.SET_ERROR]: f(({ event: t }) => "error" in t && t.error !== void 0 ? {
5385
- lastError: Ka(t.error)
5431
+ lastError: Xa(t.error)
5386
5432
  } : { lastError: void 0 }),
5387
5433
  [S.CLEAR_ERROR]: f(() => ({
5388
5434
  lastError: void 0
5389
5435
  }))
5390
5436
  }
5391
- }), Za = () => Xa().createMachine({
5437
+ }), eo = () => Za().createMachine({
5392
5438
  id: "presentation",
5393
5439
  initial: h.IDLE,
5394
- context: Yt,
5440
+ context: jt,
5395
5441
  states: {
5396
5442
  [h.IDLE]: {
5397
5443
  entry: {
@@ -5680,10 +5726,10 @@ const Yt = {
5680
5726
  }
5681
5727
  }
5682
5728
  }
5683
- }), eo = Za(), to = A("PresentationStateMachine");
5684
- class no extends ee {
5729
+ }), to = eo(), no = A("PresentationStateMachine");
5730
+ class so extends ee {
5685
5731
  constructor(e) {
5686
- super(eo), this.subscribeCallEvents(e);
5732
+ super(to), this.subscribeCallEvents(e);
5687
5733
  }
5688
5734
  get isIdle() {
5689
5735
  return this.hasState(h.IDLE);
@@ -5720,7 +5766,7 @@ class no extends ee {
5720
5766
  }
5721
5767
  sendEvent(e) {
5722
5768
  if (!this.actor.getSnapshot().can(e)) {
5723
- to(
5769
+ no(
5724
5770
  `[PresentationStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
5725
5771
  );
5726
5772
  return;
@@ -5759,14 +5805,14 @@ class no extends ee {
5759
5805
  );
5760
5806
  }
5761
5807
  }
5762
- const so = 1, ro = [
5808
+ const ro = 1, io = [
5763
5809
  "presentation:start",
5764
5810
  "presentation:started",
5765
5811
  "presentation:end",
5766
5812
  "presentation:ended",
5767
5813
  "presentation:failed"
5768
- ], io = (t) => t instanceof Error ? t : new Error(String(t)), kc = (t) => Nn(t);
5769
- class ao extends w {
5814
+ ], ao = (t) => t instanceof Error ? t : new Error(String(t)), Uc = (t) => In(t);
5815
+ class oo extends w {
5770
5816
  stateMachine;
5771
5817
  promisePendingStartPresentation;
5772
5818
  promisePendingStopPresentation;
@@ -5778,7 +5824,7 @@ class ao extends w {
5778
5824
  callManager: e,
5779
5825
  maxBitrate: n
5780
5826
  }) {
5781
- super(Ja()), this.callManager = e, this.maxBitrate = n, this.stateMachine = new no(this.callManager.events), this.subscribe();
5827
+ super(Ka()), this.callManager = e, this.maxBitrate = n, this.stateMachine = new so(this.callManager.events), this.subscribe();
5782
5828
  }
5783
5829
  get isPendingPresentation() {
5784
5830
  return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
@@ -5831,7 +5877,7 @@ class ao extends w {
5831
5877
  this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
5832
5878
  }
5833
5879
  subscribe() {
5834
- ro.forEach((e) => {
5880
+ io.forEach((e) => {
5835
5881
  this.callManager.on(e, (n) => {
5836
5882
  this.events.trigger(e, n);
5837
5883
  });
@@ -5842,7 +5888,7 @@ class ao extends w {
5842
5888
  stream: s,
5843
5889
  presentationOptions: r,
5844
5890
  options: i = {
5845
- callLimit: so
5891
+ callLimit: ro
5846
5892
  }
5847
5893
  }) {
5848
5894
  const a = async () => this.sendPresentation(
@@ -5851,7 +5897,7 @@ class ao extends w {
5851
5897
  s,
5852
5898
  r
5853
5899
  ), o = () => !!this.streamPresentationCurrent;
5854
- return this.cancelableSendPresentationWithRepeatedCalls = we({
5900
+ return this.cancelableSendPresentationWithRepeatedCalls = Ge({
5855
5901
  targetFunction: a,
5856
5902
  isComplete: o,
5857
5903
  isRejectAsValid: !0,
@@ -5866,18 +5912,18 @@ class ao extends w {
5866
5912
  sendEncodings: o,
5867
5913
  onAddedTransceiver: c
5868
5914
  }) {
5869
- const E = Ee(s, { contentHint: i });
5870
- if (E === void 0)
5915
+ const g = ge(s, { contentHint: i });
5916
+ if (g === void 0)
5871
5917
  throw new Error("No streamPresentationTarget");
5872
- this.streamPresentationCurrent = E;
5873
- const p = e().then(async () => n.startPresentation(E, r, {
5918
+ this.streamPresentationCurrent = g;
5919
+ const C = e().then(async () => n.startPresentation(g, r, {
5874
5920
  degradationPreference: a,
5875
5921
  sendEncodings: o,
5876
5922
  onAddedTransceiver: c
5877
5923
  })).then(this.setMaxBitrate).then(() => s).catch((I) => {
5878
5924
  throw this.removeStreamPresentationCurrent(), this.notifyPresentationFailed(I), I;
5879
5925
  });
5880
- return this.promisePendingStartPresentation = p, p.finally(() => {
5926
+ return this.promisePendingStartPresentation = C, C.finally(() => {
5881
5927
  this.promisePendingStartPresentation = void 0;
5882
5928
  });
5883
5929
  }
@@ -5886,7 +5932,7 @@ class ao extends w {
5886
5932
  if (!e || !n || s === void 0)
5887
5933
  return;
5888
5934
  const r = e.getSenders();
5889
- await Hi(r, n, s);
5935
+ await Wi(r, n, s);
5890
5936
  };
5891
5937
  getRtcSessionProtected = () => {
5892
5938
  const e = this.callManager.getEstablishedRTCSession();
@@ -5907,10 +5953,10 @@ class ao extends w {
5907
5953
  delete this.streamPresentationCurrent;
5908
5954
  }
5909
5955
  notifyPresentationFailed(e) {
5910
- this.events.trigger("presentation:failed", io(e));
5956
+ this.events.trigger("presentation:failed", ao(e));
5911
5957
  }
5912
5958
  }
5913
- const oo = A("ContentedStreamStateMachine"), co = Z({
5959
+ const co = A("ContentedStreamStateMachine"), lo = Z({
5914
5960
  types: {
5915
5961
  context: {},
5916
5962
  events: {}
@@ -5951,9 +5997,9 @@ const oo = A("ContentedStreamStateMachine"), co = Z({
5951
5997
  }
5952
5998
  }
5953
5999
  });
5954
- class lo extends ee {
6000
+ class ho extends ee {
5955
6001
  constructor() {
5956
- super(co);
6002
+ super(lo);
5957
6003
  }
5958
6004
  get isAvailable() {
5959
6005
  return this.state === "contented-stream:available";
@@ -5975,7 +6021,7 @@ class lo extends ee {
5975
6021
  }
5976
6022
  send(e) {
5977
6023
  if (!this.actor.getSnapshot().can(e)) {
5978
- oo(
6024
+ co(
5979
6025
  `[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`
5980
6026
  );
5981
6027
  return;
@@ -5994,15 +6040,15 @@ class lo extends ee {
5994
6040
  );
5995
6041
  }
5996
6042
  }
5997
- const ho = [
6043
+ const uo = [
5998
6044
  "available",
5999
6045
  "not-available"
6000
6046
  /* NOT_AVAILABLE */
6001
- ], uo = () => new G(ho);
6047
+ ], go = () => new G(uo);
6002
6048
  class Eo extends w {
6003
6049
  stateMachine;
6004
6050
  constructor() {
6005
- super(uo()), this.stateMachine = new lo(), this.proxyEvents();
6051
+ super(go()), this.stateMachine = new ho(), this.proxyEvents();
6006
6052
  }
6007
6053
  get isAvailable() {
6008
6054
  return this.stateMachine.isAvailable;
@@ -6026,33 +6072,33 @@ class Eo extends w {
6026
6072
  });
6027
6073
  }
6028
6074
  }
6029
- const jt = [
6075
+ const zt = [
6030
6076
  "ringing",
6031
6077
  "declinedIncomingCall",
6032
6078
  "terminatedIncomingCall",
6033
6079
  "failedIncomingCall"
6034
- ], go = () => new G(jt);
6035
- var l = /* @__PURE__ */ ((t) => (t.IDLE = "incoming:idle", t.RINGING = "incoming:ringing", t.CONSUMED = "incoming:consumed", t.DECLINED = "incoming:declined", t.TERMINATED = "incoming:terminated", t.FAILED = "incoming:failed", t))(l || {}), C = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.REMEMBER_INCOMING = "rememberIncoming", t.REMEMBER_REASON = "rememberReason", t.CLEAR_INCOMING = "clearIncoming", t))(C || {}), R = /* @__PURE__ */ ((t) => (t.RINGING = "INCOMING.RINGING", t.CONSUMED = "INCOMING.CONSUMED", t.DECLINED = "INCOMING.DECLINED", t.TERMINATED = "INCOMING.TERMINATED", t.FAILED = "INCOMING.FAILED", t.CLEAR = "INCOMING.CLEAR", t))(R || {});
6036
- const zt = {
6080
+ ], To = () => new G(zt);
6081
+ var l = /* @__PURE__ */ ((t) => (t.IDLE = "incoming:idle", t.RINGING = "incoming:ringing", t.CONSUMED = "incoming:consumed", t.DECLINED = "incoming:declined", t.TERMINATED = "incoming:terminated", t.FAILED = "incoming:failed", t))(l || {}), p = /* @__PURE__ */ ((t) => (t.LOG_TRANSITION = "logTransition", t.LOG_STATE_CHANGE = "logStateChange", t.REMEMBER_INCOMING = "rememberIncoming", t.REMEMBER_REASON = "rememberReason", t.CLEAR_INCOMING = "clearIncoming", t))(p || {}), R = /* @__PURE__ */ ((t) => (t.RINGING = "INCOMING.RINGING", t.CONSUMED = "INCOMING.CONSUMED", t.DECLINED = "INCOMING.DECLINED", t.TERMINATED = "INCOMING.TERMINATED", t.FAILED = "INCOMING.FAILED", t.CLEAR = "INCOMING.CLEAR", t))(R || {});
6082
+ const Jt = {
6037
6083
  remoteCallerData: void 0,
6038
6084
  lastReason: void 0
6039
- }, nt = A("IncomingCallStateMachine"), To = () => Z({
6085
+ }, st = A("IncomingCallStateMachine"), mo = () => Z({
6040
6086
  types: {
6041
- context: zt,
6087
+ context: Jt,
6042
6088
  events: {}
6043
6089
  },
6044
6090
  actions: {
6045
- [C.LOG_TRANSITION]: (t, e) => {
6046
- nt(`State transition: ${e.from} -> ${e.to} (${e.event})`);
6091
+ [p.LOG_TRANSITION]: (t, e) => {
6092
+ st(`State transition: ${e.from} -> ${e.to} (${e.event})`);
6047
6093
  },
6048
- [C.LOG_STATE_CHANGE]: (t, e) => {
6049
- nt("IncomingCallStateMachine state changed", e.state);
6094
+ [p.LOG_STATE_CHANGE]: (t, e) => {
6095
+ st("IncomingCallStateMachine state changed", e.state);
6050
6096
  },
6051
- [C.REMEMBER_INCOMING]: f(({ event: t }) => ({
6097
+ [p.REMEMBER_INCOMING]: f(({ event: t }) => ({
6052
6098
  remoteCallerData: t.data,
6053
6099
  lastReason: void 0
6054
6100
  })),
6055
- [C.REMEMBER_REASON]: f(({ event: t, context: e }) => t.type === R.CONSUMED ? {
6101
+ [p.REMEMBER_REASON]: f(({ event: t, context: e }) => t.type === R.CONSUMED ? {
6056
6102
  remoteCallerData: e.remoteCallerData,
6057
6103
  lastReason: l.CONSUMED
6058
6104
  } : t.type === R.DECLINED ? {
@@ -6065,28 +6111,28 @@ const zt = {
6065
6111
  remoteCallerData: t.data,
6066
6112
  lastReason: l.FAILED
6067
6113
  }),
6068
- [C.CLEAR_INCOMING]: f(() => ({
6114
+ [p.CLEAR_INCOMING]: f(() => ({
6069
6115
  remoteCallerData: void 0,
6070
6116
  lastReason: void 0
6071
6117
  }))
6072
6118
  }
6073
- }), mo = () => To().createMachine({
6119
+ }), So = () => mo().createMachine({
6074
6120
  id: "incoming",
6075
6121
  initial: l.IDLE,
6076
- context: zt,
6122
+ context: Jt,
6077
6123
  states: {
6078
6124
  [l.IDLE]: {
6079
6125
  entry: {
6080
- type: C.LOG_STATE_CHANGE,
6126
+ type: p.LOG_STATE_CHANGE,
6081
6127
  params: { state: l.IDLE }
6082
6128
  },
6083
6129
  on: {
6084
6130
  [R.RINGING]: {
6085
6131
  target: l.RINGING,
6086
6132
  actions: [
6087
- C.REMEMBER_INCOMING,
6133
+ p.REMEMBER_INCOMING,
6088
6134
  {
6089
- type: C.LOG_TRANSITION,
6135
+ type: p.LOG_TRANSITION,
6090
6136
  params: {
6091
6137
  from: l.IDLE,
6092
6138
  to: l.RINGING,
@@ -6098,9 +6144,9 @@ const zt = {
6098
6144
  [R.CLEAR]: {
6099
6145
  target: l.IDLE,
6100
6146
  actions: [
6101
- C.CLEAR_INCOMING,
6147
+ p.CLEAR_INCOMING,
6102
6148
  {
6103
- type: C.LOG_TRANSITION,
6149
+ type: p.LOG_TRANSITION,
6104
6150
  params: {
6105
6151
  from: l.IDLE,
6106
6152
  to: l.IDLE,
@@ -6113,16 +6159,16 @@ const zt = {
6113
6159
  },
6114
6160
  [l.RINGING]: {
6115
6161
  entry: {
6116
- type: C.LOG_STATE_CHANGE,
6162
+ type: p.LOG_STATE_CHANGE,
6117
6163
  params: { state: l.RINGING }
6118
6164
  },
6119
6165
  on: {
6120
6166
  [R.RINGING]: {
6121
6167
  target: l.RINGING,
6122
6168
  actions: [
6123
- C.REMEMBER_INCOMING,
6169
+ p.REMEMBER_INCOMING,
6124
6170
  {
6125
- type: C.LOG_TRANSITION,
6171
+ type: p.LOG_TRANSITION,
6126
6172
  params: {
6127
6173
  from: l.RINGING,
6128
6174
  to: l.RINGING,
@@ -6134,9 +6180,9 @@ const zt = {
6134
6180
  [R.CONSUMED]: {
6135
6181
  target: l.CONSUMED,
6136
6182
  actions: [
6137
- C.REMEMBER_REASON,
6183
+ p.REMEMBER_REASON,
6138
6184
  {
6139
- type: C.LOG_TRANSITION,
6185
+ type: p.LOG_TRANSITION,
6140
6186
  params: {
6141
6187
  from: l.RINGING,
6142
6188
  to: l.CONSUMED,
@@ -6148,9 +6194,9 @@ const zt = {
6148
6194
  [R.DECLINED]: {
6149
6195
  target: l.DECLINED,
6150
6196
  actions: [
6151
- C.REMEMBER_REASON,
6197
+ p.REMEMBER_REASON,
6152
6198
  {
6153
- type: C.LOG_TRANSITION,
6199
+ type: p.LOG_TRANSITION,
6154
6200
  params: {
6155
6201
  from: l.RINGING,
6156
6202
  to: l.DECLINED,
@@ -6162,9 +6208,9 @@ const zt = {
6162
6208
  [R.TERMINATED]: {
6163
6209
  target: l.TERMINATED,
6164
6210
  actions: [
6165
- C.REMEMBER_REASON,
6211
+ p.REMEMBER_REASON,
6166
6212
  {
6167
- type: C.LOG_TRANSITION,
6213
+ type: p.LOG_TRANSITION,
6168
6214
  params: {
6169
6215
  from: l.RINGING,
6170
6216
  to: l.TERMINATED,
@@ -6176,9 +6222,9 @@ const zt = {
6176
6222
  [R.FAILED]: {
6177
6223
  target: l.FAILED,
6178
6224
  actions: [
6179
- C.REMEMBER_REASON,
6225
+ p.REMEMBER_REASON,
6180
6226
  {
6181
- type: C.LOG_TRANSITION,
6227
+ type: p.LOG_TRANSITION,
6182
6228
  params: {
6183
6229
  from: l.RINGING,
6184
6230
  to: l.FAILED,
@@ -6190,9 +6236,9 @@ const zt = {
6190
6236
  [R.CLEAR]: {
6191
6237
  target: l.IDLE,
6192
6238
  actions: [
6193
- C.CLEAR_INCOMING,
6239
+ p.CLEAR_INCOMING,
6194
6240
  {
6195
- type: C.LOG_TRANSITION,
6241
+ type: p.LOG_TRANSITION,
6196
6242
  params: {
6197
6243
  from: l.RINGING,
6198
6244
  to: l.IDLE,
@@ -6205,16 +6251,16 @@ const zt = {
6205
6251
  },
6206
6252
  [l.CONSUMED]: {
6207
6253
  entry: {
6208
- type: C.LOG_STATE_CHANGE,
6254
+ type: p.LOG_STATE_CHANGE,
6209
6255
  params: { state: l.CONSUMED }
6210
6256
  },
6211
6257
  on: {
6212
6258
  [R.CLEAR]: {
6213
6259
  target: l.IDLE,
6214
6260
  actions: [
6215
- C.CLEAR_INCOMING,
6261
+ p.CLEAR_INCOMING,
6216
6262
  {
6217
- type: C.LOG_TRANSITION,
6263
+ type: p.LOG_TRANSITION,
6218
6264
  params: {
6219
6265
  from: l.CONSUMED,
6220
6266
  to: l.IDLE,
@@ -6226,9 +6272,9 @@ const zt = {
6226
6272
  [R.RINGING]: {
6227
6273
  target: l.RINGING,
6228
6274
  actions: [
6229
- C.REMEMBER_INCOMING,
6275
+ p.REMEMBER_INCOMING,
6230
6276
  {
6231
- type: C.LOG_TRANSITION,
6277
+ type: p.LOG_TRANSITION,
6232
6278
  params: {
6233
6279
  from: l.CONSUMED,
6234
6280
  to: l.RINGING,
@@ -6241,16 +6287,16 @@ const zt = {
6241
6287
  },
6242
6288
  [l.DECLINED]: {
6243
6289
  entry: {
6244
- type: C.LOG_STATE_CHANGE,
6290
+ type: p.LOG_STATE_CHANGE,
6245
6291
  params: { state: l.DECLINED }
6246
6292
  },
6247
6293
  on: {
6248
6294
  [R.CLEAR]: {
6249
6295
  target: l.IDLE,
6250
6296
  actions: [
6251
- C.CLEAR_INCOMING,
6297
+ p.CLEAR_INCOMING,
6252
6298
  {
6253
- type: C.LOG_TRANSITION,
6299
+ type: p.LOG_TRANSITION,
6254
6300
  params: {
6255
6301
  from: l.DECLINED,
6256
6302
  to: l.IDLE,
@@ -6262,9 +6308,9 @@ const zt = {
6262
6308
  [R.RINGING]: {
6263
6309
  target: l.RINGING,
6264
6310
  actions: [
6265
- C.REMEMBER_INCOMING,
6311
+ p.REMEMBER_INCOMING,
6266
6312
  {
6267
- type: C.LOG_TRANSITION,
6313
+ type: p.LOG_TRANSITION,
6268
6314
  params: {
6269
6315
  from: l.DECLINED,
6270
6316
  to: l.RINGING,
@@ -6277,16 +6323,16 @@ const zt = {
6277
6323
  },
6278
6324
  [l.TERMINATED]: {
6279
6325
  entry: {
6280
- type: C.LOG_STATE_CHANGE,
6326
+ type: p.LOG_STATE_CHANGE,
6281
6327
  params: { state: l.TERMINATED }
6282
6328
  },
6283
6329
  on: {
6284
6330
  [R.CLEAR]: {
6285
6331
  target: l.IDLE,
6286
6332
  actions: [
6287
- C.CLEAR_INCOMING,
6333
+ p.CLEAR_INCOMING,
6288
6334
  {
6289
- type: C.LOG_TRANSITION,
6335
+ type: p.LOG_TRANSITION,
6290
6336
  params: {
6291
6337
  from: l.TERMINATED,
6292
6338
  to: l.IDLE,
@@ -6298,9 +6344,9 @@ const zt = {
6298
6344
  [R.RINGING]: {
6299
6345
  target: l.RINGING,
6300
6346
  actions: [
6301
- C.REMEMBER_INCOMING,
6347
+ p.REMEMBER_INCOMING,
6302
6348
  {
6303
- type: C.LOG_TRANSITION,
6349
+ type: p.LOG_TRANSITION,
6304
6350
  params: {
6305
6351
  from: l.TERMINATED,
6306
6352
  to: l.RINGING,
@@ -6313,16 +6359,16 @@ const zt = {
6313
6359
  },
6314
6360
  [l.FAILED]: {
6315
6361
  entry: {
6316
- type: C.LOG_STATE_CHANGE,
6362
+ type: p.LOG_STATE_CHANGE,
6317
6363
  params: { state: l.FAILED }
6318
6364
  },
6319
6365
  on: {
6320
6366
  [R.CLEAR]: {
6321
6367
  target: l.IDLE,
6322
6368
  actions: [
6323
- C.CLEAR_INCOMING,
6369
+ p.CLEAR_INCOMING,
6324
6370
  {
6325
- type: C.LOG_TRANSITION,
6371
+ type: p.LOG_TRANSITION,
6326
6372
  params: {
6327
6373
  from: l.FAILED,
6328
6374
  to: l.IDLE,
@@ -6334,9 +6380,9 @@ const zt = {
6334
6380
  [R.RINGING]: {
6335
6381
  target: l.RINGING,
6336
6382
  actions: [
6337
- C.REMEMBER_INCOMING,
6383
+ p.REMEMBER_INCOMING,
6338
6384
  {
6339
- type: C.LOG_TRANSITION,
6385
+ type: p.LOG_TRANSITION,
6340
6386
  params: {
6341
6387
  from: l.FAILED,
6342
6388
  to: l.RINGING,
@@ -6348,10 +6394,10 @@ const zt = {
6348
6394
  }
6349
6395
  }
6350
6396
  }
6351
- }), So = mo(), Co = A("IncomingCallStateMachine");
6352
- class po extends ee {
6397
+ }), po = So(), Co = A("IncomingCallStateMachine");
6398
+ class Ro extends ee {
6353
6399
  constructor({ incomingEvents: e, connectionEvents: n }) {
6354
- super(So), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(n);
6400
+ super(po), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(n);
6355
6401
  }
6356
6402
  get isIdle() {
6357
6403
  return this.hasState(l.IDLE);
@@ -6442,18 +6488,18 @@ class po extends ee {
6442
6488
  this.sendEvent({ type: R.CLEAR });
6443
6489
  };
6444
6490
  }
6445
- const Ro = 486, No = 487, _e = (t) => ({
6491
+ const No = 486, Io = 487, _e = (t) => ({
6446
6492
  displayName: t.remote_identity.display_name,
6447
6493
  host: t.remote_identity.uri.host,
6448
6494
  incomingNumber: t.remote_identity.uri.user,
6449
6495
  rtcSession: t
6450
6496
  });
6451
- class Io extends w {
6497
+ class Ao extends w {
6452
6498
  stateMachine;
6453
6499
  incomingRTCSession;
6454
6500
  connectionManager;
6455
6501
  constructor(e) {
6456
- super(go()), this.connectionManager = e, this.stateMachine = new po({
6502
+ super(To()), this.connectionManager = e, this.stateMachine = new Ro({
6457
6503
  incomingEvents: this.events,
6458
6504
  connectionEvents: this.connectionManager.events
6459
6505
  }), this.start();
@@ -6482,7 +6528,7 @@ class Io extends w {
6482
6528
  return this.stateMachine.toConsumed(), this.removeIncomingSession(), e;
6483
6529
  };
6484
6530
  async declineToIncomingCall({
6485
- statusCode: e = No
6531
+ statusCode: e = Io
6486
6532
  } = {}) {
6487
6533
  return new Promise((n, s) => {
6488
6534
  try {
@@ -6494,7 +6540,7 @@ class Io extends w {
6494
6540
  });
6495
6541
  }
6496
6542
  async busyIncomingCall() {
6497
- return this.declineToIncomingCall({ statusCode: Ro });
6543
+ return this.declineToIncomingCall({ statusCode: No });
6498
6544
  }
6499
6545
  subscribe() {
6500
6546
  this.connectionManager.on("newRTCSession", this.handleNewRTCSession);
@@ -6519,7 +6565,7 @@ class Io extends w {
6519
6565
  delete this.incomingRTCSession;
6520
6566
  }
6521
6567
  }
6522
- class Ao {
6568
+ class vo {
6523
6569
  apiManager;
6524
6570
  connectionManager;
6525
6571
  callManager;
@@ -6548,35 +6594,35 @@ class Ao {
6548
6594
  if (e === void 0 || n === void 0 || s === void 0)
6549
6595
  return;
6550
6596
  const r = [
6551
- `${g.CONTENT_ENTER_ROOM}: ${this.peerToPeerRoom}`,
6552
- `${g.PARTICIPANT_NAME}: ${this.number}`,
6553
- `${g.IS_DIRECT_PEER_TO_PEER}: true`
6597
+ `${E.CONTENT_ENTER_ROOM}: ${this.peerToPeerRoom}`,
6598
+ `${E.PARTICIPANT_NAME}: ${this.number}`,
6599
+ `${E.IS_DIRECT_PEER_TO_PEER}: true`
6554
6600
  ];
6555
6601
  s.sendEnterRoom(r);
6556
6602
  };
6557
6603
  }
6558
- const Jt = ["snapshot-changed"], vo = () => new G(Jt), fo = (t, e) => Object.is(t, e), st = (t, e) => t.connection.value === e.connection.value && // Call: full snapshot so room/context updates without a state `value` change still emit snapshot-changed
6559
- vn(t.call, e.call) && // Incoming: value only — repeated RINGING with different callee metadata must not emit again
6560
- t.incoming.value === e.incoming.value && t.presentation.value === e.presentation.value && t.autoConnector.value === e.autoConnector.value, rt = (t) => ({
6604
+ const Kt = ["snapshot-changed"], fo = () => new G(Kt), Mo = (t, e) => Object.is(t, e), rt = (t, e) => t.connection.value === e.connection.value && // Call: full snapshot so room/context updates without a state `value` change still emit snapshot-changed
6605
+ fn(t.call, e.call) && // Incoming: value only — repeated RINGING with different callee metadata must not emit again
6606
+ t.incoming.value === e.incoming.value && t.presentation.value === e.presentation.value && t.autoConnector.value === e.autoConnector.value, it = (t) => ({
6561
6607
  connection: t.connection.getSnapshot(),
6562
6608
  call: t.call.getSnapshot(),
6563
6609
  incoming: t.incoming.getSnapshot(),
6564
6610
  presentation: t.presentation.getSnapshot(),
6565
6611
  autoConnector: t.autoConnector.getSnapshot()
6566
6612
  });
6567
- class Mo extends w {
6613
+ class _o extends w {
6568
6614
  machines;
6569
6615
  currentSnapshot;
6570
6616
  subscribers = /* @__PURE__ */ new Set();
6571
6617
  actorSubscriptions = [];
6572
6618
  constructor(e) {
6573
- super(vo()), this.machines = {
6619
+ super(fo()), this.machines = {
6574
6620
  connection: e.connectionManager.stateMachine,
6575
6621
  call: e.callManager.stateMachine,
6576
6622
  incoming: e.incomingCallManager.stateMachine,
6577
6623
  presentation: e.presentationManager.stateMachine,
6578
6624
  autoConnector: e.autoConnectorManager.stateMachine
6579
- }, this.currentSnapshot = rt(this.machines), this.actorSubscriptions.push(
6625
+ }, this.currentSnapshot = it(this.machines), this.actorSubscriptions.push(
6580
6626
  this.machines.connection.subscribe(this.notifySubscribers),
6581
6627
  this.machines.call.subscribe(this.notifySubscribers),
6582
6628
  this.machines.incoming.subscribe(this.notifySubscribers),
@@ -6588,14 +6634,14 @@ class Mo extends w {
6588
6634
  return this.currentSnapshot;
6589
6635
  }
6590
6636
  subscribe(e, n, s) {
6591
- const r = typeof n == "function", i = r ? e : (I) => I, a = r ? n : e, c = r ? s ?? fo : st, E = i(this.currentSnapshot), p = {
6637
+ const r = typeof n == "function", i = r ? e : (I) => I, a = r ? n : e, c = r ? s ?? Mo : rt, g = i(this.currentSnapshot), C = {
6592
6638
  selector: i,
6593
6639
  listener: a,
6594
6640
  equals: c,
6595
- current: E
6641
+ current: g
6596
6642
  };
6597
- return this.subscribers.add(p), () => {
6598
- this.subscribers.delete(p);
6643
+ return this.subscribers.add(C), () => {
6644
+ this.subscribers.delete(C);
6599
6645
  };
6600
6646
  }
6601
6647
  stop() {
@@ -6605,8 +6651,8 @@ class Mo extends w {
6605
6651
  }
6606
6652
  notifySubscribers = () => {
6607
6653
  const e = this.currentSnapshot;
6608
- this.currentSnapshot = rt(this.machines);
6609
- const n = st(e, this.currentSnapshot);
6654
+ this.currentSnapshot = it(this.machines);
6655
+ const n = rt(e, this.currentSnapshot);
6610
6656
  for (const s of this.subscribers) {
6611
6657
  const r = s.selector(this.currentSnapshot);
6612
6658
  s.equals(s.current, r) || (s.current = r, s.listener(r));
@@ -6619,10 +6665,10 @@ class Mo extends w {
6619
6665
  }
6620
6666
  const ie = 1e3;
6621
6667
  var P = /* @__PURE__ */ ((t) => (t.INBOUND_RTP = "inbound-rtp", t.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", t.MEDIA_SOURCE = "media-source", t.OUTBOUND_RTP = "outbound-rtp", t.REMOTE_INBOUND_RTP = "remote-inbound-rtp", t.CODEC = "codec", t.CANDIDATE_PAIR = "candidate-pair", t.CERTIFICATE = "certificate", t.TRANSPORT = "transport", t.LOCAL_CANDIDATE = "local-candidate", t.REMOTE_CANDIDATE = "remote-candidate", t))(P || {});
6622
- const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performance" in window ? performance.now() : Date.now(), le = (t) => [...t.keys()].reduce((e, n) => {
6668
+ const Xt = ["collected", "stopped"], Oo = () => new G(Xt), at = () => "performance" in window ? performance.now() : Date.now(), le = (t) => [...t.keys()].reduce((e, n) => {
6623
6669
  const s = t.get(n);
6624
6670
  return s === void 0 ? e : { ...e, [s.type]: s };
6625
- }, {}), Oo = (t) => {
6671
+ }, {}), bo = (t) => {
6626
6672
  if (!t)
6627
6673
  return {
6628
6674
  outboundRtp: void 0,
@@ -6637,7 +6683,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6637
6683
  mediaSource: e[P.MEDIA_SOURCE],
6638
6684
  remoteInboundRtp: e[P.REMOTE_INBOUND_RTP]
6639
6685
  };
6640
- }, at = (t) => {
6686
+ }, ot = (t) => {
6641
6687
  if (!t)
6642
6688
  return {
6643
6689
  outboundRtp: void 0,
@@ -6652,7 +6698,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6652
6698
  mediaSource: e[P.MEDIA_SOURCE],
6653
6699
  remoteInboundRtp: e[P.REMOTE_INBOUND_RTP]
6654
6700
  };
6655
- }, ot = ({
6701
+ }, ct = ({
6656
6702
  videoReceiversStats: t,
6657
6703
  synchronizationSourcesVideo: e
6658
6704
  }) => {
@@ -6668,7 +6714,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6668
6714
  codec: n[P.CODEC],
6669
6715
  synchronizationSources: e
6670
6716
  };
6671
- }, bo = ({
6717
+ }, Po = ({
6672
6718
  audioReceiverStats: t,
6673
6719
  synchronizationSourcesAudio: e
6674
6720
  }) => {
@@ -6686,7 +6732,7 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6686
6732
  remoteOutboundRtp: n[P.REMOTE_OUTBOUND_RTP],
6687
6733
  synchronizationSources: e
6688
6734
  };
6689
- }, Xt = (t) => {
6735
+ }, Zt = (t) => {
6690
6736
  if (!t)
6691
6737
  return {
6692
6738
  candidatePair: void 0,
@@ -6703,39 +6749,39 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6703
6749
  remoteCandidate: e[P.REMOTE_CANDIDATE],
6704
6750
  transport: e[P.TRANSPORT]
6705
6751
  };
6706
- }, Po = ({
6752
+ }, yo = ({
6707
6753
  audioSenderStats: t,
6708
6754
  videoSenderFirstStats: e,
6709
6755
  videoSenderSecondStats: n
6710
6756
  }) => ({
6711
- video: at(e),
6712
- secondVideo: at(n),
6713
- audio: Oo(t),
6714
- additional: Xt(
6757
+ video: ot(e),
6758
+ secondVideo: ot(n),
6759
+ audio: bo(t),
6760
+ additional: Zt(
6715
6761
  t ?? e ?? n
6716
6762
  )
6717
- }), yo = ({
6763
+ }), Do = ({
6718
6764
  audioReceiverStats: t,
6719
6765
  videoReceiverFirstStats: e,
6720
6766
  videoReceiverSecondStats: n,
6721
6767
  synchronizationSources: s
6722
6768
  }) => ({
6723
- video: ot({
6769
+ video: ct({
6724
6770
  videoReceiversStats: e,
6725
6771
  synchronizationSourcesVideo: s.video
6726
6772
  }),
6727
- secondVideo: ot({
6773
+ secondVideo: ct({
6728
6774
  videoReceiversStats: n,
6729
6775
  synchronizationSourcesVideo: s.secondVideo ?? s.video
6730
6776
  }),
6731
- audio: bo({
6777
+ audio: Po({
6732
6778
  audioReceiverStats: t,
6733
6779
  synchronizationSourcesAudio: s.audio
6734
6780
  }),
6735
- additional: Xt(
6781
+ additional: Zt(
6736
6782
  t ?? e ?? n
6737
6783
  )
6738
- }), Do = ({
6784
+ }), Lo = ({
6739
6785
  audioSenderStats: t,
6740
6786
  videoSenderFirstStats: e,
6741
6787
  videoSenderSecondStats: n,
@@ -6744,11 +6790,11 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6744
6790
  videoReceiverSecondStats: i,
6745
6791
  synchronizationSources: a
6746
6792
  }) => {
6747
- const o = Po({
6793
+ const o = yo({
6748
6794
  audioSenderStats: t,
6749
6795
  videoSenderFirstStats: e,
6750
6796
  videoSenderSecondStats: n
6751
- }), c = yo({
6797
+ }), c = Do({
6752
6798
  audioReceiverStats: s,
6753
6799
  videoReceiverFirstStats: r,
6754
6800
  videoReceiverSecondStats: i,
@@ -6758,19 +6804,19 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6758
6804
  outbound: o,
6759
6805
  inbound: c
6760
6806
  };
6761
- }, Lo = async (t) => {
6762
- const e = "audio", n = "video", s = t.getSenders(), r = s.find((_) => _.track?.kind === e), i = s.filter((_) => _.track?.kind === n), a = t.getReceivers(), o = a.find((_) => _.track.kind === e), c = a.filter((_) => _.track.kind === n), E = {
6807
+ }, wo = async (t) => {
6808
+ const e = "audio", n = "video", s = t.getSenders(), r = s.find((_) => _.track?.kind === e), i = s.filter((_) => _.track?.kind === n), a = t.getReceivers(), o = a.find((_) => _.track.kind === e), c = a.filter((_) => _.track.kind === n), g = {
6763
6809
  trackIdentifier: o?.track.id,
6764
6810
  item: o?.getSynchronizationSources()[0]
6765
- }, p = {
6811
+ }, C = {
6766
6812
  trackIdentifier: c[0]?.track.id,
6767
6813
  item: c[0]?.getSynchronizationSources()[0]
6768
6814
  }, I = {
6769
6815
  trackIdentifier: c[1]?.track.id,
6770
6816
  item: c[1]?.getSynchronizationSources()[0]
6771
6817
  }, b = {
6772
- audio: E,
6773
- video: p,
6818
+ audio: g,
6819
+ video: C,
6774
6820
  secondVideo: I
6775
6821
  };
6776
6822
  return Promise.all([
@@ -6786,8 +6832,8 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6786
6832
  L,
6787
6833
  z,
6788
6834
  te,
6789
- Fe,
6790
- cn
6835
+ Be,
6836
+ dn
6791
6837
  ] = _;
6792
6838
  return {
6793
6839
  synchronizationSources: b,
@@ -6795,23 +6841,23 @@ const Kt = ["collected", "stopped"], _o = () => new G(Kt), it = () => "performan
6795
6841
  videoSenderFirstStats: L,
6796
6842
  videoSenderSecondStats: z,
6797
6843
  audioReceiverStats: te,
6798
- videoReceiverFirstStats: Fe,
6799
- videoReceiverSecondStats: cn
6844
+ videoReceiverFirstStats: Be,
6845
+ videoReceiverSecondStats: dn
6800
6846
  };
6801
6847
  });
6802
- }, wo = A("StatsPeerConnection");
6803
- class Go extends w {
6848
+ }, Go = A("StatsPeerConnection");
6849
+ class ko extends w {
6804
6850
  setTimeoutRequest;
6805
- requesterAllStatistics = new pe(Lo);
6851
+ requesterAllStatistics = new Ce(wo);
6806
6852
  constructor() {
6807
- super(_o()), this.setTimeoutRequest = new ht();
6853
+ super(Oo()), this.setTimeoutRequest = new ut();
6808
6854
  }
6809
6855
  get requested() {
6810
6856
  return this.setTimeoutRequest.requested;
6811
6857
  }
6812
6858
  start(e, {
6813
6859
  interval: n = ie,
6814
- onError: s = wo
6860
+ onError: s = Go
6815
6861
  } = {}) {
6816
6862
  this.setTimeoutRequest.request(() => {
6817
6863
  this.collectStatistics(e, {
@@ -6834,10 +6880,10 @@ class Go extends w {
6834
6880
  onError: n,
6835
6881
  onSuccess: s
6836
6882
  }) => {
6837
- const r = it();
6883
+ const r = at();
6838
6884
  this.requestAllStatistics(e).then((i) => {
6839
- this.events.trigger("collected", Do(i));
6840
- const o = it() - r;
6885
+ this.events.trigger("collected", Lo(i));
6886
+ const o = at() - r;
6841
6887
  let c = ie;
6842
6888
  o > 48 ? c = ie * 4 : o > 32 ? c = ie * 3 : o > 16 && (c = ie * 2), s({ interval: c });
6843
6889
  }).catch((i) => {
@@ -6851,8 +6897,8 @@ class Go extends w {
6851
6897
  return this.requesterAllStatistics.request(n);
6852
6898
  };
6853
6899
  }
6854
- const ko = 500, Uo = A("StatsManager");
6855
- class Fo extends w {
6900
+ const Uo = 500, Fo = A("StatsManager");
6901
+ class Bo extends w {
6856
6902
  statsPeerConnection;
6857
6903
  availableStats;
6858
6904
  previousAvailableStats;
@@ -6862,7 +6908,7 @@ class Fo extends w {
6862
6908
  callManager: e,
6863
6909
  apiManager: n
6864
6910
  }) {
6865
- const s = new Go();
6911
+ const s = new ko();
6866
6912
  super(s.events), this.statsPeerConnection = s, this.callManager = e, this.apiManager = n, this.subscribe();
6867
6913
  }
6868
6914
  get availableIncomingBitrate() {
@@ -6925,7 +6971,7 @@ class Fo extends w {
6925
6971
  return this.previousInboundRtp?.bytesReceived;
6926
6972
  }
6927
6973
  get isReceivingPackets() {
6928
- const e = this.packetsReceived !== void 0 && this.packetsReceived >= ko, n = this.packetsReceived !== this.previousPacketsReceived;
6974
+ const e = this.packetsReceived !== void 0 && this.packetsReceived >= Uo, n = this.packetsReceived !== this.previousPacketsReceived;
6929
6975
  return e && n;
6930
6976
  }
6931
6977
  hasAvailableIncomingBitrateChangedQuarter() {
@@ -6961,42 +7007,42 @@ class Fo extends w {
6961
7007
  };
6962
7008
  maybeSendStats() {
6963
7009
  this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
6964
- Uo("Failed to send stats", e);
7010
+ Fo("Failed to send stats", e);
6965
7011
  });
6966
7012
  }
6967
7013
  }
6968
- const Bo = A("setCodecPreferences"), $o = (t, e) => t.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), xo = (t) => {
7014
+ const $o = A("setCodecPreferences"), xo = (t, e) => t.filter((s) => e.some((r) => r.clockRate === s.clockRate && r.mimeType === s.mimeType && r.channels === s.channels && r.sdpFmtpLine === s.sdpFmtpLine)), Vo = (t) => {
6969
7015
  const e = RTCRtpSender.getCapabilities(t), n = RTCRtpReceiver.getCapabilities(t), s = e === null ? [] : e.codecs, r = n === null ? [] : n.codecs;
6970
- return $o(s, r);
6971
- }, Vo = (t, e) => e === void 0 || e.length === 0 ? t : t.sort((n, s) => {
7016
+ return xo(s, r);
7017
+ }, qo = (t, e) => e === void 0 || e.length === 0 ? t : t.sort((n, s) => {
6972
7018
  const r = e.indexOf(n.mimeType), i = e.indexOf(s.mimeType), a = r === -1 ? Number.MAX_VALUE : r, o = i === -1 ? Number.MAX_VALUE : i;
6973
7019
  return a - o;
6974
- }), qo = (t, e) => e === void 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n.mimeType)), Ho = (t, {
7020
+ }), Ho = (t, e) => e === void 0 || e.length === 0 ? t : t.filter((n) => !e.includes(n.mimeType)), Wo = (t, {
6975
7021
  preferredMimeTypesVideoCodecs: e,
6976
7022
  excludeMimeTypesVideoCodecs: n
6977
7023
  }) => {
6978
7024
  try {
6979
7025
  if (typeof t.setCodecPreferences == "function" && t.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || n !== void 0 && n.length > 0)) {
6980
- const s = xo("video"), r = qo(s, n), i = Vo(r, e);
7026
+ const s = Vo("video"), r = Ho(s, n), i = qo(r, e);
6981
7027
  t.setCodecPreferences(i);
6982
7028
  }
6983
7029
  } catch (s) {
6984
- Bo("setCodecPreferences error", s);
7030
+ $o("setCodecPreferences error", s);
6985
7031
  }
6986
- }, Zt = [
7032
+ }, en = [
6987
7033
  "balancing-scheduled",
6988
7034
  "balancing-started",
6989
7035
  "balancing-stopped",
6990
7036
  "parameters-updated"
6991
- ], Wo = () => new G(Zt), Qo = A("VideoSendingBalancerManager");
6992
- class Yo extends w {
7037
+ ], Qo = () => new G(en), Yo = A("VideoSendingBalancerManager");
7038
+ class jo extends w {
6993
7039
  isBalancingActive = !1;
6994
7040
  callManager;
6995
7041
  balancingStartDelay;
6996
7042
  videoSendingBalancer;
6997
7043
  startBalancingTimer;
6998
7044
  constructor(e, n, s = {}) {
6999
- super(Wo()), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new va(
7045
+ super(Qo()), this.callManager = e, this.balancingStartDelay = s.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new fa(
7000
7046
  n,
7001
7047
  () => e.connection,
7002
7048
  {
@@ -7052,7 +7098,7 @@ class Yo extends w {
7052
7098
  scheduleBalancingStart() {
7053
7099
  this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
7054
7100
  this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
7055
- Qo("startBalancing: error", e);
7101
+ Yo("startBalancing: error", e);
7056
7102
  });
7057
7103
  }, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
7058
7104
  }
@@ -7060,12 +7106,12 @@ class Yo extends w {
7060
7106
  this.startBalancingTimer && (clearTimeout(this.startBalancingTimer), this.startBalancingTimer = void 0);
7061
7107
  }
7062
7108
  }
7063
- const en = "health-snapshot", tn = "inbound-video-problem-detected", nn = "inbound-video-problem-resolved", sn = "inbound-video-problem-reset", rn = [
7064
- en,
7109
+ const tn = "health-snapshot", nn = "inbound-video-problem-detected", sn = "inbound-video-problem-resolved", rn = "inbound-video-problem-reset", an = [
7065
7110
  tn,
7066
7111
  nn,
7067
- sn
7068
- ], jo = () => new G(rn), zo = 3;
7112
+ sn,
7113
+ rn
7114
+ ], zo = () => new G(an), Jo = 3;
7069
7115
  class ce extends w {
7070
7116
  statsManager;
7071
7117
  callManager;
@@ -7073,8 +7119,8 @@ class ce extends w {
7073
7119
  consecutiveProblemSamplesCount = 0;
7074
7120
  currentProblemReason;
7075
7121
  hasEmittedCurrentProblem = !1;
7076
- constructor(e, n, s = zo) {
7077
- super(jo()), this.statsManager = e, this.callManager = n, ce.assertValidMinConsecutiveProblemSamplesCount(
7122
+ constructor(e, n, s = Jo) {
7123
+ super(zo()), this.statsManager = e, this.callManager = n, ce.assertValidMinConsecutiveProblemSamplesCount(
7078
7124
  s
7079
7125
  ), this.minConsecutiveProblemSamplesCount = s, this.subscribe();
7080
7126
  }
@@ -7121,13 +7167,13 @@ class ce extends w {
7121
7167
  }
7122
7168
  handleStatsCollected = () => {
7123
7169
  const { healthSnapshot: e } = this;
7124
- this.events.trigger(en, e);
7170
+ this.events.trigger(tn, e);
7125
7171
  const n = ce.resolveProblemReason(e);
7126
7172
  if (n === void 0) {
7127
7173
  this.maybeEmitResolvedProblem(e), this.resetProblemDetectionState();
7128
7174
  return;
7129
7175
  }
7130
- this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(tn, {
7176
+ this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(nn, {
7131
7177
  ...e,
7132
7178
  consecutiveProblemSamplesCount: this.consecutiveProblemSamplesCount,
7133
7179
  reason: n
@@ -7147,7 +7193,7 @@ class ce extends w {
7147
7193
  this.currentProblemReason = e, this.consecutiveProblemSamplesCount = 1, this.hasEmittedCurrentProblem = !1;
7148
7194
  };
7149
7195
  maybeEmitResolvedProblem = (e) => {
7150
- !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(nn, {
7196
+ !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(sn, {
7151
7197
  ...e,
7152
7198
  reason: this.currentProblemReason
7153
7199
  });
@@ -7156,7 +7202,7 @@ class ce extends w {
7156
7202
  this.maybeEmitResetProblem(e), this.resetProblemDetectionState();
7157
7203
  };
7158
7204
  maybeEmitResetProblem = (e) => {
7159
- !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(sn, {
7205
+ !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(rn, {
7160
7206
  reason: this.currentProblemReason,
7161
7207
  resetCause: e
7162
7208
  });
@@ -7165,20 +7211,20 @@ class ce extends w {
7165
7211
  this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
7166
7212
  };
7167
7213
  }
7168
- const J = A("MainStreamRecovery"), Jo = 4e3;
7169
- class Ce {
7214
+ const J = A("MainStreamRecovery"), Ko = 4e3;
7215
+ class pe {
7170
7216
  renegotiateRequester;
7171
7217
  renegotiateThrottled;
7172
7218
  callManager;
7173
- constructor(e, n = Jo) {
7174
- this.callManager = e, this.renegotiateRequester = new pe(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(n), this.subscribe();
7219
+ constructor(e, n = Ko) {
7220
+ this.callManager = e, this.renegotiateRequester = new Ce(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(n), this.subscribe();
7175
7221
  }
7176
7222
  static assertValidThrottleRecoveryTimeout(e) {
7177
7223
  if (!Number.isInteger(e) || e < 1)
7178
7224
  throw new Error("throttleRecoveryTimeout should be a positive integer");
7179
7225
  }
7180
7226
  setThrottleRecoveryTimeout(e) {
7181
- Ce.assertValidThrottleRecoveryTimeout(e), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(e);
7227
+ pe.assertValidThrottleRecoveryTimeout(e), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(e);
7182
7228
  }
7183
7229
  // Запускает recovery: фактически вызывает throttled-версию requestRenegotiate.
7184
7230
  recover() {
@@ -7197,7 +7243,7 @@ class Ce {
7197
7243
  });
7198
7244
  };
7199
7245
  createRenegotiateThrottled(e) {
7200
- return Ce.assertValidThrottleRecoveryTimeout(e), An.throttle(this.requestRenegotiate.bind(this), e);
7246
+ return pe.assertValidThrottleRecoveryTimeout(e), vn.throttle(this.requestRenegotiate.bind(this), e);
7201
7247
  }
7202
7248
  // На завершение вызова: отменяем throttling и (если есть) in-flight renegotiate.
7203
7249
  subscribe() {
@@ -7210,37 +7256,36 @@ class Ce {
7210
7256
  J("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
7211
7257
  }
7212
7258
  }
7213
- var an = /* @__PURE__ */ ((t) => (t.VP8 = "video/VP8", t.VP9 = "video/VP9", t.H264 = "video/H264", t.AV1 = "video/AV1", t.rtx = "video/rtx", t.red = "video/red", t.flexfec03 = "video/flexfec-03", t))(an || {});
7214
- const Ko = {
7259
+ var on = /* @__PURE__ */ ((t) => (t.VP8 = "video/VP8", t.VP9 = "video/VP9", t.H264 = "video/H264", t.AV1 = "video/AV1", t.rtx = "video/rtx", t.red = "video/red", t.flexfec03 = "video/flexfec-03", t))(on || {});
7260
+ const Xo = {
7215
7261
  major: 25,
7216
7262
  minor: 8,
7217
7263
  patch: 0
7218
- }, Xo = ({
7264
+ }, Zo = ({
7219
7265
  isYandexBrowser: t,
7220
7266
  hasGreaterThanBrowserVersion: e
7221
7267
  }) => {
7222
7268
  const n = e(
7223
- Ko
7269
+ Xo
7224
7270
  );
7225
7271
  return t && n;
7226
- }, Zo = () => {
7227
- const t = bt();
7228
- if (Xo(t))
7229
- return [an.VP8];
7230
7272
  }, ec = () => {
7231
- const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } = bt();
7273
+ const t = Pt();
7274
+ if (Zo(t))
7275
+ return [on.VP8];
7276
+ }, tc = () => {
7277
+ const { isMobileDevice: t, isSafari: e, isOpera: n, isWindows: s } = Pt();
7232
7278
  return t || e || n && s;
7233
7279
  };
7234
- let on;
7235
- ec() && (on = "h264");
7236
- const tc = {
7237
- ignoreForCodec: on
7238
- }, nc = Zo(), sc = 1e6, rc = vt.map((t) => `auto-connect:${t}`), ic = At.map((t) => `connection:${t}`), ac = Ot.map((t) => `call:${t}`), oc = Ct.map((t) => `api:${t}`), cc = jt.map((t) => `incoming-call:${t}`), dc = Qt.map((t) => `presentation:${t}`), lc = Kt.map((t) => `stats:${t}`), hc = Zt.map((t) => `video-balancer:${t}`), uc = rn.map((t) => `main-stream-health:${t}`), Ec = Jt.map((t) => `session:${t}`), gc = [
7280
+ let cn;
7281
+ tc() && (cn = "h264");
7282
+ const nc = {
7283
+ ignoreForCodec: cn
7284
+ }, sc = ec(), rc = 1e6, ic = ft.map((t) => `auto-connect:${t}`), ac = vt.map((t) => `connection:${t}`), oc = bt.map((t) => `call:${t}`), cc = Ct.map((t) => `api:${t}`), dc = zt.map((t) => `incoming-call:${t}`), lc = Yt.map((t) => `presentation:${t}`), hc = Xt.map((t) => `stats:${t}`), uc = en.map((t) => `video-balancer:${t}`), gc = an.map((t) => `main-stream-health:${t}`), Ec = Kt.map((t) => `session:${t}`), Tc = [
7239
7285
  "disconnected-from-out-of-call",
7240
7286
  "connected-with-configuration-from-out-of-call",
7241
7287
  "stopped-presentation-by-server-command"
7242
- ], Tc = [
7243
- ...rc,
7288
+ ], mc = [
7244
7289
  ...ic,
7245
7290
  ...ac,
7246
7291
  ...oc,
@@ -7249,10 +7294,11 @@ const tc = {
7249
7294
  ...lc,
7250
7295
  ...hc,
7251
7296
  ...uc,
7297
+ ...gc,
7252
7298
  ...Ec,
7253
- ...gc
7254
- ], mc = () => new G(Tc), ct = A("SipConnector");
7255
- class Uc extends w {
7299
+ ...Tc
7300
+ ], Sc = () => new G(mc), dt = A("SipConnector");
7301
+ class Fc extends w {
7256
7302
  connectionManager;
7257
7303
  connectionQueueManager;
7258
7304
  contentedStreamManager;
@@ -7279,34 +7325,34 @@ class Uc extends w {
7279
7325
  minConsecutiveProblemSamplesCount: o,
7280
7326
  throttleRecoveryTimeout: c
7281
7327
  } = {}) {
7282
- super(mc()), this.preferredMimeTypesVideoCodecs = n ?? nc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new Un(), this.connectionManager = new Cs({ JsSIP: e }, { numberOfConnectionAttempts: a }), this.connectionQueueManager = new ps({
7328
+ super(Sc()), this.preferredMimeTypesVideoCodecs = n ?? sc, this.excludeMimeTypesVideoCodecs = s, this.apiManager = new Fn(), this.connectionManager = new Cs({ JsSIP: e }, { numberOfConnectionAttempts: a }), this.connectionQueueManager = new Rs({
7283
7329
  connectionManager: this.connectionManager
7284
- }), this.contentedStreamManager = new Eo(), this.callSessionState = new Ni(), this.callManager = new za(
7330
+ }), this.contentedStreamManager = new Eo(), this.callSessionState = new Ii(), this.callManager = new Ja(
7285
7331
  { contentedStreamManager: this.contentedStreamManager },
7286
7332
  { sendOffer: this.sendOffer },
7287
7333
  { callSessionState: this.callSessionState }
7288
- ), this.incomingCallManager = new Io(this.connectionManager), this.presentationManager = new ao({
7334
+ ), this.incomingCallManager = new Ao(this.connectionManager), this.presentationManager = new oo({
7289
7335
  callManager: this.callManager,
7290
- maxBitrate: sc
7291
- }), this.statsManager = new Fo({
7336
+ maxBitrate: rc
7337
+ }), this.statsManager = new Bo({
7292
7338
  callManager: this.callManager,
7293
7339
  apiManager: this.apiManager
7294
- }), this.autoConnectorManager = new ks(
7340
+ }), this.autoConnectorManager = new Us(
7295
7341
  {
7296
7342
  connectionQueueManager: this.connectionQueueManager,
7297
7343
  connectionManager: this.connectionManager,
7298
7344
  callManager: this.callManager
7299
7345
  },
7300
7346
  i
7301
- ), this.videoSendingBalancerManager = new Yo(
7347
+ ), this.videoSendingBalancerManager = new jo(
7302
7348
  this.callManager,
7303
7349
  this.apiManager,
7304
- r ?? tc
7350
+ r ?? nc
7305
7351
  ), this.mainStreamHealthMonitor = new ce(
7306
7352
  this.statsManager,
7307
7353
  this.callManager,
7308
7354
  o
7309
- ), this.mainStreamRecovery = new Ce(this.callManager, c), this.sessionManager = new Mo({
7355
+ ), this.mainStreamRecovery = new pe(this.callManager, c), this.sessionManager = new _o({
7310
7356
  connectionManager: this.connectionManager,
7311
7357
  callManager: this.callManager,
7312
7358
  incomingCallManager: this.incomingCallManager,
@@ -7315,7 +7361,7 @@ class Uc extends w {
7315
7361
  }), this.callManager.subscribeToApiEvents(this.apiManager), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
7316
7362
  connectionManager: this.connectionManager,
7317
7363
  callManager: this.callManager
7318
- }), this.peerToPeerManager = new Ao(), this.peerToPeerManager.subscribe({
7364
+ }), this.peerToPeerManager = new vo(), this.peerToPeerManager.subscribe({
7319
7365
  connectionManager: this.connectionManager,
7320
7366
  callManager: this.callManager,
7321
7367
  apiManager: this.apiManager
@@ -7505,11 +7551,11 @@ class Uc extends w {
7505
7551
  ), this.apiManager.on("presentation:must-stop", () => {
7506
7552
  this.mayBeStopPresentationAndNotify();
7507
7553
  }), this.apiManager.on("failed-send-room-direct-p2p", ({ error: e }) => {
7508
- const n = new dt();
7554
+ const n = new lt();
7509
7555
  n.body = e instanceof Error ? e.message : String(e);
7510
- const s = lt.causes.INTERNAL_ERROR;
7556
+ const s = ht.causes.INTERNAL_ERROR;
7511
7557
  this.callManager.failed(n, s).catch((r) => {
7512
- ct("Failed to end call after failed:", r);
7558
+ dt("Failed to end call after failed:", r);
7513
7559
  });
7514
7560
  });
7515
7561
  }
@@ -7517,7 +7563,7 @@ class Uc extends w {
7517
7563
  const r = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
7518
7564
  if (r === void 0)
7519
7565
  throw new Error("No sipServerUrl for sendOffer");
7520
- return Di({
7566
+ return Li({
7521
7567
  serverUrl: r,
7522
7568
  offer: n,
7523
7569
  token: e.token,
@@ -7527,7 +7573,7 @@ class Uc extends w {
7527
7573
  });
7528
7574
  };
7529
7575
  setCodecPreferences(e) {
7530
- Ho(e, {
7576
+ Wo(e, {
7531
7577
  preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
7532
7578
  excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
7533
7579
  });
@@ -7537,7 +7583,7 @@ class Uc extends w {
7537
7583
  }
7538
7584
  subscribeToMainStreamHealthMonitorEvents() {
7539
7585
  this.mainStreamHealthMonitor.on("inbound-video-problem-detected", ({ reason: e }) => {
7540
- ct("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
7586
+ dt("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
7541
7587
  });
7542
7588
  }
7543
7589
  bridgeEvents = (e, n) => {
@@ -7552,57 +7598,57 @@ class Uc extends w {
7552
7598
  };
7553
7599
  }
7554
7600
  export {
7555
- oi as $,
7556
- no as A,
7557
- Uc as B,
7558
- Ni as C,
7559
- zi as D,
7560
- Ht as E,
7561
- Go as F,
7562
- fs as G,
7563
- ai as H,
7564
- po as I,
7565
- aa as J,
7566
- cs as K,
7567
- go as L,
7568
- Pc as M,
7569
- bc as N,
7570
- Bt as O,
7571
- bi as P,
7572
- kc as Q,
7601
+ ci as $,
7602
+ so as A,
7603
+ Fc as B,
7604
+ Ii as C,
7605
+ Ji as D,
7606
+ Wt as E,
7607
+ ko as F,
7608
+ Ms as G,
7609
+ oi as H,
7610
+ Ro as I,
7611
+ oa as J,
7612
+ ds as K,
7613
+ To as L,
7614
+ yc as M,
7615
+ Pc as N,
7616
+ $t as O,
7617
+ Pi as P,
7618
+ Uc as Q,
7573
7619
  x as R,
7574
- Mo as S,
7575
- hi as T,
7620
+ _o as S,
7621
+ ui as T,
7576
7622
  H as U,
7577
7623
  de as V,
7578
- Ti as W,
7624
+ mi as W,
7579
7625
  Ei as X,
7580
- gi as Y,
7581
- ui as Z,
7582
- Zr as _,
7583
- wc as a,
7584
- Lc as b,
7585
- Gc as c,
7586
- bt as d,
7626
+ Ti as Y,
7627
+ gi as Z,
7628
+ ei as _,
7629
+ Gc as a,
7630
+ wc as b,
7631
+ kc as c,
7632
+ Pt as d,
7587
7633
  Se as e,
7588
- Di as f,
7589
- Dt as g,
7590
- be as h,
7591
- Pe as i,
7634
+ Li as f,
7635
+ Lt as g,
7636
+ Pe as h,
7637
+ ye as i,
7592
7638
  u as j,
7593
7639
  d as k,
7594
7640
  M as l,
7595
7641
  A as m,
7596
- Kn as n,
7597
- as as o,
7598
- Ee as p,
7642
+ Xn as n,
7643
+ os as o,
7644
+ ge as p,
7599
7645
  T as q,
7600
- Dc as r,
7601
- yc as s,
7602
- mt as t,
7646
+ Lc as r,
7647
+ Dc as s,
7648
+ St as t,
7603
7649
  R as u,
7604
7650
  l as v,
7605
- an as w,
7651
+ on as w,
7606
7652
  m as x,
7607
7653
  h as y,
7608
7654
  P as z