@genai-fi/base 4.3.7 → 4.3.8

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.
Files changed (48) hide show
  1. package/dist/{Button-BgSe1MyE.js → Button-HlUfDiMM.js} +3 -3
  2. package/dist/{CircularProgress-DgKnRiq7.js → CircularProgress-DZ8YZ0Dt.js} +345 -310
  3. package/dist/{Close-Cv_QwhIN.js → Close-TS8H1lQg.js} +1 -1
  4. package/dist/{DefaultPropsProvider-BurgXZzw.js → DefaultPropsProvider-B_x1hwuY.js} +2 -2
  5. package/dist/{DialogQR-DoM8ZHBM.js → DialogQR-ByOert0g.js} +4 -4
  6. package/dist/{FileSaver.min-DhePf63e.js → FileSaver.min-CDwyANUI.js} +57 -57
  7. package/dist/{FlashWifi-slUpI7sB.js → FlashWifi-CNanHNye.js} +1 -1
  8. package/dist/{Portal-MiwrHMB_.js → Portal-BdRLJx1y.js} +140 -133
  9. package/dist/assets/SidePanel.css +1 -1
  10. package/dist/assets/SvgLayer.css +1 -1
  11. package/dist/assets/Widget.css +1 -1
  12. package/dist/{browser-HW-wgeM2.js → browser-DWbgwj89.js} +421 -451
  13. package/dist/components/AlertPara/AlertPara.js +1 -1
  14. package/dist/components/Application/Application.js +724 -689
  15. package/dist/components/BusyButton/BusyButton.d.ts +4 -4
  16. package/dist/components/BusyButton/BusyButton.js +1 -1
  17. package/dist/components/Button/Button.js +2 -2
  18. package/dist/components/ConnectionStatus/ConnectionStatus.js +3 -3
  19. package/dist/components/ConnectionStatus/FlashWifi.js +1 -1
  20. package/dist/components/Feedback/Feedback.js +4 -4
  21. package/dist/components/Feedback/Rating.js +1 -1
  22. package/dist/components/Help/Help.js +5 -5
  23. package/dist/components/LangSelect/LangSelect.js +1 -1
  24. package/dist/components/Motd/Motd.js +1 -1
  25. package/dist/components/PieScore/PieScore.js +9609 -6092
  26. package/dist/components/QRCode/DialogQR.js +4 -4
  27. package/dist/components/QRCode/QRCode.js +2 -2
  28. package/dist/components/SidePanel/SidePanel.d.ts +2 -1
  29. package/dist/components/SidePanel/SidePanel.js +107 -89
  30. package/dist/components/Webcam/Webcam.js +3 -3
  31. package/dist/components/WorkflowLayout/Widget.js +1460 -1438
  32. package/dist/{createSvgIcon-BM4dw4Lw.js → createSvgIcon-DjQWJ3wn.js} +2 -2
  33. package/dist/{createTheme-DV959X3d.js → createTheme-DnBeI7Zz.js} +752 -749
  34. package/dist/hooks/peer.js +1 -1
  35. package/dist/{index-SOhdqzHq.js → index-B_zFkp-8.js} +2 -2
  36. package/dist/react-CiLnfHJp.js +140 -0
  37. package/dist/services/peer2peer/Incoming.js +1 -1
  38. package/dist/services/peer2peer/Outgoing.js +1 -1
  39. package/dist/services/peer2peer/Peer2Peer.js +538 -541
  40. package/dist/services/peer2peer/PeerConnection.js +1 -1
  41. package/dist/state/webrtcState.js +1 -1
  42. package/dist/style/theme.js +1 -1
  43. package/dist/util/Observer.js +1 -1
  44. package/dist/util/zip.js +1 -1
  45. package/dist/vanilla-OLGM3aAq.js +439 -0
  46. package/package.json +3 -3
  47. package/dist/react-B9NW8BS7.js +0 -112
  48. package/dist/vanilla-BJxibF1U.js +0 -404
@@ -1,16 +1,16 @@
1
1
  var ft = Object.defineProperty;
