sip-connector 6.20.0 → 6.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,804 +1,805 @@
1
- var tr = Object.defineProperty;
2
- var nr = (e, t, n) => t in e ? tr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var c = (e, t, n) => (nr(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { CancelableRequest as P, isCanceledError as qt } from "@krivega/cancelable-promise";
5
- import dt from "events-constructor";
6
- import me from "debug";
7
- import { default as xl } from "debug";
8
- import rr from "sequent-promises";
9
- import sr from "stack-promises";
10
- const or = "Connection Error", Gt = "Request Timeout", ir = "SIP Failure Code", ar = "Internal Error", cr = "Busy", Yt = "Rejected", ur = "Redirected", lr = "Unavailable", Ce = "Not Found", _r = "Address Incomplete", dr = "Incompatible SDP", Er = "Missing SDP", hr = "Authentication Error", Xt = "Terminated", fr = "WebRTC Error", zt = "Canceled", Sr = "No Answer", gr = "Expires", Tr = "No ACK", mr = "Dialog Error", Cr = "User Denied Media Access", Re = "Bad Media Description", Rr = "RTP Timeout", Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1
+ var xt = Object.defineProperty;
2
+ var Yt = (n, e, t) => e in n ? xt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var a = (n, e, t) => (Yt(n, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { CancelableRequest as O, isCanceledError as et } from "@krivega/cancelable-promise";
5
+ import Ye from "events-constructor";
6
+ import ne from "debug";
7
+ import { default as mr } from "debug";
8
+ import { debounce as Gt } from "ts-debounce";
9
+ import Xt from "sequent-promises";
10
+ import zt from "stack-promises";
11
+ const Kt = "Connection Error", tt = "Request Timeout", Jt = "SIP Failure Code", Qt = "Internal Error", jt = "Busy", nt = "Rejected", Zt = "Redirected", en = "Unavailable", se = "Not Found", tn = "Address Incomplete", nn = "Incompatible SDP", sn = "Missing SDP", rn = "Authentication Error", st = "Terminated", on = "WebRTC Error", rt = "Canceled", an = "No Answer", cn = "Expires", un = "No ACK", En = "Dialog Error", _n = "User Denied Media Access", re = "Bad Media Description", ln = "RTP Timeout", ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11
12
  __proto__: null,
12
- ADDRESS_INCOMPLETE: _r,
13
- AUTHENTICATION_ERROR: hr,
14
- BAD_MEDIA_DESCRIPTION: Re,
15
- BUSY: cr,
16
- BYE: Xt,
17
- CANCELED: zt,
18
- CONNECTION_ERROR: or,
19
- DIALOG_ERROR: mr,
20
- EXPIRES: gr,
21
- INCOMPATIBLE_SDP: dr,
22
- INTERNAL_ERROR: ar,
23
- MISSING_SDP: Er,
24
- NOT_FOUND: Ce,
25
- NO_ACK: Tr,
26
- NO_ANSWER: Sr,
27
- REDIRECTED: ur,
28
- REJECTED: Yt,
29
- REQUEST_TIMEOUT: Gt,
30
- RTP_TIMEOUT: Rr,
31
- SIP_FAILURE_CODE: ir,
32
- UNAVAILABLE: lr,
33
- USER_DENIED_MEDIA_ACCESS: Cr,
34
- WEBRTC_ERROR: fr
35
- }, Symbol.toStringTag, { value: "Module" })), Ne = "incomingCall", ve = "declinedIncomingCall", Ae = "failedIncomingCall", pe = "terminatedIncomingCall", ne = "connecting", V = "connected", w = "disconnected", q = "newRTCSession", F = "registered", be = "unregistered", k = "registrationFailed", Jt = "newMessage", ye = "sipEvent", Ie = "availableSecondRemoteStream", Oe = "notAvailableSecondRemoteStream", Me = "mustStopPresentation", G = "shareState", Pe = "enterRoom", De = "useLicense", we = "peerconnection:confirmed", $e = "peerconnection:ontrack", Y = "channels", Le = "channels:notify", Ue = "ended:fromserver", Fe = "main-cam-control", ke = "admin-stop-main-cam", Be = "admin-start-main-cam", xe = "admin-stop-mic", He = "admin-start-mic", X = "admin-force-sync-media-state", We = "participant:added-to-list-moderators", je = "participant:removed-from-list-moderators", Ve = "participant:move-request-to-conference", qe = "participant:move-request-to-stream", Ge = "participant:canceling-word-request", Ye = "webcast:started", Xe = "webcast:stopped", ze = "account:changed", Je = "account:deleted", Ke = "conference:participant-token-issued", B = "ended", Kt = "sending", Qt = "reinvite", Zt = "replaces", en = "refer", tn = "progress", nn = "accepted", z = "confirmed", J = "peerconnection", $ = "failed", rn = "muted", sn = "unmuted", Qe = "newDTMF", Ze = "newInfo", on = "hold", an = "unhold", cn = "update", un = "sdp", ln = "icecandidate", _n = "getusermediafailed", dn = "peerconnection:createofferfailed", En = "peerconnection:createanswerfailed", hn = "peerconnection:setlocaldescriptionfailed", fn = "peerconnection:setremotedescriptionfailed", Sn = "presentation:start", gn = "presentation:started", Tn = "presentation:end", et = "presentation:ended", K = "presentation:failed", Ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13
+ ADDRESS_INCOMPLETE: tn,
14
+ AUTHENTICATION_ERROR: rn,
15
+ BAD_MEDIA_DESCRIPTION: re,
16
+ BUSY: jt,
17
+ BYE: st,
18
+ CANCELED: rt,
19
+ CONNECTION_ERROR: Kt,
20
+ DIALOG_ERROR: En,
21
+ EXPIRES: cn,
22
+ INCOMPATIBLE_SDP: nn,
23
+ INTERNAL_ERROR: Qt,
24
+ MISSING_SDP: sn,
25
+ NOT_FOUND: se,
26
+ NO_ACK: un,
27
+ NO_ANSWER: an,
28
+ REDIRECTED: Zt,
29
+ REJECTED: nt,
30
+ REQUEST_TIMEOUT: tt,
31
+ RTP_TIMEOUT: ln,
32
+ SIP_FAILURE_CODE: Jt,
33
+ UNAVAILABLE: en,
34
+ USER_DENIED_MEDIA_ACCESS: _n,
35
+ WEBRTC_ERROR: on
36
+ }, Symbol.toStringTag, { value: "Module" })), oe = "incomingCall", ie = "declinedIncomingCall", ae = "failedIncomingCall", ce = "terminatedIncomingCall", z = "connecting", V = "connected", D = "disconnected", W = "newRTCSession", L = "registered", ue = "unregistered", B = "registrationFailed", ot = "newMessage", Ee = "sipEvent", _e = "availableSecondRemoteStream", le = "notAvailableSecondRemoteStream", de = "mustStopPresentation", q = "shareState", Se = "enterRoom", he = "useLicense", Te = "peerconnection:confirmed", Ce = "peerconnection:ontrack", $ = "channels", ge = "channels:notify", Ne = "ended:fromserver", me = "main-cam-control", Re = "admin-stop-main-cam", Ae = "admin-start-main-cam", fe = "admin-stop-mic", Ie = "admin-start-mic", x = "admin-force-sync-media-state", Me = "participant:added-to-list-moderators", Oe = "participant:removed-from-list-moderators", Pe = "participant:move-request-to-conference", De = "participant:move-request-to-stream", pe = "participant:canceling-word-request", ve = "webcast:started", ye = "webcast:stopped", be = "account:changed", we = "account:deleted", Ue = "conference:participant-token-issued", F = "ended", it = "sending", at = "reinvite", ct = "replaces", ut = "refer", Et = "progress", _t = "accepted", Y = "confirmed", G = "peerconnection", y = "failed", lt = "muted", dt = "unmuted", Le = "newDTMF", Be = "newInfo", St = "hold", ht = "unhold", Tt = "update", Ct = "sdp", gt = "icecandidate", Nt = "getusermediafailed", mt = "peerconnection:createofferfailed", Rt = "peerconnection:createanswerfailed", At = "peerconnection:setlocaldescriptionfailed", ft = "peerconnection:setremotedescriptionfailed", It = "presentation:start", Mt = "presentation:started", Ot = "presentation:end", Fe = "presentation:ended", X = "presentation:failed", Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
36
37
  __proto__: null,
37
- ACCEPTED: nn,
38
- ACCOUNT_CHANGED: ze,
39
- ACCOUNT_DELETED: Je,
40
- ADMIN_FORCE_SYNC_MEDIA_STATE: X,
41
- ADMIN_START_MAIN_CAM: Be,
42
- ADMIN_START_MIC: He,
43
- ADMIN_STOP_MAIN_CAM: ke,
44
- ADMIN_STOP_MIC: xe,
45
- AVAILABLE_SECOND_REMOTE_STREAM_EVENT: Ie,
46
- CHANNELS: Y,
47
- CHANNELS_NOTIFY: Le,
48
- CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ke,
49
- CONFIRMED: z,
38
+ ACCEPTED: _t,
39
+ ACCOUNT_CHANGED: be,
40
+ ACCOUNT_DELETED: we,
41
+ ADMIN_FORCE_SYNC_MEDIA_STATE: x,
42
+ ADMIN_START_MAIN_CAM: Ae,
43
+ ADMIN_START_MIC: Ie,
44
+ ADMIN_STOP_MAIN_CAM: Re,
45
+ ADMIN_STOP_MIC: fe,
46
+ AVAILABLE_SECOND_REMOTE_STREAM_EVENT: _e,
47
+ CHANNELS: $,
48
+ CHANNELS_NOTIFY: ge,
49
+ CONFERENCE_PARTICIPANT_TOKEN_ISSUED: Ue,
50
+ CONFIRMED: Y,
50
51
  CONNECTED: V,
51
- CONNECTING: ne,
52
- DECLINED_INCOMING_CALL: ve,
53
- DISCONNECTED: w,
54
- ENDED: B,
55
- ENDED_FROM_SERVER: Ue,
56
- ENTER_ROOM: Pe,
57
- FAILED: $,
58
- FAILED_INCOMING_CALL: Ae,
59
- GET_USER_MEDIA_FAILED: _n,
60
- HOLD: on,
61
- ICE_CANDIDATE: ln,
62
- INCOMING_CALL: Ne,
63
- MAIN_CAM_CONTROL: Fe,
64
- MUST_STOP_PRESENTATION_EVENT: Me,
65
- MUTED: rn,
66
- NEW_DTMF: Qe,
67
- NEW_INFO: Ze,
68
- NEW_MESSAGE: Jt,
69
- NEW_RTC_SESSION: q,
70
- NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: Oe,
71
- PARTICIPANT_ADDED_TO_LIST_MODERATORS: We,
72
- PARTICIPANT_CANCELLING_WORD_REQUEST: Ge,
73
- PARTICIPANT_MOVE_REQUEST_TO_CONFERENCE: Ve,
74
- PARTICIPANT_MOVE_REQUEST_TO_STREAM: qe,
75
- PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: je,
76
- PEER_CONNECTION: J,
77
- PEER_CONNECTION_CONFIRMED: we,
78
- PEER_CONNECTION_CREATE_ANSWER_FAILED: En,
79
- PEER_CONNECTION_CREATE_OFFER_FAILED: dn,
80
- PEER_CONNECTION_ONTRACK: $e,
81
- PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: hn,
82
- PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: fn,
83
- PRESENTATION_END: Tn,
84
- PRESENTATION_ENDED: et,
85
- PRESENTATION_FAILED: K,
86
- PRESENTATION_START: Sn,
87
- PRESENTATION_STARTED: gn,
88
- PROGRESS: tn,
89
- REFER: en,
90
- REGISTERED: F,
91
- REGISTRATION_FAILED: k,
92
- REINVITE: Qt,
93
- REPLACES: Zt,
94
- SDP: un,
95
- SENDING: Kt,
96
- SHARE_STATE: G,
97
- SIP_EVENT: ye,
98
- TERMINATED_INCOMING_CALL: pe,
99
- UNHOLD: an,
100
- UNMUTED: sn,
101
- UNREGISTERED: be,
102
- UPDATE: cn,
103
- USE_LICENSE: De,
104
- WEBCAST_STARTED: Ye,
105
- WEBCAST_STOPPED: Xe
106
- }, Symbol.toStringTag, { value: "Module" })), mn = [
107
- Ne,
108
- ve,
52
+ CONNECTING: z,
53
+ DECLINED_INCOMING_CALL: ie,
54
+ DISCONNECTED: D,
55
+ ENDED: F,
56
+ ENDED_FROM_SERVER: Ne,
57
+ ENTER_ROOM: Se,
58
+ FAILED: y,
59
+ FAILED_INCOMING_CALL: ae,
60
+ GET_USER_MEDIA_FAILED: Nt,
61
+ HOLD: St,
62
+ ICE_CANDIDATE: gt,
63
+ INCOMING_CALL: oe,
64
+ MAIN_CAM_CONTROL: me,
65
+ MUST_STOP_PRESENTATION_EVENT: de,
66
+ MUTED: lt,
67
+ NEW_DTMF: Le,
68
+ NEW_INFO: Be,
69
+ NEW_MESSAGE: ot,
70
+ NEW_RTC_SESSION: W,
71
+ NOT_AVAILABLE_SECOND_REMOTE_STREAM_EVENT: le,
72
+ PARTICIPANT_ADDED_TO_LIST_MODERATORS: Me,
73
+ PARTICIPANT_CANCELLING_WORD_REQUEST: pe,
74
+ PARTICIPANT_MOVE_REQUEST_TO_CONFERENCE: Pe,
75
+ PARTICIPANT_MOVE_REQUEST_TO_STREAM: De,
76
+ PARTICIPANT_REMOVED_FROM_LIST_MODERATORS: Oe,
77
+ PEER_CONNECTION: G,
78
+ PEER_CONNECTION_CONFIRMED: Te,
79
+ PEER_CONNECTION_CREATE_ANSWER_FAILED: Rt,
80
+ PEER_CONNECTION_CREATE_OFFER_FAILED: mt,
81
+ PEER_CONNECTION_ONTRACK: Ce,
82
+ PEER_CONNECTION_SET_LOCAL_DESCRIPTION_FAILED: At,
83
+ PEER_CONNECTION_SET_REMOTE_DESCRIPTION_FAILED: ft,
84
+ PRESENTATION_END: Ot,
85
+ PRESENTATION_ENDED: Fe,
86
+ PRESENTATION_FAILED: X,
87
+ PRESENTATION_START: It,
88
+ PRESENTATION_STARTED: Mt,
89
+ PROGRESS: Et,
90
+ REFER: ut,
91
+ REGISTERED: L,
92
+ REGISTRATION_FAILED: B,
93
+ REINVITE: at,
94
+ REPLACES: ct,
95
+ SDP: Ct,
96
+ SENDING: it,
97
+ SHARE_STATE: q,
98
+ SIP_EVENT: Ee,
99
+ TERMINATED_INCOMING_CALL: ce,
100
+ UNHOLD: ht,
101
+ UNMUTED: dt,
102
+ UNREGISTERED: ue,
103
+ UPDATE: Tt,
104
+ USE_LICENSE: he,
105
+ WEBCAST_STARTED: ve,
106
+ WEBCAST_STOPPED: ye
107
+ }, Symbol.toStringTag, { value: "Module" })), Pt = [
108
+ oe,
109
+ ie,
110
+ ce,
111
+ ae,
109
112
  pe,
110
- Ae,
111
- Ge,
112
- qe,
113
- Ve,
114
- Le,
115
- Ke,
116
- ze,
117
- Je,
118
- Ye,
119
- Xe,
120
- We,
121
- je
122
- ], tt = [
123
- ne,
113
+ De,
114
+ Pe,
115
+ ge,
116
+ Ue,
117
+ be,
118
+ we,
119
+ ve,
120
+ ye,
121
+ Me,
122
+ Oe
123
+ ], ke = [
124
+ z,
124
125
  V,
125
- w,
126
+ D,
127
+ W,
128
+ L,
129
+ ue,
130
+ B,
131
+ ot,
132
+ Ee
133
+ ], Dt = [
134
+ _e,
135
+ le,
136
+ de,
126
137
  q,
127
- F,
128
- be,
129
- k,
130
- Jt,
131
- ye
132
- ], Cn = [
138
+ Se,
139
+ he,
140
+ Te,
141
+ Ce,
142
+ $,
143
+ Ne,
144
+ me,
145
+ Ae,
146
+ Re,
147
+ fe,
133
148
  Ie,
134
- Oe,
135
- Me,
136
- G,
137
- Pe,
138
- De,
139
- we,
140
- $e,
149
+ x
150
+ ], He = [
151
+ F,
152
+ z,
153
+ it,
154
+ at,
155
+ ct,
156
+ ut,
157
+ Et,
158
+ _t,
141
159
  Y,
142
- Ue,
143
- Fe,
160
+ G,
161
+ y,
162
+ lt,
163
+ dt,
164
+ Le,
144
165
  Be,
145
- ke,
146
- xe,
147
- He,
166
+ St,
167
+ ht,
168
+ Tt,
169
+ Ct,
170
+ gt,
171
+ Nt,
172
+ mt,
173
+ Rt,
174
+ At,
175
+ ft,
176
+ It,
177
+ Mt,
178
+ Ot,
179
+ Fe,
148
180
  X
149
- ], nt = [
150
- B,
151
- ne,
152
- Kt,
153
- Qt,
154
- Zt,
155
- en,
156
- tn,
157
- nn,
158
- z,
159
- J,
160
- $,
161
- rn,
162
- sn,
163
- Qe,
164
- Ze,
165
- on,
166
- an,
167
- cn,
168
- un,
169
- ln,
170
- _n,
171
- dn,
172
- En,
173
- hn,
174
- fn,
175
- Sn,
176
- gn,
177
- Tn,
178
- et,
179
- K
180
- ], Rn = [...tt, ...mn], Nn = [
181
- ...nt,
182
- ...Cn
183
- ], Pl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
181
+ ], pt = [...ke, ...Pt], vt = [
182
+ ...He,
183
+ ...Dt
184
+ ], _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
184
185
  __proto__: null,
