sip-connector 14.1.0 → 14.1.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 (98) hide show
  1. package/dist/SipConnector-BHvTGgmw.js +1352 -0
  2. package/dist/SipConnector-ChW25Tx9.cjs +1 -0
  3. package/dist/doMock.cjs +1 -1
  4. package/dist/doMock.js +328 -327
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +280 -270
  7. package/dist/src/SipConnector.d.ts +235 -0
  8. package/dist/{SipConnectorFacade → src/SipConnectorFacade}/SipConnectorFacade.d.ts +7 -7
  9. package/dist/{__fixtures__ → src/__fixtures__}/BaseSession.mock.d.ts +22 -34
  10. package/dist/{__fixtures__ → src/__fixtures__}/RTCPeerConnectionMock.d.ts +15 -15
  11. package/dist/{__fixtures__ → src/__fixtures__}/RTCRtpSenderMock.d.ts +2 -2
  12. package/dist/{__fixtures__ → src/__fixtures__}/RTCSessionMock.d.ts +34 -38
  13. package/dist/{__fixtures__ → src/__fixtures__}/UA.mock.d.ts +25 -44
  14. package/dist/{__fixtures__ → src/__fixtures__}/channelsNotify.d.ts +2 -2
  15. package/dist/{__fixtures__ → src/__fixtures__}/jssip.mock.d.ts +1 -1
  16. package/dist/{__fixtures__ → src/__fixtures__}/participantNotify.d.ts +2 -2
  17. package/dist/{tools → src/tools}/index.d.ts +2 -2
  18. package/dist/{tools → src/tools}/sendDTMFAccumulated.d.ts +2 -2
  19. package/dist/{types.d.ts → src/types.d.ts} +2 -1
  20. package/dist/src/videoSendingBalancer/scaleBitrate.d.ts +2 -0
  21. package/package.json +27 -26
  22. package/dist/SipConnector-BPIL3yLc.js +0 -1343
  23. package/dist/SipConnector-BUbfMgHs.cjs +0 -1
  24. package/dist/SipConnector.d.ts +0 -315
  25. package/dist/utils.d.ts +0 -4
  26. package/dist/videoSendingBalancer/scaleBitrate.d.ts +0 -2
  27. /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/index.d.ts +0 -0
  28. /package/dist/{__fixtures__ → src/__fixtures__}/Registrator.mock.d.ts +0 -0
  29. /package/dist/{__fixtures__ → src/__fixtures__}/Request.mock.d.ts +0 -0
  30. /package/dist/{__fixtures__ → src/__fixtures__}/WebSocketInterface.mock.d.ts +0 -0
  31. /package/dist/{__fixtures__ → src/__fixtures__}/accountNotify.d.ts +0 -0
  32. /package/dist/{__fixtures__ → src/__fixtures__}/channels.d.ts +0 -0
  33. /package/dist/{__fixtures__ → src/__fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
  34. /package/dist/{__fixtures__ → src/__fixtures__}/delayPromise.d.ts +0 -0
  35. /package/dist/{__fixtures__ → src/__fixtures__}/enterRoom.d.ts +0 -0
  36. /package/dist/{__fixtures__ → src/__fixtures__}/index.d.ts +0 -0
  37. /package/dist/{__fixtures__ → src/__fixtures__}/mediaState.d.ts +0 -0
  38. /package/dist/{__fixtures__ → src/__fixtures__}/participantMoveRequests.d.ts +0 -0
  39. /package/dist/{__fixtures__ → src/__fixtures__}/remoteCallerData.d.ts +0 -0
  40. /package/dist/{__fixtures__ → src/__fixtures__}/utils.d.ts +0 -0
  41. /package/dist/{__fixtures__ → src/__fixtures__}/webcastNotify.d.ts +0 -0
  42. /package/dist/{causes.d.ts → src/causes.d.ts} +0 -0
  43. /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
  44. /package/dist/{doMock.d.ts → src/doMock.d.ts} +0 -0
  45. /package/dist/{eventNames.d.ts → src/eventNames.d.ts} +0 -0
  46. /package/dist/{getExtraHeadersRemoteAddress.d.ts → src/getExtraHeadersRemoteAddress.d.ts} +0 -0
  47. /package/dist/{headers.d.ts → src/headers.d.ts} +0 -0
  48. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  49. /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
  50. /package/dist/{setParametersToSender → src/setParametersToSender}/configureDegradationPreference.d.ts +0 -0
  51. /package/dist/{setParametersToSender → src/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
  52. /package/dist/{setParametersToSender → src/setParametersToSender}/configureEncodings.d.ts +0 -0
  53. /package/dist/{setParametersToSender → src/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
  54. /package/dist/{setParametersToSender → src/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
  55. /package/dist/{setParametersToSender → src/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
  56. /package/dist/{setParametersToSender → src/setParametersToSender}/index.d.ts +0 -0
  57. /package/dist/{setParametersToSender → src/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
  58. /package/dist/{setParametersToSender → src/setParametersToSender}/setParametersToSender.d.ts +0 -0
  59. /package/dist/{tools → src/tools}/__fixtures__/call.d.ts +0 -0
  60. /package/dist/{tools → src/tools}/__fixtures__/connectToServer.d.ts +0 -0
  61. /package/dist/{tools → src/tools}/__fixtures__/hasValidUri.d.ts +0 -0
  62. /package/dist/{tools → src/tools}/__fixtures__/permissions.d.ts +0 -0
  63. /package/dist/{tools → src/tools}/__fixtures__/processRequest.d.ts +0 -0
  64. /package/dist/{tools → src/tools}/__tests-utils__/parseObject.d.ts +0 -0
  65. /package/dist/{tools → src/tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
  66. /package/dist/{tools → src/tools}/error/getLinkError.d.ts +0 -0
  67. /package/dist/{tools → src/tools}/error/getTypeFromError.d.ts +0 -0
  68. /package/dist/{tools → src/tools}/error/getValuesFromError.d.ts +0 -0
  69. /package/dist/{tools → src/tools}/error/index.d.ts +0 -0
  70. /package/dist/{tools → src/tools}/error/stringifyMessage.d.ts +0 -0
  71. /package/dist/{tools → src/tools}/generateSimulcastEncodings.d.ts +0 -0
  72. /package/dist/{tools → src/tools}/getExtraHeaders.d.ts +0 -0
  73. /package/dist/{tools → src/tools}/getUserAgent.d.ts +0 -0
  74. /package/dist/{tools → src/tools}/hasPurgatory.d.ts +0 -0
  75. /package/dist/{tools → src/tools}/prepareMediaStream.d.ts +0 -0
  76. /package/dist/{tools → src/tools}/resolveUpdateTransceiver.d.ts +0 -0
  77. /package/dist/{tools → src/tools}/setVideoTrackContentHints.d.ts +0 -0
  78. /package/dist/{tools → src/tools}/syncMediaState/index.d.ts +0 -0
  79. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
  80. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
  81. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
  82. /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
  83. /package/dist/{utils → src/utils}/errors.d.ts +0 -0
  84. /package/dist/{utils → src/utils}/findSenderByStream.d.ts +0 -0
  85. /package/dist/{utils → src/utils}/findVideoSender.d.ts +0 -0
  86. /package/dist/{utils → src/utils}/findVideoTrack.d.ts +0 -0
  87. /package/dist/{utils → src/utils}/getCodecFromSender.d.ts +0 -0
  88. /package/dist/{utils → src/utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
  89. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/balance.d.ts +0 -0
  90. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
  91. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
  92. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
  93. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasIncludesString.d.ts +0 -0
  94. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/index.d.ts +0 -0
  95. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/processSender.d.ts +0 -0
  96. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
  97. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
  98. /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,21 +1,22 @@
1
- var se = Object.defineProperty;
2
- var oe = (n, e, t) => e in n ? se(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var a = (n, e, t) => oe(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { B as G, N as K, l as c, E as x, s as re, a as ie, P as ce, b as ae } from "./SipConnector-BPIL3yLc.js";
5
- import { j as Cn, k as mn, n as hn, m as Rn, S as gn, c as pn, d as yn, f as En, g as Tn, e as bn, h as Mn, i as _n } from "./SipConnector-BPIL3yLc.js";
6
- import { sequentPromises as ue } from "sequent-promises";
7
- import { createStackPromises as le } from "stack-promises";
8
- import { isCanceledError as de } from "@krivega/cancelable-promise";
9
- import { hasCanceledError as Se } from "repeated-calls";
10
- import { debounce as fe } from "ts-debounce";
11
- import { default as vn } from "debug";
12
- const H = (n) => {
1
+ var re = Object.defineProperty;
2
+ var ie = (n, e, t) => e in n ? re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var a = (n, e, t) => ie(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { B as Y, N as q, l as c, E as B, s as ce, a as ae, P as ue, b as de } from "./SipConnector-BHvTGgmw.js";
5
+ import { j as Rn, k as gn, n as yn, m as Tn, S as En, c as Mn, d as bn, f as _n, g as An, e as vn, h as On, i as Nn } from "./SipConnector-BHvTGgmw.js";
6
+ import { sequentPromises as le } from "sequent-promises";
7
+ import { createStackPromises as Ce } from "stack-promises";
8
+ import D from "debug";
9
+ import { default as Bn } from "debug";
10
+ import { isCanceledError as Se } from "@krivega/cancelable-promise";
11
+ import { hasCanceledError as fe } from "repeated-calls";
12
+ import { debounce as me } from "ts-debounce";
13
+ const x = (n) => {
13
14
  const { url: e, cause: t } = n;
14
15
  let s = e;
15
- return (t === G || t === K) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
16
+ return (t === Y || t === q) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
16
17
  };
17
- var Y = /* @__PURE__ */ ((n) => (n.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", n.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", n.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", n.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", n.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", n.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", n))(Y || {});
18
- const Ce = (n = new Error()) => {
18
+ var z = /* @__PURE__ */ ((n) => (n.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", n.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", n.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", n.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", n.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", n.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", n))(z || {});
19
+ const he = new Error("Unknown error"), pe = (n = he) => {
19
20
  var o;
20
21
  const { cause: e, socket: t } = n;
21
22
  let s = "CONNECT_SERVER_FAILED";
@@ -24,19 +25,19 @@ const Ce = (n = new Error()) => {
24
25
  s = "WRONG_USER_OR_PASSWORD";
25
26
  break;
26
27
  }
27
- case G: {
28
+ case Y: {
28
29
  s = "BAD_MEDIA_ERROR";
29
30
  break;
30
31
  }
31
- case K: {
32
+ case q: {
32
33
  s = "NOT_FOUND_ERROR";
33
34
  break;
34
35
  }
35
36
  default:
36
- t && ((o = t == null ? void 0 : t._ws) == null ? void 0 : o.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : H(n) && (s = "CONNECT_SERVER_FAILED_BY_LINK");
37
+ t !== void 0 && ((o = t._ws) == null ? void 0 : o.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : x(n) !== void 0 && x(n) !== "" && (s = "CONNECT_SERVER_FAILED_BY_LINK");
37
38
  }
38
39
  return s;
39
- }, me = (n) => {
40
+ }, Re = (n) => {
40
41
  let e = "";
41
42
  try {
42
43
  e = JSON.stringify(n);
@@ -44,16 +45,16 @@ const Ce = (n = new Error()) => {
44
45
  c("failed to stringify message", t);
45
46
  }
46
47
  return e;
47
- }, he = (n = new Error()) => {
48
- const { code: e, cause: t, message: s } = n, o = H(n), r = { code: "", cause: "", message: "" };
49
- return typeof s == "object" && s !== null ? r.message = me(s) : s && (r.message = String(s)), o && (r.link = o), e && (r.code = e), t && (r.cause = t), r;
50
- }, Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48
+ }, ge = new Error("Unknown error"), ye = (n = ge) => {
49
+ const { code: e, cause: t, message: s } = n, o = x(n), r = { code: "", cause: "", message: "" };
50
+ return typeof s == "object" && s !== null ? r.message = Re(s) : s && (r.message = String(s)), o !== void 0 && o !== "" && (r.link = o), e !== void 0 && e !== "" && (r.code = e), t !== void 0 && t !== "" && (r.cause = t), r;
51
+ }, Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51
52
  __proto__: null,
52
- EErrorTypes: Y,
53
- getLinkError: H,
54
- getTypeFromError: Ce,
55
- getValuesFromError: he
56
- }, Symbol.toStringTag, { value: "Module" })), ge = ({
53
+ EErrorTypes: z,
54
+ getLinkError: x,
55
+ getTypeFromError: pe,
56
+ getValuesFromError: ye
57
+ }, Symbol.toStringTag, { value: "Module" })), Ee = ({
57
58
  sessionId: n,
58
59
  remoteAddress: e,
59
60
  isMutedAudio: t,
@@ -61,139 +62,139 @@ const Ce = (n = new Error()) => {
61
62
  isRegistered: o,
62
63
  isPresentationCall: r
63
64
  }) => {
64
- const i = [], u = t ? "0" : "1", l = s ? "0" : "1";
65
- return i.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${l}`), o || i.push("X-Vinteo-Purgatory-Call: yes"), n && i.push(`X-Vinteo-Session: ${n}`), r && i.push("X-Vinteo-Presentation-Call: yes"), e && i.push(`X-Vinteo-Remote: ${e}`), i;
66
- }, pe = "[@*!|]", ye = "_", Ee = (n) => {
65
+ const i = [], u = t ? "0" : "1", d = s ? "0" : "1";
66
+ return i.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${d}`), (o === !1 || o === void 0) && i.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && i.push(`X-Vinteo-Session: ${n}`), r === !0 && i.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && i.push(`X-Vinteo-Remote: ${e}`), i;
67
+ }, Me = "[@*!|]", be = "_", _e = (n) => {
67
68
  let e = n;
68
- return e = e.replaceAll(new RegExp(pe, "g"), ye), e;
69
- }, Te = ({
69
+ return e = e.replaceAll(new RegExp(Me, "g"), be), e;
70
+ }, Ae = ({
70
71
  appName: n,
71
72
  appVersion: e,
72
73
  browserName: t,
73
74
  browserVersion: s
74
75
  }) => {
75
- const r = `${Ee(n)} ${e}`;
76
- return `ChromeNew - ${t ? `${t} ${s}, ${r}` : r}`;
77
- }, be = ({
76
+ const r = `${_e(n)} ${e}`;
77
+ return `ChromeNew - ${t === void 0 ? r : `${t} ${s}, ${r}`}`;
78
+ }, ve = ({
78
79
  isUnifiedSdpSemantic: n,
79
80
  appVersion: e,
80
81
  browserName: t,
81
82
  browserVersion: s,
82
83
  appName: o
83
- }) => n ? Te({ appVersion: e, browserName: t, browserVersion: s, appName: o }) : "Chrome", q = "purgatory", D = (n) => n === q, Me = (n) => (e) => [...e].map((s) => async () => n(s)), _e = async ({
84
+ }) => n ? Ae({ appVersion: e, browserName: t, browserVersion: s, appName: o }) : "Chrome", Q = "purgatory", k = (n) => n === Q, Oe = (n) => (e) => [...e].map((s) => async () => n(s)), Ne = async ({
84
85
  accumulatedKeys: n,
85
86
  sendKey: e,
86
87
  canRunTask: t
87
88
  }) => {
88
- const o = Me(e)(n);
89
- return ue(o, t);
90
- }, Ae = (n) => (t) => (c("onStartMainCam"), n.onSession("admin-start-main-cam", t)), ve = (n) => (t) => (c("onStartMic"), n.onSession("admin-start-mic", t)), Oe = (n) => (t) => (c("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), Ne = (n) => (t) => (c("onStopMic"), n.onSession("admin-stop-mic", t)), we = ({ sipConnector: n }) => {
91
- const e = (m, p) => ({ isSyncForced: h = !1 }) => {
89
+ const o = Oe(e)(n);
90
+ return le(o, t);
91
+ }, we = (n) => (t) => (c("onStartMainCam"), n.onSession("admin-start-main-cam", t)), Be = (n) => (t) => (c("onStartMic"), n.onSession("admin-start-mic", t)), Pe = (n) => (t) => (c("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), Ie = (n) => (t) => (c("onStopMic"), n.onSession("admin-stop-mic", t)), De = ({ sipConnector: n }) => {
92
+ const e = (m, g) => ({ isSyncForced: h = !1 }) => {
92
93
  if (h) {
93
94
  m();
94
95
  return;
95
96
  }
96
- p();
97
- }, t = Ae(n), s = Oe(n), o = ve(n), r = Ne(n);
97
+ g();
98
+ }, t = we(n), s = Pe(n), o = Be(n), r = Ie(n);
98
99
  let i = () => {
99
100
  }, u = () => {
100
- }, l = () => {
101
- }, S = () => {
101
+ }, d = () => {
102
+ }, C = () => {
102
103
  };
103
- const C = ({
104
+ const f = ({
104
105
  onStartMainCamForced: m,
105
- onStartMainCamNotForced: p,
106
+ onStartMainCamNotForced: g,
106
107
  onStopMainCamForced: h,
107
- onStopMainCamNotForced: R,
108
+ onStopMainCamNotForced: p,
108
109
  onStartMicForced: y,
109
- onStartMicNotForced: E,
110
- onStopMicForced: T,
111
- onStopMicNotForced: b
110
+ onStartMicNotForced: T,
111
+ onStopMicForced: E,
112
+ onStopMicNotForced: M
112
113
  }) => {
113
114
  const A = e(
114
115
  m,
115
- p
116
+ g
116
117
  );
117
118
  i = t(A);
118
119
  const v = e(
119
120
  h,
120
- R
121
+ p
121
122
  );
122
123
  u = s(v);
123
- const O = e(y, E);
124
- l = o(O);
125
- const N = e(T, b);
126
- S = r(N);
127
- }, f = () => {
128
- i(), u(), l(), S();
124
+ const O = e(y, T);
125
+ d = o(O);
126
+ const N = e(E, M);
127
+ C = r(N);
128
+ }, S = () => {
129
+ i(), u(), d(), C();
129
130
  };
130
131
  return {
131
132
  start: (m) => {
132
- C(m);
133
+ f(m);
133
134
  },
134
135
  stop: () => {
135
- f();
136
+ S();
136
137
  }
137
138
  };
138
- }, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
139
+ }, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
139
140
  __proto__: null,
140
- PURGATORY_CONFERENCE_NUMBER: q,
141
- createSyncMediaState: we,
142
- error: Re,
143
- getExtraHeaders: ge,
144
- getUserAgent: be,
145
- hasPurgatory: D,
146
- sendDTMFAccumulated: _e
147
- }, Symbol.toStringTag, { value: "Module" })), Be = (n) => [...n.keys()].map((e) => n.get(e)), Pe = (n, e) => Be(n).find((t) => t.type === e), De = async (n) => n.getStats().then((e) => {
148
- const t = Pe(e, "codec");
141
+ PURGATORY_CONFERENCE_NUMBER: Q,
142
+ createSyncMediaState: De,
143
+ error: Te,
144
+ getExtraHeaders: Ee,
145
+ getUserAgent: ve,
146
+ hasPurgatory: k,
147
+ sendDtmfAccumulated: Ne
148
+ }, Symbol.toStringTag, { value: "Module" })), ke = (n) => [...n.keys()].map((e) => n.get(e)), Fe = (n, e) => ke(n).find((t) => (t == null ? void 0 : t.type) === e), Ve = async (n) => n.getStats().then((e) => {
149
+ const t = Fe(e, "codec");
149
150
  return t == null ? void 0 : t.mimeType;
150
- }), Ie = (n) => n.find((e) => {
151
+ }), Ue = (n) => n.find((e) => {
151
152
  var t;
152
- return ((t = e == null ? void 0 : e.track) == null ? void 0 : t.kind) === "video";
153
- }), z = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Fe = 1e6, g = (n) => n * Fe, Q = g(0.06), ke = g(4), Ue = (n) => n <= 64 ? Q : n <= 128 ? g(0.12) : n <= 256 ? g(0.25) : n <= 384 ? g(0.32) : n <= 426 ? g(0.38) : n <= 640 ? g(0.5) : n <= 848 ? g(0.7) : n <= 1280 ? g(1) : n <= 1920 ? g(2) : ke, Ve = "av1", xe = (n) => z(n, Ve), Le = 0.6, J = (n, e) => xe(e) ? n * Le : n, $e = (n) => J(Q, n), Z = (n, e) => {
154
- const t = Ue(n);
155
- return J(t, e);
156
- }, He = 1, ee = ({
153
+ return ((t = e.track) == null ? void 0 : t.kind) === "video";
154
+ }), J = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), xe = 1e6, R = (n) => n * xe, Z = R(0.06), Le = R(4), $e = (n) => n <= 64 ? Z : n <= 128 ? R(0.12) : n <= 256 ? R(0.25) : n <= 384 ? R(0.32) : n <= 426 ? R(0.38) : n <= 640 ? R(0.5) : n <= 848 ? R(0.7) : n <= 1280 ? R(1) : n <= 1920 ? R(2) : Le, He = "av1", Xe = (n) => J(n, He), je = 0.6, ee = (n, e) => Xe(e) ? n * je : n, We = (n) => ee(Z, n), ne = (n, e) => {
155
+ const t = $e(n);
156
+ return ee(t, e);
157
+ }, X = 1, te = ({
157
158
  videoTrack: n,
158
159
  targetSize: e,
159
160
  codec: t
160
161
  }) => {
161
- const s = n.getSettings(), o = s.width, r = s.height, i = o / e.width, u = r / e.height, l = Math.max(i, u, He), S = Z(e.width, t);
162
- return { scaleResolutionDownBy: l, maxBitrate: S };
163
- }, ne = le(), Xe = async () => ne().catch((n) => {
162
+ const s = n.getSettings(), o = s.width, r = s.height, i = o === void 0 ? X : o / e.width, u = r === void 0 ? X : r / e.height, d = Math.max(i, u, X), C = ne(e.width, t);
163
+ return { scaleResolutionDownBy: d, maxBitrate: C };
164
+ }, se = Ce(), Ge = async () => se().catch((n) => {
164
165
  c("videoSendingBalancer: error", n);
165
- }), je = async (n) => (ne.add(n), Xe()), X = async ({
166
+ }), Ke = async (n) => (se.add(n), Ge()), W = async ({
166
167
  sender: n,
167
168
  scaleResolutionDownBy: e,
168
169
  maxBitrate: t,
169
170
  onSetParameters: s
170
- }) => je(async () => re(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), We = async ({ sender: n, codec: e }, t) => {
171
- const o = $e(e);
172
- return X({
171
+ }) => Ke(async () => ce(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), Ye = async ({ sender: n, codec: e }, t) => {
172
+ const o = We(e);
173
+ return W({
173
174
  sender: n,
174
175
  maxBitrate: o,
175
176
  onSetParameters: t,
176
177
  scaleResolutionDownBy: 200
177
178
  });
178
- }, L = async ({
179
+ }, U = async ({
179
180
  sender: n,
180
181
  videoTrack: e,
181
182
  codec: t
182
183
  }, s) => {
183
- const i = e.getSettings().width, u = Z(i, t);
184
- return X({
184
+ const i = e.getSettings().width, u = ne(i ?? 0, t);
185
+ return W({
185
186
  sender: n,
186
187
  maxBitrate: u,
187
188
  onSetParameters: s,
188
189
  scaleResolutionDownBy: 1
189
190
  });
190
- }, Ge = async ({
191
+ }, qe = async ({
191
192
  sender: n,
192
193
  videoTrack: e,
193
194
  resolution: t,
194
195
  codec: s
195
196
  }, o) => {
196
- const [r, i] = t.split("x"), { maxBitrate: u, scaleResolutionDownBy: l } = ee({
197
+ const [r, i] = t.split("x"), { maxBitrate: u, scaleResolutionDownBy: d } = te({
197
198
  videoTrack: e,
198
199
  codec: s,
199
200
  targetSize: {
@@ -201,13 +202,13 @@ const Ce = (n = new Error()) => {
201
202
  height: Number(i)
202
203
  }
203
204
  });
204
- return X({
205
+ return W({
205
206
  sender: n,
206
207
  maxBitrate: u,
207
208
  onSetParameters: o,
208
- scaleResolutionDownBy: l
209
+ scaleResolutionDownBy: d
209
210
  });
210
- }, Ke = async ({
211
+ }, ze = async ({
211
212
  mainCam: n,
212
213
  resolutionMainCam: e,
213
214
  sender: t,
@@ -215,19 +216,23 @@ const Ce = (n = new Error()) => {
215
216
  codec: o
216
217
  }, r) => {
217
218
  switch (n) {
218
- case x.PAUSE_MAIN_CAM:
219
- return We({ sender: t, codec: o }, r);
220
- case x.RESUME_MAIN_CAM:
221
- return L({ sender: t, videoTrack: s, codec: o }, r);
222
- case x.MAX_MAIN_CAM_RESOLUTION:
223
- return e !== void 0 ? Ge(
219
+ case B.PAUSE_MAIN_CAM:
220
+ return Ye({ sender: t, codec: o }, r);
221
+ case B.RESUME_MAIN_CAM:
222
+ return U({ sender: t, videoTrack: s, codec: o }, r);
223
+ case B.MAX_MAIN_CAM_RESOLUTION:
224
+ return e !== void 0 ? qe(
224
225
  { sender: t, videoTrack: s, codec: o, resolution: e },
225
226
  r
226
- ) : L({ sender: t, videoTrack: s, codec: o }, r);
227
+ ) : U({ sender: t, videoTrack: s, codec: o }, r);
228
+ case B.ADMIN_STOP_MAIN_CAM:
229
+ case B.ADMIN_START_MAIN_CAM:
230
+ case void 0:
231
+ return U({ sender: t, videoTrack: s, codec: o }, r);
227
232
  default:
228
- return L({ sender: t, videoTrack: s, codec: o }, r);
233
+ return U({ sender: t, videoTrack: s, codec: o }, r);
229
234
  }
230
- }, j = {
235
+ }, G = {
231
236
  isChanged: !1,
232
237
  parameters: {
233
238
  encodings: [{}],
@@ -236,18 +241,18 @@ const Ce = (n = new Error()) => {
236
241
  headerExtensions: [],
237
242
  rtcp: {}
238
243
  }
239
- }, W = async ({
244
+ }, K = async ({
240
245
  mainCam: n,
241
246
  resolutionMainCam: e,
242
247
  connection: t,
243
248
  onSetParameters: s,
244
249
  ignoreForCodec: o
245
250
  }) => {
246
- const r = t.getSenders(), i = Ie(r);
251
+ const r = t.getSenders(), i = Ue(r);
247
252
  if (!(i != null && i.track))
248
- return j;
249
- const u = await De(i);
250
- return z(u, o) ? j : Ke(
253
+ return G;
254
+ const u = await Ve(i);
255
+ return J(u, o) ? G : ze(
251
256
  {
252
257
  mainCam: n,
253
258
  resolutionMainCam: e,
@@ -257,33 +262,35 @@ const Ce = (n = new Error()) => {
257
262
  },
258
263
  s
259
264
  );
260
- }, ln = (n, {
265
+ }, fn = (n, {
261
266
  ignoreForCodec: e,
262
267
  onSetParameters: t
263
268
  } = {}) => {
264
269
  const s = async () => {
265
- const { connection: l } = n;
266
- if (!l)
270
+ const { connection: d } = n;
271
+ if (!d)
267
272
  throw new Error("connection is not exist");
268
- return W({
269
- connection: l,
273
+ return K({
274
+ connection: d,
270
275
  onSetParameters: t,
271
276
  ignoreForCodec: e
272
277
  });
273
278
  };
274
279
  let o = s;
275
- const r = async (l) => (o = async () => {
276
- const { mainCam: S, resolutionMainCam: C } = l, { connection: f } = n;
277
- if (!f)
278
- throw new Error("connection is not exist");
279
- return W({
280
- mainCam: S,
281
- resolutionMainCam: C,
282
- connection: f,
283
- onSetParameters: t,
284
- ignoreForCodec: e
285
- });
286
- }, o());
280
+ const r = (d) => {
281
+ o = async () => {
282
+ const { mainCam: C, resolutionMainCam: f } = d, { connection: S } = n;
283
+ if (!S)
284
+ throw new Error("connection is not exist");
285
+ return K({
286
+ mainCam: C,
287
+ resolutionMainCam: f,
288
+ connection: S,
289
+ onSetParameters: t,
290
+ ignoreForCodec: e
291
+ });
292
+ }, o().catch(D);
293
+ };
287
294
  return {
288
295
  subscribe: () => {
289
296
  n.onSession("main-cam-control", r);
@@ -299,52 +306,54 @@ const Ce = (n = new Error()) => {
299
306
  return o();
300
307
  }
301
308
  };
302
- }, Ye = (n) => n.getVideoTracks()[0], B = ({
309
+ }, Qe = (n) => n.getVideoTracks()[0], P = ({
303
310
  mediaStream: n,
304
311
  simulcastEncodings: e,
305
312
  sendEncodings: t
306
313
  }) => {
307
314
  if (e && e.length > 0) {
308
- const s = t ?? [], o = Ye(n);
315
+ const s = t ?? [], o = Qe(n);
316
+ if (o === void 0)
317
+ throw new Error("No video track");
309
318
  return e.forEach((r, i) => {
310
319
  const u = s[i] ?? {};
311
320
  u.active = !0, r.rid !== void 0 && (u.rid = r.rid), r.scalabilityMode !== void 0 && (u.scalabilityMode = r.scalabilityMode);
312
- const { maxBitrate: l, scaleResolutionDownBy: S } = ee({
321
+ const { maxBitrate: d, scaleResolutionDownBy: C } = te({
313
322
  videoTrack: o,
314
323
  targetSize: {
315
324
  width: r.width,
316
325
  height: r.height
317
326
  }
318
327
  });
319
- u.maxBitrate = l, u.scaleResolutionDownBy = S, s[i] = u;
328
+ u.maxBitrate = d, u.scaleResolutionDownBy = C, s[i] = u;
320
329
  }), s;
321
330
  }
322
331
  return t;
323
- }, qe = (n, e) => n.filter((s) => e.some((o) => o.clockRate === s.clockRate && o.mimeType === s.mimeType && o.channels === s.channels && o.sdpFmtpLine === s.sdpFmtpLine)), ze = (n) => {
332
+ }, Je = (n, e) => n.filter((s) => e.some((o) => o.clockRate === s.clockRate && o.mimeType === s.mimeType && o.channels === s.channels && o.sdpFmtpLine === s.sdpFmtpLine)), Ze = (n) => {
324
333
  const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, o = t === null ? [] : t.codecs;
325
- return qe(s, o);
326
- }, Qe = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
334
+ return Je(s, o);
335
+ }, en = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
327
336
  const o = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), i = o === -1 ? Number.MAX_VALUE : o, u = r === -1 ? Number.MAX_VALUE : r;
328
337
  return i - u;
329
- }), Je = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), P = (n, {
338
+ }), nn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), I = (n, {
330
339
  preferredMimeTypesVideoCodecs: e,
331
340
  excludeMimeTypesVideoCodecs: t
332
341
  }) => async (s) => {
333
342
  var o;
334
343
  try {
335
- if (typeof s.setCodecPreferences == "function" && ((o = s.sender.track) == null ? void 0 : o.kind) === "video" && (e !== void 0 && (e == null ? void 0 : e.length) > 0 || t !== void 0 && (t == null ? void 0 : t.length) > 0)) {
336
- const r = ze("video"), i = Je(r, t), u = Qe(i, e);
344
+ if (typeof s.setCodecPreferences == "function" && ((o = s.sender.track) == null ? void 0 : o.kind) === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
345
+ const r = Ze("video"), i = nn(r, t), u = en(i, e);
337
346
  s.setCodecPreferences(u);
338
347
  }
339
- Object.keys(n).length > 0 && await ie(s.sender, n);
348
+ Object.keys(n).length > 0 && await ae(s.sender, n);
340
349
  } catch (r) {
341
350
  c("updateTransceiver error", r);
342
351
  }
343
- }, $ = (n) => {
344
- if (!de(n) && !Se(n))
352
+ }, j = (n) => {
353
+ if (!Se(n) && !fe(n))
345
354
  throw n;
346
355
  return { isSuccessful: !1 };
347
- }, Ze = ({ kind: n, readyState: e }) => n === "video" && e === "live", en = /* @__PURE__ */ new Set([
356
+ }, tn = ({ kind: n, readyState: e }) => n === "video" && e === "live", sn = /* @__PURE__ */ new Set([
348
357
  "on",
349
358
  "once",
350
359
  "onceRace",
@@ -366,14 +375,11 @@ const Ce = (n = new Error()) => {
366
375
  "isConfigured",
367
376
  "isRegistered"
368
377
  ]);
369
- class dn {
378
+ class mn {
370
379
  constructor(e, {
371
380
  preferredMimeTypesVideoCodecs: t,
372
381
  excludeMimeTypesVideoCodecs: s
373
382
  } = {}) {
374
- a(this, "sipConnector");
375
- a(this, "preferredMimeTypesVideoCodecs");
376
- a(this, "excludeMimeTypesVideoCodecs");
377
383
  // @ts-expect-error: proxy method
378
384
  a(this, "on");
379
385
  // @ts-expect-error: proxy method
@@ -414,6 +420,9 @@ class dn {
414
420
  a(this, "isConfigured");
415
421
  // @ts-expect-error: proxy method
416
422
  a(this, "isRegistered");
423
+ a(this, "sipConnector");
424
+ a(this, "preferredMimeTypesVideoCodecs");
425
+ a(this, "excludeMimeTypesVideoCodecs");
417
426
  a(this, "connectToServer", async (e) => {
418
427
  const {
419
428
  userAgent: t,
@@ -422,9 +431,9 @@ class dn {
422
431
  remoteAddress: r,
423
432
  displayName: i,
424
433
  name: u,
425
- password: l,
426
- isRegisteredUser: S,
427
- isDisconnectOnFail: C
434
+ password: d,
435
+ isRegisteredUser: C,
436
+ isDisconnectOnFail: f
428
437
  } = e;
429
438
  return c("connectToServer", e), this.sipConnector.connect({
430
439
  userAgent: t,
@@ -432,10 +441,10 @@ class dn {
432
441
  sipServerUrl: o,
433
442
  remoteAddress: r,
434
443
  displayName: i,
435
- password: l,
444
+ password: d,
436
445
  user: u,
437
- register: S
438
- }).then((f) => (c("connectToServer then"), { ua: f, isSuccessful: !0 })).catch(async (f) => (c("connectToServer catch: error", f), C === !0 ? this.sipConnector.disconnect().then(() => $(f)).catch(() => $(f)) : $(f)));
446
+ register: C
447
+ }).then((S) => (c("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (c("connectToServer catch: error", S), f === !0 ? this.sipConnector.disconnect().then(() => j(S)).catch(() => j(S)) : j(S)));
439
448
  });
440
449
  a(this, "callToServer", async (e) => {
441
450
  const {
@@ -445,27 +454,29 @@ class dn {
445
454
  iceServers: r,
446
455
  contentHint: i,
447
456
  simulcastEncodings: u,
448
- degradationPreference: l,
449
- sendEncodings: S,
450
- offerToReceiveAudio: C,
451
- offerToReceiveVideo: f,
452
- directionVideo: I,
453
- directionAudio: F,
457
+ degradationPreference: d,
458
+ sendEncodings: C,
459
+ offerToReceiveAudio: f,
460
+ offerToReceiveVideo: S,
461
+ directionVideo: F,
462
+ directionAudio: V,
454
463
  setRemoteStreams: m,
455
- onBeforeProgressCall: p,
464
+ onBeforeProgressCall: g,
456
465
  onSuccessProgressCall: h,
457
- onEnterPurgatory: R,
466
+ onEnterPurgatory: p,
458
467
  onEnterConference: y,
459
- onFailProgressCall: E,
460
- onFinishProgressCall: T,
461
- onEndedCall: b
468
+ onFailProgressCall: T,
469
+ onFinishProgressCall: E,
470
+ onEndedCall: M
462
471
  } = e, A = this.resolveHandleReadyRemoteStreamsDebounced({
463
472
  onReadyRemoteStreams: m
464
473
  }), v = this.resolveHandleReadyRemoteStreams({
465
- onReadyRemoteStreams: A
466
- }), O = P(
474
+ onReadyRemoteStreams: () => {
475
+ A().catch(D);
476
+ }
477
+ }), O = I(
467
478
  {
468
- degradationPreference: l
479
+ degradationPreference: d
469
480
  },
470
481
  {
471
482
  preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
@@ -478,31 +489,31 @@ class dn {
478
489
  extraHeaders: o,
479
490
  iceServers: r,
480
491
  contentHint: i,
481
- offerToReceiveAudio: C,
482
- offerToReceiveVideo: f,
483
- directionVideo: I,
484
- directionAudio: F,
485
- sendEncodings: B({
492
+ offerToReceiveAudio: f,
493
+ offerToReceiveVideo: S,
494
+ directionVideo: F,
495
+ directionAudio: V,
496
+ sendEncodings: P({
486
497
  mediaStream: s,
487
498
  simulcastEncodings: u,
488
- sendEncodings: S
499
+ sendEncodings: C
489
500
  }),
490
501
  number: t,
491
502
  onAddedTransceiver: O,
492
503
  ontrack: v
493
504
  }));
494
- let M = !1, _;
495
- const w = (c("subscribeEnterConference: onEnterConference", y), R ?? y ? this.sipConnector.onSession("enterRoom", ({ room: d }) => {
496
- c("enterRoom", { _room: d, isSuccessProgressCall: M }), _ = d, D(_) ? R && R() : y && y({ isSuccessProgressCall: M });
505
+ let b = !1, _;
506
+ const w = (c("subscribeEnterConference: onEnterConference", y), p ?? y ? this.sipConnector.onSession("enterRoom", ({ room: l }) => {
507
+ c("enterRoom", { _room: l, isSuccessProgressCall: b }), _ = l, k(_) ? p && p() : y && y({ isSuccessProgressCall: b });
497
508
  }) : () => {
498
- }), k = (d) => (c("onSuccess"), M = !0, A(), h && h({ isPurgatory: D(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
499
- w(), b && b();
500
- }), d), U = (d) => {
501
- throw c("onFail"), E && E(), w(), d;
502
- }, V = () => {
503
- c("onFinish"), T && T();
509
+ }), L = (l) => (c("onSuccess"), b = !0, A().catch(D), h && h({ isPurgatory: k(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
510
+ w(), M && M();
511
+ }), l), $ = (l) => {
512
+ throw c("onFail"), T && T(), w(), l;
513
+ }, H = () => {
514
+ c("onFinish"), E && E();
504
515
  };
505
- return c("onBeforeProgressCall"), p && p(t), N().then(k).catch((d) => U(d)).finally(V);
516
+ return c("onBeforeProgressCall"), g && g(t), N().then(L).catch((l) => $(l)).finally(H);
506
517
  });
507
518
  a(this, "disconnectFromServer", async () => this.sipConnector.disconnect().then(() => (c("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (c("disconnectFromServer: catch", e), { isSuccessful: !1 })));
508
519
  a(this, "answerIncomingCall", async (e) => {
@@ -513,24 +524,26 @@ class dn {
513
524
  contentHint: r,
514
525
  simulcastEncodings: i,
515
526
  degradationPreference: u,
516
- sendEncodings: l,
517
- offerToReceiveAudio: S,
518
- offerToReceiveVideo: C,
519
- directionVideo: f,
520
- directionAudio: I,
521
- setRemoteStreams: F,
527
+ sendEncodings: d,
528
+ offerToReceiveAudio: C,
529
+ offerToReceiveVideo: f,
530
+ directionVideo: S,
531
+ directionAudio: F,
532
+ setRemoteStreams: V,
522
533
  onBeforeProgressCall: m,
523
- onSuccessProgressCall: p,
534
+ onSuccessProgressCall: g,
524
535
  onEnterPurgatory: h,
525
- onEnterConference: R,
536
+ onEnterConference: p,
526
537
  onFailProgressCall: y,
527
- onFinishProgressCall: E,
528
- onEndedCall: T
529
- } = e, b = this.resolveHandleReadyRemoteStreamsDebounced({
530
- onReadyRemoteStreams: F
538
+ onFinishProgressCall: T,
539
+ onEndedCall: E
540
+ } = e, M = this.resolveHandleReadyRemoteStreamsDebounced({
541
+ onReadyRemoteStreams: V
531
542
  }), A = this.resolveHandleReadyRemoteStreams({
532
- onReadyRemoteStreams: b
533
- }), v = P(
543
+ onReadyRemoteStreams: () => {
544
+ M().catch(D);
545
+ }
546
+ }), v = I(
534
547
  {
535
548
  degradationPreference: u
536
549
  },
@@ -545,37 +558,37 @@ class dn {
545
558
  extraHeaders: s,
546
559
  iceServers: o,
547
560
  contentHint: r,
548
- offerToReceiveAudio: S,
549
- offerToReceiveVideo: C,
550
- directionVideo: f,
551
- directionAudio: I,
552
- sendEncodings: B({
561
+ offerToReceiveAudio: C,
562
+ offerToReceiveVideo: f,
563
+ directionVideo: S,
564
+ directionAudio: F,
565
+ sendEncodings: P({
553
566
  mediaStream: t,
554
567
  simulcastEncodings: i,
555
- sendEncodings: l
568
+ sendEncodings: d
556
569
  }),
557
570
  onAddedTransceiver: v,
558
571
  ontrack: A
559
572
  }), N = () => {
560
- const { remoteCallerData: d } = this.sipConnector;
561
- return d.incomingNumber;
573
+ const { remoteCallerData: l } = this.sipConnector;
574
+ return l.incomingNumber;
562
575
  };
563
- let M = !1, _;
564
- const w = (c("subscribeEnterConference: onEnterConference", R), h ?? R ? this.sipConnector.onSession("enterRoom", (d) => {
565
- c("enterRoom", { _room: d, isSuccessProgressCall: M }), _ = d, D(_) ? h && h() : R && R({ isSuccessProgressCall: M });
576
+ let b = !1, _;
577
+ const w = (c("subscribeEnterConference: onEnterConference", p), h ?? p ? this.sipConnector.onSession("enterRoom", (l) => {
578
+ c("enterRoom", { _room: l, isSuccessProgressCall: b }), _ = l, k(_) ? h && h() : p && p({ isSuccessProgressCall: b });
566
579
  }) : () => {
567
- }), k = (d) => (c("onSuccess"), M = !0, b(), p && p({ isPurgatory: D(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
568
- w(), T && T();
569
- }), d), U = (d) => {
570
- throw c("onFail"), y && y(), w(), d;
571
- }, V = () => {
572
- c("onFinish"), E && E();
580
+ }), L = (l) => (c("onSuccess"), b = !0, M().catch(D), g && g({ isPurgatory: k(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
581
+ w(), E && E();
582
+ }), l), $ = (l) => {
583
+ throw c("onFail"), y && y(), w(), l;
584
+ }, H = () => {
585
+ c("onFinish"), T && T();
573
586
  };
574
587
  if (c("onBeforeProgressCall"), m) {
575
- const d = N();
576
- m(d);
588
+ const l = N();
589
+ m(l);
577
590
  }
578
- return O().then(k).catch((d) => U(d)).finally(V);
591
+ return O().then(L).catch((l) => $(l)).finally(H);
579
592
  });
580
593
  a(this, "updatePresentation", async ({
581
594
  mediaStream: e,
@@ -585,28 +598,28 @@ class dn {
585
598
  simulcastEncodings: r,
586
599
  degradationPreference: i,
587
600
  sendEncodings: u,
588
- preferredMimeTypesVideoCodecs: l,
589
- excludeMimeTypesVideoCodecs: S
601
+ preferredMimeTypesVideoCodecs: d,
602
+ excludeMimeTypesVideoCodecs: C
590
603
  }) => {
591
- const C = P(
604
+ const f = I(
592
605
  {
593
606
  degradationPreference: i
594
607
  },
595
608
  {
596
- preferredMimeTypesVideoCodecs: l,
597
- excludeMimeTypesVideoCodecs: S
609
+ preferredMimeTypesVideoCodecs: d,
610
+ excludeMimeTypesVideoCodecs: C
598
611
  }
599
612
  );
600
613
  return c("updatePresentation"), this.sipConnector.updatePresentation(e, {
601
614
  isP2P: t,
602
615
  maxBitrate: s,
603
616
  contentHint: o,
604
- sendEncodings: B({
617
+ sendEncodings: P({
605
618
  mediaStream: e,
606
619
  simulcastEncodings: r,
607
620
  sendEncodings: u
608
621
  }),
609
- onAddedTransceiver: C
622
+ onAddedTransceiver: f
610
623
  });
611
624
  });
612
625
  a(this, "startPresentation", async ({
@@ -617,16 +630,16 @@ class dn {
617
630
  simulcastEncodings: r,
618
631
  degradationPreference: i,
619
632
  sendEncodings: u,
620
- preferredMimeTypesVideoCodecs: l,
621
- excludeMimeTypesVideoCodecs: S
622
- }, C) => {
623
- const f = P(
633
+ preferredMimeTypesVideoCodecs: d,
634
+ excludeMimeTypesVideoCodecs: C
635
+ }, f) => {
636
+ const S = I(
624
637
  {
625
638
  degradationPreference: i
626
639
  },
627
640
  {
628
- preferredMimeTypesVideoCodecs: l,
629
- excludeMimeTypesVideoCodecs: S
641
+ preferredMimeTypesVideoCodecs: d,
642
+ excludeMimeTypesVideoCodecs: C
630
643
  }
631
644
  );
632
645
  return c("startPresentation"), this.sipConnector.startPresentation(
@@ -635,14 +648,14 @@ class dn {
635
648
  isP2P: t,
636
649
  maxBitrate: s,
637
650
  contentHint: o,
638
- sendEncodings: B({
651
+ sendEncodings: P({
639
652
  mediaStream: e,
640
653
  simulcastEncodings: r,
641
654
  sendEncodings: u
642
655
  }),
643
- onAddedTransceiver: f
656
+ onAddedTransceiver: S
644
657
  },
645
- C
658
+ f
646
659
  );
647
660
  });
648
661
  a(this, "stopShareSipConnector", async ({ isP2P: e = !1 } = {}) => (c("stopShareSipConnector"), this.sipConnector.stopPresentation({
@@ -651,23 +664,20 @@ class dn {
651
664
  c(t);
652
665
  })));
653
666
  a(this, "sendRefusalToTurnOnMic", async () => {
654
- if (this.sipConnector.isCallActive)
655
- return c("sendRefusalToTurnOnMic"), this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
656
- c("sendRefusalToTurnOnMic: error", e);
657
- });
667
+ this.sipConnector.isCallActive && (c("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
668
+ c("sendRefusalToTurnOnMic: error", e);
669
+ }));
658
670
  });
659
671
  a(this, "sendRefusalToTurnOnCam", async () => {
660
- if (this.sipConnector.isCallActive)
661
- return c("sendRefusalToTurnOnCam"), this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
662
- c("sendRefusalToTurnOnCam: error", e);
663
- });
672
+ this.sipConnector.isCallActive && (c("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
673
+ c("sendRefusalToTurnOnCam: error", e);
674
+ }));
664
675
  });
665
676
  a(this, "sendMediaState", async ({
666
677
  isEnabledCam: e,
667
678
  isEnabledMic: t
668
679
  }) => {
669
- if (this.sipConnector.isCallActive)
670
- return c("sendMediaState"), this.sipConnector.sendMediaState({ cam: e, mic: t });
680
+ this.sipConnector.isCallActive && (c("sendMediaState"), await this.sipConnector.sendMediaState({ cam: e, mic: t }));
671
681
  });
672
682
  a(this, "replaceMediaStream", async (e, {
673
683
  deleteExisting: t,
@@ -676,9 +686,9 @@ class dn {
676
686
  contentHint: r,
677
687
  simulcastEncodings: i,
678
688
  degradationPreference: u,
679
- sendEncodings: l
689
+ sendEncodings: d
680
690
  } = {}) => {
681
- const S = P(
691
+ const C = I(
682
692
  {
683
693
  degradationPreference: u
684
694
  },
@@ -692,39 +702,39 @@ class dn {
692
702
  addMissing: s,
693
703
  forceRenegotiation: o,
694
704
  contentHint: r,
695
- sendEncodings: B({
705
+ sendEncodings: P({
696
706
  mediaStream: e,
697
707
  simulcastEncodings: i,
698
- sendEncodings: l
708
+ sendEncodings: d
699
709
  }),
700
- onAddedTransceiver: S
710
+ onAddedTransceiver: C
701
711
  });
702
712
  });
703
713
  a(this, "askPermissionToEnableCam", async () => {
704
- if (this.sipConnector.isCallActive)
705
- return c("askPermissionToEnableCam"), this.sipConnector.askPermissionToEnableCam();
714
+ this.sipConnector.isCallActive && (c("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam());
706
715
  });
707
716
  a(this, "resolveHandleReadyRemoteStreamsDebounced", ({
708
717
  onReadyRemoteStreams: e
709
- }) => fe(() => {
718
+ }) => me(() => {
710
719
  const t = this.sipConnector.getRemoteStreams();
711
720
  c("remoteStreams", t), t && e(t);
712
721
  }, 200));
722
+ // eslint-disable-next-line class-methods-use-this
713
723
  a(this, "resolveHandleReadyRemoteStreams", ({
714
724
  onReadyRemoteStreams: e
715
725
  }) => ({ track: t }) => {
716
- Ze(t) && e();
726
+ tn(t) && e();
717
727
  });
718
728
  a(this, "getRemoteStreams", () => (c("getRemoteStreams"), this.sipConnector.getRemoteStreams()));
719
729
  a(this, "onUseLicense", (e) => (c("onUseLicense"), this.sipConnector.onSession("useLicense", e)));
720
730
  a(this, "onMustStopPresentation", (e) => (c("onMustStopPresentation"), this.sipConnector.onSession("mustStopPresentation", e)));
721
- a(this, "onMoveToSpectators", (e) => (c("onMoveToSpectators"), this.sipConnector.onSession(ce, e)));
722
- a(this, "onMoveToParticipants", (e) => (c("onMoveToParticipants"), this.sipConnector.onSession(ae, e)));
731
+ a(this, "onMoveToSpectators", (e) => (c("onMoveToSpectators"), this.sipConnector.onSession(ue, e)));
732
+ a(this, "onMoveToParticipants", (e) => (c("onMoveToParticipants"), this.sipConnector.onSession(de, e)));
723
733
  return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.sipConnector = e, new Proxy(this, {
724
734
  get: (o, r, i) => {
725
- if (typeof r == "string" && en.has(r) && r in this.sipConnector) {
726
- const l = Reflect.get(this.sipConnector, r, this.sipConnector);
727
- return typeof l == "function" ? l.bind(this.sipConnector) : l;
735
+ if (typeof r == "string" && sn.has(r) && r in this.sipConnector) {
736
+ const d = Reflect.get(this.sipConnector, r, this.sipConnector);
737
+ return typeof d == "function" ? d.bind(this.sipConnector) : d;
728
738
  }
729
739
  const u = Reflect.get(o, r, i);
730
740
  return typeof u == "function" ? u.bind(o) : u;
@@ -733,23 +743,23 @@ class dn {
733
743
  }
734
744
  }
735
745
  export {
736
- x as EEventsMainCAM,
737
- Cn as EEventsMic,
738
- mn as EEventsSyncMediaState,
739
- hn as EMimeTypesVideoCodecs,
740
- Rn as EUseLicense,
741
- gn as SipConnector,
742
- dn as SipConnectorFacade,
743
- pn as causes,
744
- yn as constants,
745
- vn as debug,
746
- En as disableDebug,
747
- Tn as enableDebug,
748
- bn as eventNames,
749
- De as getCodecFromSender,
750
- Mn as hasCanceledCallError,
751
- _n as hasCanceledStartPresentationError,
752
- ln as resolveVideoSendingBalancer,
753
- ie as setParametersToSender,
754
- un as tools
746
+ B as EEventsMainCAM,
747
+ Rn as EEventsMic,
748
+ gn as EEventsSyncMediaState,
749
+ yn as EMimeTypesVideoCodecs,
750
+ Tn as EUseLicense,
751
+ En as SipConnector,
752
+ mn as SipConnectorFacade,
753
+ Mn as causes,
754
+ bn as constants,
755
+ Bn as debug,
756
+ _n as disableDebug,
757
+ An as enableDebug,
758
+ vn as eventNames,
759
+ Ve as getCodecFromSender,
760
+ On as hasCanceledCallError,
761
+ Nn as hasCanceledStartPresentationError,
762
+ fn as resolveVideoSendingBalancer,
763
+ ae as setParametersToSender,
764
+ Sn as tools
755
765
  };