sip-connector 14.1.0-alpha.1 → 14.1.0-alpha.2

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