@cloudflare/realtimekit 2.0.3 → 2.0.4-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -565,12 +565,12 @@ class Qv extends Yv {
565
565
  }
566
566
  }
567
567
  const Pe = new Qv();
568
- var Tt = {}, Xv = {
568
+ var yt = {}, Xv = {
569
569
  get exports() {
570
- return Tt;
570
+ return yt;
571
571
  },
572
572
  set exports(s) {
573
- Tt = s;
573
+ yt = s;
574
574
  }
575
575
  }, kn = typeof Reflect == "object" ? Reflect : null, Vp = kn && typeof kn.apply == "function" ? kn.apply : function(t, e, r) {
576
576
  return Function.prototype.apply.call(t, e, r);
@@ -590,7 +590,7 @@ function he() {
590
590
  he.init.call(this);
591
591
  }
592
592
  Xv.exports = he;
593
- Tt.once = rT;
593
+ yt.once = rT;
594
594
  he.EventEmitter = he;
595
595
  he.prototype._events = void 0;
596
596
  he.prototype._eventsCount = 0;
@@ -871,7 +871,7 @@ class aT {
871
871
  };
872
872
  }
873
873
  }
874
- class oT extends Tt {
874
+ class oT extends yt {
875
875
  constructor({ logger: e, peerId: r, apiHostnames: i, authToken: a }) {
876
876
  super();
877
877
  p(this, "logger");
@@ -1191,7 +1191,7 @@ b=AS:${this.constrainVideoBitrateKbps}\r
1191
1191
  this.pc1.close(), this.pc2.close();
1192
1192
  }
1193
1193
  }
1194
- class sf extends Tt {
1194
+ class sf extends yt {
1195
1195
  constructor(e) {
1196
1196
  super();
1197
1197
  p(this, "call");
@@ -1388,7 +1388,7 @@ class nf {
1388
1388
  p(this, "staleConsumerStreamMap", !1);
1389
1389
  }
1390
1390
  }
1391
- class af extends Tt {
1391
+ class af extends yt {
1392
1392
  constructor() {
1393
1393
  super();
1394
1394
  p(this, "observer");
@@ -1415,7 +1415,7 @@ class af extends Tt {
1415
1415
  p(this, "screenShareConsumers", /* @__PURE__ */ new Set());
1416
1416
  p(this, "ipDetails");
1417
1417
  p(this, "callStatsInstance");
1418
- this.observer = new Tt();
1418
+ this.observer = new yt();
1419
1419
  }
1420
1420
  registerProducer(e) {
1421
1421
  return u(this, null, function* () {
@@ -2658,7 +2658,7 @@ var z = globalThis && globalThis.__decorate || function(s, t, e, r) {
2658
2658
  return i > 3 && a && Object.defineProperty(t, e, a), a;
2659
2659
  };
2660
2660
  const Y = console;
2661
- let q = class extends Tt {
2661
+ let q = class extends yt {
2662
2662
  constructor(e = "https://api.testingv3.dyte.in", r = "Blink", i = qm.PROD, a, o, c, d, l) {
2663
2663
  super();
2664
2664
  p(this, "observer");
@@ -2692,7 +2692,7 @@ let q = class extends Tt {
2692
2692
  default:
2693
2693
  throw Error(`Unknown engineName! ${r}`);
2694
2694
  }
2695
- this.measurements.callStatsInstance = this, this.registerProducer = this.registerProducer.bind(this), this.registerConsumer = this.registerConsumer.bind(this), this.observer = new Tt(), this.measurements.observer.on("consumer_score", (h) => {
2695
+ this.measurements.callStatsInstance = this, this.registerProducer = this.registerProducer.bind(this), this.registerConsumer = this.registerConsumer.bind(this), this.observer = new yt(), this.measurements.observer.on("consumer_score", (h) => {
2696
2696
  o.debug(`callStats::consumer_score ${[...h.entries()]}`), this.eventHandler.emit("consumer_score", h);
2697
2697
  }), this.measurements.observer.on("producer_score", (h) => {
2698
2698
  o.debug(`callStats::producer_score ${[...h.entries()]}`), this.eventHandler.emit("producer_score", h);
@@ -3251,7 +3251,7 @@ q = z([
3251
3251
  wT(TypeError, (s, t) => Y.error(t, s))
3252
3252
  ], q);
3253
3253
  const _T = q;
3254
- class cf extends Tt {
3254
+ class cf extends yt {
3255
3255
  constructor() {
3256
3256
  super(...arguments);
3257
3257
  p(this, "stats");
@@ -3687,7 +3687,7 @@ function ko(s, t, e, r) {
3687
3687
  }
3688
3688
  }), i.length > 0;
3689
3689
  }
3690
- class Oa extends Tt.EventEmitter {
3690
+ class Oa extends yt.EventEmitter {
3691
3691
  constructor(e) {
3692
3692
  super();
3693
3693
  p(this, "logger");
@@ -3749,7 +3749,7 @@ class Oa extends Tt.EventEmitter {
3749
3749
  return super.listenerCount(e);
3750
3750
  }
3751
3751
  }
3752
- class Bt extends Tt.EventEmitter {
3752
+ class Bt extends yt.EventEmitter {
3753
3753
  constructor(e) {
3754
3754
  super();
3755
3755
  p(this, "logger");
@@ -3812,7 +3812,7 @@ class Bt extends Tt.EventEmitter {
3812
3812
  }
3813
3813
  }
3814
3814
  var Gs, Ws;
3815
- class bT extends Tt.EventEmitter {
3815
+ class bT extends yt.EventEmitter {
3816
3816
  constructor(e) {
3817
3817
  super();
3818
3818
  m(this, Gs, void 0);
@@ -6182,12 +6182,12 @@ const _g = 1080, Cg = 1920, eR = (s, t, e, r, i, a) => {
6182
6182
  let g = d * h, S = l * h, y, E, k, b, O = 1;
6183
6183
  return g < e && (O = e / g), Math.abs(O - 1) < 1e-14 && S < r && (O = r / S), g *= O, S *= O, k = d / (g / e), b = l / (S / r), y = (d - k) * o, E = (l - b) * c, y < 0 && (y = 0), E < 0 && (E = 0), k > d && (k = d), b > l && (b = l), [y, E, k, b, s, t, e, r];
6184
6184
  };
6185
- var Et, Nr, nt, Wt, be, Jt, Js, $e, De, On, Nn, Ln, Ks, Vn, Qd, $o;
6185
+ var Pt, Nr, nt, Wt, be, Jt, Js, $e, De, On, Nn, Ln, Ks, Vn, Qd, $o;
6186
6186
  const Op = class extends Bt {
6187
6187
  constructor(e, r, i, a) {
6188
6188
  const o = e.getValue("logger");
6189
6189
  super(o);
6190
- m(this, Et, void 0);
6190
+ m(this, Pt, void 0);
6191
6191
  m(this, Nr, void 0);
6192
6192
  m(this, nt, void 0);
6193
6193
  m(this, Wt, void 0);
@@ -6331,7 +6331,7 @@ const Op = class extends Bt {
6331
6331
  /** @access private */
6332
6332
  createCanvas() {
6333
6333
  const e = document.createElement("canvas");
6334
- e.height = n(this, be).height, e.width = n(this, be).width, f(this, Et, e);
6334
+ e.height = n(this, be).height, e.width = n(this, be).width, f(this, Pt, e);
6335
6335
  }
6336
6336
  /** @access private */
6337
6337
  setupMediaSessionEvents() {
@@ -6361,9 +6361,9 @@ const Op = class extends Bt {
6361
6361
  }
6362
6362
  /** @access private */
6363
6363
  drawEmptyTile(e, r, i, a) {
6364
- if (n(this, Et) === void 0)
6364
+ if (n(this, Pt) === void 0)
6365
6365
  return;
6366
- const o = n(this, Et).getContext("2d"), c = n(this, Et).width, d = 0, l = 0, h = r - d * 2, g = i - d * 2, S = Math.floor(c / h), y = Math.floor(e / S), k = e % S * (h + d) + d, b = y * (g + d) + d, { displayText: O, image: D } = a != null ? a : {};
6366
+ const o = n(this, Pt).getContext("2d"), c = n(this, Pt).width, d = 0, l = 0, h = r - d * 2, g = i - d * 2, S = Math.floor(c / h), y = Math.floor(e / S), k = e % S * (h + d) + d, b = y * (g + d) + d, { displayText: O, image: D } = a != null ? a : {};
6367
6367
  o.fillStyle = O || D ? n(this, Jt).videoBackground : n(this, Jt).background, o.strokeStyle = n(this, Jt).brand, o.beginPath(), o.moveTo(k + l, b), o.arcTo(k + h, b, k + h, b + l, l), o.arcTo(
6368
6368
  k + h,
6369
6369
  b + g,
@@ -6385,7 +6385,7 @@ const Op = class extends Bt {
6385
6385
  const o = Math.min(Math.max(a * 0.15, 100), 200), c = o * 0.2, d = o * 0.2;
6386
6386
  let l = r + c;
6387
6387
  const h = i + c, g = (S) => {
6388
- const y = n(this, Et).getContext("2d");
6388
+ const y = n(this, Pt).getContext("2d");
6389
6389
  y.save(), y.fillStyle = n(this, Jt).background, y.beginPath(), y.moveTo(l + d, h), y.arcTo(l + o, h, l + o, h + d, d), y.arcTo(
6390
6390
  l + o,
6391
6391
  h + o,
@@ -6405,10 +6405,10 @@ const Op = class extends Bt {
6405
6405
  /** @access private */
6406
6406
  drawTile(e, r, i) {
6407
6407
  var l, h;
6408
- if (n(this, Et) === void 0)
6408
+ if (n(this, Pt) === void 0)
6409
6409
  return;
6410
- const a = n(this, Et).getContext("2d");
6411
- a.fillStyle = n(this, Jt).background, a.fillRect(0, 0, n(this, Et).width, n(this, Et).height);
6410
+ const a = n(this, Pt).getContext("2d");
6411
+ a.fillStyle = n(this, Jt).background, a.fillRect(0, 0, n(this, Pt).width, n(this, Pt).height);
6412
6412
  const o = this.getSources();
6413
6413
  let c = 0, d = 0;
6414
6414
  for (; c < n(this, be).height - 5; ) {
@@ -6474,7 +6474,7 @@ const Op = class extends Bt {
6474
6474
  document.body.removeChild(n(this, nt));
6475
6475
  } catch (e) {
6476
6476
  }
6477
- this.removeAllSources(), f(this, Et, void 0), f(this, Wt, void 0), f(this, Js, void 0);
6477
+ this.removeAllSources(), f(this, Pt, void 0), f(this, Wt, void 0), f(this, Js, void 0);
6478
6478
  }
6479
6479
  /**
6480
6480
  * Initialize PiP and prepare sources
@@ -6492,7 +6492,7 @@ const Op = class extends Bt {
6492
6492
  f(this, be, {
6493
6493
  height: e != null ? e : _g,
6494
6494
  width: r != null ? r : Cg
6495
- }), i.height = n(this, be).height, i.width = n(this, be).width, i.autoplay = !0, i.muted = !0, i.srcObject = n(this, Et).captureStream(24), f(this, Wt, i), n(this, Wt).onloadedmetadata = () => {
6495
+ }), i.height = n(this, be).height, i.width = n(this, be).width, i.autoplay = !0, i.muted = !0, i.srcObject = n(this, Pt).captureStream(24), f(this, Wt, i), n(this, Wt).onloadedmetadata = () => {
6496
6496
  try {
6497
6497
  this.emit("pipStarted"), n(this, Wt).onleavepictureinpicture = () => {
6498
6498
  this.emit("pipEnded");
@@ -6608,7 +6608,7 @@ const Op = class extends Bt {
6608
6608
  }
6609
6609
  };
6610
6610
  let Qu = Op;
6611
- Et = new WeakMap(), Nr = new WeakMap(), nt = new WeakMap(), Wt = new WeakMap(), be = new WeakMap(), Jt = new WeakMap(), Js = new WeakMap(), $e = new WeakMap(), De = new WeakMap(), On = new WeakMap(), Nn = new WeakMap(), Ln = new WeakMap(), Ks = new WeakMap(), Vn = new WeakMap(), Qd = new WeakMap(), $o = new WeakMap();
6611
+ Pt = new WeakMap(), Nr = new WeakMap(), nt = new WeakMap(), Wt = new WeakMap(), be = new WeakMap(), Jt = new WeakMap(), Js = new WeakMap(), $e = new WeakMap(), De = new WeakMap(), On = new WeakMap(), Nn = new WeakMap(), Ln = new WeakMap(), Ks = new WeakMap(), Vn = new WeakMap(), Qd = new WeakMap(), $o = new WeakMap();
6612
6612
  var fr;
6613
6613
  (function(s) {
6614
6614
  s[s.PUBLISHER = 0] = "PUBLISHER", s[s.SUBSCRIBER = 1] = "SUBSCRIBER";
@@ -17990,7 +17990,7 @@ var zD = Object.defineProperty, YD = Object.getOwnPropertyDescriptor, Bs = (s, t
17990
17990
  return r && i && zD(t, e, i), i;
17991
17991
  };
17992
17992
  const QD = ["ACTIVE_GRID", "PAGINATED", "MANUAL"];
17993
- var Ie, cc, Th, Vi, oo, ra, Rd, $i, Pt, Em;
17993
+ var Ie, cc, Th, Vi, oo, ra, Rd, $i, wt, Em;
17994
17994
  let is = (Em = class extends Bt {
17995
17995
  constructor(t, e, r) {
17996
17996
  const i = t.getValue("logger");
@@ -18040,7 +18040,7 @@ let is = (Em = class extends Bt {
18040
18040
  p(this, "all");
18041
18041
  m(this, Ie, void 0);
18042
18042
  m(this, $i, void 0);
18043
- m(this, Pt, void 0);
18043
+ m(this, wt, void 0);
18044
18044
  p(this, "rateLimitConfig", {
18045
18045
  maxInvocations: 5,
18046
18046
  period: 1
@@ -18070,7 +18070,7 @@ let is = (Em = class extends Bt {
18070
18070
  * Keeps a list of all participants who have been present in the selected peers list.
18071
18071
  */
18072
18072
  p(this, "selectedPeers", AS);
18073
- f(this, Ie, t), f(this, $i, e), f(this, Pt, r), this.waitlisted = new ro(i), this.joined = new ro(i), this.videoSubscribed = new ro(i), this.audioSubscribed = new ro(i), this.active = this.videoSubscribed, this.pinned = new ro(i), this.all = new WD(i), this.viewMode = "ACTIVE_GRID", this.currentPage = 0, this.setupEvents();
18073
+ f(this, Ie, t), f(this, $i, e), f(this, wt, r), this.waitlisted = new ro(i), this.joined = new ro(i), this.videoSubscribed = new ro(i), this.audioSubscribed = new ro(i), this.active = this.videoSubscribed, this.pinned = new ro(i), this.all = new WD(i), this.viewMode = "ACTIVE_GRID", this.currentPage = 0, this.setupEvents();
18074
18074
  }
18075
18075
  /**
18076
18076
  * Return the controls for Picture-in-Picture
@@ -18155,7 +18155,7 @@ let is = (Em = class extends Bt {
18155
18155
  "1205"
18156
18156
  );
18157
18157
  const e = (i = (r = this.waitlisted.get(t)) == null ? void 0 : r.userId) != null ? i : t;
18158
- return n(this, Pt).acceptWaitingRoomRequest([e]);
18158
+ return n(this, wt).acceptWaitingRoomRequest([e]);
18159
18159
  }
18160
18160
  /**
18161
18161
  * We need a new event for socket service events
@@ -18169,7 +18169,7 @@ let is = (Em = class extends Bt {
18169
18169
  var i, a;
18170
18170
  return (a = (i = this.waitlisted.get(r)) == null ? void 0 : i.userId) != null ? a : r;
18171
18171
  });
18172
- return n(this, Pt).acceptWaitingRoomRequest(e);
18172
+ return n(this, wt).acceptWaitingRoomRequest(e);
18173
18173
  });
18174
18174
  }
18175
18175
  /**
@@ -18186,7 +18186,7 @@ let is = (Em = class extends Bt {
18186
18186
  "1205"
18187
18187
  );
18188
18188
  const e = (i = (r = this.waitlisted.get(t)) == null ? void 0 : r.userId) != null ? i : t;
18189
- n(this, Pt).rejectWaitingRoomRequest([e]);
18189
+ n(this, wt).rejectWaitingRoomRequest([e]);
18190
18190
  });
18191
18191
  }
18192
18192
  setViewMode(t) {
@@ -18344,7 +18344,7 @@ let is = (Em = class extends Bt {
18344
18344
  "1201"
18345
18345
  );
18346
18346
  const e = !0;
18347
- n(this, Pt).kickAll(e);
18347
+ n(this, wt).kickAll(e);
18348
18348
  });
18349
18349
  }
18350
18350
  broadcastMessage(t, e, r) {
@@ -18355,7 +18355,7 @@ let is = (Em = class extends Bt {
18355
18355
  throw new R("`type` must be a non-empty string.", "1209");
18356
18356
  if (r)
18357
18357
  if ("meetingIds" in r)
18358
- yield n(this, Pt).broadcastToMeetings(t, r.meetingIds, e);
18358
+ yield n(this, wt).broadcastToMeetings(t, r.meetingIds, e);
18359
18359
  else {
18360
18360
  let i = [];
18361
18361
  "participantIds" in r ? i = r.participantIds : i = this.joined.toArray().filter(
@@ -18363,15 +18363,15 @@ let is = (Em = class extends Bt {
18363
18363
  var o;
18364
18364
  return (o = r.presetNames) == null ? void 0 : o.includes(a.presetName);
18365
18365
  }
18366
- ).map((a) => a.id), yield n(this, Pt).broadcastToPeers(t, i, e);
18366
+ ).map((a) => a.id), yield n(this, wt).broadcastToPeers(t, i, e);
18367
18367
  }
18368
18368
  else
18369
- yield n(this, Pt).broadcastMessage(t, e);
18369
+ yield n(this, wt).broadcastMessage(t, e);
18370
18370
  });
18371
18371
  }
18372
18372
  getAllJoinedPeers(t, e, r) {
18373
18373
  return u(this, null, function* () {
18374
- return (yield n(this, Pt).getRoomPeers(t, e, r)).peers.map(wr.formatSocketPeerMessage);
18374
+ return (yield n(this, wt).getRoomPeers(t, e, r)).peers.map(wr.formatSocketPeerMessage);
18375
18375
  });
18376
18376
  }
18377
18377
  /**
@@ -18383,12 +18383,12 @@ let is = (Em = class extends Bt {
18383
18383
  const r = this.joined.toArray().filter((a) => t.includes(a.id)).map((a) => a.userId), i = [...new Set(r)];
18384
18384
  if (!i.length)
18385
18385
  throw new R("Cannot update permissions, no valid userIDs found", "1204");
18386
- n(this, Pt).updatePermissions(i, e);
18386
+ n(this, wt).updatePermissions(i, e);
18387
18387
  });
18388
18388
  }
18389
18389
  getParticipantsInMeetingPreJoin() {
18390
18390
  return u(this, null, function* () {
18391
- return n(this, Pt).getRoomPeersNonPaginated();
18391
+ return n(this, wt).getRoomPeersNonPaginated();
18392
18392
  });
18393
18393
  }
18394
18394
  }, Ie = new WeakMap(), cc = new WeakSet(), Th = function() {
@@ -18399,7 +18399,7 @@ let is = (Em = class extends Bt {
18399
18399
  }, ra = new WeakSet(), Rd = function() {
18400
18400
  var t;
18401
18401
  return ((t = n(this, Ie).getValue("connectionHandler")) == null ? void 0 : t.mediaJoined) === !0;
18402
- }, $i = new WeakMap(), Pt = new WeakMap(), Em);
18402
+ }, $i = new WeakMap(), wt = new WeakMap(), Em);
18403
18403
  Bs([
18404
18404
  P.trace("Participants.setViewMode")
18405
18405
  ], is.prototype, "setViewMode", 1);
@@ -18544,7 +18544,7 @@ const co = (Pm = class {
18544
18544
  this.logger.debug(`Processing socket join for ${this.self.id === h.id ? "local peer" : "remote peer"} ${h.id} listed in socket peers.`), this.onParticipantSocketJoined(h), this.logger.debug(`Processed socket join for ${this.self.id === h.id ? "local peer" : "remote peer"} ${h.id} listed in socket peers.`);
18545
18545
  });
18546
18546
  }
18547
- handlePeerJoinedBroadcast({
18547
+ handlePeerMediaJoinedBroadcast({
18548
18548
  participant: s,
18549
18549
  producerHandoverFromPeerId: t
18550
18550
  }) {
@@ -18573,7 +18573,7 @@ const co = (Pm = class {
18573
18573
  this.handleSocketPeers.bind(this)
18574
18574
  ), this.roomSocketHandler.on(
18575
18575
  this.events.peerJoinedBroadcast,
18576
- this.handlePeerJoinedBroadcast.bind(this)
18576
+ this.handlePeerMediaJoinedBroadcast.bind(this)
18577
18577
  ), this.roomSocketHandler.on(
18578
18578
  this.events.selfJoinComplete,
18579
18579
  (r) => u(this, [r], function* ({
@@ -18705,35 +18705,37 @@ const co = (Pm = class {
18705
18705
  * Socket Service only
18706
18706
  */
18707
18707
  waitingRoomRequestHandler(s) {
18708
+ var r, i;
18709
+ this.logger.info(`Received waitlisted peers: ${((i = (r = s == null ? void 0 : s.requests) == null ? void 0 : r.map((a) => a.peerId)) == null ? void 0 : i.join(", ")) || "none"}`);
18708
18710
  const t = s.requests.filter(
18709
- (r) => !this.participants.waitlisted.toArray().find((i) => i.userId === r.userId)
18711
+ (a) => !this.participants.waitlisted.get(a.peerId)
18710
18712
  ), e = this.participants.waitlisted.toArray().filter(
18711
- (r) => !s.requests.find((i) => i.userId === r.userId)
18713
+ (a) => !s.requests.find((o) => o.peerId === a.id)
18712
18714
  );
18713
- t.forEach((r) => this.participants.waitlisted.add(
18715
+ t.forEach((a) => this.participants.waitlisted.add(
18714
18716
  new Sr(
18715
18717
  this.context,
18716
18718
  {
18717
- id: r.peerId,
18718
- displayName: r.displayName,
18719
+ id: a.peerId,
18720
+ displayName: a.displayName,
18719
18721
  audioMuted: !0,
18720
18722
  videoEnabled: !1,
18721
18723
  audioTrack: void 0,
18722
18724
  videoTrack: void 0,
18723
18725
  stageStatus: "OFF_STAGE",
18724
- userId: r.userId,
18726
+ userId: a.userId,
18725
18727
  flags: {},
18726
18728
  isHost: !1,
18727
- customParticipantId: r.customParticipantId,
18728
- picture: r.picture,
18729
+ customParticipantId: a.customParticipantId,
18730
+ picture: a.picture,
18729
18731
  metadata: {
18730
- preset_name: r.presetName
18732
+ preset_name: a.presetName
18731
18733
  }
18732
18734
  },
18733
18735
  this.self,
18734
18736
  this.roomSocketHandler
18735
18737
  )
18736
- )), e.forEach((r) => this.participants.waitlisted.delete(r.id));
18738
+ )), e.forEach((a) => this.participants.waitlisted.delete(a.id));
18737
18739
  }
18738
18740
  get maxPreferredStreams() {
18739
18741
  return this.participants.maxActiveParticipantsCount;
@@ -20405,7 +20407,7 @@ class LS extends Bt {
20405
20407
  }
20406
20408
  }
20407
20409
  Ot = new WeakMap();
20408
- var sO = Object.defineProperty, rO = Object.getOwnPropertyDescriptor, yt = (s, t, e, r) => {
20410
+ var sO = Object.defineProperty, rO = Object.getOwnPropertyDescriptor, Et = (s, t, e, r) => {
20409
20411
  for (var i = r > 1 ? void 0 : r ? rO(t, e) : t, a = s.length - 1, o; a >= 0; a--)
20410
20412
  (o = s[a]) && (i = (r ? o(t, e, i) : o(i)) || i);
20411
20413
  return r && i && sO(t, e, i), i;
@@ -20882,22 +20884,22 @@ let Qe = (wm = class extends LS {
20882
20884
  }, da = new WeakMap(), la = new WeakMap(), lc = new WeakSet(), Ph = function() {
20883
20885
  Array.from(n(this, la)).forEach((t) => this.updateVideo(t, !1)), Array.from(n(this, da)).forEach((t) => this.updateVideo(t, !0));
20884
20886
  }, wm);
20885
- yt([
20887
+ Et([
20886
20888
  P.trace("Self.cleanupEvents")
20887
20889
  ], Qe.prototype, "cleanupEvents", 1);
20888
- yt([
20890
+ Et([
20889
20891
  P.trace("Self.setupEvents")
20890
20892
  ], Qe.prototype, "setupEvents", 1);
20891
- yt([
20893
+ Et([
20892
20894
  P.trace("Self.setupTracks")
20893
20895
  ], Qe.prototype, "setupTracks", 1);
20894
- yt([
20896
+ Et([
20895
20897
  P.trace("Self.destructMediaHandler")
20896
20898
  ], Qe.prototype, "destructMediaHandler", 1);
20897
- yt([
20899
+ Et([
20898
20900
  P.trace("Self.removeDocumentEventListeners")
20899
20901
  ], Qe.prototype, "removeDocumentEventListeners", 1);
20900
- yt([
20902
+ Et([
20901
20903
  Pr.executeWithLock({
20902
20904
  methodName: "meeting.self.enableAudio",
20903
20905
  lockName: "Self.toggleAudio",
@@ -20905,7 +20907,7 @@ yt([
20905
20907
  }),
20906
20908
  P.trace("Self.enableAudio")
20907
20909
  ], Qe.prototype, "enableAudio", 1);
20908
- yt([
20910
+ Et([
20909
20911
  Pr.executeWithLock({
20910
20912
  methodName: "meeting.self.enableVideo",
20911
20913
  lockName: "Self.toggleVideo",
@@ -20913,10 +20915,10 @@ yt([
20913
20915
  }),
20914
20916
  P.trace("Self.enableVideo")
20915
20917
  ], Qe.prototype, "enableVideo", 1);
20916
- yt([
20918
+ Et([
20917
20919
  P.trace("Self.updateVideoConstraints")
20918
20920
  ], Qe.prototype, "updateVideoConstraints", 1);
20919
- yt([
20921
+ Et([
20920
20922
  P.trace("Self.enableScreenShare"),
20921
20923
  Pr.executeWithLock({
20922
20924
  methodName: "meeting.self.enableScreenShare",
@@ -20924,10 +20926,10 @@ yt([
20924
20926
  timeout: 3e3
20925
20927
  })
20926
20928
  ], Qe.prototype, "enableScreenShare", 1);
20927
- yt([
20929
+ Et([
20928
20930
  P.trace("Self.updateScreenshareConstraints")
20929
20931
  ], Qe.prototype, "updateScreenshareConstraints", 1);
20930
- yt([
20932
+ Et([
20931
20933
  Pr.executeWithLock({
20932
20934
  methodName: "meeting.self.disableAudio",
20933
20935
  lockName: "Self.toggleAudio",
@@ -20935,7 +20937,7 @@ yt([
20935
20937
  }),
20936
20938
  P.trace("Self.disableAudio")
20937
20939
  ], Qe.prototype, "disableAudio", 1);
20938
- yt([
20940
+ Et([
20939
20941
  Pr.executeWithLock({
20940
20942
  methodName: "meeting.self.disableVideo",
20941
20943
  lockName: "Self.toggleVideo",
@@ -20943,7 +20945,7 @@ yt([
20943
20945
  }),
20944
20946
  P.trace("Self.disableVideo")
20945
20947
  ], Qe.prototype, "disableVideo", 1);
20946
- yt([
20948
+ Et([
20947
20949
  Pr.executeWithLock({
20948
20950
  methodName: "meeting.self.disableScreenShare",
20949
20951
  lockName: "Self.toggleScreenShare",
@@ -20951,10 +20953,10 @@ yt([
20951
20953
  }),
20952
20954
  P.trace("Self.disableScreenShare")
20953
20955
  ], Qe.prototype, "disableScreenShare", 1);
20954
- yt([
20956
+ Et([
20955
20957
  P.trace("Self.setDevice")
20956
20958
  ], Qe.prototype, "setDevice", 1);
20957
- Qe = yt([
20959
+ Qe = Et([
20958
20960
  at("1100")
20959
20961
  ], Qe);
20960
20962
  class wp extends Error {
@@ -21150,7 +21152,7 @@ function aO(s) {
21150
21152
  };
21151
21153
  }
21152
21154
  var hc;
21153
- class vu extends Tt.EventEmitter {
21155
+ class vu extends yt.EventEmitter {
21154
21156
  constructor(e) {
21155
21157
  super();
21156
21158
  m(this, hc, void 0);
@@ -22695,7 +22697,7 @@ class pO {
22695
22697
  tr = new WeakMap(), Fi = new WeakMap();
22696
22698
  const gO = 2e3;
22697
22699
  var ma, We, Je, mc, fc, ji, fa, Sc, Sa, qi, Cs, Rs, kr, vc, Rh, El, xS, Tc, bh, Pl, US, wl, HS, _l, BS, Cl, FS, Rl, jS, yc, kh, bs, Ir;
22698
- class mO extends Tt.EventEmitter {
22700
+ class mO extends yt.EventEmitter {
22699
22701
  constructor(e, r) {
22700
22702
  super();
22701
22703
  m(this, Rs);
@@ -23428,7 +23430,7 @@ Gi = new WeakMap(), ks = new WeakMap(), Ec = new WeakMap(), Is = new WeakMap(),
23428
23430
  peerId: e.peerId
23429
23431
  });
23430
23432
  };
23431
- var wc, _c, Cc, Ta, ya, Ea, Rc, bc, Pa, wt, us, hs, Wi, Ji, rr, kc, Ol, KS, Nl, zS, Ll, YS, Vl, QS;
23433
+ var wc, _c, Cc, Ta, ya, Ea, Rc, bc, Pa, _t, us, hs, Wi, Ji, rr, kc, Ol, KS, Nl, zS, Ll, YS, Vl, QS;
23432
23434
  const $l = class {
23433
23435
  constructor({
23434
23436
  initialEnergyThreshold: t = 0.015,
@@ -23463,14 +23465,14 @@ const $l = class {
23463
23465
  m(this, bc, void 0);
23464
23466
  m(this, Pa, void 0);
23465
23467
  // State variables
23466
- m(this, wt, void 0);
23468
+ m(this, _t, void 0);
23467
23469
  m(this, us, void 0);
23468
23470
  m(this, hs, !1);
23469
23471
  m(this, Wi, 0);
23470
23472
  m(this, Ji, 0);
23471
23473
  m(this, rr, []);
23472
23474
  m(this, kc, void 0);
23473
- f(this, Ta, t), f(this, wt, t), f(this, wc, e), f(this, _c, r), f(this, Cc, i), f(this, ya, a), f(this, Ea, o), f(this, Rc, c), f(this, bc, d), f(this, Pa, l), f(this, kc, h), f(this, us, t / 2);
23475
+ f(this, Ta, t), f(this, _t, t), f(this, wc, e), f(this, _c, r), f(this, Cc, i), f(this, ya, a), f(this, Ea, o), f(this, Rc, c), f(this, bc, d), f(this, Pa, l), f(this, kc, h), f(this, us, t / 2);
23474
23476
  }
23475
23477
  get voiceDetected() {
23476
23478
  return n(this, hs);
@@ -23483,33 +23485,33 @@ const $l = class {
23483
23485
  processAudioChunk(t) {
23484
23486
  var o, c;
23485
23487
  const e = I(o = $l, Ll, YS).call(o, t), r = I(c = $l, Vl, QS).call(c, t);
23486
- return I(this, Ol, KS).call(this, e), e / n(this, us) > n(this, Pa) && e > n(this, wt) && r > n(this, wc) ? (f(this, Wi, n(this, Wi) + 1), f(this, Ji, n(this, Cc)), n(this, Wi) >= n(this, _c) && f(this, hs, !0)) : (f(this, Wi, 0), n(this, Ji) > 0 ? f(this, Ji, n(this, Ji) - 1) : n(this, hs) && f(this, hs, !1), n(this, hs) || I(this, Nl, zS).call(this, e)), { energy: e, isVoice: n(this, hs) };
23488
+ return I(this, Ol, KS).call(this, e), e / n(this, us) > n(this, Pa) && e > n(this, _t) && r > n(this, wc) ? (f(this, Wi, n(this, Wi) + 1), f(this, Ji, n(this, Cc)), n(this, Wi) >= n(this, _c) && f(this, hs, !0)) : (f(this, Wi, 0), n(this, Ji) > 0 ? f(this, Ji, n(this, Ji) - 1) : n(this, hs) && f(this, hs, !1), n(this, hs) || I(this, Nl, zS).call(this, e)), { energy: e, isVoice: n(this, hs) };
23487
23489
  }
23488
23490
  /**
23489
23491
  * Reset the detector state
23490
23492
  */
23491
23493
  reset() {
23492
- f(this, hs, !1), f(this, Wi, 0), f(this, Ji, 0), f(this, wt, n(this, Ta)), f(this, us, n(this, Ta) / 2), f(this, rr, []);
23494
+ f(this, hs, !1), f(this, Wi, 0), f(this, Ji, 0), f(this, _t, n(this, Ta)), f(this, us, n(this, Ta) / 2), f(this, rr, []);
23493
23495
  }
23494
23496
  /**
23495
23497
  * Get current adaptive threshold values for debugging/visualization
23496
23498
  */
23497
23499
  getThresholdInfo() {
23498
23500
  return {
23499
- currentEnergyThreshold: n(this, wt),
23501
+ currentEnergyThreshold: n(this, _t),
23500
23502
  backgroundNoiseEnergy: n(this, us),
23501
23503
  energyRatioThreshold: n(this, Pa)
23502
23504
  };
23503
23505
  }
23504
23506
  };
23505
23507
  let uo = $l;
23506
- wc = new WeakMap(), _c = new WeakMap(), Cc = new WeakMap(), Ta = new WeakMap(), ya = new WeakMap(), Ea = new WeakMap(), Rc = new WeakMap(), bc = new WeakMap(), Pa = new WeakMap(), wt = new WeakMap(), us = new WeakMap(), hs = new WeakMap(), Wi = new WeakMap(), Ji = new WeakMap(), rr = new WeakMap(), kc = new WeakMap(), Ol = new WeakSet(), KS = function(t) {
23507
- n(this, hs) ? f(this, wt, n(this, Ea) * n(this, wt) + (1 - n(this, Ea)) * t) : f(this, wt, n(this, ya) * n(this, wt) + (1 - n(this, ya)) * n(this, us)), f(this, wt, Math.max(
23508
+ wc = new WeakMap(), _c = new WeakMap(), Cc = new WeakMap(), Ta = new WeakMap(), ya = new WeakMap(), Ea = new WeakMap(), Rc = new WeakMap(), bc = new WeakMap(), Pa = new WeakMap(), _t = new WeakMap(), us = new WeakMap(), hs = new WeakMap(), Wi = new WeakMap(), Ji = new WeakMap(), rr = new WeakMap(), kc = new WeakMap(), Ol = new WeakSet(), KS = function(t) {
23509
+ n(this, hs) ? f(this, _t, n(this, Ea) * n(this, _t) + (1 - n(this, Ea)) * t) : f(this, _t, n(this, ya) * n(this, _t) + (1 - n(this, ya)) * n(this, us)), f(this, _t, Math.max(
23508
23510
  n(this, Rc),
23509
- Math.min(n(this, bc), n(this, wt))
23511
+ Math.min(n(this, bc), n(this, _t))
23510
23512
  ));
23511
23513
  }, Nl = new WeakSet(), zS = function(t) {
23512
- if (t < n(this, wt) * 1.2)
23514
+ if (t < n(this, _t) * 1.2)
23513
23515
  if (n(this, rr).push(t), n(this, rr).length > n(this, kc) && n(this, rr).shift(), n(this, rr).length >= 10) {
23514
23516
  const e = [...n(this, rr)].sort((i, a) => i - a), r = Math.floor(e.length / 2);
23515
23517
  f(this, us, e[r]);
@@ -23686,7 +23688,7 @@ var EO = Object.defineProperty, PO = Object.getOwnPropertyDescriptor, ge = (s, t
23686
23688
  for (var i = r > 1 ? void 0 : r ? PO(t, e) : t, a = s.length - 1, o; a >= 0; a--)
23687
23689
  (o = s[a]) && (i = (r ? o(t, e, i) : o(i)) || i);
23688
23690
  return r && i && EO(t, e, i), i;
23689
- }, Lc, Vc, Ke, j, Hl, gt, cr, Yi, Qi, $c, Lt, dr, mt, _t, lr, gi, xc, Oh, Bl, tv, Fl, sv, jl, rv, Uc, Nh, ql, iv, Gl, nv, tt, ot, Xi, po, Wl, av, Jl, ov, Kl, cv, zl, dv;
23691
+ }, Lc, Vc, Ke, j, Hl, gt, cr, Yi, Qi, $c, Lt, dr, mt, ft, lr, gi, xc, Oh, Bl, tv, Fl, sv, jl, rv, Uc, Nh, ql, iv, Gl, nv, tt, ot, Xi, po, Wl, av, Jl, ov, Kl, cv, zl, dv;
23690
23692
  class ce {
23691
23693
  constructor(t, e) {
23692
23694
  m(this, lr);
@@ -23740,13 +23742,13 @@ class ce {
23740
23742
  m(this, Lt, null);
23741
23743
  m(this, dr, void 0);
23742
23744
  m(this, mt, void 0);
23743
- m(this, _t, void 0);
23745
+ m(this, ft, void 0);
23744
23746
  var i, a;
23745
23747
  this.context = t;
23746
23748
  const {
23747
23749
  socket: r
23748
23750
  } = e;
23749
- this.mediaJoined = !1, f(this, Ke, r), f(this, cr, !1), f(this, j, new vO(t, r)), f(this, gt, n(this, j).events), f(this, dr, /* @__PURE__ */ new Set()), f(this, mt, /* @__PURE__ */ new Map()), f(this, Yi, !1), f(this, Qi, new wh(t.getValue("logger"))), f(this, _t, new ho(
23751
+ this.mediaJoined = !1, f(this, Ke, r), f(this, cr, !1), f(this, j, new vO(t, r)), f(this, gt, n(this, j).events), f(this, dr, /* @__PURE__ */ new Set()), f(this, mt, /* @__PURE__ */ new Map()), f(this, Yi, !1), f(this, Qi, new wh(t.getValue("logger"))), f(this, ft, new ho(
23750
23752
  this.context,
23751
23753
  n(this, j).socketHandler.audioActivity.bind(n(this, j).socketHandler)
23752
23754
  )), this.e2ee = (a = (i = t.getValue("modules").e2ee) == null ? void 0 : i.enabled) != null ? a : !1, this.handleSocketEvents(), this.handleCallstatsEvents(), f(this, $c, lp(
@@ -23833,7 +23835,8 @@ class ce {
23833
23835
  }
23834
23836
  leaveRoom() {
23835
23837
  return u(this, null, function* () {
23836
- n(this, j).stopAllTransports(), f(this, Yi, !1), n(this, lr, gi).mediaJoinAttempted = !1;
23838
+ var r;
23839
+ (r = n(this, ft)) == null || r.stop(), n(this, j).stopAllTransports(), f(this, Yi, !1), n(this, lr, gi).mediaJoinAttempted = !1;
23837
23840
  const t = {
23838
23841
  closeRoom: !1
23839
23842
  };
@@ -23842,11 +23845,11 @@ class ce {
23842
23845
  n(this, gt).leaveRoom,
23843
23846
  UR.toBinary(t)
23844
23847
  ) || this.logger.warn("MediaNodeClient.leaveRoom: media leave was not sent");
23845
- } catch (r) {
23846
- this.logger.error("MediaNodeClient.leaveRoom: media leave failed", { error: r });
23848
+ } catch (i) {
23849
+ this.logger.error("MediaNodeClient.leaveRoom: media leave failed", { error: i });
23847
23850
  }
23848
- this.context.getValue("callstats").callEnded(), this.context.getValue("telemetry").destruct().catch((r) => {
23849
- this.logger.error("leaveRoom::telemetry_destruct_failed", { error: r });
23851
+ this.context.getValue("callstats").callEnded(), this.context.getValue("telemetry").destruct().catch((i) => {
23852
+ this.logger.error("leaveRoom::telemetry_destruct_failed", { error: i });
23850
23853
  });
23851
23854
  });
23852
23855
  }
@@ -23959,7 +23962,7 @@ class ce {
23959
23962
  if (n(this, j).producers.has(o)) {
23960
23963
  const c = n(this, j).producers.get(o);
23961
23964
  if (!c.closed) {
23962
- yield c.replaceTrack({ track: t }), yield this.resumeMic(), n(this, _t) && (n(this, _t).audioTrack = t, n(this, _t).producerId = o, n(this, _t).start(!0));
23965
+ yield c.replaceTrack({ track: t }), yield this.resumeMic(), n(this, ft) && (n(this, ft).audioTrack = t, n(this, ft).producerId = o, n(this, ft).start(!0));
23963
23966
  return;
23964
23967
  }
23965
23968
  yield n(this, j).closeProducer(o, { stopTrack: !1 });
@@ -23974,7 +23977,7 @@ class ce {
23974
23977
  i
23975
23978
  );
23976
23979
  I(this, Xi, po).call(this, we.MIC, a.then((o) => o.id)), yield a.then((o) => {
23977
- n(this, _t) && (n(this, _t).audioTrack = o.track, n(this, _t).producerId = o.id, n(this, _t).start());
23980
+ n(this, ft) && (n(this, ft).audioTrack = o.track, n(this, ft).producerId = o.id, n(this, ft).start());
23978
23981
  });
23979
23982
  } catch (e) {
23980
23983
  throw new R(e);
@@ -23993,7 +23996,7 @@ class ce {
23993
23996
  this.logger.info("pauseMic::mic_producer_already_paused");
23994
23997
  return;
23995
23998
  }
23996
- e.pause(), (i = n(this, _t)) == null || i.stop();
23999
+ e.pause(), (i = n(this, ft)) == null || i.stop();
23997
24000
  const r = {
23998
24001
  producerId: e.id,
23999
24002
  pause: !0
@@ -24076,7 +24079,7 @@ class ce {
24076
24079
  return u(this, null, function* () {
24077
24080
  var e;
24078
24081
  const t = yield I(this, tt, ot).call(this, we.MIC);
24079
- t && (yield n(this, j).closeProducer(t)), (e = n(this, _t)) == null || e.stop(), n(this, mt).delete(we.MIC);
24082
+ t && (yield n(this, j).closeProducer(t)), (e = n(this, ft)) == null || e.stop(), n(this, mt).delete(we.MIC);
24080
24083
  });
24081
24084
  }
24082
24085
  disableScreenShare() {
@@ -24305,7 +24308,7 @@ class ce {
24305
24308
  });
24306
24309
  }
24307
24310
  }
24308
- Lc = new WeakMap(), Vc = new WeakMap(), Ke = new WeakMap(), j = new WeakMap(), Hl = new WeakMap(), gt = new WeakMap(), cr = new WeakMap(), Yi = new WeakMap(), Qi = new WeakMap(), $c = new WeakMap(), Lt = new WeakMap(), dr = new WeakMap(), mt = new WeakMap(), _t = new WeakMap(), lr = new WeakSet(), gi = function() {
24311
+ Lc = new WeakMap(), Vc = new WeakMap(), Ke = new WeakMap(), j = new WeakMap(), Hl = new WeakMap(), gt = new WeakMap(), cr = new WeakMap(), Yi = new WeakMap(), Qi = new WeakMap(), $c = new WeakMap(), Lt = new WeakMap(), dr = new WeakMap(), mt = new WeakMap(), ft = new WeakMap(), lr = new WeakSet(), gi = function() {
24309
24312
  return this.context.getValue("connectionHandler");
24310
24313
  }, xc = new WeakSet(), Oh = function(t) {
24311
24314
  this.mediaJoined = !1, f(this, cr, !1), n(this, Ke).isConnected && this.peerId === t && this.context.getValue("peerSessionStore").emit(_.MEDIA_ROOM_JOIN_FAILED);
@@ -24578,14 +24581,14 @@ var _O = Object.defineProperty, CO = Object.getOwnPropertyDescriptor, vn = (s, t
24578
24581
  for (var i = r > 1 ? void 0 : r ? CO(t, e) : t, a = s.length - 1, o; a >= 0; a--)
24579
24582
  (o = s[a]) && (i = (r ? o(t, e, i) : o(i)) || i);
24580
24583
  return r && i && _O(t, e, i), i;
24581
- }, Ra, es, Z, ft, It, _m;
24584
+ }, Ra, es, Z, St, It, _m;
24582
24585
  const uv = (_m = class {
24583
24586
  /**
24584
24587
  * Use await SelfController.init(roomNodeClient) instead
24585
24588
  */
24586
24589
  constructor(s, t, e, r) {
24587
24590
  // eslint-disable-next-line class-methods-use-this
24588
- m(this, ft);
24591
+ m(this, St);
24589
24592
  p(this, "self");
24590
24593
  p(this, "authToken");
24591
24594
  m(this, Ra, void 0);
@@ -24675,7 +24678,7 @@ const uv = (_m = class {
24675
24678
  if (e.canProduceAudio === W.Allowed && r)
24676
24679
  if ((s == null ? void 0 : s.readyState) === "live")
24677
24680
  try {
24678
- yield n(this, ft, It).shareMic(s), this.self.audioEnabled || n(this, ft, It).pauseMic();
24681
+ yield n(this, St, It).shareMic(s), this.self.audioEnabled || n(this, St, It).pauseMic();
24679
24682
  } catch (d) {
24680
24683
  this.self.disableAudio();
24681
24684
  }
@@ -24684,7 +24687,7 @@ const uv = (_m = class {
24684
24687
  if (e.canProduceVideo === W.Allowed && i)
24685
24688
  if ((t == null ? void 0 : t.readyState) === "live")
24686
24689
  try {
24687
- yield n(this, ft, It).shareWebcam(t), this.self.videoEnabled || n(this, ft, It).pauseWebcam();
24690
+ yield n(this, St, It).shareWebcam(t), this.self.videoEnabled || n(this, St, It).pauseWebcam();
24688
24691
  } catch (d) {
24689
24692
  this.self.disableVideo();
24690
24693
  }
@@ -24694,7 +24697,7 @@ const uv = (_m = class {
24694
24697
  const d = o.video, l = o.audio;
24695
24698
  if ((d == null ? void 0 : d.readyState) === "live")
24696
24699
  try {
24697
- yield (c = n(this, ft, It)) == null ? void 0 : c.shareScreen({
24700
+ yield (c = n(this, St, It)) == null ? void 0 : c.shareScreen({
24698
24701
  video: d,
24699
24702
  audio: (l == null ? void 0 : l.readyState) === "live" ? l : void 0
24700
24703
  });
@@ -24736,7 +24739,7 @@ const uv = (_m = class {
24736
24739
  return u(this, null, function* () {
24737
24740
  var r;
24738
24741
  const { wasSocketJoinAttempted: t, wasMediaJoinAttempted: e } = s;
24739
- n(this, Z).getValue("callstats").callEnded(), t || e ? (this.logger.info(`Resetting Self post reconnect. Peer has earlier tried joining the ${e ? "media room" : "socket room only"}. Not closing transports.`), yield this.joinRoom({ reconnected: !0, joinAttempts: s })) : (this.logger.info("Resetting Self post reconnect. User never joined the room so doing full reset."), (r = n(this, ft, It)) == null || r.reset({ resetTransportQueue: !0 }));
24742
+ n(this, Z).getValue("callstats").callEnded(), t || e ? (this.logger.info(`Resetting Self post reconnect. Peer has earlier tried joining the ${e ? "media room" : "socket room only"}. Not closing transports.`), yield this.joinRoom({ reconnected: !0, joinAttempts: s })) : (this.logger.info("Resetting Self post reconnect. User never joined the room so doing full reset."), (r = n(this, St, It)) == null || r.reset({ resetTransportQueue: !0 }));
24740
24743
  });
24741
24744
  }
24742
24745
  setupEvents() {
@@ -24842,7 +24845,7 @@ const uv = (_m = class {
24842
24845
  throw this.logger.error("SelfController.joinRoom: socket join failed", { error: r }), new R("Check the network and try again.", "0002");
24843
24846
  }
24844
24847
  if (this.viewType === ms.Livestream && (t != null && t.wasSocketJoinAttempted) && !t.wasMediaJoinAttempted && n(this, Z).getValue("stageStatus") !== "ON_STAGE") {
24845
- this.logger.info("Local livestream peer that only joined the socket room is not ON_STAGE. Closing transports, if any."), (e = n(this, ft, It)) == null || e.reset({ resetTransportQueue: !0 }), this.self.roomState = "joined", this.self.emit("roomJoined", { reconnected: s }), n(this, Z).notify("stageStatus");
24848
+ this.logger.info("Local livestream peer that only joined the socket room is not ON_STAGE. Closing transports, if any."), (e = n(this, St, It)) == null || e.reset({ resetTransportQueue: !0 }), this.self.roomState = "joined", this.self.emit("roomJoined", { reconnected: s }), n(this, Z).notify("stageStatus");
24846
24849
  return;
24847
24850
  }
24848
24851
  try {
@@ -24891,7 +24894,7 @@ const uv = (_m = class {
24891
24894
  peerId: t
24892
24895
  });
24893
24896
  }
24894
- const { canProduceAudio: c, canProduceVideo: d, canProduceScreenshare: l } = this.self.permissions, { roomJoined: h, error: g } = (o = yield (a = n(this, ft, It)) == null ? void 0 : a.joinRoom(
24897
+ const { canProduceAudio: c, canProduceVideo: d, canProduceScreenshare: l } = this.self.permissions, { roomJoined: h, error: g } = (o = yield (a = n(this, St, It)) == null ? void 0 : a.joinRoom(
24895
24898
  this.self.name,
24896
24899
  r,
24897
24900
  s,
@@ -24912,7 +24915,7 @@ const uv = (_m = class {
24912
24915
  leaveMediaRoom(s) {
24913
24916
  return u(this, null, function* () {
24914
24917
  const t = n(this, Z).getValue("viewType");
24915
- s !== "connected-meeting" && (yield this.cleanupSelf()), !(s === "stageLeft" && t === ms.Webinar) && n(this, ft, It) && (n(this, ft, It).mediaJoined && s !== "disconnected" && (yield n(this, ft, It).leaveRoom()), !(s === "stageLeft" && t === ms.Livestream) && (n(this, ft, It).mediaJoined = !1));
24918
+ s !== "connected-meeting" && (yield this.cleanupSelf()), !(s === "stageLeft" && t === ms.Webinar) && n(this, St, It) && (n(this, St, It).mediaJoined && s !== "disconnected" && (yield n(this, St, It).leaveRoom()), !(s === "stageLeft" && t === ms.Livestream) && (n(this, St, It).mediaJoined = !1));
24916
24919
  });
24917
24920
  }
24918
24921
  cleanupSelf() {
@@ -24920,7 +24923,7 @@ const uv = (_m = class {
24920
24923
  yield this.self.disableAudio(), yield this.self.disableVideo(), yield this.self.disableScreenShare(), this.self.cleanUpTracks(), this.self.destructMediaHandler(), navigator.isReactNative || this.self.removeDocumentEventListeners();
24921
24924
  });
24922
24925
  }
24923
- }, Ra = new WeakMap(), es = new WeakMap(), Z = new WeakMap(), ft = new WeakSet(), It = function() {
24926
+ }, Ra = new WeakMap(), es = new WeakMap(), Z = new WeakMap(), St = new WeakSet(), It = function() {
24924
24927
  return n(this, Z).getValue("roomNodeClient");
24925
24928
  }, _m);
24926
24929
  let ui = uv;
@@ -26319,7 +26322,7 @@ var QO = Object.defineProperty, XO = Object.getOwnPropertyDescriptor, Eu = (s, t
26319
26322
  return r && i && QO(t, e, i), i;
26320
26323
  };
26321
26324
  const am = 65535, ZO = 3, e1 = 15e3, t1 = 8e3, s1 = 50, r1 = 1e3, i1 = 1e4;
26322
- var Ms, Ia, _e, st, ct, Qr, Xr, Zi, en, Zr, Ds, Os, ei, tn, St, ti, vt, Ue, jc, Bh, Yl, Iv, Ql, Av, Xl, Mv, qc, Fh, Gc, jh, sn, mo, Zl, ju, Dv, eu, Ov, Wc, qh, Jc, Gh, Kc, Wh, tu, Nv, zc, Jh, Yc, Kh;
26325
+ var Ms, Ia, _e, st, ct, Qr, Xr, Zi, en, Zr, Ds, Os, ei, tn, vt, ti, Tt, Ue, jc, Bh, Yl, Iv, Ql, Av, Xl, Mv, qc, Fh, Gc, jh, sn, mo, Zl, ju, Dv, eu, Ov, Wc, qh, Jc, Gh, Kc, Wh, tu, Nv, zc, Jh, Yc, Kh;
26323
26326
  const kv = (ju = class {
26324
26327
  constructor(s, {
26325
26328
  peerId: t,
@@ -26357,9 +26360,9 @@ const kv = (ju = class {
26357
26360
  m(this, Os, void 0);
26358
26361
  m(this, ei, void 0);
26359
26362
  m(this, tn, void 0);
26360
- m(this, St, 0);
26363
+ m(this, vt, 0);
26361
26364
  m(this, ti, void 0);
26362
- m(this, vt, !0);
26365
+ m(this, Tt, !0);
26363
26366
  m(this, Ue, void 0);
26364
26367
  if (!t || !e || !r)
26365
26368
  throw new R("peerId, meetingId, or authToken can not be empty", "0404");
@@ -26417,10 +26420,10 @@ const kv = (ju = class {
26417
26420
  connect() {
26418
26421
  return u(this, null, function* () {
26419
26422
  var t;
26420
- const s = n(this, St) + 1;
26421
- f(this, St, s), I(this, Wc, qh).call(this), f(this, vt, !0), I(this, Xl, Mv).call(this);
26423
+ const s = n(this, vt) + 1;
26424
+ f(this, vt, s), I(this, Wc, qh).call(this), f(this, Tt, !0), I(this, Xl, Mv).call(this);
26422
26425
  try {
26423
- if (yield n(this, _e).connect(), !n(this, vt) || s !== n(this, St))
26426
+ if (yield n(this, _e).connect(), !n(this, Tt) || s !== n(this, vt))
26424
26427
  throw new Error("Socket connection was canceled");
26425
26428
  I(this, Gc, jh).call(this, this.peerId), (t = n(this, Ds)) != null || f(this, Ds, this.peerId), n(this, st, ct).socketState = {
26426
26429
  state: "connected",
@@ -26428,12 +26431,12 @@ const kv = (ju = class {
26428
26431
  reconnectionAttempt: void 0
26429
26432
  };
26430
26433
  } catch (e) {
26431
- throw this.logger.error(`Websocket connection failed with URL: ${n(this, sn, mo)}`, { error: e }), n(this, vt) && s === n(this, St) && I(this, Kc, Wh).call(this, s), e;
26434
+ throw this.logger.error(`Websocket connection failed with URL: ${n(this, sn, mo)}`, { error: e }), n(this, Tt) && s === n(this, vt) && I(this, Kc, Wh).call(this, s), e;
26432
26435
  }
26433
26436
  });
26434
26437
  }
26435
26438
  disconnect() {
26436
- f(this, St, n(this, St) + 1), f(this, vt, !1), I(this, Wc, qh).call(this), I(this, qc, Fh).call(this), f(this, Ds, void 0), n(this, _e).disconnect(), n(this, st, ct).socketState = {
26439
+ f(this, vt, n(this, vt) + 1), f(this, Tt, !1), I(this, Wc, qh).call(this), I(this, qc, Fh).call(this), f(this, Ds, void 0), n(this, _e).disconnect(), n(this, st, ct).socketState = {
26437
26440
  state: "disconnected",
26438
26441
  reconnected: !1,
26439
26442
  reconnectionAttempt: void 0
@@ -26547,15 +26550,15 @@ const kv = (ju = class {
26547
26550
  var s;
26548
26551
  this.logger.info(`Websocket connected with URL: ${n(this, sn, mo)}`), (s = n(this, Ds)) != null || f(this, Ds, this.peerId), n(this, st, ct).updateSocketConnectionState("connected");
26549
26552
  })), this.onStateEvent("disconnected", ({ code: s, reason: t }) => {
26550
- !n(this, vt) || n(this, ti) === n(this, St) || (this.logger.info("SocketService::Disconnected from socket-edge", { error: { code: s, reason: t } }), n(this, st, ct).updateSocketConnectionState("disconnected"), n(this, Ue).getValue("peerSessionStore").emit(
26553
+ !n(this, Tt) || n(this, ti) === n(this, vt) || (this.logger.info("SocketService::Disconnected from socket-edge", { error: { code: s, reason: t } }), n(this, st, ct).updateSocketConnectionState("disconnected"), n(this, Ue).getValue("peerSessionStore").emit(
26551
26554
  _.SOCKET_SERVICE_DISCONNECTED,
26552
26555
  { joinAttempted: n(this, st, ct).joinAttempted }
26553
- ), I(this, Kc, Wh).call(this, n(this, St)));
26556
+ ), I(this, Kc, Wh).call(this, n(this, vt)));
26554
26557
  });
26555
26558
  }
26556
26559
  }, Ms = new WeakMap(), Ia = new WeakMap(), _e = new WeakMap(), st = new WeakSet(), ct = function() {
26557
26560
  return n(this, Ue).getValue("connectionHandler");
26558
- }, Qr = new WeakMap(), Xr = new WeakMap(), Zi = new WeakMap(), en = new WeakMap(), Zr = new WeakMap(), Ds = new WeakMap(), Os = new WeakMap(), ei = new WeakMap(), tn = new WeakMap(), St = new WeakMap(), ti = new WeakMap(), vt = new WeakMap(), Ue = new WeakMap(), jc = new WeakSet(), Bh = function(s) {
26561
+ }, Qr = new WeakMap(), Xr = new WeakMap(), Zi = new WeakMap(), en = new WeakMap(), Zr = new WeakMap(), Ds = new WeakMap(), Os = new WeakMap(), ei = new WeakMap(), tn = new WeakMap(), vt = new WeakMap(), ti = new WeakMap(), Tt = new WeakMap(), Ue = new WeakMap(), jc = new WeakSet(), Bh = function(s) {
26559
26562
  let t = up({
26560
26563
  servicePrefix: "ws",
26561
26564
  baseURI: n(this, Ue).getValue("baseURI")
@@ -26648,22 +26651,22 @@ const kv = (ju = class {
26648
26651
  var s;
26649
26652
  n(this, ei) !== void 0 && (n(this, Os).clearTimeout(n(this, ei)), f(this, ei, void 0)), (s = n(this, tn)) == null || s.call(this), f(this, tn, void 0);
26650
26653
  }, Jc = new WeakSet(), Gh = function(s, t) {
26651
- !n(this, vt) || s !== n(this, St) || (t && this.logger.error("SocketService::Reconnect loop failed", { error: t }), f(this, vt, !1), I(this, qc, Fh).call(this), f(this, Ds, void 0), n(this, st, ct).updateSocketConnectionState("failed"), n(this, Ue).getValue("peerSessionStore").emit(_.SOCKET_SERVICE_FAILED));
26654
+ !n(this, Tt) || s !== n(this, vt) || (t && this.logger.error("SocketService::Reconnect loop failed", { error: t }), f(this, Tt, !1), I(this, qc, Fh).call(this), f(this, Ds, void 0), n(this, st, ct).updateSocketConnectionState("failed"), n(this, Ue).getValue("peerSessionStore").emit(_.SOCKET_SERVICE_FAILED));
26652
26655
  }, Kc = new WeakSet(), Wh = function(s) {
26653
- !n(this, vt) || n(this, ti) === s || (f(this, ti, s), n(this, st, ct).updateSocketConnectionState("reconnecting"), I(this, tu, Nv).call(this, s).catch(
26656
+ !n(this, Tt) || n(this, ti) === s || (f(this, ti, s), n(this, st, ct).updateSocketConnectionState("reconnecting"), I(this, tu, Nv).call(this, s).catch(
26654
26657
  (t) => I(this, Jc, Gh).call(this, s, t)
26655
26658
  ));
26656
26659
  }, tu = new WeakSet(), Nv = function(s) {
26657
26660
  return u(this, null, function* () {
26658
26661
  try {
26659
26662
  for (let t = 1; t <= s1; t += 1) {
26660
- if (!n(this, vt) || s !== n(this, St) || (yield I(this, eu, Ov).call(this, t), !n(this, vt) || s !== n(this, St)))
26663
+ if (!n(this, Tt) || s !== n(this, vt) || (yield I(this, eu, Ov).call(this, t), !n(this, Tt) || s !== n(this, vt)))
26661
26664
  return;
26662
26665
  this.updateURL(ln()), this.logger.info("SocketService::Attempting to reconnect to socket-edge", {
26663
26666
  socket: { retryAttempt: t }
26664
26667
  }), n(this, st, ct).updateSocketConnectionState("reconnectAttempt", t);
26665
26668
  try {
26666
- if (yield n(this, _e).connect(!0), !n(this, vt) || s !== n(this, St))
26669
+ if (yield n(this, _e).connect(!0), !n(this, Tt) || s !== n(this, vt))
26667
26670
  return;
26668
26671
  if (!this.isConnected)
26669
26672
  throw new Error("Reconnect failed");
@@ -26676,7 +26679,7 @@ const kv = (ju = class {
26676
26679
  );
26677
26680
  return;
26678
26681
  } catch (e) {
26679
- if (!n(this, vt) || s !== n(this, St))
26682
+ if (!n(this, Tt) || s !== n(this, vt))
26680
26683
  return;
26681
26684
  this.logger.error(
26682
26685
  `Websocket connection retry attempt ${t} failed with URL: ${n(this, sn, mo)}`,
@@ -27568,7 +27571,7 @@ let oi = (Rm = class {
27568
27571
  video: !0
27569
27572
  };
27570
27573
  return a.setValue("options", e), a.setValue("peerId", t), a.setValue("modules", o), a.setValue("sdkName", "web-core"), a.setValue("meetingId", r), a.setValue("apiBase", i.apiBase), a.setValue("baseURI", i.baseURI), a.setValue("userId", i.participantId), a.setValue("organizationId", i.orgId), a.setValue("authToken", e.authToken), a.setValue("overrides", (d = e.overrides) != null ? d : {}), a.setValue("env", AC({ baseURI: i.baseURI })), a.setValue("defaults", c), a.setValue("onError", e.onError || (() => {
27571
- })), a.setValue("cachedUserDetails", Vs(e.cachedUserDetails)), a.setValue("sdkVersion", "2.0.3"), (l = e.modules) != null && l.experimentalAudioPlayback && a.setValue("audioPlayback", new m1()), a;
27574
+ })), a.setValue("cachedUserDetails", Vs(e.cachedUserDetails)), a.setValue("sdkVersion", "2.0.4-staging.2"), (l = e.modules) != null && l.experimentalAudioPlayback && a.setValue("audioPlayback", new m1()), a;
27572
27575
  }
27573
27576
  join() {
27574
27577
  return u(this, null, function* () {