sip-connector 15.0.0 → 15.2.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.
Files changed (89) hide show
  1. package/README.md +160 -11
  2. package/dist/{@SipConnector-DbvV1Leg.js → @SipConnector-BEZk1hmx.js} +511 -229
  3. package/dist/@SipConnector-hpySQIBa.cjs +1 -0
  4. package/dist/ApiManager/__tests-utils__/helpers.d.ts +9 -0
  5. package/dist/ApiManager/constants.d.ts +2 -1
  6. package/dist/ApiManager/eventNames.d.ts +2 -1
  7. package/dist/CallManager/MCUCallStrategy.d.ts +1 -1
  8. package/dist/ConnectionManager/@ConnectionManager.d.ts +3 -3
  9. package/dist/ConnectionManager/getExtraHeadersRemoteAddress.d.ts +2 -2
  10. package/dist/IncomingCallManager/@IncomingCallManager.d.ts +2 -2
  11. package/dist/SipConnector/@SipConnector.d.ts +4 -2
  12. package/dist/SipConnector/eventNames.d.ts +1 -1
  13. package/dist/SipConnectorFacade/SipConnectorFacade.d.ts +15 -1
  14. package/dist/StatsManager/@StatsManager.d.ts +19 -0
  15. package/dist/StatsManager/eventNames.d.ts +2 -0
  16. package/dist/StatsManager/index.d.ts +2 -0
  17. package/dist/StatsPeerConnection/StatsPeerConnection.d.ts +20 -0
  18. package/dist/StatsPeerConnection/__fixtures__/callStaticsState.d.ts +3923 -0
  19. package/dist/StatsPeerConnection/constants.d.ts +14 -0
  20. package/dist/StatsPeerConnection/eventNames.d.ts +10 -0
  21. package/dist/StatsPeerConnection/index.d.ts +4 -0
  22. package/dist/StatsPeerConnection/parseStatsReports.d.ts +14 -0
  23. package/dist/StatsPeerConnection/requestAllStatistics.d.ts +11 -0
  24. package/dist/StatsPeerConnection/typings.d.ts +194 -0
  25. package/dist/StatsPeerConnection/utils/hasAvailableStats.d.ts +2 -0
  26. package/dist/StatsPeerConnection/utils/index.d.ts +3 -0
  27. package/dist/StatsPeerConnection/utils/now.d.ts +2 -0
  28. package/dist/StatsPeerConnection/utils/statsReportToObject.d.ts +4 -0
  29. package/dist/VideoSendingBalancer/CodecProvider.d.ts +7 -0
  30. package/dist/VideoSendingBalancer/ParametersSetterWithQueue.d.ts +12 -0
  31. package/dist/VideoSendingBalancer/SenderBalancer.d.ts +52 -0
  32. package/dist/VideoSendingBalancer/SenderFinder.d.ts +7 -0
  33. package/dist/VideoSendingBalancer/TaskQueue.d.ts +20 -0
  34. package/dist/VideoSendingBalancer/VideoSendingBalancer.d.ts +44 -0
  35. package/dist/VideoSendingBalancer/VideoSendingEventHandler.d.ts +25 -0
  36. package/dist/VideoSendingBalancer/calcBitrate/calcMaxBitrateByWidth.d.ts +4 -0
  37. package/dist/VideoSendingBalancer/calcBitrate/calcMaxBitrateByWidthAndCodec.d.ts +4 -0
  38. package/dist/VideoSendingBalancer/calcBitrate/index.d.ts +1 -0
  39. package/dist/VideoSendingBalancer/calcResolution/calcScaleResolutionDownBy.d.ts +6 -0
  40. package/dist/VideoSendingBalancer/calcResolution/index.d.ts +1 -0
  41. package/dist/VideoSendingBalancer/index.d.ts +3 -0
  42. package/dist/VideoSendingBalancer/types.d.ts +36 -0
  43. package/dist/__fixtures__/BaseSession.mock.d.ts +1 -1
  44. package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +2 -2
  45. package/dist/__fixtures__/RTCRtpSenderMock.d.ts +1 -0
  46. package/dist/__fixtures__/RTCSessionMock.d.ts +2 -2
  47. package/dist/__fixtures__/UA.mock.d.ts +2 -2
  48. package/dist/__fixtures__/eventNames.d.ts +1 -1
  49. package/dist/__fixtures__/jssip.mock.d.ts +1 -1
  50. package/dist/doMock.cjs +1 -1
  51. package/dist/doMock.js +21 -22
  52. package/dist/index.cjs +1 -1
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.js +697 -562
  55. package/dist/tools/createUaParser/createUaParser.d.ts +4 -0
  56. package/dist/tools/createUaParser/index.d.ts +1 -0
  57. package/dist/tools/createUaParser/isElectronEnvironment.d.ts +2 -0
  58. package/dist/tools/error/index.d.ts +1 -1
  59. package/dist/tools/index.d.ts +5 -1
  60. package/dist/{setParametersToSender → tools/setParametersToSender}/configureDegradationPreference.d.ts +1 -1
  61. package/dist/{setParametersToSender → tools/setParametersToSender}/configureEncodings.d.ts +1 -1
  62. package/dist/tools/setParametersToSender/index.d.ts +3 -0
  63. package/dist/tools/setParametersToSender/setEncodingsToSender.d.ts +6 -0
  64. package/dist/tools/setParametersToSender/setMaxBitrateToSender.d.ts +2 -0
  65. package/dist/tools/setParametersToSender/setParametersToSender.d.ts +4 -0
  66. package/dist/tools/setParametersToSender/types.d.ts +5 -0
  67. package/dist/tools/syncMediaState/createSyncMediaState.d.ts +18 -0
  68. package/dist/tools/syncMediaState/index.d.ts +1 -18
  69. package/dist/utils/utils.d.ts +4 -0
  70. package/package.json +12 -18
  71. package/dist/@SipConnector-CZo7A8_q.cjs +0 -1
  72. package/dist/setParametersToSender/index.d.ts +0 -1
  73. package/dist/setParametersToSender/setParametersToSender.d.ts +0 -7
  74. package/dist/videoSendingBalancer/balance.d.ts +0 -10
  75. package/dist/videoSendingBalancer/getMaxBitrateByWidth.d.ts +0 -4
  76. package/dist/videoSendingBalancer/getMaxBitrateByWidthAndCodec.d.ts +0 -4
  77. package/dist/videoSendingBalancer/index.d.ts +0 -13
  78. package/dist/videoSendingBalancer/processSender.d.ts +0 -10
  79. package/dist/videoSendingBalancer/scaleBitrate.d.ts +0 -2
  80. package/dist/videoSendingBalancer/setEncodingsToSender.d.ts +0 -10
  81. /package/dist/{videoSendingBalancer → VideoSendingBalancer/calcBitrate}/hasAv1Codec.d.ts +0 -0
  82. /package/dist/{videoSendingBalancer → VideoSendingBalancer/calcBitrate}/scaleBitrateByCodec.d.ts +0 -0
  83. /package/dist/{videoSendingBalancer → tools}/scaleResolutionAndBitrate.d.ts +0 -0
  84. /package/dist/{setParametersToSender → tools/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
  85. /package/dist/{setParametersToSender → tools/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
  86. /package/dist/{setParametersToSender → tools/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
  87. /package/dist/{setParametersToSender → tools/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
  88. /package/dist/{setParametersToSender → tools/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
  89. /package/dist/{videoSendingBalancer → utils}/hasIncludesString.d.ts +0 -0
@@ -1,10 +1,13 @@
1
- import { Events as O } from "events-constructor";
2
- import "@krivega/cancelable-promise";
3
- import k from "debug";
4
- import { hasCanceledError as K, repeatedCallsAsync as V } from "repeated-calls";
5
- import { setup as j, createActor as Z } from "xstate";
6
- var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n))(N || {}), U = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(U || {});
7
- const H = [
1
+ import { Events as f, TypedEvents as ae } from "events-constructor";
2
+ import { CancelableRequest as oe } from "@krivega/cancelable-promise";
3
+ import B from "debug";
4
+ import { hasCanceledError as ce, repeatedCallsAsync as Y } from "repeated-calls";
5
+ import { setup as ge, createActor as de } from "xstate";
6
+ import { SetTimeoutRequest as Te } from "@krivega/timeout-requester";
7
+ import "ua-parser-js";
8
+ import "sequent-promises";
9
+ var N = /* @__PURE__ */ ((n) => (n.PEER_CONNECTION = "peerconnection", n.CONNECTING = "connecting", n.SENDING = "sending", n.PROGRESS = "progress", n.ACCEPTED = "accepted", n.CONFIRMED = "confirmed", n.ENDED = "ended", n.FAILED = "failed", n.NEW_DTMF = "newDTMF", n.NEW_INFO = "newInfo", n.HOLD = "hold", n.UNHOLD = "unhold", n.MUTED = "muted", n.UNMUTED = "unmuted", n.REINVITE = "reinvite", n.UPDATE = "update", n.REFER = "refer", n.REPLACES = "replaces", n.SDP = "sdp", n.ICE_CANDIDATE = "icecandidate", n.GET_USER_MEDIA_FAILED = "getusermediafailed", n.PEER_CONNECTION_CREATE_OFFER_FAILED = "peerconnection:createofferfailed", n.PEER_CONNECTION_CREATE_ANSWER_FAILED = "peerconnection:createanswerfailed", n.PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED = "peerconnection:setlocaldescriptionfailed", n.PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED = "peerconnection:setremotedescriptionfailed", n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n.PEER_CONNECTION_CONFIRMED = "peerconnection:confirmed", n.PEER_CONNECTION_ONTRACK = "peerconnection:ontrack", n.ENDED_FROM_SERVER = "ended:fromserver", n))(N || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
10
+ const z = [
8
11
  "peerconnection",
9
12
  "connecting",
10
13
  "sending",
@@ -31,25 +34,18 @@ const H = [
31
34
  "peerconnection:createanswerfailed",
32
35
  "peerconnection:setlocaldescriptionfailed",
33
36
  "peerconnection:setremotedescriptionfailed"
34
- ], ee = [
37
+ ], he = [
35
38
  "peerconnection:confirmed",
36
39
  "peerconnection:ontrack",
37
40
  "ended:fromserver"
38
- ], G = [
39
- ...H,
40
- ...ee
41
- ];
42
- function te(n) {
43
- return (e) => `sip:${e}@${n}`;
44
- }
45
- const ne = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, B = (n) => n.trim().replaceAll(" ", "_"), se = ne(1e5, 99999999), ie = (n) => n.some((t) => {
46
- const { kind: s } = t;
47
- return s === "video";
48
- }), re = (n, e) => {
41
+ ], Q = [
42
+ ...z,
43
+ ...he
44
+ ], Ee = (n, e) => {
49
45
  n.getVideoTracks().forEach((s) => {
50
46
  "contentHint" in s && s.contentHint !== e && (s.contentHint = e);
51
47
  });
52
- }, v = (n, {
48
+ }, w = (n, {
53
49
  directionVideo: e,
54
50
  directionAudio: t,
55
51
  contentHint: s
@@ -57,9 +53,16 @@ const ne = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, B = (n) => n
57
53
  if (!n || e === "recvonly" && t === "recvonly")
58
54
  return;
59
55
  const i = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), a = [...i, ...r], o = new MediaStream(a);
60
- return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && re(o, s), o;
56
+ return o.getTracks = () => [...o.getAudioTracks(), ...o.getVideoTracks()], s && s !== "none" && Ee(o, s), o;
61
57
  };
62
- class ae {
58
+ function Se(n) {
59
+ return (e) => `sip:${e}@${n}`;
60
+ }
61
+ const le = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, X = (n) => n.trim().replaceAll(" ", "_"), ue = le(1e5, 99999999), Ce = (n) => n.some((t) => {
62
+ const { kind: s } = t;
63
+ return s === "video";
64
+ });
65
+ class Ne {
63
66
  isPendingCall = !1;
64
67
  isPendingAnswer = !1;
65
68
  rtcSession;
@@ -70,8 +73,8 @@ class ae {
70
73
  this.events = e;
71
74
  }
72
75
  }
73
- var x = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(x || {});
74
- class oe {
76
+ var J = /* @__PURE__ */ ((n) => (n.BYE = "Terminated", n.WEBRTC_ERROR = "WebRTC Error", n.CANCELED = "Canceled", n.REQUEST_TIMEOUT = "Request Timeout", n.REJECTED = "Rejected", n.REDIRECTED = "Redirected", n.UNAVAILABLE = "Unavailable", n.NOT_FOUND = "Not Found", n.ADDRESS_INCOMPLETE = "Address Incomplete", n.INCOMPATIBLE_SDP = "Incompatible SDP", n.BAD_MEDIA_DESCRIPTION = "Bad Media Description", n))(J || {});
77
+ class Ae {
75
78
  remoteStreams = {};
76
79
  reset() {
77
80
  this.remoteStreams = {};
@@ -100,8 +103,8 @@ class oe {
100
103
  return e.map((t) => this.generateAudioStream(t));
101
104
  }
102
105
  }
103
- class ce extends ae {
104
- remoteStreamsManager = new oe();
106
+ class Re extends Ne {
107
+ remoteStreamsManager = new Ae();
105
108
  disposers = /* @__PURE__ */ new Set();
106
109
  constructor(e) {
107
110
  super(e), e.on(N.FAILED, this.handleEnded), e.on(N.ENDED, this.handleEnded);
@@ -126,20 +129,20 @@ class ce extends ae {
126
129
  iceServers: o,
127
130
  directionVideo: c,
128
131
  directionAudio: g,
129
- contentHint: d,
130
- offerToReceiveAudio: l = !0,
131
- offerToReceiveVideo: E = !0,
132
+ contentHint: E,
133
+ offerToReceiveAudio: u = !0,
134
+ offerToReceiveVideo: d = !0,
132
135
  sendEncodings: S,
133
- onAddedTransceiver: I
136
+ onAddedTransceiver: _
134
137
  }) => (this.isPendingCall = !0, new Promise((C, p) => {
135
- this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((b) => {
136
- p(b);
138
+ this.callConfiguration.number = s, this.callConfiguration.answer = !1, this.handleCall({ ontrack: a }).then(C).catch((D) => {
139
+ p(D);
137
140
  }), this.rtcSession = e.call(t(s), {
138
141
  extraHeaders: r,
139
- mediaStream: v(i, {
142
+ mediaStream: w(i, {
140
143
  directionVideo: c,
141
144
  directionAudio: g,
142
- contentHint: d
145
+ contentHint: E
143
146
  }),
144
147
  // необходимо передавать в методе call, чтобы подписаться на события peerconnection,
145
148
  // так как в методе call создается RTCSession
@@ -151,11 +154,11 @@ class ce extends ae {
151
154
  iceServers: o
152
155
  },
153
156
  rtcOfferConstraints: {
154
- offerToReceiveAudio: l,
155
- offerToReceiveVideo: E
157
+ offerToReceiveAudio: u,
158
+ offerToReceiveVideo: d
156
159
  },
157
160
  sendEncodings: S,
158
- onAddedTransceiver: I
161
+ onAddedTransceiver: _
159
162
  });
160
163
  }).finally(() => {
161
164
  this.isPendingCall = !1;
@@ -164,7 +167,7 @@ class ce extends ae {
164
167
  const { rtcSession: e } = this;
165
168
  if (e && !e.isEnded())
166
169
  return e.terminateAsync({
167
- cause: x.CANCELED
170
+ cause: J.CANCELED
168
171
  }).finally(() => {
169
172
  this.reset();
170
173
  });
@@ -179,19 +182,19 @@ class ce extends ae {
179
182
  directionAudio: o,
180
183
  offerToReceiveAudio: c,
181
184
  offerToReceiveVideo: g,
182
- contentHint: d,
183
- sendEncodings: l,
184
- onAddedTransceiver: E
185
- }) => (this.isPendingAnswer = !0, new Promise((S, I) => {
185
+ contentHint: E,
186
+ sendEncodings: u,
187
+ onAddedTransceiver: d
188
+ }) => (this.isPendingAnswer = !0, new Promise((S, _) => {
186
189
  try {
187
190
  const C = e();
188
- this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(S).catch((b) => {
189
- I(b);
191
+ this.rtcSession = C, this.subscribeToSessionEvents(C), this.callConfiguration.answer = !0, this.callConfiguration.number = C.remote_identity.uri.user, this.handleCall({ ontrack: s }).then(S).catch((D) => {
192
+ _(D);
190
193
  });
191
- const p = v(t, {
194
+ const p = w(t, {
192
195
  directionVideo: a,
193
196
  directionAudio: o,
194
- contentHint: d
197
+ contentHint: E
195
198
  });
196
199
  C.answer({
197
200
  extraHeaders: i,
@@ -205,11 +208,11 @@ class ce extends ae {
205
208
  offerToReceiveAudio: c,
206
209
  offerToReceiveVideo: g
207
210
  },
208
- sendEncodings: l,
209
- onAddedTransceiver: E
211
+ sendEncodings: u,
212
+ onAddedTransceiver: d
210
213
  });
211
214
  } catch (C) {
212
- I(C);
215
+ _(C);
213
216
  }
214
217
  }).finally(() => {
215
218
  this.isPendingAnswer = !1;
@@ -224,12 +227,12 @@ class ce extends ae {
224
227
  if (!this.connection)
225
228
  return;
226
229
  const t = this.connection.getReceivers().map(({ track: s }) => s);
227
- return ie(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
230
+ return Ce(t) ? this.remoteStreamsManager.generateStreams(t) : this.remoteStreamsManager.generateAudioStreams(t);
228
231
  }
229
232
  async replaceMediaStream(e, t) {
230
233
  if (!this.rtcSession)
231
234
  throw new Error("No rtcSession established");
232
- const { contentHint: s } = t ?? {}, i = v(e, { contentHint: s });
235
+ const { contentHint: s } = t ?? {}, i = w(e, { contentHint: s });
233
236
  if (i === void 0)
234
237
  throw new Error("No preparedMediaStream");
235
238
  return this.rtcSession.replaceMediaStream(i, t);
@@ -238,33 +241,33 @@ class ce extends ae {
238
241
  ontrack: e
239
242
  }) => new Promise((t, s) => {
240
243
  const i = () => {
241
- this.events.on(N.PEER_CONNECTION, d), this.events.on(N.CONFIRMED, l);
244
+ this.events.on(N.PEER_CONNECTION, E), this.events.on(N.CONFIRMED, u);
242
245
  }, r = () => {
243
- this.events.off(N.PEER_CONNECTION, d), this.events.off(N.CONFIRMED, l);
246
+ this.events.off(N.PEER_CONNECTION, E), this.events.off(N.CONFIRMED, u);
244
247
  }, a = () => {
245
248
  this.events.on(N.FAILED, c), this.events.on(N.ENDED, c);
246
249
  }, o = () => {
247
250
  this.events.off(N.FAILED, c), this.events.off(N.ENDED, c);
248
- }, c = (E) => {
249
- r(), o(), s(E);
251
+ }, c = (d) => {
252
+ r(), o(), s(d);
250
253
  };
251
254
  let g;
252
- const d = ({ peerconnection: E }) => {
253
- g = E;
254
- const S = (I) => {
255
- this.events.trigger(N.PEER_CONNECTION_ONTRACK, E), e && e(I);
255
+ const E = ({ peerconnection: d }) => {
256
+ g = d;
257
+ const S = (_) => {
258
+ this.events.trigger(N.PEER_CONNECTION_ONTRACK, d), e && e(_);
256
259
  };
257
- E.addEventListener("track", S), this.disposers.add(() => {
258
- E.removeEventListener("track", S);
260
+ d.addEventListener("track", S), this.disposers.add(() => {
261
+ d.removeEventListener("track", S);
259
262
  });
260
- }, l = () => {
263
+ }, u = () => {
261
264
  g !== void 0 && this.events.trigger(N.PEER_CONNECTION_CONFIRMED, g), r(), o(), t(g);
262
265
  };
263
266
  i(), a();
264
267
  });
265
268
  subscribeToSessionEvents(e) {
266
269
  this.events.eachTriggers((t, s) => {
267
- const i = H.find((r) => r === s);
270
+ const i = z.find((r) => r === s);
268
271
  i && (e.on(i, t), this.disposers.add(() => {
269
272
  e.off(i, t);
270
273
  }));
@@ -277,17 +280,17 @@ class ce extends ae {
277
280
  }
278
281
  handleEnded = (e) => {
279
282
  const { originator: t } = e;
280
- t === U.REMOTE && this.events.trigger(N.ENDED_FROM_SERVER, e), this.reset();
283
+ t === $.REMOTE && this.events.trigger(N.ENDED_FROM_SERVER, e), this.reset();
281
284
  };
282
285
  reset = () => {
283
286
  delete this.rtcSession, this.remoteStreamsManager.reset(), this.unsubscribeFromSessionEvents(), this.callConfiguration.number = void 0, this.callConfiguration.answer = !1;
284
287
  };
285
288
  }
286
- class ge {
289
+ class _e {
287
290
  events;
288
291
  strategy;
289
292
  constructor(e) {
290
- this.events = new O(G), this.strategy = e ?? new ce(this.events);
293
+ this.events = new f(Q), this.strategy = e ?? new Re(this.events);
291
294
  }
292
295
  get requested() {
293
296
  return this.strategy.requested;
@@ -331,13 +334,13 @@ class ge {
331
334
  getRemoteStreams = () => this.strategy.getRemoteStreams();
332
335
  replaceMediaStream = async (...e) => this.strategy.replaceMediaStream(...e);
333
336
  }
334
- const W = "sip-connector", m = k(W), He = () => {
335
- k.enable(W);
336
- }, Ge = () => {
337
- k.enable(`-${W}`);
338
- }, Te = "Error decline with 603", he = 1006, de = (n) => typeof n == "object" && n !== null && "code" in n && n.code === he, Ee = (n) => n.message === Te;
339
- var h = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(h || {}), y = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(y || {}), w = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n))(w || {}), M = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(M || {}), _ = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(_ || {}), f = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(f || {}), L = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(F || {}), Se = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Se || {}), T = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(T || {});
340
- const q = [
337
+ const H = "sip-connector", O = B(H), ht = () => {
338
+ B.enable(H);
339
+ }, Et = () => {
340
+ B.enable(`-${H}`);
341
+ }, Ie = "Error decline with 603", Me = 1006, pe = (n) => typeof n == "object" && n !== null && "code" in n && n.code === Me, Pe = (n) => n.message === Ie;
342
+ var h = /* @__PURE__ */ ((n) => (n.CONTENT_TYPE = "content-type", n.CONTENT_ENTER_ROOM = "x-webrtc-enter-room", n.CONTENT_USE_LICENSE = "X-WEBRTC-USE-LICENSE", n.PARTICIPANT_NAME = "X-WEBRTC-PARTICIPANT-NAME", n.INPUT_CHANNELS = "X-WEBRTC-INPUT-CHANNELS", n.OUTPUT_CHANNELS = "X-WEBRTC-OUTPUT-CHANNELS", n.MAIN_CAM = "X-WEBRTC-MAINCAM", n.MIC = "X-WEBRTC-MIC", n.MEDIA_SYNC = "X-WEBRTC-SYNC", n.MAIN_CAM_RESOLUTION = "X-WEBRTC-MAINCAM-RESOLUTION", n.MEDIA_STATE = "X-WEBRTC-MEDIA-STATE", n.MEDIA_TYPE = "X-Vinteo-Media-Type", n.MAIN_CAM_STATE = "X-Vinteo-MainCam-State", n.MIC_STATE = "X-Vinteo-Mic-State", n.CONTENT_PARTICIPANT_STATE = "X-WEBRTC-PARTSTATE", n.NOTIFY = "X-VINTEO-NOTIFY", n.CONTENT_ENABLE_MEDIA_DEVICE = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", n.CONTENT_SHARE_STATE = "x-webrtc-share-state", n.MUST_STOP_PRESENTATION_P2P = "x-webrtc-share-state: YOUMUSTSTOPSENDCONTENT", n.START_PRESENTATION_P2P = "x-webrtc-share-state: YOUCANRECEIVECONTENT", n.STOP_PRESENTATION_P2P = "x-webrtc-share-state: CONTENTEND", n.STOP_PRESENTATION = "x-webrtc-share-state: STOPPRESENTATION", n.START_PRESENTATION = "x-webrtc-share-state: LETMESTARTPRESENTATION", n.ENABLE_MAIN_CAM = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE: LETMESTARTMAINCAM", n))(h || {}), L = /* @__PURE__ */ ((n) => (n.AVAILABLE_SECOND_REMOTE_STREAM = "YOUCANRECEIVECONTENT", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "CONTENTEND", n.MUST_STOP_PRESENTATION = "YOUMUSTSTOPSENDCONTENT", n))(L || {}), F = /* @__PURE__ */ ((n) => (n.SPECTATOR = "SPECTATOR", n.PARTICIPANT = "PARTICIPANT", n.SPECTATOR_OVER_SFU = "SPECTATOROVERSFU", n))(F || {}), P = /* @__PURE__ */ ((n) => (n.ENTER_ROOM = "application/vinteo.webrtc.roomname", n.MIC = "application/vinteo.webrtc.mic", n.USE_LICENSE = "application/vinteo.webrtc.uselic", n.PARTICIPANT_STATE = "application/vinteo.webrtc.partstate", n.NOTIFY = "application/vinteo.webrtc.notify", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(P || {}), I = /* @__PURE__ */ ((n) => (n.CHANNELS = "application/vinteo.webrtc.channels", n.MEDIA_STATE = "application/vinteo.webrtc.mediastate", n.REFUSAL = "application/vinteo.webrtc.refusal", n.SHARE_STATE = "application/vinteo.webrtc.sharedesktop", n.MAIN_CAM = "application/vinteo.webrtc.maincam", n))(I || {}), y = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(y || {}), k = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(k || {}), W = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(W || {}), Oe = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Oe || {}), T = /* @__PURE__ */ ((n) => (n.CHANNELS_NOTIFY = "channels:notify", n.PARTICIPANT_ADDED_TO_LIST_MODERATORS = "participant:added-to-list-moderators", n.PARTICIPANT_REMOVED_FROM_LIST_MODERATORS = "participant:removed-from-list-moderators", n.PARTICIPANT_MOVE_REQUEST_TO_STREAM = "participant:move-request-to-stream", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS = "participant:move-request-to-spectators", n.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS = "participant:move-request-to-participants", n.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU = "participant:move-request-to-spectators-over-sfu", n.PARTICIPATION_ACCEPTING_WORD_REQUEST = "participation:accepting-word-request", n.PARTICIPATION_CANCELLING_WORD_REQUEST = "participation:cancelling-word-request", n.WEBCAST_STARTED = "webcast:started", n.WEBCAST_STOPPED = "webcast:stopped", n.ACCOUNT_CHANGED = "account:changed", n.ACCOUNT_DELETED = "account:deleted", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "conference:participant-token-issued", n.CHANNELS = "channels", n.ENTER_ROOM = "enterRoom", n.SHARE_STATE = "shareState", n.MAIN_CAM_CONTROL = "main-cam-control", n.USE_LICENSE = "useLicense", n.ADMIN_START_MAIN_CAM = "admin-start-main-cam", n.ADMIN_STOP_MAIN_CAM = "admin-stop-main-cam", n.ADMIN_START_MIC = "admin-start-mic", n.ADMIN_STOP_MIC = "admin-stop-mic", n.ADMIN_FORCE_SYNC_MEDIA_STATE = "admin-force-sync-media-state", n.AVAILABLE_SECOND_REMOTE_STREAM = "availableSecondRemoteStream", n.NOT_AVAILABLE_SECOND_REMOTE_STREAM = "notAvailableSecondRemoteStream", n.MUST_STOP_PRESENTATION = "mustStopPresentation", n.NEW_DTMF = "newDTMF", n))(T || {});
343
+ const j = [
341
344
  "participation:accepting-word-request",
342
345
  "participation:cancelling-word-request",
343
346
  "participant:move-request-to-stream",
@@ -351,6 +354,7 @@ const q = [
351
354
  "participant:removed-from-list-moderators",
352
355
  "participant:move-request-to-spectators",
353
356
  "participant:move-request-to-participants",
357
+ "participant:move-request-to-spectators-over-sfu",
354
358
  "channels",
355
359
  "enterRoom",
356
360
  "shareState",
@@ -366,8 +370,8 @@ const q = [
366
370
  "mustStopPresentation",
367
371
  "newDTMF"
368
372
  ];
369
- var A = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(A || {});
370
- class le {
373
+ var R = /* @__PURE__ */ ((n) => (n.CHANNELS = "channels", n.WEBCAST_STARTED = "WebcastStarted", n.WEBCAST_STOPPED = "WebcastStopped", n.ACCOUNT_CHANGED = "accountChanged", n.ACCOUNT_DELETED = "accountDeleted", n.ADDED_TO_LIST_MODERATORS = "addedToListModerators", n.REMOVED_FROM_LIST_MODERATORS = "removedFromListModerators", n.ACCEPTING_WORD_REQUEST = "ParticipationRequestAccepted", n.CANCELLING_WORD_REQUEST = "ParticipationRequestRejected", n.MOVE_REQUEST_TO_STREAM = "ParticipantMovedToWebcast", n.CONFERENCE_PARTICIPANT_TOKEN_ISSUED = "ConferenceParticipantTokenIssued", n))(R || {});
374
+ class me {
371
375
  events;
372
376
  connectionManager;
373
377
  callManager;
@@ -375,7 +379,7 @@ class le {
375
379
  connectionManager: e,
376
380
  callManager: t
377
381
  }) {
378
- this.connectionManager = e, this.callManager = t, this.events = new O(q), this.subscribe();
382
+ this.connectionManager = e, this.callManager = t, this.events = new f(j), this.subscribe();
379
383
  }
380
384
  async waitChannels() {
381
385
  return this.wait(T.CHANNELS);
@@ -392,7 +396,7 @@ class le {
392
396
  s(r);
393
397
  }
394
398
  i && (this.callManager.once("newDTMF", ({ originator: r }) => {
395
- r === U.LOCAL && t();
399
+ r === $.LOCAL && t();
396
400
  }), i.sendDTMF(e, {
397
401
  duration: 120,
398
402
  interToneGap: 600
@@ -404,7 +408,7 @@ class le {
404
408
  i,
405
409
  r
406
410
  ];
407
- return s.sendInfo(_.CHANNELS, void 0, { extraHeaders: a });
411
+ return s.sendInfo(I.CHANNELS, void 0, { extraHeaders: a });
408
412
  }
409
413
  async sendMediaState({ cam: e, mic: t }, s = {}) {
410
414
  const i = this.getEstablishedRTCSessionProtected(), r = `${h.MEDIA_STATE}: currentstate`, a = `${h.MAIN_CAM_STATE}: ${Number(e)}`, o = `${h.MIC_STATE}: ${Number(t)}`, c = [
@@ -412,7 +416,7 @@ class le {
412
416
  a,
413
417
  o
414
418
  ];
415
- return i.sendInfo(_.MEDIA_STATE, void 0, {
419
+ return i.sendInfo(I.MEDIA_STATE, void 0, {
416
420
  noTerminateWhenError: !0,
417
421
  ...s,
418
422
  extraHeaders: c
@@ -420,7 +424,7 @@ class le {
420
424
  }
421
425
  async sendRefusalToTurnOn(e, t = {}) {
422
426
  const s = this.getEstablishedRTCSessionProtected(), a = e === "mic" ? 0 : 1, c = [`${h.MEDIA_TYPE}: ${a}`];
423
- return s.sendInfo(_.REFUSAL, void 0, {
427
+ return s.sendInfo(I.REFUSAL, void 0, {
424
428
  noTerminateWhenError: !0,
425
429
  ...t,
426
430
  extraHeaders: c
@@ -433,38 +437,38 @@ class le {
433
437
  return this.sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
434
438
  }
435
439
  async sendMustStopPresentationP2P() {
436
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
440
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
437
441
  extraHeaders: [h.MUST_STOP_PRESENTATION_P2P]
438
442
  });
439
443
  }
440
444
  async sendStoppedPresentationP2P() {
441
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
445
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
442
446
  extraHeaders: [h.STOP_PRESENTATION_P2P]
443
447
  });
444
448
  }
445
449
  async sendStoppedPresentation() {
446
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
450
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
447
451
  extraHeaders: [h.STOP_PRESENTATION]
448
452
  });
449
453
  }
450
454
  async askPermissionToStartPresentationP2P() {
451
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
455
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
452
456
  extraHeaders: [h.START_PRESENTATION_P2P]
453
457
  });
454
458
  }
455
459
  async askPermissionToStartPresentation() {
456
- await this.getEstablishedRTCSessionProtected().sendInfo(_.SHARE_STATE, void 0, {
460
+ await this.getEstablishedRTCSessionProtected().sendInfo(I.SHARE_STATE, void 0, {
457
461
  extraHeaders: [h.START_PRESENTATION]
458
462
  });
459
463
  }
460
464
  async askPermissionToEnableCam(e = {}) {
461
465
  const t = this.getEstablishedRTCSessionProtected(), s = [h.ENABLE_MAIN_CAM];
462
- return t.sendInfo(_.MAIN_CAM, void 0, {
466
+ return t.sendInfo(I.MAIN_CAM, void 0, {
463
467
  noTerminateWhenError: !0,
464
468
  ...e,
465
469
  extraHeaders: s
466
470
  }).catch((i) => {
467
- if (Ee(i))
471
+ if (Pe(i))
468
472
  throw i;
469
473
  });
470
474
  }
@@ -509,100 +513,100 @@ class le {
509
513
  this.handleNotify(s);
510
514
  }
511
515
  } catch (t) {
512
- m("error parse notify", t);
516
+ O("error parse notify", t);
513
517
  }
514
518
  };
515
519
  handleNotify = (e) => {
516
520
  switch (e.cmd) {
517
- case A.CHANNELS: {
521
+ case R.CHANNELS: {
518
522
  const t = e;
519
523
  this.triggerChannelsNotify(t);
520
524
  break;
521
525
  }
522
- case A.WEBCAST_STARTED: {
526
+ case R.WEBCAST_STARTED: {
523
527
  const t = e;
524
528
  this.triggerWebcastStartedNotify(t);
525
529
  break;
526
530
  }
527
- case A.WEBCAST_STOPPED: {
531
+ case R.WEBCAST_STOPPED: {
528
532
  const t = e;
529
533
  this.triggerWebcastStoppedNotify(t);
530
534
  break;
531
535
  }
532
- case A.ADDED_TO_LIST_MODERATORS: {
536
+ case R.ADDED_TO_LIST_MODERATORS: {
533
537
  const t = e;
534
538
  this.triggerAddedToListModeratorsNotify(t);
535
539
  break;
536
540
  }
537
- case A.REMOVED_FROM_LIST_MODERATORS: {
541
+ case R.REMOVED_FROM_LIST_MODERATORS: {
538
542
  const t = e;
539
543
  this.triggerRemovedFromListModeratorsNotify(t);
540
544
  break;
541
545
  }
542
- case A.ACCEPTING_WORD_REQUEST: {
546
+ case R.ACCEPTING_WORD_REQUEST: {
543
547
  const t = e;
544
548
  this.triggerParticipationAcceptingWordRequest(t);
545
549
  break;
546
550
  }
547
- case A.CANCELLING_WORD_REQUEST: {
551
+ case R.CANCELLING_WORD_REQUEST: {
548
552
  const t = e;
549
553
  this.triggerParticipationCancellingWordRequest(t);
550
554
  break;
551
555
  }
552
- case A.MOVE_REQUEST_TO_STREAM: {
556
+ case R.MOVE_REQUEST_TO_STREAM: {
553
557
  const t = e;
554
558
  this.triggerParticipantMoveRequestToStream(t);
555
559
  break;
556
560
  }
557
- case A.ACCOUNT_CHANGED: {
561
+ case R.ACCOUNT_CHANGED: {
558
562
  this.triggerAccountChangedNotify();
559
563
  break;
560
564
  }
561
- case A.ACCOUNT_DELETED: {
565
+ case R.ACCOUNT_DELETED: {
562
566
  this.triggerAccountDeletedNotify();
563
567
  break;
564
568
  }
565
- case A.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
569
+ case R.CONFERENCE_PARTICIPANT_TOKEN_ISSUED: {
566
570
  const t = e;
567
571
  this.triggerConferenceParticipantTokenIssued(t);
568
572
  break;
569
573
  }
570
574
  default:
571
- m("unknown cmd", e);
575
+ O("unknown cmd", e);
572
576
  }
573
577
  };
574
578
  handleNewInfo = (e) => {
575
579
  const { originator: t } = e;
576
- if (t !== U.REMOTE)
580
+ if (t !== $.REMOTE)
577
581
  return;
578
582
  const { request: s } = e, i = s.getHeader(h.CONTENT_TYPE);
579
583
  if (i !== void 0)
580
584
  switch (i) {
581
- case M.ENTER_ROOM: {
585
+ case P.ENTER_ROOM: {
582
586
  this.triggerEnterRoom(s), this.maybeTriggerChannels(s);
583
587
  break;
584
588
  }
585
- case M.NOTIFY: {
589
+ case P.NOTIFY: {
586
590
  this.maybeHandleNotify(s);
587
591
  break;
588
592
  }
589
- case M.SHARE_STATE: {
593
+ case P.SHARE_STATE: {
590
594
  this.triggerShareState(s);
591
595
  break;
592
596
  }
593
- case M.MAIN_CAM: {
597
+ case P.MAIN_CAM: {
594
598
  this.triggerMainCamControl(s);
595
599
  break;
596
600
  }
597
- case M.MIC: {
601
+ case P.MIC: {
598
602
  this.triggerMicControl(s);
599
603
  break;
600
604
  }
601
- case M.USE_LICENSE: {
605
+ case P.USE_LICENSE: {
602
606
  this.triggerUseLicense(s);
603
607
  break;
604
608
  }
605
- case M.PARTICIPANT_STATE: {
609
+ case P.PARTICIPANT_STATE: {
606
610
  this.maybeTriggerParticipantMoveRequest(s);
607
611
  break;
608
612
  }
@@ -716,15 +720,15 @@ class le {
716
720
  const t = e.getHeader(h.CONTENT_SHARE_STATE);
717
721
  if (t !== void 0)
718
722
  switch (t) {
719
- case y.AVAILABLE_SECOND_REMOTE_STREAM: {
723
+ case L.AVAILABLE_SECOND_REMOTE_STREAM: {
720
724
  this.events.trigger(T.AVAILABLE_SECOND_REMOTE_STREAM, void 0);
721
725
  break;
722
726
  }
723
- case y.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
727
+ case L.NOT_AVAILABLE_SECOND_REMOTE_STREAM: {
724
728
  this.events.trigger(T.NOT_AVAILABLE_SECOND_REMOTE_STREAM, void 0);
725
729
  break;
726
730
  }
727
- case y.MUST_STOP_PRESENTATION: {
731
+ case L.MUST_STOP_PRESENTATION: {
728
732
  this.events.trigger(T.MUST_STOP_PRESENTATION, void 0);
729
733
  break;
730
734
  }
@@ -732,19 +736,19 @@ class le {
732
736
  };
733
737
  maybeTriggerParticipantMoveRequest = (e) => {
734
738
  const t = e.getHeader(h.CONTENT_PARTICIPANT_STATE);
735
- t === w.SPECTATOR && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === w.PARTICIPANT && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0);
739
+ t === F.SPECTATOR && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS, void 0), t === F.PARTICIPANT && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_PARTICIPANTS, void 0), t === F.SPECTATOR_OVER_SFU && this.events.trigger(T.PARTICIPANT_MOVE_REQUEST_TO_SPECTATORS_OVER_SFU, void 0);
736
740
  };
737
741
  triggerMainCamControl = (e) => {
738
- const t = e.getHeader(h.MAIN_CAM), s = e.getHeader(h.MEDIA_SYNC), i = s === F.ADMIN_SYNC_FORCED;
739
- if (t === f.ADMIN_START_MAIN_CAM) {
742
+ const t = e.getHeader(h.MAIN_CAM), s = e.getHeader(h.MEDIA_SYNC), i = s === W.ADMIN_SYNC_FORCED;
743
+ if (t === y.ADMIN_START_MAIN_CAM) {
740
744
  this.events.trigger(T.ADMIN_START_MAIN_CAM, { isSyncForced: i });
741
745
  return;
742
746
  }
743
- if (t === f.ADMIN_STOP_MAIN_CAM) {
747
+ if (t === y.ADMIN_STOP_MAIN_CAM) {
744
748
  this.events.trigger(T.ADMIN_STOP_MAIN_CAM, { isSyncForced: i });
745
749
  return;
746
750
  }
747
- (t === f.RESUME_MAIN_CAM || t === f.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(T.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
751
+ (t === y.RESUME_MAIN_CAM || t === y.PAUSE_MAIN_CAM) && s !== void 0 && this.events.trigger(T.ADMIN_FORCE_SYNC_MEDIA_STATE, { isSyncForced: i });
748
752
  const r = e.getHeader(h.MAIN_CAM_RESOLUTION);
749
753
  this.events.trigger(T.MAIN_CAM_CONTROL, {
750
754
  mainCam: t,
@@ -752,23 +756,23 @@ class le {
752
756
  });
753
757
  };
754
758
  triggerMicControl = (e) => {
755
- const t = e.getHeader(h.MIC), i = e.getHeader(h.MEDIA_SYNC) === F.ADMIN_SYNC_FORCED;
756
- t === L.ADMIN_START_MIC ? this.events.trigger(T.ADMIN_START_MIC, { isSyncForced: i }) : t === L.ADMIN_STOP_MIC && this.events.trigger(T.ADMIN_STOP_MIC, { isSyncForced: i });
759
+ const t = e.getHeader(h.MIC), i = e.getHeader(h.MEDIA_SYNC) === W.ADMIN_SYNC_FORCED;
760
+ t === k.ADMIN_START_MIC ? this.events.trigger(T.ADMIN_START_MIC, { isSyncForced: i }) : t === k.ADMIN_STOP_MIC && this.events.trigger(T.ADMIN_STOP_MIC, { isSyncForced: i });
757
761
  };
758
762
  triggerUseLicense = (e) => {
759
763
  const t = e.getHeader(h.CONTENT_USE_LICENSE);
760
764
  this.events.trigger(T.USE_LICENSE, t);
761
765
  };
762
766
  }
763
- var R = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(R || {});
764
- const Y = [
767
+ var M = /* @__PURE__ */ ((n) => (n.START_PRESENTATION = "presentation:start", n.STARTED_PRESENTATION = "presentation:started", n.END_PRESENTATION = "presentation:end", n.ENDED_PRESENTATION = "presentation:ended", n.FAILED_PRESENTATION = "presentation:failed", n))(M || {});
768
+ const K = [
765
769
  "presentation:start",
766
770
  "presentation:started",
767
771
  "presentation:end",
768
772
  "presentation:ended",
769
773
  "presentation:failed"
770
- ], Ce = 1, Be = (n) => K(n);
771
- class Ne {
774
+ ], fe = 1, St = (n) => ce(n);
775
+ class De {
772
776
  events;
773
777
  promisePendingStartPresentation;
774
778
  promisePendingStopPresentation;
@@ -776,7 +780,7 @@ class Ne {
776
780
  cancelableSendPresentationWithRepeatedCalls;
777
781
  callManager;
778
782
  constructor({ callManager: e }) {
779
- this.callManager = e, this.events = new O(Y), this.subscribe();
783
+ this.callManager = e, this.events = new f(K), this.subscribe();
780
784
  }
781
785
  get isPendingPresentation() {
782
786
  return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
@@ -811,8 +815,8 @@ class Ne {
811
815
  let s = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
812
816
  const i = this.callManager.getEstablishedRTCSession();
813
817
  return i && t ? s = e().then(async () => i.stopPresentation(t)).catch((r) => {
814
- throw this.events.trigger(R.FAILED_PRESENTATION, r), r;
815
- }) : t && this.events.trigger(R.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
818
+ throw this.events.trigger(M.FAILED_PRESENTATION, r), r;
819
+ }) : t && this.events.trigger(M.ENDED_PRESENTATION, t), this.promisePendingStopPresentation = s, s.finally(() => {
816
820
  this.resetPresentation();
817
821
  });
818
822
  }
@@ -857,15 +861,15 @@ class Ne {
857
861
  }
858
862
  subscribe() {
859
863
  this.callManager.on("presentation:start", (e) => {
860
- this.events.trigger(R.START_PRESENTATION, e);
864
+ this.events.trigger(M.START_PRESENTATION, e);
861
865
  }), this.callManager.on("presentation:started", (e) => {
862
- this.events.trigger(R.STARTED_PRESENTATION, e);
866
+ this.events.trigger(M.STARTED_PRESENTATION, e);
863
867
  }), this.callManager.on("presentation:end", (e) => {
864
- this.events.trigger(R.END_PRESENTATION, e);
868
+ this.events.trigger(M.END_PRESENTATION, e);
865
869
  }), this.callManager.on("presentation:ended", (e) => {
866
- this.events.trigger(R.ENDED_PRESENTATION, e);
870
+ this.events.trigger(M.ENDED_PRESENTATION, e);
867
871
  }), this.callManager.on("presentation:failed", (e) => {
868
- this.events.trigger(R.FAILED_PRESENTATION, e);
872
+ this.events.trigger(M.FAILED_PRESENTATION, e);
869
873
  }), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
870
874
  }
871
875
  async sendPresentationWithDuplicatedCalls(e, {
@@ -873,7 +877,7 @@ class Ne {
873
877
  stream: s,
874
878
  presentationOptions: i,
875
879
  options: r = {
876
- callLimit: Ce
880
+ callLimit: fe
877
881
  }
878
882
  }) {
879
883
  const a = async () => this.sendPresentation(
@@ -882,7 +886,7 @@ class Ne {
882
886
  s,
883
887
  i
884
888
  ), o = () => !!this.streamPresentationCurrent;
885
- return this.cancelableSendPresentationWithRepeatedCalls = V({
889
+ return this.cancelableSendPresentationWithRepeatedCalls = Y({
886
890
  targetFunction: a,
887
891
  isComplete: o,
888
892
  isRejectAsValid: !0,
@@ -897,15 +901,15 @@ class Ne {
897
901
  sendEncodings: a,
898
902
  onAddedTransceiver: o
899
903
  }) {
900
- const c = v(s, { contentHint: r });
904
+ const c = w(s, { contentHint: r });
901
905
  if (c === void 0)
902
906
  throw new Error("No streamPresentationTarget");
903
907
  this.streamPresentationCurrent = c;
904
908
  const g = e().then(async () => t.startPresentation(c, i, {
905
909
  sendEncodings: a,
906
910
  onAddedTransceiver: o
907
- })).then(() => s).catch((d) => {
908
- throw this.removeStreamPresentationCurrent(), this.events.trigger(R.FAILED_PRESENTATION, d), d;
911
+ })).then(() => s).catch((E) => {
912
+ throw this.removeStreamPresentationCurrent(), this.events.trigger(M.FAILED_PRESENTATION, E), E;
909
913
  });
910
914
  return this.promisePendingStartPresentation = g, g.finally(() => {
911
915
  this.promisePendingStartPresentation = void 0;
@@ -930,7 +934,7 @@ class Ne {
930
934
  delete this.streamPresentationCurrent;
931
935
  }
932
936
  }
933
- class ue {
937
+ class ve {
934
938
  data = {};
935
939
  getUa;
936
940
  constructor(e) {
@@ -1003,8 +1007,8 @@ class ue {
1003
1007
  return this.data.register === !0;
1004
1008
  }
1005
1009
  }
1006
- var u = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n))(u || {});
1007
- const z = [
1010
+ var A = /* @__PURE__ */ ((n) => (n.CONNECTING = "connecting", n.CONNECTED = "connected", n.DISCONNECTED = "disconnected", n.NEW_RTC_SESSION = "newRTCSession", n.REGISTERED = "registered", n.UNREGISTERED = "unregistered", n.REGISTRATION_FAILED = "registrationFailed", n.NEW_MESSAGE = "newMessage", n.SIP_EVENT = "sipEvent", n))(A || {});
1011
+ const Z = [
1008
1012
  "connecting",
1009
1013
  "connected",
1010
1014
  "disconnected",
@@ -1014,8 +1018,8 @@ const z = [
1014
1018
  "registrationFailed",
1015
1019
  "newMessage",
1016
1020
  "sipEvent"
1017
- ], Q = [...z], Ae = 3;
1018
- class _e {
1021
+ ], ee = [...Z], ye = 3;
1022
+ class Ue {
1019
1023
  cancelableConnectWithRepeatedCalls;
1020
1024
  JsSIP;
1021
1025
  events;
@@ -1041,29 +1045,29 @@ class _e {
1041
1045
  }
1042
1046
  let r = !1;
1043
1047
  const a = this.getConnectionConfiguration();
1044
- e !== void 0 && e !== a.displayName && (r = i.set("display_name", B(e)), this.updateConnectionConfiguration("displayName", e));
1048
+ e !== void 0 && e !== a.displayName && (r = i.set("display_name", X(e)), this.updateConnectionConfiguration("displayName", e));
1045
1049
  const o = r;
1046
1050
  o ? t(o) : s(new Error("nothing changed"));
1047
1051
  });
1048
1052
  disconnect = async () => {
1049
1053
  const e = new Promise((s) => {
1050
- this.events.once(u.DISCONNECTED, () => {
1054
+ this.events.once(A.DISCONNECTED, () => {
1051
1055
  s();
1052
1056
  });
1053
1057
  }), t = this.getUa();
1054
- return t ? t.stop() : this.events.trigger(u.DISCONNECTED, void 0), e.finally(() => {
1058
+ return t ? t.stop() : this.events.trigger(A.DISCONNECTED, void 0), e.finally(() => {
1055
1059
  this.setUa(void 0), this.stateMachine.reset();
1056
1060
  });
1057
1061
  };
1058
1062
  cancelRequests() {
1059
1063
  this.cancelConnectWithRepeatedCalls();
1060
1064
  }
1061
- connectWithDuplicatedCalls = async (e, { callLimit: t = Ae } = {}) => {
1065
+ connectWithDuplicatedCalls = async (e, { callLimit: t = ye } = {}) => {
1062
1066
  const s = async () => this.connectInner(e), i = (r) => {
1063
- const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = r != null && !de(r);
1067
+ const c = this.getUa()?.isConnected() === !0 && this.hasEqualConnectionConfiguration(e), g = r != null && !pe(r);
1064
1068
  return c || g;
1065
1069
  };
1066
- return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = V({
1070
+ return this.stateMachine.startConnect(), this.cancelableConnectWithRepeatedCalls = Y({
1067
1071
  targetFunction: s,
1068
1072
  isComplete: i,
1069
1073
  callLimit: t,
@@ -1090,15 +1094,15 @@ class _e {
1090
1094
  registerExpires: o,
1091
1095
  connectionRecoveryMinInterval: c,
1092
1096
  connectionRecoveryMaxInterval: g,
1093
- userAgent: d,
1094
- displayName: l = "",
1095
- register: E = !1,
1097
+ userAgent: E,
1098
+ displayName: u = "",
1099
+ register: d = !1,
1096
1100
  extraHeaders: S = []
1097
1101
  }) => {
1098
1102
  this.stateMachine.startInitUa(), this.setConnectionConfiguration({
1099
1103
  sipServerUrl: s,
1100
- displayName: l,
1101
- register: E,
1104
+ displayName: u,
1105
+ register: d,
1102
1106
  user: e,
1103
1107
  password: t
1104
1108
  }), this.getUa() && await this.disconnect();
@@ -1108,13 +1112,13 @@ class _e {
1108
1112
  password: t,
1109
1113
  sipServerUrl: s,
1110
1114
  sipWebSocketServerURL: i,
1111
- displayName: l,
1112
- register: E,
1115
+ displayName: u,
1116
+ register: d,
1113
1117
  sessionTimers: a,
1114
1118
  registerExpires: o,
1115
1119
  connectionRecoveryMinInterval: c,
1116
1120
  connectionRecoveryMaxInterval: g,
1117
- userAgent: d,
1121
+ userAgent: E,
1118
1122
  remoteAddress: r,
1119
1123
  extraHeaders: S
1120
1124
  },
@@ -1132,11 +1136,11 @@ class _e {
1132
1136
  i = ((c, g) => {
1133
1137
  if (this.getConnectionConfiguration().register === !0)
1134
1138
  return this.registrationManager.subscribeToStartEvents(c, g);
1135
- const l = u.CONNECTED, E = [u.DISCONNECTED];
1136
- return this.events.on(l, c), E.forEach((S) => {
1139
+ const u = A.CONNECTED, d = [A.DISCONNECTED];
1140
+ return this.events.on(u, c), d.forEach((S) => {
1137
1141
  this.events.on(S, g);
1138
1142
  }), () => {
1139
- this.events.off(l, c), E.forEach((S) => {
1143
+ this.events.off(u, c), d.forEach((S) => {
1140
1144
  this.events.off(S, g);
1141
1145
  });
1142
1146
  };
@@ -1150,18 +1154,18 @@ class _e {
1150
1154
  this.cancelableConnectWithRepeatedCalls?.cancel();
1151
1155
  }
1152
1156
  }
1153
- var X = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(X || {});
1154
- const Ie = j({
1157
+ var te = /* @__PURE__ */ ((n) => (n.START_CONNECT = "START_CONNECT", n.START_INIT_UA = "START_INIT_UA", n.UA_CONNECTED = "UA_CONNECTED", n.UA_REGISTERED = "UA_REGISTERED", n.UA_UNREGISTERED = "UA_UNREGISTERED", n.UA_DISCONNECTED = "UA_DISCONNECTED", n.CONNECTION_FAILED = "CONNECTION_FAILED", n.RESET = "RESET", n))(te || {});
1158
+ const be = ge({
1155
1159
  types: {
1156
1160
  context: {},
1157
1161
  events: {}
1158
1162
  },
1159
1163
  actions: {
1160
1164
  logTransition: (n, e) => {
1161
- m(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1165
+ O(`State transition: ${e.from} -> ${e.to} (${e.event})`);
1162
1166
  },
1163
1167
  logStateChange: (n, e) => {
1164
- m("ConnectionStateMachine state changed", e.state);
1168
+ O("ConnectionStateMachine state changed", e.state);
1165
1169
  }
1166
1170
  }
1167
1171
  }).createMachine({
@@ -1465,14 +1469,14 @@ const Ie = j({
1465
1469
  }
1466
1470
  }
1467
1471
  });
1468
- class Re {
1472
+ class we {
1469
1473
  actor;
1470
1474
  stateChangeListeners = /* @__PURE__ */ new Set();
1471
1475
  events;
1472
1476
  unsubscribeFromEvents;
1473
1477
  actorSubscription;
1474
1478
  constructor(e) {
1475
- this.events = e, this.actor = Z(Ie), this.actorSubscription = this.actor.subscribe((t) => {
1479
+ this.events = e, this.actor = de(be), this.actorSubscription = this.actor.subscribe((t) => {
1476
1480
  const s = t.value;
1477
1481
  this.stateChangeListeners.forEach((i) => {
1478
1482
  i(s);
@@ -1558,7 +1562,7 @@ class Re {
1558
1562
  return this.actor.getSnapshot().can({ type: e });
1559
1563
  }
1560
1564
  getValidEvents() {
1561
- return Object.values(X).filter((e) => this.canTransition(e));
1565
+ return Object.values(te).filter((e) => this.canTransition(e));
1562
1566
  }
1563
1567
  hasState(e) {
1564
1568
  return this.actor.getSnapshot().matches(e);
@@ -1566,7 +1570,7 @@ class Re {
1566
1570
  sendEvent(e) {
1567
1571
  const t = this.actor.getSnapshot(), s = { type: e };
1568
1572
  if (!t.can(s)) {
1569
- m(
1573
+ O(
1570
1574
  `Invalid transition: ${s.type} from ${this.state}. Event cannot be processed in current state.`
1571
1575
  );
1572
1576
  return;
@@ -1627,7 +1631,7 @@ class Re {
1627
1631
  };
1628
1632
  }
1629
1633
  }
1630
- class Me {
1634
+ class Le {
1631
1635
  events;
1632
1636
  getUaProtected;
1633
1637
  constructor(e) {
@@ -1636,25 +1640,25 @@ class Me {
1636
1640
  async register() {
1637
1641
  const e = this.getUaProtected();
1638
1642
  return new Promise((t, s) => {
1639
- e.on(u.REGISTERED, t), e.on(u.REGISTRATION_FAILED, s), e.register();
1643
+ e.on(A.REGISTERED, t), e.on(A.REGISTRATION_FAILED, s), e.register();
1640
1644
  });
1641
1645
  }
1642
1646
  async unregister() {
1643
1647
  const e = this.getUaProtected();
1644
1648
  return new Promise((t) => {
1645
- e.on(u.UNREGISTERED, t), e.unregister();
1649
+ e.on(A.UNREGISTERED, t), e.unregister();
1646
1650
  });
1647
1651
  }
1648
1652
  async tryRegister() {
1649
1653
  try {
1650
1654
  await this.unregister();
1651
1655
  } catch (e) {
1652
- m("tryRegister", e);
1656
+ O("tryRegister", e);
1653
1657
  }
1654
1658
  return this.register();
1655
1659
  }
1656
1660
  subscribeToStartEvents(e, t) {
1657
- const s = u.REGISTERED, i = [u.REGISTRATION_FAILED, u.DISCONNECTED];
1661
+ const s = A.REGISTERED, i = [A.REGISTRATION_FAILED, A.DISCONNECTED];
1658
1662
  return this.events.on(s, e), i.forEach((r) => {
1659
1663
  this.events.on(r, t);
1660
1664
  }), () => {
@@ -1664,7 +1668,7 @@ class Me {
1664
1668
  };
1665
1669
  }
1666
1670
  }
1667
- class pe {
1671
+ class Fe {
1668
1672
  uaFactory;
1669
1673
  getUaProtected;
1670
1674
  constructor(e) {
@@ -1715,25 +1719,25 @@ class pe {
1715
1719
  displayName: t,
1716
1720
  userAgent: e,
1717
1721
  sipServerUrl: s
1718
- }), d = this.uaFactory.createUA({ ...g, remoteAddress: r, extraHeaders: a }), l = () => {
1722
+ }), E = this.uaFactory.createUA({ ...g, remoteAddress: r, extraHeaders: a }), u = () => {
1719
1723
  const S = new Error("Telephony is not available");
1720
1724
  c(S);
1721
1725
  };
1722
- d.once(u.DISCONNECTED, l);
1723
- const E = () => {
1724
- d.removeAllListeners(), d.once(u.DISCONNECTED, () => {
1726
+ E.once(A.DISCONNECTED, u);
1727
+ const d = () => {
1728
+ E.removeAllListeners(), E.once(A.DISCONNECTED, () => {
1725
1729
  o();
1726
- }), d.stop();
1730
+ }), E.stop();
1727
1731
  };
1728
- d.once(u.CONNECTED, E), d.start();
1732
+ E.once(A.CONNECTED, d), E.start();
1729
1733
  });
1730
1734
  }
1731
1735
  }
1732
- const Pe = (n) => {
1736
+ const $e = (n) => {
1733
1737
  const e = [];
1734
1738
  return n !== void 0 && n !== "" && e.push(`X-Vinteo-Remote: ${n}`), e;
1735
1739
  };
1736
- class P {
1740
+ class m {
1737
1741
  JsSIP;
1738
1742
  constructor(e) {
1739
1743
  this.JsSIP = e;
@@ -1758,10 +1762,10 @@ class P {
1758
1762
  throw new Error("user is required for authorized connection");
1759
1763
  }
1760
1764
  static resolveAuthorizationUser(e, t) {
1761
- return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${se()}`;
1765
+ return e && t !== void 0 && t.trim() !== "" ? t.trim() : `${ue()}`;
1762
1766
  }
1763
1767
  static buildExtraHeaders(e, t) {
1764
- const s = e !== void 0 && e !== "" ? Pe(e) : [];
1768
+ const s = e !== void 0 && e !== "" ? $e(e) : [];
1765
1769
  return t === void 0 ? s : [...s, ...t];
1766
1770
  }
1767
1771
  createConfiguration({
@@ -1775,30 +1779,30 @@ class P {
1775
1779
  registerExpires: c = 300,
1776
1780
  // 5 minutes in sec
1777
1781
  connectionRecoveryMinInterval: g = 2,
1778
- connectionRecoveryMaxInterval: d = 6,
1779
- userAgent: l
1782
+ connectionRecoveryMaxInterval: E = 6,
1783
+ userAgent: u
1780
1784
  }) {
1781
- P.validateConfiguration({
1785
+ m.validateConfiguration({
1782
1786
  register: a,
1783
1787
  password: t,
1784
1788
  user: e,
1785
1789
  sipServerUrl: r,
1786
1790
  sipWebSocketServerURL: s
1787
1791
  });
1788
- const E = P.resolveAuthorizationUser(a, e), S = te(r), I = S(E), C = new this.JsSIP.WebSocketInterface(s);
1792
+ const d = m.resolveAuthorizationUser(a, e), S = Se(r), _ = S(d), C = new this.JsSIP.WebSocketInterface(s);
1789
1793
  return {
1790
1794
  configuration: {
1791
1795
  password: t,
1792
1796
  register: a,
1793
- uri: I,
1794
- display_name: B(i),
1795
- user_agent: l,
1797
+ uri: _,
1798
+ display_name: X(i),
1799
+ user_agent: u,
1796
1800
  sdpSemantics: "unified-plan",
1797
1801
  sockets: [C],
1798
1802
  session_timers: o,
1799
1803
  register_expires: c,
1800
1804
  connection_recovery_min_interval: g,
1801
- connection_recovery_max_interval: d
1805
+ connection_recovery_max_interval: E
1802
1806
  },
1803
1807
  helpers: {
1804
1808
  socket: C,
@@ -1807,7 +1811,7 @@ class P {
1807
1811
  };
1808
1812
  }
1809
1813
  createUA({ remoteAddress: e, extraHeaders: t, ...s }) {
1810
- const i = new this.JsSIP.UA(s), r = P.buildExtraHeaders(e, t);
1814
+ const i = new this.JsSIP.UA(s), r = m.buildExtraHeaders(e, t);
1811
1815
  return r.length > 0 && i.registrator().setExtraHeaders(r), i;
1812
1816
  }
1813
1817
  /**
@@ -1820,12 +1824,12 @@ class P {
1820
1824
  extraHeaders: e.extraHeaders
1821
1825
  });
1822
1826
  return t.eachTriggers((a, o) => {
1823
- const c = z.find((g) => g === o);
1827
+ const c = Z.find((g) => g === o);
1824
1828
  c && r.on(c, a);
1825
1829
  }), { ua: r, helpers: i };
1826
1830
  }
1827
1831
  }
1828
- class me {
1832
+ class ke {
1829
1833
  events;
1830
1834
  ua;
1831
1835
  socket;
@@ -1837,15 +1841,15 @@ class me {
1837
1841
  configurationManager;
1838
1842
  JsSIP;
1839
1843
  constructor({ JsSIP: e }) {
1840
- this.JsSIP = e, this.events = new O(Q), this.uaFactory = new P(e), this.registrationManager = new Me({
1844
+ this.JsSIP = e, this.events = new f(ee), this.uaFactory = new m(e), this.registrationManager = new Le({
1841
1845
  events: this.events,
1842
1846
  getUaProtected: this.getUaProtected
1843
- }), this.stateMachine = new Re(this.events), this.configurationManager = new ue({
1847
+ }), this.stateMachine = new we(this.events), this.configurationManager = new ve({
1844
1848
  getUa: this.getUa
1845
- }), this.sipOperations = new pe({
1849
+ }), this.sipOperations = new Fe({
1846
1850
  uaFactory: this.uaFactory,
1847
1851
  getUaProtected: this.getUaProtected
1848
- }), this.connectionFlow = new _e({
1852
+ }), this.connectionFlow = new Ue({
1849
1853
  JsSIP: this.JsSIP,
1850
1854
  events: this.events,
1851
1855
  uaFactory: this.uaFactory,
@@ -1883,7 +1887,7 @@ class me {
1883
1887
  return this.stateMachine.state;
1884
1888
  }
1885
1889
  get isRegistered() {
1886
- return P.isRegisteredUA(this.ua);
1890
+ return m.isRegisteredUA(this.ua);
1887
1891
  }
1888
1892
  get isRegisterConfig() {
1889
1893
  return this.configurationManager.isRegister();
@@ -1927,7 +1931,7 @@ class me {
1927
1931
  destroy() {
1928
1932
  this.stateMachine.destroy();
1929
1933
  }
1930
- // eslint-disable-next-line class-methods-use-this
1934
+ // eslint-disable-next-line @typescript-eslint/class-methods-use-this
1931
1935
  getSipServerUrl = (e) => e;
1932
1936
  getUaProtected = () => {
1933
1937
  if (!this.ua)
@@ -1936,19 +1940,19 @@ class me {
1936
1940
  };
1937
1941
  getUa = () => this.ua;
1938
1942
  }
1939
- var D = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(D || {}), $ = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))($ || {});
1940
- const J = [
1943
+ var U = /* @__PURE__ */ ((n) => (n.INCOMING_CALL = "incomingCall", n.DECLINED_INCOMING_CALL = "declinedIncomingCall", n.TERMINATED_INCOMING_CALL = "terminatedIncomingCall", n.FAILED_INCOMING_CALL = "failedIncomingCall", n))(U || {}), V = /* @__PURE__ */ ((n) => (n.LOCAL = "local", n.REMOTE = "remote", n.SYSTEM = "system", n))(V || {});
1944
+ const ne = [
1941
1945
  "incomingCall",
1942
1946
  "declinedIncomingCall",
1943
1947
  "terminatedIncomingCall",
1944
1948
  "failedIncomingCall"
1945
- ], Oe = 486, fe = 487;
1946
- class De {
1949
+ ], We = 486, Ve = 487;
1950
+ class Be {
1947
1951
  events;
1948
1952
  incomingRTCSession;
1949
1953
  connectionManager;
1950
1954
  constructor(e) {
1951
- this.connectionManager = e, this.events = new O(J), this.start();
1955
+ this.connectionManager = e, this.events = new f(ne), this.start();
1952
1956
  }
1953
1957
  get remoteCallerData() {
1954
1958
  return {
@@ -1978,19 +1982,19 @@ class De {
1978
1982
  return this.removeIncomingSession(), e;
1979
1983
  };
1980
1984
  async declineToIncomingCall({
1981
- statusCode: e = fe
1985
+ statusCode: e = Ve
1982
1986
  } = {}) {
1983
1987
  return new Promise((t, s) => {
1984
1988
  try {
1985
1989
  const i = this.getIncomingRTCSession(), r = this.remoteCallerData;
1986
- this.removeIncomingSession(), this.events.trigger(D.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
1990
+ this.removeIncomingSession(), this.events.trigger(U.DECLINED_INCOMING_CALL, r), i.terminate({ status_code: e }), t();
1987
1991
  } catch (i) {
1988
1992
  s(i);
1989
1993
  }
1990
1994
  });
1991
1995
  }
1992
1996
  async busyIncomingCall() {
1993
- return this.declineToIncomingCall({ statusCode: Oe });
1997
+ return this.declineToIncomingCall({ statusCode: We });
1994
1998
  }
1995
1999
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
1996
2000
  on(e, t) {
@@ -2021,40 +2025,311 @@ class De {
2021
2025
  originator: e,
2022
2026
  session: t
2023
2027
  }) => {
2024
- e === $.REMOTE && this.setIncomingSession(t);
2028
+ e === V.REMOTE && this.setIncomingSession(t);
2025
2029
  };
2026
2030
  setIncomingSession(e) {
2027
2031
  this.incomingRTCSession = e;
2028
2032
  const t = this.remoteCallerData;
2029
2033
  e.on("failed", (s) => {
2030
- this.removeIncomingSession(), s.originator === $.LOCAL ? this.events.trigger(D.TERMINATED_INCOMING_CALL, t) : this.events.trigger(D.FAILED_INCOMING_CALL, t);
2031
- }), this.events.trigger(D.INCOMING_CALL, t);
2034
+ this.removeIncomingSession(), s.originator === V.LOCAL ? this.events.trigger(U.TERMINATED_INCOMING_CALL, t) : this.events.trigger(U.FAILED_INCOMING_CALL, t);
2035
+ }), this.events.trigger(U.INCOMING_CALL, t);
2032
2036
  }
2033
2037
  removeIncomingSession() {
2034
2038
  delete this.incomingRTCSession;
2035
2039
  }
2036
2040
  }
2037
- const ve = Q.map((n) => `connection:${n}`), ye = G.map((n) => `call:${n}`), Ue = q.map((n) => `api:${n}`), be = J.map((n) => `incoming-call:${n}`), we = Y.map((n) => `presentation:${n}`), Le = [
2038
- ...ve,
2039
- ...ye,
2040
- ...Ue,
2041
- ...be,
2042
- ...we
2041
+ const v = 1e3;
2042
+ var l = /* @__PURE__ */ ((n) => (n.INBOUND_RTP = "inbound-rtp", n.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", n.MEDIA_SOURCE = "media-source", n.OUTBOUND_RTP = "outbound-rtp", n.REMOTE_INBOUND_RTP = "remote-inbound-rtp", n.CODEC = "codec", n.CANDIDATE_PAIR = "candidate-pair", n.CERTIFICATE = "certificate", n.TRANSPORT = "transport", n.LOCAL_CANDIDATE = "local-candidate", n.REMOTE_CANDIDATE = "remote-candidate", n))(l || {});
2043
+ const se = ["collected"], q = () => "performance" in window ? performance.now() : Date.now(), b = (n) => [...n.keys()].reduce((e, t) => {
2044
+ const s = n.get(t);
2045
+ return s === void 0 ? e : { ...e, [s.type]: s };
2046
+ }, {}), He = (n) => {
2047
+ if (!n)
2048
+ return {
2049
+ outboundRtp: void 0,
2050
+ codec: void 0,
2051
+ mediaSource: void 0,
2052
+ remoteInboundRtp: void 0
2053
+ };
2054
+ const e = b(n);
2055
+ return {
2056
+ outboundRtp: e[l.OUTBOUND_RTP],
2057
+ codec: e[l.CODEC],
2058
+ mediaSource: e[l.MEDIA_SOURCE],
2059
+ remoteInboundRtp: e[l.REMOTE_INBOUND_RTP]
2060
+ };
2061
+ }, G = (n) => {
2062
+ if (!n)
2063
+ return {
2064
+ outboundRtp: void 0,
2065
+ codec: void 0,
2066
+ mediaSource: void 0,
2067
+ remoteInboundRtp: void 0
2068
+ };
2069
+ const e = b(n);
2070
+ return {
2071
+ outboundRtp: e[l.OUTBOUND_RTP],
2072
+ codec: e[l.CODEC],
2073
+ mediaSource: e[l.MEDIA_SOURCE],
2074
+ remoteInboundRtp: e[l.REMOTE_INBOUND_RTP]
2075
+ };
2076
+ }, x = ({
2077
+ videoReceiversStats: n,
2078
+ synchronizationSourcesVideo: e
2079
+ }) => {
2080
+ if (!n)
2081
+ return {
2082
+ inboundRtp: void 0,
2083
+ codec: void 0,
2084
+ synchronizationSources: e
2085
+ };
2086
+ const t = b(n);
2087
+ return {
2088
+ inboundRtp: t[l.INBOUND_RTP],
2089
+ codec: t[l.CODEC],
2090
+ synchronizationSources: e
2091
+ };
2092
+ }, qe = ({
2093
+ audioReceiverStats: n,
2094
+ synchronizationSourcesAudio: e
2095
+ }) => {
2096
+ if (!n)
2097
+ return {
2098
+ inboundRtp: void 0,
2099
+ codec: void 0,
2100
+ remoteOutboundRtp: void 0,
2101
+ synchronizationSources: e
2102
+ };
2103
+ const t = b(n);
2104
+ return {
2105
+ inboundRtp: t[l.INBOUND_RTP],
2106
+ codec: t[l.CODEC],
2107
+ remoteOutboundRtp: t[l.REMOTE_OUTBOUND_RTP],
2108
+ synchronizationSources: e
2109
+ };
2110
+ }, ie = (n) => {
2111
+ if (!n)
2112
+ return {
2113
+ candidatePair: void 0,
2114
+ certificate: void 0,
2115
+ localCandidate: void 0,
2116
+ remoteCandidate: void 0,
2117
+ transport: void 0
2118
+ };
2119
+ const e = b(n);
2120
+ return {
2121
+ candidatePair: e[l.CANDIDATE_PAIR],
2122
+ certificate: e[l.CERTIFICATE],
2123
+ localCandidate: e[l.LOCAL_CANDIDATE],
2124
+ remoteCandidate: e[l.REMOTE_CANDIDATE],
2125
+ transport: e[l.TRANSPORT]
2126
+ };
2127
+ }, Ge = ({
2128
+ audioSenderStats: n,
2129
+ videoSenderFirstStats: e,
2130
+ videoSenderSecondStats: t
2131
+ }) => ({
2132
+ video: G(e),
2133
+ secondVideo: G(t),
2134
+ audio: He(n),
2135
+ additional: ie(
2136
+ n ?? e ?? t
2137
+ )
2138
+ }), xe = ({
2139
+ audioReceiverStats: n,
2140
+ videoReceiverFirstStats: e,
2141
+ videoReceiverSecondStats: t,
2142
+ synchronizationSources: s
2143
+ }) => ({
2144
+ video: x({
2145
+ videoReceiversStats: e,
2146
+ synchronizationSourcesVideo: s.video
2147
+ }),
2148
+ secondVideo: x({
2149
+ videoReceiversStats: t,
2150
+ synchronizationSourcesVideo: s.video
2151
+ }),
2152
+ audio: qe({
2153
+ audioReceiverStats: n,
2154
+ synchronizationSourcesAudio: s.audio
2155
+ }),
2156
+ additional: ie(
2157
+ n ?? e ?? t
2158
+ )
2159
+ }), Ye = ({
2160
+ audioSenderStats: n,
2161
+ videoSenderFirstStats: e,
2162
+ videoSenderSecondStats: t,
2163
+ audioReceiverStats: s,
2164
+ videoReceiverFirstStats: i,
2165
+ videoReceiverSecondStats: r,
2166
+ synchronizationSources: a
2167
+ }) => {
2168
+ const o = Ge({
2169
+ audioSenderStats: n,
2170
+ videoSenderFirstStats: e,
2171
+ videoSenderSecondStats: t
2172
+ }), c = xe({
2173
+ audioReceiverStats: s,
2174
+ videoReceiverFirstStats: i,
2175
+ videoReceiverSecondStats: r,
2176
+ synchronizationSources: a
2177
+ });
2178
+ return {
2179
+ outbound: o,
2180
+ inbound: c
2181
+ };
2182
+ }, ze = async (n) => {
2183
+ const e = "audio", t = "video", s = n.getSenders(), i = s.find((d) => d.track?.kind === e), r = s.filter((d) => d.track?.kind === t), a = n.getReceivers(), o = a.find((d) => d.track.kind === e), c = a.filter((d) => d.track.kind === t), g = {
2184
+ trackIdentifier: o?.track.id,
2185
+ item: o?.getSynchronizationSources()[0]
2186
+ }, E = {
2187
+ trackIdentifier: c[0]?.track.id,
2188
+ item: c[0]?.getSynchronizationSources()[0]
2189
+ }, u = {
2190
+ audio: g,
2191
+ video: E
2192
+ };
2193
+ return Promise.all([
2194
+ i?.getStats(),
2195
+ r[0]?.getStats(),
2196
+ r[1]?.getStats(),
2197
+ o?.getStats(),
2198
+ c[0]?.getStats(),
2199
+ c[1]?.getStats()
2200
+ ]).then((d) => {
2201
+ const [
2202
+ S,
2203
+ _,
2204
+ C,
2205
+ p,
2206
+ D,
2207
+ re
2208
+ ] = d;
2209
+ return {
2210
+ synchronizationSources: u,
2211
+ audioSenderStats: S,
2212
+ videoSenderFirstStats: _,
2213
+ videoSenderSecondStats: C,
2214
+ audioReceiverStats: p,
2215
+ videoReceiverFirstStats: D,
2216
+ videoReceiverSecondStats: re
2217
+ };
2218
+ });
2219
+ }, Qe = (n) => {
2220
+ O(String(n));
2221
+ };
2222
+ class Xe {
2223
+ events;
2224
+ setTimeoutRequest;
2225
+ requesterAllStatistics = new oe(ze);
2226
+ constructor() {
2227
+ this.events = new ae(se), this.setTimeoutRequest = new Te();
2228
+ }
2229
+ get requested() {
2230
+ return this.setTimeoutRequest.requested;
2231
+ }
2232
+ start(e, {
2233
+ interval: t = v,
2234
+ onError: s = Qe
2235
+ } = {}) {
2236
+ const i = this.resolveCollectStatistics(e, {
2237
+ onError: s
2238
+ });
2239
+ this.stop(), this.setTimeoutRequest.request(i, t);
2240
+ }
2241
+ stop() {
2242
+ this.setTimeoutRequest.cancelRequest(), this.requesterAllStatistics.cancelRequest();
2243
+ }
2244
+ on(e, t) {
2245
+ return this.events.on(e, t);
2246
+ }
2247
+ once(e, t) {
2248
+ return this.events.once(e, t);
2249
+ }
2250
+ onceRace(e, t) {
2251
+ return this.events.onceRace(e, t);
2252
+ }
2253
+ async wait(e) {
2254
+ return this.events.wait(e);
2255
+ }
2256
+ off(e, t) {
2257
+ this.events.off(e, t);
2258
+ }
2259
+ resolveCollectStatistics = (e, {
2260
+ onError: t
2261
+ }) => () => {
2262
+ const s = q();
2263
+ this.requesterAllStatistics.request(e).then((i) => {
2264
+ this.events.trigger("collected", Ye(i));
2265
+ const a = q() - s;
2266
+ let o = v;
2267
+ a > 48 ? o = v * 4 : a > 32 ? o = v * 3 : a > 16 && (o = v * 2), this.start(e, {
2268
+ onError: t,
2269
+ interval: o
2270
+ });
2271
+ }).catch((i) => {
2272
+ t && t(i);
2273
+ });
2274
+ };
2275
+ }
2276
+ class Je {
2277
+ statsPeerConnection;
2278
+ callManager;
2279
+ constructor({ callManager: e }) {
2280
+ this.callManager = e, this.statsPeerConnection = new Xe(), this.subscribe();
2281
+ }
2282
+ get events() {
2283
+ return this.statsPeerConnection.events;
2284
+ }
2285
+ on(e, t) {
2286
+ return this.statsPeerConnection.on(e, t);
2287
+ }
2288
+ once(e, t) {
2289
+ return this.statsPeerConnection.once(e, t);
2290
+ }
2291
+ onceRace(e, t) {
2292
+ return this.statsPeerConnection.onceRace(e, t);
2293
+ }
2294
+ async wait(e) {
2295
+ return this.statsPeerConnection.wait(e);
2296
+ }
2297
+ off(e, t) {
2298
+ this.statsPeerConnection.off(e, t);
2299
+ }
2300
+ subscribe() {
2301
+ this.callManager.on("peerconnection:confirmed", this.handleStarted), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
2302
+ }
2303
+ handleStarted = (e) => {
2304
+ this.statsPeerConnection.start(e);
2305
+ };
2306
+ handleEnded = () => {
2307
+ this.statsPeerConnection.stop();
2308
+ };
2309
+ }
2310
+ const je = ee.map((n) => `connection:${n}`), Ke = Q.map((n) => `call:${n}`), Ze = j.map((n) => `api:${n}`), et = ne.map((n) => `incoming-call:${n}`), tt = K.map((n) => `presentation:${n}`), nt = se.map((n) => `stats:${n}`), st = [
2311
+ ...je,
2312
+ ...Ke,
2313
+ ...Ze,
2314
+ ...et,
2315
+ ...tt,
2316
+ ...nt
2043
2317
  ];
2044
- class xe {
2318
+ class lt {
2045
2319
  events;
2046
2320
  connectionManager;
2047
2321
  callManager;
2048
2322
  apiManager;
2049
2323
  incomingCallManager;
2050
2324
  presentationManager;
2325
+ statsManager;
2051
2326
  constructor({ JsSIP: e }) {
2052
- this.events = new O(Le), this.connectionManager = new me({ JsSIP: e }), this.callManager = new ge(), this.apiManager = new le({
2327
+ this.events = new f(st), this.connectionManager = new ke({ JsSIP: e }), this.callManager = new _e(), this.apiManager = new me({
2053
2328
  connectionManager: this.connectionManager,
2054
2329
  callManager: this.callManager
2055
- }), this.incomingCallManager = new De(this.connectionManager), this.presentationManager = new Ne({
2330
+ }), this.incomingCallManager = new Be(this.connectionManager), this.presentationManager = new De({
2056
2331
  callManager: this.callManager
2057
- }), this.subscribe();
2332
+ }), this.statsManager = new Je({ callManager: this.callManager }), this.subscribe();
2058
2333
  }
2059
2334
  get requestedConnection() {
2060
2335
  return this.connectionManager.requested;
@@ -2155,7 +2430,7 @@ class xe {
2155
2430
  async stopPresentation(e = {}) {
2156
2431
  const { isP2P: t } = e;
2157
2432
  return this.presentationManager.stopPresentation(async () => {
2158
- t === !0 ? await this.apiManager.sendMustStopPresentationP2P() : await this.apiManager.sendStoppedPresentation();
2433
+ await (t === !0 ? this.apiManager.sendMustStopPresentationP2P() : this.apiManager.sendStoppedPresentation());
2159
2434
  });
2160
2435
  }
2161
2436
  async updatePresentation(e, t = {}) {
@@ -2231,17 +2506,24 @@ class xe {
2231
2506
  this.presentationManager.on(t, (s) => {
2232
2507
  this.events.trigger(`presentation:${t}`, s);
2233
2508
  });
2509
+ }), this.statsManager.events.eachTriggers((e, t) => {
2510
+ this.statsManager.on(t, (s) => {
2511
+ this.events.trigger(`stats:${t}`, s);
2512
+ });
2234
2513
  });
2235
2514
  }
2236
2515
  }
2237
2516
  export {
2238
- x as E,
2239
- U as O,
2240
- xe as S,
2241
- f as a,
2242
- Se as b,
2243
- Ge as d,
2244
- He as e,
2245
- Be as h,
2246
- m as l
2517
+ J as E,
2518
+ $ as O,
2519
+ lt as S,
2520
+ y as a,
2521
+ Oe as b,
2522
+ l as c,
2523
+ Et as d,
2524
+ ht as e,
2525
+ Xe as f,
2526
+ St as h,
2527
+ O as l,
2528
+ w as p
2247
2529
  };