185
- SESSION_EVENT_NAMES: Nn,
186
- SESSION_JSSIP_EVENT_NAMES: nt,
187
- SESSION_SYNTHETICS_EVENT_NAMES: Cn,
188
- UA_EVENT_NAMES: Rn,
189
- UA_JSSIP_EVENT_NAMES: tt,
190
- UA_SYNTHETICS_EVENT_NAMES: mn
191
- }, Symbol.toStringTag, { value: "Module" })), Nr = (e) => {
192
- const t = [];
193
- return e && t.push(`X-Vinteo-Remote: ${e}`), t;
194
- }, vr = "content-type", Ar = "x-webrtc-enter-room", ae = "application/vinteo.webrtc.sharedesktop", pr = "application/vinteo.webrtc.roomname", br = "application/vinteo.webrtc.channels", yr = "application/vinteo.webrtc.mediastate", Ir = "application/vinteo.webrtc.refusal", Et = "application/vinteo.webrtc.maincam", Or = "application/vinteo.webrtc.mic", Mr = "application/vinteo.webrtc.uselic", Pr = "X-WEBRTC-USE-LICENSE", ht = "X-WEBRTC-INPUT-CHANNELS", ft = "X-WEBRTC-OUTPUT-CHANNELS", Dr = "X-WEBRTC-MAINCAM", wr = "X-WEBRTC-MIC", St = "X-WEBRTC-SYNC", $r = "X-WEBRTC-MAINCAM-RESOLUTION", Lr = "X-WEBRTC-MEDIA-STATE", Ur = "X-Vinteo-Media-Type", Fr = "X-Vinteo-MainCam-State", kr = "X-Vinteo-Mic-State", Br = "application/vinteo.webrtc.notify", xr = "X-VINTEO-NOTIFY", H = "x-webrtc-share-state", Hr = `${H}: LETMESTARTPRESENTATION`, Wr = `${H}: STOPPRESENTATION`, vn = "YOUCANRECEIVECONTENT", An = "CONTENTEND", jr = "YOUMUSTSTOPSENDCONTENT", Vr = `${H}: ${vn}`, qr = `${H}: ${An}`, Gr = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", Yr = `${Gr}: LETMESTARTMAINCAM`, rt = "sip-connector", _ = me(rt), Dl = () => {
195
- me.enable(`${rt}`);
196
- }, wl = () => {
197
- me.enable(`-${rt}`);
186
+ SESSION_EVENT_NAMES: vt,
187
+ SESSION_JSSIP_EVENT_NAMES: He,
188
+ SESSION_SYNTHETICS_EVENT_NAMES: Dt,
189
+ UA_EVENT_NAMES: pt,
190
+ UA_JSSIP_EVENT_NAMES: ke,
191
+ UA_SYNTHETICS_EVENT_NAMES: Pt
192
+ }, Symbol.toStringTag, { value: "Module" })), dn = (n) => {
193
+ const e = [];
194
+ return n && e.push(`X-Vinteo-Remote: ${n}`), e;
195
+ }, Sn = "content-type", hn = "x-webrtc-enter-room", K = "application/vinteo.webrtc.sharedesktop", Tn = "application/vinteo.webrtc.roomname", Cn = "application/vinteo.webrtc.channels", gn = "application/vinteo.webrtc.mediastate", Nn = "application/vinteo.webrtc.refusal", Ge = "application/vinteo.webrtc.maincam", mn = "application/vinteo.webrtc.mic", Rn = "application/vinteo.webrtc.uselic", An = "X-WEBRTC-USE-LICENSE", Xe = "X-WEBRTC-INPUT-CHANNELS", ze = "X-WEBRTC-OUTPUT-CHANNELS", fn = "X-WEBRTC-MAINCAM", In = "X-WEBRTC-MIC", Ke = "X-WEBRTC-SYNC", Mn = "X-WEBRTC-MAINCAM-RESOLUTION", On = "X-WEBRTC-MEDIA-STATE", Pn = "X-Vinteo-Media-Type", Dn = "X-Vinteo-MainCam-State", pn = "X-Vinteo-Mic-State", vn = "application/vinteo.webrtc.notify", yn = "X-VINTEO-NOTIFY", H = "x-webrtc-share-state", bn = `${H}: LETMESTARTPRESENTATION`, wn = `${H}: STOPPRESENTATION`, yt = "YOUCANRECEIVECONTENT", bt = "CONTENTEND", Un = "YOUMUSTSTOPSENDCONTENT", Ln = `${H}: ${yt}`, Bn = `${H}: ${bt}`, Fn = "X-WEBRTC-REQUEST-ENABLE-MEDIA-DEVICE", kn = `${Fn}: LETMESTARTMAINCAM`, Ve = "sip-connector", E = ne(Ve), lr = () => {
196
+ ne.enable(`${Ve}`);
197
+ }, dr = () => {
198
+ ne.enable(`-${Ve}`);
198
199
  };
