@d-id/client-sdk 2.0.6-staging.401 → 2.0.7-staging.403

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.
@@ -643,10 +643,10 @@ function bo(n, e) {
643
643
  return e == 0;
644
644
  }
645
645
  }
646
- var he;
646
+ var me;
647
647
  (function(n) {
648
648
  n[n.Varint = 0] = "Varint", n[n.Bit64 = 1] = "Bit64", n[n.LengthDelimited = 2] = "LengthDelimited", n[n.StartGroup = 3] = "StartGroup", n[n.EndGroup = 4] = "EndGroup", n[n.Bit32 = 5] = "Bit32";
649
- })(he || (he = {}));
649
+ })(me || (me = {}));
650
650
  class Nl {
651
651
  constructor(e) {
652
652
  this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
@@ -827,27 +827,27 @@ class Ul {
827
827
  skip(e, t) {
828
828
  let i = this.pos;
829
829
  switch (e) {
830
- case he.Varint:
830
+ case me.Varint:
831
831
  for (; this.buf[this.pos++] & 128; )
832
832
  ;
833
833
  break;
834
834
  // eslint-disable-next-line
835
835
  // @ts-ignore TS7029: Fallthrough case in switch
836
- case he.Bit64:
836
+ case me.Bit64:
837
837
  this.pos += 4;
838
838
  // eslint-disable-next-line
839
839
  // @ts-ignore TS7029: Fallthrough case in switch
840
- case he.Bit32:
840
+ case me.Bit32:
841
841
  this.pos += 4;
842
842
  break;
843
- case he.LengthDelimited:
843
+ case me.LengthDelimited:
844
844
  let s = this.uint32();
845
845
  this.pos += s;
846
846
  break;
847
- case he.StartGroup:
847
+ case me.StartGroup:
848
848
  for (; ; ) {
849
849
  const [r, o] = this.tag();
850
- if (o === he.EndGroup) {
850
+ if (o === me.EndGroup) {
851
851
  if (t !== void 0 && r !== t)
852
852
  throw new Error("invalid end group tag");
853
853
  break;
@@ -1596,7 +1596,7 @@ function Ql() {
1596
1596
  readMessage(n, e, t, i, s) {
1597
1597
  const r = n.getType(), o = s ? e.len : e.pos + t;
1598
1598
  let a, c;
1599
- for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == he.EndGroup)); ) {
1599
+ for (; e.pos < o && ([a, c] = e.tag(), !(s === !0 && c == me.EndGroup)); ) {
1600
1600
  const d = r.fields.find(a);
1601
1601
  if (!d) {
1602
1602
  const l = e.skip(c, a);
@@ -1606,7 +1606,7 @@ function Ql() {
1606
1606
  Kr(n, e, d, c, i);
1607
1607
  }
1608
1608
  if (s && // eslint-disable-line @typescript-eslint/strict-boolean-expressions
1609
- (c != he.EndGroup || a !== t))
1609
+ (c != me.EndGroup || a !== t))
1610
1610
  throw new Error("invalid end group tag");
1611
1611
  },
1612
1612
  readField: Kr,
@@ -1640,7 +1640,7 @@ function Kr(n, e, t, i, s) {
1640
1640
  let c = li;
1641
1641
  if (t.kind == "scalar" && t.L > 0 && (c = Xl), r) {
1642
1642
  let h = n[o];
1643
- if (i == he.LengthDelimited && a != E.STRING && a != E.BYTES) {
1643
+ if (i == me.LengthDelimited && a != E.STRING && a != E.BYTES) {
1644
1644
  let g = e.uint32() + e.pos;
1645
1645
  for (; e.pos < g; )
1646
1646
  h.push(c(e, a));
@@ -1778,7 +1778,7 @@ function Hr(n, e, t, i) {
1778
1778
  }
1779
1779
  }
1780
1780
  function Zl(n, e, t, i, s) {
1781
- n.tag(t.no, he.LengthDelimited), n.fork();
1781
+ n.tag(t.no, me.LengthDelimited), n.fork();
1782
1782
  let r = i;
1783
1783
  switch (t.K) {
1784
1784
  case E.INT32:
@@ -1800,14 +1800,14 @@ function Zl(n, e, t, i, s) {
1800
1800
  En(n, E.INT32, 2, s);
1801
1801
  break;
1802
1802
  case "message":
1803
- de(s !== void 0), n.tag(2, he.LengthDelimited).bytes(s.toBinary(e));
1803
+ de(s !== void 0), n.tag(2, me.LengthDelimited).bytes(s.toBinary(e));
1804
1804
  break;
1805
1805
  }
1806
1806
  n.join();
1807
1807
  }
1808
1808
  function Jr(n, e, t, i) {
1809
1809
  const s = wo(t.T, i);
1810
- t.delimited ? n.tag(t.no, he.StartGroup).raw(s.toBinary(e)).tag(t.no, he.EndGroup) : n.tag(t.no, he.LengthDelimited).bytes(s.toBinary(e));
1810
+ t.delimited ? n.tag(t.no, me.StartGroup).raw(s.toBinary(e)).tag(t.no, me.EndGroup) : n.tag(t.no, me.LengthDelimited).bytes(s.toBinary(e));
1811
1811
  }
1812
1812
  function En(n, e, t, i) {
1813
1813
  de(i !== void 0);
@@ -1817,28 +1817,28 @@ function En(n, e, t, i) {
1817
1817
  function eu(n, e, t, i) {
1818
1818
  if (!i.length)
1819
1819
  return;
1820
- n.tag(t, he.LengthDelimited).fork();
1820
+ n.tag(t, me.LengthDelimited).fork();
1821
1821
  let [, s] = _o(e);
1822
1822
  for (let r = 0; r < i.length; r++)
1823
1823
  n[s](i[r]);
1824
1824
  n.join();
1825
1825
  }
1826
1826
  function _o(n) {
1827
- let e = he.Varint;
1827
+ let e = me.Varint;
1828
1828
  switch (n) {
1829
1829
  case E.BYTES:
1830
1830
  case E.STRING:
1831
- e = he.LengthDelimited;
1831
+ e = me.LengthDelimited;
1832
1832
  break;
1833
1833
  case E.DOUBLE:
1834
1834
  case E.FIXED64:
1835
1835
  case E.SFIXED64:
1836
- e = he.Bit64;
1836
+ e = me.Bit64;
1837
1837
  break;
1838
1838
  case E.FIXED32:
1839
1839
  case E.SFIXED32:
1840
1840
  case E.FLOAT:
1841
- e = he.Bit32;
1841
+ e = me.Bit32;
1842
1842
  break;
1843
1843
  }
1844
1844
  const t = E[n].toLowerCase();
@@ -2426,7 +2426,7 @@ const hu = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
2426
2426
  }, {
2427
2427
  no: 2,
2428
2428
  name: "DATA"
2429
- }]), me = /* @__PURE__ */ p.makeEnum("livekit.TrackSource", [{
2429
+ }]), fe = /* @__PURE__ */ p.makeEnum("livekit.TrackSource", [{
2430
2430
  no: 0,
2431
2431
  name: "UNKNOWN"
2432
2432
  }, {
@@ -2684,7 +2684,7 @@ const hu = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
2684
2684
  no: 9,
2685
2685
  name: "can_publish_sources",
2686
2686
  kind: "enum",
2687
- T: p.getEnumType(me),
2687
+ T: p.getEnumType(fe),
2688
2688
  repeated: !0
2689
2689
  }, {
2690
2690
  no: 7,
@@ -2961,7 +2961,7 @@ const hu = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
2961
2961
  no: 9,
2962
2962
  name: "source",
2963
2963
  kind: "enum",
2964
- T: p.getEnumType(me)
2964
+ T: p.getEnumType(fe)
2965
2965
  }, {
2966
2966
  no: 10,
2967
2967
  name: "layers",
@@ -4374,7 +4374,7 @@ const hu = /* @__PURE__ */ p.makeMessageType("livekit.MetricsBatch", () => [{
4374
4374
  no: 8,
4375
4375
  name: "source",
4376
4376
  kind: "enum",
4377
- T: p.getEnumType(me)
4377
+ T: p.getEnumType(fe)
4378
4378
  }, {
4379
4379
  no: 9,
4380
4380
  name: "layers",
@@ -6291,7 +6291,7 @@ function Sh() {
6291
6291
  return d(v) || u.apply(this, arguments);
6292
6292
  }
6293
6293
  function m(v, S) {
6294
- var k = this, I, O, y, b = "loglevel";
6294
+ var k = this, P, M, y, b = "loglevel";
6295
6295
  typeof v == "string" ? b += ":" + v : typeof v == "symbol" && (b = void 0);
6296
6296
  function T(L) {
6297
6297
  var q = (s[L] || "silent").toUpperCase();
@@ -6335,7 +6335,7 @@ function Sh() {
6335
6335
  }
6336
6336
  }
6337
6337
  }
6338
- function P(L) {
6338
+ function I(L) {
6339
6339
  var q = L;
6340
6340
  if (typeof q == "string" && k.levels[q.toUpperCase()] !== void 0 && (q = k.levels[q.toUpperCase()]), typeof q == "number" && q >= 0 && q <= k.levels.SILENT)
6341
6341
  return q;
@@ -6349,11 +6349,11 @@ function Sh() {
6349
6349
  ERROR: 4,
6350
6350
  SILENT: 5
6351
6351
  }, k.methodFactory = S || h, k.getLevel = function() {
6352
- return y ?? O ?? I;
6352
+ return y ?? M ?? P;
6353
6353
  }, k.setLevel = function(L, q) {
6354
- return y = P(L), q !== !1 && T(y), l.call(k);
6354
+ return y = I(L), q !== !1 && T(y), l.call(k);
6355
6355
  }, k.setDefaultLevel = function(L) {
6356
- O = P(L), A() || k.setLevel(L, !1);
6356
+ M = I(L), A() || k.setLevel(L, !1);
6357
6357
  }, k.resetLevel = function() {
6358
6358
  y = null, U(), l.call(k);
6359
6359
  }, k.enableAll = function(L) {
@@ -6361,12 +6361,12 @@ function Sh() {
6361
6361
  }, k.disableAll = function(L) {
6362
6362
  k.setLevel(k.levels.SILENT, L);
6363
6363
  }, k.rebuild = function() {
6364
- if (o !== k && (I = P(o.getLevel())), l.call(k), o === k)
6364
+ if (o !== k && (P = I(o.getLevel())), l.call(k), o === k)
6365
6365
  for (var L in r)
6366
6366
  r[L].rebuild();
6367
- }, I = P(o ? o.getLevel() : "WARN");
6367
+ }, P = I(o ? o.getLevel() : "WARN");
6368
6368
  var x = A();
6369
- x != null && (y = P(x)), l.call(k);
6369
+ x != null && (y = I(x)), l.call(k);
6370
6370
  }
6371
6371
  o = new m(), o.getLogger = function(S) {
6372
6372
  if (typeof S != "symbol" && typeof S != "string" || S === "")
@@ -6542,8 +6542,8 @@ function Rh() {
6542
6542
  return c(this);
6543
6543
  }, r.prototype.emit = function(b) {
6544
6544
  for (var T = [], A = 1; A < arguments.length; A++) T.push(arguments[A]);
6545
- var U = b === "error", P = this._events;
6546
- if (P !== void 0) U = U && P.error === void 0;
6545
+ var U = b === "error", I = this._events;
6546
+ if (I !== void 0) U = U && I.error === void 0;
6547
6547
  else if (!U) return !1;
6548
6548
  if (U) {
6549
6549
  var x;
@@ -6552,7 +6552,7 @@ function Rh() {
6552
6552
  var L = new Error("Unhandled error." + (x ? " (" + x.message + ")" : ""));
6553
6553
  throw L.context = x, L;
6554
6554
  }
6555
- var q = P[b];
6555
+ var q = I[b];
6556
6556
  if (q === void 0) return !1;
6557
6557
  if (typeof q == "function")
6558
6558
  e(q, this, T);
@@ -6561,10 +6561,10 @@ function Rh() {
6561
6561
  return !0;
6562
6562
  };
6563
6563
  function d(y, b, T, A) {
6564
- var U, P, x;
6565
- if (a(T), P = y._events, P === void 0 ? (P = y._events = /* @__PURE__ */ Object.create(null), y._eventsCount = 0) : (P.newListener !== void 0 && (y.emit("newListener", b, T.listener ? T.listener : T), P = y._events), x = P[b]), x === void 0)
6566
- x = P[b] = T, ++y._eventsCount;
6567
- else if (typeof x == "function" ? x = P[b] = A ? [T, x] : [x, T] : A ? x.unshift(T) : x.push(T), U = c(y), U > 0 && x.length > U && !x.warned) {
6564
+ var U, I, x;
6565
+ if (a(T), I = y._events, I === void 0 ? (I = y._events = /* @__PURE__ */ Object.create(null), y._eventsCount = 0) : (I.newListener !== void 0 && (y.emit("newListener", b, T.listener ? T.listener : T), I = y._events), x = I[b]), x === void 0)
6566
+ x = I[b] = T, ++y._eventsCount;
6567
+ else if (typeof x == "function" ? x = I[b] = A ? [T, x] : [x, T] : A ? x.unshift(T) : x.push(T), U = c(y), U > 0 && x.length > U && !x.warned) {
6568
6568
  x.warned = !0;
6569
6569
  var L = new Error("Possible EventEmitter memory leak detected. " + x.length + " " + String(b) + " listeners added. Use emitter.setMaxListeners() to increase limit");
6570
6570
  L.name = "MaxListenersExceededWarning", L.emitter = y, L.type = b, L.count = x.length, i(L);
@@ -6595,19 +6595,19 @@ function Rh() {
6595
6595
  }, r.prototype.prependOnceListener = function(b, T) {
6596
6596
  return a(T), this.prependListener(b, u(this, b, T)), this;
6597
6597
  }, r.prototype.removeListener = function(b, T) {
6598
- var A, U, P, x, L;
6598
+ var A, U, I, x, L;
6599
6599
  if (a(T), U = this._events, U === void 0) return this;
6600
6600
  if (A = U[b], A === void 0) return this;
6601
6601
  if (A === T || A.listener === T)
6602
6602
  --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete U[b], U.removeListener && this.emit("removeListener", b, A.listener || T));
6603
6603
  else if (typeof A != "function") {
6604
- for (P = -1, x = A.length - 1; x >= 0; x--)
6604
+ for (I = -1, x = A.length - 1; x >= 0; x--)
6605
6605
  if (A[x] === T || A[x].listener === T) {
6606
- L = A[x].listener, P = x;
6606
+ L = A[x].listener, I = x;
6607
6607
  break;
6608
6608
  }
6609
- if (P < 0) return this;
6610
- P === 0 ? A.shift() : v(A, P), A.length === 1 && (U[b] = A[0]), U.removeListener !== void 0 && this.emit("removeListener", b, L || T);
6609
+ if (I < 0) return this;
6610
+ I === 0 ? A.shift() : v(A, I), A.length === 1 && (U[b] = A[0]), U.removeListener !== void 0 && this.emit("removeListener", b, L || T);
6611
6611
  }
6612
6612
  return this;
6613
6613
  }, r.prototype.off = r.prototype.removeListener, r.prototype.removeAllListeners = function(b) {
@@ -6616,9 +6616,9 @@ function Rh() {
6616
6616
  if (A.removeListener === void 0)
6617
6617
  return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : A[b] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete A[b]), this;
6618
6618
  if (arguments.length === 0) {
6619
- var P = Object.keys(A), x;
6620
- for (U = 0; U < P.length; ++U)
6621
- x = P[U], x !== "removeListener" && this.removeAllListeners(x);
6619
+ var I = Object.keys(A), x;
6620
+ for (U = 0; U < I.length; ++U)
6621
+ x = I[U], x !== "removeListener" && this.removeAllListeners(x);
6622
6622
  return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
6623
6623
  }
6624
6624
  if (T = A[b], typeof T == "function")
@@ -6671,27 +6671,27 @@ function Rh() {
6671
6671
  function k(y, b) {
6672
6672
  return new Promise(function(T, A) {
6673
6673
  function U(x) {
6674
- y.removeListener(b, P), A(x);
6674
+ y.removeListener(b, I), A(x);
6675
6675
  }
6676
- function P() {
6676
+ function I() {
6677
6677
  typeof y.removeListener == "function" && y.removeListener("error", U), T([].slice.call(arguments));
6678
6678
  }
6679
- O(y, b, P, {
6679
+ M(y, b, I, {
6680
6680
  once: !0
6681
- }), b !== "error" && I(y, U, {
6681
+ }), b !== "error" && P(y, U, {
6682
6682
  once: !0
6683
6683
  });
6684
6684
  });
6685
6685
  }
6686
- function I(y, b, T) {
6687
- typeof y.on == "function" && O(y, "error", b, T);
6686
+ function P(y, b, T) {
6687
+ typeof y.on == "function" && M(y, "error", b, T);
6688
6688
  }
6689
- function O(y, b, T, A) {
6689
+ function M(y, b, T, A) {
6690
6690
  if (typeof y.on == "function")
6691
6691
  A.once ? y.once(b, T) : y.on(b, T);
6692
6692
  else if (typeof y.addEventListener == "function")
6693
- y.addEventListener(b, function U(P) {
6694
- A.once && y.removeEventListener(b, U), T(P);
6693
+ y.addEventListener(b, function U(I) {
6694
+ A.once && y.removeEventListener(b, U), T(I);
6695
6695
  });
6696
6696
  else
6697
6697
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof y);
@@ -8387,10 +8387,10 @@ var D;
8387
8387
  (function(n) {
8388
8388
  n.TrackPublished = "trackPublished", n.TrackSubscribed = "trackSubscribed", n.TrackSubscriptionFailed = "trackSubscriptionFailed", n.TrackUnpublished = "trackUnpublished", n.TrackUnsubscribed = "trackUnsubscribed", n.TrackMuted = "trackMuted", n.TrackUnmuted = "trackUnmuted", n.LocalTrackPublished = "localTrackPublished", n.LocalTrackUnpublished = "localTrackUnpublished", n.LocalTrackCpuConstrained = "localTrackCpuConstrained", n.LocalSenderCreated = "localSenderCreated", n.ParticipantMetadataChanged = "participantMetadataChanged", n.ParticipantNameChanged = "participantNameChanged", n.DataReceived = "dataReceived", n.SipDTMFReceived = "sipDTMFReceived", n.TranscriptionReceived = "transcriptionReceived", n.IsSpeakingChanged = "isSpeakingChanged", n.ConnectionQualityChanged = "connectionQualityChanged", n.TrackStreamStateChanged = "trackStreamStateChanged", n.TrackSubscriptionPermissionChanged = "trackSubscriptionPermissionChanged", n.TrackSubscriptionStatusChanged = "trackSubscriptionStatusChanged", n.TrackCpuConstrained = "trackCpuConstrained", n.MediaDevicesError = "mediaDevicesError", n.AudioStreamAcquired = "audioStreamAcquired", n.ParticipantPermissionsChanged = "participantPermissionsChanged", n.PCTrackAdded = "pcTrackAdded", n.AttributesChanged = "attributesChanged", n.LocalTrackSubscribed = "localTrackSubscribed", n.ChatMessage = "chatMessage", n.Active = "active";
8389
8389
  })(D || (D = {}));
8390
- var M;
8390
+ var O;
8391
8391
  (function(n) {
8392
8392
  n.TransportsCreated = "transportsCreated", n.Connected = "connected", n.Disconnected = "disconnected", n.Resuming = "resuming", n.Resumed = "resumed", n.Restarting = "restarting", n.Restarted = "restarted", n.SignalResumed = "signalResumed", n.SignalRestarted = "signalRestarted", n.Closing = "closing", n.MediaTrackAdded = "mediaTrackAdded", n.ActiveSpeakersUpdate = "activeSpeakersUpdate", n.DataPacketReceived = "dataPacketReceived", n.RTPVideoMapUpdate = "rtpVideoMapUpdate", n.DCBufferStatusChanged = "dcBufferStatusChanged", n.ParticipantUpdate = "participantUpdate", n.RoomUpdate = "roomUpdate", n.SpeakersChanged = "speakersChanged", n.StreamStateChanged = "streamStateChanged", n.ConnectionQualityUpdate = "connectionQualityUpdate", n.SubscriptionError = "subscriptionError", n.SubscriptionPermissionUpdate = "subscriptionPermissionUpdate", n.RemoteMute = "remoteMute", n.SubscribedQualityUpdate = "subscribedQualityUpdate", n.LocalTrackUnpublished = "localTrackUnpublished", n.LocalTrackSubscribed = "localTrackSubscribed", n.Offline = "offline", n.SignalRequestResponse = "signalRequestResponse", n.SignalConnected = "signalConnected", n.RoomMoved = "roomMoved";
8393
- })(M || (M = {}));
8393
+ })(O || (O = {}));
8394
8394
  var R;
8395
8395
  (function(n) {
8396
8396
  n.Message = "message", n.Muted = "muted", n.Unmuted = "unmuted", n.Restarted = "restarted", n.Ended = "ended", n.Subscribed = "subscribed", n.Unsubscribed = "unsubscribed", n.CpuConstrained = "cpuConstrained", n.UpdateSettings = "updateSettings", n.UpdateSubscription = "updateSubscription", n.AudioPlaybackStarted = "audioPlaybackStarted", n.AudioPlaybackFailed = "audioPlaybackFailed", n.AudioSilenceDetected = "audioSilenceDetected", n.VisibilityChanged = "visibilityChanged", n.VideoDimensionsChanged = "videoDimensionsChanged", n.VideoPlaybackStarted = "videoPlaybackStarted", n.VideoPlaybackFailed = "videoPlaybackFailed", n.ElementAttached = "elementAttached", n.ElementDetached = "elementDetached", n.UpstreamPaused = "upstreamPaused", n.UpstreamResumed = "upstreamResumed", n.SubscriptionPermissionChanged = "subscriptionPermissionChanged", n.SubscriptionStatusChanged = "subscriptionStatusChanged", n.SubscriptionFailed = "subscriptionFailed", n.TrackProcessorUpdate = "trackProcessorUpdate", n.AudioTrackFeatureUpdate = "audioTrackFeatureUpdate", n.TranscriptionReceived = "transcriptionReceived", n.TimeSyncUpdate = "timeSyncUpdate", n.PreConnectBufferFlushed = "preConnectBufferFlushed";
@@ -8673,13 +8673,13 @@ function td(n) {
8673
8673
  }
8674
8674
  function Gh(n) {
8675
8675
  switch (n) {
8676
- case me.CAMERA:
8676
+ case fe.CAMERA:
8677
8677
  return C.Source.Camera;
8678
- case me.MICROPHONE:
8678
+ case fe.MICROPHONE:
8679
8679
  return C.Source.Microphone;
8680
- case me.SCREEN_SHARE:
8680
+ case fe.SCREEN_SHARE:
8681
8681
  return C.Source.ScreenShare;
8682
- case me.SCREEN_SHARE_AUDIO:
8682
+ case fe.SCREEN_SHARE_AUDIO:
8683
8683
  return C.Source.ScreenShareAudio;
8684
8684
  default:
8685
8685
  return C.Source.Unknown;
@@ -8856,27 +8856,27 @@ function Bt(n, e) {
8856
8856
  function o(d) {
8857
8857
  switch (d) {
8858
8858
  case t.Camera:
8859
- return me.CAMERA;
8859
+ return fe.CAMERA;
8860
8860
  case t.Microphone:
8861
- return me.MICROPHONE;
8861
+ return fe.MICROPHONE;
8862
8862
  case t.ScreenShare:
8863
- return me.SCREEN_SHARE;
8863
+ return fe.SCREEN_SHARE;
8864
8864
  case t.ScreenShareAudio:
8865
- return me.SCREEN_SHARE_AUDIO;
8865
+ return fe.SCREEN_SHARE_AUDIO;
8866
8866
  default:
8867
- return me.UNKNOWN;
8867
+ return fe.UNKNOWN;
8868
8868
  }
8869
8869
  }
8870
8870
  n.sourceToProto = o;
8871
8871
  function a(d) {
8872
8872
  switch (d) {
8873
- case me.CAMERA:
8873
+ case fe.CAMERA:
8874
8874
  return t.Camera;
8875
- case me.MICROPHONE:
8875
+ case fe.MICROPHONE:
8876
8876
  return t.Microphone;
8877
- case me.SCREEN_SHARE:
8877
+ case fe.SCREEN_SHARE:
8878
8878
  return t.ScreenShare;
8879
- case me.SCREEN_SHARE_AUDIO:
8879
+ case fe.SCREEN_SHARE_AUDIO:
8880
8880
  return t.ScreenShareAudio;
8881
8881
  default:
8882
8882
  return t.Unknown;
@@ -9609,7 +9609,7 @@ class Am extends ot.EventEmitter {
9609
9609
  !e || e.length === 0 ? W.warn("ignoring server sent trailer as it's empty") : this.postSifTrailer(e);
9610
9610
  }
9611
9611
  setupEngine(e) {
9612
- e.on(M.RTPVideoMapUpdate, (t) => {
9612
+ e.on(O.RTPVideoMapUpdate, (t) => {
9613
9613
  this.postRTPMap(t);
9614
9614
  });
9615
9615
  }
@@ -10141,7 +10141,7 @@ class or {
10141
10141
  d.connectOptions = a, d.useV0SignalPath = l;
10142
10142
  const h = rm(), m = l ? qm(o, h, a) : Wm(o, h, a), g = gm(r, m, l).toString(), v = ym(g).toString();
10143
10143
  return new Promise((S, k) => f(d, void 0, void 0, function* () {
10144
- var I, O;
10144
+ var P, M;
10145
10145
  try {
10146
10146
  let y = !1;
10147
10147
  const b = (x) => f(this, void 0, void 0, function* () {
@@ -10160,8 +10160,8 @@ class or {
10160
10160
  b(j.timeout("room connection has timed out (signal)"));
10161
10161
  }, a.websocketTimeout), U = (x, L) => {
10162
10162
  this.handleSignalConnected(x, A, L);
10163
- }, P = new URL(g);
10164
- P.searchParams.has("access_token") && P.searchParams.set("access_token", "<redacted>"), this.log.debug("connecting to ".concat(P), Object.assign({
10163
+ }, I = new URL(g);
10164
+ I.searchParams.has("access_token") && I.searchParams.set("access_token", "<redacted>"), this.log.debug("connecting to ".concat(I), Object.assign({
10165
10165
  reconnect: a.reconnect,
10166
10166
  reconnectReason: a.reconnectReason
10167
10167
  }, this.logContext)), this.ws && (yield this.close(!1)), this.ws = new Fm(g);
@@ -10193,12 +10193,12 @@ class or {
10193
10193
  const q = yield L.read();
10194
10194
  if (L.releaseLock(), !q.value)
10195
10195
  throw j.internal("no message received as first message");
10196
- const X = ma(q.value), w = this.validateFirstMessage(X, (I = a.reconnect) !== null && I !== void 0 ? I : !1);
10196
+ const X = ma(q.value), w = this.validateFirstMessage(X, (P = a.reconnect) !== null && P !== void 0 ? P : !1);
10197
10197
  if (!w.isValid) {
10198
10198
  k(w.error);
10199
10199
  return;
10200
10200
  }
10201
- ((O = X.message) === null || O === void 0 ? void 0 : O.case) === "join" && (this.pingTimeoutDuration = X.message.value.pingTimeout, this.pingIntervalDuration = X.message.value.pingInterval, this.pingTimeoutDuration && this.pingTimeoutDuration > 0 && this.log.debug("ping config", Object.assign(Object.assign({}, this.logContext), {
10201
+ ((M = X.message) === null || M === void 0 ? void 0 : M.case) === "join" && (this.pingTimeoutDuration = X.message.value.pingTimeout, this.pingIntervalDuration = X.message.value.pingInterval, this.pingTimeoutDuration && this.pingTimeoutDuration > 0 && this.log.debug("ping config", Object.assign(Object.assign({}, this.logContext), {
10202
10202
  timeout: this.pingTimeoutDuration,
10203
10203
  interval: this.pingIntervalDuration
10204
10204
  })));
@@ -11318,14 +11318,14 @@ function dr(n, e, t) {
11318
11318
  var k = o && r === void 0;
11319
11319
  if (r !== void 0 && clearTimeout(r), r = setTimeout(function() {
11320
11320
  if (r = void 0, d = Date.now(), !o) {
11321
- var O = n.apply(g, m);
11322
- a && a(O), l.forEach(function(y) {
11323
- return (0, y.resolve)(O);
11321
+ var M = n.apply(g, m);
11322
+ a && a(M), l.forEach(function(y) {
11323
+ return (0, y.resolve)(M);
11324
11324
  }), l = [];
11325
11325
  }
11326
11326
  }, u()), k) {
11327
- var I = n.apply(g, m);
11328
- return a && a(I), v(I);
11327
+ var P = n.apply(g, m);
11328
+ return a && a(P), v(P);
11329
11329
  }
11330
11330
  l.push({
11331
11331
  resolve: v,
@@ -12741,13 +12741,13 @@ function Ds(n, e, t, i) {
12741
12741
  // is provided. So we'll use the legacy SVC specification for now.
12742
12742
  // TODO: when we upstream libwebrtc, this will need additional verification
12743
12743
  at() || (S == null ? void 0 : S.name) === "Chrome" && Xe(S == null ? void 0 : S.version, "113") < 0) {
12744
- const k = g.suffix == "h" ? 2 : 3, I = tm(S);
12745
- for (let O = 0; O < g.spatial; O += 1)
12744
+ const k = g.suffix == "h" ? 2 : 3, P = tm(S);
12745
+ for (let M = 0; M < g.spatial; M += 1)
12746
12746
  v.push({
12747
- rid: Os[2 - O],
12748
- maxBitrate: o.maxBitrate / Math.pow(k, O),
12747
+ rid: Os[2 - M],
12748
+ maxBitrate: o.maxBitrate / Math.pow(k, M),
12749
12749
  maxFramerate: u.encoding.maxFramerate,
12750
- scaleResolutionDownBy: I ? Math.pow(2, O) : void 0
12750
+ scaleResolutionDownBy: P ? Math.pow(2, M) : void 0
12751
12751
  });
12752
12752
  v[0].scalabilityMode = c;
12753
12753
  } else
@@ -13305,7 +13305,7 @@ function Ra(n, e, t, i, s, r, o) {
13305
13305
  var g;
13306
13306
  let v = (g = h.rid) !== null && g !== void 0 ? g : "";
13307
13307
  v === "" && (v = "q");
13308
- const S = _d(v), k = t.find((I) => I.quality === S);
13308
+ const S = _d(v), k = t.find((P) => P.quality === S);
13309
13309
  k && h.active !== k.enabled && (l = !0, h.active = k.enabled, r.debug("setting layer ".concat(k.quality, " to ").concat(h.active ? "enabled" : "disabled"), o), Kt() && (k.enabled ? (h.scaleResolutionDownBy = e[m].scaleResolutionDownBy, h.maxBitrate = e[m].maxBitrate, h.maxFrameRate = e[m].maxFrameRate) : (h.scaleResolutionDownBy = 4, h.maxBitrate = 10, h.maxFrameRate = 2)));
13310
13310
  })), l && (c.encodings = d, r.debug("setting encodings", Object.assign(Object.assign({}, o), {
13311
13311
  encodings: c.encodings
@@ -13414,7 +13414,7 @@ class Ef extends ot.EventEmitter {
13414
13414
  this.reliableReceivedState.set(u.participantSid, u.sequence);
13415
13415
  }
13416
13416
  if (((s = u.value) === null || s === void 0 ? void 0 : s.case) === "speaker")
13417
- this.emit(M.ActiveSpeakersUpdate, u.value.value.speakers);
13417
+ this.emit(O.ActiveSpeakersUpdate, u.value.value.speakers);
13418
13418
  else if (((r = u.value) === null || r === void 0 ? void 0 : r.case) === "encryptedPacket") {
13419
13419
  if (!this.e2eeManager) {
13420
13420
  this.log.error("Received encrypted packet but E2EE not set up", this.logContext);
@@ -13425,9 +13425,9 @@ class Ef extends ot.EventEmitter {
13425
13425
  participantIdentity: u.participantIdentity,
13426
13426
  participantSid: u.participantSid
13427
13427
  });
13428
- ((a = g.value) === null || a === void 0 ? void 0 : a.case) === "user" && Oa(g, g.value.value), this.emit(M.DataPacketReceived, g, u.value.value.encryptionType);
13428
+ ((a = g.value) === null || a === void 0 ? void 0 : a.case) === "user" && Oa(g, g.value.value), this.emit(O.DataPacketReceived, g, u.value.value.encryptionType);
13429
13429
  } else
13430
- ((c = u.value) === null || c === void 0 ? void 0 : c.case) === "user" && Oa(u, u.value.value), this.emit(M.DataPacketReceived, u, le.NONE);
13430
+ ((c = u.value) === null || c === void 0 ? void 0 : c.case) === "user" && Oa(u, u.value.value), this.emit(O.DataPacketReceived, u, le.NONE);
13431
13431
  } finally {
13432
13432
  d();
13433
13433
  }
@@ -13452,7 +13452,7 @@ class Ef extends ot.EventEmitter {
13452
13452
  return;
13453
13453
  this.log.warn("".concat(i, " disconnected"), this.logContext), this.reconnectAttempts === 0 && (this.reconnectStart = Date.now());
13454
13454
  const r = (c) => {
13455
- this.log.warn("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(c, "ms. giving up"), this.logContext), this.emit(M.Disconnected), this.close();
13455
+ this.log.warn("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(c, "ms. giving up"), this.logContext), this.emit(O.Disconnected), this.close();
13456
13456
  }, o = Date.now() - this.reconnectStart;
13457
13457
  let a = this.getNextRetryDelay({
13458
13458
  elapsedMs: o,
@@ -13466,18 +13466,18 @@ class Ef extends ot.EventEmitter {
13466
13466
  }, this.waitForRestarted = () => new Promise((i, s) => {
13467
13467
  this.pcState === Fe.Connected && i();
13468
13468
  const r = () => {
13469
- this.off(M.Disconnected, o), i();
13469
+ this.off(O.Disconnected, o), i();
13470
13470
  }, o = () => {
13471
- this.off(M.Restarted, r), s();
13471
+ this.off(O.Restarted, r), s();
13472
13472
  };
13473
- this.once(M.Restarted, r), this.once(M.Disconnected, o);
13473
+ this.once(O.Restarted, r), this.once(O.Disconnected, o);
13474
13474
  }), this.updateAndEmitDCBufferStatus = (i) => {
13475
13475
  if (i === H.RELIABLE) {
13476
13476
  const r = this.dataChannelForKind(i);
13477
13477
  r && this.reliableMessageBuffer.alignBufferedAmount(r.bufferedAmount);
13478
13478
  }
13479
13479
  const s = this.isBufferStatusLow(i);
13480
- typeof s < "u" && s !== this.dcBufferStatus.get(i) && (this.dcBufferStatus.set(i, s), this.emit(M.DCBufferStatusChanged, s, i));
13480
+ typeof s < "u" && s !== this.dcBufferStatus.get(i) && (this.dcBufferStatus.set(i, s), this.emit(O.DCBufferStatusChanged, s, i));
13481
13481
  }, this.isBufferStatusLow = (i) => {
13482
13482
  const s = this.dataChannelForKind(i);
13483
13483
  if (s)
@@ -13504,7 +13504,7 @@ class Ef extends ot.EventEmitter {
13504
13504
  }), this.log = Ye((t = e.loggerName) !== null && t !== void 0 ? t : Ue.Engine), this.loggerOptions = {
13505
13505
  loggerName: e.loggerName,
13506
13506
  loggerContextCb: () => this.logContext
13507
- }, this.client = new or(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new Ee(), this.dataProcessLock = new Ee(), this.dcBufferStatus = /* @__PURE__ */ new Map([[H.LOSSY, !0], [H.RELIABLE, !0]]), this.client.onParticipantUpdate = (i) => this.emit(M.ParticipantUpdate, i), this.client.onConnectionQuality = (i) => this.emit(M.ConnectionQualityUpdate, i), this.client.onRoomUpdate = (i) => this.emit(M.RoomUpdate, i), this.client.onSubscriptionError = (i) => this.emit(M.SubscriptionError, i), this.client.onSubscriptionPermissionUpdate = (i) => this.emit(M.SubscriptionPermissionUpdate, i), this.client.onSpeakersChanged = (i) => this.emit(M.SpeakersChanged, i), this.client.onStreamStateUpdate = (i) => this.emit(M.StreamStateChanged, i), this.client.onRequestResponse = (i) => this.emit(M.SignalRequestResponse, i);
13507
+ }, this.client = new or(void 0, this.loggerOptions), this.client.signalLatency = this.options.expSignalLatency, this.reconnectPolicy = this.options.reconnectPolicy, this.closingLock = new Ee(), this.dataProcessLock = new Ee(), this.dcBufferStatus = /* @__PURE__ */ new Map([[H.LOSSY, !0], [H.RELIABLE, !0]]), this.client.onParticipantUpdate = (i) => this.emit(O.ParticipantUpdate, i), this.client.onConnectionQuality = (i) => this.emit(O.ConnectionQualityUpdate, i), this.client.onRoomUpdate = (i) => this.emit(O.RoomUpdate, i), this.client.onSubscriptionError = (i) => this.emit(O.SubscriptionError, i), this.client.onSubscriptionPermissionUpdate = (i) => this.emit(O.SubscriptionPermissionUpdate, i), this.client.onSpeakersChanged = (i) => this.emit(O.SpeakersChanged, i), this.client.onStreamStateUpdate = (i) => this.emit(O.StreamStateChanged, i), this.client.onRequestResponse = (i) => this.emit(O.SignalRequestResponse, i);
13508
13508
  }
13509
13509
  /** @internal */
13510
13510
  get logContext() {
@@ -13527,7 +13527,7 @@ class Ef extends ot.EventEmitter {
13527
13527
  const u = yield d.client.join(r, o, a, c, l);
13528
13528
  return d._isClosed = !1, d.latestJoinResponse = u, d.subscriberPrimary = u.subscriberPrimary, d.pcManager || (yield d.configure(u, !l)), (!d.subscriberPrimary || u.fastPublish) && d.negotiate().catch((h) => {
13529
13529
  W.error(h, d.logContext);
13530
- }), d.registerOnLineListener(), d.clientConfiguration = u.clientConfiguration, d.emit(M.SignalConnected, u), u;
13530
+ }), d.registerOnLineListener(), d.clientConfiguration = u.clientConfiguration, d.emit(O.SignalConnected, u), u;
13531
13531
  } catch (u) {
13532
13532
  if (u instanceof j) {
13533
13533
  if (u.reason === ee.ServerUnreachable) {
@@ -13549,7 +13549,7 @@ class Ef extends ot.EventEmitter {
13549
13549
  return;
13550
13550
  }
13551
13551
  try {
13552
- this._isClosed = !0, this.joinAttempts = 0, this.emit(M.Closing), this.removeAllListeners(), this.deregisterOnLineListener(), this.clearPendingReconnect(), this.cleanupLossyDataStats(), yield this.cleanupPeerConnections(), yield this.cleanupClient();
13552
+ this._isClosed = !0, this.joinAttempts = 0, this.emit(O.Closing), this.removeAllListeners(), this.deregisterOnLineListener(), this.clearPendingReconnect(), this.cleanupLossyDataStats(), yield this.cleanupPeerConnections(), yield this.cleanupClient();
13553
13553
  } finally {
13554
13554
  e();
13555
13555
  }
@@ -13636,19 +13636,19 @@ class Ef extends ot.EventEmitter {
13636
13636
  return;
13637
13637
  this.participantSid = (i = e.participant) === null || i === void 0 ? void 0 : i.sid;
13638
13638
  const r = this.makeRTCConfiguration(e);
13639
- this.pcManager = new Zm(r, t ? "publisher-only" : e.subscriberPrimary ? "subscriber-primary" : "publisher-primary", this.loggerOptions), this.emit(M.TransportsCreated, this.pcManager.publisher, this.pcManager.subscriber), this.pcManager.onIceCandidate = (o, a) => {
13639
+ this.pcManager = new Zm(r, t ? "publisher-only" : e.subscriberPrimary ? "subscriber-primary" : "publisher-primary", this.loggerOptions), this.emit(O.TransportsCreated, this.pcManager.publisher, this.pcManager.subscriber), this.pcManager.onIceCandidate = (o, a) => {
13640
13640
  this.client.sendIceCandidate(o, a);
13641
13641
  }, this.pcManager.onPublisherOffer = (o, a) => {
13642
13642
  this.client.sendOffer(o, a);
13643
13643
  }, this.pcManager.onDataChannel = this.handleDataChannel, this.pcManager.onStateChange = (o, a, c) => f(this, void 0, void 0, function* () {
13644
13644
  if (this.log.debug("primary PC state changed ".concat(o), this.logContext), ["closed", "disconnected", "failed"].includes(a) && (this.publisherConnectionPromise = void 0), o === ae.CONNECTED) {
13645
13645
  const u = this.pcState === Fe.New;
13646
- this.pcState = Fe.Connected, u && this.emit(M.Connected, e);
13646
+ this.pcState = Fe.Connected, u && this.emit(O.Connected, e);
13647
13647
  } else o === ae.FAILED && (this.pcState === Fe.Connected || this.pcState === Fe.Reconnecting) && (this.pcState = Fe.Disconnected, this.handleDisconnect("peerconnection failed", c === "failed" ? xt.RR_SUBSCRIBER_FAILED : xt.RR_PUBLISHER_FAILED));
13648
13648
  const d = this.client.isDisconnected || this.client.currentState === te.RECONNECTING, l = [ae.FAILED, ae.CLOSING, ae.CLOSED].includes(o);
13649
- d && l && !this._isClosed && this.emit(M.Offline);
13649
+ d && l && !this._isClosed && this.emit(O.Offline);
13650
13650
  }), this.pcManager.onTrack = (o) => {
13651
- o.streams.length !== 0 && this.emit(M.MediaTrackAdded, o.track, o.streams[0], o.receiver);
13651
+ o.streams.length !== 0 && this.emit(O.MediaTrackAdded, o.track, o.streams[0], o.receiver);
13652
13652
  }, wf((s = e.serverInfo) === null || s === void 0 ? void 0 : s.protocol) || this.createDataChannels();
13653
13653
  });
13654
13654
  }
@@ -13686,19 +13686,19 @@ class Ef extends ot.EventEmitter {
13686
13686
  } = this.pendingTrackResolvers[e.cid];
13687
13687
  delete this.pendingTrackResolvers[e.cid], i(e.track);
13688
13688
  }, this.client.onLocalTrackUnpublished = (e) => {
13689
- this.emit(M.LocalTrackUnpublished, e);
13689
+ this.emit(O.LocalTrackUnpublished, e);
13690
13690
  }, this.client.onLocalTrackSubscribed = (e) => {
13691
- this.emit(M.LocalTrackSubscribed, e);
13691
+ this.emit(O.LocalTrackSubscribed, e);
13692
13692
  }, this.client.onTokenRefresh = (e) => {
13693
13693
  var t;
13694
13694
  this.token = e, (t = this.regionUrlProvider) === null || t === void 0 || t.updateToken(e);
13695
13695
  }, this.client.onRemoteMuteChanged = (e, t) => {
13696
- this.emit(M.RemoteMute, e, t);
13696
+ this.emit(O.RemoteMute, e, t);
13697
13697
  }, this.client.onSubscribedQualityUpdate = (e) => {
13698
- this.emit(M.SubscribedQualityUpdate, e);
13698
+ this.emit(O.SubscribedQualityUpdate, e);
13699
13699
  }, this.client.onRoomMoved = (e) => {
13700
13700
  var t;
13701
- this.participantSid = (t = e.participant) === null || t === void 0 ? void 0 : t.sid, this.latestJoinResponse && (this.latestJoinResponse.room = e.room), this.emit(M.RoomMoved, e);
13701
+ this.participantSid = (t = e.participant) === null || t === void 0 ? void 0 : t.sid, this.latestJoinResponse && (this.latestJoinResponse.room = e.room), this.emit(O.RoomMoved, e);
13702
13702
  }, this.client.onMediaSectionsRequirement = (e) => {
13703
13703
  var t, i;
13704
13704
  const s = {
@@ -13720,7 +13720,7 @@ class Ef extends ot.EventEmitter {
13720
13720
  regionSettings: e.regions
13721
13721
  })), e.action) {
13722
13722
  case Xt.DISCONNECT:
13723
- this.emit(M.Disconnected, e == null ? void 0 : e.reason), this.close();
13723
+ this.emit(O.Disconnected, e == null ? void 0 : e.reason), this.close();
13724
13724
  break;
13725
13725
  case Xt.RECONNECT:
13726
13726
  this.fullReconnectOnNext = !0, this.handleDisconnect(ts);
@@ -13828,7 +13828,7 @@ class Ef extends ot.EventEmitter {
13828
13828
  let o = !0;
13829
13829
  r instanceof ce ? (this.log.debug("received unrecoverable error", Object.assign(Object.assign({}, this.logContext), {
13830
13830
  error: r
13831
- })), o = !1) : r instanceof At || (this.fullReconnectOnNext = !0), o ? this.handleDisconnect("reconnect", xt.RR_UNKNOWN) : (this.log.info("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(Date.now() - this.reconnectStart, "ms. giving up"), this.logContext), this.emit(M.Disconnected), yield this.close());
13831
+ })), o = !1) : r instanceof At || (this.fullReconnectOnNext = !0), o ? this.handleDisconnect("reconnect", xt.RR_UNKNOWN) : (this.log.info("could not recover connection after ".concat(this.reconnectAttempts, " attempts, ").concat(Date.now() - this.reconnectStart, "ms. giving up"), this.logContext), this.emit(O.Disconnected), yield this.close());
13832
13832
  } finally {
13833
13833
  this.attemptingReconnect = !1;
13834
13834
  }
@@ -13851,7 +13851,7 @@ class Ef extends ot.EventEmitter {
13851
13851
  try {
13852
13852
  if (!this.url || !this.token)
13853
13853
  throw new ce("could not reconnect, url or token not saved");
13854
- this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts), this.logContext), this.emit(M.Restarting), this.client.isDisconnected || (yield this.client.sendLeave()), yield this.cleanupPeerConnections(), yield this.cleanupClient();
13854
+ this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts), this.logContext), this.emit(O.Restarting), this.client.isDisconnected || (yield this.client.sendLeave()), yield this.cleanupPeerConnections(), yield this.cleanupClient();
13855
13855
  let r;
13856
13856
  try {
13857
13857
  if (!this.signalOpts)
@@ -13862,9 +13862,9 @@ class Ef extends ot.EventEmitter {
13862
13862
  }
13863
13863
  if (this.shouldFailNext)
13864
13864
  throw this.shouldFailNext = !1, new Error("simulated failure");
13865
- if (this.client.setReconnected(), this.emit(M.SignalRestarted, r), yield this.waitForPCReconnected(), this.client.currentState !== te.CONNECTED)
13865
+ if (this.client.setReconnected(), this.emit(O.SignalRestarted, r), yield this.waitForPCReconnected(), this.client.currentState !== te.CONNECTED)
13866
13866
  throw new At("Signal connection got severed during reconnect");
13867
- (t = this.regionUrlProvider) === null || t === void 0 || t.resetAttempts(), this.emit(M.Restarted);
13867
+ (t = this.regionUrlProvider) === null || t === void 0 || t.resetAttempts(), this.emit(O.Restarted);
13868
13868
  } catch (r) {
13869
13869
  const o = yield (i = this.regionUrlProvider) === null || i === void 0 ? void 0 : i.getNextBestRegionUrl();
13870
13870
  if (o) {
@@ -13882,7 +13882,7 @@ class Ef extends ot.EventEmitter {
13882
13882
  throw new ce("could not reconnect, url or token not saved");
13883
13883
  if (!this.pcManager)
13884
13884
  throw new ce("publisher and subscriber connections unset");
13885
- this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts), this.logContext), this.emit(M.Resuming);
13885
+ this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts), this.logContext), this.emit(O.Resuming);
13886
13886
  let i;
13887
13887
  try {
13888
13888
  this.setupSignalClientCallbacks(), i = yield this.client.reconnect(this.url, this.token, this.participantSid, e);
@@ -13892,7 +13892,7 @@ class Ef extends ot.EventEmitter {
13892
13892
  error: s
13893
13893
  }))), s instanceof j && s.reason === ee.NotAllowed ? new ce("could not reconnect, token might be expired") : s instanceof j && s.reason === ee.LeaveRequest ? s : new At(r);
13894
13894
  }
13895
- if (this.emit(M.SignalResumed), i) {
13895
+ if (this.emit(O.SignalResumed), i) {
13896
13896
  const s = this.makeRTCConfiguration(i);
13897
13897
  this.pcManager.updateConfiguration(s), this.latestJoinResponse && (this.latestJoinResponse.serverInfo = i.serverInfo);
13898
13898
  } else
@@ -13901,7 +13901,7 @@ class Ef extends ot.EventEmitter {
13901
13901
  throw this.shouldFailNext = !1, new Error("simulated failure");
13902
13902
  if (yield this.pcManager.triggerIceRestart(), yield this.waitForPCReconnected(), this.client.currentState !== te.CONNECTED)
13903
13903
  throw new At("Signal connection got severed during reconnect");
13904
- this.client.setReconnected(), ((t = this.reliableDC) === null || t === void 0 ? void 0 : t.readyState) === "open" && this.reliableDC.id === null && this.createDataChannels(), i != null && i.lastMessageSeq && this.resendReliableMessagesForResume(i.lastMessageSeq), this.emit(M.Resumed);
13904
+ this.client.setReconnected(), ((t = this.reliableDC) === null || t === void 0 ? void 0 : t.readyState) === "open" && this.reliableDC.id === null && this.createDataChannels(), i != null && i.lastMessageSeq && this.resendReliableMessagesForResume(i.lastMessageSeq), this.emit(O.Resumed);
13905
13905
  });
13906
13906
  }
13907
13907
  waitForPCInitialConnection(e, t) {
@@ -14016,9 +14016,9 @@ class Ef extends ot.EventEmitter {
14016
14016
  t();
14017
14017
  else {
14018
14018
  const s = () => i(new ce("engine closed"));
14019
- for (this.once(M.Closing, s); !this.dcBufferStatus.get(e); )
14019
+ for (this.once(O.Closing, s); !this.dcBufferStatus.get(e); )
14020
14020
  yield Ce(10);
14021
- this.off(M.Closing, s), t();
14021
+ this.off(O.Closing, s), t();
14022
14022
  }
14023
14023
  }));
14024
14024
  }
@@ -14074,12 +14074,12 @@ class Ef extends ot.EventEmitter {
14074
14074
  const i = new AbortController(), s = () => {
14075
14075
  i.abort(), this.log.debug("engine disconnected while negotiation was ongoing", this.logContext), e();
14076
14076
  };
14077
- this.isClosed && t(new Rt("cannot negotiate on closed engine")), this.on(M.Closing, s), this.on(M.Restarting, s), this.pcManager.publisher.once(Vt.RTPVideoPayloadTypes, (r) => {
14077
+ this.isClosed && t(new Rt("cannot negotiate on closed engine")), this.on(O.Closing, s), this.on(O.Restarting, s), this.pcManager.publisher.once(Vt.RTPVideoPayloadTypes, (r) => {
14078
14078
  const o = /* @__PURE__ */ new Map();
14079
14079
  r.forEach((a) => {
14080
14080
  const c = a.codec.toLowerCase();
14081
14081
  dd(c) && o.set(a.payload, c);
14082
- }), this.emit(M.RTPVideoMapUpdate, o);
14082
+ }), this.emit(O.RTPVideoMapUpdate, o);
14083
14083
  });
14084
14084
  try {
14085
14085
  yield this.pcManager.negotiate(i), e();
@@ -14090,7 +14090,7 @@ class Ef extends ot.EventEmitter {
14090
14090
  }
14091
14091
  r instanceof Rt && (this.fullReconnectOnNext = !0), this.handleDisconnect("negotiation", xt.RR_UNKNOWN), r instanceof Error ? t(r) : t(new Error(String(r)));
14092
14092
  } finally {
14093
- this.off(M.Closing, s), this.off(M.Restarting, s);
14093
+ this.off(O.Closing, s), this.off(O.Restarting, s);
14094
14094
  }
14095
14095
  }));
14096
14096
  });
@@ -14676,14 +14676,14 @@ class Of {
14676
14676
  content: S,
14677
14677
  streamId: r,
14678
14678
  chunkIndex: Lt(l)
14679
- }), I = new Ie({
14679
+ }), P = new Ie({
14680
14680
  destinationIdentities: c,
14681
14681
  value: {
14682
14682
  case: "streamChunk",
14683
14683
  value: k
14684
14684
  }
14685
14685
  });
14686
- yield u.sendDataPacket(I, H.RELIABLE), l += 1;
14686
+ yield u.sendDataPacket(P, H.RELIABLE), l += 1;
14687
14687
  }
14688
14688
  });
14689
14689
  },
@@ -14708,8 +14708,8 @@ class Of {
14708
14708
  let m = () => f(this, void 0, void 0, function* () {
14709
14709
  yield g.close();
14710
14710
  });
14711
- u.once(M.Closing, m);
14712
- const g = new If(h, o, () => this.engine.off(M.Closing, m));
14711
+ u.once(O.Closing, m);
14712
+ const g = new If(h, o, () => this.engine.off(O.Closing, m));
14713
14713
  return g;
14714
14714
  });
14715
14715
  }
@@ -14779,13 +14779,13 @@ class Of {
14779
14779
  yield this.engine.sendDataPacket(h, H.RELIABLE);
14780
14780
  let m = 0;
14781
14781
  const g = new Ee(), v = this.engine, S = this.log, k = new WritableStream({
14782
- write(O) {
14782
+ write(M) {
14783
14783
  return f(this, void 0, void 0, function* () {
14784
14784
  const y = yield g.lock();
14785
14785
  let b = 0;
14786
14786
  try {
14787
- for (; b < O.byteLength; ) {
14788
- const T = O.slice(b, b + Da), A = new Ie({
14787
+ for (; b < M.byteLength; ) {
14788
+ const T = M.slice(b, b + Da), A = new Ie({
14789
14789
  destinationIdentities: d,
14790
14790
  value: {
14791
14791
  case: "streamChunk",
@@ -14805,20 +14805,20 @@ class Of {
14805
14805
  },
14806
14806
  close() {
14807
14807
  return f(this, void 0, void 0, function* () {
14808
- const O = new pi({
14808
+ const M = new pi({
14809
14809
  streamId: c
14810
14810
  }), y = new Ie({
14811
14811
  destinationIdentities: d,
14812
14812
  value: {
14813
14813
  case: "streamTrailer",
14814
- value: O
14814
+ value: M
14815
14815
  }
14816
14816
  });
14817
14817
  yield v.sendDataPacket(y, H.RELIABLE);
14818
14818
  });
14819
14819
  },
14820
- abort(O) {
14821
- S.error("Sink error:", O);
14820
+ abort(M) {
14821
+ S.error("Sink error:", M);
14822
14822
  }
14823
14823
  });
14824
14824
  return new Mf(k, l);
@@ -15412,8 +15412,8 @@ function qn(n, e) {
15412
15412
  v != null && v.deviceId && jt(v.deviceId) !== k ? v.deviceId = k : v || (v = {
15413
15413
  deviceId: k
15414
15414
  });
15415
- const I = cf(h, v, e);
15416
- return I.kind === C.Kind.Video ? I.source = C.Source.Camera : I.kind === C.Kind.Audio && (I.source = C.Source.Microphone), I.mediaStream = u, Qe(I) && i ? yield I.setProcessor(i) : yt(I) && s && (yield I.setProcessor(s)), I;
15415
+ const P = cf(h, v, e);
15416
+ return P.kind === C.Kind.Video ? P.source = C.Source.Camera : P.kind === C.Kind.Audio && (P.source = C.Source.Microphone), P.mediaStream = u, Qe(P) && i ? yield P.setProcessor(i) : yt(P) && s && (yield P.setProcessor(s)), P;
15417
15417
  })));
15418
15418
  } catch (u) {
15419
15419
  if (!t)
@@ -15718,12 +15718,12 @@ class xd extends vr {
15718
15718
  try {
15719
15719
  for (var v = !0, S = ft(g), k; k = yield S.next(), c = k.done, !c; v = !0) {
15720
15720
  u = k.value, v = !1;
15721
- const I = u;
15722
- Yc(I) && (this.log.debug("publish ".concat(I, " for ").concat(m.videoTrack.sid), Object.assign(Object.assign({}, this.logContext), J(m))), yield this.publishAdditionalCodecForTrack(m.videoTrack, I, m.options));
15721
+ const P = u;
15722
+ Yc(P) && (this.log.debug("publish ".concat(P, " for ").concat(m.videoTrack.sid), Object.assign(Object.assign({}, this.logContext), J(m))), yield this.publishAdditionalCodecForTrack(m.videoTrack, P, m.options));
15723
15723
  }
15724
- } catch (I) {
15724
+ } catch (P) {
15725
15725
  d = {
15726
- error: I
15726
+ error: P
15727
15727
  };
15728
15728
  } finally {
15729
15729
  try {
@@ -15793,10 +15793,10 @@ class xd extends vr {
15793
15793
  */
15794
15794
  setupEngine(e) {
15795
15795
  var t;
15796
- this.engine = e, this.engine.on(M.RemoteMute, (i, s) => {
15796
+ this.engine = e, this.engine.on(O.RemoteMute, (i, s) => {
15797
15797
  const r = this.trackPublications.get(i);
15798
15798
  !r || !r.track || (s ? r.mute() : r.unmute());
15799
- }), !((t = this.signalConnectedFuture) === null || t === void 0) && t.isResolved && (this.signalConnectedFuture = void 0), this.engine.on(M.Connected, this.handleReconnected).on(M.SignalConnected, this.handleSignalConnected).on(M.SignalRestarted, this.handleReconnected).on(M.SignalResumed, this.handleReconnected).on(M.Restarting, this.handleReconnecting).on(M.Resuming, this.handleReconnecting).on(M.LocalTrackUnpublished, this.handleLocalTrackUnpublished).on(M.SubscribedQualityUpdate, this.handleSubscribedQualityUpdate).on(M.Closing, this.handleClosing).on(M.SignalRequestResponse, this.handleSignalRequestResponse).on(M.DataPacketReceived, this.handleDataPacket);
15799
+ }), !((t = this.signalConnectedFuture) === null || t === void 0) && t.isResolved && (this.signalConnectedFuture = void 0), this.engine.on(O.Connected, this.handleReconnected).on(O.SignalConnected, this.handleSignalConnected).on(O.SignalRestarted, this.handleReconnected).on(O.SignalResumed, this.handleReconnected).on(O.Restarting, this.handleReconnecting).on(O.Resuming, this.handleReconnecting).on(O.LocalTrackUnpublished, this.handleLocalTrackUnpublished).on(O.SubscribedQualityUpdate, this.handleSubscribedQualityUpdate).on(O.Closing, this.handleClosing).on(O.SignalRequestResponse, this.handleSignalRequestResponse).on(O.DataPacketReceived, this.handleDataPacket);
15800
15800
  }
15801
15801
  /**
15802
15802
  * Sets and updates the metadata of the local participant.
@@ -16116,29 +16116,29 @@ class xd extends vr {
16116
16116
  const m = Object.assign(Object.assign({}, r.roomOptions.publishDefaults), s), g = "channelCount" in i.mediaStreamTrack.getSettings() && // @ts-ignore `channelCount` on getSettings() is currently only available for Safari, but is generally the best way to determine a stereo track https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/channelCount
16117
16117
  i.mediaStreamTrack.getSettings().channelCount === 2 || i.mediaStreamTrack.getConstraints().channelCount === 2, v = (c = m.forceStereo) !== null && c !== void 0 ? c : g;
16118
16118
  v && (m.dtx === void 0 && r.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.", Object.assign(Object.assign({}, r.logContext), J(i))), m.red === void 0 && r.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."), (d = m.dtx) !== null && d !== void 0 || (m.dtx = !1), (l = m.red) !== null && l !== void 0 || (m.red = !1)), !nm() && r.roomOptions.e2ee && (r.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2", Object.assign({}, r.logContext)), m.simulcast = !1), m.source && (i.source = m.source);
16119
- const S = new Promise((k, I) => f(r, void 0, void 0, function* () {
16119
+ const S = new Promise((k, P) => f(r, void 0, void 0, function* () {
16120
16120
  try {
16121
16121
  if (this.engine.client.currentState !== te.CONNECTED) {
16122
16122
  this.log.debug("deferring track publication until signal is connected", Object.assign(Object.assign({}, this.logContext), {
16123
16123
  track: J(i)
16124
16124
  }));
16125
- let O = !1;
16125
+ let M = !1;
16126
16126
  const y = setTimeout(() => {
16127
- O = !0, i.stop(), I(new Ts("publishing rejected as engine not connected within timeout", 408));
16127
+ M = !0, i.stop(), P(new Ts("publishing rejected as engine not connected within timeout", 408));
16128
16128
  }, 15e3);
16129
- if (yield this.waitUntilEngineConnected(), clearTimeout(y), O)
16129
+ if (yield this.waitUntilEngineConnected(), clearTimeout(y), M)
16130
16130
  return;
16131
16131
  const b = yield this.publish(i, m, v);
16132
16132
  k(b);
16133
16133
  } else
16134
16134
  try {
16135
- const O = yield this.publish(i, m, v);
16136
- k(O);
16137
- } catch (O) {
16138
- I(O);
16135
+ const M = yield this.publish(i, m, v);
16136
+ k(M);
16137
+ } catch (M) {
16138
+ P(M);
16139
16139
  }
16140
- } catch (O) {
16141
- I(O);
16140
+ } catch (M) {
16141
+ P(M);
16142
16142
  }
16143
16143
  }));
16144
16144
  r.pendingPublishPromises.set(i, S);
@@ -16169,12 +16169,12 @@ class xd extends vr {
16169
16169
  var s, r, o, a, c, d, l, u, h, m;
16170
16170
  if (!this.hasPermissionsToPublish(e))
16171
16171
  throw new Ts("failed to publish track, insufficient permissions", 403);
16172
- Array.from(this.trackPublications.values()).find((P) => Pt(e) && P.source === e.source) && e.source !== C.Source.Unknown && this.log.info("publishing a second track with the same source: ".concat(e.source), Object.assign(Object.assign({}, this.logContext), J(e))), t.stopMicTrackOnMute && Qe(e) && (e.stopOnMute = !0), e.source === C.Source.ScreenShare && Kt() && (t.simulcast = !1), t.videoCodec === "av1" && !nd() && (t.videoCodec = void 0), t.videoCodec === "vp9" && !id() && (t.videoCodec = void 0), t.videoCodec === void 0 && (t.videoCodec = Ms), this.enabledPublishVideoCodecs.length > 0 && (this.enabledPublishVideoCodecs.some((P) => t.videoCodec === wn(P.mime)) || (t.videoCodec = wn(this.enabledPublishVideoCodecs[0].mime)));
16172
+ Array.from(this.trackPublications.values()).find((I) => Pt(e) && I.source === e.source) && e.source !== C.Source.Unknown && this.log.info("publishing a second track with the same source: ".concat(e.source), Object.assign(Object.assign({}, this.logContext), J(e))), t.stopMicTrackOnMute && Qe(e) && (e.stopOnMute = !0), e.source === C.Source.ScreenShare && Kt() && (t.simulcast = !1), t.videoCodec === "av1" && !nd() && (t.videoCodec = void 0), t.videoCodec === "vp9" && !id() && (t.videoCodec = void 0), t.videoCodec === void 0 && (t.videoCodec = Ms), this.enabledPublishVideoCodecs.length > 0 && (this.enabledPublishVideoCodecs.some((I) => t.videoCodec === wn(I.mime)) || (t.videoCodec = wn(this.enabledPublishVideoCodecs[0].mime)));
16173
16173
  const v = t.videoCodec;
16174
16174
  e.on(R.Muted, this.onTrackMuted), e.on(R.Unmuted, this.onTrackUnmuted), e.on(R.Ended, this.handleTrackEnded), e.on(R.UpstreamPaused, this.onTrackUpstreamPaused), e.on(R.UpstreamResumed, this.onTrackUpstreamResumed), e.on(R.AudioTrackFeatureUpdate, this.onTrackFeatureUpdate);
16175
- const S = [], k = !(!((s = t.dtx) !== null && s !== void 0) || s), I = e.getSourceTrackSettings();
16176
- I.autoGainControl && S.push(be.TF_AUTO_GAIN_CONTROL), I.echoCancellation && S.push(be.TF_ECHO_CANCELLATION), I.noiseSuppression && S.push(be.TF_NOISE_SUPPRESSION), I.channelCount && I.channelCount > 1 && S.push(be.TF_STEREO), k && S.push(be.TF_NO_DTX), dt(e) && e.hasPreConnectBuffer && S.push(be.TF_PRECONNECT_BUFFER);
16177
- const O = new xn({
16175
+ const S = [], k = !(!((s = t.dtx) !== null && s !== void 0) || s), P = e.getSourceTrackSettings();
16176
+ P.autoGainControl && S.push(be.TF_AUTO_GAIN_CONTROL), P.echoCancellation && S.push(be.TF_ECHO_CANCELLATION), P.noiseSuppression && S.push(be.TF_NOISE_SUPPRESSION), P.channelCount && P.channelCount > 1 && S.push(be.TF_STEREO), k && S.push(be.TF_NO_DTX), dt(e) && e.hasPreConnectBuffer && S.push(be.TF_PRECONNECT_BUFFER);
16177
+ const M = new xn({
16178
16178
  // get local track id for use during publishing
16179
16179
  cid: e.mediaStreamTrack.id,
16180
16180
  name: t.name,
@@ -16191,31 +16191,31 @@ class xd extends vr {
16191
16191
  });
16192
16192
  let y;
16193
16193
  if (e.kind === C.Kind.Video) {
16194
- let P = {
16194
+ let I = {
16195
16195
  width: 0,
16196
16196
  height: 0
16197
16197
  };
16198
16198
  try {
16199
- P = yield e.waitForDimensions();
16199
+ I = yield e.waitForDimensions();
16200
16200
  } catch {
16201
16201
  const L = (a = (o = this.roomOptions.videoCaptureDefaults) === null || o === void 0 ? void 0 : o.resolution) !== null && a !== void 0 ? a : rn.h720.resolution;
16202
- P = {
16202
+ I = {
16203
16203
  width: L.width,
16204
16204
  height: L.height
16205
16205
  }, this.log.error("could not determine track dimensions, using defaults", Object.assign(Object.assign(Object.assign({}, this.logContext), J(e)), {
16206
- dims: P
16206
+ dims: I
16207
16207
  }));
16208
16208
  }
16209
- O.width = P.width, O.height = P.height, Tt(e) && ($e(v) && (e.source === C.Source.ScreenShare && (t.scalabilityMode = "L1T3", "contentHint" in e.mediaStreamTrack && (e.mediaStreamTrack.contentHint = "motion", this.log.info("forcing contentHint to motion for screenshare with SVC codecs", Object.assign(Object.assign({}, this.logContext), J(e))))), t.scalabilityMode = (c = t.scalabilityMode) !== null && c !== void 0 ? c : "L3T3_KEY"), O.simulcastCodecs = [new us({
16209
+ M.width = I.width, M.height = I.height, Tt(e) && ($e(v) && (e.source === C.Source.ScreenShare && (t.scalabilityMode = "L1T3", "contentHint" in e.mediaStreamTrack && (e.mediaStreamTrack.contentHint = "motion", this.log.info("forcing contentHint to motion for screenshare with SVC codecs", Object.assign(Object.assign({}, this.logContext), J(e))))), t.scalabilityMode = (c = t.scalabilityMode) !== null && c !== void 0 ? c : "L3T3_KEY"), M.simulcastCodecs = [new us({
16210
16210
  codec: v,
16211
16211
  cid: e.mediaStreamTrack.id
16212
16212
  })], t.backupCodec === !0 && (t.backupCodec = {
16213
16213
  codec: Ms
16214
16214
  }), t.backupCodec && v !== t.backupCodec.codec && // TODO remove this once e2ee is supported for backup codecs
16215
- O.encryption === le.NONE && (this.roomOptions.dynacast || (this.roomOptions.dynacast = !0), O.simulcastCodecs.push(new us({
16215
+ M.encryption === le.NONE && (this.roomOptions.dynacast || (this.roomOptions.dynacast = !0), M.simulcastCodecs.push(new us({
16216
16216
  codec: t.backupCodec.codec,
16217
16217
  cid: ""
16218
- })))), y = Ds(e.source === C.Source.ScreenShare, O.width, O.height, t), O.layers = Pa(O.width, O.height, y, $e(t.videoCodec));
16218
+ })))), y = Ds(e.source === C.Source.ScreenShare, M.width, M.height, t), M.layers = Pa(M.width, M.height, y, $e(t.videoCodec));
16219
16219
  } else e.kind === C.Kind.Audio && (y = [{
16220
16220
  maxBitrate: (d = t.audioPreset) === null || d === void 0 ? void 0 : d.maxBitrate,
16221
16221
  priority: (u = (l = t.audioPreset) === null || l === void 0 ? void 0 : l.priority) !== null && u !== void 0 ? u : "high",
@@ -16224,10 +16224,10 @@ class xd extends vr {
16224
16224
  if (!this.engine || this.engine.isClosed)
16225
16225
  throw new ce("cannot publish track when not connected");
16226
16226
  const b = () => f(this, void 0, void 0, function* () {
16227
- var P, x, L;
16227
+ var I, x, L;
16228
16228
  if (!this.engine.pcManager)
16229
16229
  throw new ce("pcManager is not ready");
16230
- if (e.sender = yield this.engine.createSender(e, t, y), this.emit(D.LocalSenderCreated, e.sender, e), Tt(e) && ((P = t.degradationPreference) !== null && P !== void 0 || (t.degradationPreference = yf(e)), e.setDegradationPreference(t.degradationPreference)), y)
16230
+ if (e.sender = yield this.engine.createSender(e, t, y), this.emit(D.LocalSenderCreated, e.sender, e), Tt(e) && ((I = t.degradationPreference) !== null && I !== void 0 || (t.degradationPreference = yf(e)), e.setDegradationPreference(t.degradationPreference)), y)
16231
16231
  if (Kt() && e.kind === C.Kind.Audio) {
16232
16232
  let q;
16233
16233
  for (const X of this.engine.pcManager.publisher.getTransceivers())
@@ -16241,17 +16241,17 @@ class xd extends vr {
16241
16241
  maxbr: !((x = y[0]) === null || x === void 0) && x.maxBitrate ? y[0].maxBitrate / 1e3 : 0
16242
16242
  });
16243
16243
  } else e.codec && $e(e.codec) && (!((L = y[0]) === null || L === void 0) && L.maxBitrate) && this.engine.pcManager.publisher.setTrackCodecBitrate({
16244
- cid: O.cid,
16244
+ cid: M.cid,
16245
16245
  codec: e.codec,
16246
16246
  maxbr: y[0].maxBitrate / 1e3
16247
16247
  });
16248
16248
  yield this.engine.negotiate();
16249
16249
  });
16250
16250
  let T;
16251
- const A = new Promise((P, x) => f(this, void 0, void 0, function* () {
16251
+ const A = new Promise((I, x) => f(this, void 0, void 0, function* () {
16252
16252
  var L;
16253
16253
  try {
16254
- T = yield this.engine.addTrack(O), P(T);
16254
+ T = yield this.engine.addTrack(M), I(T);
16255
16255
  } catch (q) {
16256
16256
  e.sender && (!((L = this.engine.pcManager) === null || L === void 0) && L.publisher) && (this.engine.pcManager.publisher.removeTrack(e.sender), yield this.engine.negotiate().catch((X) => {
16257
16257
  this.log.error("failed to negotiate after removing track due to failed add track request", Object.assign(Object.assign(Object.assign({}, this.logContext), J(e)), {
@@ -16264,14 +16264,14 @@ class xd extends vr {
16264
16264
  T = (yield Promise.all([A, b()]))[0];
16265
16265
  else {
16266
16266
  T = yield A;
16267
- let P;
16267
+ let I;
16268
16268
  if (T.codecs.forEach((x) => {
16269
- P === void 0 && (P = x.mimeType);
16270
- }), P && e.kind === C.Kind.Video) {
16271
- const x = wn(P);
16269
+ I === void 0 && (I = x.mimeType);
16270
+ }), I && e.kind === C.Kind.Video) {
16271
+ const x = wn(I);
16272
16272
  x !== v && (this.log.debug("falling back to server selected codec", Object.assign(Object.assign(Object.assign({}, this.logContext), J(e)), {
16273
16273
  codec: x
16274
- })), t.videoCodec = x, y = Ds(e.source === C.Source.ScreenShare, O.width, O.height, t));
16274
+ })), t.videoCodec = x, y = Ds(e.source === C.Source.ScreenShare, M.width, M.height, t));
16275
16275
  }
16276
16276
  yield b();
16277
16277
  }
@@ -16279,11 +16279,11 @@ class xd extends vr {
16279
16279
  loggerName: this.roomOptions.loggerName,
16280
16280
  loggerContextCb: () => this.logContext
16281
16281
  });
16282
- if (U.on(R.CpuConstrained, (P) => this.onTrackCpuConstrained(P, U)), U.options = t, e.sid = T.sid, this.log.debug("publishing ".concat(e.kind, " with encodings"), Object.assign(Object.assign({}, this.logContext), {
16282
+ if (U.on(R.CpuConstrained, (I) => this.onTrackCpuConstrained(I, U)), U.options = t, e.sid = T.sid, this.log.debug("publishing ".concat(e.kind, " with encodings"), Object.assign(Object.assign({}, this.logContext), {
16283
16283
  encodings: y,
16284
16284
  trackInfo: T
16285
16285
  })), Tt(e) ? e.startMonitor(this.engine.client) : dt(e) && e.startMonitor(), this.addTrackPublication(U), this.emit(D.LocalTrackPublished, U), dt(e) && T.audioFeatures.includes(be.TF_PRECONNECT_BUFFER)) {
16286
- const P = e.getPreConnectBuffer(), x = e.getPreConnectBufferMimeType();
16286
+ const I = e.getPreConnectBuffer(), x = e.getPreConnectBufferMimeType();
16287
16287
  this.on(D.LocalTrackSubscribed, (L) => {
16288
16288
  if (L.trackSid === T.sid) {
16289
16289
  if (!e.hasPreConnectBuffer) {
@@ -16292,7 +16292,7 @@ class xd extends vr {
16292
16292
  }
16293
16293
  this.log.debug("finished recording preconnect buffer", Object.assign(Object.assign({}, this.logContext), J(e))), e.stopPreConnectBuffer();
16294
16294
  }
16295
- }), P && new Promise((q, X) => f(this, void 0, void 0, function* () {
16295
+ }), I && new Promise((q, X) => f(this, void 0, void 0, function* () {
16296
16296
  var w, N, F, K, Q, Z;
16297
16297
  try {
16298
16298
  this.log.debug("waiting for agent", Object.assign(Object.assign({}, this.logContext), J(e)));
@@ -16307,13 +16307,13 @@ class xd extends vr {
16307
16307
  destinationIdentities: [B.identity],
16308
16308
  attributes: {
16309
16309
  trackId: U.trackSid,
16310
- sampleRate: String((Q = I.sampleRate) !== null && Q !== void 0 ? Q : "48000"),
16311
- channels: String((Z = I.channelCount) !== null && Z !== void 0 ? Z : "1")
16310
+ sampleRate: String((Q = P.sampleRate) !== null && Q !== void 0 ? Q : "48000"),
16311
+ channels: String((Z = P.channelCount) !== null && Z !== void 0 ? Z : "1")
16312
16312
  }
16313
16313
  });
16314
16314
  try {
16315
- for (var fe = !0, Re = ft(P), Pe; Pe = yield Re.next(), w = Pe.done, !w; fe = !0) {
16316
- K = Pe.value, fe = !1;
16315
+ for (var pe = !0, Re = ft(I), Pe; Pe = yield Re.next(), w = Pe.done, !w; pe = !0) {
16316
+ K = Pe.value, pe = !1;
16317
16317
  const oe = K;
16318
16318
  yield V.write(oe);
16319
16319
  }
@@ -16323,7 +16323,7 @@ class xd extends vr {
16323
16323
  };
16324
16324
  } finally {
16325
16325
  try {
16326
- !fe && !w && (F = Re.return) && (yield F.call(Re));
16326
+ !pe && !w && (F = Re.return) && (yield F.call(Re));
16327
16327
  } finally {
16328
16328
  if (N) throw N.error;
16329
16329
  }
@@ -16635,8 +16635,8 @@ class xd extends vr {
16635
16635
  this.pendingResponses.delete(v), d(ie.builtIn("RESPONSE_TIMEOUT"));
16636
16636
  }, r);
16637
16637
  this.pendingResponses.set(v, {
16638
- resolve: (I, O) => {
16639
- clearTimeout(k), this.pendingAcks.has(v) && (this.log.warn("RPC response received before ack", v), this.pendingAcks.delete(v), clearTimeout(S)), O ? d(O) : c(I ?? "");
16638
+ resolve: (P, M) => {
16639
+ clearTimeout(k), this.pendingAcks.has(v) && (this.log.warn("RPC response received before ack", v), this.pendingAcks.delete(v), clearTimeout(S)), M ? d(M) : c(P ?? "");
16640
16640
  },
16641
16641
  participantIdentity: t
16642
16642
  });
@@ -17116,14 +17116,14 @@ class dn extends ot.EventEmitter {
17116
17116
  }));
17117
17117
  }));
17118
17118
  const h = (g, v, S) => f(this, void 0, void 0, function* () {
17119
- var k, I;
17119
+ var k, P;
17120
17120
  this.abortController && this.abortController.abort();
17121
- const O = new AbortController();
17122
- this.abortController = O, u == null || u();
17121
+ const M = new AbortController();
17122
+ this.abortController = M, u == null || u();
17123
17123
  try {
17124
- if (yield en.getInstance().getBackOffPromise(a), O.signal.aborted)
17124
+ if (yield en.getInstance().getBackOffPromise(a), M.signal.aborted)
17125
17125
  throw j.cancelled("Connection attempt aborted");
17126
- yield this.attemptConnection(S ?? a, c, d, O), this.abortController = void 0, g();
17126
+ yield this.attemptConnection(S ?? a, c, d, M), this.abortController = void 0, g();
17127
17127
  } catch (y) {
17128
17128
  if (this.regionUrlProvider && y instanceof j && y.reason !== ee.Cancelled && y.reason !== ee.NotAllowed) {
17129
17129
  let b = null;
@@ -17136,7 +17136,7 @@ class dn extends ot.EventEmitter {
17136
17136
  }
17137
17137
  }
17138
17138
  // making sure we only register failed attempts on things we actually care about
17139
- [ee.InternalError, ee.ServerUnreachable, ee.Timeout].includes(y.reason) && (this.log.debug("Adding failed connection attempt to back off"), en.getInstance().addFailedConnectionAttempt(a)), b && !(!((I = this.abortController) === null || I === void 0) && I.signal.aborted) ? (this.log.info("Initial connection failed with ConnectionError: ".concat(y.message, ". Retrying with another region: ").concat(b), this.logContext), this.recreateEngine(), yield h(g, v, b)) : (this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, ha(y)), v(y));
17139
+ [ee.InternalError, ee.ServerUnreachable, ee.Timeout].includes(y.reason) && (this.log.debug("Adding failed connection attempt to back off"), en.getInstance().addFailedConnectionAttempt(a)), b && !(!((P = this.abortController) === null || P === void 0) && P.signal.aborted) ? (this.log.info("Initial connection failed with ConnectionError: ".concat(y.message, ". Retrying with another region: ").concat(b), this.logContext), this.recreateEngine(), yield h(g, v, b)) : (this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, ha(y)), v(y));
17140
17140
  } else {
17141
17141
  let b = qe.UNKNOWN_REASON;
17142
17142
  y instanceof j && (b = ha(y)), this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, b), v(y);
@@ -17161,9 +17161,9 @@ class dn extends ot.EventEmitter {
17161
17161
  if (k || (k = {
17162
17162
  version: S.serverVersion,
17163
17163
  region: S.serverRegion
17164
- }), this.serverInfo = k, this.log.debug("connected to Livekit Server ".concat(Object.entries(k).map((I) => {
17165
- let [O, y] = I;
17166
- return "".concat(O, ": ").concat(y);
17164
+ }), this.serverInfo = k, this.log.debug("connected to Livekit Server ".concat(Object.entries(k).map((P) => {
17165
+ let [M, y] = P;
17166
+ return "".concat(M, ": ").concat(y);
17167
17167
  }).join(", ")), {
17168
17168
  room: (m = S.room) === null || m === void 0 ? void 0 : m.name,
17169
17169
  roomSid: (g = S.room) === null || g === void 0 ? void 0 : g.sid,
@@ -17547,10 +17547,10 @@ class dn extends ot.EventEmitter {
17547
17547
  getSid() {
17548
17548
  return this.state === $.Disconnected ? _e.resolve("") : this.roomInfo && this.roomInfo.sid !== "" ? _e.resolve(this.roomInfo.sid) : new _e((e, t) => {
17549
17549
  const i = (s) => {
17550
- s.sid !== "" && (this.engine.off(M.RoomUpdate, i), e(s.sid));
17550
+ s.sid !== "" && (this.engine.off(O.RoomUpdate, i), e(s.sid));
17551
17551
  };
17552
- this.engine.on(M.RoomUpdate, i), this.once(_.Disconnected, () => {
17553
- this.engine.off(M.RoomUpdate, i), t(new ce("Room disconnected before room server id was available"));
17552
+ this.engine.on(O.RoomUpdate, i), this.once(_.Disconnected, () => {
17553
+ this.engine.off(O.RoomUpdate, i), t(new ce("Room disconnected before room server id was available"));
17554
17554
  });
17555
17555
  });
17556
17556
  }
@@ -17573,21 +17573,21 @@ class dn extends ot.EventEmitter {
17573
17573
  return (t = (e = this.roomInfo) === null || e === void 0 ? void 0 : e.numPublishers) !== null && t !== void 0 ? t : 0;
17574
17574
  }
17575
17575
  maybeCreateEngine() {
17576
- this.engine && !this.engine.isClosed || (this.engine = new Ef(this.options), this.engine.e2eeManager = this.e2eeManager, this.engine.on(M.ParticipantUpdate, this.handleParticipantUpdates).on(M.RoomUpdate, this.handleRoomUpdate).on(M.SpeakersChanged, this.handleSpeakersChanged).on(M.StreamStateChanged, this.handleStreamStateUpdate).on(M.ConnectionQualityUpdate, this.handleConnectionQualityUpdate).on(M.SubscriptionError, this.handleSubscriptionError).on(M.SubscriptionPermissionUpdate, this.handleSubscriptionPermissionUpdate).on(M.MediaTrackAdded, (e, t, i) => {
17576
+ this.engine && !this.engine.isClosed || (this.engine = new Ef(this.options), this.engine.e2eeManager = this.e2eeManager, this.engine.on(O.ParticipantUpdate, this.handleParticipantUpdates).on(O.RoomUpdate, this.handleRoomUpdate).on(O.SpeakersChanged, this.handleSpeakersChanged).on(O.StreamStateChanged, this.handleStreamStateUpdate).on(O.ConnectionQualityUpdate, this.handleConnectionQualityUpdate).on(O.SubscriptionError, this.handleSubscriptionError).on(O.SubscriptionPermissionUpdate, this.handleSubscriptionPermissionUpdate).on(O.MediaTrackAdded, (e, t, i) => {
17577
17577
  this.onTrackAdded(e, t, i);
17578
- }).on(M.Disconnected, (e) => {
17578
+ }).on(O.Disconnected, (e) => {
17579
17579
  this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, e);
17580
- }).on(M.ActiveSpeakersUpdate, this.handleActiveSpeakersUpdate).on(M.DataPacketReceived, this.handleDataPacket).on(M.Resuming, () => {
17580
+ }).on(O.ActiveSpeakersUpdate, this.handleActiveSpeakersUpdate).on(O.DataPacketReceived, this.handleDataPacket).on(O.Resuming, () => {
17581
17581
  this.clearConnectionReconcile(), this.isResuming = !0, this.log.info("Resuming signal connection", this.logContext), this.setAndEmitConnectionState($.SignalReconnecting) && this.emit(_.SignalReconnecting);
17582
- }).on(M.Resumed, () => {
17582
+ }).on(O.Resumed, () => {
17583
17583
  this.registerConnectionReconcile(), this.isResuming = !1, this.log.info("Resumed signal connection", this.logContext), this.updateSubscriptions(), this.emitBufferedEvents(), this.setAndEmitConnectionState($.Connected) && this.emit(_.Reconnected);
17584
- }).on(M.SignalResumed, () => {
17584
+ }).on(O.SignalResumed, () => {
17585
17585
  this.bufferedEvents = [], (this.state === $.Reconnecting || this.isResuming) && this.sendSyncState();
17586
- }).on(M.Restarting, this.handleRestarting).on(M.SignalRestarted, this.handleSignalRestarted).on(M.Offline, () => {
17586
+ }).on(O.Restarting, this.handleRestarting).on(O.SignalRestarted, this.handleSignalRestarted).on(O.Offline, () => {
17587
17587
  this.setAndEmitConnectionState($.Reconnecting) && this.emit(_.Reconnecting);
17588
- }).on(M.DCBufferStatusChanged, (e, t) => {
17588
+ }).on(O.DCBufferStatusChanged, (e, t) => {
17589
17589
  this.emit(_.DCBufferStatusChanged, e, t);
17590
- }).on(M.LocalTrackSubscribed, (e) => {
17590
+ }).on(O.LocalTrackSubscribed, (e) => {
17591
17591
  const t = this.localParticipant.getTrackPublications().find((i) => {
17592
17592
  let {
17593
17593
  trackSid: s
@@ -17599,7 +17599,7 @@ class dn extends ot.EventEmitter {
17599
17599
  return;
17600
17600
  }
17601
17601
  this.localParticipant.emit(D.LocalTrackSubscribed, t), this.emitWhenConnected(_.LocalTrackSubscribed, t, this.localParticipant);
17602
- }).on(M.RoomMoved, (e) => {
17602
+ }).on(O.RoomMoved, (e) => {
17603
17603
  this.log.debug("room moved", e), e.room && this.handleRoomUpdate(e.room), this.remoteParticipants.forEach((t, i) => {
17604
17604
  this.handleParticipantDisconnected(i, t);
17605
17605
  }), this.emit(_.Moved, e.room.name), e.participant ? this.handleParticipantUpdates([e.participant, ...e.otherParticipants]) : this.handleParticipantUpdates(e.otherParticipants);
@@ -17803,38 +17803,38 @@ class dn extends ot.EventEmitter {
17803
17803
  v = r.localParticipant.audioTrackPublications.size === 0;
17804
17804
  const k = (a = r.getActiveDevice(i)) !== null && a !== void 0 ? a : r.options.audioCaptureDefaults.deviceId;
17805
17805
  r.options.audioCaptureDefaults.deviceId = S;
17806
- const I = Array.from(r.localParticipant.audioTrackPublications.values()).filter((y) => y.source === C.Source.Microphone);
17806
+ const P = Array.from(r.localParticipant.audioTrackPublications.values()).filter((y) => y.source === C.Source.Microphone);
17807
17807
  try {
17808
- g = (yield Promise.all(I.map((y) => {
17808
+ g = (yield Promise.all(P.map((y) => {
17809
17809
  var b;
17810
17810
  return (b = y.audioTrack) === null || b === void 0 ? void 0 : b.setDeviceId(S);
17811
17811
  }))).every((y) => y === !0);
17812
17812
  } catch (y) {
17813
17813
  throw r.options.audioCaptureDefaults.deviceId = k, y;
17814
17814
  }
17815
- const O = I.some((y) => {
17815
+ const M = P.some((y) => {
17816
17816
  var b, T;
17817
17817
  return (T = (b = y.track) === null || b === void 0 ? void 0 : b.isMuted) !== null && T !== void 0 ? T : !1;
17818
17818
  });
17819
- g && O && (v = !0);
17819
+ g && M && (v = !0);
17820
17820
  } else if (i === "videoinput") {
17821
17821
  v = r.localParticipant.videoTrackPublications.size === 0;
17822
17822
  const k = (c = r.getActiveDevice(i)) !== null && c !== void 0 ? c : r.options.videoCaptureDefaults.deviceId;
17823
17823
  r.options.videoCaptureDefaults.deviceId = S;
17824
- const I = Array.from(r.localParticipant.videoTrackPublications.values()).filter((y) => y.source === C.Source.Camera);
17824
+ const P = Array.from(r.localParticipant.videoTrackPublications.values()).filter((y) => y.source === C.Source.Camera);
17825
17825
  try {
17826
- g = (yield Promise.all(I.map((y) => {
17826
+ g = (yield Promise.all(P.map((y) => {
17827
17827
  var b;
17828
17828
  return (b = y.videoTrack) === null || b === void 0 ? void 0 : b.setDeviceId(S);
17829
17829
  }))).every((y) => y === !0);
17830
17830
  } catch (y) {
17831
17831
  throw r.options.videoCaptureDefaults.deviceId = k, y;
17832
17832
  }
17833
- const O = I.some((y) => {
17833
+ const M = P.some((y) => {
17834
17834
  var b, T;
17835
17835
  return (T = (b = y.track) === null || b === void 0 ? void 0 : b.isMuted) !== null && T !== void 0 ? T : !1;
17836
17836
  });
17837
- g && O && (v = !0);
17837
+ g && M && (v = !0);
17838
17838
  } else if (i === "audiooutput") {
17839
17839
  if (v = !0, !ki() && !r.options.webAudioMix || r.options.webAudioMix && r.audioContext && !("setSinkId" in r.audioContext))
17840
17840
  throw new Error("cannot switch audio output, the current browser does not support it");
@@ -17842,11 +17842,11 @@ class dn extends ot.EventEmitter {
17842
17842
  const k = (u = r.getActiveDevice(i)) !== null && u !== void 0 ? u : r.options.audioOutput.deviceId;
17843
17843
  r.options.audioOutput.deviceId = s;
17844
17844
  try {
17845
- r.options.webAudioMix && ((h = r.audioContext) === null || h === void 0 || h.setSinkId(s)), yield Promise.all(Array.from(r.remoteParticipants.values()).map((I) => I.setAudioOutput({
17845
+ r.options.webAudioMix && ((h = r.audioContext) === null || h === void 0 || h.setSinkId(s)), yield Promise.all(Array.from(r.remoteParticipants.values()).map((P) => P.setAudioOutput({
17846
17846
  deviceId: s
17847
17847
  })));
17848
- } catch (I) {
17849
- throw r.options.audioOutput.deviceId = k, I;
17848
+ } catch (P) {
17849
+ throw r.options.audioOutput.deviceId = k, P;
17850
17850
  }
17851
17851
  }
17852
17852
  return v && (r.localParticipant.activeDeviceMap.set(i, s), r.emit(_.ActiveDeviceChanged, i, s)), g;
@@ -18143,7 +18143,7 @@ class dn extends ot.EventEmitter {
18143
18143
  name: "local-name"
18144
18144
  })), this.setupLocalParticipantEvents(), this.emit(_.SignalConnected), this.emit(_.Connected), this.setAndEmitConnectionState($.Connected), o.video) {
18145
18145
  const c = new Ei(C.Kind.Video, new $t({
18146
- source: me.CAMERA,
18146
+ source: fe.CAMERA,
18147
18147
  sid: Math.floor(Math.random() * 1e4).toString(),
18148
18148
  type: Ve.AUDIO,
18149
18149
  name: "video-dummy"
@@ -18160,7 +18160,7 @@ class dn extends ot.EventEmitter {
18160
18160
  }
18161
18161
  if (o.audio) {
18162
18162
  const c = new Ei(C.Kind.Audio, new $t({
18163
- source: me.MICROPHONE,
18163
+ source: fe.MICROPHONE,
18164
18164
  sid: Math.floor(Math.random() * 1e4).toString(),
18165
18165
  type: Ve.AUDIO
18166
18166
  }), new on(o.useRealTracks && (!((s = navigator.mediaDevices) === null || s === void 0) && s.getUserMedia) ? (yield navigator.mediaDevices.getUserMedia({
@@ -18185,7 +18185,7 @@ class dn extends ot.EventEmitter {
18185
18185
  const l = this.getOrCreateParticipant(d.identity, d);
18186
18186
  if (a.video) {
18187
18187
  const u = Rs(160 * ((r = a.aspectRatios[c % a.aspectRatios.length]) !== null && r !== void 0 ? r : 1), 160, !1, !0), h = new $t({
18188
- source: me.CAMERA,
18188
+ source: fe.CAMERA,
18189
18189
  sid: Math.floor(Math.random() * 1e4).toString(),
18190
18190
  type: Ve.AUDIO
18191
18191
  });
@@ -18193,7 +18193,7 @@ class dn extends ot.EventEmitter {
18193
18193
  }
18194
18194
  if (a.audio) {
18195
18195
  const u = ai(), h = new $t({
18196
- source: me.MICROPHONE,
18196
+ source: fe.MICROPHONE,
18197
18197
  sid: Math.floor(Math.random() * 1e4).toString(),
18198
18198
  type: Ve.AUDIO
18199
18199
  });
@@ -18331,7 +18331,7 @@ function yr(n) {
18331
18331
  return new DataView(n.buffer, n.byteOffset, n.byteLength);
18332
18332
  throw new Error("Error coercing ".concat(n, " to DataView - input was not DataView, ArrayBuffer, or Uint8Array."));
18333
18333
  }
18334
- const it = 1, ue = 2, xa = 4, Bf = 8, Aa = 0, La = 12, Na = 5, jf = 7, Ua = 3, Vf = 3, Fa = 2, Ba = 1, ja = 0, Va = 3, qf = 2, qa = 2, Wf = 1, Kf = 0;
18334
+ const it = 1, he = 2, xa = 4, Bf = 8, Aa = 0, La = 12, Na = 5, jf = 7, Ua = 3, Vf = 3, Fa = 2, Ba = 1, ja = 0, Va = 3, qf = 2, qa = 2, Wf = 1, Kf = 0;
18335
18335
  var lt;
18336
18336
  (function(n) {
18337
18337
  n[n.TooShort = 0] = "TooShort", n[n.HeaderOverrun = 1] = "HeaderOverrun", n[n.MissingExtWords = 2] = "MissingExtWords", n[n.UnsupportedVersion = 3] = "UnsupportedVersion", n[n.InvalidHandle = 4] = "InvalidHandle", n[n.MalformedExt = 5] = "MalformedExt";
@@ -18396,13 +18396,13 @@ class st extends Fd {
18396
18396
  super(), this.timestamp = e;
18397
18397
  }
18398
18398
  toBinaryLengthBytes() {
18399
- return ue + ue + st.lengthBytes;
18399
+ return he + he + st.lengthBytes;
18400
18400
  }
18401
18401
  toBinaryInto(e) {
18402
18402
  let t = 0;
18403
- e.setUint16(t, st.tag), t += ue;
18403
+ e.setUint16(t, st.tag), t += he;
18404
18404
  const i = st.lengthBytes - 1;
18405
- e.setUint16(t, i), t += ue, e.setBigUint64(t, this.timestamp), t += Bf;
18405
+ e.setUint16(t, i), t += he, e.setBigUint64(t, this.timestamp), t += Bf;
18406
18406
  const s = this.toBinaryLengthBytes();
18407
18407
  if (t !== s)
18408
18408
  throw new Error("DataTrackUserTimestampExtension.toBinaryInto: Wrote ".concat(t, " bytes but expected length was ").concat(s, " bytes"));
@@ -18423,13 +18423,13 @@ class rt extends Fd {
18423
18423
  super(), this.keyIndex = e, this.iv = t;
18424
18424
  }
18425
18425
  toBinaryLengthBytes() {
18426
- return ue + ue + rt.lengthBytes;
18426
+ return he + he + rt.lengthBytes;
18427
18427
  }
18428
18428
  toBinaryInto(e) {
18429
18429
  let t = 0;
18430
- e.setUint16(t, rt.tag), t += ue;
18430
+ e.setUint16(t, rt.tag), t += he;
18431
18431
  const i = rt.lengthBytes - 1;
18432
- e.setUint16(t, i), t += ue, e.setUint8(t, this.keyIndex), t += it;
18432
+ e.setUint16(t, i), t += he, e.setUint8(t, this.keyIndex), t += it;
18433
18433
  for (let r = 0; r < this.iv.length; r += 1)
18434
18434
  e.setUint8(t, this.iv[r]), t += it;
18435
18435
  const s = this.toBinaryLengthBytes();
@@ -18475,11 +18475,11 @@ class In extends Ui {
18475
18475
  static fromBinary(e) {
18476
18476
  const t = yr(e);
18477
18477
  let i, s, r = 0;
18478
- for (; t.byteLength - r >= ue + ue; ) {
18478
+ for (; t.byteLength - r >= he + he; ) {
18479
18479
  const o = t.getUint16(r);
18480
- r += ue;
18480
+ r += he;
18481
18481
  const c = t.getUint16(r) + 1;
18482
- if (r += ue, o !== Kf)
18482
+ if (r += he, o !== Kf)
18483
18483
  switch (o) {
18484
18484
  case ln.UserTimestamp:
18485
18485
  if (t.byteLength - r < st.lengthBytes)
@@ -18593,9 +18593,9 @@ class kr extends Ui {
18593
18593
  } = this.extensionsMetrics();
18594
18594
  s > 0 && (t |= 1 << qa);
18595
18595
  let a = 0;
18596
- if (e.setUint8(a, t), a += it, e.setUint8(a, 0), a += it, e.setUint16(a, this.trackHandle.value), a += ue, e.setUint16(a, this.sequence.value), a += ue, e.setUint16(a, this.frameNumber.value), a += ue, e.setUint32(a, this.timestamp.asTicks()), a += xa, s > 0) {
18596
+ if (e.setUint8(a, t), a += it, e.setUint8(a, 0), a += it, e.setUint16(a, this.trackHandle.value), a += he, e.setUint16(a, this.sequence.value), a += he, e.setUint16(a, this.frameNumber.value), a += he, e.setUint32(a, this.timestamp.asTicks()), a += xa, s > 0) {
18597
18597
  const d = r - 1;
18598
- e.setUint16(a, d), a += ue;
18598
+ e.setUint16(a, d), a += he;
18599
18599
  const l = this.extensions.toBinaryInto(new DataView(e.buffer, e.byteOffset + a));
18600
18600
  a += l;
18601
18601
  for (let u = 0; u < o; u += 1)
@@ -18640,25 +18640,25 @@ class kr extends Ui {
18640
18640
  } catch (m) {
18641
18641
  throw m instanceof un && (m.isReason(qt.Reserved) || m.isReason(qt.TooLarge)) ? Me.invalidHandle(m) : m;
18642
18642
  }
18643
- i += ue;
18643
+ i += he;
18644
18644
  const d = wt.u16(t.getUint16(i));
18645
- i += ue;
18645
+ i += he;
18646
18646
  const l = wt.u16(t.getUint16(i));
18647
- i += ue;
18647
+ i += he;
18648
18648
  const u = Rn.fromRtpTicks(t.getUint32(i));
18649
18649
  i += xa;
18650
18650
  let h = new In();
18651
18651
  if (a) {
18652
- if (t.byteLength - i < ue)
18652
+ if (t.byteLength - i < he)
18653
18653
  throw Me.missingExtWords();
18654
18654
  let m = t.getUint16(i);
18655
- i += ue;
18655
+ i += he;
18656
18656
  let v = 4 * (m + 1);
18657
18657
  if (i + v > t.byteLength)
18658
18658
  throw Me.headerOverrun();
18659
18659
  let S = new DataView(t.buffer, t.byteOffset + i, v);
18660
- const [k, I] = In.fromBinary(S);
18661
- h = k, i += I;
18660
+ const [k, P] = In.fromBinary(S);
18661
+ h = k, i += P;
18662
18662
  }
18663
18663
  return [new kr({
18664
18664
  marker: o,
@@ -19698,7 +19698,7 @@ const Dg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19698
19698
  },
19699
19699
  Encryption_Type: le,
19700
19700
  get EngineEvent() {
19701
- return M;
19701
+ return O;
19702
19702
  },
19703
19703
  ExternalE2EEKeyProvider: Dm,
19704
19704
  get KeyHandlerEvent() {
@@ -20002,7 +20002,7 @@ function $a(n) {
20002
20002
  function ss(n) {
20003
20003
  return n instanceof Ot ? n.toJson() : { kind: "UnknownError", message: Np(n) || "UnknownError" };
20004
20004
  }
20005
- const qp = "2.0.6-staging.401", Wp = "https://api-js.mixpanel.com/track/?verbose=1&ip=1", Hd = 50, Nt = [];
20005
+ const qp = "2.0.7-staging.403", Wp = "https://api-js.mixpanel.com/track/?verbose=1&ip=1", Hd = 50, Nt = [];
20006
20006
  let rs = !1;
20007
20007
  async function Jd(n) {
20008
20008
  const e = await fetch(Wp, {
@@ -20240,8 +20240,8 @@ function Xp(n, e, t, i, s) {
20240
20240
  if (d = d, d === m.StreamVideoCreated && (n.linkTrack("agent-video", S, m.StreamVideoCreated, ["start"]), l.sentiment)) {
20241
20241
  const k = e.messages[e.messages.length - 1];
20242
20242
  if ((k == null ? void 0 : k.role) === "assistant") {
20243
- const I = { ...k, sentiment: l.sentiment };
20244
- e.messages[e.messages.length - 1] = I, c == null || c([...e.messages], a ?? "answer");
20243
+ const P = { ...k, sentiment: l.sentiment };
20244
+ e.messages[e.messages.length - 1] = P, c == null || c([...e.messages], a ?? "answer");
20245
20245
  }
20246
20246
  }
20247
20247
  if (g.includes(d)) {
@@ -20517,12 +20517,12 @@ function lg(n, e, t, i, s) {
20517
20517
  const S = await n();
20518
20518
  if (!S)
20519
20519
  return;
20520
- const { isReceiving: k, avgJitterDelayInInterval: I, freezeCount: O } = g(S), y = rg(S);
20520
+ const { isReceiving: k, avgJitterDelayInInterval: P, freezeCount: M } = g(S), y = rg(S);
20521
20521
  if (k)
20522
- c = 0, h = O - m, u = I < og ? bn.Strong : I > cg && h > 1 ? bn.Weak : l, u !== l && (s == null || s(u), l = u, m += h, h = 0), d || (i == null || i(ne.Start), a = o[o.length - 1], o = [], d = !0), o.push(y);
20522
+ c = 0, h = M - m, u = P < og ? bn.Strong : P > cg && h > 1 ? bn.Weak : l, u !== l && (s == null || s(u), l = u, m += h, h = 0), d || (i == null || i(ne.Start), a = o[o.length - 1], o = [], d = !0), o.push(y);
20523
20523
  else if (d && (c++, c >= ag)) {
20524
20524
  const b = Xa(o, ci, a);
20525
- i == null || i(ne.Stop, b), e() || t(), m = O, d = !1;
20525
+ i == null || i(ne.Stop, b), e() || t(), m = M, d = !1;
20526
20526
  }
20527
20527
  }
20528
20528
  return {
@@ -20606,21 +20606,21 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20606
20606
  var se;
20607
20607
  const c = eg(t, "WebRTCStreamingManager"), d = hg(c);
20608
20608
  let l = !1, u = !1, h = ne.Stop, m = ne.Stop;
20609
- const { startConnection: g, sendStreamRequest: v, close: S, createStream: k, addIceCandidate: I } = Zp(
20609
+ const { startConnection: g, sendStreamRequest: v, close: S, createStream: k, addIceCandidate: P } = Zp(
20610
20610
  s,
20611
20611
  r,
20612
20612
  n,
20613
20613
  i.onError
20614
20614
  ), {
20615
- id: O,
20615
+ id: M,
20616
20616
  offer: y,
20617
20617
  ice_servers: b,
20618
20618
  session_id: T,
20619
20619
  fluent: A,
20620
20620
  interrupt_enabled: U
20621
20621
  } = await k(e, a);
20622
- (se = i.onStreamCreated) == null || se.call(i, { stream_id: O, session_id: T, agent_id: n });
20623
- const P = new ug({ iceServers: b }), x = P.createDataChannel("JanusDataChannel");
20622
+ (se = i.onStreamCreated) == null || se.call(i, { stream_id: M, session_id: T, agent_id: n });
20623
+ const I = new ug({ iceServers: b }), x = I.createDataChannel("JanusDataChannel");
20624
20624
  if (!T)
20625
20625
  throw new Error("Could not create session_id");
20626
20626
  const L = A ? ut.Fluent : ut.Legacy;
@@ -20631,7 +20631,7 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20631
20631
  var B;
20632
20632
  l = !0, u && (c("CALLBACK: onConnectionStateChange(Connected)"), (B = i.onConnectionStateChange) == null || B.call(i, ye.Connected));
20633
20633
  }, N = lg(
20634
- () => P.getStats(),
20634
+ () => I.getStats(),
20635
20635
  X,
20636
20636
  w,
20637
20637
  (B, V) => eo({
@@ -20648,12 +20648,12 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20648
20648
  return (V = i.onConnectivityStateChange) == null ? void 0 : V.call(i, B);
20649
20649
  }
20650
20650
  );
20651
- N.start(), P.onicecandidate = (B) => {
20651
+ N.start(), I.onicecandidate = (B) => {
20652
20652
  var V;
20653
20653
  c("peerConnection.onicecandidate", B);
20654
20654
  try {
20655
- B.candidate && B.candidate.sdpMid && B.candidate.sdpMLineIndex !== null ? I(
20656
- O,
20655
+ B.candidate && B.candidate.sdpMid && B.candidate.sdpMLineIndex !== null ? P(
20656
+ M,
20657
20657
  {
20658
20658
  candidate: B.candidate.candidate,
20659
20659
  sdpMid: B.candidate.sdpMid,
@@ -20661,9 +20661,9 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20661
20661
  },
20662
20662
  T,
20663
20663
  a
20664
- ) : I(O, { candidate: null }, T, a);
20664
+ ) : P(M, { candidate: null }, T, a);
20665
20665
  } catch (oe) {
20666
- (V = i.onError) == null || V.call(i, oe, { streamId: O });
20666
+ (V = i.onError) == null || V.call(i, oe, { streamId: M });
20667
20667
  }
20668
20668
  }, x.onopen = () => {
20669
20669
  u = !0, (!q || l) && w();
@@ -20688,42 +20688,42 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20688
20688
  });
20689
20689
  }
20690
20690
  function Z(B, V) {
20691
- var ge;
20691
+ var ue;
20692
20692
  const oe = typeof V == "string" ? V : V == null ? void 0 : V.metadata;
20693
- oe && o.enrich({ streamMetadata: oe }), (ge = i.onStreamReady) == null || ge.call(i);
20693
+ oe && o.enrich({ streamMetadata: oe }), (ue = i.onStreamReady) == null || ue.call(i);
20694
20694
  }
20695
- const fe = {
20695
+ const pe = {
20696
20696
  [Se.StreamStarted]: Q,
20697
20697
  [Se.StreamDone]: Q,
20698
20698
  [Se.StreamReady]: Z
20699
20699
  };
20700
20700
  x.onmessage = (B) => {
20701
- var ge;
20701
+ var ue;
20702
20702
  const { subject: V, data: oe } = d(B.data);
20703
- (ge = fe[V]) == null || ge.call(fe, V, oe);
20704
- }, P.oniceconnectionstatechange = () => {
20703
+ (ue = pe[V]) == null || ue.call(pe, V, oe);
20704
+ }, I.oniceconnectionstatechange = () => {
20705
20705
  var V;
20706
- c("peerConnection.oniceconnectionstatechange => " + P.iceConnectionState);
20707
- const B = Za(P.iceConnectionState);
20708
- B !== ye.Connected && ((V = i.onConnectionStateChange) == null || V.call(i, B, `webrtc:ice-${P.iceConnectionState}`));
20709
- }, P.ontrack = (B) => {
20706
+ c("peerConnection.oniceconnectionstatechange => " + I.iceConnectionState);
20707
+ const B = Za(I.iceConnectionState);
20708
+ B !== ye.Connected && ((V = i.onConnectionStateChange) == null || V.call(i, B, `webrtc:ice-${I.iceConnectionState}`));
20709
+ }, I.ontrack = (B) => {
20710
20710
  var V;
20711
20711
  c("peerConnection.ontrack", B), c("CALLBACK: onSrcObjectReady"), (V = i.onSrcObjectReady) == null || V.call(i, B.streams[0]);
20712
- }, await P.setRemoteDescription(y), c("set remote description OK");
20713
- const Re = await P.createAnswer();
20714
- c("create answer OK"), await P.setLocalDescription(Re), c("set local description OK"), await g(O, Re, T, a), c("start connection OK");
20712
+ }, await I.setRemoteDescription(y), c("set remote description OK");
20713
+ const Re = await I.createAnswer();
20714
+ c("create answer OK"), await I.setLocalDescription(Re), c("set local description OK"), await g(M, Re, T, a), c("start connection OK");
20715
20715
  async function Pe(B, V) {
20716
- var oe, ge;
20716
+ var oe, ue;
20717
20717
  if (!l || x.readyState !== "open") {
20718
20718
  c("Data channel is not ready for sending messages"), (oe = i.onError) == null || oe.call(i, new ro("Data channel is not ready for sending messages"), {
20719
- streamId: O
20719
+ streamId: M
20720
20720
  });
20721
20721
  return;
20722
20722
  }
20723
20723
  try {
20724
20724
  x.send(V);
20725
- } catch (pe) {
20726
- c("Error sending data channel message", pe), (ge = i.onError) == null || ge.call(i, pe, { streamId: O });
20725
+ } catch (ge) {
20726
+ c("Error sending data channel message", ge), (ue = i.onError) == null || ue.call(i, ge, { streamId: M });
20727
20727
  }
20728
20728
  }
20729
20729
  return {
@@ -20732,24 +20732,24 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20732
20732
  * @param payload
20733
20733
  */
20734
20734
  speak(B) {
20735
- return v(O, T, B);
20735
+ return v(M, T, B);
20736
20736
  },
20737
20737
  /**
20738
20738
  * Method to close RTC connection
20739
20739
  */
20740
20740
  async disconnect() {
20741
20741
  var B;
20742
- if (O) {
20743
- const V = Za(P.iceConnectionState);
20744
- if (P) {
20742
+ if (M) {
20743
+ const V = Za(I.iceConnectionState);
20744
+ if (I) {
20745
20745
  if (V === ye.New) {
20746
20746
  N.stop();
20747
20747
  return;
20748
20748
  }
20749
- P.close(), P.oniceconnectionstatechange = null, P.onnegotiationneeded = null, P.onicecandidate = null, P.ontrack = null;
20749
+ I.close(), I.oniceconnectionstatechange = null, I.onnegotiationneeded = null, I.onicecandidate = null, I.ontrack = null;
20750
20750
  }
20751
20751
  try {
20752
- V === ye.Connected && await S(O, T).catch((oe) => {
20752
+ V === ye.Connected && await S(M, T).catch((oe) => {
20753
20753
  });
20754
20754
  } catch (oe) {
20755
20755
  c("Error on close stream connection", oe);
@@ -20765,7 +20765,7 @@ async function pg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = wi,
20765
20765
  /**
20766
20766
  * Id of current RTC stream
20767
20767
  */
20768
- streamId: O,
20768
+ streamId: M,
20769
20769
  streamType: L,
20770
20770
  interruptAvailable: U ?? !1,
20771
20771
  isInterruptible: !0,
@@ -20797,7 +20797,7 @@ async function gg(n, e, t, i) {
20797
20797
  const { version: r, ...o } = e;
20798
20798
  switch (o.transport.provider) {
20799
20799
  case js.Livekit:
20800
- const { createLiveKitStreamingManager: a } = await import("./livekit-manager-Der3_cF-.js");
20800
+ const { createLiveKitStreamingManager: a } = await import("./livekit-manager-BW499fIa.js");
20801
20801
  return a(s, o, t);
20802
20802
  default:
20803
20803
  throw new Error(`Unsupported transport provider: ${o.transport.provider}`);
@@ -20991,8 +20991,8 @@ async function _g(n, e, t, i, s) {
20991
20991
  e.mode,
20992
20992
  e.persistentChat,
20993
20993
  s
20994
- ), I = no(n, e, i, v).then((b) => (S = b, b)), [O, y] = await Promise.all([k, I]);
20995
- return { chatResult: O, streamingManager: y };
20994
+ ), P = no(n, e, i, v).then((b) => (S = b, b)), [M, y] = await Promise.all([k, P]);
20995
+ return { chatResult: M, streamingManager: y };
20996
20996
  } catch (k) {
20997
20997
  throw g.abort(), S && await S.disconnect().catch(() => {
20998
20998
  }), k;
@@ -21044,10 +21044,10 @@ async function Ag(n, e) {
21044
21044
  video_duration_to_interrupt: Fs.get(!0),
21045
21045
  message_duration_to_interrupt: Et.get(!0)
21046
21046
  }), N.interrupted = !0, (Z = (Q = e.callbacks).onNewMessage) == null || Z.call(Q, [...a.messages], "answer"), a.streamingManager.interrupt(w);
21047
- }, I = /* @__PURE__ */ new Map();
21048
- function O(w) {
21047
+ }, P = /* @__PURE__ */ new Map();
21048
+ function M(w) {
21049
21049
  return async (N) => {
21050
- const F = I.get(w);
21050
+ const F = P.get(w);
21051
21051
  if (!F)
21052
21052
  throw io(`No handler registered for client tool: ${w}`);
21053
21053
  try {
@@ -21060,25 +21060,25 @@ async function Ag(n, e) {
21060
21060
  }
21061
21061
  function y() {
21062
21062
  var w, N, F, K;
21063
- for (const [Q] of I)
21064
- (N = (w = a.streamingManager) == null ? void 0 : w.unregisterRpcMethod) == null || N.call(w, Q), (K = (F = a.streamingManager) == null ? void 0 : F.registerRpcMethod) == null || K.call(F, Q, O(Q));
21063
+ for (const [Q] of P)
21064
+ (N = (w = a.streamingManager) == null ? void 0 : w.unregisterRpcMethod) == null || N.call(w, Q), (K = (F = a.streamingManager) == null ? void 0 : F.registerRpcMethod) == null || K.call(F, Q, M(Q));
21065
21065
  }
21066
21066
  function b(w, N) {
21067
21067
  var K, Q;
21068
- const F = !I.has(w);
21069
- I.set(w, N), F && ((Q = (K = a.streamingManager) == null ? void 0 : K.registerRpcMethod) == null || Q.call(K, w, O(w)));
21068
+ const F = !P.has(w);
21069
+ P.set(w, N), F && ((Q = (K = a.streamingManager) == null ? void 0 : K.registerRpcMethod) == null || Q.call(K, w, M(w)));
21070
21070
  }
21071
21071
  function T(w) {
21072
21072
  var N, F;
21073
- I.delete(w), (F = (N = a.streamingManager) == null ? void 0 : N.unregisterRpcMethod) == null || F.call(N, w);
21073
+ P.delete(w), (F = (N = a.streamingManager) == null ? void 0 : N.unregisterRpcMethod) == null || F.call(N, w);
21074
21074
  }
21075
21075
  const A = Date.now();
21076
21076
  $a(() => {
21077
21077
  c.track("agent-sdk", { event: "loaded", ...Ap(h) }, A);
21078
21078
  });
21079
21079
  async function U(w) {
21080
- var fe, Re, Pe, se, B, V, oe;
21081
- ll(), (Re = (fe = e.callbacks).onConnectionStateChange) == null || Re.call(fe, ye.Connecting), Et.reset(), w && !t && (delete a.chat, (se = (Pe = e.callbacks).onNewMessage) == null || se.call(Pe, [...a.messages], "answer"));
21080
+ var pe, Re, Pe, se, B, V, oe;
21081
+ ll(), (Re = (pe = e.callbacks).onConnectionStateChange) == null || Re.call(pe, ye.Connecting), Et.reset(), w && !t && (delete a.chat, (se = (Pe = e.callbacks).onNewMessage) == null || se.call(Pe, [...a.messages], "answer"));
21082
21082
  const N = o === ve.DirectPlayback || m ? Promise.resolve(void 0) : $p(
21083
21083
  e.auth,
21084
21084
  s,
@@ -21094,7 +21094,8 @@ async function Ag(n, e) {
21094
21094
  ...e.callbacks,
21095
21095
  onVideoIdChange: S,
21096
21096
  onMessage: g
21097
- }
21097
+ },
21098
+ rpcMethods: new Map([...P.keys()].map((ue) => [ue, M(ue)]))
21098
21099
  },
21099
21100
  u,
21100
21101
  c,
@@ -21104,12 +21105,12 @@ async function Ag(n, e) {
21104
21105
  limit: 3,
21105
21106
  timeout: ul,
21106
21107
  timeoutErrorMessage: "Timeout initializing the stream",
21107
- shouldRetryFn: (ge) => (ge == null ? void 0 : ge.message) !== "Could not connect" && !(ge instanceof so && (ge.status === 429 || ge.kind === "InsufficientCreditsError")),
21108
+ shouldRetryFn: (ue) => (ue == null ? void 0 : ue.message) !== "Could not connect" && !(ue instanceof so && (ue.status === 429 || ue.kind === "InsufficientCreditsError")),
21108
21109
  delayMs: 1e3
21109
21110
  }
21110
- ).catch((ge) => {
21111
- var pe, Dt;
21112
- throw x(ve.Maintenance), (Dt = (pe = e.callbacks).onConnectionStateChange) == null || Dt.call(pe, ye.Fail), ge;
21111
+ ).catch((ue) => {
21112
+ var ge, Dt;
21113
+ throw x(ve.Maintenance), (Dt = (ge = e.callbacks).onConnectionStateChange) == null || Dt.call(ge, ye.Fail), ue;
21113
21114
  }), [K, { streamingManager: Q, chat: Z }] = await Promise.all([N, F]);
21114
21115
  Z && Z.id !== ((B = a.chat) == null ? void 0 : B.id) && ((oe = (V = e.callbacks).onNewChat) == null || oe.call(V, Z.id)), a.streamingManager = Q, a.socketManager = K, a.chat = Z, y(), t = !1, c.enrich({
21115
21116
  chatId: Z == null ? void 0 : Z.id,
@@ -21117,13 +21118,13 @@ async function Ag(n, e) {
21117
21118
  mode: a.chatMode
21118
21119
  }), x((Z == null ? void 0 : Z.chat_mode) ?? o);
21119
21120
  }
21120
- async function P() {
21121
+ async function I() {
21121
21122
  var w, N, F, K;
21122
21123
  (w = a.socketManager) == null || w.disconnect(), await ((N = a.streamingManager) == null ? void 0 : N.disconnect()), delete a.streamingManager, delete a.socketManager, (K = (F = e.callbacks).onConnectionStateChange) == null || K.call(F, ye.Disconnected);
21123
21124
  }
21124
21125
  async function x(w) {
21125
21126
  var N, F;
21126
- w !== a.chatMode && (c.track("agent-mode-change", { mode: w }), a.chatMode = w, a.chatMode !== ve.Functional && await P(), (F = (N = e.callbacks).onModeChange) == null || F.call(N, w));
21127
+ w !== a.chatMode && (c.track("agent-mode-change", { mode: w }), a.chatMode = w, a.chatMode !== ve.Functional && await I(), (F = (N = e.callbacks).onModeChange) == null || F.call(N, w));
21127
21128
  }
21128
21129
  return {
21129
21130
  agent: h,
@@ -21152,10 +21153,10 @@ async function Ag(n, e) {
21152
21153
  try {
21153
21154
  await w.reconnect();
21154
21155
  } catch (F) {
21155
- N = ss(F).kind, await P(), await U(!1);
21156
+ N = ss(F).kind, await I(), await U(!1);
21156
21157
  }
21157
21158
  else
21158
- await P(), await U(!1);
21159
+ await I(), await U(!1);
21159
21160
  c.track("agent-chat", {
21160
21161
  event: "reconnect",
21161
21162
  mode: a.chatMode,
@@ -21164,7 +21165,7 @@ async function Ag(n, e) {
21164
21165
  });
21165
21166
  },
21166
21167
  async disconnect() {
21167
- await P(), c.track("agent-chat", {
21168
+ await I(), c.track("agent-chat", {
21168
21169
  event: "disconnect",
21169
21170
  mode: a.chatMode
21170
21171
  });
@@ -21199,7 +21200,7 @@ async function Ag(n, e) {
21199
21200
  return (w = a.streamingManager) != null && w.unpublishCameraStream ? a.streamingManager.unpublishCameraStream() : Promise.resolve();
21200
21201
  },
21201
21202
  async chat(w) {
21202
- var Q, Z, fe, Re, Pe;
21203
+ var Q, Z, pe, Re, Pe;
21203
21204
  const N = () => {
21204
21205
  if (uo(o))
21205
21206
  throw new He(`${o} is enabled, chat is disabled`);
@@ -21233,16 +21234,16 @@ async function Ag(n, e) {
21233
21234
  }, K = async (se, B) => {
21234
21235
  const V = a.chatMode === ve.Playground;
21235
21236
  return Ns(m && !V ? async () => {
21236
- var pe;
21237
- return await ((pe = a.streamingManager) == null ? void 0 : pe.sendDataChannelMessage(Mn.Chat, w)), Promise.resolve({});
21237
+ var ge;
21238
+ return await ((ge = a.streamingManager) == null ? void 0 : ge.sendDataChannelMessage(Mn.Chat, w)), Promise.resolve({});
21238
21239
  } : async () => {
21239
- var pe, Dt;
21240
+ var ge, Dt;
21240
21241
  return u.chat(
21241
21242
  h.id,
21242
21243
  B,
21243
21244
  {
21244
21245
  chatMode: a.chatMode,
21245
- streamId: (pe = a.streamingManager) == null ? void 0 : pe.streamId,
21246
+ streamId: (ge = a.streamingManager) == null ? void 0 : ge.streamId,
21246
21247
  sessionId: (Dt = a.streamingManager) == null ? void 0 : Dt.sessionId,
21247
21248
  messages: se.map(({ matches: Qd, ...Wn }) => Wn)
21248
21249
  },
@@ -21253,13 +21254,13 @@ async function Ag(n, e) {
21253
21254
  );
21254
21255
  }, {
21255
21256
  limit: 2,
21256
- shouldRetryFn: (pe) => {
21257
+ shouldRetryFn: (ge) => {
21257
21258
  var Wn, Er, wr, _r;
21258
- const Dt = (Wn = pe == null ? void 0 : pe.message) == null ? void 0 : Wn.includes("missing or invalid session_id");
21259
- return !((Er = pe == null ? void 0 : pe.message) == null ? void 0 : Er.includes("Stream Error")) && !Dt ? ((_r = (wr = e.callbacks).onError) == null || _r.call(wr, pe), !1) : !0;
21259
+ const Dt = (Wn = ge == null ? void 0 : ge.message) == null ? void 0 : Wn.includes("missing or invalid session_id");
21260
+ return !((Er = ge == null ? void 0 : ge.message) == null ? void 0 : Er.includes("Stream Error")) && !Dt ? ((_r = (wr = e.callbacks).onError) == null || _r.call(wr, ge), !1) : !0;
21260
21261
  },
21261
21262
  onRetry: async () => {
21262
- await P(), await U(!1);
21263
+ await I(), await U(!1);
21263
21264
  }
21264
21265
  });
21265
21266
  };
@@ -21283,7 +21284,7 @@ async function Ag(n, e) {
21283
21284
  }), c.track("agent-message-send", {
21284
21285
  event: "success",
21285
21286
  messages: a.messages.length + 1
21286
- }), B.result && ((Re = (fe = e.callbacks).onNewMessage) == null || Re.call(fe, [...a.messages], "answer"), c.track("agent-message-received", {
21287
+ }), B.result && ((Re = (pe = e.callbacks).onNewMessage) == null || Re.call(pe, [...a.messages], "answer"), c.track("agent-message-received", {
21287
21288
  latency: Et.get(!0),
21288
21289
  messages: a.messages.length
21289
21290
  })), B;
@@ -21296,7 +21297,7 @@ async function Ag(n, e) {
21296
21297
  }
21297
21298
  },
21298
21299
  rate(w, N, F) {
21299
- var Z, fe, Re, Pe;
21300
+ var Z, pe, Re, Pe;
21300
21301
  const K = a.messages.find((se) => se.id === w);
21301
21302
  if (a.chat) {
21302
21303
  if (!K)
@@ -21306,7 +21307,7 @@ async function Ag(n, e) {
21306
21307
  return c.track("agent-rate", {
21307
21308
  event: F ? "update" : "create",
21308
21309
  thumb: N === 1 ? "up" : "down",
21309
- knowledge_id: ((fe = h.knowledge) == null ? void 0 : fe.id) ?? "",
21310
+ knowledge_id: ((pe = h.knowledge) == null ? void 0 : pe.id) ?? "",
21310
21311
  matches: Q,
21311
21312
  score: N
21312
21313
  }), F ? u.updateRating(h.id, a.chat.id, F, {
@@ -21332,7 +21333,7 @@ async function Ag(n, e) {
21332
21333
  return c.track("agent-feedback", { rating: w, hasAnswer: !!N }), u.submitFeedback(h.id, a.chat.id, { rating: w, answer: N });
21333
21334
  },
21334
21335
  async speak(w) {
21335
- var Q, Z, fe;
21336
+ var Q, Z, pe;
21336
21337
  function N() {
21337
21338
  return typeof w == "string" ? {
21338
21339
  type: "text",
@@ -21363,7 +21364,7 @@ async function Ag(n, e) {
21363
21364
  throw new He("Please connect to the agent first");
21364
21365
  return a.streamingManager.speak({
21365
21366
  script: F,
21366
- metadata: { chat_id: (fe = a.chat) == null ? void 0 : fe.id, agent_id: h.id }
21367
+ metadata: { chat_id: (pe = a.chat) == null ? void 0 : pe.id, agent_id: h.id }
21367
21368
  });
21368
21369
  },
21369
21370
  interrupt: k,