@volcengine/vepusher 2.0.4-rc.1 → 2.0.4-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- var Qs = Object.defineProperty;
2
- var en = (r, e, t) => e in r ? Qs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var m = (r, e, t) => en(r, typeof e != "symbol" ? e + "" : e, t);
4
- function tn(r, e) {
1
+ var rn = Object.defineProperty;
2
+ var sn = (r, e, t) => e in r ? rn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var m = (r, e, t) => sn(r, typeof e != "symbol" ? e + "" : e, t);
4
+ function nn(r, e) {
5
5
  for (var t = 0; t < e.length; t++) {
6
6
  const i = e[t];
7
7
  if (typeof i != "string" && !Array.isArray(i)) {
@@ -20,9 +20,9 @@ function tn(r, e) {
20
20
  function Ge(r) {
21
21
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
22
22
  }
23
- var nt = { exports: {} }, br;
24
- function rn() {
25
- return br || (br = 1, function(r) {
23
+ var nt = { exports: {} }, kr;
24
+ function on() {
25
+ return kr || (kr = 1, function(r) {
26
26
  var e = Object.prototype.hasOwnProperty, t = "~";
27
27
  function i() {
28
28
  }
@@ -127,39 +127,39 @@ function rn() {
127
127
  }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, r.exports = o;
128
128
  }(nt)), nt.exports;
129
129
  }
130
- var sn = rn();
131
- const te = /* @__PURE__ */ Ge(sn);
132
- var S = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Screen = "screen", r.VideoFile = "videoFile", r.Microphone = "microphone", r.AudioFile = "audioFile", r.Image = "image", r.MixAudio = "mixAudio", r.MixVideo = "mixVideo", r.CustomVideo = "customVideo", r.CustomAudio = "customAudio", r))(S || {}), j = /* @__PURE__ */ ((r) => (r.DeviceCaptured = "deviceCaptured", r.DeviceStopCapture = "deviceStopCapture", r.Error = "error", r.Interrupted = "interrupted", r))(j || {}), w = /* @__PURE__ */ ((r) => (r.PushStart = "pushStart", r.PushStop = "pushStop", r.PushError = "pushError", r.RTCConnectStateChanged = "rtcConnectStateChanged", r.CaptureFirstVideoFrame = "capturefirstvideoframe", r.CaptureFirstAudioFrame = "capturefirstaudioframe", r.NotAllowedAutoPlay = "notallowedautoplay", r))(w || {}), Ri = /* @__PURE__ */ ((r) => (r["120p"] = "160x120x15x200", r["180p"] = "320x180x15x350", r["240p"] = "320x240x15x400", r["360p"] = "640x360x15x800", r["480p"] = "640x480x15x900", r["720p-1"] = "1280x720x15x1500", r["720p-2"] = "1280x720x25x1500", r["720p-3"] = "1280x720x30x1500", r["1080p-1"] = "1920x1080x15x2080", r["1080p-2"] = "1920x1080x25x3000", r["1080p-3"] = "1920x1080x30x3150", r))(Ri || {}), Ai = /* @__PURE__ */ ((r) => (r["120p"] = "120x160x15x200", r["180p"] = "180x320x15x350", r["240p"] = "240x320x15x400", r["360p"] = "360x640x15x800", r["480p"] = "480x640x15x900", r["720p-1"] = "720x1280x15x1500", r["720p-2"] = "720x1280x25x1500", r["720p-3"] = "720x1280x30x1500", r["1080p-1"] = "1080x1920x15x2080", r["1080p-2"] = "1080x1920x25x3000", r["1080p-3"] = "1080x1920x30x3150", r))(Ai || {}), wi = /* @__PURE__ */ ((r) => (r.STANDARD = "48000x40", r.HIGH = "48000x128", r))(wi || {}), ie = /* @__PURE__ */ ((r) => (r.VideoStreamChange = "videoStreamChange", r.AudioStreamChange = "audioStreamChange", r))(ie || {}), Oi = /* @__PURE__ */ ((r) => (r[r.init = -1] = "init", r[r.new = 0] = "new", r[r.connecting = 1] = "connecting", r[r.connected = 2] = "connected", r[r.disconnected = 3] = "disconnected", r[r.failed = 4] = "failed", r[r.closed = 5] = "closed", r))(Oi || {}), Nt = /* @__PURE__ */ ((r) => (r.SizeChange = "sizeChange", r))(Nt || {}), gt = /* @__PURE__ */ ((r) => (r.Portrait = "portrait", r.Landscape = "landscape", r))(gt || {});
133
- const Ii = "720p-1", Di = "STANDARD";
134
- var y = /* @__PURE__ */ ((r) => (r.TRACK_NOT_AVAILABLE = "track-not-available", r.UNEXPECTED_TYPE = "unexpected-type", r.PLAY_FAILED = "play-failed", r.CAPTURE_FAILED = "capture-failed", r.NOT_SUPPORTED = "not-supported", r.UNEXPECTED_ERROR = "unexpected-error", r))(y || {}), E = /* @__PURE__ */ ((r) => (r.AUDIO = "audio", r.VIDEO = "video", r))(E || {}), I = /* @__PURE__ */ ((r) => (r.ENDED = "ended", r.MUTE = "mute", r.UNMUTE = "unmute", r.PLAY_FAILED = "play-failed", r.SIZE_CHANGE = "size-change", r))(I || {});
130
+ var an = on();
131
+ const te = /* @__PURE__ */ Ge(an);
132
+ var wi = /* @__PURE__ */ ((r) => (r.LeftToRight = "LeftToRight", r.UpToDown = "UpToDown", r.All = "All", r.None = "None", r))(wi || {}), S = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Screen = "screen", r.VideoFile = "videoFile", r.Microphone = "microphone", r.AudioFile = "audioFile", r.Image = "image", r.MixAudio = "mixAudio", r.MixVideo = "mixVideo", r.CustomVideo = "customVideo", r.CustomAudio = "customAudio", r))(S || {}), j = /* @__PURE__ */ ((r) => (r.DeviceCaptured = "deviceCaptured", r.DeviceStopCapture = "deviceStopCapture", r.Error = "error", r.Interrupted = "interrupted", r))(j || {}), w = /* @__PURE__ */ ((r) => (r.PushStart = "pushStart", r.PushStop = "pushStop", r.PushError = "pushError", r.RTCConnectStateChanged = "rtcConnectStateChanged", r.CaptureFirstVideoFrame = "capturefirstvideoframe", r.CaptureFirstAudioFrame = "capturefirstaudioframe", r.NotAllowedAutoPlay = "notallowedautoplay", r))(w || {}), Oi = /* @__PURE__ */ ((r) => (r["120p"] = "160x120x15x200", r["180p"] = "320x180x15x350", r["240p"] = "320x240x15x400", r["360p"] = "640x360x15x800", r["480p"] = "640x480x15x900", r["720p-1"] = "1280x720x15x1500", r["720p-2"] = "1280x720x25x1500", r["720p-3"] = "1280x720x30x1500", r["1080p-1"] = "1920x1080x15x2080", r["1080p-2"] = "1920x1080x25x3000", r["1080p-3"] = "1920x1080x30x3150", r))(Oi || {}), Di = /* @__PURE__ */ ((r) => (r["120p"] = "120x160x15x200", r["180p"] = "180x320x15x350", r["240p"] = "240x320x15x400", r["360p"] = "360x640x15x800", r["480p"] = "480x640x15x900", r["720p-1"] = "720x1280x15x1500", r["720p-2"] = "720x1280x25x1500", r["720p-3"] = "720x1280x30x1500", r["1080p-1"] = "1080x1920x15x2080", r["1080p-2"] = "1080x1920x25x3000", r["1080p-3"] = "1080x1920x30x3150", r))(Di || {}), Ii = /* @__PURE__ */ ((r) => (r.STANDARD = "48000x40", r.HIGH = "48000x128", r))(Ii || {}), ie = /* @__PURE__ */ ((r) => (r.VideoStreamChange = "videoStreamChange", r.AudioStreamChange = "audioStreamChange", r))(ie || {}), Mi = /* @__PURE__ */ ((r) => (r[r.init = -1] = "init", r[r.new = 0] = "new", r[r.connecting = 1] = "connecting", r[r.connected = 2] = "connected", r[r.disconnected = 3] = "disconnected", r[r.failed = 4] = "failed", r[r.closed = 5] = "closed", r))(Mi || {}), Vt = /* @__PURE__ */ ((r) => (r.SizeChange = "sizeChange", r))(Vt || {}), vt = /* @__PURE__ */ ((r) => (r.Portrait = "portrait", r.Landscape = "landscape", r))(vt || {});
133
+ const Li = "720p-1", Fi = "STANDARD";
134
+ var y = /* @__PURE__ */ ((r) => (r.TRACK_NOT_AVAILABLE = "track-not-available", r.UNEXPECTED_TYPE = "unexpected-type", r.PLAY_FAILED = "play-failed", r.CAPTURE_FAILED = "capture-failed", r.NOT_SUPPORTED = "not-supported", r.UNEXPECTED_ERROR = "unexpected-error", r))(y || {}), E = /* @__PURE__ */ ((r) => (r.AUDIO = "audio", r.VIDEO = "video", r))(E || {}), D = /* @__PURE__ */ ((r) => (r.ENDED = "ended", r.MUTE = "mute", r.UNMUTE = "unmute", r.PLAY_FAILED = "play-failed", r.SIZE_CHANGE = "size-change", r))(D || {});
135
135
  const O = [];
136
136
  for (let r = 0; r < 256; ++r)
137
137
  O.push((r + 256).toString(16).slice(1));
138
- function nn(r, e = 0) {
138
+ function cn(r, e = 0) {
139
139
  return (O[r[e + 0]] + O[r[e + 1]] + O[r[e + 2]] + O[r[e + 3]] + "-" + O[r[e + 4]] + O[r[e + 5]] + "-" + O[r[e + 6]] + O[r[e + 7]] + "-" + O[r[e + 8]] + O[r[e + 9]] + "-" + O[r[e + 10]] + O[r[e + 11]] + O[r[e + 12]] + O[r[e + 13]] + O[r[e + 14]] + O[r[e + 15]]).toLowerCase();
140
140
  }
141
141
  let ot;
142
- const on = new Uint8Array(16);
143
- function an() {
142
+ const dn = new Uint8Array(16);
143
+ function un() {
144
144
  if (!ot) {
145
145
  if (typeof crypto > "u" || !crypto.getRandomValues)
146
146
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
147
147
  ot = crypto.getRandomValues.bind(crypto);
148
148
  }
149
- return ot(on);
149
+ return ot(dn);
150
150
  }
151
- const cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kr = { randomUUID: cn };
151
+ const hn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Pr = { randomUUID: hn };
152
152
  function oe(r, e, t) {
153
153
  var s;
154
- if (kr.randomUUID && !r)
155
- return kr.randomUUID();
154
+ if (Pr.randomUUID && !r)
155
+ return Pr.randomUUID();
156
156
  r = r || {};
157
- const i = r.random ?? ((s = r.rng) == null ? void 0 : s.call(r)) ?? an();
157
+ const i = r.random ?? ((s = r.rng) == null ? void 0 : s.call(r)) ?? un();
158
158
  if (i.length < 16)
159
159
  throw new Error("Random bytes length must be >= 16");
160
- return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, nn(i);
160
+ return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, cn(i);
161
161
  }
162
- class Mi {
162
+ class Ni {
163
163
  constructor() {
164
164
  m(this, "id", oe());
165
165
  m(this, "_nextNode");
@@ -170,9 +170,9 @@ class Mi {
170
170
  // SourceNode -> GainNode -> DynamicPressureNode ...
171
171
  // 因此 每次调用 node 生成方法时判断 nextNode 是否类型匹配,如果匹配则复用
172
172
  gain(e) {
173
- if (this._nextNode instanceof Pr)
173
+ if (this._nextNode instanceof xr)
174
174
  return this._nextNode.g = e, this._nextNode;
175
- const t = new Pr(this, { g: e });
175
+ const t = new xr(this, { g: e });
176
176
  return this._nextNode = t, t;
177
177
  }
178
178
  connect(e, t) {
@@ -190,7 +190,7 @@ class Mi {
190
190
  (e = this._node) == null || e.disconnect(), delete this._node;
191
191
  }
192
192
  }
193
- class Pr extends Mi {
193
+ class xr extends Ni {
194
194
  constructor(t, i) {
195
195
  super();
196
196
  m(this, "previousNode");
@@ -207,7 +207,7 @@ class Pr extends Mi {
207
207
  this._g = t, this._node && (this._node.gain.value = t);
208
208
  }
209
209
  }
210
- class dn extends Mi {
210
+ class pn extends Ni {
211
211
  constructor(t) {
212
212
  super();
213
213
  m(this, "previousNode", null);
@@ -221,7 +221,7 @@ class dn extends Mi {
221
221
  super.destroy();
222
222
  }
223
223
  }
224
- class un extends dn {
224
+ class ln extends pn {
225
225
  constructor() {
226
226
  super(...arguments);
227
227
  m(this, "_node");
@@ -230,7 +230,7 @@ class un extends dn {
230
230
  if (this._node)
231
231
  return this._node;
232
232
  let i;
233
- if (this.source instanceof Bi) {
233
+ if (this.source instanceof Gi) {
234
234
  const s = this.source.element();
235
235
  i = new MediaElementAudioSourceNode(t, {
236
236
  mediaElement: s
@@ -257,17 +257,17 @@ class C extends Error {
257
257
  return `VeCapture Error: ${this.code} ${this.message}`;
258
258
  }
259
259
  }
260
- const xr = {
260
+ const Rr = {
261
261
  info: { color: "rgba(93, 173, 226, 0)", text: "INFO" },
262
262
  warn: { color: "rgba(255, 119, 0, 0.3)", text: "WARN" },
263
263
  err: { color: "rgba(255, 0, 0, 0.3)", text: "ERR " },
264
264
  succ: { color: "rgba(0, 119, 0, 0.3)", text: "SUCC" }
265
- }, Rr = "__debug__", hn = "[VE-CAPTURE]";
266
- function pn() {
265
+ }, Ar = "__debug__", mn = "[VE-CAPTURE]";
266
+ function fn() {
267
267
  if (typeof location > "u" || typeof localStorage > "u")
268
268
  return !1;
269
269
  let r = !1;
270
- return location.href.includes(Rr) && (r = !0), localStorage.getItem(Rr) && (r = !0), r;
270
+ return location.href.includes(Ar) && (r = !0), localStorage.getItem(Ar) && (r = !0), r;
271
271
  }
272
272
  let L = class {
273
273
  constructor(e) {
@@ -275,10 +275,10 @@ let L = class {
275
275
  this.moduleName = e;
276
276
  }
277
277
  print(e, t, ...i) {
278
- const s = ln();
279
- pn() && console.log(
280
- `${s}-${hn}%c[${xr[e].text}]%c[${this.moduleName}][${t}]`,
281
- `background-color:${xr[e].color};`,
278
+ const s = _n();
279
+ fn() && console.log(
280
+ `${s}-${mn}%c[${Rr[e].text}]%c[${this.moduleName}][${t}]`,
281
+ `background-color:${Rr[e].color};`,
282
282
  "background-color:rgba(0, 0, 0, 0)",
283
283
  ...i
284
284
  );
@@ -310,11 +310,11 @@ let L = class {
310
310
  };
311
311
  }
312
312
  };
313
- function ln() {
313
+ function _n() {
314
314
  const r = /* @__PURE__ */ new Date();
315
315
  return `${r.toTimeString().split(" ")[0]}:${r.getMilliseconds().toString().padStart(3, "0")}`;
316
316
  }
317
- function vt(r, e) {
317
+ function Ct(r, e) {
318
318
  const t = document.createElement(r);
319
319
  return e.id && (t.id = e.id), e.classList && e.classList.forEach((i) => {
320
320
  t.classList.add(i);
@@ -322,7 +322,7 @@ function vt(r, e) {
322
322
  i === "muted" && (t instanceof HTMLVideoElement || t instanceof HTMLAudioElement) ? t.muted = !0 : t.setAttribute(i, s);
323
323
  }), t;
324
324
  }
325
- function Li({ width: r, height: e }) {
325
+ function Vi({ width: r, height: e }) {
326
326
  const t = document.createElement("canvas"), i = t.getContext("2d");
327
327
  if (!i)
328
328
  throw new C(
@@ -331,7 +331,7 @@ function Li({ width: r, height: e }) {
331
331
  );
332
332
  return t.width = r, t.height = e, t.style.width = "100%", t.style.height = "100%", { context: i, canvas: t };
333
333
  }
334
- class Vt {
334
+ class Ut {
335
335
  constructor(e) {
336
336
  m(this, "target");
337
337
  m(this, "_eventDict", /* @__PURE__ */ new Map());
@@ -366,12 +366,12 @@ const x = () => typeof window > "u";
366
366
  function P() {
367
367
  return navigator.userAgent.toLowerCase();
368
368
  }
369
- function Ut(r = P()) {
369
+ function $t(r = P()) {
370
370
  let e = "none";
371
371
  return x() || (r.match("firefox") !== null ? e = "firefox" : r.match("Chrome") !== null ? (e = "chrome", r.match("Electron") !== null && (e = "electron")) : (r.match("Safari") !== null || r.match("AppleWebKit") !== null) && (e = "safari")), e;
372
372
  }
373
- const Fi = Ut() === "firefox", He = Ut() === "safari";
374
- Ut();
373
+ const Ui = $t() === "firefox", He = $t() === "safari";
374
+ $t();
375
375
  !x() && /crios/i.test(P());
376
376
  !x() && /edg\//i.test(P());
377
377
  !x() && /edgA/i.test(P());
@@ -384,67 +384,67 @@ Ut();
384
384
  !x() && /micromessenger/i.test(P());
385
385
  !x() && P().includes("mobile");
386
386
  !x() && /sm-\w+/i.test(P());
387
- const mn = !x() && !!/(iphone|ipad|ipod)/i.exec(P());
387
+ const gn = !x() && !!/(iphone|ipad|ipod)/i.exec(P());
388
388
  !x() && /android/i.test(P());
389
389
  !x() && /windows/i.test(P());
390
390
  !x() && /openharmony/i.test(P());
391
- let Ni = "0";
392
- var Ti;
393
- const fn = !x() && ((Ti = P().match(/version\/(\d+)/i)) == null ? void 0 : Ti[1]);
394
- var Ei;
395
- He && fn && (Ni = (Ei = navigator.userAgent.match(/version\/(\d+\.\d+)/i)) == null ? void 0 : Ei[1]);
391
+ let $i = "0";
396
392
  var bi;
397
- !x() && ((bi = P().match(/firefox\/(\d+)/i)) == null || bi[1]);
398
- const Ct = Ni;
399
- var ki, Pi;
400
- !x() && ((Pi = (ki = P().match(/ ([\d_]+) like mac os x/i)) == null ? void 0 : ki[1]) == null || Pi.split("_").map((r) => parseInt(r)));
401
- var xi;
402
- !x() && ((xi = P().match(/chrome\/(\d+)/i)) == null || xi[1]);
403
- function _n() {
393
+ const vn = !x() && ((bi = P().match(/version\/(\d+)/i)) == null ? void 0 : bi[1]);
394
+ var ki;
395
+ He && vn && ($i = (ki = navigator.userAgent.match(/version\/(\d+\.\d+)/i)) == null ? void 0 : ki[1]);
396
+ var Pi;
397
+ !x() && ((Pi = P().match(/firefox\/(\d+)/i)) == null || Pi[1]);
398
+ const yt = $i;
399
+ var xi, Ri;
400
+ !x() && ((Ri = (xi = P().match(/ ([\d_]+) like mac os x/i)) == null ? void 0 : xi[1]) == null || Ri.split("_").map((r) => parseInt(r)));
401
+ var Ai;
402
+ !x() && ((Ai = P().match(/chrome\/(\d+)/i)) == null || Ai[1]);
403
+ function Cn() {
404
404
  var r;
405
405
  return !!((r = navigator == null ? void 0 : navigator.permissions) != null && r.query);
406
406
  }
407
- function $t() {
407
+ function Bt() {
408
408
  return !!(navigator != null && navigator.mediaDevices);
409
409
  }
410
- function gn() {
410
+ function yn() {
411
411
  var r;
412
- return $t() && !!((r = navigator == null ? void 0 : navigator.mediaDevices) != null && r.getUserMedia);
412
+ return Bt() && !!((r = navigator == null ? void 0 : navigator.mediaDevices) != null && r.getUserMedia);
413
413
  }
414
- function vn() {
414
+ function Sn() {
415
415
  return !!Promise.withResolvers;
416
416
  }
417
- function Cn() {
418
- return !(He && Ct === "16.1");
417
+ function Tn() {
418
+ return !(He && yt === "16.1");
419
419
  }
420
- function yn() {
421
- return !(He && Ct && ["16.1", "16.2", "16.3"].includes(Ct));
420
+ function En() {
421
+ return !(He && yt && ["16.1", "16.2", "16.3"].includes(yt));
422
422
  }
423
- function Sn() {
424
- return !Fi;
423
+ function bn() {
424
+ return !Ui;
425
425
  }
426
- function Tn() {
426
+ function kn() {
427
427
  return typeof CanvasCaptureMediaStreamTrack < "u";
428
428
  }
429
- function En(r) {
429
+ function Pn(r) {
430
430
  return typeof r.requestFrame == "function";
431
431
  }
432
- function bn() {
433
- return !!$t() && typeof navigator.mediaDevices.ondevicechange < "u" && typeof navigator.mediaDevices.addEventListener == "function";
432
+ function xn() {
433
+ return !!Bt() && typeof navigator.mediaDevices.ondevicechange < "u" && typeof navigator.mediaDevices.addEventListener == "function";
434
434
  }
435
435
  const G = {
436
- permissionQuery: _n,
437
- mediaDevices: $t,
438
- settingResolutionInGetDisplayMedia: Cn,
439
- promiseWithResolvers: vn,
440
- getUserMedia: gn,
441
- isolateEnumerateDevices: Sn,
442
- supportIdealParamsInGetDisplayMedia: yn,
443
- canvasCaptureMediaStreamTrack: Tn,
444
- requestFrameOnMediaStream: En,
445
- ondevicechange: bn
436
+ permissionQuery: Cn,
437
+ mediaDevices: Bt,
438
+ settingResolutionInGetDisplayMedia: Tn,
439
+ promiseWithResolvers: Sn,
440
+ getUserMedia: yn,
441
+ isolateEnumerateDevices: bn,
442
+ supportIdealParamsInGetDisplayMedia: En,
443
+ canvasCaptureMediaStreamTrack: kn,
444
+ requestFrameOnMediaStream: Pn,
445
+ ondevicechange: xn
446
446
  };
447
- function kn() {
447
+ function Rn() {
448
448
  if (G.promiseWithResolvers())
449
449
  return Promise.withResolvers();
450
450
  let r, e;
@@ -455,12 +455,12 @@ function kn() {
455
455
  throw Error("resolver and rejector working unexpected");
456
456
  return { promise: t, resolve: r, reject: e };
457
457
  }
458
- function Vi(r = {}) {
458
+ function Bi(r = {}) {
459
459
  const { timeout: e, message: t } = {
460
460
  timeout: 0,
461
461
  message: new C(y.UNEXPECTED_ERROR, "unexpected timeout"),
462
462
  ...r
463
- }, { promise: i, resolve: s, reject: n } = kn();
463
+ }, { promise: i, resolve: s, reject: n } = Rn();
464
464
  if (e <= 0)
465
465
  return { promise: i, resolve: s, reject: n };
466
466
  const a = setTimeout(() => {
@@ -474,7 +474,7 @@ function Vi(r = {}) {
474
474
  reject: n
475
475
  };
476
476
  }
477
- const Pn = {
477
+ const An = {
478
478
  playsinline: "",
479
479
  "webkit-playsinline": "",
480
480
  "x5-playsinline": "",
@@ -483,7 +483,7 @@ const Pn = {
483
483
  preload: "metadata",
484
484
  muted: "",
485
485
  crossOrigin: "anonymous"
486
- }, xn = {
486
+ }, wn = {
487
487
  playsinline: "",
488
488
  "webkit-playsinline": "",
489
489
  preload: "metadata",
@@ -503,19 +503,19 @@ class be {
503
503
  let i;
504
504
  if (e instanceof MediaStreamTrack) {
505
505
  const o = new MediaStream([e]);
506
- i = Rn(o), this._stream = o;
506
+ i = On(o), this._stream = o;
507
507
  } else if (e.url)
508
- i = An(e);
508
+ i = Dn(e);
509
509
  else
510
510
  throw new C(
511
511
  y.UNEXPECTED_TYPE,
512
512
  `got ${typeof e}, expected: MediaStreamTrack or constraints for creating element`
513
513
  );
514
- const { promise: s, resolve: n, reject: a } = Vi({
514
+ const { promise: s, resolve: n, reject: a } = Bi({
515
515
  timeout: 2e3,
516
516
  message: new C(y.PLAY_FAILED, "load media timeout")
517
517
  });
518
- this._readyLock = s, this._releaseReadyLock = n, this._throwReadyLock = a, this._element = new Vt(i), this._bindPlayerEvent(this._element), this._referenceTracks = [...t];
518
+ this._readyLock = s, this._releaseReadyLock = n, this._throwReadyLock = a, this._element = new Ut(i), this._bindPlayerEvent(this._element), this._referenceTracks = [...t];
519
519
  }
520
520
  addReferenceTrack(e) {
521
521
  this._referenceTracks.push(e);
@@ -609,40 +609,40 @@ class be {
609
609
  });
610
610
  }
611
611
  }
612
- function Rn(r) {
612
+ function On(r) {
613
613
  let e = "audio";
614
614
  r.getVideoTracks().length > 0 && (e = "video");
615
- const t = Ui(
615
+ const t = ji(
616
616
  e === "video" ? E.VIDEO : E.AUDIO
617
617
  );
618
618
  return t.srcObject = r, t;
619
619
  }
620
- function An(r) {
621
- const { url: e, kind: t, loop: i } = r, s = Ui(t);
620
+ function Dn(r) {
621
+ const { url: e, kind: t, loop: i } = r, s = ji(t);
622
622
  return s.src = e, s.loop = i, s;
623
623
  }
624
- function Ui(r) {
624
+ function ji(r) {
625
625
  if (r === E.VIDEO)
626
- return vt(E.VIDEO, {
626
+ return Ct(E.VIDEO, {
627
627
  style: {
628
628
  width: "100%",
629
629
  height: "100%"
630
630
  },
631
- attributes: Pn
631
+ attributes: An
632
632
  });
633
633
  if (r === E.AUDIO)
634
- return vt(E.AUDIO, {
634
+ return Ct(E.AUDIO, {
635
635
  style: {
636
636
  display: "none"
637
637
  },
638
- attributes: xn
638
+ attributes: wn
639
639
  });
640
640
  throw new C(
641
641
  y.UNEXPECTED_TYPE,
642
642
  `got ${r}, expected: audio, video`
643
643
  );
644
644
  }
645
- class Bt extends te {
645
+ class jt extends te {
646
646
  emit(e, ...t) {
647
647
  const i = this.listenerCount(e);
648
648
  return Promise.resolve().then(() => {
@@ -689,8 +689,8 @@ function at(r) {
689
689
  return r.min;
690
690
  throw new C(y.UNEXPECTED_TYPE, "unexpected constraints type");
691
691
  }
692
- const yt = 1e3;
693
- class $i {
692
+ const St = 1e3;
693
+ class zi {
694
694
  constructor(e) {
695
695
  m(this, "id", oe());
696
696
  m(this, "_context");
@@ -705,11 +705,11 @@ class $i {
705
705
  m(this, "_stream");
706
706
  const t = at(e.width), i = at(e.height), s = at(e.frameRate);
707
707
  this._config = { width: t, height: i, frameRate: s };
708
- const { context: n, canvas: a } = Li({ width: t, height: i });
708
+ const { context: n, canvas: a } = Vi({ width: t, height: i });
709
709
  this._context = n, this._canvas = a;
710
- const o = wn({ url: e.url, width: t, height: i });
711
- this._image = new Vt(o);
712
- const { promise: u, resolve: d, reject: c } = Vi({
710
+ const o = In({ url: e.url, width: t, height: i });
711
+ this._image = new Ut(o);
712
+ const { promise: u, resolve: d, reject: c } = Bi({
713
713
  timeout: 2e3,
714
714
  message: new C(y.PLAY_FAILED, "load image timeout")
715
715
  });
@@ -750,7 +750,7 @@ class $i {
750
750
  const { width: e, height: t, frameRate: i } = this._config;
751
751
  this._context.drawImage(this._image.target, 0, 0, e, t), this._loopTimer && clearTimeout(this._loopTimer), this._loopTimer = setTimeout(
752
752
  this._paint.bind(this),
753
- yt / i
753
+ St / i
754
754
  );
755
755
  }
756
756
  addReferenceTrack(e) {
@@ -762,12 +762,12 @@ class $i {
762
762
  }
763
763
  // destroy() {}
764
764
  }
765
- function wn({
765
+ function In({
766
766
  url: r,
767
767
  height: e,
768
768
  width: t
769
769
  }) {
770
- const i = vt("img", {
770
+ const i = Ct("img", {
771
771
  style: {
772
772
  width: `${t}px`,
773
773
  height: `${e}px`
@@ -778,26 +778,26 @@ function wn({
778
778
  });
779
779
  return i.src = r, i;
780
780
  }
781
- class jt extends Bt {
781
+ class zt extends jt {
782
782
  constructor(t) {
783
783
  super();
784
784
  m(this, "id", oe());
785
785
  m(this, "_track");
786
786
  m(this, "_element");
787
- t instanceof MediaStreamTrack ? (this._track = new Vt(t), this._bindTrackEvent(this._track)) : t instanceof be ? (this._element = t, t.addReferenceTrack(this)) : t instanceof $i && (this._element = t);
787
+ t instanceof MediaStreamTrack ? (this._track = new Ut(t), this._bindTrackEvent(this._track)) : t instanceof be ? (this._element = t, t.addReferenceTrack(this)) : t instanceof zi && (this._element = t);
788
788
  }
789
789
  _bindTrackEvent(t) {
790
790
  t.on("ended", this._handleTrackEnded.bind(this)), t.on("mute", () => {
791
- this.emit(I.MUTE);
791
+ this.emit(D.MUTE);
792
792
  }), t.on("unmute", () => {
793
- this.emit(I.UNMUTE);
793
+ this.emit(D.UNMUTE);
794
794
  });
795
795
  }
796
796
  _handleTrackEnded() {
797
- this.emit(I.ENDED), this.destroy();
797
+ this.emit(D.ENDED), this.destroy();
798
798
  }
799
799
  handlePlayFailed() {
800
- this.emit(I.PLAY_FAILED);
800
+ this.emit(D.PLAY_FAILED);
801
801
  }
802
802
  track() {
803
803
  if (this.logger.info("track"), !this.available())
@@ -841,7 +841,7 @@ class jt extends Bt {
841
841
  (t = this._track) == null || t.clearAll(), (i = this._track) == null || i.target.stop(), this._track && delete this._track, (s = this._element) == null || s.removeReference(this), delete this._element;
842
842
  }
843
843
  }
844
- class qe extends jt {
844
+ class qe extends zt {
845
845
  constructor() {
846
846
  super(...arguments);
847
847
  m(this, "kind", E.AUDIO);
@@ -855,7 +855,7 @@ class qe extends jt {
855
855
  );
856
856
  if (this._node)
857
857
  return this._node;
858
- const t = new un(this);
858
+ const t = new ln(this);
859
859
  return this._node = t, t;
860
860
  }
861
861
  /** overwrite in AudioTrack */
@@ -890,25 +890,25 @@ class qe extends jt {
890
890
  this.logger.warn("destroy", this.id), (t = this._node) == null || t.destroy(), super.destroy();
891
891
  }
892
892
  }
893
- class On extends qe {
893
+ class Mn extends qe {
894
894
  constructor() {
895
895
  super(...arguments);
896
896
  m(this, "logger", new L("MicrophoneAudioTrack"));
897
897
  }
898
898
  }
899
- class In extends qe {
899
+ class Ln extends qe {
900
900
  constructor() {
901
901
  super(...arguments);
902
902
  m(this, "logger", new L("ScreenAudioTrack"));
903
903
  }
904
904
  }
905
- class Bi extends qe {
905
+ class Gi extends qe {
906
906
  constructor() {
907
907
  super(...arguments);
908
908
  m(this, "logger", new L("MediaAudioTrack"));
909
909
  }
910
910
  handlePlayFailed() {
911
- this.emit(I.PLAY_FAILED);
911
+ this.emit(D.PLAY_FAILED);
912
912
  }
913
913
  async play() {
914
914
  if (this._element) {
@@ -921,22 +921,22 @@ class Bi extends qe {
921
921
  }
922
922
  }
923
923
  }
924
- class Dn extends qe {
924
+ class Fn extends qe {
925
925
  constructor() {
926
926
  super(...arguments);
927
927
  m(this, "logger", new L("CustomAudioTrack"));
928
928
  }
929
929
  }
930
- let Mn = 1;
930
+ let Nn = 1;
931
931
  const ct = new L("PromiseQueue");
932
- class Ln {
932
+ class Vn {
933
933
  constructor(e) {
934
934
  m(this, "lockingPromise", Promise.resolve());
935
935
  m(this, "locks", 0);
936
936
  m(this, "name", "");
937
937
  m(this, "lockId");
938
938
  m(this, "closeReason");
939
- this.lockId = Mn++, e && (this.name = e), ct.info(`lock-${this.name}-${this.lockId}`, "is created.");
939
+ this.lockId = Nn++, e && (this.name = e), ct.info(`lock-${this.name}-${this.lockId}`, "is created.");
940
940
  }
941
941
  get isLocked() {
942
942
  return this.locks > 0;
@@ -958,8 +958,8 @@ class Ln {
958
958
  return this.lockingPromise = this.lockingPromise.then(() => t), i;
959
959
  }
960
960
  }
961
- const Fn = 300, Nn = 3e3, B = new L("Devices");
962
- class Vn extends Bt {
961
+ const Un = 300, $n = 3e3, B = new L("Devices");
962
+ class Bn extends jt {
963
963
  constructor() {
964
964
  super();
965
965
  /** 存储 SDK 已知的设备列表 */
@@ -973,7 +973,7 @@ class Vn extends Bt {
973
973
  [E.AUDIO]: !1,
974
974
  [E.VIDEO]: !1
975
975
  });
976
- m(this, "_changedQueue", new Ln("device changed queue"));
976
+ m(this, "_changedQueue", new Vn("device changed queue"));
977
977
  this._init();
978
978
  }
979
979
  async _init() {
@@ -988,13 +988,13 @@ class Vn extends Bt {
988
988
  "no supported, use timer instead"
989
989
  ), setInterval(() => {
990
990
  this._handleDeviceChanged();
991
- }, Nn);
991
+ }, $n);
992
992
  return;
993
993
  }
994
994
  G.ondevicechange() && navigator.mediaDevices.addEventListener("devicechange", () => {
995
995
  B.info("devicechange"), setTimeout(() => {
996
996
  this._handleDeviceChanged();
997
- }, Fn);
997
+ }, Un);
998
998
  });
999
999
  }
1000
1000
  async _initPermissionChanged() {
@@ -1051,7 +1051,7 @@ class Vn extends Bt {
1051
1051
  }), i = await navigator.mediaDevices.getUserMedia(a);
1052
1052
  }
1053
1053
  let s = await navigator.mediaDevices.enumerateDevices();
1054
- i && Ar(i), s = s.filter(({ deviceId: a }) => !!a);
1054
+ i && wr(i), s = s.filter(({ deviceId: a }) => !!a);
1055
1055
  const n = {
1056
1056
  audioinput: [],
1057
1057
  audiooutput: [],
@@ -1084,7 +1084,7 @@ class Vn extends Bt {
1084
1084
  const n = await navigator.mediaDevices.getUserMedia(
1085
1085
  s
1086
1086
  );
1087
- return n ? (s.audio && (this._permissions[E.AUDIO] = !0), s.video && (this._permissions[E.VIDEO] = !0), Ar(n), { grant: !0 }) : {
1087
+ return n ? (s.audio && (this._permissions[E.AUDIO] = !0), s.video && (this._permissions[E.VIDEO] = !0), wr(n), { grant: !0 }) : {
1088
1088
  grant: !1,
1089
1089
  reason: new C(
1090
1090
  y.UNEXPECTED_TYPE,
@@ -1106,7 +1106,7 @@ class Vn extends Bt {
1106
1106
  B.info("_handleDeviceChanged", this._deviceMap, this._permissions);
1107
1107
  const t = await this._changedQueue.lock();
1108
1108
  try {
1109
- const i = Or(this._deviceMap);
1109
+ const i = Dr(this._deviceMap);
1110
1110
  let s = [];
1111
1111
  const n = Ir(
1112
1112
  this._permissions
@@ -1114,16 +1114,16 @@ class Vn extends Bt {
1114
1114
  n.length === 0 ? B.warn(
1115
1115
  "_handleDeviceChanged",
1116
1116
  "no permission, use empty list"
1117
- ) : (await this._refreshDevices(n), s = Or(this._deviceMap)), s.forEach((a) => {
1117
+ ) : (await this._refreshDevices(n), s = Dr(this._deviceMap)), s.forEach((a) => {
1118
1118
  i.findIndex(
1119
- (u) => wr(u, a)
1119
+ (u) => Or(u, a)
1120
1120
  ) !== -1 || this.emit("onDeviceStateChanged", {
1121
1121
  deviceInfo: a,
1122
1122
  deviceState: "active"
1123
1123
  });
1124
1124
  }), i.forEach((a) => {
1125
1125
  s.findIndex(
1126
- (u) => wr(u, a)
1126
+ (u) => Or(u, a)
1127
1127
  ) !== -1 || this.emit("onDeviceStateChanged", {
1128
1128
  deviceInfo: a,
1129
1129
  deviceState: "inactive"
@@ -1159,13 +1159,13 @@ class Vn extends Bt {
1159
1159
  return this._acquireUserPermission(t);
1160
1160
  }
1161
1161
  }
1162
- function Ar(r) {
1162
+ function wr(r) {
1163
1163
  r.getTracks().forEach((e) => e.stop());
1164
1164
  }
1165
- function wr(r, e) {
1165
+ function Or(r, e) {
1166
1166
  return r.deviceId === e.deviceId;
1167
1167
  }
1168
- function Or(r) {
1168
+ function Dr(r) {
1169
1169
  return Array.from([
1170
1170
  ...r.audioinput.values(),
1171
1171
  ...r.videoinput.values(),
@@ -1176,23 +1176,30 @@ function Ir(r) {
1176
1176
  const e = [];
1177
1177
  return r.audio && e.push(E.AUDIO), r.video && e.push(E.VIDEO), e;
1178
1178
  }
1179
- const St = new Vn();
1180
- class zt {
1179
+ const Tt = new Bn(), dt = {
1180
+ LeftToRight: "LeftToRight",
1181
+ UpToDown: "UpToDown",
1182
+ All: "All"
1183
+ };
1184
+ class Gt {
1181
1185
  constructor() {
1182
1186
  m(this, "id", oe());
1183
1187
  }
1184
1188
  position(e, t) {
1185
- return new Un(this, { x: e, y: t });
1189
+ return new jn(this, { x: e, y: t });
1186
1190
  }
1187
1191
  scale(e) {
1188
- return new $n(this, { s: e });
1192
+ return new Mr(this, { s: e });
1193
+ }
1194
+ mirror(e) {
1195
+ return new Mr(this, { mirrorType: e });
1189
1196
  }
1190
1197
  available() {
1191
1198
  var e;
1192
1199
  return ((e = this.previousNode) == null ? void 0 : e.available()) ?? !1;
1193
1200
  }
1194
1201
  }
1195
- class Un extends zt {
1202
+ class jn extends Gt {
1196
1203
  constructor(t, i) {
1197
1204
  super();
1198
1205
  m(this, "previousNode");
@@ -1204,18 +1211,33 @@ class Un extends zt {
1204
1211
  t.translate(this._x, this._y);
1205
1212
  }
1206
1213
  }
1207
- class $n extends zt {
1214
+ class Mr extends Gt {
1208
1215
  constructor(t, i) {
1209
1216
  super();
1210
1217
  m(this, "previousNode");
1211
- m(this, "_s");
1212
- this.previousNode = t, this._s = i.s;
1218
+ m(this, "_scaleParams", [1, 1]);
1219
+ if (this.previousNode = t, i.mirrorType)
1220
+ switch (i.mirrorType) {
1221
+ case dt.LeftToRight:
1222
+ this._scaleParams = [-1, 1];
1223
+ break;
1224
+ case dt.UpToDown:
1225
+ this._scaleParams = [1, -1];
1226
+ break;
1227
+ case dt.All:
1228
+ this._scaleParams = [-1, -1];
1229
+ break;
1230
+ default:
1231
+ this._scaleParams = [1, 1];
1232
+ break;
1233
+ }
1234
+ else i.s && (this._scaleParams = [i.s, i.s]);
1213
1235
  }
1214
1236
  paint(t) {
1215
- t.scale(this._s, this._s);
1237
+ t.scale(this._scaleParams[0], this._scaleParams[1]);
1216
1238
  }
1217
1239
  }
1218
- class Bn extends zt {
1240
+ class zn extends Gt {
1219
1241
  constructor(t) {
1220
1242
  super();
1221
1243
  m(this, "previousNode", null);
@@ -1226,7 +1248,7 @@ class Bn extends zt {
1226
1248
  return this._source.available();
1227
1249
  }
1228
1250
  }
1229
- class We extends Bn {
1251
+ class We extends zn {
1230
1252
  constructor(t, i) {
1231
1253
  super(t);
1232
1254
  m(this, "_targetWidth");
@@ -1248,7 +1270,7 @@ class We extends Bn {
1248
1270
  );
1249
1271
  }
1250
1272
  }
1251
- class jn extends jt {
1273
+ class Gn extends zt {
1252
1274
  constructor() {
1253
1275
  super(...arguments);
1254
1276
  m(this, "logger", new L("PictureTrack"));
@@ -1284,8 +1306,8 @@ class jn extends jt {
1284
1306
  this.logger.warn("destroy"), super.destroy();
1285
1307
  }
1286
1308
  }
1287
- const zn = 500;
1288
- class Xe extends jt {
1309
+ const Hn = 500;
1310
+ class Xe extends zt {
1289
1311
  constructor() {
1290
1312
  super(...arguments);
1291
1313
  m(this, "kind", E.VIDEO);
@@ -1295,11 +1317,11 @@ class Xe extends jt {
1295
1317
  const t = this.width(), i = this.height();
1296
1318
  this.sizeChangeTimer = setTimeout(() => {
1297
1319
  const s = this.width(), n = this.height();
1298
- (i !== n || t !== s) && this.emit(I.SIZE_CHANGE, {
1320
+ (i !== n || t !== s) && this.emit(D.SIZE_CHANGE, {
1299
1321
  width: s,
1300
1322
  height: n
1301
1323
  });
1302
- }, zn);
1324
+ }, Hn);
1303
1325
  });
1304
1326
  }
1305
1327
  element() {
@@ -1323,7 +1345,7 @@ class Xe extends jt {
1323
1345
  clearTimeout(this.sizeChangeTimer), super.destroy();
1324
1346
  }
1325
1347
  }
1326
- class Gn extends Xe {
1348
+ class qn extends Xe {
1327
1349
  constructor(t) {
1328
1350
  super(t);
1329
1351
  m(this, "logger", new L("CameraVideoTrack"));
@@ -1338,7 +1360,7 @@ class Gn extends Xe {
1338
1360
  return t ?? 0;
1339
1361
  }
1340
1362
  }
1341
- class Hn extends Xe {
1363
+ class Wn extends Xe {
1342
1364
  constructor(t) {
1343
1365
  super(t);
1344
1366
  m(this, "logger", new L("ScreenVideoTrack"));
@@ -1353,7 +1375,7 @@ class Hn extends Xe {
1353
1375
  return t ?? 0;
1354
1376
  }
1355
1377
  }
1356
- class qn extends Xe {
1378
+ class Xn extends Xe {
1357
1379
  constructor() {
1358
1380
  super(...arguments);
1359
1381
  m(this, "logger", new L("MediaVideoTrack"));
@@ -1367,7 +1389,7 @@ class qn extends Xe {
1367
1389
  return t ?? 0;
1368
1390
  }
1369
1391
  }
1370
- class Wn extends Xe {
1392
+ class Kn extends Xe {
1371
1393
  constructor() {
1372
1394
  super(...arguments);
1373
1395
  m(this, "logger", new L("CustomVideoTrack"));
@@ -1381,7 +1403,7 @@ class Wn extends Xe {
1381
1403
  return t ?? 0;
1382
1404
  }
1383
1405
  }
1384
- function ji(r, e) {
1406
+ function Hi(r, e) {
1385
1407
  let t;
1386
1408
  if (e != null && e.frameRate && typeof e.frameRate == "number" && (t = e.frameRate), t)
1387
1409
  try {
@@ -1396,13 +1418,13 @@ function ji(r, e) {
1396
1418
  }
1397
1419
  }
1398
1420
  const q = new L("Capture");
1399
- async function Xn(r) {
1400
- return St.enumerateDevices(r);
1421
+ async function Jn(r) {
1422
+ return Tt.enumerateDevices(r);
1401
1423
  }
1402
- async function Kn(r) {
1403
- St.removeAllListeners("onDeviceStateChanged"), St.on("onDeviceStateChanged", r);
1424
+ async function Yn(r) {
1425
+ Tt.removeAllListeners("onDeviceStateChanged"), Tt.on("onDeviceStateChanged", r);
1404
1426
  }
1405
- async function Jn(r) {
1427
+ async function Zn(r) {
1406
1428
  let e;
1407
1429
  try {
1408
1430
  const i = { video: r ?? !0 };
@@ -1415,11 +1437,11 @@ async function Jn(r) {
1415
1437
  );
1416
1438
  }
1417
1439
  const t = e.getVideoTracks()[0];
1418
- if (r != null && r.frameRate && ji(t, r), !t)
1440
+ if (r != null && r.frameRate && Hi(t, r), !t)
1419
1441
  throw new C(y.UNEXPECTED_TYPE, "got falsy in track");
1420
- return new Gn(t);
1442
+ return new qn(t);
1421
1443
  }
1422
- async function Yn(r, e) {
1444
+ async function Qn(r, e) {
1423
1445
  const { video: t, audio: i } = r;
1424
1446
  let s = t === !0 ? {} : t;
1425
1447
  e != null && e.displaySurface && (s.displaySurface = e.displaySurface, delete e.displaySurface), G.settingResolutionInGetDisplayMedia() || (s = !0), !G.supportIdealParamsInGetDisplayMedia() && typeof s != "boolean" && (s.width && typeof s.width == "number" && (s.width = {
@@ -1444,23 +1466,23 @@ async function Yn(r, e) {
1444
1466
  const a = n.getVideoTracks()[0], o = n.getAudioTracks()[0];
1445
1467
  if (!a)
1446
1468
  throw new C(y.UNEXPECTED_TYPE, "got falsy in videoTrack");
1447
- typeof s != "boolean" && typeof s.frameRate == "number" && ji(a, s);
1469
+ typeof s != "boolean" && typeof s.frameRate == "number" && Hi(a, s);
1448
1470
  const u = [];
1449
- return u.push(new Hn(a)), o && u.push(new In(o)), u;
1471
+ return u.push(new Wn(a)), o && u.push(new Ln(o)), u;
1450
1472
  }
1451
- async function Zn(r) {
1473
+ async function eo(r) {
1452
1474
  const { url: e, audio: t, video: i, loop: s } = r, n = new be({
1453
1475
  url: e,
1454
1476
  kind: i ? E.VIDEO : E.AUDIO,
1455
1477
  loop: s
1456
1478
  }), a = [];
1457
- return t && a.push(new Bi(n)), i && a.push(new qn(n)), await n.isReady(), a;
1479
+ return t && a.push(new Gi(n)), i && a.push(new Xn(n)), await n.isReady(), a;
1458
1480
  }
1459
- async function Qn(r) {
1460
- const e = new $i(r);
1461
- return await e.isReady(), new jn(e);
1481
+ async function to(r) {
1482
+ const e = new zi(r);
1483
+ return await e.isReady(), new Gn(e);
1462
1484
  }
1463
- async function eo(r) {
1485
+ async function ro(r) {
1464
1486
  let e;
1465
1487
  try {
1466
1488
  const i = { audio: r ?? !0 };
@@ -1475,31 +1497,31 @@ async function eo(r) {
1475
1497
  const t = e.getAudioTracks()[0];
1476
1498
  if (!t)
1477
1499
  throw new C(y.UNEXPECTED_TYPE, "got falsy in track");
1478
- return new On(t);
1500
+ return new Mn(t);
1479
1501
  }
1480
- function to(r) {
1502
+ function io(r) {
1481
1503
  if (!r || r.kind !== "video")
1482
1504
  throw new C(
1483
1505
  y.UNEXPECTED_TYPE,
1484
1506
  "error custom video track type"
1485
1507
  );
1486
- return new Wn(r);
1508
+ return new Kn(r);
1487
1509
  }
1488
- function ro(r) {
1510
+ function so(r) {
1489
1511
  if (!r || r.kind !== "audio")
1490
1512
  throw new C(
1491
1513
  y.UNEXPECTED_TYPE,
1492
1514
  "error custom audio track type"
1493
1515
  );
1494
- return new Dn(r);
1516
+ return new Fn(r);
1495
1517
  }
1496
- const io = q.invoke(Xn, "enumerateInputDevices"), so = q.invoke(Jn, "createCameraTrack"), no = q.invoke(Qn, "createPictureTrack"), Dr = q.invoke(Zn, "createMediaTracks"), oo = q.invoke(eo, "createMicrophoneTrack"), ao = q.invoke(Yn, "createScreenTracks"), co = q.invoke(Kn, "onDeviceChanged"), uo = q.invoke(to, "createCustomVideoTrack"), ho = q.invoke(ro, "createCustomAudioTrack");
1497
- var Tt = /* @__PURE__ */ ((r) => (r.PAUSING = "pausing", r))(Tt || {});
1498
- const po = {
1518
+ const no = q.invoke(Jn, "enumerateInputDevices"), oo = q.invoke(Zn, "createCameraTrack"), ao = q.invoke(to, "createPictureTrack"), Lr = q.invoke(eo, "createMediaTracks"), co = q.invoke(ro, "createMicrophoneTrack"), uo = q.invoke(Qn, "createScreenTracks"), ho = q.invoke(Yn, "onDeviceChanged"), po = q.invoke(io, "createCustomVideoTrack"), lo = q.invoke(so, "createCustomAudioTrack");
1519
+ var Et = /* @__PURE__ */ ((r) => (r.PAUSING = "pausing", r))(Et || {});
1520
+ const mo = {
1499
1521
  sampleRate: 48e3,
1500
1522
  keepAlive: !0
1501
- }, Mr = /* @__PURE__ */ new Map(), ye = new L("Mixer");
1502
- class lo extends Bt {
1523
+ }, Fr = /* @__PURE__ */ new Map(), ye = new L("Mixer");
1524
+ class fo extends jt {
1503
1525
  constructor(t) {
1504
1526
  super();
1505
1527
  m(this, "id", oe());
@@ -1510,12 +1532,12 @@ class lo extends Bt {
1510
1532
  m(this, "_bufferNode");
1511
1533
  m(this, "_track");
1512
1534
  ye.info("ctor", t), this._config = {
1513
- ...po,
1535
+ ...mo,
1514
1536
  ...t
1515
- }, this._context = mo(this._config), this._bindContextEvent(this._context);
1537
+ }, this._context = _o(this._config), this._bindContextEvent(this._context);
1516
1538
  }
1517
1539
  mix(t) {
1518
- ye.info("mix", t), Et(this._context);
1540
+ ye.info("mix", t), bt(this._context);
1519
1541
  for (const i of this._nodeList)
1520
1542
  t.includes(i) || i.destroy();
1521
1543
  this._nodeList = t, this._connect(t, this._destNode), this._nodeList.length === 0 && this._appendSlience(this._context, this._destNode);
@@ -1544,10 +1566,10 @@ class lo extends Bt {
1544
1566
  }
1545
1567
  _handleContextStateChange() {
1546
1568
  const t = this._context;
1547
- (t.state === "suspended" || t.state === "interrupted") && (ye.info("_emit_", Tt.PAUSING), this.emit(Tt.PAUSING));
1569
+ (t.state === "suspended" || t.state === "interrupted") && (ye.info("_emit_", Et.PAUSING), this.emit(Et.PAUSING));
1548
1570
  }
1549
1571
  track() {
1550
- if (ye.info("track"), Et(this._context), this._track)
1572
+ if (ye.info("track"), bt(this._context), this._track)
1551
1573
  return this._track;
1552
1574
  let t = this._destNode;
1553
1575
  t || (t = new MediaStreamAudioDestinationNode(this._context)), this._nodeList.length === 0 && this._appendSlience(this._context, t), this._connect(this._nodeList, t);
@@ -1555,38 +1577,38 @@ class lo extends Bt {
1555
1577
  return this._destNode = t, this._track = i, i;
1556
1578
  }
1557
1579
  }
1558
- function mo(r) {
1580
+ function _o(r) {
1559
1581
  const { sampleRate: e, keepAlive: t } = r;
1560
- let i = Mr.get(e);
1561
- return (!i || i.state === "closed") && (i = new AudioContext({ sampleRate: e }), Mr.set(e, i)), t && (i.onstatechange = () => {
1562
- Et(i);
1582
+ let i = Fr.get(e);
1583
+ return (!i || i.state === "closed") && (i = new AudioContext({ sampleRate: e }), Fr.set(e, i)), t && (i.onstatechange = () => {
1584
+ bt(i);
1563
1585
  }), i;
1564
1586
  }
1565
- function Et(r) {
1587
+ function bt(r) {
1566
1588
  if (r.state === "suspended" || r.state === "interrupted")
1567
1589
  return r.resume();
1568
1590
  }
1569
- const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER, zi = 536870912, Fr = zi * 2, _o = (r, e) => (t) => {
1591
+ const go = (r) => (e, t) => (r.set(e, t), t), Nr = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER, qi = 536870912, Vr = qi * 2, vo = (r, e) => (t) => {
1570
1592
  const i = e.get(t);
1571
- let s = i === void 0 ? t.size : i < Fr ? i + 1 : 0;
1593
+ let s = i === void 0 ? t.size : i < Vr ? i + 1 : 0;
1572
1594
  if (!t.has(s))
1573
1595
  return r(t, s);
1574
- if (t.size < zi) {
1596
+ if (t.size < qi) {
1575
1597
  for (; t.has(s); )
1576
- s = Math.floor(Math.random() * Fr);
1598
+ s = Math.floor(Math.random() * Vr);
1577
1599
  return r(t, s);
1578
1600
  }
1579
- if (t.size > Lr)
1601
+ if (t.size > Nr)
1580
1602
  throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");
1581
1603
  for (; t.has(s); )
1582
- s = Math.floor(Math.random() * Lr);
1604
+ s = Math.floor(Math.random() * Nr);
1583
1605
  return r(t, s);
1584
- }, Gi = /* @__PURE__ */ new WeakMap(), go = fo(Gi), Y = _o(go, Gi), vo = (r) => r.method !== void 0 && r.method === "call", Co = (r) => typeof r.id == "number" && typeof r.result == "boolean", yo = (r) => {
1606
+ }, Wi = /* @__PURE__ */ new WeakMap(), Co = go(Wi), Y = vo(Co, Wi), yo = (r) => r.method !== void 0 && r.method === "call", So = (r) => typeof r.id == "number" && typeof r.result == "boolean", To = (r) => {
1585
1607
  const e = /* @__PURE__ */ new Map([[0, () => {
1586
1608
  }]]), t = /* @__PURE__ */ new Map([[0, () => {
1587
1609
  }]]), i = /* @__PURE__ */ new Map(), s = new Worker(r);
1588
1610
  return s.addEventListener("message", ({ data: d }) => {
1589
- if (vo(d)) {
1611
+ if (yo(d)) {
1590
1612
  const { params: { timerId: c, timerType: h } } = d;
1591
1613
  if (h === "interval") {
1592
1614
  const p = e.get(c);
@@ -1607,7 +1629,7 @@ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1607
1629
  throw new Error("The timer is in an undefined state.");
1608
1630
  } else typeof p == "function" && (p(), t.delete(c));
1609
1631
  }
1610
- } else if (Co(d)) {
1632
+ } else if (So(d)) {
1611
1633
  const { id: c } = d, h = i.get(c);
1612
1634
  if (h === void 0)
1613
1635
  throw new Error("The timer is in an undefined state.");
@@ -1676,7 +1698,7 @@ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1676
1698
  }), p;
1677
1699
  }
1678
1700
  };
1679
- }, So = (r, e) => {
1701
+ }, Eo = (r, e) => {
1680
1702
  let t = null;
1681
1703
  return () => {
1682
1704
  if (t !== null)
@@ -1684,7 +1706,7 @@ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1684
1706
  const i = new Blob([e], { type: "application/javascript; charset=utf-8" }), s = URL.createObjectURL(i);
1685
1707
  return t = r(s), setTimeout(() => URL.revokeObjectURL(s)), t;
1686
1708
  };
1687
- }, To = `(()=>{"use strict";const e=new Map,t=new Map,r=t=>{const r=e.get(t);return void 0!==r&&(clearTimeout(r),e.delete(t),!0)},s=e=>{const r=t.get(e);return void 0!==r&&(clearTimeout(r),t.delete(e),!0)},o=(e,t)=>{const r=performance.now(),s=e+t-r-performance.timeOrigin;return{expected:r+s,remainingDelay:s}},i=(e,t,r,s)=>{const o=r-performance.now();o>0?e.set(t,setTimeout(i,o,e,t,r,s)):(e.delete(t),postMessage({id:null,method:"call",params:{timerId:t,timerType:s}}))};addEventListener("message",(({data:n})=>{try{if("clear"===n.method){const{id:e,params:{timerId:t,timerType:o}}=n;if("interval"===o)postMessage({id:e,result:r(t)});else{if("timeout"!==o)throw new Error('The given type "'.concat(o,'" is not supported'));postMessage({id:e,result:s(t)})}}else{if("set"!==n.method)throw new Error('The given method "'.concat(n.method,'" is not supported'));{const{params:{delay:r,now:s,timerId:a,timerType:m}}=n;if("interval"===m)((t,r,s)=>{const{expected:n,remainingDelay:a}=o(t,s);e.set(r,setTimeout(i,a,e,r,n,"interval"))})(r,a,s);else{if("timeout"!==m)throw new Error('The given type "'.concat(m,'" is not supported'));((e,r,s)=>{const{expected:n,remainingDelay:a}=o(e,s);t.set(r,setTimeout(i,a,t,r,n,"timeout"))})(r,a,s)}}}}catch(e){postMessage({error:{message:e.message},id:n.id,result:null})}}))})();`, Hi = So(yo, To), Eo = (r) => Hi().clearTimeout(r), bo = (...r) => Hi().setTimeout(...r), ko = (r) => r.method !== void 0 && r.method === "call", Po = (r) => typeof r.id == "number" && typeof r.result == "boolean", xo = (r) => {
1709
+ }, bo = `(()=>{"use strict";const e=new Map,t=new Map,r=t=>{const r=e.get(t);return void 0!==r&&(clearTimeout(r),e.delete(t),!0)},s=e=>{const r=t.get(e);return void 0!==r&&(clearTimeout(r),t.delete(e),!0)},o=(e,t)=>{const r=performance.now(),s=e+t-r-performance.timeOrigin;return{expected:r+s,remainingDelay:s}},i=(e,t,r,s)=>{const o=r-performance.now();o>0?e.set(t,setTimeout(i,o,e,t,r,s)):(e.delete(t),postMessage({id:null,method:"call",params:{timerId:t,timerType:s}}))};addEventListener("message",(({data:n})=>{try{if("clear"===n.method){const{id:e,params:{timerId:t,timerType:o}}=n;if("interval"===o)postMessage({id:e,result:r(t)});else{if("timeout"!==o)throw new Error('The given type "'.concat(o,'" is not supported'));postMessage({id:e,result:s(t)})}}else{if("set"!==n.method)throw new Error('The given method "'.concat(n.method,'" is not supported'));{const{params:{delay:r,now:s,timerId:a,timerType:m}}=n;if("interval"===m)((t,r,s)=>{const{expected:n,remainingDelay:a}=o(t,s);e.set(r,setTimeout(i,a,e,r,n,"interval"))})(r,a,s);else{if("timeout"!==m)throw new Error('The given type "'.concat(m,'" is not supported'));((e,r,s)=>{const{expected:n,remainingDelay:a}=o(e,s);t.set(r,setTimeout(i,a,t,r,n,"timeout"))})(r,a,s)}}}}catch(e){postMessage({error:{message:e.message},id:n.id,result:null})}}))})();`, Xi = Eo(To, bo), ko = (r) => Xi().clearTimeout(r), Po = (...r) => Xi().setTimeout(...r), xo = (r) => r.method !== void 0 && r.method === "call", Ro = (r) => typeof r.id == "number" && typeof r.result == "boolean", Ao = (r) => {
1688
1710
  const e = /* @__PURE__ */ new Map([
1689
1711
  [0, () => {
1690
1712
  }]
@@ -1695,7 +1717,7 @@ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1695
1717
  credentials: "omit"
1696
1718
  });
1697
1719
  return s.addEventListener("message", ({ data: d }) => {
1698
- if (ko(d)) {
1720
+ if (xo(d)) {
1699
1721
  const {
1700
1722
  params: { timerId: c, timerType: h }
1701
1723
  } = d;
@@ -1718,7 +1740,7 @@ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1718
1740
  throw new Error("The timer is in an undefined state.");
1719
1741
  } else typeof p == "function" && (p(), t.delete(c));
1720
1742
  }
1721
- } else if (Po(d)) {
1743
+ } else if (Ro(d)) {
1722
1744
  const { id: c } = d, h = i.get(c);
1723
1745
  if (h === void 0)
1724
1746
  throw new Error("The timer is in an undefined state.");
@@ -1789,13 +1811,13 @@ const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
1789
1811
  }), p;
1790
1812
  }
1791
1813
  };
1792
- }, Ro = {
1814
+ }, wo = {
1793
1815
  width: 640,
1794
1816
  height: 480,
1795
1817
  frameRate: 30,
1796
1818
  backgroundColor: "#000000"
1797
- }, Ie = new L("View");
1798
- class Ao {
1819
+ }, De = new L("View");
1820
+ class Oo {
1799
1821
  constructor(e) {
1800
1822
  m(this, "id", oe());
1801
1823
  m(this, "_context");
@@ -1819,18 +1841,18 @@ class Ao {
1819
1841
  }
1820
1842
  this._drawOnCanvas(), this._workerTimeoutId && this._customClearTimeout(this._workerTimeoutId), this._workerTimeoutId = this._customSetTimeout(() => {
1821
1843
  this._paintLoop(), this._raqId && (cancelAnimationFrame(this._raqId), this._raqId = void 0);
1822
- }, yt / this._config.frameRate), this._raqId = requestAnimationFrame(this._paintLoop);
1844
+ }, St / this._config.frameRate), this._raqId = requestAnimationFrame(this._paintLoop);
1823
1845
  });
1824
- Ie.info("ctor", e), this._config = {
1825
- ...Ro,
1846
+ De.info("ctor", e), this._config = {
1847
+ ...wo,
1826
1848
  ...e
1827
1849
  };
1828
- const { context: t, canvas: i } = Li(this._config);
1829
- this._context = t, this._canvas = i, this._customSetTimeout = bo, this._customClearTimeout = Eo;
1850
+ const { context: t, canvas: i } = Vi(this._config);
1851
+ this._context = t, this._canvas = i, this._customSetTimeout = Po, this._customClearTimeout = ko;
1830
1852
  }
1831
1853
  setWorkerTimerScriptUrl(e) {
1832
1854
  if (this._workerTimerScriptUrl = e, this._workerTimerScriptUrl) {
1833
- const t = xo(this._workerTimerScriptUrl);
1855
+ const t = Ao(this._workerTimerScriptUrl);
1834
1856
  this._customSetTimeout = (...i) => t.setTimeout(...i), this._customClearTimeout = (i) => t.clearTimeout(i);
1835
1857
  }
1836
1858
  }
@@ -1838,7 +1860,7 @@ class Ao {
1838
1860
  if (e < this._nextTime)
1839
1861
  return !1;
1840
1862
  for (; e > this._nextTime; )
1841
- this._nextTime += yt / this._config.frameRate;
1863
+ this._nextTime += St / this._config.frameRate;
1842
1864
  return !0;
1843
1865
  }
1844
1866
  updateConfig(e) {
@@ -1848,7 +1870,7 @@ class Ao {
1848
1870
  }, this._canvas.width = this._config.width, this._canvas.height = this._config.height;
1849
1871
  }
1850
1872
  draw(e = []) {
1851
- Ie.info("draw", e), this._nodeList = e;
1873
+ De.info("draw", e), this._nodeList = e;
1852
1874
  }
1853
1875
  _drawOnCanvas() {
1854
1876
  if (this._shouldDraw(Date.now())) {
@@ -1868,7 +1890,7 @@ class Ao {
1868
1890
  this._context.clearRect(0, 0, t, i), e && (this._context.fillStyle = e, this._context.fillRect(0, 0, t, i));
1869
1891
  }
1870
1892
  track() {
1871
- if (Ie.info("track"), this._track)
1893
+ if (De.info("track"), this._track)
1872
1894
  return this._track;
1873
1895
  this._stopped = !1, this._paintLoop();
1874
1896
  const { frameRate: e } = this._config, t = this._canvas.captureStream(e);
@@ -1882,16 +1904,16 @@ class Ao {
1882
1904
  return this.track();
1883
1905
  }
1884
1906
  element() {
1885
- return Ie.info("element"), this._paintLoop(), this._canvas;
1907
+ return De.info("element"), this._paintLoop(), this._canvas;
1886
1908
  }
1887
1909
  stop() {
1888
1910
  this._stopped = !0;
1889
1911
  }
1890
1912
  }
1891
- function wo() {
1913
+ function Do() {
1892
1914
  return Math.random().toString(36).slice(-8);
1893
1915
  }
1894
- const Oo = `
1916
+ const Io = `
1895
1917
  const SMOOTHING_FACTOR = 0.8;
1896
1918
  const MINIMUM_VALUE = 0.00001;
1897
1919
 
@@ -1946,10 +1968,10 @@ registerProcessor('vumeter', class extends AudioWorkletProcessor {
1946
1968
  return true;
1947
1969
  }
1948
1970
  });
1949
- `, Io = URL.createObjectURL(
1950
- new Blob([Oo], { type: "application/javascript" })
1971
+ `, Mo = URL.createObjectURL(
1972
+ new Blob([Io], { type: "application/javascript" })
1951
1973
  );
1952
- class Do {
1974
+ class Lo {
1953
1975
  constructor() {
1954
1976
  this._audioCtx = null, this._volume = 0;
1955
1977
  }
@@ -1959,7 +1981,7 @@ class Do {
1959
1981
  async start(e, t) {
1960
1982
  if (this._audioCtx) return;
1961
1983
  const i = new AudioContext();
1962
- await i.audioWorklet.addModule(t || Io);
1984
+ await i.audioWorklet.addModule(t || Mo);
1963
1985
  const s = new MediaStream();
1964
1986
  s.addTrack(e);
1965
1987
  const n = i.createMediaStreamSource(s), a = new AudioWorkletNode(i, "vumeter");
@@ -1987,9 +2009,9 @@ class Ke {
1987
2009
  this._volumeDetectScriptUrl = e;
1988
2010
  }
1989
2011
  }
1990
- class qi extends te {
2012
+ class Ki extends te {
1991
2013
  constructor(e) {
1992
- super(), this._width = 0, this._height = 0, this._mediaStream = null, this._nextStream = null, this._trackMap = {}, this.type = e.type, this.id = wo(), this._source = e.stream;
2014
+ super(), this._width = 0, this._height = 0, this._mediaStream = null, this._nextStream = null, this._trackMap = {}, this.type = e.type, this.id = Do(), this._source = e.stream;
1993
2015
  }
1994
2016
  get source() {
1995
2017
  return this._source;
@@ -2020,7 +2042,7 @@ class qi extends te {
2020
2042
  return this._trackMap.audio && e.addTrack(this._trackMap.audio), this._trackMap.video && e.addTrack(this._trackMap.video), this._mediaStream = e, e;
2021
2043
  }
2022
2044
  async startVolumeDetect() {
2023
- this.audioTrack && (this._volumeDetector || (this._volumeDetector = new Do()), await this._volumeDetector.start(
2045
+ this.audioTrack && (this._volumeDetector || (this._volumeDetector = new Lo()), await this._volumeDetector.start(
2024
2046
  this.audioTrack,
2025
2047
  Ke.instance.volumeDetectScriptUrl
2026
2048
  ));
@@ -2034,7 +2056,7 @@ class qi extends te {
2034
2056
  return ((e = this._volumeDetector) == null ? void 0 : e.volume) || 0;
2035
2057
  }
2036
2058
  }
2037
- class _e extends qi {
2059
+ class _e extends Ki {
2038
2060
  get isVideoStream() {
2039
2061
  return !0;
2040
2062
  }
@@ -2042,15 +2064,15 @@ class _e extends qi {
2042
2064
  return !1;
2043
2065
  }
2044
2066
  bindTrackSizeChangeEvent(e) {
2045
- e.on(I.SIZE_CHANGE, ({ width: t, height: i }) => {
2046
- this._width = t, this._height = i, this.emit(Nt.SizeChange, {
2067
+ e.on(D.SIZE_CHANGE, ({ width: t, height: i }) => {
2068
+ this._width = t, this._height = i, this.emit(Vt.SizeChange, {
2047
2069
  width: t,
2048
2070
  height: i
2049
2071
  });
2050
2072
  });
2051
2073
  }
2052
2074
  }
2053
- class Je extends qi {
2075
+ class Je extends Ki {
2054
2076
  get isVideoStream() {
2055
2077
  return !1;
2056
2078
  }
@@ -2058,7 +2080,7 @@ class Je extends qi {
2058
2080
  return !0;
2059
2081
  }
2060
2082
  }
2061
- class Mo extends _e {
2083
+ class Fo extends _e {
2062
2084
  constructor(e) {
2063
2085
  super({
2064
2086
  type: S.Camera,
@@ -2075,120 +2097,120 @@ class Mo extends _e {
2075
2097
  return null;
2076
2098
  }
2077
2099
  bindTrackEnd(e) {
2078
- this.source.on(I.ENDED, e);
2100
+ this.source.on(D.ENDED, e);
2079
2101
  }
2080
2102
  destroy() {
2081
2103
  this.source.destroy();
2082
2104
  }
2083
2105
  }
2084
- var Wi = typeof global == "object" && global && global.Object === Object && global, Lo = typeof self == "object" && self && self.Object === Object && self, W = Wi || Lo || Function("return this")(), Q = W.Symbol, Xi = Object.prototype, Fo = Xi.hasOwnProperty, No = Xi.toString, Se = Q ? Q.toStringTag : void 0;
2085
- function Vo(r) {
2086
- var e = Fo.call(r, Se), t = r[Se];
2106
+ var Ji = typeof global == "object" && global && global.Object === Object && global, No = typeof self == "object" && self && self.Object === Object && self, W = Ji || No || Function("return this")(), Q = W.Symbol, Yi = Object.prototype, Vo = Yi.hasOwnProperty, Uo = Yi.toString, Se = Q ? Q.toStringTag : void 0;
2107
+ function $o(r) {
2108
+ var e = Vo.call(r, Se), t = r[Se];
2087
2109
  try {
2088
2110
  r[Se] = void 0;
2089
2111
  var i = !0;
2090
2112
  } catch {
2091
2113
  }
2092
- var s = No.call(r);
2114
+ var s = Uo.call(r);
2093
2115
  return i && (e ? r[Se] = t : delete r[Se]), s;
2094
2116
  }
2095
- var Uo = Object.prototype, $o = Uo.toString;
2096
- function Bo(r) {
2097
- return $o.call(r);
2117
+ var Bo = Object.prototype, jo = Bo.toString;
2118
+ function zo(r) {
2119
+ return jo.call(r);
2098
2120
  }
2099
- var jo = "[object Null]", zo = "[object Undefined]", Nr = Q ? Q.toStringTag : void 0;
2121
+ var Go = "[object Null]", Ho = "[object Undefined]", Ur = Q ? Q.toStringTag : void 0;
2100
2122
  function ge(r) {
2101
- return r == null ? r === void 0 ? zo : jo : Nr && Nr in Object(r) ? Vo(r) : Bo(r);
2123
+ return r == null ? r === void 0 ? Ho : Go : Ur && Ur in Object(r) ? $o(r) : zo(r);
2102
2124
  }
2103
2125
  function me(r) {
2104
2126
  return r != null && typeof r == "object";
2105
2127
  }
2106
- var Go = "[object Symbol]";
2128
+ var qo = "[object Symbol]";
2107
2129
  function Ye(r) {
2108
- return typeof r == "symbol" || me(r) && ge(r) == Go;
2130
+ return typeof r == "symbol" || me(r) && ge(r) == qo;
2109
2131
  }
2110
- function Ki(r, e) {
2132
+ function Zi(r, e) {
2111
2133
  for (var t = -1, i = r == null ? 0 : r.length, s = Array(i); ++t < i; )
2112
2134
  s[t] = e(r[t], t, r);
2113
2135
  return s;
2114
2136
  }
2115
- var M = Array.isArray, Vr = Q ? Q.prototype : void 0, Ur = Vr ? Vr.toString : void 0;
2116
- function Ji(r) {
2137
+ var M = Array.isArray, $r = Q ? Q.prototype : void 0, Br = $r ? $r.toString : void 0;
2138
+ function Qi(r) {
2117
2139
  if (typeof r == "string")
2118
2140
  return r;
2119
2141
  if (M(r))
2120
- return Ki(r, Ji) + "";
2142
+ return Zi(r, Qi) + "";
2121
2143
  if (Ye(r))
2122
- return Ur ? Ur.call(r) : "";
2144
+ return Br ? Br.call(r) : "";
2123
2145
  var e = r + "";
2124
2146
  return e == "0" && 1 / r == -1 / 0 ? "-0" : e;
2125
2147
  }
2126
- var Ho = /\s/;
2127
- function qo(r) {
2128
- for (var e = r.length; e-- && Ho.test(r.charAt(e)); )
2148
+ var Wo = /\s/;
2149
+ function Xo(r) {
2150
+ for (var e = r.length; e-- && Wo.test(r.charAt(e)); )
2129
2151
  ;
2130
2152
  return e;
2131
2153
  }
2132
- var Wo = /^\s+/;
2133
- function Xo(r) {
2134
- return r && r.slice(0, qo(r) + 1).replace(Wo, "");
2154
+ var Ko = /^\s+/;
2155
+ function Jo(r) {
2156
+ return r && r.slice(0, Xo(r) + 1).replace(Ko, "");
2135
2157
  }
2136
2158
  function ke(r) {
2137
2159
  var e = typeof r;
2138
2160
  return r != null && (e == "object" || e == "function");
2139
2161
  }
2140
- var $r = NaN, Ko = /^[-+]0x[0-9a-f]+$/i, Jo = /^0b[01]+$/i, Yo = /^0o[0-7]+$/i, Zo = parseInt;
2141
- function Qo(r) {
2162
+ var jr = NaN, Yo = /^[-+]0x[0-9a-f]+$/i, Zo = /^0b[01]+$/i, Qo = /^0o[0-7]+$/i, ea = parseInt;
2163
+ function ta(r) {
2142
2164
  if (typeof r == "number")
2143
2165
  return r;
2144
2166
  if (Ye(r))
2145
- return $r;
2167
+ return jr;
2146
2168
  if (ke(r)) {
2147
2169
  var e = typeof r.valueOf == "function" ? r.valueOf() : r;
2148
2170
  r = ke(e) ? e + "" : e;
2149
2171
  }
2150
2172
  if (typeof r != "string")
2151
2173
  return r === 0 ? r : +r;
2152
- r = Xo(r);
2153
- var t = Jo.test(r);
2154
- return t || Yo.test(r) ? Zo(r.slice(2), t ? 2 : 8) : Ko.test(r) ? $r : +r;
2174
+ r = Jo(r);
2175
+ var t = Zo.test(r);
2176
+ return t || Qo.test(r) ? ea(r.slice(2), t ? 2 : 8) : Yo.test(r) ? jr : +r;
2155
2177
  }
2156
- var ea = 1 / 0, ta = 17976931348623157e292;
2157
- function ra(r) {
2178
+ var ra = 1 / 0, ia = 17976931348623157e292;
2179
+ function sa(r) {
2158
2180
  if (!r)
2159
2181
  return r === 0 ? r : 0;
2160
- if (r = Qo(r), r === ea || r === -1 / 0) {
2182
+ if (r = ta(r), r === ra || r === -1 / 0) {
2161
2183
  var e = r < 0 ? -1 : 1;
2162
- return e * ta;
2184
+ return e * ia;
2163
2185
  }
2164
2186
  return r === r ? r : 0;
2165
2187
  }
2166
- function ia(r) {
2167
- var e = ra(r), t = e % 1;
2188
+ function na(r) {
2189
+ var e = sa(r), t = e % 1;
2168
2190
  return e === e ? t ? e - t : e : 0;
2169
2191
  }
2170
- function sa(r) {
2192
+ function oa(r) {
2171
2193
  return r;
2172
2194
  }
2173
- var na = "[object AsyncFunction]", oa = "[object Function]", aa = "[object GeneratorFunction]", ca = "[object Proxy]";
2174
- function Yi(r) {
2195
+ var aa = "[object AsyncFunction]", ca = "[object Function]", da = "[object GeneratorFunction]", ua = "[object Proxy]";
2196
+ function es(r) {
2175
2197
  if (!ke(r))
2176
2198
  return !1;
2177
2199
  var e = ge(r);
2178
- return e == oa || e == aa || e == na || e == ca;
2200
+ return e == ca || e == da || e == aa || e == ua;
2179
2201
  }
2180
- var dt = W["__core-js_shared__"], Br = function() {
2181
- var r = /[^.]+$/.exec(dt && dt.keys && dt.keys.IE_PROTO || "");
2202
+ var ut = W["__core-js_shared__"], zr = function() {
2203
+ var r = /[^.]+$/.exec(ut && ut.keys && ut.keys.IE_PROTO || "");
2182
2204
  return r ? "Symbol(src)_1." + r : "";
2183
2205
  }();
2184
- function da(r) {
2185
- return !!Br && Br in r;
2206
+ function ha(r) {
2207
+ return !!zr && zr in r;
2186
2208
  }
2187
- var ua = Function.prototype, ha = ua.toString;
2209
+ var pa = Function.prototype, la = pa.toString;
2188
2210
  function ae(r) {
2189
2211
  if (r != null) {
2190
2212
  try {
2191
- return ha.call(r);
2213
+ return la.call(r);
2192
2214
  } catch {
2193
2215
  }
2194
2216
  try {
@@ -2198,144 +2220,144 @@ function ae(r) {
2198
2220
  }
2199
2221
  return "";
2200
2222
  }
2201
- var pa = /[\\^$.*+?()[\]{}|]/g, la = /^\[object .+?Constructor\]$/, ma = Function.prototype, fa = Object.prototype, _a = ma.toString, ga = fa.hasOwnProperty, va = RegExp(
2202
- "^" + _a.call(ga).replace(pa, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2223
+ var ma = /[\\^$.*+?()[\]{}|]/g, fa = /^\[object .+?Constructor\]$/, _a = Function.prototype, ga = Object.prototype, va = _a.toString, Ca = ga.hasOwnProperty, ya = RegExp(
2224
+ "^" + va.call(Ca).replace(ma, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2203
2225
  );
2204
- function Ca(r) {
2205
- if (!ke(r) || da(r))
2226
+ function Sa(r) {
2227
+ if (!ke(r) || ha(r))
2206
2228
  return !1;
2207
- var e = Yi(r) ? va : la;
2229
+ var e = es(r) ? ya : fa;
2208
2230
  return e.test(ae(r));
2209
2231
  }
2210
- function ya(r, e) {
2232
+ function Ta(r, e) {
2211
2233
  return r == null ? void 0 : r[e];
2212
2234
  }
2213
2235
  function ve(r, e) {
2214
- var t = ya(r, e);
2215
- return Ca(t) ? t : void 0;
2236
+ var t = Ta(r, e);
2237
+ return Sa(t) ? t : void 0;
2216
2238
  }
2217
- var bt = ve(W, "WeakMap");
2218
- function Sa(r, e, t, i) {
2239
+ var kt = ve(W, "WeakMap");
2240
+ function Ea(r, e, t, i) {
2219
2241
  for (var s = r.length, n = t + -1; ++n < s; )
2220
2242
  if (e(r[n], n, r))
2221
2243
  return n;
2222
2244
  return -1;
2223
2245
  }
2224
- var Ta = 9007199254740991, Ea = /^(?:0|[1-9]\d*)$/;
2225
- function Zi(r, e) {
2246
+ var ba = 9007199254740991, ka = /^(?:0|[1-9]\d*)$/;
2247
+ function ts(r, e) {
2226
2248
  var t = typeof r;
2227
- return e = e ?? Ta, !!e && (t == "number" || t != "symbol" && Ea.test(r)) && r > -1 && r % 1 == 0 && r < e;
2249
+ return e = e ?? ba, !!e && (t == "number" || t != "symbol" && ka.test(r)) && r > -1 && r % 1 == 0 && r < e;
2228
2250
  }
2229
- function Qi(r, e) {
2251
+ function rs(r, e) {
2230
2252
  return r === e || r !== r && e !== e;
2231
2253
  }
2232
- var ba = 9007199254740991;
2233
- function Gt(r) {
2234
- return typeof r == "number" && r > -1 && r % 1 == 0 && r <= ba;
2235
- }
2254
+ var Pa = 9007199254740991;
2236
2255
  function Ht(r) {
2237
- return r != null && Gt(r.length) && !Yi(r);
2256
+ return typeof r == "number" && r > -1 && r % 1 == 0 && r <= Pa;
2257
+ }
2258
+ function qt(r) {
2259
+ return r != null && Ht(r.length) && !es(r);
2238
2260
  }
2239
- var ka = Object.prototype;
2240
- function Pa(r) {
2241
- var e = r && r.constructor, t = typeof e == "function" && e.prototype || ka;
2261
+ var xa = Object.prototype;
2262
+ function Ra(r) {
2263
+ var e = r && r.constructor, t = typeof e == "function" && e.prototype || xa;
2242
2264
  return r === t;
2243
2265
  }
2244
- function xa(r, e) {
2266
+ function Aa(r, e) {
2245
2267
  for (var t = -1, i = Array(r); ++t < r; )
2246
2268
  i[t] = e(t);
2247
2269
  return i;
2248
2270
  }
2249
- var Ra = "[object Arguments]";
2250
- function jr(r) {
2251
- return me(r) && ge(r) == Ra;
2271
+ var wa = "[object Arguments]";
2272
+ function Gr(r) {
2273
+ return me(r) && ge(r) == wa;
2252
2274
  }
2253
- var es = Object.prototype, Aa = es.hasOwnProperty, wa = es.propertyIsEnumerable, ts = jr(/* @__PURE__ */ function() {
2275
+ var is = Object.prototype, Oa = is.hasOwnProperty, Da = is.propertyIsEnumerable, ss = Gr(/* @__PURE__ */ function() {
2254
2276
  return arguments;
2255
- }()) ? jr : function(r) {
2256
- return me(r) && Aa.call(r, "callee") && !wa.call(r, "callee");
2277
+ }()) ? Gr : function(r) {
2278
+ return me(r) && Oa.call(r, "callee") && !Da.call(r, "callee");
2257
2279
  };
2258
- function Oa() {
2280
+ function Ia() {
2259
2281
  return !1;
2260
2282
  }
2261
- var rs = typeof exports == "object" && exports && !exports.nodeType && exports, zr = rs && typeof module == "object" && module && !module.nodeType && module, Ia = zr && zr.exports === rs, Gr = Ia ? W.Buffer : void 0, Da = Gr ? Gr.isBuffer : void 0, kt = Da || Oa, Ma = "[object Arguments]", La = "[object Array]", Fa = "[object Boolean]", Na = "[object Date]", Va = "[object Error]", Ua = "[object Function]", $a = "[object Map]", Ba = "[object Number]", ja = "[object Object]", za = "[object RegExp]", Ga = "[object Set]", Ha = "[object String]", qa = "[object WeakMap]", Wa = "[object ArrayBuffer]", Xa = "[object DataView]", Ka = "[object Float32Array]", Ja = "[object Float64Array]", Ya = "[object Int8Array]", Za = "[object Int16Array]", Qa = "[object Int32Array]", ec = "[object Uint8Array]", tc = "[object Uint8ClampedArray]", rc = "[object Uint16Array]", ic = "[object Uint32Array]", k = {};
2262
- k[Ka] = k[Ja] = k[Ya] = k[Za] = k[Qa] = k[ec] = k[tc] = k[rc] = k[ic] = !0;
2263
- k[Ma] = k[La] = k[Wa] = k[Fa] = k[Xa] = k[Na] = k[Va] = k[Ua] = k[$a] = k[Ba] = k[ja] = k[za] = k[Ga] = k[Ha] = k[qa] = !1;
2264
- function sc(r) {
2265
- return me(r) && Gt(r.length) && !!k[ge(r)];
2283
+ var ns = typeof exports == "object" && exports && !exports.nodeType && exports, Hr = ns && typeof module == "object" && module && !module.nodeType && module, Ma = Hr && Hr.exports === ns, qr = Ma ? W.Buffer : void 0, La = qr ? qr.isBuffer : void 0, Pt = La || Ia, Fa = "[object Arguments]", Na = "[object Array]", Va = "[object Boolean]", Ua = "[object Date]", $a = "[object Error]", Ba = "[object Function]", ja = "[object Map]", za = "[object Number]", Ga = "[object Object]", Ha = "[object RegExp]", qa = "[object Set]", Wa = "[object String]", Xa = "[object WeakMap]", Ka = "[object ArrayBuffer]", Ja = "[object DataView]", Ya = "[object Float32Array]", Za = "[object Float64Array]", Qa = "[object Int8Array]", ec = "[object Int16Array]", tc = "[object Int32Array]", rc = "[object Uint8Array]", ic = "[object Uint8ClampedArray]", sc = "[object Uint16Array]", nc = "[object Uint32Array]", k = {};
2284
+ k[Ya] = k[Za] = k[Qa] = k[ec] = k[tc] = k[rc] = k[ic] = k[sc] = k[nc] = !0;
2285
+ k[Fa] = k[Na] = k[Ka] = k[Va] = k[Ja] = k[Ua] = k[$a] = k[Ba] = k[ja] = k[za] = k[Ga] = k[Ha] = k[qa] = k[Wa] = k[Xa] = !1;
2286
+ function oc(r) {
2287
+ return me(r) && Ht(r.length) && !!k[ge(r)];
2266
2288
  }
2267
- function nc(r) {
2289
+ function ac(r) {
2268
2290
  return function(e) {
2269
2291
  return r(e);
2270
2292
  };
2271
2293
  }
2272
- var is = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = is && typeof module == "object" && module && !module.nodeType && module, oc = Ee && Ee.exports === is, ut = oc && Wi.process, Hr = function() {
2294
+ var os = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = os && typeof module == "object" && module && !module.nodeType && module, cc = Ee && Ee.exports === os, ht = cc && Ji.process, Wr = function() {
2273
2295
  try {
2274
2296
  var r = Ee && Ee.require && Ee.require("util").types;
2275
- return r || ut && ut.binding && ut.binding("util");
2297
+ return r || ht && ht.binding && ht.binding("util");
2276
2298
  } catch {
2277
2299
  }
2278
- }(), qr = Hr && Hr.isTypedArray, ss = qr ? nc(qr) : sc, ac = Object.prototype, cc = ac.hasOwnProperty;
2279
- function dc(r, e) {
2280
- var t = M(r), i = !t && ts(r), s = !t && !i && kt(r), n = !t && !i && !s && ss(r), a = t || i || s || n, o = a ? xa(r.length, String) : [], u = o.length;
2300
+ }(), Xr = Wr && Wr.isTypedArray, as = Xr ? ac(Xr) : oc, dc = Object.prototype, uc = dc.hasOwnProperty;
2301
+ function hc(r, e) {
2302
+ var t = M(r), i = !t && ss(r), s = !t && !i && Pt(r), n = !t && !i && !s && as(r), a = t || i || s || n, o = a ? Aa(r.length, String) : [], u = o.length;
2281
2303
  for (var d in r)
2282
- cc.call(r, d) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
2304
+ uc.call(r, d) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
2283
2305
  (d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2284
2306
  s && (d == "offset" || d == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2285
2307
  n && (d == "buffer" || d == "byteLength" || d == "byteOffset") || // Skip index properties.
2286
- Zi(d, u))) && o.push(d);
2308
+ ts(d, u))) && o.push(d);
2287
2309
  return o;
2288
2310
  }
2289
- function uc(r, e) {
2311
+ function pc(r, e) {
2290
2312
  return function(t) {
2291
2313
  return r(e(t));
2292
2314
  };
2293
2315
  }
2294
- var hc = uc(Object.keys, Object), pc = Object.prototype, lc = pc.hasOwnProperty;
2295
- function mc(r) {
2296
- if (!Pa(r))
2297
- return hc(r);
2316
+ var lc = pc(Object.keys, Object), mc = Object.prototype, fc = mc.hasOwnProperty;
2317
+ function _c(r) {
2318
+ if (!Ra(r))
2319
+ return lc(r);
2298
2320
  var e = [];
2299
2321
  for (var t in Object(r))
2300
- lc.call(r, t) && t != "constructor" && e.push(t);
2322
+ fc.call(r, t) && t != "constructor" && e.push(t);
2301
2323
  return e;
2302
2324
  }
2303
2325
  function Ae(r) {
2304
- return Ht(r) ? dc(r) : mc(r);
2326
+ return qt(r) ? hc(r) : _c(r);
2305
2327
  }
2306
- var fc = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, _c = /^\w*$/;
2307
- function qt(r, e) {
2328
+ var gc = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, vc = /^\w*$/;
2329
+ function Wt(r, e) {
2308
2330
  if (M(r))
2309
2331
  return !1;
2310
2332
  var t = typeof r;
2311
- return t == "number" || t == "symbol" || t == "boolean" || r == null || Ye(r) ? !0 : _c.test(r) || !fc.test(r) || e != null && r in Object(e);
2333
+ return t == "number" || t == "symbol" || t == "boolean" || r == null || Ye(r) ? !0 : vc.test(r) || !gc.test(r) || e != null && r in Object(e);
2312
2334
  }
2313
2335
  var Pe = ve(Object, "create");
2314
- function gc() {
2336
+ function Cc() {
2315
2337
  this.__data__ = Pe ? Pe(null) : {}, this.size = 0;
2316
2338
  }
2317
- function vc(r) {
2339
+ function yc(r) {
2318
2340
  var e = this.has(r) && delete this.__data__[r];
2319
2341
  return this.size -= e ? 1 : 0, e;
2320
2342
  }
2321
- var Cc = "__lodash_hash_undefined__", yc = Object.prototype, Sc = yc.hasOwnProperty;
2322
- function Tc(r) {
2343
+ var Sc = "__lodash_hash_undefined__", Tc = Object.prototype, Ec = Tc.hasOwnProperty;
2344
+ function bc(r) {
2323
2345
  var e = this.__data__;
2324
2346
  if (Pe) {
2325
2347
  var t = e[r];
2326
- return t === Cc ? void 0 : t;
2348
+ return t === Sc ? void 0 : t;
2327
2349
  }
2328
- return Sc.call(e, r) ? e[r] : void 0;
2350
+ return Ec.call(e, r) ? e[r] : void 0;
2329
2351
  }
2330
- var Ec = Object.prototype, bc = Ec.hasOwnProperty;
2331
- function kc(r) {
2352
+ var kc = Object.prototype, Pc = kc.hasOwnProperty;
2353
+ function xc(r) {
2332
2354
  var e = this.__data__;
2333
- return Pe ? e[r] !== void 0 : bc.call(e, r);
2355
+ return Pe ? e[r] !== void 0 : Pc.call(e, r);
2334
2356
  }
2335
- var Pc = "__lodash_hash_undefined__";
2336
- function xc(r, e) {
2357
+ var Rc = "__lodash_hash_undefined__";
2358
+ function Ac(r, e) {
2337
2359
  var t = this.__data__;
2338
- return this.size += this.has(r) ? 0 : 1, t[r] = Pe && e === void 0 ? Pc : e, this;
2360
+ return this.size += this.has(r) ? 0 : 1, t[r] = Pe && e === void 0 ? Rc : e, this;
2339
2361
  }
2340
2362
  function ne(r) {
2341
2363
  var e = -1, t = r == null ? 0 : r.length;
@@ -2344,36 +2366,36 @@ function ne(r) {
2344
2366
  this.set(i[0], i[1]);
2345
2367
  }
2346
2368
  }
2347
- ne.prototype.clear = gc;
2348
- ne.prototype.delete = vc;
2349
- ne.prototype.get = Tc;
2350
- ne.prototype.has = kc;
2351
- ne.prototype.set = xc;
2352
- function Rc() {
2369
+ ne.prototype.clear = Cc;
2370
+ ne.prototype.delete = yc;
2371
+ ne.prototype.get = bc;
2372
+ ne.prototype.has = xc;
2373
+ ne.prototype.set = Ac;
2374
+ function wc() {
2353
2375
  this.__data__ = [], this.size = 0;
2354
2376
  }
2355
2377
  function Ze(r, e) {
2356
2378
  for (var t = r.length; t--; )
2357
- if (Qi(r[t][0], e))
2379
+ if (rs(r[t][0], e))
2358
2380
  return t;
2359
2381
  return -1;
2360
2382
  }
2361
- var Ac = Array.prototype, wc = Ac.splice;
2362
- function Oc(r) {
2383
+ var Oc = Array.prototype, Dc = Oc.splice;
2384
+ function Ic(r) {
2363
2385
  var e = this.__data__, t = Ze(e, r);
2364
2386
  if (t < 0)
2365
2387
  return !1;
2366
2388
  var i = e.length - 1;
2367
- return t == i ? e.pop() : wc.call(e, t, 1), --this.size, !0;
2389
+ return t == i ? e.pop() : Dc.call(e, t, 1), --this.size, !0;
2368
2390
  }
2369
- function Ic(r) {
2391
+ function Mc(r) {
2370
2392
  var e = this.__data__, t = Ze(e, r);
2371
2393
  return t < 0 ? void 0 : e[t][1];
2372
2394
  }
2373
- function Dc(r) {
2395
+ function Lc(r) {
2374
2396
  return Ze(this.__data__, r) > -1;
2375
2397
  }
2376
- function Mc(r, e) {
2398
+ function Fc(r, e) {
2377
2399
  var t = this.__data__, i = Ze(t, r);
2378
2400
  return i < 0 ? (++this.size, t.push([r, e])) : t[i][1] = e, this;
2379
2401
  }
@@ -2384,38 +2406,38 @@ function X(r) {
2384
2406
  this.set(i[0], i[1]);
2385
2407
  }
2386
2408
  }
2387
- X.prototype.clear = Rc;
2388
- X.prototype.delete = Oc;
2389
- X.prototype.get = Ic;
2390
- X.prototype.has = Dc;
2391
- X.prototype.set = Mc;
2409
+ X.prototype.clear = wc;
2410
+ X.prototype.delete = Ic;
2411
+ X.prototype.get = Mc;
2412
+ X.prototype.has = Lc;
2413
+ X.prototype.set = Fc;
2392
2414
  var xe = ve(W, "Map");
2393
- function Lc() {
2415
+ function Nc() {
2394
2416
  this.size = 0, this.__data__ = {
2395
2417
  hash: new ne(),
2396
2418
  map: new (xe || X)(),
2397
2419
  string: new ne()
2398
2420
  };
2399
2421
  }
2400
- function Fc(r) {
2422
+ function Vc(r) {
2401
2423
  var e = typeof r;
2402
2424
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? r !== "__proto__" : r === null;
2403
2425
  }
2404
2426
  function Qe(r, e) {
2405
2427
  var t = r.__data__;
2406
- return Fc(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
2428
+ return Vc(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
2407
2429
  }
2408
- function Nc(r) {
2430
+ function Uc(r) {
2409
2431
  var e = Qe(this, r).delete(r);
2410
2432
  return this.size -= e ? 1 : 0, e;
2411
2433
  }
2412
- function Vc(r) {
2434
+ function $c(r) {
2413
2435
  return Qe(this, r).get(r);
2414
2436
  }
2415
- function Uc(r) {
2437
+ function Bc(r) {
2416
2438
  return Qe(this, r).has(r);
2417
2439
  }
2418
- function $c(r, e) {
2440
+ function jc(r, e) {
2419
2441
  var t = Qe(this, r), i = t.size;
2420
2442
  return t.set(r, e), this.size += t.size == i ? 0 : 1, this;
2421
2443
  }
@@ -2426,15 +2448,15 @@ function K(r) {
2426
2448
  this.set(i[0], i[1]);
2427
2449
  }
2428
2450
  }
2429
- K.prototype.clear = Lc;
2430
- K.prototype.delete = Nc;
2431
- K.prototype.get = Vc;
2432
- K.prototype.has = Uc;
2433
- K.prototype.set = $c;
2434
- var Bc = "Expected a function";
2435
- function Wt(r, e) {
2451
+ K.prototype.clear = Nc;
2452
+ K.prototype.delete = Uc;
2453
+ K.prototype.get = $c;
2454
+ K.prototype.has = Bc;
2455
+ K.prototype.set = jc;
2456
+ var zc = "Expected a function";
2457
+ function Xt(r, e) {
2436
2458
  if (typeof r != "function" || e != null && typeof e != "function")
2437
- throw new TypeError(Bc);
2459
+ throw new TypeError(zc);
2438
2460
  var t = function() {
2439
2461
  var i = arguments, s = e ? e.apply(this, i) : i[0], n = t.cache;
2440
2462
  if (n.has(s))
@@ -2442,27 +2464,27 @@ function Wt(r, e) {
2442
2464
  var a = r.apply(this, i);
2443
2465
  return t.cache = n.set(s, a) || n, a;
2444
2466
  };
2445
- return t.cache = new (Wt.Cache || K)(), t;
2467
+ return t.cache = new (Xt.Cache || K)(), t;
2446
2468
  }
2447
- Wt.Cache = K;
2448
- var jc = 500;
2449
- function zc(r) {
2450
- var e = Wt(r, function(i) {
2451
- return t.size === jc && t.clear(), i;
2469
+ Xt.Cache = K;
2470
+ var Gc = 500;
2471
+ function Hc(r) {
2472
+ var e = Xt(r, function(i) {
2473
+ return t.size === Gc && t.clear(), i;
2452
2474
  }), t = e.cache;
2453
2475
  return e;
2454
2476
  }
2455
- var Gc = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Hc = /\\(\\)?/g, qc = zc(function(r) {
2477
+ var qc = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Wc = /\\(\\)?/g, Xc = Hc(function(r) {
2456
2478
  var e = [];
2457
- return r.charCodeAt(0) === 46 && e.push(""), r.replace(Gc, function(t, i, s, n) {
2458
- e.push(s ? n.replace(Hc, "$1") : i || t);
2479
+ return r.charCodeAt(0) === 46 && e.push(""), r.replace(qc, function(t, i, s, n) {
2480
+ e.push(s ? n.replace(Wc, "$1") : i || t);
2459
2481
  }), e;
2460
2482
  });
2461
- function Wc(r) {
2462
- return r == null ? "" : Ji(r);
2483
+ function Kc(r) {
2484
+ return r == null ? "" : Qi(r);
2463
2485
  }
2464
- function ns(r, e) {
2465
- return M(r) ? r : qt(r, e) ? [r] : qc(Wc(r));
2486
+ function cs(r, e) {
2487
+ return M(r) ? r : Wt(r, e) ? [r] : Xc(Kc(r));
2466
2488
  }
2467
2489
  function et(r) {
2468
2490
  if (typeof r == "string" || Ye(r))
@@ -2470,40 +2492,40 @@ function et(r) {
2470
2492
  var e = r + "";
2471
2493
  return e == "0" && 1 / r == -1 / 0 ? "-0" : e;
2472
2494
  }
2473
- function os(r, e) {
2474
- e = ns(e, r);
2495
+ function ds(r, e) {
2496
+ e = cs(e, r);
2475
2497
  for (var t = 0, i = e.length; r != null && t < i; )
2476
2498
  r = r[et(e[t++])];
2477
2499
  return t && t == i ? r : void 0;
2478
2500
  }
2479
- function Xc(r, e, t) {
2480
- var i = r == null ? void 0 : os(r, e);
2501
+ function Jc(r, e, t) {
2502
+ var i = r == null ? void 0 : ds(r, e);
2481
2503
  return i === void 0 ? t : i;
2482
2504
  }
2483
- function Kc(r, e) {
2505
+ function Yc(r, e) {
2484
2506
  for (var t = -1, i = e.length, s = r.length; ++t < i; )
2485
2507
  r[s + t] = e[t];
2486
2508
  return r;
2487
2509
  }
2488
- function Jc() {
2510
+ function Zc() {
2489
2511
  this.__data__ = new X(), this.size = 0;
2490
2512
  }
2491
- function Yc(r) {
2513
+ function Qc(r) {
2492
2514
  var e = this.__data__, t = e.delete(r);
2493
2515
  return this.size = e.size, t;
2494
2516
  }
2495
- function Zc(r) {
2517
+ function ed(r) {
2496
2518
  return this.__data__.get(r);
2497
2519
  }
2498
- function Qc(r) {
2520
+ function td(r) {
2499
2521
  return this.__data__.has(r);
2500
2522
  }
2501
- var ed = 200;
2502
- function td(r, e) {
2523
+ var rd = 200;
2524
+ function id(r, e) {
2503
2525
  var t = this.__data__;
2504
2526
  if (t instanceof X) {
2505
2527
  var i = t.__data__;
2506
- if (!xe || i.length < ed - 1)
2528
+ if (!xe || i.length < rd - 1)
2507
2529
  return i.push([r, e]), this.size = ++t.size, this;
2508
2530
  t = this.__data__ = new K(i);
2509
2531
  }
@@ -2513,56 +2535,56 @@ function H(r) {
2513
2535
  var e = this.__data__ = new X(r);
2514
2536
  this.size = e.size;
2515
2537
  }
2516
- H.prototype.clear = Jc;
2517
- H.prototype.delete = Yc;
2518
- H.prototype.get = Zc;
2519
- H.prototype.has = Qc;
2520
- H.prototype.set = td;
2521
- function as(r, e) {
2538
+ H.prototype.clear = Zc;
2539
+ H.prototype.delete = Qc;
2540
+ H.prototype.get = ed;
2541
+ H.prototype.has = td;
2542
+ H.prototype.set = id;
2543
+ function us(r, e) {
2522
2544
  for (var t = -1, i = r == null ? 0 : r.length, s = 0, n = []; ++t < i; ) {
2523
2545
  var a = r[t];
2524
2546
  e(a, t, r) && (n[s++] = a);
2525
2547
  }
2526
2548
  return n;
2527
2549
  }
2528
- function rd() {
2550
+ function sd() {
2529
2551
  return [];
2530
2552
  }
2531
- var id = Object.prototype, sd = id.propertyIsEnumerable, Wr = Object.getOwnPropertySymbols, nd = Wr ? function(r) {
2532
- return r == null ? [] : (r = Object(r), as(Wr(r), function(e) {
2533
- return sd.call(r, e);
2553
+ var nd = Object.prototype, od = nd.propertyIsEnumerable, Kr = Object.getOwnPropertySymbols, ad = Kr ? function(r) {
2554
+ return r == null ? [] : (r = Object(r), us(Kr(r), function(e) {
2555
+ return od.call(r, e);
2534
2556
  }));
2535
- } : rd;
2536
- function od(r, e, t) {
2557
+ } : sd;
2558
+ function cd(r, e, t) {
2537
2559
  var i = e(r);
2538
- return M(r) ? i : Kc(i, t(r));
2560
+ return M(r) ? i : Yc(i, t(r));
2539
2561
  }
2540
- function Xr(r) {
2541
- return od(r, Ae, nd);
2562
+ function Jr(r) {
2563
+ return cd(r, Ae, ad);
2542
2564
  }
2543
- var Pt = ve(W, "DataView"), xt = ve(W, "Promise"), Rt = ve(W, "Set"), Kr = "[object Map]", ad = "[object Object]", Jr = "[object Promise]", Yr = "[object Set]", Zr = "[object WeakMap]", Qr = "[object DataView]", cd = ae(Pt), dd = ae(xe), ud = ae(xt), hd = ae(Rt), pd = ae(bt), J = ge;
2544
- (Pt && J(new Pt(new ArrayBuffer(1))) != Qr || xe && J(new xe()) != Kr || xt && J(xt.resolve()) != Jr || Rt && J(new Rt()) != Yr || bt && J(new bt()) != Zr) && (J = function(r) {
2545
- var e = ge(r), t = e == ad ? r.constructor : void 0, i = t ? ae(t) : "";
2565
+ var xt = ve(W, "DataView"), Rt = ve(W, "Promise"), At = ve(W, "Set"), Yr = "[object Map]", dd = "[object Object]", Zr = "[object Promise]", Qr = "[object Set]", ei = "[object WeakMap]", ti = "[object DataView]", ud = ae(xt), hd = ae(xe), pd = ae(Rt), ld = ae(At), md = ae(kt), J = ge;
2566
+ (xt && J(new xt(new ArrayBuffer(1))) != ti || xe && J(new xe()) != Yr || Rt && J(Rt.resolve()) != Zr || At && J(new At()) != Qr || kt && J(new kt()) != ei) && (J = function(r) {
2567
+ var e = ge(r), t = e == dd ? r.constructor : void 0, i = t ? ae(t) : "";
2546
2568
  if (i)
2547
2569
  switch (i) {
2548
- case cd:
2549
- return Qr;
2550
- case dd:
2551
- return Kr;
2552
2570
  case ud:
2553
- return Jr;
2571
+ return ti;
2554
2572
  case hd:
2555
2573
  return Yr;
2556
2574
  case pd:
2557
2575
  return Zr;
2576
+ case ld:
2577
+ return Qr;
2578
+ case md:
2579
+ return ei;
2558
2580
  }
2559
2581
  return e;
2560
2582
  });
2561
- var ei = W.Uint8Array, ld = "__lodash_hash_undefined__";
2562
- function md(r) {
2563
- return this.__data__.set(r, ld), this;
2583
+ var ri = W.Uint8Array, fd = "__lodash_hash_undefined__";
2584
+ function _d(r) {
2585
+ return this.__data__.set(r, fd), this;
2564
2586
  }
2565
- function fd(r) {
2587
+ function gd(r) {
2566
2588
  return this.__data__.has(r);
2567
2589
  }
2568
2590
  function je(r) {
@@ -2570,26 +2592,26 @@ function je(r) {
2570
2592
  for (this.__data__ = new K(); ++e < t; )
2571
2593
  this.add(r[e]);
2572
2594
  }
2573
- je.prototype.add = je.prototype.push = md;
2574
- je.prototype.has = fd;
2575
- function _d(r, e) {
2595
+ je.prototype.add = je.prototype.push = _d;
2596
+ je.prototype.has = gd;
2597
+ function vd(r, e) {
2576
2598
  for (var t = -1, i = r == null ? 0 : r.length; ++t < i; )
2577
2599
  if (e(r[t], t, r))
2578
2600
  return !0;
2579
2601
  return !1;
2580
2602
  }
2581
- function gd(r, e) {
2603
+ function Cd(r, e) {
2582
2604
  return r.has(e);
2583
2605
  }
2584
- var vd = 1, Cd = 2;
2585
- function cs(r, e, t, i, s, n) {
2586
- var a = t & vd, o = r.length, u = e.length;
2606
+ var yd = 1, Sd = 2;
2607
+ function hs(r, e, t, i, s, n) {
2608
+ var a = t & yd, o = r.length, u = e.length;
2587
2609
  if (o != u && !(a && u > o))
2588
2610
  return !1;
2589
2611
  var d = n.get(r), c = n.get(e);
2590
2612
  if (d && c)
2591
2613
  return d == e && c == r;
2592
- var h = -1, p = !0, l = t & Cd ? new je() : void 0;
2614
+ var h = -1, p = !0, l = t & Sd ? new je() : void 0;
2593
2615
  for (n.set(r, e), n.set(e, r); ++h < o; ) {
2594
2616
  var f = r[h], g = e[h];
2595
2617
  if (i)
@@ -2601,8 +2623,8 @@ function cs(r, e, t, i, s, n) {
2601
2623
  break;
2602
2624
  }
2603
2625
  if (l) {
2604
- if (!_d(e, function(T, b) {
2605
- if (!gd(l, b) && (f === T || s(f, T, t, i, n)))
2626
+ if (!vd(e, function(T, b) {
2627
+ if (!Cd(l, b) && (f === T || s(f, T, t, i, n)))
2606
2628
  return l.push(b);
2607
2629
  })) {
2608
2630
  p = !1;
@@ -2615,62 +2637,62 @@ function cs(r, e, t, i, s, n) {
2615
2637
  }
2616
2638
  return n.delete(r), n.delete(e), p;
2617
2639
  }
2618
- function yd(r) {
2640
+ function Td(r) {
2619
2641
  var e = -1, t = Array(r.size);
2620
2642
  return r.forEach(function(i, s) {
2621
2643
  t[++e] = [s, i];
2622
2644
  }), t;
2623
2645
  }
2624
- function Sd(r) {
2646
+ function Ed(r) {
2625
2647
  var e = -1, t = Array(r.size);
2626
2648
  return r.forEach(function(i) {
2627
2649
  t[++e] = i;
2628
2650
  }), t;
2629
2651
  }
2630
- var Td = 1, Ed = 2, bd = "[object Boolean]", kd = "[object Date]", Pd = "[object Error]", xd = "[object Map]", Rd = "[object Number]", Ad = "[object RegExp]", wd = "[object Set]", Od = "[object String]", Id = "[object Symbol]", Dd = "[object ArrayBuffer]", Md = "[object DataView]", ti = Q ? Q.prototype : void 0, ht = ti ? ti.valueOf : void 0;
2631
- function Ld(r, e, t, i, s, n, a) {
2652
+ var bd = 1, kd = 2, Pd = "[object Boolean]", xd = "[object Date]", Rd = "[object Error]", Ad = "[object Map]", wd = "[object Number]", Od = "[object RegExp]", Dd = "[object Set]", Id = "[object String]", Md = "[object Symbol]", Ld = "[object ArrayBuffer]", Fd = "[object DataView]", ii = Q ? Q.prototype : void 0, pt = ii ? ii.valueOf : void 0;
2653
+ function Nd(r, e, t, i, s, n, a) {
2632
2654
  switch (t) {
2633
- case Md:
2655
+ case Fd:
2634
2656
  if (r.byteLength != e.byteLength || r.byteOffset != e.byteOffset)
2635
2657
  return !1;
2636
2658
  r = r.buffer, e = e.buffer;
2637
- case Dd:
2638
- return !(r.byteLength != e.byteLength || !n(new ei(r), new ei(e)));
2639
- case bd:
2640
- case kd:
2641
- case Rd:
2642
- return Qi(+r, +e);
2659
+ case Ld:
2660
+ return !(r.byteLength != e.byteLength || !n(new ri(r), new ri(e)));
2643
2661
  case Pd:
2662
+ case xd:
2663
+ case wd:
2664
+ return rs(+r, +e);
2665
+ case Rd:
2644
2666
  return r.name == e.name && r.message == e.message;
2645
- case Ad:
2646
2667
  case Od:
2668
+ case Id:
2647
2669
  return r == e + "";
2648
- case xd:
2649
- var o = yd;
2650
- case wd:
2651
- var u = i & Td;
2652
- if (o || (o = Sd), r.size != e.size && !u)
2670
+ case Ad:
2671
+ var o = Td;
2672
+ case Dd:
2673
+ var u = i & bd;
2674
+ if (o || (o = Ed), r.size != e.size && !u)
2653
2675
  return !1;
2654
2676
  var d = a.get(r);
2655
2677
  if (d)
2656
2678
  return d == e;
2657
- i |= Ed, a.set(r, e);
2658
- var c = cs(o(r), o(e), i, s, n, a);
2679
+ i |= kd, a.set(r, e);
2680
+ var c = hs(o(r), o(e), i, s, n, a);
2659
2681
  return a.delete(r), c;
2660
- case Id:
2661
- if (ht)
2662
- return ht.call(r) == ht.call(e);
2682
+ case Md:
2683
+ if (pt)
2684
+ return pt.call(r) == pt.call(e);
2663
2685
  }
2664
2686
  return !1;
2665
2687
  }
2666
- var Fd = 1, Nd = Object.prototype, Vd = Nd.hasOwnProperty;
2667
- function Ud(r, e, t, i, s, n) {
2668
- var a = t & Fd, o = Xr(r), u = o.length, d = Xr(e), c = d.length;
2688
+ var Vd = 1, Ud = Object.prototype, $d = Ud.hasOwnProperty;
2689
+ function Bd(r, e, t, i, s, n) {
2690
+ var a = t & Vd, o = Jr(r), u = o.length, d = Jr(e), c = d.length;
2669
2691
  if (u != c && !a)
2670
2692
  return !1;
2671
2693
  for (var h = u; h--; ) {
2672
2694
  var p = o[h];
2673
- if (!(a ? p in e : Vd.call(e, p)))
2695
+ if (!(a ? p in e : $d.call(e, p)))
2674
2696
  return !1;
2675
2697
  }
2676
2698
  var l = n.get(r), f = n.get(e);
@@ -2695,32 +2717,32 @@ function Ud(r, e, t, i, s, n) {
2695
2717
  }
2696
2718
  return n.delete(r), n.delete(e), g;
2697
2719
  }
2698
- var $d = 1, ri = "[object Arguments]", ii = "[object Array]", De = "[object Object]", Bd = Object.prototype, si = Bd.hasOwnProperty;
2699
- function jd(r, e, t, i, s, n) {
2700
- var a = M(r), o = M(e), u = a ? ii : J(r), d = o ? ii : J(e);
2701
- u = u == ri ? De : u, d = d == ri ? De : d;
2702
- var c = u == De, h = d == De, p = u == d;
2703
- if (p && kt(r)) {
2704
- if (!kt(e))
2720
+ var jd = 1, si = "[object Arguments]", ni = "[object Array]", Ie = "[object Object]", zd = Object.prototype, oi = zd.hasOwnProperty;
2721
+ function Gd(r, e, t, i, s, n) {
2722
+ var a = M(r), o = M(e), u = a ? ni : J(r), d = o ? ni : J(e);
2723
+ u = u == si ? Ie : u, d = d == si ? Ie : d;
2724
+ var c = u == Ie, h = d == Ie, p = u == d;
2725
+ if (p && Pt(r)) {
2726
+ if (!Pt(e))
2705
2727
  return !1;
2706
2728
  a = !0, c = !1;
2707
2729
  }
2708
2730
  if (p && !c)
2709
- return n || (n = new H()), a || ss(r) ? cs(r, e, t, i, s, n) : Ld(r, e, u, t, i, s, n);
2710
- if (!(t & $d)) {
2711
- var l = c && si.call(r, "__wrapped__"), f = h && si.call(e, "__wrapped__");
2731
+ return n || (n = new H()), a || as(r) ? hs(r, e, t, i, s, n) : Nd(r, e, u, t, i, s, n);
2732
+ if (!(t & jd)) {
2733
+ var l = c && oi.call(r, "__wrapped__"), f = h && oi.call(e, "__wrapped__");
2712
2734
  if (l || f) {
2713
2735
  var g = l ? r.value() : r, _ = f ? e.value() : e;
2714
2736
  return n || (n = new H()), s(g, _, t, i, n);
2715
2737
  }
2716
2738
  }
2717
- return p ? (n || (n = new H()), Ud(r, e, t, i, s, n)) : !1;
2739
+ return p ? (n || (n = new H()), Bd(r, e, t, i, s, n)) : !1;
2718
2740
  }
2719
- function Xt(r, e, t, i, s) {
2720
- return r === e ? !0 : r == null || e == null || !me(r) && !me(e) ? r !== r && e !== e : jd(r, e, t, i, Xt, s);
2741
+ function Kt(r, e, t, i, s) {
2742
+ return r === e ? !0 : r == null || e == null || !me(r) && !me(e) ? r !== r && e !== e : Gd(r, e, t, i, Kt, s);
2721
2743
  }
2722
- var zd = 1, Gd = 2;
2723
- function Hd(r, e, t, i) {
2744
+ var Hd = 1, qd = 2;
2745
+ function Wd(r, e, t, i) {
2724
2746
  var s = t.length, n = s;
2725
2747
  if (r == null)
2726
2748
  return !n;
@@ -2737,73 +2759,73 @@ function Hd(r, e, t, i) {
2737
2759
  return !1;
2738
2760
  } else {
2739
2761
  var c = new H(), h;
2740
- if (!(h === void 0 ? Xt(d, u, zd | Gd, i, c) : h))
2762
+ if (!(h === void 0 ? Kt(d, u, Hd | qd, i, c) : h))
2741
2763
  return !1;
2742
2764
  }
2743
2765
  }
2744
2766
  return !0;
2745
2767
  }
2746
- function ds(r) {
2768
+ function ps(r) {
2747
2769
  return r === r && !ke(r);
2748
2770
  }
2749
- function qd(r) {
2771
+ function Xd(r) {
2750
2772
  for (var e = Ae(r), t = e.length; t--; ) {
2751
2773
  var i = e[t], s = r[i];
2752
- e[t] = [i, s, ds(s)];
2774
+ e[t] = [i, s, ps(s)];
2753
2775
  }
2754
2776
  return e;
2755
2777
  }
2756
- function us(r, e) {
2778
+ function ls(r, e) {
2757
2779
  return function(t) {
2758
2780
  return t == null ? !1 : t[r] === e && (e !== void 0 || r in Object(t));
2759
2781
  };
2760
2782
  }
2761
- function Wd(r) {
2762
- var e = qd(r);
2763
- return e.length == 1 && e[0][2] ? us(e[0][0], e[0][1]) : function(t) {
2764
- return t === r || Hd(t, r, e);
2783
+ function Kd(r) {
2784
+ var e = Xd(r);
2785
+ return e.length == 1 && e[0][2] ? ls(e[0][0], e[0][1]) : function(t) {
2786
+ return t === r || Wd(t, r, e);
2765
2787
  };
2766
2788
  }
2767
- function Xd(r, e) {
2789
+ function Jd(r, e) {
2768
2790
  return r != null && e in Object(r);
2769
2791
  }
2770
- function Kd(r, e, t) {
2771
- e = ns(e, r);
2792
+ function Yd(r, e, t) {
2793
+ e = cs(e, r);
2772
2794
  for (var i = -1, s = e.length, n = !1; ++i < s; ) {
2773
2795
  var a = et(e[i]);
2774
2796
  if (!(n = r != null && t(r, a)))
2775
2797
  break;
2776
2798
  r = r[a];
2777
2799
  }
2778
- return n || ++i != s ? n : (s = r == null ? 0 : r.length, !!s && Gt(s) && Zi(a, s) && (M(r) || ts(r)));
2800
+ return n || ++i != s ? n : (s = r == null ? 0 : r.length, !!s && Ht(s) && ts(a, s) && (M(r) || ss(r)));
2779
2801
  }
2780
- function Jd(r, e) {
2781
- return r != null && Kd(r, e, Xd);
2802
+ function Zd(r, e) {
2803
+ return r != null && Yd(r, e, Jd);
2782
2804
  }
2783
- var Yd = 1, Zd = 2;
2784
- function Qd(r, e) {
2785
- return qt(r) && ds(e) ? us(et(r), e) : function(t) {
2786
- var i = Xc(t, r);
2787
- return i === void 0 && i === e ? Jd(t, r) : Xt(e, i, Yd | Zd);
2805
+ var Qd = 1, eu = 2;
2806
+ function tu(r, e) {
2807
+ return Wt(r) && ps(e) ? ls(et(r), e) : function(t) {
2808
+ var i = Jc(t, r);
2809
+ return i === void 0 && i === e ? Zd(t, r) : Kt(e, i, Qd | eu);
2788
2810
  };
2789
2811
  }
2790
- function eu(r) {
2812
+ function ru(r) {
2791
2813
  return function(e) {
2792
2814
  return e == null ? void 0 : e[r];
2793
2815
  };
2794
2816
  }
2795
- function tu(r) {
2817
+ function iu(r) {
2796
2818
  return function(e) {
2797
- return os(e, r);
2819
+ return ds(e, r);
2798
2820
  };
2799
2821
  }
2800
- function ru(r) {
2801
- return qt(r) ? eu(et(r)) : tu(r);
2822
+ function su(r) {
2823
+ return Wt(r) ? ru(et(r)) : iu(r);
2802
2824
  }
2803
- function Kt(r) {
2804
- return typeof r == "function" ? r : r == null ? sa : typeof r == "object" ? M(r) ? Qd(r[0], r[1]) : Wd(r) : ru(r);
2825
+ function Jt(r) {
2826
+ return typeof r == "function" ? r : r == null ? oa : typeof r == "object" ? M(r) ? tu(r[0], r[1]) : Kd(r) : su(r);
2805
2827
  }
2806
- function iu(r) {
2828
+ function nu(r) {
2807
2829
  return function(e, t, i) {
2808
2830
  for (var s = -1, n = Object(e), a = i(e), o = a.length; o--; ) {
2809
2831
  var u = a[++s];
@@ -2813,37 +2835,37 @@ function iu(r) {
2813
2835
  return e;
2814
2836
  };
2815
2837
  }
2816
- var su = iu();
2817
- function nu(r, e) {
2818
- return r && su(r, e, Ae);
2838
+ var ou = nu();
2839
+ function au(r, e) {
2840
+ return r && ou(r, e, Ae);
2819
2841
  }
2820
- function ou(r, e) {
2842
+ function cu(r, e) {
2821
2843
  return function(t, i) {
2822
2844
  if (t == null)
2823
2845
  return t;
2824
- if (!Ht(t))
2846
+ if (!qt(t))
2825
2847
  return r(t, i);
2826
2848
  for (var s = t.length, n = -1, a = Object(t); ++n < s && i(a[n], n, a) !== !1; )
2827
2849
  ;
2828
2850
  return t;
2829
2851
  };
2830
2852
  }
2831
- var au = ou(nu);
2832
- function cu(r, e) {
2853
+ var du = cu(au);
2854
+ function uu(r, e) {
2833
2855
  var t = [];
2834
- return au(r, function(i, s, n) {
2856
+ return du(r, function(i, s, n) {
2835
2857
  e(i, s, n) && t.push(i);
2836
2858
  }), t;
2837
2859
  }
2838
- function hs(r, e) {
2839
- var t = M(r) ? as : cu;
2840
- return t(r, Kt(e));
2860
+ function ms(r, e) {
2861
+ var t = M(r) ? us : uu;
2862
+ return t(r, Jt(e));
2841
2863
  }
2842
- function du(r) {
2864
+ function hu(r) {
2843
2865
  return function(e, t, i) {
2844
2866
  var s = Object(e);
2845
- if (!Ht(e)) {
2846
- var n = Kt(t);
2867
+ if (!qt(e)) {
2868
+ var n = Jt(t);
2847
2869
  e = Ae(e), t = function(o) {
2848
2870
  return n(s[o], o, s);
2849
2871
  };
@@ -2852,27 +2874,27 @@ function du(r) {
2852
2874
  return a > -1 ? s[n ? e[a] : a] : void 0;
2853
2875
  };
2854
2876
  }
2855
- var uu = Math.max;
2856
- function hu(r, e, t) {
2877
+ var pu = Math.max;
2878
+ function lu(r, e, t) {
2857
2879
  var i = r == null ? 0 : r.length;
2858
2880
  if (!i)
2859
2881
  return -1;
2860
- var s = t == null ? 0 : ia(t);
2861
- return s < 0 && (s = uu(i + s, 0)), Sa(r, Kt(e), s);
2882
+ var s = t == null ? 0 : na(t);
2883
+ return s < 0 && (s = pu(i + s, 0)), Ea(r, Jt(e), s);
2862
2884
  }
2863
- var Re = du(hu);
2864
- function pu(r, e) {
2865
- return Ki(e, function(t) {
2885
+ var Re = hu(lu);
2886
+ function mu(r, e) {
2887
+ return Zi(e, function(t) {
2866
2888
  return r[t];
2867
2889
  });
2868
2890
  }
2869
2891
  function ue(r) {
2870
- return r == null ? [] : pu(r, Ae(r));
2892
+ return r == null ? [] : mu(r, Ae(r));
2871
2893
  }
2872
- function lu(r) {
2894
+ function fu(r) {
2873
2895
  return r == null;
2874
2896
  }
2875
- class mu extends Je {
2897
+ class _u extends Je {
2876
2898
  constructor(e) {
2877
2899
  super({
2878
2900
  type: S.Microphone,
@@ -2886,13 +2908,13 @@ class mu extends Je {
2886
2908
  return this.source.node();
2887
2909
  }
2888
2910
  bindTrackEnd(e) {
2889
- this.source.on(I.ENDED, e);
2911
+ this.source.on(D.ENDED, e);
2890
2912
  }
2891
2913
  destroy() {
2892
2914
  this.source.destroy();
2893
2915
  }
2894
2916
  }
2895
- class fu extends _e {
2917
+ class gu extends _e {
2896
2918
  constructor(e) {
2897
2919
  super({
2898
2920
  type: S.VideoFile,
@@ -2917,14 +2939,14 @@ class fu extends _e {
2917
2939
  }
2918
2940
  bindTrackEnd(e) {
2919
2941
  var t;
2920
- (t = this._videoStream) == null || t.on(I.ENDED, e);
2942
+ (t = this._videoStream) == null || t.on(D.ENDED, e);
2921
2943
  }
2922
2944
  destroy() {
2923
2945
  var e, t;
2924
2946
  (e = this._videoStream) == null || e.destroy(), (t = this._audioStream) == null || t.destroy(), delete this._trackMap.video, delete this._trackMap.audio;
2925
2947
  }
2926
2948
  }
2927
- class _u extends _e {
2949
+ class vu extends _e {
2928
2950
  constructor(e) {
2929
2951
  super({
2930
2952
  type: S.Screen,
@@ -2949,14 +2971,14 @@ class _u extends _e {
2949
2971
  }
2950
2972
  bindTrackEnd(e) {
2951
2973
  var t;
2952
- (t = this._videoStream) == null || t.on(I.ENDED, e);
2974
+ (t = this._videoStream) == null || t.on(D.ENDED, e);
2953
2975
  }
2954
2976
  destroy() {
2955
2977
  var e, t;
2956
2978
  (e = this._videoStream) == null || e.destroy(), (t = this._audioStream) == null || t.destroy(), delete this._trackMap.video, delete this._trackMap.audio;
2957
2979
  }
2958
2980
  }
2959
- class gu extends Je {
2981
+ class Cu extends Je {
2960
2982
  constructor(e) {
2961
2983
  super({
2962
2984
  type: S.AudioFile,
@@ -2974,14 +2996,14 @@ class gu extends Je {
2974
2996
  }
2975
2997
  bindTrackEnd(e) {
2976
2998
  var t;
2977
- (t = this._audioStream) == null || t.on(I.ENDED, e);
2999
+ (t = this._audioStream) == null || t.on(D.ENDED, e);
2978
3000
  }
2979
3001
  destroy() {
2980
3002
  var e;
2981
3003
  (e = this._audioStream) == null || e.destroy();
2982
3004
  }
2983
3005
  }
2984
- class vu extends _e {
3006
+ class yu extends _e {
2985
3007
  constructor(e) {
2986
3008
  super({
2987
3009
  type: S.Image,
@@ -2998,13 +3020,13 @@ class vu extends _e {
2998
3020
  return this.source.node();
2999
3021
  }
3000
3022
  bindTrackEnd(e) {
3001
- this.source.on(I.ENDED, e);
3023
+ this.source.on(D.ENDED, e);
3002
3024
  }
3003
3025
  destroy() {
3004
3026
  this.source.destroy();
3005
3027
  }
3006
3028
  }
3007
- class Cu extends _e {
3029
+ class Su extends _e {
3008
3030
  constructor(e) {
3009
3031
  super({
3010
3032
  type: S.CustomVideo,
@@ -3021,13 +3043,13 @@ class Cu extends _e {
3021
3043
  return null;
3022
3044
  }
3023
3045
  bindTrackEnd(e) {
3024
- this.source.on(I.ENDED, e);
3046
+ this.source.on(D.ENDED, e);
3025
3047
  }
3026
3048
  destroy() {
3027
3049
  this.source.destroy();
3028
3050
  }
3029
3051
  }
3030
- class yu extends Je {
3052
+ class Tu extends Je {
3031
3053
  constructor(e) {
3032
3054
  super({
3033
3055
  type: S.CustomAudio,
@@ -3043,14 +3065,14 @@ class yu extends Je {
3043
3065
  }
3044
3066
  bindTrackEnd(e) {
3045
3067
  var t;
3046
- (t = this._audioStream) == null || t.on(I.ENDED, e);
3068
+ (t = this._audioStream) == null || t.on(D.ENDED, e);
3047
3069
  }
3048
3070
  destroy() {
3049
3071
  var e;
3050
3072
  (e = this._audioStream) == null || e.destroy();
3051
3073
  }
3052
3074
  }
3053
- const Su = ["user", "environment"];
3075
+ const Eu = ["user", "environment"];
3054
3076
  var V = /* @__PURE__ */ ((r) => (r[r.OPEN_CAMERA_FAILED = 1001] = "OPEN_CAMERA_FAILED", r[r.OPEN_MICROPHONE_FAILED = 1002] = "OPEN_MICROPHONE_FAILED", r[r.OPEN_SCREEN_FAILED = 1003] = "OPEN_SCREEN_FAILED", r[r.VIDEO_FILE_CAPTURE_FAILED = 1004] = "VIDEO_FILE_CAPTURE_FAILED", r[r.AUDIO_FILE_CAPTURE_FAILED = 1005] = "AUDIO_FILE_CAPTURE_FAILED", r[r.IMAGE_FILE_CAPTURE_FAILED = 1006] = "IMAGE_FILE_CAPTURE_FAILED", r[r.VOLUME_DETECT_FAILED = 1008] = "VOLUME_DETECT_FAILED", r[r.PUBLISH_FAILED = 2001] = "PUBLISH_FAILED", r[r.UPDATE_PUBLISH_FAILED = 2002] = "UPDATE_PUBLISH_FAILED", r[r.PUSH_CONNECT_FAILED = 2003] = "PUSH_CONNECT_FAILED", r))(V || {});
3055
3077
  class Te extends Error {
3056
3078
  constructor(e, t, i) {
@@ -3058,9 +3080,9 @@ class Te extends Error {
3058
3080
  }
3059
3081
  }
3060
3082
  function fe(r, e, t) {
3061
- const i = gt.Landscape;
3083
+ const i = vt.Landscape;
3062
3084
  if (e === "video") {
3063
- const u = (i === gt.Landscape ? Ri : Ai)[r], [d, c, h, p] = u.split("x").map((l) => Number(l));
3085
+ const u = (i === vt.Landscape ? Oi : Di)[r], [d, c, h, p] = u.split("x").map((l) => Number(l));
3064
3086
  return {
3065
3087
  width: d,
3066
3088
  height: c,
@@ -3068,13 +3090,13 @@ function fe(r, e, t) {
3068
3090
  bitrate: p * 1e3
3069
3091
  };
3070
3092
  }
3071
- const s = wi[r], [n, a] = s.split("x").map((o) => Number(o));
3093
+ const s = Ii[r], [n, a] = s.split("x").map((o) => Number(o));
3072
3094
  return {
3073
3095
  sampleRate: n,
3074
3096
  bitrate: a * 1e3
3075
3097
  };
3076
3098
  }
3077
- class Tu extends te {
3099
+ class bu extends te {
3078
3100
  constructor() {
3079
3101
  super(), this._videoConstraints = {
3080
3102
  width: 1080,
@@ -3082,9 +3104,9 @@ class Tu extends te {
3082
3104
  frameRate: 30
3083
3105
  }, this._cameraStreams = {}, this._screenStreams = {}, this._videoFileStreams = {}, this._microphoneStreams = {}, this._audioFileStreams = {}, this._imageStreams = {}, this._customVideoStreams = {}, this._customAudioStreams = {};
3084
3106
  const { width: e, height: t, frameRate: i } = fe(
3085
- Ii,
3107
+ Li,
3086
3108
  "video"
3087
- ), { sampleRate: s } = fe(Di, "audio");
3109
+ ), { sampleRate: s } = fe(Fi, "audio");
3088
3110
  this._videoConstraints = {
3089
3111
  width: e,
3090
3112
  height: t,
@@ -3133,7 +3155,7 @@ class Tu extends te {
3133
3155
  };
3134
3156
  }
3135
3157
  async getDevicesList(e) {
3136
- return io(
3158
+ return no(
3137
3159
  e ? [e] : ["audioinput", "videoinput"]
3138
3160
  );
3139
3161
  }
@@ -3185,16 +3207,16 @@ class Tu extends te {
3185
3207
  }
3186
3208
  async startCameraCapture(e) {
3187
3209
  let t = {};
3188
- Su.includes(e) ? t = {
3210
+ Eu.includes(e) ? t = {
3189
3211
  facingMode: e
3190
3212
  } : t = {
3191
3213
  deviceId: e
3192
3214
  };
3193
3215
  try {
3194
- const i = await so({
3216
+ const i = await oo({
3195
3217
  ...t,
3196
3218
  ...this._videoConstraints
3197
- }), s = new Mo(i);
3219
+ }), s = new Fo(i);
3198
3220
  return this._cameraStreams[s.id] = s, this._notifyCaptured(s), this._bindStreamEvent(s), s.id;
3199
3221
  } catch (i) {
3200
3222
  throw this._handleError(i, V.OPEN_CAMERA_FAILED), i;
@@ -3202,10 +3224,10 @@ class Tu extends te {
3202
3224
  }
3203
3225
  async startMicrophoneCapture(e) {
3204
3226
  try {
3205
- const t = await oo({
3227
+ const t = await co({
3206
3228
  ...this._audioConstraints,
3207
3229
  deviceId: e
3208
- }), i = new mu(t);
3230
+ }), i = new _u(t);
3209
3231
  return this._microphoneStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3210
3232
  } catch (t) {
3211
3233
  throw this._handleError(
@@ -3216,10 +3238,10 @@ class Tu extends te {
3216
3238
  }
3217
3239
  async startScreenCapture(e) {
3218
3240
  try {
3219
- const t = await ao({
3241
+ const t = await uo({
3220
3242
  audio: e,
3221
3243
  video: this._videoConstraints
3222
- }), i = new _u(t);
3244
+ }), i = new vu(t);
3223
3245
  return this._screenStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3224
3246
  } catch (t) {
3225
3247
  throw this._handleError(t, V.OPEN_SCREEN_FAILED), t;
@@ -3227,12 +3249,12 @@ class Tu extends te {
3227
3249
  }
3228
3250
  async startVideoFileCapture(e) {
3229
3251
  try {
3230
- const t = await Dr({
3252
+ const t = await Lr({
3231
3253
  url: e,
3232
3254
  video: !0,
3233
3255
  audio: !0,
3234
3256
  loop: !0
3235
- }), i = new fu(t);
3257
+ }), i = new gu(t);
3236
3258
  return this._videoFileStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3237
3259
  } catch (t) {
3238
3260
  throw this._handleError(
@@ -3243,12 +3265,12 @@ class Tu extends te {
3243
3265
  }
3244
3266
  async startAudioFileCapture(e) {
3245
3267
  try {
3246
- const t = await Dr({
3268
+ const t = await Lr({
3247
3269
  url: e,
3248
3270
  video: !1,
3249
3271
  audio: !0,
3250
3272
  loop: !0
3251
- }), i = new gu(t);
3273
+ }), i = new Cu(t);
3252
3274
  return this._audioFileStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3253
3275
  } catch (t) {
3254
3276
  throw this._handleError(
@@ -3259,12 +3281,12 @@ class Tu extends te {
3259
3281
  }
3260
3282
  async startImageCapture(e) {
3261
3283
  try {
3262
- const t = await no({
3284
+ const t = await ao({
3263
3285
  url: e,
3264
3286
  width: 0,
3265
3287
  height: 0,
3266
3288
  frameRate: 30
3267
- }), i = new vu(t);
3289
+ }), i = new yu(t);
3268
3290
  return this._imageStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3269
3291
  } catch (t) {
3270
3292
  throw this._handleError(
@@ -3274,16 +3296,16 @@ class Tu extends te {
3274
3296
  }
3275
3297
  }
3276
3298
  startCustomVideoCapture(e) {
3277
- const t = uo(e);
3299
+ const t = po(e);
3278
3300
  if (t) {
3279
- const i = new Cu(t);
3301
+ const i = new Su(t);
3280
3302
  return this._customVideoStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3281
3303
  }
3282
3304
  }
3283
3305
  startCustomAudioCapture(e) {
3284
- const t = ho(e);
3306
+ const t = lo(e);
3285
3307
  if (t) {
3286
- const i = new yu(t);
3308
+ const i = new Tu(t);
3287
3309
  return this._customAudioStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
3288
3310
  }
3289
3311
  }
@@ -3353,7 +3375,7 @@ let ce = class {
3353
3375
  }
3354
3376
  }
3355
3377
  };
3356
- class Jt {
3378
+ class Yt {
3357
3379
  constructor({
3358
3380
  streamManagerController: e,
3359
3381
  composedStream: t,
@@ -3384,8 +3406,8 @@ class Jt {
3384
3406
  this._active = !1;
3385
3407
  }
3386
3408
  }
3387
- const ni = new ce("SingleComposer");
3388
- class Eu extends Jt {
3409
+ const ai = new ce("SingleComposer");
3410
+ class ku extends Yt {
3389
3411
  onStreamCapture(e) {
3390
3412
  e.isVideoStream ? this._handleVideoStreamCapture(e) : this._handleAudioStreamCapture(e);
3391
3413
  }
@@ -3423,7 +3445,7 @@ class Eu extends Jt {
3423
3445
  }
3424
3446
  ));
3425
3447
  } catch (a) {
3426
- ni.error("setVideoQuality error", a);
3448
+ ai.error("setVideoQuality error", a);
3427
3449
  }
3428
3450
  }
3429
3451
  _handleVideoStreamCapture(e) {
@@ -3446,7 +3468,7 @@ class Eu extends Jt {
3446
3468
  const t = this._composedStream.videoStream;
3447
3469
  if ((t == null ? void 0 : t.id) === e.id) {
3448
3470
  const i = this._streamManagerController.getDefaultVideoStream();
3449
- i ? this._handleVideoStreamCapture(i) : ni.error("all video stream stop capture");
3471
+ i ? this._handleVideoStreamCapture(i) : ai.error("all video stream stop capture");
3450
3472
  }
3451
3473
  }
3452
3474
  _handleAudioStreamStopCapture(e) {
@@ -3456,14 +3478,15 @@ class Eu extends Jt {
3456
3478
  return this._composedStream;
3457
3479
  }
3458
3480
  }
3459
- class bu extends te {
3481
+ class Pu extends te {
3460
3482
  constructor(e, {
3461
3483
  width: t,
3462
3484
  height: i,
3463
3485
  x: s,
3464
3486
  y: n,
3465
3487
  zOrder: a,
3466
- keepRatio: o
3488
+ keepRatio: o,
3489
+ mirrorType: u
3467
3490
  }) {
3468
3491
  super(), this._rect = {
3469
3492
  x: 0,
@@ -3474,7 +3497,7 @@ class bu extends te {
3474
3497
  }, this._isHidden = !1, this._paintSize = {
3475
3498
  width: 0,
3476
3499
  height: 0
3477
- }, this._rect.width = t ?? e.width, this._rect.height = i ?? e.height, this._rect.x = s ?? 0, this._rect.y = n ?? 0, this._rect.zOrder = a ?? 0, this._rect.sourceHeight = e.height, this._rect.sourceWidth = e.width, this._rect.keepRatio = o ?? !1, this._stream = e, this._bindVideoTrackSizeChange();
3500
+ }, this._rect.width = t ?? e.width, this._rect.height = i ?? e.height, this._rect.x = s ?? 0, this._rect.y = n ?? 0, this._rect.zOrder = a ?? 0, this._rect.sourceHeight = e.height, this._rect.sourceWidth = e.width, this._rect.keepRatio = o ?? !1, this._rect.mirrorType = u, this._stream = e, this._bindVideoTrackSizeChange();
3478
3501
  }
3479
3502
  _getPaintSize({
3480
3503
  elementWidth: e,
@@ -3504,22 +3527,28 @@ class bu extends te {
3504
3527
  };
3505
3528
  }
3506
3529
  _bindVideoTrackSizeChange() {
3507
- this._stream.on(Nt.SizeChange, ({ width: e, height: t }) => {
3530
+ this._stream.on(Vt.SizeChange, ({ width: e, height: t }) => {
3508
3531
  this.setBaseProps("sourceWidth", e), this.setBaseProps("sourceHeight", t);
3509
3532
  });
3510
3533
  }
3511
3534
  getViewNode() {
3512
- var i;
3535
+ var s;
3513
3536
  if (!this._stream)
3514
3537
  return;
3515
3538
  let e = {
3516
3539
  width: this._rect.width,
3517
3540
  height: this._rect.height
3518
3541
  };
3519
- return this._rect.keepRatio && (e = this._getPaintSize({
3542
+ this._rect.keepRatio && (e = this._getPaintSize({
3520
3543
  elementWidth: this._stream.width,
3521
3544
  elementHeight: this._stream.height
3522
- })), this._paintSize = e, (i = this._stream.viewNode) == null ? void 0 : i.size(e.width, e.height).position(this._rect.x, this._rect.y);
3545
+ })), this._paintSize = e;
3546
+ const t = (s = this._stream.viewNode) == null ? void 0 : s.size(
3547
+ e.width,
3548
+ e.height
3549
+ );
3550
+ let i;
3551
+ return this._rect.mirrorType !== void 0 && this._rect.mirrorType !== wi.None ? i = t == null ? void 0 : t.mirror(this._rect.mirrorType) : i = t, i = i == null ? void 0 : i.position(this._rect.x, this._rect.y), i;
3523
3552
  }
3524
3553
  get x() {
3525
3554
  return this._rect.x;
@@ -3557,6 +3586,9 @@ class bu extends te {
3557
3586
  set keepRatio(e) {
3558
3587
  this.setBaseProps("keepRatio", e);
3559
3588
  }
3589
+ set mirrorType(e) {
3590
+ this.setBaseProps("mirrorType", e);
3591
+ }
3560
3592
  get paintSize() {
3561
3593
  return this._paintSize;
3562
3594
  }
@@ -3581,6 +3613,9 @@ class bu extends te {
3581
3613
  case "keepRatio":
3582
3614
  this._rect.keepRatio = t;
3583
3615
  break;
3616
+ case "mirrorType":
3617
+ this._rect.mirrorType = t;
3618
+ break;
3584
3619
  }
3585
3620
  i && this.emit("propsChange", { [e]: t });
3586
3621
  }
@@ -3599,7 +3634,7 @@ class bu extends te {
3599
3634
  destroy() {
3600
3635
  }
3601
3636
  }
3602
- class oi extends _e {
3637
+ class ci extends _e {
3603
3638
  constructor(e) {
3604
3639
  super({
3605
3640
  type: S.MixVideo,
@@ -3625,26 +3660,26 @@ class oi extends _e {
3625
3660
  this.source.stop(), delete this._trackMap.video;
3626
3661
  }
3627
3662
  }
3628
- var ku = Object.defineProperty, Pu = Object.getOwnPropertyDescriptor, we = (r, e, t, i) => {
3629
- for (var s = Pu(e, t), n = r.length - 1, a; n >= 0; n--)
3663
+ var xu = Object.defineProperty, Ru = Object.getOwnPropertyDescriptor, we = (r, e, t, i) => {
3664
+ for (var s = Ru(e, t), n = r.length - 1, a; n >= 0; n--)
3630
3665
  (a = r[n]) && (s = a(e, t, s) || s);
3631
- return s && ku(e, t, s), s;
3666
+ return s && xu(e, t, s), s;
3632
3667
  };
3633
- const ps = new ce("composition-composer");
3668
+ const fs = new ce("composition-composer");
3634
3669
  function Oe(r, e, t) {
3635
3670
  const i = t.value;
3636
3671
  return t.value = function(...s) {
3637
- return this._active || ps.error("composer is not active"), i.apply(this, s);
3672
+ return this._active || fs.error("composer is not active"), i.apply(this, s);
3638
3673
  }, t;
3639
3674
  }
3640
- class Ce extends Jt {
3675
+ class Ce extends Yt {
3641
3676
  constructor(e) {
3642
3677
  super(e), this._compositionViewConfig = {
3643
3678
  width: 1080,
3644
3679
  height: 720,
3645
3680
  frameRate: 30,
3646
3681
  backgroundColor: "#000000"
3647
- }, this._sprites = [], this._videoMixer = new Ao();
3682
+ }, this._sprites = [], this._videoMixer = new Oo();
3648
3683
  }
3649
3684
  onStreamCapture(e) {
3650
3685
  }
@@ -3654,13 +3689,13 @@ class Ce extends Jt {
3654
3689
  enable() {
3655
3690
  super.enable();
3656
3691
  const e = this._videoMixer.track();
3657
- this._mixedVideoStream ? this._mixedVideoStream.replaceVideoTrack(e) : this._mixedVideoStream = new oi(e), this._composedStream.setVideoStream(this._mixedVideoStream);
3692
+ this._mixedVideoStream ? this._mixedVideoStream.replaceVideoTrack(e) : this._mixedVideoStream = new ci(e), this._composedStream.setVideoStream(this._mixedVideoStream);
3658
3693
  }
3659
3694
  disable() {
3660
3695
  super.disable(), this._videoMixer.stop();
3661
3696
  }
3662
3697
  _updateSpriteToMixer() {
3663
- const e = hs(
3698
+ const e = ms(
3664
3699
  this._sprites.map((t) => t.isHidden ? null : t.getViewNode())
3665
3700
  );
3666
3701
  this._videoMixer.draw(e);
@@ -3670,7 +3705,7 @@ class Ce extends Jt {
3670
3705
  }
3671
3706
  _addSprite(e) {
3672
3707
  this._sprites.push(e), this._sprites = this._sprites.sort((t, i) => t.zOrder - i.zOrder), e.on("propsChange", (t) => {
3673
- lu(t.zOrder) || (this._sprites = this._sprites.sort(
3708
+ fu(t.zOrder) || (this._sprites = this._sprites.sort(
3674
3709
  (i, s) => i.zOrder - s.zOrder
3675
3710
  )), this._updateSpriteToMixer();
3676
3711
  }), this._updateSpriteToMixer();
@@ -3682,19 +3717,19 @@ class Ce extends Jt {
3682
3717
  ...e
3683
3718
  }, this._compositionViewConfig.frameRate < 1 && (this._compositionViewConfig.frameRate = 1), this._videoMixer.updateConfig(this._compositionViewConfig), t && this._mixedVideoStream) {
3684
3719
  const i = this._videoMixer.updateFps();
3685
- this._mixedVideoStream ? this._mixedVideoStream.replaceVideoTrack(i) : this._mixedVideoStream = new oi(i), this._composedStream.setVideoStream(this._mixedVideoStream);
3720
+ this._mixedVideoStream ? this._mixedVideoStream.replaceVideoTrack(i) : this._mixedVideoStream = new ci(i), this._composedStream.setVideoStream(this._mixedVideoStream);
3686
3721
  }
3687
3722
  }
3688
3723
  addVideoStream(e, t) {
3689
3724
  if (!e.viewNode) {
3690
- ps.error("have no viewNode for composition");
3725
+ fs.error("have no viewNode for composition");
3691
3726
  return;
3692
3727
  }
3693
3728
  e.audioTrack && this._streamComposeController.addAudioStream({
3694
3729
  streamId: e.id,
3695
3730
  volume: 100
3696
3731
  });
3697
- const i = new bu(e, t);
3732
+ const i = new Pu(e, t);
3698
3733
  this._addSprite(i);
3699
3734
  }
3700
3735
  _updateSingleVideoStream(e) {
@@ -3702,7 +3737,7 @@ class Ce extends Jt {
3702
3737
  if (!t)
3703
3738
  return;
3704
3739
  const i = this._sprites.find((s) => s.stream.id === t);
3705
- i && (i.height = e.height, i.width = e.width, i.x = e.x, i.y = e.y, i.zOrder = e.zOrder, i.keepRatio = e.keepRatio ?? !1);
3740
+ i && (i.height = e.height, i.width = e.width, i.x = e.x, i.y = e.y, i.zOrder = e.zOrder, i.keepRatio = e.keepRatio ?? !1, i.mirrorType = e.mirrorType);
3706
3741
  }
3707
3742
  updateVideoStream(e) {
3708
3743
  e.forEach((t) => {
@@ -3754,7 +3789,7 @@ we([
3754
3789
  we([
3755
3790
  Oe
3756
3791
  ], Ce.prototype, "unmuteVideoStream");
3757
- class xu extends te {
3792
+ class Au extends te {
3758
3793
  constructor(e, { volume: t }) {
3759
3794
  super(), this._volume = 100, this._isMute = !1, this._volume = t ?? 100, this._stream = e;
3760
3795
  }
@@ -3782,7 +3817,7 @@ class xu extends te {
3782
3817
  return this._stream;
3783
3818
  }
3784
3819
  }
3785
- class Ru extends Je {
3820
+ class wu extends Je {
3786
3821
  constructor(e) {
3787
3822
  super({
3788
3823
  type: S.MixAudio,
@@ -3806,9 +3841,9 @@ class Ru extends Je {
3806
3841
  (e = this._trackMap.audio) == null || e.stop(), delete this._trackMap.audio;
3807
3842
  }
3808
3843
  }
3809
- class Au extends Jt {
3844
+ class Ou extends Yt {
3810
3845
  constructor(e) {
3811
- super(e), this._spriteList = [], this._audioMixer = new lo();
3846
+ super(e), this._spriteList = [], this._audioMixer = new fo();
3812
3847
  }
3813
3848
  onStreamCapture(e) {
3814
3849
  }
@@ -3816,7 +3851,7 @@ class Au extends Jt {
3816
3851
  e && this.removeAudioStream(e.id);
3817
3852
  }
3818
3853
  _updateSpriteToMixer() {
3819
- const e = hs(
3854
+ const e = ms(
3820
3855
  this._spriteList.map((t) => t.isMute ? null : t.getMixerNode())
3821
3856
  );
3822
3857
  this._audioMixer.mix(e);
@@ -3827,11 +3862,11 @@ class Au extends Jt {
3827
3862
  }
3828
3863
  enable() {
3829
3864
  super.enable();
3830
- const e = this._audioMixer.track(), t = new Ru(e);
3865
+ const e = this._audioMixer.track(), t = new wu(e);
3831
3866
  this._composedStream.setAudioStream(t), this._audioMixer.mix([]);
3832
3867
  }
3833
3868
  addAudioStream(e, t) {
3834
- const i = new xu(e, t);
3869
+ const i = new Au(e, t);
3835
3870
  this._spriteList.push(i), this._updateSpriteToMixer();
3836
3871
  }
3837
3872
  removeAudioStream(e) {
@@ -3874,7 +3909,7 @@ class Au extends Jt {
3874
3909
  return this._spriteList.filter((t) => t.stream.type === e).map((t) => t.stream);
3875
3910
  }
3876
3911
  }
3877
- class wu extends te {
3912
+ class Du extends te {
3878
3913
  constructor({
3879
3914
  videoStream: e,
3880
3915
  audioStream: t
@@ -3904,10 +3939,10 @@ class wu extends te {
3904
3939
  return (e = this._audioStream) == null ? void 0 : e.audioTrack;
3905
3940
  }
3906
3941
  }
3907
- const Ou = new ce("streamComposeController");
3908
- class Iu {
3942
+ const Iu = new ce("streamComposeController");
3943
+ class Mu {
3909
3944
  constructor(e) {
3910
- this._streamManagerController = e, this._composedStream = new wu(), this.singleComposer = new Eu({
3945
+ this._streamManagerController = e, this._composedStream = new Du(), this.singleComposer = new ku({
3911
3946
  streamManagerController: this._streamManagerController,
3912
3947
  composedStream: this._composedStream,
3913
3948
  streamComposeController: this
@@ -3915,7 +3950,7 @@ class Iu {
3915
3950
  streamManagerController: this._streamManagerController,
3916
3951
  composedStream: this._composedStream,
3917
3952
  streamComposeController: this
3918
- }), this.mixerComposer = new Au({
3953
+ }), this.mixerComposer = new Ou({
3919
3954
  streamManagerController: this._streamManagerController,
3920
3955
  composedStream: this._composedStream,
3921
3956
  streamComposeController: this
@@ -3961,7 +3996,7 @@ class Iu {
3961
3996
  e.streamId
3962
3997
  );
3963
3998
  if (!t) {
3964
- Ou.error("can not find video stream" + e.streamId);
3999
+ Iu.error("can not find video stream" + e.streamId);
3965
4000
  return;
3966
4001
  }
3967
4002
  this.compositionComposer.addVideoStream(t, e);
@@ -4005,7 +4040,7 @@ class Iu {
4005
4040
  this.compositionComposer.setMixerWorkerScript(e);
4006
4041
  }
4007
4042
  }
4008
- class ls {
4043
+ class _s {
4009
4044
  constructor(e) {
4010
4045
  this._hasBindComposedStreamEvent = !1, this._composedStream = e;
4011
4046
  }
@@ -4029,7 +4064,7 @@ class ls {
4029
4064
  }
4030
4065
  }
4031
4066
  const he = new ce("PreviewConsumer");
4032
- class Du extends ls {
4067
+ class Lu extends _s {
4033
4068
  constructor(e, {
4034
4069
  streamConsumeController: t
4035
4070
  }) {
@@ -4121,11 +4156,11 @@ class Du extends ls {
4121
4156
  return this._isPreviewing;
4122
4157
  }
4123
4158
  }
4124
- var $ = {}, pt = {}, lt = { exports: {} }, ai;
4125
- function Yt() {
4126
- if (ai) return lt.exports;
4127
- ai = 1;
4128
- var r = lt.exports = {
4159
+ var $ = {}, lt = {}, mt = { exports: {} }, di;
4160
+ function Zt() {
4161
+ if (di) return mt.exports;
4162
+ di = 1;
4163
+ var r = mt.exports = {
4129
4164
  v: [{
4130
4165
  name: "version",
4131
4166
  reg: /^(\d*)$/
@@ -4564,11 +4599,11 @@ function Yt() {
4564
4599
  t.forEach(function(i) {
4565
4600
  i.reg || (i.reg = /(.*)/), i.format || (i.format = "%s");
4566
4601
  });
4567
- }), lt.exports;
4602
+ }), mt.exports;
4568
4603
  }
4569
- var ci;
4570
- function Mu() {
4571
- return ci || (ci = 1, function(r) {
4604
+ var ui;
4605
+ function Fu() {
4606
+ return ui || (ui = 1, function(r) {
4572
4607
  var e = function(o) {
4573
4608
  return String(Number(o)) === o ? Number(o) : o;
4574
4609
  }, t = function(o, u, d, c) {
@@ -4585,7 +4620,7 @@ function Mu() {
4585
4620
  c ? u[o.name] : u
4586
4621
  );
4587
4622
  t(d.match(o.reg), h, o.names, o.name), o.push && u[o.push].push(h);
4588
- }, s = Yt(), n = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
4623
+ }, s = Zt(), n = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
4589
4624
  r.parse = function(o) {
4590
4625
  var u = {}, d = [], c = u;
4591
4626
  return o.split(/(\r\n|\r|\n)/).filter(n).forEach(function(h) {
@@ -4629,13 +4664,13 @@ function Mu() {
4629
4664
  });
4630
4665
  });
4631
4666
  };
4632
- }(pt)), pt;
4667
+ }(lt)), lt;
4633
4668
  }
4634
- var mt, di;
4635
- function Lu() {
4636
- if (di) return mt;
4637
- di = 1;
4638
- var r = Yt(), e = /%[sdv%]/g, t = function(a) {
4669
+ var ft, hi;
4670
+ function Nu() {
4671
+ if (hi) return ft;
4672
+ hi = 1;
4673
+ var r = Zt(), e = /%[sdv%]/g, t = function(a) {
4639
4674
  var o = 1, u = arguments, d = u.length;
4640
4675
  return a.replace(e, function(c) {
4641
4676
  if (o >= d)
@@ -4677,7 +4712,7 @@ function Lu() {
4677
4712
  "z",
4678
4713
  "a"
4679
4714
  ], n = ["i", "c", "b", "a"];
4680
- return mt = function(a, o) {
4715
+ return ft = function(a, o) {
4681
4716
  o = o || {}, a.version == null && (a.version = 0), a.name == null && (a.name = " "), a.media.forEach(function(h) {
4682
4717
  h.payloads == null && (h.payloads = "");
4683
4718
  });
@@ -4699,23 +4734,23 @@ function Lu() {
4699
4734
  }), c.join(`\r
4700
4735
  `) + `\r
4701
4736
  `;
4702
- }, mt;
4737
+ }, ft;
4703
4738
  }
4704
- var ui;
4705
- function Fu() {
4706
- if (ui) return $;
4707
- ui = 1;
4708
- var r = Mu(), e = Lu(), t = Yt();
4739
+ var pi;
4740
+ function Vu() {
4741
+ if (pi) return $;
4742
+ pi = 1;
4743
+ var r = Fu(), e = Nu(), t = Zt();
4709
4744
  return $.grammar = t, $.write = e, $.parse = r.parse, $.parseParams = r.parseParams, $.parseFmtpConfig = r.parseFmtpConfig, $.parsePayloads = r.parsePayloads, $.parseRemoteCandidates = r.parseRemoteCandidates, $.parseImageAttributes = r.parseImageAttributes, $.parseSimulcastStreamList = r.parseSimulcastStreamList, $;
4710
4745
  }
4711
- var Nu = Fu();
4712
- const Me = /* @__PURE__ */ Ge(Nu);
4713
- function ms(r) {
4746
+ var Uu = Vu();
4747
+ const Me = /* @__PURE__ */ Ge(Uu);
4748
+ function gs(r) {
4714
4749
  return new Promise((e) => {
4715
4750
  setTimeout(e, r);
4716
4751
  });
4717
4752
  }
4718
- async function Vu(r, e = {}, t = 0) {
4753
+ async function $u(r, e = {}, t = 0) {
4719
4754
  const i = new AbortController();
4720
4755
  let s = !1;
4721
4756
  e = Object.assign({}, e, { signal: i.signal });
@@ -4742,15 +4777,15 @@ async function Vu(r, e = {}, t = 0) {
4742
4777
  throw s = !0, a;
4743
4778
  }
4744
4779
  }
4745
- async function fs(r, e = {}, t = {}) {
4780
+ async function vs(r, e = {}, t = {}) {
4746
4781
  const { timeout: i = 0, retryDelay: s = 0 } = t;
4747
4782
  let { retryCount: n = 0 } = t;
4748
4783
  try {
4749
- return await Vu(r, e, i);
4784
+ return await $u(r, e, i);
4750
4785
  } catch (a) {
4751
4786
  if (n--, t.retryCount = n, n < 0)
4752
4787
  throw a;
4753
- return await ms(s), await fs(r, e, t);
4788
+ return await gs(s), await vs(r, e, t);
4754
4789
  }
4755
4790
  }
4756
4791
  function A(r, e) {
@@ -4759,7 +4794,7 @@ function A(r, e) {
4759
4794
  i.type === r && (t = i);
4760
4795
  }), t;
4761
4796
  }
4762
- async function At(r, e) {
4797
+ async function wt(r, e) {
4763
4798
  const t = {}, i = await (r == null ? void 0 : r.getStats()), s = await (e == null ? void 0 : e.getStats());
4764
4799
  return i && (t.audio = {
4765
4800
  mediaSource: A("media-source", i),
@@ -4783,11 +4818,11 @@ async function At(r, e) {
4783
4818
  transport: A("transport", s)
4784
4819
  }), t;
4785
4820
  }
4786
- async function Uu(r, e, t) {
4787
- var c, h, p, l, f, g, _, T, b, v, U, R, Qt, er, tr, rr, ir, sr, nr, or, ar, cr, dr, ur, hr, pr, lr, mr, fr, _r, gr, vr, Cr, yr, Sr, Tr;
4788
- const i = await At(e, t);
4789
- await ms(r);
4790
- const s = await At(e, t), { audio: n, video: a } = i, { audio: o, video: u } = s, d = {};
4821
+ async function Bu(r, e, t) {
4822
+ var c, h, p, l, f, g, _, T, b, v, U, R, er, tr, rr, ir, sr, nr, or, ar, cr, dr, ur, hr, pr, lr, mr, fr, _r, gr, vr, Cr, yr, Sr, Tr, Er;
4823
+ const i = await wt(e, t);
4824
+ await gs(r);
4825
+ const s = await wt(e, t), { audio: n, video: a } = i, { audio: o, video: u } = s, d = {};
4791
4826
  if (n != null && n.codec && (o != null && o.codec)) {
4792
4827
  const tt = ((c = o.outboundRtp) == null ? void 0 : c.timestamp) - ((h = n.outboundRtp) == null ? void 0 : h.timestamp), rt = ((p = o.outboundRtp) == null ? void 0 : p.bytesSent) - ((l = n.outboundRtp) == null ? void 0 : l.bytesSent), it = ((f = o.remoteInboundRtp) == null ? void 0 : f.packetsLost) - ((g = n.remoteInboundRtp) == null ? void 0 : g.packetsLost), st = ((_ = o.outboundRtp) == null ? void 0 : _.packetsSent) - ((T = n.outboundRtp) == null ? void 0 : T.packetsSent);
4793
4828
  d.audio = {
@@ -4802,48 +4837,48 @@ async function Uu(r, e, t) {
4802
4837
  };
4803
4838
  }
4804
4839
  if (a != null && a.codec && (u != null && u.codec)) {
4805
- const tt = ((R = u.outboundRtp) == null ? void 0 : R.timestamp) - ((Qt = a.outboundRtp) == null ? void 0 : Qt.timestamp), rt = ((er = u.outboundRtp) == null ? void 0 : er.bytesSent) - ((tr = a.outboundRtp) == null ? void 0 : tr.bytesSent), it = ((rr = u.outboundRtp) == null ? void 0 : rr.framesEncoded) - ((ir = a.outboundRtp) == null ? void 0 : ir.framesEncoded), st = ((sr = u.outboundRtp) == null ? void 0 : sr.totalEncodeTime) - ((nr = a.outboundRtp) == null ? void 0 : nr.totalEncodeTime), Er = ((or = u.outboundRtp) == null ? void 0 : or.packetsSent) - ((ar = a.outboundRtp) == null ? void 0 : ar.packetsSent), Ys = ((cr = u.outboundRtp) == null ? void 0 : cr.totalPacketSendDelay) - ((dr = a.outboundRtp) == null ? void 0 : dr.totalPacketSendDelay), Zs = ((ur = u.remoteInboundRtp) == null ? void 0 : ur.packetsLost) - ((hr = a.remoteInboundRtp) == null ? void 0 : hr.packetsLost);
4840
+ const tt = ((R = u.outboundRtp) == null ? void 0 : R.timestamp) - ((er = a.outboundRtp) == null ? void 0 : er.timestamp), rt = ((tr = u.outboundRtp) == null ? void 0 : tr.bytesSent) - ((rr = a.outboundRtp) == null ? void 0 : rr.bytesSent), it = ((ir = u.outboundRtp) == null ? void 0 : ir.framesEncoded) - ((sr = a.outboundRtp) == null ? void 0 : sr.framesEncoded), st = ((nr = u.outboundRtp) == null ? void 0 : nr.totalEncodeTime) - ((or = a.outboundRtp) == null ? void 0 : or.totalEncodeTime), br = ((ar = u.outboundRtp) == null ? void 0 : ar.packetsSent) - ((cr = a.outboundRtp) == null ? void 0 : cr.packetsSent), en = ((dr = u.outboundRtp) == null ? void 0 : dr.totalPacketSendDelay) - ((ur = a.outboundRtp) == null ? void 0 : ur.totalPacketSendDelay), tn = ((hr = u.remoteInboundRtp) == null ? void 0 : hr.packetsLost) - ((pr = a.remoteInboundRtp) == null ? void 0 : pr.packetsLost);
4806
4841
  d.video = {
4807
4842
  codec: u.codec.mimeType,
4808
4843
  sendBitrate: rt / tt * 8e3,
4809
4844
  // bps
4810
- frameWidth: (pr = u.outboundRtp) == null ? void 0 : pr.frameWidth,
4811
- frameHeight: (lr = u.outboundRtp) == null ? void 0 : lr.frameHeight,
4812
- framesPerSecond: (mr = u.outboundRtp) == null ? void 0 : mr.framesPerSecond,
4813
- framesEncoded: (fr = u.outboundRtp) == null ? void 0 : fr.framesEncoded,
4814
- keyFramesEncoded: (_r = u.outboundRtp) == null ? void 0 : _r.keyFramesEncoded,
4815
- framesSent: (gr = u.outboundRtp) == null ? void 0 : gr.frameHeight,
4845
+ frameWidth: (lr = u.outboundRtp) == null ? void 0 : lr.frameWidth,
4846
+ frameHeight: (mr = u.outboundRtp) == null ? void 0 : mr.frameHeight,
4847
+ framesPerSecond: (fr = u.outboundRtp) == null ? void 0 : fr.framesPerSecond,
4848
+ framesEncoded: (_r = u.outboundRtp) == null ? void 0 : _r.framesEncoded,
4849
+ keyFramesEncoded: (gr = u.outboundRtp) == null ? void 0 : gr.keyFramesEncoded,
4850
+ framesSent: (vr = u.outboundRtp) == null ? void 0 : vr.frameHeight,
4816
4851
  frameEncodeAvgTime: st * 1e3 / it,
4817
4852
  // ms
4818
- packetsSent: (vr = u.outboundRtp) == null ? void 0 : vr.packetsSent,
4819
- packetSendDelay: Ys * 1e3 / Er,
4853
+ packetsSent: (Cr = u.outboundRtp) == null ? void 0 : Cr.packetsSent,
4854
+ packetSendDelay: en * 1e3 / br,
4820
4855
  // ms
4821
- nackCount: (Cr = u.outboundRtp) == null ? void 0 : Cr.nackCount,
4822
- firCount: (yr = u.outboundRtp) == null ? void 0 : yr.firCount,
4823
- pliCount: (Sr = u.outboundRtp) == null ? void 0 : Sr.pliCount,
4824
- packetsLost: (Tr = u.remoteInboundRtp) == null ? void 0 : Tr.packetsLost,
4825
- packetsLostPercent: Zs / Er
4856
+ nackCount: (yr = u.outboundRtp) == null ? void 0 : yr.nackCount,
4857
+ firCount: (Sr = u.outboundRtp) == null ? void 0 : Sr.firCount,
4858
+ pliCount: (Tr = u.outboundRtp) == null ? void 0 : Tr.pliCount,
4859
+ packetsLost: (Er = u.remoteInboundRtp) == null ? void 0 : Er.packetsLost,
4860
+ packetsLostPercent: tn / br
4826
4861
  };
4827
4862
  }
4828
4863
  return d;
4829
4864
  }
4830
- const $u = (r) => {
4865
+ const ju = (r) => {
4831
4866
  var t;
4832
- if (!Fi)
4867
+ if (!Ui)
4833
4868
  return;
4834
4869
  const e = (t = r.rtp.filter((i) => i.codec === "opus")[0]) == null ? void 0 : t.payload;
4835
4870
  e && r.fmtp.forEach((i) => {
4836
4871
  i.payload === e && (i.config = "minptime=10;useinbandfec=1");
4837
4872
  });
4838
- }, Bu = (r) => {
4839
- r.ext && (mn || He) && (r.ext = r.ext.filter(
4873
+ }, zu = (r) => {
4874
+ r.ext && (gn || He) && (r.ext = r.ext.filter(
4840
4875
  (e) => {
4841
4876
  var t;
4842
4877
  return !((t = e.uri) != null && t.includes("video-orientation"));
4843
4878
  }
4844
4879
  ));
4845
4880
  };
4846
- function ju(r, e) {
4881
+ function Gu(r, e) {
4847
4882
  r == null || r.rtp.forEach(({ codec: t, payload: i }) => {
4848
4883
  if (["vp8", "h264"].includes(t.toLocaleLowerCase())) {
4849
4884
  const s = r.fmtp.find((n) => n.payload === i);
@@ -4858,8 +4893,8 @@ function ju(r, e) {
4858
4893
  }
4859
4894
  });
4860
4895
  }
4861
- const D = new ce("PCConnect");
4862
- class zu {
4896
+ const I = new ce("PCConnect");
4897
+ class Hu {
4863
4898
  constructor(e, t, i) {
4864
4899
  this._pc = null, this._ms = new MediaStream(), this._signalUrl = "", this._videoTransceiver = null, this._audioTransceiver = null, this._opts = void 0, this._sessionId = Date.now(), this._signalUrl = e, this._opts = t, this._onConnectStateChange = i;
4865
4900
  }
@@ -4881,18 +4916,18 @@ class zu {
4881
4916
  direction: "sendonly",
4882
4917
  sendEncodings: [{ maxBitrate: t[0] }],
4883
4918
  streams: [this._ms]
4884
- }), D.log("add track to pc,", s), this._videoTransceiver = i.addTransceiver(n || "video", {
4919
+ }), I.log("add track to pc,", s), this._videoTransceiver = i.addTransceiver(n || "video", {
4885
4920
  direction: "sendonly",
4886
4921
  sendEncodings: [{ maxBitrate: t[1] }],
4887
4922
  streams: [this._ms]
4888
- }), D.log("add track to pc,", n);
4923
+ }), I.log("add track to pc,", n);
4889
4924
  const a = await i.createOffer();
4890
- D.groupCollapsed("local offer"), D.log(a.sdp);
4925
+ I.groupCollapsed("local offer"), I.log(a.sdp);
4891
4926
  const o = Me.parse(a.sdp);
4892
4927
  o.media.forEach((c) => {
4893
- c.type === "audio" ? $u(c) : c.type === "video" && (Bu(c), ju(c, t[1]));
4894
- }), a.sdp = Me.write(o), D.log("local offer modified"), D.log(a.sdp), await i.setLocalDescription(a);
4895
- const u = await fs(
4928
+ c.type === "audio" ? ju(c) : c.type === "video" && (zu(c), Gu(c, t[1]));
4929
+ }), a.sdp = Me.write(o), I.log("local offer modified"), I.log(a.sdp), await i.setLocalDescription(a);
4930
+ const u = await vs(
4896
4931
  this._signalUrl,
4897
4932
  {
4898
4933
  method: "POST",
@@ -4913,19 +4948,19 @@ class zu {
4913
4948
  code: u.code,
4914
4949
  message: u.message
4915
4950
  };
4916
- D.log("remote answer:"), D.log(u.remoteSdp.sdp);
4951
+ I.log("remote answer:"), I.log(u.remoteSdp.sdp);
4917
4952
  const d = Me.parse(u.remoteSdp.sdp);
4918
4953
  d.media.forEach((c) => {
4919
4954
  var h;
4920
4955
  (h = c.fingerprint) != null && h.hash && (c.fingerprint.hash = c.fingerprint.hash.toUpperCase());
4921
- }), u.remoteSdp.sdp = Me.write(d), D.log("remote answer modified"), D.log(u.remoteSdp.sdp), D.groupEnd(), await i.setRemoteDescription(u.remoteSdp);
4956
+ }), u.remoteSdp.sdp = Me.write(d), I.log("remote answer modified"), I.log(u.remoteSdp.sdp), I.groupEnd(), await i.setRemoteDescription(u.remoteSdp);
4922
4957
  }
4923
4958
  async updatePublish(e, t) {
4924
4959
  var n, a;
4925
4960
  let i;
4926
4961
  t === "video" ? i = this._videoTransceiver : i = this._audioTransceiver;
4927
4962
  const s = (n = i == null ? void 0 : i.sender) == null ? void 0 : n.track;
4928
- (s == null ? void 0 : s.id) !== (e == null ? void 0 : e.id) && (await ((a = i == null ? void 0 : i.sender) == null ? void 0 : a.replaceTrack(e)), D.log(
4963
+ (s == null ? void 0 : s.id) !== (e == null ? void 0 : e.id) && (await ((a = i == null ? void 0 : i.sender) == null ? void 0 : a.replaceTrack(e)), I.log(
4929
4964
  `replace ${t} track done! ${s == null ? void 0 : s.label} -> ${e == null ? void 0 : e.label}`
4930
4965
  ));
4931
4966
  }
@@ -4934,25 +4969,25 @@ class zu {
4934
4969
  const s = t === "video" ? (a = this._videoTransceiver) == null ? void 0 : a.sender : (o = this._audioTransceiver) == null ? void 0 : o.sender;
4935
4970
  if (!s) return;
4936
4971
  const n = s.getParameters();
4937
- n.encodings = (u = n.encodings) != null && u.length ? n.encodings : [{}], i ? n.encodings[0].minBitrate = e : n.encodings[0].maxBitrate = e, s.setParameters(n), D.log(`set bitrate for ${t}, ${e} bps, min:${i}`);
4972
+ n.encodings = (u = n.encodings) != null && u.length ? n.encodings : [{}], i ? n.encodings[0].minBitrate = e : n.encodings[0].maxBitrate = e, s.setParameters(n), I.log(`set bitrate for ${t}, ${e} bps, min:${i}`);
4938
4973
  }
4939
4974
  unpublish() {
4940
4975
  var e, t;
4941
4976
  (e = this._pc) == null || e.getSenders().forEach((i) => {
4942
4977
  var s;
4943
4978
  (s = this._pc) == null || s.removeTrack(i);
4944
- }), (t = this._pc) == null || t.close(), this._audioTransceiver = null, this._videoTransceiver = null, this._pc = null, D.log("close pc!");
4979
+ }), (t = this._pc) == null || t.close(), this._audioTransceiver = null, this._videoTransceiver = null, this._pc = null, I.log("close pc!");
4945
4980
  }
4946
4981
  getStats() {
4947
4982
  var e, t;
4948
- return At(
4983
+ return wt(
4949
4984
  (e = this._audioTransceiver) == null ? void 0 : e.sender,
4950
4985
  (t = this._videoTransceiver) == null ? void 0 : t.sender
4951
4986
  );
4952
4987
  }
4953
4988
  getStatsSnapshoot(e) {
4954
4989
  var t, i;
4955
- return Uu(
4990
+ return Bu(
4956
4991
  e || 100,
4957
4992
  (t = this._audioTransceiver) == null ? void 0 : t.sender,
4958
4993
  (i = this._videoTransceiver) == null ? void 0 : i.sender
@@ -4961,13 +4996,13 @@ class zu {
4961
4996
  _bindRTCEvent() {
4962
4997
  const e = this._pc;
4963
4998
  e == null || e.addEventListener("connectionstatechange", () => {
4964
- D.log("onconnectionstatechange:", e.connectionState), this._onConnectStateChange(e.connectionState);
4999
+ I.log("onconnectionstatechange:", e.connectionState), this._onConnectStateChange(e.connectionState);
4965
5000
  });
4966
5001
  }
4967
5002
  }
4968
- var se = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(se || {}), Z = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Z || {}), N = /* @__PURE__ */ ((r) => (r.Init = "init", r.AvExist = "avexist", r.VideoFrame = "videoframe", r.MockVideoEncode = "mockvideoencode", r.AudioFrame = "audioframe", r.AdjustBitrate = "adjustbitrate", r.Publish = "publish", r.UnPublish = "unpublish", r.Download = "download", r.GetStats = "getstats", r.EncodeConfig = "encodeconfig", r))(N || {}), re = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(re || {}), ft = { exports: {} }, hi;
4969
- function Gu() {
4970
- return hi || (hi = 1, function(r) {
5003
+ var se = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(se || {}), Z = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Z || {}), N = /* @__PURE__ */ ((r) => (r.Init = "init", r.AvExist = "avexist", r.VideoFrame = "videoframe", r.MockVideoEncode = "mockvideoencode", r.AudioFrame = "audioframe", r.AdjustBitrate = "adjustbitrate", r.Publish = "publish", r.UnPublish = "unpublish", r.Download = "download", r.GetStats = "getstats", r.EncodeConfig = "encodeconfig", r))(N || {}), re = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(re || {}), _t = { exports: {} }, li;
5004
+ function qu() {
5005
+ return li || (li = 1, function(r) {
4971
5006
  var e = Object.prototype.hasOwnProperty, t = "~";
4972
5007
  function i() {
4973
5008
  }
@@ -5070,12 +5105,12 @@ function Gu() {
5070
5105
  var c;
5071
5106
  return d ? (c = t ? t + d : d, this._events[c] && a(this, c)) : (this._events = new i(), this._eventsCount = 0), this;
5072
5107
  }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, r.exports = o;
5073
- }(ft)), ft.exports;
5108
+ }(_t)), _t.exports;
5074
5109
  }
5075
- var Hu = Gu();
5076
- const qu = /* @__PURE__ */ Ge(Hu);
5077
- var wt = /* @__PURE__ */ ((r) => (r[r.RTMP_INIT_FAIL = 3e3] = "RTMP_INIT_FAIL", r[r.AUDIO_ENCODER_INIT_FAIL = 3001] = "AUDIO_ENCODER_INIT_FAIL", r[r.AUDIO_RRNOISE_INIT_FAIL = 3002] = "AUDIO_RRNOISE_INIT_FAIL", r[r.AUDIO_ENCODE_FAIL = 3003] = "AUDIO_ENCODE_FAIL", r[r.VIDEO_ENCODE_CONFIGURE_FAIL = 3004] = "VIDEO_ENCODE_CONFIGURE_FAIL", r[r.VIDEO_ENCODE_FAIL = 3005] = "VIDEO_ENCODE_FAIL", r[r.WTP_OPEN_FAIL = 3006] = "WTP_OPEN_FAIL", r[r.WTP_CONNECT_FAIL = 3007] = "WTP_CONNECT_FAIL", r[r.WORKER_ERROR = 3008] = "WORKER_ERROR", r))(wt || {});
5078
- class Wu extends Error {
5110
+ var Wu = qu();
5111
+ const Xu = /* @__PURE__ */ Ge(Wu);
5112
+ var Ot = /* @__PURE__ */ ((r) => (r[r.RTMP_INIT_FAIL = 3e3] = "RTMP_INIT_FAIL", r[r.AUDIO_ENCODER_INIT_FAIL = 3001] = "AUDIO_ENCODER_INIT_FAIL", r[r.AUDIO_RRNOISE_INIT_FAIL = 3002] = "AUDIO_RRNOISE_INIT_FAIL", r[r.AUDIO_ENCODE_FAIL = 3003] = "AUDIO_ENCODE_FAIL", r[r.VIDEO_ENCODE_CONFIGURE_FAIL = 3004] = "VIDEO_ENCODE_CONFIGURE_FAIL", r[r.VIDEO_ENCODE_FAIL = 3005] = "VIDEO_ENCODE_FAIL", r[r.WTP_OPEN_FAIL = 3006] = "WTP_OPEN_FAIL", r[r.WTP_CONNECT_FAIL = 3007] = "WTP_CONNECT_FAIL", r[r.WORKER_ERROR = 3008] = "WORKER_ERROR", r))(Ot || {});
5113
+ class Ku extends Error {
5079
5114
  constructor(e, t, i) {
5080
5115
  super(), this.code = e, this.message = t, i && (this.ext = i), this.toJson = () => ({
5081
5116
  code: this.code,
@@ -5084,8 +5119,8 @@ class Wu extends Error {
5084
5119
  });
5085
5120
  }
5086
5121
  }
5087
- function pi(r, e, t) {
5088
- return new Wu(r, e, t);
5122
+ function mi(r, e, t) {
5123
+ return new Ku(r, e, t);
5089
5124
  }
5090
5125
  const pe = class pe {
5091
5126
  constructor(e) {
@@ -5118,7 +5153,7 @@ const pe = class pe {
5118
5153
  pe.enable = !1, pe.enableLong = !1;
5119
5154
  let ee = pe;
5120
5155
  const F = new ee("RTMP_Capture");
5121
- class Xu {
5156
+ class Ju {
5122
5157
  constructor(e) {
5123
5158
  this._videoFirstframeCaptured = !1, this._audioFirstframeCaptured = !1, this._videoProcessorReader = null, this._audioProcessorReader = null, this._bridge = e;
5124
5159
  }
@@ -5217,11 +5252,11 @@ class Xu {
5217
5252
  });
5218
5253
  }
5219
5254
  }
5220
- const _s = '(function(){"use strict";var l=(i=>(i.OnVideoCaptured="onvideocaptured",i.OnAudioCaptured="onaudiocaptured",i.OnVideoCaptureNoOutput="onvideocapturenooutput",i.OnVideoEncoded="onvideoencoded",i.OnAudioEncoded="onaudioencoded",i.OnEncodedFrame="onencodedframe",i.OnPacketed="onpacketed",i.OnUpstreamFeedback="onupstreamfeedback",i.OnBitrateChanged="onbitratechanged",i))(l||{}),O=(i=>(i.OnError="onerror",i.OnConnectClosed="onconnectclosed",i.OnFirstFramePushed="onfirstframepushed",i))(O||{}),I=(i=>(i.Video="video",i.Audio="audio",i))(I||{}),v=(i=>(i.Init="init",i.AvExist="avexist",i.VideoFrame="videoframe",i.MockVideoEncode="mockvideoencode",i.AudioFrame="audioframe",i.AdjustBitrate="adjustbitrate",i.Publish="publish",i.UnPublish="unpublish",i.Download="download",i.GetStats="getstats",i.EncodeConfig="encodeconfig",i))(v||{}),w=(i=>(i.Ready="ready",i.Error="error",i.FirstFramePushed="firstframepushed",i.Flvfile="flvfile",i.STATS="stats",i.Close="close",i))(w||{});function $(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k={exports:{}},U;function q(){return U||(U=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(u,a,n){this.fn=u,this.context=a,this.once=n||!1}function o(u,a,n,h,m){if(typeof n!="function")throw new TypeError("The listener must be a function");var g=new r(n,h||u,m),f=e?e+a:a;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],g]:u._events[f].push(g):(u._events[f]=g,u._eventsCount++),u}function _(u,a){--u._eventsCount===0?u._events=new s:delete u._events[a]}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var a=[],n,h;if(this._eventsCount===0)return a;for(h in n=this._events)t.call(n,h)&&a.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(n)):a},c.prototype.listeners=function(a){var n=e?e+a:a,h=this._events[n];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,g=h.length,f=new Array(g);m<g;m++)f[m]=h[m].fn;return f},c.prototype.listenerCount=function(a){var n=e?e+a:a,h=this._events[n];return h?h.fn?1:h.length:0},c.prototype.emit=function(a,n,h,m,g,f){var F=e?e+a:a;if(!this._events[F])return!1;var d=this._events[F],C=arguments.length,N,p;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),C){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,n),!0;case 3:return d.fn.call(d.context,n,h),!0;case 4:return d.fn.call(d.context,n,h,m),!0;case 5:return d.fn.call(d.context,n,h,m,g),!0;case 6:return d.fn.call(d.context,n,h,m,g,f),!0}for(p=1,N=new Array(C-1);p<C;p++)N[p-1]=arguments[p];d.fn.apply(d.context,N)}else{var fe=d.length,R;for(p=0;p<fe;p++)switch(d[p].once&&this.removeListener(a,d[p].fn,void 0,!0),C){case 1:d[p].fn.call(d[p].context);break;case 2:d[p].fn.call(d[p].context,n);break;case 3:d[p].fn.call(d[p].context,n,h);break;case 4:d[p].fn.call(d[p].context,n,h,m);break;default:if(!N)for(R=1,N=new Array(C-1);R<C;R++)N[R-1]=arguments[R];d[p].fn.apply(d[p].context,N)}}return!0},c.prototype.on=function(a,n,h){return o(this,a,n,h,!1)},c.prototype.once=function(a,n,h){return o(this,a,n,h,!0)},c.prototype.removeListener=function(a,n,h,m){var g=e?e+a:a;if(!this._events[g])return this;if(!n)return _(this,g),this;var f=this._events[g];if(f.fn)f.fn===n&&(!m||f.once)&&(!h||f.context===h)&&_(this,g);else{for(var F=0,d=[],C=f.length;F<C;F++)(f[F].fn!==n||m&&!f[F].once||h&&f[F].context!==h)&&d.push(f[F]);d.length?this._events[g]=d.length===1?d[0]:d:_(this,g)}return this},c.prototype.removeAllListeners=function(a){var n;return a?(n=e?e+a:a,this._events[n]&&_(this,n)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,i.exports=c}(k)),k.exports}var z=q(),H=$(z);const x=class x{constructor(t){this.group=(...e)=>{this._enabled&&console.group(`[${this._prefix}]: `,...e)},this.groupCollapsed=(...e)=>{this._enabled&&console.groupCollapsed(`[${this._prefix}]: `,...e)},this.groupEnd=()=>{this._enabled&&console.groupEnd()},this.log=(...e)=>{this._enabled&&console.log(`[${this._prefix}]: `,...e)},this.warn=(...e)=>{this._enabled&&console.warn(`[${this._prefix}]: `,...e)},this.error=(...e)=>{this._enabled&&console.error(`[${this._prefix}]: `,...e)},this.table=(...e)=>{this._enabled&&console.table(...e)},this._prefix=t}get _enabled(){return x.enable}get _enableLong(){return x.enableLong}get long(){return this._enableLong}};x.enable=!1,x.enableLong=!1;let E=x;function S(i){i=i.filter(Boolean);const t=new Uint8Array(i.reduce((s,r)=>s+r.byteLength,0));let e=0;return i.forEach(s=>{t.set(s,e),e+=s.byteLength}),t}const A={codec:"avc1.4DE033",MaxCachedFrameSize:100,RealSpeedPercent:.8,UplinkBitrateCheckInterval:60*1e3,VideoBitrateDefault:1e6,AudioBitrateDefault:68e3,gopSize:90,sampleRate:48e3,channel:2,audioEncoderPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.1/1735619140327/pcm2aac.js",audioEncoderWasmPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.2/1735619208418/pcm2aac.wasm",ignoreRelPublish:!1},T=new E("RTMP_AudioEncoder");class j{constructor(t){this._encodedFrameCount=0,this._ready=!1,this._lastFrame=null,this._aacOutput=(e,s)=>{const r=this._module.HEAPU8.subarray(e,e+s);if(!this._lastFrame)return;this._encodedFrameCount++;const{props:o}=this._lastFrame,_={buffer:new Uint8Array(r),props:{timestamp:parseInt(o.timestamp/1e3),originTs:parseInt(o.timestamp/1e3)}};this._core.emit(l.OnAudioEncoded,_)},this._core=t}async init(){const t=await fetch(A.audioEncoderPath).then(_=>_.text());new Function(`self.exports={};${t}`)();const e=self.exports.m;let s,r;const o=new Promise((_,c)=>{r=_,s=c});return e({instantiateWasm:function(_,c){fetch(A.audioEncoderWasmPath).then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,_)).then(function(u){return c(u.instance)}).then(()=>{r(),T.log("aac module inited")}).catch(u=>{s(u)})}}).then(_=>{const c=_.addFunction(this._aacOutput,"vii");_._init_callback(c),this._module=_}).catch(s),o}rnnoise(t){var s;const e=t.length;for(let r=0;r<e;r++)t[r]=t[r]*32768;(s=this._rnnoiseModule)==null||s.processFrame(t);for(let r=0;r<e;r++)t[r]=t[r]/32768}updateConfigure(){this._module._flush(),this._module._free_encoder(),this._ready=!1}encode(t){if(!this._ready){const o=this._start_encoder();if(o<0)throw new Error(`init aac encoder error, code:${o}`)}this._lastFrame=t;const e=t.buffer.buffer,s=this._module._malloc(e.byteLength);this._module.HEAPU8.subarray(s,s+e.byteLength).set(new Uint8Array(e));const r=this._module._encode_one_frame(s);if(r<0)throw new Error(`encode aac frame error, code:${r}`)}_start_encoder(){const t=this._core.getSetting(),e=this._module._init_encoder(t.sampleRate,t.channel,t.audioBitrate);if(e<0)return e;this._ready=!0,T.log(`init encoder: sampleRate=${t.sampleRate}, channel:${t.channel}, bitrate:${t.audioBitrate}`)}destroy(){var t;(t=this._module)==null||t._free_encoder()}}const P=1024;class M{constructor(){this._queue=[],this._sampleCount=0}compose(t){if(this._queue.push(t),this._sampleCount+=t.data.audioData.numberOfFrames,this._sampleCount>=P)return this._doCompose()}_doCompose(){const t=new Float32Array(P);let e=0,s=P;const r=this._queue[0];for(;;){const o=this._queue[0];if(!o)break;const _=Math.min(s,o.data.audioData.numberOfFrames-o.offset,480),c=o.data.buffer.slice(o.offset,o.offset+_);if(o.offset+=_,o.offset>=o.data.audioData.numberOfFrames&&this._queue.shift(),s-=_,this._sampleCount-=_,t.set(c,e),e+=_,s<=0)break}return{buffer:t,props:{timestamp:r.data.audioData.timestamp,sampleRate:r.data.audioData.sampleRate,numberOfChannels:r.data.audioData.numberOfChannels}}}}var y=(i=>(i[i.RTMP_INIT_FAIL=3e3]="RTMP_INIT_FAIL",i[i.AUDIO_ENCODER_INIT_FAIL=3001]="AUDIO_ENCODER_INIT_FAIL",i[i.AUDIO_RRNOISE_INIT_FAIL=3002]="AUDIO_RRNOISE_INIT_FAIL",i[i.AUDIO_ENCODE_FAIL=3003]="AUDIO_ENCODE_FAIL",i[i.VIDEO_ENCODE_CONFIGURE_FAIL=3004]="VIDEO_ENCODE_CONFIGURE_FAIL",i[i.VIDEO_ENCODE_FAIL=3005]="VIDEO_ENCODE_FAIL",i[i.WTP_OPEN_FAIL=3006]="WTP_OPEN_FAIL",i[i.WTP_CONNECT_FAIL=3007]="WTP_CONNECT_FAIL",i[i.WORKER_ERROR=3008]="WORKER_ERROR",i))(y||{});class W extends Error{constructor(t,e,s){super(),this.code=t,this.message=e,s&&(this.ext=s),this.toJson=()=>({code:this.code,message:this.message,ext:this.ext})}}function b(i,t,e){return new W(i,t,e)}class G{constructor(t){this._audioFrameQueue=new M,this.encode=e=>{const s=new Float32Array(e.numberOfFrames);e.copyTo(s,{planeIndex:0,frameOffset:0,frameCount:e.numberOfFrames});const r=this._audioFrameQueue.compose({offset:0,data:{audioData:e,buffer:s}});if(r)try{this._encoder.encode(r)}catch(o){this._core.emit(O.OnError,b(y.AUDIO_ENCODE_FAIL,o.message))}},this._core=t,this._encoder=new j(t)}async init(){try{await this._encoder.init()}catch(t){throw b(y.AUDIO_ENCODER_INIT_FAIL,t.message)}}setConfiguration(t){const e=Object.assign({},this._core.getSetting(),{audioBitrate:t});this._core.updateSetting(e),this._encoder.updateConfigure()}destroy(){this._encoder.destroy()}}const L=new E("RTMP_VEncoder");class J{constructor(t){this._encoder=null,this._queue=[],this._encodeTimer=0,this._loopEncodeTimer=0,this._frameIndex=0,this._gopSize=0,this._encodedFrameCount=0,this._lastFrame=null,this._startTimer=()=>{this._clearEncodeTimer(),this._encodeTimer=setInterval(()=>{const e=this._queue.shift();if(!(!e||!this._encoder||this._encoder.state==="closed"))try{this._encoder.encode(e,{keyFrame:this._frameIndex%this._gopSize===0}),this._frameIndex++,this._lastFrame&&this._lastFrame.close(),this._lastFrame=e}catch(s){L.log("encode frame error",s)}},5)},this._core=t}configurate(t){return this._gopSize=t.gopSize,this._encoder?this.flush().then(()=>this._configure(t)):this._configure(t)}_configure(t){return this._clearEncodeTimer(),L.log("start config encoder",t),VideoEncoder.isConfigSupported(t).then(e=>{if(!e.supported)throw new Error(`VideoEncoder not support config, ${JSON.stringify(t)}`);this._encoder=new VideoEncoder({output:(s,r)=>{const o=new Uint8Array(s.byteLength);s.copyTo(o),this._emitFrame(o,s,r)},error:s=>{this._clearEncodeTimer(),this._core.emit(O.OnError,b(y.VIDEO_ENCODE_FAIL,s.message))}}),this._encoder.configure(t),L.log("encoder configured")}).then(this._startTimer).catch(e=>{throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,e.message)})}_emitFrame(t,e,s){this._encodedFrameCount++,this._core.emit(l.OnVideoEncoded,{buffer:t,props:{byteLength:e.byteLength,duration:e.duration,timestamp:parseInt(e.timestamp/1e3),originTs:parseInt(e.timestamp/1e3),type:e.type},cfg:s.decoderConfig})}_clearEncodeTimer(){clearInterval(this._encodeTimer)}_clearLoopEncodeTimer(){this._loopEncodeTimer&&clearInterval(this._loopEncodeTimer)}flush(){return this._encoder?this._encoder.flush().then(()=>{var t;this._clearEncodeTimer(),(t=this._encoder)==null||t.close(),this._frameIndex=0,this._encoder=null,L.log("encoder flush & closed")}).catch(t=>{console.log("encoder flush & close error:",t)}):Promise.resolve()}encode(t){this._clearLoopEncodeTimer(),this._queue.push(t)}startLoop(t){if(!this._lastFrame)return;const e=Math.floor(1e3/t*1e3);L.log("start encode last frame looped, ",t,"increment:",e),this._loopEncodeTimer=setInterval(()=>{if(!this._lastFrame)return;const s=new VideoFrame(this._lastFrame,{duration:e,timestamp:(this._lastFrame.timestamp||0)+e});this._queue.push(s)},Math.floor(1e3/t))}destroy(){this._queue.forEach(t=>t.close()),this._lastFrame&&this._lastFrame.close(),this._clearEncodeTimer(),this._clearLoopEncodeTimer(),this.flush()}}const Q=new E("RTMP_VideoEncode");class K{constructor(t){this._core=t,this._encoder=new J(t)}async setConfiguration(t={}){const e=Object.assign({},this._core.getSetting(),t),s={width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,bitrate:e.videoBitrate,framerate:Math.floor(e.frameRate),codec:e.codec,gopSize:e.gopSize,hardwareAcceleration:e.hardwareAcceleration};this._core.updateSetting(e),Q.log("set Configuration:",s,t);try{await this._encoder.configurate(s)}catch(r){this._core.emit(O.OnError,r)}}encode(t){this._encoder.encode(t)}startLoopEncodeLastFrame(){this._encoder.startLoop(this._core.getSetting().frameRate)}flushEncoder(){this._encoder.flush()}destroy(){this._encoder.destroy()}}const V=new E("RTMP_AVSync");class Z{constructor(t){this._videoFrameGot=!1,this._videoBaseDts=0,this._audioBaseDts=0,this._videoNextDts=0,this._videoLastDts=0,this._audioNextDts=0,this._lastVideoReceived=0,this._core=t}get avExist(){return this._core.getSetting().hasVideo&&this._core.getSetting().hasAudio}get videoRefDuration(){return parseInt(1e3/this._core.getSetting().frameRate)}get audioRefDuration(){return parseInt(1024/this._core.getSetting().sampleRate*1e3)}addVideoFrame(t){this._videoFrameGot||(this._videoFrameGot=!0);const e=t.props;if(Math.abs(this._videoNextDts-e.timestamp-this._videoBaseDts)>1e3){const r=Date.now()-this._lastVideoReceived;this._videoNextDts=this._videoNextDts===this._audioNextDts?this._videoNextDts+this.videoRefDuration:this._audioNextDts||this._videoNextDts+r,this._videoBaseDts=this._videoNextDts-e.timestamp,V.warn(`video stream timestamp breaked! dts:${this._videoNextDts} -> ${e.timestamp}, videoBaseDts=${this._videoBaseDts}, deltaToLastFrame=${r}`)}e.timestamp=e.timestamp+this._videoBaseDts;const s=e.timestamp-this._videoLastDts;return s>100&&V.warn("video frame large gap",s),this._videoLastDts=this._videoNextDts=e.timestamp,V.long&&V.log(`V frame, dts: ${e.timestamp}, originDts:${e.originTs}, videoBaseDts=${this._videoBaseDts}, type=${e.type}, duration=${s}`),this._lastVideoReceived=Date.now(),this._core.emit(l.OnEncodedFrame,I.Video,t),{size:t.buffer.length,duration:s,key:t.props.type==="key"}}addAudioFrame(t){if(this.avExist&&!this._videoFrameGot)return;const e=t.props;return this._audioBaseDts||(this._audioBaseDts=e.timestamp-this._videoNextDts),Math.abs(e.timestamp-this._audioBaseDts-this._audioNextDts)>1e3&&(this._audioBaseDts=this._audioNextDts+this.audioRefDuration-e.timestamp,V.warn(`audio stream timestamp breaked! dts:${this._audioNextDts} -> ${e.timestamp}, audioBaseDts=${this._audioBaseDts}`)),this._audioNextDts=e.timestamp=e.timestamp-this._audioBaseDts,V.long&&V.log(`A frame, dts: ${e.timestamp}, originDts:${e.originTs}`),this._core.emit(l.OnEncodedFrame,I.Audio,t),{size:t.buffer.length,duration:this.audioRefDuration}}}class X{constructor(){this._videoSize=0,this._videoDuration=0,this._videoBitrate=0,this._frameCount=0,this._fps=0,this._videoEncodedCount=0,this._keyCount=0,this._audioSize=0,this._audioDuration=0,this._audioBitrate=0,this._audioEncodedCount=0}get videoStats(){return{sendBitrate:this._videoBitrate,framesPerSecond:this._fps,framesEncoded:this._videoEncodedCount,keyFramesEncoded:this._keyCount}}get audioStats(){return{sendBitrate:this._audioBitrate,framesEncoded:this._audioEncodedCount}}addVideoSample({size:t,duration:e,key:s}){this._videoEncodedCount++,this._videoSize+=t,this._videoDuration+=e,this._frameCount++,s&&this._keyCount++,this._videoDuration>=1e3&&(this._videoBitrate=Math.floor(this._videoSize/this._videoDuration*8e3),this._fps=this._frameCount,this._frameCount=0,this._videoSize=0,this._videoDuration=0)}addAudioSample({size:t,duration:e}){this._audioEncodedCount++,this._audioSize+=t,this._audioDuration+=e,this._audioDuration>=1e3&&(this._audioBitrate=Math.floor(this._audioSize/this._audioDuration*1e3),this._audioSize=0,this._audioDuration=0)}}const Y=new E("RTMP_EncodeController");class ee{constructor(t){this._analyse=new X,this._gotFrame=!1,this._OnVideoCaptured=(e,s)=>{this._gotFrame=!0,this._videoSettingChanged(s)&&(Y.log("video track setting changed!",s),this._core.updateSetting({width:s.width,height:s.height,frameRate:s.frameRate,vDeviceId:s.deviceId}),this._videoEncode.setConfiguration()),this._videoEncode.encode(e)},this._OnVideoCaptureNoOutput=()=>{this._videoEncode.startLoopEncodeLastFrame()},this._OnAudioCaptured=e=>{this._gotFrame=!0,this._audioEncode.encode(e)},this._OnVideoEncoded=e=>{const s=this._avSync.addVideoFrame(e);this._analyse.addVideoSample(s)},this._OnAudioEncoded=e=>{if(!e.buffer.length)return;const s=this._avSync.addAudioFrame(e);s&&this._analyse.addAudioSample(s)},this._OnUpstreamFeedback=e=>{this._videoEncode.setConfiguration(e)},this._OnBitrateChanged=(e,s)=>{this._gotFrame&&(e===I.Video&&this._videoEncode.setConfiguration({videoBitrate:s}),e===I.Audio&&this._audioEncode.setConfiguration(s))},this._core=t,this._audioEncode=new G(t),this._videoEncode=new K(t),this._avSync=new Z(t),this._bindEvents()}getStats(){return{video:this._analyse.videoStats,audio:this._analyse.audioStats}}init(){return this._audioEncode.init()}_bindEvents(){this._core.on(l.OnVideoCaptured,this._OnVideoCaptured),this._core.on(l.OnAudioCaptured,this._OnAudioCaptured),this._core.on(l.OnVideoCaptureNoOutput,this._OnVideoCaptureNoOutput),this._core.on(l.OnVideoEncoded,this._OnVideoEncoded),this._core.on(l.OnAudioEncoded,this._OnAudioEncoded),this._core.on(l.OnUpstreamFeedback,this._OnUpstreamFeedback),this._core.on(l.OnBitrateChanged,this._OnBitrateChanged)}_videoSettingChanged(t){const e=this._core.getSetting();return t.width!==e.width||t.height!==e.height||Math.floor(t.frameRate)!==Math.floor(e.frameRate)||t.deviceId!==e.vDeviceId}destroy(){this._videoEncode.destroy(),this._audioEncode.destroy()}}var B=(i=>(i[i.AUDIO=8]="AUDIO",i[i.VIDEO=9]="VIDEO",i[i.SCRIPT_DATA=18]="SCRIPT_DATA",i))(B||{});const te=10,ie=1,se=7,oe={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function re(i){const t=(i[4]&3)+1;let e;const s=[],r=[];let o=6;const _=i[5]&31;let c;for(let n=0;n<_;n++){if(c=i[o]<<8|i[o+1],o+=2,!c)continue;const h=i.subarray(o,o+c);o+=c,s.push(h)}const u=i[o];o++;let a;for(let n=0;n<u;n++)a=i[o]<<8|i[o+1],o+=2,a&&(r.push(i.subarray(o,o+a)),o+=a);return{sps:e,spsArr:s,ppsArr:r,nalUnitSize:t}}class ne{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,channelCount:1},this._hasAudioSeqHeader=!1,this._hasVideoSeqHeader=!1}setConfig(t){this._cfg=Object.assign(this._cfg,t)}genHeader(){const t=[70,76,86,1,(this._cfg.hasAudio?1:0)<<2|(this._cfg.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(t)}genSeqTag(t,e){let s;t===8?(s=this._genAudioTagPaylod(0,e),this._hasAudioSeqHeader=!0):(s=this._genVideoTagPayload(0,e),this._hasVideoSeqHeader=!0);const r=this._genTagHeader(t,s.length,e.props.timestamp),o=r.length+s.length;return S([r,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}genFrameTag(t,e){let s;t===8?s=this._genAudioTagPaylod(1,e):s=this._genVideoTagPayload(1,e);const r=this._genTagHeader(t,s.length,e.props.timestamp),o=r.length+s.length;return S([r,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}_genTagHeader(t,e,s){return new Uint8Array([t,e>>>16,e>>>8,e,s>>>16,s>>>8,s,s>>>24,0,0,0])}_genAudioTagPaylod(t,e){return S(t===0?[this._genAudioTagHeader(),this._genAudioSequenceHeader()]:[this._genAudioTagHeader(),this._genAudioData(e)])}_genAudioTagHeader(){return new Uint8Array([te<<4|12|ie<<1|this._cfg.channelCount-1])}_genAudioSequenceHeader(){const t=4096|oe[this._cfg.sampleRate]<<7|this._cfg.channelCount<<3;return new Uint8Array([0,t>>8,t])}_genAudioData(t){const e=new Uint8Array(1+t.buffer.length);return e.set([1],0),e.set(t.buffer,1),e}_genVideoTagPayload(t,e){return S(t===0?[this._genVideoTagHeader(e),this._genVideoSequenceHeader(e)]:[this._genVideoTagHeader(e),this._genVideoData(e)])}_genVideoTagHeader(t){return new Uint8Array([(t.props.type==="key"?1:2)<<4|se,this._hasVideoSeqHeader?1:0,0,0,0])}_genVideoSequenceHeader(t){return new Uint8Array(t.cfg.description)}_genVideoData(t){if(t.props.type==="delta")return t.buffer;const e=re(new Uint8Array(t.cfg.description)),s=e.spsArr[0].length,r=e.ppsArr[0].length;return S([new Uint8Array([0,0,s>>8,s%256]),e.spsArr[0],new Uint8Array([0,0,r>>8,r%256]),e.ppsArr[0],t.buffer])}}const ae=new E("RTMP_Packet");class de{constructor(t){this._firstFrame=!0,this._flv=new ne,this._OnEncodedFrame=(e,s)=>{if(this._firstFrame){const o=this._core.getSetting();this._flv.setConfig({hasVideo:o.hasVideo,hasAudio:o.hasAudio,sampleRate:o.sampleRate,channelCount:o.channel});const _=this._flv.genHeader();if(this._core.emit(l.OnPacketed,_),o.hasVideo){const c=this._flv.genSeqTag(B.VIDEO,s);this._core.emit(l.OnPacketed,c)}if(o.hasAudio){const c=this._flv.genSeqTag(B.AUDIO,s);this._core.emit(l.OnPacketed,c)}this._firstFrame=!1,ae.log("first frame encoded & packed")}const r=this._flv.genFrameTag(e==="video"?B.VIDEO:B.AUDIO,s);this._core.emit(l.OnPacketed,r,s.props.type==="key")},this._core=t,this._bindEvents()}_bindEvents(){this._core.on(l.OnEncodedFrame,this._OnEncodedFrame)}destroy(){}}class he{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(t){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=t;const e=Date.now()-this._lastDot;e>=500&&(this._addSpeedSample(this._totalSize/e*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(t){this._speed.push(t),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((t,e)=>t+=e,0)/this._speed.length):0}}const D=new E("RTMP_Wtp");class ce{constructor(t){this._queue=[],this._url="",this._connectClosed=!1,this._upSpeed=new he,this._transport=null,this._writer=null,this._inWriting=!1,this._inAdjustEncode=!1,this._increaseTimer=0,this._firstFramePushed=!1,this._core=t,this._bindEvents()}get sendSpeed(){return this._upSpeed.getUpSpeed()}getStats(){var t;return(t=this._transport)==null?void 0:t.getStats()}_bindEvents(){this._core.on(l.OnPacketed,(t,e=!1)=>{this._checkDecreaseBitrate(),this._checkDeleteCache(e),this._queue.push(t),this._inWriting||this._write()})}_checkDecreaseBitrate(){if(this._inAdjustEncode)return;const t=this._upSpeed.getUpSpeed();if(!t||this._queue.length<A.MaxCachedFrameSize)return;D.log(`up speed: ${t} low, ajust encode setting`);const e=this._core.getSetting();this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t*A.RealSpeedPercent,width:e.width,height:e.height,frameRate:e.frameRate}),this._inAdjustEncode=!0,this._checkIncreaseBitrate()}_checkIncreaseBitrate(){D.log("add timer to check uplink speed increased"),clearInterval(this._increaseTimer),this._increaseTimer=setTimeout(()=>{const t=this._core.getSetting();D.log(`set encode bitrate to specified ${t.videoBitrate}`),this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t.videoBitrate,width:t.width,height:t.height,frameRate:t.frameRate}),this._inAdjustEncode=!0},A.UplinkBitrateCheckInterval)}_checkDeleteCache(t){this._inAdjustEncode&&t&&(D.log(`ajust encode setting finish, delete cached ${this._queue.length} frame`),this._queue=[],this._upSpeed.reset(),this._inAdjustEncode=!1)}async start(t){this._url=t;try{await this._connect()}catch(e){throw b(y.WTP_OPEN_FAIL,e.message)}}async _connect(){const t=new WebTransport(this._url);let e;t.closed.then(()=>{D.log("webtransport closed")}).catch(r=>{e=r.message,D.log("webtransport closed due to",r)}).finally(()=>{this._connectClosed=!0,this._core.emit(O.OnConnectClosed,e),this._core.emit(O.OnError,b(y.WTP_CONNECT_FAIL,e))}),await t.ready,this._transport=t;const s=await t.createBidirectionalStream();this._writer=s.writable.getWriter(),this._write(),D.log("transport opend")}async _write(){var e;if(!this._writer)return;this._inWriting=!0;const t=this._queue.shift();if(!t){this._inWriting=!1;return}await((e=this._writer)==null?void 0:e.write(t)),this._firstFramePushed||(this._firstFramePushed=!0,this._core.emit(O.OnFirstFramePushed),D.log("first frame pushed")),this._upSpeed.addSample(t.length);try{await this._write()}catch(s){D.log("writer error:",s)}}getFile(){return S(this._queue)}destroy(){var t,e;clearTimeout(this._increaseTimer),this._connectClosed||(t=this._writer)==null||t.close(),this._writer=null,(e=this._transport)==null||e.close(),this._transport=null}}const ue=new E("LiveRTMP");class _e extends H{constructor(){super(),this._ts=0,this._setting={codec:A.codec,hardwareAcceleration:"prefer-hardware",width:-1,height:-1,frameRate:-1,sampleRate:A.sampleRate,channel:A.channel,gopSize:A.gopSize,videoBitrate:A.VideoBitrateDefault,audioBitrate:A.AudioBitrateDefault,hasAudio:!1,hasVideo:!1,vDeviceId:"",aDeviceId:""},this._encode=new ee(this),this._packet=new de(this),this._transport=new ce(this)}async checkVideoHardwareAcceleration(){const t=["prefer-hardware","prefer-software","no-preference"],e=this.getSetting(),s={codec:e.codec,width:1280,height:720,framerate:15,bitrate:e.videoBitrate};for(const r of t)try{if((await VideoEncoder.isConfigSupported({...s,hardwareAcceleration:r})).supported)return this.updateSetting({hardwareAcceleration:r}),Promise.resolve()}catch{throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,`VideoEncoder not support hardwareAcceleration, ${JSON.stringify({...s,hardwareAcceleration:r})}`)}throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,"VideoEncoder not support hardwareAcceleration")}async ready(){await Promise.all([this.checkVideoHardwareAcceleration(),this._encode.init()])}getSetting(){return this._setting}updateSetting(t){this._setting=Object.assign({},this._setting,t)}videoFrameCaptured(t,e){this.emit(l.OnVideoCaptured,t,e)}audioFrameCaptured(t,e){this.emit(l.OnAudioCaptured,t,e)}startMockVideoEncode(){this.emit(l.OnVideoCaptureNoOutput)}adjustBitrate(t,e){t===I.Video&&this.updateSetting({videoBitrate:e}),t===I.Audio&&this.updateSetting({audioBitrate:e}),this.emit(l.OnBitrateChanged,t,e)}avExist(t,e){this._setting.hasVideo=t,this._setting.hasAudio=e}publish(t){return this._transport.start(t)}setEncodeCapacity(t){this._setting=Object.assign({},this._setting,t)}getStats(){return{video:{...this._encode.getStats().video,sendSpeed:this._transport.sendSpeed,codec:this._setting.codec,frameWidth:this._setting.width,frameHeight:this._setting.height,gopSize:this._setting.gopSize},audio:{...this._encode.getStats().audio,codec:"aac",channels:this._setting.channel,sampleRate:this._setting.sampleRate}}}destroy(){ue.log("destroy"),this._encode.destroy(),this._packet.destroy(),this._transport.destroy()}down(){return this._transport.getFile()}}self.constructor.name!=="Window"&&le();function le(){let i={};self.addEventListener("message",async t=>{switch(t.data.type){case v.Init:{const{options:e}=t.data;e.logEnable&&(E.enable=!0),e.logEnableLong&&(E.enableLong=!0),i=new _e,i.on(O.OnError,s=>{self.postMessage({type:w.Error,data:s.toJson()})}),i.on(O.OnConnectClosed,()=>{self.postMessage({type:w.Close})}),i.on(O.OnFirstFramePushed,()=>{self.postMessage({type:w.FirstFramePushed})});try{await i.ready(),self.postMessage({type:w.Ready})}catch(s){self.postMessage({type:w.Error,data:s.toJson()})}}break;case v.AvExist:{const{hasAudio:e,hasVideo:s}=t.data;i.avExist(s,e)}break;case v.VideoFrame:{const{frame:e,setting:s}=t.data;i.videoFrameCaptured(e,s)}break;case v.MockVideoEncode:i.startMockVideoEncode();break;case v.AudioFrame:{const{frame:e,setting:s}=t.data;i.audioFrameCaptured(e,s)}break;case v.AdjustBitrate:{const{kind:e,bitrate:s}=t.data;i.adjustBitrate(e,s)}break;case v.Publish:{const{url:e}=t.data;try{await i.publish(e)}catch(s){self.postMessage({type:w.Error,data:s.toJson()})}}break;case v.GetStats:self.postMessage({type:w.STATS,data:i.getStats()});break;case v.EncodeConfig:{i.setEncodeCapacity(t.data.cfg);break}case v.Download:{const e=i.down();self.postMessage({type:w.Flvfile,buffer:e},[e.buffer])}break;case v.UnPublish:{i.destroy();break}}})}})();\n', li = typeof self < "u" && self.Blob && new Blob([_s], { type: "text/javascript;charset=utf-8" });
5221
- function Ku(r) {
5255
+ const Cs = '(function(){"use strict";var l=(i=>(i.OnVideoCaptured="onvideocaptured",i.OnAudioCaptured="onaudiocaptured",i.OnVideoCaptureNoOutput="onvideocapturenooutput",i.OnVideoEncoded="onvideoencoded",i.OnAudioEncoded="onaudioencoded",i.OnEncodedFrame="onencodedframe",i.OnPacketed="onpacketed",i.OnUpstreamFeedback="onupstreamfeedback",i.OnBitrateChanged="onbitratechanged",i))(l||{}),O=(i=>(i.OnError="onerror",i.OnConnectClosed="onconnectclosed",i.OnFirstFramePushed="onfirstframepushed",i))(O||{}),I=(i=>(i.Video="video",i.Audio="audio",i))(I||{}),v=(i=>(i.Init="init",i.AvExist="avexist",i.VideoFrame="videoframe",i.MockVideoEncode="mockvideoencode",i.AudioFrame="audioframe",i.AdjustBitrate="adjustbitrate",i.Publish="publish",i.UnPublish="unpublish",i.Download="download",i.GetStats="getstats",i.EncodeConfig="encodeconfig",i))(v||{}),w=(i=>(i.Ready="ready",i.Error="error",i.FirstFramePushed="firstframepushed",i.Flvfile="flvfile",i.STATS="stats",i.Close="close",i))(w||{});function $(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k={exports:{}},U;function q(){return U||(U=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(u,a,n){this.fn=u,this.context=a,this.once=n||!1}function o(u,a,n,h,m){if(typeof n!="function")throw new TypeError("The listener must be a function");var g=new r(n,h||u,m),f=e?e+a:a;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],g]:u._events[f].push(g):(u._events[f]=g,u._eventsCount++),u}function _(u,a){--u._eventsCount===0?u._events=new s:delete u._events[a]}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var a=[],n,h;if(this._eventsCount===0)return a;for(h in n=this._events)t.call(n,h)&&a.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(n)):a},c.prototype.listeners=function(a){var n=e?e+a:a,h=this._events[n];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,g=h.length,f=new Array(g);m<g;m++)f[m]=h[m].fn;return f},c.prototype.listenerCount=function(a){var n=e?e+a:a,h=this._events[n];return h?h.fn?1:h.length:0},c.prototype.emit=function(a,n,h,m,g,f){var F=e?e+a:a;if(!this._events[F])return!1;var d=this._events[F],C=arguments.length,N,p;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),C){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,n),!0;case 3:return d.fn.call(d.context,n,h),!0;case 4:return d.fn.call(d.context,n,h,m),!0;case 5:return d.fn.call(d.context,n,h,m,g),!0;case 6:return d.fn.call(d.context,n,h,m,g,f),!0}for(p=1,N=new Array(C-1);p<C;p++)N[p-1]=arguments[p];d.fn.apply(d.context,N)}else{var fe=d.length,R;for(p=0;p<fe;p++)switch(d[p].once&&this.removeListener(a,d[p].fn,void 0,!0),C){case 1:d[p].fn.call(d[p].context);break;case 2:d[p].fn.call(d[p].context,n);break;case 3:d[p].fn.call(d[p].context,n,h);break;case 4:d[p].fn.call(d[p].context,n,h,m);break;default:if(!N)for(R=1,N=new Array(C-1);R<C;R++)N[R-1]=arguments[R];d[p].fn.apply(d[p].context,N)}}return!0},c.prototype.on=function(a,n,h){return o(this,a,n,h,!1)},c.prototype.once=function(a,n,h){return o(this,a,n,h,!0)},c.prototype.removeListener=function(a,n,h,m){var g=e?e+a:a;if(!this._events[g])return this;if(!n)return _(this,g),this;var f=this._events[g];if(f.fn)f.fn===n&&(!m||f.once)&&(!h||f.context===h)&&_(this,g);else{for(var F=0,d=[],C=f.length;F<C;F++)(f[F].fn!==n||m&&!f[F].once||h&&f[F].context!==h)&&d.push(f[F]);d.length?this._events[g]=d.length===1?d[0]:d:_(this,g)}return this},c.prototype.removeAllListeners=function(a){var n;return a?(n=e?e+a:a,this._events[n]&&_(this,n)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,i.exports=c}(k)),k.exports}var z=q(),H=$(z);const x=class x{constructor(t){this.group=(...e)=>{this._enabled&&console.group(`[${this._prefix}]: `,...e)},this.groupCollapsed=(...e)=>{this._enabled&&console.groupCollapsed(`[${this._prefix}]: `,...e)},this.groupEnd=()=>{this._enabled&&console.groupEnd()},this.log=(...e)=>{this._enabled&&console.log(`[${this._prefix}]: `,...e)},this.warn=(...e)=>{this._enabled&&console.warn(`[${this._prefix}]: `,...e)},this.error=(...e)=>{this._enabled&&console.error(`[${this._prefix}]: `,...e)},this.table=(...e)=>{this._enabled&&console.table(...e)},this._prefix=t}get _enabled(){return x.enable}get _enableLong(){return x.enableLong}get long(){return this._enableLong}};x.enable=!1,x.enableLong=!1;let E=x;function S(i){i=i.filter(Boolean);const t=new Uint8Array(i.reduce((s,r)=>s+r.byteLength,0));let e=0;return i.forEach(s=>{t.set(s,e),e+=s.byteLength}),t}const A={codec:"avc1.4DE033",MaxCachedFrameSize:100,RealSpeedPercent:.8,UplinkBitrateCheckInterval:60*1e3,VideoBitrateDefault:1e6,AudioBitrateDefault:68e3,gopSize:90,sampleRate:48e3,channel:2,audioEncoderPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.1/1735619140327/pcm2aac.js",audioEncoderWasmPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.2/1735619208418/pcm2aac.wasm",ignoreRelPublish:!1},T=new E("RTMP_AudioEncoder");class j{constructor(t){this._encodedFrameCount=0,this._ready=!1,this._lastFrame=null,this._aacOutput=(e,s)=>{const r=this._module.HEAPU8.subarray(e,e+s);if(!this._lastFrame)return;this._encodedFrameCount++;const{props:o}=this._lastFrame,_={buffer:new Uint8Array(r),props:{timestamp:parseInt(o.timestamp/1e3),originTs:parseInt(o.timestamp/1e3)}};this._core.emit(l.OnAudioEncoded,_)},this._core=t}async init(){const t=await fetch(A.audioEncoderPath).then(_=>_.text());new Function(`self.exports={};${t}`)();const e=self.exports.m;let s,r;const o=new Promise((_,c)=>{r=_,s=c});return e({instantiateWasm:function(_,c){fetch(A.audioEncoderWasmPath).then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,_)).then(function(u){return c(u.instance)}).then(()=>{r(),T.log("aac module inited")}).catch(u=>{s(u)})}}).then(_=>{const c=_.addFunction(this._aacOutput,"vii");_._init_callback(c),this._module=_}).catch(s),o}rnnoise(t){var s;const e=t.length;for(let r=0;r<e;r++)t[r]=t[r]*32768;(s=this._rnnoiseModule)==null||s.processFrame(t);for(let r=0;r<e;r++)t[r]=t[r]/32768}updateConfigure(){this._module._flush(),this._module._free_encoder(),this._ready=!1}encode(t){if(!this._ready){const o=this._start_encoder();if(o<0)throw new Error(`init aac encoder error, code:${o}`)}this._lastFrame=t;const e=t.buffer.buffer,s=this._module._malloc(e.byteLength);this._module.HEAPU8.subarray(s,s+e.byteLength).set(new Uint8Array(e));const r=this._module._encode_one_frame(s);if(r<0)throw new Error(`encode aac frame error, code:${r}`)}_start_encoder(){const t=this._core.getSetting(),e=this._module._init_encoder(t.sampleRate,t.channel,t.audioBitrate);if(e<0)return e;this._ready=!0,T.log(`init encoder: sampleRate=${t.sampleRate}, channel:${t.channel}, bitrate:${t.audioBitrate}`)}destroy(){var t;(t=this._module)==null||t._free_encoder()}}const P=1024;class M{constructor(){this._queue=[],this._sampleCount=0}compose(t){if(this._queue.push(t),this._sampleCount+=t.data.audioData.numberOfFrames,this._sampleCount>=P)return this._doCompose()}_doCompose(){const t=new Float32Array(P);let e=0,s=P;const r=this._queue[0];for(;;){const o=this._queue[0];if(!o)break;const _=Math.min(s,o.data.audioData.numberOfFrames-o.offset,480),c=o.data.buffer.slice(o.offset,o.offset+_);if(o.offset+=_,o.offset>=o.data.audioData.numberOfFrames&&this._queue.shift(),s-=_,this._sampleCount-=_,t.set(c,e),e+=_,s<=0)break}return{buffer:t,props:{timestamp:r.data.audioData.timestamp,sampleRate:r.data.audioData.sampleRate,numberOfChannels:r.data.audioData.numberOfChannels}}}}var y=(i=>(i[i.RTMP_INIT_FAIL=3e3]="RTMP_INIT_FAIL",i[i.AUDIO_ENCODER_INIT_FAIL=3001]="AUDIO_ENCODER_INIT_FAIL",i[i.AUDIO_RRNOISE_INIT_FAIL=3002]="AUDIO_RRNOISE_INIT_FAIL",i[i.AUDIO_ENCODE_FAIL=3003]="AUDIO_ENCODE_FAIL",i[i.VIDEO_ENCODE_CONFIGURE_FAIL=3004]="VIDEO_ENCODE_CONFIGURE_FAIL",i[i.VIDEO_ENCODE_FAIL=3005]="VIDEO_ENCODE_FAIL",i[i.WTP_OPEN_FAIL=3006]="WTP_OPEN_FAIL",i[i.WTP_CONNECT_FAIL=3007]="WTP_CONNECT_FAIL",i[i.WORKER_ERROR=3008]="WORKER_ERROR",i))(y||{});class W extends Error{constructor(t,e,s){super(),this.code=t,this.message=e,s&&(this.ext=s),this.toJson=()=>({code:this.code,message:this.message,ext:this.ext})}}function b(i,t,e){return new W(i,t,e)}class G{constructor(t){this._audioFrameQueue=new M,this.encode=e=>{const s=new Float32Array(e.numberOfFrames);e.copyTo(s,{planeIndex:0,frameOffset:0,frameCount:e.numberOfFrames});const r=this._audioFrameQueue.compose({offset:0,data:{audioData:e,buffer:s}});if(r)try{this._encoder.encode(r)}catch(o){this._core.emit(O.OnError,b(y.AUDIO_ENCODE_FAIL,o.message))}},this._core=t,this._encoder=new j(t)}async init(){try{await this._encoder.init()}catch(t){throw b(y.AUDIO_ENCODER_INIT_FAIL,t.message)}}setConfiguration(t){const e=Object.assign({},this._core.getSetting(),{audioBitrate:t});this._core.updateSetting(e),this._encoder.updateConfigure()}destroy(){this._encoder.destroy()}}const L=new E("RTMP_VEncoder");class J{constructor(t){this._encoder=null,this._queue=[],this._encodeTimer=0,this._loopEncodeTimer=0,this._frameIndex=0,this._gopSize=0,this._encodedFrameCount=0,this._lastFrame=null,this._startTimer=()=>{this._clearEncodeTimer(),this._encodeTimer=setInterval(()=>{const e=this._queue.shift();if(!(!e||!this._encoder||this._encoder.state==="closed"))try{this._encoder.encode(e,{keyFrame:this._frameIndex%this._gopSize===0}),this._frameIndex++,this._lastFrame&&this._lastFrame.close(),this._lastFrame=e}catch(s){L.log("encode frame error",s)}},5)},this._core=t}configurate(t){return this._gopSize=t.gopSize,this._encoder?this.flush().then(()=>this._configure(t)):this._configure(t)}_configure(t){return this._clearEncodeTimer(),L.log("start config encoder",t),VideoEncoder.isConfigSupported(t).then(e=>{if(!e.supported)throw new Error(`VideoEncoder not support config, ${JSON.stringify(t)}`);this._encoder=new VideoEncoder({output:(s,r)=>{const o=new Uint8Array(s.byteLength);s.copyTo(o),this._emitFrame(o,s,r)},error:s=>{this._clearEncodeTimer(),this._core.emit(O.OnError,b(y.VIDEO_ENCODE_FAIL,s.message))}}),this._encoder.configure(t),L.log("encoder configured")}).then(this._startTimer).catch(e=>{throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,e.message)})}_emitFrame(t,e,s){this._encodedFrameCount++,this._core.emit(l.OnVideoEncoded,{buffer:t,props:{byteLength:e.byteLength,duration:e.duration,timestamp:parseInt(e.timestamp/1e3),originTs:parseInt(e.timestamp/1e3),type:e.type},cfg:s.decoderConfig})}_clearEncodeTimer(){clearInterval(this._encodeTimer)}_clearLoopEncodeTimer(){this._loopEncodeTimer&&clearInterval(this._loopEncodeTimer)}flush(){return this._encoder?this._encoder.flush().then(()=>{var t;this._clearEncodeTimer(),(t=this._encoder)==null||t.close(),this._frameIndex=0,this._encoder=null,L.log("encoder flush & closed")}).catch(t=>{console.log("encoder flush & close error:",t)}):Promise.resolve()}encode(t){this._clearLoopEncodeTimer(),this._queue.push(t)}startLoop(t){if(!this._lastFrame)return;const e=Math.floor(1e3/t*1e3);L.log("start encode last frame looped, ",t,"increment:",e),this._loopEncodeTimer=setInterval(()=>{if(!this._lastFrame)return;const s=new VideoFrame(this._lastFrame,{duration:e,timestamp:(this._lastFrame.timestamp||0)+e});this._queue.push(s)},Math.floor(1e3/t))}destroy(){this._queue.forEach(t=>t.close()),this._lastFrame&&this._lastFrame.close(),this._clearEncodeTimer(),this._clearLoopEncodeTimer(),this.flush()}}const Q=new E("RTMP_VideoEncode");class K{constructor(t){this._core=t,this._encoder=new J(t)}async setConfiguration(t={}){const e=Object.assign({},this._core.getSetting(),t),s={width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,bitrate:e.videoBitrate,framerate:Math.floor(e.frameRate),codec:e.codec,gopSize:e.gopSize,hardwareAcceleration:e.hardwareAcceleration};this._core.updateSetting(e),Q.log("set Configuration:",s,t);try{await this._encoder.configurate(s)}catch(r){this._core.emit(O.OnError,r)}}encode(t){this._encoder.encode(t)}startLoopEncodeLastFrame(){this._encoder.startLoop(this._core.getSetting().frameRate)}flushEncoder(){this._encoder.flush()}destroy(){this._encoder.destroy()}}const V=new E("RTMP_AVSync");class Z{constructor(t){this._videoFrameGot=!1,this._videoBaseDts=0,this._audioBaseDts=0,this._videoNextDts=0,this._videoLastDts=0,this._audioNextDts=0,this._lastVideoReceived=0,this._core=t}get avExist(){return this._core.getSetting().hasVideo&&this._core.getSetting().hasAudio}get videoRefDuration(){return parseInt(1e3/this._core.getSetting().frameRate)}get audioRefDuration(){return parseInt(1024/this._core.getSetting().sampleRate*1e3)}addVideoFrame(t){this._videoFrameGot||(this._videoFrameGot=!0);const e=t.props;if(Math.abs(this._videoNextDts-e.timestamp-this._videoBaseDts)>1e3){const r=Date.now()-this._lastVideoReceived;this._videoNextDts=this._videoNextDts===this._audioNextDts?this._videoNextDts+this.videoRefDuration:this._audioNextDts||this._videoNextDts+r,this._videoBaseDts=this._videoNextDts-e.timestamp,V.warn(`video stream timestamp breaked! dts:${this._videoNextDts} -> ${e.timestamp}, videoBaseDts=${this._videoBaseDts}, deltaToLastFrame=${r}`)}e.timestamp=e.timestamp+this._videoBaseDts;const s=e.timestamp-this._videoLastDts;return s>100&&V.warn("video frame large gap",s),this._videoLastDts=this._videoNextDts=e.timestamp,V.long&&V.log(`V frame, dts: ${e.timestamp}, originDts:${e.originTs}, videoBaseDts=${this._videoBaseDts}, type=${e.type}, duration=${s}`),this._lastVideoReceived=Date.now(),this._core.emit(l.OnEncodedFrame,I.Video,t),{size:t.buffer.length,duration:s,key:t.props.type==="key"}}addAudioFrame(t){if(this.avExist&&!this._videoFrameGot)return;const e=t.props;return this._audioBaseDts||(this._audioBaseDts=e.timestamp-this._videoNextDts),Math.abs(e.timestamp-this._audioBaseDts-this._audioNextDts)>1e3&&(this._audioBaseDts=this._audioNextDts+this.audioRefDuration-e.timestamp,V.warn(`audio stream timestamp breaked! dts:${this._audioNextDts} -> ${e.timestamp}, audioBaseDts=${this._audioBaseDts}`)),this._audioNextDts=e.timestamp=e.timestamp-this._audioBaseDts,V.long&&V.log(`A frame, dts: ${e.timestamp}, originDts:${e.originTs}`),this._core.emit(l.OnEncodedFrame,I.Audio,t),{size:t.buffer.length,duration:this.audioRefDuration}}}class X{constructor(){this._videoSize=0,this._videoDuration=0,this._videoBitrate=0,this._frameCount=0,this._fps=0,this._videoEncodedCount=0,this._keyCount=0,this._audioSize=0,this._audioDuration=0,this._audioBitrate=0,this._audioEncodedCount=0}get videoStats(){return{sendBitrate:this._videoBitrate,framesPerSecond:this._fps,framesEncoded:this._videoEncodedCount,keyFramesEncoded:this._keyCount}}get audioStats(){return{sendBitrate:this._audioBitrate,framesEncoded:this._audioEncodedCount}}addVideoSample({size:t,duration:e,key:s}){this._videoEncodedCount++,this._videoSize+=t,this._videoDuration+=e,this._frameCount++,s&&this._keyCount++,this._videoDuration>=1e3&&(this._videoBitrate=Math.floor(this._videoSize/this._videoDuration*8e3),this._fps=this._frameCount,this._frameCount=0,this._videoSize=0,this._videoDuration=0)}addAudioSample({size:t,duration:e}){this._audioEncodedCount++,this._audioSize+=t,this._audioDuration+=e,this._audioDuration>=1e3&&(this._audioBitrate=Math.floor(this._audioSize/this._audioDuration*1e3),this._audioSize=0,this._audioDuration=0)}}const Y=new E("RTMP_EncodeController");class ee{constructor(t){this._analyse=new X,this._gotFrame=!1,this._OnVideoCaptured=(e,s)=>{this._gotFrame=!0,this._videoSettingChanged(s)&&(Y.log("video track setting changed!",s),this._core.updateSetting({width:s.width,height:s.height,frameRate:s.frameRate,vDeviceId:s.deviceId}),this._videoEncode.setConfiguration()),this._videoEncode.encode(e)},this._OnVideoCaptureNoOutput=()=>{this._videoEncode.startLoopEncodeLastFrame()},this._OnAudioCaptured=e=>{this._gotFrame=!0,this._audioEncode.encode(e)},this._OnVideoEncoded=e=>{const s=this._avSync.addVideoFrame(e);this._analyse.addVideoSample(s)},this._OnAudioEncoded=e=>{if(!e.buffer.length)return;const s=this._avSync.addAudioFrame(e);s&&this._analyse.addAudioSample(s)},this._OnUpstreamFeedback=e=>{this._videoEncode.setConfiguration(e)},this._OnBitrateChanged=(e,s)=>{this._gotFrame&&(e===I.Video&&this._videoEncode.setConfiguration({videoBitrate:s}),e===I.Audio&&this._audioEncode.setConfiguration(s))},this._core=t,this._audioEncode=new G(t),this._videoEncode=new K(t),this._avSync=new Z(t),this._bindEvents()}getStats(){return{video:this._analyse.videoStats,audio:this._analyse.audioStats}}init(){return this._audioEncode.init()}_bindEvents(){this._core.on(l.OnVideoCaptured,this._OnVideoCaptured),this._core.on(l.OnAudioCaptured,this._OnAudioCaptured),this._core.on(l.OnVideoCaptureNoOutput,this._OnVideoCaptureNoOutput),this._core.on(l.OnVideoEncoded,this._OnVideoEncoded),this._core.on(l.OnAudioEncoded,this._OnAudioEncoded),this._core.on(l.OnUpstreamFeedback,this._OnUpstreamFeedback),this._core.on(l.OnBitrateChanged,this._OnBitrateChanged)}_videoSettingChanged(t){const e=this._core.getSetting();return t.width!==e.width||t.height!==e.height||Math.floor(t.frameRate)!==Math.floor(e.frameRate)||t.deviceId!==e.vDeviceId}destroy(){this._videoEncode.destroy(),this._audioEncode.destroy()}}var B=(i=>(i[i.AUDIO=8]="AUDIO",i[i.VIDEO=9]="VIDEO",i[i.SCRIPT_DATA=18]="SCRIPT_DATA",i))(B||{});const te=10,ie=1,se=7,oe={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function re(i){const t=(i[4]&3)+1;let e;const s=[],r=[];let o=6;const _=i[5]&31;let c;for(let n=0;n<_;n++){if(c=i[o]<<8|i[o+1],o+=2,!c)continue;const h=i.subarray(o,o+c);o+=c,s.push(h)}const u=i[o];o++;let a;for(let n=0;n<u;n++)a=i[o]<<8|i[o+1],o+=2,a&&(r.push(i.subarray(o,o+a)),o+=a);return{sps:e,spsArr:s,ppsArr:r,nalUnitSize:t}}class ne{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,channelCount:1},this._hasAudioSeqHeader=!1,this._hasVideoSeqHeader=!1}setConfig(t){this._cfg=Object.assign(this._cfg,t)}genHeader(){const t=[70,76,86,1,(this._cfg.hasAudio?1:0)<<2|(this._cfg.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(t)}genSeqTag(t,e){let s;t===8?(s=this._genAudioTagPaylod(0,e),this._hasAudioSeqHeader=!0):(s=this._genVideoTagPayload(0,e),this._hasVideoSeqHeader=!0);const r=this._genTagHeader(t,s.length,e.props.timestamp),o=r.length+s.length;return S([r,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}genFrameTag(t,e){let s;t===8?s=this._genAudioTagPaylod(1,e):s=this._genVideoTagPayload(1,e);const r=this._genTagHeader(t,s.length,e.props.timestamp),o=r.length+s.length;return S([r,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}_genTagHeader(t,e,s){return new Uint8Array([t,e>>>16,e>>>8,e,s>>>16,s>>>8,s,s>>>24,0,0,0])}_genAudioTagPaylod(t,e){return S(t===0?[this._genAudioTagHeader(),this._genAudioSequenceHeader()]:[this._genAudioTagHeader(),this._genAudioData(e)])}_genAudioTagHeader(){return new Uint8Array([te<<4|12|ie<<1|this._cfg.channelCount-1])}_genAudioSequenceHeader(){const t=4096|oe[this._cfg.sampleRate]<<7|this._cfg.channelCount<<3;return new Uint8Array([0,t>>8,t])}_genAudioData(t){const e=new Uint8Array(1+t.buffer.length);return e.set([1],0),e.set(t.buffer,1),e}_genVideoTagPayload(t,e){return S(t===0?[this._genVideoTagHeader(e),this._genVideoSequenceHeader(e)]:[this._genVideoTagHeader(e),this._genVideoData(e)])}_genVideoTagHeader(t){return new Uint8Array([(t.props.type==="key"?1:2)<<4|se,this._hasVideoSeqHeader?1:0,0,0,0])}_genVideoSequenceHeader(t){return new Uint8Array(t.cfg.description)}_genVideoData(t){if(t.props.type==="delta")return t.buffer;const e=re(new Uint8Array(t.cfg.description)),s=e.spsArr[0].length,r=e.ppsArr[0].length;return S([new Uint8Array([0,0,s>>8,s%256]),e.spsArr[0],new Uint8Array([0,0,r>>8,r%256]),e.ppsArr[0],t.buffer])}}const ae=new E("RTMP_Packet");class de{constructor(t){this._firstFrame=!0,this._flv=new ne,this._OnEncodedFrame=(e,s)=>{if(this._firstFrame){const o=this._core.getSetting();this._flv.setConfig({hasVideo:o.hasVideo,hasAudio:o.hasAudio,sampleRate:o.sampleRate,channelCount:o.channel});const _=this._flv.genHeader();if(this._core.emit(l.OnPacketed,_),o.hasVideo){const c=this._flv.genSeqTag(B.VIDEO,s);this._core.emit(l.OnPacketed,c)}if(o.hasAudio){const c=this._flv.genSeqTag(B.AUDIO,s);this._core.emit(l.OnPacketed,c)}this._firstFrame=!1,ae.log("first frame encoded & packed")}const r=this._flv.genFrameTag(e==="video"?B.VIDEO:B.AUDIO,s);this._core.emit(l.OnPacketed,r,s.props.type==="key")},this._core=t,this._bindEvents()}_bindEvents(){this._core.on(l.OnEncodedFrame,this._OnEncodedFrame)}destroy(){}}class he{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(t){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=t;const e=Date.now()-this._lastDot;e>=500&&(this._addSpeedSample(this._totalSize/e*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(t){this._speed.push(t),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((t,e)=>t+=e,0)/this._speed.length):0}}const D=new E("RTMP_Wtp");class ce{constructor(t){this._queue=[],this._url="",this._connectClosed=!1,this._upSpeed=new he,this._transport=null,this._writer=null,this._inWriting=!1,this._inAdjustEncode=!1,this._increaseTimer=0,this._firstFramePushed=!1,this._core=t,this._bindEvents()}get sendSpeed(){return this._upSpeed.getUpSpeed()}getStats(){var t;return(t=this._transport)==null?void 0:t.getStats()}_bindEvents(){this._core.on(l.OnPacketed,(t,e=!1)=>{this._checkDecreaseBitrate(),this._checkDeleteCache(e),this._queue.push(t),this._inWriting||this._write()})}_checkDecreaseBitrate(){if(this._inAdjustEncode)return;const t=this._upSpeed.getUpSpeed();if(!t||this._queue.length<A.MaxCachedFrameSize)return;D.log(`up speed: ${t} low, ajust encode setting`);const e=this._core.getSetting();this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t*A.RealSpeedPercent,width:e.width,height:e.height,frameRate:e.frameRate}),this._inAdjustEncode=!0,this._checkIncreaseBitrate()}_checkIncreaseBitrate(){D.log("add timer to check uplink speed increased"),clearInterval(this._increaseTimer),this._increaseTimer=setTimeout(()=>{const t=this._core.getSetting();D.log(`set encode bitrate to specified ${t.videoBitrate}`),this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t.videoBitrate,width:t.width,height:t.height,frameRate:t.frameRate}),this._inAdjustEncode=!0},A.UplinkBitrateCheckInterval)}_checkDeleteCache(t){this._inAdjustEncode&&t&&(D.log(`ajust encode setting finish, delete cached ${this._queue.length} frame`),this._queue=[],this._upSpeed.reset(),this._inAdjustEncode=!1)}async start(t){this._url=t;try{await this._connect()}catch(e){throw b(y.WTP_OPEN_FAIL,e.message)}}async _connect(){const t=new WebTransport(this._url);let e;t.closed.then(()=>{D.log("webtransport closed")}).catch(r=>{e=r.message,D.log("webtransport closed due to",r)}).finally(()=>{this._connectClosed=!0,this._core.emit(O.OnConnectClosed,e),this._core.emit(O.OnError,b(y.WTP_CONNECT_FAIL,e))}),await t.ready,this._transport=t;const s=await t.createBidirectionalStream();this._writer=s.writable.getWriter(),this._write(),D.log("transport opend")}async _write(){var e;if(!this._writer)return;this._inWriting=!0;const t=this._queue.shift();if(!t){this._inWriting=!1;return}await((e=this._writer)==null?void 0:e.write(t)),this._firstFramePushed||(this._firstFramePushed=!0,this._core.emit(O.OnFirstFramePushed),D.log("first frame pushed")),this._upSpeed.addSample(t.length);try{await this._write()}catch(s){D.log("writer error:",s)}}getFile(){return S(this._queue)}destroy(){var t,e;clearTimeout(this._increaseTimer),this._connectClosed||(t=this._writer)==null||t.close(),this._writer=null,(e=this._transport)==null||e.close(),this._transport=null}}const ue=new E("LiveRTMP");class _e extends H{constructor(){super(),this._ts=0,this._setting={codec:A.codec,hardwareAcceleration:"prefer-hardware",width:-1,height:-1,frameRate:-1,sampleRate:A.sampleRate,channel:A.channel,gopSize:A.gopSize,videoBitrate:A.VideoBitrateDefault,audioBitrate:A.AudioBitrateDefault,hasAudio:!1,hasVideo:!1,vDeviceId:"",aDeviceId:""},this._encode=new ee(this),this._packet=new de(this),this._transport=new ce(this)}async checkVideoHardwareAcceleration(){const t=["prefer-hardware","prefer-software","no-preference"],e=this.getSetting(),s={codec:e.codec,width:1280,height:720,framerate:15,bitrate:e.videoBitrate};for(const r of t)try{if((await VideoEncoder.isConfigSupported({...s,hardwareAcceleration:r})).supported)return this.updateSetting({hardwareAcceleration:r}),Promise.resolve()}catch{throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,`VideoEncoder not support hardwareAcceleration, ${JSON.stringify({...s,hardwareAcceleration:r})}`)}throw b(y.VIDEO_ENCODE_CONFIGURE_FAIL,"VideoEncoder not support hardwareAcceleration")}async ready(){await Promise.all([this.checkVideoHardwareAcceleration(),this._encode.init()])}getSetting(){return this._setting}updateSetting(t){this._setting=Object.assign({},this._setting,t)}videoFrameCaptured(t,e){this.emit(l.OnVideoCaptured,t,e)}audioFrameCaptured(t,e){this.emit(l.OnAudioCaptured,t,e)}startMockVideoEncode(){this.emit(l.OnVideoCaptureNoOutput)}adjustBitrate(t,e){t===I.Video&&this.updateSetting({videoBitrate:e}),t===I.Audio&&this.updateSetting({audioBitrate:e}),this.emit(l.OnBitrateChanged,t,e)}avExist(t,e){this._setting.hasVideo=t,this._setting.hasAudio=e}publish(t){return this._transport.start(t)}setEncodeCapacity(t){this._setting=Object.assign({},this._setting,t)}getStats(){return{video:{...this._encode.getStats().video,sendSpeed:this._transport.sendSpeed,codec:this._setting.codec,frameWidth:this._setting.width,frameHeight:this._setting.height,gopSize:this._setting.gopSize},audio:{...this._encode.getStats().audio,codec:"aac",channels:this._setting.channel,sampleRate:this._setting.sampleRate}}}destroy(){ue.log("destroy"),this._encode.destroy(),this._packet.destroy(),this._transport.destroy()}down(){return this._transport.getFile()}}self.constructor.name!=="Window"&&le();function le(){let i={};self.addEventListener("message",async t=>{switch(t.data.type){case v.Init:{const{options:e}=t.data;e.logEnable&&(E.enable=!0),e.logEnableLong&&(E.enableLong=!0),i=new _e,i.on(O.OnError,s=>{self.postMessage({type:w.Error,data:s.toJson()})}),i.on(O.OnConnectClosed,()=>{self.postMessage({type:w.Close})}),i.on(O.OnFirstFramePushed,()=>{self.postMessage({type:w.FirstFramePushed})});try{await i.ready(),self.postMessage({type:w.Ready})}catch(s){self.postMessage({type:w.Error,data:s.toJson()})}}break;case v.AvExist:{const{hasAudio:e,hasVideo:s}=t.data;i.avExist(s,e)}break;case v.VideoFrame:{const{frame:e,setting:s}=t.data;i.videoFrameCaptured(e,s)}break;case v.MockVideoEncode:i.startMockVideoEncode();break;case v.AudioFrame:{const{frame:e,setting:s}=t.data;i.audioFrameCaptured(e,s)}break;case v.AdjustBitrate:{const{kind:e,bitrate:s}=t.data;i.adjustBitrate(e,s)}break;case v.Publish:{const{url:e}=t.data;try{await i.publish(e)}catch(s){self.postMessage({type:w.Error,data:s.toJson()})}}break;case v.GetStats:self.postMessage({type:w.STATS,data:i.getStats()});break;case v.EncodeConfig:{i.setEncodeCapacity(t.data.cfg);break}case v.Download:{const e=i.down();self.postMessage({type:w.Flvfile,buffer:e},[e.buffer])}break;case v.UnPublish:{i.destroy();break}}})}})();\n', fi = typeof self < "u" && self.Blob && new Blob([Cs], { type: "text/javascript;charset=utf-8" });
5256
+ function Yu(r) {
5222
5257
  let e;
5223
5258
  try {
5224
- if (e = li && (self.URL || self.webkitURL).createObjectURL(li), !e) throw "";
5259
+ if (e = fi && (self.URL || self.webkitURL).createObjectURL(fi), !e) throw "";
5225
5260
  const t = new Worker(e, {
5226
5261
  name: r == null ? void 0 : r.name
5227
5262
  });
@@ -5230,7 +5265,7 @@ function Ku(r) {
5230
5265
  }), t;
5231
5266
  } catch {
5232
5267
  return new Worker(
5233
- "data:text/javascript;charset=utf-8," + encodeURIComponent(_s),
5268
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Cs),
5234
5269
  {
5235
5270
  name: r == null ? void 0 : r.name
5236
5271
  }
@@ -5244,10 +5279,10 @@ try {
5244
5279
  } catch {
5245
5280
  }
5246
5281
  const Le = new ee("Bridge");
5247
- class gs extends qu {
5282
+ class ys extends Xu {
5248
5283
  // static version = __VERSION__
5249
5284
  constructor() {
5250
- super(), this._worker = null, this._audioMsTrack = null, this._videoMsTrack = null, this._capture = new Xu(this);
5285
+ super(), this._worker = null, this._audioMsTrack = null, this._videoMsTrack = null, this._capture = new Ju(this);
5251
5286
  }
5252
5287
  static isSupported() {
5253
5288
  return typeof WebTransport < "u" && typeof MediaStreamTrackProcessor < "u" && typeof MediaStreamTrackGenerator < "u" && typeof VideoEncoder < "u";
@@ -5274,9 +5309,9 @@ class gs extends qu {
5274
5309
  }
5275
5310
  };
5276
5311
  try {
5277
- this._worker = new Ku();
5312
+ this._worker = new Yu();
5278
5313
  } catch (o) {
5279
- t(pi(wt.RTMP_INIT_FAIL, o.message));
5314
+ t(mi(Ot.RTMP_INIT_FAIL, o.message));
5280
5315
  }
5281
5316
  return (n = this._worker) == null || n.postMessage({
5282
5317
  type: N.Init,
@@ -5299,7 +5334,7 @@ class gs extends qu {
5299
5334
  Le.table(i.data.data), this.emit(se.OnError, i.data.data);
5300
5335
  break;
5301
5336
  case re.Flvfile:
5302
- Ju(i.data.buffer);
5337
+ Zu(i.data.buffer);
5303
5338
  break;
5304
5339
  case re.FirstFramePushed:
5305
5340
  this.emit(se.OnFirstFramePushed);
@@ -5311,7 +5346,7 @@ class gs extends qu {
5311
5346
  }), (t = this._worker) == null || t.addEventListener("error", (i) => {
5312
5347
  this.emit(
5313
5348
  se.OnError,
5314
- pi(wt.WORKER_ERROR, i.message)
5349
+ mi(Ot.WORKER_ERROR, i.message)
5315
5350
  );
5316
5351
  });
5317
5352
  }
@@ -5417,14 +5452,14 @@ class gs extends qu {
5417
5452
  });
5418
5453
  }
5419
5454
  }
5420
- function Ju(r) {
5455
+ function Zu(r) {
5421
5456
  const e = document.createElement("a");
5422
5457
  e.href = URL.createObjectURL(new Blob([r])), e.download = Date.now() + ".flv", e.click();
5423
5458
  }
5424
- const mi = new ce("RTMPConnect");
5425
- class Yu {
5459
+ const _i = new ce("RTMPConnect");
5460
+ class Qu {
5426
5461
  constructor(e, t, i, s) {
5427
- this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = i, this._OnSuccess = s, this._rtmp = new gs(), this._bindEvents();
5462
+ this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = i, this._OnSuccess = s, this._rtmp = new ys(), this._bindEvents();
5428
5463
  }
5429
5464
  get isPushing() {
5430
5465
  return this._isPushing;
@@ -5446,7 +5481,7 @@ class Yu {
5446
5481
  await this._rtmp.ready(), i && this._rtmp.setEncodeCapacity(i), e.filter(Boolean).forEach((s) => this._rtmp.addTrack(s)), t[0] && this._rtmp.adjustBitrate(Z.Audio, t[0]), t[1] && this._rtmp.adjustBitrate(Z.Video, t[1]), this._rtmp.publish(this._url);
5447
5482
  }
5448
5483
  updatePublish(e, t) {
5449
- mi.log(`replace track to ${e == null ? void 0 : e.label}`), this._rtmp.replaceTrack(t, e);
5484
+ _i.log(`replace track to ${e == null ? void 0 : e.label}`), this._rtmp.replaceTrack(t, e);
5450
5485
  }
5451
5486
  applyBitrate(e, t) {
5452
5487
  this._rtmp.adjustBitrate(t, e);
@@ -5458,11 +5493,11 @@ class Yu {
5458
5493
  return this._rtmp.getStats();
5459
5494
  }
5460
5495
  unpublish() {
5461
- mi.warn("unpublish"), this._rtmp.unpublish(), this._isPushing = !1;
5496
+ _i.warn("unpublish"), this._rtmp.unpublish(), this._isPushing = !1;
5462
5497
  }
5463
5498
  }
5464
- const Zu = new ce("PushController");
5465
- class Qu extends ls {
5499
+ const eh = new ce("PushController");
5500
+ class th extends _s {
5466
5501
  constructor(e, {
5467
5502
  config: t,
5468
5503
  streamConsumeController: i
@@ -5471,7 +5506,7 @@ class Qu extends ls {
5471
5506
  timeout: 5e3,
5472
5507
  retryCount: 1,
5473
5508
  retryDelay: 1e3
5474
- }, this._audioBitrate = fe(Di, "audio").bitrate, this._videoBitrate = fe(Ii, "video").bitrate, this.handleAudioStreamChange = (s) => {
5509
+ }, this._audioBitrate = fe(Fi, "audio").bitrate, this._videoBitrate = fe(Li, "video").bitrate, this.handleAudioStreamChange = (s) => {
5475
5510
  this.updatePush({
5476
5511
  audioTrack: s.audioTrack
5477
5512
  });
@@ -5546,7 +5581,7 @@ class Qu extends ls {
5546
5581
  if (!i && !s)
5547
5582
  return;
5548
5583
  let n;
5549
- this._pushMode === "rtm" ? n = new zu(e, this._pushConfig, this._OnRtcStateChange) : n = new Yu(
5584
+ this._pushMode === "rtm" ? n = new Hu(e, this._pushConfig, this._OnRtcStateChange) : n = new Qu(
5550
5585
  e,
5551
5586
  this._pushConfig,
5552
5587
  this._OnRTMPError,
@@ -5559,7 +5594,7 @@ class Qu extends ls {
5559
5594
  t
5560
5595
  );
5561
5596
  } catch (a) {
5562
- Zu.groupEnd(), n.unpublish();
5597
+ eh.groupEnd(), n.unpublish();
5563
5598
  const o = new Te(
5564
5599
  V.PUBLISH_FAILED,
5565
5600
  a.message,
@@ -5620,14 +5655,14 @@ class Qu extends ls {
5620
5655
  return this._pushMode;
5621
5656
  }
5622
5657
  }
5623
- class eh extends te {
5658
+ class rh extends te {
5624
5659
  constructor(e) {
5625
- super(), this._previewConsumer = new Du(
5660
+ super(), this._previewConsumer = new Lu(
5626
5661
  e.getComposedStream(),
5627
5662
  {
5628
5663
  streamConsumeController: this
5629
5664
  }
5630
- ), this._pushConsumer = new Qu(
5665
+ ), this._pushConsumer = new th(
5631
5666
  e.getComposedStream(),
5632
5667
  {
5633
5668
  streamConsumeController: this
@@ -5674,13 +5709,13 @@ class eh extends te {
5674
5709
  await this._pushConsumer.destroy(), this._previewConsumer.destroy();
5675
5710
  }
5676
5711
  }
5677
- const th = () => typeof window > "u", z = {}, ze = async (r) => {
5712
+ const ih = () => typeof window > "u", z = {}, ze = async (r) => {
5678
5713
  const e = new RTCPeerConnection({ sdpSemantics: "unified-plan" });
5679
5714
  e.addTransceiver("video", { direction: r });
5680
5715
  const t = await e.createOffer();
5681
5716
  return e.close(), t.sdp.toLowerCase();
5682
5717
  };
5683
- function vs(r) {
5718
+ function Ss(r) {
5684
5719
  const e = r.split(`
5685
5720
  `);
5686
5721
  let t = !1;
@@ -5713,30 +5748,30 @@ function vs(r) {
5713
5748
  }
5714
5749
  return !1;
5715
5750
  }
5716
- const rh = async () => {
5751
+ const sh = async () => {
5717
5752
  let r = await ze("sendonly");
5718
- return navigator.userAgent.includes("VivoBrowser") && (r = await ze("sendonly")), z.h264encode = vs(r), z.vp8encode = r.indexOf("vp8") > -1, z;
5719
- }, ih = async () => {
5753
+ return navigator.userAgent.includes("VivoBrowser") && (r = await ze("sendonly")), z.h264encode = Ss(r), z.vp8encode = r.indexOf("vp8") > -1, z;
5754
+ }, nh = async () => {
5720
5755
  let r = await ze("recvonly");
5721
- return navigator.userAgent.includes("VivoBrowser") && (r = await ze("recvonly")), z.h264decode = vs(r), z.vp8decode = r.indexOf("vp8") > -1, z;
5722
- }, sh = async () => {
5756
+ return navigator.userAgent.includes("VivoBrowser") && (r = await ze("recvonly")), z.h264decode = Ss(r), z.vp8decode = r.indexOf("vp8") > -1, z;
5757
+ }, oh = async () => {
5723
5758
  if (typeof z.h264encode > "u")
5724
5759
  try {
5725
- await rh();
5760
+ await sh();
5726
5761
  } catch {
5727
5762
  return !1;
5728
5763
  }
5729
5764
  return z.h264encode || !1;
5730
- }, nh = async () => {
5765
+ }, ah = async () => {
5731
5766
  if (typeof z.h264decode > "u")
5732
5767
  try {
5733
- await ih();
5768
+ await nh();
5734
5769
  } catch {
5735
5770
  return !1;
5736
5771
  }
5737
5772
  return z.h264decode || !1;
5738
5773
  };
5739
- class oh {
5774
+ class ch {
5740
5775
  /** {zh}
5741
5776
  * @brief 构造函数
5742
5777
  * @hidden
@@ -5760,8 +5795,8 @@ class oh {
5760
5795
  };
5761
5796
  }
5762
5797
  }
5763
- const ah = new oh();
5764
- let Cs = !0, ys = !0;
5798
+ const dh = new ch();
5799
+ let Ts = !0, Es = !0;
5765
5800
  function Fe(r, e, t) {
5766
5801
  const i = r.match(e);
5767
5802
  return i && i.length >= t && parseInt(i[t], 10);
@@ -5810,23 +5845,23 @@ function de(r, e, t) {
5810
5845
  configurable: !0
5811
5846
  });
5812
5847
  }
5813
- function ch(r) {
5814
- return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Cs = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
5848
+ function uh(r) {
5849
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Ts = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
5815
5850
  }
5816
- function dh(r) {
5817
- return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (ys = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
5851
+ function hh(r) {
5852
+ return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Es = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
5818
5853
  }
5819
- function Ss() {
5854
+ function bs() {
5820
5855
  if (typeof window == "object") {
5821
- if (Cs)
5856
+ if (Ts)
5822
5857
  return;
5823
5858
  typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
5824
5859
  }
5825
5860
  }
5826
- function Zt(r, e) {
5827
- ys && console.warn(r + " is deprecated, please use " + e + " instead.");
5861
+ function Qt(r, e) {
5862
+ Es && console.warn(r + " is deprecated, please use " + e + " instead.");
5828
5863
  }
5829
- function uh(r) {
5864
+ function ph(r) {
5830
5865
  const e = { browser: null, version: null };
5831
5866
  if (typeof r > "u" || !r.navigator || !r.navigator.userAgent)
5832
5867
  return e.browser = "Not a browser.", e;
@@ -5858,23 +5893,23 @@ function uh(r) {
5858
5893
  return e.browser = "Not a supported browser.", e;
5859
5894
  return e;
5860
5895
  }
5861
- function fi(r) {
5896
+ function gi(r) {
5862
5897
  return Object.prototype.toString.call(r) === "[object Object]";
5863
5898
  }
5864
- function Ts(r) {
5865
- return fi(r) ? Object.keys(r).reduce(function(e, t) {
5866
- const i = fi(r[t]), s = i ? Ts(r[t]) : r[t], n = i && !Object.keys(s).length;
5899
+ function ks(r) {
5900
+ return gi(r) ? Object.keys(r).reduce(function(e, t) {
5901
+ const i = gi(r[t]), s = i ? ks(r[t]) : r[t], n = i && !Object.keys(s).length;
5867
5902
  return s === void 0 || n ? e : Object.assign(e, { [t]: s });
5868
5903
  }, {}) : r;
5869
5904
  }
5870
- function Ot(r, e, t) {
5905
+ function Dt(r, e, t) {
5871
5906
  !e || t.has(e.id) || (t.set(e.id, e), Object.keys(e).forEach((i) => {
5872
- i.endsWith("Id") ? Ot(r, r.get(e[i]), t) : i.endsWith("Ids") && e[i].forEach((s) => {
5873
- Ot(r, r.get(s), t);
5907
+ i.endsWith("Id") ? Dt(r, r.get(e[i]), t) : i.endsWith("Ids") && e[i].forEach((s) => {
5908
+ Dt(r, r.get(s), t);
5874
5909
  });
5875
5910
  }));
5876
5911
  }
5877
- function _i(r, e, t) {
5912
+ function vi(r, e, t) {
5878
5913
  const i = t ? "outbound-rtp" : "inbound-rtp", s = /* @__PURE__ */ new Map();
5879
5914
  if (e === null)
5880
5915
  return s;
@@ -5883,12 +5918,12 @@ function _i(r, e, t) {
5883
5918
  a.type === "track" && a.trackIdentifier === e.id && n.push(a);
5884
5919
  }), n.forEach((a) => {
5885
5920
  r.forEach((o) => {
5886
- o.type === i && o.trackId === a.id && Ot(r, o, s);
5921
+ o.type === i && o.trackId === a.id && Dt(r, o, s);
5887
5922
  });
5888
5923
  }), s;
5889
5924
  }
5890
- const gi = Ss;
5891
- function Es(r, e) {
5925
+ const Ci = bs;
5926
+ function Ps(r, e) {
5892
5927
  const t = r && r.navigator;
5893
5928
  if (!t.mediaDevices)
5894
5929
  return;
@@ -5933,12 +5968,12 @@ function Es(r, e) {
5933
5968
  return t.mediaDevices.enumerateDevices().then((p) => {
5934
5969
  p = p.filter((f) => f.kind === "videoinput");
5935
5970
  let l = p.find((f) => h.some((g) => f.label.toLowerCase().includes(g)));
5936
- return !l && p.length && h.includes("back") && (l = p[p.length - 1]), l && (o.video.deviceId = d.exact ? { exact: l.deviceId } : { ideal: l.deviceId }), o.video = i(o.video), gi("chrome: " + JSON.stringify(o)), u(o);
5971
+ return !l && p.length && h.includes("back") && (l = p[p.length - 1]), l && (o.video.deviceId = d.exact ? { exact: l.deviceId } : { ideal: l.deviceId }), o.video = i(o.video), Ci("chrome: " + JSON.stringify(o)), u(o);
5937
5972
  });
5938
5973
  }
5939
5974
  o.video = i(o.video);
5940
5975
  }
5941
- return gi("chrome: " + JSON.stringify(o)), u(o);
5976
+ return Ci("chrome: " + JSON.stringify(o)), u(o);
5942
5977
  }, n = function(o) {
5943
5978
  return e.version >= 64 ? o : {
5944
5979
  name: {
@@ -5980,10 +6015,10 @@ function Es(r, e) {
5980
6015
  };
5981
6016
  }
5982
6017
  }
5983
- function bs(r) {
6018
+ function xs(r) {
5984
6019
  r.MediaStream = r.MediaStream || r.webkitMediaStream;
5985
6020
  }
5986
- function ks(r) {
6021
+ function Rs(r) {
5987
6022
  if (typeof r == "object" && r.RTCPeerConnection && !("ontrack" in r.RTCPeerConnection.prototype)) {
5988
6023
  Object.defineProperty(r.RTCPeerConnection.prototype, "ontrack", {
5989
6024
  get() {
@@ -6018,7 +6053,7 @@ function ks(r) {
6018
6053
  { value: { receiver: e.receiver } }
6019
6054
  ), e));
6020
6055
  }
6021
- function Ps(r) {
6056
+ function As(r) {
6022
6057
  if (typeof r == "object" && r.RTCPeerConnection && !("getSenders" in r.RTCPeerConnection.prototype) && "createDTMFSender" in r.RTCPeerConnection.prototype) {
6023
6058
  const e = function(s, n) {
6024
6059
  return {
@@ -6070,7 +6105,7 @@ function Ps(r) {
6070
6105
  });
6071
6106
  }
6072
6107
  }
6073
- function xs(r) {
6108
+ function ws(r) {
6074
6109
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender && r.RTCRtpReceiver))
6075
6110
  return;
6076
6111
  if (!("getStats" in r.RTCRtpSender.prototype)) {
@@ -6090,7 +6125,7 @@ function xs(r) {
6090
6125
  * send a track with the same id as sender.track as
6091
6126
  * it is not possible to identify the RTCRtpSender.
6092
6127
  */
6093
- _i(a, n.track, !0)
6128
+ vi(a, n.track, !0)
6094
6129
  ));
6095
6130
  };
6096
6131
  }
@@ -6101,7 +6136,7 @@ function xs(r) {
6101
6136
  return s.forEach((n) => n._pc = this), s;
6102
6137
  }), de(r, "track", (i) => (i.receiver._pc = i.srcElement, i)), r.RTCRtpReceiver.prototype.getStats = function() {
6103
6138
  const s = this;
6104
- return this._pc.getStats().then((n) => _i(n, s.track, !1));
6139
+ return this._pc.getStats().then((n) => vi(n, s.track, !1));
6105
6140
  };
6106
6141
  }
6107
6142
  if (!("getStats" in r.RTCRtpSender.prototype && "getStats" in r.RTCRtpReceiver.prototype))
@@ -6124,7 +6159,7 @@ function xs(r) {
6124
6159
  return e.apply(this, arguments);
6125
6160
  };
6126
6161
  }
6127
- function Rs(r) {
6162
+ function Os(r) {
6128
6163
  r.RTCPeerConnection.prototype.getLocalStreams = function() {
6129
6164
  return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map((a) => this._shimmedLocalStreams[a][0]);
6130
6165
  };
@@ -6162,11 +6197,11 @@ function Rs(r) {
6162
6197
  }), s.apply(this, arguments);
6163
6198
  };
6164
6199
  }
6165
- function As(r, e) {
6200
+ function Ds(r, e) {
6166
6201
  if (!r.RTCPeerConnection)
6167
6202
  return;
6168
6203
  if (r.RTCPeerConnection.prototype.addTrack && e.version >= 65)
6169
- return Rs(r);
6204
+ return Os(r);
6170
6205
  const t = r.RTCPeerConnection.prototype.getLocalStreams;
6171
6206
  r.RTCPeerConnection.prototype.getLocalStreams = function() {
6172
6207
  const c = t.apply(this);
@@ -6305,29 +6340,29 @@ function It(r, e) {
6305
6340
  r.RTCPeerConnection.prototype[t] = s[t];
6306
6341
  });
6307
6342
  }
6308
- function ws(r, e) {
6343
+ function Is(r, e) {
6309
6344
  de(r, "negotiationneeded", (t) => {
6310
6345
  const i = t.target;
6311
6346
  if (!((e.version < 72 || i.getConfiguration && i.getConfiguration().sdpSemantics === "plan-b") && i.signalingState !== "stable"))
6312
6347
  return t;
6313
6348
  });
6314
6349
  }
6315
- const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6350
+ const yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6316
6351
  __proto__: null,
6317
- fixNegotiationNeeded: ws,
6318
- shimAddTrackRemoveTrack: As,
6319
- shimAddTrackRemoveTrackWithNative: Rs,
6320
- shimGetSendersWithDtmf: Ps,
6321
- shimGetUserMedia: Es,
6322
- shimMediaStream: bs,
6323
- shimOnTrack: ks,
6352
+ fixNegotiationNeeded: Is,
6353
+ shimAddTrackRemoveTrack: Ds,
6354
+ shimAddTrackRemoveTrackWithNative: Os,
6355
+ shimGetSendersWithDtmf: As,
6356
+ shimGetUserMedia: Ps,
6357
+ shimMediaStream: xs,
6358
+ shimOnTrack: Rs,
6324
6359
  shimPeerConnection: It,
6325
- shimSenderReceiverGetStats: xs
6360
+ shimSenderReceiverGetStats: ws
6326
6361
  }, Symbol.toStringTag, { value: "Module" }));
6327
- function Os(r, e) {
6362
+ function Ms(r, e) {
6328
6363
  const t = r && r.navigator, i = r && r.MediaStreamTrack;
6329
6364
  if (t.getUserMedia = function(s, n, a) {
6330
- Zt(
6365
+ Qt(
6331
6366
  "navigator.getUserMedia",
6332
6367
  "navigator.mediaDevices.getUserMedia"
6333
6368
  ), t.mediaDevices.getUserMedia(s).then(n, a);
@@ -6352,7 +6387,7 @@ function Os(r, e) {
6352
6387
  }
6353
6388
  }
6354
6389
  }
6355
- function hh(r, e) {
6390
+ function lh(r, e) {
6356
6391
  r.navigator.mediaDevices && "getDisplayMedia" in r.navigator.mediaDevices || r.navigator.mediaDevices && (r.navigator.mediaDevices.getDisplayMedia = function(i) {
6357
6392
  if (!(i && i.video)) {
6358
6393
  const s = new DOMException("getDisplayMedia without video constraints is undefined");
@@ -6361,14 +6396,14 @@ function hh(r, e) {
6361
6396
  return i.video === !0 ? i.video = { mediaSource: e } : i.video.mediaSource = e, r.navigator.mediaDevices.getUserMedia(i);
6362
6397
  });
6363
6398
  }
6364
- function Is(r) {
6399
+ function Ls(r) {
6365
6400
  typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
6366
6401
  get() {
6367
6402
  return { receiver: this.receiver };
6368
6403
  }
6369
6404
  });
6370
6405
  }
6371
- function Dt(r, e) {
6406
+ function Mt(r, e) {
6372
6407
  if (typeof r != "object" || !(r.RTCPeerConnection || r.mozRTCPeerConnection))
6373
6408
  return;
6374
6409
  !r.RTCPeerConnection && r.mozRTCPeerConnection && (r.RTCPeerConnection = r.mozRTCPeerConnection), e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(s) {
@@ -6405,7 +6440,7 @@ function Dt(r, e) {
6405
6440
  }).then(a, o);
6406
6441
  };
6407
6442
  }
6408
- function Ds(r) {
6443
+ function Fs(r) {
6409
6444
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpSender.prototype)
6410
6445
  return;
6411
6446
  const e = r.RTCPeerConnection.prototype.getSenders;
@@ -6421,7 +6456,7 @@ function Ds(r) {
6421
6456
  return this.track ? this._pc.getStats(this.track) : Promise.resolve(/* @__PURE__ */ new Map());
6422
6457
  };
6423
6458
  }
6424
- function Ms(r) {
6459
+ function Ns(r) {
6425
6460
  if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpReceiver.prototype)
6426
6461
  return;
6427
6462
  const e = r.RTCPeerConnection.prototype.getReceivers;
@@ -6432,17 +6467,17 @@ function Ms(r) {
6432
6467
  return this._pc.getStats(this.track);
6433
6468
  };
6434
6469
  }
6435
- function Ls(r) {
6470
+ function Vs(r) {
6436
6471
  !r.RTCPeerConnection || "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
6437
- Zt("removeStream", "removeTrack"), this.getSenders().forEach((i) => {
6472
+ Qt("removeStream", "removeTrack"), this.getSenders().forEach((i) => {
6438
6473
  i.track && t.getTracks().includes(i.track) && this.removeTrack(i);
6439
6474
  });
6440
6475
  });
6441
6476
  }
6442
- function Fs(r) {
6477
+ function Us(r) {
6443
6478
  r.DataChannel && !r.RTCDataChannel && (r.RTCDataChannel = r.DataChannel);
6444
6479
  }
6445
- function Ns(r) {
6480
+ function $s(r) {
6446
6481
  if (!(typeof r == "object" && r.RTCPeerConnection))
6447
6482
  return;
6448
6483
  const e = r.RTCPeerConnection.prototype.addTransceiver;
@@ -6474,7 +6509,7 @@ function Ns(r) {
6474
6509
  return n;
6475
6510
  });
6476
6511
  }
6477
- function Vs(r) {
6512
+ function Bs(r) {
6478
6513
  if (!(typeof r == "object" && r.RTCRtpSender))
6479
6514
  return;
6480
6515
  const e = r.RTCRtpSender.prototype.getParameters;
@@ -6483,7 +6518,7 @@ function Vs(r) {
6483
6518
  return "encodings" in i || (i.encodings = [].concat(this.sendEncodings || [{}])), i;
6484
6519
  });
6485
6520
  }
6486
- function Us(r) {
6521
+ function js(r) {
6487
6522
  if (!(typeof r == "object" && r.RTCPeerConnection))
6488
6523
  return;
6489
6524
  const e = r.RTCPeerConnection.prototype.createOffer;
@@ -6493,7 +6528,7 @@ function Us(r) {
6493
6528
  }) : e.apply(this, arguments);
6494
6529
  };
6495
6530
  }
6496
- function $s(r) {
6531
+ function zs(r) {
6497
6532
  if (!(typeof r == "object" && r.RTCPeerConnection))
6498
6533
  return;
6499
6534
  const e = r.RTCPeerConnection.prototype.createAnswer;
@@ -6503,22 +6538,22 @@ function $s(r) {
6503
6538
  }) : e.apply(this, arguments);
6504
6539
  };
6505
6540
  }
6506
- const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6541
+ const Si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6507
6542
  __proto__: null,
6508
- shimAddTransceiver: Ns,
6509
- shimCreateAnswer: $s,
6510
- shimCreateOffer: Us,
6511
- shimGetDisplayMedia: hh,
6512
- shimGetParameters: Vs,
6513
- shimGetUserMedia: Os,
6514
- shimOnTrack: Is,
6515
- shimPeerConnection: Dt,
6516
- shimRTCDataChannel: Fs,
6517
- shimReceiverGetStats: Ms,
6518
- shimRemoveStream: Ls,
6519
- shimSenderGetStats: Ds
6543
+ shimAddTransceiver: $s,
6544
+ shimCreateAnswer: zs,
6545
+ shimCreateOffer: js,
6546
+ shimGetDisplayMedia: lh,
6547
+ shimGetParameters: Bs,
6548
+ shimGetUserMedia: Ms,
6549
+ shimOnTrack: Ls,
6550
+ shimPeerConnection: Mt,
6551
+ shimRTCDataChannel: Us,
6552
+ shimReceiverGetStats: Ns,
6553
+ shimRemoveStream: Vs,
6554
+ shimSenderGetStats: Fs
6520
6555
  }, Symbol.toStringTag, { value: "Module" }));
6521
- function Bs(r) {
6556
+ function Gs(r) {
6522
6557
  if (!(typeof r != "object" || !r.RTCPeerConnection)) {
6523
6558
  if ("getLocalStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getLocalStreams = function() {
6524
6559
  return this._localStreams || (this._localStreams = []), this._localStreams;
@@ -6553,7 +6588,7 @@ function Bs(r) {
6553
6588
  });
6554
6589
  }
6555
6590
  }
6556
- function js(r) {
6591
+ function Hs(r) {
6557
6592
  if (!(typeof r != "object" || !r.RTCPeerConnection) && ("getRemoteStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getRemoteStreams = function() {
6558
6593
  return this._remoteStreams ? this._remoteStreams : [];
6559
6594
  }), !("onaddstream" in r.RTCPeerConnection.prototype))) {
@@ -6588,7 +6623,7 @@ function js(r) {
6588
6623
  };
6589
6624
  }
6590
6625
  }
6591
- function zs(r) {
6626
+ function qs(r) {
6592
6627
  if (typeof r != "object" || !r.RTCPeerConnection)
6593
6628
  return;
6594
6629
  const e = r.RTCPeerConnection.prototype, t = e.createOffer, i = e.createAnswer, s = e.setLocalDescription, n = e.setRemoteDescription, a = e.addIceCandidate;
@@ -6611,24 +6646,24 @@ function zs(r) {
6611
6646
  return c ? (h.then(d, c), Promise.resolve()) : h;
6612
6647
  }, e.addIceCandidate = o;
6613
6648
  }
6614
- function Gs(r) {
6649
+ function Ws(r) {
6615
6650
  const e = r && r.navigator;
6616
6651
  if (e.mediaDevices && e.mediaDevices.getUserMedia) {
6617
6652
  const t = e.mediaDevices, i = t.getUserMedia.bind(t);
6618
- e.mediaDevices.getUserMedia = (s) => i(Hs(s));
6653
+ e.mediaDevices.getUserMedia = (s) => i(Xs(s));
6619
6654
  }
6620
6655
  !e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(i, s, n) {
6621
6656
  e.mediaDevices.getUserMedia(i).then(s, n);
6622
6657
  }).bind(e));
6623
6658
  }
6624
- function Hs(r) {
6659
+ function Xs(r) {
6625
6660
  return r && r.video !== void 0 ? Object.assign(
6626
6661
  {},
6627
6662
  r,
6628
- { video: Ts(r.video) }
6663
+ { video: ks(r.video) }
6629
6664
  ) : r;
6630
6665
  }
6631
- function qs(r) {
6666
+ function Ks(r) {
6632
6667
  if (!r.RTCPeerConnection)
6633
6668
  return;
6634
6669
  const e = r.RTCPeerConnection;
@@ -6637,7 +6672,7 @@ function qs(r) {
6637
6672
  const n = [];
6638
6673
  for (let a = 0; a < i.iceServers.length; a++) {
6639
6674
  let o = i.iceServers[a];
6640
- o.urls === void 0 && o.url ? (Zt("RTCIceServer.url", "RTCIceServer.urls"), o = JSON.parse(JSON.stringify(o)), o.urls = o.url, delete o.url, n.push(o)) : n.push(i.iceServers[a]);
6675
+ o.urls === void 0 && o.url ? (Qt("RTCIceServer.url", "RTCIceServer.urls"), o = JSON.parse(JSON.stringify(o)), o.urls = o.url, delete o.url, n.push(o)) : n.push(i.iceServers[a]);
6641
6676
  }
6642
6677
  i.iceServers = n;
6643
6678
  }
@@ -6648,14 +6683,14 @@ function qs(r) {
6648
6683
  }
6649
6684
  });
6650
6685
  }
6651
- function Ws(r) {
6686
+ function Js(r) {
6652
6687
  typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
6653
6688
  get() {
6654
6689
  return { receiver: this.receiver };
6655
6690
  }
6656
6691
  });
6657
6692
  }
6658
- function Xs(r) {
6693
+ function Ys(r) {
6659
6694
  const e = r.RTCPeerConnection.prototype.createOffer;
6660
6695
  r.RTCPeerConnection.prototype.createOffer = function(i) {
6661
6696
  if (i) {
@@ -6668,24 +6703,24 @@ function Xs(r) {
6668
6703
  return e.apply(this, arguments);
6669
6704
  };
6670
6705
  }
6671
- function Ks(r) {
6706
+ function Zs(r) {
6672
6707
  typeof r != "object" || r.AudioContext || (r.AudioContext = r.webkitAudioContext);
6673
6708
  }
6674
- const yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6709
+ const Ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6675
6710
  __proto__: null,
6676
- shimAudioContext: Ks,
6677
- shimCallbacksAPI: zs,
6678
- shimConstraints: Hs,
6679
- shimCreateOfferLegacy: Xs,
6680
- shimGetUserMedia: Gs,
6681
- shimLocalStreamsAPI: Bs,
6682
- shimRTCIceServerUrls: qs,
6683
- shimRemoteStreamsAPI: js,
6684
- shimTrackEventTransceiver: Ws
6711
+ shimAudioContext: Zs,
6712
+ shimCallbacksAPI: qs,
6713
+ shimConstraints: Xs,
6714
+ shimCreateOfferLegacy: Ys,
6715
+ shimGetUserMedia: Ws,
6716
+ shimLocalStreamsAPI: Gs,
6717
+ shimRTCIceServerUrls: Ks,
6718
+ shimRemoteStreamsAPI: Hs,
6719
+ shimTrackEventTransceiver: Js
6685
6720
  }, Symbol.toStringTag, { value: "Module" }));
6686
- var _t = { exports: {} }, Si;
6687
- function ph() {
6688
- return Si || (Si = 1, function(r) {
6721
+ var gt = { exports: {} }, Ei;
6722
+ function mh() {
6723
+ return Ei || (Ei = 1, function(r) {
6689
6724
  const e = {};
6690
6725
  e.generateIdentifier = function() {
6691
6726
  return Math.random().toString(36).substring(2, 12);
@@ -7071,13 +7106,13 @@ t=0 0\r
7071
7106
  return !1;
7072
7107
  return !0;
7073
7108
  }, r.exports = e;
7074
- }(_t)), _t.exports;
7109
+ }(gt)), gt.exports;
7075
7110
  }
7076
- var Js = ph();
7077
- const le = /* @__PURE__ */ Ge(Js), lh = /* @__PURE__ */ tn({
7111
+ var Qs = mh();
7112
+ const le = /* @__PURE__ */ Ge(Qs), fh = /* @__PURE__ */ nn({
7078
7113
  __proto__: null,
7079
7114
  default: le
7080
- }, [Js]);
7115
+ }, [Qs]);
7081
7116
  function Ne(r) {
7082
7117
  if (!r.RTCIceCandidate || r.RTCIceCandidate && "foundation" in r.RTCIceCandidate.prototype)
7083
7118
  return;
@@ -7106,7 +7141,7 @@ function Ne(r) {
7106
7141
  writable: "false"
7107
7142
  }), t));
7108
7143
  }
7109
- function Mt(r) {
7144
+ function Lt(r) {
7110
7145
  !r.RTCIceCandidate || r.RTCIceCandidate && "relayProtocol" in r.RTCIceCandidate.prototype || de(r, "icecandidate", (e) => {
7111
7146
  if (e.candidate) {
7112
7147
  const t = le.parseCandidate(e.candidate.candidate);
@@ -7196,7 +7231,7 @@ function Ue(r) {
7196
7231
  return e(s, this), s;
7197
7232
  }, de(r, "datachannel", (i) => (e(i.channel, i.target), i));
7198
7233
  }
7199
- function Lt(r) {
7234
+ function Ft(r) {
7200
7235
  if (!r.RTCPeerConnection || "connectionState" in r.RTCPeerConnection.prototype)
7201
7236
  return;
7202
7237
  const e = r.RTCPeerConnection.prototype;
@@ -7242,7 +7277,7 @@ function Lt(r) {
7242
7277
  };
7243
7278
  });
7244
7279
  }
7245
- function Ft(r, e) {
7280
+ function Nt(r, e) {
7246
7281
  if (!r.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e.version >= 605)
7247
7282
  return;
7248
7283
  const t = r.RTCPeerConnection.prototype.setRemoteDescription;
@@ -7290,48 +7325,48 @@ function Be(r, e) {
7290
7325
  return s.sdp || s.type !== "offer" && s.type !== "answer" ? t.apply(this, [s]) : (s.type === "offer" ? this.createOffer : this.createAnswer).apply(this).then((a) => t.apply(this, [a]));
7291
7326
  });
7292
7327
  }
7293
- const mh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7328
+ const _h = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7294
7329
  __proto__: null,
7295
- removeExtmapAllowMixed: Ft,
7330
+ removeExtmapAllowMixed: Nt,
7296
7331
  shimAddIceCandidateNullOrEmpty: $e,
7297
- shimConnectionState: Lt,
7332
+ shimConnectionState: Ft,
7298
7333
  shimMaxMessageSize: Ve,
7299
7334
  shimParameterlessSetLocalDescription: Be,
7300
7335
  shimRTCIceCandidate: Ne,
7301
- shimRTCIceCandidateRelayProtocol: Mt,
7336
+ shimRTCIceCandidateRelayProtocol: Lt,
7302
7337
  shimSendThrowTypeError: Ue
7303
7338
  }, Symbol.toStringTag, { value: "Module" }));
7304
- function fh({ window: r } = {}, e = {
7339
+ function gh({ window: r } = {}, e = {
7305
7340
  shimChrome: !0,
7306
7341
  shimFirefox: !0,
7307
7342
  shimSafari: !0
7308
7343
  }) {
7309
- const t = Ss, i = uh(r), s = {
7344
+ const t = bs, i = ph(r), s = {
7310
7345
  browserDetails: i,
7311
- commonShim: mh,
7346
+ commonShim: _h,
7312
7347
  extractVersion: Fe,
7313
- disableLog: ch,
7314
- disableWarnings: dh,
7348
+ disableLog: uh,
7349
+ disableWarnings: hh,
7315
7350
  // Expose sdp as a convenience. For production apps include directly.
7316
- sdp: lh
7351
+ sdp: fh
7317
7352
  };
7318
7353
  switch (i.browser) {
7319
7354
  case "chrome":
7320
- if (!vi || !It || !e.shimChrome)
7355
+ if (!yi || !It || !e.shimChrome)
7321
7356
  return t("Chrome shim is not included in this adapter release."), s;
7322
7357
  if (i.version === null)
7323
7358
  return t("Chrome shim can not determine version, not shimming."), s;
7324
- t("adapter.js shimming chrome."), s.browserShim = vi, $e(r, i), Be(r), Es(r, i), bs(r), It(r, i), ks(r), As(r, i), Ps(r), xs(r), ws(r, i), Ne(r), Mt(r), Lt(r), Ve(r, i), Ue(r), Ft(r, i);
7359
+ t("adapter.js shimming chrome."), s.browserShim = yi, $e(r, i), Be(r), Ps(r, i), xs(r), It(r, i), Rs(r), Ds(r, i), As(r), ws(r), Is(r, i), Ne(r), Lt(r), Ft(r), Ve(r, i), Ue(r), Nt(r, i);
7325
7360
  break;
7326
7361
  case "firefox":
7327
- if (!Ci || !Dt || !e.shimFirefox)
7362
+ if (!Si || !Mt || !e.shimFirefox)
7328
7363
  return t("Firefox shim is not included in this adapter release."), s;
7329
- t("adapter.js shimming firefox."), s.browserShim = Ci, $e(r, i), Be(r), Os(r, i), Dt(r, i), Is(r), Ls(r), Ds(r), Ms(r), Fs(r), Ns(r), Vs(r), Us(r), $s(r), Ne(r), Lt(r), Ve(r, i), Ue(r);
7364
+ t("adapter.js shimming firefox."), s.browserShim = Si, $e(r, i), Be(r), Ms(r, i), Mt(r, i), Ls(r), Vs(r), Fs(r), Ns(r), Us(r), $s(r), Bs(r), js(r), zs(r), Ne(r), Ft(r), Ve(r, i), Ue(r);
7330
7365
  break;
7331
7366
  case "safari":
7332
- if (!yi || !e.shimSafari)
7367
+ if (!Ti || !e.shimSafari)
7333
7368
  return t("Safari shim is not included in this adapter release."), s;
7334
- t("adapter.js shimming safari."), s.browserShim = yi, $e(r, i), Be(r), qs(r), Xs(r), zs(r), Bs(r), js(r), Ws(r), Gs(r), Ks(r), Ne(r), Mt(r), Ve(r, i), Ue(r), Ft(r, i);
7369
+ t("adapter.js shimming safari."), s.browserShim = Ti, $e(r, i), Be(r), Ks(r), Ys(r), qs(r), Gs(r), Hs(r), Js(r), Ws(r), Zs(r), Ne(r), Lt(r), Ve(r, i), Ue(r), Nt(r, i);
7335
7370
  break;
7336
7371
  default:
7337
7372
  t("Unsupported browser!");
@@ -7339,8 +7374,8 @@ function fh({ window: r } = {}, e = {
7339
7374
  }
7340
7375
  return s;
7341
7376
  }
7342
- fh({ window: typeof window > "u" ? void 0 : window });
7343
- class Ch extends te {
7377
+ gh({ window: typeof window > "u" ? void 0 : window });
7378
+ class Sh extends te {
7344
7379
  /** {zh}
7345
7380
  * @brief 查询是否支持 RTM 或 WebTransport 推流。
7346
7381
  * @param mode 推流模式。
@@ -7356,9 +7391,9 @@ class Ch extends te {
7356
7391
  */
7357
7392
  static async isSupported(e) {
7358
7393
  if (e === "webTransport")
7359
- return Promise.resolve(gs.isSupported());
7394
+ return Promise.resolve(ys.isSupported());
7360
7395
  try {
7361
- return th() || !window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver || !window.RTCPeerConnection.prototype.createDataChannel ? !1 : await nh() && await sh();
7396
+ return ih() || !window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver || !window.RTCPeerConnection.prototype.createDataChannel ? !1 : await ah() && await oh();
7362
7397
  } catch {
7363
7398
  return !1;
7364
7399
  }
@@ -7374,11 +7409,11 @@ class Ch extends te {
7374
7409
  * @return LivePusher instance.
7375
7410
  */
7376
7411
  constructor(e) {
7377
- super(), this._streamManagerController = new Tu(), this._streamComposeController = new Iu(
7412
+ super(), this._streamManagerController = new bu(), this._streamComposeController = new Mu(
7378
7413
  this._streamManagerController
7379
- ), this._streamConsumeController = new eh(
7414
+ ), this._streamConsumeController = new rh(
7380
7415
  this._streamComposeController
7381
- ), this._streamConsumeController.setPushConfig(e), this._observer = ah, this._bindEvent();
7416
+ ), this._streamConsumeController.setPushConfig(e), this._observer = dh, this._bindEvent();
7382
7417
  }
7383
7418
  /** {zh}
7384
7419
  * @brief 获取设备列表,包括音频输入设备和视频输入设备。
@@ -8229,7 +8264,7 @@ class Ch extends te {
8229
8264
  ), this._streamConsumeController.on(
8230
8265
  w.RTCConnectStateChanged,
8231
8266
  (e) => {
8232
- this.observer.onPushStatusUpdate(Oi[e], e);
8267
+ this.observer.onPushStatusUpdate(Mi[e], e);
8233
8268
  }
8234
8269
  ), this._streamConsumeController.on(
8235
8270
  w.PushError,
@@ -8251,7 +8286,7 @@ class Ch extends te {
8251
8286
  () => {
8252
8287
  this.observer.onCaptureFirstVideoFrame();
8253
8288
  }
8254
- ), co((e) => {
8289
+ ), ho((e) => {
8255
8290
  e.deviceInfo.kind === "videoinput" ? this.observer.onCameraChanged(e.deviceInfo) : e.deviceInfo.kind === "audioinput" && this.observer.onMicrophoneChanged(e.deviceInfo);
8256
8291
  });
8257
8292
  }
@@ -8321,5 +8356,5 @@ class Ch extends te {
8321
8356
  }
8322
8357
  }
8323
8358
  export {
8324
- Ch as default
8359
+ Sh as default
8325
8360
  };