@vkontakte/calls-sdk 2.8.12-dev.8f58ce7b.0 → 2.8.12-dev.9e9e52d8.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/calls-sdk.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @vkontakte/calls-sdk v2.8.12-dev.8f58ce7b.0
3
- * Thu, 27 Aug 2026 12:25:15 GMT
2
+ * @vkontakte/calls-sdk v2.8.12-dev.9e9e52d8.0
3
+ * Mon, 31 Aug 2026 18:22:17 GMT
4
4
  * https://calls-sdk.cdn-vk.ru/doc/latest/index.html
5
5
  */
6
6
 
@@ -2156,7 +2156,7 @@ var yn = vn.getInstance(), M = class e {
2156
2156
  return 1.1;
2157
2157
  }
2158
2158
  static get sdkVersion() {
2159
- return "2.8.12-dev.8f58ce7b.0";
2159
+ return "2.8.12-dev.9e9e52d8.0";
2160
2160
  }
2161
2161
  static get debug() {
2162
2162
  return e._params.debug;
@@ -5675,9 +5675,10 @@ var Ci = 2 ** 15 - 1, wi = 1, Ti = 5, Ei = 5, Di = class e {
5675
5675
  this._debug.debug("SimulcastSender: Camera stream or track not found");
5676
5676
  return;
5677
5677
  }
5678
- t.direction = "sendonly", await t.sender.replaceTrack(r), t.sender.setStreams(n);
5679
- let i = t.sender.getParameters(), a = this._getTrackConfig(r, Xt.WIDTH, Xt.HEIGHT);
5680
- an(i.encodings, a.simulcastInfo), await t.sender.setParameters(i), this._pc = e, this._transceiver = t, this._simulcastInfo = a.simulcastInfo, this._debug.log(`SimulcastSender: Prepared mid=${t.mid} track=${a.width}x${a.height} encodings=${JSON.stringify(i.encodings)}`);
5678
+ let i = this._getTrackConfig(r, Xt.WIDTH, Xt.HEIGHT);
5679
+ this._pc = e, this._transceiver = t, this._simulcastInfo = i.simulcastInfo, t.direction = "sendonly", await t.sender.replaceTrack(r), t.sender.setStreams(n);
5680
+ let a = t.sender.getParameters();
5681
+ an(a.encodings, i.simulcastInfo), await t.sender.setParameters(a), this._debug.log(`SimulcastSender: Prepared mid=${t.mid} track=${i.width}x${i.height} encodings=${JSON.stringify(a.encodings)}`);
5681
5682
  }
5682
5683
  finalizeAnswer(e) {
5683
5684
  if (!this._pc || !this._transceiver?.mid || !this._simulcastInfo) return e;
@@ -5716,14 +5717,17 @@ var Ci = 2 ** 15 - 1, wi = 1, Ti = 5, Ei = 5, Di = class e {
5716
5717
  }
5717
5718
  replaceTrack(e) {
5718
5719
  let t = this._transceiver, n = t?.sender.track;
5719
- return !t || !this._simulcastInfo || e.kind !== k.video || !n || n.contentHint !== e.contentHint ? !1 : (t.sender.replaceTrack(e).then(() => {
5720
+ if (!t || !this._simulcastInfo || e.kind !== k.video || !n || n.contentHint !== e.contentHint) return !1;
5721
+ let r = this._mediaSource.mediaSettings.isVideoEnabled;
5722
+ return t.sender.replaceTrack(e).then(() => {
5723
+ if (!r) return;
5720
5724
  let { width: t, height: n } = e.getSettings();
5721
5725
  t && n && this._syncReplacedTrack(e).catch((e) => {
5722
5726
  this._debug.error("SimulcastSender: Failed to sync replaced track", e);
5723
5727
  });
5724
5728
  }).catch((e) => {
5725
5729
  this._debug.error("SimulcastSender: Unable to replace track", e), this._logger?.log(C.ERROR, "replaceTrack-single");
5726
- }), !0);
5730
+ }), !0;
5727
5731
  }
5728
5732
  reset() {
5729
5733
  this._pc = null, this._transceiver = null, this._simulcastInfo = null;
@@ -5758,10 +5762,10 @@ var Ci = 2 ** 15 - 1, wi = 1, Ti = 5, Ei = 5, Di = class e {
5758
5762
  }
5759
5763
  async _syncReplacedTrack(e) {
5760
5764
  let t = this._getTrackConfig(e);
5761
- en(this._simulcastInfo, t.simulcastInfo) || (this._simulcastInfo = t.simulcastInfo, await this._signaling.changeSimulcast({
5765
+ this._simulcastInfo = t.simulcastInfo, await this._signaling.changeSimulcast({
5762
5766
  mediaSource: Jt.CAMERA,
5763
5767
  simulcastInfo: t.simulcastInfo
5764
- }));
5768
+ });
5765
5769
  }
5766
5770
  }, aa = 90, oa = 4294967295, sa = class e extends Mr {
5767
5771
  constructor(e, t, n, r = R, i = null, a = null, o = null, s = null) {
@@ -9243,7 +9247,7 @@ var ss = 15, $ = class e extends b {
9243
9247
  isMe: (e) => this._isMe(e),
9244
9248
  updateDisplayLayout: (e) => this.updateDisplayLayout(e)
9245
9249
  }), this._onUnload = () => {
9246
- this._stopFirstMediaSentProbe(), this._conversation && this._api && this._api.hangupConversation(this._conversation.id, this._state === "IDLE" ? D.CANCELED : D.HUNGUP), this._stats.destroy();
9250
+ this._stopFirstMediaSentProbe(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? D.CANCELED : D.HUNGUP), this._stats.destroy();
9247
9251
  }, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new rs(this._stats.statAggregator), this._audioOutput = new mo(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), is));
9248
9252
  }
9249
9253
  static current() {
@@ -9523,7 +9527,7 @@ var ss = 15, $ = class e extends b {
9523
9527
  let t = e ?? (this._state === "ACTIVE" || this._state === "HELD" ? D.HUNGUP : D.CANCELED), n = new O(t), r = this._conversation?.id ?? null;
9524
9528
  return this._stats.logger.log(C.HANGUP, t), this._finishLifecycle(n), this._hangupPromise = this._signaling.hangup(t).then(() => void 0).catch((e) => {
9525
9529
  if (!(e instanceof wn)) throw e;
9526
- }).finally(() => this._close(n)), this._emitHangupOnce(n, r), this._cleanupTransport(), this._cleanupMediaSource(), this._hangupPromise;
9530
+ }).finally(() => (r != null && this._sendHangupApi(r, t), this._close(n))), this._emitHangupOnce(n, r), this._cleanupTransport(), this._cleanupMediaSource(), this._hangupPromise;
9527
9531
  }