2
- var ht = (r) => {
2
+ var pt = (r) => {
3
3
  throw TypeError(r);
4
4
  };
5
- var lt = (r, e, t) => e in r ? ft(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
- var m = (r, e, t) => lt(r, typeof e != "symbol" ? e + "" : e, t);
7
- var M = (r, e, t) => e.has(r) ? ht("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
5
+ var ht = (r, e, t) => e in r ? ft(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
+ var m = (r, e, t) => ht(r, typeof e != "symbol" ? e + "" : e, t);
7
+ var I = (r, e, t) => e.has(r) ? pt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
8
8
  import { g as ut } from "../../_commonjsHelpers-DaMA6jEr.js";
9
- import { E as dt } from "../../index-SOhdqzHq.js";
10
- import q from "./PeerConnection.js";
11
- import mt from "./Outgoing.js";
12
- import gt from "./Incoming.js";
13
- function yt(r, e) {
9
+ import { E as dt } from "../../index-B_zFkp-8.js";
10
+ import K from "./PeerConnection.js";
11
+ import lt from "./Outgoing.js";
12
+ import mt from "./Incoming.js";
13
+ function gt(r, e) {
14
14
  for (var t = 0; t < e.length; t++) {
15
15
  const n = e[t];
16
16
  if (typeof n != "string" && !Array.isArray(n)) {
@@ -45,10 +45,10 @@ class _t {
45
45
  toArrayBuffer() {
46
46
  const e = [];
47
47
  for (const t of this._parts) e.push(t);
48
- return Ct(e).buffer;
48
+ return yt(e).buffer;
49
49
  }
50
50
  }
51
- function Ct(r) {
51
+ function yt(r) {
52
52
  let e = 0;
53
53
  for (const i of r) e += i.byteLength;
54
54
  const t = new Uint8Array(e);
@@ -59,14 +59,14 @@ function Ct(r) {
59
59
  }
60
60
  return t;
61
61
  }
62
- function Te(r) {
63
- return new bt(r).unpack();
62
+ function Se(r) {
63
+ return new Ct(r).unpack();
64
64
  }
65
- function Re(r) {
66
- const e = new vt(), t = e.pack(r);
65
+ function Te(r) {
66
+ const e = new bt(), t = e.pack(r);
67
67
  return t instanceof Promise ? t.then(() => e.getBuffer()) : e.getBuffer();
68
68
  }
69
- class bt {
69
+ class Ct {
70
70
  constructor(e) {
71
71
  this.index = 0, this.dataBuffer = e, this.dataView = new Uint8Array(this.dataBuffer), this.length = this.dataBuffer.byteLength;
72
72
  }
@@ -205,7 +205,7 @@ class bt {
205
205
  throw new Error("BinaryPackFailure: read index out of range");
206
206
  }
207
207
  }
208
- class vt {
208
+ class bt {
209
209
  getBuffer() {
210
210
  return this._bufferBuilder.toArrayBuffer();
211
211
  }
@@ -355,10 +355,10 @@ class vt {
355
355
  this._bufferBuilder = new _t(), this._textEncoder = new TextEncoder();
356
356
  }
357
357
  }
358
- let xe = !0, Pe = !0;
359
- function U(r, e, t) {
358
+ let ke = !0, Re = !0;
359
+ function O(r, e, t) {
360
360
  const n = r.match(e);
361
- return n && n.length >= t && parseInt(n[t], 10);
361
+ return n && n.length >= t && parseFloat(n[t], 10);
362
362
  }
363
363
  function x(r, e, t) {
364
364
  if (!r.RTCPeerConnection)
@@ -367,9 +367,9 @@ function x(r, e, t) {
367
367
  n.addEventListener = function(o, a) {
368
368
  if (o !== e)
369
369
  return i.apply(this, arguments);
370
- const c = (p) => {
371
- const f = t(p);
372
- f && (a.handleEvent ? a.handleEvent(f) : a(f));
370
+ const c = (f) => {
371
+ const p = t(f);
372
+ p && (a.handleEvent ? a.handleEvent(p) : a(p));
373
373
  };
374
374
  return this._eventMap = this._eventMap || {}, this._eventMap[e] || (this._eventMap[e] = /* @__PURE__ */ new Map()), this._eventMap[e].set(a, c), i.apply(this, [
375
375
  o,
@@ -404,21 +404,21 @@ function x(r, e, t) {
404
404
  configurable: !0
405
405
  });
406
406
  }
407
- function kt(r) {
408
- return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (xe = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
407
+ function vt(r) {
408
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (ke = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
409
409
  }
410
410
  function St(r) {
411
- return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Pe = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
411
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Re = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
412
412
  }
413
- function Ee() {
413
+ function xe() {
414
414
  if (typeof window == "object") {
415
- if (xe)
415
+ if (ke)
416
416
  return;
417
417
  typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
418
418
  }
419
419
  }
420
- function pe(r, e) {
421
- Pe && console.warn(r + " is deprecated, please use " + e + " instead.");
420
+ function ce(r, e) {
421
+ Re && console.warn(r + " is deprecated, please use " + e + " instead.");
422
422
  }
423
423
  function Tt(r) {
424
424
  const e = { browser: null, version: null };
@@ -431,23 +431,27 @@ function Tt(r) {
431
431
  return { browser: "chrome", version: parseInt(n.version, 10) };
432
432
  }
433
433
  if (t.mozGetUserMedia)
434
- e.browser = "firefox", e.version = U(
434
+ e.browser = "firefox", e.version = parseInt(O(
435
435
  t.userAgent,
436
436
  /Firefox\/(\d+)\./,
437
437
  1
438
- );
438
+ ));
439
439
  else if (t.webkitGetUserMedia || r.isSecureContext === !1 && r.webkitRTCPeerConnection)
440
- e.browser = "chrome", e.version = U(
440
+ e.browser = "chrome", e.version = parseInt(O(
441
441
  t.userAgent,
442
442
  /Chrom(e|ium)\/(\d+)\./,
443
443
  2
444
- );
444
+ )) || null;
445
445
  else if (r.RTCPeerConnection && t.userAgent.match(/AppleWebKit\/(\d+)\./))
446
- e.browser = "safari", e.version = U(
446
+ e.browser = "safari", e.version = parseInt(O(
447
447
  t.userAgent,
448
448
  /AppleWebKit\/(\d+)\./,
449
449
  1
450
- ), e.supportsUnifiedPlan = r.RTCRtpTransceiver && "currentDirection" in r.RTCRtpTransceiver.prototype;
450
+ )), e.supportsUnifiedPlan = r.RTCRtpTransceiver && "currentDirection" in r.RTCRtpTransceiver.prototype, e._safariVersion = O(
451
+ t.userAgent,
452
+ /Version\/(\d+(\.?\d+))/,
453
+ 1
454
+ );
451
455
  else
452
456
  return e.browser = "Not a supported browser.", e;
453
457
  return e;
@@ -455,16 +459,16 @@ function Tt(r) {
455
459
  function ue(r) {
456
460
  return Object.prototype.toString.call(r) === "[object Object]";
457
461
  }
458
- function De(r) {
462
+ function Pe(r) {
459
463
  return ue(r) ? Object.keys(r).reduce(function(e, t) {
460
- const n = ue(r[t]), i = n ? De(r[t]) : r[t], s = n && !Object.keys(i).length;
464
+ const n = ue(r[t]), i = n ? Pe(r[t]) : r[t], s = n && !Object.keys(i).length;
461
465
  return i === void 0 || s ? e : Object.assign(e, { [t]: i });
462
466
  }, {}) : r;
463
467
  }
464
- function Z(r, e, t) {
468
+ function W(r, e, t) {
465
469
  !e || t.has(e.id) || (t.set(e.id, e), Object.keys(e).forEach((n) => {
466
- n.endsWith("Id") ? Z(r, r.get(e[n]), t) : n.endsWith("Ids") && e[n].forEach((i) => {
467
- Z(r, r.get(i), t);
470
+ n.endsWith("Id") ? W(r, r.get(e[n]), t) : n.endsWith("Ids") && e[n].forEach((i) => {
471
+ W(r, r.get(i), t);
468
472
  });
469
473
  }));
470
474
  }
@@ -477,12 +481,12 @@ function de(r, e, t) {
477
481
  o.type === "track" && o.trackIdentifier === e.id && s.push(o);
478
482
  }), s.forEach((o) => {
479
483
  r.forEach((a) => {
480
- a.type === n && a.trackId === o.id && Z(r, a, i);
484
+ a.type === n && a.trackId === o.id && W(r, a, i);
481
485
  });
482
486
  }), i;
483
487
  }
484
- const me = Ee;
485
- function Ie(r, e) {
488
+ const le = xe;
489
+ function Ee(r, e) {
486
490
  const t = r && r.navigator;
487
491
  if (!t.mediaDevices)
488
492
  return;
@@ -490,49 +494,49 @@ function Ie(r, e) {
490
494
  if (typeof a != "object" || a.mandatory || a.optional)
491
495
  return a;
492
496
  const c = {};
493
- return Object.keys(a).forEach((p) => {
494
- if (p === "require" || p === "advanced" || p === "mediaSource")
497
+ return Object.keys(a).forEach((f) => {
498
+ if (f === "require" || f === "advanced" || f === "mediaSource")
495
499
  return;
496
- const f = typeof a[p] == "object" ? a[p] : { ideal: a[p] };
497
- f.exact !== void 0 && typeof f.exact == "number" && (f.min = f.max = f.exact);
498
- const h = function(l, d) {
499
- return l ? l + d.charAt(0).toUpperCase() + d.slice(1) : d === "deviceId" ? "sourceId" : d;
500
+ const p = typeof a[f] == "object" ? a[f] : { ideal: a[f] };
501
+ p.exact !== void 0 && typeof p.exact == "number" && (p.min = p.max = p.exact);
502
+ const h = function(u, l) {
503
+ return u ? u + l.charAt(0).toUpperCase() + l.slice(1) : l === "deviceId" ? "sourceId" : l;
500
504
  };
501
- if (f.ideal !== void 0) {
505
+ if (p.ideal !== void 0) {
502
506
  c.optional = c.optional || [];
503
- let l = {};
504
- typeof f.ideal == "number" ? (l[h("min", p)] = f.ideal, c.optional.push(l), l = {}, l[h("max", p)] = f.ideal, c.optional.push(l)) : (l[h("", p)] = f.ideal, c.optional.push(l));
507
+ let u = {};
508
+ typeof p.ideal == "number" ? (u[h("min", f)] = p.ideal, c.optional.push(u), u = {}, u[h("max", f)] = p.ideal, c.optional.push(u)) : (u[h("", f)] = p.ideal, c.optional.push(u));
505
509
  }
506
- f.exact !== void 0 && typeof f.exact != "number" ? (c.mandatory = c.mandatory || {}, c.mandatory[h("", p)] = f.exact) : ["min", "max"].forEach((l) => {
507
- f[l] !== void 0 && (c.mandatory = c.mandatory || {}, c.mandatory[h(l, p)] = f[l]);
510
+ p.exact !== void 0 && typeof p.exact != "number" ? (c.mandatory = c.mandatory || {}, c.mandatory[h("", f)] = p.exact) : ["min", "max"].forEach((u) => {
511
+ p[u] !== void 0 && (c.mandatory = c.mandatory || {}, c.mandatory[h(u, f)] = p[u]);
508
512
  });
509
513
  }), a.advanced && (c.optional = (c.optional || []).concat(a.advanced)), c;
510
514
  }, i = function(a, c) {
511
515
  if (e.version >= 61)
512
516
  return c(a);
513
517
  if (a = JSON.parse(JSON.stringify(a)), a && typeof a.audio == "object") {
514
- const p = function(f, h, l) {
515
- h in f && !(l in f) && (f[l] = f[h], delete f[h]);
518
+ const f = function(p, h, u) {
519
+ h in p && !(u in p) && (p[u] = p[h], delete p[h]);
516
520
  };
517
- a = JSON.parse(JSON.stringify(a)), p(a.audio, "autoGainControl", "googAutoGainControl"), p(a.audio, "noiseSuppression", "googNoiseSuppression"), a.audio = n(a.audio);
521
+ a = JSON.parse(JSON.stringify(a)), f(a.audio, "autoGainControl", "googAutoGainControl"), f(a.audio, "noiseSuppression", "googNoiseSuppression"), a.audio = n(a.audio);
518
522
  }
519
523
  if (a && typeof a.video == "object") {
520
- let p = a.video.facingMode;
521
- p = p && (typeof p == "object" ? p : { ideal: p });
522
- const f = e.version < 66;
523
- if (p && (p.exact === "user" || p.exact === "environment" || p.ideal === "user" || p.ideal === "environment") && !(t.mediaDevices.getSupportedConstraints && t.mediaDevices.getSupportedConstraints().facingMode && !f)) {
524
+ let f = a.video.facingMode;
525
+ f = f && (typeof f == "object" ? f : { ideal: f });
526
+ const p = e.version < 66;
527
+ if (f && (f.exact === "user" || f.exact === "environment" || f.ideal === "user" || f.ideal === "environment") && !(t.mediaDevices.getSupportedConstraints && t.mediaDevices.getSupportedConstraints().facingMode && !p)) {
524
528
  delete a.video.facingMode;
525
529
  let h;
526
- if (p.exact === "environment" || p.ideal === "environment" ? h = ["back", "rear"] : (p.exact === "user" || p.ideal === "user") && (h = ["front"]), h)
527
- return t.mediaDevices.enumerateDevices().then((l) => {
528
- l = l.filter((y) => y.kind === "videoinput");
529
- let d = l.find((y) => h.some((b) => y.label.toLowerCase().includes(b)));
530
- return !d && l.length && h.includes("back") && (d = l[l.length - 1]), d && (a.video.deviceId = p.exact ? { exact: d.deviceId } : { ideal: d.deviceId }), a.video = n(a.video), me("chrome: " + JSON.stringify(a)), c(a);
530
+ if (f.exact === "environment" || f.ideal === "environment" ? h = ["back", "rear"] : (f.exact === "user" || f.ideal === "user") && (h = ["front"]), h)
531
+ return t.mediaDevices.enumerateDevices().then((u) => {
532
+ u = u.filter((_) => _.kind === "videoinput");
533
+ let l = u.find((_) => h.some((b) => _.label.toLowerCase().includes(b)));
534
+ return !l && u.length && h.includes("back") && (l = u[u.length - 1]), l && (a.video.deviceId = f.exact ? { exact: l.deviceId } : { ideal: l.deviceId }), a.video = n(a.video), le("chrome: " + JSON.stringify(a)), c(a);
531
535
  });
532
536
  }
533
537
  a.video = n(a.video);
534
538
  }
535
- return me("chrome: " + JSON.stringify(a)), c(a);
539
+ return le("chrome: " + JSON.stringify(a)), c(a);
536
540
  }, s = function(a) {
537
541
  return e.version >= 64 ? a : {
538
542
  name: {
@@ -554,30 +558,30 @@ function Ie(r, e) {
554
558
  return this.name + (this.message && ": ") + this.message;
555
559
  }
556
560
  };
557
- }, o = function(a, c, p) {
558
- i(a, (f) => {
559
- t.webkitGetUserMedia(f, c, (h) => {
560
- p && p(s(h));
561
+ }, o = function(a, c, f) {
562
+ i(a, (p) => {
563
+ t.webkitGetUserMedia(p, c, (h) => {
564
+ f && f(s(h));
561
565
  });
562
566
  });
563
567
  };
564
568
  if (t.getUserMedia = o.bind(t), t.mediaDevices.getUserMedia) {
565
569
  const a = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
566
570
  t.mediaDevices.getUserMedia = function(c) {
567
- return i(c, (p) => a(p).then((f) => {
568
- if (p.audio && !f.getAudioTracks().length || p.video && !f.getVideoTracks().length)
569
- throw f.getTracks().forEach((h) => {
571
+ return i(c, (f) => a(f).then((p) => {
572
+ if (f.audio && !p.getAudioTracks().length || f.video && !p.getVideoTracks().length)
573
+ throw p.getTracks().forEach((h) => {
570
574
  h.stop();
571
575
  }), new DOMException("", "NotFoundError");
572
- return f;
573
- }, (f) => Promise.reject(s(f))));
576
+ return p;
577
+ }, (p) => Promise.reject(s(p))));
574
578
  };
575
579
  }
576
580
  }
577
- function Me(r) {
581
+ function De(r) {
578
582
  r.MediaStream = r.MediaStream || r.webkitMediaStream;
579
583
  }
580
- function Oe(r) {
584
+ function Ie(r) {
581
585
  if (typeof r == "object" && r.RTCPeerConnection && !("ontrack" in r.RTCPeerConnection.prototype)) {
582
586
  Object.defineProperty(r.RTCPeerConnection.prototype, "ontrack", {
583
587
  get() {
@@ -612,7 +616,7 @@ function Oe(r) {
612
616
  { value: { receiver: e.receiver } }
613
617
  ), e));
614
618
  }
615
- function Ae(r) {
619
+ function Me(r) {
616
620
  if (typeof r == "object" && r.RTCPeerConnection && !("getSenders" in r.RTCPeerConnection.prototype) && "createDTMFSender" in r.RTCPeerConnection.prototype) {
617
621
  const e = function(i, s) {
618
622
  return {
@@ -629,8 +633,8 @@ function Ae(r) {
629
633
  };
630
634
  const i = r.RTCPeerConnection.prototype.addTrack;
631
635
  r.RTCPeerConnection.prototype.addTrack = function(a, c) {
632
- let p = i.apply(this, arguments);
633
- return p || (p = e(this, a), this._senders.push(p)), p;
636
+ let f = i.apply(this, arguments);
637
+ return f || (f = e(this, a), this._senders.push(f)), f;
634
638
  };
635
639
  const s = r.RTCPeerConnection.prototype.removeTrack;
636
640
  r.RTCPeerConnection.prototype.removeTrack = function(a) {
@@ -664,7 +668,7 @@ function Ae(r) {
664
668
  });
665
669
  }
666
670
  }
667
- function $e(r) {
671
+ function Oe(r) {
668
672
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender && r.RTCRtpReceiver))
669
673
  return;
670
674
  if (!("getStats" in r.RTCRtpSender.prototype)) {
@@ -718,7 +722,7 @@ function $e(r) {
718
722
  return e.apply(this, arguments);
719
723
  };
720
724
  }
721
- function je(r) {
725
+ function Le(r) {
722
726
  r.RTCPeerConnection.prototype.getLocalStreams = function() {
723
727
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map((o) => this._shimmedLocalStreams[o][0]);
724
728
  };
@@ -732,8 +736,8 @@ function je(r) {
732
736
  };
733
737
  const t = r.RTCPeerConnection.prototype.addStream;
734
738
  r.RTCPeerConnection.prototype.addStream = function(o) {
735
- this._shimmedLocalStreams = this._shimmedLocalStreams || {}, o.getTracks().forEach((p) => {
736
- if (this.getSenders().find((h) => h.track === p))
739
+ this._shimmedLocalStreams = this._shimmedLocalStreams || {}, o.getTracks().forEach((f) => {
740
+ if (this.getSenders().find((h) => h.track === f))
737
741
  throw new DOMException(
738
742
  "Track already exists.",
739
743
  "InvalidAccessError"
@@ -741,7 +745,7 @@ function je(r) {
741
745
  });
742
746
  const a = this.getSenders();
743
747
  t.apply(this, arguments);
744
- const c = this.getSenders().filter((p) => a.indexOf(p) === -1);
748
+ const c = this.getSenders().filter((f) => a.indexOf(f) === -1);
745
749
  this._shimmedLocalStreams[o.id] = [o].concat(c);
746
750
  };
747
751
  const n = r.RTCPeerConnection.prototype.removeStream;
@@ -756,103 +760,103 @@ function je(r) {
756
760
  }), i.apply(this, arguments);
757
761
  };
758
762
  }
759
- function Le(r, e) {
763
+ function $e(r, e) {
760
764
  if (!r.RTCPeerConnection)
761
765
  return;
762
766
  if (r.RTCPeerConnection.prototype.addTrack && e.version >= 65)
763
- return je(r);
767
+ return Le(r);
764
768
  const t = r.RTCPeerConnection.prototype.getLocalStreams;
765
769
  r.RTCPeerConnection.prototype.getLocalStreams = function() {
766
- const f = t.apply(this);
767
- return this._reverseStreams = this._reverseStreams || {}, f.map((h) => this._reverseStreams[h.id]);
770
+ const p = t.apply(this);
771
+ return this._reverseStreams = this._reverseStreams || {}, p.map((h) => this._reverseStreams[h.id]);
768
772
  };
769
773
  const n = r.RTCPeerConnection.prototype.addStream;
770
- r.RTCPeerConnection.prototype.addStream = function(f) {
771
- if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, f.getTracks().forEach((h) => {
772
- if (this.getSenders().find((d) => d.track === h))
774
+ r.RTCPeerConnection.prototype.addStream = function(p) {
775
+ if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, p.getTracks().forEach((h) => {
776
+ if (this.getSenders().find((l) => l.track === h))
773
777
  throw new DOMException(
774
778
  "Track already exists.",
775
779
  "InvalidAccessError"
776
780
  );
777
- }), !this._reverseStreams[f.id]) {
778
- const h = new r.MediaStream(f.getTracks());
779
- this._streams[f.id] = h, this._reverseStreams[h.id] = f, f = h;
781
+ }), !this._reverseStreams[p.id]) {
782
+ const h = new r.MediaStream(p.getTracks());
783
+ this._streams[p.id] = h, this._reverseStreams[h.id] = p, p = h;
780
784
  }
781
- n.apply(this, [f]);
785
+ n.apply(this, [p]);
782
786
  };
783
787
  const i = r.RTCPeerConnection.prototype.removeStream;
784
- r.RTCPeerConnection.prototype.removeStream = function(f) {
785
- this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, i.apply(this, [this._streams[f.id] || f]), delete this._reverseStreams[this._streams[f.id] ? this._streams[f.id].id : f.id], delete this._streams[f.id];
786
- }, r.RTCPeerConnection.prototype.addTrack = function(f, h) {
788
+ r.RTCPeerConnection.prototype.removeStream = function(p) {
789
+ this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, i.apply(this, [this._streams[p.id] || p]), delete this._reverseStreams[this._streams[p.id] ? this._streams[p.id].id : p.id], delete this._streams[p.id];
790
+ }, r.RTCPeerConnection.prototype.addTrack = function(p, h) {
787
791
  if (this.signalingState === "closed")
788
792
  throw new DOMException(
789
793
  "The RTCPeerConnection's signalingState is 'closed'.",
790
794
  "InvalidStateError"
791
795
  );
792
- const l = [].slice.call(arguments, 1);
793
- if (l.length !== 1 || !l[0].getTracks().find((b) => b === f))
796
+ const u = [].slice.call(arguments, 1);
797
+ if (u.length !== 1 || !u[0].getTracks().find((b) => b === p))
794
798
  throw new DOMException(
795
799
  "The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.",
796
800
  "NotSupportedError"
797
801
  );
798
- if (this.getSenders().find((b) => b.track === f))
802
+ if (this.getSenders().find((b) => b.track === p))
799
803
  throw new DOMException(
800
804
  "Track already exists.",
801
805
  "InvalidAccessError"
802
806
  );
803
807
  this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
804
- const y = this._streams[h.id];
805
- if (y)
806
- y.addTrack(f), Promise.resolve().then(() => {
808
+ const _ = this._streams[h.id];
809
+ if (_)
810
+ _.addTrack(p), Promise.resolve().then(() => {
807
811
  this.dispatchEvent(new Event("negotiationneeded"));
808
812
  });
809
813
  else {
810
- const b = new r.MediaStream([f]);
814
+ const b = new r.MediaStream([p]);
811
815
  this._streams[h.id] = b, this._reverseStreams[b.id] = h, this.addStream(b);
812
816
  }
813
- return this.getSenders().find((b) => b.track === f);
817
+ return this.getSenders().find((b) => b.track === p);
814
818
  };
815
- function s(p, f) {
816
- let h = f.sdp;
817
- return Object.keys(p._reverseStreams || []).forEach((l) => {
818
- const d = p._reverseStreams[l], y = p._streams[d.id];
819
+ function s(f, p) {
820
+ let h = p.sdp;
821
+ return Object.keys(f._reverseStreams || []).forEach((u) => {
822
+ const l = f._reverseStreams[u], _ = f._streams[l.id];
819
823
  h = h.replace(
820
- new RegExp(y.id, "g"),
821
- d.id
824
+ new RegExp(_.id, "g"),
825
+ l.id
822
826
  );
823
827
  }), new RTCSessionDescription({
824
- type: f.type,
828
+ type: p.type,
825
829
  sdp: h
826
830
  });
827
831
  }
828
- function o(p, f) {
829
- let h = f.sdp;
830
- return Object.keys(p._reverseStreams || []).forEach((l) => {
831
- const d = p._reverseStreams[l], y = p._streams[d.id];
832
+ function o(f, p) {
833
+ let h = p.sdp;
834
+ return Object.keys(f._reverseStreams || []).forEach((u) => {
835
+ const l = f._reverseStreams[u], _ = f._streams[l.id];
832
836
  h = h.replace(
833
- new RegExp(d.id, "g"),
834
- y.id
837
+ new RegExp(l.id, "g"),
838
+ _.id
835
839
  );
836
840
  }), new RTCSessionDescription({
837
- type: f.type,
841
+ type: p.type,
838
842
  sdp: h
839
843
  });
840
844
  }
841
- ["createOffer", "createAnswer"].forEach(function(p) {
842
- const f = r.RTCPeerConnection.prototype[p], h = { [p]() {
843
- const l = arguments;
844
- return arguments.length && typeof arguments[0] == "function" ? f.apply(this, [
845
- (y) => {
846
- const b = s(this, y);
847
- l[0].apply(null, [b]);
845
+ ["createOffer", "createAnswer"].forEach(function(f) {
846
+ const p = r.RTCPeerConnection.prototype[f], h = { [f]() {
847
+ const u = arguments;
848
+ return arguments.length && typeof arguments[0] == "function" ? p.apply(this, [
849
+ (_) => {
850
+ const b = s(this, _);
851
+ u[0].apply(null, [b]);
848
852
  },
849
- (y) => {
850
- l[1] && l[1].apply(null, y);
853
+ (_) => {
854
+ u[1] && u[1].apply(null, _);
851
855
  },
852
856
  arguments[2]
853
- ]) : f.apply(this, arguments).then((y) => s(this, y));
857
+ ]) : p.apply(this, arguments).then((_) => s(this, _));
854
858
  } };
855
- r.RTCPeerConnection.prototype[p] = h[p];
859
+ r.RTCPeerConnection.prototype[f] = h[f];
856
860
  });
857
861
  const a = r.RTCPeerConnection.prototype.setLocalDescription;
858
862
  r.RTCPeerConnection.prototype.setLocalDescription = function() {
@@ -867,31 +871,31 @@ function Le(r, e) {
867
871
  "localDescription",
868
872
  {
869
873
  get() {
870
- const p = c.get.apply(this);
871
- return p.type === "" ? p : s(this, p);
874
+ const f = c.get.apply(this);
875
+ return f.type === "" ? f : s(this, f);
872
876
  }
873
877
  }
874
- ), r.RTCPeerConnection.prototype.removeTrack = function(f) {
878
+ ), r.RTCPeerConnection.prototype.removeTrack = function(p) {
875
879
  if (this.signalingState === "closed")
876
880
  throw new DOMException(
877
881
  "The RTCPeerConnection's signalingState is 'closed'.",
878
882
  "InvalidStateError"
879
883
  );
880
- if (!f._pc)
884
+ if (!p._pc)
881
885
  throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.", "TypeError");
882
- if (!(f._pc === this))
886
+ if (!(p._pc === this))
883
887
  throw new DOMException(
884
888
  "Sender was not created by this connection.",
885
889
  "InvalidAccessError"
886
890
  );
887
891
  this._streams = this._streams || {};
888
- let l;
889
- Object.keys(this._streams).forEach((d) => {
890
- this._streams[d].getTracks().find((b) => f.track === b) && (l = this._streams[d]);
891
- }), l && (l.getTracks().length === 1 ? this.removeStream(this._reverseStreams[l.id]) : l.removeTrack(f.track), this.dispatchEvent(new Event("negotiationneeded")));
892
+ let u;
893
+ Object.keys(this._streams).forEach((l) => {
894
+ this._streams[l].getTracks().find((b) => p.track === b) && (u = this._streams[l]);
895
+ }), u && (u.getTracks().length === 1 ? this.removeStream(this._reverseStreams[u.id]) : u.removeTrack(p.track), this.dispatchEvent(new Event("negotiationneeded")));
892
896
  };
893
897
  }
894
- function w(r, e) {
898
+ function Q(r, e) {
895
899
  !r.RTCPeerConnection && r.webkitRTCPeerConnection && (r.RTCPeerConnection = r.webkitRTCPeerConnection), r.RTCPeerConnection && e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
896
900
  const n = r.RTCPeerConnection.prototype[t], i = { [t]() {
897
901
  return arguments[0] = new (t === "addIceCandidate" ? r.RTCIceCandidate : r.RTCSessionDescription)(arguments[0]), n.apply(this, arguments);
@@ -899,29 +903,29 @@ function w(r, e) {
899
903
  r.RTCPeerConnection.prototype[t] = i[t];
900
904
  });
901
905
  }
902
- function Be(r, e) {
906
+ function Ae(r, e) {
903
907
  x(r, "negotiationneeded", (t) => {
904
908
  const n = t.target;
905
909
  if (!((e.version < 72 || n.getConfiguration && n.getConfiguration().sdpSemantics === "plan-b") && n.signalingState !== "stable"))
906
910
  return t;
907
911
  });
908
912
  }
909
- const ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
913
+ const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
910
914
  __proto__: null,
911
- fixNegotiationNeeded: Be,
912
- shimAddTrackRemoveTrack: Le,
913
- shimAddTrackRemoveTrackWithNative: je,
914
- shimGetSendersWithDtmf: Ae,
915
- shimGetUserMedia: Ie,
916
- shimMediaStream: Me,
917
- shimOnTrack: Oe,
918
- shimPeerConnection: w,
919
- shimSenderReceiverGetStats: $e
915
+ fixNegotiationNeeded: Ae,
916
+ shimAddTrackRemoveTrack: $e,
917
+ shimAddTrackRemoveTrackWithNative: Le,
918
+ shimGetSendersWithDtmf: Me,
919
+ shimGetUserMedia: Ee,
920
+ shimMediaStream: De,
921
+ shimOnTrack: Ie,
922
+ shimPeerConnection: Q,
923
+ shimSenderReceiverGetStats: Oe
920
924
  }, Symbol.toStringTag, { value: "Module" }));
921
- function Fe(r, e) {
925
+ function je(r, e) {
922
926
  const t = r && r.navigator, n = r && r.MediaStreamTrack;
923
927
  if (t.getUserMedia = function(i, s, o) {
924
- pe(
928
+ ce(
925
929
  "navigator.getUserMedia",
926
930
  "navigator.mediaDevices.getUserMedia"
927
931
  ), t.mediaDevices.getUserMedia(i).then(s, o);
@@ -946,7 +950,7 @@ function Fe(r, e) {
946
950
  }
947
951
  }
948
952
  }
949
- function Rt(r, e) {
953
+ function kt(r, e) {
950
954
  r.navigator.mediaDevices && "getDisplayMedia" in r.navigator.mediaDevices || r.navigator.mediaDevices && (r.navigator.mediaDevices.getDisplayMedia = function(n) {
951
955
  if (!(n && n.video)) {
952
956
  const i = new DOMException("getDisplayMedia without video constraints is undefined");
@@ -955,14 +959,14 @@ function Rt(r, e) {
955
959
  return n.video === !0 ? n.video = { mediaSource: e } : n.video.mediaSource = e, r.navigator.mediaDevices.getUserMedia(n);
956
960
  });
957
961
  }
958
- function Ue(r) {
962
+ function Be(r) {
959
963
  typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
960
964
  get() {
961
965
  return { receiver: this.receiver };
962
966
  }
963
967
  });
964
968
  }
965
- function ee(r, e) {
969
+ function Z(r, e) {
966
970
  if (typeof r != "object" || !(r.RTCPeerConnection || r.mozRTCPeerConnection))
967
971
  return;
968
972
  !r.RTCPeerConnection && r.mozRTCPeerConnection && (r.RTCPeerConnection = r.mozRTCPeerConnection), e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(i) {
@@ -983,15 +987,15 @@ function ee(r, e) {
983
987
  return n.apply(this, [s || null]).then((c) => {
984
988
  if (e.version < 53 && !o)
985
989
  try {
986
- c.forEach((p) => {
987
- p.type = t[p.type] || p.type;
990
+ c.forEach((f) => {
991
+ f.type = t[f.type] || f.type;
988
992
  });
989
- } catch (p) {
990
- if (p.name !== "TypeError")
991
- throw p;
992
- c.forEach((f, h) => {
993
- c.set(h, Object.assign({}, f, {
994
- type: t[f.type] || f.type
993
+ } catch (f) {
994
+ if (f.name !== "TypeError")
995
+ throw f;
996
+ c.forEach((p, h) => {
997
+ c.set(h, Object.assign({}, p, {
998
+ type: t[p.type] || p.type
995
999
  }));
996
1000
  });
997
1001
  }
@@ -999,7 +1003,7 @@ function ee(r, e) {
999
1003
  }).then(o, a);
1000
1004
  };
1001
1005
  }
1002
- function ze(r) {
1006
+ function Ue(r) {
1003
1007
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpSender.prototype)
1004
1008
  return;
1005
1009
  const e = r.RTCPeerConnection.prototype.getSenders;
@@ -1015,7 +1019,7 @@ function ze(r) {
1015
1019
  return this.track ? this._pc.getStats(this.track) : Promise.resolve(/* @__PURE__ */ new Map());
1016
1020
  };
1017
1021
  }
1018
- function Ne(r) {
1022
+ function Fe(r) {
1019
1023
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpReceiver.prototype)
1020
1024
  return;
1021
1025
  const e = r.RTCPeerConnection.prototype.getReceivers;
@@ -1026,14 +1030,14 @@ function Ne(r) {
1026
1030
  return this._pc.getStats(this.track);
1027
1031
  };
1028
1032
  }
1029
- function Je(r) {
1033
+ function ze(r) {
1030
1034
  !r.RTCPeerConnection || "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
1031
- pe("removeStream", "removeTrack"), this.getSenders().forEach((n) => {
1035
+ ce("removeStream", "removeTrack"), this.getSenders().forEach((n) => {
1032
1036
  n.track && t.getTracks().includes(n.track) && this.removeTrack(n);
1033
1037
  });
1034
1038
  });
1035
1039
  }
1036
- function Ge(r) {
1040
+ function Ne(r) {
1037
1041
  r.DataChannel && !r.RTCDataChannel && (r.RTCDataChannel = r.DataChannel);
1038
1042
  }
1039
1043
  function Ve(r) {
@@ -1068,7 +1072,7 @@ function Ve(r) {
1068
1072
  return s;
1069
1073
  });
1070
1074
  }
1071
- function He(r) {
1075
+ function Ge(r) {
1072
1076
  if (!(typeof r == "object" && r.RTCRtpSender))
1073
1077
  return;
1074
1078
  const e = r.RTCRtpSender.prototype.getParameters;
@@ -1077,7 +1081,7 @@ function He(r) {
1077
1081
  return "encodings" in n || (n.encodings = [].concat(this.sendEncodings || [{}])), n;
1078
1082
  });
1079
1083
  }
1080
- function Ye(r) {
1084
+ function Je(r) {
1081
1085
  if (!(typeof r == "object" && r.RTCPeerConnection))
1082
1086
  return;
1083
1087
  const e = r.RTCPeerConnection.prototype.createOffer;
@@ -1087,7 +1091,7 @@ function Ye(r) {
1087
1091
  }) : e.apply(this, arguments);
1088
1092
  };
1089
1093
  }
1090
- function Ke(r) {
1094
+ function Ye(r) {
1091
1095
  if (!(typeof r == "object" && r.RTCPeerConnection))
1092
1096
  return;
1093
1097
  const e = r.RTCPeerConnection.prototype.createAnswer;
@@ -1097,22 +1101,22 @@ function Ke(r) {
1097
1101
  }) : e.apply(this, arguments);
1098
1102
  };
1099
1103
  }
1100
- const ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1104
+ const ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1101
1105
  __proto__: null,
1102
1106
  shimAddTransceiver: Ve,
1103
- shimCreateAnswer: Ke,
1104
- shimCreateOffer: Ye,
1105
- shimGetDisplayMedia: Rt,
1106
- shimGetParameters: He,
1107
- shimGetUserMedia: Fe,
1108
- shimOnTrack: Ue,
1109
- shimPeerConnection: ee,
1110
- shimRTCDataChannel: Ge,
1111
- shimReceiverGetStats: Ne,
1112
- shimRemoveStream: Je,
1113
- shimSenderGetStats: ze
1107
+ shimCreateAnswer: Ye,
1108
+ shimCreateOffer: Je,
1109
+ shimGetDisplayMedia: kt,
1110
+ shimGetParameters: Ge,
1111
+ shimGetUserMedia: je,
1112
+ shimOnTrack: Be,
1113
+ shimPeerConnection: Z,
1114
+ shimRTCDataChannel: Ne,
1115
+ shimReceiverGetStats: Fe,
1116
+ shimRemoveStream: ze,
1117
+ shimSenderGetStats: Ue
1114
1118
  }, Symbol.toStringTag, { value: "Module" }));
1115
- function qe(r) {
1119
+ function Ke(r) {
1116
1120
  if (!(typeof r != "object" || !r.RTCPeerConnection)) {
1117
1121
  if ("getLocalStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getLocalStreams = function() {
1118
1122
  return this._localStreams || (this._localStreams = []), this._localStreams;
@@ -1147,7 +1151,7 @@ function qe(r) {
1147
1151
  });
1148
1152
  }
1149
1153
  }
1150
- function We(r) {
1154
+ function He(r) {
1151
1155
  if (!(typeof r != "object" || !r.RTCPeerConnection) && ("getRemoteStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getRemoteStreams = function() {
1152
1156
  return this._remoteStreams ? this._remoteStreams : [];
1153
1157
  }), !("onaddstream" in r.RTCPeerConnection.prototype))) {
@@ -1182,47 +1186,47 @@ function We(r) {
1182
1186
  };
1183
1187
  }
1184
1188
  }
1185
- function Xe(r) {
1189
+ function qe(r) {
1186
1190
  if (typeof r != "object" || !r.RTCPeerConnection)
1187
1191
  return;
1188
1192
  const e = r.RTCPeerConnection.prototype, t = e.createOffer, n = e.createAnswer, i = e.setLocalDescription, s = e.setRemoteDescription, o = e.addIceCandidate;
1189
- e.createOffer = function(p, f) {
1190
- const h = arguments.length >= 2 ? arguments[2] : arguments[0], l = t.apply(this, [h]);
1191
- return f ? (l.then(p, f), Promise.resolve()) : l;
1192
- }, e.createAnswer = function(p, f) {
1193
- const h = arguments.length >= 2 ? arguments[2] : arguments[0], l = n.apply(this, [h]);
1194
- return f ? (l.then(p, f), Promise.resolve()) : l;
1193
+ e.createOffer = function(f, p) {
1194
+ const h = arguments.length >= 2 ? arguments[2] : arguments[0], u = t.apply(this, [h]);
1195
+ return p ? (u.then(f, p), Promise.resolve()) : u;
1196
+ }, e.createAnswer = function(f, p) {
1197
+ const h = arguments.length >= 2 ? arguments[2] : arguments[0], u = n.apply(this, [h]);
1198
+ return p ? (u.then(f, p), Promise.resolve()) : u;
1195
1199
  };
1196
- let a = function(c, p, f) {
1200
+ let a = function(c, f, p) {
1197
1201
  const h = i.apply(this, [c]);
1198
- return f ? (h.then(p, f), Promise.resolve()) : h;
1202
+ return p ? (h.then(f, p), Promise.resolve()) : h;
1199
1203
  };
1200
- e.setLocalDescription = a, a = function(c, p, f) {
1204
+ e.setLocalDescription = a, a = function(c, f, p) {
1201
1205
  const h = s.apply(this, [c]);
1202
- return f ? (h.then(p, f), Promise.resolve()) : h;
1203
- }, e.setRemoteDescription = a, a = function(c, p, f) {
1206
+ return p ? (h.then(f, p), Promise.resolve()) : h;
1207
+ }, e.setRemoteDescription = a, a = function(c, f, p) {
1204
1208
  const h = o.apply(this, [c]);
1205
- return f ? (h.then(p, f), Promise.resolve()) : h;
1209
+ return p ? (h.then(f, p), Promise.resolve()) : h;
1206
1210
  }, e.addIceCandidate = a;
1207
1211
  }
1208
- function Qe(r) {
1212
+ function Xe(r) {
1209
1213
  const e = r && r.navigator;
1210
1214
  if (e.mediaDevices && e.mediaDevices.getUserMedia) {
1211
1215
  const t = e.mediaDevices, n = t.getUserMedia.bind(t);
1212
- e.mediaDevices.getUserMedia = (i) => n(Ze(i));
1216
+ e.mediaDevices.getUserMedia = (i) => n(We(i));
1213
1217
  }
1214
1218
  !e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(n, i, s) {
1215
1219
  e.mediaDevices.getUserMedia(n).then(i, s);
1216
1220
  }).bind(e));
1217
1221
  }
1218
- function Ze(r) {
1222
+ function We(r) {
1219
1223
  return r && r.video !== void 0 ? Object.assign(
1220
1224
  {},
1221
1225
  r,
1222
- { video: De(r.video) }
1226
+ { video: Pe(r.video) }
1223
1227
  ) : r;
1224
1228
  }
1225
- function we(r) {
1229
+ function Qe(r) {
1226
1230
  if (!r.RTCPeerConnection)
1227
1231
  return;
1228
1232
  const e = r.RTCPeerConnection;
@@ -1231,7 +1235,7 @@ function we(r) {
1231
1235
  const s = [];
1232
1236
  for (let o = 0; o < n.iceServers.length; o++) {
1233
1237
  let a = n.iceServers[o];
1234
- a.urls === void 0 && a.url ? (pe("RTCIceServer.url", "RTCIceServer.urls"), a = JSON.parse(JSON.stringify(a)), a.urls = a.url, delete a.url, s.push(a)) : s.push(n.iceServers[o]);
1238
+ a.urls === void 0 && a.url ? (ce("RTCIceServer.url", "RTCIceServer.urls"), a = JSON.parse(JSON.stringify(a)), a.urls = a.url, delete a.url, s.push(a)) : s.push(n.iceServers[o]);
1235
1239
  }
1236
1240
  n.iceServers = s;
1237
1241
  }
@@ -1242,14 +1246,14 @@ function we(r) {
1242
1246
  }
1243
1247
  });
1244
1248
  }
1245
- function et(r) {
1249
+ function Ze(r) {
1246
1250
  typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
1247
1251
  get() {
1248
1252
  return { receiver: this.receiver };
1249
1253
  }
1250
1254
  });
1251
1255
  }
1252
- function tt(r) {
1256
+ function we(r) {
1253
1257
  const e = r.RTCPeerConnection.prototype.createOffer;
1254
1258
  r.RTCPeerConnection.prototype.createOffer = function(n) {
1255
1259
  if (n) {
@@ -1262,24 +1266,24 @@ function tt(r) {
1262
1266
  return e.apply(this, arguments);
1263
1267
  };
1264
1268
  }
1265
- function nt(r) {
1269
+ function et(r) {
1266
1270
  typeof r != "object" || r.AudioContext || (r.AudioContext = r.webkitAudioContext);
1267
1271
  }
1268
1272
  const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1269
1273
  __proto__: null,
1270
- shimAudioContext: nt,
1271
- shimCallbacksAPI: Xe,
1272
- shimConstraints: Ze,
1273
- shimCreateOfferLegacy: tt,
1274
- shimGetUserMedia: Qe,
1275
- shimLocalStreamsAPI: qe,
1276
- shimRTCIceServerUrls: we,
1277
- shimRemoteStreamsAPI: We,
1278
- shimTrackEventTransceiver: et
1274
+ shimAudioContext: et,
1275
+ shimCallbacksAPI: qe,
1276
+ shimConstraints: We,
1277
+ shimCreateOfferLegacy: we,
1278
+ shimGetUserMedia: Xe,
1279
+ shimLocalStreamsAPI: Ke,
1280
+ shimRTCIceServerUrls: Qe,
1281
+ shimRemoteStreamsAPI: He,
1282
+ shimTrackEventTransceiver: Ze
1279
1283
  }, Symbol.toStringTag, { value: "Module" }));
1280
- var W = { exports: {} }, Ce;
1281
- function xt() {
1282
- return Ce || (Ce = 1, function(r) {
1284
+ var H = { exports: {} }, ye;
1285
+ function Rt() {
1286
+ return ye || (ye = 1, (function(r) {
1283
1287
  const e = {};
1284
1288
  e.generateIdentifier = function() {
1285
1289
  return Math.random().toString(36).substring(2, 12);
@@ -1488,22 +1492,22 @@ a=ice-pwd:` + t.password + `\r
1488
1492
  }, s = e.splitLines(t)[0].split(" ");
1489
1493
  n.profile = s[2];
1490
1494
  for (let a = 3; a < s.length; a++) {
1491
- const c = s[a], p = e.matchPrefix(
1495
+ const c = s[a], f = e.matchPrefix(
1492
1496
  t,
1493
1497
  "a=rtpmap:" + c + " "
1494
1498
  )[0];
1495
- if (p) {
1496
- const f = e.parseRtpMap(p), h = e.matchPrefix(
1499
+ if (f) {
1500
+ const p = e.parseRtpMap(f), h = e.matchPrefix(
1497
1501
  t,
1498
1502
  "a=fmtp:" + c + " "
1499
1503
  );
1500
- switch (f.parameters = h.length ? e.parseFmtp(h[0]) : {}, f.rtcpFeedback = e.matchPrefix(
1504
+ switch (p.parameters = h.length ? e.parseFmtp(h[0]) : {}, p.rtcpFeedback = e.matchPrefix(
1501
1505
  t,
1502
1506
  "a=rtcp-fb:" + c + " "
1503
- ).map(e.parseRtcpFb), n.codecs.push(f), f.name.toUpperCase()) {
1507
+ ).map(e.parseRtcpFb), n.codecs.push(p), p.name.toUpperCase()) {
1504
1508
  case "RED":
1505
1509
  case "ULPFEC":
1506
- n.fecMechanisms.push(f.name.toUpperCase());
1510
+ n.fecMechanisms.push(p.name.toUpperCase());
1507
1511
  break;
1508
1512
  }
1509
1513
  }
@@ -1514,7 +1518,7 @@ a=ice-pwd:` + t.password + `\r
1514
1518
  const o = e.matchPrefix(t, "a=rtcp-fb:* ").map(e.parseRtcpFb);
1515
1519
  return n.codecs.forEach((a) => {
1516
1520
  o.forEach((c) => {
1517
- a.rtcpFeedback.find((f) => f.type === c.type && f.parameter === c.parameter) || a.rtcpFeedback.push(c);
1521
+ a.rtcpFeedback.find((p) => p.type === c.type && p.parameter === c.parameter) || a.rtcpFeedback.push(c);
1518
1522
  });
1519
1523
  }), n;
1520
1524
  }, e.writeRtpDescription = function(t, n) {
@@ -1533,26 +1537,26 @@ a=ice-pwd:` + t.password + `\r
1533
1537
  i += e.writeExtmap(o);
1534
1538
  }), i;
1535
1539
  }, e.parseRtpEncodingParameters = function(t) {
1536
- const n = [], i = e.parseRtpParameters(t), s = i.fecMechanisms.indexOf("RED") !== -1, o = i.fecMechanisms.indexOf("ULPFEC") !== -1, a = e.matchPrefix(t, "a=ssrc:").map((l) => e.parseSsrcMedia(l)).filter((l) => l.attribute === "cname"), c = a.length > 0 && a[0].ssrc;
1537
- let p;
1538
- const f = e.matchPrefix(t, "a=ssrc-group:FID").map((l) => l.substring(17).split(" ").map((y) => parseInt(y, 10)));
1539
- f.length > 0 && f[0].length > 1 && f[0][0] === c && (p = f[0][1]), i.codecs.forEach((l) => {
1540
- if (l.name.toUpperCase() === "RTX" && l.parameters.apt) {
1541
- let d = {
1540
+ const n = [], i = e.parseRtpParameters(t), s = i.fecMechanisms.indexOf("RED") !== -1, o = i.fecMechanisms.indexOf("ULPFEC") !== -1, a = e.matchPrefix(t, "a=ssrc:").map((u) => e.parseSsrcMedia(u)).filter((u) => u.attribute === "cname"), c = a.length > 0 && a[0].ssrc;
1541
+ let f;
1542
+ const p = e.matchPrefix(t, "a=ssrc-group:FID").map((u) => u.substring(17).split(" ").map((_) => parseInt(_, 10)));
1543
+ p.length > 0 && p[0].length > 1 && p[0][0] === c && (f = p[0][1]), i.codecs.forEach((u) => {
1544
+ if (u.name.toUpperCase() === "RTX" && u.parameters.apt) {
1545
+ let l = {
1542
1546
  ssrc: c,
1543
- codecPayloadType: parseInt(l.parameters.apt, 10)
1547
+ codecPayloadType: parseInt(u.parameters.apt, 10)
1544
1548
  };
1545
- c && p && (d.rtx = { ssrc: p }), n.push(d), s && (d = JSON.parse(JSON.stringify(d)), d.fec = {
1549
+ c && f && (l.rtx = { ssrc: f }), n.push(l), s && (l = JSON.parse(JSON.stringify(l)), l.fec = {
1546
1550
  ssrc: c,
1547
1551
  mechanism: o ? "red+ulpfec" : "red"
1548
- }, n.push(d));
1552
+ }, n.push(l));
1549
1553
  }
1550
1554
  }), n.length === 0 && c && n.push({
1551
1555
  ssrc: c
1552
1556
  });
1553
1557
  let h = e.matchPrefix(t, "b=");
1554
- return h.length && (h[0].indexOf("b=TIAS:") === 0 ? h = parseInt(h[0].substring(7), 10) : h[0].indexOf("b=AS:") === 0 ? h = parseInt(h[0].substring(5), 10) * 1e3 * 0.95 - 50 * 40 * 8 : h = void 0, n.forEach((l) => {
1555
- l.maxBitrate = h;
1558
+ return h.length && (h[0].indexOf("b=TIAS:") === 0 ? h = parseInt(h[0].substring(7), 10) : h[0].indexOf("b=AS:") === 0 ? h = parseInt(h[0].substring(5), 10) * 1e3 * 0.95 - 2e3 * 8 : h = void 0, n.forEach((u) => {
1559
+ u.maxBitrate = h;
1556
1560
  })), n;
1557
1561
  }, e.parseRtcpParameters = function(t) {
1558
1562
  const n = {}, i = e.matchPrefix(t, "a=ssrc:").map((a) => e.parseSsrcMedia(a)).filter((a) => a.attribute === "cname")[0];
@@ -1665,14 +1669,14 @@ t=0 0\r
1665
1669
  return !1;
1666
1670
  return !0;
1667
1671
  }, r.exports = e;
1668
- }(W)), W.exports;
1672
+ })(H)), H.exports;
1669
1673
  }
1670
- var rt = xt();
1671
- const D = /* @__PURE__ */ ut(rt), Pt = /* @__PURE__ */ yt({
1674
+ var tt = Rt();
1675
+ const D = /* @__PURE__ */ ut(tt), xt = /* @__PURE__ */ gt({
1672
1676
  __proto__: null,
1673
1677
  default: D
1674
- }, [rt]);
1675
- function z(r) {
1678
+ }, [tt]);
1679
+ function B(r) {
1676
1680
  if (!r.RTCIceCandidate || r.RTCIceCandidate && "foundation" in r.RTCIceCandidate.prototype)
1677
1681
  return;
1678
1682
  const e = r.RTCIceCandidate;
@@ -1700,7 +1704,7 @@ function z(r) {
1700
1704
  writable: "false"
1701
1705
  }), t));
1702
1706
  }
1703
- function te(r) {
1707
+ function w(r) {
1704
1708
  !r.RTCIceCandidate || r.RTCIceCandidate && "relayProtocol" in r.RTCIceCandidate.prototype || x(r, "icecandidate", (e) => {
1705
1709
  if (e.candidate) {
1706
1710
  const t = D.parseCandidate(e.candidate.candidate);
@@ -1713,7 +1717,7 @@ function te(r) {
1713
1717
  return e;
1714
1718
  });
1715
1719
  }
1716
- function N(r, e) {
1720
+ function U(r, e) {
1717
1721
  if (!r.RTCPeerConnection)
1718
1722
  return;
1719
1723
  "sctp" in r.RTCPeerConnection.prototype || Object.defineProperty(r.RTCPeerConnection.prototype, "sctp", {
@@ -1725,27 +1729,27 @@ function N(r, e) {
1725
1729
  if (!a || !a.sdp)
1726
1730
  return !1;
1727
1731
  const c = D.splitSections(a.sdp);
1728
- return c.shift(), c.some((p) => {
1729
- const f = D.parseMLine(p);
1730
- return f && f.kind === "application" && f.protocol.indexOf("SCTP") !== -1;
1732
+ return c.shift(), c.some((f) => {
1733
+ const p = D.parseMLine(f);
1734
+ return p && p.kind === "application" && p.protocol.indexOf("SCTP") !== -1;
1731
1735
  });
1732
1736
  }, n = function(a) {
1733
1737
  const c = a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
1734
1738
  if (c === null || c.length < 2)
1735
1739
  return -1;
1736
- const p = parseInt(c[1], 10);
1737
- return p !== p ? -1 : p;
1740
+ const f = parseInt(c[1], 10);
1741
+ return f !== f ? -1 : f;
1738
1742
  }, i = function(a) {
1739
1743
  let c = 65536;
1740
1744
  return e.browser === "firefox" && (e.version < 57 ? a === -1 ? c = 16384 : c = 2147483637 : e.version < 60 ? c = e.version === 57 ? 65535 : 65536 : c = 2147483637), c;
1741
1745
  }, s = function(a, c) {
1742
- let p = 65536;
1743
- e.browser === "firefox" && e.version === 57 && (p = 65535);
1744
- const f = D.matchPrefix(
1746
+ let f = 65536;
1747
+ e.browser === "firefox" && e.version === 57 && (f = 65535);
1748
+ const p = D.matchPrefix(
1745
1749
  a.sdp,
1746
1750
  "a=max-message-size:"
1747
1751
  );
1748
- return f.length > 0 ? p = parseInt(f[0].substring(19), 10) : e.browser === "firefox" && c !== -1 && (p = 2147483637), p;
1752
+ return p.length > 0 ? f = parseInt(p[0].substring(19), 10) : e.browser === "firefox" && c !== -1 && (f = 2147483637), f;
1749
1753
  }, o = r.RTCPeerConnection.prototype.setRemoteDescription;
1750
1754
  r.RTCPeerConnection.prototype.setRemoteDescription = function() {
1751
1755
  if (this._sctp = null, e.browser === "chrome" && e.version >= 76) {
@@ -1759,20 +1763,20 @@ function N(r, e) {
1759
1763
  });
1760
1764
  }
1761
1765
  if (t(arguments[0])) {
1762
- const c = n(arguments[0]), p = i(c), f = s(arguments[0], c);
1766
+ const c = n(arguments[0]), f = i(c), p = s(arguments[0], c);
1763
1767
  let h;
1764
- p === 0 && f === 0 ? h = Number.POSITIVE_INFINITY : p === 0 || f === 0 ? h = Math.max(p, f) : h = Math.min(p, f);
1765
- const l = {};
1766
- Object.defineProperty(l, "maxMessageSize", {
1768
+ f === 0 && p === 0 ? h = Number.POSITIVE_INFINITY : f === 0 || p === 0 ? h = Math.max(f, p) : h = Math.min(f, p);
1769
+ const u = {};
1770
+ Object.defineProperty(u, "maxMessageSize", {
1767
1771
  get() {
1768
1772
  return h;
1769
1773
  }
1770
- }), this._sctp = l;
1774
+ }), this._sctp = u;
1771
1775
  }
1772
1776
  return o.apply(this, arguments);
1773
1777
  };
1774
1778
  }
1775
- function J(r) {
1779
+ function F(r) {
1776
1780
  if (!(r.RTCPeerConnection && "createDataChannel" in r.RTCPeerConnection.prototype))
1777
1781
  return;
1778
1782
  function e(n, i) {
@@ -1790,7 +1794,7 @@ function J(r) {
1790
1794
  return e(i, this), i;
1791
1795
  }, x(r, "datachannel", (n) => (e(n.channel, n.target), n));
1792
1796
  }
1793
- function ne(r) {
1797
+ function ee(r) {
1794
1798
  if (!r.RTCPeerConnection || "connectionState" in r.RTCPeerConnection.prototype)
1795
1799
  return;
1796
1800
  const e = r.RTCPeerConnection.prototype;
@@ -1836,8 +1840,8 @@ function ne(r) {
1836
1840
  };
1837
1841
  });
1838
1842
  }
1839
- function re(r, e) {
1840
- if (!r.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e.version >= 605)
1843
+ function te(r, e) {
1844
+ if (!r.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e._safariVersion >= 13.1)
1841
1845
  return;
1842
1846
  const t = r.RTCPeerConnection.prototype.setRemoteDescription;
1843
1847
  r.RTCPeerConnection.prototype.setRemoteDescription = function(i) {
@@ -1854,7 +1858,7 @@ a=extmap-allow-mixed`) !== -1) {
1854
1858
  return t.apply(this, arguments);
1855
1859
  };
1856
1860
  }
1857
- function G(r, e) {
1861
+ function z(r, e) {
1858
1862
  if (!(r.RTCPeerConnection && r.RTCPeerConnection.prototype))
1859
1863
  return;
1860
1864
  const t = r.RTCPeerConnection.prototype.addIceCandidate;
@@ -1862,7 +1866,7 @@ function G(r, e) {
1862
1866
  return arguments[0] ? (e.browser === "chrome" && e.version < 78 || e.browser === "firefox" && e.version < 68 || e.browser === "safari") && arguments[0] && arguments[0].candidate === "" ? Promise.resolve() : t.apply(this, arguments) : (arguments[1] && arguments[1].apply(null), Promise.resolve());
1863
1867
  });
1864
1868
  }
1865
- function V(r, e) {
1869
+ function N(r, e) {
1866
1870
  if (!(r.RTCPeerConnection && r.RTCPeerConnection.prototype))
1867
1871
  return;
1868
1872
  const t = r.RTCPeerConnection.prototype.setLocalDescription;
@@ -1884,48 +1888,48 @@ function V(r, e) {
1884
1888
  return i.sdp || i.type !== "offer" && i.type !== "answer" ? t.apply(this, [i]) : (i.type === "offer" ? this.createOffer : this.createAnswer).apply(this).then((o) => t.apply(this, [o]));
1885
1889
  });
1886
1890
  }
1887
- const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1891
+ const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1888
1892
  __proto__: null,
1889
- removeExtmapAllowMixed: re,
1890
- shimAddIceCandidateNullOrEmpty: G,
1891
- shimConnectionState: ne,
1892
- shimMaxMessageSize: N,
1893
- shimParameterlessSetLocalDescription: V,
1894
- shimRTCIceCandidate: z,
1895
- shimRTCIceCandidateRelayProtocol: te,
1896
- shimSendThrowTypeError: J
1893
+ removeExtmapAllowMixed: te,
1894
+ shimAddIceCandidateNullOrEmpty: z,
1895
+ shimConnectionState: ee,
1896
+ shimMaxMessageSize: U,
1897
+ shimParameterlessSetLocalDescription: N,
1898
+ shimRTCIceCandidate: B,
1899
+ shimRTCIceCandidateRelayProtocol: w,
1900
+ shimSendThrowTypeError: F
1897
1901
  }, Symbol.toStringTag, { value: "Module" }));
1898
- function Dt({ window: r } = {}, e = {
1902
+ function Et({ window: r } = {}, e = {
1899
1903
  shimChrome: !0,
1900
1904
  shimFirefox: !0,
1901
1905
  shimSafari: !0
1902
1906
  }) {
1903
- const t = Ee, n = Tt(r), i = {
1907
+ const t = xe, n = Tt(r), i = {
1904
1908
  browserDetails: n,
1905
- commonShim: Et,
1906
- extractVersion: U,
1907
- disableLog: kt,
1909
+ commonShim: Pt,
1910
+ extractVersion: O,
1911
+ disableLog: vt,
1908
1912
  disableWarnings: St,
1909
1913
  // Expose sdp as a convenience. For production apps include directly.
1910
- sdp: Pt
1914
+ sdp: xt
1911
1915
  };
1912
1916
  switch (n.browser) {
1913
1917
  case "chrome":
1914
- if (!ge || !w || !e.shimChrome)
1918
+ if (!me || !Q || !e.shimChrome)
1915
1919
  return t("Chrome shim is not included in this adapter release."), i;
1916
1920
  if (n.version === null)
1917
1921
  return t("Chrome shim can not determine version, not shimming."), i;
1918
- t("adapter.js shimming chrome."), i.browserShim = ge, G(r, n), V(r), Ie(r, n), Me(r), w(r, n), Oe(r), Le(r, n), Ae(r), $e(r), Be(r, n), z(r), te(r), ne(r), N(r, n), J(r), re(r, n);
1922
+ t("adapter.js shimming chrome."), i.browserShim = me, z(r, n), N(r), Ee(r, n), De(r), Q(r, n), Ie(r), $e(r, n), Me(r), Oe(r), Ae(r, n), B(r), w(r), ee(r), U(r, n), F(r), te(r, n);
1919
1923
  break;
1920
1924
  case "firefox":
1921
- if (!ye || !ee || !e.shimFirefox)
1925
+ if (!ge || !Z || !e.shimFirefox)
1922
1926
  return t("Firefox shim is not included in this adapter release."), i;
1923
- t("adapter.js shimming firefox."), i.browserShim = ye, G(r, n), V(r), Fe(r, n), ee(r, n), Ue(r), Je(r), ze(r), Ne(r), Ge(r), Ve(r), He(r), Ye(r), Ke(r), z(r), ne(r), N(r, n), J(r);
1927
+ t("adapter.js shimming firefox."), i.browserShim = ge, z(r, n), N(r), je(r, n), Z(r, n), Be(r), ze(r), Ue(r), Fe(r), Ne(r), Ve(r), Ge(r), Je(r), Ye(r), B(r), ee(r), U(r, n), F(r);
1924
1928
  break;
1925
1929
  case "safari":
1926
1930
  if (!_e || !e.shimSafari)
1927
1931
  return t("Safari shim is not included in this adapter release."), i;
1928
- t("adapter.js shimming safari."), i.browserShim = _e, G(r, n), V(r), we(r), tt(r), Xe(r), qe(r), We(r), et(r), Qe(r), nt(r), z(r), te(r), N(r, n), J(r), re(r, n);
1932
+ t("adapter.js shimming safari."), i.browserShim = _e, z(r, n), N(r), Qe(r), we(r), qe(r), Ke(r), He(r), Ze(r), Xe(r), et(r), B(r), w(r), U(r, n), F(r), te(r, n);
1929
1933
  break;
1930
1934
  default:
1931
1935
  t("Unsupported browser!");
@@ -1933,29 +1937,29 @@ function Dt({ window: r } = {}, e = {
1933
1937
  }
1934
1938
  return i;
1935
1939
  }
1936
- const be = Dt({ window: typeof window > "u" ? void 0 : window });
1940
+ const Ce = Et({ window: typeof window > "u" ? void 0 : window });
1937
1941
  function P(r, e, t, n) {
1938
1942
  Object.defineProperty(r, e, { get: t, set: n, enumerable: !0, configurable: !0 });
1939
1943
  }
1940
- class it {
1944
+ class nt {
1941
1945
  constructor() {
1942
1946
  this.chunkedMTU = 16300, this._dataCount = 1, this.chunk = (e) => {
1943
1947
  const t = [], n = e.byteLength, i = Math.ceil(n / this.chunkedMTU);
1944
1948
  let s = 0, o = 0;
1945
1949
  for (; o < n; ) {
1946
- const a = Math.min(n, o + this.chunkedMTU), c = e.slice(o, a), p = {
1950
+ const a = Math.min(n, o + this.chunkedMTU), c = e.slice(o, a), f = {
1947
1951
  __peerData: this._dataCount,
1948
1952
  n: s,
1949
1953
  data: c,
1950
1954
  total: i
1951
1955
  };
1952
- t.push(p), o = a, s++;
1956
+ t.push(f), o = a, s++;
1953
1957
  }
1954
1958
  return this._dataCount++, t;
1955
1959
  };
1956
1960
  }
1957
1961
  }
1958
- function It(r) {
1962
+ function Dt(r) {
1959
1963
  let e = 0;
1960
1964
  for (const i of r) e += i.byteLength;
1961
1965
  const t = new Uint8Array(e);
@@ -1964,10 +1968,10 @@ function It(r) {
1964
1968
  t.set(i, n), n += i.byteLength;
1965
1969
  return t;
1966
1970
  }
1967
- const X = (
1971
+ const q = (
1968
1972
  //@ts-ignore
1969
- be.default || be
1970
- ), O = new class {
1973
+ Ce.default || Ce
1974
+ ), M = new class {
1971
1975
  isWebRTCSupported() {
1972
1976
  return typeof RTCPeerConnection < "u";
1973
1977
  }
@@ -1976,13 +1980,13 @@ const X = (
1976
1980
  return this.supportedBrowsers.includes(r) ? r === "chrome" ? e >= this.minChromeVersion : r === "firefox" ? e >= this.minFirefoxVersion : r === "safari" ? !this.isIOS && e >= this.minSafariVersion : !1 : !1;
1977
1981
  }
1978
1982
  getBrowser() {
1979
- return X.browserDetails.browser;
1983
+ return q.browserDetails.browser;
1980
1984
  }
1981
1985
  getVersion() {
1982
- return X.browserDetails.version || 0;
1986
+ return q.browserDetails.version || 0;
1983
1987
  }
1984
1988
  isUnifiedPlanSupported() {
1985
- const r = this.getBrowser(), e = X.browserDetails.version || 0;
1989
+ const r = this.getBrowser(), e = q.browserDetails.version || 0;
1986
1990
  if (r === "chrome" && e < this.minChromeVersion) return !1;
1987
1991
  if (r === "firefox" && e >= this.minFirefoxVersion) return !0;
1988
1992
  if (!window.RTCRtpTransceiver || !("currentDirection" in RTCRtpTransceiver.prototype)) return !1;
@@ -2015,7 +2019,7 @@ const X = (
2015
2019
  "safari"
2016
2020
  ], this.minFirefoxVersion = 59, this.minChromeVersion = 72, this.minSafariVersion = 605;
2017
2021
  }
2018
- }(), Mt = (r) => !r || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(r), st = () => Math.random().toString(36).slice(2), ve = {
2022
+ }(), It = (r) => !r || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(r), rt = () => Math.random().toString(36).slice(2), be = {
2019
2023
  iceServers: [
2020
2024
  {
2021
2025
  urls: "stun:stun.l.google.com:19302"
@@ -2031,7 +2035,7 @@ const X = (
2031
2035
  ],
2032
2036
  sdpSemantics: "unified-plan"
2033
2037
  };
2034
- class Ot extends it {
2038
+ class Mt extends nt {
2035
2039
  noop() {
2036
2040
  }
2037
2041
  blobToArrayBuffer(e, t) {
@@ -2049,13 +2053,22 @@ class Ot extends it {
2049
2053
  return location.protocol === "https:";
2050
2054
  }
2051
2055
  constructor(...e) {
2052
- super(...e), this.CLOUD_HOST = "0.peerjs.com", this.CLOUD_PORT = 443, this.chunkedBrowsers = {
2056
+ super(...e), this.CLOUD_HOST = "0.peerjs.com", this.CLOUD_PORT = 443, // Browsers that need chunking:
2057
+ this.chunkedBrowsers = {
2053
2058
  Chrome: 1,
2054
2059
  chrome: 1
2055
- }, this.defaultConfig = ve, this.browser = O.getBrowser(), this.browserVersion = O.getVersion(), this.pack = Re, this.unpack = Te, this.supports = function() {
2060
+ }, // Returns browser-agnostic default config
2061
+ this.defaultConfig = be, this.browser = M.getBrowser(), this.browserVersion = M.getVersion(), this.pack = Te, this.unpack = Se, /**
2062
+ * A hash of WebRTC features mapped to booleans that correspond to whether the feature is supported by the current browser.
2063
+ *
2064
+ * :::caution
2065
+ * Only the properties documented here are guaranteed to be present on `util.supports`
2066
+ * :::
2067
+ */
2068
+ this.supports = (function() {
2056
2069
  const t = {
2057
- browser: O.isBrowserSupported(),
2058
- webRTC: O.isWebRTCSupported(),
2070
+ browser: M.isBrowserSupported(),
2071
+ webRTC: M.isWebRTCSupported(),
2059
2072
  audioVideo: !1,
2060
2073
  data: !1,
2061
2074
  binaryBlob: !1,
@@ -2064,14 +2077,14 @@ class Ot extends it {
2064
2077
  if (!t.webRTC) return t;
2065
2078
  let n;
2066
2079
  try {
2067
- n = new RTCPeerConnection(ve), t.audioVideo = !0;
2080
+ n = new RTCPeerConnection(be), t.audioVideo = !0;
2068
2081
  let i;
2069
2082
  try {
2070
2083
  i = n.createDataChannel("_PEERJSTEST", {
2071
2084
  ordered: !0
2072
2085
  }), t.data = !0, t.reliable = !!i.ordered;
2073
2086
  try {
2074
- i.binaryType = "blob", t.binaryBlob = !O.isIOS;
2087
+ i.binaryType = "blob", t.binaryBlob = !M.isIOS;
2075
2088
  } catch {
2076
2089
  }
2077
2090
  } catch {
@@ -2083,15 +2096,12 @@ class Ot extends it {
2083
2096
  n && n.close();
2084
2097
  }
2085
2098
  return t;
2086
- }(), this.validateId = Mt, this.randomToken = st;
2099
+ })(), // Ensure alphanumeric ids
2100
+ this.validateId = It, this.randomToken = rt;
2087
2101
  }
2088
2102
  }
2089
- const k = new Ot(), At = "PeerJS: ";
2090
- var ke;
2091
- (function(r) {
2092
- r[r.Disabled = 0] = "Disabled", r[r.Errors = 1] = "Errors", r[r.Warnings = 2] = "Warnings", r[r.All = 3] = "All";
2093
- })(ke || (ke = {}));
2094
- class $t {
2103
+ const S = new Mt(), Ot = "PeerJS: ";
2104
+ class Lt {
2095
2105
  get logLevel() {
2096
2106
  return this._logLevel;
2097
2107
  }
@@ -2112,7 +2122,7 @@ class $t {
2112
2122
  }
2113
2123
  _print(e, ...t) {
2114
2124
  const n = [
2115
- At,
2125
+ Ot,
2116
2126
  ...t
2117
2127
  ];
2118
2128
  for (const i in n) n[i] instanceof Error && (n[i] = "(" + n[i].name + ") " + n[i].message);
@@ -2122,31 +2132,31 @@ class $t {
2122
2132
  this._logLevel = 0;
2123
2133
  }
2124
2134
  }
2125
- var u = new $t(), fe = {}, jt = Object.prototype.hasOwnProperty, v = "~";
2126
- function j() {
2135
+ var d = new Lt(), fe = {}, $t = Object.prototype.hasOwnProperty, v = "~";
2136
+ function A() {
2127
2137
  }
2128
- Object.create && (j.prototype = /* @__PURE__ */ Object.create(null), new j().__proto__ || (v = !1));
2129
- function Lt(r, e, t) {
2138
+ Object.create && (A.prototype = /* @__PURE__ */ Object.create(null), new A().__proto__ || (v = !1));
2139
+ function At(r, e, t) {
2130
2140
  this.fn = r, this.context = e, this.once = t || !1;
2131
2141
  }
2132
- function ot(r, e, t, n, i) {
2142
+ function it(r, e, t, n, i) {
2133
2143
  if (typeof t != "function") throw new TypeError("The listener must be a function");
2134
- var s = new Lt(t, n || r, i), o = v ? v + e : e;
2144
+ var s = new At(t, n || r, i), o = v ? v + e : e;
2135
2145
  return r._events[o] ? r._events[o].fn ? r._events[o] = [
2136
2146
  r._events[o],
2137
2147
  s
2138
2148
  ] : r._events[o].push(s) : (r._events[o] = s, r._eventsCount++), r;
2139
2149
  }
2140
- function H(r, e) {
2141
- --r._eventsCount === 0 ? r._events = new j() : delete r._events[e];
2150
+ function V(r, e) {
2151
+ --r._eventsCount === 0 ? r._events = new A() : delete r._events[e];
2142
2152
  }
2143
2153
  function C() {
2144
- this._events = new j(), this._eventsCount = 0;
2154
+ this._events = new A(), this._eventsCount = 0;
2145
2155
  }
2146
2156
  C.prototype.eventNames = function() {
2147
2157
  var e = [], t, n;
2148
2158
  if (this._eventsCount === 0) return e;
2149
- for (n in t = this._events) jt.call(t, n) && e.push(v ? n.slice(1) : n);
2159
+ for (n in t = this._events) $t.call(t, n) && e.push(v ? n.slice(1) : n);
2150
2160
  return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(t)) : e;
2151
2161
  };
2152
2162
  C.prototype.listeners = function(e) {
@@ -2165,9 +2175,9 @@ C.prototype.listenerCount = function(e) {
2165
2175
  C.prototype.emit = function(e, t, n, i, s, o) {
2166
2176
  var a = v ? v + e : e;
2167
2177
  if (!this._events[a]) return !1;
2168
- var c = this._events[a], p = arguments.length, f, h;
2178
+ var c = this._events[a], f = arguments.length, p, h;
2169
2179
  if (c.fn) {
2170
- switch (c.once && this.removeListener(e, c.fn, void 0, !0), p) {
2180
+ switch (c.once && this.removeListener(e, c.fn, void 0, !0), f) {
2171
2181
  case 1:
2172
2182
  return c.fn.call(c.context), !0;
2173
2183
  case 2:
@@ -2181,12 +2191,12 @@ C.prototype.emit = function(e, t, n, i, s, o) {
2181
2191
  case 6:
2182
2192
  return c.fn.call(c.context, t, n, i, s, o), !0;
2183
2193
  }
2184
- for (h = 1, f = new Array(p - 1); h < p; h++) f[h - 1] = arguments[h];
2185
- c.fn.apply(c.context, f);
2194
+ for (h = 1, p = new Array(f - 1); h < f; h++) p[h - 1] = arguments[h];
2195
+ c.fn.apply(c.context, p);
2186
2196
  } else {
2187
- var l = c.length, d;
2188
- for (h = 0; h < l; h++)
2189
- switch (c[h].once && this.removeListener(e, c[h].fn, void 0, !0), p) {
2197
+ var u = c.length, l;
2198
+ for (h = 0; h < u; h++)
2199
+ switch (c[h].once && this.removeListener(e, c[h].fn, void 0, !0), f) {
2190
2200
  case 1:
2191
2201
  c[h].fn.call(c[h].context);
2192
2202
  break;
@@ -2200,35 +2210,35 @@ C.prototype.emit = function(e, t, n, i, s, o) {
2200
2210
  c[h].fn.call(c[h].context, t, n, i);
2201
2211
  break;
2202
2212
  default:
2203
- if (!f) for (d = 1, f = new Array(p - 1); d < p; d++) f[d - 1] = arguments[d];
2204
- c[h].fn.apply(c[h].context, f);
2213
+ if (!p) for (l = 1, p = new Array(f - 1); l < f; l++) p[l - 1] = arguments[l];
2214
+ c[h].fn.apply(c[h].context, p);
2205
2215
  }
2206
2216
  }
2207
2217
  return !0;
2208
2218
  };
2209
2219
  C.prototype.on = function(e, t, n) {
2210
- return ot(this, e, t, n, !1);
2220
+ return it(this, e, t, n, !1);
2211
2221
  };
2212
2222
  C.prototype.once = function(e, t, n) {
2213
- return ot(this, e, t, n, !0);
2223
+ return it(this, e, t, n, !0);
2214
2224
  };
2215
2225
  C.prototype.removeListener = function(e, t, n, i) {
2216
2226
  var s = v ? v + e : e;
2217
2227
  if (!this._events[s]) return this;
2218
2228
  if (!t)
2219
- return H(this, s), this;
2229
+ return V(this, s), this;
2220
2230
  var o = this._events[s];
2221
2231
  if (o.fn)
2222
- o.fn === t && (!i || o.once) && (!n || o.context === n) && H(this, s);
2232
+ o.fn === t && (!i || o.once) && (!n || o.context === n) && V(this, s);
2223
2233
  else {
2224
- for (var a = 0, c = [], p = o.length; a < p; a++) (o[a].fn !== t || i && !o[a].once || n && o[a].context !== n) && c.push(o[a]);
2225
- c.length ? this._events[s] = c.length === 1 ? c[0] : c : H(this, s);
2234
+ for (var a = 0, c = [], f = o.length; a < f; a++) (o[a].fn !== t || i && !o[a].once || n && o[a].context !== n) && c.push(o[a]);
2235
+ c.length ? this._events[s] = c.length === 1 ? c[0] : c : V(this, s);
2226
2236
  }
2227
2237
  return this;
2228
2238
  };
2229
2239
  C.prototype.removeAllListeners = function(e) {
2230
2240
  var t;
2231
- return e ? (t = v ? v + e : e, this._events[t] && H(this, t)) : (this._events = new j(), this._eventsCount = 0), this;
2241
+ return e ? (t = v ? v + e : e, this._events[t] && V(this, t)) : (this._events = new A(), this._eventsCount = 0), this;
2232
2242
  };
2233
2243
  C.prototype.off = C.prototype.removeListener;
2234
2244
  C.prototype.addListener = C.prototype.on;
@@ -2236,44 +2246,30 @@ C.prefixed = v;
2236
2246
  C.EventEmitter = C;
2237
2247
  fe = C;
2238
2248
  var E = {};
2239
- P(E, "ConnectionType", () => T);
2249
+ P(E, "ConnectionType", () => k);
2240
2250
  P(E, "PeerErrorType", () => g);
2241
- P(E, "BaseConnectionErrorType", () => L);
2242
- P(E, "DataConnectionErrorType", () => B);
2243
- P(E, "SerializationType", () => I);
2244
- P(E, "SocketEventType", () => S);
2245
- P(E, "ServerMessageType", () => _);
2246
- var T;
2247
- (function(r) {
2248
- r.Data = "data", r.Media = "media";
2249
- })(T || (T = {}));
2250
- var g;
2251
- (function(r) {
2252
- r.BrowserIncompatible = "browser-incompatible", r.Disconnected = "disconnected", r.InvalidID = "invalid-id", r.InvalidKey = "invalid-key", r.Network = "network", r.PeerUnavailable = "peer-unavailable", r.SslUnavailable = "ssl-unavailable", r.ServerError = "server-error", r.SocketError = "socket-error", r.SocketClosed = "socket-closed", r.UnavailableID = "unavailable-id", r.WebRTC = "webrtc";
2253
- })(g || (g = {}));
2254
- var L;
2255
- (function(r) {
2256
- r.NegotiationFailed = "negotiation-failed", r.ConnectionClosed = "connection-closed";
2257
- })(L || (L = {}));
2258
- var B;
2259
- (function(r) {
2260
- r.NotOpenYet = "not-open-yet", r.MessageToBig = "message-too-big";
2261
- })(B || (B = {}));
2262
- var I;
2263
- (function(r) {
2264
- r.Binary = "binary", r.BinaryUTF8 = "binary-utf8", r.JSON = "json", r.None = "raw";
2265
- })(I || (I = {}));
2266
- var S;
2267
- (function(r) {
2268
- r.Message = "message", r.Disconnected = "disconnected", r.Error = "error", r.Close = "close";
2269
- })(S || (S = {}));
2270
- var _;
2271
- (function(r) {
2272
- r.Heartbeat = "HEARTBEAT", r.Candidate = "CANDIDATE", r.Offer = "OFFER", r.Answer = "ANSWER", r.Open = "OPEN", r.Error = "ERROR", r.IdTaken = "ID-TAKEN", r.InvalidKey = "INVALID-KEY", r.Leave = "LEAVE", r.Expire = "EXPIRE";
2273
- })(_ || (_ = {}));
2274
- var he = {};
2275
- he = JSON.parse('{"name":"peerjs","version":"1.5.4","keywords":["peerjs","webrtc","p2p","rtc"],"description":"PeerJS client","homepage":"https://peerjs.com","bugs":{"url":"https://github.com/peers/peerjs/issues"},"repository":{"type":"git","url":"https://github.com/peers/peerjs"},"license":"MIT","contributors":["Michelle Bu <michelle@michellebu.com>","afrokick <devbyru@gmail.com>","ericz <really.ez@gmail.com>","Jairo <kidandcat@gmail.com>","Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>","Jairo Caro-Accino Viciana <jairo@galax.be>","Carlos Caballero <carlos.caballero.gonzalez@gmail.com>","hc <hheennrryy@gmail.com>","Muhammad Asif <capripio@gmail.com>","PrashoonB <prashoonbhattacharjee@gmail.com>","Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>","akotynski <aleksanderkotbury@gmail.com>","lmb <i@lmb.io>","Jairooo <jairocaro@msn.com>","Moritz Stückler <moritz.stueckler@gmail.com>","Simon <crydotsnakegithub@gmail.com>","Denis Lukov <denismassters@gmail.com>","Philipp Hancke <fippo@andyet.net>","Hans Oksendahl <hansoksendahl@gmail.com>","Jess <jessachandler@gmail.com>","khankuan <khankuan@gmail.com>","DUODVK <kurmanov.work@gmail.com>","XiZhao <kwang1imsa@gmail.com>","Matthias Lohr <matthias@lohr.me>","=frank tree <=frnktrb@googlemail.com>","Andre Eckardt <aeckardt@outlook.com>","Chris Cowan <agentme49@gmail.com>","Alex Chuev <alex@chuev.com>","alxnull <alxnull@e.mail.de>","Yemel Jardi <angel.jardi@gmail.com>","Ben Parnell <benjaminparnell.94@gmail.com>","Benny Lichtner <bennlich@gmail.com>","fresheneesz <bitetrudpublic@gmail.com>","bob.barstead@exaptive.com <bob.barstead@exaptive.com>","chandika <chandika@gmail.com>","emersion <contact@emersion.fr>","Christopher Van <cvan@users.noreply.github.com>","eddieherm <edhermoso@gmail.com>","Eduardo Pinho <enet4mikeenet@gmail.com>","Evandro Zanatta <ezanatta@tray.net.br>","Gardner Bickford <gardner@users.noreply.github.com>","Gian Luca <gianluca.cecchi@cynny.com>","PatrickJS <github@gdi2290.com>","jonnyf <github@jonathanfoss.co.uk>","Hizkia Felix <hizkifw@gmail.com>","Hristo Oskov <hristo.oskov@gmail.com>","Isaac Madwed <i.madwed@gmail.com>","Ilya Konanykhin <ilya.konanykhin@gmail.com>","jasonbarry <jasbarry@me.com>","Jonathan Burke <jonathan.burke.1311@googlemail.com>","Josh Hamit <josh.hamit@gmail.com>","Jordan Austin <jrax86@gmail.com>","Joel Wetzell <jwetzell@yahoo.com>","xizhao <kevin.wang@cloudera.com>","Alberto Torres <kungfoobar@gmail.com>","Jonathan Mayol <mayoljonathan@gmail.com>","Jefferson Felix <me@jsfelix.dev>","Rolf Erik Lekang <me@rolflekang.com>","Kevin Mai-Husan Chia <mhchia@users.noreply.github.com>","Pepijn de Vos <pepijndevos@gmail.com>","JooYoung <qkdlql@naver.com>","Tobias Speicher <rootcommander@gmail.com>","Steve Blaurock <sblaurock@gmail.com>","Kyrylo Shegeda <shegeda@ualberta.ca>","Diwank Singh Tomer <singh@diwank.name>","Sören Balko <Soeren.Balko@gmail.com>","Arpit Solanki <solankiarpit1997@gmail.com>","Yuki Ito <yuki@gnnk.net>","Artur Zayats <zag2art@gmail.com>"],"funding":{"type":"opencollective","url":"https://opencollective.com/peer"},"collective":{"type":"opencollective","url":"https://opencollective.com/peer"},"files":["dist/*"],"sideEffects":["lib/global.ts","lib/supports.ts"],"main":"dist/bundler.cjs","module":"dist/bundler.mjs","browser-minified":"dist/peerjs.min.js","browser-unminified":"dist/peerjs.js","browser-minified-msgpack":"dist/serializer.msgpack.mjs","types":"dist/types.d.ts","engines":{"node":">= 14"},"targets":{"types":{"source":"lib/exports.ts"},"main":{"source":"lib/exports.ts","sourceMap":{"inlineSources":true}},"module":{"source":"lib/exports.ts","includeNodeModules":["eventemitter3"],"sourceMap":{"inlineSources":true}},"browser-minified":{"context":"browser","outputFormat":"global","optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-unminified":{"context":"browser","outputFormat":"global","optimize":false,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15"},"source":"lib/global.ts"},"browser-minified-msgpack":{"context":"browser","outputFormat":"esmodule","isLibrary":true,"optimize":true,"engines":{"browsers":"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15"},"source":"lib/dataconnection/StreamConnection/MsgPack.ts"}},"scripts":{"contributors":"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\"chore(contributors): update and sort contributors list\\"","check":"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit","watch":"parcel watch","build":"rm -rf dist && parcel build","prepublishOnly":"npm run build","test":"jest","test:watch":"jest --watch","coverage":"jest --coverage --collectCoverageFrom=\\"./lib/**\\"","format":"prettier --write .","format:check":"prettier --check .","semantic-release":"semantic-release","e2e":"wdio run e2e/wdio.local.conf.ts","e2e:bstack":"wdio run e2e/wdio.bstack.conf.ts"},"devDependencies":{"@parcel/config-default":"^2.9.3","@parcel/packager-ts":"^2.9.3","@parcel/transformer-typescript-tsc":"^2.9.3","@parcel/transformer-typescript-types":"^2.9.3","@semantic-release/changelog":"^6.0.1","@semantic-release/git":"^10.0.1","@swc/core":"^1.3.27","@swc/jest":"^0.2.24","@types/jasmine":"^4.3.4","@wdio/browserstack-service":"^8.11.2","@wdio/cli":"^8.11.2","@wdio/globals":"^8.11.2","@wdio/jasmine-framework":"^8.11.2","@wdio/local-runner":"^8.11.2","@wdio/spec-reporter":"^8.11.2","@wdio/types":"^8.10.4","http-server":"^14.1.1","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1","mock-socket":"^9.0.0","parcel":"^2.9.3","prettier":"^3.0.0","semantic-release":"^21.0.0","ts-node":"^10.9.1","typescript":"^5.0.0","wdio-geckodriver-service":"^5.0.1"},"dependencies":{"@msgpack/msgpack":"^2.8.0","eventemitter3":"^4.0.7","peerjs-js-binarypack":"^2.1.0","webrtc-adapter":"^9.0.0"},"alias":{"process":false,"buffer":false}}');
2276
- class Bt extends fe.EventEmitter {
2251
+ P(E, "BaseConnectionErrorType", () => ne);
2252
+ P(E, "DataConnectionErrorType", () => pe);
2253
+ P(E, "SerializationType", () => Y);
2254
+ P(E, "SocketEventType", () => T);
2255
+ P(E, "ServerMessageType", () => y);
2256
+ var k = /* @__PURE__ */ (function(r) {
2257
+ return r.Data = "data", r.Media = "media", r;
2258
+ })({}), g = /* @__PURE__ */ (function(r) {
2259
+ return r.BrowserIncompatible = "browser-incompatible", r.Disconnected = "disconnected", r.InvalidID = "invalid-id", r.InvalidKey = "invalid-key", r.Network = "network", r.PeerUnavailable = "peer-unavailable", r.SslUnavailable = "ssl-unavailable", r.ServerError = "server-error", r.SocketError = "socket-error", r.SocketClosed = "socket-closed", r.UnavailableID = "unavailable-id", r.WebRTC = "webrtc", r;
2260
+ })({}), ne = /* @__PURE__ */ (function(r) {
2261
+ return r.NegotiationFailed = "negotiation-failed", r.ConnectionClosed = "connection-closed", r;
2262
+ })({}), pe = /* @__PURE__ */ (function(r) {
2263
+ return r.NotOpenYet = "not-open-yet", r.MessageToBig = "message-too-big", r;
2264
+ })({}), Y = /* @__PURE__ */ (function(r) {
2265
+ return r.Binary = "binary", r.BinaryUTF8 = "binary-utf8", r.JSON = "json", r.None = "raw", r;
2266
+ })({}), T = /* @__PURE__ */ (function(r) {
2267
+ return r.Message = "message", r.Disconnected = "disconnected", r.Error = "error", r.Close = "close", r;
2268
+ })({}), y = /* @__PURE__ */ (function(r) {
2269
+ return r.Heartbeat = "HEARTBEAT", r.Candidate = "CANDIDATE", r.Offer = "OFFER", r.Answer = "ANSWER", r.Open = "OPEN", r.Error = "ERROR", r.IdTaken = "ID-TAKEN", r.InvalidKey = "INVALID-KEY", r.Leave = "LEAVE", r.Expire = "EXPIRE", r;
2270
+ })({});
2271
+ const st = "1.5.5";
2272
+ class jt extends fe.EventEmitter {
2277
2273
  constructor(e, t, n, i, s, o = 5e3) {
2278
2274
  super(), this.pingInterval = o, this._disconnected = !0, this._messagesQueue = [];
2279
2275
  const a = e ? "wss://" : "ws://";
@@ -2282,19 +2278,19 @@ class Bt extends fe.EventEmitter {
2282
2278
  start(e, t) {
2283
2279
  this._id = e;
2284
2280
  const n = `${this._baseUrl}&id=${e}&token=${t}`;
2285
- this._socket || !this._disconnected || (this._socket = new WebSocket(n + "&version=" + he.version), this._disconnected = !1, this._socket.onmessage = (i) => {
2281
+ this._socket || !this._disconnected || (this._socket = new WebSocket(n + "&version=" + st), this._disconnected = !1, this._socket.onmessage = (i) => {
2286
2282
  let s;
2287
2283
  try {
2288
- s = JSON.parse(i.data), u.log("Server message received:", s);
2284
+ s = JSON.parse(i.data), d.log("Server message received:", s);
2289
2285
  } catch {
2290
- u.log("Invalid server message", i.data);
2286
+ d.log("Invalid server message", i.data);
2291
2287
  return;
2292
2288
  }
2293
- this.emit(S.Message, s);
2289
+ this.emit(T.Message, s);
2294
2290
  }, this._socket.onclose = (i) => {
2295
- this._disconnected || (u.log("Socket closed.", i), this._cleanup(), this._disconnected = !0, this.emit(S.Disconnected));
2291
+ this._disconnected || (d.log("Socket closed.", i), this._cleanup(), this._disconnected = !0, this.emit(T.Disconnected));
2296
2292
  }, this._socket.onopen = () => {
2297
- this._disconnected || (this._sendQueuedMessages(), u.log("Socket open"), this._scheduleHeartbeat());
2293
+ this._disconnected || (this._sendQueuedMessages(), d.log("Socket open"), this._scheduleHeartbeat());
2298
2294
  });
2299
2295
  }
2300
2296
  _scheduleHeartbeat() {
@@ -2304,11 +2300,11 @@ class Bt extends fe.EventEmitter {
2304
2300
  }
2305
2301
  _sendHeartbeat() {
2306
2302
  if (!this._wsOpen()) {
2307
- u.log("Cannot send heartbeat, because socket closed");
2303
+ d.log("Cannot send heartbeat, because socket closed");
2308
2304
  return;
2309
2305
  }
2310
2306
  const e = JSON.stringify({
2311
- type: _.Heartbeat
2307
+ type: y.Heartbeat
2312
2308
  });
2313
2309
  this._socket.send(e), this._scheduleHeartbeat();
2314
2310
  }
@@ -2332,7 +2328,7 @@ class Bt extends fe.EventEmitter {
2332
2328
  return;
2333
2329
  }
2334
2330
  if (!e.type) {
2335
- this.emit(S.Error, "Invalid message");
2331
+ this.emit(T.Error, "Invalid message");
2336
2332
  return;
2337
2333
  }
2338
2334
  if (!this._wsOpen()) return;
@@ -2346,14 +2342,14 @@ class Bt extends fe.EventEmitter {
2346
2342
  this._socket && (this._socket.onopen = this._socket.onmessage = this._socket.onclose = null, this._socket.close(), this._socket = void 0), clearTimeout(this._wsPingTimer);
2347
2343
  }
2348
2344
  }
2349
- class at {
2345
+ class ot {
2350
2346
  constructor(e) {
2351
2347
  this.connection = e;
2352
2348
  }
2353
2349
  /** Returns a PeerConnection object set up correctly (for data, media). */
2354
2350
  startConnection(e) {
2355
2351
  const t = this._startPeerConnection();
2356
- if (this.connection.peerConnection = t, this.connection.type === T.Media && e._stream && this._addTracksToConnection(e._stream, t), e.originator) {
2352
+ if (this.connection.peerConnection = t, this.connection.type === k.Media && e._stream && this._addTracksToConnection(e._stream, t), e.originator) {
2357
2353
  const n = this.connection, i = {
2358
2354
  ordered: !!e.reliable
2359
2355
  }, s = t.createDataChannel(n.label, i);
@@ -2362,16 +2358,16 @@ class at {
2362
2358
  }
2363
2359
  /** Start a PC. */
2364
2360
  _startPeerConnection() {
2365
- u.log("Creating RTCPeerConnection.");
2361
+ d.log("Creating RTCPeerConnection.");
2366
2362
  const e = new RTCPeerConnection(this.connection.provider.options.config);
2367
2363
  return this._setupListeners(e), e;
2368
2364
  }
2369
2365
  /** Set up various WebRTC listeners. */
2370
2366
  _setupListeners(e) {
2371
2367
  const t = this.connection.peer, n = this.connection.connectionId, i = this.connection.type, s = this.connection.provider;
2372
- u.log("Listening for ICE candidates."), e.onicecandidate = (o) => {
2373
- !o.candidate || !o.candidate.candidate || (u.log(`Received ICE candidates for ${t}:`, o.candidate), s.socket.send({
2374
- type: _.Candidate,
2368
+ d.log("Listening for ICE candidates."), e.onicecandidate = (o) => {
2369
+ !o.candidate || !o.candidate.candidate || (d.log(`Received ICE candidates for ${t}:`, o.candidate), s.socket.send({
2370
+ type: y.Candidate,
2375
2371
  payload: {
2376
2372
  candidate: o.candidate,
2377
2373
  type: i,
@@ -2382,13 +2378,13 @@ class at {
2382
2378
  }, e.oniceconnectionstatechange = () => {
2383
2379
  switch (e.iceConnectionState) {
2384
2380
  case "failed":
2385
- u.log("iceConnectionState is failed, closing connections to " + t), this.connection.emitError(L.NegotiationFailed, "Negotiation of connection to " + t + " failed."), this.connection.close();
2381
+ d.log("iceConnectionState is failed, closing connections to " + t), this.connection.emitError(ne.NegotiationFailed, "Negotiation of connection to " + t + " failed."), this.connection.close();
2386
2382
  break;
2387
2383
  case "closed":
2388
- u.log("iceConnectionState is closed, closing connections to " + t), this.connection.emitError(L.ConnectionClosed, "Connection to " + t + " closed."), this.connection.close();
2384
+ d.log("iceConnectionState is closed, closing connections to " + t), this.connection.emitError(ne.ConnectionClosed, "Connection to " + t + " closed."), this.connection.close();
2389
2385
  break;
2390
2386
  case "disconnected":
2391
- u.log("iceConnectionState changed to disconnected on the connection with " + t);
2387
+ d.log("iceConnectionState changed to disconnected on the connection with " + t);
2392
2388
  break;
2393
2389
  case "completed":
2394
2390
  e.onicecandidate = () => {
@@ -2396,21 +2392,21 @@ class at {
2396
2392
  break;
2397
2393
  }
2398
2394
  this.connection.emit("iceStateChanged", e.iceConnectionState);
2399
- }, u.log("Listening for data channel"), e.ondatachannel = (o) => {
2400
- u.log("Received data channel");
2395
+ }, d.log("Listening for data channel"), e.ondatachannel = (o) => {
2396
+ d.log("Received data channel");
2401
2397
  const a = o.channel;
2402
2398
  s.getConnection(t, n)._initializeDataChannel(a);
2403
- }, u.log("Listening for remote stream"), e.ontrack = (o) => {
2404
- u.log("Received remote stream");
2399
+ }, d.log("Listening for remote stream"), e.ontrack = (o) => {
2400
+ d.log("Received remote stream");
2405
2401
  const a = o.streams[0], c = s.getConnection(t, n);
2406
- if (c.type === T.Media) {
2407
- const p = c;
2408
- this._addStreamToMediaConnection(a, p);
2402
+ if (c.type === k.Media) {
2403
+ const f = c;
2404
+ this._addStreamToMediaConnection(a, f);
2409
2405
  }
2410
2406
  };
2411
2407
  }
2412
2408
  cleanup() {
2413
- u.log("Cleaning up PeerConnection to " + this.connection.peer);
2409
+ d.log("Cleaning up PeerConnection to " + this.connection.peer);
2414
2410
  const e = this.connection.peerConnection;
2415
2411
  if (!e) return;
2416
2412
  this.connection.peerConnection = null, e.onicecandidate = e.oniceconnectionstatechange = e.ondatachannel = e.ontrack = () => {
@@ -2424,16 +2420,16 @@ class at {
2424
2420
  const e = this.connection.peerConnection, t = this.connection.provider;
2425
2421
  try {
2426
2422
  const n = await e.createOffer(this.connection.options.constraints);
2427
- u.log("Created offer."), this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform == "function" && (n.sdp = this.connection.options.sdpTransform(n.sdp) || n.sdp);
2423
+ d.log("Created offer."), this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform == "function" && (n.sdp = this.connection.options.sdpTransform(n.sdp) || n.sdp);
2428
2424
  try {
2429
- await e.setLocalDescription(n), u.log("Set localDescription:", n, `for:${this.connection.peer}`);
2425
+ await e.setLocalDescription(n), d.log("Set localDescription:", n, `for:${this.connection.peer}`);
2430
2426
  let i = {
2431
2427
  sdp: n,
2432
2428
  type: this.connection.type,
2433
2429
  connectionId: this.connection.connectionId,
2434
2430
  metadata: this.connection.metadata
2435
2431
  };
2436
- if (this.connection.type === T.Data) {
2432
+ if (this.connection.type === k.Data) {
2437
2433
  const s = this.connection;
2438
2434
  i = {
2439
2435
  ...i,
@@ -2443,25 +2439,25 @@ class at {
2443
2439
  };
2444
2440
  }
2445
2441
  t.socket.send({
2446
- type: _.Offer,
2442
+ type: y.Offer,
2447
2443
  payload: i,
2448
2444
  dst: this.connection.peer
2449
2445
  });
2450
2446
  } catch (i) {
2451
- i != "OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer" && (t.emitError(g.WebRTC, i), u.log("Failed to setLocalDescription, ", i));
2447
+ i != "OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer" && (t.emitError(g.WebRTC, i), d.log("Failed to setLocalDescription, ", i));
2452
2448
  }
2453
2449
  } catch (n) {
2454
- t.emitError(g.WebRTC, n), u.log("Failed to createOffer, ", n);
2450
+ t.emitError(g.WebRTC, n), d.log("Failed to createOffer, ", n);
2455
2451
  }
2456
2452
  }
2457
2453
  async _makeAnswer() {
2458
2454
  const e = this.connection.peerConnection, t = this.connection.provider;
2459
2455
  try {
2460
2456
  const n = await e.createAnswer();
2461
- u.log("Created answer."), this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform == "function" && (n.sdp = this.connection.options.sdpTransform(n.sdp) || n.sdp);
2457
+ d.log("Created answer."), this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform == "function" && (n.sdp = this.connection.options.sdpTransform(n.sdp) || n.sdp);
2462
2458
  try {
2463
- await e.setLocalDescription(n), u.log("Set localDescription:", n, `for:${this.connection.peer}`), t.socket.send({
2464
- type: _.Answer,
2459
+ await e.setLocalDescription(n), d.log("Set localDescription:", n, `for:${this.connection.peer}`), t.socket.send({
2460
+ type: y.Answer,
2465
2461
  payload: {
2466
2462
  sdp: n,
2467
2463
  type: this.connection.type,
@@ -2470,54 +2466,54 @@ class at {
2470
2466
  dst: this.connection.peer
2471
2467
  });
2472
2468
  } catch (i) {
2473
- t.emitError(g.WebRTC, i), u.log("Failed to setLocalDescription, ", i);
2469
+ t.emitError(g.WebRTC, i), d.log("Failed to setLocalDescription, ", i);
2474
2470
  }
2475
2471
  } catch (n) {
2476
- t.emitError(g.WebRTC, n), u.log("Failed to create answer, ", n);
2472
+ t.emitError(g.WebRTC, n), d.log("Failed to create answer, ", n);
2477
2473
  }
2478
2474
  }
2479
2475
  /** Handle an SDP. */
2480
2476
  async handleSDP(e, t) {
2481
2477
  t = new RTCSessionDescription(t);
2482
2478
  const n = this.connection.peerConnection, i = this.connection.provider;
2483
- u.log("Setting remote description", t);
2479
+ d.log("Setting remote description", t);
2484
2480
  const s = this;
2485
2481
  try {
2486
- await n.setRemoteDescription(t), u.log(`Set remoteDescription:${e} for:${this.connection.peer}`), e === "OFFER" && await s._makeAnswer();
2482
+ await n.setRemoteDescription(t), d.log(`Set remoteDescription:${e} for:${this.connection.peer}`), e === "OFFER" && await s._makeAnswer();
2487
2483
  } catch (o) {
2488
- i.emitError(g.WebRTC, o), u.log("Failed to setRemoteDescription, ", o);
2484
+ i.emitError(g.WebRTC, o), d.log("Failed to setRemoteDescription, ", o);
2489
2485
  }
2490
2486
  }
2491
2487
  /** Handle a candidate. */
2492
2488
  async handleCandidate(e) {
2493
- u.log("handleCandidate:", e);
2489
+ d.log("handleCandidate:", e);
2494
2490
  try {
2495
- await this.connection.peerConnection.addIceCandidate(e), u.log(`Added ICE candidate for:${this.connection.peer}`);
2491
+ await this.connection.peerConnection.addIceCandidate(e), d.log(`Added ICE candidate for:${this.connection.peer}`);
2496
2492
  } catch (t) {
2497
- this.connection.provider.emitError(g.WebRTC, t), u.log("Failed to handleCandidate, ", t);
2493
+ this.connection.provider.emitError(g.WebRTC, t), d.log("Failed to handleCandidate, ", t);
2498
2494
  }
2499
2495
  }
2500
2496
  _addTracksToConnection(e, t) {
2501
- if (u.log(`add tracks from stream ${e.id} to peer connection`), !t.addTrack) return u.error("Your browser does't support RTCPeerConnection#addTrack. Ignored.");
2497
+ if (d.log(`add tracks from stream ${e.id} to peer connection`), !t.addTrack) return d.error("Your browser does't support RTCPeerConnection#addTrack. Ignored.");
2502
2498
  e.getTracks().forEach((n) => {
2503
2499
  t.addTrack(n, e);
2504
2500
  });
2505
2501
  }
2506
2502
  _addStreamToMediaConnection(e, t) {
2507
- u.log(`add stream ${e.id} to media connection ${t.connectionId}`), t.addStream(e);
2503
+ d.log(`add stream ${e.id} to media connection ${t.connectionId}`), t.addStream(e);
2508
2504
  }
2509
2505
  }
2510
- class ct extends fe.EventEmitter {
2506
+ class at extends fe.EventEmitter {
2511
2507
  /**
2512
2508
  * Emits a typed error message.
2513
2509
  *
2514
2510
  * @internal
2515
2511
  */
2516
2512
  emitError(e, t) {
2517
- u.error("Error:", t), this.emit("error", new Ft(`${e}`, t));
2513
+ d.error("Error:", t), this.emit("error", new Bt(`${e}`, t));
2518
2514
  }
2519
2515
  }
2520
- class Ft extends Error {
2516
+ class Bt extends Error {
2521
2517
  /**
2522
2518
  * @internal
2523
2519
  */
@@ -2525,7 +2521,7 @@ class Ft extends Error {
2525
2521
  typeof t == "string" ? super(t) : (super(), Object.assign(this, t)), this.type = e;
2526
2522
  }
2527
2523
  }
2528
- class pt extends ct {
2524
+ class ct extends at {
2529
2525
  /**
2530
2526
  * Whether the media connection is active (e.g. your call has been answered).
2531
2527
  * You can check this if you want to set a maximum wait time for a one-sided call.
@@ -2537,13 +2533,13 @@ class pt extends ct {
2537
2533
  super(), this.peer = e, this.provider = t, this.options = n, this._open = !1, this.metadata = n.metadata;
2538
2534
  }
2539
2535
  }
2540
- var se;
2541
- const A = class A extends pt {
2536
+ var ie;
2537
+ const L = class L extends ct {
2542
2538
  /**
2543
2539
  * For media connections, this is always 'media'.
2544
2540
  */
2545
2541
  get type() {
2546
- return T.Media;
2542
+ return k.Media;
2547
2543
  }
2548
2544
  get localStream() {
2549
2545
  return this._localStream;
@@ -2552,7 +2548,7 @@ const A = class A extends pt {
2552
2548
  return this._remoteStream;
2553
2549
  }
2554
2550
  constructor(e, t, n) {
2555
- super(e, t, n), this._localStream = this.options._stream, this.connectionId = this.options.connectionId || A.ID_PREFIX + k.randomToken(), this._negotiator = new at(this), this._localStream && this._negotiator.startConnection({
2551
+ super(e, t, n), this._localStream = this.options._stream, this.connectionId = this.options.connectionId || L.ID_PREFIX + S.randomToken(), this._negotiator = new ot(this), this._localStream && this._negotiator.startConnection({
2556
2552
  _stream: this._localStream,
2557
2553
  originator: !0
2558
2554
  });
@@ -2560,13 +2556,13 @@ const A = class A extends pt {
2560
2556
  /** Called by the Negotiator when the DataChannel is ready. */
2561
2557
  _initializeDataChannel(e) {
2562
2558
  this.dataChannel = e, this.dataChannel.onopen = () => {
2563
- u.log(`DC#${this.connectionId} dc connection success`), this.emit("willCloseOnRemote");
2559
+ d.log(`DC#${this.connectionId} dc connection success`), this.emit("willCloseOnRemote");
2564
2560
  }, this.dataChannel.onclose = () => {
2565
- u.log(`DC#${this.connectionId} dc closed for:`, this.peer), this.close();
2561
+ d.log(`DC#${this.connectionId} dc closed for:`, this.peer), this.close();
2566
2562
  };
2567
2563
  }
2568
2564
  addStream(e) {
2569
- u.log("Receiving stream", e), this._remoteStream = e, super.emit("stream", e);
2565
+ d.log("Receiving stream", e), this._remoteStream = e, super.emit("stream", e);
2570
2566
  }
2571
2567
  /**
2572
2568
  * @internal
@@ -2574,14 +2570,14 @@ const A = class A extends pt {
2574
2570
  handleMessage(e) {
2575
2571
  const t = e.type, n = e.payload;
2576
2572
  switch (e.type) {
2577
- case _.Answer:
2573
+ case y.Answer:
2578
2574
  this._negotiator.handleSDP(t, n.sdp), this._open = !0;
2579
2575
  break;
2580
- case _.Candidate:
2576
+ case y.Candidate:
2581
2577
  this._negotiator.handleCandidate(n.candidate);
2582
2578
  break;
2583
2579
  default:
2584
- u.warn(`Unrecognized message type:${t} from peer:${this.peer}`);
2580
+ d.warn(`Unrecognized message type:${t} from peer:${this.peer}`);
2585
2581
  break;
2586
2582
  }
2587
2583
  }
@@ -2597,7 +2593,7 @@ const A = class A extends pt {
2597
2593
  */
2598
2594
  answer(e, t = {}) {
2599
2595
  if (this._localStream) {
2600
- u.warn("Local stream already exists on this MediaConnection. Are you answering a call twice?");
2596
+ d.warn("Local stream already exists on this MediaConnection. Are you answering a call twice?");
2601
2597
  return;
2602
2598
  }
2603
2599
  this._localStream = e, t && t.sdpTransform && (this.options.sdpTransform = t.sdpTransform), this._negotiator.startConnection({
@@ -2618,15 +2614,15 @@ const A = class A extends pt {
2618
2614
  this._negotiator && (this._negotiator.cleanup(), this._negotiator = null), this._localStream = null, this._remoteStream = null, this.provider && (this.provider._removeConnection(this), this.provider = null), this.options && this.options._stream && (this.options._stream = null), this.open && (this._open = !1, super.emit("close"));
2619
2615
  }
2620
2616
  };
2621
- se = new WeakMap(), M(A, se, A.ID_PREFIX = "mc_");
2622
- let Y = A;
2617
+ ie = new WeakMap(), I(L, ie, L.ID_PREFIX = "mc_");
2618
+ let G = L;
2623
2619
  class Ut {
2624
2620
  constructor(e) {
2625
2621
  this._options = e;
2626
2622
  }
2627
2623
  _buildRequest(e) {
2628
2624
  const t = this._options.secure ? "https" : "http", { host: n, port: i, path: s, key: o } = this._options, a = new URL(`${t}://${n}:${i}${s}${o}/${e}`);
2629
- return a.searchParams.set("ts", `${Date.now()}${Math.random()}`), a.searchParams.set("version", he.version), fetch(a.href, {
2625
+ return a.searchParams.set("ts", `${Date.now()}${Math.random()}`), a.searchParams.set("version", st), fetch(a.href, {
2630
2626
  referrerPolicy: this._options.referrerPolicy
2631
2627
  });
2632
2628
  }
@@ -2637,9 +2633,9 @@ class Ut {
2637
2633
  if (e.status !== 200) throw new Error(`Error. Status:${e.status}`);
2638
2634
  return e.text();
2639
2635
  } catch (e) {
2640
- u.error("Error retrieving ID", e);
2636
+ d.error("Error retrieving ID", e);
2641
2637
  let t = "";
2642
- throw this._options.path === "/" && this._options.host !== k.CLOUD_HOST && (t = " If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."), new Error("Could not get an ID from the server." + t);
2638
+ throw this._options.path === "/" && this._options.host !== S.CLOUD_HOST && (t = " If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer."), new Error("Could not get an ID from the server." + t);
2643
2639
  }
2644
2640
  }
2645
2641
  /** @deprecated */
@@ -2649,23 +2645,23 @@ class Ut {
2649
2645
  if (e.status !== 200) {
2650
2646
  if (e.status === 401) {
2651
2647
  let t = "";
2652
- throw this._options.host === k.CLOUD_HOST ? t = "It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key." : t = "You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.", new Error("It doesn't look like you have permission to list peers IDs. " + t);
2648
+ throw this._options.host === S.CLOUD_HOST ? t = "It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key." : t = "You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.", new Error("It doesn't look like you have permission to list peers IDs. " + t);
2653
2649
  }
2654
2650
  throw new Error(`Error. Status:${e.status}`);
2655
2651
  }
2656
2652
  return e.json();
2657
2653
  } catch (e) {
2658
- throw u.error("Error retrieving list peers", e), new Error("Could not get list peers from the server." + e);
2654
+ throw d.error("Error retrieving list peers", e), new Error("Could not get list peers from the server." + e);
2659
2655
  }
2660
2656
  }
2661
2657
  }
2662
- var oe, ae;
2663
- const R = class R extends pt {
2658
+ var se, oe;
2659
+ const R = class R extends ct {
2664
2660
  get type() {
2665
- return T.Data;
2661
+ return k.Data;
2666
2662
  }
2667
2663
  constructor(e, t, n) {
2668
- super(e, t, n), this.connectionId = this.options.connectionId || R.ID_PREFIX + st(), this.label = this.options.label || this.connectionId, this.reliable = !!this.options.reliable, this._negotiator = new at(this), this._negotiator.startConnection(this.options._payload || {
2664
+ super(e, t, n), this.connectionId = this.options.connectionId || R.ID_PREFIX + rt(), this.label = this.options.label || this.connectionId, this.reliable = !!this.options.reliable, this._negotiator = new ot(this), this._negotiator.startConnection(this.options._payload || {
2669
2665
  originator: !0,
2670
2666
  reliable: this.reliable
2671
2667
  });
@@ -2673,11 +2669,11 @@ const R = class R extends pt {
2673
2669
  /** Called by the Negotiator when the DataChannel is ready. */
2674
2670
  _initializeDataChannel(e) {
2675
2671
  this.dataChannel = e, this.dataChannel.onopen = () => {
2676
- u.log(`DC#${this.connectionId} dc connection success`), this._open = !0, this.emit("open");
2672
+ d.log(`DC#${this.connectionId} dc connection success`), this._open = !0, this.emit("open");
2677
2673
  }, this.dataChannel.onmessage = (t) => {
2678
- u.log(`DC#${this.connectionId} dc onmessage:`, t.data);
2674
+ d.log(`DC#${this.connectionId} dc onmessage:`, t.data);
2679
2675
  }, this.dataChannel.onclose = () => {
2680
- u.log(`DC#${this.connectionId} dc closed for:`, this.peer), this.close();
2676
+ d.log(`DC#${this.connectionId} dc closed for:`, this.peer), this.close();
2681
2677
  };
2682
2678
  }
2683
2679
  /**
@@ -2698,7 +2694,7 @@ const R = class R extends pt {
2698
2694
  /** Allows user to send data. */
2699
2695
  send(e, t = !1) {
2700
2696
  if (!this.open) {
2701
- this.emitError(B.NotOpenYet, "Connection is not open. You should listen for the `open` event before sending messages.");
2697
+ this.emitError(pe.NotOpenYet, "Connection is not open. You should listen for the `open` event before sending messages.");
2702
2698
  return;
2703
2699
  }
2704
2700
  return this._send(e, t);
@@ -2706,21 +2702,21 @@ const R = class R extends pt {
2706
2702
  async handleMessage(e) {
2707
2703
  const t = e.payload;
2708
2704
  switch (e.type) {
2709
- case _.Answer:
2705
+ case y.Answer:
2710
2706
  await this._negotiator.handleSDP(e.type, t.sdp);
2711
2707
  break;
2712
- case _.Candidate:
2708
+ case y.Candidate:
2713
2709
  await this._negotiator.handleCandidate(t.candidate);
2714
2710
  break;
2715
2711
  default:
2716
- u.warn("Unrecognized message type:", e.type, "from peer:", this.peer);
2712
+ d.warn("Unrecognized message type:", e.type, "from peer:", this.peer);
2717
2713
  break;
2718
2714
  }
2719
2715
  }
2720
2716
  };
2721
- oe = new WeakMap(), ae = new WeakMap(), M(R, oe, R.ID_PREFIX = "dc_"), M(R, ae, R.MAX_BUFFERED_AMOUNT = 8388608);
2722
- let K = R;
2723
- class le extends K {
2717
+ se = new WeakMap(), oe = new WeakMap(), I(R, se, R.ID_PREFIX = "dc_"), I(R, oe, R.MAX_BUFFERED_AMOUNT = 8388608);
2718
+ let J = R;
2719
+ class he extends J {
2724
2720
  get bufferSize() {
2725
2721
  return this._bufferSize;
2726
2722
  }
@@ -2733,14 +2729,14 @@ class le extends K {
2733
2729
  // Returns true if the send succeeds.
2734
2730
  _trySend(e) {
2735
2731
  if (!this.open) return !1;
2736
- if (this.dataChannel.bufferedAmount > K.MAX_BUFFERED_AMOUNT)
2732
+ if (this.dataChannel.bufferedAmount > J.MAX_BUFFERED_AMOUNT)
2737
2733
  return this._buffering = !0, setTimeout(() => {
2738
2734
  this._buffering = !1, this._tryBuffer();
2739
2735
  }, 50), !1;
2740
2736
  try {
2741
2737
  this.dataChannel.send(e);
2742
2738
  } catch (t) {
2743
- return u.error(`DC#:${this.connectionId} Error when sending:`, t), this._buffering = !0, this.close(), !1;
2739
+ return d.error(`DC#:${this.connectionId} Error when sending:`, t), this._buffering = !0, this.close(), !1;
2744
2740
  }
2745
2741
  return !0;
2746
2742
  }
@@ -2765,16 +2761,16 @@ class le extends K {
2765
2761
  super(...e), this._buffer = [], this._bufferSize = 0, this._buffering = !1;
2766
2762
  }
2767
2763
  }
2768
- class Q extends le {
2764
+ class X extends he {
2769
2765
  close(e) {
2770
2766
  super.close(e), this._chunkedData = {};
2771
2767
  }
2772
2768
  constructor(e, t, n) {
2773
- super(e, t, n), this.chunker = new it(), this.serialization = I.Binary, this._chunkedData = {};
2769
+ super(e, t, n), this.chunker = new nt(), this.serialization = Y.Binary, this._chunkedData = {};
2774
2770
  }
2775
2771
  // Handles a DataChannel message.
2776
2772
  _handleDataMessage({ data: e }) {
2777
- const t = Te(e), n = t.__peerData;
2773
+ const t = Se(e), n = t.__peerData;
2778
2774
  if (n) {
2779
2775
  if (n.type === "close") {
2780
2776
  this.close();
@@ -2793,14 +2789,14 @@ class Q extends le {
2793
2789
  };
2794
2790
  if (n.data[e.n] = new Uint8Array(e.data), n.count++, this._chunkedData[t] = n, n.total === n.count) {
2795
2791
  delete this._chunkedData[t];
2796
- const i = It(n.data);
2792
+ const i = Dt(n.data);
2797
2793
  this._handleDataMessage({
2798
2794
  data: i
2799
2795
  });
2800
2796
  }
2801
2797
  }
2802
2798
  _send(e, t) {
2803
- const n = Re(e);
2799
+ const n = Te(e);
2804
2800
  if (n instanceof Promise) return this._send_blob(n);
2805
2801
  if (!t && n.byteLength > this.chunker.chunkedMTU) {
2806
2802
  this._sendChunks(n);
@@ -2818,11 +2814,11 @@ class Q extends le {
2818
2814
  }
2819
2815
  _sendChunks(e) {
2820
2816
  const t = this.chunker.chunk(e);
2821
- u.log(`DC#${this.connectionId} Try to send ${t.length} chunks...`);
2817
+ d.log(`DC#${this.connectionId} Try to send ${t.length} chunks...`);
2822
2818
  for (const n of t) this.send(n, !0);
2823
2819
  }
2824
2820
  }
2825
- class zt extends le {
2821
+ class Ft extends he {
2826
2822
  _handleDataMessage({ data: e }) {
2827
2823
  super.emit("data", e);
2828
2824
  }
@@ -2830,10 +2826,10 @@ class zt extends le {
2830
2826
  this._bufferedSend(e);
2831
2827
  }
2832
2828
  constructor(...e) {
2833
- super(...e), this.serialization = I.None;
2829
+ super(...e), this.serialization = Y.None;
2834
2830
  }
2835
2831
  }
2836
- class Nt extends le {
2832
+ class zt extends he {
2837
2833
  // Handles a DataChannel message.
2838
2834
  _handleDataMessage({ data: e }) {
2839
2835
  const t = this.parse(this.decoder.decode(e)), n = t.__peerData;
@@ -2845,18 +2841,18 @@ class Nt extends le {
2845
2841
  }
2846
2842
  _send(e, t) {
2847
2843
  const n = this.encoder.encode(this.stringify(e));
2848
- if (n.byteLength >= k.chunkedMTU) {
2849
- this.emitError(B.MessageToBig, "Message too big for JSON channel");
2844
+ if (n.byteLength >= S.chunkedMTU) {
2845
+ this.emitError(pe.MessageToBig, "Message too big for JSON channel");
2850
2846
  return;
2851
2847
  }
2852
2848
  this._bufferedSend(n);
2853
2849
  }
2854
2850
  constructor(...e) {
2855
- super(...e), this.serialization = I.JSON, this.encoder = new TextEncoder(), this.decoder = new TextDecoder(), this.stringify = JSON.stringify, this.parse = JSON.parse;
2851
+ super(...e), this.serialization = Y.JSON, this.encoder = new TextEncoder(), this.decoder = new TextDecoder(), this.stringify = JSON.stringify, this.parse = JSON.parse;
2856
2852
  }
2857
2853
  }
2858
- var ce;
2859
- const $ = class $ extends ct {
2854
+ var ae;
2855
+ const $ = class $ extends at {
2860
2856
  /**
2861
2857
  * The brokering ID of this peer
2862
2858
  *
@@ -2902,46 +2898,47 @@ const $ = class $ extends ct {
2902
2898
  }
2903
2899
  constructor(e, t) {
2904
2900
  super(), this._serializers = {
2905
- raw: zt,
2906
- json: Nt,
2907
- binary: Q,
2908
- "binary-utf8": Q,
2909
- default: Q
2910
- }, this._id = null, this._lastServerId = null, this._destroyed = !1, this._disconnected = !1, this._open = !1, this._connections = /* @__PURE__ */ new Map(), this._lostMessages = /* @__PURE__ */ new Map();
2901
+ raw: Ft,
2902
+ json: zt,
2903
+ binary: X,
2904
+ "binary-utf8": X,
2905
+ default: X
2906
+ }, this._id = null, this._lastServerId = null, // States.
2907
+ this._destroyed = !1, this._disconnected = !1, this._open = !1, this._connections = /* @__PURE__ */ new Map(), this._lostMessages = /* @__PURE__ */ new Map();
2911
2908
  let n;
2912
2909
  if (e && e.constructor == Object ? t = e : e && (n = e.toString()), t = {
2913
2910
  debug: 0,
2914
- host: k.CLOUD_HOST,
2915
- port: k.CLOUD_PORT,
2911
+ host: S.CLOUD_HOST,
2912
+ port: S.CLOUD_PORT,
2916
2913
  path: "/",
2917
2914
  key: $.DEFAULT_KEY,
2918
- token: k.randomToken(),
2919
- config: k.defaultConfig,
2915
+ token: S.randomToken(),
2916
+ config: S.defaultConfig,
2920
2917
  referrerPolicy: "strict-origin-when-cross-origin",
2921
2918
  serializers: {},
2922
2919
  ...t
2923
2920
  }, this._options = t, this._serializers = {
2924
2921
  ...this._serializers,
2925
2922
  ...this.options.serializers
2926
- }, this._options.host === "/" && (this._options.host = window.location.hostname), this._options.path && (this._options.path[0] !== "/" && (this._options.path = "/" + this._options.path), this._options.path[this._options.path.length - 1] !== "/" && (this._options.path += "/")), this._options.secure === void 0 && this._options.host !== k.CLOUD_HOST ? this._options.secure = k.isSecure() : this._options.host == k.CLOUD_HOST && (this._options.secure = !0), this._options.logFunction && u.setLogFunction(this._options.logFunction), u.logLevel = this._options.debug || 0, this._api = new Ut(t), this._socket = this._createServerConnection(), !k.supports.audioVideo && !k.supports.data) {
2923
+ }, this._options.host === "/" && (this._options.host = window.location.hostname), this._options.path && (this._options.path[0] !== "/" && (this._options.path = "/" + this._options.path), this._options.path[this._options.path.length - 1] !== "/" && (this._options.path += "/")), this._options.secure === void 0 && this._options.host !== S.CLOUD_HOST ? this._options.secure = S.isSecure() : this._options.host == S.CLOUD_HOST && (this._options.secure = !0), this._options.logFunction && d.setLogFunction(this._options.logFunction), d.logLevel = this._options.debug || 0, this._api = new Ut(t), this._socket = this._createServerConnection(), !S.supports.audioVideo && !S.supports.data) {
2927
2924
  this._delayedAbort(g.BrowserIncompatible, "The current browser does not support WebRTC");
2928
2925
  return;
2929
2926
  }
2930
- if (n && !k.validateId(n)) {
2927
+ if (n && !S.validateId(n)) {
2931
2928
  this._delayedAbort(g.InvalidID, `ID "${n}" is invalid`);
2932
2929
  return;
2933
2930
  }
2934
2931
  n ? this._initialize(n) : this._api.retrieveId().then((i) => this._initialize(i)).catch((i) => this._abort(g.ServerError, i));
2935
2932
  }
2936
2933
  _createServerConnection() {
2937
- const e = new Bt(this._options.secure, this._options.host, this._options.port, this._options.path, this._options.key, this._options.pingInterval);
2938
- return e.on(S.Message, (t) => {
2934
+ const e = new jt(this._options.secure, this._options.host, this._options.port, this._options.path, this._options.key, this._options.pingInterval);
2935
+ return e.on(T.Message, (t) => {
2939
2936
  this._handleMessage(t);
2940
- }), e.on(S.Error, (t) => {
2937
+ }), e.on(T.Error, (t) => {
2941
2938
  this._abort(g.SocketError, t);
2942
- }), e.on(S.Disconnected, () => {
2939
+ }), e.on(T.Disconnected, () => {
2943
2940
  this.disconnected || (this.emitError(g.Network, "Lost connection to server."), this.disconnect());
2944
- }), e.on(S.Close, () => {
2941
+ }), e.on(T.Close, () => {
2945
2942
  this.disconnected || this._abort(g.SocketClosed, "Underlying socket is already closed.");
2946
2943
  }), e;
2947
2944
  }
@@ -2953,35 +2950,35 @@ const $ = class $ extends ct {
2953
2950
  _handleMessage(e) {
2954
2951
  const t = e.type, n = e.payload, i = e.src;
2955
2952
  switch (t) {
2956
- case _.Open:
2953
+ case y.Open:
2957
2954
  this._lastServerId = this.id, this._open = !0, this.emit("open", this.id);
2958
2955
  break;
2959
- case _.Error:
2956
+ case y.Error:
2960
2957
  this._abort(g.ServerError, n.msg);
2961
2958
  break;
2962
- case _.IdTaken:
2959
+ case y.IdTaken:
2963
2960
  this._abort(g.UnavailableID, `ID "${this.id}" is taken`);
2964
2961
  break;
2965
- case _.InvalidKey:
2962
+ case y.InvalidKey:
2966
2963
  this._abort(g.InvalidKey, `API KEY "${this._options.key}" is invalid`);
2967
2964
  break;
2968
- case _.Leave:
2969
- u.log(`Received leave message from ${i}`), this._cleanupPeer(i), this._connections.delete(i);
2965
+ case y.Leave:
2966
+ d.log(`Received leave message from ${i}`), this._cleanupPeer(i), this._connections.delete(i);
2970
2967
  break;
2971
- case _.Expire:
2968
+ case y.Expire:
2972
2969
  this.emitError(g.PeerUnavailable, `Could not connect to peer ${i}`);
2973
2970
  break;
2974
- case _.Offer: {
2971
+ case y.Offer: {
2975
2972
  const s = n.connectionId;
2976
2973
  let o = this.getConnection(i, s);
2977
- if (o && (o.close(), u.warn(`Offer received for existing Connection ID:${s}`)), n.type === T.Media) {
2978
- const c = new Y(i, this, {
2974
+ if (o && (o.close(), d.warn(`Offer received for existing Connection ID:${s}`)), n.type === k.Media) {
2975
+ const c = new G(i, this, {
2979
2976
  connectionId: s,
2980
2977
  _payload: n,
2981
2978
  metadata: n.metadata
2982
2979
  });
2983
2980
  o = c, this._addConnection(i, o), this.emit("call", c);
2984
- } else if (n.type === T.Data) {
2981
+ } else if (n.type === k.Data) {
2985
2982
  const c = new this._serializers[n.serialization](i, this, {
2986
2983
  connectionId: s,
2987
2984
  _payload: n,
@@ -2992,7 +2989,7 @@ const $ = class $ extends ct {
2992
2989
  });
2993
2990
  o = c, this._addConnection(i, o), this.emit("connection", c);
2994
2991
  } else {
2995
- u.warn(`Received malformed connection type:${n.type}`);
2992
+ d.warn(`Received malformed connection type:${n.type}`);
2996
2993
  return;
2997
2994
  }
2998
2995
  const a = this._getMessages(s);
@@ -3001,11 +2998,11 @@ const $ = class $ extends ct {
3001
2998
  }
3002
2999
  default: {
3003
3000
  if (!n) {
3004
- u.warn(`You received a malformed message from ${i} of type ${t}`);
3001
+ d.warn(`You received a malformed message from ${i} of type ${t}`);
3005
3002
  return;
3006
3003
  }
3007
3004
  const s = n.connectionId, o = this.getConnection(i, s);
3008
- o && o.peerConnection ? o.handleMessage(e) : s ? this._storeMessage(s, e) : u.warn("You received an unrecognized message:", e);
3005
+ o && o.peerConnection ? o.handleMessage(e) : s ? this._storeMessage(s, e) : d.warn("You received an unrecognized message:", e);
3009
3006
  break;
3010
3007
  }
3011
3008
  }
@@ -3033,7 +3030,7 @@ const $ = class $ extends ct {
3033
3030
  serialization: "default",
3034
3031
  ...t
3035
3032
  }, this.disconnected) {
3036
- u.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available."), this.emitError(g.Disconnected, "Cannot connect to new Peer after disconnecting from server.");
3033
+ d.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available."), this.emitError(g.Disconnected, "Cannot connect to new Peer after disconnecting from server.");
3037
3034
  return;
3038
3035
  }
3039
3036
  const n = new this._serializers[t.serialization](e, this, t);
@@ -3047,14 +3044,14 @@ const $ = class $ extends ct {
3047
3044
  */
3048
3045
  call(e, t, n = {}) {
3049
3046
  if (this.disconnected) {
3050
- u.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect."), this.emitError(g.Disconnected, "Cannot connect to new Peer after disconnecting from server.");
3047
+ d.warn("You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect."), this.emitError(g.Disconnected, "Cannot connect to new Peer after disconnecting from server.");
3051
3048
  return;
3052
3049
  }
3053
3050
  if (!t) {
3054
- u.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");
3051
+ d.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");
3055
3052
  return;
3056
3053
  }
3057
- const i = new Y(e, this, {
3054
+ const i = new G(e, this, {
3058
3055
  ...n,
3059
3056
  _stream: t
3060
3057
  });
@@ -3062,7 +3059,7 @@ const $ = class $ extends ct {
3062
3059
  }
3063
3060
  /** Add a data/media connection to this peer. */
3064
3061
  _addConnection(e, t) {
3065
- u.log(`add connection ${t.type}:${t.connectionId} to peerId:${e}`), this._connections.has(e) || this._connections.set(e, []), this._connections.get(e).push(t);
3062
+ d.log(`add connection ${t.type}:${t.connectionId} to peerId:${e}`), this._connections.has(e) || this._connections.set(e, []), this._connections.get(e).push(t);
3066
3063
  }
3067
3064
  //TODO should be private
3068
3065
  _removeConnection(e) {
@@ -3092,7 +3089,7 @@ const $ = class $ extends ct {
3092
3089
  * it retains its disconnected state and its existing connections.
3093
3090
  */
3094
3091
  _abort(e, t) {
3095
- u.error("Aborting!"), this.emitError(e, t), this._lastServerId ? this.disconnect() : this.destroy();
3092
+ d.error("Aborting!"), this.emitError(e, t), this._lastServerId ? this.disconnect() : this.destroy();
3096
3093
  }
3097
3094
  /**
3098
3095
  * Destroys the Peer: closes all active connections as well as the connection
@@ -3105,7 +3102,7 @@ const $ = class $ extends ct {
3105
3102
  * :::
3106
3103
  */
3107
3104
  destroy() {
3108
- this.destroyed || (u.log(`Destroy peer with ID:${this.id}`), this.disconnect(), this._cleanup(), this._destroyed = !0, this.emit("close"));
3105
+ this.destroyed || (d.log(`Destroy peer with ID:${this.id}`), this.disconnect(), this._cleanup(), this._destroyed = !0, this.emit("close"));
3109
3106
  }
3110
3107
  /** Disconnects every connection on this peer. */
3111
3108
  _cleanup() {
@@ -3128,7 +3125,7 @@ const $ = class $ extends ct {
3128
3125
  disconnect() {
3129
3126
  if (this.disconnected) return;
3130
3127
  const e = this.id;
3131
- u.log(`Disconnect peer with ID:${e}`), this._disconnected = !0, this._open = !1, this.socket.close(), this._lastServerId = e, this._id = null, this.emit("disconnected", e);
3128
+ d.log(`Disconnect peer with ID:${e}`), this._disconnected = !0, this._open = !1, this.socket.close(), this._lastServerId = e, this._id = null, this.emit("disconnected", e);
3132
3129
  }
3133
3130
  /** Attempts to reconnect with the same ID.
3134
3131
  *
@@ -3139,11 +3136,11 @@ const $ = class $ extends ct {
3139
3136
  */
3140
3137
  reconnect() {
3141
3138
  if (this.disconnected && !this.destroyed)
3142
- u.log(`Attempting reconnection to server with ID ${this._lastServerId}`), this._disconnected = !1, this._initialize(this._lastServerId);
3139
+ d.log(`Attempting reconnection to server with ID ${this._lastServerId}`), this._disconnected = !1, this._initialize(this._lastServerId);
3143
3140
  else {
3144
3141
  if (this.destroyed) throw new Error("This peer cannot reconnect to the server. It has already been destroyed.");
3145
3142
  if (!this.disconnected && !this.open)
3146
- u.error("In a hurry? We're still trying to make the initial connection!");
3143
+ d.error("In a hurry? We're still trying to make the initial connection!");
3147
3144
  else throw new Error(`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`);
3148
3145
  }
3149
3146
  }
@@ -3158,17 +3155,17 @@ const $ = class $ extends ct {
3158
3155
  this._api.listAllPeers().then((t) => e(t)).catch((t) => this._abort(g.ServerError, t));
3159
3156
  }
3160
3157
  };
3161
- ce = new WeakMap(), M($, ce, $.DEFAULT_KEY = "peerjs");
3162
- let ie = $;
3163
- const Jt = 3, Gt = 1e3, Vt = 1e4, Ht = 20, Yt = 30;
3164
- function F(r) {
3165
- return Math.pow(2, Math.min(r, Jt)) * Gt;
3158
+ ae = new WeakMap(), I($, ae, $.DEFAULT_KEY = "peerjs");
3159
+ let re = $;
3160
+ const Nt = 3, Vt = 1e3, Gt = 1e4, Jt = 20, Yt = 30;
3161
+ function j(r) {
3162
+ return Math.pow(2, Math.min(r, Nt)) * Vt;
3166
3163
  }
3167
- function Se(r) {
3164
+ function ve(r) {
3168
3165
  return typeof r.event == "string";
3169
3166
  }
3170
- class wt {
3171
- constructor(e, t, n, i, s, o, a, c, p) {
3167
+ class Zt {
3168
+ constructor(e, t, n, i, s, o, a, c, f) {
3172
3169
  m(this, "emitter", new dt());
3173
3170
  m(this, "peer");
3174
3171
  m(this, "connections", /* @__PURE__ */ new Map());
@@ -3192,7 +3189,7 @@ class wt {
3192
3189
  m(this, "options");
3193
3190
  m(this, "boundSendAll");
3194
3191
  m(this, "failed", !1);
3195
- this.server = c, this.code = e, this.host = t, this.secure = n, this.key = i || "peerjs", this.port = s || 443, this.ice = o, this.relay = a, this.options = p, this.peer = this.createPeerServer(), this.boundSendAll = this.sendAll.bind(this);
3192
+ this.server = c, this.code = e, this.host = t, this.secure = n, this.key = i || "peerjs", this.port = s || 443, this.ice = o, this.relay = a, this.options = f, this.peer = this.createPeerServer(), this.boundSendAll = this.sendAll.bind(this);
3196
3193
  }
3197
3194
  get quality() {
3198
3195
  return this._quality;
@@ -3225,7 +3222,7 @@ class wt {
3225
3222
  }
3226
3223
  createPeerServer() {
3227
3224
  var t;
3228
- const e = new ie(this.code, {
3225
+ const e = new re(this.code, {
3229
3226
  host: this.host,
3230
3227
  secure: this.secure,
3231
3228
  key: this.key,
@@ -3237,7 +3234,7 @@ class wt {
3237
3234
  iceTransportPolicy: this.relay || (t = this.options) != null && t.forceTURN ? "relay" : void 0
3238
3235
  }
3239
3236
  });
3240
- return e.on("open", () => this.onOpen()), e.on("connection", (n) => this.onConnection(new q(n.peer, this.peer, !1, n))), e.on("error", (n) => this.onError(n)), e.on("close", () => {
3237
+ return e.on("open", () => this.onOpen()), e.on("connection", (n) => this.onConnection(new K(n.peer, this.peer, !1, n))), e.on("error", (n) => this.onError(n)), e.on("close", () => {
3241
3238
  this.update();
3242
3239
  }), e.on("disconnected", () => {
3243
3240
  this.heatbeatTimeout >= 0 && clearTimeout(this.heatbeatTimeout), this.update();
@@ -3259,24 +3256,24 @@ class wt {
3259
3256
  const n = this.connections.get(e);
3260
3257
  this.connections.delete(e), n && n.close(), setTimeout(() => {
3261
3258
  this.peer.destroyed || this.createPeer(e, t);
3262
- }, F(this.connRetryCount++));
3259
+ }, j(this.connRetryCount++));
3263
3260
  }
3264
3261
  /** Initiate a connection to a peer */
3265
3262
  createPeer(e, t) {
3266
- const n = new q(
3263
+ const n = new K(
3267
3264
  e,
3268
3265
  this.peer,
3269
3266
  !0,
3270
3267
  t ? void 0 : this.peer.connect(e, { reliable: !0 })
3271
3268
  ), i = this.connections.get(e);
3272
3269
  i && (console.warn("Connection already existed when creating peer:", e), i.close());
3273
- const s = new mt(n);
3270
+ const s = new lt(n);
3274
3271
  this.connections.set(n.peer, s), s.on("retry", () => {
3275
3272
  this.update();
3276
3273
  }), s.on("connect", () => {
3277
3274
  this.update(), this.setError("none"), this.emit("connect", s.connection);
3278
3275
  }), s.on("data", async (o) => {
3279
- Se(o) && (o.event === "eter:connect" ? this.createPeer(o.code) : this.emit("data", o, s.connection));
3276
+ ve(o) && (o.event === "eter:connect" ? this.createPeer(o.code) : this.emit("data", o, s.connection));
3280
3277
  }), s.on("close", () => {
3281
3278
  this.connections.delete(s.connection.peer), this.update(), this.emit("close", s.connection);
3282
3279
  });
@@ -3284,7 +3281,7 @@ class wt {
3284
3281
  retry() {
3285
3282
  this.heatbeatTimeout >= 0 && clearTimeout(this.heatbeatTimeout), this.heatbeatTimeout = window.setTimeout(() => {
3286
3283
  document.hidden ? this.retry() : (this.heatbeatTimeout = -1, this.reset());
3287
- }, Vt);
3284
+ }, Gt);
3288
3285
  }
3289
3286
  onOpen() {
3290
3287
  var e;
@@ -3294,7 +3291,7 @@ class wt {
3294
3291
  else if (t.type === "KEY") {
3295
3292
  const n = this.connections.get(t.src);
3296
3293
  if (!n || n.connection.connectionType !== "server") {
3297
- const i = new q(t.src, this.peer, !1);
3294
+ const i = new K(t.src, this.peer, !1);
3298
3295
  if (this.onConnection(i), t.payload) {
3299
3296
  const s = t.payload;
3300
3297
  i.setKey(s);
@@ -3311,9 +3308,9 @@ class wt {
3311
3308
  const n = this.connections.get(e.peer);
3312
3309
  n && (n.close(), console.warn("Connection already existed", n));
3313
3310
  }
3314
- const t = new gt(e);
3311
+ const t = new mt(e);
3315
3312
  this.connections.set(e.peer, t), t.on("data", async (n) => {
3316
- Se(n) && (n.event === "eter:connect" ? this.createPeer(n.code) : n.event === "ping" ? t.connection.send({ event: "ping", ok: !0 }) : this.emit("data", n, t.connection));
3313
+ ve(n) && (n.event === "eter:connect" ? this.createPeer(n.code) : n.event === "ping" ? t.connection.send({ event: "ping", ok: !0 }) : this.emit("data", n, t.connection));
3317
3314
  }), t.on("connect", () => {
3318
3315
  this.connRetryCount = 0, this.update(), this.emit("connect", t.connection);
3319
3316
  }), t.on("close", () => {
@@ -3332,12 +3329,12 @@ class wt {
3332
3329
  } catch {
3333
3330
  this.setError("peer-not-found");
3334
3331
  }
3335
- }, F(this.peerRetryCount++));
3332
+ }, j(this.peerRetryCount++));
3336
3333
  break;
3337
3334
  case "unavailable-id":
3338
- this.idRetryCount < Ht ? (clearTimeout(this.retryTimeout), this.retryTimeout = window.setTimeout(() => {
3335
+ this.idRetryCount < Jt ? (clearTimeout(this.retryTimeout), this.retryTimeout = window.setTimeout(() => {
3339
3336
  this.reset();
3340
- }, F(this.idRetryCount++))) : (this.peer.destroy(), this.setError("id-in-use"));
3337
+ }, j(this.idRetryCount++))) : (this.peer.destroy(), this.setError("id-in-use"));
3341
3338
  break;
3342
3339
  case "browser-incompatible":
3343
3340
  this.setError("bad-browser");
@@ -3350,7 +3347,7 @@ class wt {
3350
3347
  default:
3351
3348
  clearTimeout(this.retryTimeout), this.retryTimeout = window.setTimeout(() => {
3352
3349
  this.reset();
3353
- }, F(this.peerRetryCount++));
3350
+ }, j(this.peerRetryCount++));
3354
3351
  }
3355
3352
  this.update();
3356
3353
  }
@@ -3363,5 +3360,5 @@ class wt {
3363
3360
  }
3364
3361
  }
3365
3362
  export {
3366
- wt as default
3363
+ Zt as default
3367
3364
  };