199
- var M = /* @__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))(M || {}), he = /* @__PURE__ */ ((e) => (e.ADMIN_STOP_MIC = "ADMINSTOPMIC", e.ADMIN_START_MIC = "ADMINSTARTMIC", e))(he || {}), fe = /* @__PURE__ */ ((e) => (e.ADMIN_SYNC_FORCED = "1", e.ADMIN_SYNC_NOT_FORCED = "0", e))(fe || {}), Xr = /* @__PURE__ */ ((e) => (e.AUDIO = "AUDIO", e.VIDEO = "VIDEO", e.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", e))(Xr || {});
200
- function zr(e) {
201
- return (t) => `sip:${t}@${e}`;
200
+ var I = /* @__PURE__ */ ((n) => (n.PAUSE_MAIN_CAM = "PAUSEMAINCAM", n.RESUME_MAIN_CAM = "RESUMEMAINCAM", n.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", n.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", n.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", n))(I || {}), Z = /* @__PURE__ */ ((n) => (n.ADMIN_STOP_MIC = "ADMINSTOPMIC", n.ADMIN_START_MIC = "ADMINSTARTMIC", n))(Z || {}), ee = /* @__PURE__ */ ((n) => (n.ADMIN_SYNC_FORCED = "1", n.ADMIN_SYNC_NOT_FORCED = "0", n))(ee || {}), Hn = /* @__PURE__ */ ((n) => (n.AUDIO = "AUDIO", n.VIDEO = "VIDEO", n.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", n))(Hn || {});
201
+ function Vn(n) {
202
+ return (e) => `sip:${e}@${n}`;
202
203
  }
203
- const Jr = (e, t) => () => Math.floor(Math.random() * (t - e)) + e, gt = (e) => e.trim().replaceAll(" ", "_"), Kr = Jr(1e5, 99999999), ce = (e, {
204
- videoMode: t,
205
- audioMode: n
204
+ const Wn = (n, e) => () => Math.floor(Math.random() * (e - n)) + n, Je = (n) => n.trim().replaceAll(" ", "_"), qn = Wn(1e5, 99999999), J = (n, {
205
+ videoMode: e,
206
+ audioMode: t
206
207
  } = {}) => {
207
- if (!e || t === "recvonly" && n === "recvonly")
208
+ if (!n || e === "recvonly" && t === "recvonly")
208
209
  return;
209
- const r = n === "recvonly" ? [] : e.getAudioTracks(), s = t === "recvonly" ? [] : e.getVideoTracks(), o = [...r, ...s], i = new MediaStream(o);
210
+ const s = t === "recvonly" ? [] : n.getAudioTracks(), r = e === "recvonly" ? [] : n.getVideoTracks(), o = [...s, ...r], i = new MediaStream(o);
210
211
  return i.getTracks = () => [...i.getAudioTracks(), ...i.getVideoTracks()], i;
211
- }, Qr = (e) => e.some((n) => {
212
- const { kind: r } = n;
213
- return r === "video";
214
- }), Zr = "Error decline with 603", es = (e) => e.message === Zr, ts = (e, t) => e.find((n) => n.track && t.getTracks().includes(n.track)), pn = 1, bn = (e) => (t, n) => n !== void 0 && t !== n || n === void 0 && t !== e, ns = bn(
215
- pn
216
- ), rs = (e, t) => {
217
- const n = e === void 0 ? void 0 : Math.max(e, pn);
218
- if (n !== void 0 && ns(
219
- n,
220
- t
212
+ }, $n = (n) => n.some((t) => {
213
+ const { kind: s } = t;
214
+ return s === "video";
215
+ }), xn = "Error decline with 603", Yn = (n) => n.message === xn, Gn = (n, e) => n.find((t) => t.track && e.getTracks().includes(t.track)), wt = 1, Ut = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, Xn = Ut(
216
+ wt
217
+ ), zn = (n, e) => {
218
+ const t = n === void 0 ? void 0 : Math.max(n, wt);
219
+ if (t !== void 0 && Xn(
220
+ t,
221
+ e
221
222
  ))
223
+ return t;
224
+ }, Kn = Ut(), Jn = (n, e) => {
225
+ if (Kn(n, e))
222
226
  return n;
223
- }, ss = bn(), os = (e, t) => {
224
- if (ss(e, t))
225
- return e;
226
- }, yn = async (e, t, n) => {
227
- const r = e.getParameters();
228
- (r.encodings === void 0 || r.encodings.length === 0) && (r.encodings = [{}]);
229
- const [s] = r.encodings, o = s.scaleResolutionDownBy, i = rs(
230
- t.scaleResolutionDownBy,
227
+ }, Lt = async (n, e, t) => {
228
+ const s = n.getParameters();
229
+ (s.encodings === void 0 || s.encodings.length === 0) && (s.encodings = [{}]);
230
+ const [r] = s.encodings, o = r.scaleResolutionDownBy, i = zn(
231
+ e.scaleResolutionDownBy,
231
232
  o
232
233
  );
233
- let a = !1;
234
- i !== void 0 && (r.encodings[0].scaleResolutionDownBy = i, a = !0);
235
- const u = s.maxBitrate, l = os(t.maxBitrate, u);
236
- return l !== void 0 && (r.encodings[0].maxBitrate = l, a = !0), a ? (n && n(r), e.setParameters(r).then(() => ({ parameters: r, isChanged: a }))) : { parameters: r, isChanged: a };
237
- }, is = async (e, t, n) => {
238
- const r = ts(e, t);
239
- if (r)
240
- return yn(r, { maxBitrate: n });
241
- }, as = 486, cs = 487, Se = "local", Tt = "remote", $l = (e = new Error()) => {
242
- const { originator: t, cause: n } = e;
243
- return qt(e) ? !0 : typeof n == "string" ? n === Gt || n === Yt || t === Se && (n === zt || n === Xt) : !1;
244
- }, D = "SipConnector", us = "channels", ls = "WebcastStarted", _s = "WebcastStopped", ds = "accountChanged", Es = "accountDeleted", hs = "addedToListModerators", fs = "removedFromListModerators", Ss = "WebcastParticipationAccepted", gs = "WebcastParticipationRejected", Ts = "ParticipantMovedToWebcast", ms = "ConferenceParticipantTokenIssued";
245
- class Ll {
246
- constructor({ JsSIP: t }) {
247
- c(this, "_isRegisterConfig", !1);
248
- c(this, "_connectionConfiguration", {});
249
- c(this, "_remoteStreams", {});
250
- c(this, "JsSIP");
251
- c(this, "_sessionEvents");
252
- c(this, "_uaEvents");
253
- c(this, "_cancelableConnect");
254
- c(this, "_cancelableCreateUa");
255
- c(this, "_cancelableDisconnect");
256
- c(this, "_cancelableSet");
257
- c(this, "_cancelableCall");
258
- c(this, "_cancelableAnswer");
259
- c(this, "_cancelableSendDTMF");
260
- c(this, "getSipServerUrl", (t) => t);
261
- c(this, "promisePendingStartPresentation");
262
- c(this, "promisePendingStopPresentation");
263
- c(this, "ua");
264
- c(this, "session");
265
- c(this, "incomingSession");
266
- c(this, "_streamPresentationCurrent");
267
- c(this, "socket");
268
- c(this, "connect", async (t) => (this._cancelRequests(), this._cancelableConnect.request(t)));
269
- c(this, "createUa", async (t) => this._cancelableCreateUa.request(t));
270
- c(this, "set", async (t) => this._cancelableSet.request(t));
271
- c(this, "call", async (t) => this._cancelableCall.request(t));
272
- c(this, "disconnect", async () => (this._cancelRequests(), this._disconnectWithoutCancelRequests()));
273
- c(this, "answerToIncomingCall", async (t) => this._cancelableAnswer.request(t));
274
- c(this, "sendDTMF", async (t) => this._cancelableSendDTMF.request(t));
275
- c(this, "hangUp", async () => (this._cancelRequests(), this._hangUpWithoutCancelRequests()));
276
- c(this, "tryRegister", async () => {
234
+ let c = !1;
235
+ i !== void 0 && (s.encodings[0].scaleResolutionDownBy = i, c = !0);
236
+ const u = r.maxBitrate, _ = Jn(e.maxBitrate, u);
237
+ return _ !== void 0 && (s.encodings[0].maxBitrate = _, c = !0), c ? (t && t(s), n.setParameters(s).then(() => ({ parameters: s, isChanged: c }))) : { parameters: s, isChanged: c };
238
+ }, Qn = async (n, e, t) => {
239
+ const s = Gn(n, e);
240
+ if (s)
241
+ return Lt(s, { maxBitrate: t });
242
+ }, jn = 486, Zn = 487, te = "local", Qe = "remote", Sr = (n = new Error()) => {
243
+ const { originator: e, cause: t } = n;
244
+ return et(n) ? !0 : typeof t == "string" ? t === tt || t === nt || e === te && (t === rt || t === st) : !1;
245
+ }, P = "SipConnector", es = "channels", ts = "WebcastStarted", ns = "WebcastStopped", ss = "accountChanged", rs = "accountDeleted", os = "addedToListModerators", is = "removedFromListModerators", as = "WebcastParticipationAccepted", cs = "WebcastParticipationRejected", us = "ParticipantMovedToWebcast", Es = "ConferenceParticipantTokenIssued";
246
+ class hr {
247
+ constructor({ JsSIP: e }) {
248
+ a(this, "_isRegisterConfig", !1);
249
+ a(this, "_connectionConfiguration", {});
250
+ a(this, "_remoteStreams", {});
251
+ a(this, "JsSIP");
252
+ a(this, "_sessionEvents");
253
+ a(this, "_uaEvents");
254
+ a(this, "_cancelableConnect");
255
+ a(this, "_cancelableCreateUa");
256
+ a(this, "_cancelableDisconnect");
257
+ a(this, "_cancelableSet");
258
+ a(this, "_cancelableCall");
259
+ a(this, "_cancelableAnswer");
260
+ a(this, "_cancelableSendDTMF");
261
+ a(this, "getSipServerUrl", (e) => e);
262
+ a(this, "promisePendingStartPresentation");
263
+ a(this, "promisePendingStopPresentation");
264
+ a(this, "ua");
265
+ a(this, "session");
266
+ a(this, "incomingSession");
267
+ a(this, "_streamPresentationCurrent");
268
+ a(this, "socket");
269
+ a(this, "connect", async (e) => (this._cancelRequests(), this._cancelableConnect.request(e)));
270
+ a(this, "createUa", async (e) => this._cancelableCreateUa.request(e));
271
+ a(this, "set", async (e) => this._cancelableSet.request(e));
272
+ a(this, "call", async (e) => this._cancelableCall.request(e));
273
+ a(this, "disconnect", async () => (this._cancelRequests(), this._disconnectWithoutCancelRequests()));
274
+ a(this, "answerToIncomingCall", async (e) => this._cancelableAnswer.request(e));
275
+ a(this, "sendDTMF", async (e) => this._cancelableSendDTMF.request(e));
276
+ a(this, "hangUp", async () => (this._cancelRequests(), this._hangUpWithoutCancelRequests()));
277
+ a(this, "tryRegister", async () => {
277
278
  if (!this.isRegisterConfig)
278
279
  throw new Error("Config is not registered");
279
- this._uaEvents.trigger(ne, void 0);
280
+ this._uaEvents.trigger(z, void 0);
280
281
  try {
281
282
  await this.unregister();
282
- } catch (t) {
283
- _("tryRegister", t);
283
+ } catch (e) {
284
+ E("tryRegister", e);
284
285
  }
285
286
  return this.register();
286
287
  });
287
- c(this, "declineToIncomingCall", async ({ statusCode: t = cs } = {}) => new Promise((n, r) => {
288
+ a(this, "declineToIncomingCall", async ({ statusCode: e = Zn } = {}) => new Promise((t, s) => {
288
289
  if (!this.isAvailableIncomingCall) {
289
- r(new Error("no incomingSession"));
290
+ s(new Error("no incomingSession"));
290
291
  return;
291
292
  }
292
- const s = this.incomingSession, o = this.remoteCallerData;
293
- this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(ve, o), n(s.terminate({ status_code: t }));
293
+ const r = this.incomingSession, o = this.remoteCallerData;
294
+ this._cancelableCall.cancelRequest(), this._cancelableAnswer.cancelRequest(), this.removeIncomingSession(), this._uaEvents.trigger(ie, o), t(r.terminate({ status_code: e }));
294
295
  }));
295
- c(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: as }));
296
- c(this, "removeIncomingSession", () => {
296
+ a(this, "busyIncomingCall", async () => this.declineToIncomingCall({ statusCode: jn }));
297
+ a(this, "removeIncomingSession", () => {
297
298
  delete this.incomingSession;
298
299
  });
299
- c(this, "handleNewRTCSession", ({ originator: t, session: n }) => {
300
- if (t === Tt) {
301
- this.incomingSession = n;
302
- const r = this.remoteCallerData;
303
- n.on($, (s) => {
304
- this.removeIncomingSession(), s.originator === Se ? this._uaEvents.trigger(pe, r) : this._uaEvents.trigger(Ae, r);
305
- }), this._uaEvents.trigger(Ne, r);
300
+ a(this, "handleNewRTCSession", ({ originator: e, session: t }) => {
301
+ if (e === Qe) {
302
+ this.incomingSession = t;
303
+ const s = this.remoteCallerData;
304
+ t.on(y, (r) => {
305
+ this.removeIncomingSession(), r.originator === te ? this._uaEvents.trigger(ce, s) : this._uaEvents.trigger(ae, s);
306
+ }), this._uaEvents.trigger(oe, s);
306
307
  }
307
308
  });
308
- c(this, "_connect", async (t) => this.createUa(t).then(async () => this._start()));
309
- c(this, "_createUa", async ({
310
- displayName: t = "",
311
- user: n,
312
- password: r,
313
- register: s = !1,
309
+ a(this, "_connect", async (e) => this.createUa(e).then(async () => this._start()));
310
+ a(this, "_createUa", async ({
311
+ displayName: e = "",
312
+ user: t,
313
+ password: s,
314
+ register: r = !1,
314
315
  sipServerUrl: o,
315
316
  sipWebSocketServerURL: i,
316
- remoteAddress: a,
317
+ remoteAddress: c,
317
318
  extraHeaders: u = [],
318
- sdpSemantics: l = "plan-b",
319
- sessionTimers: d = !1,
320
- registerExpires: E = 60 * 5,
319
+ sdpSemantics: _ = "plan-b",
320
+ sessionTimers: l = !1,
321
+ registerExpires: d = 60 * 5,
321
322
  // 5 minutes in sec
322
- connectionRecoveryMinInterval: h = 2,
323
- connectionRecoveryMaxInterval: S = 6,
324
- userAgent: g
323
+ connectionRecoveryMinInterval: S = 2,
324
+ connectionRecoveryMaxInterval: h = 6,
325
+ userAgent: T
325
326
  }) => {
326
327
  if (!o)
327
328
  throw new Error("sipServerUrl is required");
328
329
  if (!i)
329
330
  throw new Error("sipWebSocketServerURL is required");
330
- if (s && !n)
331
+ if (r && !t)
331
332
  throw new Error("user is required for authorized connection");
332
- if (s && !r)
333
+ if (r && !s)
333
334
  throw new Error("password is required for authorized connection");
334
335
  this._connectionConfiguration = {
335
336
  sipServerUrl: o,
336
- displayName: t,
337
- register: s,
338
- user: n,
339
- password: r
337
+ displayName: e,
338
+ register: r,
339
+ user: t,
340
+ password: s
340
341
  }, this._init({ sipServerUrl: o, sipWebSocketServerURL: i });
341
- const m = s && n ? n.trim() : `${Kr()}`, C = {
342
- password: r,
343
- register: s,
344
- display_name: gt(t),
345
- user_agent: g,
346
- sdp_semantics: l,
342
+ const g = r && t ? t.trim() : `${qn()}`, N = {
343
+ password: s,
344
+ register: r,
345
+ display_name: Je(e),
346
+ user_agent: T,
347
+ sdp_semantics: _,
347
348
  sockets: [this.socket],
348
- uri: this.getSipServerUrl(m),
349
- session_timers: d,
350
- register_expires: E,
351
- connection_recovery_min_interval: h,
352
- connection_recovery_max_interval: S
349
+ uri: this.getSipServerUrl(g),
350
+ session_timers: l,
351
+ register_expires: d,
352
+ connection_recovery_min_interval: S,
353
+ connection_recovery_max_interval: h
353
354
  };
354
- this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!C.register, this.ua = new this.JsSIP.UA(C), this._uaEvents.eachTriggers((N, v) => {
355
- const y = tt.find((f) => f === v);
356
- y && this.ua && this.ua.on(y, N);
355
+ this.ua && await this._disconnectWithoutCancelRequests(), this._isRegisterConfig = !!N.register, this.ua = new this.JsSIP.UA(N), this._uaEvents.eachTriggers((m, R) => {
356
+ const v = ke.find((f) => f === R);
357
+ v && this.ua && this.ua.on(v, m);
357
358
  });
358
- const b = [...Nr(a), ...u];
359
- return this.ua.registrator().setExtraHeaders(b), this.ua;
359
+ const M = [...dn(c), ...u];
360
+ return this.ua.registrator().setExtraHeaders(M), this.ua;
360
361
  });
361
- c(this, "_start", async () => new Promise((t, n) => {
362
- const { ua: r } = this;
363
- if (!r) {
364
- n(new Error("this.ua is not initialized"));
362
+ a(this, "_start", async () => new Promise((e, t) => {
363
+ const { ua: s } = this;
364
+ if (!s) {
365
+ t(new Error("this.ua is not initialized"));
365
366
  return;
366
367
  }
367
- const s = () => {
368
- a(), t(r);
368
+ const r = () => {
369
+ c(), e(s);
369
370
  }, o = (u) => {
370
- a(), n(u);
371
+ c(), t(u);
371
372
  }, i = () => {
372
- this.isRegisterConfig ? (this.on(F, s), this.on(k, o)) : this.on(V, s), this.on(w, o);
373
- }, a = () => {
374
- this.off(F, s), this.off(k, o), this.off(V, s), this.off(w, o);
373
+ this.isRegisterConfig ? (this.on(L, r), this.on(B, o)) : this.on(V, r), this.on(D, o);
374
+ }, c = () => {
375
+ this.off(L, r), this.off(B, o), this.off(V, r), this.off(D, o);
375
376
  };
376
- i(), this.on(q, this.handleNewRTCSession), r.start();
377
+ i(), this.on(W, this.handleNewRTCSession), s.start();
377
378
  }));
378
- c(this, "_set", async ({ displayName: t, password: n }) => new Promise((r, s) => {
379
+ a(this, "_set", async ({ displayName: e, password: t }) => new Promise((s, r) => {
379
380
  const { ua: o } = this;
380
381
  if (!o) {
381
- s(new Error("this.ua is not initialized"));
382
+ r(new Error("this.ua is not initialized"));
382
383
  return;
383
384
  }
384
- let i = !1, a = !1;
385
- t !== void 0 && t !== this._connectionConfiguration.displayName && (i = o.set("display_name", gt(t)), this._connectionConfiguration.displayName = t), n !== void 0 && n !== this._connectionConfiguration.password && (a = o.set("password", n), this._connectionConfiguration.password = n);
386
- const u = i || a;
387
- a && this.isRegisterConfig ? this.register().then(() => {
388
- r(u);
389
- }).catch(s) : u ? r(u) : s(u);
385
+ let i = !1, c = !1;
386
+ e !== void 0 && e !== this._connectionConfiguration.displayName && (i = o.set("display_name", Je(e)), this._connectionConfiguration.displayName = e), t !== void 0 && t !== this._connectionConfiguration.password && (c = o.set("password", t), this._connectionConfiguration.password = t);
387
+ const u = i || c;
388
+ c && this.isRegisterConfig ? this.register().then(() => {
389
+ s(u);
390
+ }).catch(r) : u ? s(u) : r(u);
390
391
  }));
391
- c(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
392
- c(this, "_disconnect", async () => {
393
- this.off(q, this.handleNewRTCSession);
394
- const t = new Promise((n) => {
395
- this.once(w, () => {
396
- delete this.ua, n();
392
+ a(this, "_disconnectWithoutCancelRequests", async () => this._cancelableDisconnect.request());
393
+ a(this, "_disconnect", async () => {
394
+ this.off(W, this.handleNewRTCSession);
395
+ const e = new Promise((t) => {
396
+ this.once(D, () => {
397
+ delete this.ua, t();
397
398
  });
398
399
  });
399
- return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(w, void 0)) : this._uaEvents.trigger(w, void 0), t;
400
+ return this.ua ? (await this._hangUpWithoutCancelRequests(), this.ua ? this.ua.stop() : this._uaEvents.trigger(D, void 0)) : this._uaEvents.trigger(D, void 0), e;
400
401
  });
401
- c(this, "_call", async ({
402
- number: t,
403
- mediaStream: n,
404
- extraHeaders: r = [],
405
- ontrack: s,
402
+ a(this, "_call", async ({
403
+ number: e,
404
+ mediaStream: t,
405
+ extraHeaders: s = [],
406
+ ontrack: r,
406
407
  iceServers: o,
407
408
  videoMode: i,
408
- audioMode: a,
409
+ audioMode: c,
409
410
  degradationPreference: u,
410
- offerToReceiveAudio: l = !0,
411
- offerToReceiveVideo: d = !0
412
- }) => new Promise((E, h) => {
413
- const { ua: S } = this;
414
- if (!S) {
415
- h(new Error("this.ua is not initialized"));
411
+ offerToReceiveAudio: _ = !0,
412
+ offerToReceiveVideo: l = !0
413
+ }) => new Promise((d, S) => {
414
+ const { ua: h } = this;
415
+ if (!h) {
416
+ S(new Error("this.ua is not initialized"));
416
417
  return;
417
418
  }
418
- this._connectionConfiguration.number = t, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: s }).then(E).catch(h), this.session = S.call(this.getSipServerUrl(t), {
419
- extraHeaders: r,
420
- mediaStream: ce(n, {
419
+ this._connectionConfiguration.number = e, this._connectionConfiguration.answer = !1, this._handleCall({ ontrack: r }).then(d).catch(S), this.session = h.call(this.getSipServerUrl(e), {
420
+ extraHeaders: s,
421
+ mediaStream: J(t, {
421
422
  videoMode: i,
422
- audioMode: a
423
+ audioMode: c
423
424
  }),
424
425
  eventHandlers: this._sessionEvents.triggers,
425
426
  videoMode: i,
426
- audioMode: a,
427
+ audioMode: c,
427
428
  degradationPreference: u,
428
429
  pcConfig: {
429
430
  iceServers: o
430
431
  },
431
432
  rtcOfferConstraints: {
432
- offerToReceiveAudio: l,
433
- offerToReceiveVideo: d
433
+ offerToReceiveAudio: _,
434
+ offerToReceiveVideo: l
434
435
  }
435
436
  });
436
437
  }));
437
- c(this, "_answer", async ({
438
- mediaStream: t,
439
- ontrack: n,
440
- extraHeaders: r = [],
441
- iceServers: s,
438
+ a(this, "_answer", async ({
439
+ mediaStream: e,
440
+ ontrack: t,
441
+ extraHeaders: s = [],
442
+ iceServers: r,
442
443
  videoMode: o,
443
444
  audioMode: i,
444
- degradationPreference: a
445
- }) => new Promise((u, l) => {
445
+ degradationPreference: c
446
+ }) => new Promise((u, _) => {
446
447
  if (!this.isAvailableIncomingCall) {
447
- l(new Error("no incomingSession"));
448
+ _(new Error("no incomingSession"));
448
449
  return;
449
450
  }
450
451
  this.session = this.incomingSession, this.removeIncomingSession();
451
- const { session: d } = this;
452
- if (!d) {
453
- l(new Error("No session established"));
452
+ const { session: l } = this;
453
+ if (!l) {
454
+ _(new Error("No session established"));
454
455
  return;
455
456
  }
456
- this._sessionEvents.eachTriggers((h, S) => {
457
- const g = nt.find((m) => m === S);
458
- g && d.on(g, h);
459
- }), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = d.remote_identity.uri.user, this._handleCall({ ontrack: n }).then(u).catch(l);
460
- const E = ce(t, {
457
+ this._sessionEvents.eachTriggers((S, h) => {
458
+ const T = He.find((g) => g === h);
459
+ T && l.on(T, S);
460
+ }), this._connectionConfiguration.answer = !0, this._connectionConfiguration.number = l.remote_identity.uri.user, this._handleCall({ ontrack: t }).then(u).catch(_);
461
+ const d = J(e, {
461
462
  videoMode: o,
462
463
  audioMode: i
463
464
  });
464
- d.answer({
465
- extraHeaders: r,
465
+ l.answer({
466
+ extraHeaders: s,
466
467
  videoMode: o,
467
468
  audioMode: i,
468
- degradationPreference: a,
469
- mediaStream: E,
469
+ degradationPreference: c,
470
+ mediaStream: d,
470
471
  pcConfig: {
471
- iceServers: s
472
+ iceServers: r
472
473
  }
473
474
  });
474
475
  }));
475
- c(this, "_handleCall", async ({ ontrack: t }) => new Promise((n, r) => {
476
- const s = () => {
477
- this.onSession(J, d), this.onSession(z, E);
476
+ a(this, "_handleCall", async ({ ontrack: e }) => new Promise((t, s) => {
477
+ const r = () => {
478
+ this.onSession(G, l), this.onSession(Y, d);
478
479
  }, o = () => {
479
- this.offSession(J, d), this.offSession(z, E);
480
+ this.offSession(G, l), this.offSession(Y, d);
480
481
  }, i = () => {
481
- this.onSession($, u), this.onSession(B, u);
482
- }, a = () => {
483
- this.offSession($, u), this.offSession(B, u);
484
- }, u = (h) => {
485
- o(), a(), r(h);
482
+ this.onSession(y, u), this.onSession(F, u);
483
+ }, c = () => {
484
+ this.offSession(y, u), this.offSession(F, u);
485
+ }, u = (S) => {
486
+ o(), c(), s(S);
486
487
  };
487
- let l;
488
- const d = ({ peerconnection: h }) => {
489
- l = h, l.ontrack = (S) => {
490
- this._sessionEvents.trigger($e, l), t && t(S);
488
+ let _;
489
+ const l = ({ peerconnection: S }) => {
490
+ _ = S, _.ontrack = (h) => {
491
+ this._sessionEvents.trigger(Ce, _), e && e(h);
491
492
  };
492
- }, E = () => {
493
- l && this._sessionEvents.trigger(we, l), o(), a(), n(l);
493
+ }, d = () => {
494
+ _ && this._sessionEvents.trigger(Te, _), o(), c(), t(_);
494
495
  };
495
- s(), i();
496
+ r(), i();
496
497
  }));
497
- c(this, "_restoreSession", () => {
498
+ a(this, "_restoreSession", () => {
498
499
  this._resetPresentation(), delete this._connectionConfiguration.number, delete this.session, this._remoteStreams = {};
499
500
  });
500
- c(this, "_sendDTMF", async (t) => new Promise((n, r) => {
501
- const { session: s } = this;
502
- if (!s) {
503
- r(new Error("No session established"));
501
+ a(this, "_sendDTMF", async (e) => new Promise((t, s) => {
502
+ const { session: r } = this;
503
+ if (!r) {
504
+ s(new Error("No session established"));
504
505
  return;
505
506
  }
506
- this.onceSession(Qe, ({ originator: o }) => {
507
- o === Se && n();
508
- }), s.sendDTMF(t, {
507
+ this.onceSession(Le, ({ originator: o }) => {
508
+ o === te && t();
509
+ }), r.sendDTMF(e, {
509
510
  duration: 120,
510
511
  interToneGap: 600
511
512
  });
512
513
  }));
513
- c(this, "_hangUpWithoutCancelRequests", async () => {
514
+ a(this, "_hangUpWithoutCancelRequests", async () => {
514
515
  if (this.ua && this.session) {
515
- const { session: t } = this;
516
- this._streamPresentationCurrent && await this.stopPresentation(), this._restoreSession(), t.isEnded() || t.terminate();
516
+ const { session: e } = this;
517
+ this._streamPresentationCurrent && await this.stopPresentation(), this._restoreSession(), e.isEnded() || e.terminate();
517
518
  }
518
519
  });
519
- c(this, "_handleShareState", (t) => {
520
- switch (t) {
521
- case vn: {
522
- this._sessionEvents.trigger(Ie, void 0);
520
+ a(this, "_handleShareState", (e) => {
521
+ switch (e) {
522
+ case yt: {
523
+ this._sessionEvents.trigger(_e, void 0);
523
524
  break;
524
525
  }
525
- case An: {
526
- this._sessionEvents.trigger(Oe, void 0);
526
+ case bt: {
527
+ this._sessionEvents.trigger(le, void 0);
527
528
  break;
528
529
  }
529
- case jr: {
530
- this._sessionEvents.trigger(Me, void 0);
530
+ case Un: {
531
+ this._sessionEvents.trigger(de, void 0);
531
532
  break;
532
533
  }
533
534
  }
534
535
  });
535
- c(this, "_maybeTriggerChannels", (t) => {
536
- const n = t.getHeader(ht), r = t.getHeader(ft);
537
- if (n && r) {
538
- const s = {
539
- inputChannels: n,
540
- outputChannels: r
536
+ a(this, "_maybeTriggerChannels", (e) => {
537
+ const t = e.getHeader(Xe), s = e.getHeader(ze);
538
+ if (t && s) {
539
+ const r = {
540
+ inputChannels: t,
541
+ outputChannels: s
541
542
  };
542
- this._sessionEvents.trigger(Y, s);
543
+ this._sessionEvents.trigger($, r);
543
544
  }
544
545
  });
545
- c(this, "_handleNotify", (t) => {
546
- switch (t.cmd) {
547
- case us: {
548
- const n = t;
549
- this._triggerChannelsNotify(n);
546
+ a(this, "_handleNotify", (e) => {
547
+ switch (e.cmd) {
548
+ case es: {
549
+ const t = e;
550
+ this._triggerChannelsNotify(t);
550
551
  break;
551
552
  }
552
- case ls: {
553
- const n = t;
554
- this._triggerWebcastStartedNotify(n);
553
+ case ts: {
554
+ const t = e;
555
+ this._triggerWebcastStartedNotify(t);
555
556
  break;
556
557
  }
557
- case _s: {
558
- const n = t;
559
- this._triggerWebcastStoppedNotify(n);
558
+ case ns: {
559
+ const t = e;
560
+ this._triggerWebcastStoppedNotify(t);
560
561
  break;
561
562
  }
562
- case hs: {
563
- const n = t;
564
- this._triggerAddedToListModeratorsNotify(n);
563
+ case os: {
564
+ const t = e;
565
+ this._triggerAddedToListModeratorsNotify(t);
565
566
  break;
566
567
  }
567
- case fs: {
568
- const n = t;
569
- this._triggerRemovedFromListModeratorsNotify(n);
568
+ case is: {
569
+ const t = e;
570
+ this._triggerRemovedFromListModeratorsNotify(t);
570
571
  break;
571
572
  }
572
- case Ss: {
573
- const n = t;
574
- this._triggerParticipantMoveRequestToConference(n);
573
+ case as: {
574
+ const t = e;
575
+ this._triggerParticipantMoveRequestToConference(t);
575
576
  break;
576
577
  }
577
- case gs: {
578
- const n = t;
579
- this._triggerParticipantCancelingWordRequest(n);
578
+ case cs: {
579
+ const t = e;
580
+ this._triggerParticipantCancelingWordRequest(t);
580
581
  break;
581
582
  }
582
- case Ts: {
583
- const n = t;
584
- this._triggerParticipantMoveRequestToStream(n);
583
+ case us: {
584
+ const t = e;
585
+ this._triggerParticipantMoveRequestToStream(t);
585
586
  break;
586
587
  }
587
- case ds: {
588
+ case ss: {
588
589
  this._triggerAccountChangedNotify();
589
590
  break;
590
591
  }
591
- case Es: {
592
+ case rs: {
592
593
  this._triggerAccountDeletedNotify();
593
594
  break;
594
595
  }
595
- case ms: {
596
- const n = t;
597
- this._triggerConferenceParticipantTokenIssued(n);
596
+ case Es: {
597
+ const t = e;
598
+ this._triggerConferenceParticipantTokenIssued(t);
598
599
  break;
599
600
  }
600
601
  default:
601
- _("unknown cmd", t.cmd);
602
+ E("unknown cmd", e.cmd);
602
603
  }
603
604
  });
604
- c(this, "_triggerRemovedFromListModeratorsNotify", ({
605
- conference: t
605
+ a(this, "_triggerRemovedFromListModeratorsNotify", ({
606
+ conference: e
606
607
  }) => {
607
- const n = {
608
- conference: t
608
+ const t = {
609
+ conference: e
609
610
  };
610
611
  this._uaEvents.trigger(
611
- je,
612
- n
612
+ Oe,
613
+ t
613
614
  );
614
615
  });
615
- c(this, "_triggerAddedToListModeratorsNotify", ({ conference: t }) => {
616
- const n = {
617
- conference: t
616
+ a(this, "_triggerAddedToListModeratorsNotify", ({ conference: e }) => {
617
+ const t = {
618
+ conference: e
618
619
  };
619
- this._uaEvents.trigger(We, n);
620
+ this._uaEvents.trigger(Me, t);
620
621
  });
621
- c(this, "_triggerWebcastStartedNotify", ({ body: { conference: t, type: n } }) => {
622
- const r = {
623
- conference: t,
624
- type: n
622
+ a(this, "_triggerWebcastStartedNotify", ({ body: { conference: e, type: t } }) => {
623
+ const s = {
624
+ conference: e,
625
+ type: t
625
626
  };
626
- this._uaEvents.trigger(Ye, r);
627
+ this._uaEvents.trigger(ve, s);
627
628
  });
628
- c(this, "_triggerWebcastStoppedNotify", ({ body: { conference: t, type: n } }) => {
629
- const r = {
630
- conference: t,
631
- type: n
629
+ a(this, "_triggerWebcastStoppedNotify", ({ body: { conference: e, type: t } }) => {
630
+ const s = {
631
+ conference: e,
632
+ type: t
632
633
  };
633
- this._uaEvents.trigger(Xe, r);
634
+ this._uaEvents.trigger(ye, s);
634
635
  });
635
- c(this, "_triggerAccountChangedNotify", () => {
636
- this._uaEvents.trigger(ze, void 0);
636
+ a(this, "_triggerAccountChangedNotify", () => {
637
+ this._uaEvents.trigger(be, void 0);
637
638
  });
638
- c(this, "_triggerAccountDeletedNotify", () => {
639
- this._uaEvents.trigger(Je, void 0);
639
+ a(this, "_triggerAccountDeletedNotify", () => {
640
+ this._uaEvents.trigger(we, void 0);
640
641
  });
641
- c(this, "_triggerConferenceParticipantTokenIssued", ({
642
- body: { conference: t, participant: n, jwt: r }
642
+ a(this, "_triggerConferenceParticipantTokenIssued", ({
643
+ body: { conference: e, participant: t, jwt: s }
643
644
  }) => {
644
- const s = {
645
- conference: t,
646
- participant: n,
647
- jwt: r
645
+ const r = {
646
+ conference: e,
647
+ participant: t,
648
+ jwt: s
648
649
  };
649
650
  this._uaEvents.trigger(
650
- Ke,
651
- s
651
+ Ue,
652
+ r
652
653
  );
653
654
  });
654
- c(this, "_triggerChannelsNotify", (t) => {
655
- const n = t.input, r = t.output, s = {
656
- inputChannels: n,
657
- outputChannels: r
655
+ a(this, "_triggerChannelsNotify", (e) => {
656
+ const t = e.input, s = e.output, r = {
657
+ inputChannels: t,
658
+ outputChannels: s
658
659
  };
659
- this._uaEvents.trigger(Le, s);
660
+ this._uaEvents.trigger(ge, r);
660
661
  });
661
- c(this, "_triggerParticipantMoveRequestToConference", ({
662
- body: { conference: t }
662
+ a(this, "_triggerParticipantMoveRequestToConference", ({
663
+ body: { conference: e }
663
664
  }) => {
664
- const n = {
665
- conference: t
665
+ const t = {
666
+ conference: e
666
667
  };
667
- this._uaEvents.trigger(Ve, n);
668
+ this._uaEvents.trigger(Pe, t);
668
669
  });
669
- c(this, "_triggerParticipantCancelingWordRequest", ({
670
- body: { conference: t }
670
+ a(this, "_triggerParticipantCancelingWordRequest", ({
671
+ body: { conference: e }
671
672
  }) => {
672
- const n = {
673
- conference: t
673
+ const t = {
674
+ conference: e
674
675
  };
675
- this._uaEvents.trigger(Ge, n);
676
+ this._uaEvents.trigger(pe, t);
676
677
  });
677
- c(this, "_triggerParticipantMoveRequestToStream", ({
678
- body: { conference: t }
678
+ a(this, "_triggerParticipantMoveRequestToStream", ({
679
+ body: { conference: e }
679
680
  }) => {
680
- const n = {
681
- conference: t
681
+ const t = {
682
+ conference: e
682
683
  };
683
- this._uaEvents.trigger(qe, n);
684
+ this._uaEvents.trigger(De, t);
684
685
  });
685
- c(this, "_triggerEnterRoom", (t) => {
686
- const n = t.getHeader(Ar);
687
- this._sessionEvents.trigger(Pe, n);
686
+ a(this, "_triggerEnterRoom", (e) => {
687
+ const t = e.getHeader(hn);
688
+ this._sessionEvents.trigger(Se, t);
688
689
  });
689
- c(this, "_triggerShareState", (t) => {
690
- const n = t.getHeader(H);
691
- this._sessionEvents.trigger(G, n);
690
+ a(this, "_triggerShareState", (e) => {
691
+ const t = e.getHeader(H);
692
+ this._sessionEvents.trigger(q, t);
692
693
  });
693
- c(this, "_triggerMainCamControl", (t) => {
694
- const n = t.getHeader(Dr), r = t.getHeader(St), s = r === fe.ADMIN_SYNC_FORCED;
695
- if (n === M.ADMIN_START_MAIN_CAM)
696
- this._sessionEvents.trigger(Be, { isSyncForced: s });
697
- else if (n === M.ADMIN_STOP_MAIN_CAM)
698
- this._sessionEvents.trigger(ke, { isSyncForced: s });
699
- else if ((n === M.RESUME_MAIN_CAM || n === M.PAUSE_MAIN_CAM) && r)
700
- this._sessionEvents.trigger(X, { isSyncForced: s });
694
+ a(this, "_triggerMainCamControl", (e) => {
695
+ const t = e.getHeader(fn), s = e.getHeader(Ke), r = s === ee.ADMIN_SYNC_FORCED;
696
+ if (t === I.ADMIN_START_MAIN_CAM)
697
+ this._sessionEvents.trigger(Ae, { isSyncForced: r });
698
+ else if (t === I.ADMIN_STOP_MAIN_CAM)
699
+ this._sessionEvents.trigger(Re, { isSyncForced: r });
700
+ else if ((t === I.RESUME_MAIN_CAM || t === I.PAUSE_MAIN_CAM) && s)
701
+ this._sessionEvents.trigger(x, { isSyncForced: r });
701
702
  else {
702
- const o = t.getHeader($r);
703
- this._sessionEvents.trigger(Fe, {
704
- mainCam: n,
703
+ const o = e.getHeader(Mn);
704
+ this._sessionEvents.trigger(me, {
705
+ mainCam: t,
705
706
  resolutionMainCam: o
706
707
  });
707
708
  }
708
709
  });
709
- c(this, "_triggerMicControl", (t) => {
710
- const n = t.getHeader(wr), s = t.getHeader(St) === fe.ADMIN_SYNC_FORCED;
711
- n === he.ADMIN_START_MIC ? this._sessionEvents.trigger(He, { isSyncForced: s }) : n === he.ADMIN_STOP_MIC && this._sessionEvents.trigger(xe, { isSyncForced: s });
710
+ a(this, "_triggerMicControl", (e) => {
711
+ const t = e.getHeader(In), r = e.getHeader(Ke) === ee.ADMIN_SYNC_FORCED;
712
+ t === Z.ADMIN_START_MIC ? this._sessionEvents.trigger(Ie, { isSyncForced: r }) : t === Z.ADMIN_STOP_MIC && this._sessionEvents.trigger(fe, { isSyncForced: r });
712
713
  });
713
- c(this, "_triggerUseLicense", (t) => {
714
- const n = t.getHeader(Pr);
715
- this._sessionEvents.trigger(De, n);
714
+ a(this, "_triggerUseLicense", (e) => {
715
+ const t = e.getHeader(An);
716
+ this._sessionEvents.trigger(he, t);
716
717
  });
717
- c(this, "_handleNewInfo", (t) => {
718
- const { originator: n } = t;
719
- if (n !== "remote")
718
+ a(this, "_handleNewInfo", (e) => {
719
+ const { originator: t } = e;
720
+ if (t !== "remote")
720
721
  return;
721
- const { request: r } = t, s = r.getHeader(vr);
722
- if (s)
723
- switch (s) {
724
- case pr: {
725
- this._triggerEnterRoom(r), this._maybeTriggerChannels(r);
722
+ const { request: s } = e, r = s.getHeader(Sn);
723
+ if (r)
724
+ switch (r) {
725
+ case Tn: {
726
+ this._triggerEnterRoom(s), this._maybeTriggerChannels(s);
726
727
  break;
727
728
  }
728
- case Br: {
729
- this._maybeHandleNotify(r);
729
+ case vn: {
730
+ this._maybeHandleNotify(s);
730
731
  break;
731
732
  }
732
- case ae: {
733
- this._triggerShareState(r);
733
+ case K: {
734
+ this._triggerShareState(s);
734
735
  break;
735
736
  }
736
- case Et: {
737
- this._triggerMainCamControl(r);
737
+ case Ge: {
738
+ this._triggerMainCamControl(s);
738
739
  break;
739
740
  }
740
- case Or: {
741
- this._triggerMicControl(r);
741
+ case mn: {
742
+ this._triggerMicControl(s);
742
743
  break;
743
744
  }
744
- case Mr: {
745
- this._triggerUseLicense(r);
745
+ case Rn: {
746
+ this._triggerUseLicense(s);
746
747
  break;
747
748
  }
748
749
  }
749
750
  });
750
- c(this, "_handleSipEvent", ({ request: t }) => {
751
- this._maybeHandleNotify(t);
751
+ a(this, "_handleSipEvent", ({ request: e }) => {
752
+ this._maybeHandleNotify(e);
752
753
  });
753
- c(this, "_maybeHandleNotify", (t) => {
754
- const n = t.getHeader(xr);
755
- if (n) {
756
- const r = JSON.parse(n);
757
- this._handleNotify(r);
754
+ a(this, "_maybeHandleNotify", (e) => {
755
+ const t = e.getHeader(yn);
756
+ if (t) {
757
+ const s = JSON.parse(t);
758
+ this._handleNotify(s);
758
759
  }
759
760
  });
760
- c(this, "_handleEnded", (t) => {
761
- const { originator: n } = t;
762
- n === Tt && this._sessionEvents.trigger(Ue, t), this._restoreSession();
761
+ a(this, "_handleEnded", (e) => {
762
+ const { originator: t } = e;
763
+ t === Qe && this._sessionEvents.trigger(Ne, e), this._restoreSession();
763
764
  });
764
- this.JsSIP = t, this._sessionEvents = new dt(Nn), this._uaEvents = new dt(Rn), this._cancelableConnect = new P(
765
+ this.JsSIP = e, this._sessionEvents = new Ye(vt), this._uaEvents = new Ye(pt), this._cancelableConnect = new O(
765
766
  this._connect,
766
767
  {
767
- moduleName: D,
768
+ moduleName: P,
768
769
  afterCancelRequest: () => {
769
770
  this._cancelableCreateUa.cancelRequest(), this._cancelableDisconnect.cancelRequest();
770
771
  }
771
772
  }
772
- ), this._cancelableCreateUa = new P(this._createUa, { moduleName: D }), this._cancelableDisconnect = new P(
773
+ ), this._cancelableCreateUa = new O(this._createUa, { moduleName: P }), this._cancelableDisconnect = new O(
773
774
  this._disconnect,
774
- { moduleName: D }
775
- ), this._cancelableSet = new P(this._set, {
776
- moduleName: D
777
- }), this._cancelableCall = new P(
775
+ { moduleName: P }
776
+ ), this._cancelableSet = new O(this._set, {
777
+ moduleName: P
778
+ }), this._cancelableCall = new O(
778
779
  this._call,
779
- { moduleName: D }
780
- ), this._cancelableAnswer = new P(this._answer, { moduleName: D }), this._cancelableSendDTMF = new P(this._sendDTMF, { moduleName: D }), this.onSession(G, this._handleShareState), this.onSession(Ze, this._handleNewInfo), this.on(ye, this._handleSipEvent), this.onSession($, this._handleEnded), this.onSession(B, this._handleEnded);
780
+ { moduleName: P }
781
+ ), this._cancelableAnswer = new O(this._answer, { moduleName: P }), this._cancelableSendDTMF = new O(this._sendDTMF, { moduleName: P }), this.onSession(q, this._handleShareState), this.onSession(Be, this._handleNewInfo), this.on(Ee, this._handleSipEvent), this.onSession(y, this._handleEnded), this.onSession(F, this._handleEnded);
781
782
  }
782
783
  async register() {
783
- return new Promise((t, n) => {
784
- this.isRegisterConfig && this.ua ? (this.ua.on(F, t), this.ua.on(k, n), this.ua.register()) : n(new Error("Config is not registered"));
784
+ return new Promise((e, t) => {
785
+ this.isRegisterConfig && this.ua ? (this.ua.on(L, e), this.ua.on(B, t), this.ua.register()) : t(new Error("Config is not registered"));
785
786
  });
786
787
  }
787
788
  async unregister() {
788
- return new Promise((t, n) => {
789
- this.isRegistered && this.ua ? (this.ua.on(be, t), this.ua.unregister()) : n(new Error("ua is not registered"));
789
+ return new Promise((e, t) => {
790
+ this.isRegistered && this.ua ? (this.ua.on(ue, e), this.ua.unregister()) : t(new Error("ua is not registered"));
790
791
  });
791
792
  }
792
- async sendOptions(t, n, r) {
793
+ async sendOptions(e, t, s) {
793
794
  if (!this.ua)
794
795
  throw new Error("is not connected");
795
- return new Promise((s, o) => {
796
+ return new Promise((r, o) => {
796
797
  try {
797
- this.ua.sendOptions(t, n, {
798
- extraHeaders: r,
798
+ this.ua.sendOptions(e, t, {
799
+ extraHeaders: s,
799
800
  eventHandlers: {
800
801
  succeeded: () => {
801
- s();
802
+ r();
802
803
  },
803
804
  failed: o
804
805
  }
@@ -808,65 +809,65 @@ class Ll {
808
809
  }
809
810
  });
810
811
  }
811
- async ping(t, n) {
812
- var s;
813
- if (!((s = this.ua) != null && s.configuration.uri))
812
+ async ping(e, t) {
813
+ var r;
814
+ if (!((r = this.ua) != null && r.configuration.uri))
814
815
  throw new Error("is not connected");
815
- const r = this.ua.configuration.uri;
816
- return this.sendOptions(r, t, n);
816
+ const s = this.ua.configuration.uri;
817
+ return this.sendOptions(s, e, t);
817
818
  }
818
- async replaceMediaStream(t, n) {
819
+ async replaceMediaStream(e, t) {
819
820
  if (!this.session)
820
821
  throw new Error("No session established");
821
- return this.session.replaceMediaStream(t, n);
822
+ return this.session.replaceMediaStream(e, t);
822
823
  }
823
- async askPermissionToEnableCam(t = {}) {
824
+ async askPermissionToEnableCam(e = {}) {
824
825
  if (!this.session)
825
826
  throw new Error("No session established");
826
- const n = [Yr];
827
- return this.session.sendInfo(Et, void 0, {
827
+ const t = [kn];
828
+ return this.session.sendInfo(Ge, void 0, {
828
829
  noTerminateWhenError: !0,
829
- ...t,
830
- extraHeaders: n
831
- }).catch((r) => {
832
- if (es(r))
833
- throw r;
830
+ ...e,
831
+ extraHeaders: t
832
+ }).catch((s) => {
833
+ if (Yn(s))
834
+ throw s;
834
835
  });
835
836
  }
836
837
  get isPendingPresentation() {
837
838
  return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
838
839
  }
839
- async _sendPresentation(t, n, {
840
- maxBitrate: r,
841
- degradationPreference: s,
840
+ async _sendPresentation(e, t, {
841
+ maxBitrate: s,
842
+ degradationPreference: r,
842
843
  isNeedReinvite: o = !0,
843
844
  isP2P: i = !1
844
845
  }) {
845
- const a = ce(n);
846
- this._streamPresentationCurrent = a;
847
- const u = i ? [Vr] : [Hr], l = t.sendInfo(ae, void 0, {
846
+ const c = J(t);
847
+ this._streamPresentationCurrent = c;
848
+ const u = i ? [Ln] : [bn], _ = e.sendInfo(K, void 0, {
848
849
  extraHeaders: u
849
- }).then(async () => t.startPresentation(
850
- a,
850
+ }).then(async () => e.startPresentation(
851
+ c,
851
852
  o,
852
- s
853
+ r
853
854
  )).then(async () => {
854
- const { connection: d } = this;
855
- if (!d || r === void 0)
855
+ const { connection: l } = this;
856
+ if (!l || s === void 0)
856
857
  return;
857
- const E = d.getSenders();
858
- return is(E, n, r);
859
- }).then(() => n).catch((d) => {
860
- throw this._sessionEvents.trigger(K, d), d;
858
+ const d = l.getSenders();
859
+ return Qn(d, t, s);
860
+ }).then(() => t).catch((l) => {
861
+ throw this._sessionEvents.trigger(X, l), l;
861
862
  });
862
- return this.promisePendingStartPresentation = l, l.finally(() => {
863
+ return this.promisePendingStartPresentation = _, _.finally(() => {
863
864
  this.promisePendingStartPresentation = void 0;
864
865
  });
865
866
  }
866
- async startPresentation(t, {
867
- isNeedReinvite: n = !0,
868
- isP2P: r = !1,
869
- maxBitrate: s,
867
+ async startPresentation(e, {
868
+ isNeedReinvite: t = !0,
869
+ isP2P: s = !1,
870
+ maxBitrate: r,
870
871
  degradationPreference: o
871
872
  } = {}) {
872
873
  const i = this.establishedSession;
@@ -874,76 +875,76 @@ class Ll {
874
875
  throw new Error("No session established");
875
876
  if (this._streamPresentationCurrent)
876
877
  throw new Error("Presentation is already started");
877
- return this._sendPresentation(i, t, {
878
- isNeedReinvite: n,
879
- isP2P: r,
880
- maxBitrate: s,
878
+ return this._sendPresentation(i, e, {
879
+ isNeedReinvite: t,
880
+ isP2P: s,
881
+ maxBitrate: r,
881
882
  degradationPreference: o
882
883
  });
883
884
  }
884
885
  async stopPresentation({
885
- isP2P: t = !1
886
+ isP2P: e = !1
886
887
  } = {}) {
887
- const n = this._streamPresentationCurrent;
888
- let r = this.promisePendingStartPresentation ?? Promise.resolve();
889
- const s = t ? [qr] : [Wr], o = this.establishedSession;
890
- return o && n && (r = r.then(async () => o.sendInfo(ae, void 0, {
891
- extraHeaders: s
892
- })).then(async () => o.stopPresentation(n)).catch((i) => {
893
- throw this._sessionEvents.trigger(K, i), i;
894
- })), !o && n && this._sessionEvents.trigger(et, n), this.promisePendingStopPresentation = r, r.finally(() => {
888
+ const t = this._streamPresentationCurrent;
889
+ let s = this.promisePendingStartPresentation ?? Promise.resolve();
890
+ const r = e ? [Bn] : [wn], o = this.establishedSession;
891
+ return o && t && (s = s.then(async () => o.sendInfo(K, void 0, {
892
+ extraHeaders: r
893
+ })).then(async () => o.stopPresentation(t)).catch((i) => {
894
+ throw this._sessionEvents.trigger(X, i), i;
895
+ })), !o && t && this._sessionEvents.trigger(Fe, t), this.promisePendingStopPresentation = s, s.finally(() => {
895
896
  this._resetPresentation();
896
897
  });
897
898
  }
898
- async updatePresentation(t, {
899
- isP2P: n = !1,
900
- maxBitrate: r,
901
- degradationPreference: s
899
+ async updatePresentation(e, {
900
+ isP2P: t = !1,
901
+ maxBitrate: s,
902
+ degradationPreference: r
902
903
  } = {}) {
903
904
  const o = this.establishedSession;
904
905
  if (!o)
905
906
  throw new Error("No session established");
906
907
  if (!this._streamPresentationCurrent)
907
908
  throw new Error("Presentation has not started yet");
908
- return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(o, t, {
909
- isP2P: n,
910
- maxBitrate: r,
911
- degradationPreference: s,
909
+ return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this._sendPresentation(o, e, {
910
+ isP2P: t,
911
+ maxBitrate: s,
912
+ degradationPreference: r,
912
913
  isNeedReinvite: !1
913
914
  });
914
915
  }
915
916
  _resetPresentation() {
916
917
  delete this._streamPresentationCurrent, this.promisePendingStartPresentation = void 0, this.promisePendingStopPresentation = void 0;
917
918
  }
918
- on(t, n) {
919
- return this._uaEvents.on(t, n);
919
+ on(e, t) {
920
+ return this._uaEvents.on(e, t);
920
921
  }
921
- once(t, n) {
922
- return this._uaEvents.once(t, n);
922
+ once(e, t) {
923
+ return this._uaEvents.once(e, t);
923
924
  }
924
- onceRace(t, n) {
925
- return this._uaEvents.onceRace(t, n);
925
+ onceRace(e, t) {
926
+ return this._uaEvents.onceRace(e, t);
926
927
  }
927
- async wait(t) {
928
- return this._uaEvents.wait(t);
928
+ async wait(e) {
929
+ return this._uaEvents.wait(e);
929
930
  }
930
- off(t, n) {
931
- this._uaEvents.off(t, n);
931
+ off(e, t) {
932
+ this._uaEvents.off(e, t);
932
933
  }
933
- onSession(t, n) {
934
- return this._sessionEvents.on(t, n);
934
+ onSession(e, t) {
935
+ return this._sessionEvents.on(e, t);
935
936
  }
936
- onceSession(t, n) {
937
- return this._sessionEvents.once(t, n);
937
+ onceSession(e, t) {
938
+ return this._sessionEvents.once(e, t);
938
939
  }
939
- onceRaceSession(t, n) {
940
- return this._sessionEvents.onceRace(t, n);
940
+ onceRaceSession(e, t) {
941
+ return this._sessionEvents.onceRace(e, t);
941
942
  }
942
- async waitSession(t) {
943
- return this._sessionEvents.wait(t);
943
+ async waitSession(e) {
944
+ return this._sessionEvents.wait(e);
944
945
  }
945
- offSession(t, n) {
946
- this._sessionEvents.off(t, n);
946
+ offSession(e, t) {
947
+ this._sessionEvents.off(e, t);
947
948
  }
948
949
  isConfigured() {
949
950
  return !!this.ua;
@@ -954,18 +955,18 @@ class Ll {
954
955
  getRemoteStreams() {
955
956
  if (!this.connection)
956
957
  return;
957
- const n = this.connection.getReceivers().map(({ track: r }) => r);
958
- return Qr(n) ? this._generateStreams(n) : this._generateAudioStreams(n);
958
+ const t = this.connection.getReceivers().map(({ track: s }) => s);
959
+ return $n(t) ? this._generateStreams(t) : this._generateAudioStreams(t);
959
960
  }
960
961
  get connection() {
961
- var n;
962
- return (n = this.session) == null ? void 0 : n.connection;
962
+ var t;
963
+ return (t = this.session) == null ? void 0 : t.connection;
963
964
  }
964
965
  get remoteCallerData() {
965
- var t, n, r, s, o, i;
966
+ var e, t, s, r, o, i;
966
967
  return {
967
- displayName: (n = (t = this.incomingSession) == null ? void 0 : t.remote_identity) == null ? void 0 : n.display_name,
968
- host: (s = (r = this.incomingSession) == null ? void 0 : r.remote_identity) == null ? void 0 : s.uri.host,
968
+ displayName: (t = (e = this.incomingSession) == null ? void 0 : e.remote_identity) == null ? void 0 : t.display_name,
969
+ host: (r = (s = this.incomingSession) == null ? void 0 : s.remote_identity) == null ? void 0 : r.uri.host,
969
970
  incomingNumber: (i = (o = this.incomingSession) == null ? void 0 : o.remote_identity) == null ? void 0 : i.uri.user,
970
971
  session: this.incomingSession
971
972
  };
@@ -989,33 +990,33 @@ class Ll {
989
990
  return !!this.incomingSession;
990
991
  }
991
992
  _init({
992
- sipServerUrl: t,
993
- sipWebSocketServerURL: n
993
+ sipServerUrl: e,
994
+ sipWebSocketServerURL: t
994
995
  }) {
995
- this.getSipServerUrl = zr(t), this.socket = new this.JsSIP.WebSocketInterface(n);
996
+ this.getSipServerUrl = Vn(e), this.socket = new this.JsSIP.WebSocketInterface(t);
996
997
  }
997
- _generateStream(t, n) {
998
- const { id: r } = t, s = this._remoteStreams[r] || new MediaStream();
999
- return n && s.addTrack(n), s.addTrack(t), this._remoteStreams[r] = s, s;
998
+ _generateStream(e, t) {
999
+ const { id: s } = e, r = this._remoteStreams[s] || new MediaStream();
1000
+ return t && r.addTrack(t), r.addTrack(e), this._remoteStreams[s] = r, r;
1000
1001
  }
1001
- _generateAudioStream(t) {
1002
- const { id: n } = t, r = this._remoteStreams[n] || new MediaStream();
1003
- return r.addTrack(t), this._remoteStreams[n] = r, r;
1002
+ _generateAudioStream(e) {
1003
+ const { id: t } = e, s = this._remoteStreams[t] || new MediaStream();
1004
+ return s.addTrack(e), this._remoteStreams[t] = s, s;
1004
1005
  }
1005
- _generateStreams(t) {
1006
- const n = [];
1007
- return t.forEach((r, s) => {
1008
- if (r.kind === "audio")
1006
+ _generateStreams(e) {
1007
+ const t = [];
1008
+ return e.forEach((s, r) => {
1009
+ if (s.kind === "audio")
1009
1010
  return;
1010
- const o = r, i = t[s - 1];
1011
- let a;
1012
- i && i.kind === "audio" && (a = i);
1013
- const u = this._generateStream(o, a);
1014
- n.push(u);
1015
- }), n;
1011
+ const o = s, i = e[r - 1];
1012
+ let c;
1013
+ i && i.kind === "audio" && (c = i);
1014
+ const u = this._generateStream(o, c);
1015
+ t.push(u);
1016
+ }), t;
1016
1017
  }
1017
- _generateAudioStreams(t) {
1018
- return t.map((r) => this._generateAudioStream(r));
1018
+ _generateAudioStreams(e) {
1019
+ return e.map((s) => this._generateAudioStream(s));
1019
1020
  }
1020
1021
  _cancelRequests() {
1021
1022
  this._cancelActionsRequests(), this._cancelCallRequests(), this._cancelConnectRequests();
@@ -1030,885 +1031,420 @@ class Ll {
1030
1031
  this._cancelableAnswer.cancelRequest(), this._cancelableSendDTMF.cancelRequest();
1031
1032
  }
1032
1033
  async waitChannels() {
1033
- return this.waitSession(Y);
1034
+ return this.waitSession($);
1034
1035
  }
1035
1036
  async waitSyncMediaState() {
1036
- return this.waitSession(X);
1037
+ return this.waitSession(x);
1037
1038
  }
1038
- async sendChannels({ inputChannels: t, outputChannels: n }) {
1039
+ async sendChannels({ inputChannels: e, outputChannels: t }) {
1039
1040
  if (!this.session)
1040
1041
  throw new Error("No session established");
1041
- const r = `${ht}: ${t}`, s = `${ft}: ${n}`, o = [
1042
- r,
1043
- s
1042
+ const s = `${Xe}: ${e}`, r = `${ze}: ${t}`, o = [
1043
+ s,
1044
+ r
1044
1045
  ];
1045
- return this.session.sendInfo(br, void 0, { extraHeaders: o });
1046
+ return this.session.sendInfo(Cn, void 0, { extraHeaders: o });
1046
1047
  }
1047
- async sendMediaState({ cam: t, mic: n }, r = {}) {
1048
+ async sendMediaState({ cam: e, mic: t }, s = {}) {
1048
1049
  if (!this.session)
1049
1050
  throw new Error("No session established");
1050
- const s = `${Lr}: currentstate`, o = `${Fr}: ${Number(t)}`, i = `${kr}: ${Number(n)}`, a = [
1051
- s,
1051
+ const r = `${On}: currentstate`, o = `${Dn}: ${Number(e)}`, i = `${pn}: ${Number(t)}`, c = [
1052
+ r,
1052
1053
  o,
1053
1054
  i
1054
1055
  ];
1055
- return this.session.sendInfo(yr, void 0, {
1056
+ return this.session.sendInfo(gn, void 0, {
1056
1057
  noTerminateWhenError: !0,
1057
- ...r,
1058
- extraHeaders: a
1058
+ ...s,
1059
+ extraHeaders: c
1059
1060
  });
1060
1061
  }
1061
- async _sendRefusalToTurnOn(t, n = {}) {
1062
+ async _sendRefusalToTurnOn(e, t = {}) {
1062
1063
  if (!this.session)
1063
1064
  throw new Error("No session established");
1064
- const a = [`${Ur}: ${t === "mic" ? 0 : 1}`];
1065
- return this.session.sendInfo(Ir, void 0, {
1065
+ const c = [`${Pn}: ${e === "mic" ? 0 : 1}`];
1066
+ return this.session.sendInfo(Nn, void 0, {
1066
1067
  noTerminateWhenError: !0,
1067
- ...n,
1068
- extraHeaders: a
1068
+ ...t,
1069
+ extraHeaders: c
1069
1070
  });
1070
1071
  }
1071
- async sendRefusalToTurnOnMic(t = {}) {
1072
+ async sendRefusalToTurnOnMic(e = {}) {
1072
1073
  if (!this.session)
1073
1074
  throw new Error("No session established");
1074
- return this._sendRefusalToTurnOn("mic", { noTerminateWhenError: !0, ...t });
1075
+ return this._sendRefusalToTurnOn("mic", { noTerminateWhenError: !0, ...e });
1075
1076
  }
1076
- async sendRefusalToTurnOnCam(t = {}) {
1077
+ async sendRefusalToTurnOnCam(e = {}) {
1077
1078
  if (!this.session)
1078
1079
  throw new Error("No session established");
1079
- return this._sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...t });
1080
- }
1081
- }
1082
- const In = "purgatory", x = (e) => e === In, st = (e) => () => (_("getRemoteStreams"), e.getRemoteStreams()), Cs = ({ kind: e, readyState: t }) => e === "video" && t === "live", On = (e) => ({ track: t }) => {
1083
- Cs(t) && e();
1084
- };
1085
- var j = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1086
- function ot(e) {
1087
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1088
- }
1089
- function Rs(e) {
1090
- var t = typeof e;
1091
- return e != null && (t == "object" || t == "function");
1092
- }
1093
- var L = Rs, Ns = typeof j == "object" && j && j.Object === Object && j, Mn = Ns, vs = Mn, As = typeof self == "object" && self && self.Object === Object && self, ps = vs || As || Function("return this")(), re = ps, bs = re, ys = function() {
1094
- return bs.Date.now();
1095
- }, Is = ys, Os = /\s/;
1096
- function Ms(e) {
1097
- for (var t = e.length; t-- && Os.test(e.charAt(t)); )
1098
- ;
1099
- return t;
1100
- }
1101
- var Ps = Ms, Ds = Ps, ws = /^\s+/;
1102
- function $s(e) {
1103
- return e && e.slice(0, Ds(e) + 1).replace(ws, "");
1104
- }
1105
- var Ls = $s, Us = re, Fs = Us.Symbol, se = Fs, mt = se, Pn = Object.prototype, ks = Pn.hasOwnProperty, Bs = Pn.toString, U = mt ? mt.toStringTag : void 0;
1106
- function xs(e) {
1107
- var t = ks.call(e, U), n = e[U];
1108
- try {
1109
- e[U] = void 0;
1110
- var r = !0;
1111
- } catch {
1080
+ return this._sendRefusalToTurnOn("cam", { noTerminateWhenError: !0, ...e });
1112
1081
  }
1113
- var s = Bs.call(e);
1114
- return r && (t ? e[U] = n : delete e[U]), s;
1115
1082
  }
1116
- var Hs = xs, Ws = Object.prototype, js = Ws.toString;
1117
- function Vs(e) {
1118
- return js.call(e);
1119
- }
1120
- var qs = Vs, Ct = se, Gs = Hs, Ys = qs, Xs = "[object Null]", zs = "[object Undefined]", Rt = Ct ? Ct.toStringTag : void 0;
1121
- function Js(e) {
1122
- return e == null ? e === void 0 ? zs : Xs : Rt && Rt in Object(e) ? Gs(e) : Ys(e);
1123
- }
1124
- var oe = Js;
1125
- function Ks(e) {
1126
- return e != null && typeof e == "object";
1127
- }
1128
- var W = Ks, Qs = oe, Zs = W, eo = "[object Symbol]";
1129
- function to(e) {
1130
- return typeof e == "symbol" || Zs(e) && Qs(e) == eo;
1131
- }
1132
- var Dn = to, no = Ls, Nt = L, ro = Dn, vt = 0 / 0, so = /^[-+]0x[0-9a-f]+$/i, oo = /^0b[01]+$/i, io = /^0o[0-7]+$/i, ao = parseInt;
1133
- function co(e) {
1134
- if (typeof e == "number")
1135
- return e;
1136
- if (ro(e))
1137
- return vt;
1138
- if (Nt(e)) {
1139
- var t = typeof e.valueOf == "function" ? e.valueOf() : e;
1140
- e = Nt(t) ? t + "" : t;
1141
- }
1142
- if (typeof e != "string")
1143
- return e === 0 ? e : +e;
1144
- e = no(e);
1145
- var n = oo.test(e);
1146
- return n || io.test(e) ? ao(e.slice(2), n ? 2 : 8) : so.test(e) ? vt : +e;
1147
- }
1148
- var uo = co, lo = L, ue = Is, At = uo, _o = "Expected a function", Eo = Math.max, ho = Math.min;
1149
- function fo(e, t, n) {
1150
- var r, s, o, i, a, u, l = 0, d = !1, E = !1, h = !0;
1151
- if (typeof e != "function")
1152
- throw new TypeError(_o);
1153
- t = At(t) || 0, lo(n) && (d = !!n.leading, E = "maxWait" in n, o = E ? Eo(At(n.maxWait) || 0, t) : o, h = "trailing" in n ? !!n.trailing : h);
1154
- function S(f) {
1155
- var R = r, p = s;
1156
- return r = s = void 0, l = f, i = e.apply(p, R), i;
1157
- }
1158
- function g(f) {
1159
- return l = f, a = setTimeout(A, t), d ? S(f) : i;
1160
- }
1161
- function m(f) {
1162
- var R = f - u, p = f - l, O = t - R;
1163
- return E ? ho(O, o - p) : O;
1164
- }
1165
- function C(f) {
1166
- var R = f - u, p = f - l;
1167
- return u === void 0 || R >= t || R < 0 || E && p >= o;
1168
- }
1169
- function A() {
1170
- var f = ue();
1171
- if (C(f))
1172
- return b(f);
1173
- a = setTimeout(A, m(f));
1174
- }
1175
- function b(f) {
1176
- return a = void 0, h && r ? S(f) : (r = s = void 0, i);
1177
- }
1178
- function N() {
1179
- a !== void 0 && clearTimeout(a), l = 0, r = u = s = a = void 0;
1180
- }
1181
- function v() {
1182
- return a === void 0 ? i : b(ue());
1183
- }
1184
- function y() {
1185
- var f = ue(), R = C(f);
1186
- if (r = arguments, s = this, u = f, R) {
1187
- if (a === void 0)
1188
- return g(u);
1189
- if (E)
1190
- return clearTimeout(a), a = setTimeout(A, t), S(u);
1191
- }
1192
- return a === void 0 && (a = setTimeout(A, t)), i;
1193
- }
1194
- return y.cancel = N, y.flush = v, y;
1195
- }
1196
- var So = fo;
1197
- const go = /* @__PURE__ */ ot(So), it = ({
1198
- getRemoteStreams: e,
1199
- setRemoteStreams: t
1200
- }) => go(() => {
1201
- const n = e();
1202
- _("remoteStreams", n), n && t(n);
1203
- }, 200), To = (e) => async (n) => {
1083
+ const Bt = "purgatory", k = (n) => n === Bt, We = (n) => () => (E("getRemoteStreams"), n.getRemoteStreams()), _s = ({ kind: n, readyState: e }) => n === "video" && e === "live", Ft = (n) => ({ track: e }) => {
1084
+ _s(e) && n();
1085
+ }, qe = ({
1086
+ getRemoteStreams: n,
1087
+ setRemoteStreams: e
1088
+ }) => Gt(() => {
1089
+ const t = n();
1090
+ E("remoteStreams", t), t && e(t);
1091
+ }, 200), ls = (n) => async (t) => {
1204
1092
  const {
1205
- mediaStream: r,
1206
- extraHeaders: s,
1093
+ mediaStream: s,
1094
+ extraHeaders: r,
1207
1095
  iceServers: o,
1208
1096
  degradationPreference: i,
1209
- setRemoteStreams: a,
1097
+ setRemoteStreams: c,
1210
1098
  onBeforeProgressCall: u,
1211
- onSuccessProgressCall: l,
1212
- onEnterPurgatory: d,
1213
- onEnterConference: E,
1214
- onFailProgressCall: h,
1215
- onFinishProgressCall: S,
1216
- onEndedCall: g
1217
- } = n, m = it({
1218
- setRemoteStreams: a,
1219
- getRemoteStreams: st(e)
1220
- }), C = On(m);
1221
- _("answerIncomingCall", n);
1222
- const A = async () => e.answerToIncomingCall({
1223
- mediaStream: r,
1224
- extraHeaders: s,
1099
+ onSuccessProgressCall: _,
1100
+ onEnterPurgatory: l,
1101
+ onEnterConference: d,
1102
+ onFailProgressCall: S,
1103
+ onFinishProgressCall: h,
1104
+ onEndedCall: T
1105
+ } = t, g = qe({
1106
+ setRemoteStreams: c,
1107
+ getRemoteStreams: We(n)
1108
+ }), N = Ft(g);
1109
+ E("answerIncomingCall", t);
1110
+ const p = async () => n.answerToIncomingCall({
1111
+ mediaStream: s,
1112
+ extraHeaders: r,
1225
1113
  iceServers: o,
1226
1114
  degradationPreference: i,
1227
- ontrack: C
1228
- }), b = () => {
1229
- const { remoteCallerData: T } = e;
1230
- return T.incomingNumber;
1115
+ ontrack: N
1116
+ }), M = () => {
1117
+ const { remoteCallerData: C } = n;
1118
+ return C.incomingNumber;
1231
1119
  };
1232
- let N = !1, v;
1233
- const f = (() => (_("subscribeEnterConference: onEnterConference", E), d ?? E ? e.onSession("enterRoom", (T) => {
1234
- _("enterRoom", { _room: T, isSuccessProgressCall: N }), v = T, x(v) ? d && d() : E && E({ isSuccessProgressCall: N });
1120
+ let m = !1, R;
1121
+ const f = (() => (E("subscribeEnterConference: onEnterConference", d), l ?? d ? n.onSession("enterRoom", (C) => {
1122
+ E("enterRoom", { _room: C, isSuccessProgressCall: m }), R = C, k(R) ? l && l() : d && d({ isSuccessProgressCall: m });
1235
1123
  }) : () => {
1236
- }))(), R = (T) => (_("onSuccess"), N = !0, m(), l && l({ isPurgatory: x(v) }), e.onceRaceSession(["ended", "failed"], () => {
1237
- f(), g && g();
1238
- }), T), p = (T) => {
1239
- throw _("onFail"), h && h(), f(), T;
1240
- }, O = () => {
1241
- _("onFinish"), S && S();
1124
+ }))(), b = (C) => (E("onSuccess"), m = !0, g(), _ && _({ isPurgatory: k(R) }), n.onceRaceSession(["ended", "failed"], () => {
1125
+ f(), T && T();
1126
+ }), C), w = (C) => {
1127
+ throw E("onFail"), S && S(), f(), C;
1128
+ }, U = () => {
1129
+ E("onFinish"), h && h();
1242
1130
  };
1243
- if (_("onBeforeProgressCall"), u) {
1244
- const T = b();
1245
- u(T);
1131
+ if (E("onBeforeProgressCall"), u) {
1132
+ const C = M();
1133
+ u(C);
1246
1134
  }
1247
- return A().then(R).catch(p).finally(O);
1248
- }, mo = (e) => async (n) => {
1135
+ return p().then(b).catch(w).finally(U);
1136
+ }, ds = (n) => async (t) => {
1249
1137
  const {
1250
- conference: r,
1251
- mediaStream: s,
1138
+ conference: s,
1139
+ mediaStream: r,
1252
1140
  extraHeaders: o,
1253
1141
  iceServers: i,
1254
- degradationPreference: a,
1142
+ degradationPreference: c,
1255
1143
  setRemoteStreams: u,
1256
- onBeforeProgressCall: l,
1257
- onSuccessProgressCall: d,
1258
- onEnterPurgatory: E,
1259
- onEnterConference: h,
1260
- onFailProgressCall: S,
1261
- onFinishProgressCall: g,
1262
- onEndedCall: m
1263
- } = n, C = it({
1144
+ onBeforeProgressCall: _,
1145
+ onSuccessProgressCall: l,
1146
+ onEnterPurgatory: d,
1147
+ onEnterConference: S,
1148
+ onFailProgressCall: h,
1149
+ onFinishProgressCall: T,
1150
+ onEndedCall: g
1151
+ } = t, N = qe({
1264
1152
  setRemoteStreams: u,
1265
- getRemoteStreams: st(e)
1266
- }), A = On(C);
1267
- _("callToServer", n);
1268
- const b = async () => (_("startCall"), e.call({
1269
- mediaStream: s,
1153
+ getRemoteStreams: We(n)
1154
+ }), p = Ft(N);
1155
+ E("callToServer", t);
1156
+ const M = async () => (E("startCall"), n.call({
1157
+ mediaStream: r,
1270
1158
  extraHeaders: o,
1271
1159
  iceServers: i,
1272
- degradationPreference: a,
1273
- number: r,
1274
- ontrack: A
1160
+ degradationPreference: c,
1161
+ number: s,
1162
+ ontrack: p
1275
1163
  }));
1276
- let N = !1, v;
1277
- const f = (() => (_("subscribeEnterConference: onEnterConference", h), E ?? h ? e.onSession("enterRoom", (T) => {
1278
- _("enterRoom", { _room: T, isSuccessProgressCall: N }), v = T, x(v) ? E && E() : h && h({ isSuccessProgressCall: N });
1164
+ let m = !1, R;
1165
+ const f = (() => (E("subscribeEnterConference: onEnterConference", S), d ?? S ? n.onSession("enterRoom", (C) => {
1166
+ E("enterRoom", { _room: C, isSuccessProgressCall: m }), R = C, k(R) ? d && d() : S && S({ isSuccessProgressCall: m });
1279
1167
  }) : () => {
1280
- }))(), R = (T) => (_("onSuccess"), N = !0, C(), d && d({ isPurgatory: x(v) }), e.onceRaceSession(["ended", "failed"], () => {
1281
- f(), m && m();
1282
- }), T), p = (T) => {
1283
- throw _("onFail"), S && S(), f(), T;
1284
- }, O = () => {
1285
- _("onFinish"), g && g();
1168
+ }))(), b = (C) => (E("onSuccess"), m = !0, N(), l && l({ isPurgatory: k(R) }), n.onceRaceSession(["ended", "failed"], () => {
1169
+ f(), g && g();
1170
+ }), C), w = (C) => {
1171
+ throw E("onFail"), h && h(), f(), C;
1172
+ }, U = () => {
1173
+ E("onFinish"), T && T();
1286
1174
  };
1287
- return _("onBeforeProgressCall"), l && l(r), b().then(R).catch(p).finally(O);
1288
- }, le = (e) => {
1289
- if (!qt(e))
1290
- throw e;
1175
+ return E("onBeforeProgressCall"), _ && _(s), M().then(b).catch(w).finally(U);
1176
+ }, Q = (n) => {
1177
+ if (!et(n))
1178
+ throw n;
1291
1179
  return !1;
1292
- }, Co = (e) => async (n) => {
1180
+ }, Ss = (n) => async (t) => {
1293
1181
  const {
1294
- userAgent: r,
1295
- sipWebSocketServerURL: s,
1182
+ userAgent: s,
1183
+ sipWebSocketServerURL: r,
1296
1184
  sipServerUrl: o,
1297
1185
  remoteAddress: i,
1298
- displayName: a,
1186
+ displayName: c,
1299
1187
  name: u,
1300
- password: l,
1301
- isRegisteredUser: d,
1302
- sdpSemantics: E,
1303
- isDisconnectOnFail: h
1304
- } = n;
1305
- return _("connectToServer", n), e.connect({
1306
- userAgent: r,
1307
- sdpSemantics: E,
1308
- sipWebSocketServerURL: s,
1188
+ password: _,
1189
+ isRegisteredUser: l,
1190
+ sdpSemantics: d,
1191
+ isDisconnectOnFail: S
1192
+ } = t;
1193
+ return E("connectToServer", t), n.connect({
1194
+ userAgent: s,
1195
+ sdpSemantics: d,
1196
+ sipWebSocketServerURL: r,
1309
1197
  sipServerUrl: o,
1310
1198
  remoteAddress: i,
1311
- displayName: a,
1312
- password: l,
1199
+ displayName: c,
1200
+ password: _,
1313
1201
  user: u,
1314
- register: d
1315
- }).then(() => (_("connectToServer then"), !0)).catch(async (S) => (_("connectToServer catch: error", S), h === !0 ? e.disconnect().then(() => le(S)).catch(() => le(S)) : le(S)));
1316
- }, Ro = (e) => async () => (_("disconnectFromServer"), e.disconnect().then(() => (_("disconnectFromServer: then"), !1)).catch((t) => (_("disconnectFromServer: catch", t), !1))), at = (e) => {
1317
- const { url: t, cause: n } = e;
1318
- let r = t;
1319
- return (n === Re || n === Ce) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
1202
+ register: l
1203
+ }).then(() => (E("connectToServer then"), !0)).catch(async (h) => (E("connectToServer catch: error", h), S === !0 ? n.disconnect().then(() => Q(h)).catch(() => Q(h)) : Q(h)));
1204
+ }, hs = (n) => async () => (E("disconnectFromServer"), n.disconnect().then(() => (E("disconnectFromServer: then"), !1)).catch((e) => (E("disconnectFromServer: catch", e), !1))), $e = (n) => {
1205
+ const { url: e, cause: t } = n;
1206
+ let s = e;
1207
+ return (t === re || t === se) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
1320
1208
  };
1321
- var wn = /* @__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))(wn || {});
1322
- const No = (e = new Error()) => {
1323
- var s;
1324
- const { cause: t, socket: n } = e;
1325
- let r = "CONNECT_SERVER_FAILED";
1326
- switch (t) {
1209
+ var kt = /* @__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))(kt || {});
1210
+ const Ts = (n = new Error()) => {
1211
+ var r;
1212
+ const { cause: e, socket: t } = n;
1213
+ let s = "CONNECT_SERVER_FAILED";
1214
+ switch (e) {
1327
1215
  case "Forbidden": {
1328
- r = "WRONG_USER_OR_PASSWORD";
1216
+ s = "WRONG_USER_OR_PASSWORD";
1329
1217
  break;
1330
1218
  }
1331
- case Re: {
1332
- r = "BAD_MEDIA_ERROR";
1219
+ case re: {
1220
+ s = "BAD_MEDIA_ERROR";
1333
1221
  break;
1334
1222
  }
1335
- case Ce: {
1336
- r = "NOT_FOUND_ERROR";
1223
+ case se: {
1224
+ s = "NOT_FOUND_ERROR";
1337
1225
  break;
1338
1226
  }
1339
1227
  default:
1340
- n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" : at(e) && (r = "CONNECT_SERVER_FAILED_BY_LINK");
1228
+ t && ((r = t == null ? void 0 : t._ws) == null ? void 0 : r.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : $e(n) && (s = "CONNECT_SERVER_FAILED_BY_LINK");
1341
1229
  }
1342
- return r;
1343
- }, vo = (e = new Error()) => {
1344
- const { code: t, cause: n, message: r } = e, s = at(e), o = {};
1345
- return r && (o.message = r), s && (o.link = s), t && (o.code = t), n && (o.cause = n), o;
1346
- }, Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1230
+ return s;
1231
+ }, Cs = (n = new Error()) => {
1232
+ const { code: e, cause: t, message: s } = n, r = $e(n), o = {};
1233
+ return s && (o.message = s), r && (o.link = r), e && (o.code = e), t && (o.cause = t), o;
1234
+ }, gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1347
1235
  __proto__: null,
1348
- EErrorTypes: wn,
1349
- getLinkError: at,
1350
- getTypeFromError: No,
1351
- getValuesFromError: vo
1352
- }, Symbol.toStringTag, { value: "Module" })), po = ({
1353
- sessionId: e,
1354
- remoteAddress: t,
1355
- isMutedAudio: n,
1356
- isMutedVideo: r,
1357
- isRegistered: s,
1236
+ EErrorTypes: kt,
1237
+ getLinkError: $e,
1238
+ getTypeFromError: Ts,
1239
+ getValuesFromError: Cs
1240
+ }, Symbol.toStringTag, { value: "Module" })), Ns = ({
1241
+ sessionId: n,
1242
+ remoteAddress: e,
1243
+ isMutedAudio: t,
1244
+ isMutedVideo: s,
1245
+ isRegistered: r,
1358
1246
  isPresentationCall: o
1359
1247
  }) => {
1360
- const i = [], a = n ? "0" : "1", u = r ? "0" : "1";
1361
- return i.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), s || i.push("X-Vinteo-Purgatory-Call: yes"), e && i.push(`X-Vinteo-Session: ${e}`), o && i.push("X-Vinteo-Presentation-Call: yes"), t && i.push(`X-Vinteo-Remote: ${t}`), i;
1362
- }, bo = ({
1363
- appName: e,
1364
- appVersion: t,
1365
- browserName: n,
1366
- browserVersion: r
1248
+ const i = [], c = t ? "0" : "1", u = s ? "0" : "1";
1249
+ return i.push(`X-Vinteo-Mic-State: ${c}`, `X-Vinteo-MainCam-State: ${u}`), r || i.push("X-Vinteo-Purgatory-Call: yes"), n && i.push(`X-Vinteo-Session: ${n}`), o && i.push("X-Vinteo-Presentation-Call: yes"), e && i.push(`X-Vinteo-Remote: ${e}`), i;
1250
+ }, ms = ({
1251
+ appName: n,
1252
+ appVersion: e,
1253
+ browserName: t,
1254
+ browserVersion: s
1367
1255
  }) => {
1368
- const s = `${e} ${t}`;
1369
- return `ChromeNew - ${n ? `${n} ${r}, ${s}` : s}`;
1370
- }, yo = ({
1371
- isUnifiedSdpSemantic: e,
1372
- appVersion: t,
1373
- browserName: n,
1374
- browserVersion: r,
1375
- appName: s
1376
- }) => e ? bo({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", Io = (e) => async () => {
1377
- if (e.isCallActive)
1378
- return _("askPermissionToEnableCam"), e.askPermissionToEnableCam();
1379
- }, Oo = (e) => (n) => (_("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Mo = (e) => (n) => (_("onUseLicense"), e.onSession("useLicense", n)), Po = (e) => async ({
1380
- isEnabledCam: n,
1381
- isEnabledMic: r
1256
+ const r = `${n} ${e}`;
1257
+ return `ChromeNew - ${t ? `${t} ${s}, ${r}` : r}`;
1258
+ }, Rs = ({
1259
+ isUnifiedSdpSemantic: n,
1260
+ appVersion: e,
1261
+ browserName: t,
1262
+ browserVersion: s,
1263
+ appName: r
1264
+ }) => n ? ms({ appVersion: e, browserName: t, browserVersion: s, appName: r }) : "Chrome", As = (n) => async () => {
1265
+ if (n.isCallActive)
1266
+ return E("askPermissionToEnableCam"), n.askPermissionToEnableCam();
1267
+ }, fs = (n) => (t) => (E("onMustStopPresentation"), n.onSession("mustStopPresentation", t)), Is = (n) => (t) => (E("onUseLicense"), n.onSession("useLicense", t)), Ms = (n) => async ({
1268
+ isEnabledCam: t,
1269
+ isEnabledMic: s
1382
1270
  }) => {
1383
- if (e.isCallActive)
1384
- return _("sendMediaState"), e.sendMediaState({ cam: n, mic: r });
1385
- }, Do = (e) => async () => {
1386
- if (e.isCallActive)
1387
- return _("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((n) => {
1388
- _("sendRefusalToTurnOnCam: error", n);
1271
+ if (n.isCallActive)
1272
+ return E("sendMediaState"), n.sendMediaState({ cam: t, mic: s });
1273
+ }, Os = (n) => async () => {
1274
+ if (n.isCallActive)
1275
+ return E("sendRefusalToTurnOnCam"), n.sendRefusalToTurnOnCam().catch((t) => {
1276
+ E("sendRefusalToTurnOnCam: error", t);
1389
1277
  });
1390
- }, wo = (e) => async () => {
1391
- if (e.isCallActive)
1392
- return _("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((n) => {
1393
- _("sendRefusalToTurnOnMic: error", n);
1278
+ }, Ps = (n) => async () => {
1279
+ if (n.isCallActive)
1280
+ return E("sendRefusalToTurnOnMic"), n.sendRefusalToTurnOnMic().catch((t) => {
1281
+ E("sendRefusalToTurnOnMic: error", t);
1394
1282
  });
1395
- }, $o = 1e6, Lo = ({
1396
- maxBitrate: e = $o,
1397
- sipConnector: t
1283
+ }, Ds = 1e6, ps = ({
1284
+ maxBitrate: n = Ds,
1285
+ sipConnector: e
1398
1286
  }) => async ({
1399
- mediaStream: r,
1400
- isP2P: s = !1
1401
- }) => (_("startPresentation"), t.startPresentation(r, {
1402
- isP2P: s,
1403
- maxBitrate: e
1404
- })), Uo = ({ sipConnector: e }) => async ({ isP2P: n = !1 } = {}) => (_("stopShareSipConnector"), e.stopPresentation({
1405
- isP2P: n
1406
- }).catch(_)), Fo = 1e6, ko = ({
1407
- sipConnector: e,
1408
- maxBitrate: t = Fo
1287
+ mediaStream: s,
1288
+ isP2P: r = !1
1289
+ }) => (E("startPresentation"), e.startPresentation(s, {
1290
+ isP2P: r,
1291
+ maxBitrate: n
1292
+ })), vs = ({ sipConnector: n }) => async ({ isP2P: t = !1 } = {}) => (E("stopShareSipConnector"), n.stopPresentation({
1293
+ isP2P: t
1294
+ }).catch(E)), ys = 1e6, bs = ({
1295
+ sipConnector: n,
1296
+ maxBitrate: e = ys
1409
1297
  }) => async ({
1410
- mediaStream: r,
1411
- isP2P: s = !1
1412
- }) => (_("updatePresentation"), e.updatePresentation(r, {
1413
- isP2P: s,
1414
- maxBitrate: t
1415
- }));
1416
- var Bo = L, pt = Object.create, xo = function() {
1417
- function e() {
1418
- }
1419
- return function(t) {
1420
- if (!Bo(t))
1421
- return {};
1422
- if (pt)
1423
- return pt(t);
1424
- e.prototype = t;
1425
- var n = new e();
1426
- return e.prototype = void 0, n;
1427
- };
1428
- }(), $n = xo;
1429
- function Ho() {
1430
- }
1431
- var ct = Ho, Wo = $n, jo = ct;
1432
- function Q(e, t) {
1433
- this.__wrapped__ = e, this.__actions__ = [], this.__chain__ = !!t, this.__index__ = 0, this.__values__ = void 0;
1434
- }
1435
- Q.prototype = Wo(jo.prototype);
1436
- Q.prototype.constructor = Q;
1437
- var ut = Q;
1438
- function Vo(e, t) {
1439
- for (var n = -1, r = t.length, s = e.length; ++n < r; )
1440
- e[s + n] = t[n];
1441
- return e;
1442
- }
1443
- var qo = Vo, Go = oe, Yo = W, Xo = "[object Arguments]";
1444
- function zo(e) {
1445
- return Yo(e) && Go(e) == Xo;
1446
- }
1447
- var Jo = zo, bt = Jo, Ko = W, Ln = Object.prototype, Qo = Ln.hasOwnProperty, Zo = Ln.propertyIsEnumerable, ei = bt(function() {
1448
- return arguments;
1449
- }()) ? bt : function(e) {
1450
- return Ko(e) && Qo.call(e, "callee") && !Zo.call(e, "callee");
1451
- }, ti = ei, ni = Array.isArray, ie = ni, yt = se, ri = ti, si = ie, It = yt ? yt.isConcatSpreadable : void 0;
1452
- function oi(e) {
1453
- return si(e) || ri(e) || !!(It && e && e[It]);
1454
- }
1455
- var ii = oi, ai = qo, ci = ii;
1456
- function Un(e, t, n, r, s) {
1457
- var o = -1, i = e.length;
1458
- for (n || (n = ci), s || (s = []); ++o < i; ) {
1459
- var a = e[o];
1460
- t > 0 && n(a) ? t > 1 ? Un(a, t - 1, n, r, s) : ai(s, a) : r || (s[s.length] = a);
1461
- }
1462
- return s;
1463
- }
1464
- var ui = Un, li = ui;
1465
- function _i(e) {
1466
- var t = e == null ? 0 : e.length;
1467
- return t ? li(e, 1) : [];
1468
- }
1469
- var di = _i;
1470
- function Ei(e, t, n) {
1471
- switch (n.length) {
1472
- case 0:
1473
- return e.call(t);
1474
- case 1:
1475
- return e.call(t, n[0]);
1476
- case 2:
1477
- return e.call(t, n[0], n[1]);
1478
- case 3:
1479
- return e.call(t, n[0], n[1], n[2]);
1480
- }
1481
- return e.apply(t, n);
1482
- }
1483
- var hi = Ei, fi = hi, Ot = Math.max;
1484
- function Si(e, t, n) {
1485
- return t = Ot(t === void 0 ? e.length - 1 : t, 0), function() {
1486
- for (var r = arguments, s = -1, o = Ot(r.length - t, 0), i = Array(o); ++s < o; )
1487
- i[s] = r[t + s];
1488
- s = -1;
1489
- for (var a = Array(t + 1); ++s < t; )
1490
- a[s] = r[s];
1491
- return a[t] = n(i), fi(e, this, a);
1492
- };
1493
- }
1494
- var gi = Si;
1495
- function Ti(e) {
1496
- return function() {
1497
- return e;
1498
- };
1499
- }
1500
- var mi = Ti, Ci = oe, Ri = L, Ni = "[object AsyncFunction]", vi = "[object Function]", Ai = "[object GeneratorFunction]", pi = "[object Proxy]";
1501
- function bi(e) {
1502
- if (!Ri(e))
1503
- return !1;
1504
- var t = Ci(e);
1505
- return t == vi || t == Ai || t == Ni || t == pi;
1506
- }
1507
- var Fn = bi, yi = re, Ii = yi["__core-js_shared__"], Oi = Ii, _e = Oi, Mt = function() {
1508
- var e = /[^.]+$/.exec(_e && _e.keys && _e.keys.IE_PROTO || "");
1509
- return e ? "Symbol(src)_1." + e : "";
1510
- }();
1511
- function Mi(e) {
1512
- return !!Mt && Mt in e;
1513
- }
1514
- var Pi = Mi, Di = Function.prototype, wi = Di.toString;
1515
- function $i(e) {
1516
- if (e != null) {
1517
- try {
1518
- return wi.call(e);
1519
- } catch {
1520
- }
1521
- try {
1522
- return e + "";
1523
- } catch {
1524
- }
1525
- }
1526
- return "";
1527
- }
1528
- var Li = $i, Ui = Fn, Fi = Pi, ki = L, Bi = Li, xi = /[\\^$.*+?()[\]{}|]/g, Hi = /^\[object .+?Constructor\]$/, Wi = Function.prototype, ji = Object.prototype, Vi = Wi.toString, qi = ji.hasOwnProperty, Gi = RegExp(
1529
- "^" + Vi.call(qi).replace(xi, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1530
- );
1531
- function Yi(e) {
1532
- if (!ki(e) || Fi(e))
1533
- return !1;
1534
- var t = Ui(e) ? Gi : Hi;
1535
- return t.test(Bi(e));
1536
- }
1537
- var Xi = Yi;
1538
- function zi(e, t) {
1539
- return e == null ? void 0 : e[t];
1540
- }
1541
- var Ji = zi, Ki = Xi, Qi = Ji;
1542
- function Zi(e, t) {
1543
- var n = Qi(e, t);
1544
- return Ki(n) ? n : void 0;
1545
- }
1546
- var kn = Zi, ea = kn, ta = function() {
1547
- try {
1548
- var e = ea(Object, "defineProperty");
1549
- return e({}, "", {}), e;
1550
- } catch {
1551
- }
1552
- }(), na = ta;
1553
- function ra(e) {
1554
- return e;
1555
- }
1556
- var sa = ra, oa = mi, Pt = na, ia = sa, aa = Pt ? function(e, t) {
1557
- return Pt(e, "toString", {
1558
- configurable: !0,
1559
- enumerable: !1,
1560
- value: oa(t),
1561
- writable: !0
1562
- });
1563
- } : ia, ca = aa, ua = 800, la = 16, _a = Date.now;
1564
- function da(e) {
1565
- var t = 0, n = 0;
1566
- return function() {
1567
- var r = _a(), s = la - (r - n);
1568
- if (n = r, s > 0) {
1569
- if (++t >= ua)
1570
- return arguments[0];
1571
- } else
1572
- t = 0;
1573
- return e.apply(void 0, arguments);
1574
- };
1575
- }
1576
- var Ea = da, ha = ca, fa = Ea, Sa = fa(ha), ga = Sa, Ta = di, ma = gi, Ca = ga;
1577
- function Ra(e) {
1578
- return Ca(ma(e, void 0, Ta), e + "");
1579
- }
1580
- var Na = Ra, va = kn, Aa = re, pa = va(Aa, "WeakMap"), ba = pa, Dt = ba, ya = Dt && new Dt(), Ia = ya;
1581
- function Oa() {
1582
- }
1583
- var Ma = Oa, wt = Ia, Pa = Ma, Da = wt ? function(e) {
1584
- return wt.get(e);
1585
- } : Pa, Bn = Da, wa = {}, $a = wa, $t = $a, La = Object.prototype, Ua = La.hasOwnProperty;
1586
- function Fa(e) {
1587
- for (var t = e.name + "", n = $t[t], r = Ua.call($t, t) ? n.length : 0; r--; ) {
1588
- var s = n[r], o = s.func;
1589
- if (o == null || o == e)
1590
- return s.name;
1591
- }
1592
- return t;
1593
- }
1594
- var xn = Fa, ka = $n, Ba = ct, xa = 4294967295;
1595
- function Z(e) {
1596
- this.__wrapped__ = e, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, this.__iteratees__ = [], this.__takeCount__ = xa, this.__views__ = [];
1597
- }
1598
- Z.prototype = ka(Ba.prototype);
1599
- Z.prototype.constructor = Z;
1600
- var lt = Z;
1601
- function Ha(e, t) {
1602
- var n = -1, r = e.length;
1603
- for (t || (t = Array(r)); ++n < r; )
1604
- t[n] = e[n];
1605
- return t;
1606
- }
1607
- var Wa = Ha, ja = lt, Va = ut, qa = Wa;
1608
- function Ga(e) {
1609
- if (e instanceof ja)
1610
- return e.clone();
1611
- var t = new Va(e.__wrapped__, e.__chain__);
1612
- return t.__actions__ = qa(e.__actions__), t.__index__ = e.__index__, t.__values__ = e.__values__, t;
1613
- }
1614
- var Ya = Ga, Xa = lt, Lt = ut, za = ct, Ja = ie, Ka = W, Qa = Ya, Za = Object.prototype, ec = Za.hasOwnProperty;
1615
- function ee(e) {
1616
- if (Ka(e) && !Ja(e) && !(e instanceof Xa)) {
1617
- if (e instanceof Lt)
1618
- return e;
1619
- if (ec.call(e, "__wrapped__"))
1620
- return Qa(e);
1621
- }
1622
- return new Lt(e);
1623
- }
1624
- ee.prototype = za.prototype;
1625
- ee.prototype.constructor = ee;
1626
- var tc = ee, nc = lt, rc = Bn, sc = xn, oc = tc;
1627
- function ic(e) {
1628
- var t = sc(e), n = oc[t];
1629
- if (typeof n != "function" || !(t in nc.prototype))
1630
- return !1;
1631
- if (e === n)
1632
- return !0;
1633
- var r = rc(n);
1634
- return !!r && e === r[0];
1635
- }
1636
- var ac = ic, Ut = ut, cc = Na, uc = Bn, de = xn, lc = ie, Ft = ac, _c = "Expected a function", dc = 8, Ec = 32, hc = 128, fc = 256;
1637
- function Sc(e) {
1638
- return cc(function(t) {
1639
- var n = t.length, r = n, s = Ut.prototype.thru;
1640
- for (e && t.reverse(); r--; ) {
1641
- var o = t[r];
1642
- if (typeof o != "function")
1643
- throw new TypeError(_c);
1644
- if (s && !i && de(o) == "wrapper")
1645
- var i = new Ut([], !0);
1646
- }
1647
- for (r = i ? r : n; ++r < n; ) {
1648
- o = t[r];
1649
- var a = de(o), u = a == "wrapper" ? uc(o) : void 0;
1650
- u && Ft(u[0]) && u[1] == (hc | dc | Ec | fc) && !u[4].length && u[9] == 1 ? i = i[de(u[0])].apply(i, u[3]) : i = o.length == 1 && Ft(o) ? i[a]() : i.thru(o);
1651
- }
1652
- return function() {
1653
- var l = arguments, d = l[0];
1654
- if (i && l.length == 1 && lc(d))
1655
- return i.plant(d).value();
1656
- for (var E = 0, h = n ? t[E].apply(this, l) : d; ++E < n; )
1657
- h = t[E].call(this, h);
1658
- return h;
1659
- };
1660
- });
1661
- }
1662
- var gc = Sc, Tc = gc, mc = Tc(), Cc = mc;
1663
- const Rc = /* @__PURE__ */ ot(Cc);
1664
- function Nc(e, t) {
1665
- for (var n = -1, r = e == null ? 0 : e.length, s = Array(r); ++n < r; )
1666
- s[n] = t(e[n], n, e);
1667
- return s;
1668
- }
1669
- var vc = Nc, kt = se, Ac = vc, pc = ie, bc = Dn, yc = 1 / 0, Bt = kt ? kt.prototype : void 0, xt = Bt ? Bt.toString : void 0;
1670
- function Hn(e) {
1671
- if (typeof e == "string")
1672
- return e;
1673
- if (pc(e))
1674
- return Ac(e, Hn) + "";
1675
- if (bc(e))
1676
- return xt ? xt.call(e) : "";
1677
- var t = e + "";
1678
- return t == "0" && 1 / e == -yc ? "-0" : t;
1679
- }
1680
- var Wn = Hn;
1681
- function Ic(e, t, n) {
1682
- var r = -1, s = e.length;
1683
- t < 0 && (t = -t > s ? 0 : s + t), n = n > s ? s : n, n < 0 && (n += s), s = t > n ? 0 : n - t >>> 0, t >>>= 0;
1684
- for (var o = Array(s); ++r < s; )
1685
- o[r] = e[r + t];
1686
- return o;
1687
- }
1688
- var Oc = Ic, Mc = Oc;
1689
- function Pc(e, t, n) {
1690
- var r = e.length;
1691
- return n = n === void 0 ? r : n, !t && n >= r ? e : Mc(e, t, n);
1692
- }
1693
- var Dc = Pc, wc = "\\ud800-\\udfff", $c = "\\u0300-\\u036f", Lc = "\\ufe20-\\ufe2f", Uc = "\\u20d0-\\u20ff", Fc = $c + Lc + Uc, kc = "\\ufe0e\\ufe0f", Bc = "\\u200d", xc = RegExp("[" + Bc + wc + Fc + kc + "]");
1694
- function Hc(e) {
1695
- return xc.test(e);
1696
- }
1697
- var jn = Hc;
1698
- function Wc(e, t) {
1699
- return e === t || e !== e && t !== t;
1700
- }
1701
- var jc = Wc, Vc = 9007199254740991;
1702
- function qc(e) {
1703
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Vc;
1704
- }
1705
- var Gc = qc, Yc = Fn, Xc = Gc;
1706
- function zc(e) {
1707
- return e != null && Xc(e.length) && !Yc(e);
1708
- }
1709
- var Jc = zc, Kc = 9007199254740991, Qc = /^(?:0|[1-9]\d*)$/;
1710
- function Zc(e, t) {
1711
- var n = typeof e;
1712
- return t = t ?? Kc, !!t && (n == "number" || n != "symbol" && Qc.test(e)) && e > -1 && e % 1 == 0 && e < t;
1713
- }
1714
- var eu = Zc, tu = jc, nu = Jc, ru = eu, su = L;
1715
- function ou(e, t, n) {
1716
- if (!su(n))
1717
- return !1;
1718
- var r = typeof t;
1719
- return (r == "number" ? nu(n) && ru(t, n.length) : r == "string" && t in n) ? tu(n[t], e) : !1;
1720
- }
1721
- var iu = ou, au = oe, cu = W, uu = "[object RegExp]";
1722
- function lu(e) {
1723
- return cu(e) && au(e) == uu;
1724
- }
1725
- var _u = lu;
1726
- function du(e) {
1727
- return function(t) {
1728
- return e(t);
1729
- };
1730
- }
1731
- var Eu = du, te = { exports: {} };
1732
- te.exports;
1733
- (function(e, t) {
1734
- var n = Mn, r = t && !t.nodeType && t, s = r && !0 && e && !e.nodeType && e, o = s && s.exports === r, i = o && n.process, a = function() {
1735
- try {
1736
- var u = s && s.require && s.require("util").types;
1737
- return u || i && i.binding && i.binding("util");
1738
- } catch {
1739
- }
1740
- }();
1741
- e.exports = a;
1742
- })(te, te.exports);
1743
- var hu = te.exports, fu = _u, Su = Eu, Ht = hu, Wt = Ht && Ht.isRegExp, gu = Wt ? Su(Wt) : fu, Tu = gu;
1744
- function mu(e) {
1745
- return e.split("");
1746
- }
1747
- var Cu = mu, Vn = "\\ud800-\\udfff", Ru = "\\u0300-\\u036f", Nu = "\\ufe20-\\ufe2f", vu = "\\u20d0-\\u20ff", Au = Ru + Nu + vu, pu = "\\ufe0e\\ufe0f", bu = "[" + Vn + "]", ge = "[" + Au + "]", Te = "\\ud83c[\\udffb-\\udfff]", yu = "(?:" + ge + "|" + Te + ")", qn = "[^" + Vn + "]", Gn = "(?:\\ud83c[\\udde6-\\uddff]){2}", Yn = "[\\ud800-\\udbff][\\udc00-\\udfff]", Iu = "\\u200d", Xn = yu + "?", zn = "[" + pu + "]?", Ou = "(?:" + Iu + "(?:" + [qn, Gn, Yn].join("|") + ")" + zn + Xn + ")*", Mu = zn + Xn + Ou, Pu = "(?:" + [qn + ge + "?", ge, Gn, Yn, bu].join("|") + ")", Du = RegExp(Te + "(?=" + Te + ")|" + Pu + Mu, "g");
1748
- function wu(e) {
1749
- return e.match(Du) || [];
1750
- }
1751
- var $u = wu, Lu = Cu, Uu = jn, Fu = $u;
1752
- function ku(e) {
1753
- return Uu(e) ? Fu(e) : Lu(e);
1754
- }
1755
- var Bu = ku, xu = Wn;
1756
- function Hu(e) {
1757
- return e == null ? "" : xu(e);
1758
- }
1759
- var Wu = Hu, ju = Wn, Vu = Dc, qu = jn, Gu = iu, Yu = Tu, Xu = Bu, zu = Wu, Ju = 4294967295;
1760
- function Ku(e, t, n) {
1761
- return n && typeof n != "number" && Gu(e, t, n) && (t = n = void 0), n = n === void 0 ? Ju : n >>> 0, n ? (e = zu(e), e && (typeof t == "string" || t != null && !Yu(t)) && (t = ju(t), !t && qu(e)) ? Vu(Xu(e), 0, n) : e.split(t, n)) : [];
1762
- }
1763
- var Qu = Ku;
1764
- const Zu = /* @__PURE__ */ ot(Qu), el = (e) => Rc(
1765
- (t) => Zu(t, ""),
1766
- (t) => t.map((n) => async () => e(n))
1767
- ), tl = async ({
1768
- accumulatedKeys: e,
1769
- sendKey: t,
1770
- canRunTask: n
1298
+ mediaStream: s,
1299
+ isP2P: r = !1
1300
+ }) => (E("updatePresentation"), n.updatePresentation(s, {
1301
+ isP2P: r,
1302
+ maxBitrate: e
1303
+ })), ws = (n) => (e) => [...e].map((s) => async () => n(s)), Us = async ({
1304
+ accumulatedKeys: n,
1305
+ sendKey: e,
1306
+ canRunTask: t
1771
1307
  }) => {
1772
- const s = el(t)(e);
1773
- return rr(s, n);
1774
- }, nl = (e) => (n) => (_("onStartMainCam"), e.onSession("admin-start-main-cam", n)), rl = (e) => (n) => (_("onStartMic"), e.onSession("admin-start-mic", n)), sl = (e) => (n) => (_("onStopMainCam"), e.onSession("admin-stop-main-cam", n)), ol = (e) => (n) => (_("onStopMic"), e.onSession("admin-stop-mic", n)), il = ({ sipConnector: e }) => {
1775
- const t = (g, m) => ({ isSyncForced: C = !1 }) => {
1776
- if (C) {
1777
- g();
1308
+ const r = ws(e)(n);
1309
+ return Xt(r, t);
1310
+ }, Ls = (n) => (t) => (E("onStartMainCam"), n.onSession("admin-start-main-cam", t)), Bs = (n) => (t) => (E("onStartMic"), n.onSession("admin-start-mic", t)), Fs = (n) => (t) => (E("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), ks = (n) => (t) => (E("onStopMic"), n.onSession("admin-stop-mic", t)), Hs = ({ sipConnector: n }) => {
1311
+ const e = (T, g) => ({ isSyncForced: N = !1 }) => {
1312
+ if (N) {
1313
+ T();
1778
1314
  return;
1779
1315
  }
1780
- m();
1781
- }, n = nl(e), r = sl(e), s = rl(e), o = ol(e);
1316
+ g();
1317
+ }, t = Ls(n), s = Fs(n), r = Bs(n), o = ks(n);
1782
1318
  let i = () => {
1783
- }, a = () => {
1319
+ }, c = () => {
1784
1320
  }, u = () => {
1785
- }, l = () => {
1321
+ }, _ = () => {
1786
1322
  };
1787
- const d = ({
1788
- onStartMainCamForced: g,
1789
- onStartMainCamNotForced: m,
1790
- onStopMainCamForced: C,
1791
- onStopMainCamNotForced: A,
1792
- onStartMicForced: b,
1793
- onStartMicNotForced: N,
1794
- onStopMicForced: v,
1795
- onStopMicNotForced: y
1323
+ const l = ({
1324
+ onStartMainCamForced: T,
1325
+ onStartMainCamNotForced: g,
1326
+ onStopMainCamForced: N,
1327
+ onStopMainCamNotForced: p,
1328
+ onStartMicForced: M,
1329
+ onStartMicNotForced: m,
1330
+ onStopMicForced: R,
1331
+ onStopMicNotForced: v
1796
1332
  }) => {
1797
- const f = t(
1798
- g,
1799
- m
1333
+ const f = e(
1334
+ T,
1335
+ g
1800
1336
  );
1801
- i = n(f);
1802
- const R = t(
1803
- C,
1804
- A
1337
+ i = t(f);
1338
+ const b = e(
1339
+ N,
1340
+ p
1805
1341
  );
1806
- a = r(R);
1807
- const p = t(b, N);
1808
- u = s(p);
1809
- const O = t(v, y);
1810
- l = o(O);
1811
- }, E = () => {
1812
- i(), a(), u(), l();
1342
+ c = s(b);
1343
+ const w = e(M, m);
1344
+ u = r(w);
1345
+ const U = e(R, v);
1346
+ _ = o(U);
1347
+ }, d = () => {
1348
+ i(), c(), u(), _();
1813
1349
  };
1814
1350
  return {
1815
- start: (g) => {
1816
- d(g);
1351
+ start: (T) => {
1352
+ l(T);
1817
1353
  },
1818
1354
  stop: () => {
1819
- E();
1355
+ d();
1820
1356
  }
1821
1357
  };
1822
- }, Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1358
+ }, Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1823
1359
  __proto__: null,
1824
- PURGATORY_CONFERENCE_NUMBER: In,
1825
- createSyncMediaState: il,
1826
- error: Ao,
1827
- getExtraHeaders: po,
1828
- getUserAgent: yo,
1829
- hasPurgatory: x,
1830
- resolveAnswerIncomingCall: To,
1831
- resolveAskPermissionToEnableCam: Io,
1832
- resolveCallToServer: mo,
1833
- resolveConnectToServer: Co,
1834
- resolveDisconnectFromServer: Ro,
1835
- resolveGetRemoteStreams: st,
1836
- resolveOnMustStopPresentation: Oo,
1837
- resolveOnUseLicense: Mo,
1838
- resolveSendMediaState: Po,
1839
- resolveSendRefusalToTurnOnCam: Do,
1840
- resolveSendRefusalToTurnOnMic: wo,
1841
- resolveStartPresentation: Lo,
1842
- resolveStopShareSipConnector: Uo,
1843
- resolveUpdatePresentation: ko,
1844
- resolveUpdateRemoteStreams: it,
1845
- sendDTMFAccumulated: tl
1846
- }, Symbol.toStringTag, { value: "Module" })), al = (e) => [...e.keys()].map((t) => e.get(t)), cl = (e, t) => al(e).find((n) => n.type === t), ul = async (e) => e.getStats().then((t) => {
1847
- const n = cl(t, "codec");
1848
- return n == null ? void 0 : n.mimeType;
1849
- }), ll = (e) => e.find((t) => {
1850
- var n;
1851
- return ((n = t == null ? void 0 : t.track) == null ? void 0 : n.kind) === "video";
1852
- }), Jn = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), _l = 1e6, I = (e) => e * _l, Kn = I(0.06), dl = I(4), El = (e) => e <= 64 ? Kn : e <= 128 ? I(0.12) : e <= 256 ? I(0.25) : e <= 384 ? I(0.32) : e <= 426 ? I(0.38) : e <= 640 ? I(0.5) : e <= 848 ? I(0.7) : e <= 1280 ? I(1) : e <= 1920 ? I(2) : dl, hl = "av1", fl = (e) => Jn(e, hl), Sl = 0.6, Qn = (e, t) => fl(t) ? e * Sl : e, gl = (e) => Qn(Kn, e), Zn = (e, t) => {
1853
- const n = El(e);
1854
- return Qn(n, t);
1855
- }, er = sr(), Tl = async () => er().catch((e) => {
1856
- _("videoSendingBalancer: error", e);
1857
- }), ml = async (e) => (er.add(e), Tl()), _t = async ({
1858
- sender: e,
1859
- scaleResolutionDownBy: t,
1860
- maxBitrate: n,
1861
- onSetParameters: r
1862
- }) => ml(async () => yn(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), Cl = async ({ sender: e, codec: t }, n) => {
1863
- const s = gl(t);
1864
- return _t({
1865
- sender: e,
1866
- maxBitrate: s,
1867
- onSetParameters: n,
1360
+ PURGATORY_CONFERENCE_NUMBER: Bt,
1361
+ createSyncMediaState: Hs,
1362
+ error: gs,
1363
+ getExtraHeaders: Ns,
1364
+ getUserAgent: Rs,
1365
+ hasPurgatory: k,
1366
+ resolveAnswerIncomingCall: ls,
1367
+ resolveAskPermissionToEnableCam: As,
1368
+ resolveCallToServer: ds,
1369
+ resolveConnectToServer: Ss,
1370
+ resolveDisconnectFromServer: hs,
1371
+ resolveGetRemoteStreams: We,
1372
+ resolveOnMustStopPresentation: fs,
1373
+ resolveOnUseLicense: Is,
1374
+ resolveSendMediaState: Ms,
1375
+ resolveSendRefusalToTurnOnCam: Os,
1376
+ resolveSendRefusalToTurnOnMic: Ps,
1377
+ resolveStartPresentation: ps,
1378
+ resolveStopShareSipConnector: vs,
1379
+ resolveUpdatePresentation: bs,
1380
+ resolveUpdateRemoteStreams: qe,
1381
+ sendDTMFAccumulated: Us
1382
+ }, Symbol.toStringTag, { value: "Module" })), Vs = (n) => [...n.keys()].map((e) => n.get(e)), Ws = (n, e) => Vs(n).find((t) => t.type === e), qs = async (n) => n.getStats().then((e) => {
1383
+ const t = Ws(e, "codec");
1384
+ return t == null ? void 0 : t.mimeType;
1385
+ }), $s = (n) => n.find((e) => {
1386
+ var t;
1387
+ return ((t = e == null ? void 0 : e.track) == null ? void 0 : t.kind) === "video";
1388
+ }), Ht = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), xs = 1e6, A = (n) => n * xs, Vt = A(0.06), Ys = A(4), Gs = (n) => n <= 64 ? Vt : n <= 128 ? A(0.12) : n <= 256 ? A(0.25) : n <= 384 ? A(0.32) : n <= 426 ? A(0.38) : n <= 640 ? A(0.5) : n <= 848 ? A(0.7) : n <= 1280 ? A(1) : n <= 1920 ? A(2) : Ys, Xs = "av1", zs = (n) => Ht(n, Xs), Ks = 0.6, Wt = (n, e) => zs(e) ? n * Ks : n, Js = (n) => Wt(Vt, n), qt = (n, e) => {
1389
+ const t = Gs(n);
1390
+ return Wt(t, e);
1391
+ }, $t = zt(), Qs = async () => $t().catch((n) => {
1392
+ E("videoSendingBalancer: error", n);
1393
+ }), js = async (n) => ($t.add(n), Qs()), xe = async ({
1394
+ sender: n,
1395
+ scaleResolutionDownBy: e,
1396
+ maxBitrate: t,
1397
+ onSetParameters: s
1398
+ }) => js(async () => Lt(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), Zs = async ({ sender: n, codec: e }, t) => {
1399
+ const r = Js(e);
1400
+ return xe({
1401
+ sender: n,
1402
+ maxBitrate: r,
1403
+ onSetParameters: t,
1868
1404
  scaleResolutionDownBy: 200
1869
1405
  });
1870
- }, Ee = async ({ sender: e, track: t, codec: n }, r) => {
1871
- const i = t.getSettings().width, a = Zn(i, n);
1872
- return _t({
1873
- sender: e,
1874
- maxBitrate: a,
1875
- onSetParameters: r,
1876
- scaleResolutionDownBy: 1
1877
- });
1878
- }, Rl = async ({
1879
- sender: e,
1880
- track: t,
1881
- resolution: n,
1882
- codec: r
1883
- }, s) => {
1884
- const o = t.getSettings(), i = o.width, a = o.height, [u, l] = n.split("x"), d = i / Number(u), E = a / Number(l), S = Math.max(d, E, 1), g = Zn(Number(u), r);
1885
- return _t({
1886
- sender: e,
1887
- maxBitrate: g,
1406
+ }, j = async ({ sender: n, track: e, codec: t }, s) => {
1407
+ const i = e.getSettings().width, c = qt(i, t);
1408
+ return xe({
1409
+ sender: n,
1410
+ maxBitrate: c,
1888
1411
  onSetParameters: s,
1889
- scaleResolutionDownBy: S
1412
+ scaleResolutionDownBy: 1
1890
1413
  });
1891
- }, Nl = async ({
1892
- mainCam: e,
1893
- resolutionMainCam: t,
1414
+ }, er = async ({
1894
1415
  sender: n,
1895
- track: r,
1416
+ track: e,
1417
+ resolution: t,
1896
1418
  codec: s
1419
+ }, r) => {
1420
+ const o = e.getSettings(), i = o.width, c = o.height, [u, _] = t.split("x"), l = i / Number(u), d = c / Number(_), h = Math.max(l, d, 1), T = qt(Number(u), s);
1421
+ return xe({
1422
+ sender: n,
1423
+ maxBitrate: T,
1424
+ onSetParameters: r,
1425
+ scaleResolutionDownBy: h
1426
+ });
1427
+ }, tr = async ({
1428
+ mainCam: n,
1429
+ resolutionMainCam: e,
1430
+ sender: t,
1431
+ track: s,
1432
+ codec: r
1897
1433
  }, o) => {
1898
- switch (e) {
1899
- case M.PAUSE_MAIN_CAM:
1900
- return Cl({ sender: n, codec: s }, o);
1901
- case M.RESUME_MAIN_CAM:
1902
- return Ee({ sender: n, track: r, codec: s }, o);
1903
- case M.MAX_MAIN_CAM_RESOLUTION:
1904
- return t !== void 0 ? Rl(
1905
- { sender: n, track: r, codec: s, resolution: t },
1434
+ switch (n) {
1435
+ case I.PAUSE_MAIN_CAM:
1436
+ return Zs({ sender: t, codec: r }, o);
1437
+ case I.RESUME_MAIN_CAM:
1438
+ return j({ sender: t, track: s, codec: r }, o);
1439
+ case I.MAX_MAIN_CAM_RESOLUTION:
1440
+ return e !== void 0 ? er(
1441
+ { sender: t, track: s, codec: r, resolution: e },
1906
1442
  o
1907
- ) : Ee({ sender: n, track: r, codec: s }, o);
1443
+ ) : j({ sender: t, track: s, codec: r }, o);
1908
1444
  default:
1909
- return Ee({ sender: n, track: r, codec: s }, o);
1445
+ return j({ sender: t, track: s, codec: r }, o);
1910
1446
  }
1911
- }, jt = {
1447
+ }, je = {
1912
1448
  isChanged: !1,
1913
1449
  parameters: {
1914
1450
  encodings: [{}],
@@ -1917,78 +1453,78 @@ const Zu = /* @__PURE__ */ ot(Qu), el = (e) => Rc(
1917
1453
  headerExtensions: [],
1918
1454
  rtcp: {}
1919
1455
  }
1920
- }, Vt = async ({
1921
- mainCam: e,
1922
- resolutionMainCam: t,
1923
- connection: n,
1924
- onSetParameters: r,
1925
- ignoreForCodec: s
1456
+ }, Ze = async ({
1457
+ mainCam: n,
1458
+ resolutionMainCam: e,
1459
+ connection: t,
1460
+ onSetParameters: s,
1461
+ ignoreForCodec: r
1926
1462
  }) => {
1927
- const o = n.getSenders(), i = ll(o);
1463
+ const o = t.getSenders(), i = $s(o);
1928
1464
  if (!(i != null && i.track))
1929
- return jt;
1930
- const a = await ul(i);
1931
- return Jn(a, s) ? jt : Nl(
1932
- { mainCam: e, resolutionMainCam: t, sender: i, codec: a, track: i.track },
1933
- r
1465
+ return je;
1466
+ const c = await qs(i);
1467
+ return Ht(c, r) ? je : tr(
1468
+ { mainCam: n, resolutionMainCam: e, sender: i, codec: c, track: i.track },
1469
+ s
1934
1470
  );
1935
- }, Fl = (e, {
1936
- ignoreForCodec: t,
1937
- onSetParameters: n
1471
+ }, Cr = (n, {
1472
+ ignoreForCodec: e,
1473
+ onSetParameters: t
1938
1474
  } = {}) => {
1939
- const r = async () => {
1940
- const { connection: u } = e;
1475
+ const s = async () => {
1476
+ const { connection: u } = n;
1941
1477
  if (!u)
1942
1478
  throw new Error("connection is not exist");
1943
- return Vt({
1479
+ return Ze({
1944
1480
  connection: u,
1945
- onSetParameters: n,
1946
- ignoreForCodec: t
1481
+ onSetParameters: t,
1482
+ ignoreForCodec: e
1947
1483
  });
1948
1484
  };
1949
- let s = r;
1950
- const o = async (u) => (s = async () => {
1951
- const { mainCam: l, resolutionMainCam: d } = u, { connection: E } = e;
1952
- if (!E)
1485
+ let r = s;
1486
+ const o = async (u) => (r = async () => {
1487
+ const { mainCam: _, resolutionMainCam: l } = u, { connection: d } = n;
1488
+ if (!d)
1953
1489
  throw new Error("connection is not exist");
1954
- return Vt({
1955
- mainCam: l,
1956
- resolutionMainCam: d,
1957
- connection: E,
1958
- onSetParameters: n,
1959
- ignoreForCodec: t
1490
+ return Ze({
1491
+ mainCam: _,
1492
+ resolutionMainCam: l,
1493
+ connection: d,
1494
+ onSetParameters: t,
1495
+ ignoreForCodec: e
1960
1496
  });
1961
- }, s());
1497
+ }, r());
1962
1498
  return {
1963
1499
  subscribe: () => {
1964
- e.onSession("main-cam-control", o);
1500
+ n.onSession("main-cam-control", o);
1965
1501
  },
1966
1502
  unsubscribe: () => {
1967
- e.offSession("main-cam-control", o);
1503
+ n.offSession("main-cam-control", o);
1968
1504
  },
1969
- balanceByTrack: r,
1505
+ balanceByTrack: s,
1970
1506
  resetMainCamControl() {
1971
- s = r;
1507
+ r = s;
1972
1508
  },
1973
1509
  async reBalance() {
1974
- return s();
1510
+ return r();
1975
1511
  }
1976
1512
  };
1977
1513
  };
1978
1514
  export {
1979
- M as EEventsMainCAM,
1980
- he as EEventsMic,
1981
- fe as EEventsSyncMediaState,
1982
- Xr as EUseLicense,
1983
- Ol as causes,
1984
- Ml as constants,
1985
- xl as debug,
1986
- Ll as default,
1987
- wl as disableDebug,
1988
- Dl as enableDebug,
1989
- Pl as eventNames,
1990
- ul as getCodecFromSender,
1991
- $l as hasCanceledCallError,
1992
- Fl as resolveVideoSendingBalancer,
1993
- Ul as tools
1515
+ I as EEventsMainCAM,
1516
+ Z as EEventsMic,
1517
+ ee as EEventsSyncMediaState,
1518
+ Hn as EUseLicense,
1519
+ ur as causes,
1520
+ Er as constants,
1521
+ mr as debug,
1522
+ hr as default,
1523
+ dr as disableDebug,
1524
+ lr as enableDebug,
1525
+ _r as eventNames,
1526
+ qs as getCodecFromSender,
1527
+ Sr as hasCanceledCallError,
1528
+ Cr as resolveVideoSendingBalancer,
1529
+ Tr as tools
1994
1530
  };