9528
9532
  async addParticipant(e, t) {
9529
9533
  if (!this._signaling.ready) {
@@ -9578,6 +9582,10 @@ var ss = 15, $ = class e extends b {
9578
9582
  _emitHangupOnce(e, t) {
9579
9583
  this._hangupEmitted || (this._hangupEmitted = !0, L.onHangup(e, t));
9580
9584
  }
9585
+ _sendHangupApi(e, t) {
9586
+ let n = this._signaling.getPeerId(), r = {};
9587
+ n != null && (r.peerId = String(n)), this._api.hangupConversation(e, t, r);
9588
+ }
9581
9589
  _close(e, t = {}) {
9582
9590
  this._clearCalleeUnavailableWatchdog(), t.errorText && this._debug.error(t.errorText, e), this._debug.debug("Close conversation", e), this._finishLifecycle(e), this._stats.flushCallMetrics();
9583
9591
  let n = t.signalingReason ?? (e.error ? D.FAILED : void 0), r = n && this._signaling.ready ? this._signaling.hangup(n) : void 0;
@@ -9619,7 +9627,7 @@ var ss = 15, $ = class e extends b {
9619
9627
  this._clearCalleeUnavailableWatchdog();
9620
9628
  let t = this._conversation && this._conversation.id;
9621
9629
  if (this._debug.debug("Destroy conversation", { conversationId: t }), this._stopFirstMediaSentProbe(), this._cooldownQueueCleanupTimer !== null && (window.clearInterval(this._cooldownQueueCleanupTimer), this._cooldownQueueCleanupTimer = null), this._state = "CLOSE", this._participantState = Z.HUNGUP, this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._disposeSignaling(e), this._api.cleanup(), this._api.setAbortSignal(void 0), this._delayedHangup && t) try {
9622
- this._api.hangupConversation(t, D.CANCELED);
9630
+ this._sendHangupApi(t, D.CANCELED);
9623
9631
  } catch {}
9624
9632
  this._cleanupListeners(), this._stats.destroy(), this._cleanupRegistry(), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null;
9625
9633
  }
@@ -11957,15 +11965,15 @@ var ss = 15, $ = class e extends b {
11957
11965
  constructor(t, n) {
11958
11966
  super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
11959
11967
  }
11960
- }, us = null, ds = null;
11961
- function fs() {
11968
+ }, us = null, ds = null, fs = 64 * 1024;
11969
+ function ps() {
11962
11970
  us = null, ds = null;
11963
11971
  }
11964
- function ps(e) {
11972
+ function ms(e) {
11965
11973
  return e?.endsWith("/") ? e.slice(0, -1) : e;
11966
11974
  }
11967
- async function ms(e = null, t) {
11968
- let n = ps(e ?? M.apiBaseUrl);
11975
+ async function hs(e = null, t) {
11976
+ let n = ms(e ?? M.apiBaseUrl);
11969
11977
  if (n) return n;
11970
11978
  if ((t ?? M.apiEnv) !== "AUTO") return M.apiEndpoint(t);
11971
11979
  try {
@@ -11980,62 +11988,68 @@ async function ms(e = null, t) {
11980
11988
  return R.warn("Failed to resolve API endpoint using DNS, default is used", e), M.apiEndpoint(t);
11981
11989
  }
11982
11990
  }
11983
- async function hs() {
11984
- return us || ds || (ds = ms(), us = await ds, ds = null, us);
11991
+ async function gs() {
11992
+ return us || ds || (ds = hs(), us = await ds, ds = null, us);
11985
11993
  }
11986
- async function gs(e, t = {}, n = !1) {
11994
+ async function _s(e, t = {}, n = !1) {
11987
11995
  if (!window.Blob || !window.navigator.sendBeacon) return;
11988
- await hs();
11989
- let r = xs(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
11996
+ await gs();
11997
+ let r = Cs(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
11990
11998
  window.navigator.sendBeacon(`${us}/fb.do`, i);
11991
11999
  }
11992
- async function _s(e, t = {}, n = !1, r) {
11993
- return await hs(), vs(xs(e, t, n), r);
12000
+ async function vs(e, t = {}, n = !1, r) {
12001
+ return await gs(), bs(Cs(e, t, n), r);
11994
12002
  }
11995
- async function vs(e, t) {
11996
- let n = `${t ?? us}/fb.do`, r = new AbortController(), i = new O(x.NETWORK, { callError: {
12003
+ async function ys(e, t = {}, n = !1) {
12004
+ await gs();
12005
+ let r = Cs(e, t, n);
12006
+ return bs(r, void 0, new Blob([r]).size <= fs);
12007
+ }
12008
+ async function bs(e, t, n = !1) {
12009
+ let r = `${t ?? us}/fb.do`, i = new AbortController(), a = new O(x.NETWORK, { callError: {
11997
12010
  scope: "network",
11998
12011
  source: "api",
11999
12012
  code: "timeout",
12000
12013
  description: "request-timeout"
12001
- } }), a = setTimeout(() => r.abort(i), M.apiTimeout);
12014
+ } }), o = setTimeout(() => i.abort(a), M.apiTimeout);
12002
12015
  try {
12003
- let t = await fetch(n, {
12016
+ let t = await fetch(r, {
12004
12017
  method: "POST",
12005
12018
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
12006
12019
  body: e,
12007
- signal: r.signal
12008
- }), i = await t.text(), a;
12020
+ signal: i.signal,
12021
+ ...n && { keepalive: !0 }
12022
+ }), a = await t.text(), o;
12009
12023
  try {
12010
- a = JSON.parse(i);
12024
+ o = JSON.parse(a);
12011
12025
  } catch {
12012
- a = { result: i };
12026
+ o = { result: a };
12013
12027
  }
12014
- if (!t.ok && !ys(a)) throw new O(x.API, { callError: {
12028
+ if (!t.ok && !xs(o)) throw new O(x.API, { callError: {
12015
12029
  scope: "server",
12016
12030
  source: "api",
12017
12031
  code: `http-${t.status}`,
12018
12032
  description: "http-error"
12019
12033
  } });
12020
- if (ys(a)) throw a;
12021
- return a;
12034
+ if (xs(o)) throw o;
12035
+ return o;
12022
12036
  } catch (e) {
12023
- throw e instanceof O ? e : r.signal.aborted ? i : ys(e) ? e : new O(x.NETWORK, { callError: {
12037
+ throw e instanceof O ? e : i.signal.aborted ? a : xs(e) ? e : new O(x.NETWORK, { callError: {
12024
12038
  scope: "network",
12025
12039
  source: "api",
12026
12040
  code: "fetch-failed",
12027
12041
  description: "request-failed"
12028
12042
  } });
12029
12043
  } finally {
12030
- clearTimeout(a);
12044
+ clearTimeout(o);
12031
12045
  }
12032
12046
  }
12033
- function ys(e) {
12047
+ function xs(e) {
12034
12048
  if (typeof e != "object" || !e) return !1;
12035
12049
  let t = e;
12036
12050
  return typeof t.error_code == "number" && typeof t.error_msg == "string";
12037
12051
  }
12038
- async function bs(e, t) {
12052
+ async function Ss(e, t) {
12039
12053
  try {
12040
12054
  let n = await fetch(e, {
12041
12055
  method: "POST",
@@ -12048,7 +12062,7 @@ async function bs(e, t) {
12048
12062
  throw R.warn("Failed to send form data", e), e;
12049
12063
  }
12050
12064
  }
12051
- function xs(e, t = {}, n = !1) {
12065
+ function Cs(e, t = {}, n = !1) {
12052
12066
  t.method = e, t.format = "JSON", t.application_key || (t.application_key = M.apiKey), n || (y.sessionKey ? t.session_key = y.sessionKey : y.accessToken && (t.access_token = y.accessToken));
12053
12067
  for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
12054
12068
  let r = "";
@@ -12057,7 +12071,7 @@ function xs(e, t = {}, n = !1) {
12057
12071
  }
12058
12072
  //#endregion
12059
12073
  //#region src/abstract/BaseApi.ts
12060
- var Ss = class {
12074
+ var ws = class {
12061
12075
  constructor() {
12062
12076
  h(this, "_abortSignal", void 0);
12063
12077
  }
@@ -12091,7 +12105,7 @@ var Ss = class {
12091
12105
  replaceByInitialIdIdIfExists(e) {
12092
12106
  return typeof e == "string" ? parseInt(e, 10) : e;
12093
12107
  }
12094
- hangupConversation(e, t = D.HUNGUP) {}
12108
+ hangupConversation(e, t = D.HUNGUP, n) {}
12095
12109
  async removeHistoryRecords(e) {}
12096
12110
  async getServerTime() {
12097
12111
  return Date.now();
@@ -12100,7 +12114,7 @@ var Ss = class {
12100
12114
  async getInbounds() {
12101
12115
  return [];
12102
12116
  }
12103
- }, Cs = class e {
12117
+ }, Ts = class e {
12104
12118
  constructor() {
12105
12119
  h(this, "_okIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToOkId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
12106
12120
  }
@@ -12151,27 +12165,27 @@ var Ss = class {
12151
12165
  clear() {
12152
12166
  this._okIdToExternalId.clear(), this._externalIdToOkId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
12153
12167
  }
12154
- }, ws = "anonymLogin:", Ts = 700, Es = 3e3;
12155
- function Ds(e) {
12168
+ }, Es = "anonymLogin:", Ds = 700, Os = 3e3;
12169
+ function ks(e) {
12156
12170
  let t = e.error_code;
12157
12171
  switch (t) {
12158
- case 2: return Os(D.SERVICE_UNAVAILABLE, t, "service-unavailable");
12159
- case 4: return e.error_msg.includes("participants.limit.exceeded") ? Os(D.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Os(x.API, t, "request-error");
12160
- case 300: return Os(D.NOT_FOUND, t, "not-found");
12161
- case 1101: return Os(D.SERVICE_DISABLED, t, "vchat-service-disabled");
12162
- case 1102: return Os(D.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
12163
- case 1103: return Os(D.NOT_FRIENDS, t, "friendship-required");
12164
- case 1104: return ks(t, "youla-api-error");
12165
- case 1106: return ks(t, "vk-api-error");
12166
- case 1113: return Os(D.CALLER_IS_REJECTED, t, "caller-is-rejected");
12172
+ case 2: return As(D.SERVICE_UNAVAILABLE, t, "service-unavailable");
12173
+ case 4: return e.error_msg.includes("participants.limit.exceeded") ? As(D.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : As(x.API, t, "request-error");
12174
+ case 300: return As(D.NOT_FOUND, t, "not-found");
12175
+ case 1101: return As(D.SERVICE_DISABLED, t, "vchat-service-disabled");
12176
+ case 1102: return As(D.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
12177
+ case 1103: return As(D.NOT_FRIENDS, t, "friendship-required");
12178
+ case 1104: return js(t, "youla-api-error");
12179
+ case 1106: return js(t, "vk-api-error");
12180
+ case 1113: return As(D.CALLER_IS_REJECTED, t, "caller-is-rejected");
12167
12181
  case 1114: {
12168
12182
  let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
12169
- return Os(r ? D.OBSOLETE_CLIENT : D.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
12183
+ return As(r ? D.OBSOLETE_CLIENT : D.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
12170
12184
  }
12171
- default: return Os(x.API, t, "api-error");
12185
+ default: return As(x.API, t, "api-error");
12172
12186
  }
12173
12187
  }
12174
- function Os(e, t, n, r) {
12188
+ function As(e, t, n, r) {
12175
12189
  return {
12176
12190
  type: e,
12177
12191
  callError: {
@@ -12183,7 +12197,7 @@ function Os(e, t, n, r) {
12183
12197
  message: r
12184
12198
  };
12185
12199
  }
12186
- function ks(e, t) {
12200
+ function js(e, t) {
12187
12201
  return {
12188
12202
  type: D.EXTERNAL_API_ERROR,
12189
12203
  callError: {
@@ -12194,19 +12208,19 @@ function ks(e, t) {
12194
12208
  }
12195
12209
  };
12196
12210
  }
12197
- var As = class extends Ss {
12211
+ var Ms = class extends ws {
12198
12212
  constructor(...e) {
12199
- super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new Cs());
12213
+ super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new Ts());
12200
12214
  }
12201
12215
  async _callUnsafe(e, t = {}, n = !1) {
12202
12216
  let r = async (i) => {
12203
12217
  try {
12204
- return await _s(e, t, n);
12218
+ return await vs(e, t, n);
12205
12219
  } catch (t) {
12206
12220
  if (!t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
12207
12221
  i++;
12208
12222
  let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
12209
- if (R.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (R.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < M.apiMaxAttempt) return await j.delay(Math.min(i * Ts, Es), { signal: this._abortSignal }), r(i);
12223
+ if (R.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (R.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < M.apiMaxAttempt) return await j.delay(Math.min(i * Ds, Os), { signal: this._abortSignal }), r(i);
12210
12224
  }
12211
12225
  throw R.warn(e, "error", t), t;
12212
12226
  }
@@ -12223,14 +12237,14 @@ var As = class extends Ss {
12223
12237
  case 103:
12224
12238
  case 104:
12225
12239
  if (!r) break;
12226
- return this._removeCachedAnonymLogin(), await y.reauthorize(() => this.authorize()), this._call(e, t, n, !1);
12240
+ return await this._reauthorize(), this._call(e, t, n, !1);
12227
12241
  }
12228
12242
  let a = {
12229
12243
  message: i?.error_msg,
12230
12244
  code: i?.error_code
12231
12245
  };
12232
- if (i.custom_error && (a.custom_error = i.custom_error), js(i)) {
12233
- let e = Ds(i);
12246
+ if (i.custom_error && (a.custom_error = i.custom_error), Ns(i)) {
12247
+ let e = ks(i);
12234
12248
  throw a.callError = e.callError, a.message = e.message ?? a.message, new O(e.type, a);
12235
12249
  }
12236
12250
  throw new O(x.API, a);
@@ -12276,17 +12290,17 @@ var As = class extends Ss {
12276
12290
  });
12277
12291
  }
12278
12292
  _getAnonymLoginCacheKey() {
12279
- return M.authToken ? `${ws}${M.authToken}` : null;
12293
+ return M.authToken ? `${Es}${M.authToken}` : null;
12280
12294
  }
12281
12295
  _getCachedAnonymLogin() {
12282
12296
  let e = this._getAnonymLoginCacheKey();
12283
12297
  if (!e) return null;
12284
12298
  let t = at.get(e);
12285
- return Ms(t) ? t : (t && at.remove(e), null);
12299
+ return Ps(t) ? t : (t && at.remove(e), null);
12286
12300
  }
12287
12301
  _setCachedAnonymLogin(e) {
12288
12302
  let t = this._getAnonymLoginCacheKey();
12289
- !t || !Ms(e) || at.set(t, {
12303
+ !t || !Ps(e) || at.set(t, {
12290
12304
  session_key: e.session_key,
12291
12305
  session_secret_key: e.session_secret_key,
12292
12306
  uid: e.uid
@@ -12296,9 +12310,23 @@ var As = class extends Ss {
12296
12310
  let e = this._getAnonymLoginCacheKey();
12297
12311
  e && at.remove(e);
12298
12312
  }
12313
+ _reauthorize() {
12314
+ return this._removeCachedAnonymLogin(), y.reauthorize(() => this.authorize());
12315
+ }
12299
12316
  _applyAnonymLogin(e) {
12300
12317
  e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key;
12301
12318
  }
12319
+ async _sendClientStats(e, t = !0) {
12320
+ try {
12321
+ (await ys("vchat.clientStats", e))?.items_responses?.forEach((e) => {
12322
+ e.errors && R.error("[vchat.clientStats]", e);
12323
+ });
12324
+ } catch (n) {
12325
+ let r = n?.error_code === 102 || n?.error_code === 103 || n?.error_code === 104;
12326
+ if (!t || !r) throw n;
12327
+ await this._reauthorize(), await this._sendClientStats(e, !1);
12328
+ }
12329
+ }
12302
12330
  logClientStats(e) {
12303
12331
  let t = {
12304
12332
  app_version: String(M.appVersion),
@@ -12307,7 +12335,9 @@ var As = class extends Ss {
12307
12335
  version: 1,
12308
12336
  items: e
12309
12337
  };
12310
- M.clientStatsPlatform && (t.platform = M.clientStatsPlatform), gs("vchat.clientStats", { data: JSON.stringify(t) });
12338
+ M.clientStatsPlatform && (t.platform = M.clientStatsPlatform);
12339
+ let n = { data: JSON.stringify(t) };
12340
+ this._sendClientStats(n).catch((e) => R.error("[vchat.clientStats]", e));
12311
12341
  }
12312
12342
  async uploadDebugLogs(e, t, n, r) {
12313
12343
  let i = {
@@ -12318,7 +12348,7 @@ var As = class extends Ss {
12318
12348
  }, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
12319
12349
  o.append("file", s, "log.json");
12320
12350
  let c = new URL(a.upload_url);
12321
- return c.searchParams.append("size", s.size.toString()), bs(c.toString(), o);
12351
+ return c.searchParams.append("size", s.size.toString()), Ss(c.toString(), o);
12322
12352
  }
12323
12353
  async joinConversation(e, t = !1, n) {
12324
12354
  let r = {
@@ -12444,12 +12474,12 @@ var As = class extends Ss {
12444
12474
  setUserId(e) {
12445
12475
  y.userId = e;
12446
12476
  }
12447
- hangupConversation(e, t = D.HUNGUP) {
12448
- let n = {
12477
+ hangupConversation(e, t = D.HUNGUP, n) {
12478
+ let r = {
12449
12479
  conversationId: e,
12450
12480
  reason: t
12451
12481
  };
12452
- M.anonymToken && (n.anonymToken = M.anonymToken), gs("vchat.hangupConversation", n);
12482
+ M.anonymToken && (r.anonymToken = M.anonymToken), n?.peerId && (r.peerId = n.peerId), _s("vchat.hangupConversation", r);
12453
12483
  }
12454
12484
  async removeHistoryRecords(e) {
12455
12485
  await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
@@ -12465,19 +12495,19 @@ var As = class extends Ss {
12465
12495
  return Array.isArray(e?.inbounds) ? e.inbounds : [];
12466
12496
  }
12467
12497
  };
12468
- function js(e) {
12498
+ function Ns(e) {
12469
12499
  return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
12470
12500
  }
12471
- function Ms(e) {
12501
+ function Ps(e) {
12472
12502
  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;
12473
12503
  }
12474
12504
  //#endregion
12475
12505
  //#region src/enums/RecordRole.ts
12476
- var Ns = /* @__PURE__ */ function(e) {
12506
+ var Fs = /* @__PURE__ */ function(e) {
12477
12507
  return e.KING = "KING", e.PAWN = "PAWN", e;
12478
- }(Ns || {}), Ps = /* @__PURE__ */ function(e) {
12508
+ }(Fs || {}), Is = /* @__PURE__ */ function(e) {
12479
12509
  return e.OFF = "0", e.ON = "1", e;
12480
- }({}), Fs = class {
12510
+ }({}), Ls = class {
12481
12511
  constructor(e) {
12482
12512
  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;
12483
12513
  }
@@ -12500,12 +12530,12 @@ var Ns = /* @__PURE__ */ function(e) {
12500
12530
  let e = this._queue[this._readCursor];
12501
12531
  return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
12502
12532
  }
12503
- }, Is = class {
12533
+ }, Rs = class {
12504
12534
  constructor(e, t, n, r = null) {
12505
12535
  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 = j.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
12506
12536
  }
12507
12537
  async authorize() {
12508
- let e = await _s("auth.anonymLogin", {
12538
+ let e = await vs("auth.anonymLogin", {
12509
12539
  session_data: {
12510
12540
  device_id: this._uuid,
12511
12541
  client_version: M.appVersion,
@@ -12514,18 +12544,19 @@ var Ns = /* @__PURE__ */ function(e) {
12514
12544
  version: 3
12515
12545
  },
12516
12546
  application_key: this._apiKey
12517
- }, !0, await ms(this._baseApiUrl, this._apiEnv));
12547
+ }, !0, await hs(this._baseApiUrl, this._apiEnv));
12518
12548
  return j.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
12519
12549
  }
12520
- async hangupConversation(e) {
12521
- await _s("vchat.hangupConversation", {
12550
+ async hangupConversation(e, t) {
12551
+ let n = {
12522
12552
  conversationId: e,
12523
12553
  reason: D.HUNGUP,
12524
12554
  application_key: this._apiKey,
12525
12555
  session_key: this._sessionKey
12526
- }, !0, await ms(this._baseApiUrl, this._apiEnv));
12556
+ };
12557
+ t?.peerId && (n.peerId = t.peerId), await vs("vchat.hangupConversation", n, !0, await hs(this._baseApiUrl, this._apiEnv));
12527
12558
  }
12528
- }, Ls, Rs = null, zs = {
12559
+ }, zs, Bs = null, Vs = {
12529
12560
  getCameras: T.getCameras,
12530
12561
  getMicrophones: T.getMicrophones,
12531
12562
  getOutput: T.getOutput,
@@ -12551,27 +12582,27 @@ var Ns = /* @__PURE__ */ function(e) {
12551
12582
  baseChromeVersion: T.baseChromeVersion,
12552
12583
  getAudioContext: T.getAudioContext,
12553
12584
  isAudioShareSupported: T.isAudioShareSupported
12554
- }, Bs = { participantMarkerCompare: j.participantMarkerCompare };
12555
- function Vs(e) {
12556
- Rs = e;
12585
+ }, Hs = { participantMarkerCompare: j.participantMarkerCompare };
12586
+ function Us(e) {
12587
+ Bs = e;
12557
12588
  }
12558
- function Hs(e) {
12589
+ function Ws(e) {
12559
12590
  M.videoEffects = e;
12560
12591
  }
12561
- function Us(e) {
12592
+ function Gs(e) {
12562
12593
  M.audioEffects = e;
12563
12594
  }
12564
- function Ws(e, t = {}) {
12595
+ function Ks(e, t = {}) {
12565
12596
  M.vad = e, M.vadOptions = t;
12566
12597
  }
12567
- function Gs(e, t = null, n = {}, r = 1) {
12598
+ function qs(e, t = null, n = {}, r = 1) {
12568
12599
  M.vmoji = e, M.vmojiOptions = {
12569
12600
  protocolVersion: r,
12570
12601
  renderingOptions: n
12571
12602
  }, t && e.setSDK(t);
12572
12603
  }
12573
- async function Ks(t) {
12574
- M.set(t), Ls || (Ls = new As()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init();
12604
+ async function Js(t) {
12605
+ M.set(t), zs || (zs = new Ms()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init();
12575
12606
  let n = T.getBrowserSupportFailure();
12576
12607
  if (n) throw new O(x.UNSUPPORTED, { callError: {
12577
12608
  scope: "internal",
@@ -12580,13 +12611,13 @@ async function Ks(t) {
12580
12611
  } });
12581
12612
  R.log("UserAgent:", navigator.userAgent), R.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), R.log("Permissions:", `Camera: ${T.hasCameraPermission()}, Mic: ${T.hasMicrophonePermission()}`), R.log("Simulcast:", `${t.simulcast} => ${M.simulcast}`);
12582
12613
  }
12583
- async function qs(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
12614
+ async function Ys(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
12584
12615
  let c = [];
12585
- return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), Js([], Ba.USER, t, n, r, i, a, c, o, s);
12616
+ return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), Xs([], Ba.USER, t, n, r, i, a, c, o, s);
12586
12617
  }
12587
- async function Js(e, t = Ba.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
12618
+ async function Xs(e, t = Ba.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
12588
12619
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
12589
- return new $(new As(), Rs).onStart({
12620
+ return new $(new Ms(), Bs).onStart({
12590
12621
  opponentIds: e,
12591
12622
  opponentType: t,
12592
12623
  mediaOptions: n,
@@ -12599,40 +12630,40 @@ async function Js(e, t = Ba.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
12599
12630
  conversationId: l
12600
12631
  });
12601
12632
  }
12602
- async function Ys(e, t) {
12603
- return Xs(e, A.USER, void 0, t);
12633
+ async function Zs(e, t) {
12634
+ return Qs(e, A.USER, void 0, t);
12604
12635
  }
12605
- async function Xs(e, t = A.USER, n, r, i, a) {
12636
+ async function Qs(e, t = A.USER, n, r, i, a) {
12606
12637
  if (e === $.id()) throw Error("Push has already been processed");
12607
- return new $(new As(), Rs).onPush(e, t, n, r, i, a);
12638
+ return new $(new Ms(), Bs).onPush(e, t, n, r, i, a);
12608
12639
  }
12609
- async function Zs() {
12610
- return Ls.getInbounds();
12640
+ async function $s() {
12641
+ return zs.getInbounds();
12611
12642
  }
12612
- async function Qs(e, t) {
12613
- return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, fs()), Ls.authorize();
12643
+ async function ec(e, t) {
12644
+ return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, ps()), zs.authorize();
12614
12645
  }
12615
- async function $s(e = [S.AUDIO], t) {
12616
- return Sl(t).accept(e);
12646
+ async function tc(e = [S.AUDIO], t) {
12647
+ return wl(t).accept(e);
12617
12648
  }
12618
- async function ec(e, t) {
12619
- let n = xl(e);
12649
+ async function nc(e, t) {
12650
+ let n = Cl(e);
12620
12651
  if (n) return n.decline(t?.reason);
12621
12652
  }
12622
- async function tc(e, t = [S.AUDIO]) {
12623
- return nc(e, t);
12653
+ async function rc(e, t = [S.AUDIO]) {
12654
+ return ic(e, t);
12624
12655
  }
12625
- async function nc(e, t, n) {
12656
+ async function ic(e, t, n) {
12626
12657
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
12627
- return new $(new As(), Rs).onJoin({
12658
+ return new $(new Ms(), Bs).onJoin({
12628
12659
  conversationId: e,
12629
12660
  mediaOptions: t,
12630
12661
  chatId: n
12631
12662
  });
12632
12663
  }
12633
- async function rc(e, t = [S.AUDIO], n, r, i, a) {
12664
+ async function ac(e, t = [S.AUDIO], n, r, i, a) {
12634
12665
  if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
12635
- return n && (M.anonymToken = n), new $(new As(), Rs).onJoin({
12666
+ return n && (M.anonymToken = n), new $(new Ms(), Bs).onJoin({
12636
12667
  joinLink: e,
12637
12668
  mediaOptions: t,
12638
12669
  observedIds: r,
@@ -12641,30 +12672,30 @@ async function rc(e, t = [S.AUDIO], n, r, i, a) {
12641
12672
  anonymous: !!M.anonymToken
12642
12673
  });
12643
12674
  }
12644
- function ic(e, t) {
12645
- let n = xl(e);
12675
+ function oc(e, t) {
12676
+ let n = Cl(e);
12646
12677
  return n ? n.hangup(t?.reason) : ($.hangupAfterInit(), Promise.resolve());
12647
12678
  }
12648
- async function ac(e, t) {
12679
+ async function sc(e, t) {
12649
12680
  let n = Array.isArray(e) ? e : [e], r = $.current();
12650
12681
  r && await r.addParticipant(n, t);
12651
12682
  }
12652
- async function oc(e, t) {
12683
+ async function cc(e, t) {
12653
12684
  let n = $.current();
12654
12685
  if (n) {
12655
12686
  let r = e.map((e) => j.composeUserId(e));
12656
12687
  await n.addParticipantLegacy(r, t);
12657
12688
  }
12658
12689
  }
12659
- async function sc(e, t = !1) {
12690
+ async function lc(e, t = !1) {
12660
12691
  let n = $.current()?.getCachedRawOkIdByExternalId(e) ?? null;
12661
12692
  if (!n) {
12662
12693
  R.warn("removeParticipant: externalId not found in cache", e);
12663
12694
  return;
12664
12695
  }
12665
- return cc(n, t);
12696
+ return uc(n, t);
12666
12697
  }
12667
- async function cc(e, t = !1) {
12698
+ async function uc(e, t = !1) {
12668
12699
  let n = $.current();
12669
12700
  if (n) try {
12670
12701
  await n.removeParticipant(j.composeUserId(e), t);
@@ -12672,13 +12703,13 @@ async function cc(e, t = !1) {
12672
12703
  R.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
12673
12704
  }
12674
12705
  }
12675
- async function lc(e, t) {
12706
+ async function dc(e, t) {
12676
12707
  let n = $.current();
12677
12708
  if (e === "videoinput" && jt.contains(t)) return M.videoFacingMode = t, n ? (T.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
12678
12709
  if (!await T._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
12679
12710
  if (n) return n.changeDevice(e);
12680
12711
  }
12681
- async function uc(e, t) {
12712
+ async function fc(e, t) {
12682
12713
  let n = typeof e == "object" ? {
12683
12714
  ...e,
12684
12715
  fastScreenSharing: e.captureScreen && e.fastScreenSharing,
@@ -12687,34 +12718,34 @@ async function uc(e, t) {
12687
12718
  captureScreen: e,
12688
12719
  fastScreenSharing: !1,
12689
12720
  captureAudio: !1
12690
- }, r = xl(t);
12721
+ }, r = Cl(t);
12691
12722
  return r ? r.toggleScreenCapturing(n) : Promise.reject();
12692
12723
  }
12693
- function dc(e) {
12724
+ function pc(e) {
12694
12725
  let t = $.current();
12695
12726
  t && t.toggleAnimojiCapturing(e);
12696
12727
  }
12697
- async function fc(e, t = !1) {
12728
+ async function mc(e, t = !1) {
12698
12729
  let n = $.current();
12699
12730
  n && await n.setVideoStream(e, t);
12700
12731
  }
12701
- async function pc(e, t) {
12702
- let n = xl(t);
12732
+ async function hc(e, t) {
12733
+ let n = Cl(t);
12703
12734
  n && await n.toggleLocalVideo(e);
12704
12735
  }
12705
- async function mc(e, t) {
12706
- let n = xl(t);
12736
+ async function gc(e, t) {
12737
+ let n = Cl(t);
12707
12738
  n && await n.toggleLocalAudio(e);
12708
12739
  }
12709
- async function hc(e) {
12740
+ async function _c(e) {
12710
12741
  let t = $.current();
12711
12742
  if (t) return t.setLocalResolution(e);
12712
12743
  }
12713
- async function gc(e) {
12744
+ async function vc(e) {
12714
12745
  let t = $.current();
12715
12746
  t && await t.changePriorities(e);
12716
12747
  }
12717
- async function _c(e, t) {
12748
+ async function yc(e, t) {
12718
12749
  let n = $.current();
12719
12750
  if (n) {
12720
12751
  let r;
@@ -12729,33 +12760,33 @@ async function _c(e, t) {
12729
12760
  await n.changeParticipantState(e, r);
12730
12761
  }
12731
12762
  }
12732
- async function vc() {
12763
+ async function bc() {
12733
12764
  let e = $.current();
12734
12765
  e && await e.putHandsDown();
12735
12766
  }
12736
- async function yc(e) {
12767
+ async function xc(e) {
12737
12768
  let t = $.current();
12738
12769
  t && await t.updateDisplayLayout(e);
12739
12770
  }
12740
- async function bc(e) {
12771
+ async function Sc(e) {
12741
12772
  let t = $.current();
12742
12773
  t && await t.requestDisplayLayout(e);
12743
12774
  }
12744
- async function xc(e, t, n = !1) {
12775
+ async function Cc(e, t, n = !1) {
12745
12776
  let r = $.current()?.getCachedRawOkIdByExternalId(e) ?? null;
12746
12777
  if (!r) {
12747
12778
  R.warn("grantRoles: externalId not found in cache", e);
12748
12779
  return;
12749
12780
  }
12750
- return Sc(r, Q.getDeviceIdx(e), t, n);
12781
+ return wc(r, Q.getDeviceIdx(e), t, n);
12751
12782
  }
12752
- async function Sc(e, t, n, r = !1) {
12783
+ async function wc(e, t, n, r = !1) {
12753
12784
  let i = $.current();
12754
12785
  i && await i.grantRoles(j.composeParticipantId(e, A.USER, t), n, r);
12755
12786
  }
12756
- async function Cc({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
12787
+ async function Tc({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
12757
12788
  let i = null;
12758
- return e && (i = $.current()?.getCachedRawOkIdByExternalId(e) ?? null, i || R.warn("muteParticipant: externalId not found in cache", e)), wc({
12789
+ return e && (i = $.current()?.getCachedRawOkIdByExternalId(e) ?? null, i || R.warn("muteParticipant: externalId not found in cache", e)), Ec({
12759
12790
  uid: i,
12760
12791
  muteStates: t,
12761
12792
  requestedMedia: n,
@@ -12763,129 +12794,129 @@ async function Cc({ externalId: e = null, muteStates: t, requestedMedia: n = [],
12763
12794
  roomId: r
12764
12795
  });
12765
12796
  }
12766
- async function wc({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
12797
+ async function Ec({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
12767
12798
  let a = $.current();
12768
12799
  if (a) {
12769
12800
  let o = e ? j.composeParticipantId(e, A.USER, r) : null;
12770
12801
  await a.muteParticipant(o, t, n, i);
12771
12802
  }
12772
12803
  }
12773
- async function Tc(e, t = !1, n = null) {
12804
+ async function Dc(e, t = !1, n = null) {
12774
12805
  let r = $.current()?.getCachedRawOkIdByExternalId(e) ?? null;
12775
12806
  if (!r) {
12776
12807
  R.warn("pinParticipant: externalId not found in cache", e);
12777
12808
  return;
12778
12809
  }
12779
- return Ec(r, t, Q.getDeviceIdx(e), n);
12810
+ return Oc(r, t, Q.getDeviceIdx(e), n);
12780
12811
  }
12781
- async function Ec(e, t = !1, n = 0, r = null) {
12812
+ async function Oc(e, t = !1, n = 0, r = null) {
12782
12813
  let i = $.current();
12783
12814
  i && await i.pinParticipant(j.composeParticipantId(e, A.USER, n), t, r);
12784
12815
  }
12785
- async function Dc(e) {
12816
+ async function kc(e) {
12786
12817
  let t = $.current();
12787
12818
  t && await t.updateMediaModifiers(e);
12788
12819
  }
12789
- async function Oc(e) {
12820
+ async function Ac(e) {
12790
12821
  let t = $.current();
12791
12822
  t && await t.enableVideoSuspend(e);
12792
12823
  }
12793
- async function kc(e) {
12824
+ async function jc(e) {
12794
12825
  let t = $.current();
12795
12826
  t && await t.enableVideoSuspendSuggest(e);
12796
12827
  }
12797
- async function Ac(e) {
12828
+ async function Mc(e) {
12798
12829
  let t = $.current();
12799
12830
  t && await t.changeOptions(e);
12800
12831
  }
12801
- async function jc(e, t = null) {
12832
+ async function Nc(e, t = null) {
12802
12833
  let n = null;
12803
- return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("chatMessage: externalId not found in cache", t)), Mc(e, n);
12834
+ return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("chatMessage: externalId not found in cache", t)), Pc(e, n);
12804
12835
  }
12805
- async function Mc(e, t = null) {
12836
+ async function Pc(e, t = null) {
12806
12837
  let n = $.current();
12807
12838
  if (n) {
12808
12839
  let r = t ? j.composeUserId(t) : null;
12809
12840
  await n.chatMessage(e, r);
12810
12841
  }
12811
12842
  }
12812
- async function Nc(e = 10) {
12843
+ async function Fc(e = 10) {
12813
12844
  let t = $.current();
12814
12845
  if (t) return t.chatHistory(e);
12815
12846
  }
12816
- async function Pc(e, t = null) {
12847
+ async function Ic(e, t = null) {
12817
12848
  let n = null;
12818
- return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("customData: externalId not found in cache", t)), Fc(e, n, Q.getDeviceIdx(t));
12849
+ return t && (n = $.current()?.getCachedRawOkIdByExternalId(t) ?? null, n || R.warn("customData: externalId not found in cache", t)), Lc(e, n, Q.getDeviceIdx(t));
12819
12850
  }
12820
- async function Fc(e, t = null, n = 0) {
12851
+ async function Lc(e, t = null, n = 0) {
12821
12852
  let r = $.current();
12822
12853
  if (r) {
12823
12854
  let i = t ? j.composeParticipantId(t, A.USER, n) : null;
12824
12855
  await r.customData(e, i);
12825
12856
  }
12826
12857
  }
12827
- async function Ic(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
12828
- return (await Ls.createConversation(a ?? j.uuid(), e, t, {
12858
+ async function Rc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
12859
+ return (await zs.createConversation(a ?? j.uuid(), e, t, {
12829
12860
  onlyAdminCanShareMovie: n,
12830
12861
  waitForAdmin: r,
12831
12862
  closedConversation: i
12832
12863
  })).join_link;
12833
12864
  }
12834
- async function Lc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
12865
+ async function zc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
12835
12866
  let a = i.map((e) => Q.fromId(e));
12836
- return (await Ls.createConversation(j.uuid(), e, t, {
12867
+ return (await zs.createConversation(j.uuid(), e, t, {
12837
12868
  onlyAdminCanShareMovie: n,
12838
12869
  audienceMode: !0,
12839
12870
  audioOnly: r
12840
12871
  }, a)).join_link;
12841
12872
  }
12842
- async function Rc() {
12873
+ async function Bc() {
12843
12874
  let e = $.current();
12844
12875
  return e ? e.createJoinLink() : Promise.reject();
12845
12876
  }
12846
- async function zc() {
12877
+ async function Vc() {
12847
12878
  let e = $.current();
12848
12879
  return e ? e.removeJoinLink() : Promise.reject();
12849
12880
  }
12850
- async function Bc(e, t) {
12851
- return Ls.getAnonymTokenByLink(e, t);
12881
+ async function Hc(e, t) {
12882
+ return zs.getAnonymTokenByLink(e, t);
12852
12883
  }
12853
- function Vc(e) {
12884
+ function Uc(e) {
12854
12885
  let t = $.current();
12855
12886
  t && t.setVolume(e);
12856
12887
  }
12857
- function Hc(e) {
12888
+ function Wc(e) {
12858
12889
  M.forceRelayPolicy = e;
12859
12890
  }
12860
- async function Uc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
12891
+ async function Gc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
12861
12892
  let o = $.current();
12862
12893
  return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
12863
12894
  }
12864
- async function Wc(e = null, t) {
12895
+ async function Kc(e = null, t) {
12865
12896
  let n = $.current();
12866
12897
  return n ? n.stopStream(e, t) : Promise.reject();
12867
12898
  }
12868
- async function Gc(e = null) {
12899
+ async function qc(e = null) {
12869
12900
  let t = $.current();
12870
12901
  return t ? t.publishStream(e) : Promise.reject();
12871
12902
  }
12872
- async function Kc() {
12903
+ async function Jc() {
12873
12904
  let e = $.current();
12874
12905
  return e ? e.getStreamInfo() : Promise.reject();
12875
12906
  }
12876
- async function qc(e) {
12907
+ async function Yc(e) {
12877
12908
  let t = $.current();
12878
12909
  return t ? t.addMovie(e) : Promise.reject();
12879
12910
  }
12880
- async function Jc(e) {
12911
+ async function Xc(e) {
12881
12912
  let t = $.current();
12882
12913
  return t ? t.updateMovie(e) : Promise.reject();
12883
12914
  }
12884
- async function Yc(e) {
12915
+ async function Zc(e) {
12885
12916
  let t = $.current();
12886
12917
  return t ? t.removeMovie(e) : Promise.reject();
12887
12918
  }
12888
- async function Xc(e, t) {
12919
+ async function Qc(e, t) {
12889
12920
  let n = $.current();
12890
12921
  if (n) {
12891
12922
  let r = [];
@@ -12910,11 +12941,11 @@ async function Xc(e, t) {
12910
12941
  }
12911
12942
  return Promise.reject();
12912
12943
  }
12913
- async function Zc(e, t) {
12944
+ async function $c(e, t) {
12914
12945
  let n = $.current();
12915
12946
  return n ? n.activateRooms(e, t) : Promise.reject();
12916
12947
  }
12917
- async function Qc(e = null, t = null) {
12948
+ async function el(e = null, t = null) {
12918
12949
  let n = $.current();
12919
12950
  if (!n) return Promise.reject();
12920
12951
  let r;
@@ -12929,25 +12960,25 @@ async function Qc(e = null, t = null) {
12929
12960
  }
12930
12961
  return n.switchRoom(e, r);
12931
12962
  }
12932
- async function $c(e) {
12963
+ async function tl(e) {
12933
12964
  let t = $.current();
12934
12965
  return t ? t.removeRooms(e) : Promise.reject();
12935
12966
  }
12936
- function el(e) {
12967
+ function nl(e) {
12937
12968
  M.statisticsInterval = e;
12938
12969
  let t = $.current();
12939
12970
  if (t) return t.updateStatisticsInterval();
12940
12971
  }
12941
- function tl(t) {
12972
+ function rl(t) {
12942
12973
  e.disableLog(!t), R.toggle(t);
12943
12974
  }
12944
- function nl(e, ...t) {
12975
+ function il(e, ...t) {
12945
12976
  M.debugLog && ($.debugMessage(e, "[external]", ...t) || R.send(e, "[external]", ...t));
12946
12977
  }
12947
- function rl(e, t, ...n) {
12978
+ function al(e, t, ...n) {
12948
12979
  M.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || R.send(e, "[external]", ...n));
12949
12980
  }
12950
- var il = {
12981
+ var ol = {
12951
12982
  list: Ne,
12952
12983
  get: Pe,
12953
12984
  getJson: Fe,
@@ -12955,7 +12986,7 @@ var il = {
12955
12986
  clear: Le,
12956
12987
  stats: Re
12957
12988
  };
12958
- function al() {
12989
+ function sl() {
12959
12990
  let e = [
12960
12991
  [`Calls SDK ${M.sdkVersion}`, M.toJSON()],
12961
12992
  ["UserAgent:", navigator.userAgent],
@@ -12972,31 +13003,31 @@ function al() {
12972
13003
  d: e
12973
13004
  }));
12974
13005
  }
12975
- async function ol() {
13006
+ async function cl() {
12976
13007
  let e = $.id(), t = $.debugSessionId();
12977
13008
  if (!t || !e) throw R.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
12978
13009
  let n = await Pe({ sessionId: t });
12979
13010
  if (n.length === 0) throw R.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
12980
13011
  let r = n[0].t, i = n[n.length - 1].t;
12981
13012
  try {
12982
- return Ls?.uploadDebugLogs(e, r, i, JSON.stringify([...al(), ...n]));
13013
+ return zs?.uploadDebugLogs(e, r, i, JSON.stringify([...sl(), ...n]));
12983
13014
  } catch (e) {
12984
13015
  throw R.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
12985
13016
  }
12986
13017
  }
12987
- async function sl(e) {
13018
+ async function ll(e) {
12988
13019
  let t = $.current();
12989
13020
  if (t) return t.videoEffect(e);
12990
13021
  }
12991
- async function cl(e, t) {
13022
+ async function ul(e, t) {
12992
13023
  let n = $.current();
12993
13024
  if (n) return n.audioEffect(e.length > 0 ? e : null, t);
12994
13025
  }
12995
- async function ll(e) {
13026
+ async function dl(e) {
12996
13027
  let t = $.current();
12997
13028
  t && await t.setAudioStream(e);
12998
13029
  }
12999
- async function ul(e, t = null, n = null) {
13030
+ async function fl(e, t = null, n = null) {
13000
13031
  let r = $.current();
13001
13032
  if (!r) return;
13002
13033
  let i = n ?? t?.id, a = null;
@@ -13007,18 +13038,18 @@ async function ul(e, t = null, n = null) {
13007
13038
  }
13008
13039
  r.setAnimojiSvg(e, a, i);
13009
13040
  }
13010
- function dl(e) {
13041
+ function pl(e) {
13011
13042
  let t = $.current();
13012
13043
  t && t.setAnimojiFill(e);
13013
13044
  }
13014
- async function fl(e = null, t, n = !1) {
13015
- return Sl().getWaitingHall(e, t, n);
13045
+ async function ml(e = null, t, n = !1) {
13046
+ return wl().getWaitingHall(e, t, n);
13016
13047
  }
13017
- async function pl() {
13018
- return Sl().getAudienceModeHands();
13048
+ async function hl() {
13049
+ return wl().getAudienceModeHands();
13019
13050
  }
13020
- async function ml(e, t = !1) {
13021
- let n = Sl(), r;
13051
+ async function gl(e, t = !1) {
13052
+ let n = wl(), r;
13022
13053
  if (e) {
13023
13054
  let t = n.getCachedRawOkIdByExternalId(e);
13024
13055
  if (!t) {
@@ -13029,67 +13060,67 @@ async function ml(e, t = !1) {
13029
13060
  }
13030
13061
  return n.promoteParticipant(r, t);
13031
13062
  }
13032
- async function hl(e = !1) {
13033
- return Sl().requestPromotion(e);
13063
+ async function _l(e = !1) {
13064
+ return wl().requestPromotion(e);
13034
13065
  }
13035
- async function gl(e = !1) {
13036
- return Sl().acceptPromotion(e);
13066
+ async function vl(e = !1) {
13067
+ return wl().acceptPromotion(e);
13037
13068
  }
13038
- async function _l(e) {
13039
- return Sl().getParticipantListChunk(e);
13069
+ async function yl(e) {
13070
+ return wl().getParticipantListChunk(e);
13040
13071
  }
13041
- async function vl(e) {
13042
- return Sl().getParticipants(e);
13072
+ async function bl(e) {
13073
+ return wl().getParticipants(e);
13043
13074
  }
13044
- async function yl(e) {
13045
- return Sl().feedback(e);
13075
+ async function xl(e) {
13076
+ return wl().feedback(e);
13046
13077
  }
13047
- async function bl(e, t, n) {
13048
- return Sl(n).enableFeatureForRoles(e, t);
13078
+ async function Sl(e, t, n) {
13079
+ return wl(n).enableFeatureForRoles(e, t);
13049
13080
  }
13050
- function xl(e) {
13081
+ function Cl(e) {
13051
13082
  return e ? z.get(e) ?? null : $.current() ?? z.getFirst();
13052
13083
  }
13053
- function Sl(e) {
13054
- let t = xl(e);
13084
+ function wl(e) {
13085
+ let t = Cl(e);
13055
13086
  if (!t) throw Error("Conversation not found");
13056
13087
  return t;
13057
13088
  }
13058
- async function Cl(e) {
13059
- await Ls.removeHistoryRecords(e);
13089
+ async function Tl(e) {
13090
+ await zs.removeHistoryRecords(e);
13060
13091
  }
13061
- async function wl(e) {
13092
+ async function El(e) {
13062
13093
  let t = $.current() ?? z.getFirst();
13063
13094
  t && await t.startAsr(e);
13064
13095
  }
13065
- async function Tl(e) {
13096
+ async function Dl(e) {
13066
13097
  let t = $.current() ?? z.getFirst();
13067
13098
  t && await t.stopAsr(e);
13068
13099
  }
13069
- async function El(e) {
13100
+ async function Ol(e) {
13070
13101
  let t = $.current() ?? z.getFirst();
13071
13102
  t && await t.requestAsr(e);
13072
13103
  }
13073
- async function Dl(e) {
13104
+ async function kl(e) {
13074
13105
  let t = $.current();
13075
13106
  return t ? t.startUrlSharing(e) : Promise.reject();
13076
13107
  }
13077
- async function Ol() {
13108
+ async function Al() {
13078
13109
  let e = $.current();
13079
13110
  return e ? e.stopUrlSharing() : Promise.reject();
13080
13111
  }
13081
- async function kl(e) {
13112
+ async function jl(e) {
13082
13113
  await z.switchCall(e);
13083
13114
  }
13084
- function Al() {
13115
+ function Ml() {
13085
13116
  return z.getActiveId();
13086
13117
  }
13087
- function jl() {
13118
+ function Nl() {
13088
13119
  return $.getSyncedTime();
13089
13120
  }
13090
- function Ml() {
13121
+ function Pl() {
13091
13122
  return M.sdkVersion;
13092
13123
  }
13093
13124
  typeof window < "u" && (window.__CALLS_SDK = yn);
13094
13125
  //#endregion
13095
- export { As as Api, Is as ApiExternal, Fs as ArrayDequeue, y as AuthData, f as BaseLogger, za as CallDirection, Ba as CallType, Va as ChatRoomEventType, Ha as ConversationFeature, Ua as ConversationOption, Sn as DebugMessageType, eo as ExternalIdType, jt as FacingMode, x as FatalError, O as HangupReason, D as HangupType, S as MediaOption, k as MediaTrackKind, V as MediaType, Ka as MuteState, Z as ParticipantState, Ps as ParticipantStateDataValue, N as ParticipantStatus, Ns as RecordRole, qa as RoomsEventType, Ra as Signaling, B as SignalingCommandType, _r as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, Xa as UserRole, A as UserType, Co as VolumeDetector, $s as acceptCall, gl as acceptPromotion, Zc as activateRooms, qc as addMovie, ac as addParticipant, oc as addParticipantInternal, Qs as authorize, zs as browser, Js as callInternal, qs as callTo, uc as captureScreen, dc as captureVmoji, cl as changeAudioEffect, Ac as changeConversationOptions, lc as changeDevice, _c as changeParticipantState, gc as changePriorities, sl as changeVideoEffect, Nc as chatHistory, jc as chatMessage, Mc as chatMessageInternal, Rc as createJoinLink, Pc as customData, Fc as customDataInternal, tl as debug, il as debugLogs, nl as debugMessage, rl as debugMessageWithContext, ec as declineCall, bl as enableFeatureForRoles, Oc as enableVideoSuspend, kc as enableVideoSuspendSuggest, yl as feedback, Hc as forceRelayPolicy, Al as getActiveCallId, Bc as getAnonymTokenByLink, pl as getAudienceModeHands, Zs as getInbounds, _l as getParticipantListChunk, vl as getParticipants, Kc as getStreamInfo, jl as getSyncedTime, fl as getWaitingHall, xc as grantRoles, Sc as grantRolesInternal, ic as hangup, Ks as init, tc as joinCall, rc as joinCallByLink, nc as joinCallInternal, Cc as muteParticipant, wc as muteParticipantInternal, Tc as pinParticipant, Ec as pinParticipantInternal, Ys as processPush, Xs as processPushInternal, ml as promoteParticipant, Gc as publishStream, vc as putHandsDown, Cl as removeHistoryRecords, zc as removeJoinLink, Yc as removeMovie, sc as removeParticipant, cc as removeParticipantInternal, $c as removeRooms, El as requestAsr, bc as requestDisplayLayout, hl as requestPromotion, Us as setAudioEffects, ll as setAudioStream, hc as setLocalResolution, Vs as setLogger, Dc as setMediaModifiers, el as setStatisticsInterval, Ws as setVad, Hs as setVideoEffects, fc as setVideoStream, Gs as setVmoji, dl as setVmojiFill, ul as setVmojiSvg, Vc as setVolume, wl as startAsr, Lc as startAudienceConversation, Ic as startConversation, Uc as startStream, Dl as startUrlSharing, Tl as stopAsr, Wc as stopStream, Ol as stopUrlSharing, kl as switchCall, Qc as switchRoom, mc as toggleLocalAudio, pc as toggleLocalVideo, yc as updateDisplayLayout, Jc as updateMovie, Xc as updateRooms, ol as uploadDebugLogs, Bs as utils, Ml as version };
13126
+ export { Ms as Api, Rs as ApiExternal, Ls as ArrayDequeue, y as AuthData, f as BaseLogger, za as CallDirection, Ba as CallType, Va as ChatRoomEventType, Ha as ConversationFeature, Ua as ConversationOption, Sn as DebugMessageType, eo as ExternalIdType, jt as FacingMode, x as FatalError, O as HangupReason, D as HangupType, S as MediaOption, k as MediaTrackKind, V as MediaType, Ka as MuteState, Z as ParticipantState, Is as ParticipantStateDataValue, N as ParticipantStatus, Fs as RecordRole, qa as RoomsEventType, Ra as Signaling, B as SignalingCommandType, _r as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, Xa as UserRole, A as UserType, Co as VolumeDetector, tc as acceptCall, vl as acceptPromotion, $c as activateRooms, Yc as addMovie, sc as addParticipant, cc as addParticipantInternal, ec as authorize, Vs as browser, Xs as callInternal, Ys as callTo, fc as captureScreen, pc as captureVmoji, ul as changeAudioEffect, Mc as changeConversationOptions, dc as changeDevice, yc as changeParticipantState, vc as changePriorities, ll as changeVideoEffect, Fc as chatHistory, Nc as chatMessage, Pc as chatMessageInternal, Bc as createJoinLink, Ic as customData, Lc as customDataInternal, rl as debug, ol as debugLogs, il as debugMessage, al as debugMessageWithContext, nc as declineCall, Sl as enableFeatureForRoles, Ac as enableVideoSuspend, jc as enableVideoSuspendSuggest, xl as feedback, Wc as forceRelayPolicy, Ml as getActiveCallId, Hc as getAnonymTokenByLink, hl as getAudienceModeHands, $s as getInbounds, yl as getParticipantListChunk, bl as getParticipants, Jc as getStreamInfo, Nl as getSyncedTime, ml as getWaitingHall, Cc as grantRoles, wc as grantRolesInternal, oc as hangup, Js as init, rc as joinCall, ac as joinCallByLink, ic as joinCallInternal, Tc as muteParticipant, Ec as muteParticipantInternal, Dc as pinParticipant, Oc as pinParticipantInternal, Zs as processPush, Qs as processPushInternal, gl as promoteParticipant, qc as publishStream, bc as putHandsDown, Tl as removeHistoryRecords, Vc as removeJoinLink, Zc as removeMovie, lc as removeParticipant, uc as removeParticipantInternal, tl as removeRooms, Ol as requestAsr, Sc as requestDisplayLayout, _l as requestPromotion, Gs as setAudioEffects, dl as setAudioStream, _c as setLocalResolution, Us as setLogger, kc as setMediaModifiers, nl as setStatisticsInterval, Ks as setVad, Ws as setVideoEffects, mc as setVideoStream, qs as setVmoji, pl as setVmojiFill, fl as setVmojiSvg, Uc as setVolume, El as startAsr, zc as startAudienceConversation, Rc as startConversation, Gc as startStream, kl as startUrlSharing, Dl as stopAsr, Kc as stopStream, Al as stopUrlSharing, jl as switchCall, el as switchRoom, gc as toggleLocalAudio, hc as toggleLocalVideo, xc as updateDisplayLayout, Xc as updateMovie, Qc as updateRooms, cl as uploadDebugLogs, Hs as utils, Pl as version };