@vkontakte/calls-sdk 2.8.13-beta.2 → 2.8.13-dev.0b2c361e.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/abstract/BaseApi.d.ts +4 -0
- package/calls-sdk.cjs.js +5 -5
- package/calls-sdk.esm.js +565 -543
- package/classes/stat/ApiCallStats.d.ts +12 -0
- package/classes/stat/ConversationStats.d.ts +3 -0
- package/classes/transport/DirectTransport.d.ts +4 -0
- package/default/Signaling.d.ts +10 -1
- package/enums/Stat.d.ts +1 -0
- package/package.json +1 -1
- package/static/Params.d.ts +8 -0
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-dev.0b2c361e.0
|
|
3
|
+
* Wed, 23 Sep 2026 14:04:35 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -2162,7 +2162,7 @@ var vn = _n.getInstance(), N = class e {
|
|
|
2162
2162
|
return 1.1;
|
|
2163
2163
|
}
|
|
2164
2164
|
static get sdkVersion() {
|
|
2165
|
-
return "2.8.13-
|
|
2165
|
+
return "2.8.13-dev.0b2c361e.0";
|
|
2166
2166
|
}
|
|
2167
2167
|
static get debug() {
|
|
2168
2168
|
return e._params.debug;
|
|
@@ -2408,6 +2408,9 @@ var vn = _n.getInstance(), N = class e {
|
|
|
2408
2408
|
static get transportConnectionWaitTime() {
|
|
2409
2409
|
return e._params.transportConnectionWaitTime;
|
|
2410
2410
|
}
|
|
2411
|
+
static get switchTopologyOnReconnectFromAnySide() {
|
|
2412
|
+
return e._params.switchTopologyOnReconnectFromAnySide;
|
|
2413
|
+
}
|
|
2411
2414
|
static get statisticsInterval() {
|
|
2412
2415
|
return e._params.statisticsInterval;
|
|
2413
2416
|
}
|
|
@@ -2657,6 +2660,7 @@ h(N, "_params", {
|
|
|
2657
2660
|
vmojiOptions: null,
|
|
2658
2661
|
iceRestartWaitTime: 2e4,
|
|
2659
2662
|
transportConnectionWaitTime: 5e3,
|
|
2663
|
+
switchTopologyOnReconnectFromAnySide: !1,
|
|
2660
2664
|
statisticsInterval: 5e3,
|
|
2661
2665
|
networkStatisticsInterval: 2e4,
|
|
2662
2666
|
perfStatReportEnabled: !0,
|
|
@@ -3604,7 +3608,7 @@ var Ln = 0, Rn = 1, zn = 2, Bn = 3, Vn = 4, Hn = 5, Un = 6, Wn = 7, Gn = 0, Kn =
|
|
|
3604
3608
|
};
|
|
3605
3609
|
}
|
|
3606
3610
|
}, U = /* @__PURE__ */ function(e) {
|
|
3607
|
-
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3611
|
+
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3608
3612
|
}(U || {}), $n = 1e3;
|
|
3609
3613
|
function W(e, t, n = 0) {
|
|
3610
3614
|
return t in e && e[t] ? e[t] : n;
|
|
@@ -4277,8 +4281,8 @@ var Mr = class {
|
|
|
4277
4281
|
this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch() : this._startIceRestart();
|
|
4278
4282
|
}, N.transportConnectionWaitTime));
|
|
4279
4283
|
}
|
|
4280
|
-
_requestTopologySwitch() {
|
|
4281
|
-
this._isMaster && this._signaling.ready && (this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId }), this._signaling.switchTopology(J.SERVER).catch((e) => {
|
|
4284
|
+
_requestTopologySwitch(e = !1) {
|
|
4285
|
+
(this._isMaster || e) && this._signaling.ready && (this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId }), this._signaling.switchTopology(J.SERVER).catch((e) => {
|
|
4282
4286
|
e instanceof Cn || this._debug.warn("Unable to switch topology DIRECT to SERVER", e);
|
|
4283
4287
|
}));
|
|
4284
4288
|
}
|
|
@@ -4287,7 +4291,7 @@ var Mr = class {
|
|
|
4287
4291
|
}
|
|
4288
4292
|
_startIceRestart() {
|
|
4289
4293
|
this._isMaster ? (this._logger?.log(C.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
|
|
4290
|
-
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch();
|
|
4294
|
+
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch(N.switchTopologyOnReconnectFromAnySide);
|
|
4291
4295
|
}, N.iceRestartWaitTime);
|
|
4292
4296
|
}
|
|
4293
4297
|
async _createOffer(t) {
|
|
@@ -7071,31 +7075,31 @@ var ba = ya, xa = {
|
|
|
7071
7075
|
_stopDoctor() {
|
|
7072
7076
|
window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
|
|
7073
7077
|
}
|
|
7074
|
-
}, Pa = "open", Fa =
|
|
7078
|
+
}, Pa = "open", Fa = 300, Ia = 10, La = {
|
|
7075
7079
|
CONVERSATION_ENDED: "conversation-ended",
|
|
7076
7080
|
OBSOLETE_CLIENT: "gen.obsoleteClient",
|
|
7077
7081
|
INVALID_TOKEN: "invalid-token",
|
|
7078
7082
|
PARTICIPANT_NOT_FOUND: "participant-not-found",
|
|
7079
7083
|
ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
|
|
7080
7084
|
SERVICE_UNAVAILABLE: "service-unavailable"
|
|
7081
|
-
},
|
|
7082
|
-
[
|
|
7083
|
-
[
|
|
7084
|
-
[
|
|
7085
|
-
[
|
|
7086
|
-
[
|
|
7087
|
-
[
|
|
7085
|
+
}, Ra = {
|
|
7086
|
+
[La.CONVERSATION_ENDED]: "conversation-ended",
|
|
7087
|
+
[La.OBSOLETE_CLIENT]: "obsolete-client",
|
|
7088
|
+
[La.INVALID_TOKEN]: "invalid-token",
|
|
7089
|
+
[La.PARTICIPANT_NOT_FOUND]: "participant-not-found",
|
|
7090
|
+
[La.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
|
|
7091
|
+
[La.SERVICE_UNAVAILABLE]: "service-unavailable"
|
|
7088
7092
|
};
|
|
7089
|
-
function
|
|
7093
|
+
function za(e, t) {
|
|
7090
7094
|
return e.errorMessage ?? e.message ?? e.error ?? t;
|
|
7091
7095
|
}
|
|
7092
|
-
var
|
|
7096
|
+
var Ba = new Set([
|
|
7093
7097
|
O.CALLER_IS_BLOCKED,
|
|
7094
7098
|
O.ENDED,
|
|
7095
7099
|
O.NOT_FOUND,
|
|
7096
7100
|
O.PARTICIPANT_LIMIT_REACHED,
|
|
7097
7101
|
O.SERVICE_UNAVAILABLE
|
|
7098
|
-
]),
|
|
7102
|
+
]), Va = class e extends Tn {
|
|
7099
7103
|
static get WAIT_CONNECTION_DELAY() {
|
|
7100
7104
|
return N.waitConnectionDelay;
|
|
7101
7105
|
}
|
|
@@ -7106,7 +7110,7 @@ var za = new Set([
|
|
|
7106
7110
|
return !this.disposed && this.transport.readyState !== null;
|
|
7107
7111
|
}
|
|
7108
7112
|
constructor(e = z, t = null, n = null, r = null, i = null) {
|
|
7109
|
-
super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new Qn(e), this.transport = new Na(e, {
|
|
7113
|
+
super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new Qn(e), this.transport = new Na(e, {
|
|
7110
7114
|
onConnecting: this._onTransportConnecting.bind(this),
|
|
7111
7115
|
onOpen: this._onOpen.bind(this),
|
|
7112
7116
|
onMessage: this._onMessage.bind(this),
|
|
@@ -7193,13 +7197,13 @@ var za = new Set([
|
|
|
7193
7197
|
return this._send(V.TRANSMIT_DATA, {
|
|
7194
7198
|
participantId: e,
|
|
7195
7199
|
data: r
|
|
7196
|
-
}, !0,
|
|
7200
|
+
}, !0, Ia);
|
|
7197
7201
|
}
|
|
7198
7202
|
async acceptCall(e) {
|
|
7199
7203
|
return this._send(V.ACCEPT_CALL, { mediaSettings: e });
|
|
7200
7204
|
}
|
|
7201
7205
|
async changeMediaSettings(e) {
|
|
7202
|
-
return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0,
|
|
7206
|
+
return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Ia);
|
|
7203
7207
|
}
|
|
7204
7208
|
async changeParticipantState(e, t) {
|
|
7205
7209
|
let n = { participantState: { state: e } };
|
|
@@ -7488,7 +7492,7 @@ var za = new Set([
|
|
|
7488
7492
|
_handleMessage(e) {
|
|
7489
7493
|
switch (e.type) {
|
|
7490
7494
|
case "notification":
|
|
7491
|
-
this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.resetReconnectCount(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(br.RESTART), this._triggerEvent(vr.RECONNECT, e), e.conversation.topology && this._triggerEvent(vr.NOTIFICATION, {
|
|
7495
|
+
this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.resetReconnectCount(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._logTransportStat(br.RESTART, { value: 0 }), this._triggerEvent(vr.RECONNECT, e), e.conversation.topology && this._triggerEvent(vr.NOTIFICATION, {
|
|
7492
7496
|
type: "notification",
|
|
7493
7497
|
notification: K.TOPOLOGY_CHANGED,
|
|
7494
7498
|
topology: e.conversation.topology
|
|
@@ -7508,9 +7512,9 @@ var za = new Set([
|
|
|
7508
7512
|
}
|
|
7509
7513
|
_handleErrorMessage(e) {
|
|
7510
7514
|
this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
|
|
7511
|
-
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r =
|
|
7515
|
+
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = za(e, "Unknown signaling error");
|
|
7512
7516
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
7513
|
-
case
|
|
7517
|
+
case La.SERVICE_UNAVAILABLE:
|
|
7514
7518
|
let i = new k(O.SERVICE_UNAVAILABLE, {
|
|
7515
7519
|
callError: n,
|
|
7516
7520
|
message: r,
|
|
@@ -7522,7 +7526,7 @@ var za = new Set([
|
|
|
7522
7526
|
reason: O.SERVICE_UNAVAILABLE
|
|
7523
7527
|
});
|
|
7524
7528
|
break;
|
|
7525
|
-
case
|
|
7529
|
+
case La.CONVERSATION_ENDED:
|
|
7526
7530
|
this.conversationReject ? this.conversationReject(new k(e.reason || x.SIGNALING_FAILED, {
|
|
7527
7531
|
callError: n,
|
|
7528
7532
|
message: r,
|
|
@@ -7533,22 +7537,22 @@ var za = new Set([
|
|
|
7533
7537
|
reason: e.reason
|
|
7534
7538
|
});
|
|
7535
7539
|
break;
|
|
7536
|
-
case
|
|
7537
|
-
case
|
|
7540
|
+
case La.ILLEGAL_PARTICIPANT_STATE:
|
|
7541
|
+
case La.PARTICIPANT_NOT_FOUND:
|
|
7538
7542
|
this._throwError(new k(x.SIGNALING_FAILED, {
|
|
7539
7543
|
callError: n,
|
|
7540
7544
|
message: r,
|
|
7541
7545
|
remote: !0
|
|
7542
7546
|
}));
|
|
7543
7547
|
break;
|
|
7544
|
-
case
|
|
7548
|
+
case La.OBSOLETE_CLIENT:
|
|
7545
7549
|
this.conversationReject?.(new k(e.reason || O.OBSOLETE_CLIENT, {
|
|
7546
7550
|
callError: n,
|
|
7547
7551
|
message: r,
|
|
7548
7552
|
remote: !0
|
|
7549
7553
|
}));
|
|
7550
7554
|
break;
|
|
7551
|
-
case
|
|
7555
|
+
case La.INVALID_TOKEN:
|
|
7552
7556
|
default:
|
|
7553
7557
|
if (e.sequence || t === yr.WEBTRANSPORT) break;
|
|
7554
7558
|
if (this.connected) this._throwError(new k(e.reason || x.SIGNALING_FAILED, {
|
|
@@ -7583,20 +7587,15 @@ var za = new Set([
|
|
|
7583
7587
|
this._triggerEvent(vr.FAILED, e);
|
|
7584
7588
|
}
|
|
7585
7589
|
_onError(e) {
|
|
7586
|
-
this._logger?.log(C.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(br.FAILED_EXCEPTIONS, {
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
let t = e, n = t.error instanceof Error ? t.error : null;
|
|
7590
|
-
return JSON.stringify({
|
|
7591
|
-
eventType: e.type,
|
|
7592
|
-
socketType: this._getSocketType(),
|
|
7593
|
-
readyState: this.transport.readyState,
|
|
7594
|
-
errorName: n?.name || t.errorInfo?.name,
|
|
7595
|
-
errorMessage: n?.message || t.errorInfo?.message || t.message,
|
|
7596
|
-
errorStack: n?.stack || t.errorInfo?.stack,
|
|
7597
|
-
errorInfo: t.errorInfo
|
|
7590
|
+
this._logger?.log(C.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(br.FAILED_EXCEPTIONS, {
|
|
7591
|
+
value: 0,
|
|
7592
|
+
string_value: this._describeErrorEvent(e)
|
|
7598
7593
|
});
|
|
7599
7594
|
}
|
|
7595
|
+
_describeErrorEvent(e) {
|
|
7596
|
+
let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
|
|
7597
|
+
return (i ? `${i}: ${r}` : r).slice(0, Fa);
|
|
7598
|
+
}
|
|
7600
7599
|
_onClose(e) {
|
|
7601
7600
|
this._logger?.log(C.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
|
|
7602
7601
|
code: e.code,
|
|
@@ -7650,7 +7649,7 @@ var za = new Set([
|
|
|
7650
7649
|
let r = this.responseHandlers[n.sequence];
|
|
7651
7650
|
window.clearTimeout(r.responseTimer);
|
|
7652
7651
|
let i = G.measureMark(r.statMarkName);
|
|
7653
|
-
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-error"), r.reject(Error(
|
|
7652
|
+
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-error"), r.reject(Error(za(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-timeout"), r.reject(Error(za(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
7654
7653
|
}
|
|
7655
7654
|
_handleCommandsQueue(e) {
|
|
7656
7655
|
for (; e.length > 0;) {
|
|
@@ -7753,7 +7752,7 @@ var za = new Set([
|
|
|
7753
7752
|
}));
|
|
7754
7753
|
break;
|
|
7755
7754
|
case Ma.NETWORK_ERROR:
|
|
7756
|
-
this._fail(new k(O.NETWORK_ERROR, { callError: {
|
|
7755
|
+
this._logReconnectTimeout(), this._fail(new k(O.NETWORK_ERROR, { callError: {
|
|
7757
7756
|
scope: "network",
|
|
7758
7757
|
source: e.source,
|
|
7759
7758
|
code: "reconnect-exhausted",
|
|
@@ -7766,13 +7765,16 @@ var za = new Set([
|
|
|
7766
7765
|
}
|
|
7767
7766
|
}
|
|
7768
7767
|
_onTransportReconnectScheduled(e) {
|
|
7769
|
-
this.connectionType = _r.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(C.SOCKET_ACTION, "reconnect");
|
|
7768
|
+
this.connectionType = _r.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(C.SOCKET_ACTION, "reconnect"), e.count === 1 && (this.reconnectStartedAt = performance.now());
|
|
7769
|
+
}
|
|
7770
|
+
_logReconnectTimeout() {
|
|
7771
|
+
this.reconnectStartedAt !== null && (this._logTransportStat(br.TIMEOUT, { value: Math.round(performance.now() - this.reconnectStartedAt) }), this.reconnectStartedAt = null);
|
|
7770
7772
|
}
|
|
7771
7773
|
_onTransportConnectionDead() {
|
|
7772
7774
|
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(br.FAILED_PINGS);
|
|
7773
7775
|
}
|
|
7774
7776
|
_attachNotificationCallError(e) {
|
|
7775
|
-
e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !
|
|
7777
|
+
e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !Ba.has(e.reason) && !e.errorCode || (e.callError = {
|
|
7776
7778
|
scope: "server",
|
|
7777
7779
|
source: this._getSocketType(),
|
|
7778
7780
|
code: e.errorCode || "protocol",
|
|
@@ -7780,7 +7782,7 @@ var za = new Set([
|
|
|
7780
7782
|
});
|
|
7781
7783
|
}
|
|
7782
7784
|
_createSignalingCallError(e, t, n) {
|
|
7783
|
-
let r =
|
|
7785
|
+
let r = Ra[e];
|
|
7784
7786
|
if (r) return {
|
|
7785
7787
|
scope: "server",
|
|
7786
7788
|
source: n,
|
|
@@ -7802,39 +7804,39 @@ var za = new Set([
|
|
|
7802
7804
|
...t
|
|
7803
7805
|
});
|
|
7804
7806
|
}
|
|
7805
|
-
},
|
|
7807
|
+
}, Ha = /* @__PURE__ */ function(e) {
|
|
7806
7808
|
return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
|
|
7807
|
-
}(Va || {}), Ha = /* @__PURE__ */ function(e) {
|
|
7808
|
-
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
7809
7809
|
}(Ha || {}), Ua = /* @__PURE__ */ function(e) {
|
|
7810
|
-
return e.
|
|
7810
|
+
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
7811
7811
|
}(Ua || {}), Wa = /* @__PURE__ */ function(e) {
|
|
7812
|
-
return e.
|
|
7812
|
+
return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
|
|
7813
7813
|
}(Wa || {}), Ga = /* @__PURE__ */ function(e) {
|
|
7814
|
+
return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
|
|
7815
|
+
}(Ga || {}), Ka = /* @__PURE__ */ function(e) {
|
|
7814
7816
|
return e.REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN", e.AUDIENCE_MODE = "AUDIENCE_MODE", e.WAITING_HALL = "WAITING_HALL", e.WAIT_FOR_ADMIN = "WAIT_FOR_ADMIN", e.ADMIN_IS_HERE = "ADMIN_IS_HERE", e.ASR = "ASR", e.FEEDBACK = "FEEDBACK", e.RECURRING = "RECURRING", e;
|
|
7815
|
-
}(
|
|
7816
|
-
function
|
|
7817
|
+
}(Ka || {});
|
|
7818
|
+
function qa(e, t) {
|
|
7817
7819
|
if (e.length !== t.length) return !1;
|
|
7818
7820
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7819
7821
|
return !0;
|
|
7820
7822
|
}
|
|
7821
|
-
function
|
|
7823
|
+
function Ja(e, t) {
|
|
7822
7824
|
let n = new Set(e);
|
|
7823
7825
|
for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
|
|
7824
7826
|
return Array.from(n);
|
|
7825
7827
|
}
|
|
7826
7828
|
//#endregion
|
|
7827
7829
|
//#region src/enums/MuteState.ts
|
|
7828
|
-
var
|
|
7830
|
+
var Ya = /* @__PURE__ */ function(e) {
|
|
7829
7831
|
return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
|
|
7830
|
-
}(
|
|
7832
|
+
}(Ya || {}), X = /* @__PURE__ */ function(e) {
|
|
7831
7833
|
return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
|
|
7832
|
-
}(X || {}),
|
|
7834
|
+
}(X || {}), Xa = /* @__PURE__ */ function(e) {
|
|
7833
7835
|
return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
|
|
7834
|
-
}(
|
|
7836
|
+
}(Xa || {}), Za = /* @__PURE__ */ function(e) {
|
|
7835
7837
|
return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
|
|
7836
|
-
}(
|
|
7837
|
-
function
|
|
7838
|
+
}(Za || {});
|
|
7839
|
+
function Qa(e) {
|
|
7838
7840
|
switch (e) {
|
|
7839
7841
|
case 1: return "no-available-tracks";
|
|
7840
7842
|
default: return "unknown-error";
|
|
@@ -7842,17 +7844,17 @@ function Za(e) {
|
|
|
7842
7844
|
}
|
|
7843
7845
|
//#endregion
|
|
7844
7846
|
//#region src/enums/UserRole.ts
|
|
7845
|
-
var
|
|
7847
|
+
var $a = /* @__PURE__ */ function(e) {
|
|
7846
7848
|
return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
|
|
7847
|
-
}(
|
|
7848
|
-
function
|
|
7849
|
+
}($a || {});
|
|
7850
|
+
function eo(e, t) {
|
|
7849
7851
|
if (e.length !== t.length) return !1;
|
|
7850
7852
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7851
7853
|
return !0;
|
|
7852
7854
|
}
|
|
7853
7855
|
//#endregion
|
|
7854
7856
|
//#region src/static/ParticipantConnectionStatusUtils.ts
|
|
7855
|
-
var
|
|
7857
|
+
var to;
|
|
7856
7858
|
(function(e) {
|
|
7857
7859
|
function t(e) {
|
|
7858
7860
|
let t = e?.transport ?? e?.lastEffective ?? P.WAITING, n = {
|
|
@@ -7904,8 +7906,8 @@ var eo;
|
|
|
7904
7906
|
shouldNotify: !0
|
|
7905
7907
|
});
|
|
7906
7908
|
}
|
|
7907
|
-
})(
|
|
7908
|
-
var
|
|
7909
|
+
})(to || (to = {}));
|
|
7910
|
+
var no = to, ro = /* @__PURE__ */ function(e) {
|
|
7909
7911
|
return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
|
|
7910
7912
|
}({}), Z;
|
|
7911
7913
|
(function(e) {
|
|
@@ -7968,7 +7970,7 @@ var to = eo, no = /* @__PURE__ */ function(e) {
|
|
|
7968
7970
|
})(Z || (Z = {}));
|
|
7969
7971
|
//#endregion
|
|
7970
7972
|
//#region src/types/WaitingHall.ts
|
|
7971
|
-
function
|
|
7973
|
+
function io(e) {
|
|
7972
7974
|
try {
|
|
7973
7975
|
return btoa(JSON.stringify(e));
|
|
7974
7976
|
} catch (t) {
|
|
@@ -7976,7 +7978,7 @@ function ro(e) {
|
|
|
7976
7978
|
}
|
|
7977
7979
|
return null;
|
|
7978
7980
|
}
|
|
7979
|
-
function
|
|
7981
|
+
function ao(e) {
|
|
7980
7982
|
try {
|
|
7981
7983
|
return JSON.parse(atob(e));
|
|
7982
7984
|
} catch (t) {
|
|
@@ -7986,12 +7988,12 @@ function io(e) {
|
|
|
7986
7988
|
}
|
|
7987
7989
|
//#endregion
|
|
7988
7990
|
//#region src/utils/Conversation.ts
|
|
7989
|
-
var
|
|
7990
|
-
function
|
|
7991
|
+
var oo = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
|
|
7992
|
+
function so(e) {
|
|
7991
7993
|
if (e.conversation?.muteStates) return e.conversation.muteStates;
|
|
7992
7994
|
if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
|
|
7993
7995
|
}
|
|
7994
|
-
function
|
|
7996
|
+
function co(e, t) {
|
|
7995
7997
|
switch (e) {
|
|
7996
7998
|
case S.AUDIO: return !!t.isAudioEnabled;
|
|
7997
7999
|
case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
|
|
@@ -8000,12 +8002,12 @@ function so(e, t) {
|
|
|
8000
8002
|
default: return !1;
|
|
8001
8003
|
}
|
|
8002
8004
|
}
|
|
8003
|
-
function
|
|
8005
|
+
function lo(e, t) {
|
|
8004
8006
|
return M.objectReduce(e, (e, n, r) => {
|
|
8005
8007
|
switch (n) {
|
|
8006
|
-
case
|
|
8007
|
-
case
|
|
8008
|
-
|
|
8008
|
+
case Ya.MUTE:
|
|
8009
|
+
case Ya.MUTE_PERMANENT:
|
|
8010
|
+
co(r, t) || (e[r] = n);
|
|
8009
8011
|
break;
|
|
8010
8012
|
default:
|
|
8011
8013
|
e[r] = n;
|
|
@@ -8014,19 +8016,19 @@ function co(e, t) {
|
|
|
8014
8016
|
return e;
|
|
8015
8017
|
}, {});
|
|
8016
8018
|
}
|
|
8017
|
-
function
|
|
8019
|
+
function uo(e) {
|
|
8018
8020
|
let { muteStates: t = {}, mediaSettings: n } = e;
|
|
8019
|
-
return
|
|
8021
|
+
return lo(t, n);
|
|
8020
8022
|
}
|
|
8021
|
-
function
|
|
8023
|
+
function fo(e, t) {
|
|
8022
8024
|
let n = e.conversation.participants.find((t) => M.comparePeerId(t.peerId, e.peerId));
|
|
8023
8025
|
if (!n) return t;
|
|
8024
8026
|
let { mediaSettings: r } = n;
|
|
8025
|
-
return
|
|
8027
|
+
return lo(t, r);
|
|
8026
8028
|
}
|
|
8027
8029
|
//#endregion
|
|
8028
8030
|
//#region src/utils/IceServers.ts
|
|
8029
|
-
function
|
|
8031
|
+
function po(e) {
|
|
8030
8032
|
if (!e) return null;
|
|
8031
8033
|
let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
|
|
8032
8034
|
return t.length ? {
|
|
@@ -8034,8 +8036,8 @@ function fo(e) {
|
|
|
8034
8036
|
urls: t
|
|
8035
8037
|
} : null;
|
|
8036
8038
|
}
|
|
8037
|
-
function
|
|
8038
|
-
let n = [], r =
|
|
8039
|
+
function mo(e, t) {
|
|
8040
|
+
let n = [], r = po(e), i = po(t);
|
|
8039
8041
|
if (r && n.push(r), i) {
|
|
8040
8042
|
let e = [...i.urls];
|
|
8041
8043
|
e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
|
|
@@ -8047,7 +8049,7 @@ function po(e, t) {
|
|
|
8047
8049
|
}
|
|
8048
8050
|
//#endregion
|
|
8049
8051
|
//#region src/utils/Lz4.ts
|
|
8050
|
-
function
|
|
8052
|
+
function ho(e, t) {
|
|
8051
8053
|
let n = new Uint8Array(t), r = 0, i = 0;
|
|
8052
8054
|
for (; r < e.length && i < t;) {
|
|
8053
8055
|
let a = e[r++], o = a >> 4, s = a & 15;
|
|
@@ -8074,7 +8076,7 @@ function mo(e, t) {
|
|
|
8074
8076
|
}
|
|
8075
8077
|
//#endregion
|
|
8076
8078
|
//#region src/utils/SerializeLatest.ts
|
|
8077
|
-
function
|
|
8079
|
+
function go(e) {
|
|
8078
8080
|
let t, n = !1, r, i = async () => {
|
|
8079
8081
|
let t = !1, i;
|
|
8080
8082
|
for (; n;) {
|
|
@@ -8095,7 +8097,7 @@ function ho(e) {
|
|
|
8095
8097
|
}
|
|
8096
8098
|
//#endregion
|
|
8097
8099
|
//#region src/classes/AudioFix.ts
|
|
8098
|
-
var
|
|
8100
|
+
var _o = class {
|
|
8099
8101
|
constructor(e, t = z, n = null) {
|
|
8100
8102
|
h(this, "_fixNoPacketsApplied", !1), h(this, "_fixNoPacketsChecked", !1), h(this, "_fixTooManyPacketsApplied", !1), h(this, "_fixTooManyPacketsSucceeded", !1), h(this, "_fixTooManyPacketsFailed", !1), h(this, "_fixTooManyPacketsTime", void 0), h(this, "_mediaSource", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_lastPacketsSent", void 0), h(this, "_lastPacketsSentTime", void 0), h(this, "_toggleAudioPromise", null), h(this, "_fixNoPacketsAppliedVideo", !1), this._mediaSource = e, this._debug = t, this._logger = n;
|
|
8101
8103
|
}
|
|
@@ -8133,7 +8135,7 @@ var go = class {
|
|
|
8133
8135
|
this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
|
|
8134
8136
|
}));
|
|
8135
8137
|
}
|
|
8136
|
-
},
|
|
8138
|
+
}, vo = class {
|
|
8137
8139
|
constructor(e, t = !1, n = z, r = null) {
|
|
8138
8140
|
h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
|
|
8139
8141
|
}
|
|
@@ -8234,13 +8236,13 @@ var go = class {
|
|
|
8234
8236
|
};
|
|
8235
8237
|
//#endregion
|
|
8236
8238
|
//#region src/classes/conversation/ConversationResponseValidator.ts
|
|
8237
|
-
function
|
|
8238
|
-
e ||
|
|
8239
|
+
function yo(e, t) {
|
|
8240
|
+
e || xo(t, "response-empty"), e.id || xo(t, "id-empty"), e.endpoint || xo(t, "endpoint-empty"), !bo(e.stun_server) && !bo(e.turn_server) && xo(t, "ice-servers-empty");
|
|
8239
8241
|
}
|
|
8240
|
-
function
|
|
8242
|
+
function bo(e) {
|
|
8241
8243
|
return Array.isArray(e?.urls) && e.urls.length > 0;
|
|
8242
8244
|
}
|
|
8243
|
-
function
|
|
8245
|
+
function xo(e, t) {
|
|
8244
8246
|
let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
|
|
8245
8247
|
throw new k(r ? e === "fastStart" ? O.FAST_START_ERROR : O.FAST_JOIN_ERROR : O.UNKNOWN_ERROR, {
|
|
8246
8248
|
message: `Invalid ${e} response: ${t}`,
|
|
@@ -8259,7 +8261,7 @@ function bo(e, t) {
|
|
|
8259
8261
|
}
|
|
8260
8262
|
//#endregion
|
|
8261
8263
|
//#region src/classes/DebugInfo.ts
|
|
8262
|
-
var
|
|
8264
|
+
var So = 90, Co = 3, wo = class extends b {
|
|
8263
8265
|
constructor(e = z) {
|
|
8264
8266
|
super(), h(this, "_lastMemoryStat", {
|
|
8265
8267
|
percent: 0,
|
|
@@ -8275,9 +8277,9 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8275
8277
|
let e = window?.performance?.memory;
|
|
8276
8278
|
if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
|
|
8277
8279
|
let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
|
|
8278
|
-
t >
|
|
8280
|
+
t > So ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Co) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
|
|
8279
8281
|
}
|
|
8280
|
-
},
|
|
8282
|
+
}, To = class {
|
|
8281
8283
|
constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
|
|
8282
8284
|
h(this, "_api", void 0), h(this, "_debug", void 0), h(this, "_getParticipants", void 0), h(this, "_isMe", void 0), h(this, "_updateDisplayLayout", void 0), h(this, "_onNonFatalError", void 0), h(this, "_requestedLayouts", {}), h(this, "_uncertainLayouts", {}), h(this, "_pendingRequests", null), h(this, "_pendingPromises", []), h(this, "_lastRequests", null), h(this, "_timer", null), h(this, "_inFlight", !1), h(this, "_lastFlushAt", null), h(this, "_generation", 0), h(this, "_forceNextFlush", !1), this._api = e, this._debug = t, this._getParticipants = n, this._isMe = r, this._updateDisplayLayout = i, this._onNonFatalError = a;
|
|
8283
8285
|
}
|
|
@@ -8392,7 +8394,7 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8392
8394
|
let n = e, r = t;
|
|
8393
8395
|
return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
|
|
8394
8396
|
}
|
|
8395
|
-
},
|
|
8397
|
+
}, Eo = 44100, Do = class {
|
|
8396
8398
|
constructor(e, t) {
|
|
8397
8399
|
h(this, "_analyser", null), h(this, "_gainNode", null), h(this, "_fftBins", null), h(this, "_mediaStreamSource", null), h(this, "_lastSmoothedLevel", 0), h(this, "_trackId", void 0), h(this, "_track", void 0), h(this, "_stream", void 0), this._trackId = e, this._track = t, this._stream = new MediaStream([t]);
|
|
8398
8400
|
try {
|
|
@@ -8409,7 +8411,7 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8409
8411
|
_getBins() {
|
|
8410
8412
|
if (!this._fftBins || !this._analyser) return new Uint8Array();
|
|
8411
8413
|
this._analyser.getByteFrequencyData(this._fftBins);
|
|
8412
|
-
let e =
|
|
8414
|
+
let e = Eo / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
|
|
8413
8415
|
return this._fftBins.subarray(t, n);
|
|
8414
8416
|
}
|
|
8415
8417
|
getLevel() {
|
|
@@ -8422,7 +8424,7 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8422
8424
|
destroy() {
|
|
8423
8425
|
this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track);
|
|
8424
8426
|
}
|
|
8425
|
-
},
|
|
8427
|
+
}, Oo = class extends b {
|
|
8426
8428
|
constructor(e) {
|
|
8427
8429
|
super(), h(this, "_detector", null), h(this, "_interval", null);
|
|
8428
8430
|
let t = () => {
|
|
@@ -8438,7 +8440,7 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8438
8440
|
}), this.subscribe(e, Kt.SOURCE_READY, n), n();
|
|
8439
8441
|
}
|
|
8440
8442
|
init(e) {
|
|
8441
|
-
this._stopDetector(), this._detector = new
|
|
8443
|
+
this._stopDetector(), this._detector = new Do("local", e.clone());
|
|
8442
8444
|
}
|
|
8443
8445
|
_stopDetector() {
|
|
8444
8446
|
this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
|
|
@@ -8446,7 +8448,7 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8446
8448
|
destroy() {
|
|
8447
8449
|
this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
|
|
8448
8450
|
}
|
|
8449
|
-
},
|
|
8451
|
+
}, ko = class {
|
|
8450
8452
|
constructor(e, t = z) {
|
|
8451
8453
|
h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
|
|
8452
8454
|
}
|
|
@@ -8466,9 +8468,9 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8466
8468
|
this.isProcessing = !1;
|
|
8467
8469
|
}
|
|
8468
8470
|
}
|
|
8469
|
-
},
|
|
8471
|
+
}, Ao = /* @__PURE__ */ function(e) {
|
|
8470
8472
|
return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
|
|
8471
|
-
}({}),
|
|
8473
|
+
}({}), jo = class extends b {
|
|
8472
8474
|
constructor(e) {
|
|
8473
8475
|
super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, Y.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8474
8476
|
}
|
|
@@ -8476,7 +8478,7 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8476
8478
|
this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
|
|
8477
8479
|
}
|
|
8478
8480
|
_onRemoteTrackAdded(e, t, n) {
|
|
8479
|
-
if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new
|
|
8481
|
+
if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new Do(e, n)), !this._interval)) {
|
|
8480
8482
|
let e = () => {
|
|
8481
8483
|
this._collectVolumes(), this._interval = window.setTimeout(e, N.voiceParams.interval);
|
|
8482
8484
|
};
|
|
@@ -8530,11 +8532,11 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8530
8532
|
e.destroy();
|
|
8531
8533
|
}), this._detectors.clear();
|
|
8532
8534
|
}
|
|
8533
|
-
},
|
|
8535
|
+
}, Mo = /* @__PURE__ */ function(e) {
|
|
8534
8536
|
return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
|
|
8535
|
-
}({}),
|
|
8537
|
+
}({}), No = class extends b {
|
|
8536
8538
|
constructor(e, t, n) {
|
|
8537
|
-
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e,
|
|
8539
|
+
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, Ao.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, Y.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8538
8540
|
}
|
|
8539
8541
|
destroy() {
|
|
8540
8542
|
this.unsubscribe();
|
|
@@ -8556,9 +8558,9 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8556
8558
|
_onTopologyChanged(e) {
|
|
8557
8559
|
this._serverSideSpeakerDetection = e === J.SERVER;
|
|
8558
8560
|
}
|
|
8559
|
-
},
|
|
8561
|
+
}, Po = 15e3, Fo = 15e3, Io = class extends b {
|
|
8560
8562
|
constructor(e, t, n, r = z, i = null) {
|
|
8561
|
-
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t,
|
|
8563
|
+
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, Ao.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
|
|
8562
8564
|
}
|
|
8563
8565
|
destroy() {
|
|
8564
8566
|
this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
|
|
@@ -8570,10 +8572,10 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8570
8572
|
this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
|
|
8571
8573
|
}
|
|
8572
8574
|
_getConnectionTimeout() {
|
|
8573
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8575
|
+
return this._transport.getTopology() === J.DIRECT ? Po : N.specListenerParams.connectionTimeout;
|
|
8574
8576
|
}
|
|
8575
8577
|
_getVolumeTimeout() {
|
|
8576
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8578
|
+
return this._transport.getTopology() === J.DIRECT ? Fo : N.specListenerParams.volumeTimeout;
|
|
8577
8579
|
}
|
|
8578
8580
|
_onTransportStateChanged(e, t) {
|
|
8579
8581
|
t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
|
|
@@ -8606,15 +8608,15 @@ var xo = 90, So = 3, Co = class extends b {
|
|
|
8606
8608
|
r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
|
|
8607
8609
|
}), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
|
|
8608
8610
|
}
|
|
8609
|
-
},
|
|
8611
|
+
}, Lo = /* @__PURE__ */ function(e) {
|
|
8610
8612
|
return e[e.PARAM_SESSION_EXPIRED = 102] = "PARAM_SESSION_EXPIRED", e[e.PARAM_SESSION_KEY = 103] = "PARAM_SESSION_KEY", e[e.PARAM_SIGNATURE = 104] = "PARAM_SIGNATURE", e[e.AUTH_LOGIN = 401] = "AUTH_LOGIN", e;
|
|
8611
|
-
}(
|
|
8612
|
-
function
|
|
8613
|
+
}(Lo || {});
|
|
8614
|
+
function Ro(e) {
|
|
8613
8615
|
return e === 102 || e === 103 || e === 104;
|
|
8614
8616
|
}
|
|
8615
8617
|
//#endregion
|
|
8616
8618
|
//#region src/classes/stat/StatQueue.ts
|
|
8617
|
-
var
|
|
8619
|
+
var zo, Bo = "ok-calls-sdk-stats", Vo = 1, Ho = "events", Uo = 100, Wo = 5e3, Go = 10080 * 60 * 1e3, Ko = 5e3, qo = 6e4, Q = class e {
|
|
8618
8620
|
static isSupported() {
|
|
8619
8621
|
return e._supported;
|
|
8620
8622
|
}
|
|
@@ -8627,7 +8629,7 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
|
|
|
8627
8629
|
n.onsuccess = () => e(n.result);
|
|
8628
8630
|
});
|
|
8629
8631
|
}).catch((e) => (z.error("[StatQueue] failed to append event", e), null));
|
|
8630
|
-
return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >=
|
|
8632
|
+
return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >= Uo && (e._appendsSinceEvictCheck = 0, await e.evictToLimit(Wo)), r);
|
|
8631
8633
|
}
|
|
8632
8634
|
static async fillDelta(t, n) {
|
|
8633
8635
|
if (t.length === 0) return;
|
|
@@ -8728,7 +8730,7 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
|
|
|
8728
8730
|
});
|
|
8729
8731
|
}
|
|
8730
8732
|
static async __resetForTests() {
|
|
8731
|
-
if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName ===
|
|
8733
|
+
if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === Bo && (e._dbName = `${Bo}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
|
|
8732
8734
|
let t = await e._open();
|
|
8733
8735
|
t && await e._runTransaction(t, "readwrite", (e) => {
|
|
8734
8736
|
e.clear();
|
|
@@ -8744,18 +8746,18 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
|
|
|
8744
8746
|
static _open() {
|
|
8745
8747
|
if (!e._checkSupport()) return e._supported = !1, Promise.resolve(null);
|
|
8746
8748
|
if (e._dbPromise) return e._dbPromise;
|
|
8747
|
-
if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt <
|
|
8749
|
+
if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < qo) return Promise.resolve(null);
|
|
8748
8750
|
let t = !1, n = new Promise((n) => {
|
|
8749
8751
|
let r = (r, i) => {
|
|
8750
8752
|
t || (t = !0, z.error(r, i), e._supported = !1, e._dbPromise = null, e._lastOpenFailureAt = Date.now(), n(null));
|
|
8751
8753
|
}, i;
|
|
8752
8754
|
try {
|
|
8753
|
-
i = window.indexedDB.open(e._dbName,
|
|
8755
|
+
i = window.indexedDB.open(e._dbName, Vo);
|
|
8754
8756
|
} catch (e) {
|
|
8755
8757
|
r("[StatQueue] storage is not accessible", e);
|
|
8756
8758
|
return;
|
|
8757
8759
|
}
|
|
8758
|
-
let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"),
|
|
8760
|
+
let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), Ko);
|
|
8759
8761
|
i.onupgradeneeded = () => {
|
|
8760
8762
|
e._createSchema(i.result);
|
|
8761
8763
|
}, i.onsuccess = () => {
|
|
@@ -8776,8 +8778,8 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
|
|
|
8776
8778
|
e._db && (e._db.close(), e._db = null), e._dbPromise = null;
|
|
8777
8779
|
}
|
|
8778
8780
|
static _createSchema(e) {
|
|
8779
|
-
if (e.objectStoreNames.contains(
|
|
8780
|
-
let t = e.createObjectStore(
|
|
8781
|
+
if (e.objectStoreNames.contains(Ho)) return;
|
|
8782
|
+
let t = e.createObjectStore(Ho, {
|
|
8781
8783
|
keyPath: "id",
|
|
8782
8784
|
autoIncrement: !0
|
|
8783
8785
|
});
|
|
@@ -8785,8 +8787,8 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
|
|
|
8785
8787
|
}
|
|
8786
8788
|
static _runTransaction(e, t, n) {
|
|
8787
8789
|
return new Promise((r, i) => {
|
|
8788
|
-
let a = e.transaction(
|
|
8789
|
-
a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(
|
|
8790
|
+
let a = e.transaction(Ho, t), o;
|
|
8791
|
+
a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(Ho))).then((e) => {
|
|
8790
8792
|
o = e;
|
|
8791
8793
|
}).catch((e) => {
|
|
8792
8794
|
try {
|
|
@@ -8811,18 +8813,18 @@ var Ro, zo = "ok-calls-sdk-stats", Bo = 1, Vo = "events", Ho = 100, Uo = 5e3, Wo
|
|
|
8811
8813
|
});
|
|
8812
8814
|
}
|
|
8813
8815
|
};
|
|
8814
|
-
|
|
8816
|
+
zo = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", Bo), h(Q, "_supported", zo._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
|
|
8815
8817
|
//#endregion
|
|
8816
8818
|
//#region src/static/ApiTransport.ts
|
|
8817
|
-
var
|
|
8818
|
-
function
|
|
8819
|
-
|
|
8819
|
+
var Jo = null, Yo = null, Xo = 64 * 1024;
|
|
8820
|
+
function Zo() {
|
|
8821
|
+
Jo = null, Yo = null;
|
|
8820
8822
|
}
|
|
8821
|
-
function
|
|
8823
|
+
function Qo(e) {
|
|
8822
8824
|
return e?.endsWith("/") ? e.slice(0, -1) : e;
|
|
8823
8825
|
}
|
|
8824
|
-
async function
|
|
8825
|
-
let n =
|
|
8826
|
+
async function $o(e = null, t) {
|
|
8827
|
+
let n = Qo(e ?? N.apiBaseUrl);
|
|
8826
8828
|
if (n) return n;
|
|
8827
8829
|
if ((t ?? N.apiEnv) !== "AUTO") return N.apiEndpoint(t);
|
|
8828
8830
|
try {
|
|
@@ -8837,25 +8839,25 @@ async function Qo(e = null, t) {
|
|
|
8837
8839
|
return z.warn("Failed to resolve API endpoint using DNS, default is used", e), N.apiEndpoint(t);
|
|
8838
8840
|
}
|
|
8839
8841
|
}
|
|
8840
|
-
async function
|
|
8841
|
-
return
|
|
8842
|
+
async function es() {
|
|
8843
|
+
return Jo || Yo || (Yo = $o(), Jo = await Yo, Yo = null, Jo);
|
|
8842
8844
|
}
|
|
8843
|
-
async function
|
|
8845
|
+
async function ts(e, t = {}, n = !1) {
|
|
8844
8846
|
if (!window.Blob || !window.navigator.sendBeacon) return;
|
|
8845
|
-
await
|
|
8846
|
-
let r =
|
|
8847
|
-
window.navigator.sendBeacon(`${
|
|
8847
|
+
await es();
|
|
8848
|
+
let r = ss(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
|
|
8849
|
+
window.navigator.sendBeacon(`${Jo}/fb.do`, i);
|
|
8848
8850
|
}
|
|
8849
|
-
async function
|
|
8850
|
-
return await
|
|
8851
|
+
async function ns(e, t = {}, n = !1, r) {
|
|
8852
|
+
return await es(), is(ss(e, t, n), r);
|
|
8851
8853
|
}
|
|
8852
|
-
async function
|
|
8853
|
-
await
|
|
8854
|
-
let r =
|
|
8855
|
-
return
|
|
8854
|
+
async function rs(e, t = {}, n = !1) {
|
|
8855
|
+
await es();
|
|
8856
|
+
let r = ss(e, t, n);
|
|
8857
|
+
return is(r, void 0, new Blob([r]).size <= Xo);
|
|
8856
8858
|
}
|
|
8857
|
-
async function
|
|
8858
|
-
let r = `${t ??
|
|
8859
|
+
async function is(e, t, n = !1) {
|
|
8860
|
+
let r = `${t ?? Jo}/fb.do`, i = new AbortController(), a = new k(x.NETWORK, { callError: {
|
|
8859
8861
|
scope: "network",
|
|
8860
8862
|
source: "api",
|
|
8861
8863
|
code: "timeout",
|
|
@@ -8874,16 +8876,16 @@ async function rs(e, t, n = !1) {
|
|
|
8874
8876
|
} catch {
|
|
8875
8877
|
o = { result: a };
|
|
8876
8878
|
}
|
|
8877
|
-
if (!t.ok && !
|
|
8879
|
+
if (!t.ok && !as(o)) throw new k(x.API, { callError: {
|
|
8878
8880
|
scope: "server",
|
|
8879
8881
|
source: "api",
|
|
8880
8882
|
code: `http-${t.status}`,
|
|
8881
8883
|
description: "http-error"
|
|
8882
8884
|
} });
|
|
8883
|
-
if (
|
|
8885
|
+
if (as(o)) throw o;
|
|
8884
8886
|
return o;
|
|
8885
8887
|
} catch (e) {
|
|
8886
|
-
throw e instanceof k ? e : i.signal.aborted ? a :
|
|
8888
|
+
throw e instanceof k ? e : i.signal.aborted ? a : as(e) ? e : new k(x.NETWORK, { callError: {
|
|
8887
8889
|
scope: "network",
|
|
8888
8890
|
source: "api",
|
|
8889
8891
|
code: "fetch-failed",
|
|
@@ -8893,12 +8895,12 @@ async function rs(e, t, n = !1) {
|
|
|
8893
8895
|
clearTimeout(o);
|
|
8894
8896
|
}
|
|
8895
8897
|
}
|
|
8896
|
-
function
|
|
8898
|
+
function as(e) {
|
|
8897
8899
|
if (typeof e != "object" || !e) return !1;
|
|
8898
8900
|
let t = e;
|
|
8899
8901
|
return typeof t.error_code == "number" && typeof t.error_msg == "string";
|
|
8900
8902
|
}
|
|
8901
|
-
async function
|
|
8903
|
+
async function os(e, t) {
|
|
8902
8904
|
try {
|
|
8903
8905
|
let n = await fetch(e, {
|
|
8904
8906
|
method: "POST",
|
|
@@ -8911,7 +8913,7 @@ async function as(e, t) {
|
|
|
8911
8913
|
throw z.warn("Failed to send form data", e), e;
|
|
8912
8914
|
}
|
|
8913
8915
|
}
|
|
8914
|
-
function
|
|
8916
|
+
function ss(e, t = {}, n = !1) {
|
|
8915
8917
|
t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (y.sessionKey ? t.session_key = y.sessionKey : y.accessToken && (t.access_token = y.accessToken));
|
|
8916
8918
|
for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
|
|
8917
8919
|
let r = "";
|
|
@@ -8920,7 +8922,7 @@ function os(e, t = {}, n = !1) {
|
|
|
8920
8922
|
}
|
|
8921
8923
|
//#endregion
|
|
8922
8924
|
//#region src/static/SessionStore.ts
|
|
8923
|
-
var
|
|
8925
|
+
var cs = "sessions", ls = 5, us = class e {
|
|
8924
8926
|
static remember(t, n) {
|
|
8925
8927
|
let r = e._read();
|
|
8926
8928
|
r[String(t)] = {
|
|
@@ -8928,7 +8930,7 @@ var ss = "sessions", cs = 5, ls = class e {
|
|
|
8928
8930
|
savedAt: Date.now()
|
|
8929
8931
|
};
|
|
8930
8932
|
let i = Object.keys(r);
|
|
8931
|
-
i.length >
|
|
8933
|
+
i.length > ls && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - ls).forEach((e) => delete r[e]), e._write(r);
|
|
8932
8934
|
}
|
|
8933
8935
|
static get(t) {
|
|
8934
8936
|
return e._read()[String(t)] ?? null;
|
|
@@ -8944,10 +8946,10 @@ var ss = "sessions", cs = 5, ls = class e {
|
|
|
8944
8946
|
}), r && e._write(n);
|
|
8945
8947
|
}
|
|
8946
8948
|
static currentEndpoint() {
|
|
8947
|
-
return String(
|
|
8949
|
+
return String(Qo(N.apiBaseUrl) || N.apiEndpoint());
|
|
8948
8950
|
}
|
|
8949
8951
|
static _read() {
|
|
8950
|
-
let t = w.get(
|
|
8952
|
+
let t = w.get(cs);
|
|
8951
8953
|
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
8952
8954
|
let n = {};
|
|
8953
8955
|
return Object.entries(t).forEach(([t, r]) => {
|
|
@@ -8956,16 +8958,16 @@ var ss = "sessions", cs = 5, ls = class e {
|
|
|
8956
8958
|
}
|
|
8957
8959
|
static _write(e) {
|
|
8958
8960
|
if (Object.keys(e).length === 0) {
|
|
8959
|
-
w.remove(
|
|
8961
|
+
w.remove(cs);
|
|
8960
8962
|
return;
|
|
8961
8963
|
}
|
|
8962
|
-
w.set(
|
|
8964
|
+
w.set(cs, e);
|
|
8963
8965
|
}
|
|
8964
8966
|
static _isValid(e) {
|
|
8965
8967
|
let t = e;
|
|
8966
8968
|
return typeof t == "object" && !!t && typeof t.sessionKey == "string" && t.sessionKey.length > 0 && typeof t.endpoint == "string" && typeof t.savedAt == "number";
|
|
8967
8969
|
}
|
|
8968
|
-
},
|
|
8970
|
+
}, ds = 15e3, fs = class e {
|
|
8969
8971
|
static setApi(t) {
|
|
8970
8972
|
e._api = t;
|
|
8971
8973
|
}
|
|
@@ -8976,7 +8978,7 @@ var ss = "sessions", cs = 5, ls = class e {
|
|
|
8976
8978
|
e._delta === null && e._api && e.get();
|
|
8977
8979
|
}
|
|
8978
8980
|
static get() {
|
|
8979
|
-
return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt <
|
|
8981
|
+
return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt < ds ? Promise.resolve(0) : (e._pending || (e._pending = e._measure().finally(() => {
|
|
8980
8982
|
e._pending = null;
|
|
8981
8983
|
})), e._pending) : Promise.resolve(e._delta);
|
|
8982
8984
|
}
|
|
@@ -9006,10 +9008,10 @@ var ss = "sessions", cs = 5, ls = class e {
|
|
|
9006
9008
|
return e._idsAwaitingDelta = [], await Q.fillDelta(n, t), t;
|
|
9007
9009
|
}
|
|
9008
9010
|
};
|
|
9009
|
-
h(
|
|
9011
|
+
h(fs, "_api", null), h(fs, "_delta", null), h(fs, "_pending", null), h(fs, "_idsAwaitingDelta", []), h(fs, "_lastFailureAt", null);
|
|
9010
9012
|
//#endregion
|
|
9011
9013
|
//#region src/classes/stat/StatUnloadJournal.ts
|
|
9012
|
-
var
|
|
9014
|
+
var ps = "okcls-stat-unload.", ms = class e {
|
|
9013
9015
|
static beginTabSession() {
|
|
9014
9016
|
e._tabKey = null, e._entries = [];
|
|
9015
9017
|
}
|
|
@@ -9017,7 +9019,7 @@ var fs = "okcls-stat-unload.", ps = class e {
|
|
|
9017
9019
|
let n = e._storage();
|
|
9018
9020
|
if (!n) return !1;
|
|
9019
9021
|
try {
|
|
9020
|
-
return e._tabKey || (e._tabKey =
|
|
9022
|
+
return e._tabKey || (e._tabKey = ps + M.uuid()), e._entries.length > 0 && n.getItem(e._tabKey) === null && (e._entries = []), e._entries.push(t), n.setItem(e._tabKey, JSON.stringify(e._entries)), !0;
|
|
9021
9023
|
} catch (e) {
|
|
9022
9024
|
return z.error("[StatUnloadJournal] failed to write", e), !1;
|
|
9023
9025
|
}
|
|
@@ -9029,7 +9031,7 @@ var fs = "okcls-stat-unload.", ps = class e {
|
|
|
9029
9031
|
try {
|
|
9030
9032
|
for (let e = 0; e < t.length; e += 1) {
|
|
9031
9033
|
let r = t.key(e);
|
|
9032
|
-
r && r.startsWith(
|
|
9034
|
+
r && r.startsWith(ps) && n.push(r);
|
|
9033
9035
|
}
|
|
9034
9036
|
} catch (e) {
|
|
9035
9037
|
return z.error("[StatUnloadJournal] failed to scan journals", e), 0;
|
|
@@ -9072,32 +9074,32 @@ var fs = "okcls-stat-unload.", ps = class e {
|
|
|
9072
9074
|
return typeof t == "object" && !!t && typeof t.uid == "number" && (t.vcid === null || typeof t.vcid == "string") && typeof t.ts == "number" && (t.delta === void 0 || t.delta === null || typeof t.delta == "number") && typeof t.ev == "object" && t.ev !== null;
|
|
9073
9075
|
}
|
|
9074
9076
|
};
|
|
9075
|
-
h(
|
|
9077
|
+
h(ms, "_tabKey", null), h(ms, "_entries", []);
|
|
9076
9078
|
//#endregion
|
|
9077
9079
|
//#region src/classes/stat/StatDrainScheduler.ts
|
|
9078
|
-
var
|
|
9080
|
+
var hs = 500, gs = 100, _s = 3e4, vs = 1e3, ys = 5e3, bs = 3e3, xs = "okcls-stat-drain", Ss = class e {
|
|
9079
9081
|
static setApi(t) {
|
|
9080
|
-
e._api = t,
|
|
9082
|
+
e._api = t, fs.setApi(t);
|
|
9081
9083
|
}
|
|
9082
9084
|
static start(t) {
|
|
9083
|
-
e.setApi(t),
|
|
9085
|
+
e.setApi(t), ms.drainToQueue().catch((e) => z.error("[StatDrainScheduler] failed to import unload journal", e)).then(async () => (us.prune(), await Q.evictOlderThan(Go), await Q.evictToLimit(Wo), e._drain())).catch((e) => z.error("[StatDrainScheduler] failed to start", e));
|
|
9084
9086
|
}
|
|
9085
9087
|
static notifyAppended() {
|
|
9086
9088
|
if (e._api) {
|
|
9087
|
-
if (e._localCount += 1, e._localCount >=
|
|
9089
|
+
if (e._localCount += 1, e._localCount >= gs) {
|
|
9088
9090
|
e._drain();
|
|
9089
9091
|
return;
|
|
9090
9092
|
}
|
|
9091
|
-
e._state === "IDLE" && e._arm(
|
|
9093
|
+
e._state === "IDLE" && e._arm(_s);
|
|
9092
9094
|
}
|
|
9093
9095
|
}
|
|
9094
9096
|
static notifyCallFinished() {
|
|
9095
9097
|
if (e._api) {
|
|
9096
|
-
if (e._directBuffer.length > 0 && e._armDirect(
|
|
9098
|
+
if (e._directBuffer.length > 0 && e._armDirect(vs), e._state === "DRAINING") {
|
|
9097
9099
|
e._callFinishedDuringDrain = !0;
|
|
9098
9100
|
return;
|
|
9099
9101
|
}
|
|
9100
|
-
e._arm(
|
|
9102
|
+
e._arm(vs);
|
|
9101
9103
|
}
|
|
9102
9104
|
}
|
|
9103
9105
|
static drainOnce() {
|
|
@@ -9106,7 +9108,7 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
|
|
|
9106
9108
|
if (!t) return !1;
|
|
9107
9109
|
let n = e._currentUserId(), r = await Q.listUids(), i = !1, a = null;
|
|
9108
9110
|
for (let o of r) try {
|
|
9109
|
-
(o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) ===
|
|
9111
|
+
(o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === hs && (i = !0);
|
|
9110
9112
|
} catch (e) {
|
|
9111
9113
|
a === null && (a = e);
|
|
9112
9114
|
}
|
|
@@ -9120,20 +9122,20 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
|
|
|
9120
9122
|
z.error("[StatDrainScheduler] direct send skipped: event belongs to another user");
|
|
9121
9123
|
return;
|
|
9122
9124
|
}
|
|
9123
|
-
e._directBuffer.push(t), e._directTimer === null && e._armDirect(
|
|
9125
|
+
e._directBuffer.push(t), e._directTimer === null && e._armDirect(bs);
|
|
9124
9126
|
}
|
|
9125
9127
|
}
|
|
9126
9128
|
static __resetForTests() {
|
|
9127
|
-
|
|
9129
|
+
fs.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
|
|
9128
9130
|
}
|
|
9129
9131
|
static _currentUserId() {
|
|
9130
9132
|
return y.userId;
|
|
9131
9133
|
}
|
|
9132
9134
|
static async _drainCurrent(t, n) {
|
|
9133
9135
|
if (e._isSessionBlocked()) return 0;
|
|
9134
|
-
let r = await Q.readOldest(n,
|
|
9136
|
+
let r = await Q.readOldest(n, hs);
|
|
9135
9137
|
if (r.length === 0) return 0;
|
|
9136
|
-
let i = await
|
|
9138
|
+
let i = await fs.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
|
|
9137
9139
|
try {
|
|
9138
9140
|
await t.logClientStats(a);
|
|
9139
9141
|
} catch (t) {
|
|
@@ -9144,25 +9146,25 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
|
|
|
9144
9146
|
return await Q.remove(o), r.length;
|
|
9145
9147
|
}
|
|
9146
9148
|
static async _drainStored(t, n) {
|
|
9147
|
-
let r =
|
|
9148
|
-
if (!r || r.endpoint !==
|
|
9149
|
-
let i = await Q.readOldest(n,
|
|
9149
|
+
let r = us.get(n);
|
|
9150
|
+
if (!r || r.endpoint !== us.currentEndpoint()) return 0;
|
|
9151
|
+
let i = await Q.readOldest(n, hs);
|
|
9150
9152
|
if (i.length === 0) return 0;
|
|
9151
|
-
let a = await
|
|
9153
|
+
let a = await fs.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
|
|
9152
9154
|
try {
|
|
9153
9155
|
await t.logClientStatsWith(r.sessionKey, o), z.debug("[StatDrainScheduler] delivered", i.length, "stored events of uid", n);
|
|
9154
9156
|
} catch (t) {
|
|
9155
|
-
if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n),
|
|
9157
|
+
if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), us.forget(n), 0;
|
|
9156
9158
|
if (e._isRetryable(t)) throw t;
|
|
9157
9159
|
return z.error("[StatDrainScheduler] batch rejected, dropping", t), await Q.remove(s), i.length;
|
|
9158
9160
|
}
|
|
9159
9161
|
return await Q.remove(s), i.length;
|
|
9160
9162
|
}
|
|
9161
9163
|
static _withLock(e) {
|
|
9162
|
-
return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(
|
|
9164
|
+
return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(xs, e);
|
|
9163
9165
|
}
|
|
9164
9166
|
static _isSessionError(e) {
|
|
9165
|
-
return
|
|
9167
|
+
return Ro(e?.error_code);
|
|
9166
9168
|
}
|
|
9167
9169
|
static _isReauthorizeFailure(e) {
|
|
9168
9170
|
return e?.error === x.AUTH;
|
|
@@ -9175,7 +9177,7 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
|
|
|
9175
9177
|
}
|
|
9176
9178
|
static _isAuthError(t) {
|
|
9177
9179
|
let n = t?.error_code;
|
|
9178
|
-
return e._isSessionError(t) || n ===
|
|
9180
|
+
return e._isSessionError(t) || n === Lo.AUTH_LOGIN;
|
|
9179
9181
|
}
|
|
9180
9182
|
static _isRetryable(t) {
|
|
9181
9183
|
if (e._isSessionError(t)) return !0;
|
|
@@ -9200,7 +9202,7 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
|
|
|
9200
9202
|
static async _flushDirect() {
|
|
9201
9203
|
let t = e._api, n = e._directBuffer;
|
|
9202
9204
|
if (e._directBuffer = [], !(!t || n.length === 0)) try {
|
|
9203
|
-
let r = await
|
|
9205
|
+
let r = await fs.get();
|
|
9204
9206
|
await t.logClientStats(n.map((t) => e._toClientStats(t, r)));
|
|
9205
9207
|
} catch (e) {
|
|
9206
9208
|
z.error("[StatDrainScheduler] direct send failed, events lost", e);
|
|
@@ -9219,28 +9221,28 @@ var ms = 500, hs = 100, gs = 3e4, _s = 1e3, vs = 5e3, ys = 3e3, bs = "okcls-stat
|
|
|
9219
9221
|
e._clearTimer(), e._state = "DRAINING", e._localCount = 0, e._callFinishedDuringDrain = !1;
|
|
9220
9222
|
try {
|
|
9221
9223
|
if (await e.drainOnce()) {
|
|
9222
|
-
e._arm(
|
|
9224
|
+
e._arm(ys);
|
|
9223
9225
|
return;
|
|
9224
9226
|
}
|
|
9225
9227
|
if (e._callFinishedDuringDrain) {
|
|
9226
|
-
e._arm(
|
|
9228
|
+
e._arm(vs);
|
|
9227
9229
|
return;
|
|
9228
9230
|
}
|
|
9229
9231
|
if (e._localCount > 0) {
|
|
9230
|
-
e._arm(
|
|
9232
|
+
e._arm(_s);
|
|
9231
9233
|
return;
|
|
9232
9234
|
}
|
|
9233
9235
|
e._state = "IDLE";
|
|
9234
9236
|
} catch (t) {
|
|
9235
|
-
z.error("[StatDrainScheduler] drain failed", t), e._arm(
|
|
9237
|
+
z.error("[StatDrainScheduler] drain failed", t), e._arm(_s);
|
|
9236
9238
|
}
|
|
9237
9239
|
}
|
|
9238
9240
|
}
|
|
9239
9241
|
};
|
|
9240
|
-
h(
|
|
9242
|
+
h(Ss, "_api", null), h(Ss, "_state", "IDLE"), h(Ss, "_timer", null), h(Ss, "_localCount", 0), h(Ss, "_callFinishedDuringDrain", !1), h(Ss, "_blockedSession", null), h(Ss, "_directBuffer", []), h(Ss, "_directTimer", null);
|
|
9241
9243
|
//#endregion
|
|
9242
9244
|
//#region src/classes/StatsLogger.ts
|
|
9243
|
-
var
|
|
9245
|
+
var Cs = class extends f {
|
|
9244
9246
|
constructor(e, t, n, r = () => void 0) {
|
|
9245
9247
|
super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), h(this, "_waitingForServerTime", !0), h(this, "_deferredClientStats", []), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._calculateServerTimeDelta();
|
|
9246
9248
|
}
|
|
@@ -9320,7 +9322,7 @@ var Ss = class extends f {
|
|
|
9320
9322
|
_now() {
|
|
9321
9323
|
return Date.now() - this._serverTimeDelta;
|
|
9322
9324
|
}
|
|
9323
|
-
},
|
|
9325
|
+
}, ws = class e extends f {
|
|
9324
9326
|
static __resetForTests() {
|
|
9325
9327
|
e._pending = [], e._pendingOverflow = !1;
|
|
9326
9328
|
}
|
|
@@ -9336,17 +9338,17 @@ var Ss = class extends f {
|
|
|
9336
9338
|
return e._pending = [], e._pendingOverflow = !1, t;
|
|
9337
9339
|
}
|
|
9338
9340
|
constructor(e, t, n, r = () => void 0) {
|
|
9339
|
-
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_unloadMode", !1), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new
|
|
9341
|
+
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_unloadMode", !1), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new Cs(e, t, n, r);
|
|
9340
9342
|
}
|
|
9341
9343
|
log(e, t, n = !1) {
|
|
9342
9344
|
this._externalLogger && this._externalLogger.log(e, t, n);
|
|
9343
9345
|
}
|
|
9344
9346
|
enterUnloadMode() {
|
|
9345
|
-
this._legacy || (this._unloadMode = !0,
|
|
9347
|
+
this._legacy || (this._unloadMode = !0, ms.beginTabSession());
|
|
9346
9348
|
}
|
|
9347
9349
|
exitUnloadMode() {
|
|
9348
|
-
this._legacy || !this._unloadMode || (this._unloadMode = !1,
|
|
9349
|
-
e > 0 &&
|
|
9350
|
+
this._legacy || !this._unloadMode || (this._unloadMode = !1, ms.drainToQueue().then((e) => {
|
|
9351
|
+
e > 0 && Ss.notifyAppended();
|
|
9350
9352
|
}).catch((e) => z.error("[StatEventCollector] failed to import unload journal", e)));
|
|
9351
9353
|
}
|
|
9352
9354
|
logClientStats(t, n = {}) {
|
|
@@ -9360,11 +9362,11 @@ var Ss = class extends f {
|
|
|
9360
9362
|
};
|
|
9361
9363
|
Object.keys(r).forEach((e) => {
|
|
9362
9364
|
r[e] === void 0 && delete r[e];
|
|
9363
|
-
}),
|
|
9365
|
+
}), fs.ensure();
|
|
9364
9366
|
let i = {
|
|
9365
9367
|
vcid: n.conversationId === void 0 ? this._getConversationId() : n.conversationId,
|
|
9366
9368
|
ts: n.occurredAt === void 0 ? Date.now() : n.occurredAt,
|
|
9367
|
-
delta:
|
|
9369
|
+
delta: fs.delta(),
|
|
9368
9370
|
ev: r
|
|
9369
9371
|
}, a = y.userId;
|
|
9370
9372
|
if (a === null) {
|
|
@@ -9387,12 +9389,12 @@ var Ss = class extends f {
|
|
|
9387
9389
|
}
|
|
9388
9390
|
}
|
|
9389
9391
|
_store(e) {
|
|
9390
|
-
this._unloadMode &&
|
|
9392
|
+
this._unloadMode && ms.writeSync(e) || Q.append(e).then((t) => {
|
|
9391
9393
|
if (t !== null) {
|
|
9392
|
-
typeof e.delta != "number" &&
|
|
9394
|
+
typeof e.delta != "number" && fs.noteAppended(t), Ss.notifyAppended();
|
|
9393
9395
|
return;
|
|
9394
9396
|
}
|
|
9395
|
-
z.error("[StatEventCollector] failed to store event, sending directly"),
|
|
9397
|
+
z.error("[StatEventCollector] failed to store event, sending directly"), Ss.sendDirect(e);
|
|
9396
9398
|
}).catch((e) => z.error("[StatEventCollector] failed to store event", e));
|
|
9397
9399
|
}
|
|
9398
9400
|
_getConversationId() {
|
|
@@ -9410,10 +9412,22 @@ var Ss = class extends f {
|
|
|
9410
9412
|
}
|
|
9411
9413
|
}
|
|
9412
9414
|
};
|
|
9413
|
-
h(
|
|
9415
|
+
h(ws, "_pending", []), h(ws, "_pendingOverflow", !1);
|
|
9414
9416
|
//#endregion
|
|
9415
|
-
//#region src/classes/stat/
|
|
9416
|
-
var
|
|
9417
|
+
//#region src/classes/stat/ApiCallStats.ts
|
|
9418
|
+
var Ts = class {
|
|
9419
|
+
constructor(e) {
|
|
9420
|
+
h(this, "_statAggregator", void 0), this._statAggregator = e;
|
|
9421
|
+
}
|
|
9422
|
+
log(e, t, n) {
|
|
9423
|
+
this._statAggregator?.logEventualStat({
|
|
9424
|
+
name: U.API_CALL,
|
|
9425
|
+
value: Math.round(t),
|
|
9426
|
+
api_method: e,
|
|
9427
|
+
string_value: n
|
|
9428
|
+
});
|
|
9429
|
+
}
|
|
9430
|
+
}, Es = "invalid-error-metadata", Ds = 64, Os = new Set(Object.values(O)), ks = new Set(Object.values(x)), As = {
|
|
9417
9431
|
[O.CANCELED]: {
|
|
9418
9432
|
type: "semantic",
|
|
9419
9433
|
reason: "canceled"
|
|
@@ -9534,7 +9548,7 @@ var ws = "invalid-error-metadata", Ts = 64, Es = new Set(Object.values(O)), Ds =
|
|
|
9534
9548
|
type: "semantic",
|
|
9535
9549
|
reason: "obsolete_client"
|
|
9536
9550
|
}
|
|
9537
|
-
},
|
|
9551
|
+
}, js = {
|
|
9538
9552
|
[x.MIC_CAMERA_PERMISSION]: {
|
|
9539
9553
|
type: "direct-error",
|
|
9540
9554
|
error: {
|
|
@@ -9623,14 +9637,14 @@ var ws = "invalid-error-metadata", Ts = 64, Es = new Set(Object.values(O)), Ds =
|
|
|
9623
9637
|
}
|
|
9624
9638
|
}
|
|
9625
9639
|
};
|
|
9626
|
-
function
|
|
9627
|
-
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return
|
|
9640
|
+
function Ms(e) {
|
|
9641
|
+
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Es;
|
|
9628
9642
|
let t = String(e).trim();
|
|
9629
|
-
if (!t) return
|
|
9643
|
+
if (!t) return Es;
|
|
9630
9644
|
let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
9631
|
-
return !n || !/^[a-z0-9.-]+$/.test(n) ?
|
|
9645
|
+
return !n || !/^[a-z0-9.-]+$/.test(n) ? Es : n.length > Ds ? `${n.slice(0, Ds - 3)}...` : n;
|
|
9632
9646
|
}
|
|
9633
|
-
function
|
|
9647
|
+
function Ns(e) {
|
|
9634
9648
|
if (!e || typeof e != "object") return !1;
|
|
9635
9649
|
let t = e;
|
|
9636
9650
|
switch (t.scope) {
|
|
@@ -9642,49 +9656,49 @@ function js(e) {
|
|
|
9642
9656
|
default: return !1;
|
|
9643
9657
|
}
|
|
9644
9658
|
}
|
|
9645
|
-
function
|
|
9646
|
-
let t =
|
|
9659
|
+
function Ps(e) {
|
|
9660
|
+
let t = Ms(e.description);
|
|
9647
9661
|
if (e.scope === "unknown") return `unknown:${t}`;
|
|
9648
|
-
let n =
|
|
9662
|
+
let n = Ms(e.code);
|
|
9649
9663
|
return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
|
|
9650
9664
|
}
|
|
9651
|
-
function
|
|
9665
|
+
function Fs(e, t) {
|
|
9652
9666
|
return t === null ? e.type === "direct-error" ? {
|
|
9653
9667
|
reason: "error",
|
|
9654
|
-
string_value:
|
|
9655
|
-
} : { reason: "failed" } :
|
|
9668
|
+
string_value: Ps(e.error)
|
|
9669
|
+
} : { reason: "failed" } : Ns(t) ? {
|
|
9656
9670
|
reason: "error",
|
|
9657
|
-
string_value:
|
|
9671
|
+
string_value: Ps(t)
|
|
9658
9672
|
} : { reason: "failed" };
|
|
9659
9673
|
}
|
|
9660
|
-
function
|
|
9674
|
+
function Is(e) {
|
|
9661
9675
|
if (e.hangup) {
|
|
9662
|
-
let t =
|
|
9676
|
+
let t = As[e.hangup];
|
|
9663
9677
|
return t ? t.type === "semantic" ? e.hangup === O.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
|
|
9664
9678
|
reason: t.reason,
|
|
9665
9679
|
string_value: e.custom_error.vchat_detailed_api_error.code
|
|
9666
|
-
} : { reason: t.reason } :
|
|
9680
|
+
} : { reason: t.reason } : Fs(t, e.callError) : { reason: "failed" };
|
|
9667
9681
|
}
|
|
9668
9682
|
if (e.error) {
|
|
9669
|
-
let t =
|
|
9670
|
-
return t ?
|
|
9683
|
+
let t = js[e.error];
|
|
9684
|
+
return t ? Fs(t, e.callError) : { reason: "failed" };
|
|
9671
9685
|
}
|
|
9672
9686
|
return { reason: "failed" };
|
|
9673
9687
|
}
|
|
9674
|
-
function
|
|
9675
|
-
return e instanceof k ?
|
|
9688
|
+
function Ls(e) {
|
|
9689
|
+
return e instanceof k ? Is(e) : typeof e == "string" && (Os.has(e) || ks.has(e)) ? Is(new k(e)) : { reason: "failed" };
|
|
9676
9690
|
}
|
|
9677
9691
|
//#endregion
|
|
9678
9692
|
//#region src/classes/stat/CallLifecycleStats.ts
|
|
9679
|
-
var
|
|
9693
|
+
var Rs = {
|
|
9680
9694
|
wallNow: () => Date.now(),
|
|
9681
9695
|
monotonicNow: () => performance.now()
|
|
9682
9696
|
};
|
|
9683
|
-
function
|
|
9697
|
+
function zs(e) {
|
|
9684
9698
|
return e === "anonym_join" ? "join" : e;
|
|
9685
9699
|
}
|
|
9686
|
-
var
|
|
9687
|
-
constructor(e, t =
|
|
9700
|
+
var Bs = class {
|
|
9701
|
+
constructor(e, t = Rs) {
|
|
9688
9702
|
h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_conversationId", null), h(this, "_callStartLabel", null), h(this, "_lifecycleStartedAtMonotonic", 0), h(this, "_pendingEvents", []), h(this, "_callStarted", !1), h(this, "_accepted", !1), h(this, "_firstMediaSent", !1), h(this, "_finished", !1), h(this, "_destroyed", !1), this._logger = e, this._clock = t;
|
|
9689
9703
|
}
|
|
9690
9704
|
get firstMediaSentReported() {
|
|
@@ -9696,7 +9710,7 @@ var Rs = class {
|
|
|
9696
9710
|
markInitializationStarted({ source: e, conversationId: t }) {
|
|
9697
9711
|
if (this._destroyed || this._callStartLabel !== null) return;
|
|
9698
9712
|
let n = this._clock.wallNow();
|
|
9699
|
-
this._callStartLabel =
|
|
9713
|
+
this._callStartLabel = zs(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
|
|
9700
9714
|
name: U.CALL_INIT,
|
|
9701
9715
|
source: e
|
|
9702
9716
|
}, n);
|
|
@@ -9724,7 +9738,7 @@ var Rs = class {
|
|
|
9724
9738
|
!this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: U.FIRST_MEDIA_SENT }));
|
|
9725
9739
|
}
|
|
9726
9740
|
markFinished(e) {
|
|
9727
|
-
this._finish(
|
|
9741
|
+
this._finish(Ls(e));
|
|
9728
9742
|
}
|
|
9729
9743
|
markTerminated() {
|
|
9730
9744
|
this._finish({ reason: "terminated" });
|
|
@@ -9775,7 +9789,7 @@ var Rs = class {
|
|
|
9775
9789
|
...n && { immediately: !0 }
|
|
9776
9790
|
});
|
|
9777
9791
|
}
|
|
9778
|
-
},
|
|
9792
|
+
}, Vs = class {
|
|
9779
9793
|
constructor(e, t) {
|
|
9780
9794
|
h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
|
|
9781
9795
|
}
|
|
@@ -9838,7 +9852,7 @@ var Rs = class {
|
|
|
9838
9852
|
this.report(e);
|
|
9839
9853
|
}), this._codecUsages.clear();
|
|
9840
9854
|
}
|
|
9841
|
-
},
|
|
9855
|
+
}, Hs = class {
|
|
9842
9856
|
constructor(e) {
|
|
9843
9857
|
h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e;
|
|
9844
9858
|
}
|
|
@@ -9876,7 +9890,7 @@ var Rs = class {
|
|
|
9876
9890
|
...this._lastCallStatContext ?? {}
|
|
9877
9891
|
}, { occurredAt: t });
|
|
9878
9892
|
}
|
|
9879
|
-
},
|
|
9893
|
+
}, Us = class {
|
|
9880
9894
|
constructor(e) {
|
|
9881
9895
|
if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
|
|
9882
9896
|
1,
|
|
@@ -9935,7 +9949,7 @@ var Rs = class {
|
|
|
9935
9949
|
5
|
|
9936
9950
|
];
|
|
9937
9951
|
}
|
|
9938
|
-
},
|
|
9952
|
+
}, Ws = class {
|
|
9939
9953
|
constructor() {
|
|
9940
9954
|
h(this, "n", 0), h(this, "mean", 0);
|
|
9941
9955
|
}
|
|
@@ -9947,9 +9961,9 @@ var Rs = class {
|
|
|
9947
9961
|
get avg() {
|
|
9948
9962
|
return this.n ? this.mean : NaN;
|
|
9949
9963
|
}
|
|
9950
|
-
},
|
|
9964
|
+
}, Gs = class {
|
|
9951
9965
|
constructor() {
|
|
9952
|
-
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new
|
|
9966
|
+
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Ws()), h(this, "p50", new Us(.5)), h(this, "p95", new Us(.95));
|
|
9953
9967
|
}
|
|
9954
9968
|
add(e) {
|
|
9955
9969
|
e < this.minVal && (this.minVal = e), e > this.maxVal && (this.maxVal = e), this.mean.add(e), this.p50.add(e), this.p95.add(e), this.count++;
|
|
@@ -9967,11 +9981,11 @@ var Rs = class {
|
|
|
9967
9981
|
get hasData() {
|
|
9968
9982
|
return this.count > 0;
|
|
9969
9983
|
}
|
|
9970
|
-
},
|
|
9984
|
+
}, Ks = class {
|
|
9971
9985
|
constructor(e) {
|
|
9972
9986
|
h(this, "_logger", void 0), h(this, "trackerByTransport", {
|
|
9973
|
-
ws: new
|
|
9974
|
-
wt: new
|
|
9987
|
+
ws: new Gs(),
|
|
9988
|
+
wt: new Gs()
|
|
9975
9989
|
}), h(this, "lastSeen", {}), this._logger = e;
|
|
9976
9990
|
}
|
|
9977
9991
|
mark(e) {
|
|
@@ -10000,17 +10014,17 @@ var Rs = class {
|
|
|
10000
10014
|
}
|
|
10001
10015
|
destroy() {
|
|
10002
10016
|
this.trackerByTransport = {
|
|
10003
|
-
ws: new
|
|
10004
|
-
wt: new
|
|
10017
|
+
ws: new Gs(),
|
|
10018
|
+
wt: new Gs()
|
|
10005
10019
|
}, this.lastSeen = {};
|
|
10006
10020
|
}
|
|
10007
|
-
},
|
|
10021
|
+
}, qs = class {
|
|
10008
10022
|
constructor(e) {
|
|
10009
10023
|
h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
|
|
10010
10024
|
}
|
|
10011
10025
|
mark(e, t, n) {
|
|
10012
10026
|
let r = `${e}|${n}`, i;
|
|
10013
|
-
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new
|
|
10027
|
+
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new Gs(), this.trackerByCommand.set(r, i)), i.add(t);
|
|
10014
10028
|
}
|
|
10015
10029
|
logMetrics() {
|
|
10016
10030
|
for (let [e, t] of this.trackerByCommand.entries()) {
|
|
@@ -10032,9 +10046,9 @@ var Rs = class {
|
|
|
10032
10046
|
destroy() {
|
|
10033
10047
|
this.trackerByCommand.clear();
|
|
10034
10048
|
}
|
|
10035
|
-
},
|
|
10049
|
+
}, Js = class {
|
|
10036
10050
|
constructor(e, t, n, r) {
|
|
10037
|
-
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "_unloading", !1), this.logger = new
|
|
10051
|
+
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "_api", void 0), h(this, "_unloading", !1), this.logger = new ws(e, t, n, r), this.lifecycle = new Bs(this.logger), this.statAggregator = new Hs(this.logger), this.codecStatsAggregator = new Vs(this.logger, r), this.pings = new Ks(this.logger), this.signalingCommands = new qs(this.logger), this.apiCalls = new Ts(this.statAggregator), this._api = e, this._api.setApiCallStats(this.apiCalls);
|
|
10038
10052
|
}
|
|
10039
10053
|
prepareForUnload() {
|
|
10040
10054
|
N.statQueueEnabled && (this._unloading = !0, this.logger.enterUnloadMode(), this.pings.logMetrics(), this.signalingCommands.logMetrics());
|
|
@@ -10049,9 +10063,9 @@ var Rs = class {
|
|
|
10049
10063
|
this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy();
|
|
10050
10064
|
}
|
|
10051
10065
|
destroy() {
|
|
10052
|
-
this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading &&
|
|
10066
|
+
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading && Ss.notifyCallFinished();
|
|
10053
10067
|
}
|
|
10054
|
-
},
|
|
10068
|
+
}, Ys = class {
|
|
10055
10069
|
constructor(e) {
|
|
10056
10070
|
h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
|
|
10057
10071
|
}
|
|
@@ -10076,8 +10090,8 @@ var Rs = class {
|
|
|
10076
10090
|
call_type: this._callType
|
|
10077
10091
|
}));
|
|
10078
10092
|
}
|
|
10079
|
-
},
|
|
10080
|
-
function
|
|
10093
|
+
}, Xs = 1e3, Zs = 1e4;
|
|
10094
|
+
function Qs(e, t, n, r) {
|
|
10081
10095
|
return new k(e, {
|
|
10082
10096
|
callError: {
|
|
10083
10097
|
scope: "external",
|
|
@@ -10088,11 +10102,11 @@ function Xs(e, t, n, r) {
|
|
|
10088
10102
|
message: r
|
|
10089
10103
|
});
|
|
10090
10104
|
}
|
|
10091
|
-
var
|
|
10105
|
+
var $s = 15, $ = class e extends b {
|
|
10092
10106
|
constructor(e, t) {
|
|
10093
|
-
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", kr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo",
|
|
10107
|
+
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", kr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", go((e) => {
|
|
10094
10108
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
10095
|
-
})), h(this, "_toggleLocalAudio",
|
|
10109
|
+
})), h(this, "_toggleLocalAudio", go((e) => {
|
|
10096
10110
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
|
|
10097
10111
|
})), h(this, "_changeMediaSettings", M.debounce(async (e) => {
|
|
10098
10112
|
if (this._signaling.ready) try {
|
|
@@ -10104,7 +10118,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10104
10118
|
captureAudio: !1
|
|
10105
10119
|
});
|
|
10106
10120
|
}
|
|
10107
|
-
}, 100)), this._stats = new
|
|
10121
|
+
}, 100)), this._stats = new Js(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Va(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new ko(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new To({
|
|
10108
10122
|
api: this._api,
|
|
10109
10123
|
debug: this._debug,
|
|
10110
10124
|
getParticipants: () => this._participants,
|
|
@@ -10115,13 +10129,13 @@ var Zs = 15, $ = class e extends b {
|
|
|
10115
10129
|
this._stopFirstMediaSentProbe(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? O.CANCELED : O.HUNGUP), this._stats.prepareForUnload(), this._stats.destroy();
|
|
10116
10130
|
}, this._onRestore = () => {
|
|
10117
10131
|
this._stats.restoreAfterUnload();
|
|
10118
|
-
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), this._statFirstMediaReceived = new
|
|
10132
|
+
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), this._statFirstMediaReceived = new Ys(this._stats.statAggregator), this._audioOutput = new vo(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Xs));
|
|
10119
10133
|
}
|
|
10120
10134
|
static current() {
|
|
10121
10135
|
return B.getActive() ?? (N.hold ? null : B.getFirst());
|
|
10122
10136
|
}
|
|
10123
10137
|
static hangupAfterInit(e) {
|
|
10124
|
-
let t =
|
|
10138
|
+
let t = ec;
|
|
10125
10139
|
if (t) {
|
|
10126
10140
|
if (typeof e == "function" && (t._onFastHangup = e), t._delayedHangup === !1 && !t._conversation) {
|
|
10127
10141
|
t._delayedHangup = !0, t._abortController?.abort(new k(O.CANCELED));
|
|
@@ -10149,7 +10163,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10149
10163
|
return this._state === "HELD";
|
|
10150
10164
|
}
|
|
10151
10165
|
get isIncomingRinging() {
|
|
10152
|
-
return this._conversation?.direction ===
|
|
10166
|
+
return this._conversation?.direction === Ha.INCOMING && this._state === "IDLE";
|
|
10153
10167
|
}
|
|
10154
10168
|
static debugSessionId() {
|
|
10155
10169
|
return e.current()?.debugSessionId ?? null;
|
|
@@ -10175,7 +10189,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10175
10189
|
R.onNonFatalError(Error(e), this.id);
|
|
10176
10190
|
}
|
|
10177
10191
|
getIncomingCallerExternalId() {
|
|
10178
|
-
return this._conversation?.direction ===
|
|
10192
|
+
return this._conversation?.direction === Ha.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
|
|
10179
10193
|
}
|
|
10180
10194
|
_buildInternalParams() {
|
|
10181
10195
|
let e = {
|
|
@@ -10190,19 +10204,19 @@ var Zs = 15, $ = class e extends b {
|
|
|
10190
10204
|
return JSON.stringify(e);
|
|
10191
10205
|
}
|
|
10192
10206
|
async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
|
|
10193
|
-
let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t ===
|
|
10207
|
+
let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === Ua.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
|
|
10194
10208
|
this._stats.lifecycle.markInitializationStarted({
|
|
10195
10209
|
source: "outgoing",
|
|
10196
10210
|
conversationId: u
|
|
10197
|
-
}), this._debug.setConversationId(u),
|
|
10211
|
+
}), this._debug.setConversationId(u), ec = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10198
10212
|
try {
|
|
10199
10213
|
this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
|
|
10200
10214
|
let l = this._mediaSource.mediaSettings;
|
|
10201
|
-
t ===
|
|
10215
|
+
t === Ua.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l);
|
|
10202
10216
|
let d = await this._startConversation({
|
|
10203
10217
|
opponentIds: e,
|
|
10204
10218
|
opponentType: t,
|
|
10205
|
-
direction:
|
|
10219
|
+
direction: Ha.OUTGOING,
|
|
10206
10220
|
mediaOptions: n,
|
|
10207
10221
|
payload: r,
|
|
10208
10222
|
joiningAllowed: i,
|
|
@@ -10226,18 +10240,18 @@ var Zs = 15, $ = class e extends b {
|
|
|
10226
10240
|
let e = B.get(this._conversation.id);
|
|
10227
10241
|
e && e !== this && e._close(new k(O.HUNGUP, { remote: !0 }));
|
|
10228
10242
|
}
|
|
10229
|
-
return B.add(this), await B.setActive(this.id),
|
|
10243
|
+
return B.add(this), await B.setActive(this.id), ec = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
|
|
10230
10244
|
this._calleeUnavailableTimer = null, this._close(new k(O.CALLEE_UNAVAILABLE), { signalingReason: O.CANCELED });
|
|
10231
10245
|
}, f)), this._conversation;
|
|
10232
10246
|
} catch (e) {
|
|
10233
|
-
throw
|
|
10247
|
+
throw ec = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
|
|
10234
10248
|
}
|
|
10235
10249
|
}
|
|
10236
10250
|
async onJoin(e) {
|
|
10237
10251
|
this._stats.lifecycle.markInitializationStarted({
|
|
10238
10252
|
source: e.anonymous ? "anonym_join" : "join",
|
|
10239
10253
|
conversationId: e.conversationId
|
|
10240
|
-
}),
|
|
10254
|
+
}), ec = this, this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10241
10255
|
try {
|
|
10242
10256
|
let t = !!e.observedIds?.length;
|
|
10243
10257
|
if (t && N.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new k(O.UNSUPPORTED, { callError: {
|
|
@@ -10254,9 +10268,9 @@ var Zs = 15, $ = class e extends b {
|
|
|
10254
10268
|
code: "conversation",
|
|
10255
10269
|
description: "not-initialized-after-join"
|
|
10256
10270
|
} });
|
|
10257
|
-
return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this),
|
|
10271
|
+
return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this), ec = null, this._signaling.readyToSend(), R.onLocalStatus(this._conversation.waitForAdmin ? P.WAIT_FOR_ADMIN : P.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
|
|
10258
10272
|
} catch (e) {
|
|
10259
|
-
throw
|
|
10273
|
+
throw ec = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
10260
10274
|
}
|
|
10261
10275
|
}
|
|
10262
10276
|
async _onJoinPart2(e, t = !0, n = !1) {
|
|
@@ -10271,7 +10285,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10271
10285
|
if (this._delayedHangup) throw new k(O.CANCELED);
|
|
10272
10286
|
this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
10273
10287
|
let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
|
|
10274
|
-
R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (B.add(this), n ? await this._holdLocally() : await B.setActive(this.id),
|
|
10288
|
+
R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (B.add(this), n ? await this._holdLocally() : await B.setActive(this.id), ec = null);
|
|
10275
10289
|
let i = this._extractLocalParticipantFromConnection(e);
|
|
10276
10290
|
if (i) {
|
|
10277
10291
|
let e = M.mapParticipantState(i);
|
|
@@ -10279,7 +10293,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10279
10293
|
}
|
|
10280
10294
|
return t && this._openTransport(Object.values(this._participants), !1), this._conversation;
|
|
10281
10295
|
} catch (e) {
|
|
10282
|
-
throw
|
|
10296
|
+
throw ec = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
10283
10297
|
}
|
|
10284
10298
|
}
|
|
10285
10299
|
_extractExternalRooms(e) {
|
|
@@ -10299,7 +10313,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10299
10313
|
B.reserve(e), this._reservedId = e, a && this._api.setUserId(a), this._stats.lifecycle.markInitializationStarted({
|
|
10300
10314
|
source: "incoming",
|
|
10301
10315
|
conversationId: e
|
|
10302
|
-
}), this._debug.setConversationId(e),
|
|
10316
|
+
}), this._debug.setConversationId(e), ec = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10303
10317
|
try {
|
|
10304
10318
|
let a = await this._prepareConversation(e, t, n, r, i);
|
|
10305
10319
|
if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
@@ -10308,20 +10322,20 @@ var Zs = 15, $ = class e extends b {
|
|
|
10308
10322
|
description: "incoming-not-initialized"
|
|
10309
10323
|
} });
|
|
10310
10324
|
if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(C.PUSH, "rejected"), new k(O.REJECTED);
|
|
10311
|
-
if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), B.add(this),
|
|
10325
|
+
if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), B.add(this), ec = null, this._delayedHangup) throw new k(O.CANCELED);
|
|
10312
10326
|
} catch (e) {
|
|
10313
|
-
throw
|
|
10327
|
+
throw ec = null, this._cleanupRegistry(), this._close(e, {
|
|
10314
10328
|
errorText: "Unable to handle inbound call push",
|
|
10315
10329
|
signalingReason: e instanceof k && e.hangup === O.BUSY ? O.BUSY : void 0
|
|
10316
10330
|
}), e;
|
|
10317
10331
|
}
|
|
10318
10332
|
}
|
|
10319
10333
|
_isInWaitingHall(e) {
|
|
10320
|
-
return !e.conversation || !e.conversation.options.includes(
|
|
10334
|
+
return !e.conversation || !e.conversation.options.includes(Ka.WAITING_HALL) ? !1 : this._isRestricted(e);
|
|
10321
10335
|
}
|
|
10322
10336
|
_isWaitForAdmin(e) {
|
|
10323
10337
|
if (!e.conversation) return !1;
|
|
10324
|
-
let t = e.conversation.options.includes(
|
|
10338
|
+
let t = e.conversation.options.includes(Ka.WAIT_FOR_ADMIN), n = e.conversation.options.includes(Ka.ADMIN_IS_HERE);
|
|
10325
10339
|
return !t || t && n ? !1 : this._isRestricted(e);
|
|
10326
10340
|
}
|
|
10327
10341
|
_isRestricted(e) {
|
|
@@ -10329,7 +10343,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10329
10343
|
return t && t.restricted || !1;
|
|
10330
10344
|
}
|
|
10331
10345
|
_isAudienceMode(e) {
|
|
10332
|
-
return e.conversation?.options?.includes(
|
|
10346
|
+
return e.conversation?.options?.includes(Ka.AUDIENCE_MODE) || !1;
|
|
10333
10347
|
}
|
|
10334
10348
|
_isAudienceModeListener() {
|
|
10335
10349
|
return this._conversation?.audienceMode && this._conversation?.restricted;
|
|
@@ -10359,7 +10373,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10359
10373
|
let i = atob(n), a = new Uint8Array(i.length);
|
|
10360
10374
|
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
10361
10375
|
try {
|
|
10362
|
-
let e =
|
|
10376
|
+
let e = ho(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
|
|
10363
10377
|
return {
|
|
10364
10378
|
token: i,
|
|
10365
10379
|
endpoint: l,
|
|
@@ -10562,10 +10576,10 @@ var Zs = 15, $ = class e extends b {
|
|
|
10562
10576
|
let t = await this._api.getConversationParams(e);
|
|
10563
10577
|
this._debug.debug("Api.getConversationParams", t);
|
|
10564
10578
|
let { turn_server: n, stun_server: r } = t;
|
|
10565
|
-
return N.iceServers =
|
|
10579
|
+
return N.iceServers = mo(r, n), N.wssBase = t.endpoint, t.wt_endpoint && (N.wtsBase = t.wt_endpoint), N.wssToken = t.token, t.client_type && (N.clientType = t.client_type), t.external_user_type && (N.externalUserType = t.external_user_type), t;
|
|
10566
10580
|
}
|
|
10567
10581
|
_setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
|
|
10568
|
-
N.iceServers =
|
|
10582
|
+
N.iceServers = mo(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
|
|
10569
10583
|
}
|
|
10570
10584
|
_buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
|
|
10571
10585
|
let s = new URL(e), c = s.searchParams;
|
|
@@ -10597,10 +10611,10 @@ var Zs = 15, $ = class e extends b {
|
|
|
10597
10611
|
isVideo: f,
|
|
10598
10612
|
joiningAllowed: a,
|
|
10599
10613
|
requireAuthToJoin: o
|
|
10600
|
-
}, this._abortController?.signal), !e) throw
|
|
10614
|
+
}, this._abortController?.signal), !e) throw Qs(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
|
|
10601
10615
|
if (!e.internalCallerParams) {
|
|
10602
10616
|
let t = e.rejectedParticipants[0]?.status;
|
|
10603
|
-
throw
|
|
10617
|
+
throw Qs(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
10604
10618
|
}
|
|
10605
10619
|
} catch (e) {
|
|
10606
10620
|
throw this._delayedHangup && this._abortController?.signal.aborted ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_START_ERROR, { message: e.message }) : new k(O.FAST_START_ERROR, { message: String(e) });
|
|
@@ -10622,10 +10636,10 @@ var Zs = 15, $ = class e extends b {
|
|
|
10622
10636
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
10623
10637
|
}, this._debug.debug("FastStart", p), m = "fastStart";
|
|
10624
10638
|
} catch {
|
|
10625
|
-
throw
|
|
10639
|
+
throw Qs(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
10626
10640
|
}
|
|
10627
10641
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
|
|
10628
|
-
|
|
10642
|
+
yo(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
10629
10643
|
let ee = await this._connectSignaling(_r.START, p);
|
|
10630
10644
|
return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
10631
10645
|
}
|
|
@@ -10650,9 +10664,9 @@ var Zs = 15, $ = class e extends b {
|
|
|
10650
10664
|
joinLink: i,
|
|
10651
10665
|
isVideo: c,
|
|
10652
10666
|
internalParams: this._buildInternalParams()
|
|
10653
|
-
}, this._abortController?.signal), !e) throw
|
|
10654
|
-
if (!e.internalCallerParams) throw
|
|
10655
|
-
if (!e.conversationId) throw
|
|
10667
|
+
}, this._abortController?.signal), !e) throw Qs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
|
|
10668
|
+
if (!e.internalCallerParams) throw Qs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
10669
|
+
if (!e.conversationId) throw Qs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
10656
10670
|
} catch (e) {
|
|
10657
10671
|
throw this._delayedHangup && this._abortController?.signal.aborted ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_JOIN_ERROR, { message: e.message }) : new k(O.FAST_JOIN_ERROR, { message: String(e) });
|
|
10658
10672
|
}
|
|
@@ -10670,7 +10684,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10670
10684
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
10671
10685
|
}, this._debug.debug("FastJoin", l), u = "fastJoin";
|
|
10672
10686
|
} catch (e) {
|
|
10673
|
-
throw e instanceof k ? e :
|
|
10687
|
+
throw e instanceof k ? e : Qs(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
|
|
10674
10688
|
}
|
|
10675
10689
|
} else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
|
|
10676
10690
|
else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
|
|
@@ -10679,13 +10693,13 @@ var Zs = 15, $ = class e extends b {
|
|
|
10679
10693
|
code: "join",
|
|
10680
10694
|
description: "target-missing"
|
|
10681
10695
|
} });
|
|
10682
|
-
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id),
|
|
10696
|
+
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), yo(l, u), l.id) {
|
|
10683
10697
|
if (B.has(l.id)) throw new k(O.HAS_ACTIVE_CALL);
|
|
10684
10698
|
B.reserve(l.id), this._reservedId = l.id;
|
|
10685
10699
|
}
|
|
10686
10700
|
this._setConversationParams(l);
|
|
10687
10701
|
let d = await this._connectSignaling(_r.JOIN, l);
|
|
10688
|
-
return this._setConversation(l, d,
|
|
10702
|
+
return this._setConversation(l, d, Ha.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
10689
10703
|
}
|
|
10690
10704
|
async _prepareConversation(e, t = j.USER, n, r, i) {
|
|
10691
10705
|
G.setMark(U.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -10747,7 +10761,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10747
10761
|
}), l.wt_endpoint = c);
|
|
10748
10762
|
}
|
|
10749
10763
|
let u = await this._connectSignaling(_r.ACCEPT, l);
|
|
10750
|
-
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._setConversation(l, u,
|
|
10764
|
+
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._setConversation(l, u, Ha.INCOMING, t), u);
|
|
10751
10765
|
}
|
|
10752
10766
|
_createParticipant(e, t, n = !0) {
|
|
10753
10767
|
let r = Object.assign({
|
|
@@ -10774,7 +10788,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10774
10788
|
let e = this._getParticipantId(t ?? r.id);
|
|
10775
10789
|
e && (r.externalId = e);
|
|
10776
10790
|
}
|
|
10777
|
-
return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus =
|
|
10791
|
+
return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = no.create(r.connectionStatus), r;
|
|
10778
10792
|
}
|
|
10779
10793
|
_getParticipantId(e) {
|
|
10780
10794
|
let t = this._api.userId(e);
|
|
@@ -10853,7 +10867,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10853
10867
|
}
|
|
10854
10868
|
_createMediaSource() {
|
|
10855
10869
|
let e = new Jt(this._debug, this._stats.logger);
|
|
10856
|
-
return this.subscribe(e, Kt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new
|
|
10870
|
+
return this.subscribe(e, Kt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Kt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new _o(e, this._debug, this._stats.logger), e;
|
|
10857
10871
|
}
|
|
10858
10872
|
async _connectSignaling(e, t) {
|
|
10859
10873
|
this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, vr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, vr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, vr.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
@@ -10861,7 +10875,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10861
10875
|
return this._stats.statAggregator.logEventualStat({ name: U.SIGNALING_CONNECTED }), n;
|
|
10862
10876
|
}
|
|
10863
10877
|
async _processConnection(e) {
|
|
10864
|
-
await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(
|
|
10878
|
+
await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(Wa.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
10865
10879
|
}
|
|
10866
10880
|
_onConversationParticipantListChunk(e) {
|
|
10867
10881
|
let t = e.participants;
|
|
@@ -10930,7 +10944,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
10930
10944
|
_registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
|
|
10931
10945
|
if (!e) return;
|
|
10932
10946
|
let n = async () => {
|
|
10933
|
-
let n =
|
|
10947
|
+
let n = oo(e, Ya.MUTE), r = oo(e, Ya.MUTE_PERMANENT);
|
|
10934
10948
|
for (let i of [n, r]) i.length && await this._onMuteParticipant({
|
|
10935
10949
|
muteStates: e,
|
|
10936
10950
|
unmuteOptions: t,
|
|
@@ -10944,8 +10958,8 @@ var Zs = 15, $ = class e extends b {
|
|
|
10944
10958
|
if (!(!N.enableSessionStateUpdates || this._isMe(e))) return t;
|
|
10945
10959
|
}
|
|
10946
10960
|
_buildConnectionStatus(e, t, n, r = !1) {
|
|
10947
|
-
return
|
|
10948
|
-
transport: r ? P.ONHOLD :
|
|
10961
|
+
return no.create({
|
|
10962
|
+
transport: r ? P.ONHOLD : no.fromTransportState(n) ?? P.WAITING,
|
|
10949
10963
|
sessionState: this._remoteParticipantSessionState(e, t),
|
|
10950
10964
|
sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
|
|
10951
10965
|
});
|
|
@@ -10954,12 +10968,12 @@ var Zs = 15, $ = class e extends b {
|
|
|
10954
10968
|
return N.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
|
|
10955
10969
|
}
|
|
10956
10970
|
_setTransportStatus(e, t) {
|
|
10957
|
-
return
|
|
10971
|
+
return no.setTransport(e.connectionStatus, t);
|
|
10958
10972
|
}
|
|
10959
10973
|
_setSessionState(e, t) {
|
|
10960
|
-
let n =
|
|
10974
|
+
let n = no.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
10961
10975
|
this._emitParticipantTransition(e, n);
|
|
10962
|
-
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i =
|
|
10976
|
+
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = no.setSessionState(e.connectionStatus, t, r);
|
|
10963
10977
|
return this._emitParticipantTransition(e, i), i;
|
|
10964
10978
|
}
|
|
10965
10979
|
_emitParticipantTransition(e, t, n = null) {
|
|
@@ -11030,11 +11044,11 @@ var Zs = 15, $ = class e extends b {
|
|
|
11030
11044
|
this._onRoomSwitched(t, !0);
|
|
11031
11045
|
}
|
|
11032
11046
|
_processMuteStates(e, t = !1) {
|
|
11033
|
-
let n =
|
|
11047
|
+
let n = so(e);
|
|
11034
11048
|
this._setMuteStatesForRoomId(n, null);
|
|
11035
11049
|
for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
|
|
11036
11050
|
let r = this._getMuteStatesForCurrentRoom();
|
|
11037
|
-
t && (r =
|
|
11051
|
+
t && (r = fo(e, r));
|
|
11038
11052
|
let i = Object.keys(r), a = this._conversation?.roomId;
|
|
11039
11053
|
i.length && this._onMuteParticipant({
|
|
11040
11054
|
muteStates: r,
|
|
@@ -11054,15 +11068,15 @@ var Zs = 15, $ = class e extends b {
|
|
|
11054
11068
|
}
|
|
11055
11069
|
_allocateTransport() {
|
|
11056
11070
|
if (!this._conversation || !this._mediaSource) return;
|
|
11057
|
-
this._transport = new ua(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new
|
|
11058
|
-
let e = this._conversation.direction ===
|
|
11071
|
+
this._transport = new ua(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new wo(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
11072
|
+
let e = this._conversation.direction === Ha.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
11059
11073
|
for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
11060
11074
|
}
|
|
11061
11075
|
_createSpeakerDetector() {
|
|
11062
|
-
this._transport && this._conversation && (this._volumesDetector = new
|
|
11076
|
+
this._transport && this._conversation && (this._volumesDetector = new jo(this._transport), this.subscribe(this._volumesDetector, Ao.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new No(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, Mo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new Oo(this._mediaSource));
|
|
11063
11077
|
}
|
|
11064
11078
|
_createSpecListener() {
|
|
11065
|
-
this._transport && this._volumesDetector && (this._specListener = new
|
|
11079
|
+
this._transport && this._volumesDetector && (this._specListener = new Io(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
|
|
11066
11080
|
}
|
|
11067
11081
|
_logDevices() {
|
|
11068
11082
|
let e = E.getCameras().length, t = E.getMicrophones().length;
|
|
@@ -11161,7 +11175,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
11161
11175
|
_onRemoveParticipant(e) {
|
|
11162
11176
|
this._debug.debug(`Remove participant [${e}]`);
|
|
11163
11177
|
let t = [], n = this._participants;
|
|
11164
|
-
for (let r = 0; r <=
|
|
11178
|
+
for (let r = 0; r <= $s; r++) {
|
|
11165
11179
|
let i = n[M.compose(e, r)];
|
|
11166
11180
|
i && t.push(i);
|
|
11167
11181
|
}
|
|
@@ -11255,7 +11269,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
11255
11269
|
await this._signaling.hold(!1, n), this._restoreStateAfterHold();
|
|
11256
11270
|
let r = null;
|
|
11257
11271
|
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._participants), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
11258
|
-
let e = this._conversation?.direction ===
|
|
11272
|
+
let e = this._conversation?.direction === Ha.OUTGOING && !this._conversation.concurrent;
|
|
11259
11273
|
this._openTransport(r ?? Object.values(this._participants), e);
|
|
11260
11274
|
}
|
|
11261
11275
|
}
|
|
@@ -11378,13 +11392,13 @@ var Zs = 15, $ = class e extends b {
|
|
|
11378
11392
|
let n = Mn(e), a = i[n.participantId];
|
|
11379
11393
|
if (a) {
|
|
11380
11394
|
let e;
|
|
11381
|
-
typeof t == "number" ? e =
|
|
11395
|
+
typeof t == "number" ? e = Qa(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Za.UNKNOWN_ERROR), r.push({
|
|
11382
11396
|
externalId: a.externalId,
|
|
11383
11397
|
errorReason: e
|
|
11384
11398
|
});
|
|
11385
11399
|
}
|
|
11386
11400
|
}
|
|
11387
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
11401
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new tc("Could not allocate one or more participants", r);
|
|
11388
11402
|
}
|
|
11389
11403
|
async _cleanupCooldownQueue() {
|
|
11390
11404
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -11392,7 +11406,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
11392
11406
|
let n = t.next();
|
|
11393
11407
|
if (n.done) break;
|
|
11394
11408
|
let r = n.value;
|
|
11395
|
-
if (r[1] +
|
|
11409
|
+
if (r[1] + Zs > Date.now()) break;
|
|
11396
11410
|
let i = r[0];
|
|
11397
11411
|
await this._stopStreaming(i), e[i] = { stopStream: !0 };
|
|
11398
11412
|
} while (!0);
|
|
@@ -11596,10 +11610,10 @@ var Zs = 15, $ = class e extends b {
|
|
|
11596
11610
|
throw Error("transport is not initialized");
|
|
11597
11611
|
}
|
|
11598
11612
|
_isCallAdmin() {
|
|
11599
|
-
return this._conversation ? M.includesOneOf(this._conversation.roles, [
|
|
11613
|
+
return this._conversation ? M.includesOneOf(this._conversation.roles, [$a.ADMIN, $a.CREATOR]) : !1;
|
|
11600
11614
|
}
|
|
11601
11615
|
_checkAdminRole() {
|
|
11602
|
-
if (this._conversation && !M.includesOneOf(this._conversation.roles, [
|
|
11616
|
+
if (this._conversation && !M.includesOneOf(this._conversation.roles, [$a.ADMIN, $a.CREATOR])) throw Error("You don't have the required permission");
|
|
11603
11617
|
}
|
|
11604
11618
|
_isCalledState() {
|
|
11605
11619
|
return this._participantState === X.CALLED;
|
|
@@ -11637,21 +11651,21 @@ var Zs = 15, $ = class e extends b {
|
|
|
11637
11651
|
async changeOptions(e) {
|
|
11638
11652
|
if (this._signaling.ready && this._conversation) {
|
|
11639
11653
|
this._checkAdminRole(), await this._signaling.changeOptions(e);
|
|
11640
|
-
let t =
|
|
11654
|
+
let t = Ja(this._conversation.options, e);
|
|
11641
11655
|
this._onOptionsChanged(t);
|
|
11642
11656
|
}
|
|
11643
11657
|
}
|
|
11644
11658
|
async getWaitingHall(e, t, n) {
|
|
11645
11659
|
if (!this._signaling) return Promise.reject();
|
|
11646
11660
|
let r = null;
|
|
11647
|
-
if (e && (r =
|
|
11661
|
+
if (e && (r = ao(e), r)) {
|
|
11648
11662
|
let e = this._api.getDecorativeIdByInitialId(r.id);
|
|
11649
11663
|
r.id = e ?? r.id;
|
|
11650
11664
|
}
|
|
11651
11665
|
let i = await this._signaling.getWaitingHall(r, t, n);
|
|
11652
11666
|
if (i.error) return Promise.reject(i.message);
|
|
11653
11667
|
let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
|
|
11654
|
-
return a.length && i.hasMore && (s =
|
|
11668
|
+
return a.length && i.hasMore && (s = io(a[a.length - 1].id)), {
|
|
11655
11669
|
participants: o,
|
|
11656
11670
|
pageMarker: s,
|
|
11657
11671
|
totalCount: i.totalCount || 0
|
|
@@ -11685,7 +11699,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
11685
11699
|
}
|
|
11686
11700
|
async promoteParticipant(e, t) {
|
|
11687
11701
|
if (this._signaling && this._conversation) try {
|
|
11688
|
-
if (!M.includesOneOf(this._conversation.options, [
|
|
11702
|
+
if (!M.includesOneOf(this._conversation.options, [Ka.WAITING_HALL, Ka.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
|
|
11689
11703
|
if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
|
|
11690
11704
|
await this._signaling.promoteParticipant(e, t);
|
|
11691
11705
|
} catch (t) {
|
|
@@ -11857,7 +11871,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
11857
11871
|
let a = this._transport?.getState();
|
|
11858
11872
|
return n.participants.forEach((e) => {
|
|
11859
11873
|
let t = M.composeId(e), n = r[t];
|
|
11860
|
-
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n,
|
|
11874
|
+
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, no.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, D(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
|
|
11861
11875
|
}), this._participantListChunkToExternalChunk(n);
|
|
11862
11876
|
}
|
|
11863
11877
|
async _getInitialParticiapntListChunk() {
|
|
@@ -11871,7 +11885,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
11871
11885
|
_onLocalMediaStreamChanged(e) {
|
|
11872
11886
|
if (!this._conversation || !this._mediaSource) return;
|
|
11873
11887
|
let t = this._mediaSource.mediaSettings;
|
|
11874
|
-
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new
|
|
11888
|
+
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new _o(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
|
|
11875
11889
|
}
|
|
11876
11890
|
_onScreenSharingStatus(e) {
|
|
11877
11891
|
let t = this.mediaSettings;
|
|
@@ -12001,9 +12015,9 @@ var Zs = 15, $ = class e extends b {
|
|
|
12001
12015
|
for (let n of e.conversation.participants) {
|
|
12002
12016
|
let e = M.composeId(n), i = n.roles || [];
|
|
12003
12017
|
if (this._isMe(e)) {
|
|
12004
|
-
|
|
12018
|
+
eo(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
|
|
12005
12019
|
this._registerParticipantLocalMuteState({
|
|
12006
|
-
muteStates:
|
|
12020
|
+
muteStates: uo(n),
|
|
12007
12021
|
unmuteOptions: n.unmuteOptions
|
|
12008
12022
|
});
|
|
12009
12023
|
};
|
|
@@ -12021,7 +12035,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12021
12035
|
let t = D(n.mediaSettings);
|
|
12022
12036
|
Ut(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
12023
12037
|
let r = M.mapParticipantState(n), o = a.participantState;
|
|
12024
|
-
M.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r),
|
|
12038
|
+
M.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), eo(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? P.ONHOLD : P.CONNECTED));
|
|
12025
12039
|
}
|
|
12026
12040
|
}
|
|
12027
12041
|
let i = this._participants;
|
|
@@ -12046,7 +12060,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12046
12060
|
this._close(new k(O.MISSED), { errorText: "Call accepted on other device" });
|
|
12047
12061
|
return;
|
|
12048
12062
|
}
|
|
12049
|
-
this._conversation?.direction ===
|
|
12063
|
+
this._conversation?.direction === Ha.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
|
|
12050
12064
|
let r = this._getParticipant(t);
|
|
12051
12065
|
if (!r) {
|
|
12052
12066
|
let n = this._api.getDecorativeIdByInitialId(t);
|
|
@@ -12059,7 +12073,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12059
12073
|
let t = Z.fromSignaling(e.externalId, e.deviceIdx);
|
|
12060
12074
|
r.externalId = t, this._api.cacheExternalId(r.id, t);
|
|
12061
12075
|
}
|
|
12062
|
-
r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction ===
|
|
12076
|
+
r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Ha.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
|
|
12063
12077
|
let i = Object.keys(r.muteStates);
|
|
12064
12078
|
if (i.length && this._onMuteParticipant({
|
|
12065
12079
|
muteStates: r.muteStates,
|
|
@@ -12108,7 +12122,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12108
12122
|
return;
|
|
12109
12123
|
}
|
|
12110
12124
|
if (e.connected) {
|
|
12111
|
-
let e =
|
|
12125
|
+
let e = no.fromTransportState(this._transport?.getState());
|
|
12112
12126
|
e && this._setTransportStatus(n, e);
|
|
12113
12127
|
}
|
|
12114
12128
|
this._setSessionState(n, { connected: e.connected });
|
|
@@ -12185,7 +12199,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12185
12199
|
isOnHold: !!r.onHold
|
|
12186
12200
|
}, i), n = this._getParticipant(t);
|
|
12187
12201
|
}
|
|
12188
|
-
this._conversation && this._conversation.direction ===
|
|
12202
|
+
this._conversation && this._conversation.direction === Ha.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = D(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], P.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), R.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
|
|
12189
12203
|
let i = Object.keys(n.muteStates);
|
|
12190
12204
|
i.length && this._onMuteParticipant({
|
|
12191
12205
|
muteStates: n.muteStates,
|
|
@@ -12376,15 +12390,15 @@ var Zs = 15, $ = class e extends b {
|
|
|
12376
12390
|
R.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
|
|
12377
12391
|
}
|
|
12378
12392
|
async _onRolesChanged(e, t) {
|
|
12379
|
-
if (this._conversation && this._isMe(e) &&
|
|
12393
|
+
if (this._conversation && this._isMe(e) && !eo(this._conversation.roles, t)) {
|
|
12380
12394
|
this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, R.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
|
|
12381
|
-
mediaOptions:
|
|
12395
|
+
mediaOptions: oo(this._getMuteStatesForCurrentRoom(), Ya.MUTE_PERMANENT),
|
|
12382
12396
|
stateUpdated: !0
|
|
12383
|
-
}), M.includesOneOf(t, [
|
|
12397
|
+
}), M.includesOneOf(t, [$a.ADMIN, $a.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
|
|
12384
12398
|
return;
|
|
12385
12399
|
}
|
|
12386
12400
|
let n = this._getParticipant(e);
|
|
12387
|
-
n &&
|
|
12401
|
+
n && !eo(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
|
|
12388
12402
|
}
|
|
12389
12403
|
async _onMuteParticipant(e, t = !1) {
|
|
12390
12404
|
if (!this._conversation) return;
|
|
@@ -12433,7 +12447,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12433
12447
|
let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
|
|
12434
12448
|
for (let [e, i] of d) {
|
|
12435
12449
|
let a = this._isCallAdmin() && n;
|
|
12436
|
-
if (!(i !==
|
|
12450
|
+
if (!(i !== Ya.MUTE && i !== Ya.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === Ya.MUTE_PERMANENT && !n && (l[e] = Ya.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
12437
12451
|
case S.VIDEO:
|
|
12438
12452
|
u.isVideoEnabled && (R.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
|
|
12439
12453
|
break;
|
|
@@ -12470,7 +12484,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12470
12484
|
this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
|
|
12471
12485
|
}
|
|
12472
12486
|
_onOptionsChanged(e) {
|
|
12473
|
-
this._conversation && !
|
|
12487
|
+
this._conversation && !qa(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(Ka.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(Ka.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
|
|
12474
12488
|
}
|
|
12475
12489
|
async _onNetworkStatus(e) {
|
|
12476
12490
|
if (this._conversation) {
|
|
@@ -12525,7 +12539,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12525
12539
|
}
|
|
12526
12540
|
_changeFeatureSet() {
|
|
12527
12541
|
if (this._conversation) {
|
|
12528
|
-
let e = this._state === "ACTIVE", t = this._conversation.features.includes(
|
|
12542
|
+
let e = this._state === "ACTIVE", t = this._conversation.features.includes(Ga.ADD_PARTICIPANT);
|
|
12529
12543
|
R.onCallState(e, t, this._conversation, this.id);
|
|
12530
12544
|
}
|
|
12531
12545
|
}
|
|
@@ -12559,7 +12573,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12559
12573
|
let n = this._getParticipant(e);
|
|
12560
12574
|
if (n) {
|
|
12561
12575
|
if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
|
|
12562
|
-
let e =
|
|
12576
|
+
let e = no.fromTransportState(this._transport?.getState());
|
|
12563
12577
|
e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
|
|
12564
12578
|
let t = this._setTransportStatus(n, n.connectionStatus.transport);
|
|
12565
12579
|
this._emitParticipantTransition(n, t);
|
|
@@ -12569,7 +12583,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12569
12583
|
}
|
|
12570
12584
|
async _onTransportStateChanged(e, t) {
|
|
12571
12585
|
this._debug.debug(`Transport state has changed: ${t}`, e);
|
|
12572
|
-
let n =
|
|
12586
|
+
let n = no.fromTransportState(t);
|
|
12573
12587
|
if (!n) return;
|
|
12574
12588
|
let r = this._participants, i = [], a = e.reduce((e, n) => {
|
|
12575
12589
|
if (n in r) {
|
|
@@ -12647,7 +12661,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12647
12661
|
if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
|
|
12648
12662
|
this._conversation.topology = e;
|
|
12649
12663
|
for (let e of Object.values(this._participants)) {
|
|
12650
|
-
let t =
|
|
12664
|
+
let t = no.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
12651
12665
|
this._emitParticipantTransition(e, t);
|
|
12652
12666
|
}
|
|
12653
12667
|
this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
|
|
@@ -12703,7 +12717,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12703
12717
|
].includes(t) ? null : this._setTransportStatus(e, t), n);
|
|
12704
12718
|
}
|
|
12705
12719
|
_setParticipantsStalled(e, t) {
|
|
12706
|
-
this._updateParticipantsStatus(e, (e) =>
|
|
12720
|
+
this._updateParticipantsStatus(e, (e) => no.setStalled(e.connectionStatus, t));
|
|
12707
12721
|
}
|
|
12708
12722
|
_updateParticipantsStatus(e, t, n = null) {
|
|
12709
12723
|
let r = e.reduce((e, n) => {
|
|
@@ -12722,7 +12736,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12722
12736
|
_onRoomsUpdated(e) {
|
|
12723
12737
|
if (this._isCalledState()) return;
|
|
12724
12738
|
let t = {}, n = [], r = [];
|
|
12725
|
-
for (let i of Object.keys(
|
|
12739
|
+
for (let i of Object.keys(Xa)) {
|
|
12726
12740
|
let a = e.updates[i];
|
|
12727
12741
|
a && (a?.rooms?.forEach((e) => {
|
|
12728
12742
|
let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
|
|
@@ -12737,7 +12751,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12737
12751
|
}
|
|
12738
12752
|
_onRoomUpdated(e) {
|
|
12739
12753
|
let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
|
|
12740
|
-
e.events.some((e) => e ===
|
|
12754
|
+
e.events.some((e) => e === Xa.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || (this._reportMissingExternalIds(n, "ROOM_UPDATED"), R.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id));
|
|
12741
12755
|
}
|
|
12742
12756
|
_convertRoomToExternal(e) {
|
|
12743
12757
|
if (!e) return {
|
|
@@ -12848,7 +12862,7 @@ var Zs = 15, $ = class e extends b {
|
|
|
12848
12862
|
n && r.push(n);
|
|
12849
12863
|
}
|
|
12850
12864
|
}
|
|
12851
|
-
r.length && !this._isCalledState() && R.onRoomsUpdated({ [
|
|
12865
|
+
r.length && !this._isCalledState() && R.onRoomsUpdated({ [Xa.UPDATE]: { rooms: r } }, this.id);
|
|
12852
12866
|
}
|
|
12853
12867
|
_onFeedback(e) {
|
|
12854
12868
|
let t = [];
|
|
@@ -12924,13 +12938,16 @@ var Zs = 15, $ = class e extends b {
|
|
|
12924
12938
|
_getParticipant(e) {
|
|
12925
12939
|
return this._participants[e];
|
|
12926
12940
|
}
|
|
12927
|
-
},
|
|
12941
|
+
}, ec = null, tc = class e extends Error {
|
|
12928
12942
|
constructor(t, n) {
|
|
12929
12943
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
12930
12944
|
}
|
|
12931
|
-
},
|
|
12945
|
+
}, nc = class {
|
|
12932
12946
|
constructor() {
|
|
12933
|
-
h(this, "_abortSignal", void 0);
|
|
12947
|
+
h(this, "_abortSignal", void 0), h(this, "_apiCallStats", null);
|
|
12948
|
+
}
|
|
12949
|
+
setApiCallStats(e) {
|
|
12950
|
+
this._apiCallStats = e;
|
|
12934
12951
|
}
|
|
12935
12952
|
setAbortSignal(e) {
|
|
12936
12953
|
this._abortSignal = e;
|
|
@@ -12970,14 +12987,14 @@ var Zs = 15, $ = class e extends b {
|
|
|
12970
12987
|
async getInbounds() {
|
|
12971
12988
|
return [];
|
|
12972
12989
|
}
|
|
12973
|
-
},
|
|
12990
|
+
}, rc = class e {
|
|
12974
12991
|
constructor() {
|
|
12975
12992
|
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
12976
12993
|
}
|
|
12977
12994
|
static _normalizeType(e) {
|
|
12978
|
-
return e.type ===
|
|
12995
|
+
return e.type === ro.GROUP ? {
|
|
12979
12996
|
...e,
|
|
12980
|
-
type:
|
|
12997
|
+
type: ro.USER
|
|
12981
12998
|
} : e;
|
|
12982
12999
|
}
|
|
12983
13000
|
getExternalId(e) {
|
|
@@ -13005,27 +13022,27 @@ var Zs = 15, $ = class e extends b {
|
|
|
13005
13022
|
clear() {
|
|
13006
13023
|
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
13007
13024
|
}
|
|
13008
|
-
},
|
|
13009
|
-
function
|
|
13025
|
+
}, ic = "anonymLogin:", ac = 700, oc = 3e3;
|
|
13026
|
+
function sc(e) {
|
|
13010
13027
|
let t = e.error_code;
|
|
13011
13028
|
switch (t) {
|
|
13012
|
-
case 2: return
|
|
13013
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
13014
|
-
case 300: return
|
|
13015
|
-
case 1101: return
|
|
13016
|
-
case 1102: return
|
|
13017
|
-
case 1103: return
|
|
13018
|
-
case 1104: return
|
|
13019
|
-
case 1106: return
|
|
13020
|
-
case 1113: return
|
|
13029
|
+
case 2: return cc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
13030
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? cc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : cc(x.API, t, "request-error");
|
|
13031
|
+
case 300: return cc(O.NOT_FOUND, t, "not-found");
|
|
13032
|
+
case 1101: return cc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
13033
|
+
case 1102: return cc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
13034
|
+
case 1103: return cc(O.NOT_FRIENDS, t, "friendship-required");
|
|
13035
|
+
case 1104: return uc(t, "youla-api-error");
|
|
13036
|
+
case 1106: return uc(t, "vk-api-error");
|
|
13037
|
+
case 1113: return cc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
13021
13038
|
case 1114: {
|
|
13022
13039
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
13023
|
-
return
|
|
13040
|
+
return cc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
13024
13041
|
}
|
|
13025
|
-
default: return
|
|
13042
|
+
default: return cc(x.API, t, "api-error");
|
|
13026
13043
|
}
|
|
13027
13044
|
}
|
|
13028
|
-
function
|
|
13045
|
+
function cc(e, t, n, r) {
|
|
13029
13046
|
return {
|
|
13030
13047
|
type: e,
|
|
13031
13048
|
callError: {
|
|
@@ -13037,7 +13054,10 @@ function oc(e, t, n, r) {
|
|
|
13037
13054
|
message: r
|
|
13038
13055
|
};
|
|
13039
13056
|
}
|
|
13040
|
-
function
|
|
13057
|
+
function lc(e) {
|
|
13058
|
+
return e?.error_code === void 0 ? e instanceof Error ? e.name : "network" : String(e.error_code);
|
|
13059
|
+
}
|
|
13060
|
+
function uc(e, t) {
|
|
13041
13061
|
return {
|
|
13042
13062
|
type: O.EXTERNAL_API_ERROR,
|
|
13043
13063
|
callError: {
|
|
@@ -13048,19 +13068,21 @@ function sc(e, t) {
|
|
|
13048
13068
|
}
|
|
13049
13069
|
};
|
|
13050
13070
|
}
|
|
13051
|
-
var
|
|
13071
|
+
var dc = class extends nc {
|
|
13052
13072
|
constructor(...e) {
|
|
13053
|
-
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
13073
|
+
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new rc());
|
|
13054
13074
|
}
|
|
13055
13075
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
13056
13076
|
let r = async (i) => {
|
|
13077
|
+
let a = performance.now();
|
|
13057
13078
|
try {
|
|
13058
|
-
|
|
13079
|
+
let r = await ns(e, t, n);
|
|
13080
|
+
return this._apiCallStats?.log(e, performance.now() - a), r;
|
|
13059
13081
|
} catch (t) {
|
|
13060
|
-
if (!t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
13082
|
+
if (this._apiCallStats?.log(e, performance.now() - a, lc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
13061
13083
|
i++;
|
|
13062
13084
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
13063
|
-
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i *
|
|
13085
|
+
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * ac, oc), { signal: this._abortSignal }), r(i);
|
|
13064
13086
|
}
|
|
13065
13087
|
throw z.warn(e, "error", t), t;
|
|
13066
13088
|
}
|
|
@@ -13072,13 +13094,13 @@ var cc = class extends ec {
|
|
|
13072
13094
|
return await this._callUnsafe(e, t, n);
|
|
13073
13095
|
} catch (i) {
|
|
13074
13096
|
if (z.warn("Api call error", i), i instanceof k) throw i;
|
|
13075
|
-
if (
|
|
13097
|
+
if (Ro(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
|
|
13076
13098
|
let a = {
|
|
13077
13099
|
message: i?.error_msg,
|
|
13078
13100
|
code: i?.error_code
|
|
13079
13101
|
};
|
|
13080
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
13081
|
-
let e =
|
|
13102
|
+
if (i.custom_error && (a.custom_error = i.custom_error), fc(i)) {
|
|
13103
|
+
let e = sc(i);
|
|
13082
13104
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
|
|
13083
13105
|
}
|
|
13084
13106
|
throw new k(x.API, a);
|
|
@@ -13108,7 +13130,7 @@ var cc = class extends ec {
|
|
|
13108
13130
|
return this._anonymLogin(N.authToken).then((e) => {
|
|
13109
13131
|
this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
|
|
13110
13132
|
}).catch((e) => {
|
|
13111
|
-
throw e instanceof k ? e : (e?.error_code ===
|
|
13133
|
+
throw e instanceof k ? e : (e?.error_code === Lo.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(x.AUTH, {
|
|
13112
13134
|
message: e?.error_msg,
|
|
13113
13135
|
code: e?.error_code,
|
|
13114
13136
|
callError: {
|
|
@@ -13130,17 +13152,17 @@ var cc = class extends ec {
|
|
|
13130
13152
|
return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
|
|
13131
13153
|
}
|
|
13132
13154
|
_getAnonymLoginCacheKey() {
|
|
13133
|
-
return N.authToken ? `${
|
|
13155
|
+
return N.authToken ? `${ic}${N.authToken}` : null;
|
|
13134
13156
|
}
|
|
13135
13157
|
_getCachedAnonymLogin() {
|
|
13136
13158
|
let e = this._getAnonymLoginCacheKey();
|
|
13137
13159
|
if (!e) return null;
|
|
13138
13160
|
let t = w.get(e);
|
|
13139
|
-
return
|
|
13161
|
+
return pc(t) ? t : (t && w.remove(e), null);
|
|
13140
13162
|
}
|
|
13141
13163
|
_setCachedAnonymLogin(e) {
|
|
13142
13164
|
let t = this._getAnonymLoginCacheKey();
|
|
13143
|
-
!t || !
|
|
13165
|
+
!t || !pc(e) || w.set(t, {
|
|
13144
13166
|
session_key: e.session_key,
|
|
13145
13167
|
session_secret_key: e.session_secret_key,
|
|
13146
13168
|
uid: e.uid
|
|
@@ -13154,9 +13176,9 @@ var cc = class extends ec {
|
|
|
13154
13176
|
return this._removeCachedAnonymLogin(), y.reauthorize(() => this.authorize());
|
|
13155
13177
|
}
|
|
13156
13178
|
_applyAnonymLogin(e) {
|
|
13157
|
-
e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key, N.statQueueEnabled && e.uid &&
|
|
13179
|
+
e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key, N.statQueueEnabled && e.uid && us.remember(Number(e.uid), {
|
|
13158
13180
|
sessionKey: e.session_key,
|
|
13159
|
-
endpoint:
|
|
13181
|
+
endpoint: us.currentEndpoint()
|
|
13160
13182
|
});
|
|
13161
13183
|
}
|
|
13162
13184
|
_buildClientStatsData(e) {
|
|
@@ -13175,7 +13197,7 @@ var cc = class extends ec {
|
|
|
13175
13197
|
});
|
|
13176
13198
|
}
|
|
13177
13199
|
async _sendClientStatsWith(e, t) {
|
|
13178
|
-
let n = await
|
|
13200
|
+
let n = await ns("vchat.clientStats", {
|
|
13179
13201
|
...t,
|
|
13180
13202
|
session_key: e
|
|
13181
13203
|
}, !0);
|
|
@@ -13183,10 +13205,10 @@ var cc = class extends ec {
|
|
|
13183
13205
|
}
|
|
13184
13206
|
async _sendClientStats(e, t, n = !0) {
|
|
13185
13207
|
try {
|
|
13186
|
-
let n = t ? await
|
|
13208
|
+
let n = t ? await rs("vchat.clientStats", e) : await ns("vchat.clientStats", e);
|
|
13187
13209
|
this._reportClientStatsItemErrors(n);
|
|
13188
13210
|
} catch (r) {
|
|
13189
|
-
if (!n || !
|
|
13211
|
+
if (!n || !Ro(r?.error_code)) throw r;
|
|
13190
13212
|
await this._reauthorize(), await this._sendClientStats(e, t, !1);
|
|
13191
13213
|
}
|
|
13192
13214
|
}
|
|
@@ -13210,7 +13232,7 @@ var cc = class extends ec {
|
|
|
13210
13232
|
}, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
|
|
13211
13233
|
o.append("file", s, "log.json");
|
|
13212
13234
|
let c = new URL(a.upload_url);
|
|
13213
|
-
return c.searchParams.append("size", s.size.toString()),
|
|
13235
|
+
return c.searchParams.append("size", s.size.toString()), os(c.toString(), o);
|
|
13214
13236
|
}
|
|
13215
13237
|
async joinConversation(e, t = !1, n) {
|
|
13216
13238
|
let r = {
|
|
@@ -13249,13 +13271,13 @@ var cc = class extends ec {
|
|
|
13249
13271
|
externalIds: l
|
|
13250
13272
|
});
|
|
13251
13273
|
if (t && t.length) switch (n) {
|
|
13252
|
-
case
|
|
13274
|
+
case Ua.USER:
|
|
13253
13275
|
u.uids = t.join(",");
|
|
13254
13276
|
break;
|
|
13255
|
-
case
|
|
13277
|
+
case Ua.GROUP:
|
|
13256
13278
|
u.gid = t[0];
|
|
13257
13279
|
break;
|
|
13258
|
-
case
|
|
13280
|
+
case Ua.CHAT:
|
|
13259
13281
|
u.chatId = t[0];
|
|
13260
13282
|
break;
|
|
13261
13283
|
}
|
|
@@ -13328,9 +13350,9 @@ var cc = class extends ec {
|
|
|
13328
13350
|
return y.userId;
|
|
13329
13351
|
}
|
|
13330
13352
|
setUserId(e) {
|
|
13331
|
-
y.userId = e, N.statQueueEnabled && y.sessionKey &&
|
|
13353
|
+
y.userId = e, N.statQueueEnabled && y.sessionKey && us.remember(Number(e), {
|
|
13332
13354
|
sessionKey: y.sessionKey,
|
|
13333
|
-
endpoint:
|
|
13355
|
+
endpoint: us.currentEndpoint()
|
|
13334
13356
|
});
|
|
13335
13357
|
}
|
|
13336
13358
|
hangupConversation(e, t = O.HUNGUP, n) {
|
|
@@ -13338,7 +13360,7 @@ var cc = class extends ec {
|
|
|
13338
13360
|
conversationId: e,
|
|
13339
13361
|
reason: t
|
|
13340
13362
|
};
|
|
13341
|
-
N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId),
|
|
13363
|
+
N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), ts("vchat.hangupConversation", r);
|
|
13342
13364
|
}
|
|
13343
13365
|
async removeHistoryRecords(e) {
|
|
13344
13366
|
await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
|
|
@@ -13354,19 +13376,19 @@ var cc = class extends ec {
|
|
|
13354
13376
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
13355
13377
|
}
|
|
13356
13378
|
};
|
|
13357
|
-
function
|
|
13379
|
+
function fc(e) {
|
|
13358
13380
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
13359
13381
|
}
|
|
13360
|
-
function
|
|
13382
|
+
function pc(e) {
|
|
13361
13383
|
return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
|
|
13362
13384
|
}
|
|
13363
13385
|
//#endregion
|
|
13364
13386
|
//#region src/enums/RecordRole.ts
|
|
13365
|
-
var
|
|
13387
|
+
var mc = /* @__PURE__ */ function(e) {
|
|
13366
13388
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
13367
|
-
}(
|
|
13389
|
+
}(mc || {}), hc = /* @__PURE__ */ function(e) {
|
|
13368
13390
|
return e.OFF = "0", e.ON = "1", e;
|
|
13369
|
-
}({}),
|
|
13391
|
+
}({}), gc = class {
|
|
13370
13392
|
constructor(e) {
|
|
13371
13393
|
h(this, "_queue", void 0), h(this, "_readCursor", void 0), h(this, "_writeCursor", void 0), h(this, "_moveReadCursor", void 0), h(this, "_left", void 0), this._queue = Array(e).fill(null), this._readCursor = this._writeCursor = this._left = 0, this._moveReadCursor = !1;
|
|
13372
13394
|
}
|
|
@@ -13389,12 +13411,12 @@ var dc = /* @__PURE__ */ function(e) {
|
|
|
13389
13411
|
let e = this._queue[this._readCursor];
|
|
13390
13412
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
13391
13413
|
}
|
|
13392
|
-
},
|
|
13414
|
+
}, _c = class {
|
|
13393
13415
|
constructor(e, t, n, r = null) {
|
|
13394
13416
|
h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
|
|
13395
13417
|
}
|
|
13396
13418
|
async authorize() {
|
|
13397
|
-
let e = await
|
|
13419
|
+
let e = await ns("auth.anonymLogin", {
|
|
13398
13420
|
session_data: {
|
|
13399
13421
|
device_id: this._uuid,
|
|
13400
13422
|
client_version: N.apiClientVersion,
|
|
@@ -13403,7 +13425,7 @@ var dc = /* @__PURE__ */ function(e) {
|
|
|
13403
13425
|
version: 3
|
|
13404
13426
|
},
|
|
13405
13427
|
application_key: this._apiKey
|
|
13406
|
-
}, !0, await
|
|
13428
|
+
}, !0, await $o(this._baseApiUrl, this._apiEnv));
|
|
13407
13429
|
return M.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
|
|
13408
13430
|
}
|
|
13409
13431
|
async hangupConversation(e, t) {
|
|
@@ -13413,9 +13435,9 @@ var dc = /* @__PURE__ */ function(e) {
|
|
|
13413
13435
|
application_key: this._apiKey,
|
|
13414
13436
|
session_key: this._sessionKey
|
|
13415
13437
|
};
|
|
13416
|
-
t?.peerId && (n.peerId = t.peerId), await
|
|
13438
|
+
t?.peerId && (n.peerId = t.peerId), await ns("vchat.hangupConversation", n, !0, await $o(this._baseApiUrl, this._apiEnv));
|
|
13417
13439
|
}
|
|
13418
|
-
},
|
|
13440
|
+
}, vc, yc = null, bc = !1, xc = {
|
|
13419
13441
|
getCameras: E.getCameras,
|
|
13420
13442
|
getMicrophones: E.getMicrophones,
|
|
13421
13443
|
getOutput: E.getOutput,
|
|
@@ -13441,27 +13463,27 @@ var dc = /* @__PURE__ */ function(e) {
|
|
|
13441
13463
|
baseChromeVersion: E.baseChromeVersion,
|
|
13442
13464
|
getAudioContext: E.getAudioContext,
|
|
13443
13465
|
isAudioShareSupported: E.isAudioShareSupported
|
|
13444
|
-
},
|
|
13445
|
-
function
|
|
13446
|
-
|
|
13466
|
+
}, Sc = { participantMarkerCompare: M.participantMarkerCompare };
|
|
13467
|
+
function Cc(e) {
|
|
13468
|
+
yc = e;
|
|
13447
13469
|
}
|
|
13448
|
-
function
|
|
13470
|
+
function wc(e) {
|
|
13449
13471
|
N.videoEffects = e;
|
|
13450
13472
|
}
|
|
13451
|
-
function
|
|
13473
|
+
function Tc(e) {
|
|
13452
13474
|
N.audioEffects = e;
|
|
13453
13475
|
}
|
|
13454
|
-
function
|
|
13476
|
+
function Ec(e, t = {}) {
|
|
13455
13477
|
N.vad = e, N.vadOptions = t;
|
|
13456
13478
|
}
|
|
13457
|
-
function
|
|
13479
|
+
function Dc(e, t = null, n = {}, r = 1) {
|
|
13458
13480
|
N.vmoji = e, N.vmojiOptions = {
|
|
13459
13481
|
protocolVersion: r,
|
|
13460
13482
|
renderingOptions: n
|
|
13461
13483
|
}, t && e.setSDK(t);
|
|
13462
13484
|
}
|
|
13463
|
-
async function
|
|
13464
|
-
N.set(t),
|
|
13485
|
+
async function Oc(t) {
|
|
13486
|
+
N.set(t), vc || (vc = new dc()), N.statQueueEnabled && (fs.setApi(vc), N.autoStartStats && Fc()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
|
|
13465
13487
|
let n = E.getBrowserSupportFailure();
|
|
13466
13488
|
if (n) throw new k(x.UNSUPPORTED, { callError: {
|
|
13467
13489
|
scope: "internal",
|
|
@@ -13470,19 +13492,19 @@ async function Tc(t) {
|
|
|
13470
13492
|
} });
|
|
13471
13493
|
z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${E.hasCameraPermission()}, Mic: ${E.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
|
|
13472
13494
|
}
|
|
13473
|
-
async function
|
|
13495
|
+
async function kc(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
13474
13496
|
let c = [];
|
|
13475
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
13497
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), jc([], Ua.USER, t, n, r, i, a, c, o, s);
|
|
13476
13498
|
}
|
|
13477
|
-
function
|
|
13499
|
+
function Ac(e, t = []) {
|
|
13478
13500
|
let n = e.getIncomingCallerExternalId();
|
|
13479
13501
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
13480
13502
|
}
|
|
13481
|
-
async function
|
|
13503
|
+
async function jc(e, t = Ua.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
13482
13504
|
if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
13483
13505
|
let u = B.getAll().find((e) => e.isIncomingRinging);
|
|
13484
|
-
if (!N.hold && u && !
|
|
13485
|
-
return new $(new
|
|
13506
|
+
if (!N.hold && u && !Ac(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
|
|
13507
|
+
return new $(new dc(), yc).onStart({
|
|
13486
13508
|
opponentIds: e,
|
|
13487
13509
|
opponentType: t,
|
|
13488
13510
|
mediaOptions: n,
|
|
@@ -13495,49 +13517,49 @@ async function Oc(e, t = Ha.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
13495
13517
|
conversationId: l
|
|
13496
13518
|
});
|
|
13497
13519
|
}
|
|
13498
|
-
async function
|
|
13499
|
-
return
|
|
13520
|
+
async function Mc(e, t) {
|
|
13521
|
+
return Nc(e, j.USER, void 0, t);
|
|
13500
13522
|
}
|
|
13501
|
-
async function
|
|
13523
|
+
async function Nc(e, t = j.USER, n, r, i, a) {
|
|
13502
13524
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
13503
|
-
return new $(new
|
|
13525
|
+
return new $(new dc(), yc).onPush(e, t, n, r, i, a);
|
|
13504
13526
|
}
|
|
13505
|
-
async function
|
|
13506
|
-
return
|
|
13527
|
+
async function Pc() {
|
|
13528
|
+
return vc.getInbounds();
|
|
13507
13529
|
}
|
|
13508
|
-
function
|
|
13530
|
+
function Fc() {
|
|
13509
13531
|
if (N.statQueueEnabled) {
|
|
13510
|
-
if (!
|
|
13532
|
+
if (!vc) {
|
|
13511
13533
|
z.error("[CallsSDK] startStats() called before init()");
|
|
13512
13534
|
return;
|
|
13513
13535
|
}
|
|
13514
|
-
|
|
13536
|
+
bc || (bc = !0, Ss.start(vc));
|
|
13515
13537
|
}
|
|
13516
13538
|
}
|
|
13517
|
-
async function
|
|
13518
|
-
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t,
|
|
13539
|
+
async function Ic(e, t) {
|
|
13540
|
+
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Zo()), vc.authorize();
|
|
13519
13541
|
}
|
|
13520
|
-
async function
|
|
13521
|
-
return
|
|
13542
|
+
async function Lc(e = [S.AUDIO], t) {
|
|
13543
|
+
return cu(t).accept(e);
|
|
13522
13544
|
}
|
|
13523
|
-
async function
|
|
13524
|
-
let t =
|
|
13545
|
+
async function Rc(e) {
|
|
13546
|
+
let t = au(e?.conversationId);
|
|
13525
13547
|
if (t) return t.decline(e);
|
|
13526
13548
|
}
|
|
13527
|
-
async function
|
|
13528
|
-
return
|
|
13549
|
+
async function zc(e, t = [S.AUDIO]) {
|
|
13550
|
+
return Bc(e, t);
|
|
13529
13551
|
}
|
|
13530
|
-
async function
|
|
13552
|
+
async function Bc(e, t, n) {
|
|
13531
13553
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
13532
|
-
return new $(new
|
|
13554
|
+
return new $(new dc(), yc).onJoin({
|
|
13533
13555
|
conversationId: e,
|
|
13534
13556
|
mediaOptions: t,
|
|
13535
13557
|
chatId: n
|
|
13536
13558
|
});
|
|
13537
13559
|
}
|
|
13538
|
-
async function
|
|
13560
|
+
async function Vc(e, t = [S.AUDIO], n, r, i, a) {
|
|
13539
13561
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
13540
|
-
return n && (N.anonymToken = n), new $(new
|
|
13562
|
+
return n && (N.anonymToken = n), new $(new dc(), yc).onJoin({
|
|
13541
13563
|
joinLink: e,
|
|
13542
13564
|
mediaOptions: t,
|
|
13543
13565
|
observedIds: r,
|
|
@@ -13546,30 +13568,30 @@ async function Rc(e, t = [S.AUDIO], n, r, i, a) {
|
|
|
13546
13568
|
anonymous: !!N.anonymToken
|
|
13547
13569
|
});
|
|
13548
13570
|
}
|
|
13549
|
-
function
|
|
13550
|
-
let t =
|
|
13571
|
+
function Hc(e) {
|
|
13572
|
+
let t = au(e?.conversationId);
|
|
13551
13573
|
return t ? t.hangup(e) : ($.hangupAfterInit(e?.onFastHangup), Promise.resolve());
|
|
13552
13574
|
}
|
|
13553
|
-
async function
|
|
13575
|
+
async function Uc(e, t) {
|
|
13554
13576
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
13555
13577
|
r && await r.addParticipant(n, t);
|
|
13556
13578
|
}
|
|
13557
|
-
async function
|
|
13579
|
+
async function Wc(e, t) {
|
|
13558
13580
|
let n = $.current();
|
|
13559
13581
|
if (n) {
|
|
13560
13582
|
let r = e.map((e) => M.composeUserId(e));
|
|
13561
13583
|
await n.addParticipantLegacy(r, t);
|
|
13562
13584
|
}
|
|
13563
13585
|
}
|
|
13564
|
-
async function
|
|
13565
|
-
let n =
|
|
13586
|
+
async function Gc(e, t = !1) {
|
|
13587
|
+
let n = lu(e, "removeParticipant");
|
|
13566
13588
|
if (n) try {
|
|
13567
13589
|
await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
13568
13590
|
} catch (e) {
|
|
13569
13591
|
z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
13570
13592
|
}
|
|
13571
13593
|
}
|
|
13572
|
-
async function
|
|
13594
|
+
async function Kc(e, t = !1) {
|
|
13573
13595
|
let n = $.current();
|
|
13574
13596
|
if (n) try {
|
|
13575
13597
|
await n.removeParticipant(M.composeUserId(e), t);
|
|
@@ -13577,13 +13599,13 @@ async function Uc(e, t = !1) {
|
|
|
13577
13599
|
z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
13578
13600
|
}
|
|
13579
13601
|
}
|
|
13580
|
-
async function
|
|
13602
|
+
async function qc(e, t) {
|
|
13581
13603
|
let n = $.current();
|
|
13582
13604
|
if (e === "videoinput" && At.contains(t)) return N.videoFacingMode = t, n ? (E.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
13583
13605
|
if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
13584
13606
|
if (n) return n.changeDevice(e);
|
|
13585
13607
|
}
|
|
13586
|
-
async function
|
|
13608
|
+
async function Jc(e, t) {
|
|
13587
13609
|
let n = typeof e == "object" ? {
|
|
13588
13610
|
...e,
|
|
13589
13611
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -13592,40 +13614,40 @@ async function Gc(e, t) {
|
|
|
13592
13614
|
captureScreen: e,
|
|
13593
13615
|
fastScreenSharing: !1,
|
|
13594
13616
|
captureAudio: !1
|
|
13595
|
-
}, r =
|
|
13617
|
+
}, r = au(t);
|
|
13596
13618
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
13597
13619
|
}
|
|
13598
|
-
function
|
|
13620
|
+
function Yc(e) {
|
|
13599
13621
|
let t = $.current();
|
|
13600
13622
|
t && t.toggleAnimojiCapturing(e);
|
|
13601
13623
|
}
|
|
13602
|
-
async function
|
|
13624
|
+
async function Xc(e, t = !1) {
|
|
13603
13625
|
let n = $.current();
|
|
13604
13626
|
n && await n.setVideoStream(e, t);
|
|
13605
13627
|
}
|
|
13606
|
-
async function
|
|
13607
|
-
let n =
|
|
13628
|
+
async function Zc(e, t) {
|
|
13629
|
+
let n = au(t);
|
|
13608
13630
|
n && await n.toggleLocalVideo(e);
|
|
13609
13631
|
}
|
|
13610
|
-
async function
|
|
13611
|
-
let n =
|
|
13632
|
+
async function Qc(e, t) {
|
|
13633
|
+
let n = au(t);
|
|
13612
13634
|
n && await n.toggleLocalAudio(e);
|
|
13613
13635
|
}
|
|
13614
|
-
async function
|
|
13636
|
+
async function $c(e) {
|
|
13615
13637
|
let t = $.current();
|
|
13616
13638
|
if (t) return t.setLocalResolution(e);
|
|
13617
13639
|
}
|
|
13618
|
-
async function
|
|
13640
|
+
async function el(e) {
|
|
13619
13641
|
let t = $.current();
|
|
13620
13642
|
t && await t.changePriorities(e);
|
|
13621
13643
|
}
|
|
13622
|
-
async function
|
|
13644
|
+
async function tl(e, t) {
|
|
13623
13645
|
let n = $.current();
|
|
13624
13646
|
if (n) {
|
|
13625
13647
|
if (t) {
|
|
13626
13648
|
let r = n.getCachedParticipantIdByExternalId(t);
|
|
13627
13649
|
if (!r) {
|
|
13628
|
-
|
|
13650
|
+
ou(t, "changeParticipantState", n);
|
|
13629
13651
|
return;
|
|
13630
13652
|
}
|
|
13631
13653
|
await n.changeParticipantState(e, r);
|
|
@@ -13634,161 +13656,161 @@ async function Qc(e, t) {
|
|
|
13634
13656
|
await n.changeParticipantState(e);
|
|
13635
13657
|
}
|
|
13636
13658
|
}
|
|
13637
|
-
async function
|
|
13659
|
+
async function nl() {
|
|
13638
13660
|
let e = $.current();
|
|
13639
13661
|
e && await e.putHandsDown();
|
|
13640
13662
|
}
|
|
13641
|
-
async function
|
|
13663
|
+
async function rl(e) {
|
|
13642
13664
|
let t = $.current();
|
|
13643
13665
|
t && await t.updateDisplayLayout(e);
|
|
13644
13666
|
}
|
|
13645
|
-
async function
|
|
13667
|
+
async function il(e) {
|
|
13646
13668
|
let t = $.current();
|
|
13647
13669
|
t && await t.requestDisplayLayout(e);
|
|
13648
13670
|
}
|
|
13649
|
-
async function
|
|
13650
|
-
let r =
|
|
13671
|
+
async function al(e, t, n = !1) {
|
|
13672
|
+
let r = lu(e, "grantRoles");
|
|
13651
13673
|
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
13652
13674
|
}
|
|
13653
|
-
async function
|
|
13675
|
+
async function ol(e, t, n, r = !1) {
|
|
13654
13676
|
let i = $.current();
|
|
13655
13677
|
i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
|
|
13656
13678
|
}
|
|
13657
|
-
async function
|
|
13679
|
+
async function sl({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
13658
13680
|
if (e) {
|
|
13659
|
-
let i =
|
|
13681
|
+
let i = lu(e, "muteParticipant");
|
|
13660
13682
|
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
13661
13683
|
}
|
|
13662
13684
|
let i = $.current();
|
|
13663
13685
|
i && await i.muteParticipant(null, t, n, r);
|
|
13664
13686
|
}
|
|
13665
|
-
async function
|
|
13687
|
+
async function cl({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
13666
13688
|
let a = $.current();
|
|
13667
13689
|
if (a) {
|
|
13668
13690
|
let o = e ? M.composeParticipantId(e, j.USER, r) : null;
|
|
13669
13691
|
await a.muteParticipant(o, t, n, i);
|
|
13670
13692
|
}
|
|
13671
13693
|
}
|
|
13672
|
-
async function
|
|
13673
|
-
let r =
|
|
13694
|
+
async function ll(e, t = !1, n = null) {
|
|
13695
|
+
let r = lu(e, "pinParticipant");
|
|
13674
13696
|
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
13675
13697
|
}
|
|
13676
|
-
async function
|
|
13698
|
+
async function ul(e, t = !1, n = 0, r = null) {
|
|
13677
13699
|
let i = $.current();
|
|
13678
13700
|
i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
|
|
13679
13701
|
}
|
|
13680
|
-
async function
|
|
13702
|
+
async function dl(e) {
|
|
13681
13703
|
let t = $.current();
|
|
13682
13704
|
t && await t.updateMediaModifiers(e);
|
|
13683
13705
|
}
|
|
13684
|
-
async function
|
|
13706
|
+
async function fl(e) {
|
|
13685
13707
|
let t = $.current();
|
|
13686
13708
|
t && await t.enableVideoSuspend(e);
|
|
13687
13709
|
}
|
|
13688
|
-
async function
|
|
13710
|
+
async function pl(e) {
|
|
13689
13711
|
let t = $.current();
|
|
13690
13712
|
t && await t.enableVideoSuspendSuggest(e);
|
|
13691
13713
|
}
|
|
13692
|
-
async function
|
|
13714
|
+
async function ml(e) {
|
|
13693
13715
|
let t = $.current();
|
|
13694
13716
|
t && await t.changeOptions(e);
|
|
13695
13717
|
}
|
|
13696
|
-
async function
|
|
13718
|
+
async function hl(e, t = null) {
|
|
13697
13719
|
if (t) {
|
|
13698
|
-
let n =
|
|
13720
|
+
let n = lu(t, "chatMessage");
|
|
13699
13721
|
return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
13700
13722
|
}
|
|
13701
13723
|
let n = $.current();
|
|
13702
13724
|
n && await n.chatMessage(e, null);
|
|
13703
13725
|
}
|
|
13704
|
-
async function
|
|
13726
|
+
async function gl(e, t = null) {
|
|
13705
13727
|
let n = $.current();
|
|
13706
13728
|
if (n) {
|
|
13707
13729
|
let r = t ? M.composeUserId(t) : null;
|
|
13708
13730
|
await n.chatMessage(e, r);
|
|
13709
13731
|
}
|
|
13710
13732
|
}
|
|
13711
|
-
async function
|
|
13733
|
+
async function _l(e = 10) {
|
|
13712
13734
|
let t = $.current();
|
|
13713
13735
|
if (t) return t.chatHistory(e);
|
|
13714
13736
|
}
|
|
13715
|
-
async function
|
|
13737
|
+
async function vl(e, t = null) {
|
|
13716
13738
|
if (t) {
|
|
13717
|
-
let n =
|
|
13739
|
+
let n = lu(t, "customData");
|
|
13718
13740
|
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
13719
13741
|
}
|
|
13720
13742
|
let n = $.current();
|
|
13721
13743
|
n && await n.customData(e, null);
|
|
13722
13744
|
}
|
|
13723
|
-
async function
|
|
13745
|
+
async function yl(e, t = null, n = 0) {
|
|
13724
13746
|
let r = $.current();
|
|
13725
13747
|
if (r) {
|
|
13726
13748
|
let i = t ? M.composeParticipantId(t, j.USER, n) : null;
|
|
13727
13749
|
await r.customData(e, i);
|
|
13728
13750
|
}
|
|
13729
13751
|
}
|
|
13730
|
-
async function
|
|
13731
|
-
return (await
|
|
13752
|
+
async function bl(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
13753
|
+
return (await vc.createConversation(a ?? M.uuid(), e, t, {
|
|
13732
13754
|
onlyAdminCanShareMovie: n,
|
|
13733
13755
|
waitForAdmin: r,
|
|
13734
13756
|
closedConversation: i
|
|
13735
13757
|
})).join_link;
|
|
13736
13758
|
}
|
|
13737
|
-
async function
|
|
13759
|
+
async function xl(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
13738
13760
|
let a = i.map((e) => Z.fromId(e));
|
|
13739
|
-
return (await
|
|
13761
|
+
return (await vc.createConversation(M.uuid(), e, t, {
|
|
13740
13762
|
onlyAdminCanShareMovie: n,
|
|
13741
13763
|
audienceMode: !0,
|
|
13742
13764
|
audioOnly: r
|
|
13743
13765
|
}, a)).join_link;
|
|
13744
13766
|
}
|
|
13745
|
-
async function
|
|
13767
|
+
async function Sl() {
|
|
13746
13768
|
let e = $.current();
|
|
13747
13769
|
return e ? e.createJoinLink() : Promise.reject();
|
|
13748
13770
|
}
|
|
13749
|
-
async function
|
|
13771
|
+
async function Cl() {
|
|
13750
13772
|
let e = $.current();
|
|
13751
13773
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
13752
13774
|
}
|
|
13753
|
-
async function
|
|
13754
|
-
return
|
|
13775
|
+
async function wl(e, t) {
|
|
13776
|
+
return vc.getAnonymTokenByLink(e, t);
|
|
13755
13777
|
}
|
|
13756
|
-
function
|
|
13778
|
+
function Tl(e) {
|
|
13757
13779
|
let t = $.current();
|
|
13758
13780
|
t && t.setVolume(e);
|
|
13759
13781
|
}
|
|
13760
|
-
function
|
|
13782
|
+
function El(e) {
|
|
13761
13783
|
N.forceRelayPolicy = e;
|
|
13762
13784
|
}
|
|
13763
|
-
async function
|
|
13785
|
+
async function Dl(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
13764
13786
|
let o = $.current();
|
|
13765
13787
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
13766
13788
|
}
|
|
13767
|
-
async function
|
|
13789
|
+
async function Ol(e = null, t) {
|
|
13768
13790
|
let n = $.current();
|
|
13769
13791
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
13770
13792
|
}
|
|
13771
|
-
async function
|
|
13793
|
+
async function kl(e = null) {
|
|
13772
13794
|
let t = $.current();
|
|
13773
13795
|
return t ? t.publishStream(e) : Promise.reject();
|
|
13774
13796
|
}
|
|
13775
|
-
async function
|
|
13797
|
+
async function Al() {
|
|
13776
13798
|
let e = $.current();
|
|
13777
13799
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
13778
13800
|
}
|
|
13779
|
-
async function
|
|
13801
|
+
async function jl(e) {
|
|
13780
13802
|
let t = $.current();
|
|
13781
13803
|
return t ? t.addMovie(e) : Promise.reject();
|
|
13782
13804
|
}
|
|
13783
|
-
async function
|
|
13805
|
+
async function Ml(e) {
|
|
13784
13806
|
let t = $.current();
|
|
13785
13807
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
13786
13808
|
}
|
|
13787
|
-
async function
|
|
13809
|
+
async function Nl(e) {
|
|
13788
13810
|
let t = $.current();
|
|
13789
13811
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
13790
13812
|
}
|
|
13791
|
-
async function
|
|
13813
|
+
async function Pl(e, t) {
|
|
13792
13814
|
let n = $.current();
|
|
13793
13815
|
if (n) {
|
|
13794
13816
|
let r = [], i = [];
|
|
@@ -13810,46 +13832,46 @@ async function jl(e, t) {
|
|
|
13810
13832
|
});
|
|
13811
13833
|
}
|
|
13812
13834
|
if (i.length) {
|
|
13813
|
-
|
|
13835
|
+
su(i, "updateRooms", n);
|
|
13814
13836
|
return;
|
|
13815
13837
|
}
|
|
13816
13838
|
return n.updateRooms(r, t);
|
|
13817
13839
|
}
|
|
13818
13840
|
return Promise.reject();
|
|
13819
13841
|
}
|
|
13820
|
-
async function
|
|
13842
|
+
async function Fl(e, t) {
|
|
13821
13843
|
let n = $.current();
|
|
13822
13844
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
13823
13845
|
}
|
|
13824
|
-
async function
|
|
13846
|
+
async function Il(e = null, t = null) {
|
|
13825
13847
|
let n = $.current();
|
|
13826
13848
|
if (!n) return Promise.reject();
|
|
13827
13849
|
let r;
|
|
13828
13850
|
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
13829
|
-
|
|
13851
|
+
ou(t, "switchRoom", n);
|
|
13830
13852
|
return;
|
|
13831
13853
|
}
|
|
13832
13854
|
return n.switchRoom(e, r);
|
|
13833
13855
|
}
|
|
13834
|
-
async function
|
|
13856
|
+
async function Ll(e) {
|
|
13835
13857
|
let t = $.current();
|
|
13836
13858
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
13837
13859
|
}
|
|
13838
|
-
function
|
|
13860
|
+
function Rl(e) {
|
|
13839
13861
|
N.statisticsInterval = e;
|
|
13840
13862
|
let t = $.current();
|
|
13841
13863
|
if (t) return t.updateStatisticsInterval();
|
|
13842
13864
|
}
|
|
13843
|
-
function
|
|
13865
|
+
function zl(t) {
|
|
13844
13866
|
e.disableLog(!t), z.toggle(t);
|
|
13845
13867
|
}
|
|
13846
|
-
function
|
|
13868
|
+
function Bl(e, ...t) {
|
|
13847
13869
|
N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
|
|
13848
13870
|
}
|
|
13849
|
-
function
|
|
13871
|
+
function Vl(e, t, ...n) {
|
|
13850
13872
|
N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
|
|
13851
13873
|
}
|
|
13852
|
-
var
|
|
13874
|
+
var Hl = {
|
|
13853
13875
|
list: Ne,
|
|
13854
13876
|
get: Pe,
|
|
13855
13877
|
getJson: Fe,
|
|
@@ -13857,7 +13879,7 @@ var zl = {
|
|
|
13857
13879
|
clear: Le,
|
|
13858
13880
|
stats: Re
|
|
13859
13881
|
};
|
|
13860
|
-
function
|
|
13882
|
+
function Ul() {
|
|
13861
13883
|
let e = [
|
|
13862
13884
|
[`Calls SDK ${N.sdkVersion}`, N.toJSON()],
|
|
13863
13885
|
["UserAgent:", navigator.userAgent],
|
|
@@ -13874,139 +13896,139 @@ function Bl() {
|
|
|
13874
13896
|
d: e
|
|
13875
13897
|
}));
|
|
13876
13898
|
}
|
|
13877
|
-
async function
|
|
13899
|
+
async function Wl() {
|
|
13878
13900
|
let e = $.id(), t = $.debugSessionId();
|
|
13879
13901
|
if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
13880
13902
|
let n = await Pe({ sessionId: t });
|
|
13881
13903
|
if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
13882
13904
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
13883
13905
|
try {
|
|
13884
|
-
return
|
|
13906
|
+
return vc?.uploadDebugLogs(e, r, i, JSON.stringify([...Ul(), ...n]));
|
|
13885
13907
|
} catch (e) {
|
|
13886
13908
|
throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
13887
13909
|
}
|
|
13888
13910
|
}
|
|
13889
|
-
async function
|
|
13911
|
+
async function Gl(e) {
|
|
13890
13912
|
let t = $.current();
|
|
13891
13913
|
if (t) return t.videoEffect(e);
|
|
13892
13914
|
}
|
|
13893
|
-
async function
|
|
13915
|
+
async function Kl(e, t) {
|
|
13894
13916
|
let n = $.current();
|
|
13895
13917
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
13896
13918
|
}
|
|
13897
|
-
async function
|
|
13919
|
+
async function ql(e) {
|
|
13898
13920
|
let t = $.current();
|
|
13899
13921
|
t && await t.setAudioStream(e);
|
|
13900
13922
|
}
|
|
13901
|
-
async function
|
|
13923
|
+
async function Jl(e, t = null, n = null) {
|
|
13902
13924
|
let r = $.current();
|
|
13903
13925
|
if (!r) return;
|
|
13904
13926
|
let i = n ?? t?.id, a = null;
|
|
13905
13927
|
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
13906
|
-
|
|
13928
|
+
ou(t, "setVmojiSvg", r);
|
|
13907
13929
|
return;
|
|
13908
13930
|
}
|
|
13909
13931
|
r.setAnimojiSvg(e, a, i);
|
|
13910
13932
|
}
|
|
13911
|
-
function
|
|
13933
|
+
function Yl(e) {
|
|
13912
13934
|
let t = $.current();
|
|
13913
13935
|
t && t.setAnimojiFill(e);
|
|
13914
13936
|
}
|
|
13915
|
-
async function
|
|
13916
|
-
return
|
|
13937
|
+
async function Xl(e = null, t, n = !1) {
|
|
13938
|
+
return cu().getWaitingHall(e, t, n);
|
|
13917
13939
|
}
|
|
13918
|
-
async function
|
|
13919
|
-
return
|
|
13940
|
+
async function Zl() {
|
|
13941
|
+
return cu().getAudienceModeHands();
|
|
13920
13942
|
}
|
|
13921
|
-
async function
|
|
13922
|
-
let n =
|
|
13943
|
+
async function Ql(e, t = !1) {
|
|
13944
|
+
let n = cu(), r;
|
|
13923
13945
|
if (e) {
|
|
13924
13946
|
let t = n.getCachedParticipantIdByExternalId(e);
|
|
13925
13947
|
if (!t) {
|
|
13926
|
-
|
|
13948
|
+
ou(e, "promoteParticipant", n);
|
|
13927
13949
|
return;
|
|
13928
13950
|
}
|
|
13929
13951
|
r = M.decomposeParticipantId(t).compositeUserId;
|
|
13930
13952
|
}
|
|
13931
13953
|
return n.promoteParticipant(r, t);
|
|
13932
13954
|
}
|
|
13933
|
-
async function
|
|
13934
|
-
return
|
|
13955
|
+
async function $l(e = !1) {
|
|
13956
|
+
return cu().requestPromotion(e);
|
|
13935
13957
|
}
|
|
13936
|
-
async function
|
|
13937
|
-
return
|
|
13958
|
+
async function eu(e = !1) {
|
|
13959
|
+
return cu().acceptPromotion(e);
|
|
13938
13960
|
}
|
|
13939
|
-
async function
|
|
13940
|
-
return
|
|
13961
|
+
async function tu(e) {
|
|
13962
|
+
return cu().getParticipantListChunk(e);
|
|
13941
13963
|
}
|
|
13942
|
-
async function
|
|
13943
|
-
return
|
|
13964
|
+
async function nu(e) {
|
|
13965
|
+
return cu().getParticipants(e);
|
|
13944
13966
|
}
|
|
13945
|
-
async function
|
|
13946
|
-
return
|
|
13967
|
+
async function ru(e) {
|
|
13968
|
+
return cu().feedback(e);
|
|
13947
13969
|
}
|
|
13948
|
-
async function
|
|
13949
|
-
return
|
|
13970
|
+
async function iu(e, t, n) {
|
|
13971
|
+
return cu(n).enableFeatureForRoles(e, t);
|
|
13950
13972
|
}
|
|
13951
|
-
function
|
|
13973
|
+
function au(e) {
|
|
13952
13974
|
return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
|
|
13953
13975
|
}
|
|
13954
|
-
function
|
|
13976
|
+
function ou(e, t, n) {
|
|
13955
13977
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
13956
13978
|
}
|
|
13957
|
-
function
|
|
13979
|
+
function su(e, t, n) {
|
|
13958
13980
|
let r = Array.from(new Set(e));
|
|
13959
13981
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
13960
13982
|
}
|
|
13961
|
-
function
|
|
13962
|
-
let t =
|
|
13983
|
+
function cu(e) {
|
|
13984
|
+
let t = au(e);
|
|
13963
13985
|
if (!t) throw Error("Conversation not found");
|
|
13964
13986
|
return t;
|
|
13965
13987
|
}
|
|
13966
|
-
function
|
|
13988
|
+
function lu(e, t) {
|
|
13967
13989
|
let n = $.current();
|
|
13968
13990
|
if (!n) return null;
|
|
13969
13991
|
let r = n.getCachedParticipantIdByExternalId(e);
|
|
13970
13992
|
return r ? {
|
|
13971
13993
|
conversation: n,
|
|
13972
13994
|
participantId: r
|
|
13973
|
-
} : (
|
|
13995
|
+
} : (ou(e, t, n), null);
|
|
13974
13996
|
}
|
|
13975
|
-
async function
|
|
13976
|
-
await
|
|
13997
|
+
async function uu(e) {
|
|
13998
|
+
await vc.removeHistoryRecords(e);
|
|
13977
13999
|
}
|
|
13978
|
-
async function
|
|
14000
|
+
async function du(e) {
|
|
13979
14001
|
let t = $.current() ?? B.getFirst();
|
|
13980
14002
|
t && await t.startAsr(e);
|
|
13981
14003
|
}
|
|
13982
|
-
async function
|
|
14004
|
+
async function fu(e) {
|
|
13983
14005
|
let t = $.current() ?? B.getFirst();
|
|
13984
14006
|
t && await t.stopAsr(e);
|
|
13985
14007
|
}
|
|
13986
|
-
async function
|
|
14008
|
+
async function pu(e) {
|
|
13987
14009
|
let t = $.current() ?? B.getFirst();
|
|
13988
14010
|
t && await t.requestAsr(e);
|
|
13989
14011
|
}
|
|
13990
|
-
async function
|
|
14012
|
+
async function mu(e) {
|
|
13991
14013
|
let t = $.current();
|
|
13992
14014
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
13993
14015
|
}
|
|
13994
|
-
async function
|
|
14016
|
+
async function hu() {
|
|
13995
14017
|
let e = $.current();
|
|
13996
14018
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
13997
14019
|
}
|
|
13998
|
-
async function
|
|
14020
|
+
async function gu(e) {
|
|
13999
14021
|
await B.switchCall(e);
|
|
14000
14022
|
}
|
|
14001
|
-
function
|
|
14023
|
+
function _u() {
|
|
14002
14024
|
return B.getActiveId();
|
|
14003
14025
|
}
|
|
14004
|
-
function
|
|
14026
|
+
function vu() {
|
|
14005
14027
|
return $.getSyncedTime();
|
|
14006
14028
|
}
|
|
14007
|
-
function
|
|
14029
|
+
function yu() {
|
|
14008
14030
|
return N.sdkVersion;
|
|
14009
14031
|
}
|
|
14010
14032
|
typeof window < "u" && (window.__CALLS_SDK = vn);
|
|
14011
14033
|
//#endregion
|
|
14012
|
-
export {
|
|
14034
|
+
export { dc as Api, _c as ApiExternal, gc as ArrayDequeue, y as AuthData, f as BaseLogger, Ha as CallDirection, Ua as CallType, Wa as ChatRoomEventType, Ga as ConversationFeature, Ka as ConversationOption, xn as DebugMessageType, ro as ExternalIdType, At as FacingMode, x as FatalError, k as HangupReason, O as HangupType, S as MediaOption, A as MediaTrackKind, H as MediaType, Ya as MuteState, X as ParticipantState, hc as ParticipantStateDataValue, P as ParticipantStatus, mc as RecordRole, Xa as RoomsEventType, Va as Signaling, V as SignalingCommandType, _r as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, $a as UserRole, j as UserType, Do as VolumeDetector, Lc as acceptCall, eu as acceptPromotion, Fl as activateRooms, jl as addMovie, Uc as addParticipant, Wc as addParticipantInternal, Ic as authorize, xc as browser, jc as callInternal, kc as callTo, Jc as captureScreen, Yc as captureVmoji, Kl as changeAudioEffect, ml as changeConversationOptions, qc as changeDevice, tl as changeParticipantState, el as changePriorities, Gl as changeVideoEffect, _l as chatHistory, hl as chatMessage, gl as chatMessageInternal, Sl as createJoinLink, vl as customData, yl as customDataInternal, zl as debug, Hl as debugLogs, Bl as debugMessage, Vl as debugMessageWithContext, Rc as declineCall, iu as enableFeatureForRoles, fl as enableVideoSuspend, pl as enableVideoSuspendSuggest, ru as feedback, El as forceRelayPolicy, _u as getActiveCallId, wl as getAnonymTokenByLink, Zl as getAudienceModeHands, Pc as getInbounds, tu as getParticipantListChunk, nu as getParticipants, Al as getStreamInfo, vu as getSyncedTime, Xl as getWaitingHall, al as grantRoles, ol as grantRolesInternal, Hc as hangup, Oc as init, zc as joinCall, Vc as joinCallByLink, Bc as joinCallInternal, sl as muteParticipant, cl as muteParticipantInternal, ll as pinParticipant, ul as pinParticipantInternal, Mc as processPush, Nc as processPushInternal, Ql as promoteParticipant, kl as publishStream, nl as putHandsDown, uu as removeHistoryRecords, Cl as removeJoinLink, Nl as removeMovie, Gc as removeParticipant, Kc as removeParticipantInternal, Ll as removeRooms, pu as requestAsr, il as requestDisplayLayout, $l as requestPromotion, Tc as setAudioEffects, ql as setAudioStream, $c as setLocalResolution, Cc as setLogger, dl as setMediaModifiers, Rl as setStatisticsInterval, Ec as setVad, wc as setVideoEffects, Xc as setVideoStream, Dc as setVmoji, Yl as setVmojiFill, Jl as setVmojiSvg, Tl as setVolume, du as startAsr, xl as startAudienceConversation, bl as startConversation, Fc as startStats, Dl as startStream, mu as startUrlSharing, fu as stopAsr, Ol as stopStream, hu as stopUrlSharing, gu as switchCall, Il as switchRoom, Qc as toggleLocalAudio, Zc as toggleLocalVideo, rl as updateDisplayLayout, Ml as updateMovie, Pl as updateRooms, Wl as uploadDebugLogs, Sc as utils, yu as version };
|