(function webpackUniversalModuleDefinition(root, factory) {
  if (typeof exports === 'object' && typeof module === 'object')
    module.exports = factory();
  else if (typeof define === 'function' && define.amd) define([], factory);
  else if (typeof exports === 'object') exports['TrtcWrapper'] = factory();
  else root['TrtcWrapper'] = factory();
})(self, () => {
  return /******/ (() => {
    // webpackBootstrap
    /******/ var __webpack_modules__ = {
      /***/ 79: /***/ function (
        __unused_webpack_module,
        exports,
        __webpack_require__,
      ) {
        var global, factory;
        (global = this),
          (factory = function (e, t) {
            function o(e) {
              return e && 'object' == typeof e && 'default' in e
                ? e
                : { default: e };
            }
            var i = o(t),
              r = function (e, t) {
                return (
                  (r =
                    Object.setPrototypeOf ||
                    ({ __proto__: [] } instanceof Array &&
                      function (e, t) {
                        e.__proto__ = t;
                      }) ||
                    function (e, t) {
                      for (var o in t)
                        Object.prototype.hasOwnProperty.call(t, o) &&
                          (e[o] = t[o]);
                    }),
                  r(e, t)
                );
              },
              n = function () {
                return (
                  (n =
                    Object.assign ||
                    function (e) {
                      for (var t, o = 1, i = arguments.length; o < i; o++)
                        for (var r in (t = arguments[o]))
                          Object.prototype.hasOwnProperty.call(t, r) &&
                            (e[r] = t[r]);
                      return e;
                    }),
                  n.apply(this, arguments)
                );
              };
            function a(e, t, o, i) {
              return new (o || (o = Promise))(function (r, n) {
                function a(e) {
                  try {
                    c(i.next(e));
                  } catch (t) {
                    n(t);
                  }
                }
                function s(e) {
                  try {
                    c(i.throw(e));
                  } catch (t) {
                    n(t);
                  }
                }
                function c(e) {
                  var t;
                  e.done
                    ? r(e.value)
                    : ((t = e.value),
                      t instanceof o
                        ? t
                        : new o(function (e) {
                            e(t);
                          })).then(a, s);
                }
                c((i = i.apply(e, t || [])).next());
              });
            }
            function s(e, t) {
              var o,
                i,
                r,
                n,
                a = {
                  label: 0,
                  sent: function () {
                    if (1 & r[0]) throw r[1];
                    return r[1];
                  },
                  trys: [],
                  ops: [],
                };
              return (
                (n = { next: s(0), throw: s(1), return: s(2) }),
                'function' == typeof Symbol &&
                  (n[Symbol.iterator] = function () {
                    return this;
                  }),
                n
              );
              function s(s) {
                return function (c) {
                  return (function (s) {
                    if (o)
                      throw new TypeError('Generator is already executing.');
                    for (; n && ((n = 0), s[0] && (a = 0)), a; )
                      try {
                        if (
                          ((o = 1),
                          i &&
                            (r =
                              2 & s[0]
                                ? i.return
                                : s[0]
                                ? i.throw || ((r = i.return) && r.call(i), 0)
                                : i.next) &&
                            !(r = r.call(i, s[1])).done)
                        )
                          return r;
                        switch (
                          ((i = 0), r && (s = [2 & s[0], r.value]), s[0])
                        ) {
                          case 0:
                          case 1:
                            r = s;
                            break;
                          case 4:
                            return a.label++, { value: s[1], done: !1 };
                          case 5:
                            a.label++, (i = s[1]), (s = [0]);
                            continue;
                          case 7:
                            (s = a.ops.pop()), a.trys.pop();
                            continue;
                          default:
                            if (
                              !(
                                (r =
                                  (r = a.trys).length > 0 && r[r.length - 1]) ||
                                (6 !== s[0] && 2 !== s[0])
                              )
                            ) {
                              a = 0;
                              continue;
                            }
                            if (
                              3 === s[0] &&
                              (!r || (s[1] > r[0] && s[1] < r[3]))
                            ) {
                              a.label = s[1];
                              break;
                            }
                            if (6 === s[0] && a.label < r[1]) {
                              (a.label = r[1]), (r = s);
                              break;
                            }
                            if (r && a.label < r[2]) {
                              (a.label = r[2]), a.ops.push(s);
                              break;
                            }
                            r[2] && a.ops.pop(), a.trys.pop();
                            continue;
                        }
                        s = t.call(e, a);
                      } catch (c) {
                        (s = [6, c]), (i = 0);
                      } finally {
                        o = r = 0;
                      }
                    if (5 & s[0]) throw s[1];
                    return { value: s[0] ? s[1] : void 0, done: !0 };
                  })([s, c]);
                };
              }
            }
            function c(e, t, o) {
              if (o || 2 === arguments.length)
                for (var i, r = 0, n = t.length; r < n; r++)
                  (!i && r in t) ||
                    (i || (i = Array.prototype.slice.call(t, 0, r)),
                    (i[r] = t[r]));
              return e.concat(i || Array.prototype.slice.call(t));
            }
            var u,
              l,
              d,
              T,
              h,
              p,
              f,
              R,
              _ = (function (e, t) {
                return e((t = { exports: {} }), t.exports), t.exports;
              })(function (e) {
                var t = Object.prototype.hasOwnProperty,
                  o = '~';
                function i() {}
                function r(e, t, o) {
                  (this.fn = e), (this.context = t), (this.once = o || !1);
                }
                function n(e, t, i, n, a) {
                  if ('function' != typeof i)
                    throw new TypeError('The listener must be a function');
                  var s = new r(i, n || e, a),
                    c = o ? o + t : t;
                  return (
                    e._events[c]
                      ? e._events[c].fn
                        ? (e._events[c] = [e._events[c], s])
                        : e._events[c].push(s)
                      : ((e._events[c] = s), e._eventsCount++),
                    e
                  );
                }
                function a(e, t) {
                  0 == --e._eventsCount
                    ? (e._events = new i())
                    : delete e._events[t];
                }
                function s() {
                  (this._events = new i()), (this._eventsCount = 0);
                }
                Object.create &&
                  ((i.prototype = Object.create(null)),
                  new i().__proto__ || (o = !1)),
                  (s.prototype.eventNames = function () {
                    var e,
                      i,
                      r = [];
                    if (0 === this._eventsCount) return r;
                    for (i in (e = this._events))
                      t.call(e, i) && r.push(o ? i.slice(1) : i);
                    return Object.getOwnPropertySymbols
                      ? r.concat(Object.getOwnPropertySymbols(e))
                      : r;
                  }),
                  (s.prototype.listeners = function (e) {
                    var t = o ? o + e : e,
                      i = this._events[t];
                    if (!i) return [];
                    if (i.fn) return [i.fn];
                    for (var r = 0, n = i.length, a = new Array(n); r < n; r++)
                      a[r] = i[r].fn;
                    return a;
                  }),
                  (s.prototype.listenerCount = function (e) {
                    var t = o ? o + e : e,
                      i = this._events[t];
                    return i ? (i.fn ? 1 : i.length) : 0;
                  }),
                  (s.prototype.emit = function (e, t, i, r, n, a) {
                    var s = o ? o + e : e;
                    if (!this._events[s]) return !1;
                    var c,
                      u,
                      l = this._events[s],
                      d = arguments.length;
                    if (l.fn) {
                      switch (
                        (l.once && this.removeListener(e, l.fn, void 0, !0), d)
                      ) {
                        case 1:
                          return l.fn.call(l.context), !0;
                        case 2:
                          return l.fn.call(l.context, t), !0;
                        case 3:
                          return l.fn.call(l.context, t, i), !0;
                        case 4:
                          return l.fn.call(l.context, t, i, r), !0;
                        case 5:
                          return l.fn.call(l.context, t, i, r, n), !0;
                        case 6:
                          return l.fn.call(l.context, t, i, r, n, a), !0;
                      }
                      for (u = 1, c = new Array(d - 1); u < d; u++)
                        c[u - 1] = arguments[u];
                      l.fn.apply(l.context, c);
                    } else {
                      var T,
                        h = l.length;
                      for (u = 0; u < h; u++)
                        switch (
                          (l[u].once &&
                            this.removeListener(e, l[u].fn, void 0, !0),
                          d)
                        ) {
                          case 1:
                            l[u].fn.call(l[u].context);
                            break;
                          case 2:
                            l[u].fn.call(l[u].context, t);
                            break;
                          case 3:
                            l[u].fn.call(l[u].context, t, i);
                            break;
                          case 4:
                            l[u].fn.call(l[u].context, t, i, r);
                            break;
                          default:
                            if (!c)
                              for (T = 1, c = new Array(d - 1); T < d; T++)
                                c[T - 1] = arguments[T];
                            l[u].fn.apply(l[u].context, c);
                        }
                    }
                    return !0;
                  }),
                  (s.prototype.on = function (e, t, o) {
                    return n(this, e, t, o, !1);
                  }),
                  (s.prototype.once = function (e, t, o) {
                    return n(this, e, t, o, !0);
                  }),
                  (s.prototype.removeListener = function (e, t, i, r) {
                    var n = o ? o + e : e;
                    if (!this._events[n]) return this;
                    if (!t) return a(this, n), this;
                    var s = this._events[n];
                    if (s.fn)
                      s.fn !== t ||
                        (r && !s.once) ||
                        (i && s.context !== i) ||
                        a(this, n);
                    else {
                      for (var c = 0, u = [], l = s.length; c < l; c++)
                        (s[c].fn !== t ||
                          (r && !s[c].once) ||
                          (i && s[c].context !== i)) &&
                          u.push(s[c]);
                      u.length
                        ? (this._events[n] = 1 === u.length ? u[0] : u)
                        : a(this, n);
                    }
                    return this;
                  }),
                  (s.prototype.removeAllListeners = function (e) {
                    var t;
                    return (
                      e
                        ? ((t = o ? o + e : e), this._events[t] && a(this, t))
                        : ((this._events = new i()), (this._eventsCount = 0)),
                      this
                    );
                  }),
                  (s.prototype.off = s.prototype.removeListener),
                  (s.prototype.addListener = s.prototype.on),
                  (s.prefixed = o),
                  (s.EventEmitter = s),
                  (e.exports = s);
              });
            (e.TRTCVideoResolution = void 0),
              ((u = e.TRTCVideoResolution || (e.TRTCVideoResolution = {}))[
                (u.TRTCVideoResolution_120_120 = 1)
              ] = 'TRTCVideoResolution_120_120'),
              (u[(u.TRTCVideoResolution_160_160 = 3)] =
                'TRTCVideoResolution_160_160'),
              (u[(u.TRTCVideoResolution_270_270 = 5)] =
                'TRTCVideoResolution_270_270'),
              (u[(u.TRTCVideoResolution_480_480 = 7)] =
                'TRTCVideoResolution_480_480'),
              (u[(u.TRTCVideoResolution_160_120 = 50)] =
                'TRTCVideoResolution_160_120'),
              (u[(u.TRTCVideoResolution_240_180 = 52)] =
                'TRTCVideoResolution_240_180'),
              (u[(u.TRTCVideoResolution_280_210 = 54)] =
                'TRTCVideoResolution_280_210'),
              (u[(u.TRTCVideoResolution_320_240 = 56)] =
                'TRTCVideoResolution_320_240'),
              (u[(u.TRTCVideoResolution_400_300 = 58)] =
                'TRTCVideoResolution_400_300'),
              (u[(u.TRTCVideoResolution_480_360 = 60)] =
                'TRTCVideoResolution_480_360'),
              (u[(u.TRTCVideoResolution_640_480 = 62)] =
                'TRTCVideoResolution_640_480'),
              (u[(u.TRTCVideoResolution_960_720 = 64)] =
                'TRTCVideoResolution_960_720'),
              (u[(u.TRTCVideoResolution_160_90 = 100)] =
                'TRTCVideoResolution_160_90'),
              (u[(u.TRTCVideoResolution_256_144 = 102)] =
                'TRTCVideoResolution_256_144'),
              (u[(u.TRTCVideoResolution_320_180 = 104)] =
                'TRTCVideoResolution_320_180'),
              (u[(u.TRTCVideoResolution_480_270 = 106)] =
                'TRTCVideoResolution_480_270'),
              (u[(u.TRTCVideoResolution_640_360 = 108)] =
                'TRTCVideoResolution_640_360'),
              (u[(u.TRTCVideoResolution_960_540 = 110)] =
                'TRTCVideoResolution_960_540'),
              (u[(u.TRTCVideoResolution_1280_720 = 112)] =
                'TRTCVideoResolution_1280_720'),
              (u[(u.TRTCVideoResolution_1920_1080 = 114)] =
                'TRTCVideoResolution_1920_1080'),
              (e.TRTCVideoStreamType = void 0),
              ((l = e.TRTCVideoStreamType || (e.TRTCVideoStreamType = {}))[
                (l.TRTCVideoStreamTypeBig = 0)
              ] = 'TRTCVideoStreamTypeBig'),
              (l[(l.TRTCVideoStreamTypeSmall = 1)] =
                'TRTCVideoStreamTypeSmall'),
              (l[(l.TRTCVideoStreamTypeSub = 2)] = 'TRTCVideoStreamTypeSub'),
              (e.TRTCVideoFillMode = void 0),
              ((d = e.TRTCVideoFillMode || (e.TRTCVideoFillMode = {}))[
                (d.TRTCVideoFillMode_Fill = 0)
              ] = 'TRTCVideoFillMode_Fill'),
              (d[(d.TRTCVideoFillMode_Fit = 1)] = 'TRTCVideoFillMode_Fit'),
              (e.TRTCVideoMirrorType = void 0),
              ((T = e.TRTCVideoMirrorType || (e.TRTCVideoMirrorType = {}))[
                (T.TRTCVideoMirrorType_Auto = 0)
              ] = 'TRTCVideoMirrorType_Auto'),
              (T[(T.TRTCVideoMirrorType_Enable = 1)] =
                'TRTCVideoMirrorType_Enable'),
              (T[(T.TRTCVideoMirrorType_Disable = 2)] =
                'TRTCVideoMirrorType_Disable'),
              (e.TRTCBeautyStyle = void 0),
              ((h = e.TRTCBeautyStyle || (e.TRTCBeautyStyle = {}))[
                (h.TRTCBeautyStyleSmooth = 0)
              ] = 'TRTCBeautyStyleSmooth'),
              (h[(h.TRTCBeautyStyleNature = 1)] = 'TRTCBeautyStyleNature'),
              (e.TRTCAppScene = void 0),
              ((p = e.TRTCAppScene || (e.TRTCAppScene = {}))[
                (p.TRTCAppSceneVideoCall = 0)
              ] = 'TRTCAppSceneVideoCall'),
              (p[(p.TRTCAppSceneLIVE = 1)] = 'TRTCAppSceneLIVE'),
              (p[(p.TRTCAppSceneAudioCall = 2)] = 'TRTCAppSceneAudioCall'),
              (p[(p.TRTCAppSceneVoiceChatRoom = 3)] =
                'TRTCAppSceneVoiceChatRoom'),
              (e.TRTCRoleType = void 0),
              ((f = e.TRTCRoleType || (e.TRTCRoleType = {}))[
                (f.TRTCRoleAnchor = 20)
              ] = 'TRTCRoleAnchor'),
              (f[(f.TRTCRoleAudience = 21)] = 'TRTCRoleAudience'),
              (e.TRTCAudioQuality = void 0),
              ((R = e.TRTCAudioQuality || (e.TRTCAudioQuality = {}))[
                (R.TRTCAudioQualityDefault = 0)
              ] = 'TRTCAudioQualityDefault'),
              (R[(R.TRTCAudioQualitySpeech = 1)] = 'TRTCAudioQualitySpeech'),
              (R[(R.TRTCAudioQualityMusic = 3)] = 'TRTCAudioQualityMusic');
            var v,
              C,
              g = function (e, t, o, i, r) {
                void 0 === e && (e = ''),
                  void 0 === t && (t = ''),
                  void 0 === o && (o = ''),
                  void 0 === i && (i = ''),
                  void 0 === r && (r = ''),
                  (this.deviceId = e),
                  (this.deviceName = t),
                  (this.kind = o),
                  (this.label = i),
                  (this.groupId = r);
              };
            (e.TRTCDeviceState = void 0),
              ((v = e.TRTCDeviceState || (e.TRTCDeviceState = {}))[
                (v.TRTCDeviceStateAdd = 0)
              ] = 'TRTCDeviceStateAdd'),
              (v[(v.TRTCDeviceStateRemove = 1)] = 'TRTCDeviceStateRemove'),
              (v[(v.TRTCDeviceStateActive = 2)] = 'TRTCDeviceStateActive'),
              (e.TRTCDeviceType = void 0),
              ((C = e.TRTCDeviceType || (e.TRTCDeviceType = {}))[
                (C.TRTCDeviceTypeUnknow = -1)
              ] = 'TRTCDeviceTypeUnknow'),
              (C[(C.TRTCDeviceTypeMic = 0)] = 'TRTCDeviceTypeMic'),
              (C[(C.TRTCDeviceTypeSpeaker = 1)] = 'TRTCDeviceTypeSpeaker'),
              (C[(C.TRTCDeviceTypeCamera = 2)] = 'TRTCDeviceTypeCamera');
            var m,
              y = function (t, o, i, r, n, a, s, c, u, l, d) {
                void 0 === t && (t = 0),
                  void 0 === o && (o = ''),
                  void 0 === i && (i = ''),
                  void 0 === r && (r = 0),
                  void 0 === n && (n = ''),
                  void 0 === a && (a = e.TRTCRoleType.TRTCRoleAnchor),
                  void 0 === s && (s = null),
                  void 0 === u && (u = null),
                  void 0 === l && (l = null),
                  void 0 === d && (d = 30),
                  (this.sdkAppId = t),
                  (this.userId = o),
                  (this.userSig = i),
                  (this.roomId = r),
                  (this.strRoomId = n),
                  (this.role = a),
                  (this.privateMapKey = s),
                  (this.streamId = u),
                  (this.userDefineRecordId = l),
                  (this.frameWorkType = d);
              },
              S = function (t, o, i, r) {
                void 0 === t &&
                  (t = e.TRTCVideoResolution.TRTCVideoResolution_640_360),
                  void 0 === o &&
                    (o =
                      e.TRTCVideoResolutionMode
                        .TRTCVideoResolutionModeLandscape),
                  void 0 === i && (i = 15),
                  void 0 === r && (r = 550),
                  (this.videoResolution = t),
                  (this.resMode = o),
                  (this.videoFps = i),
                  (this.videoBitrate = r);
              };
            (e.TRTCVideoRotation = void 0),
              ((m = e.TRTCVideoRotation || (e.TRTCVideoRotation = {}))[
                (m.TRTCVideoRotation0 = 0)
              ] = 'TRTCVideoRotation0'),
              (m[(m.TRTCVideoRotation90 = 1)] = 'TRTCVideoRotation90'),
              (m[(m.TRTCVideoRotation180 = 2)] = 'TRTCVideoRotation180'),
              (m[(m.TRTCVideoRotation270 = 3)] = 'TRTCVideoRotation270');
            var V,
              M = function (t, o, i) {
                void 0 === t && (t = e.TRTCVideoRotation.TRTCVideoRotation0),
                  void 0 === o &&
                    (o = e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),
                  void 0 === i &&
                    (i = e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),
                  (this.rotation = t),
                  (this.fillMode = o),
                  (this.mirrorType = i);
              };
            (e.TRTCQuality = void 0),
              ((V = e.TRTCQuality || (e.TRTCQuality = {}))[
                (V.TRTCQuality_Unknown = 0)
              ] = 'TRTCQuality_Unknown'),
              (V[(V.TRTCQuality_Excellent = 1)] = 'TRTCQuality_Excellent'),
              (V[(V.TRTCQuality_Good = 2)] = 'TRTCQuality_Good'),
              (V[(V.TRTCQuality_Poor = 3)] = 'TRTCQuality_Poor'),
              (V[(V.TRTCQuality_Bad = 4)] = 'TRTCQuality_Bad'),
              (V[(V.TRTCQuality_Vbad = 5)] = 'TRTCQuality_Vbad'),
              (V[(V.TRTCQuality_Down = 6)] = 'TRTCQuality_Down');
            var w,
              b,
              A,
              I = function (t, o) {
                void 0 === t && (t = ''),
                  void 0 === o && (o = e.TRTCQuality.TRTCQuality_Unknown),
                  (this.userId = t),
                  (this.quality = o);
              },
              E = function (e, t) {
                void 0 === e && (e = ''),
                  void 0 === t && (t = 0),
                  (this.userId = e),
                  (this.volume = t);
              },
              D = function (e, t, o) {
                void 0 === e && (e = 0),
                  void 0 === t && (t = 0),
                  void 0 === o && (o = null),
                  (this.appId = e),
                  (this.bizId = t),
                  (this.url = o);
              },
              P = function (t, o, i, r, n, a, s) {
                void 0 === t && (t = 0),
                  void 0 === o && (o = 0),
                  void 0 === i && (i = 0),
                  void 0 === r && (r = 0),
                  void 0 === n && (n = 0),
                  void 0 === a && (a = 0),
                  void 0 === s &&
                    (s = e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),
                  (this.width = t),
                  (this.height = o),
                  (this.frameRate = i),
                  (this.videoBitrate = r),
                  (this.audioSampleRate = n),
                  (this.audioBitrate = a),
                  (this.streamType = s);
              },
              L = function (e, t, o, i, r, n, a, s, c, u) {
                void 0 === e && (e = 0),
                  void 0 === t && (t = 0),
                  void 0 === o && (o = 0),
                  void 0 === i && (i = 0),
                  void 0 === r && (r = 0),
                  void 0 === n && (n = 0),
                  void 0 === a && (a = 0),
                  void 0 === s && (s = []),
                  void 0 === c && (c = 0),
                  void 0 === u && (u = 0),
                  (this.upLoss = e),
                  (this.downLoss = t),
                  (this.appCpu = o),
                  (this.systemCpu = i),
                  (this.rtt = r),
                  (this.receivedBytes = n),
                  (this.sentBytes = a),
                  (this.localStatisticsArray = s),
                  (this.localStatisticsArraySize = c),
                  (this.remoteStatisticsArraySize = u);
              };
            (e.TRTCVideoResolutionMode = void 0),
              ((w =
                e.TRTCVideoResolutionMode || (e.TRTCVideoResolutionMode = {}))[
                (w.TRTCVideoResolutionModeLandscape = 0)
              ] = 'TRTCVideoResolutionModeLandscape'),
              (w[(w.TRTCVideoResolutionModePortrait = 1)] =
                'TRTCVideoResolutionModePortrait'),
              (e.TRTCVideoQosPreference = void 0),
              ((b =
                e.TRTCVideoQosPreference || (e.TRTCVideoQosPreference = {}))[
                (b.TRTCVideoQosPreferenceSmooth = 1)
              ] = 'TRTCVideoQosPreferenceSmooth'),
              (b[(b.TRTCVideoQosPreferenceClear = 2)] =
                'TRTCVideoQosPreferenceClear'),
              (e.TRTCQosControlMode = void 0),
              ((A = e.TRTCQosControlMode || (e.TRTCQosControlMode = {}))[
                (A.TRTCQosControlModeClient = 0)
              ] = 'TRTCQosControlModeClient'),
              (A[(A.TRTCQosControlModeServer = 1)] =
                'TRTCQosControlModeServer');
            var O,
              k = function (t, o) {
                void 0 === t &&
                  (t = e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),
                  void 0 === o &&
                    (o = e.TRTCQosControlMode.TRTCQosControlModeServer),
                  (this.preference = t),
                  (this.controlMode = o);
              },
              F = function (e, t, o, i) {
                void 0 === e && (e = new ArrayBuffer(0)),
                  void 0 === t && (t = 0),
                  void 0 === o && (o = 0),
                  void 0 === i && (i = 0),
                  (this.buffer = e),
                  (this.length = t),
                  (this.width = o),
                  (this.height = i);
              };
            (e.TRTCScreenCaptureSourceType = void 0),
              ((O =
                e.TRTCScreenCaptureSourceType ||
                (e.TRTCScreenCaptureSourceType = {}))[
                (O.TRTCScreenCaptureSourceTypeUnknown = -1)
              ] = 'TRTCScreenCaptureSourceTypeUnknown'),
              (O[(O.TRTCScreenCaptureSourceTypeWindow = 0)] =
                'TRTCScreenCaptureSourceTypeWindow'),
              (O[(O.TRTCScreenCaptureSourceTypeScreen = 1)] =
                'TRTCScreenCaptureSourceTypeScreen'),
              (O[(O.TRTCScreenCaptureSourceTypeCustom = 2)] =
                'TRTCScreenCaptureSourceTypeCustom');
            var Q,
              N = function (t, o, i, r, n, a) {
                void 0 === t &&
                  (t =
                    e.TRTCScreenCaptureSourceType
                      .TRTCScreenCaptureSourceTypeUnknown),
                  void 0 === o && (o = ''),
                  void 0 === i && (i = ''),
                  void 0 === r && (r = new F()),
                  void 0 === n && (n = new F()),
                  void 0 === a && (a = !1),
                  (this.type = t),
                  (this.sourceId = o),
                  (this.sourceName = i),
                  (this.thumbBGRA = r),
                  (this.iconBGRA = n),
                  (this.isMinimizeWindow = a);
              },
              x = function (e, t, o, i) {
                void 0 === e && (e = 0),
                  void 0 === t && (t = 0),
                  void 0 === o && (o = 0),
                  void 0 === i && (i = 0),
                  (this.left = e),
                  (this.top = t),
                  (this.right = o),
                  (this.bottom = i);
              },
              B = function (t, o, i, r, n, a, s, c, u, l, d, T, h, p, f) {
                void 0 === t &&
                  (t =
                    e.TRTCTranscodingConfigMode
                      .TRTCTranscodingConfigMode_Unknown),
                  void 0 === o && (o = 0),
                  void 0 === i && (i = 0),
                  void 0 === r && (r = 0),
                  void 0 === n && (n = 0),
                  void 0 === a && (a = 0),
                  void 0 === s && (s = 15),
                  void 0 === c && (c = 2),
                  void 0 === u && (u = 0),
                  void 0 === l && (l = ''),
                  void 0 === d && (d = 64),
                  void 0 === T && (T = 48e3),
                  void 0 === h && (h = 1),
                  void 0 === p && (p = []),
                  void 0 === f && (f = ''),
                  (this.mode = t),
                  (this.appId = o),
                  (this.bizId = i),
                  (this.videoWidth = r),
                  (this.videoHeight = n),
                  (this.videoBitrate = a),
                  (this.videoFramerate = s),
                  (this.videoGOP = c),
                  (this.backgroundColor = u),
                  (this.backgroundImage = l),
                  (this.audioSampleRate = d),
                  (this.audioBitrate = T),
                  (this.audioChannels = h),
                  (this.mixUsersArray = p),
                  (this.mixUsersArraySize = p.length),
                  (this.streamId = f);
              };
            (e.TRTCTranscodingConfigMode = void 0),
              ((Q =
                e.TRTCTranscodingConfigMode ||
                (e.TRTCTranscodingConfigMode = {}))[
                (Q.TRTCTranscodingConfigMode_Unknown = 0)
              ] = 'TRTCTranscodingConfigMode_Unknown'),
              (Q[(Q.TRTCTranscodingConfigMode_Manual = 1)] =
                'TRTCTranscodingConfigMode_Manual'),
              (Q[(Q.TRTCTranscodingConfigMode_Template_PureAudio = 2)] =
                'TRTCTranscodingConfigMode_Template_PureAudio'),
              (Q[(Q.TRTCTranscodingConfigMode_Template_PresetLayout = 3)] =
                'TRTCTranscodingConfigMode_Template_PresetLayout'),
              (Q[(Q.TRTCTranscodingConfigMode_Template_ScreenSharing = 4)] =
                'TRTCTranscodingConfigMode_Template_ScreenSharing'),
              (Q[(Q.TRTC_TranscodingConfigMode_Unknown = 5)] =
                'TRTC_TranscodingConfigMode_Unknown'),
              (Q[(Q.TRTC_TranscodingConfigMode_Manual = 6)] =
                'TRTC_TranscodingConfigMode_Manual'),
              (Q[(Q.TRTC_TranscodingConfigMode_Template_PureAudio = 7)] =
                'TRTC_TranscodingConfigMode_Template_PureAudio'),
              (Q[(Q.TRTC_TranscodingConfigMode_Template_PresetLayout = 8)] =
                'TRTC_TranscodingConfigMode_Template_PresetLayout'),
              (Q[(Q.TRTC_TranscodingConfigMode_Template_ScreenSharing = 9)] =
                'TRTC_TranscodingConfigMode_Template_ScreenSharing');
            var U,
              j = function (t, o, i, r, n, a, s, c) {
                void 0 === t && (t = ''),
                  void 0 === o && (o = ''),
                  void 0 === i && (i = null),
                  void 0 === r && (r = 0),
                  void 0 === n && (n = !1),
                  void 0 === a &&
                    (a = e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),
                  void 0 === s &&
                    (s = e.TRTCMixInputType.TRTCMixInputTypeUndefined),
                  void 0 === c && (c = 0),
                  (this.userId = t),
                  (this.roomId = o),
                  (this.rect = i),
                  (this.zOrder = r),
                  (this.pureAudio = n),
                  (this.streamType = a),
                  (this.inputType = s),
                  (this.renderMode = c);
              };
            (e.TRTCMixInputType = void 0),
              ((U = e.TRTCMixInputType || (e.TRTCMixInputType = {}))[
                (U.TRTCMixInputTypeUndefined = 0)
              ] = 'TRTCMixInputTypeUndefined'),
              (U[(U.TRTCMixInputTypeAudioVideo = 1)] =
                'TRTCMixInputTypeAudioVideo'),
              (U[(U.TRTCMixInputTypePureVideo = 2)] =
                'TRTCMixInputTypePureVideo'),
              (U[(U.TRTCMixInputTypePureAudio = 3)] =
                'TRTCMixInputTypePureAudio');
            var W,
              J = 'onError',
              Y = 'rtc',
              G = 'live',
              z = { 20: 'anchor', 21: 'audience' },
              K = { 0: Y, 1: G, 2: Y, 3: G },
              q = {
                0: 'standard',
                1: 'high',
                2: 'standard_stereo',
                3: 'high_stereo',
              };
            function H() {
              return Math.floor(performance.now());
            }
            !(function (e) {
              (e[(e.ActiveExitRoom = 0)] = 'ActiveExitRoom'),
                (e[(e.KickedExitRoom = 1)] = 'KickedExitRoom');
            })(W || (W = {}));
            var X,
              Z,
              $ = function (e) {
                return void 0 === e;
              },
              ee = function (e) {
                return 'number' == typeof e;
              },
              te = function (e) {
                return 'boolean' == typeof e;
              };
            !(function (e) {
              (e.LIVE = 'live'), (e.RTC = 'rtc');
            })(X || (X = {})),
              (function (e) {
                (e.CONTAIN = 'contain'), (e.COVER = 'cover'), (e.FILL = 'fill');
              })(Z || (Z = {}));
            var oe = -1e3,
              ie = {
                code: -1001,
                message: '参数错误, 请检查参数格式、是否非空等',
              },
              re = { code: -1005, message: 'not supported' },
              ne = '2.2.4',
              ae = (function () {
                function e(e, t) {
                  if (((this.logRegion = 'tc'), (this.loggerManager = e), t)) {
                    var o = t.sdkAppId,
                      i = t.userId,
                      r = t.seq;
                    (this.seq = r),
                      e &&
                        (this.logger = e.createLogger({
                          id: ''.concat(this.logRegion).concat(r),
                          userId: i,
                          sdkAppId: o,
                        }));
                  } else this.logger = e;
                  this.logger ||
                    (this.logger = {
                      debug: function (e) {
                        console.debug(e);
                      },
                      info: function (e) {
                        console.info(e);
                      },
                      warn: function (e) {
                        console.warn(e);
                      },
                      error: function (e) {
                        console.error(e);
                      },
                    });
                }
                return (
                  (e.prototype.getLogMessage = function (e) {
                    var t = this;
                    return e
                      .map(function (e) {
                        return t.getStringifyMessage(e);
                      })
                      .join(' ');
                  }),
                  (e.prototype.getStringifyMessage = function (e) {
                    var t = this;
                    if ('object' != typeof e) return e;
                    if (e instanceof HTMLElement)
                      return ''
                        .concat(e.tagName.toLocaleLowerCase(), '#')
                        .concat(e.id);
                    if (e instanceof Array) {
                      var o = [];
                      return (
                        Object.keys(e).forEach(function (i) {
                          return (o[i] = t.getStringifyMessage(e[i]));
                        }),
                        JSON.stringify(o)
                      );
                    }
                    if (e instanceof Object) {
                      var i = {};
                      return (
                        Object.keys(e).forEach(function (o) {
                          return (i[o] = t.getStringifyMessage(e[o]));
                        }),
                        JSON.stringify(i)
                      );
                    }
                    return e;
                  }),
                  (e.prototype.update = function (e) {
                    var t = e.userId,
                      o = e.sdkAppId;
                    this.loggerManager &&
                      this.loggerManager.createLogger &&
                      (this.logger = this.loggerManager.createLogger({
                        id: ''.concat(this.logRegion).concat(this.seq),
                        userId: t,
                        sdkAppId: o,
                      }));
                  }),
                  (e.prototype.debug = function () {
                    for (var e = [], t = 0; t < arguments.length; t++)
                      e[t] = arguments[t];
                    var o = this.getLogMessage(e);
                    this.logger.debug(o);
                  }),
                  (e.prototype.info = function () {
                    for (var e = [], t = 0; t < arguments.length; t++)
                      e[t] = arguments[t];
                    var o = this.getLogMessage(e);
                    this.logger && this.logger.info && this.logger.info(o);
                  }),
                  (e.prototype.warn = function () {
                    for (var e = [], t = 0; t < arguments.length; t++)
                      e[t] = arguments[t];
                    var o = this.getLogMessage(e);
                    this.logger && this.logger.warn && this.logger.warn(o);
                  }),
                  (e.prototype.error = function () {
                    for (var e = [], t = 0; t < arguments.length; t++)
                      e[t] = arguments[t];
                    var o = this.getLogMessage(e);
                    this.logger && this.logger.error && this.logger.error(o);
                  }),
                  e
                );
              })(),
              se = null,
              ce = i.default._loggerManager;
            ce.info('TRTCCloud Version: '.concat(ne));
            var ue = 'trtcCloud',
              le = 1,
              de = (function (t) {
                function o(o) {
                  void 0 === o && (o = {});
                  var r = t.call(this) || this;
                  (r._version = ''),
                    (r._frameWorkType = 30),
                    (r._component = 0),
                    (r._language = 0),
                    (r._localView = null),
                    (r._autoRecvAudio = !0),
                    (r._autoRecvVideo = !0),
                    (r._localTestView = null),
                    (r._isVideoPublish = !0),
                    (r._localRenderParams = {
                      rotation: e.TRTCVideoRotation.TRTCVideoRotation0,
                      fillMode: e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,
                      mirrorType:
                        e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto,
                    }),
                    (r._videoProfile = {}),
                    (r._videoPlayOption = {}),
                    (r._isAudioPublish = !0),
                    (r._audioProfile = Object.keys(q)[0]),
                    (r._isSharingScreen = !1),
                    (r._remoteStreamConfig = new Map()),
                    (r._remoteStreamMap = new Map()),
                    (r._cameraList = []),
                    (r._microphoneList = []),
                    (r._speakerList = []),
                    (r._currentCamera = {}),
                    (r._currentMicrophone = {}),
                    (r._currentSpeaker = {}),
                    (r._currentCameraId = ''),
                    (r._currentMicrophoneId = ''),
                    (r._currentSpeakerId = ''),
                    (r._screenShareParams = { option: {} }),
                    (r._isMobile = !1),
                    (r._isFrontCamera = !1),
                    (r._smallStreamVideoProfile = void 0),
                    (r._defaultVideoProfile = {
                      width: 640,
                      height: 480,
                      frameRate: 15,
                      bitrate: 900,
                    }),
                    (r._defaultScreenProfile = {
                      width: 1920,
                      height: 1080,
                      frameRate: 15,
                      bitrate: 1500,
                    }),
                    (r._defaultSmallVideoProfile = {
                      width: 160,
                      height: 120,
                      frameRate: 15,
                      bitrate: 200,
                    }),
                    (r._version = ne);
                  var n,
                    a,
                    s,
                    c = o.frameWorkType,
                    u = void 0 === c ? 30 : c,
                    l = o.component,
                    d = void 0 === l ? 0 : l;
                  return (
                    (r._frameWorkType = u),
                    (r._component = d),
                    (r._trtc = i.default.create()),
                    (r._testTrtc = i.default.create()),
                    (r._log = i.default._loggerManager),
                    (r.logger = new ae(ce, { seq: le++ })),
                    r._addTRTCEvents(),
                    (r.handleDeviceChange = r.handleDeviceChange.bind(r)),
                    navigator &&
                      navigator.mediaDevices &&
                      navigator.mediaDevices.addEventListener &&
                      navigator.mediaDevices.addEventListener(
                        'devicechange',
                        ((n = r.handleDeviceChange),
                        (a = 30),
                        function () {
                          for (
                            var e = this, t = [], o = 0;
                            o < arguments.length;
                            o++
                          )
                            t[o] = arguments[o];
                          s > 0 && clearTimeout(s),
                            (s = window.setTimeout(function () {
                              n.apply(e, t), (s = -1);
                            }, a));
                        }),
                      ),
                    r
                  );
                }
                return (
                  (function (e, t) {
                    if ('function' != typeof t && null !== t)
                      throw new TypeError(
                        'Class extends value ' +
                          String(t) +
                          ' is not a constructor or null',
                      );
                    function o() {
                      this.constructor = e;
                    }
                    r(e, t),
                      (e.prototype =
                        null === t
                          ? Object.create(t)
                          : ((o.prototype = t.prototype), new o()));
                  })(o, t),
                  (o.getTRTCShareInstance = function (e) {
                    return se || (se = new o(e)), se;
                  }),
                  (o.prototype.destroyTRTCShareInstance = function () {
                    se &&
                      (this._removeTRTCEvents(), se._destroy(), (se = null));
                  }),
                  (o.prototype.getSDKVersion = function () {
                    return this._version || '';
                  }),
                  (o.prototype.enterRoom = function (e, t) {
                    return a(this, void 0, Promise, function () {
                      var o, i, r, a, c, u, l, d, T, h, p, f, R, _, v, C;
                      return s(this, function (s) {
                        switch (s.label) {
                          case 0:
                            if (
                              ((o = e.sdkAppId),
                              (i = e.userId),
                              (r = e.userSig),
                              (a = e.roomId),
                              (c = e.strRoomId),
                              (u = e.role),
                              (l = e.privateMapKey),
                              (d = e.businessInfo),
                              (T = e.enableAutoPlayDialog),
                              (h = e.proxy),
                              (p = e.streamId),
                              (f = e.userDefineRecordId),
                              this.logger.update({ sdkAppId: o, userId: i }),
                              this.logger.info(
                                ''.concat(ue, '.enterRoom with params: '),
                                e,
                                t,
                              ),
                              !(o && i && r))
                            )
                              return [3, 5];
                            s.label = 1;
                          case 1:
                            return (
                              s.trys.push([1, 3, , 4]),
                              (R = {
                                sdkAppId: o,
                                userId: i,
                                userSig: r,
                                roomId: a,
                                strRoomId: c,
                                role: z[u],
                                scene: K[t],
                                autoReceiveAudio: this._autoRecvAudio,
                                autoReceiveVideo: this._autoRecvVideo,
                                frameWorkType: this._frameWorkType,
                                component: this._component,
                                language: this._language,
                              }),
                              (R = l ? n(n({}, R), { privateMapKey: l }) : R),
                              (R = d ? n(n({}, R), { businessInfo: d }) : R),
                              (R = T
                                ? n(n({}, R), { enableAutoPlayDialog: T })
                                : R),
                              (R = h ? n(n({}, R), { proxy: h }) : R),
                              (R = p ? n(n({}, R), { streamId: p }) : R),
                              (R = f
                                ? n(n({}, R), { userDefineRecordId: f })
                                : R),
                              (_ = H()),
                              [4, this._trtc.enterRoom(R)]
                            );
                          case 2:
                            return (
                              s.sent(),
                              (v = H() - _),
                              this.emit('onEnterRoom', v),
                              [3, 4]
                            );
                          case 3:
                            return (
                              (C = s.sent()),
                              this.emit('onEnterRoom', -1),
                              this._callFunctionErrorManage(C, 'enterRoom'),
                              [3, 4]
                            );
                          case 4:
                            return [3, 6];
                          case 5:
                            this._emitError(ie), (s.label = 6);
                          case 6:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.exitRoom = function () {
                    return a(this, void 0, Promise, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            return (
                              t.trys.push([0, 4, , 5]),
                              this.logger.info(''.concat(ue, '.exitRoom')),
                              this._isSharingScreen
                                ? [4, this.stopScreenShare()]
                                : [3, 2]
                            );
                          case 1:
                            t.sent(), (t.label = 2);
                          case 2:
                            return [4, this._trtc.exitRoom()];
                          case 3:
                            return t.sent(), [3, 5];
                          case 4:
                            return (
                              (e = t.sent()),
                              this._callFunctionErrorManage(e, 'exitRoom'),
                              [3, 5]
                            );
                          case 5:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.switchRole = function (e) {
                    return a(this, void 0, void 0, function () {
                      var t;
                      return s(this, function (o) {
                        switch (o.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.switchRole with param: '),
                              e,
                            ),
                              (o.label = 1);
                          case 1:
                            return (
                              o.trys.push([1, 3, , 4]),
                              [4, this._trtc.switchRole(z[e])]
                            );
                          case 2:
                            return (
                              o.sent(),
                              this.emit(
                                'onSwitchRole',
                                0,
                                'switch role success, role = '
                                  .concat(e, ', ')
                                  .concat(z[e]),
                              ),
                              [3, 4]
                            );
                          case 3:
                            return (
                              (t = o.sent()),
                              this.emit(
                                'onSwitchRole',
                                null == t ? void 0 : t.getCode(),
                                t.message,
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setDefaultStreamRecvMode = function (e, t) {
                    return a(this, void 0, void 0, function () {
                      return s(this, function (o) {
                        return (
                          this.logger.info(
                            ''.concat(
                              ue,
                              '.setDefaultStreamRecvMode with param: ',
                            ),
                            { autoRecvAudio: e, autoRecvVideo: t },
                          ),
                          te(e) && (this._autoRecvAudio = e),
                          te(t) && (this._autoRecvVideo = t),
                          [2]
                        );
                      });
                    });
                  }),
                  (o.prototype._updateLocalVideo = function () {
                    return a(this, void 0, void 0, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            return (
                              t.trys.push([0, 2, , 3]),
                              [
                                4,
                                this._trtc.updateLocalVideo(
                                  this._generateLocalVideoData(),
                                ),
                              ]
                            );
                          case 1:
                            return t.sent(), [3, 3];
                          case 2:
                            if (
                              (e = t.sent()).code ===
                              i.default.ERROR_CODE.OPERATION_ABORT
                            )
                              return [2];
                            throw e;
                          case 3:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype._updateLocalTestVideo = function () {
                    return a(this, void 0, void 0, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            return (
                              t.trys.push([0, 2, , 3]),
                              [
                                4,
                                this._testTrtc.updateLocalVideo(
                                  this._generateLocalTestVideoData(),
                                ),
                              ]
                            );
                          case 1:
                            return t.sent(), [3, 3];
                          case 2:
                            if (
                              (e = t.sent()).code ===
                              i.default.ERROR_CODE.OPERATION_ABORT
                            )
                              return [2];
                            throw e;
                          case 3:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype._updateRemoteVideo = function (e, t) {
                    return a(this, void 0, void 0, function () {
                      var o;
                      return s(this, function (r) {
                        switch (r.label) {
                          case 0:
                            return (
                              r.trys.push([0, 2, , 3]),
                              [
                                4,
                                this._trtc.updateRemoteVideo(
                                  this._generateRemoteVideoData(e, t),
                                ),
                              ]
                            );
                          case 1:
                            return r.sent(), [3, 3];
                          case 2:
                            if (
                              (o = r.sent()).code ===
                              i.default.ERROR_CODE.OPERATION_ABORT
                            )
                              return [2];
                            throw o;
                          case 3:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.startLocalPreview = function () {
                    for (var t = [], o = 0; o < arguments.length; o++)
                      t[o] = arguments[o];
                    return a(this, void 0, Promise, function () {
                      var o, r, n, a, u, l, d, T;
                      return s(this, function (s) {
                        switch (s.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.startLocalPreview with params: '),
                              t,
                            ),
                              1 === c([], t, !0).length
                                ? (r = c([], t, !0)[0])
                                : 2 === c([], t, !0).length &&
                                  ((T = c([], t, !0)), (o = T[0]), (r = T[1])),
                              $(o) ||
                                (this._setIsMobile(!0),
                                this._setIsFrontCamera(o)),
                              this._setLocalView(r),
                              (s.label = 1);
                          case 1:
                            s.trys.push([1, 8, , 9]), (s.label = 2);
                          case 2:
                            return (
                              s.trys.push([2, 4, , 7]),
                              [
                                4,
                                this._trtc.startLocalVideo(
                                  this._generateLocalVideoData(),
                                ),
                              ]
                            );
                          case 3:
                            return s.sent(), [3, 7];
                          case 4:
                            return (n = s.sent()).code !==
                              i.default.ERROR_CODE.OPERATION_ABORT
                              ? [3, 6]
                              : [4, this._updateLocalVideo()];
                          case 5:
                            return s.sent(), [2];
                          case 6:
                            throw n;
                          case 7:
                            return (
                              this.emit('onCameraDidReady'),
                              (a = this._getVideoProfile()),
                              (u = a.width),
                              (l = a.height),
                              this.emit(
                                'onFirstVideoFrame',
                                '',
                                e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,
                                u,
                                l,
                              ),
                              [3, 9]
                            );
                          case 8:
                            return (
                              (d = s.sent()),
                              this._callFunctionErrorManage(
                                d,
                                'startLocalPreview',
                              ),
                              [3, 9]
                            );
                          case 9:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.updateLocalView = function (e) {
                    return a(this, void 0, void 0, function () {
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(ue, '.updateLocalView with param: '),
                                e,
                              ),
                              this._setLocalView(e),
                              [4, this._updateLocalVideo()]
                            );
                          case 1:
                            return t.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.stopLocalPreview = function () {
                    return a(this, void 0, void 0, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.stopLocalPreview'),
                            ),
                              (t.label = 1);
                          case 1:
                            return (
                              t.trys.push([1, 3, , 4]),
                              this._setLocalView(null),
                              [4, this._trtc.stopLocalVideo()]
                            );
                          case 2:
                            return t.sent(), [3, 4];
                          case 3:
                            return (
                              (e = t.sent()),
                              console.warn(
                                ''
                                  .concat(ue, ' stopLocalPreview error: ')
                                  .concat(e),
                              ),
                              this._callFunctionErrorManage(
                                e,
                                'stopLocalPreview',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.muteLocalVideo = function (e) {
                    return (
                      void 0 === e && (e = !1),
                      a(this, void 0, void 0, function () {
                        var t;
                        return s(this, function (o) {
                          switch (o.label) {
                            case 0:
                              this.logger.info(
                                ''.concat(ue, '.muteLocalVideo with params: '),
                                e,
                              ),
                                (o.label = 1);
                            case 1:
                              return (
                                o.trys.push([1, 3, , 4]),
                                this._setIsVideoPublish(!e),
                                [4, this._updateLocalVideo()]
                              );
                            case 2:
                              return o.sent(), [3, 4];
                            case 3:
                              return (
                                (t = o.sent()),
                                this._callFunctionErrorManage(
                                  t,
                                  'muteLocalVideo',
                                ),
                                [3, 4]
                              );
                            case 4:
                              return [2];
                          }
                        });
                      })
                    );
                  }),
                  (o.prototype.startRemoteView = function (t, o, r) {
                    return a(this, void 0, void 0, function () {
                      var n, a;
                      return s(this, function (s) {
                        switch (s.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.startRemoteView with params: '),
                              t,
                              o,
                              r,
                            ),
                              (s.label = 1);
                          case 1:
                            if (
                              (s.trys.push([1, 8, , 9]),
                              this._setRemoteStreamConfig(t, r, {
                                view: o,
                                small:
                                  r ===
                                  e.TRTCVideoStreamType
                                    .TRTCVideoStreamTypeSmall,
                              }),
                              !this._remoteStreamMap.get(
                                ''
                                  .concat(t, '_')
                                  .concat(this._getTRTCStreamType(r)),
                              ))
                            )
                              return [2];
                            s.label = 2;
                          case 2:
                            return (
                              s.trys.push([2, 4, , 7]),
                              [
                                4,
                                this._trtc.startRemoteVideo(
                                  this._generateRemoteVideoData(t, r),
                                ),
                              ]
                            );
                          case 3:
                            return s.sent(), [3, 7];
                          case 4:
                            return (n = s.sent()).code !==
                              i.default.ERROR_CODE.OPERATION_ABORT
                              ? [3, 6]
                              : [4, this._updateRemoteVideo(t, r)];
                          case 5:
                            return s.sent(), [2];
                          case 6:
                            throw n;
                          case 7:
                            return (
                              this.emit('onFirstVideoFrame', t, r, 0, 0), [3, 9]
                            );
                          case 8:
                            return (
                              (a = s.sent()),
                              this._callFunctionErrorManage(
                                a,
                                'startRemoteView',
                              ),
                              [3, 9]
                            );
                          case 9:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.updateRemoteView = function (e, t, o) {
                    return a(this, void 0, void 0, function () {
                      return s(this, function (i) {
                        switch (i.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(
                                  ue,
                                  '.updateRemoteView with params: ',
                                ),
                                e,
                                t,
                                o,
                              ),
                              this._setRemoteStreamConfig(e, o, { view: t }),
                              this._remoteStreamMap.get(
                                ''
                                  .concat(e, '_')
                                  .concat(this._getTRTCStreamType(o)),
                              )
                                ? [4, this._updateRemoteVideo(e, o)]
                                : [2]
                            );
                          case 1:
                            return i.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.stopRemoteView = function (e, t) {
                    return a(this, void 0, void 0, function () {
                      var o;
                      return s(this, function (i) {
                        switch (i.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.stopRemoteView with params: '),
                              e,
                              t,
                            ),
                              (i.label = 1);
                          case 1:
                            return (
                              i.trys.push([1, 3, , 4]),
                              [
                                4,
                                this._trtc.stopRemoteVideo({
                                  userId: e,
                                  streamType: this._getTRTCStreamType(t),
                                }),
                              ]
                            );
                          case 2:
                            return i.sent(), [3, 4];
                          case 3:
                            return (
                              (o = i.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'stopRemoteView',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.stopAllRemoteView = function () {
                    return a(this, void 0, void 0, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.stopAllRemoteView'),
                            ),
                              (t.label = 1);
                          case 1:
                            return (
                              t.trys.push([1, 3, , 4]),
                              [4, this._trtc.stopRemoteVideo({ userId: '*' })]
                            );
                          case 2:
                            return t.sent(), [3, 4];
                          case 3:
                            return (
                              (e = t.sent()),
                              this._callFunctionErrorManage(
                                e,
                                'stopAllRemoteView',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setVideoEncoderParam = function (e) {
                    return a(this, void 0, void 0, function () {
                      var t, o;
                      return s(this, function (i) {
                        switch (i.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setVideoEncoderParam with params: ',
                              ),
                              e,
                            ),
                              (i.label = 1);
                          case 1:
                            return (
                              i.trys.push([1, 4, , 5]),
                              (t = this._getTRTCVideoProfile('video', e)),
                              this._setVideoProfile(t),
                              [4, this._updateLocalVideo()]
                            );
                          case 2:
                            return i.sent(), [4, this._updateLocalTestVideo()];
                          case 3:
                            return i.sent(), [3, 5];
                          case 4:
                            return (
                              (o = i.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'setVideoEncoderParam',
                              ),
                              [3, 5]
                            );
                          case 5:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setLocalRenderParams = function (e) {
                    return a(this, void 0, void 0, function () {
                      var t, o;
                      return s(this, function (i) {
                        switch (i.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setLocalRenderParams with params: ',
                              ),
                              e,
                            ),
                              Object.assign(this._localRenderParams, e),
                              (i.label = 1);
                          case 1:
                            return (
                              i.trys.push([1, 4, , 5]),
                              (t = {}),
                              e.mirrorType &&
                                (t.mirror = this._getTRTCMirror(e.mirrorType)),
                              e.fillMode &&
                                (t.fillMode = this._getTRTCFillMode(
                                  e.fillMode,
                                )),
                              this._setVideoPlayOption(t),
                              [4, this._updateLocalVideo()]
                            );
                          case 2:
                            return i.sent(), [4, this._updateLocalTestVideo()];
                          case 3:
                            return i.sent(), [3, 5];
                          case 4:
                            return (
                              (o = i.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'setLocalRenderParams',
                              ),
                              [3, 5]
                            );
                          case 5:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setRemoteRenderParams = function (e, t, o) {
                    return a(this, void 0, void 0, function () {
                      var i;
                      return s(this, function (r) {
                        switch (r.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setRemoteRenderParams with params: ',
                              ),
                              e,
                              t,
                              o,
                            ),
                              (r.label = 1);
                          case 1:
                            return (
                              r.trys.push([1, 3, , 4]),
                              this._setRemoteStreamConfig(e, t, o),
                              [4, this._updateRemoteVideo(e, t)]
                            );
                          case 2:
                            return r.sent(), [3, 4];
                          case 3:
                            return (
                              (i = r.sent()),
                              this._callFunctionErrorManage(
                                i,
                                'setRemoteRenderParams',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype._updateLocalAudio = function () {
                    return a(this, void 0, void 0, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            return (
                              t.trys.push([0, 2, , 3]),
                              [
                                4,
                                this._trtc.updateLocalAudio(
                                  this._generateLocalAudioData(),
                                ),
                              ]
                            );
                          case 1:
                            return t.sent(), [3, 3];
                          case 2:
                            if (
                              (e = t.sent()).code ===
                              i.default.ERROR_CODE.OPERATION_ABORT
                            )
                              return [2];
                            throw e;
                          case 3:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.startLocalAudio = function (t) {
                    return (
                      void 0 === t &&
                        (t = e.TRTCAudioQuality.TRTCAudioQualityDefault),
                      a(this, void 0, void 0, function () {
                        var e, o;
                        return s(this, function (r) {
                          switch (r.label) {
                            case 0:
                              this.logger.info(
                                ''.concat(ue, '.startLocalAudio with params: '),
                                t,
                              ),
                                (r.label = 1);
                            case 1:
                              r.trys.push([1, 8, , 9]),
                                this._setAudioProfile(q[t]),
                                (r.label = 2);
                            case 2:
                              return (
                                r.trys.push([2, 4, , 7]),
                                [
                                  4,
                                  this._trtc.startLocalAudio(
                                    this._generateLocalAudioData(),
                                  ),
                                ]
                              );
                            case 3:
                              return r.sent(), [3, 7];
                            case 4:
                              return (e = r.sent()).code !==
                                i.default.ERROR_CODE.OPERATION_ABORT
                                ? [3, 6]
                                : [4, this._updateLocalAudio()];
                            case 5:
                              return r.sent(), [2];
                            case 6:
                              throw e;
                            case 7:
                              return this.emit('onMicDidReady'), [3, 9];
                            case 8:
                              return (
                                (o = r.sent()),
                                console.warn(
                                  ''
                                    .concat(ue, ' startLocalAudio error: ')
                                    .concat(o),
                                ),
                                this._callFunctionErrorManage(
                                  o,
                                  'startLocalAudio',
                                ),
                                [3, 9]
                              );
                            case 9:
                              return [2];
                          }
                        });
                      })
                    );
                  }),
                  (o.prototype.stopLocalAudio = function () {
                    return a(this, void 0, void 0, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            this.logger.info(''.concat(ue, '.stopLocalAudio')),
                              (t.label = 1);
                          case 1:
                            return (
                              t.trys.push([1, 3, , 4]),
                              [4, this._trtc.stopLocalAudio()]
                            );
                          case 2:
                            return t.sent(), [3, 4];
                          case 3:
                            return (
                              (e = t.sent()),
                              this._callFunctionErrorManage(
                                e,
                                'stopLocalAudio',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.muteLocalAudio = function (e) {
                    return (
                      void 0 === e && (e = !1),
                      a(this, void 0, void 0, function () {
                        var t;
                        return s(this, function (o) {
                          switch (o.label) {
                            case 0:
                              this.logger.info(
                                ''.concat(ue, '.muteLocalAudio with params: '),
                                e,
                              ),
                                (o.label = 1);
                            case 1:
                              return (
                                o.trys.push([1, 3, , 4]),
                                this._setIsAudioPublish(!e),
                                [4, this._updateLocalAudio()]
                              );
                            case 2:
                              return o.sent(), [3, 4];
                            case 3:
                              return (
                                (t = o.sent()),
                                this._callFunctionErrorManage(
                                  t,
                                  'muteLocalAudio',
                                ),
                                [3, 4]
                              );
                            case 4:
                              return [2];
                          }
                        });
                      })
                    );
                  }),
                  (o.prototype.muteRemoteAudio = function (e, t) {
                    return (
                      void 0 === t && (t = !1),
                      a(this, void 0, void 0, function () {
                        var o;
                        return s(this, function (i) {
                          switch (i.label) {
                            case 0:
                              this.logger.info(
                                ''.concat(ue, '.muteRemoteAudio with params: '),
                                e,
                                t,
                              ),
                                (i.label = 1);
                            case 1:
                              return (
                                i.trys.push([1, 3, , 4]),
                                e
                                  ? [4, this._trtc.muteRemoteAudio(e, t)]
                                  : (this._emitError(ie), [2])
                              );
                            case 2:
                              return i.sent(), [3, 4];
                            case 3:
                              return (
                                (o = i.sent()),
                                this._callFunctionErrorManage(
                                  o,
                                  'muteRemoteAudio',
                                ),
                                [3, 4]
                              );
                            case 4:
                              return [2];
                          }
                        });
                      })
                    );
                  }),
                  (o.prototype.muteAllRemoteAudio = function (e) {
                    this.logger.info(
                      ''.concat(ue, '.muteAllRemoteAudio with params: '),
                      e,
                    );
                    try {
                      this._trtc.muteRemoteAudio('*', e);
                    } catch (t) {
                      this._callFunctionErrorManage(t, 'muteAllRemoteAudio');
                    }
                  }),
                  (o.prototype.setRemoteAudioVolume = function (e, t) {
                    this.logger.info(
                      ''.concat(ue, '.setRemoteAudioVolume with params: '),
                      e,
                      t,
                    );
                    try {
                      this._trtc.setRemoteAudioVolume(e, t);
                    } catch (o) {
                      this._callFunctionErrorManage(o, 'setRemoteAudioVolume');
                    }
                  }),
                  (o.prototype.enableAudioVolumeEvaluation = function (e) {
                    this.logger.info(
                      ''.concat(
                        ue,
                        '.enableAudioVolumeEvaluation with params: ',
                      ),
                      e,
                    );
                    try {
                      this._trtc.enableAudioVolumeEvaluation(e);
                    } catch (t) {
                      this._callFunctionErrorManage(
                        t,
                        'enableAudioVolumeEvaluation',
                      );
                    }
                  }),
                  (o.prototype.enableSmallVideoStream = function (e, t) {
                    return a(this, void 0, Promise, function () {
                      var o;
                      return s(this, function (i) {
                        switch (i.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(
                                  ue,
                                  '.enableSmallVideoStream with params: ',
                                ),
                                e,
                                t,
                              ),
                              e
                                ? ((o = this._getTRTCVideoProfile('small', t)),
                                  this._setSmallStreamVideoProfile(o))
                                : this._setSmallStreamVideoProfile(void 0),
                              [4, this._updateLocalVideo()]
                            );
                          case 1:
                            return i.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.startScreenShare = function (t, o, r) {
                    return a(this, void 0, void 0, function () {
                      var n, a, c, u, l, d;
                      return s(this, function (s) {
                        switch (s.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.startScreenShare with params: '),
                              t,
                              o,
                              r,
                            ),
                              (s.label = 1);
                          case 1:
                            return (
                              s.trys.push([1, 3, , 4]),
                              (n = (r || {}).screenAudio),
                              (a = void 0 !== n && n),
                              (c = this._getTRTCVideoProfile('screen', r)),
                              this._setScreenShareParams({
                                view: t,
                                profile: c,
                                systemAudio: a,
                              }),
                              [
                                4,
                                this._trtc.startScreenShare(
                                  this._getScreenShareParams(),
                                ),
                              ]
                            );
                          case 2:
                            return (
                              s.sent(),
                              (this._isSharingScreen = !0),
                              (u = c.width),
                              (l = c.height),
                              this.emit(
                                'onFirstVideoFrame',
                                '',
                                e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,
                                u,
                                l,
                              ),
                              [3, 4]
                            );
                          case 3:
                            if (
                              (d = s.sent()).code ===
                              i.default.ERROR_CODE.OPERATION_ABORT
                            )
                              return [2];
                            throw (
                              (console.error(
                                'Start share screen error:',
                                d,
                                d.code,
                                d.name,
                                d.message,
                              ),
                              d)
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setSubStreamEncoderParam = function (e) {
                    return a(this, void 0, void 0, function () {
                      var t, o;
                      return s(this, function (i) {
                        switch (i.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setSubStreamEncoderParam with params: ',
                              ),
                              e,
                            ),
                              (i.label = 1);
                          case 1:
                            return (
                              i.trys.push([1, 3, , 4]),
                              (t = this._getTRTCVideoProfile('screen', e)),
                              this._setScreenShareParams({ profile: t }),
                              [
                                4,
                                this._trtc.updateScreenShare(
                                  this._getScreenShareParams(),
                                ),
                              ]
                            );
                          case 2:
                            return i.sent(), [3, 4];
                          case 3:
                            return (
                              (o = i.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'setSubStreamEncoderParam',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.stopScreenShare = function () {
                    return a(this, void 0, Promise, function () {
                      var e;
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            this.logger.info(''.concat(ue, '.stopScreenShare')),
                              (t.label = 1);
                          case 1:
                            return (
                              t.trys.push([1, 3, , 4]),
                              [4, this._trtc.stopScreenShare()]
                            );
                          case 2:
                            return (
                              t.sent(),
                              (this._isSharingScreen = !1),
                              this.emit('onScreenCaptureStopped', 0),
                              [3, 4]
                            );
                          case 3:
                            return (
                              (e = t.sent()),
                              this._callFunctionErrorManage(
                                e,
                                'stopScreenShare',
                              ),
                              [3, 4]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.startScreenCapture = function () {
                    this._emitError(re);
                  }),
                  (o.prototype.pauseScreenCapture = function () {
                    this._emitError(re);
                  }),
                  (o.prototype.resumeScreenCapture = function () {
                    this._emitError(re);
                  }),
                  (o.prototype.getScreenCaptureSources = function () {
                    this._emitError(re);
                  }),
                  (o.prototype.selectScreenCaptureTarget = function () {
                    this._emitError(re);
                  }),
                  (o.prototype.getCameraDevicesList = function () {
                    return a(this, void 0, Promise, function () {
                      var e, t, o;
                      return s(this, function (r) {
                        switch (r.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.getCameraDevicesList'),
                            ),
                              (r.label = 1);
                          case 1:
                            return (
                              r.trys.push([1, 3, , 4]),
                              [4, i.default.getCameraList()]
                            );
                          case 2:
                            return (
                              (e = r.sent()),
                              (t = e.map(function (e) {
                                return n(n({}, e), { deviceName: e.label });
                              })),
                              (this._cameraList = e),
                              '{}' === JSON.stringify(this._currentCamera) &&
                                ((this._currentCamera =
                                  this.getDefaultDeviceInfo(e)),
                                (this._currentCameraId =
                                  this._currentCamera.deviceId)),
                              [2, Promise.resolve(t)]
                            );
                          case 3:
                            return (
                              (o = r.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'getCameraDevicesList',
                              ),
                              [2, Promise.resolve([])]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setCurrentCameraDevice = function (e) {
                    return a(this, void 0, Promise, function () {
                      var t;
                      return s(this, function (o) {
                        switch (o.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setCurrentCameraDevice with params: ',
                              ),
                              { cameraId: e },
                            ),
                              (o.label = 1);
                          case 1:
                            return (
                              o.trys.push([1, 4, , 5]),
                              e
                                ? ((this._currentCameraId = e),
                                  (this._currentCamera =
                                    this._cameraList.filter(function (t) {
                                      return t.deviceId === e;
                                    })),
                                  [4, this._updateLocalVideo()])
                                : [2, !1]
                            );
                          case 2:
                            return o.sent(), [4, this._updateLocalTestVideo()];
                          case 3:
                            return o.sent(), [2, !0];
                          case 4:
                            return (
                              (t = o.sent()),
                              this._callFunctionErrorManage(
                                t,
                                'setCurrentCameraDevice',
                              ),
                              [2, !1]
                            );
                          case 5:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.getCurrentCameraDevice = function () {
                    this.logger.info(''.concat(ue, '.getCurrentCameraDevice'));
                    var e = this._currentCamera,
                      t = e.deviceId,
                      o = e.label,
                      i = e.kind,
                      r = e.groupId;
                    return new g(t, o, i, o, r);
                  }),
                  (o.prototype.isFrontCamera = function () {
                    return this._getIsFrontCamera();
                  }),
                  (o.prototype.switchCamera = function (e) {
                    return a(this, void 0, void 0, function () {
                      var t;
                      return s(this, function (o) {
                        switch (o.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(ue, '.switchCamera with params: '),
                                e,
                              ),
                              this._setIsFrontCamera(e),
                              ((t = this._getVideoPlayOption()).mirror =
                                this._getTRTCMirror(
                                  this._localRenderParams.mirrorType,
                                )),
                              this._setVideoPlayOption(t),
                              [4, this._updateLocalVideo()]
                            );
                          case 1:
                            return o.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.getMicDevicesList = function () {
                    return a(this, void 0, Promise, function () {
                      var e, t, o;
                      return s(this, function (r) {
                        switch (r.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.getMicDevicesList'),
                            ),
                              (r.label = 1);
                          case 1:
                            return (
                              r.trys.push([1, 3, , 4]),
                              [4, i.default.getMicrophoneList()]
                            );
                          case 2:
                            return (
                              (e = r.sent()),
                              (t = e.map(function (e) {
                                return n(n({}, e), { deviceName: e.label });
                              })),
                              (this._microphoneList = e),
                              '{}' ===
                                JSON.stringify(this._currentMicrophone) &&
                                ((this._currentMicrophone =
                                  this.getDefaultDeviceInfo(e)),
                                (this._currentMicrophoneId =
                                  this._currentMicrophone.deviceId)),
                              [2, Promise.resolve(t)]
                            );
                          case 3:
                            return (
                              (o = r.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'getMicDevicesList',
                              ),
                              [2, Promise.resolve([])]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setCurrentMicDevice = function (e) {
                    return a(this, void 0, Promise, function () {
                      var t;
                      return s(this, function (o) {
                        switch (o.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setCurrentMicDevice with params: ',
                              ),
                              { micId: e },
                            ),
                              (o.label = 1);
                          case 1:
                            return (
                              o.trys.push([1, 3, , 4]),
                              e
                                ? (this._setCurrentMicrophoneId(e),
                                  (this._currentMicrophone =
                                    this._microphoneList.filter(function (t) {
                                      return t.deviceId === e;
                                    })),
                                  [
                                    4,
                                    this._trtc.updateLocalAudio(
                                      this._generateLocalAudioData(),
                                    ),
                                  ])
                                : [2, !1]
                            );
                          case 2:
                            return o.sent(), [2, !0];
                          case 3:
                            return (
                              (t = o.sent()),
                              this._callFunctionErrorManage(
                                t,
                                'setCurrentMicDevice',
                              ),
                              [2, !1]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.getCurrentMicDevice = function () {
                    this.logger.info(''.concat(ue, '.getCurrentMicDevice'));
                    var e = this._currentMicrophone,
                      t = e.deviceId,
                      o = e.label,
                      i = e.kind,
                      r = e.groupId;
                    return new g(t, o, i, o, r);
                  }),
                  (o.prototype.getSpeakerDevicesList = function () {
                    return a(this, void 0, Promise, function () {
                      var e, t, o;
                      return s(this, function (r) {
                        switch (r.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(ue, '.getSpeakerDevicesList'),
                            ),
                              (r.label = 1);
                          case 1:
                            return (
                              r.trys.push([1, 3, , 4]),
                              [4, i.default.getSpeakerList()]
                            );
                          case 2:
                            return (
                              (e = r.sent()),
                              (t = e.map(function (e) {
                                return n(n({}, e), { deviceName: e.label });
                              })),
                              (this._speakerList = e),
                              '{}' === JSON.stringify(this._currentSpeaker) &&
                                ((this._currentSpeaker =
                                  this.getDefaultDeviceInfo(e)),
                                (this._currentSpeakerId =
                                  this._currentSpeaker.deviceId)),
                              [2, Promise.resolve(t)]
                            );
                          case 3:
                            return (
                              (o = r.sent()),
                              this._callFunctionErrorManage(
                                o,
                                'getSpeakerDevicesList',
                              ),
                              [2, Promise.resolve([])]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.setCurrentSpeakerDevice = function (e) {
                    return a(this, void 0, Promise, function () {
                      var t;
                      return s(this, function (o) {
                        switch (o.label) {
                          case 0:
                            this.logger.info(
                              ''.concat(
                                ue,
                                '.setCurrentSpeakerDevice with params: ',
                              ),
                              { speakerId: e },
                            ),
                              (o.label = 1);
                          case 1:
                            return (
                              o.trys.push([1, 3, , 4]),
                              e
                                ? (this._setCurrentSpeakerId(e),
                                  (this._currentSpeaker =
                                    this._speakerList.filter(function (t) {
                                      return t.deviceId === e;
                                    })),
                                  [4, i.default.setCurrentSpeaker(e)])
                                : [2, !1]
                            );
                          case 2:
                            return o.sent(), [2, !0];
                          case 3:
                            return (
                              (t = o.sent()),
                              this._callFunctionErrorManage(
                                t,
                                'setCurrentSpeakerDevice',
                              ),
                              [2, !1]
                            );
                          case 4:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.getCurrentSpeakerDevice = function () {
                    this.logger.info(''.concat(ue, '.getCurrentSpeakerDevice'));
                    var e = this._currentSpeaker,
                      t = e.deviceId,
                      o = e.label,
                      i = e.kind,
                      r = e.groupId;
                    return new g(t, o, i, o, r);
                  }),
                  (o.prototype.startCameraDeviceTest = function (e) {
                    return a(this, void 0, void 0, function () {
                      return s(this, function (t) {
                        switch (t.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(
                                  ue,
                                  '.startCameraDeviceTest with params: ',
                                ),
                                e,
                              ),
                              e
                                ? (this._setLocalTestView(e),
                                  [
                                    4,
                                    this._testTrtc.startLocalVideo(
                                      this._generateLocalTestVideoData(),
                                    ),
                                  ])
                                : [2]
                            );
                          case 1:
                            return t.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.stopCameraDeviceTest = function () {
                    return a(this, void 0, void 0, function () {
                      return s(this, function (e) {
                        switch (e.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(ue, '.stopCameraDeviceTest'),
                              ),
                              this._setLocalTestView(null),
                              [4, this._testTrtc.stopLocalVideo()]
                            );
                          case 1:
                            return e.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.startMicDeviceTest = function (t) {
                    return a(this, void 0, void 0, function () {
                      var o = this;
                      return s(this, function (r) {
                        switch (r.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(
                                  ue,
                                  '.startMicDeviceTest with params: ',
                                ),
                                t,
                              ),
                              [
                                4,
                                this._testTrtc.startLocalAudio({
                                  publish: !1,
                                  option: {
                                    microphoneId: this._currentMicrophoneId,
                                    profile:
                                      q[
                                        e.TRTCAudioQuality
                                          .TRTCAudioQualityDefault
                                      ],
                                  },
                                }),
                              ]
                            );
                          case 1:
                            return (
                              r.sent(),
                              this._testTrtc.on(
                                i.default.EVENT.AUDIO_VOLUME,
                                function (e) {
                                  null == e ||
                                    e.result.forEach(function (e) {
                                      var t = e.userId,
                                        i = e.volume;
                                      '' === t && o.emit('onTestMicVolume', i);
                                    });
                                },
                              ),
                              [4, this._testTrtc.enableAudioVolumeEvaluation(t)]
                            );
                          case 2:
                            return r.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.stopMicDeviceTest = function () {
                    return a(this, void 0, void 0, function () {
                      return s(this, function (e) {
                        switch (e.label) {
                          case 0:
                            return (
                              this.logger.info(
                                ''.concat(ue, '.stopMicDeviceTest'),
                              ),
                              [4, this._testTrtc.stopLocalAudio()]
                            );
                          case 1:
                            return e.sent(), [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.callExperimentalAPI = function (e) {
                    this.logger.info(''.concat(ue, '.callExperimentalAPI'), e);
                    var t = (function (e) {
                      if ('string' != typeof e) return e;
                      var t;
                      try {
                        var o = JSON.parse(e);
                        t = 'object' == typeof o && o ? o : e;
                      } catch (i) {
                        t = e;
                      }
                      return t;
                    })(e);
                    if (t !== e) {
                      var o = t.api,
                        i = t.params;
                      o &&
                        i &&
                        'setFramework' === o &&
                        this._handleSetFrameWork(i);
                    }
                  }),
                  (o.prototype._handleSetFrameWork = function (e) {
                    var t = e.frameWork,
                      o = e.component,
                      i = e.language;
                    ee(t) && (this._frameWorkType = t),
                      ee(o) && (this._component = o),
                      ee(i) && (this._language = i);
                  }),
                  (o.prototype._unbindEvents = function () {}),
                  (o.prototype._destroy = function () {
                    this._unbindEvents();
                  }),
                  (o.prototype._emitError = function (e) {
                    e && this.emit && this.emit(J, e.code, e.message);
                  }),
                  (o.prototype._callFunctionErrorManage = function (e, t) {
                    (e && e.code === i.default.ERROR_CODE.OPERATION_ABORT) ||
                      (e && e.getCode && e.getCode()
                        ? (this.emit(J, e.getCode(), e.message),
                          this.logger.warn(
                            '('.concat(t, ') failed - ').concat(e.message),
                          ))
                        : (this.emit(J, oe, e.message),
                          this.logger.warn(
                            '('.concat(t, ') failed - ').concat(e.message),
                          )));
                  }),
                  (o.prototype._getTRTCResolution = function (t) {
                    var o = (e.TRTCVideoResolution[t] || '').split('_');
                    return {
                      width: +(o.length > 1 && o[1]),
                      height: +(o.length > 2 && o[2]),
                    };
                  }),
                  (o.prototype._getTRTCVideoProfile = function (t, o) {
                    var i = o.videoResolution,
                      r = o.videoFps,
                      n = o.videoBitrate,
                      a = o.resMode,
                      s = {};
                    switch (t) {
                      case 'screen':
                        s = this._defaultScreenProfile;
                        break;
                      case 'small':
                        s = this._defaultSmallVideoProfile;
                        break;
                      default:
                        s = this._defaultVideoProfile;
                    }
                    if (!$(i)) {
                      var c = this._getTRTCResolution(i);
                      (s.width = c.width), (s.height = c.height);
                    }
                    if (
                      !$(a) &&
                      a ===
                        e.TRTCVideoResolutionMode
                          .TRTCVideoResolutionModePortrait
                    ) {
                      var u = s.height,
                        l = s.width;
                      (s.width = u), (s.height = l);
                    }
                    return r && (s.frameRate = r), n && (s.bitrate = n), s;
                  }),
                  (o.prototype._getTRTCStreamType = function (t) {
                    var o;
                    return (((o = {})[
                      e.TRTCVideoStreamType.TRTCVideoStreamTypeBig
                    ] = i.default.TYPE.STREAM_TYPE_MAIN),
                    (o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall] =
                      i.default.TYPE.STREAM_TYPE_MAIN),
                    (o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub] =
                      i.default.TYPE.STREAM_TYPE_SUB),
                    o)[t];
                  }),
                  (o.prototype._getTRTCFillMode = function (t) {
                    var o;
                    return (((o = {})[
                      e.TRTCVideoFillMode.TRTCVideoFillMode_Fill
                    ] = Z.COVER),
                    (o[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit] = Z.CONTAIN),
                    o)[t];
                  }),
                  (o.prototype._getTRTCMirror = function (t) {
                    var o;
                    return t === e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto
                      ? !this._getIsMobile() || this._getIsFrontCamera()
                      : (((o = {})[
                          e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable
                        ] = !0),
                        (o[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable] =
                          !1),
                        o)[t];
                  }),
                  (o.prototype._getTRTCCloudDeviceType = function (t) {
                    return {
                      camera: e.TRTCDeviceType.TRTCDeviceTypeCamera,
                      microphone: e.TRTCDeviceType.TRTCDeviceTypeMic,
                      speaker: e.TRTCDeviceType.TRTCDeviceTypeSpeaker,
                    }[t];
                  }),
                  (o.prototype._getTRTCCloudDeviceState = function (t) {
                    return {
                      add: e.TRTCDeviceState.TRTCDeviceStateAdd,
                      remove: e.TRTCDeviceState.TRTCDeviceStateRemove,
                      active: e.TRTCDeviceState.TRTCDeviceStateActive,
                    }[t];
                  }),
                  (o.prototype._getTRTCCloudQuality = function (t) {
                    return [
                      e.TRTCQuality.TRTCQuality_Unknown,
                      e.TRTCQuality.TRTCQuality_Excellent,
                      e.TRTCQuality.TRTCQuality_Good,
                      e.TRTCQuality.TRTCQuality_Poor,
                      e.TRTCQuality.TRTCQuality_Bad,
                      e.TRTCQuality.TRTCQuality_Vbad,
                      e.TRTCQuality.TRTCQuality_Down,
                    ][t];
                  }),
                  (o.prototype._generateLocalVideoData = function () {
                    var e = {
                      view: this._getLocalView(),
                      publish: this._getIsVideoPublish(),
                      option: n(
                        {
                          profile: this._getVideoProfile(),
                          small: this._getSmallStreamVideoProfile(),
                        },
                        this._getVideoPlayOption(),
                      ),
                    };
                    return (
                      this._getIsMobile()
                        ? e &&
                          Object.assign(e.option, {
                            useFrontCamera: this._getIsFrontCamera(),
                          })
                        : e &&
                          Object.assign(e.option, {
                            cameraId: this._getCurrentCameraId(),
                          }),
                      e
                    );
                  }),
                  (o.prototype._generateLocalTestVideoData = function () {
                    return {
                      view: this._getLocalTestView(),
                      publish: !1,
                      option: n(
                        {
                          cameraId: this._getCurrentCameraId(),
                          profile: this._getVideoProfile(),
                        },
                        this._getVideoPlayOption(),
                      ),
                    };
                  }),
                  (o.prototype._generateLocalAudioData = function () {
                    return {
                      publish: this._getIsAudioPublish(),
                      option: {
                        microphoneId: this._getCurrentMicrophoneId(),
                        profile: this._getAudioProfile(),
                      },
                    };
                  }),
                  (o.prototype._generateRemoteVideoData = function (e, t) {
                    return this._remoteStreamConfig.get(
                      ''.concat(e, '_').concat(this._getTRTCStreamType(t)),
                    );
                  }),
                  (o.prototype._addTRTCEvents = function () {
                    var t = this;
                    this._trtc.on(i.default.EVENT.ERROR, function (e) {
                      var o;
                      e &&
                        t.emit(
                          'onError',
                          null === (o = null == e ? void 0 : e.getCode) ||
                            void 0 === o
                            ? void 0
                            : o.getCode(),
                          e.message,
                        );
                    }),
                      this._trtc.on(
                        i.default.EVENT.REMOTE_USER_ENTER,
                        function (e) {
                          (null == e ? void 0 : e.userId) &&
                            t.emit('onRemoteUserEnterRoom', e.userId);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.REMOTE_USER_EXIT,
                        function (e) {
                          (null == e ? void 0 : e.userId) &&
                            t.emit('onRemoteUserLeaveRoom', e.userId);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.REMOTE_AUDIO_AVAILABLE,
                        function (e) {
                          (null == e ? void 0 : e.userId) &&
                            t.emit('onUserAudioAvailable', e.userId, !0);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,
                        function (e) {
                          (null == e ? void 0 : e.userId) &&
                            t.emit('onUserAudioAvailable', e.userId, !1);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.REMOTE_VIDEO_AVAILABLE,
                        function (e) {
                          t._emitVideoAvailable(e, !0);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,
                        function (e) {
                          t._emitVideoAvailable(e, !1);
                        },
                      ),
                      this._trtc.on(i.default.EVENT.AUDIO_VOLUME, function (e) {
                        (null == e ? void 0 : e.result) &&
                          t.emit(
                            'onUserVoiceVolume',
                            null == e ? void 0 : e.result,
                            ((null == e ? void 0 : e.result) || []).length,
                          );
                      }),
                      this._trtc.on(
                        i.default.EVENT.NETWORK_QUALITY,
                        function (e) {
                          var o = e.uplinkNetworkQuality,
                            i = e.downlinkNetworkQuality,
                            r = e.uplinkRTT,
                            n = e.uplinkLoss,
                            a = e.downlinkLoss,
                            s = e.downlinkInfo,
                            c = new I('', t._getTRTCCloudQuality(o)),
                            u = [];
                          s.length > 0 &&
                            (u = s.map(function (e) {
                              return new I(e.userId, t._getTRTCCloudQuality(i));
                            })),
                            t.emit('onNetworkQuality', c, u);
                          var l = new L(n, a, 0, 0, r, 0, 0);
                          t.emit('onStatistics', l);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.SCREEN_SHARE_STOPPED,
                        function () {
                          t.emit('onScreenCaptureStopped', 0),
                            (t._isSharingScreen = !1);
                        },
                      ),
                      this._trtc.on(
                        i.default.EVENT.PUBLISH_STATE_CHANGED,
                        function (o) {
                          var i = o.mediaType;
                          'started' === o.state &&
                            ('audio' === i
                              ? t.emit('onSendFirstLocalAudioFrame')
                              : 'video' === i
                              ? t.emit(
                                  'onSendFirstLocalVideoFrame',
                                  e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,
                                )
                              : 'screen' === i &&
                                t.emit(
                                  'onSendFirstLocalVideoFrame',
                                  e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,
                                ));
                        },
                      );
                  }),
                  (o.prototype._removeTRTCEvents = function () {
                    this._trtc.off('*');
                  }),
                  (o.prototype._emitVideoAvailable = function (e, t) {
                    var o = e.userId,
                      r = e.streamType;
                    t
                      ? this._remoteStreamMap.set(
                          ''.concat(o, '_').concat(r),
                          !0,
                        )
                      : this._remoteStreamMap.delete(
                          ''.concat(o, '_').concat(r),
                        ),
                      r === i.default.TYPE.STREAM_TYPE_SUB
                        ? o && this.emit('onUserSubStreamAvailable', o, t)
                        : o && this.emit('onUserVideoAvailable', o, t);
                  }),
                  (o.prototype._setLocalView = function (e) {
                    this._localView = e;
                  }),
                  (o.prototype._getLocalView = function () {
                    return this._localView;
                  }),
                  (o.prototype._setIsMobile = function (e) {
                    this._isMobile = e;
                  }),
                  (o.prototype._getIsMobile = function () {
                    return this._isMobile;
                  }),
                  (o.prototype._setIsFrontCamera = function (e) {
                    this._isFrontCamera = e;
                  }),
                  (o.prototype._getIsFrontCamera = function () {
                    return this._isFrontCamera;
                  }),
                  (o.prototype._getSmallStreamVideoProfile = function () {
                    return this._smallStreamVideoProfile;
                  }),
                  (o.prototype._setSmallStreamVideoProfile = function (e) {
                    this._smallStreamVideoProfile = e;
                  }),
                  (o.prototype._setIsVideoPublish = function (e) {
                    this._isVideoPublish = e;
                  }),
                  (o.prototype._getIsVideoPublish = function () {
                    return this._isVideoPublish;
                  }),
                  (o.prototype._setVideoProfile = function (e) {
                    this._videoProfile = e;
                  }),
                  (o.prototype._getVideoProfile = function () {
                    return this._videoProfile;
                  }),
                  (o.prototype._setVideoPlayOption = function (e) {
                    this._videoPlayOption = e;
                  }),
                  (o.prototype._getVideoPlayOption = function () {
                    return this._videoPlayOption;
                  }),
                  (o.prototype._setLocalTestView = function (e) {
                    this._localTestView = e;
                  }),
                  (o.prototype._getLocalTestView = function () {
                    return this._localTestView;
                  }),
                  (o.prototype._setScreenShareParams = function (e) {
                    var t = e.view,
                      o = e.systemAudio,
                      i = e.fillMode,
                      r = e.profile;
                    $(t) || (this._screenShareParams.view = t),
                      $(o) || (this._screenShareParams.option.systemAudio = o),
                      $(i) || (this._screenShareParams.option.fillMode = i),
                      $(r) || (this._screenShareParams.option.profile = r);
                  }),
                  (o.prototype._getScreenShareParams = function () {
                    return this._screenShareParams;
                  }),
                  (o.prototype._setIsAudioPublish = function (e) {
                    this._isAudioPublish = e;
                  }),
                  (o.prototype._getIsAudioPublish = function () {
                    return this._isAudioPublish;
                  }),
                  (o.prototype._setAudioProfile = function (e) {
                    this._audioProfile = e;
                  }),
                  (o.prototype._getAudioProfile = function () {
                    return this._audioProfile;
                  }),
                  (o.prototype._setCurrentCameraId = function (e) {
                    this._currentCameraId = e;
                  }),
                  (o.prototype._getCurrentCameraId = function () {
                    return this._currentCameraId;
                  }),
                  (o.prototype._setCurrentMicrophoneId = function (e) {
                    this._currentMicrophoneId = e;
                  }),
                  (o.prototype._getCurrentMicrophoneId = function () {
                    return this._currentMicrophoneId;
                  }),
                  (o.prototype._setCurrentSpeakerId = function (e) {
                    this._currentSpeakerId = e;
                  }),
                  (o.prototype._getCurrentSpeakerId = function () {
                    return this._currentSpeakerId;
                  }),
                  (o.prototype._setRemoteStreamConfig = function (t, o, i) {
                    var r = this._remoteStreamConfig.get(
                      ''.concat(t, '_').concat(this._getTRTCStreamType(o)),
                    );
                    r ||
                      (r = {
                        userId: t,
                        streamType: this._getTRTCStreamType(o),
                        option: {
                          mirror: this._getTRTCMirror(
                            e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable,
                          ),
                          fillMode: this._getTRTCFillMode(
                            e.TRTCVideoFillMode.TRTCVideoFillMode_Fit,
                          ),
                        },
                      });
                    var n = i.view,
                      a = i.mirrorType,
                      s = i.fillMode,
                      c = i.small;
                    $(n) || (r.view = n),
                      $(a) || (r.option.mirror = this._getTRTCMirror(a)),
                      $(s) || (r.option.fillMode = this._getTRTCFillMode(s)),
                      $(c) || (r.option.small = c),
                      this._remoteStreamConfig.set(
                        ''.concat(t, '_').concat(this._getTRTCStreamType(o)),
                        r,
                      );
                  }),
                  (o.prototype.handleDeviceChange = function () {
                    return a(this, void 0, void 0, function () {
                      var t = this;
                      return s(this, function (o) {
                        return (
                          i.default.getCameraList().then(function (o) {
                            return a(t, void 0, void 0, function () {
                              return s(this, function (t) {
                                switch (t.label) {
                                  case 0:
                                    return this._cameraList.length === o.length
                                      ? [2]
                                      : [
                                          4,
                                          this.deviceChangeManage(
                                            this._cameraList,
                                            o,
                                            e.TRTCDeviceType
                                              .TRTCDeviceTypeCamera,
                                          ),
                                        ];
                                  case 1:
                                    return (
                                      t.sent(), (this._cameraList = o), [2]
                                    );
                                }
                              });
                            });
                          }),
                          i.default.getMicrophoneList().then(function (o) {
                            return a(t, void 0, void 0, function () {
                              return s(this, function (t) {
                                switch (t.label) {
                                  case 0:
                                    return [
                                      4,
                                      this.deviceChangeManage(
                                        this._microphoneList,
                                        o,
                                        e.TRTCDeviceType.TRTCDeviceTypeMic,
                                      ),
                                    ];
                                  case 1:
                                    return (
                                      t.sent(), (this._microphoneList = o), [2]
                                    );
                                }
                              });
                            });
                          }),
                          i.default.getSpeakerList().then(function (o) {
                            return a(t, void 0, void 0, function () {
                              return s(this, function (t) {
                                switch (t.label) {
                                  case 0:
                                    return [
                                      4,
                                      this.deviceChangeManage(
                                        this._speakerList,
                                        o,
                                        e.TRTCDeviceType.TRTCDeviceTypeSpeaker,
                                      ),
                                    ];
                                  case 1:
                                    return (
                                      t.sent(), (this._speakerList = o), [2]
                                    );
                                }
                              });
                            });
                          }),
                          [2]
                        );
                      });
                    });
                  }),
                  (o.prototype.isSameDevice = function (e, t) {
                    var o = e && e.deviceId && e.groupId && e.label,
                      i = t && t.deviceId && t.groupId && t.label;
                    return (
                      !(!o || !i) &&
                      e.deviceId === t.deviceId &&
                      e.groupId === t.groupId &&
                      e.label === t.label
                    );
                  }),
                  (o.prototype.deviceChangeManage = function (t, o, i) {
                    return a(this, void 0, void 0, function () {
                      var r, n, a, c, u;
                      return s(this, function (s) {
                        switch (s.label) {
                          case 0:
                            return (
                              (r = void 0),
                              t.length !== o.length &&
                                ((n = (o || []).map(function (e) {
                                  return e.deviceId;
                                })),
                                (a = new g()),
                                t.length > o.length
                                  ? ((a =
                                      t.filter(function (e) {
                                        return !n.includes(e.deviceId);
                                      })[0] || {}),
                                    (r =
                                      e.TRTCDeviceState.TRTCDeviceStateRemove))
                                  : ((n = (t || []).map(function (e) {
                                      return e.deviceId;
                                    })),
                                    (a =
                                      o.filter(function (e) {
                                        return !n.includes(e.deviceId);
                                      })[0] || {}),
                                    (r = e.TRTCDeviceState.TRTCDeviceStateAdd)),
                                (c = a.deviceId),
                                this.emitOnDeviceChange(c, i, r)),
                              (u = this.getDefaultDeviceInfo(o)),
                              i !== e.TRTCDeviceType.TRTCDeviceTypeCamera ||
                              r !== e.TRTCDeviceState.TRTCDeviceStateRemove
                                ? [3, 3]
                                : this.isSameDevice(this._currentCamera, u)
                                ? [2]
                                : u.deviceId
                                ? [4, this.autoChangeDevice(i, u)]
                                : [3, 2]
                            );
                          case 1:
                            s.sent(), (s.label = 2);
                          case 2:
                            s.label = 3;
                          case 3:
                            return i !== e.TRTCDeviceType.TRTCDeviceTypeMic
                              ? [3, 6]
                              : this.isSameDevice(this._currentMicrophone, u)
                              ? [2]
                              : u.deviceId
                              ? [4, this.autoChangeDevice(i, u)]
                              : [3, 5];
                          case 4:
                            s.sent(), (s.label = 5);
                          case 5:
                            s.label = 6;
                          case 6:
                            return i !== e.TRTCDeviceType.TRTCDeviceTypeSpeaker
                              ? [3, 9]
                              : this.isSameDevice(this._currentSpeaker, u)
                              ? [2]
                              : u.deviceId
                              ? [4, this.autoChangeDevice(i, u)]
                              : [3, 8];
                          case 7:
                            s.sent(), (s.label = 8);
                          case 8:
                            s.label = 9;
                          case 9:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.getDefaultDeviceInfo = function (e) {
                    var t = new g();
                    if (0 === e.length) return t;
                    var o = e.filter(function (e) {
                      return 'default' === e.deviceId;
                    });
                    return (t = o.length > 0 ? o[0] : e[0]);
                  }),
                  (o.prototype.autoChangeDevice = function (t, o) {
                    return a(this, void 0, void 0, function () {
                      var r, n, a, c, u;
                      return s(this, function (s) {
                        switch (s.label) {
                          case 0:
                            if (
                              ((r = o.deviceId),
                              t !== e.TRTCDeviceType.TRTCDeviceTypeCamera)
                            )
                              return [3, 8];
                            s.label = 1;
                          case 1:
                            return (
                              s.trys.push([1, 3, , 4]),
                              [
                                4,
                                this._trtc.updateLocalVideo({
                                  option: { cameraId: r },
                                }),
                              ]
                            );
                          case 2:
                            return s.sent(), [3, 4];
                          case 3:
                            return (
                              (n = s.sent()),
                              console.log('error', JSON.stringify(n)),
                              n.code,
                              i.default.ERROR_CODE.OPERATION_ABORT,
                              [3, 4]
                            );
                          case 4:
                            return (
                              s.trys.push([4, 6, , 7]),
                              [
                                4,
                                this._testTrtc.updateLocalVideo({
                                  option: { cameraId: r },
                                }),
                              ]
                            );
                          case 5:
                            return s.sent(), [3, 7];
                          case 6:
                            return (
                              (a = s.sent()),
                              console.log('testTRTC error', JSON.stringify(a)),
                              a.code,
                              i.default.ERROR_CODE.OPERATION_ABORT,
                              [3, 7]
                            );
                          case 7:
                            (this._currentCameraId = r),
                              (this._currentCamera = o),
                              this.emitOnDeviceChange(
                                r,
                                t,
                                e.TRTCDeviceState.TRTCDeviceStateActive,
                              ),
                              (s.label = 8);
                          case 8:
                            if (t !== e.TRTCDeviceType.TRTCDeviceTypeMic)
                              return [3, 16];
                            s.label = 9;
                          case 9:
                            return (
                              s.trys.push([9, 11, , 12]),
                              [
                                4,
                                this._trtc.updateLocalAudio({
                                  option: { microphoneId: r },
                                }),
                              ]
                            );
                          case 10:
                            return s.sent(), [3, 12];
                          case 11:
                            return (
                              (c = s.sent()),
                              console.log('error', JSON.stringify(c)),
                              c.code,
                              i.default.ERROR_CODE.OPERATION_ABORT,
                              [3, 12]
                            );
                          case 12:
                            return (
                              s.trys.push([12, 14, , 15]),
                              [
                                4,
                                this._testTrtc.updateLocalAudio({
                                  option: { microphoneId: r },
                                }),
                              ]
                            );
                          case 13:
                            return s.sent(), [3, 15];
                          case 14:
                            return (
                              (u = s.sent()),
                              console.log('testTRTC error', JSON.stringify(u)),
                              u.code,
                              i.default.ERROR_CODE.OPERATION_ABORT,
                              [3, 15]
                            );
                          case 15:
                            (this._currentMicrophoneId = r),
                              (this._currentMicrophone = o),
                              this.emitOnDeviceChange(
                                r,
                                t,
                                e.TRTCDeviceState.TRTCDeviceStateActive,
                              ),
                              (s.label = 16);
                          case 16:
                            return t !== e.TRTCDeviceType.TRTCDeviceTypeSpeaker
                              ? [3, 18]
                              : [4, i.default.setCurrentSpeaker(r)];
                          case 17:
                            s.sent(),
                              (this._currentSpeakerId = r),
                              (this._currentSpeaker = o),
                              this.emitOnDeviceChange(
                                r,
                                t,
                                e.TRTCDeviceState.TRTCDeviceStateActive,
                              ),
                              (s.label = 18);
                          case 18:
                            return [2];
                        }
                      });
                    });
                  }),
                  (o.prototype.emitOnDeviceChange = function (e, t, o) {
                    this.emit('onDeviceChange', e, t, o);
                  }),
                  o
                );
              })(_);
            (e.Rect = x),
              (e.TRTCDeviceInfo = g),
              (e.TRTCImageBuffer = F),
              (e.TRTCLocalStatistics = P),
              (e.TRTCMixUser = j),
              (e.TRTCNetworkQosParam = k),
              (e.TRTCParams = y),
              (e.TRTCPublishCDNParam = D),
              (e.TRTCQualityInfo = I),
              (e.TRTCRenderParams = M),
              (e.TRTCScreenCaptureSourceInfo = N),
              (e.TRTCStatistics = L),
              (e.TRTCTranscodingConfig = B),
              (e.TRTCVideoEncParam = S),
              (e.TRTCVolumeInfo = E),
              (e.default = de),
              Object.defineProperty(e, '__esModule', { value: !0 });
          }),
          true ? factory(exports, __webpack_require__(734)) : 0;

        /***/
      },

      /***/ 734: /***/ function (
        module,
        __unused_webpack_exports,
        __webpack_require__,
      ) {
        !(function (e, t) {
          true ? (module.exports = t()) : 0;
        })(this, function () {
          function e(e, t) {
            return (
              t.forEach(function (t) {
                t &&
                  'string' != typeof t &&
                  !Array.isArray(t) &&
                  Object.keys(t).forEach(function (i) {
                    if ('default' !== i && !(i in e)) {
                      var n = Object.getOwnPropertyDescriptor(t, i);
                      Object.defineProperty(
                        e,
                        i,
                        n.get
                          ? n
                          : {
                              enumerable: !0,
                              get: function () {
                                return t[i];
                              },
                            },
                      );
                    }
                  });
              }),
              Object.freeze(e)
            );
          }
          var t =
              'undefined' != typeof globalThis
                ? globalThis
                : 'undefined' != typeof window
                ? window
                : 'undefined' != typeof __webpack_require__.g
                ? __webpack_require__.g
                : 'undefined' != typeof self
                ? self
                : {},
            i = function (e) {
              try {
                return !!e();
              } catch (t) {
                return !0;
              }
            },
            n = !i(function () {
              var e = function () {}.bind();
              return 'function' != typeof e || e.hasOwnProperty('prototype');
            }),
            r = n,
            o = Function.prototype,
            s = o.call,
            a = r && o.bind.bind(s, s),
            c = r
              ? a
              : function (e) {
                  return function () {
                    return s.apply(e, arguments);
                  };
                },
            l = c,
            d = l({}.toString),
            u = l(''.slice),
            h = function (e) {
              return u(d(e), 8, -1);
            },
            p = i,
            _ = h,
            m = Object,
            f = c(''.split),
            g = p(function () {
              return !m('z').propertyIsEnumerable(0);
            })
              ? function (e) {
                  return 'String' == _(e) ? f(e, '') : m(e);
                }
              : m,
            T = function (e) {
              return null == e;
            },
            E = T,
            S = TypeError,
            I = function (e) {
              if (E(e)) throw S("Can't call method on " + e);
              return e;
            },
            v = g,
            y = I,
            A = function (e) {
              return v(y(e));
            },
            R = function (e) {
              return e && e.Math == Math && e;
            },
            C =
              R('object' == typeof globalThis && globalThis) ||
              R('object' == typeof window && window) ||
              R('object' == typeof self && self) ||
              R('object' == typeof t && t) ||
              (function () {
                return this;
              })() ||
              Function('return this')(),
            b = {},
            k = {
              get exports() {
                return b;
              },
              set exports(e) {
                b = e;
              },
            },
            N = C,
            D = Object.defineProperty,
            O = function (e, t) {
              try {
                D(N, e, { value: t, configurable: !0, writable: !0 });
              } catch (i) {
                N[e] = t;
              }
              return t;
            },
            w = O,
            P = '__core-js_shared__',
            L = C[P] || w(P, {}),
            M = L;
          (k.exports = function (e, t) {
            return M[e] || (M[e] = void 0 !== t ? t : {});
          })('versions', []).push({
            version: '3.30.0',
            mode: 'global',
            copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
            license: 'https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE',
            source: 'https://github.com/zloirock/core-js',
          });
          var V,
            x,
            U = I,
            F = Object,
            B = function (e) {
              return F(U(e));
            },
            H = B,
            j = c({}.hasOwnProperty),
            G =
              Object.hasOwn ||
              function (e, t) {
                return j(H(e), t);
              },
            W = c,
            J = 0,
            K = Math.random(),
            Y = W((1).toString),
            z = function (e) {
              return (
                'Symbol(' + (void 0 === e ? '' : e) + ')_' + Y(++J + K, 36)
              );
            },
            q =
              ('undefined' != typeof navigator &&
                String(navigator.userAgent)) ||
              '',
            Q = C,
            X = q,
            $ = Q.process,
            Z = Q.Deno,
            ee = ($ && $.versions) || (Z && Z.version),
            te = ee && ee.v8;
          te &&
            (x = (V = te.split('.'))[0] > 0 && V[0] < 4 ? 1 : +(V[0] + V[1])),
            !x &&
              X &&
              (!(V = X.match(/Edge\/(\d+)/)) || V[1] >= 74) &&
              (V = X.match(/Chrome\/(\d+)/)) &&
              (x = +V[1]);
          var ie = x,
            ne = ie,
            re = i,
            oe =
              !!Object.getOwnPropertySymbols &&
              !re(function () {
                var e = Symbol();
                return (
                  !String(e) ||
                  !(Object(e) instanceof Symbol) ||
                  (!Symbol.sham && ne && ne < 41)
                );
              }),
            se = oe && !Symbol.sham && 'symbol' == typeof Symbol.iterator,
            ae = b,
            ce = G,
            le = z,
            de = oe,
            ue = se,
            he = C.Symbol,
            pe = ae('wks'),
            _e = ue ? he.for || he : (he && he.withoutSetter) || le,
            me = function (e) {
              return (
                ce(pe, e) ||
                  (pe[e] = de && ce(he, e) ? he[e] : _e('Symbol.' + e)),
                pe[e]
              );
            },
            fe = 'object' == typeof document && document.all,
            ge = { all: fe, IS_HTMLDDA: void 0 === fe && void 0 !== fe },
            Te = ge.all,
            Ee = ge.IS_HTMLDDA
              ? function (e) {
                  return 'function' == typeof e || e === Te;
                }
              : function (e) {
                  return 'function' == typeof e;
                },
            Se = Ee,
            Ie = ge.all,
            ve = ge.IS_HTMLDDA
              ? function (e) {
                  return 'object' == typeof e ? null !== e : Se(e) || e === Ie;
                }
              : function (e) {
                  return 'object' == typeof e ? null !== e : Se(e);
                },
            ye = ve,
            Ae = String,
            Re = TypeError,
            Ce = function (e) {
              if (ye(e)) return e;
              throw Re(Ae(e) + ' is not an object');
            },
            be = {},
            ke = !i(function () {
              return (
                7 !=
                Object.defineProperty({}, 1, {
                  get: function () {
                    return 7;
                  },
                })[1]
              );
            }),
            Ne =
              ke &&
              i(function () {
                return (
                  42 !=
                  Object.defineProperty(function () {}, 'prototype', {
                    value: 42,
                    writable: !1,
                  }).prototype
                );
              }),
            De = {},
            Oe = ve,
            we = C.document,
            Pe = Oe(we) && Oe(we.createElement),
            Le = function (e) {
              return Pe ? we.createElement(e) : {};
            },
            Me = Le,
            Ve =
              !ke &&
              !i(function () {
                return (
                  7 !=
                  Object.defineProperty(Me('div'), 'a', {
                    get: function () {
                      return 7;
                    },
                  }).a
                );
              }),
            xe = n,
            Ue = Function.prototype.call,
            Fe = xe
              ? Ue.bind(Ue)
              : function () {
                  return Ue.apply(Ue, arguments);
                },
            Be = C,
            He = Ee,
            je = function (e, t) {
              return arguments.length < 2
                ? ((i = Be[e]), He(i) ? i : void 0)
                : Be[e] && Be[e][t];
              var i;
            },
            Ge = c({}.isPrototypeOf),
            We = je,
            Je = Ee,
            Ke = Ge,
            Ye = Object,
            ze = se
              ? function (e) {
                  return 'symbol' == typeof e;
                }
              : function (e) {
                  var t = We('Symbol');
                  return Je(t) && Ke(t.prototype, Ye(e));
                },
            qe = String,
            Qe = function (e) {
              try {
                return qe(e);
              } catch (t) {
                return 'Object';
              }
            },
            Xe = Ee,
            $e = Qe,
            Ze = TypeError,
            et = function (e) {
              if (Xe(e)) return e;
              throw Ze($e(e) + ' is not a function');
            },
            tt = et,
            it = T,
            nt = function (e, t) {
              var i = e[t];
              return it(i) ? void 0 : tt(i);
            },
            rt = Fe,
            ot = Ee,
            st = ve,
            at = TypeError,
            ct = Fe,
            lt = ve,
            dt = ze,
            ut = nt,
            ht = function (e, t) {
              var i, n;
              if ('string' === t && ot((i = e.toString)) && !st((n = rt(i, e))))
                return n;
              if (ot((i = e.valueOf)) && !st((n = rt(i, e)))) return n;
              if ('string' !== t && ot((i = e.toString)) && !st((n = rt(i, e))))
                return n;
              throw at("Can't convert object to primitive value");
            },
            pt = TypeError,
            _t = me('toPrimitive'),
            mt = function (e, t) {
              if (!lt(e) || dt(e)) return e;
              var i,
                n = ut(e, _t);
              if (n) {
                if (
                  (void 0 === t && (t = 'default'),
                  (i = ct(n, e, t)),
                  !lt(i) || dt(i))
                )
                  return i;
                throw pt("Can't convert object to primitive value");
              }
              return void 0 === t && (t = 'number'), ht(e, t);
            },
            ft = mt,
            gt = ze,
            Tt = function (e) {
              var t = ft(e, 'string');
              return gt(t) ? t : t + '';
            },
            Et = ke,
            St = Ve,
            It = Ne,
            vt = Ce,
            yt = Tt,
            At = TypeError,
            Rt = Object.defineProperty,
            Ct = Object.getOwnPropertyDescriptor,
            bt = 'enumerable',
            kt = 'configurable',
            Nt = 'writable';
          De.f = Et
            ? It
              ? function (e, t, i) {
                  if (
                    (vt(e),
                    (t = yt(t)),
                    vt(i),
                    'function' == typeof e &&
                      'prototype' === t &&
                      'value' in i &&
                      Nt in i &&
                      !i[Nt])
                  ) {
                    var n = Ct(e, t);
                    n &&
                      n[Nt] &&
                      ((e[t] = i.value),
                      (i = {
                        configurable: kt in i ? i[kt] : n[kt],
                        enumerable: bt in i ? i[bt] : n[bt],
                        writable: !1,
                      }));
                  }
                  return Rt(e, t, i);
                }
              : Rt
            : function (e, t, i) {
                if ((vt(e), (t = yt(t)), vt(i), St))
                  try {
                    return Rt(e, t, i);
                  } catch (n) {}
                if ('get' in i || 'set' in i)
                  throw At('Accessors not supported');
                return 'value' in i && (e[t] = i.value), e;
              };
          var Dt = Math.ceil,
            Ot = Math.floor,
            wt =
              Math.trunc ||
              function (e) {
                var t = +e;
                return (t > 0 ? Ot : Dt)(t);
              },
            Pt = wt,
            Lt = function (e) {
              var t = +e;
              return t != t || 0 === t ? 0 : Pt(t);
            },
            Mt = Lt,
            Vt = Math.max,
            xt = Math.min,
            Ut = function (e, t) {
              var i = Mt(e);
              return i < 0 ? Vt(i + t, 0) : xt(i, t);
            },
            Ft = Lt,
            Bt = Math.min,
            Ht = function (e) {
              return e > 0 ? Bt(Ft(e), 9007199254740991) : 0;
            },
            jt = Ht,
            Gt = function (e) {
              return jt(e.length);
            },
            Wt = A,
            Jt = Ut,
            Kt = Gt,
            Yt = function (e) {
              return function (t, i, n) {
                var r,
                  o = Wt(t),
                  s = Kt(o),
                  a = Jt(n, s);
                if (e && i != i) {
                  for (; s > a; ) if ((r = o[a++]) != r) return !0;
                } else
                  for (; s > a; a++)
                    if ((e || a in o) && o[a] === i) return e || a || 0;
                return !e && -1;
              };
            },
            zt = { includes: Yt(!0), indexOf: Yt(!1) },
            qt = {},
            Qt = G,
            Xt = A,
            $t = zt.indexOf,
            Zt = qt,
            ei = c([].push),
            ti = function (e, t) {
              var i,
                n = Xt(e),
                r = 0,
                o = [];
              for (i in n) !Qt(Zt, i) && Qt(n, i) && ei(o, i);
              for (; t.length > r; )
                Qt(n, (i = t[r++])) && (~$t(o, i) || ei(o, i));
              return o;
            },
            ii = [
              'constructor',
              'hasOwnProperty',
              'isPrototypeOf',
              'propertyIsEnumerable',
              'toLocaleString',
              'toString',
              'valueOf',
            ],
            ni = ti,
            ri = ii,
            oi =
              Object.keys ||
              function (e) {
                return ni(e, ri);
              },
            si = ke,
            ai = Ne,
            ci = De,
            li = Ce,
            di = A,
            ui = oi;
          be.f =
            si && !ai
              ? Object.defineProperties
              : function (e, t) {
                  li(e);
                  for (
                    var i, n = di(t), r = ui(t), o = r.length, s = 0;
                    o > s;

                  )
                    ci.f(e, (i = r[s++]), n[i]);
                  return e;
                };
          var hi,
            pi = je('document', 'documentElement'),
            _i = z,
            mi = b('keys'),
            fi = function (e) {
              return mi[e] || (mi[e] = _i(e));
            },
            gi = Ce,
            Ti = be,
            Ei = ii,
            Si = qt,
            Ii = pi,
            vi = Le,
            yi = 'prototype',
            Ai = 'script',
            Ri = fi('IE_PROTO'),
            Ci = function () {},
            bi = function (e) {
              return '<' + Ai + '>' + e + '</' + Ai + '>';
            },
            ki = function (e) {
              e.write(bi('')), e.close();
              var t = e.parentWindow.Object;
              return (e = null), t;
            },
            Ni = function () {
              try {
                hi = new ActiveXObject('htmlfile');
              } catch (r) {}
              var e, t, i;
              Ni =
                'undefined' != typeof document
                  ? document.domain && hi
                    ? ki(hi)
                    : ((t = vi('iframe')),
                      (i = 'java' + Ai + ':'),
                      (t.style.display = 'none'),
                      Ii.appendChild(t),
                      (t.src = String(i)),
                      (e = t.contentWindow.document).open(),
                      e.write(bi('document.F=Object')),
                      e.close(),
                      e.F)
                  : ki(hi);
              for (var n = Ei.length; n--; ) delete Ni[yi][Ei[n]];
              return Ni();
            };
          Si[Ri] = !0;
          var Di =
              Object.create ||
              function (e, t) {
                var i;
                return (
                  null !== e
                    ? ((Ci[yi] = gi(e)),
                      (i = new Ci()),
                      (Ci[yi] = null),
                      (i[Ri] = e))
                    : (i = Ni()),
                  void 0 === t ? i : Ti.f(i, t)
                );
              },
            Oi = me,
            wi = Di,
            Pi = De.f,
            Li = Oi('unscopables'),
            Mi = Array.prototype;
          null == Mi[Li] && Pi(Mi, Li, { configurable: !0, value: wi(null) });
          var Vi,
            xi,
            Ui,
            Fi = function (e) {
              Mi[Li][e] = !0;
            },
            Bi = {},
            Hi = Ee,
            ji = C.WeakMap,
            Gi = Hi(ji) && /native code/.test(String(ji)),
            Wi = function (e, t) {
              return {
                enumerable: !(1 & e),
                configurable: !(2 & e),
                writable: !(4 & e),
                value: t,
              };
            },
            Ji = De,
            Ki = Wi,
            Yi = ke
              ? function (e, t, i) {
                  return Ji.f(e, t, Ki(1, i));
                }
              : function (e, t, i) {
                  return (e[t] = i), e;
                },
            zi = Gi,
            qi = C,
            Qi = ve,
            Xi = Yi,
            $i = G,
            Zi = L,
            en = fi,
            tn = qt,
            nn = 'Object already initialized',
            rn = qi.TypeError,
            on = qi.WeakMap;
          if (zi || Zi.state) {
            var sn = Zi.state || (Zi.state = new on());
            (sn.get = sn.get),
              (sn.has = sn.has),
              (sn.set = sn.set),
              (Vi = function (e, t) {
                if (sn.has(e)) throw rn(nn);
                return (t.facade = e), sn.set(e, t), t;
              }),
              (xi = function (e) {
                return sn.get(e) || {};
              }),
              (Ui = function (e) {
                return sn.has(e);
              });
          } else {
            var an = en('state');
            (tn[an] = !0),
              (Vi = function (e, t) {
                if ($i(e, an)) throw rn(nn);
                return (t.facade = e), Xi(e, an, t), t;
              }),
              (xi = function (e) {
                return $i(e, an) ? e[an] : {};
              }),
              (Ui = function (e) {
                return $i(e, an);
              });
          }
          var cn = {
              set: Vi,
              get: xi,
              has: Ui,
              enforce: function (e) {
                return Ui(e) ? xi(e) : Vi(e, {});
              },
              getterFor: function (e) {
                return function (t) {
                  var i;
                  if (!Qi(t) || (i = xi(t)).type !== e)
                    throw rn('Incompatible receiver, ' + e + ' required');
                  return i;
                };
              },
            },
            ln = {},
            dn = {},
            un = {}.propertyIsEnumerable,
            hn = Object.getOwnPropertyDescriptor,
            pn = hn && !un.call({ 1: 2 }, 1);
          dn.f = pn
            ? function (e) {
                var t = hn(this, e);
                return !!t && t.enumerable;
              }
            : un;
          var _n = ke,
            mn = Fe,
            fn = dn,
            gn = Wi,
            Tn = A,
            En = Tt,
            Sn = G,
            In = Ve,
            vn = Object.getOwnPropertyDescriptor;
          ln.f = _n
            ? vn
            : function (e, t) {
                if (((e = Tn(e)), (t = En(t)), In))
                  try {
                    return vn(e, t);
                  } catch (i) {}
                if (Sn(e, t)) return gn(!mn(fn.f, e, t), e[t]);
              };
          var yn = {},
            An = {
              get exports() {
                return yn;
              },
              set exports(e) {
                yn = e;
              },
            },
            Rn = ke,
            Cn = G,
            bn = Function.prototype,
            kn = Rn && Object.getOwnPropertyDescriptor,
            Nn = Cn(bn, 'name'),
            Dn = {
              EXISTS: Nn,
              PROPER: Nn && 'something' === function () {}.name,
              CONFIGURABLE: Nn && (!Rn || (Rn && kn(bn, 'name').configurable)),
            },
            On = Ee,
            wn = L,
            Pn = c(Function.toString);
          On(wn.inspectSource) ||
            (wn.inspectSource = function (e) {
              return Pn(e);
            });
          var Ln = wn.inspectSource,
            Mn = c,
            Vn = i,
            xn = Ee,
            Un = G,
            Fn = ke,
            Bn = Dn.CONFIGURABLE,
            Hn = Ln,
            jn = cn.enforce,
            Gn = cn.get,
            Wn = String,
            Jn = Object.defineProperty,
            Kn = Mn(''.slice),
            Yn = Mn(''.replace),
            zn = Mn([].join),
            qn =
              Fn &&
              !Vn(function () {
                return 8 !== Jn(function () {}, 'length', { value: 8 }).length;
              }),
            Qn = String(String).split('String'),
            Xn = (An.exports = function (e, t, i) {
              'Symbol(' === Kn(Wn(t), 0, 7) &&
                (t = '[' + Yn(Wn(t), /^Symbol\(([^)]*)\)/, '$1') + ']'),
                i && i.getter && (t = 'get ' + t),
                i && i.setter && (t = 'set ' + t),
                (!Un(e, 'name') || (Bn && e.name !== t)) &&
                  (Fn
                    ? Jn(e, 'name', { value: t, configurable: !0 })
                    : (e.name = t)),
                qn &&
                  i &&
                  Un(i, 'arity') &&
                  e.length !== i.arity &&
                  Jn(e, 'length', { value: i.arity });
              try {
                i && Un(i, 'constructor') && i.constructor
                  ? Fn && Jn(e, 'prototype', { writable: !1 })
                  : e.prototype && (e.prototype = void 0);
              } catch (r) {}
              var n = jn(e);
              return (
                Un(n, 'source') ||
                  (n.source = zn(Qn, 'string' == typeof t ? t : '')),
                e
              );
            });
          Function.prototype.toString = Xn(function () {
            return (xn(this) && Gn(this).source) || Hn(this);
          }, 'toString');
          var $n = Ee,
            Zn = De,
            er = yn,
            tr = O,
            ir = function (e, t, i, n) {
              n || (n = {});
              var r = n.enumerable,
                o = void 0 !== n.name ? n.name : t;
              if (($n(i) && er(i, o, n), n.global)) r ? (e[t] = i) : tr(t, i);
              else {
                try {
                  n.unsafe ? e[t] && (r = !0) : delete e[t];
                } catch (s) {}
                r
                  ? (e[t] = i)
                  : Zn.f(e, t, {
                      value: i,
                      enumerable: !1,
                      configurable: !n.nonConfigurable,
                      writable: !n.nonWritable,
                    });
              }
              return e;
            },
            nr = {},
            rr = ti,
            or = ii.concat('length', 'prototype');
          nr.f =
            Object.getOwnPropertyNames ||
            function (e) {
              return rr(e, or);
            };
          var sr = {};
          sr.f = Object.getOwnPropertySymbols;
          var ar,
            cr,
            lr,
            dr = je,
            ur = nr,
            hr = sr,
            pr = Ce,
            _r = c([].concat),
            mr =
              dr('Reflect', 'ownKeys') ||
              function (e) {
                var t = ur.f(pr(e)),
                  i = hr.f;
                return i ? _r(t, i(e)) : t;
              },
            fr = G,
            gr = mr,
            Tr = ln,
            Er = De,
            Sr = function (e, t, i) {
              for (
                var n = gr(t), r = Er.f, o = Tr.f, s = 0;
                s < n.length;
                s++
              ) {
                var a = n[s];
                fr(e, a) || (i && fr(i, a)) || r(e, a, o(t, a));
              }
            },
            Ir = i,
            vr = Ee,
            yr = /#|\.prototype\./,
            Ar = function (e, t) {
              var i = Cr[Rr(e)];
              return i == kr || (i != br && (vr(t) ? Ir(t) : !!t));
            },
            Rr = (Ar.normalize = function (e) {
              return String(e).replace(yr, '.').toLowerCase();
            }),
            Cr = (Ar.data = {}),
            br = (Ar.NATIVE = 'N'),
            kr = (Ar.POLYFILL = 'P'),
            Nr = Ar,
            Dr = C,
            Or = ln.f,
            wr = Yi,
            Pr = ir,
            Lr = O,
            Mr = Sr,
            Vr = Nr,
            xr = function (e, t) {
              var i,
                n,
                r,
                o,
                s,
                a = e.target,
                c = e.global,
                l = e.stat;
              if (
                (i = c ? Dr : l ? Dr[a] || Lr(a, {}) : (Dr[a] || {}).prototype)
              )
                for (n in t) {
                  if (
                    ((o = t[n]),
                    (r = e.dontCallGetSet ? (s = Or(i, n)) && s.value : i[n]),
                    !Vr(c ? n : a + (l ? '.' : '#') + n, e.forced) &&
                      void 0 !== r)
                  ) {
                    if (typeof o == typeof r) continue;
                    Mr(o, r);
                  }
                  (e.sham || (r && r.sham)) && wr(o, 'sham', !0),
                    Pr(i, n, o, e);
                }
            },
            Ur = !i(function () {
              function e() {}
              return (
                (e.prototype.constructor = null),
                Object.getPrototypeOf(new e()) !== e.prototype
              );
            }),
            Fr = G,
            Br = Ee,
            Hr = B,
            jr = Ur,
            Gr = fi('IE_PROTO'),
            Wr = Object,
            Jr = Wr.prototype,
            Kr = jr
              ? Wr.getPrototypeOf
              : function (e) {
                  var t = Hr(e);
                  if (Fr(t, Gr)) return t[Gr];
                  var i = t.constructor;
                  return Br(i) && t instanceof i
                    ? i.prototype
                    : t instanceof Wr
                    ? Jr
                    : null;
                },
            Yr = i,
            zr = Ee,
            qr = ve,
            Qr = Kr,
            Xr = ir,
            $r = me('iterator'),
            Zr = !1;
          [].keys &&
            ('next' in (lr = [].keys())
              ? (cr = Qr(Qr(lr))) !== Object.prototype && (ar = cr)
              : (Zr = !0));
          var eo =
            !qr(ar) ||
            Yr(function () {
              var e = {};
              return ar[$r].call(e) !== e;
            });
          eo && (ar = {}),
            zr(ar[$r]) ||
              Xr(ar, $r, function () {
                return this;
              });
          var to = { IteratorPrototype: ar, BUGGY_SAFARI_ITERATORS: Zr },
            io = De.f,
            no = G,
            ro = me('toStringTag'),
            oo = function (e, t, i) {
              e && !i && (e = e.prototype),
                e && !no(e, ro) && io(e, ro, { configurable: !0, value: t });
            },
            so = to.IteratorPrototype,
            ao = Di,
            co = Wi,
            lo = oo,
            uo = Bi,
            ho = function () {
              return this;
            },
            po = function (e, t, i, n) {
              var r = t + ' Iterator';
              return (
                (e.prototype = ao(so, { next: co(+!n, i) })),
                lo(e, r, !1),
                (uo[r] = ho),
                e
              );
            },
            _o = c,
            mo = et,
            fo = Ee,
            go = String,
            To = TypeError,
            Eo = function (e, t, i) {
              try {
                return _o(mo(Object.getOwnPropertyDescriptor(e, t)[i]));
              } catch (n) {}
            },
            So = Ce,
            Io = function (e) {
              if ('object' == typeof e || fo(e)) return e;
              throw To("Can't set " + go(e) + ' as a prototype');
            },
            vo =
              Object.setPrototypeOf ||
              ('__proto__' in {}
                ? (function () {
                    var e,
                      t = !1,
                      i = {};
                    try {
                      (e = Eo(Object.prototype, '__proto__', 'set'))(i, []),
                        (t = i instanceof Array);
                    } catch (n) {}
                    return function (i, n) {
                      return So(i), Io(n), t ? e(i, n) : (i.__proto__ = n), i;
                    };
                  })()
                : void 0),
            yo = xr,
            Ao = Fe,
            Ro = Ee,
            Co = po,
            bo = Kr,
            ko = vo,
            No = oo,
            Do = Yi,
            Oo = ir,
            wo = Bi,
            Po = Dn.PROPER,
            Lo = Dn.CONFIGURABLE,
            Mo = to.IteratorPrototype,
            Vo = to.BUGGY_SAFARI_ITERATORS,
            xo = me('iterator'),
            Uo = 'keys',
            Fo = 'values',
            Bo = 'entries',
            Ho = function () {
              return this;
            },
            jo = function (e, t, i, n, r, o, s) {
              Co(i, t, n);
              var a,
                c,
                l,
                d = function (e) {
                  if (e === r && m) return m;
                  if (!Vo && e in p) return p[e];
                  switch (e) {
                    case Uo:
                    case Fo:
                    case Bo:
                      return function () {
                        return new i(this, e);
                      };
                  }
                  return function () {
                    return new i(this);
                  };
                },
                u = t + ' Iterator',
                h = !1,
                p = e.prototype,
                _ = p[xo] || p['@@iterator'] || (r && p[r]),
                m = (!Vo && _) || d(r),
                f = ('Array' == t && p.entries) || _;
              if (
                (f &&
                  (a = bo(f.call(new e()))) !== Object.prototype &&
                  a.next &&
                  (bo(a) !== Mo &&
                    (ko ? ko(a, Mo) : Ro(a[xo]) || Oo(a, xo, Ho)),
                  No(a, u, !0)),
                Po &&
                  r == Fo &&
                  _ &&
                  _.name !== Fo &&
                  (Lo
                    ? Do(p, 'name', Fo)
                    : ((h = !0),
                      (m = function () {
                        return Ao(_, this);
                      }))),
                r)
              )
                if (
                  ((c = { values: d(Fo), keys: o ? m : d(Uo), entries: d(Bo) }),
                  s)
                )
                  for (l in c) (Vo || h || !(l in p)) && Oo(p, l, c[l]);
                else yo({ target: t, proto: !0, forced: Vo || h }, c);
              return p[xo] !== m && Oo(p, xo, m, { name: r }), (wo[t] = m), c;
            },
            Go = function (e, t) {
              return { value: e, done: t };
            },
            Wo = A,
            Jo = Fi,
            Ko = Bi,
            Yo = cn,
            zo = De.f,
            qo = jo,
            Qo = Go,
            Xo = ke,
            $o = 'Array Iterator',
            Zo = Yo.set,
            es = Yo.getterFor($o),
            ts = qo(
              Array,
              'Array',
              function (e, t) {
                Zo(this, { type: $o, target: Wo(e), index: 0, kind: t });
              },
              function () {
                var e = es(this),
                  t = e.target,
                  i = e.kind,
                  n = e.index++;
                return !t || n >= t.length
                  ? ((e.target = void 0), Qo(void 0, !0))
                  : Qo('keys' == i ? n : 'values' == i ? t[n] : [n, t[n]], !1);
              },
              'values',
            ),
            is = (Ko.Arguments = Ko.Array);
          if (
            (Jo('keys'),
            Jo('values'),
            Jo('entries'),
            Xo && 'values' !== is.name)
          )
            try {
              zo(is, 'name', { value: 'values' });
            } catch (IU) {}
          var ns = {
              CSSRuleList: 0,
              CSSStyleDeclaration: 0,
              CSSValueList: 0,
              ClientRectList: 0,
              DOMRectList: 0,
              DOMStringList: 0,
              DOMTokenList: 1,
              DataTransferItemList: 0,
              FileList: 0,
              HTMLAllCollection: 0,
              HTMLCollection: 0,
              HTMLFormElement: 0,
              HTMLSelectElement: 0,
              MediaList: 0,
              MimeTypeArray: 0,
              NamedNodeMap: 0,
              NodeList: 1,
              PaintRequestList: 0,
              Plugin: 0,
              PluginArray: 0,
              SVGLengthList: 0,
              SVGNumberList: 0,
              SVGPathSegList: 0,
              SVGPointList: 0,
              SVGStringList: 0,
              SVGTransformList: 0,
              SourceBufferList: 0,
              StyleSheetList: 0,
              TextTrackCueList: 0,
              TextTrackList: 0,
              TouchList: 0,
            },
            rs = Le('span').classList,
            os = rs && rs.constructor && rs.constructor.prototype,
            ss = os === Object.prototype ? void 0 : os,
            as = C,
            cs = ns,
            ls = ss,
            ds = ts,
            us = Yi,
            hs = me,
            ps = hs('iterator'),
            _s = hs('toStringTag'),
            ms = ds.values,
            fs = function (e, t) {
              if (e) {
                if (e[ps] !== ms)
                  try {
                    us(e, ps, ms);
                  } catch (IU) {
                    e[ps] = ms;
                  }
                if ((e[_s] || us(e, _s, t), cs[t]))
                  for (var i in ds)
                    if (e[i] !== ds[i])
                      try {
                        us(e, i, ds[i]);
                      } catch (IU) {
                        e[i] = ds[i];
                      }
              }
            };
          for (var gs in cs) fs(as[gs] && as[gs].prototype, gs);
          fs(ls, 'DOMTokenList');
          var Ts = 'undefined' != typeof process && 'process' == h(process),
            Es = yn,
            Ss = De,
            Is = function (e, t, i) {
              return (
                i.get && Es(i.get, t, { getter: !0 }),
                i.set && Es(i.set, t, { setter: !0 }),
                Ss.f(e, t, i)
              );
            },
            vs = je,
            ys = Is,
            As = ke,
            Rs = me('species'),
            Cs = function (e) {
              var t = vs(e);
              As &&
                t &&
                !t[Rs] &&
                ys(t, Rs, {
                  configurable: !0,
                  get: function () {
                    return this;
                  },
                });
            },
            bs = Ge,
            ks = TypeError,
            Ns = function (e, t) {
              if (bs(t, e)) return e;
              throw ks('Incorrect invocation');
            },
            Ds = {};
          Ds[me('toStringTag')] = 'z';
          var Os = '[object z]' === String(Ds),
            ws = Ee,
            Ps = h,
            Ls = me('toStringTag'),
            Ms = Object,
            Vs =
              'Arguments' ==
              Ps(
                (function () {
                  return arguments;
                })(),
              ),
            xs = Os
              ? Ps
              : function (e) {
                  var t, i, n;
                  return void 0 === e
                    ? 'Undefined'
                    : null === e
                    ? 'Null'
                    : 'string' ==
                      typeof (i = (function (e, t) {
                        try {
                          return e[t];
                        } catch (IU) {}
                      })((t = Ms(e)), Ls))
                    ? i
                    : Vs
                    ? Ps(t)
                    : 'Object' == (n = Ps(t)) && ws(t.callee)
                    ? 'Arguments'
                    : n;
                },
            Us = c,
            Fs = i,
            Bs = Ee,
            Hs = xs,
            js = Ln,
            Gs = function () {},
            Ws = [],
            Js = je('Reflect', 'construct'),
            Ks = /^\s*(?:class|function)\b/,
            Ys = Us(Ks.exec),
            zs = !Ks.exec(Gs),
            qs = function (e) {
              if (!Bs(e)) return !1;
              try {
                return Js(Gs, Ws, e), !0;
              } catch (IU) {
                return !1;
              }
            },
            Qs = function (e) {
              if (!Bs(e)) return !1;
              switch (Hs(e)) {
                case 'AsyncFunction':
                case 'GeneratorFunction':
                case 'AsyncGeneratorFunction':
                  return !1;
              }
              try {
                return zs || !!Ys(Ks, js(e));
              } catch (IU) {
                return !0;
              }
            };
          Qs.sham = !0;
          var Xs,
            $s,
            Zs,
            ea,
            ta =
              !Js ||
              Fs(function () {
                var e;
                return (
                  qs(qs.call) ||
                  !qs(Object) ||
                  !qs(function () {
                    e = !0;
                  }) ||
                  e
                );
              })
                ? Qs
                : qs,
            ia = ta,
            na = Qe,
            ra = TypeError,
            oa = function (e) {
              if (ia(e)) return e;
              throw ra(na(e) + ' is not a constructor');
            },
            sa = Ce,
            aa = oa,
            ca = T,
            la = me('species'),
            da = function (e, t) {
              var i,
                n = sa(e).constructor;
              return void 0 === n || ca((i = sa(n)[la])) ? t : aa(i);
            },
            ua = n,
            ha = Function.prototype,
            pa = ha.apply,
            _a = ha.call,
            ma =
              ('object' == typeof Reflect && Reflect.apply) ||
              (ua
                ? _a.bind(pa)
                : function () {
                    return _a.apply(pa, arguments);
                  }),
            fa = h,
            ga = c,
            Ta = function (e) {
              if ('Function' === fa(e)) return ga(e);
            },
            Ea = et,
            Sa = n,
            Ia = Ta(Ta.bind),
            va = function (e, t) {
              return (
                Ea(e),
                void 0 === t
                  ? e
                  : Sa
                  ? Ia(e, t)
                  : function () {
                      return e.apply(t, arguments);
                    }
              );
            },
            ya = c([].slice),
            Aa = TypeError,
            Ra = function (e, t) {
              if (e < t) throw Aa('Not enough arguments');
              return e;
            },
            Ca = /(?:ipad|iphone|ipod).*applewebkit/i.test(q),
            ba = C,
            ka = ma,
            Na = va,
            Da = Ee,
            Oa = G,
            wa = i,
            Pa = pi,
            La = ya,
            Ma = Le,
            Va = Ra,
            xa = Ca,
            Ua = Ts,
            Fa = ba.setImmediate,
            Ba = ba.clearImmediate,
            Ha = ba.process,
            ja = ba.Dispatch,
            Ga = ba.Function,
            Wa = ba.MessageChannel,
            Ja = ba.String,
            Ka = 0,
            Ya = {},
            za = 'onreadystatechange';
          wa(function () {
            Xs = ba.location;
          });
          var qa = function (e) {
              if (Oa(Ya, e)) {
                var t = Ya[e];
                delete Ya[e], t();
              }
            },
            Qa = function (e) {
              return function () {
                qa(e);
              };
            },
            Xa = function (e) {
              qa(e.data);
            },
            $a = function (e) {
              ba.postMessage(Ja(e), Xs.protocol + '//' + Xs.host);
            };
          (Fa && Ba) ||
            ((Fa = function (e) {
              Va(arguments.length, 1);
              var t = Da(e) ? e : Ga(e),
                i = La(arguments, 1);
              return (
                (Ya[++Ka] = function () {
                  ka(t, void 0, i);
                }),
                $s(Ka),
                Ka
              );
            }),
            (Ba = function (e) {
              delete Ya[e];
            }),
            Ua
              ? ($s = function (e) {
                  Ha.nextTick(Qa(e));
                })
              : ja && ja.now
              ? ($s = function (e) {
                  ja.now(Qa(e));
                })
              : Wa && !xa
              ? ((ea = (Zs = new Wa()).port2),
                (Zs.port1.onmessage = Xa),
                ($s = Na(ea.postMessage, ea)))
              : ba.addEventListener &&
                Da(ba.postMessage) &&
                !ba.importScripts &&
                Xs &&
                'file:' !== Xs.protocol &&
                !wa($a)
              ? (($s = $a), ba.addEventListener('message', Xa, !1))
              : ($s =
                  za in Ma('script')
                    ? function (e) {
                        Pa.appendChild(Ma('script'))[za] = function () {
                          Pa.removeChild(this), qa(e);
                        };
                      }
                    : function (e) {
                        setTimeout(Qa(e), 0);
                      }));
          var Za = { set: Fa, clear: Ba },
            ec = function () {
              (this.head = null), (this.tail = null);
            };
          ec.prototype = {
            add: function (e) {
              var t = { item: e, next: null },
                i = this.tail;
              i ? (i.next = t) : (this.head = t), (this.tail = t);
            },
            get: function () {
              var e = this.head;
              if (e)
                return (
                  null === (this.head = e.next) && (this.tail = null), e.item
                );
            },
          };
          var tc,
            ic,
            nc,
            rc,
            oc,
            sc = ec,
            ac = /ipad|iphone|ipod/i.test(q) && 'undefined' != typeof Pebble,
            cc = /web0s(?!.*chrome)/i.test(q),
            lc = C,
            dc = va,
            uc = ln.f,
            hc = Za.set,
            pc = sc,
            _c = Ca,
            mc = ac,
            fc = cc,
            gc = Ts,
            Tc = lc.MutationObserver || lc.WebKitMutationObserver,
            Ec = lc.document,
            Sc = lc.process,
            Ic = lc.Promise,
            vc = uc(lc, 'queueMicrotask'),
            yc = vc && vc.value;
          if (!yc) {
            var Ac = new pc(),
              Rc = function () {
                var e, t;
                for (gc && (e = Sc.domain) && e.exit(); (t = Ac.get()); )
                  try {
                    t();
                  } catch (IU) {
                    throw (Ac.head && tc(), IU);
                  }
                e && e.enter();
              };
            _c || gc || fc || !Tc || !Ec
              ? !mc && Ic && Ic.resolve
                ? (((rc = Ic.resolve(void 0)).constructor = Ic),
                  (oc = dc(rc.then, rc)),
                  (tc = function () {
                    oc(Rc);
                  }))
                : gc
                ? (tc = function () {
                    Sc.nextTick(Rc);
                  })
                : ((hc = dc(hc, lc)),
                  (tc = function () {
                    hc(Rc);
                  }))
              : ((ic = !0),
                (nc = Ec.createTextNode('')),
                new Tc(Rc).observe(nc, { characterData: !0 }),
                (tc = function () {
                  nc.data = ic = !ic;
                })),
              (yc = function (e) {
                Ac.head || tc(), Ac.add(e);
              });
          }
          var Cc = yc,
            bc = function (e) {
              try {
                return { error: !1, value: e() };
              } catch (IU) {
                return { error: !0, value: IU };
              }
            },
            kc = C.Promise,
            Nc =
              'object' == typeof Deno &&
              Deno &&
              'object' == typeof Deno.version,
            Dc =
              !Nc &&
              !Ts &&
              'object' == typeof window &&
              'object' == typeof document,
            Oc = C,
            wc = kc,
            Pc = Ee,
            Lc = Nr,
            Mc = Ln,
            Vc = me,
            xc = Dc,
            Uc = Nc,
            Fc = ie;
          wc && wc.prototype;
          var Bc = Vc('species'),
            Hc = !1,
            jc = Pc(Oc.PromiseRejectionEvent),
            Gc = Lc('Promise', function () {
              var e = Mc(wc),
                t = e !== String(wc);
              if (!t && 66 === Fc) return !0;
              if (!Fc || Fc < 51 || !/native code/.test(e)) {
                var i = new wc(function (e) {
                    e(1);
                  }),
                  n = function (e) {
                    e(
                      function () {},
                      function () {},
                    );
                  };
                if (
                  (((i.constructor = {})[Bc] = n),
                  !(Hc = i.then(function () {}) instanceof n))
                )
                  return !0;
              }
              return !t && (xc || Uc) && !jc;
            }),
            Wc = { CONSTRUCTOR: Gc, REJECTION_EVENT: jc, SUBCLASSING: Hc },
            Jc = {},
            Kc = et,
            Yc = TypeError,
            zc = function (e) {
              var t, i;
              (this.promise = new e(function (e, n) {
                if (void 0 !== t || void 0 !== i)
                  throw Yc('Bad Promise constructor');
                (t = e), (i = n);
              })),
                (this.resolve = Kc(t)),
                (this.reject = Kc(i));
            };
          Jc.f = function (e) {
            return new zc(e);
          };
          var qc,
            Qc,
            Xc,
            $c = xr,
            Zc = Ts,
            el = C,
            tl = Fe,
            il = ir,
            nl = vo,
            rl = oo,
            ol = Cs,
            sl = et,
            al = Ee,
            cl = ve,
            ll = Ns,
            dl = da,
            ul = Za.set,
            hl = Cc,
            pl = function (e, t) {
              try {
                1 == arguments.length ? console.error(e) : console.error(e, t);
              } catch (IU) {}
            },
            _l = bc,
            ml = sc,
            fl = cn,
            gl = kc,
            Tl = Jc,
            El = 'Promise',
            Sl = Wc.CONSTRUCTOR,
            Il = Wc.REJECTION_EVENT,
            vl = Wc.SUBCLASSING,
            yl = fl.getterFor(El),
            Al = fl.set,
            Rl = gl && gl.prototype,
            Cl = gl,
            bl = Rl,
            kl = el.TypeError,
            Nl = el.document,
            Dl = el.process,
            Ol = Tl.f,
            wl = Ol,
            Pl = !!(Nl && Nl.createEvent && el.dispatchEvent),
            Ll = 'unhandledrejection',
            Ml = function (e) {
              var t;
              return !(!cl(e) || !al((t = e.then))) && t;
            },
            Vl = function (e, t) {
              var i,
                n,
                r,
                o = t.value,
                s = 1 == t.state,
                a = s ? e.ok : e.fail,
                c = e.resolve,
                l = e.reject,
                d = e.domain;
              try {
                a
                  ? (s || (2 === t.rejection && Hl(t), (t.rejection = 1)),
                    !0 === a
                      ? (i = o)
                      : (d && d.enter(), (i = a(o)), d && (d.exit(), (r = !0))),
                    i === e.promise
                      ? l(kl('Promise-chain cycle'))
                      : (n = Ml(i))
                      ? tl(n, i, c, l)
                      : c(i))
                  : l(o);
              } catch (IU) {
                d && !r && d.exit(), l(IU);
              }
            },
            xl = function (e, t) {
              e.notified ||
                ((e.notified = !0),
                hl(function () {
                  for (var i, n = e.reactions; (i = n.get()); ) Vl(i, e);
                  (e.notified = !1), t && !e.rejection && Fl(e);
                }));
            },
            Ul = function (e, t, i) {
              var n, r;
              Pl
                ? (((n = Nl.createEvent('Event')).promise = t),
                  (n.reason = i),
                  n.initEvent(e, !1, !0),
                  el.dispatchEvent(n))
                : (n = { promise: t, reason: i }),
                !Il && (r = el['on' + e])
                  ? r(n)
                  : e === Ll && pl('Unhandled promise rejection', i);
            },
            Fl = function (e) {
              tl(ul, el, function () {
                var t,
                  i = e.facade,
                  n = e.value;
                if (
                  Bl(e) &&
                  ((t = _l(function () {
                    Zc ? Dl.emit('unhandledRejection', n, i) : Ul(Ll, i, n);
                  })),
                  (e.rejection = Zc || Bl(e) ? 2 : 1),
                  t.error)
                )
                  throw t.value;
              });
            },
            Bl = function (e) {
              return 1 !== e.rejection && !e.parent;
            },
            Hl = function (e) {
              tl(ul, el, function () {
                var t = e.facade;
                Zc
                  ? Dl.emit('rejectionHandled', t)
                  : Ul('rejectionhandled', t, e.value);
              });
            },
            jl = function (e, t, i) {
              return function (n) {
                e(t, n, i);
              };
            },
            Gl = function (e, t, i) {
              e.done ||
                ((e.done = !0),
                i && (e = i),
                (e.value = t),
                (e.state = 2),
                xl(e, !0));
            },
            Wl = function (e, t, i) {
              if (!e.done) {
                (e.done = !0), i && (e = i);
                try {
                  if (e.facade === t)
                    throw kl("Promise can't be resolved itself");
                  var n = Ml(t);
                  n
                    ? hl(function () {
                        var i = { done: !1 };
                        try {
                          tl(n, t, jl(Wl, i, e), jl(Gl, i, e));
                        } catch (IU) {
                          Gl(i, IU, e);
                        }
                      })
                    : ((e.value = t), (e.state = 1), xl(e, !1));
                } catch (IU) {
                  Gl({ done: !1 }, IU, e);
                }
              }
            };
          if (
            Sl &&
            ((bl = (Cl = function (e) {
              ll(this, bl), sl(e), tl(qc, this);
              var t = yl(this);
              try {
                e(jl(Wl, t), jl(Gl, t));
              } catch (IU) {
                Gl(t, IU);
              }
            }).prototype),
            ((qc = function (e) {
              Al(this, {
                type: El,
                done: !1,
                notified: !1,
                parent: !1,
                reactions: new ml(),
                rejection: !1,
                state: 0,
                value: void 0,
              });
            }).prototype = il(bl, 'then', function (e, t) {
              var i = yl(this),
                n = Ol(dl(this, Cl));
              return (
                (i.parent = !0),
                (n.ok = !al(e) || e),
                (n.fail = al(t) && t),
                (n.domain = Zc ? Dl.domain : void 0),
                0 == i.state
                  ? i.reactions.add(n)
                  : hl(function () {
                      Vl(n, i);
                    }),
                n.promise
              );
            })),
            (Qc = function () {
              var e = new qc(),
                t = yl(e);
              (this.promise = e),
                (this.resolve = jl(Wl, t)),
                (this.reject = jl(Gl, t));
            }),
            (Tl.f = Ol =
              function (e) {
                return e === Cl || undefined === e ? new Qc(e) : wl(e);
              }),
            al(gl) && Rl !== Object.prototype)
          ) {
            (Xc = Rl.then),
              vl ||
                il(
                  Rl,
                  'then',
                  function (e, t) {
                    var i = this;
                    return new Cl(function (e, t) {
                      tl(Xc, i, e, t);
                    }).then(e, t);
                  },
                  { unsafe: !0 },
                );
            try {
              delete Rl.constructor;
            } catch (IU) {}
            nl && nl(Rl, bl);
          }
          $c(
            { global: !0, constructor: !0, wrap: !0, forced: Sl },
            { Promise: Cl },
          ),
            rl(Cl, El, !1),
            ol(El);
          var Jl = Bi,
            Kl = me('iterator'),
            Yl = Array.prototype,
            zl = function (e) {
              return void 0 !== e && (Jl.Array === e || Yl[Kl] === e);
            },
            ql = xs,
            Ql = nt,
            Xl = T,
            $l = Bi,
            Zl = me('iterator'),
            ed = function (e) {
              if (!Xl(e)) return Ql(e, Zl) || Ql(e, '@@iterator') || $l[ql(e)];
            },
            td = Fe,
            id = et,
            nd = Ce,
            rd = Qe,
            od = ed,
            sd = TypeError,
            ad = function (e, t) {
              var i = arguments.length < 2 ? od(e) : t;
              if (id(i)) return nd(td(i, e));
              throw sd(rd(e) + ' is not iterable');
            },
            cd = Fe,
            ld = Ce,
            dd = nt,
            ud = function (e, t, i) {
              var n, r;
              ld(e);
              try {
                if (!(n = dd(e, 'return'))) {
                  if ('throw' === t) throw i;
                  return i;
                }
                n = cd(n, e);
              } catch (IU) {
                (r = !0), (n = IU);
              }
              if ('throw' === t) throw i;
              if (r) throw n;
              return ld(n), i;
            },
            hd = va,
            pd = Fe,
            _d = Ce,
            md = Qe,
            fd = zl,
            gd = Gt,
            Td = Ge,
            Ed = ad,
            Sd = ed,
            Id = ud,
            vd = TypeError,
            yd = function (e, t) {
              (this.stopped = e), (this.result = t);
            },
            Ad = yd.prototype,
            Rd = function (e, t, i) {
              var n,
                r,
                o,
                s,
                a,
                c,
                l,
                d = i && i.that,
                u = !(!i || !i.AS_ENTRIES),
                h = !(!i || !i.IS_RECORD),
                p = !(!i || !i.IS_ITERATOR),
                _ = !(!i || !i.INTERRUPTED),
                m = hd(t, d),
                f = function (e) {
                  return n && Id(n, 'normal', e), new yd(!0, e);
                },
                g = function (e) {
                  return u
                    ? (_d(e), _ ? m(e[0], e[1], f) : m(e[0], e[1]))
                    : _
                    ? m(e, f)
                    : m(e);
                };
              if (h) n = e.iterator;
              else if (p) n = e;
              else {
                if (!(r = Sd(e))) throw vd(md(e) + ' is not iterable');
                if (fd(r)) {
                  for (o = 0, s = gd(e); s > o; o++)
                    if ((a = g(e[o])) && Td(Ad, a)) return a;
                  return new yd(!1);
                }
                n = Ed(e, r);
              }
              for (c = h ? e.next : n.next; !(l = pd(c, n)).done; ) {
                try {
                  a = g(l.value);
                } catch (IU) {
                  Id(n, 'throw', IU);
                }
                if ('object' == typeof a && a && Td(Ad, a)) return a;
              }
              return new yd(!1);
            },
            Cd = me('iterator'),
            bd = !1;
          try {
            var kd = 0,
              Nd = {
                next: function () {
                  return { done: !!kd++ };
                },
                return: function () {
                  bd = !0;
                },
              };
            (Nd[Cd] = function () {
              return this;
            }),
              Array.from(Nd, function () {
                throw 2;
              });
          } catch (IU) {}
          var Dd = function (e, t) {
              if (!t && !bd) return !1;
              var i = !1;
              try {
                var n = {};
                (n[Cd] = function () {
                  return {
                    next: function () {
                      return { done: (i = !0) };
                    },
                  };
                }),
                  e(n);
              } catch (IU) {}
              return i;
            },
            Od = kc,
            wd =
              Wc.CONSTRUCTOR ||
              !Dd(function (e) {
                Od.all(e).then(void 0, function () {});
              }),
            Pd = Fe,
            Ld = et,
            Md = Jc,
            Vd = bc,
            xd = Rd;
          xr(
            { target: 'Promise', stat: !0, forced: wd },
            {
              all: function (e) {
                var t = this,
                  i = Md.f(t),
                  n = i.resolve,
                  r = i.reject,
                  o = Vd(function () {
                    var i = Ld(t.resolve),
                      o = [],
                      s = 0,
                      a = 1;
                    xd(e, function (e) {
                      var c = s++,
                        l = !1;
                      a++,
                        Pd(i, t, e).then(function (e) {
                          l || ((l = !0), (o[c] = e), --a || n(o));
                        }, r);
                    }),
                      --a || n(o);
                  });
                return o.error && r(o.value), i.promise;
              },
            },
          );
          var Ud = xr,
            Fd = Wc.CONSTRUCTOR,
            Bd = kc,
            Hd = je,
            jd = Ee,
            Gd = ir,
            Wd = Bd && Bd.prototype;
          if (
            (Ud(
              { target: 'Promise', proto: !0, forced: Fd, real: !0 },
              {
                catch: function (e) {
                  return this.then(void 0, e);
                },
              },
            ),
            jd(Bd))
          ) {
            var Jd = Hd('Promise').prototype.catch;
            Wd.catch !== Jd && Gd(Wd, 'catch', Jd, { unsafe: !0 });
          }
          var Kd = Fe,
            Yd = et,
            zd = Jc,
            qd = bc,
            Qd = Rd;
          xr(
            { target: 'Promise', stat: !0, forced: wd },
            {
              race: function (e) {
                var t = this,
                  i = zd.f(t),
                  n = i.reject,
                  r = qd(function () {
                    var r = Yd(t.resolve);
                    Qd(e, function (e) {
                      Kd(r, t, e).then(i.resolve, n);
                    });
                  });
                return r.error && n(r.value), i.promise;
              },
            },
          );
          var Xd = Fe,
            $d = Jc;
          xr(
            { target: 'Promise', stat: !0, forced: Wc.CONSTRUCTOR },
            {
              reject: function (e) {
                var t = $d.f(this);
                return Xd(t.reject, void 0, e), t.promise;
              },
            },
          );
          var Zd = Ce,
            eu = ve,
            tu = Jc,
            iu = function (e, t) {
              if ((Zd(e), eu(t) && t.constructor === e)) return t;
              var i = tu.f(e);
              return (0, i.resolve)(t), i.promise;
            },
            nu = xr,
            ru = Wc.CONSTRUCTOR,
            ou = iu;
          je('Promise'),
            nu(
              { target: 'Promise', stat: !0, forced: ru },
              {
                resolve: function (e) {
                  return ou(this, e);
                },
              },
            );
          var su = Ee,
            au = ve,
            cu = vo,
            lu = function (e, t, i) {
              var n, r;
              return (
                cu &&
                  su((n = t.constructor)) &&
                  n !== i &&
                  au((r = n.prototype)) &&
                  r !== i.prototype &&
                  cu(e, r),
                e
              );
            },
            du = ve,
            uu = h,
            hu = me('match'),
            pu = function (e) {
              var t;
              return (
                du(e) && (void 0 !== (t = e[hu]) ? !!t : 'RegExp' == uu(e))
              );
            },
            _u = xs,
            mu = String,
            fu = function (e) {
              if ('Symbol' === _u(e))
                throw TypeError('Cannot convert a Symbol value to a string');
              return mu(e);
            },
            gu = Ce,
            Tu = function () {
              var e = gu(this),
                t = '';
              return (
                e.hasIndices && (t += 'd'),
                e.global && (t += 'g'),
                e.ignoreCase && (t += 'i'),
                e.multiline && (t += 'm'),
                e.dotAll && (t += 's'),
                e.unicode && (t += 'u'),
                e.unicodeSets && (t += 'v'),
                e.sticky && (t += 'y'),
                t
              );
            },
            Eu = Fe,
            Su = G,
            Iu = Ge,
            vu = Tu,
            yu = RegExp.prototype,
            Au = function (e) {
              var t = e.flags;
              return void 0 !== t ||
                'flags' in yu ||
                Su(e, 'flags') ||
                !Iu(yu, e)
                ? t
                : Eu(vu, e);
            },
            Ru = i,
            Cu = C.RegExp,
            bu = Ru(function () {
              var e = Cu('a', 'y');
              return (e.lastIndex = 2), null != e.exec('abcd');
            }),
            ku =
              bu ||
              Ru(function () {
                return !Cu('a', 'y').sticky;
              }),
            Nu =
              bu ||
              Ru(function () {
                var e = Cu('^r', 'gy');
                return (e.lastIndex = 2), null != e.exec('str');
              }),
            Du = { BROKEN_CARET: Nu, MISSED_STICKY: ku, UNSUPPORTED_Y: bu },
            Ou = De.f,
            wu = i,
            Pu = C.RegExp,
            Lu = wu(function () {
              var e = Pu('.', 's');
              return !(e.dotAll && e.exec('\n') && 's' === e.flags);
            }),
            Mu = i,
            Vu = C.RegExp,
            xu = Mu(function () {
              var e = Vu('(?<a>b)', 'g');
              return (
                'b' !== e.exec('b').groups.a || 'bc' !== 'b'.replace(e, '$<a>c')
              );
            }),
            Uu = ke,
            Fu = C,
            Bu = c,
            Hu = Nr,
            ju = lu,
            Gu = Yi,
            Wu = nr.f,
            Ju = Ge,
            Ku = pu,
            Yu = fu,
            zu = Au,
            qu = Du,
            Qu = function (e, t, i) {
              i in e ||
                Ou(e, i, {
                  configurable: !0,
                  get: function () {
                    return t[i];
                  },
                  set: function (e) {
                    t[i] = e;
                  },
                });
            },
            Xu = ir,
            $u = i,
            Zu = G,
            eh = cn.enforce,
            th = Cs,
            ih = Lu,
            nh = xu,
            rh = me('match'),
            oh = Fu.RegExp,
            sh = oh.prototype,
            ah = Fu.SyntaxError,
            ch = Bu(sh.exec),
            lh = Bu(''.charAt),
            dh = Bu(''.replace),
            uh = Bu(''.indexOf),
            hh = Bu(''.slice),
            ph = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,
            _h = /a/g,
            mh = /a/g,
            fh = new oh(_h) !== _h,
            gh = qu.MISSED_STICKY,
            Th = qu.UNSUPPORTED_Y,
            Eh =
              Uu &&
              (!fh ||
                gh ||
                ih ||
                nh ||
                $u(function () {
                  return (
                    (mh[rh] = !1),
                    oh(_h) != _h || oh(mh) == mh || '/a/i' != oh(_h, 'i')
                  );
                }));
          if (Hu('RegExp', Eh)) {
            for (
              var Sh = function (e, t) {
                  var i,
                    n,
                    r,
                    o,
                    s,
                    a,
                    c = Ju(sh, this),
                    l = Ku(e),
                    d = void 0 === t,
                    u = [],
                    h = e;
                  if (!c && l && d && e.constructor === Sh) return e;
                  if (
                    ((l || Ju(sh, e)) && ((e = e.source), d && (t = zu(h))),
                    (e = void 0 === e ? '' : Yu(e)),
                    (t = void 0 === t ? '' : Yu(t)),
                    (h = e),
                    ih &&
                      ('dotAll' in _h) &&
                      (n = !!t && uh(t, 's') > -1) &&
                      (t = dh(t, /s/g, '')),
                    (i = t),
                    gh &&
                      ('sticky' in _h) &&
                      (r = !!t && uh(t, 'y') > -1) &&
                      Th &&
                      (t = dh(t, /y/g, '')),
                    nh &&
                      ((o = (function (e) {
                        for (
                          var t,
                            i = e.length,
                            n = 0,
                            r = '',
                            o = [],
                            s = {},
                            a = !1,
                            c = !1,
                            l = 0,
                            d = '';
                          n <= i;
                          n++
                        ) {
                          if ('\\' === (t = lh(e, n))) t += lh(e, ++n);
                          else if (']' === t) a = !1;
                          else if (!a)
                            switch (!0) {
                              case '[' === t:
                                a = !0;
                                break;
                              case '(' === t:
                                ch(ph, hh(e, n + 1)) && ((n += 2), (c = !0)),
                                  (r += t),
                                  l++;
                                continue;
                              case '>' === t && c:
                                if ('' === d || Zu(s, d))
                                  throw new ah('Invalid capture group name');
                                (s[d] = !0),
                                  (o[o.length] = [d, l]),
                                  (c = !1),
                                  (d = '');
                                continue;
                            }
                          c ? (d += t) : (r += t);
                        }
                        return [r, o];
                      })(e)),
                      (e = o[0]),
                      (u = o[1])),
                    (s = ju(oh(e, t), c ? this : sh, Sh)),
                    (n || r || u.length) &&
                      ((a = eh(s)),
                      n &&
                        ((a.dotAll = !0),
                        (a.raw = Sh(
                          (function (e) {
                            for (
                              var t, i = e.length, n = 0, r = '', o = !1;
                              n <= i;
                              n++
                            )
                              '\\' !== (t = lh(e, n))
                                ? o || '.' !== t
                                  ? ('[' === t
                                      ? (o = !0)
                                      : ']' === t && (o = !1),
                                    (r += t))
                                  : (r += '[\\s\\S]')
                                : (r += t + lh(e, ++n));
                            return r;
                          })(e),
                          i,
                        ))),
                      r && (a.sticky = !0),
                      u.length && (a.groups = u)),
                    e !== h)
                  )
                    try {
                      Gu(s, 'source', '' === h ? '(?:)' : h);
                    } catch (IU) {}
                  return s;
                },
                Ih = Wu(oh),
                vh = 0;
              Ih.length > vh;

            )
              Qu(Sh, oh, Ih[vh++]);
            (sh.constructor = Sh),
              (Sh.prototype = sh),
              Xu(Fu, 'RegExp', Sh, { constructor: !0 });
          }
          th('RegExp');
          var yh = Fe,
            Ah = c,
            Rh = fu,
            Ch = Tu,
            bh = Du,
            kh = Di,
            Nh = cn.get,
            Dh = Lu,
            Oh = xu,
            wh = b('native-string-replace', String.prototype.replace),
            Ph = RegExp.prototype.exec,
            Lh = Ph,
            Mh = Ah(''.charAt),
            Vh = Ah(''.indexOf),
            xh = Ah(''.replace),
            Uh = Ah(''.slice),
            Fh = (function () {
              var e = /a/,
                t = /b*/g;
              return (
                yh(Ph, e, 'a'),
                yh(Ph, t, 'a'),
                0 !== e.lastIndex || 0 !== t.lastIndex
              );
            })(),
            Bh = bh.BROKEN_CARET,
            Hh = void 0 !== /()??/.exec('')[1];
          (Fh || Hh || Bh || Dh || Oh) &&
            (Lh = function (e) {
              var t,
                i,
                n,
                r,
                o,
                s,
                a,
                c = this,
                l = Nh(c),
                d = Rh(e),
                u = l.raw;
              if (u)
                return (
                  (u.lastIndex = c.lastIndex),
                  (t = yh(Lh, u, d)),
                  (c.lastIndex = u.lastIndex),
                  t
                );
              var h = l.groups,
                p = Bh && c.sticky,
                _ = yh(Ch, c),
                m = c.source,
                f = 0,
                g = d;
              if (
                (p &&
                  ((_ = xh(_, 'y', '')),
                  -1 === Vh(_, 'g') && (_ += 'g'),
                  (g = Uh(d, c.lastIndex)),
                  c.lastIndex > 0 &&
                    (!c.multiline ||
                      (c.multiline && '\n' !== Mh(d, c.lastIndex - 1))) &&
                    ((m = '(?: ' + m + ')'), (g = ' ' + g), f++),
                  (i = new RegExp('^(?:' + m + ')', _))),
                Hh && (i = new RegExp('^' + m + '$(?!\\s)', _)),
                Fh && (n = c.lastIndex),
                (r = yh(Ph, p ? i : c, g)),
                p
                  ? r
                    ? ((r.input = Uh(r.input, f)),
                      (r[0] = Uh(r[0], f)),
                      (r.index = c.lastIndex),
                      (c.lastIndex += r[0].length))
                    : (c.lastIndex = 0)
                  : Fh &&
                    r &&
                    (c.lastIndex = c.global ? r.index + r[0].length : n),
                Hh &&
                  r &&
                  r.length > 1 &&
                  yh(wh, r[0], i, function () {
                    for (o = 1; o < arguments.length - 2; o++)
                      void 0 === arguments[o] && (r[o] = void 0);
                  }),
                r && h)
              )
                for (r.groups = s = kh(null), o = 0; o < h.length; o++)
                  s[(a = h[o])[0]] = r[a[1]];
              return r;
            });
          var jh = Lh;
          xr(
            { target: 'RegExp', proto: !0, forced: /./.exec !== jh },
            { exec: jh },
          );
          var Gh = h,
            Wh =
              Array.isArray ||
              function (e) {
                return 'Array' == Gh(e);
              },
            Jh = Wh,
            Kh = ta,
            Yh = ve,
            zh = me('species'),
            qh = Array,
            Qh = function (e) {
              var t;
              return (
                Jh(e) &&
                  ((t = e.constructor),
                  ((Kh(t) && (t === qh || Jh(t.prototype))) ||
                    (Yh(t) && null === (t = t[zh]))) &&
                    (t = void 0)),
                void 0 === t ? qh : t
              );
            },
            Xh = va,
            $h = g,
            Zh = B,
            ep = Gt,
            tp = function (e, t) {
              return new (Qh(e))(0 === t ? 0 : t);
            },
            ip = c([].push),
            np = function (e) {
              var t = 1 == e,
                i = 2 == e,
                n = 3 == e,
                r = 4 == e,
                o = 6 == e,
                s = 7 == e,
                a = 5 == e || o;
              return function (c, l, d, u) {
                for (
                  var h,
                    p,
                    _ = Zh(c),
                    m = $h(_),
                    f = Xh(l, d),
                    g = ep(m),
                    T = 0,
                    E = u || tp,
                    S = t ? E(c, g) : i || s ? E(c, 0) : void 0;
                  g > T;
                  T++
                )
                  if ((a || T in m) && ((p = f((h = m[T]), T, _)), e))
                    if (t) S[T] = p;
                    else if (p)
                      switch (e) {
                        case 3:
                          return !0;
                        case 5:
                          return h;
                        case 6:
                          return T;
                        case 2:
                          ip(S, h);
                      }
                    else
                      switch (e) {
                        case 4:
                          return !1;
                        case 7:
                          ip(S, h);
                      }
                return o ? -1 : n || r ? r : S;
              };
            },
            rp = {
              forEach: np(0),
              map: np(1),
              filter: np(2),
              some: np(3),
              every: np(4),
              find: np(5),
              findIndex: np(6),
              filterReject: np(7),
            },
            op = i,
            sp = function (e, t) {
              var i = [][e];
              return (
                !!i &&
                op(function () {
                  i.call(
                    null,
                    t ||
                      function () {
                        return 1;
                      },
                    1,
                  );
                })
              );
            },
            ap = rp.forEach,
            cp = sp('forEach')
              ? [].forEach
              : function (e) {
                  return ap(
                    this,
                    e,
                    arguments.length > 1 ? arguments[1] : void 0,
                  );
                },
            lp = C,
            dp = ns,
            up = ss,
            hp = cp,
            pp = Yi,
            _p = function (e) {
              if (e && e.forEach !== hp)
                try {
                  pp(e, 'forEach', hp);
                } catch (IU) {
                  e.forEach = hp;
                }
            };
          for (var mp in dp) dp[mp] && _p(lp[mp] && lp[mp].prototype);
          _p(up);
          var fp = et,
            gp = B,
            Tp = g,
            Ep = Gt,
            Sp = TypeError,
            Ip = function (e) {
              return function (t, i, n, r) {
                fp(i);
                var o = gp(t),
                  s = Tp(o),
                  a = Ep(o),
                  c = e ? a - 1 : 0,
                  l = e ? -1 : 1;
                if (n < 2)
                  for (;;) {
                    if (c in s) {
                      (r = s[c]), (c += l);
                      break;
                    }
                    if (((c += l), e ? c < 0 : a <= c))
                      throw Sp('Reduce of empty array with no initial value');
                  }
                for (; e ? c >= 0 : a > c; c += l)
                  c in s && (r = i(r, s[c], c, o));
                return r;
              };
            },
            vp = { left: Ip(!1), right: Ip(!0) }.left;
          xr(
            {
              target: 'Array',
              proto: !0,
              forced: (!Ts && ie > 79 && ie < 83) || !sp('reduce'),
            },
            {
              reduce: function (e) {
                var t = arguments.length;
                return vp(this, e, t, t > 1 ? arguments[1] : void 0);
              },
            },
          );
          var yp = Ta,
            Ap = ir,
            Rp = jh,
            Cp = i,
            bp = me,
            kp = Yi,
            Np = bp('species'),
            Dp = RegExp.prototype,
            Op = c,
            wp = Lt,
            Pp = fu,
            Lp = I,
            Mp = Op(''.charAt),
            Vp = Op(''.charCodeAt),
            xp = Op(''.slice),
            Up = function (e) {
              return function (t, i) {
                var n,
                  r,
                  o = Pp(Lp(t)),
                  s = wp(i),
                  a = o.length;
                return s < 0 || s >= a
                  ? e
                    ? ''
                    : void 0
                  : (n = Vp(o, s)) < 55296 ||
                    n > 56319 ||
                    s + 1 === a ||
                    (r = Vp(o, s + 1)) < 56320 ||
                    r > 57343
                  ? e
                    ? Mp(o, s)
                    : n
                  : e
                  ? xp(o, s, s + 2)
                  : r - 56320 + ((n - 55296) << 10) + 65536;
              };
            },
            Fp = { codeAt: Up(!1), charAt: Up(!0) },
            Bp = Fp.charAt,
            Hp = c,
            jp = B,
            Gp = Math.floor,
            Wp = Hp(''.charAt),
            Jp = Hp(''.replace),
            Kp = Hp(''.slice),
            Yp = /\$([$&'`]|\d{1,2}|<[^>]*>)/g,
            zp = /\$([$&'`]|\d{1,2})/g,
            qp = function (e, t, i, n, r, o) {
              var s = i + e.length,
                a = n.length,
                c = zp;
              return (
                void 0 !== r && ((r = jp(r)), (c = Yp)),
                Jp(o, c, function (o, c) {
                  var l;
                  switch (Wp(c, 0)) {
                    case '$':
                      return '$';
                    case '&':
                      return e;
                    case '`':
                      return Kp(t, 0, i);
                    case "'":
                      return Kp(t, s);
                    case '<':
                      l = r[Kp(c, 1, -1)];
                      break;
                    default:
                      var d = +c;
                      if (0 === d) return o;
                      if (d > a) {
                        var u = Gp(d / 10);
                        return 0 === u
                          ? o
                          : u <= a
                          ? void 0 === n[u - 1]
                            ? Wp(c, 1)
                            : n[u - 1] + Wp(c, 1)
                          : o;
                      }
                      l = n[d - 1];
                  }
                  return void 0 === l ? '' : l;
                })
              );
            },
            Qp = Fe,
            Xp = Ce,
            $p = Ee,
            Zp = h,
            e_ = jh,
            t_ = TypeError,
            i_ = ma,
            n_ = Fe,
            r_ = c,
            o_ = function (e, t, i, n) {
              var r = bp(e),
                o = !Cp(function () {
                  var t = {};
                  return (
                    (t[r] = function () {
                      return 7;
                    }),
                    7 != ''[e](t)
                  );
                }),
                s =
                  o &&
                  !Cp(function () {
                    var t = !1,
                      i = /a/;
                    return (
                      'split' === e &&
                        (((i = {}).constructor = {}),
                        (i.constructor[Np] = function () {
                          return i;
                        }),
                        (i.flags = ''),
                        (i[r] = /./[r])),
                      (i.exec = function () {
                        return (t = !0), null;
                      }),
                      i[r](''),
                      !t
                    );
                  });
              if (!o || !s || i) {
                var a = yp(/./[r]),
                  c = t(r, ''[e], function (e, t, i, n, r) {
                    var s = yp(e),
                      c = t.exec;
                    return c === Rp || c === Dp.exec
                      ? o && !r
                        ? { done: !0, value: a(t, i, n) }
                        : { done: !0, value: s(i, t, n) }
                      : { done: !1 };
                  });
                Ap(String.prototype, e, c[0]), Ap(Dp, r, c[1]);
              }
              n && kp(Dp[r], 'sham', !0);
            },
            s_ = i,
            a_ = Ce,
            c_ = Ee,
            l_ = T,
            d_ = Lt,
            u_ = Ht,
            h_ = fu,
            p_ = I,
            __ = function (e, t, i) {
              return t + (i ? Bp(e, t).length : 1);
            },
            m_ = nt,
            f_ = qp,
            g_ = function (e, t) {
              var i = e.exec;
              if ($p(i)) {
                var n = Qp(i, e, t);
                return null !== n && Xp(n), n;
              }
              if ('RegExp' === Zp(e)) return Qp(e_, e, t);
              throw t_('RegExp#exec called on incompatible receiver');
            },
            T_ = me('replace'),
            E_ = Math.max,
            S_ = Math.min,
            I_ = r_([].concat),
            v_ = r_([].push),
            y_ = r_(''.indexOf),
            A_ = r_(''.slice),
            R_ = function (e) {
              return void 0 === e ? e : String(e);
            },
            C_ = '$0' === 'a'.replace(/./, '$0'),
            b_ = !!/./[T_] && '' === /./[T_]('a', '$0'),
            k_ = !s_(function () {
              var e = /./;
              return (
                (e.exec = function () {
                  var e = [];
                  return (e.groups = { a: '7' }), e;
                }),
                '7' !== ''.replace(e, '$<a>')
              );
            });
          o_(
            'replace',
            function (e, t, i) {
              var n = b_ ? '$' : '$0';
              return [
                function (e, i) {
                  var n = p_(this),
                    r = l_(e) ? void 0 : m_(e, T_);
                  return r ? n_(r, e, n, i) : n_(t, h_(n), e, i);
                },
                function (e, r) {
                  var o = a_(this),
                    s = h_(e);
                  if (
                    'string' == typeof r &&
                    -1 === y_(r, n) &&
                    -1 === y_(r, '$<')
                  ) {
                    var a = i(t, o, s, r);
                    if (a.done) return a.value;
                  }
                  var c = c_(r);
                  c || (r = h_(r));
                  var l = o.global;
                  if (l) {
                    var d = o.unicode;
                    o.lastIndex = 0;
                  }
                  for (var u = []; ; ) {
                    var h = g_(o, s);
                    if (null === h) break;
                    if ((v_(u, h), !l)) break;
                    '' === h_(h[0]) &&
                      (o.lastIndex = __(s, u_(o.lastIndex), d));
                  }
                  for (var p = '', _ = 0, m = 0; m < u.length; m++) {
                    for (
                      var f = h_((h = u[m])[0]),
                        g = E_(S_(d_(h.index), s.length), 0),
                        T = [],
                        E = 1;
                      E < h.length;
                      E++
                    )
                      v_(T, R_(h[E]));
                    var S = h.groups;
                    if (c) {
                      var I = I_([f], T, g, s);
                      void 0 !== S && v_(I, S);
                      var v = h_(i_(r, void 0, I));
                    } else v = f_(f, s, g, T, S, r);
                    g >= _ && ((p += A_(s, _, g) + v), (_ = g + f.length));
                  }
                  return p + A_(s, _);
                },
              ];
            },
            !k_ || !C_ || b_,
          );
          var N_ = zt.includes,
            D_ = Fi;
          xr(
            {
              target: 'Array',
              proto: !0,
              forced: i(function () {
                return !Array(1).includes();
              }),
            },
            {
              includes: function (e) {
                return N_(
                  this,
                  e,
                  arguments.length > 1 ? arguments[1] : void 0,
                );
              },
            },
          ),
            D_('includes');
          var O_ = Lt,
            w_ = fu,
            P_ = I,
            L_ = RangeError,
            M_ = c,
            V_ = Ht,
            x_ = fu,
            U_ = function (e) {
              var t = w_(P_(this)),
                i = '',
                n = O_(e);
              if (n < 0 || Infinity == n)
                throw L_('Wrong number of repetitions');
              for (; n > 0; (n >>>= 1) && (t += t)) 1 & n && (i += t);
              return i;
            },
            F_ = I,
            B_ = M_(U_),
            H_ = M_(''.slice),
            j_ = Math.ceil,
            G_ = function (e) {
              return function (t, i, n) {
                var r,
                  o,
                  s = x_(F_(t)),
                  a = V_(i),
                  c = s.length,
                  l = void 0 === n ? ' ' : x_(n);
                return a <= c || '' == l
                  ? s
                  : ((o = B_(l, j_((r = a - c) / l.length))).length > r &&
                      (o = H_(o, 0, r)),
                    e ? s + o : o + s);
              };
            },
            W_ = { start: G_(!1), end: G_(!0) },
            J_ =
              /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(
                q,
              ),
            K_ = W_.start;
          xr(
            { target: 'String', proto: !0, forced: J_ },
            {
              padStart: function (e) {
                return K_(
                  this,
                  e,
                  arguments.length > 1 ? arguments[1] : void 0,
                );
              },
            },
          );
          var Y_ = i,
            z_ = ke,
            q_ = me('iterator'),
            Q_ = !Y_(function () {
              var e = new URL('b?a=1&b=2&c=3', 'http://a'),
                t = e.searchParams,
                i = '';
              return (
                (e.pathname = 'c%20d'),
                t.forEach(function (e, n) {
                  t.delete('b'), (i += n + e);
                }),
                (!t.size && !z_) ||
                  !t.sort ||
                  'http://a/c%20d?a=1&c=3' !== e.href ||
                  '3' !== t.get('c') ||
                  'a=1' !== String(new URLSearchParams('?a=1')) ||
                  !t[q_] ||
                  'a' !== new URL('https://a@b').username ||
                  'b' !==
                    new URLSearchParams(new URLSearchParams('a=b')).get('a') ||
                  'xn--e1aybc' !== new URL('http://тест').host ||
                  '#%D0%B1' !== new URL('http://a#б').hash ||
                  'a1c3' !== i ||
                  'x' !== new URL('http://x', void 0).host
              );
            }),
            X_ = ir,
            $_ = function (e, t, i) {
              for (var n in t) X_(e, n, t[n], i);
              return e;
            },
            Z_ = Tt,
            em = De,
            tm = Wi,
            im = function (e, t, i) {
              var n = Z_(t);
              n in e ? em.f(e, n, tm(0, i)) : (e[n] = i);
            },
            nm = Ut,
            rm = Gt,
            om = im,
            sm = Array,
            am = Math.max,
            cm = function (e, t, i) {
              for (
                var n = rm(e),
                  r = nm(t, n),
                  o = nm(void 0 === i ? n : i, n),
                  s = sm(am(o - r, 0)),
                  a = 0;
                r < o;
                r++, a++
              )
                om(s, a, e[r]);
              return (s.length = a), s;
            },
            lm = cm,
            dm = Math.floor,
            um = function (e, t) {
              var i = e.length,
                n = dm(i / 2);
              return i < 8
                ? hm(e, t)
                : pm(e, um(lm(e, 0, n), t), um(lm(e, n), t), t);
            },
            hm = function (e, t) {
              for (var i, n, r = e.length, o = 1; o < r; ) {
                for (n = o, i = e[o]; n && t(e[n - 1], i) > 0; ) e[n] = e[--n];
                n !== o++ && (e[n] = i);
              }
              return e;
            },
            pm = function (e, t, i, n) {
              for (
                var r = t.length, o = i.length, s = 0, a = 0;
                s < r || a < o;

              )
                e[s + a] =
                  s < r && a < o
                    ? n(t[s], i[a]) <= 0
                      ? t[s++]
                      : i[a++]
                    : s < r
                    ? t[s++]
                    : i[a++];
              return e;
            },
            _m = um,
            mm = xr,
            fm = C,
            gm = Fe,
            Tm = c,
            Em = ke,
            Sm = Q_,
            Im = ir,
            vm = Is,
            ym = $_,
            Am = oo,
            Rm = po,
            Cm = cn,
            bm = Ns,
            km = Ee,
            Nm = G,
            Dm = va,
            Om = xs,
            wm = Ce,
            Pm = ve,
            Lm = fu,
            Mm = Di,
            Vm = Wi,
            xm = ad,
            Um = ed,
            Fm = Ra,
            Bm = _m,
            Hm = me('iterator'),
            jm = 'URLSearchParams',
            Gm = jm + 'Iterator',
            Wm = Cm.set,
            Jm = Cm.getterFor(jm),
            Km = Cm.getterFor(Gm),
            Ym = Object.getOwnPropertyDescriptor,
            zm = function (e) {
              if (!Em) return fm[e];
              var t = Ym(fm, e);
              return t && t.value;
            },
            qm = zm('fetch'),
            Qm = zm('Request'),
            Xm = zm('Headers'),
            $m = Qm && Qm.prototype,
            Zm = Xm && Xm.prototype,
            ef = fm.RegExp,
            tf = fm.TypeError,
            nf = fm.decodeURIComponent,
            rf = fm.encodeURIComponent,
            of = Tm(''.charAt),
            sf = Tm([].join),
            af = Tm([].push),
            cf = Tm(''.replace),
            lf = Tm([].shift),
            df = Tm([].splice),
            uf = Tm(''.split),
            hf = Tm(''.slice),
            pf = /\+/g,
            _f = Array(4),
            mf = function (e) {
              return (
                _f[e - 1] ||
                (_f[e - 1] = ef('((?:%[\\da-f]{2}){' + e + '})', 'gi'))
              );
            },
            ff = function (e) {
              try {
                return nf(e);
              } catch (IU) {
                return e;
              }
            },
            gf = function (e) {
              var t = cf(e, pf, ' '),
                i = 4;
              try {
                return nf(t);
              } catch (IU) {
                for (; i; ) t = cf(t, mf(i--), ff);
                return t;
              }
            },
            Tf = /[!'()~]|%20/g,
            Ef = {
              '!': '%21',
              "'": '%27',
              '(': '%28',
              ')': '%29',
              '~': '%7E',
              '%20': '+',
            },
            Sf = function (e) {
              return Ef[e];
            },
            If = function (e) {
              return cf(rf(e), Tf, Sf);
            },
            vf = Rm(
              function (e, t) {
                Wm(this, { type: Gm, iterator: xm(Jm(e).entries), kind: t });
              },
              'Iterator',
              function () {
                var e = Km(this),
                  t = e.kind,
                  i = e.iterator.next(),
                  n = i.value;
                return (
                  i.done ||
                    (i.value =
                      'keys' === t
                        ? n.key
                        : 'values' === t
                        ? n.value
                        : [n.key, n.value]),
                  i
                );
              },
              !0,
            ),
            yf = function (e) {
              (this.entries = []),
                (this.url = null),
                void 0 !== e &&
                  (Pm(e)
                    ? this.parseObject(e)
                    : this.parseQuery(
                        'string' == typeof e
                          ? '?' === of(e, 0)
                            ? hf(e, 1)
                            : e
                          : Lm(e),
                      ));
            };
          yf.prototype = {
            type: jm,
            bindURL: function (e) {
              (this.url = e), this.update();
            },
            parseObject: function (e) {
              var t,
                i,
                n,
                r,
                o,
                s,
                a,
                c = Um(e);
              if (c)
                for (i = (t = xm(e, c)).next; !(n = gm(i, t)).done; ) {
                  if (
                    ((o = (r = xm(wm(n.value))).next),
                    (s = gm(o, r)).done ||
                      (a = gm(o, r)).done ||
                      !gm(o, r).done)
                  )
                    throw tf('Expected sequence with length 2');
                  af(this.entries, { key: Lm(s.value), value: Lm(a.value) });
                }
              else
                for (var l in e)
                  Nm(e, l) && af(this.entries, { key: l, value: Lm(e[l]) });
            },
            parseQuery: function (e) {
              if (e)
                for (var t, i, n = uf(e, '&'), r = 0; r < n.length; )
                  (t = n[r++]).length &&
                    ((i = uf(t, '=')),
                    af(this.entries, {
                      key: gf(lf(i)),
                      value: gf(sf(i, '=')),
                    }));
            },
            serialize: function () {
              for (var e, t = this.entries, i = [], n = 0; n < t.length; )
                (e = t[n++]), af(i, If(e.key) + '=' + If(e.value));
              return sf(i, '&');
            },
            update: function () {
              (this.entries.length = 0), this.parseQuery(this.url.query);
            },
            updateURL: function () {
              this.url && this.url.update();
            },
          };
          var Af = function () {
              bm(this, Rf);
              var e = Wm(
                this,
                new yf(arguments.length > 0 ? arguments[0] : void 0),
              );
              Em || (this.length = e.entries.length);
            },
            Rf = Af.prototype;
          if (
            (ym(
              Rf,
              {
                append: function (e, t) {
                  Fm(arguments.length, 2);
                  var i = Jm(this);
                  af(i.entries, { key: Lm(e), value: Lm(t) }),
                    Em || this.length++,
                    i.updateURL();
                },
                delete: function (e) {
                  Fm(arguments.length, 1);
                  for (
                    var t = Jm(this), i = t.entries, n = Lm(e), r = 0;
                    r < i.length;

                  )
                    i[r].key === n ? df(i, r, 1) : r++;
                  Em || (this.length = i.length), t.updateURL();
                },
                get: function (e) {
                  Fm(arguments.length, 1);
                  for (
                    var t = Jm(this).entries, i = Lm(e), n = 0;
                    n < t.length;
                    n++
                  )
                    if (t[n].key === i) return t[n].value;
                  return null;
                },
                getAll: function (e) {
                  Fm(arguments.length, 1);
                  for (
                    var t = Jm(this).entries, i = Lm(e), n = [], r = 0;
                    r < t.length;
                    r++
                  )
                    t[r].key === i && af(n, t[r].value);
                  return n;
                },
                has: function (e) {
                  Fm(arguments.length, 1);
                  for (
                    var t = Jm(this).entries, i = Lm(e), n = 0;
                    n < t.length;

                  )
                    if (t[n++].key === i) return !0;
                  return !1;
                },
                set: function (e, t) {
                  Fm(arguments.length, 1);
                  for (
                    var i,
                      n = Jm(this),
                      r = n.entries,
                      o = !1,
                      s = Lm(e),
                      a = Lm(t),
                      c = 0;
                    c < r.length;
                    c++
                  )
                    (i = r[c]).key === s &&
                      (o ? df(r, c--, 1) : ((o = !0), (i.value = a)));
                  o || af(r, { key: s, value: a }),
                    Em || (this.length = r.length),
                    n.updateURL();
                },
                sort: function () {
                  var e = Jm(this);
                  Bm(e.entries, function (e, t) {
                    return e.key > t.key ? 1 : -1;
                  }),
                    e.updateURL();
                },
                forEach: function (e) {
                  for (
                    var t,
                      i = Jm(this).entries,
                      n = Dm(e, arguments.length > 1 ? arguments[1] : void 0),
                      r = 0;
                    r < i.length;

                  )
                    n((t = i[r++]).value, t.key, this);
                },
                keys: function () {
                  return new vf(this, 'keys');
                },
                values: function () {
                  return new vf(this, 'values');
                },
                entries: function () {
                  return new vf(this, 'entries');
                },
              },
              { enumerable: !0 },
            ),
            Im(Rf, Hm, Rf.entries, { name: 'entries' }),
            Im(
              Rf,
              'toString',
              function () {
                return Jm(this).serialize();
              },
              { enumerable: !0 },
            ),
            Em &&
              vm(Rf, 'size', {
                get: function () {
                  return Jm(this).entries.length;
                },
                configurable: !0,
                enumerable: !0,
              }),
            Am(Af, jm),
            mm(
              { global: !0, constructor: !0, forced: !Sm },
              { URLSearchParams: Af },
            ),
            !Sm && km(Xm))
          ) {
            var Cf = Tm(Zm.has),
              bf = Tm(Zm.set),
              kf = function (e) {
                if (Pm(e)) {
                  var t,
                    i = e.body;
                  if (Om(i) === jm)
                    return (
                      (t = e.headers ? new Xm(e.headers) : new Xm()),
                      Cf(t, 'content-type') ||
                        bf(
                          t,
                          'content-type',
                          'application/x-www-form-urlencoded;charset=UTF-8',
                        ),
                      Mm(e, { body: Vm(0, Lm(i)), headers: Vm(0, t) })
                    );
                }
                return e;
              };
            if (
              (km(qm) &&
                mm(
                  {
                    global: !0,
                    enumerable: !0,
                    dontCallGetSet: !0,
                    forced: !0,
                  },
                  {
                    fetch: function (e) {
                      return qm(
                        e,
                        arguments.length > 1 ? kf(arguments[1]) : {},
                      );
                    },
                  },
                ),
              km(Qm))
            ) {
              var Nf = function (e) {
                return (
                  bm(this, $m),
                  new Qm(e, arguments.length > 1 ? kf(arguments[1]) : {})
                );
              };
              ($m.constructor = Nf),
                (Nf.prototype = $m),
                mm(
                  {
                    global: !0,
                    constructor: !0,
                    dontCallGetSet: !0,
                    forced: !0,
                  },
                  { Request: Nf },
                );
            }
          }
          var Df = { URLSearchParams: Af, getState: Jm },
            Of = '\t\n\v\f\r                　\u2028\u2029\ufeff',
            wf = I,
            Pf = fu,
            Lf = Of,
            Mf = c(''.replace),
            Vf = RegExp('^[' + Lf + ']+'),
            xf = RegExp('(^|[^' + Lf + '])[' + Lf + ']+$'),
            Uf = function (e) {
              return function (t) {
                var i = Pf(wf(t));
                return (
                  1 & e && (i = Mf(i, Vf, '')),
                  2 & e && (i = Mf(i, xf, '$1')),
                  i
                );
              };
            },
            Ff = { start: Uf(1), end: Uf(2), trim: Uf(3) },
            Bf = Dn.PROPER,
            Hf = i,
            jf = Of,
            Gf = Ff.trim;
          xr(
            {
              target: 'String',
              proto: !0,
              forced: (function (e) {
                return Hf(function () {
                  return (
                    !!jf[e]() || '​᠎' !== '​᠎'[e]() || (Bf && jf[e].name !== e)
                  );
                });
              })('trim'),
            },
            {
              trim: function () {
                return Gf(this);
              },
            },
          );
          var Wf = xr,
            Jf = ke,
            Kf = c,
            Yf = G,
            zf = Ee,
            qf = Ge,
            Qf = fu,
            Xf = Is,
            $f = Sr,
            Zf = C.Symbol,
            eg = Zf && Zf.prototype;
          if (
            Jf &&
            zf(Zf) &&
            (!('description' in eg) || void 0 !== Zf().description)
          ) {
            var tg = {},
              ig = function () {
                var e =
                    arguments.length < 1 || void 0 === arguments[0]
                      ? void 0
                      : Qf(arguments[0]),
                  t = qf(eg, this) ? new Zf(e) : void 0 === e ? Zf() : Zf(e);
                return '' === e && (tg[t] = !0), t;
              };
            $f(ig, Zf), (ig.prototype = eg), (eg.constructor = ig);
            var ng = 'Symbol(test)' == String(Zf('test')),
              rg = Kf(eg.valueOf),
              og = Kf(eg.toString),
              sg = /^Symbol\((.*)\)[^)]+$/,
              ag = Kf(''.replace),
              cg = Kf(''.slice);
            Xf(eg, 'description', {
              configurable: !0,
              get: function () {
                var e = rg(this);
                if (Yf(tg, e)) return '';
                var t = og(e),
                  i = ng ? cg(t, 7, -1) : ag(t, sg, '$1');
                return '' === i ? void 0 : i;
              },
            }),
              Wf({ global: !0, constructor: !0, forced: !0 }, { Symbol: ig });
          }
          var lg = Fp.charAt,
            dg = fu,
            ug = cn,
            hg = jo,
            pg = Go,
            _g = 'String Iterator',
            mg = ug.set,
            fg = ug.getterFor(_g);
          hg(
            String,
            'String',
            function (e) {
              mg(this, { type: _g, string: dg(e), index: 0 });
            },
            function () {
              var e,
                t = fg(this),
                i = t.string,
                n = t.index;
              return n >= i.length
                ? pg(void 0, !0)
                : ((e = lg(i, n)), (t.index += e.length), pg(e, !1));
            },
          );
          var gg,
            Tg = ke,
            Eg = c,
            Sg = Fe,
            Ig = i,
            vg = oi,
            yg = sr,
            Ag = dn,
            Rg = B,
            Cg = g,
            bg = Object.assign,
            kg = Object.defineProperty,
            Ng = Eg([].concat),
            Dg =
              !bg ||
              Ig(function () {
                if (
                  Tg &&
                  1 !==
                    bg(
                      { b: 1 },
                      bg(
                        kg({}, 'a', {
                          enumerable: !0,
                          get: function () {
                            kg(this, 'b', { value: 3, enumerable: !1 });
                          },
                        }),
                        { b: 2 },
                      ),
                    ).b
                )
                  return !0;
                var e = {},
                  t = {},
                  i = Symbol(),
                  n = 'abcdefghijklmnopqrst';
                return (
                  (e[i] = 7),
                  n.split('').forEach(function (e) {
                    t[e] = e;
                  }),
                  7 != bg({}, e)[i] || vg(bg({}, t)).join('') != n
                );
              })
                ? function (e, t) {
                    for (
                      var i = Rg(e),
                        n = arguments.length,
                        r = 1,
                        o = yg.f,
                        s = Ag.f;
                      n > r;

                    )
                      for (
                        var a,
                          c = Cg(arguments[r++]),
                          l = o ? Ng(vg(c), o(c)) : vg(c),
                          d = l.length,
                          u = 0;
                        d > u;

                      )
                        (a = l[u++]), (Tg && !Sg(s, c, a)) || (i[a] = c[a]);
                    return i;
                  }
                : bg,
            Og = Ce,
            wg = ud,
            Pg = va,
            Lg = Fe,
            Mg = B,
            Vg = function (e, t, i, n) {
              try {
                return n ? t(Og(i)[0], i[1]) : t(i);
              } catch (IU) {
                wg(e, 'throw', IU);
              }
            },
            xg = zl,
            Ug = ta,
            Fg = Gt,
            Bg = im,
            Hg = ad,
            jg = ed,
            Gg = Array,
            Wg = c,
            Jg = 2147483647,
            Kg = /[^\0-\u007E]/,
            Yg = /[.\u3002\uFF0E\uFF61]/g,
            zg = 'Overflow: input needs wider integers to process',
            qg = RangeError,
            Qg = Wg(Yg.exec),
            Xg = Math.floor,
            $g = String.fromCharCode,
            Zg = Wg(''.charCodeAt),
            eT = Wg([].join),
            tT = Wg([].push),
            iT = Wg(''.replace),
            nT = Wg(''.split),
            rT = Wg(''.toLowerCase),
            oT = function (e) {
              return e + 22 + 75 * (e < 26);
            },
            sT = function (e, t, i) {
              var n = 0;
              for (e = i ? Xg(e / 700) : e >> 1, e += Xg(e / t); e > 455; )
                (e = Xg(e / 35)), (n += 36);
              return Xg(n + (36 * e) / (e + 38));
            },
            aT = function (e) {
              var t = [];
              e = (function (e) {
                for (var t = [], i = 0, n = e.length; i < n; ) {
                  var r = Zg(e, i++);
                  if (r >= 55296 && r <= 56319 && i < n) {
                    var o = Zg(e, i++);
                    56320 == (64512 & o)
                      ? tT(t, ((1023 & r) << 10) + (1023 & o) + 65536)
                      : (tT(t, r), i--);
                  } else tT(t, r);
                }
                return t;
              })(e);
              var i,
                n,
                r = e.length,
                o = 128,
                s = 0,
                a = 72;
              for (i = 0; i < e.length; i++) (n = e[i]) < 128 && tT(t, $g(n));
              var c = t.length,
                l = c;
              for (c && tT(t, '-'); l < r; ) {
                var d = Jg;
                for (i = 0; i < e.length; i++)
                  (n = e[i]) >= o && n < d && (d = n);
                var u = l + 1;
                if (d - o > Xg((Jg - s) / u)) throw qg(zg);
                for (s += (d - o) * u, o = d, i = 0; i < e.length; i++) {
                  if ((n = e[i]) < o && ++s > Jg) throw qg(zg);
                  if (n == o) {
                    for (var h = s, p = 36; ; ) {
                      var _ = p <= a ? 1 : p >= a + 26 ? 26 : p - a;
                      if (h < _) break;
                      var m = h - _,
                        f = 36 - _;
                      tT(t, $g(oT(_ + (m % f)))), (h = Xg(m / f)), (p += 36);
                    }
                    tT(t, $g(oT(h))), (a = sT(s, u, l == c)), (s = 0), l++;
                  }
                }
                s++, o++;
              }
              return eT(t, '');
            },
            cT = xr,
            lT = ke,
            dT = Q_,
            uT = C,
            hT = va,
            pT = c,
            _T = ir,
            mT = Is,
            fT = Ns,
            gT = G,
            TT = Dg,
            ET = function (e) {
              var t = Mg(e),
                i = Ug(this),
                n = arguments.length,
                r = n > 1 ? arguments[1] : void 0,
                o = void 0 !== r;
              o && (r = Pg(r, n > 2 ? arguments[2] : void 0));
              var s,
                a,
                c,
                l,
                d,
                u,
                h = jg(t),
                p = 0;
              if (!h || (this === Gg && xg(h)))
                for (s = Fg(t), a = i ? new this(s) : Gg(s); s > p; p++)
                  (u = o ? r(t[p], p) : t[p]), Bg(a, p, u);
              else
                for (
                  d = (l = Hg(t, h)).next, a = i ? new this() : [];
                  !(c = Lg(d, l)).done;
                  p++
                )
                  (u = o ? Vg(l, r, [c.value, p], !0) : c.value), Bg(a, p, u);
              return (a.length = p), a;
            },
            ST = cm,
            IT = Fp.codeAt,
            vT = function (e) {
              var t,
                i,
                n = [],
                r = nT(iT(rT(e), Yg, '.'), '.');
              for (t = 0; t < r.length; t++)
                (i = r[t]), tT(n, Qg(Kg, i) ? 'xn--' + aT(i) : i);
              return eT(n, '.');
            },
            yT = fu,
            AT = oo,
            RT = Ra,
            CT = Df,
            bT = cn,
            kT = bT.set,
            NT = bT.getterFor('URL'),
            DT = CT.URLSearchParams,
            OT = CT.getState,
            wT = uT.URL,
            PT = uT.TypeError,
            LT = uT.parseInt,
            MT = Math.floor,
            VT = Math.pow,
            xT = pT(''.charAt),
            UT = pT(/./.exec),
            FT = pT([].join),
            BT = pT((1).toString),
            HT = pT([].pop),
            jT = pT([].push),
            GT = pT(''.replace),
            WT = pT([].shift),
            JT = pT(''.split),
            KT = pT(''.slice),
            YT = pT(''.toLowerCase),
            zT = pT([].unshift),
            qT = 'Invalid scheme',
            QT = 'Invalid host',
            XT = 'Invalid port',
            $T = /[a-z]/i,
            ZT = /[\d+-.a-z]/i,
            eE = /\d/,
            tE = /^0x/i,
            iE = /^[0-7]+$/,
            nE = /^\d+$/,
            rE = /^[\da-f]+$/i,
            oE = /[\0\t\n\r #%/:<>?@[\\\]^|]/,
            sE = /[\0\t\n\r #/:<>?@[\\\]^|]/,
            aE = /^[\u0000-\u0020]+/,
            cE = /(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,
            lE = /[\t\n\r]/g,
            dE = function (e) {
              var t, i, n, r;
              if ('number' == typeof e) {
                for (t = [], i = 0; i < 4; i++)
                  zT(t, e % 256), (e = MT(e / 256));
                return FT(t, '.');
              }
              if ('object' == typeof e) {
                for (
                  t = '',
                    n = (function (e) {
                      for (
                        var t = null, i = 1, n = null, r = 0, o = 0;
                        o < 8;
                        o++
                      )
                        0 !== e[o]
                          ? (r > i && ((t = n), (i = r)), (n = null), (r = 0))
                          : (null === n && (n = o), ++r);
                      return r > i && ((t = n), (i = r)), t;
                    })(e),
                    i = 0;
                  i < 8;
                  i++
                )
                  (r && 0 === e[i]) ||
                    (r && (r = !1),
                    n === i
                      ? ((t += i ? ':' : '::'), (r = !0))
                      : ((t += BT(e[i], 16)), i < 7 && (t += ':')));
                return '[' + t + ']';
              }
              return e;
            },
            uE = {},
            hE = TT({}, uE, { ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1 }),
            pE = TT({}, hE, { '#': 1, '?': 1, '{': 1, '}': 1 }),
            _E = TT({}, pE, {
              '/': 1,
              ':': 1,
              ';': 1,
              '=': 1,
              '@': 1,
              '[': 1,
              '\\': 1,
              ']': 1,
              '^': 1,
              '|': 1,
            }),
            mE = function (e, t) {
              var i = IT(e, 0);
              return i > 32 && i < 127 && !gT(t, e) ? e : encodeURIComponent(e);
            },
            fE = {
              ftp: 21,
              file: null,
              http: 80,
              https: 443,
              ws: 80,
              wss: 443,
            },
            gE = function (e, t) {
              var i;
              return (
                2 == e.length &&
                UT($T, xT(e, 0)) &&
                (':' == (i = xT(e, 1)) || (!t && '|' == i))
              );
            },
            TE = function (e) {
              var t;
              return (
                e.length > 1 &&
                gE(KT(e, 0, 2)) &&
                (2 == e.length ||
                  '/' === (t = xT(e, 2)) ||
                  '\\' === t ||
                  '?' === t ||
                  '#' === t)
              );
            },
            EE = function (e) {
              return '.' === e || '%2e' === YT(e);
            },
            SE = {},
            IE = {},
            vE = {},
            yE = {},
            AE = {},
            RE = {},
            CE = {},
            bE = {},
            kE = {},
            NE = {},
            DE = {},
            OE = {},
            wE = {},
            PE = {},
            LE = {},
            ME = {},
            VE = {},
            xE = {},
            UE = {},
            FE = {},
            BE = {},
            HE = function (e, t, i) {
              var n,
                r,
                o,
                s = yT(e);
              if (t) {
                if ((r = this.parse(s))) throw PT(r);
                this.searchParams = null;
              } else {
                if (
                  (void 0 !== i && (n = new HE(i, !0)),
                  (r = this.parse(s, null, n)))
                )
                  throw PT(r);
                (o = OT(new DT())).bindURL(this), (this.searchParams = o);
              }
            };
          HE.prototype = {
            type: 'URL',
            parse: function (e, t, i) {
              var n,
                r,
                o,
                s,
                a,
                c = this,
                l = t || SE,
                d = 0,
                u = '',
                h = !1,
                p = !1,
                _ = !1;
              for (
                e = yT(e),
                  t ||
                    ((c.scheme = ''),
                    (c.username = ''),
                    (c.password = ''),
                    (c.host = null),
                    (c.port = null),
                    (c.path = []),
                    (c.query = null),
                    (c.fragment = null),
                    (c.cannotBeABaseURL = !1),
                    (e = GT(e, aE, '')),
                    (e = GT(e, cE, '$1'))),
                  e = GT(e, lE, ''),
                  n = ET(e);
                d <= n.length;

              ) {
                switch (((r = n[d]), l)) {
                  case SE:
                    if (!r || !UT($T, r)) {
                      if (t) return qT;
                      l = vE;
                      continue;
                    }
                    (u += YT(r)), (l = IE);
                    break;
                  case IE:
                    if (r && (UT(ZT, r) || '+' == r || '-' == r || '.' == r))
                      u += YT(r);
                    else {
                      if (':' != r) {
                        if (t) return qT;
                        (u = ''), (l = vE), (d = 0);
                        continue;
                      }
                      if (
                        t &&
                        (c.isSpecial() != gT(fE, u) ||
                          ('file' == u &&
                            (c.includesCredentials() || null !== c.port)) ||
                          ('file' == c.scheme && !c.host))
                      )
                        return;
                      if (((c.scheme = u), t))
                        return void (
                          c.isSpecial() &&
                          fE[c.scheme] == c.port &&
                          (c.port = null)
                        );
                      (u = ''),
                        'file' == c.scheme
                          ? (l = PE)
                          : c.isSpecial() && i && i.scheme == c.scheme
                          ? (l = yE)
                          : c.isSpecial()
                          ? (l = bE)
                          : '/' == n[d + 1]
                          ? ((l = AE), d++)
                          : ((c.cannotBeABaseURL = !0),
                            jT(c.path, ''),
                            (l = UE));
                    }
                    break;
                  case vE:
                    if (!i || (i.cannotBeABaseURL && '#' != r)) return qT;
                    if (i.cannotBeABaseURL && '#' == r) {
                      (c.scheme = i.scheme),
                        (c.path = ST(i.path)),
                        (c.query = i.query),
                        (c.fragment = ''),
                        (c.cannotBeABaseURL = !0),
                        (l = BE);
                      break;
                    }
                    l = 'file' == i.scheme ? PE : RE;
                    continue;
                  case yE:
                    if ('/' != r || '/' != n[d + 1]) {
                      l = RE;
                      continue;
                    }
                    (l = kE), d++;
                    break;
                  case AE:
                    if ('/' == r) {
                      l = NE;
                      break;
                    }
                    l = xE;
                    continue;
                  case RE:
                    if (((c.scheme = i.scheme), r == gg))
                      (c.username = i.username),
                        (c.password = i.password),
                        (c.host = i.host),
                        (c.port = i.port),
                        (c.path = ST(i.path)),
                        (c.query = i.query);
                    else if ('/' == r || ('\\' == r && c.isSpecial())) l = CE;
                    else if ('?' == r)
                      (c.username = i.username),
                        (c.password = i.password),
                        (c.host = i.host),
                        (c.port = i.port),
                        (c.path = ST(i.path)),
                        (c.query = ''),
                        (l = FE);
                    else {
                      if ('#' != r) {
                        (c.username = i.username),
                          (c.password = i.password),
                          (c.host = i.host),
                          (c.port = i.port),
                          (c.path = ST(i.path)),
                          c.path.length--,
                          (l = xE);
                        continue;
                      }
                      (c.username = i.username),
                        (c.password = i.password),
                        (c.host = i.host),
                        (c.port = i.port),
                        (c.path = ST(i.path)),
                        (c.query = i.query),
                        (c.fragment = ''),
                        (l = BE);
                    }
                    break;
                  case CE:
                    if (!c.isSpecial() || ('/' != r && '\\' != r)) {
                      if ('/' != r) {
                        (c.username = i.username),
                          (c.password = i.password),
                          (c.host = i.host),
                          (c.port = i.port),
                          (l = xE);
                        continue;
                      }
                      l = NE;
                    } else l = kE;
                    break;
                  case bE:
                    if (((l = kE), '/' != r || '/' != xT(u, d + 1))) continue;
                    d++;
                    break;
                  case kE:
                    if ('/' != r && '\\' != r) {
                      l = NE;
                      continue;
                    }
                    break;
                  case NE:
                    if ('@' == r) {
                      h && (u = '%40' + u), (h = !0), (o = ET(u));
                      for (var m = 0; m < o.length; m++) {
                        var f = o[m];
                        if (':' != f || _) {
                          var g = mE(f, _E);
                          _ ? (c.password += g) : (c.username += g);
                        } else _ = !0;
                      }
                      u = '';
                    } else if (
                      r == gg ||
                      '/' == r ||
                      '?' == r ||
                      '#' == r ||
                      ('\\' == r && c.isSpecial())
                    ) {
                      if (h && '' == u) return 'Invalid authority';
                      (d -= ET(u).length + 1), (u = ''), (l = DE);
                    } else u += r;
                    break;
                  case DE:
                  case OE:
                    if (t && 'file' == c.scheme) {
                      l = ME;
                      continue;
                    }
                    if (':' != r || p) {
                      if (
                        r == gg ||
                        '/' == r ||
                        '?' == r ||
                        '#' == r ||
                        ('\\' == r && c.isSpecial())
                      ) {
                        if (c.isSpecial() && '' == u) return QT;
                        if (
                          t &&
                          '' == u &&
                          (c.includesCredentials() || null !== c.port)
                        )
                          return;
                        if ((s = c.parseHost(u))) return s;
                        if (((u = ''), (l = VE), t)) return;
                        continue;
                      }
                      '[' == r ? (p = !0) : ']' == r && (p = !1), (u += r);
                    } else {
                      if ('' == u) return QT;
                      if ((s = c.parseHost(u))) return s;
                      if (((u = ''), (l = wE), t == OE)) return;
                    }
                    break;
                  case wE:
                    if (!UT(eE, r)) {
                      if (
                        r == gg ||
                        '/' == r ||
                        '?' == r ||
                        '#' == r ||
                        ('\\' == r && c.isSpecial()) ||
                        t
                      ) {
                        if ('' != u) {
                          var T = LT(u, 10);
                          if (T > 65535) return XT;
                          (c.port =
                            c.isSpecial() && T === fE[c.scheme] ? null : T),
                            (u = '');
                        }
                        if (t) return;
                        l = VE;
                        continue;
                      }
                      return XT;
                    }
                    u += r;
                    break;
                  case PE:
                    if (((c.scheme = 'file'), '/' == r || '\\' == r)) l = LE;
                    else {
                      if (!i || 'file' != i.scheme) {
                        l = xE;
                        continue;
                      }
                      if (r == gg)
                        (c.host = i.host),
                          (c.path = ST(i.path)),
                          (c.query = i.query);
                      else if ('?' == r)
                        (c.host = i.host),
                          (c.path = ST(i.path)),
                          (c.query = ''),
                          (l = FE);
                      else {
                        if ('#' != r) {
                          TE(FT(ST(n, d), '')) ||
                            ((c.host = i.host),
                            (c.path = ST(i.path)),
                            c.shortenPath()),
                            (l = xE);
                          continue;
                        }
                        (c.host = i.host),
                          (c.path = ST(i.path)),
                          (c.query = i.query),
                          (c.fragment = ''),
                          (l = BE);
                      }
                    }
                    break;
                  case LE:
                    if ('/' == r || '\\' == r) {
                      l = ME;
                      break;
                    }
                    i &&
                      'file' == i.scheme &&
                      !TE(FT(ST(n, d), '')) &&
                      (gE(i.path[0], !0)
                        ? jT(c.path, i.path[0])
                        : (c.host = i.host)),
                      (l = xE);
                    continue;
                  case ME:
                    if (
                      r == gg ||
                      '/' == r ||
                      '\\' == r ||
                      '?' == r ||
                      '#' == r
                    ) {
                      if (!t && gE(u)) l = xE;
                      else if ('' == u) {
                        if (((c.host = ''), t)) return;
                        l = VE;
                      } else {
                        if ((s = c.parseHost(u))) return s;
                        if (('localhost' == c.host && (c.host = ''), t)) return;
                        (u = ''), (l = VE);
                      }
                      continue;
                    }
                    u += r;
                    break;
                  case VE:
                    if (c.isSpecial()) {
                      if (((l = xE), '/' != r && '\\' != r)) continue;
                    } else if (t || '?' != r)
                      if (t || '#' != r) {
                        if (r != gg && ((l = xE), '/' != r)) continue;
                      } else (c.fragment = ''), (l = BE);
                    else (c.query = ''), (l = FE);
                    break;
                  case xE:
                    if (
                      r == gg ||
                      '/' == r ||
                      ('\\' == r && c.isSpecial()) ||
                      (!t && ('?' == r || '#' == r))
                    ) {
                      if (
                        ('..' === (a = YT((a = u))) ||
                        '%2e.' === a ||
                        '.%2e' === a ||
                        '%2e%2e' === a
                          ? (c.shortenPath(),
                            '/' == r ||
                              ('\\' == r && c.isSpecial()) ||
                              jT(c.path, ''))
                          : EE(u)
                          ? '/' == r ||
                            ('\\' == r && c.isSpecial()) ||
                            jT(c.path, '')
                          : ('file' == c.scheme &&
                              !c.path.length &&
                              gE(u) &&
                              (c.host && (c.host = ''), (u = xT(u, 0) + ':')),
                            jT(c.path, u)),
                        (u = ''),
                        'file' == c.scheme && (r == gg || '?' == r || '#' == r))
                      )
                        for (; c.path.length > 1 && '' === c.path[0]; )
                          WT(c.path);
                      '?' == r
                        ? ((c.query = ''), (l = FE))
                        : '#' == r && ((c.fragment = ''), (l = BE));
                    } else u += mE(r, pE);
                    break;
                  case UE:
                    '?' == r
                      ? ((c.query = ''), (l = FE))
                      : '#' == r
                      ? ((c.fragment = ''), (l = BE))
                      : r != gg && (c.path[0] += mE(r, uE));
                    break;
                  case FE:
                    t || '#' != r
                      ? r != gg &&
                        ("'" == r && c.isSpecial()
                          ? (c.query += '%27')
                          : (c.query += '#' == r ? '%23' : mE(r, uE)))
                      : ((c.fragment = ''), (l = BE));
                    break;
                  case BE:
                    r != gg && (c.fragment += mE(r, hE));
                }
                d++;
              }
            },
            parseHost: function (e) {
              var t, i, n;
              if ('[' == xT(e, 0)) {
                if (']' != xT(e, e.length - 1)) return QT;
                if (
                  ((t = (function (e) {
                    var t,
                      i,
                      n,
                      r,
                      o,
                      s,
                      a,
                      c = [0, 0, 0, 0, 0, 0, 0, 0],
                      l = 0,
                      d = null,
                      u = 0,
                      h = function () {
                        return xT(e, u);
                      };
                    if (':' == h()) {
                      if (':' != xT(e, 1)) return;
                      (u += 2), (d = ++l);
                    }
                    for (; h(); ) {
                      if (8 == l) return;
                      if (':' != h()) {
                        for (t = i = 0; i < 4 && UT(rE, h()); )
                          (t = 16 * t + LT(h(), 16)), u++, i++;
                        if ('.' == h()) {
                          if (0 == i) return;
                          if (((u -= i), l > 6)) return;
                          for (n = 0; h(); ) {
                            if (((r = null), n > 0)) {
                              if (!('.' == h() && n < 4)) return;
                              u++;
                            }
                            if (!UT(eE, h())) return;
                            for (; UT(eE, h()); ) {
                              if (((o = LT(h(), 10)), null === r)) r = o;
                              else {
                                if (0 == r) return;
                                r = 10 * r + o;
                              }
                              if (r > 255) return;
                              u++;
                            }
                            (c[l] = 256 * c[l] + r),
                              (2 != ++n && 4 != n) || l++;
                          }
                          if (4 != n) return;
                          break;
                        }
                        if (':' == h()) {
                          if ((u++, !h())) return;
                        } else if (h()) return;
                        c[l++] = t;
                      } else {
                        if (null !== d) return;
                        u++, (d = ++l);
                      }
                    }
                    if (null !== d)
                      for (s = l - d, l = 7; 0 != l && s > 0; )
                        (a = c[l]), (c[l--] = c[d + s - 1]), (c[d + --s] = a);
                    else if (8 != l) return;
                    return c;
                  })(KT(e, 1, -1))),
                  !t)
                )
                  return QT;
                this.host = t;
              } else if (this.isSpecial()) {
                if (((e = vT(e)), UT(oE, e))) return QT;
                if (
                  ((t = (function (e) {
                    var t,
                      i,
                      n,
                      r,
                      o,
                      s,
                      a,
                      c = JT(e, '.');
                    if (
                      (c.length && '' == c[c.length - 1] && c.length--,
                      (t = c.length) > 4)
                    )
                      return e;
                    for (i = [], n = 0; n < t; n++) {
                      if ('' == (r = c[n])) return e;
                      if (
                        ((o = 10),
                        r.length > 1 &&
                          '0' == xT(r, 0) &&
                          ((o = UT(tE, r) ? 16 : 8),
                          (r = KT(r, 8 == o ? 1 : 2))),
                        '' === r)
                      )
                        s = 0;
                      else {
                        if (!UT(10 == o ? nE : 8 == o ? iE : rE, r)) return e;
                        s = LT(r, o);
                      }
                      jT(i, s);
                    }
                    for (n = 0; n < t; n++)
                      if (((s = i[n]), n == t - 1)) {
                        if (s >= VT(256, 5 - t)) return null;
                      } else if (s > 255) return null;
                    for (a = HT(i), n = 0; n < i.length; n++)
                      a += i[n] * VT(256, 3 - n);
                    return a;
                  })(e)),
                  null === t)
                )
                  return QT;
                this.host = t;
              } else {
                if (UT(sE, e)) return QT;
                for (t = '', i = ET(e), n = 0; n < i.length; n++)
                  t += mE(i[n], uE);
                this.host = t;
              }
            },
            cannotHaveUsernamePasswordPort: function () {
              return (
                !this.host || this.cannotBeABaseURL || 'file' == this.scheme
              );
            },
            includesCredentials: function () {
              return '' != this.username || '' != this.password;
            },
            isSpecial: function () {
              return gT(fE, this.scheme);
            },
            shortenPath: function () {
              var e = this.path,
                t = e.length;
              !t ||
                ('file' == this.scheme && 1 == t && gE(e[0], !0)) ||
                e.length--;
            },
            serialize: function () {
              var e = this,
                t = e.scheme,
                i = e.username,
                n = e.password,
                r = e.host,
                o = e.port,
                s = e.path,
                a = e.query,
                c = e.fragment,
                l = t + ':';
              return (
                null !== r
                  ? ((l += '//'),
                    e.includesCredentials() &&
                      (l += i + (n ? ':' + n : '') + '@'),
                    (l += dE(r)),
                    null !== o && (l += ':' + o))
                  : 'file' == t && (l += '//'),
                (l += e.cannotBeABaseURL
                  ? s[0]
                  : s.length
                  ? '/' + FT(s, '/')
                  : ''),
                null !== a && (l += '?' + a),
                null !== c && (l += '#' + c),
                l
              );
            },
            setHref: function (e) {
              var t = this.parse(e);
              if (t) throw PT(t);
              this.searchParams.update();
            },
            getOrigin: function () {
              var e = this.scheme,
                t = this.port;
              if ('blob' == e)
                try {
                  return new jE(e.path[0]).origin;
                } catch (IU) {
                  return 'null';
                }
              return 'file' != e && this.isSpecial()
                ? e + '://' + dE(this.host) + (null !== t ? ':' + t : '')
                : 'null';
            },
            getProtocol: function () {
              return this.scheme + ':';
            },
            setProtocol: function (e) {
              this.parse(yT(e) + ':', SE);
            },
            getUsername: function () {
              return this.username;
            },
            setUsername: function (e) {
              var t = ET(yT(e));
              if (!this.cannotHaveUsernamePasswordPort()) {
                this.username = '';
                for (var i = 0; i < t.length; i++)
                  this.username += mE(t[i], _E);
              }
            },
            getPassword: function () {
              return this.password;
            },
            setPassword: function (e) {
              var t = ET(yT(e));
              if (!this.cannotHaveUsernamePasswordPort()) {
                this.password = '';
                for (var i = 0; i < t.length; i++)
                  this.password += mE(t[i], _E);
              }
            },
            getHost: function () {
              var e = this.host,
                t = this.port;
              return null === e ? '' : null === t ? dE(e) : dE(e) + ':' + t;
            },
            setHost: function (e) {
              this.cannotBeABaseURL || this.parse(e, DE);
            },
            getHostname: function () {
              var e = this.host;
              return null === e ? '' : dE(e);
            },
            setHostname: function (e) {
              this.cannotBeABaseURL || this.parse(e, OE);
            },
            getPort: function () {
              var e = this.port;
              return null === e ? '' : yT(e);
            },
            setPort: function (e) {
              this.cannotHaveUsernamePasswordPort() ||
                ('' == (e = yT(e)) ? (this.port = null) : this.parse(e, wE));
            },
            getPathname: function () {
              var e = this.path;
              return this.cannotBeABaseURL
                ? e[0]
                : e.length
                ? '/' + FT(e, '/')
                : '';
            },
            setPathname: function (e) {
              this.cannotBeABaseURL || ((this.path = []), this.parse(e, VE));
            },
            getSearch: function () {
              var e = this.query;
              return e ? '?' + e : '';
            },
            setSearch: function (e) {
              '' == (e = yT(e))
                ? (this.query = null)
                : ('?' == xT(e, 0) && (e = KT(e, 1)),
                  (this.query = ''),
                  this.parse(e, FE)),
                this.searchParams.update();
            },
            getSearchParams: function () {
              return this.searchParams.facade;
            },
            getHash: function () {
              var e = this.fragment;
              return e ? '#' + e : '';
            },
            setHash: function (e) {
              '' != (e = yT(e))
                ? ('#' == xT(e, 0) && (e = KT(e, 1)),
                  (this.fragment = ''),
                  this.parse(e, BE))
                : (this.fragment = null);
            },
            update: function () {
              this.query = this.searchParams.serialize() || null;
            },
          };
          var jE = function (e) {
              var t = fT(this, GE),
                i = RT(arguments.length, 1) > 1 ? arguments[1] : void 0,
                n = kT(t, new HE(e, !1, i));
              lT ||
                ((t.href = n.serialize()),
                (t.origin = n.getOrigin()),
                (t.protocol = n.getProtocol()),
                (t.username = n.getUsername()),
                (t.password = n.getPassword()),
                (t.host = n.getHost()),
                (t.hostname = n.getHostname()),
                (t.port = n.getPort()),
                (t.pathname = n.getPathname()),
                (t.search = n.getSearch()),
                (t.searchParams = n.getSearchParams()),
                (t.hash = n.getHash()));
            },
            GE = jE.prototype,
            WE = function (e, t) {
              return {
                get: function () {
                  return NT(this)[e]();
                },
                set:
                  t &&
                  function (e) {
                    return NT(this)[t](e);
                  },
                configurable: !0,
                enumerable: !0,
              };
            };
          if (
            (lT &&
              (mT(GE, 'href', WE('serialize', 'setHref')),
              mT(GE, 'origin', WE('getOrigin')),
              mT(GE, 'protocol', WE('getProtocol', 'setProtocol')),
              mT(GE, 'username', WE('getUsername', 'setUsername')),
              mT(GE, 'password', WE('getPassword', 'setPassword')),
              mT(GE, 'host', WE('getHost', 'setHost')),
              mT(GE, 'hostname', WE('getHostname', 'setHostname')),
              mT(GE, 'port', WE('getPort', 'setPort')),
              mT(GE, 'pathname', WE('getPathname', 'setPathname')),
              mT(GE, 'search', WE('getSearch', 'setSearch')),
              mT(GE, 'searchParams', WE('getSearchParams')),
              mT(GE, 'hash', WE('getHash', 'setHash'))),
            _T(
              GE,
              'toJSON',
              function () {
                return NT(this).serialize();
              },
              { enumerable: !0 },
            ),
            _T(
              GE,
              'toString',
              function () {
                return NT(this).serialize();
              },
              { enumerable: !0 },
            ),
            wT)
          ) {
            var JE = wT.createObjectURL,
              KE = wT.revokeObjectURL;
            JE && _T(jE, 'createObjectURL', hT(JE, wT)),
              KE && _T(jE, 'revokeObjectURL', hT(KE, wT));
          }
          AT(jE, 'URL'),
            cT(
              { global: !0, constructor: !0, forced: !dT, sham: !lT },
              { URL: jE },
            );
          var YE = xr,
            zE = kc,
            qE = i,
            QE = je,
            XE = Ee,
            $E = da,
            ZE = iu,
            eS = ir,
            tS = zE && zE.prototype;
          if (
            (YE(
              {
                target: 'Promise',
                proto: !0,
                real: !0,
                forced:
                  !!zE &&
                  qE(function () {
                    tS.finally.call({ then: function () {} }, function () {});
                  }),
              },
              {
                finally: function (e) {
                  var t = $E(this, QE('Promise')),
                    i = XE(e);
                  return this.then(
                    i
                      ? function (i) {
                          return ZE(t, e()).then(function () {
                            return i;
                          });
                        }
                      : e,
                    i
                      ? function (i) {
                          return ZE(t, e()).then(function () {
                            throw i;
                          });
                        }
                      : e,
                  );
                },
              },
            ),
            XE(zE))
          ) {
            var iS = QE('Promise').prototype.finally;
            tS.finally !== iS && eS(tS, 'finally', iS, { unsafe: !0 });
          }
          var nS =
              'undefined' != typeof ArrayBuffer &&
              'undefined' != typeof DataView,
            rS = Lt,
            oS = Ht,
            sS = RangeError,
            aS = function (e) {
              if (void 0 === e) return 0;
              var t = rS(e),
                i = oS(t);
              if (t !== i) throw sS('Wrong length or index');
              return i;
            },
            cS = Array,
            lS = Math.abs,
            dS = Math.pow,
            uS = Math.floor,
            hS = Math.log,
            pS = Math.LN2,
            _S = {
              pack: function (e, t, i) {
                var n,
                  r,
                  o,
                  s = cS(i),
                  a = 8 * i - t - 1,
                  c = (1 << a) - 1,
                  l = c >> 1,
                  d = 23 === t ? dS(2, -24) - dS(2, -77) : 0,
                  u = e < 0 || (0 === e && 1 / e < 0) ? 1 : 0,
                  h = 0;
                for (
                  (e = lS(e)) != e || Infinity === e
                    ? ((r = e != e ? 1 : 0), (n = c))
                    : ((n = uS(hS(e) / pS)),
                      e * (o = dS(2, -n)) < 1 && (n--, (o *= 2)),
                      (e += n + l >= 1 ? d / o : d * dS(2, 1 - l)) * o >= 2 &&
                        (n++, (o /= 2)),
                      n + l >= c
                        ? ((r = 0), (n = c))
                        : n + l >= 1
                        ? ((r = (e * o - 1) * dS(2, t)), (n += l))
                        : ((r = e * dS(2, l - 1) * dS(2, t)), (n = 0)));
                  t >= 8;

                )
                  (s[h++] = 255 & r), (r /= 256), (t -= 8);
                for (n = (n << t) | r, a += t; a > 0; )
                  (s[h++] = 255 & n), (n /= 256), (a -= 8);
                return (s[--h] |= 128 * u), s;
              },
              unpack: function (e, t) {
                var i,
                  n = e.length,
                  r = 8 * n - t - 1,
                  o = (1 << r) - 1,
                  s = o >> 1,
                  a = r - 7,
                  c = n - 1,
                  l = e[c--],
                  d = 127 & l;
                for (l >>= 7; a > 0; ) (d = 256 * d + e[c--]), (a -= 8);
                for (i = d & ((1 << -a) - 1), d >>= -a, a += t; a > 0; )
                  (i = 256 * i + e[c--]), (a -= 8);
                if (0 === d) d = 1 - s;
                else {
                  if (d === o) return i ? NaN : l ? -Infinity : Infinity;
                  (i += dS(2, t)), (d -= s);
                }
                return (l ? -1 : 1) * i * dS(2, d - t);
              },
            },
            mS = B,
            fS = Ut,
            gS = Gt,
            TS = function (e) {
              for (
                var t = mS(this),
                  i = gS(t),
                  n = arguments.length,
                  r = fS(n > 1 ? arguments[1] : void 0, i),
                  o = n > 2 ? arguments[2] : void 0,
                  s = void 0 === o ? i : fS(o, i);
                s > r;

              )
                t[r++] = e;
              return t;
            },
            ES = C,
            SS = c,
            IS = ke,
            vS = nS,
            yS = Dn,
            AS = Yi,
            RS = Is,
            CS = $_,
            bS = i,
            kS = Ns,
            NS = Lt,
            DS = Ht,
            OS = aS,
            wS = _S,
            PS = Kr,
            LS = vo,
            MS = nr.f,
            VS = TS,
            xS = cm,
            US = oo,
            FS = cn,
            BS = yS.PROPER,
            HS = yS.CONFIGURABLE,
            jS = 'ArrayBuffer',
            GS = 'DataView',
            WS = 'prototype',
            JS = 'Wrong index',
            KS = FS.getterFor(jS),
            YS = FS.getterFor(GS),
            zS = FS.set,
            qS = ES[jS],
            QS = qS,
            XS = QS && QS[WS],
            $S = ES[GS],
            ZS = $S && $S[WS],
            eI = Object.prototype,
            tI = ES.Array,
            iI = ES.RangeError,
            nI = SS(VS),
            rI = SS([].reverse),
            oI = wS.pack,
            sI = wS.unpack,
            aI = function (e) {
              return [255 & e];
            },
            cI = function (e) {
              return [255 & e, (e >> 8) & 255];
            },
            lI = function (e) {
              return [
                255 & e,
                (e >> 8) & 255,
                (e >> 16) & 255,
                (e >> 24) & 255,
              ];
            },
            dI = function (e) {
              return (e[3] << 24) | (e[2] << 16) | (e[1] << 8) | e[0];
            },
            uI = function (e) {
              return oI(e, 23, 4);
            },
            hI = function (e) {
              return oI(e, 52, 8);
            },
            pI = function (e, t, i) {
              RS(e[WS], t, {
                configurable: !0,
                get: function () {
                  return i(this)[t];
                },
              });
            },
            _I = function (e, t, i, n) {
              var r = OS(i),
                o = YS(e);
              if (r + t > o.byteLength) throw iI(JS);
              var s = o.bytes,
                a = r + o.byteOffset,
                c = xS(s, a, a + t);
              return n ? c : rI(c);
            },
            mI = function (e, t, i, n, r, o) {
              var s = OS(i),
                a = YS(e);
              if (s + t > a.byteLength) throw iI(JS);
              for (
                var c = a.bytes, l = s + a.byteOffset, d = n(+r), u = 0;
                u < t;
                u++
              )
                c[l + u] = d[o ? u : t - u - 1];
            };
          if (vS) {
            var fI = BS && qS.name !== jS;
            if (
              bS(function () {
                qS(1);
              }) &&
              bS(function () {
                new qS(-1);
              }) &&
              !bS(function () {
                return (
                  new qS(),
                  new qS(1.5),
                  new qS(NaN),
                  1 != qS.length || (fI && !HS)
                );
              })
            )
              fI && HS && AS(qS, 'name', jS);
            else {
              (QS = function (e) {
                return kS(this, XS), new qS(OS(e));
              })[WS] = XS;
              for (var gI, TI = MS(qS), EI = 0; TI.length > EI; )
                (gI = TI[EI++]) in QS || AS(QS, gI, qS[gI]);
              XS.constructor = QS;
            }
            LS && PS(ZS) !== eI && LS(ZS, eI);
            var SI = new $S(new QS(2)),
              II = SS(ZS.setInt8);
            SI.setInt8(0, 2147483648),
              SI.setInt8(1, 2147483649),
              (!SI.getInt8(0) && SI.getInt8(1)) ||
                CS(
                  ZS,
                  {
                    setInt8: function (e, t) {
                      II(this, e, (t << 24) >> 24);
                    },
                    setUint8: function (e, t) {
                      II(this, e, (t << 24) >> 24);
                    },
                  },
                  { unsafe: !0 },
                );
          } else
            (XS = (QS = function (e) {
              kS(this, XS);
              var t = OS(e);
              zS(this, { type: jS, bytes: nI(tI(t), 0), byteLength: t }),
                IS || ((this.byteLength = t), (this.detached = !1));
            })[WS]),
              (ZS = ($S = function (e, t, i) {
                kS(this, ZS), kS(e, XS);
                var n = KS(e),
                  r = n.byteLength,
                  o = NS(t);
                if (o < 0 || o > r) throw iI('Wrong offset');
                if (o + (i = void 0 === i ? r - o : DS(i)) > r)
                  throw iI('Wrong length');
                zS(this, {
                  type: GS,
                  buffer: e,
                  byteLength: i,
                  byteOffset: o,
                  bytes: n.bytes,
                }),
                  IS ||
                    ((this.buffer = e),
                    (this.byteLength = i),
                    (this.byteOffset = o));
              })[WS]),
              IS &&
                (pI(QS, 'byteLength', KS),
                pI($S, 'buffer', YS),
                pI($S, 'byteLength', YS),
                pI($S, 'byteOffset', YS)),
              CS(ZS, {
                getInt8: function (e) {
                  return (_I(this, 1, e)[0] << 24) >> 24;
                },
                getUint8: function (e) {
                  return _I(this, 1, e)[0];
                },
                getInt16: function (e) {
                  var t = _I(
                    this,
                    2,
                    e,
                    arguments.length > 1 ? arguments[1] : void 0,
                  );
                  return (((t[1] << 8) | t[0]) << 16) >> 16;
                },
                getUint16: function (e) {
                  var t = _I(
                    this,
                    2,
                    e,
                    arguments.length > 1 ? arguments[1] : void 0,
                  );
                  return (t[1] << 8) | t[0];
                },
                getInt32: function (e) {
                  return dI(
                    _I(
                      this,
                      4,
                      e,
                      arguments.length > 1 ? arguments[1] : void 0,
                    ),
                  );
                },
                getUint32: function (e) {
                  return (
                    dI(
                      _I(
                        this,
                        4,
                        e,
                        arguments.length > 1 ? arguments[1] : void 0,
                      ),
                    ) >>> 0
                  );
                },
                getFloat32: function (e) {
                  return sI(
                    _I(
                      this,
                      4,
                      e,
                      arguments.length > 1 ? arguments[1] : void 0,
                    ),
                    23,
                  );
                },
                getFloat64: function (e) {
                  return sI(
                    _I(
                      this,
                      8,
                      e,
                      arguments.length > 1 ? arguments[1] : void 0,
                    ),
                    52,
                  );
                },
                setInt8: function (e, t) {
                  mI(this, 1, e, aI, t);
                },
                setUint8: function (e, t) {
                  mI(this, 1, e, aI, t);
                },
                setInt16: function (e, t) {
                  mI(
                    this,
                    2,
                    e,
                    cI,
                    t,
                    arguments.length > 2 ? arguments[2] : void 0,
                  );
                },
                setUint16: function (e, t) {
                  mI(
                    this,
                    2,
                    e,
                    cI,
                    t,
                    arguments.length > 2 ? arguments[2] : void 0,
                  );
                },
                setInt32: function (e, t) {
                  mI(
                    this,
                    4,
                    e,
                    lI,
                    t,
                    arguments.length > 2 ? arguments[2] : void 0,
                  );
                },
                setUint32: function (e, t) {
                  mI(
                    this,
                    4,
                    e,
                    lI,
                    t,
                    arguments.length > 2 ? arguments[2] : void 0,
                  );
                },
                setFloat32: function (e, t) {
                  mI(
                    this,
                    4,
                    e,
                    uI,
                    t,
                    arguments.length > 2 ? arguments[2] : void 0,
                  );
                },
                setFloat64: function (e, t) {
                  mI(
                    this,
                    8,
                    e,
                    hI,
                    t,
                    arguments.length > 2 ? arguments[2] : void 0,
                  );
                },
              });
          US(QS, jS), US($S, GS);
          var vI = { ArrayBuffer: QS, DataView: $S },
            yI = Cs,
            AI = 'ArrayBuffer',
            RI = vI[AI];
          xr(
            { global: !0, constructor: !0, forced: C[AI] !== RI },
            { ArrayBuffer: RI },
          ),
            yI(AI);
          var CI = xr,
            bI = Ta,
            kI = i,
            NI = Ce,
            DI = Ut,
            OI = Ht,
            wI = da,
            PI = vI.ArrayBuffer,
            LI = vI.DataView,
            MI = LI.prototype,
            VI = bI(PI.prototype.slice),
            xI = bI(MI.getUint8),
            UI = bI(MI.setUint8);
          CI(
            {
              target: 'ArrayBuffer',
              proto: !0,
              unsafe: !0,
              forced: kI(function () {
                return !new PI(2).slice(1, void 0).byteLength;
              }),
            },
            {
              slice: function (e, t) {
                if (VI && void 0 === t) return VI(NI(this), e);
                for (
                  var i = NI(this).byteLength,
                    n = DI(e, i),
                    r = DI(void 0 === t ? i : t, i),
                    o = new (wI(this, PI))(OI(r - n)),
                    s = new LI(this),
                    a = new LI(o),
                    c = 0;
                  n < r;

                )
                  UI(a, c++, xI(s, n++));
                return o;
              },
            },
          );
          var FI,
            BI,
            HI,
            jI = {},
            GI = {
              get exports() {
                return jI;
              },
              set exports(e) {
                jI = e;
              },
            },
            WI = nS,
            JI = ke,
            KI = C,
            YI = Ee,
            zI = ve,
            qI = G,
            QI = xs,
            XI = Qe,
            $I = Yi,
            ZI = ir,
            ev = Is,
            tv = Ge,
            iv = Kr,
            nv = vo,
            rv = me,
            ov = z,
            sv = cn.enforce,
            av = cn.get,
            cv = KI.Int8Array,
            lv = cv && cv.prototype,
            dv = KI.Uint8ClampedArray,
            uv = dv && dv.prototype,
            hv = cv && iv(cv),
            pv = lv && iv(lv),
            _v = Object.prototype,
            mv = KI.TypeError,
            fv = rv('toStringTag'),
            gv = ov('TYPED_ARRAY_TAG'),
            Tv = 'TypedArrayConstructor',
            Ev = WI && !!nv && 'Opera' !== QI(KI.opera),
            Sv = !1,
            Iv = {
              Int8Array: 1,
              Uint8Array: 1,
              Uint8ClampedArray: 1,
              Int16Array: 2,
              Uint16Array: 2,
              Int32Array: 4,
              Uint32Array: 4,
              Float32Array: 4,
              Float64Array: 8,
            },
            vv = { BigInt64Array: 8, BigUint64Array: 8 },
            yv = function (e) {
              var t = iv(e);
              if (zI(t)) {
                var i = av(t);
                return i && qI(i, Tv) ? i[Tv] : yv(t);
              }
            },
            Av = function (e) {
              if (!zI(e)) return !1;
              var t = QI(e);
              return qI(Iv, t) || qI(vv, t);
            };
          for (FI in Iv)
            (HI = (BI = KI[FI]) && BI.prototype)
              ? (sv(HI)[Tv] = BI)
              : (Ev = !1);
          for (FI in vv)
            (HI = (BI = KI[FI]) && BI.prototype) && (sv(HI)[Tv] = BI);
          if (
            (!Ev || !YI(hv) || hv === Function.prototype) &&
            ((hv = function () {
              throw mv('Incorrect invocation');
            }),
            Ev)
          )
            for (FI in Iv) KI[FI] && nv(KI[FI], hv);
          if ((!Ev || !pv || pv === _v) && ((pv = hv.prototype), Ev))
            for (FI in Iv) KI[FI] && nv(KI[FI].prototype, pv);
          if ((Ev && iv(uv) !== pv && nv(uv, pv), JI && !qI(pv, fv)))
            for (FI in ((Sv = !0),
            ev(pv, fv, {
              configurable: !0,
              get: function () {
                return zI(this) ? this[gv] : void 0;
              },
            }),
            Iv))
              KI[FI] && $I(KI[FI], gv, FI);
          var Rv = {
              NATIVE_ARRAY_BUFFER_VIEWS: Ev,
              TYPED_ARRAY_TAG: Sv && gv,
              aTypedArray: function (e) {
                if (Av(e)) return e;
                throw mv('Target is not a typed array');
              },
              aTypedArrayConstructor: function (e) {
                if (YI(e) && (!nv || tv(hv, e))) return e;
                throw mv(XI(e) + ' is not a typed array constructor');
              },
              exportTypedArrayMethod: function (e, t, i, n) {
                if (JI) {
                  if (i)
                    for (var r in Iv) {
                      var o = KI[r];
                      if (o && qI(o.prototype, e))
                        try {
                          delete o.prototype[e];
                        } catch (IU) {
                          try {
                            o.prototype[e] = t;
                          } catch (s) {}
                        }
                    }
                  (pv[e] && !i) || ZI(pv, e, i ? t : (Ev && lv[e]) || t, n);
                }
              },
              exportTypedArrayStaticMethod: function (e, t, i) {
                var n, r;
                if (JI) {
                  if (nv) {
                    if (i)
                      for (n in Iv)
                        if ((r = KI[n]) && qI(r, e))
                          try {
                            delete r[e];
                          } catch (IU) {}
                    if (hv[e] && !i) return;
                    try {
                      return ZI(hv, e, i ? t : (Ev && hv[e]) || t);
                    } catch (IU) {}
                  }
                  for (n in Iv) !(r = KI[n]) || (r[e] && !i) || ZI(r, e, t);
                }
              },
              getTypedArrayConstructor: yv,
              isView: function (e) {
                if (!zI(e)) return !1;
                var t = QI(e);
                return 'DataView' === t || qI(Iv, t) || qI(vv, t);
              },
              isTypedArray: Av,
              TypedArray: hv,
              TypedArrayPrototype: pv,
            },
            Cv = C,
            bv = i,
            kv = Dd,
            Nv = Rv.NATIVE_ARRAY_BUFFER_VIEWS,
            Dv = Cv.ArrayBuffer,
            Ov = Cv.Int8Array,
            wv =
              !Nv ||
              !bv(function () {
                Ov(1);
              }) ||
              !bv(function () {
                new Ov(-1);
              }) ||
              !kv(function (e) {
                new Ov(), new Ov(null), new Ov(1.5), new Ov(e);
              }, !0) ||
              bv(function () {
                return 1 !== new Ov(new Dv(2), 1, void 0).length;
              }),
            Pv = ve,
            Lv = Math.floor,
            Mv =
              Number.isInteger ||
              function (e) {
                return !Pv(e) && isFinite(e) && Lv(e) === e;
              },
            Vv = Lt,
            xv = RangeError,
            Uv = function (e) {
              var t = Vv(e);
              if (t < 0) throw xv("The argument can't be less than 0");
              return t;
            },
            Fv = RangeError,
            Bv = function (e, t) {
              var i = Uv(e);
              if (i % t) throw Fv('Wrong offset');
              return i;
            },
            Hv = xs,
            jv = mt,
            Gv = TypeError,
            Wv = function (e) {
              var t = jv(e, 'number');
              if ('number' == typeof t)
                throw Gv("Can't convert number to bigint");
              return BigInt(t);
            },
            Jv = va,
            Kv = Fe,
            Yv = oa,
            zv = B,
            qv = Gt,
            Qv = ad,
            Xv = ed,
            $v = zl,
            Zv = function (e) {
              var t = Hv(e);
              return 'BigInt64Array' == t || 'BigUint64Array' == t;
            },
            ey = Rv.aTypedArrayConstructor,
            ty = Wv,
            iy = xr,
            ny = C,
            ry = Fe,
            oy = ke,
            sy = wv,
            ay = Rv,
            cy = vI,
            ly = Ns,
            dy = Wi,
            uy = Yi,
            hy = Mv,
            py = Ht,
            _y = aS,
            my = Bv,
            fy = Tt,
            gy = G,
            Ty = xs,
            Ey = ve,
            Sy = ze,
            Iy = Di,
            vy = Ge,
            yy = vo,
            Ay = nr.f,
            Ry = function (e) {
              var t,
                i,
                n,
                r,
                o,
                s,
                a,
                c,
                l = Yv(this),
                d = zv(e),
                u = arguments.length,
                h = u > 1 ? arguments[1] : void 0,
                p = void 0 !== h,
                _ = Xv(d);
              if (_ && !$v(_))
                for (c = (a = Qv(d, _)).next, d = []; !(s = Kv(c, a)).done; )
                  d.push(s.value);
              for (
                p && u > 2 && (h = Jv(h, arguments[2])),
                  i = qv(d),
                  n = new (ey(l))(i),
                  r = Zv(n),
                  t = 0;
                i > t;
                t++
              )
                (o = p ? h(d[t], t) : d[t]), (n[t] = r ? ty(o) : +o);
              return n;
            },
            Cy = rp.forEach,
            by = Cs,
            ky = Is,
            Ny = De,
            Dy = ln,
            Oy = lu,
            wy = cn.get,
            Py = cn.set,
            Ly = cn.enforce,
            My = Ny.f,
            Vy = Dy.f,
            xy = Math.round,
            Uy = ny.RangeError,
            Fy = cy.ArrayBuffer,
            By = Fy.prototype,
            Hy = cy.DataView,
            jy = ay.NATIVE_ARRAY_BUFFER_VIEWS,
            Gy = ay.TYPED_ARRAY_TAG,
            Wy = ay.TypedArray,
            Jy = ay.TypedArrayPrototype,
            Ky = ay.aTypedArrayConstructor,
            Yy = ay.isTypedArray,
            zy = 'BYTES_PER_ELEMENT',
            qy = 'Wrong length',
            Qy = function (e, t) {
              Ky(e);
              for (var i = 0, n = t.length, r = new e(n); n > i; )
                r[i] = t[i++];
              return r;
            },
            Xy = function (e, t) {
              ky(e, t, {
                configurable: !0,
                get: function () {
                  return wy(this)[t];
                },
              });
            },
            $y = function (e) {
              var t;
              return (
                vy(By, e) ||
                'ArrayBuffer' == (t = Ty(e)) ||
                'SharedArrayBuffer' == t
              );
            },
            Zy = function (e, t) {
              return Yy(e) && !Sy(t) && t in e && hy(+t) && t >= 0;
            },
            eA = function (e, t) {
              return (t = fy(t)), Zy(e, t) ? dy(2, e[t]) : Vy(e, t);
            },
            tA = function (e, t, i) {
              return (
                (t = fy(t)),
                !(Zy(e, t) && Ey(i) && gy(i, 'value')) ||
                gy(i, 'get') ||
                gy(i, 'set') ||
                i.configurable ||
                (gy(i, 'writable') && !i.writable) ||
                (gy(i, 'enumerable') && !i.enumerable)
                  ? My(e, t, i)
                  : ((e[t] = i.value), e)
              );
            };
          oy
            ? (jy ||
                ((Dy.f = eA),
                (Ny.f = tA),
                Xy(Jy, 'buffer'),
                Xy(Jy, 'byteOffset'),
                Xy(Jy, 'byteLength'),
                Xy(Jy, 'length')),
              iy(
                { target: 'Object', stat: !0, forced: !jy },
                { getOwnPropertyDescriptor: eA, defineProperty: tA },
              ),
              (GI.exports = function (e, t, i) {
                var n = e.match(/\d+/)[0] / 8,
                  r = e + (i ? 'Clamped' : '') + 'Array',
                  o = 'get' + e,
                  s = 'set' + e,
                  a = ny[r],
                  c = a,
                  l = c && c.prototype,
                  d = {},
                  u = function (e, t) {
                    My(e, t, {
                      get: function () {
                        return (function (e, t) {
                          var i = wy(e);
                          return i.view[o](t * n + i.byteOffset, !0);
                        })(this, t);
                      },
                      set: function (e) {
                        return (function (e, t, r) {
                          var o = wy(e);
                          i &&
                            (r = (r = xy(r)) < 0 ? 0 : r > 255 ? 255 : 255 & r),
                            o.view[s](t * n + o.byteOffset, r, !0);
                        })(this, t, e);
                      },
                      enumerable: !0,
                    });
                  };
                jy
                  ? sy &&
                    ((c = t(function (e, t, i, r) {
                      return (
                        ly(e, l),
                        Oy(
                          Ey(t)
                            ? $y(t)
                              ? void 0 !== r
                                ? new a(t, my(i, n), r)
                                : void 0 !== i
                                ? new a(t, my(i, n))
                                : new a(t)
                              : Yy(t)
                              ? Qy(c, t)
                              : ry(Ry, c, t)
                            : new a(_y(t)),
                          e,
                          c,
                        )
                      );
                    })),
                    yy && yy(c, Wy),
                    Cy(Ay(a), function (e) {
                      e in c || uy(c, e, a[e]);
                    }),
                    (c.prototype = l))
                  : ((c = t(function (e, t, i, r) {
                      ly(e, l);
                      var o,
                        s,
                        a,
                        d = 0,
                        h = 0;
                      if (Ey(t)) {
                        if (!$y(t)) return Yy(t) ? Qy(c, t) : ry(Ry, c, t);
                        (o = t), (h = my(i, n));
                        var p = t.byteLength;
                        if (void 0 === r) {
                          if (p % n) throw Uy(qy);
                          if ((s = p - h) < 0) throw Uy(qy);
                        } else if ((s = py(r) * n) + h > p) throw Uy(qy);
                        a = s / n;
                      } else (a = _y(t)), (o = new Fy((s = a * n)));
                      for (
                        Py(e, {
                          buffer: o,
                          byteOffset: h,
                          byteLength: s,
                          length: a,
                          view: new Hy(o),
                        });
                        d < a;

                      )
                        u(e, d++);
                    })),
                    yy && yy(c, Wy),
                    (l = c.prototype = Iy(Jy))),
                  l.constructor !== c && uy(l, 'constructor', c),
                  (Ly(l).TypedArrayConstructor = c),
                  Gy && uy(l, Gy, r);
                var h = c != a;
                (d[r] = c),
                  iy({ global: !0, constructor: !0, forced: h, sham: !jy }, d),
                  zy in c || uy(c, zy, n),
                  zy in l || uy(l, zy, n),
                  by(r);
              }))
            : (GI.exports = function () {}),
            jI('Float32', function (e) {
              return function (t, i, n) {
                return e(this, t, i, n);
              };
            });
          var iA = TS,
            nA = Wv,
            rA = xs,
            oA = Fe,
            sA = i,
            aA = Rv.aTypedArray,
            cA = Rv.exportTypedArrayMethod,
            lA = c(''.slice);
          cA(
            'fill',
            function (e) {
              var t = arguments.length;
              aA(this);
              var i = 'Big' === lA(rA(this), 0, 3) ? nA(e) : +e;
              return oA(
                iA,
                this,
                i,
                t > 1 ? arguments[1] : void 0,
                t > 2 ? arguments[2] : void 0,
              );
            },
            sA(function () {
              var e = 0;
              return (
                new Int8Array(2).fill({
                  valueOf: function () {
                    return e++;
                  },
                }),
                1 !== e
              );
            }),
          );
          var dA = C,
            uA = Fe,
            hA = Rv,
            pA = Gt,
            _A = Bv,
            mA = B,
            fA = i,
            gA = dA.RangeError,
            TA = dA.Int8Array,
            EA = TA && TA.prototype,
            SA = EA && EA.set,
            IA = hA.aTypedArray,
            vA = hA.exportTypedArrayMethod,
            yA = !fA(function () {
              var e = new Uint8ClampedArray(2);
              return uA(SA, e, { length: 1, 0: 3 }, 1), 3 !== e[1];
            }),
            AA =
              yA &&
              hA.NATIVE_ARRAY_BUFFER_VIEWS &&
              fA(function () {
                var e = new TA(2);
                return e.set(1), e.set('2', 1), 0 !== e[0] || 2 !== e[1];
              });
          vA(
            'set',
            function (e) {
              IA(this);
              var t = _A(arguments.length > 1 ? arguments[1] : void 0, 1),
                i = mA(e);
              if (yA) return uA(SA, this, i, t);
              var n = this.length,
                r = pA(i),
                o = 0;
              if (r + t > n) throw gA('Wrong length');
              for (; o < r; ) this[t + o] = i[o++];
            },
            !yA || AA,
          );
          var RA = q.match(/firefox\/(\d+)/i),
            CA = !!RA && +RA[1],
            bA = /MSIE|Trident/.test(q),
            kA = q.match(/AppleWebKit\/(\d+)\./),
            NA = !!kA && +kA[1],
            DA = Ta,
            OA = i,
            wA = et,
            PA = _m,
            LA = CA,
            MA = bA,
            VA = ie,
            xA = NA,
            UA = Rv.aTypedArray,
            FA = Rv.exportTypedArrayMethod,
            BA = C.Uint16Array,
            HA = BA && DA(BA.prototype.sort),
            jA = !(
              !HA ||
              (OA(function () {
                HA(new BA(2), null);
              }) &&
                OA(function () {
                  HA(new BA(2), {});
                }))
            ),
            GA =
              !!HA &&
              !OA(function () {
                if (VA) return VA < 74;
                if (LA) return LA < 67;
                if (MA) return !0;
                if (xA) return xA < 602;
                var e,
                  t,
                  i = new BA(516),
                  n = Array(516);
                for (e = 0; e < 516; e++)
                  (t = e % 4), (i[e] = 515 - e), (n[e] = e - 2 * t + 3);
                for (
                  HA(i, function (e, t) {
                    return ((e / 4) | 0) - ((t / 4) | 0);
                  }),
                    e = 0;
                  e < 516;
                  e++
                )
                  if (i[e] !== n[e]) return !0;
              });
          FA(
            'sort',
            function (e) {
              return (
                void 0 !== e && wA(e),
                GA
                  ? HA(this, e)
                  : PA(
                      UA(this),
                      (function (e) {
                        return function (t, i) {
                          return void 0 !== e
                            ? +e(t, i) || 0
                            : i != i
                            ? -1
                            : t != t
                            ? 1
                            : 0 === t && 0 === i
                            ? 1 / t > 0 && 1 / i < 0
                              ? 1
                              : -1
                            : t > i;
                        };
                      })(e),
                    )
              );
            },
            !GA || jA,
          );
          var WA = Qe,
            JA = TypeError,
            KA = xr,
            YA = c,
            zA = et,
            qA = B,
            QA = Gt,
            XA = function (e, t) {
              if (!delete e[t])
                throw JA('Cannot delete property ' + WA(t) + ' of ' + WA(e));
            },
            $A = fu,
            ZA = i,
            eR = _m,
            tR = sp,
            iR = CA,
            nR = bA,
            rR = ie,
            oR = NA,
            sR = [],
            aR = YA(sR.sort),
            cR = YA(sR.push),
            lR = ZA(function () {
              sR.sort(void 0);
            }),
            dR = ZA(function () {
              sR.sort(null);
            }),
            uR = tR('sort'),
            hR = !ZA(function () {
              if (rR) return rR < 70;
              if (!(iR && iR > 3)) {
                if (nR) return !0;
                if (oR) return oR < 603;
                var e,
                  t,
                  i,
                  n,
                  r = '';
                for (e = 65; e < 76; e++) {
                  switch (((t = String.fromCharCode(e)), e)) {
                    case 66:
                    case 69:
                    case 70:
                    case 72:
                      i = 3;
                      break;
                    case 68:
                    case 71:
                      i = 4;
                      break;
                    default:
                      i = 2;
                  }
                  for (n = 0; n < 47; n++) sR.push({ k: t + n, v: i });
                }
                for (
                  sR.sort(function (e, t) {
                    return t.v - e.v;
                  }),
                    n = 0;
                  n < sR.length;
                  n++
                )
                  (t = sR[n].k.charAt(0)),
                    r.charAt(r.length - 1) !== t && (r += t);
                return 'DGBEFHACIJK' !== r;
              }
            });
          KA(
            { target: 'Array', proto: !0, forced: lR || !dR || !uR || !hR },
            {
              sort: function (e) {
                void 0 !== e && zA(e);
                var t = qA(this);
                if (hR) return void 0 === e ? aR(t) : aR(t, e);
                var i,
                  n,
                  r = [],
                  o = QA(t);
                for (n = 0; n < o; n++) n in t && cR(r, t[n]);
                for (
                  eR(
                    r,
                    (function (e) {
                      return function (t, i) {
                        return void 0 === i
                          ? -1
                          : void 0 === t
                          ? 1
                          : void 0 !== e
                          ? +e(t, i) || 0
                          : $A(t) > $A(i)
                          ? 1
                          : -1;
                      };
                    })(e),
                  ),
                    i = QA(r),
                    n = 0;
                  n < i;

                )
                  t[n] = r[n++];
                for (; n < o; ) XA(t, n++);
                return t;
              },
            },
          ),
            jI('Uint8', function (e) {
              return function (t, i, n) {
                return e(this, t, i, n);
              };
            });
          var pR = xr,
            _R = Wh,
            mR = c([].reverse),
            fR = [1, 2];
          pR(
            {
              target: 'Array',
              proto: !0,
              forced: String(fR) === String(fR.reverse()),
            },
            {
              reverse: function () {
                return _R(this) && (this.length = this.length), mR(this);
              },
            },
          );
          var gR = xr,
            TR = Fe,
            ER = c,
            SR = I,
            IR = Ee,
            vR = T,
            yR = pu,
            AR = fu,
            RR = nt,
            CR = Au,
            bR = qp,
            kR = me('replace'),
            NR = TypeError,
            DR = ER(''.indexOf);
          ER(''.replace);
          var OR = ER(''.slice),
            wR = Math.max,
            PR = function (e, t, i) {
              return i > e.length ? -1 : '' === t ? i : DR(e, t, i);
            };
          gR(
            { target: 'String', proto: !0 },
            {
              replaceAll: function (e, t) {
                var i,
                  n,
                  r,
                  o,
                  s,
                  a,
                  c,
                  l,
                  d = SR(this),
                  u = 0,
                  h = 0,
                  p = '';
                if (!vR(e)) {
                  if (yR(e) && ((i = AR(SR(CR(e)))), !~DR(i, 'g')))
                    throw NR('`.replaceAll` does not allow non-global regexes');
                  if ((n = RR(e, kR))) return TR(n, e, d, t);
                }
                for (
                  r = AR(d),
                    o = AR(e),
                    (s = IR(t)) || (t = AR(t)),
                    a = o.length,
                    c = wR(1, a),
                    u = PR(r, o, 0);
                  -1 !== u;

                )
                  (l = s ? AR(t(o, u, r)) : bR(o, r, u, [], void 0, t)),
                    (p += OR(r, h, u) + l),
                    (h = u + a),
                    (u = PR(r, o, u + c));
                return h < r.length && (p += OR(r, h)), p;
              },
            },
          );
          let LR = !0,
            MR = !0;
          function VR(e, t, i) {
            const n = e.match(t);
            return n && n.length >= i && parseInt(n[i], 10);
          }
          function xR(e, t, i) {
            if (!e.RTCPeerConnection) return;
            const n = e.RTCPeerConnection.prototype,
              r = n.addEventListener;
            n.addEventListener = function (e, n) {
              if (e !== t) return r.apply(this, arguments);
              const o = (e) => {
                const t = i(e);
                t && (n.handleEvent ? n.handleEvent(t) : n(t));
              };
              return (
                (this._eventMap = this._eventMap || {}),
                this._eventMap[t] || (this._eventMap[t] = new Map()),
                this._eventMap[t].set(n, o),
                r.apply(this, [e, o])
              );
            };
            const o = n.removeEventListener;
            (n.removeEventListener = function (e, i) {
              if (e !== t || !this._eventMap || !this._eventMap[t])
                return o.apply(this, arguments);
              if (!this._eventMap[t].has(i)) return o.apply(this, arguments);
              const n = this._eventMap[t].get(i);
              return (
                this._eventMap[t].delete(i),
                0 === this._eventMap[t].size && delete this._eventMap[t],
                0 === Object.keys(this._eventMap).length &&
                  delete this._eventMap,
                o.apply(this, [e, n])
              );
            }),
              Object.defineProperty(n, 'on' + t, {
                get() {
                  return this['_on' + t];
                },
                set(e) {
                  this['_on' + t] &&
                    (this.removeEventListener(t, this['_on' + t]),
                    delete this['_on' + t]),
                    e && this.addEventListener(t, (this['_on' + t] = e));
                },
                enumerable: !0,
                configurable: !0,
              });
          }
          function UR(e) {
            return 'boolean' != typeof e
              ? new Error(
                  'Argument type: ' + typeof e + '. Please use a boolean.',
                )
              : ((LR = e),
                e
                  ? 'adapter.js logging disabled'
                  : 'adapter.js logging enabled');
          }
          function FR(e) {
            return 'boolean' != typeof e
              ? new Error(
                  'Argument type: ' + typeof e + '. Please use a boolean.',
                )
              : ((MR = !e),
                'adapter.js deprecation warnings ' +
                  (e ? 'disabled' : 'enabled'));
          }
          function BR() {
            if ('object' == typeof window) {
              if (LR) return;
              'undefined' != typeof console &&
                'function' == typeof console.log &&
                console.log.apply(console, arguments);
            }
          }
          function HR(e, t) {
            MR &&
              console.warn(e + ' is deprecated, please use ' + t + ' instead.');
          }
          function jR(e) {
            return '[object Object]' === Object.prototype.toString.call(e);
          }
          function GR(e) {
            return jR(e)
              ? Object.keys(e).reduce(function (t, i) {
                  const n = jR(e[i]),
                    r = n ? GR(e[i]) : e[i],
                    o = n && !Object.keys(r).length;
                  return void 0 === r || o ? t : Object.assign(t, { [i]: r });
                }, {})
              : e;
          }
          function WR(e, t, i) {
            t &&
              !i.has(t.id) &&
              (i.set(t.id, t),
              Object.keys(t).forEach((n) => {
                n.endsWith('Id')
                  ? WR(e, e.get(t[n]), i)
                  : n.endsWith('Ids') &&
                    t[n].forEach((t) => {
                      WR(e, e.get(t), i);
                    });
              }));
          }
          function JR(e, t, i) {
            const n = i ? 'outbound-rtp' : 'inbound-rtp',
              r = new Map();
            if (null === t) return r;
            const o = [];
            return (
              e.forEach((e) => {
                'track' === e.type && e.trackIdentifier === t.id && o.push(e);
              }),
              o.forEach((t) => {
                e.forEach((i) => {
                  i.type === n && i.trackId === t.id && WR(e, i, r);
                });
              }),
              r
            );
          }
          const KR = BR;
          function YR(e, t) {
            const i = e && e.navigator;
            if (!i.mediaDevices) return;
            const n = function (e) {
                if ('object' != typeof e || e.mandatory || e.optional) return e;
                const t = {};
                return (
                  Object.keys(e).forEach((i) => {
                    if (
                      'require' === i ||
                      'advanced' === i ||
                      'mediaSource' === i
                    )
                      return;
                    const n = 'object' == typeof e[i] ? e[i] : { ideal: e[i] };
                    void 0 !== n.exact &&
                      'number' == typeof n.exact &&
                      (n.min = n.max = n.exact);
                    const r = function (e, t) {
                      return e
                        ? e + t.charAt(0).toUpperCase() + t.slice(1)
                        : 'deviceId' === t
                        ? 'sourceId'
                        : t;
                    };
                    if (void 0 !== n.ideal) {
                      t.optional = t.optional || [];
                      let e = {};
                      'number' == typeof n.ideal
                        ? ((e[r('min', i)] = n.ideal),
                          t.optional.push(e),
                          (e = {}),
                          (e[r('max', i)] = n.ideal),
                          t.optional.push(e))
                        : ((e[r('', i)] = n.ideal), t.optional.push(e));
                    }
                    void 0 !== n.exact && 'number' != typeof n.exact
                      ? ((t.mandatory = t.mandatory || {}),
                        (t.mandatory[r('', i)] = n.exact))
                      : ['min', 'max'].forEach((e) => {
                          void 0 !== n[e] &&
                            ((t.mandatory = t.mandatory || {}),
                            (t.mandatory[r(e, i)] = n[e]));
                        });
                  }),
                  e.advanced &&
                    (t.optional = (t.optional || []).concat(e.advanced)),
                  t
                );
              },
              r = function (e, r) {
                if (t.version >= 61) return r(e);
                if (
                  (e = JSON.parse(JSON.stringify(e))) &&
                  'object' == typeof e.audio
                ) {
                  const t = function (e, t, i) {
                    t in e && !(i in e) && ((e[i] = e[t]), delete e[t]);
                  };
                  t(
                    (e = JSON.parse(JSON.stringify(e))).audio,
                    'autoGainControl',
                    'googAutoGainControl',
                  ),
                    t(e.audio, 'noiseSuppression', 'googNoiseSuppression'),
                    (e.audio = n(e.audio));
                }
                if (e && 'object' == typeof e.video) {
                  let o = e.video.facingMode;
                  o = o && ('object' == typeof o ? o : { ideal: o });
                  const s = t.version < 66;
                  if (
                    o &&
                    ('user' === o.exact ||
                      'environment' === o.exact ||
                      'user' === o.ideal ||
                      'environment' === o.ideal) &&
                    (!i.mediaDevices.getSupportedConstraints ||
                      !i.mediaDevices.getSupportedConstraints().facingMode ||
                      s)
                  ) {
                    let t;
                    if (
                      (delete e.video.facingMode,
                      'environment' === o.exact || 'environment' === o.ideal
                        ? (t = ['back', 'rear'])
                        : ('user' !== o.exact && 'user' !== o.ideal) ||
                          (t = ['front']),
                      t)
                    )
                      return i.mediaDevices.enumerateDevices().then((i) => {
                        i = i.filter((e) => 'videoinput' === e.kind);
                        let s = i.find((e) =>
                          t.some((t) => e.label.toLowerCase().includes(t)),
                        );
                        return (
                          !s &&
                            i.length &&
                            t.includes('back') &&
                            (s = i[i.length - 1]),
                          s &&
                            (e.video.deviceId = o.exact
                              ? { exact: s.deviceId }
                              : { ideal: s.deviceId }),
                          (e.video = n(e.video)),
                          KR('chrome: ' + JSON.stringify(e)),
                          r(e)
                        );
                      });
                  }
                  e.video = n(e.video);
                }
                return KR('chrome: ' + JSON.stringify(e)), r(e);
              },
              o = function (e) {
                return t.version >= 64
                  ? e
                  : {
                      name:
                        {
                          PermissionDeniedError: 'NotAllowedError',
                          PermissionDismissedError: 'NotAllowedError',
                          InvalidStateError: 'NotAllowedError',
                          DevicesNotFoundError: 'NotFoundError',
                          ConstraintNotSatisfiedError: 'OverconstrainedError',
                          TrackStartError: 'NotReadableError',
                          MediaDeviceFailedDueToShutdown: 'NotAllowedError',
                          MediaDeviceKillSwitchOn: 'NotAllowedError',
                          TabCaptureError: 'AbortError',
                          ScreenCaptureError: 'AbortError',
                          DeviceCaptureError: 'AbortError',
                        }[e.name] || e.name,
                      message: e.message,
                      constraint: e.constraint || e.constraintName,
                      toString() {
                        return (
                          this.name + (this.message && ': ') + this.message
                        );
                      },
                    };
              };
            if (
              ((i.getUserMedia = function (e, t, n) {
                r(e, (e) => {
                  i.webkitGetUserMedia(e, t, (e) => {
                    n && n(o(e));
                  });
                });
              }.bind(i)),
              i.mediaDevices.getUserMedia)
            ) {
              const e = i.mediaDevices.getUserMedia.bind(i.mediaDevices);
              i.mediaDevices.getUserMedia = function (t) {
                return r(t, (t) =>
                  e(t).then(
                    (e) => {
                      if (
                        (t.audio && !e.getAudioTracks().length) ||
                        (t.video && !e.getVideoTracks().length)
                      )
                        throw (
                          (e.getTracks().forEach((e) => {
                            e.stop();
                          }),
                          new DOMException('', 'NotFoundError'))
                        );
                      return e;
                    },
                    (e) => Promise.reject(o(e)),
                  ),
                );
              };
            }
          }
          function zR(e) {
            e.MediaStream = e.MediaStream || e.webkitMediaStream;
          }
          function qR(e) {
            if (
              'object' == typeof e &&
              e.RTCPeerConnection &&
              !('ontrack' in e.RTCPeerConnection.prototype)
            ) {
              Object.defineProperty(e.RTCPeerConnection.prototype, 'ontrack', {
                get() {
                  return this._ontrack;
                },
                set(e) {
                  this._ontrack &&
                    this.removeEventListener('track', this._ontrack),
                    this.addEventListener('track', (this._ontrack = e));
                },
                enumerable: !0,
                configurable: !0,
              });
              const t = e.RTCPeerConnection.prototype.setRemoteDescription;
              e.RTCPeerConnection.prototype.setRemoteDescription = function () {
                return (
                  this._ontrackpoly ||
                    ((this._ontrackpoly = (t) => {
                      t.stream.addEventListener('addtrack', (i) => {
                        let n;
                        n = e.RTCPeerConnection.prototype.getReceivers
                          ? this.getReceivers().find(
                              (e) => e.track && e.track.id === i.track.id,
                            )
                          : { track: i.track };
                        const r = new Event('track');
                        (r.track = i.track),
                          (r.receiver = n),
                          (r.transceiver = { receiver: n }),
                          (r.streams = [t.stream]),
                          this.dispatchEvent(r);
                      }),
                        t.stream.getTracks().forEach((i) => {
                          let n;
                          n = e.RTCPeerConnection.prototype.getReceivers
                            ? this.getReceivers().find(
                                (e) => e.track && e.track.id === i.id,
                              )
                            : { track: i };
                          const r = new Event('track');
                          (r.track = i),
                            (r.receiver = n),
                            (r.transceiver = { receiver: n }),
                            (r.streams = [t.stream]),
                            this.dispatchEvent(r);
                        });
                    }),
                    this.addEventListener('addstream', this._ontrackpoly)),
                  t.apply(this, arguments)
                );
              };
            } else xR(e, 'track', (e) => (e.transceiver || Object.defineProperty(e, 'transceiver', { value: { receiver: e.receiver } }), e));
          }
          function QR(e) {
            if (
              'object' == typeof e &&
              e.RTCPeerConnection &&
              !('getSenders' in e.RTCPeerConnection.prototype) &&
              'createDTMFSender' in e.RTCPeerConnection.prototype
            ) {
              const t = function (e, t) {
                return {
                  track: t,
                  get dtmf() {
                    return (
                      void 0 === this._dtmf &&
                        ('audio' === t.kind
                          ? (this._dtmf = e.createDTMFSender(t))
                          : (this._dtmf = null)),
                      this._dtmf
                    );
                  },
                  _pc: e,
                };
              };
              if (!e.RTCPeerConnection.prototype.getSenders) {
                e.RTCPeerConnection.prototype.getSenders = function () {
                  return (
                    (this._senders = this._senders || []), this._senders.slice()
                  );
                };
                const i = e.RTCPeerConnection.prototype.addTrack;
                e.RTCPeerConnection.prototype.addTrack = function (e, n) {
                  let r = i.apply(this, arguments);
                  return r || ((r = t(this, e)), this._senders.push(r)), r;
                };
                const n = e.RTCPeerConnection.prototype.removeTrack;
                e.RTCPeerConnection.prototype.removeTrack = function (e) {
                  n.apply(this, arguments);
                  const t = this._senders.indexOf(e);
                  -1 !== t && this._senders.splice(t, 1);
                };
              }
              const i = e.RTCPeerConnection.prototype.addStream;
              e.RTCPeerConnection.prototype.addStream = function (e) {
                (this._senders = this._senders || []),
                  i.apply(this, [e]),
                  e.getTracks().forEach((e) => {
                    this._senders.push(t(this, e));
                  });
              };
              const n = e.RTCPeerConnection.prototype.removeStream;
              e.RTCPeerConnection.prototype.removeStream = function (e) {
                (this._senders = this._senders || []),
                  n.apply(this, [e]),
                  e.getTracks().forEach((e) => {
                    const t = this._senders.find((t) => t.track === e);
                    t && this._senders.splice(this._senders.indexOf(t), 1);
                  });
              };
            } else if (
              'object' == typeof e &&
              e.RTCPeerConnection &&
              'getSenders' in e.RTCPeerConnection.prototype &&
              'createDTMFSender' in e.RTCPeerConnection.prototype &&
              e.RTCRtpSender &&
              !('dtmf' in e.RTCRtpSender.prototype)
            ) {
              const t = e.RTCPeerConnection.prototype.getSenders;
              (e.RTCPeerConnection.prototype.getSenders = function () {
                const e = t.apply(this, []);
                return e.forEach((e) => (e._pc = this)), e;
              }),
                Object.defineProperty(e.RTCRtpSender.prototype, 'dtmf', {
                  get() {
                    return (
                      void 0 === this._dtmf &&
                        ('audio' === this.track.kind
                          ? (this._dtmf = this._pc.createDTMFSender(this.track))
                          : (this._dtmf = null)),
                      this._dtmf
                    );
                  },
                });
            }
          }
          function XR(e) {
            if (!e.RTCPeerConnection) return;
            const t = e.RTCPeerConnection.prototype.getStats;
            e.RTCPeerConnection.prototype.getStats = function () {
              const [e, i, n] = arguments;
              if (arguments.length > 0 && 'function' == typeof e)
                return t.apply(this, arguments);
              if (
                0 === t.length &&
                (0 === arguments.length || 'function' != typeof e)
              )
                return t.apply(this, []);
              const r = function (e) {
                  const t = {};
                  return (
                    e.result().forEach((e) => {
                      const i = {
                        id: e.id,
                        timestamp: e.timestamp,
                        type:
                          {
                            localcandidate: 'local-candidate',
                            remotecandidate: 'remote-candidate',
                          }[e.type] || e.type,
                      };
                      e.names().forEach((t) => {
                        i[t] = e.stat(t);
                      }),
                        (t[i.id] = i);
                    }),
                    t
                  );
                },
                o = function (e) {
                  return new Map(Object.keys(e).map((t) => [t, e[t]]));
                };
              if (arguments.length >= 2) {
                const n = function (e) {
                  i(o(r(e)));
                };
                return t.apply(this, [n, e]);
              }
              return new Promise((e, i) => {
                t.apply(this, [
                  function (t) {
                    e(o(r(t)));
                  },
                  i,
                ]);
              }).then(i, n);
            };
          }
          function $R(e) {
            if (
              !(
                'object' == typeof e &&
                e.RTCPeerConnection &&
                e.RTCRtpSender &&
                e.RTCRtpReceiver
              )
            )
              return;
            if (!('getStats' in e.RTCRtpSender.prototype)) {
              const t = e.RTCPeerConnection.prototype.getSenders;
              t &&
                (e.RTCPeerConnection.prototype.getSenders = function () {
                  const e = t.apply(this, []);
                  return e.forEach((e) => (e._pc = this)), e;
                });
              const i = e.RTCPeerConnection.prototype.addTrack;
              i &&
                (e.RTCPeerConnection.prototype.addTrack = function () {
                  const e = i.apply(this, arguments);
                  return (e._pc = this), e;
                }),
                (e.RTCRtpSender.prototype.getStats = function () {
                  const e = this;
                  return this._pc.getStats().then((t) => JR(t, e.track, !0));
                });
            }
            if (!('getStats' in e.RTCRtpReceiver.prototype)) {
              const t = e.RTCPeerConnection.prototype.getReceivers;
              t &&
                (e.RTCPeerConnection.prototype.getReceivers = function () {
                  const e = t.apply(this, []);
                  return e.forEach((e) => (e._pc = this)), e;
                }),
                xR(e, 'track', (e) => ((e.receiver._pc = e.srcElement), e)),
                (e.RTCRtpReceiver.prototype.getStats = function () {
                  const e = this;
                  return this._pc.getStats().then((t) => JR(t, e.track, !1));
                });
            }
            if (
              !('getStats' in e.RTCRtpSender.prototype) ||
              !('getStats' in e.RTCRtpReceiver.prototype)
            )
              return;
            const t = e.RTCPeerConnection.prototype.getStats;
            e.RTCPeerConnection.prototype.getStats = function () {
              if (
                arguments.length > 0 &&
                arguments[0] instanceof e.MediaStreamTrack
              ) {
                const e = arguments[0];
                let t, i, n;
                return (
                  this.getSenders().forEach((i) => {
                    i.track === e && (t ? (n = !0) : (t = i));
                  }),
                  this.getReceivers().forEach(
                    (t) => (
                      t.track === e && (i ? (n = !0) : (i = t)), t.track === e
                    ),
                  ),
                  n || (t && i)
                    ? Promise.reject(
                        new DOMException(
                          'There are more than one sender or receiver for the track.',
                          'InvalidAccessError',
                        ),
                      )
                    : t
                    ? t.getStats()
                    : i
                    ? i.getStats()
                    : Promise.reject(
                        new DOMException(
                          'There is no sender or receiver for the track.',
                          'InvalidAccessError',
                        ),
                      )
                );
              }
              return t.apply(this, arguments);
            };
          }
          function ZR(e) {
            e.RTCPeerConnection.prototype.getLocalStreams = function () {
              return (
                (this._shimmedLocalStreams = this._shimmedLocalStreams || {}),
                Object.keys(this._shimmedLocalStreams).map(
                  (e) => this._shimmedLocalStreams[e][0],
                )
              );
            };
            const t = e.RTCPeerConnection.prototype.addTrack;
            e.RTCPeerConnection.prototype.addTrack = function (e, i) {
              if (!i) return t.apply(this, arguments);
              this._shimmedLocalStreams = this._shimmedLocalStreams || {};
              const n = t.apply(this, arguments);
              return (
                this._shimmedLocalStreams[i.id]
                  ? -1 === this._shimmedLocalStreams[i.id].indexOf(n) &&
                    this._shimmedLocalStreams[i.id].push(n)
                  : (this._shimmedLocalStreams[i.id] = [i, n]),
                n
              );
            };
            const i = e.RTCPeerConnection.prototype.addStream;
            e.RTCPeerConnection.prototype.addStream = function (e) {
              (this._shimmedLocalStreams = this._shimmedLocalStreams || {}),
                e.getTracks().forEach((e) => {
                  if (this.getSenders().find((t) => t.track === e))
                    throw new DOMException(
                      'Track already exists.',
                      'InvalidAccessError',
                    );
                });
              const t = this.getSenders();
              i.apply(this, arguments);
              const n = this.getSenders().filter((e) => -1 === t.indexOf(e));
              this._shimmedLocalStreams[e.id] = [e].concat(n);
            };
            const n = e.RTCPeerConnection.prototype.removeStream;
            e.RTCPeerConnection.prototype.removeStream = function (e) {
              return (
                (this._shimmedLocalStreams = this._shimmedLocalStreams || {}),
                delete this._shimmedLocalStreams[e.id],
                n.apply(this, arguments)
              );
            };
            const r = e.RTCPeerConnection.prototype.removeTrack;
            e.RTCPeerConnection.prototype.removeTrack = function (e) {
              return (
                (this._shimmedLocalStreams = this._shimmedLocalStreams || {}),
                e &&
                  Object.keys(this._shimmedLocalStreams).forEach((t) => {
                    const i = this._shimmedLocalStreams[t].indexOf(e);
                    -1 !== i && this._shimmedLocalStreams[t].splice(i, 1),
                      1 === this._shimmedLocalStreams[t].length &&
                        delete this._shimmedLocalStreams[t];
                  }),
                r.apply(this, arguments)
              );
            };
          }
          function eC(e, t) {
            if (!e.RTCPeerConnection) return;
            if (e.RTCPeerConnection.prototype.addTrack && t.version >= 65)
              return ZR(e);
            const i = e.RTCPeerConnection.prototype.getLocalStreams;
            e.RTCPeerConnection.prototype.getLocalStreams = function () {
              const e = i.apply(this);
              return (
                (this._reverseStreams = this._reverseStreams || {}),
                e.map((e) => this._reverseStreams[e.id])
              );
            };
            const n = e.RTCPeerConnection.prototype.addStream;
            e.RTCPeerConnection.prototype.addStream = function (t) {
              if (
                ((this._streams = this._streams || {}),
                (this._reverseStreams = this._reverseStreams || {}),
                t.getTracks().forEach((e) => {
                  if (this.getSenders().find((t) => t.track === e))
                    throw new DOMException(
                      'Track already exists.',
                      'InvalidAccessError',
                    );
                }),
                !this._reverseStreams[t.id])
              ) {
                const i = new e.MediaStream(t.getTracks());
                (this._streams[t.id] = i),
                  (this._reverseStreams[i.id] = t),
                  (t = i);
              }
              n.apply(this, [t]);
            };
            const r = e.RTCPeerConnection.prototype.removeStream;
            function o(e, t) {
              let i = t.sdp;
              return (
                Object.keys(e._reverseStreams || []).forEach((t) => {
                  const n = e._reverseStreams[t],
                    r = e._streams[n.id];
                  i = i.replace(new RegExp(r.id, 'g'), n.id);
                }),
                new RTCSessionDescription({ type: t.type, sdp: i })
              );
            }
            (e.RTCPeerConnection.prototype.removeStream = function (e) {
              (this._streams = this._streams || {}),
                (this._reverseStreams = this._reverseStreams || {}),
                r.apply(this, [this._streams[e.id] || e]),
                delete this._reverseStreams[
                  this._streams[e.id] ? this._streams[e.id].id : e.id
                ],
                delete this._streams[e.id];
            }),
              (e.RTCPeerConnection.prototype.addTrack = function (t, i) {
                if ('closed' === this.signalingState)
                  throw new DOMException(
                    "The RTCPeerConnection's signalingState is 'closed'.",
                    'InvalidStateError',
                  );
                const n = [].slice.call(arguments, 1);
                if (1 !== n.length || !n[0].getTracks().find((e) => e === t))
                  throw new DOMException(
                    'The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.',
                    'NotSupportedError',
                  );
                if (this.getSenders().find((e) => e.track === t))
                  throw new DOMException(
                    'Track already exists.',
                    'InvalidAccessError',
                  );
                (this._streams = this._streams || {}),
                  (this._reverseStreams = this._reverseStreams || {});
                const r = this._streams[i.id];
                if (r)
                  r.addTrack(t),
                    Promise.resolve().then(() => {
                      this.dispatchEvent(new Event('negotiationneeded'));
                    });
                else {
                  const n = new e.MediaStream([t]);
                  (this._streams[i.id] = n),
                    (this._reverseStreams[n.id] = i),
                    this.addStream(n);
                }
                return this.getSenders().find((e) => e.track === t);
              }),
              ['createOffer', 'createAnswer'].forEach(function (t) {
                const i = e.RTCPeerConnection.prototype[t],
                  n = {
                    [t]() {
                      const e = arguments;
                      return arguments.length &&
                        'function' == typeof arguments[0]
                        ? i.apply(this, [
                            (t) => {
                              const i = o(this, t);
                              e[0].apply(null, [i]);
                            },
                            (t) => {
                              e[1] && e[1].apply(null, t);
                            },
                            arguments[2],
                          ])
                        : i.apply(this, arguments).then((e) => o(this, e));
                    },
                  };
                e.RTCPeerConnection.prototype[t] = n[t];
              });
            const s = e.RTCPeerConnection.prototype.setLocalDescription;
            e.RTCPeerConnection.prototype.setLocalDescription = function () {
              return arguments.length && arguments[0].type
                ? ((arguments[0] = (function (e, t) {
                    let i = t.sdp;
                    return (
                      Object.keys(e._reverseStreams || []).forEach((t) => {
                        const n = e._reverseStreams[t],
                          r = e._streams[n.id];
                        i = i.replace(new RegExp(n.id, 'g'), r.id);
                      }),
                      new RTCSessionDescription({ type: t.type, sdp: i })
                    );
                  })(this, arguments[0])),
                  s.apply(this, arguments))
                : s.apply(this, arguments);
            };
            const a = Object.getOwnPropertyDescriptor(
              e.RTCPeerConnection.prototype,
              'localDescription',
            );
            Object.defineProperty(
              e.RTCPeerConnection.prototype,
              'localDescription',
              {
                get() {
                  const e = a.get.apply(this);
                  return '' === e.type ? e : o(this, e);
                },
              },
            ),
              (e.RTCPeerConnection.prototype.removeTrack = function (e) {
                if ('closed' === this.signalingState)
                  throw new DOMException(
                    "The RTCPeerConnection's signalingState is 'closed'.",
                    'InvalidStateError',
                  );
                if (!e._pc)
                  throw new DOMException(
                    'Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.',
                    'TypeError',
                  );
                if (!(e._pc === this))
                  throw new DOMException(
                    'Sender was not created by this connection.',
                    'InvalidAccessError',
                  );
                let t;
                (this._streams = this._streams || {}),
                  Object.keys(this._streams).forEach((i) => {
                    this._streams[i].getTracks().find((t) => e.track === t) &&
                      (t = this._streams[i]);
                  }),
                  t &&
                    (1 === t.getTracks().length
                      ? this.removeStream(this._reverseStreams[t.id])
                      : t.removeTrack(e.track),
                    this.dispatchEvent(new Event('negotiationneeded')));
              });
          }
          function tC(e, t) {
            !e.RTCPeerConnection &&
              e.webkitRTCPeerConnection &&
              (e.RTCPeerConnection = e.webkitRTCPeerConnection),
              e.RTCPeerConnection &&
                t.version < 53 &&
                [
                  'setLocalDescription',
                  'setRemoteDescription',
                  'addIceCandidate',
                ].forEach(function (t) {
                  const i = e.RTCPeerConnection.prototype[t],
                    n = {
                      [t]() {
                        return (
                          (arguments[0] = new (
                            'addIceCandidate' === t
                              ? e.RTCIceCandidate
                              : e.RTCSessionDescription
                          )(arguments[0])),
                          i.apply(this, arguments)
                        );
                      },
                    };
                  e.RTCPeerConnection.prototype[t] = n[t];
                });
          }
          function iC(e, t) {
            xR(e, 'negotiationneeded', (e) => {
              const i = e.target;
              if (
                !(
                  t.version < 72 ||
                  (i.getConfiguration &&
                    'plan-b' === i.getConfiguration().sdpSemantics)
                ) ||
                'stable' === i.signalingState
              )
                return e;
            });
          }
          var nC = Object.freeze({
            __proto__: null,
            shimMediaStream: zR,
            shimOnTrack: qR,
            shimGetSendersWithDtmf: QR,
            shimGetStats: XR,
            shimSenderReceiverGetStats: $R,
            shimAddTrackRemoveTrackWithNative: ZR,
            shimAddTrackRemoveTrack: eC,
            shimPeerConnection: tC,
            fixNegotiationNeeded: iC,
            shimGetUserMedia: YR,
            shimGetDisplayMedia: function (e, t) {
              (e.navigator.mediaDevices &&
                'getDisplayMedia' in e.navigator.mediaDevices) ||
                (e.navigator.mediaDevices &&
                  ('function' == typeof t
                    ? (e.navigator.mediaDevices.getDisplayMedia = function (i) {
                        return t(i).then((t) => {
                          const n = i.video && i.video.width,
                            r = i.video && i.video.height,
                            o = i.video && i.video.frameRate;
                          return (
                            (i.video = {
                              mandatory: {
                                chromeMediaSource: 'desktop',
                                chromeMediaSourceId: t,
                                maxFrameRate: o || 3,
                              },
                            }),
                            n && (i.video.mandatory.maxWidth = n),
                            r && (i.video.mandatory.maxHeight = r),
                            e.navigator.mediaDevices.getUserMedia(i)
                          );
                        });
                      })
                    : console.error(
                        'shimGetDisplayMedia: getSourceId argument is not a function',
                      )));
            },
          });
          function rC(e, t) {
            const i = e && e.navigator,
              n = e && e.MediaStreamTrack;
            if (
              ((i.getUserMedia = function (e, t, n) {
                HR(
                  'navigator.getUserMedia',
                  'navigator.mediaDevices.getUserMedia',
                ),
                  i.mediaDevices.getUserMedia(e).then(t, n);
              }),
              !(
                t.version > 55 &&
                'autoGainControl' in i.mediaDevices.getSupportedConstraints()
              ))
            ) {
              const e = function (e, t, i) {
                  t in e && !(i in e) && ((e[i] = e[t]), delete e[t]);
                },
                t = i.mediaDevices.getUserMedia.bind(i.mediaDevices);
              if (
                ((i.mediaDevices.getUserMedia = function (i) {
                  return (
                    'object' == typeof i &&
                      'object' == typeof i.audio &&
                      ((i = JSON.parse(JSON.stringify(i))),
                      e(i.audio, 'autoGainControl', 'mozAutoGainControl'),
                      e(i.audio, 'noiseSuppression', 'mozNoiseSuppression')),
                    t(i)
                  );
                }),
                n && n.prototype.getSettings)
              ) {
                const t = n.prototype.getSettings;
                n.prototype.getSettings = function () {
                  const i = t.apply(this, arguments);
                  return (
                    e(i, 'mozAutoGainControl', 'autoGainControl'),
                    e(i, 'mozNoiseSuppression', 'noiseSuppression'),
                    i
                  );
                };
              }
              if (n && n.prototype.applyConstraints) {
                const t = n.prototype.applyConstraints;
                n.prototype.applyConstraints = function (i) {
                  return (
                    'audio' === this.kind &&
                      'object' == typeof i &&
                      ((i = JSON.parse(JSON.stringify(i))),
                      e(i, 'autoGainControl', 'mozAutoGainControl'),
                      e(i, 'noiseSuppression', 'mozNoiseSuppression')),
                    t.apply(this, [i])
                  );
                };
              }
            }
          }
          function oC(e) {
            'object' == typeof e &&
              e.RTCTrackEvent &&
              'receiver' in e.RTCTrackEvent.prototype &&
              !('transceiver' in e.RTCTrackEvent.prototype) &&
              Object.defineProperty(e.RTCTrackEvent.prototype, 'transceiver', {
                get() {
                  return { receiver: this.receiver };
                },
              });
          }
          function sC(e, t) {
            if (
              'object' != typeof e ||
              (!e.RTCPeerConnection && !e.mozRTCPeerConnection)
            )
              return;
            !e.RTCPeerConnection &&
              e.mozRTCPeerConnection &&
              (e.RTCPeerConnection = e.mozRTCPeerConnection),
              t.version < 53 &&
                [
                  'setLocalDescription',
                  'setRemoteDescription',
                  'addIceCandidate',
                ].forEach(function (t) {
                  const i = e.RTCPeerConnection.prototype[t],
                    n = {
                      [t]() {
                        return (
                          (arguments[0] = new (
                            'addIceCandidate' === t
                              ? e.RTCIceCandidate
                              : e.RTCSessionDescription
                          )(arguments[0])),
                          i.apply(this, arguments)
                        );
                      },
                    };
                  e.RTCPeerConnection.prototype[t] = n[t];
                });
            const i = {
                inboundrtp: 'inbound-rtp',
                outboundrtp: 'outbound-rtp',
                candidatepair: 'candidate-pair',
                localcandidate: 'local-candidate',
                remotecandidate: 'remote-candidate',
              },
              n = e.RTCPeerConnection.prototype.getStats;
            e.RTCPeerConnection.prototype.getStats = function () {
              const [e, r, o] = arguments;
              return n
                .apply(this, [e || null])
                .then((e) => {
                  if (t.version < 53 && !r)
                    try {
                      e.forEach((e) => {
                        e.type = i[e.type] || e.type;
                      });
                    } catch (sN) {
                      if ('TypeError' !== sN.name) throw sN;
                      e.forEach((t, n) => {
                        e.set(
                          n,
                          Object.assign({}, t, { type: i[t.type] || t.type }),
                        );
                      });
                    }
                  return e;
                })
                .then(r, o);
            };
          }
          function aC(e) {
            if ('object' != typeof e || !e.RTCPeerConnection || !e.RTCRtpSender)
              return;
            if (e.RTCRtpSender && 'getStats' in e.RTCRtpSender.prototype)
              return;
            const t = e.RTCPeerConnection.prototype.getSenders;
            t &&
              (e.RTCPeerConnection.prototype.getSenders = function () {
                const e = t.apply(this, []);
                return e.forEach((e) => (e._pc = this)), e;
              });
            const i = e.RTCPeerConnection.prototype.addTrack;
            i &&
              (e.RTCPeerConnection.prototype.addTrack = function () {
                const e = i.apply(this, arguments);
                return (e._pc = this), e;
              }),
              (e.RTCRtpSender.prototype.getStats = function () {
                return this.track
                  ? this._pc.getStats(this.track)
                  : Promise.resolve(new Map());
              });
          }
          function cC(e) {
            if ('object' != typeof e || !e.RTCPeerConnection || !e.RTCRtpSender)
              return;
            if (e.RTCRtpSender && 'getStats' in e.RTCRtpReceiver.prototype)
              return;
            const t = e.RTCPeerConnection.prototype.getReceivers;
            t &&
              (e.RTCPeerConnection.prototype.getReceivers = function () {
                const e = t.apply(this, []);
                return e.forEach((e) => (e._pc = this)), e;
              }),
              xR(e, 'track', (e) => ((e.receiver._pc = e.srcElement), e)),
              (e.RTCRtpReceiver.prototype.getStats = function () {
                return this._pc.getStats(this.track);
              });
          }
          function lC(e) {
            e.RTCPeerConnection &&
              !('removeStream' in e.RTCPeerConnection.prototype) &&
              (e.RTCPeerConnection.prototype.removeStream = function (e) {
                HR('removeStream', 'removeTrack'),
                  this.getSenders().forEach((t) => {
                    t.track &&
                      e.getTracks().includes(t.track) &&
                      this.removeTrack(t);
                  });
              });
          }
          function dC(e) {
            e.DataChannel &&
              !e.RTCDataChannel &&
              (e.RTCDataChannel = e.DataChannel);
          }
          function uC(e) {
            if ('object' != typeof e || !e.RTCPeerConnection) return;
            const t = e.RTCPeerConnection.prototype.addTransceiver;
            t &&
              (e.RTCPeerConnection.prototype.addTransceiver = function () {
                this.setParametersPromises = [];
                let e = arguments[1] && arguments[1].sendEncodings;
                void 0 === e && (e = []), (e = [...e]);
                const i = e.length > 0;
                i &&
                  e.forEach((e) => {
                    if ('rid' in e) {
                      if (!/^[a-z0-9]{0,16}$/i.test(e.rid))
                        throw new TypeError('Invalid RID value provided.');
                    }
                    if (
                      'scaleResolutionDownBy' in e &&
                      !(parseFloat(e.scaleResolutionDownBy) >= 1)
                    )
                      throw new RangeError(
                        'scale_resolution_down_by must be >= 1.0',
                      );
                    if (
                      'maxFramerate' in e &&
                      !(parseFloat(e.maxFramerate) >= 0)
                    )
                      throw new RangeError('max_framerate must be >= 0.0');
                  });
                const n = t.apply(this, arguments);
                if (i) {
                  const { sender: t } = n,
                    i = t.getParameters();
                  (!('encodings' in i) ||
                    (1 === i.encodings.length &&
                      0 === Object.keys(i.encodings[0]).length)) &&
                    ((i.encodings = e),
                    (t.sendEncodings = e),
                    this.setParametersPromises.push(
                      t
                        .setParameters(i)
                        .then(() => {
                          delete t.sendEncodings;
                        })
                        .catch(() => {
                          delete t.sendEncodings;
                        }),
                    ));
                }
                return n;
              });
          }
          function hC(e) {
            if ('object' != typeof e || !e.RTCRtpSender) return;
            const t = e.RTCRtpSender.prototype.getParameters;
            t &&
              (e.RTCRtpSender.prototype.getParameters = function () {
                const e = t.apply(this, arguments);
                return (
                  'encodings' in e ||
                    (e.encodings = [].concat(this.sendEncodings || [{}])),
                  e
                );
              });
          }
          function pC(e) {
            if ('object' != typeof e || !e.RTCPeerConnection) return;
            const t = e.RTCPeerConnection.prototype.createOffer;
            e.RTCPeerConnection.prototype.createOffer = function () {
              return this.setParametersPromises &&
                this.setParametersPromises.length
                ? Promise.all(this.setParametersPromises)
                    .then(() => t.apply(this, arguments))
                    .finally(() => {
                      this.setParametersPromises = [];
                    })
                : t.apply(this, arguments);
            };
          }
          function _C(e) {
            if ('object' != typeof e || !e.RTCPeerConnection) return;
            const t = e.RTCPeerConnection.prototype.createAnswer;
            e.RTCPeerConnection.prototype.createAnswer = function () {
              return this.setParametersPromises &&
                this.setParametersPromises.length
                ? Promise.all(this.setParametersPromises)
                    .then(() => t.apply(this, arguments))
                    .finally(() => {
                      this.setParametersPromises = [];
                    })
                : t.apply(this, arguments);
            };
          }
          var mC = Object.freeze({
            __proto__: null,
            shimOnTrack: oC,
            shimPeerConnection: sC,
            shimSenderGetStats: aC,
            shimReceiverGetStats: cC,
            shimRemoveStream: lC,
            shimRTCDataChannel: dC,
            shimAddTransceiver: uC,
            shimGetParameters: hC,
            shimCreateOffer: pC,
            shimCreateAnswer: _C,
            shimGetUserMedia: rC,
            shimGetDisplayMedia: function (e, t) {
              (e.navigator.mediaDevices &&
                'getDisplayMedia' in e.navigator.mediaDevices) ||
                (e.navigator.mediaDevices &&
                  (e.navigator.mediaDevices.getDisplayMedia = function (i) {
                    if (!i || !i.video) {
                      const e = new DOMException(
                        'getDisplayMedia without video constraints is undefined',
                      );
                      return (
                        (e.name = 'NotFoundError'),
                        (e.code = 8),
                        Promise.reject(e)
                      );
                    }
                    return (
                      !0 === i.video
                        ? (i.video = { mediaSource: t })
                        : (i.video.mediaSource = t),
                      e.navigator.mediaDevices.getUserMedia(i)
                    );
                  }));
            },
          });
          function fC(e) {
            if ('object' == typeof e && e.RTCPeerConnection) {
              if (
                ('getLocalStreams' in e.RTCPeerConnection.prototype ||
                  (e.RTCPeerConnection.prototype.getLocalStreams = function () {
                    return (
                      this._localStreams || (this._localStreams = []),
                      this._localStreams
                    );
                  }),
                !('addStream' in e.RTCPeerConnection.prototype))
              ) {
                const t = e.RTCPeerConnection.prototype.addTrack;
                (e.RTCPeerConnection.prototype.addStream = function (e) {
                  this._localStreams || (this._localStreams = []),
                    this._localStreams.includes(e) ||
                      this._localStreams.push(e),
                    e.getAudioTracks().forEach((i) => t.call(this, i, e)),
                    e.getVideoTracks().forEach((i) => t.call(this, i, e));
                }),
                  (e.RTCPeerConnection.prototype.addTrack = function (e, ...i) {
                    return (
                      i &&
                        i.forEach((e) => {
                          this._localStreams
                            ? this._localStreams.includes(e) ||
                              this._localStreams.push(e)
                            : (this._localStreams = [e]);
                        }),
                      t.apply(this, arguments)
                    );
                  });
              }
              'removeStream' in e.RTCPeerConnection.prototype ||
                (e.RTCPeerConnection.prototype.removeStream = function (e) {
                  this._localStreams || (this._localStreams = []);
                  const t = this._localStreams.indexOf(e);
                  if (-1 === t) return;
                  this._localStreams.splice(t, 1);
                  const i = e.getTracks();
                  this.getSenders().forEach((e) => {
                    i.includes(e.track) && this.removeTrack(e);
                  });
                });
            }
          }
          function gC(e) {
            if (
              'object' == typeof e &&
              e.RTCPeerConnection &&
              ('getRemoteStreams' in e.RTCPeerConnection.prototype ||
                (e.RTCPeerConnection.prototype.getRemoteStreams = function () {
                  return this._remoteStreams ? this._remoteStreams : [];
                }),
              !('onaddstream' in e.RTCPeerConnection.prototype))
            ) {
              Object.defineProperty(
                e.RTCPeerConnection.prototype,
                'onaddstream',
                {
                  get() {
                    return this._onaddstream;
                  },
                  set(e) {
                    this._onaddstream &&
                      (this.removeEventListener('addstream', this._onaddstream),
                      this.removeEventListener('track', this._onaddstreampoly)),
                      this.addEventListener(
                        'addstream',
                        (this._onaddstream = e),
                      ),
                      this.addEventListener(
                        'track',
                        (this._onaddstreampoly = (e) => {
                          e.streams.forEach((e) => {
                            if (
                              (this._remoteStreams ||
                                (this._remoteStreams = []),
                              this._remoteStreams.includes(e))
                            )
                              return;
                            this._remoteStreams.push(e);
                            const t = new Event('addstream');
                            (t.stream = e), this.dispatchEvent(t);
                          });
                        }),
                      );
                  },
                },
              );
              const t = e.RTCPeerConnection.prototype.setRemoteDescription;
              e.RTCPeerConnection.prototype.setRemoteDescription = function () {
                const e = this;
                return (
                  this._onaddstreampoly ||
                    this.addEventListener(
                      'track',
                      (this._onaddstreampoly = function (t) {
                        t.streams.forEach((t) => {
                          if (
                            (e._remoteStreams || (e._remoteStreams = []),
                            e._remoteStreams.indexOf(t) >= 0)
                          )
                            return;
                          e._remoteStreams.push(t);
                          const i = new Event('addstream');
                          (i.stream = t), e.dispatchEvent(i);
                        });
                      }),
                    ),
                  t.apply(e, arguments)
                );
              };
            }
          }
          function TC(e) {
            if ('object' != typeof e || !e.RTCPeerConnection) return;
            const t = e.RTCPeerConnection.prototype,
              i = t.createOffer,
              n = t.createAnswer,
              r = t.setLocalDescription,
              o = t.setRemoteDescription,
              s = t.addIceCandidate;
            (t.createOffer = function (e, t) {
              const n = arguments.length >= 2 ? arguments[2] : arguments[0],
                r = i.apply(this, [n]);
              return t ? (r.then(e, t), Promise.resolve()) : r;
            }),
              (t.createAnswer = function (e, t) {
                const i = arguments.length >= 2 ? arguments[2] : arguments[0],
                  r = n.apply(this, [i]);
                return t ? (r.then(e, t), Promise.resolve()) : r;
              });
            let a = function (e, t, i) {
              const n = r.apply(this, [e]);
              return i ? (n.then(t, i), Promise.resolve()) : n;
            };
            (t.setLocalDescription = a),
              (a = function (e, t, i) {
                const n = o.apply(this, [e]);
                return i ? (n.then(t, i), Promise.resolve()) : n;
              }),
              (t.setRemoteDescription = a),
              (a = function (e, t, i) {
                const n = s.apply(this, [e]);
                return i ? (n.then(t, i), Promise.resolve()) : n;
              }),
              (t.addIceCandidate = a);
          }
          function EC(e) {
            const t = e && e.navigator;
            if (t.mediaDevices && t.mediaDevices.getUserMedia) {
              const e = t.mediaDevices,
                i = e.getUserMedia.bind(e);
              t.mediaDevices.getUserMedia = (e) => i(SC(e));
            }
            !t.getUserMedia &&
              t.mediaDevices &&
              t.mediaDevices.getUserMedia &&
              (t.getUserMedia = function (e, i, n) {
                t.mediaDevices.getUserMedia(e).then(i, n);
              }.bind(t));
          }
          function SC(e) {
            return e && void 0 !== e.video
              ? Object.assign({}, e, { video: GR(e.video) })
              : e;
          }
          function IC(e) {
            if (!e.RTCPeerConnection) return;
            const t = e.RTCPeerConnection;
            (e.RTCPeerConnection = function (e, i) {
              if (e && e.iceServers) {
                const t = [];
                for (let i = 0; i < e.iceServers.length; i++) {
                  let n = e.iceServers[i];
                  void 0 === n.urls && n.url
                    ? (HR('RTCIceServer.url', 'RTCIceServer.urls'),
                      (n = JSON.parse(JSON.stringify(n))),
                      (n.urls = n.url),
                      delete n.url,
                      t.push(n))
                    : t.push(e.iceServers[i]);
                }
                e.iceServers = t;
              }
              return new t(e, i);
            }),
              (e.RTCPeerConnection.prototype = t.prototype),
              'generateCertificate' in t &&
                Object.defineProperty(
                  e.RTCPeerConnection,
                  'generateCertificate',
                  { get: () => t.generateCertificate },
                );
          }
          function vC(e) {
            'object' == typeof e &&
              e.RTCTrackEvent &&
              'receiver' in e.RTCTrackEvent.prototype &&
              !('transceiver' in e.RTCTrackEvent.prototype) &&
              Object.defineProperty(e.RTCTrackEvent.prototype, 'transceiver', {
                get() {
                  return { receiver: this.receiver };
                },
              });
          }
          function yC(e) {
            const t = e.RTCPeerConnection.prototype.createOffer;
            e.RTCPeerConnection.prototype.createOffer = function (e) {
              if (e) {
                void 0 !== e.offerToReceiveAudio &&
                  (e.offerToReceiveAudio = !!e.offerToReceiveAudio);
                const t = this.getTransceivers().find(
                  (e) => 'audio' === e.receiver.track.kind,
                );
                !1 === e.offerToReceiveAudio && t
                  ? 'sendrecv' === t.direction
                    ? t.setDirection
                      ? t.setDirection('sendonly')
                      : (t.direction = 'sendonly')
                    : 'recvonly' === t.direction &&
                      (t.setDirection
                        ? t.setDirection('inactive')
                        : (t.direction = 'inactive'))
                  : !0 !== e.offerToReceiveAudio ||
                    t ||
                    this.addTransceiver('audio', { direction: 'recvonly' }),
                  void 0 !== e.offerToReceiveVideo &&
                    (e.offerToReceiveVideo = !!e.offerToReceiveVideo);
                const i = this.getTransceivers().find(
                  (e) => 'video' === e.receiver.track.kind,
                );
                !1 === e.offerToReceiveVideo && i
                  ? 'sendrecv' === i.direction
                    ? i.setDirection
                      ? i.setDirection('sendonly')
                      : (i.direction = 'sendonly')
                    : 'recvonly' === i.direction &&
                      (i.setDirection
                        ? i.setDirection('inactive')
                        : (i.direction = 'inactive'))
                  : !0 !== e.offerToReceiveVideo ||
                    i ||
                    this.addTransceiver('video', { direction: 'recvonly' });
              }
              return t.apply(this, arguments);
            };
          }
          function AC(e) {
            'object' != typeof e ||
              e.AudioContext ||
              (e.AudioContext = e.webkitAudioContext);
          }
          var RC = Object.freeze({
              __proto__: null,
              shimLocalStreamsAPI: fC,
              shimRemoteStreamsAPI: gC,
              shimCallbacksAPI: TC,
              shimGetUserMedia: EC,
              shimConstraints: SC,
              shimRTCIceServerUrls: IC,
              shimTrackEventTransceiver: vC,
              shimCreateOfferLegacy: yC,
              shimAudioContext: AC,
            }),
            CC = {},
            bC = {
              get exports() {
                return CC;
              },
              set exports(e) {
                CC = e;
              },
            };
          !(function (e) {
            const t = {
              generateIdentifier: function () {
                return Math.random().toString(36).substring(2, 12);
              },
            };
            (t.localCName = t.generateIdentifier()),
              (t.splitLines = function (e) {
                return e
                  .trim()
                  .split('\n')
                  .map((e) => e.trim());
              }),
              (t.splitSections = function (e) {
                return e
                  .split('\nm=')
                  .map((e, t) => (t > 0 ? 'm=' + e : e).trim() + '\r\n');
              }),
              (t.getDescription = function (e) {
                const i = t.splitSections(e);
                return i && i[0];
              }),
              (t.getMediaSections = function (e) {
                const i = t.splitSections(e);
                return i.shift(), i;
              }),
              (t.matchPrefix = function (e, i) {
                return t.splitLines(e).filter((e) => 0 === e.indexOf(i));
              }),
              (t.parseCandidate = function (e) {
                let t;
                t =
                  0 === e.indexOf('a=candidate:')
                    ? e.substring(12).split(' ')
                    : e.substring(10).split(' ');
                const i = {
                  foundation: t[0],
                  component: { 1: 'rtp', 2: 'rtcp' }[t[1]] || t[1],
                  protocol: t[2].toLowerCase(),
                  priority: parseInt(t[3], 10),
                  ip: t[4],
                  address: t[4],
                  port: parseInt(t[5], 10),
                  type: t[7],
                };
                for (let n = 8; n < t.length; n += 2)
                  switch (t[n]) {
                    case 'raddr':
                      i.relatedAddress = t[n + 1];
                      break;
                    case 'rport':
                      i.relatedPort = parseInt(t[n + 1], 10);
                      break;
                    case 'tcptype':
                      i.tcpType = t[n + 1];
                      break;
                    case 'ufrag':
                      (i.ufrag = t[n + 1]), (i.usernameFragment = t[n + 1]);
                      break;
                    default:
                      void 0 === i[t[n]] && (i[t[n]] = t[n + 1]);
                  }
                return i;
              }),
              (t.writeCandidate = function (e) {
                const t = [];
                t.push(e.foundation);
                const i = e.component;
                'rtp' === i ? t.push(1) : 'rtcp' === i ? t.push(2) : t.push(i),
                  t.push(e.protocol.toUpperCase()),
                  t.push(e.priority),
                  t.push(e.address || e.ip),
                  t.push(e.port);
                const n = e.type;
                return (
                  t.push('typ'),
                  t.push(n),
                  'host' !== n &&
                    e.relatedAddress &&
                    e.relatedPort &&
                    (t.push('raddr'),
                    t.push(e.relatedAddress),
                    t.push('rport'),
                    t.push(e.relatedPort)),
                  e.tcpType &&
                    'tcp' === e.protocol.toLowerCase() &&
                    (t.push('tcptype'), t.push(e.tcpType)),
                  (e.usernameFragment || e.ufrag) &&
                    (t.push('ufrag'), t.push(e.usernameFragment || e.ufrag)),
                  'candidate:' + t.join(' ')
                );
              }),
              (t.parseIceOptions = function (e) {
                return e.substring(14).split(' ');
              }),
              (t.parseRtpMap = function (e) {
                let t = e.substring(9).split(' ');
                const i = { payloadType: parseInt(t.shift(), 10) };
                return (
                  (t = t[0].split('/')),
                  (i.name = t[0]),
                  (i.clockRate = parseInt(t[1], 10)),
                  (i.channels = 3 === t.length ? parseInt(t[2], 10) : 1),
                  (i.numChannels = i.channels),
                  i
                );
              }),
              (t.writeRtpMap = function (e) {
                let t = e.payloadType;
                void 0 !== e.preferredPayloadType &&
                  (t = e.preferredPayloadType);
                const i = e.channels || e.numChannels || 1;
                return (
                  'a=rtpmap:' +
                  t +
                  ' ' +
                  e.name +
                  '/' +
                  e.clockRate +
                  (1 !== i ? '/' + i : '') +
                  '\r\n'
                );
              }),
              (t.parseExtmap = function (e) {
                const t = e.substring(9).split(' ');
                return {
                  id: parseInt(t[0], 10),
                  direction:
                    t[0].indexOf('/') > 0 ? t[0].split('/')[1] : 'sendrecv',
                  uri: t[1],
                  attributes: t.slice(2).join(' '),
                };
              }),
              (t.writeExtmap = function (e) {
                return (
                  'a=extmap:' +
                  (e.id || e.preferredId) +
                  (e.direction && 'sendrecv' !== e.direction
                    ? '/' + e.direction
                    : '') +
                  ' ' +
                  e.uri +
                  (e.attributes ? ' ' + e.attributes : '') +
                  '\r\n'
                );
              }),
              (t.parseFmtp = function (e) {
                const t = {};
                let i;
                const n = e.substring(e.indexOf(' ') + 1).split(';');
                for (let r = 0; r < n.length; r++)
                  (i = n[r].trim().split('=')), (t[i[0].trim()] = i[1]);
                return t;
              }),
              (t.writeFmtp = function (e) {
                let t = '',
                  i = e.payloadType;
                if (
                  (void 0 !== e.preferredPayloadType &&
                    (i = e.preferredPayloadType),
                  e.parameters && Object.keys(e.parameters).length)
                ) {
                  const n = [];
                  Object.keys(e.parameters).forEach((t) => {
                    void 0 !== e.parameters[t]
                      ? n.push(t + '=' + e.parameters[t])
                      : n.push(t);
                  }),
                    (t += 'a=fmtp:' + i + ' ' + n.join(';') + '\r\n');
                }
                return t;
              }),
              (t.parseRtcpFb = function (e) {
                const t = e.substring(e.indexOf(' ') + 1).split(' ');
                return { type: t.shift(), parameter: t.join(' ') };
              }),
              (t.writeRtcpFb = function (e) {
                let t = '',
                  i = e.payloadType;
                return (
                  void 0 !== e.preferredPayloadType &&
                    (i = e.preferredPayloadType),
                  e.rtcpFeedback &&
                    e.rtcpFeedback.length &&
                    e.rtcpFeedback.forEach((e) => {
                      t +=
                        'a=rtcp-fb:' +
                        i +
                        ' ' +
                        e.type +
                        (e.parameter && e.parameter.length
                          ? ' ' + e.parameter
                          : '') +
                        '\r\n';
                    }),
                  t
                );
              }),
              (t.parseSsrcMedia = function (e) {
                const t = e.indexOf(' '),
                  i = { ssrc: parseInt(e.substring(7, t), 10) },
                  n = e.indexOf(':', t);
                return (
                  n > -1
                    ? ((i.attribute = e.substring(t + 1, n)),
                      (i.value = e.substring(n + 1)))
                    : (i.attribute = e.substring(t + 1)),
                  i
                );
              }),
              (t.parseSsrcGroup = function (e) {
                const t = e.substring(13).split(' ');
                return {
                  semantics: t.shift(),
                  ssrcs: t.map((e) => parseInt(e, 10)),
                };
              }),
              (t.getMid = function (e) {
                const i = t.matchPrefix(e, 'a=mid:')[0];
                if (i) return i.substring(6);
              }),
              (t.parseFingerprint = function (e) {
                const t = e.substring(14).split(' ');
                return {
                  algorithm: t[0].toLowerCase(),
                  value: t[1].toUpperCase(),
                };
              }),
              (t.getDtlsParameters = function (e, i) {
                return {
                  role: 'auto',
                  fingerprints: t
                    .matchPrefix(e + i, 'a=fingerprint:')
                    .map(t.parseFingerprint),
                };
              }),
              (t.writeDtlsParameters = function (e, t) {
                let i = 'a=setup:' + t + '\r\n';
                return (
                  e.fingerprints.forEach((e) => {
                    i +=
                      'a=fingerprint:' + e.algorithm + ' ' + e.value + '\r\n';
                  }),
                  i
                );
              }),
              (t.parseCryptoLine = function (e) {
                const t = e.substring(9).split(' ');
                return {
                  tag: parseInt(t[0], 10),
                  cryptoSuite: t[1],
                  keyParams: t[2],
                  sessionParams: t.slice(3),
                };
              }),
              (t.writeCryptoLine = function (e) {
                return (
                  'a=crypto:' +
                  e.tag +
                  ' ' +
                  e.cryptoSuite +
                  ' ' +
                  ('object' == typeof e.keyParams
                    ? t.writeCryptoKeyParams(e.keyParams)
                    : e.keyParams) +
                  (e.sessionParams ? ' ' + e.sessionParams.join(' ') : '') +
                  '\r\n'
                );
              }),
              (t.parseCryptoKeyParams = function (e) {
                if (0 !== e.indexOf('inline:')) return null;
                const t = e.substring(7).split('|');
                return {
                  keyMethod: 'inline',
                  keySalt: t[0],
                  lifeTime: t[1],
                  mkiValue: t[2] ? t[2].split(':')[0] : void 0,
                  mkiLength: t[2] ? t[2].split(':')[1] : void 0,
                };
              }),
              (t.writeCryptoKeyParams = function (e) {
                return (
                  e.keyMethod +
                  ':' +
                  e.keySalt +
                  (e.lifeTime ? '|' + e.lifeTime : '') +
                  (e.mkiValue && e.mkiLength
                    ? '|' + e.mkiValue + ':' + e.mkiLength
                    : '')
                );
              }),
              (t.getCryptoParameters = function (e, i) {
                return t.matchPrefix(e + i, 'a=crypto:').map(t.parseCryptoLine);
              }),
              (t.getIceParameters = function (e, i) {
                const n = t.matchPrefix(e + i, 'a=ice-ufrag:')[0],
                  r = t.matchPrefix(e + i, 'a=ice-pwd:')[0];
                return n && r
                  ? {
                      usernameFragment: n.substring(12),
                      password: r.substring(10),
                    }
                  : null;
              }),
              (t.writeIceParameters = function (e) {
                let t =
                  'a=ice-ufrag:' +
                  e.usernameFragment +
                  '\r\na=ice-pwd:' +
                  e.password +
                  '\r\n';
                return e.iceLite && (t += 'a=ice-lite\r\n'), t;
              }),
              (t.parseRtpParameters = function (e) {
                const i = {
                    codecs: [],
                    headerExtensions: [],
                    fecMechanisms: [],
                    rtcp: [],
                  },
                  n = t.splitLines(e)[0].split(' ');
                i.profile = n[2];
                for (let o = 3; o < n.length; o++) {
                  const r = n[o],
                    s = t.matchPrefix(e, 'a=rtpmap:' + r + ' ')[0];
                  if (s) {
                    const n = t.parseRtpMap(s),
                      o = t.matchPrefix(e, 'a=fmtp:' + r + ' ');
                    switch (
                      ((n.parameters = o.length ? t.parseFmtp(o[0]) : {}),
                      (n.rtcpFeedback = t
                        .matchPrefix(e, 'a=rtcp-fb:' + r + ' ')
                        .map(t.parseRtcpFb)),
                      i.codecs.push(n),
                      n.name.toUpperCase())
                    ) {
                      case 'RED':
                      case 'ULPFEC':
                        i.fecMechanisms.push(n.name.toUpperCase());
                    }
                  }
                }
                t.matchPrefix(e, 'a=extmap:').forEach((e) => {
                  i.headerExtensions.push(t.parseExtmap(e));
                });
                const r = t.matchPrefix(e, 'a=rtcp-fb:* ').map(t.parseRtcpFb);
                return (
                  i.codecs.forEach((e) => {
                    r.forEach((t) => {
                      e.rtcpFeedback.find(
                        (e) => e.type === t.type && e.parameter === t.parameter,
                      ) || e.rtcpFeedback.push(t);
                    });
                  }),
                  i
                );
              }),
              (t.writeRtpDescription = function (e, i) {
                let n = '';
                (n += 'm=' + e + ' '),
                  (n += i.codecs.length > 0 ? '9' : '0'),
                  (n += ' ' + (i.profile || 'UDP/TLS/RTP/SAVPF') + ' '),
                  (n +=
                    i.codecs
                      .map((e) =>
                        void 0 !== e.preferredPayloadType
                          ? e.preferredPayloadType
                          : e.payloadType,
                      )
                      .join(' ') + '\r\n'),
                  (n += 'c=IN IP4 0.0.0.0\r\n'),
                  (n += 'a=rtcp:9 IN IP4 0.0.0.0\r\n'),
                  i.codecs.forEach((e) => {
                    (n += t.writeRtpMap(e)),
                      (n += t.writeFmtp(e)),
                      (n += t.writeRtcpFb(e));
                  });
                let r = 0;
                return (
                  i.codecs.forEach((e) => {
                    e.maxptime > r && (r = e.maxptime);
                  }),
                  r > 0 && (n += 'a=maxptime:' + r + '\r\n'),
                  i.headerExtensions &&
                    i.headerExtensions.forEach((e) => {
                      n += t.writeExtmap(e);
                    }),
                  n
                );
              }),
              (t.parseRtpEncodingParameters = function (e) {
                const i = [],
                  n = t.parseRtpParameters(e),
                  r = -1 !== n.fecMechanisms.indexOf('RED'),
                  o = -1 !== n.fecMechanisms.indexOf('ULPFEC'),
                  s = t
                    .matchPrefix(e, 'a=ssrc:')
                    .map((e) => t.parseSsrcMedia(e))
                    .filter((e) => 'cname' === e.attribute),
                  a = s.length > 0 && s[0].ssrc;
                let c;
                const l = t.matchPrefix(e, 'a=ssrc-group:FID').map((e) =>
                  e
                    .substring(17)
                    .split(' ')
                    .map((e) => parseInt(e, 10)),
                );
                l.length > 0 &&
                  l[0].length > 1 &&
                  l[0][0] === a &&
                  (c = l[0][1]),
                  n.codecs.forEach((e) => {
                    if ('RTX' === e.name.toUpperCase() && e.parameters.apt) {
                      let t = {
                        ssrc: a,
                        codecPayloadType: parseInt(e.parameters.apt, 10),
                      };
                      a && c && (t.rtx = { ssrc: c }),
                        i.push(t),
                        r &&
                          ((t = JSON.parse(JSON.stringify(t))),
                          (t.fec = {
                            ssrc: a,
                            mechanism: o ? 'red+ulpfec' : 'red',
                          }),
                          i.push(t));
                    }
                  }),
                  0 === i.length && a && i.push({ ssrc: a });
                let d = t.matchPrefix(e, 'b=');
                return (
                  d.length &&
                    ((d =
                      0 === d[0].indexOf('b=TIAS:')
                        ? parseInt(d[0].substring(7), 10)
                        : 0 === d[0].indexOf('b=AS:')
                        ? 1e3 * parseInt(d[0].substring(5), 10) * 0.95 - 16e3
                        : void 0),
                    i.forEach((e) => {
                      e.maxBitrate = d;
                    })),
                  i
                );
              }),
              (t.parseRtcpParameters = function (e) {
                const i = {},
                  n = t
                    .matchPrefix(e, 'a=ssrc:')
                    .map((e) => t.parseSsrcMedia(e))
                    .filter((e) => 'cname' === e.attribute)[0];
                n && ((i.cname = n.value), (i.ssrc = n.ssrc));
                const r = t.matchPrefix(e, 'a=rtcp-rsize');
                (i.reducedSize = r.length > 0), (i.compound = 0 === r.length);
                const o = t.matchPrefix(e, 'a=rtcp-mux');
                return (i.mux = o.length > 0), i;
              }),
              (t.writeRtcpParameters = function (e) {
                let t = '';
                return (
                  e.reducedSize && (t += 'a=rtcp-rsize\r\n'),
                  e.mux && (t += 'a=rtcp-mux\r\n'),
                  void 0 !== e.ssrc &&
                    e.cname &&
                    (t += 'a=ssrc:' + e.ssrc + ' cname:' + e.cname + '\r\n'),
                  t
                );
              }),
              (t.parseMsid = function (e) {
                let i;
                const n = t.matchPrefix(e, 'a=msid:');
                if (1 === n.length)
                  return (
                    (i = n[0].substring(7).split(' ')),
                    { stream: i[0], track: i[1] }
                  );
                const r = t
                  .matchPrefix(e, 'a=ssrc:')
                  .map((e) => t.parseSsrcMedia(e))
                  .filter((e) => 'msid' === e.attribute);
                return r.length > 0
                  ? ((i = r[0].value.split(' ')), { stream: i[0], track: i[1] })
                  : void 0;
              }),
              (t.parseSctpDescription = function (e) {
                const i = t.parseMLine(e),
                  n = t.matchPrefix(e, 'a=max-message-size:');
                let r;
                n.length > 0 && (r = parseInt(n[0].substring(19), 10)),
                  isNaN(r) && (r = 65536);
                const o = t.matchPrefix(e, 'a=sctp-port:');
                if (o.length > 0)
                  return {
                    port: parseInt(o[0].substring(12), 10),
                    protocol: i.fmt,
                    maxMessageSize: r,
                  };
                const s = t.matchPrefix(e, 'a=sctpmap:');
                if (s.length > 0) {
                  const e = s[0].substring(10).split(' ');
                  return {
                    port: parseInt(e[0], 10),
                    protocol: e[1],
                    maxMessageSize: r,
                  };
                }
              }),
              (t.writeSctpDescription = function (e, t) {
                let i = [];
                return (
                  (i =
                    'DTLS/SCTP' !== e.protocol
                      ? [
                          'm=' +
                            e.kind +
                            ' 9 ' +
                            e.protocol +
                            ' ' +
                            t.protocol +
                            '\r\n',
                          'c=IN IP4 0.0.0.0\r\n',
                          'a=sctp-port:' + t.port + '\r\n',
                        ]
                      : [
                          'm=' +
                            e.kind +
                            ' 9 ' +
                            e.protocol +
                            ' ' +
                            t.port +
                            '\r\n',
                          'c=IN IP4 0.0.0.0\r\n',
                          'a=sctpmap:' +
                            t.port +
                            ' ' +
                            t.protocol +
                            ' 65535\r\n',
                        ]),
                  void 0 !== t.maxMessageSize &&
                    i.push('a=max-message-size:' + t.maxMessageSize + '\r\n'),
                  i.join('')
                );
              }),
              (t.generateSessionId = function () {
                return Math.random().toString().substr(2, 22);
              }),
              (t.writeSessionBoilerplate = function (e, i, n) {
                let r;
                const o = void 0 !== i ? i : 2;
                r = e || t.generateSessionId();
                return (
                  'v=0\r\no=' +
                  (n || 'thisisadapterortc') +
                  ' ' +
                  r +
                  ' ' +
                  o +
                  ' IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n'
                );
              }),
              (t.getDirection = function (e, i) {
                const n = t.splitLines(e);
                for (let t = 0; t < n.length; t++)
                  switch (n[t]) {
                    case 'a=sendrecv':
                    case 'a=sendonly':
                    case 'a=recvonly':
                    case 'a=inactive':
                      return n[t].substring(2);
                  }
                return i ? t.getDirection(i) : 'sendrecv';
              }),
              (t.getKind = function (e) {
                return t.splitLines(e)[0].split(' ')[0].substring(2);
              }),
              (t.isRejected = function (e) {
                return '0' === e.split(' ', 2)[1];
              }),
              (t.parseMLine = function (e) {
                const i = t.splitLines(e)[0].substring(2).split(' ');
                return {
                  kind: i[0],
                  port: parseInt(i[1], 10),
                  protocol: i[2],
                  fmt: i.slice(3).join(' '),
                };
              }),
              (t.parseOLine = function (e) {
                const i = t.matchPrefix(e, 'o=')[0].substring(2).split(' ');
                return {
                  username: i[0],
                  sessionId: i[1],
                  sessionVersion: parseInt(i[2], 10),
                  netType: i[3],
                  addressType: i[4],
                  address: i[5],
                };
              }),
              (t.isValidSDP = function (e) {
                if ('string' != typeof e || 0 === e.length) return !1;
                const i = t.splitLines(e);
                for (let t = 0; t < i.length; t++)
                  if (i[t].length < 2 || '=' !== i[t].charAt(1)) return !1;
                return !0;
              }),
              (e.exports = t);
          })(bC);
          var kC = CC,
            NC = e({ __proto__: null, default: kC }, [CC]);
          function DC(e) {
            if (
              !e.RTCIceCandidate ||
              (e.RTCIceCandidate && 'foundation' in e.RTCIceCandidate.prototype)
            )
              return;
            const t = e.RTCIceCandidate;
            (e.RTCIceCandidate = function (e) {
              if (
                ('object' == typeof e &&
                  e.candidate &&
                  0 === e.candidate.indexOf('a=') &&
                  ((e = JSON.parse(JSON.stringify(e))).candidate =
                    e.candidate.substring(2)),
                e.candidate && e.candidate.length)
              ) {
                const i = new t(e),
                  n = kC.parseCandidate(e.candidate);
                for (const e in n)
                  e in i || Object.defineProperty(i, e, { value: n[e] });
                return (
                  (i.toJSON = function () {
                    return {
                      candidate: i.candidate,
                      sdpMid: i.sdpMid,
                      sdpMLineIndex: i.sdpMLineIndex,
                      usernameFragment: i.usernameFragment,
                    };
                  }),
                  i
                );
              }
              return new t(e);
            }),
              (e.RTCIceCandidate.prototype = t.prototype),
              xR(
                e,
                'icecandidate',
                (t) => (
                  t.candidate &&
                    Object.defineProperty(t, 'candidate', {
                      value: new e.RTCIceCandidate(t.candidate),
                      writable: 'false',
                    }),
                  t
                ),
              );
          }
          function OC(e) {
            !e.RTCIceCandidate ||
              (e.RTCIceCandidate &&
                'relayProtocol' in e.RTCIceCandidate.prototype) ||
              xR(e, 'icecandidate', (e) => {
                if (e.candidate) {
                  const t = kC.parseCandidate(e.candidate.candidate);
                  'relay' === t.type &&
                    (e.candidate.relayProtocol = {
                      0: 'tls',
                      1: 'tcp',
                      2: 'udp',
                    }[t.priority >> 24]);
                }
                return e;
              });
          }
          function wC(e, t) {
            if (!e.RTCPeerConnection) return;
            'sctp' in e.RTCPeerConnection.prototype ||
              Object.defineProperty(e.RTCPeerConnection.prototype, 'sctp', {
                get() {
                  return void 0 === this._sctp ? null : this._sctp;
                },
              });
            const i = e.RTCPeerConnection.prototype.setRemoteDescription;
            e.RTCPeerConnection.prototype.setRemoteDescription = function () {
              if (
                ((this._sctp = null), 'chrome' === t.browser && t.version >= 76)
              ) {
                const { sdpSemantics: e } = this.getConfiguration();
                'plan-b' === e &&
                  Object.defineProperty(this, 'sctp', {
                    get() {
                      return void 0 === this._sctp ? null : this._sctp;
                    },
                    enumerable: !0,
                    configurable: !0,
                  });
              }
              if (
                (function (e) {
                  if (!e || !e.sdp) return !1;
                  const t = kC.splitSections(e.sdp);
                  return (
                    t.shift(),
                    t.some((e) => {
                      const t = kC.parseMLine(e);
                      return (
                        t &&
                        'application' === t.kind &&
                        -1 !== t.protocol.indexOf('SCTP')
                      );
                    })
                  );
                })(arguments[0])
              ) {
                const e = (function (e) {
                    const t = e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
                    if (null === t || t.length < 2) return -1;
                    const i = parseInt(t[1], 10);
                    return i != i ? -1 : i;
                  })(arguments[0]),
                  i = (function (e) {
                    let i = 65536;
                    return (
                      'firefox' === t.browser &&
                        (i =
                          t.version < 57
                            ? -1 === e
                              ? 16384
                              : 2147483637
                            : t.version < 60
                            ? 57 === t.version
                              ? 65535
                              : 65536
                            : 2147483637),
                      i
                    );
                  })(e),
                  n = (function (e, i) {
                    let n = 65536;
                    'firefox' === t.browser && 57 === t.version && (n = 65535);
                    const r = kC.matchPrefix(e.sdp, 'a=max-message-size:');
                    return (
                      r.length > 0
                        ? (n = parseInt(r[0].substring(19), 10))
                        : 'firefox' === t.browser &&
                          -1 !== i &&
                          (n = 2147483637),
                      n
                    );
                  })(arguments[0], e);
                let r;
                r =
                  0 === i && 0 === n
                    ? Number.POSITIVE_INFINITY
                    : 0 === i || 0 === n
                    ? Math.max(i, n)
                    : Math.min(i, n);
                const o = {};
                Object.defineProperty(o, 'maxMessageSize', { get: () => r }),
                  (this._sctp = o);
              }
              return i.apply(this, arguments);
            };
          }
          function PC(e) {
            if (
              !e.RTCPeerConnection ||
              !('createDataChannel' in e.RTCPeerConnection.prototype)
            )
              return;
            function t(e, t) {
              const i = e.send;
              e.send = function () {
                const n = arguments[0],
                  r = n.length || n.size || n.byteLength;
                if (
                  'open' === e.readyState &&
                  t.sctp &&
                  r > t.sctp.maxMessageSize
                )
                  throw new TypeError(
                    'Message too large (can send a maximum of ' +
                      t.sctp.maxMessageSize +
                      ' bytes)',
                  );
                return i.apply(e, arguments);
              };
            }
            const i = e.RTCPeerConnection.prototype.createDataChannel;
            (e.RTCPeerConnection.prototype.createDataChannel = function () {
              const e = i.apply(this, arguments);
              return t(e, this), e;
            }),
              xR(e, 'datachannel', (e) => (t(e.channel, e.target), e));
          }
          function LC(e) {
            if (
              !e.RTCPeerConnection ||
              'connectionState' in e.RTCPeerConnection.prototype
            )
              return;
            const t = e.RTCPeerConnection.prototype;
            Object.defineProperty(t, 'connectionState', {
              get() {
                return (
                  { completed: 'connected', checking: 'connecting' }[
                    this.iceConnectionState
                  ] || this.iceConnectionState
                );
              },
              enumerable: !0,
              configurable: !0,
            }),
              Object.defineProperty(t, 'onconnectionstatechange', {
                get() {
                  return this._onconnectionstatechange || null;
                },
                set(e) {
                  this._onconnectionstatechange &&
                    (this.removeEventListener(
                      'connectionstatechange',
                      this._onconnectionstatechange,
                    ),
                    delete this._onconnectionstatechange),
                    e &&
                      this.addEventListener(
                        'connectionstatechange',
                        (this._onconnectionstatechange = e),
                      );
                },
                enumerable: !0,
                configurable: !0,
              }),
              ['setLocalDescription', 'setRemoteDescription'].forEach((e) => {
                const i = t[e];
                t[e] = function () {
                  return (
                    this._connectionstatechangepoly ||
                      ((this._connectionstatechangepoly = (e) => {
                        const t = e.target;
                        if (t._lastConnectionState !== t.connectionState) {
                          t._lastConnectionState = t.connectionState;
                          const i = new Event('connectionstatechange', e);
                          t.dispatchEvent(i);
                        }
                        return e;
                      }),
                      this.addEventListener(
                        'iceconnectionstatechange',
                        this._connectionstatechangepoly,
                      )),
                    i.apply(this, arguments)
                  );
                };
              });
          }
          function MC(e, t) {
            if (!e.RTCPeerConnection) return;
            if ('chrome' === t.browser && t.version >= 71) return;
            if ('safari' === t.browser && t.version >= 605) return;
            const i = e.RTCPeerConnection.prototype.setRemoteDescription;
            e.RTCPeerConnection.prototype.setRemoteDescription = function (t) {
              if (
                t &&
                t.sdp &&
                -1 !== t.sdp.indexOf('\na=extmap-allow-mixed')
              ) {
                const i = t.sdp
                  .split('\n')
                  .filter((e) => 'a=extmap-allow-mixed' !== e.trim())
                  .join('\n');
                e.RTCSessionDescription && t instanceof e.RTCSessionDescription
                  ? (arguments[0] = new e.RTCSessionDescription({
                      type: t.type,
                      sdp: i,
                    }))
                  : (t.sdp = i);
              }
              return i.apply(this, arguments);
            };
          }
          function VC(e, t) {
            if (!e.RTCPeerConnection || !e.RTCPeerConnection.prototype) return;
            const i = e.RTCPeerConnection.prototype.addIceCandidate;
            i &&
              0 !== i.length &&
              (e.RTCPeerConnection.prototype.addIceCandidate = function () {
                return arguments[0]
                  ? (('chrome' === t.browser && t.version < 78) ||
                      ('firefox' === t.browser && t.version < 68) ||
                      'safari' === t.browser) &&
                    arguments[0] &&
                    '' === arguments[0].candidate
                    ? Promise.resolve()
                    : i.apply(this, arguments)
                  : (arguments[1] && arguments[1].apply(null),
                    Promise.resolve());
              });
          }
          function xC(e, t) {
            if (!e.RTCPeerConnection || !e.RTCPeerConnection.prototype) return;
            const i = e.RTCPeerConnection.prototype.setLocalDescription;
            i &&
              0 !== i.length &&
              (e.RTCPeerConnection.prototype.setLocalDescription = function () {
                let e = arguments[0] || {};
                if ('object' != typeof e || (e.type && e.sdp))
                  return i.apply(this, arguments);
                if (((e = { type: e.type, sdp: e.sdp }), !e.type))
                  switch (this.signalingState) {
                    case 'stable':
                    case 'have-local-offer':
                    case 'have-remote-pranswer':
                      e.type = 'offer';
                      break;
                    default:
                      e.type = 'answer';
                  }
                if (e.sdp || ('offer' !== e.type && 'answer' !== e.type))
                  return i.apply(this, [e]);
                return (
                  'offer' === e.type ? this.createOffer : this.createAnswer
                )
                  .apply(this)
                  .then((e) => i.apply(this, [e]));
              });
          }
          var UC = Object.freeze({
            __proto__: null,
            shimRTCIceCandidate: DC,
            shimRTCIceCandidateRelayProtocol: OC,
            shimMaxMessageSize: wC,
            shimSendThrowTypeError: PC,
            shimConnectionState: LC,
            removeExtmapAllowMixed: MC,
            shimAddIceCandidateNullOrEmpty: VC,
            shimParameterlessSetLocalDescription: xC,
          });
          !(function (
            { window: e } = {},
            t = { shimChrome: !0, shimFirefox: !0, shimSafari: !0 },
          ) {
            const i = BR,
              n = (function (e) {
                const t = { browser: null, version: null };
                if (void 0 === e || !e.navigator || !e.navigator.userAgent)
                  return (t.browser = 'Not a browser.'), t;
                const { navigator: i } = e;
                if (i.mozGetUserMedia)
                  (t.browser = 'firefox'),
                    (t.version = VR(i.userAgent, /Firefox\/(\d+)\./, 1));
                else if (
                  i.webkitGetUserMedia ||
                  (!1 === e.isSecureContext && e.webkitRTCPeerConnection)
                )
                  (t.browser = 'chrome'),
                    (t.version = VR(i.userAgent, /Chrom(e|ium)\/(\d+)\./, 2));
                else {
                  if (
                    !e.RTCPeerConnection ||
                    !i.userAgent.match(/AppleWebKit\/(\d+)\./)
                  )
                    return (t.browser = 'Not a supported browser.'), t;
                  (t.browser = 'safari'),
                    (t.version = VR(i.userAgent, /AppleWebKit\/(\d+)\./, 1)),
                    (t.supportsUnifiedPlan =
                      e.RTCRtpTransceiver &&
                      'currentDirection' in e.RTCRtpTransceiver.prototype);
                }
                return t;
              })(e),
              r = {
                browserDetails: n,
                commonShim: UC,
                extractVersion: VR,
                disableLog: UR,
                disableWarnings: FR,
                sdp: NC,
              };
            switch (n.browser) {
              case 'chrome':
                if (!nC || !tC || !t.shimChrome)
                  return (
                    i('Chrome shim is not included in this adapter release.'), r
                  );
                if (null === n.version)
                  return (
                    i('Chrome shim can not determine version, not shimming.'), r
                  );
                i('adapter.js shimming chrome.'),
                  (r.browserShim = nC),
                  VC(e, n),
                  xC(e),
                  YR(e, n),
                  zR(e),
                  tC(e, n),
                  qR(e),
                  eC(e, n),
                  QR(e),
                  XR(e),
                  $R(e),
                  iC(e, n),
                  DC(e),
                  OC(e),
                  LC(e),
                  wC(e, n),
                  PC(e),
                  MC(e, n);
                break;
              case 'firefox':
                if (!mC || !sC || !t.shimFirefox)
                  return (
                    i('Firefox shim is not included in this adapter release.'),
                    r
                  );
                i('adapter.js shimming firefox.'),
                  (r.browserShim = mC),
                  VC(e, n),
                  xC(e),
                  rC(e, n),
                  sC(e, n),
                  oC(e),
                  lC(e),
                  aC(e),
                  cC(e),
                  dC(e),
                  uC(e),
                  hC(e),
                  pC(e),
                  _C(e),
                  DC(e),
                  LC(e),
                  wC(e, n),
                  PC(e);
                break;
              case 'safari':
                if (!RC || !t.shimSafari)
                  return (
                    i('Safari shim is not included in this adapter release.'), r
                  );
                i('adapter.js shimming safari.'),
                  (r.browserShim = RC),
                  VC(e, n),
                  xC(e),
                  IC(e),
                  yC(e),
                  TC(e),
                  fC(e),
                  gC(e),
                  vC(e),
                  EC(e),
                  AC(e),
                  DC(e),
                  OC(e),
                  wC(e, n),
                  PC(e),
                  MC(e, n);
                break;
              default:
                i('Unsupported browser!');
            }
          })({ window: 'undefined' == typeof window ? void 0 : window });
          var FC,
            BC = Object.create,
            HC = Object.defineProperty,
            jC = Object.defineProperties,
            GC = Object.getOwnPropertyDescriptor,
            WC = Object.getOwnPropertyDescriptors,
            JC = Object.getOwnPropertyNames,
            KC = Object.getOwnPropertySymbols,
            YC = Object.getPrototypeOf,
            zC = Object.prototype.hasOwnProperty,
            qC = Object.prototype.propertyIsEnumerable,
            QC = Reflect.get,
            XC = Math.pow,
            $C = (e, t, i) =>
              t in e
                ? HC(e, t, {
                    enumerable: !0,
                    configurable: !0,
                    writable: !0,
                    value: i,
                  })
                : (e[t] = i),
            ZC = (e, t) => {
              for (var i in t || (t = {})) zC.call(t, i) && $C(e, i, t[i]);
              if (KC) for (var i of KC(t)) qC.call(t, i) && $C(e, i, t[i]);
              return e;
            },
            eb = (e, t) => jC(e, WC(t)),
            tb = (e, t) => () => (
              t || e((t = { exports: {} }).exports, t), t.exports
            ),
            ib = (e, t) => {
              for (var i in t) HC(e, i, { get: t[i], enumerable: !0 });
            },
            nb = (e, t, i) => (
              (i = null != e ? BC(YC(e)) : {}),
              ((e, t, i, n) => {
                if ((t && 'object' == typeof t) || 'function' == typeof t)
                  for (let r of JC(t))
                    !zC.call(e, r) &&
                      r !== i &&
                      HC(e, r, {
                        get: () => t[r],
                        enumerable: !(n = GC(t, r)) || n.enumerable,
                      });
                return e;
              })(
                !t && e && e.__esModule
                  ? i
                  : HC(i, 'default', { value: e, enumerable: !0 }),
                e,
              )
            ),
            rb = (e, t, i, n) => {
              for (
                var r, o = n > 1 ? void 0 : n ? GC(t, i) : t, s = e.length - 1;
                s >= 0;
                s--
              )
                (r = e[s]) && (o = (n ? r(t, i, o) : r(o)) || o);
              return n && o && HC(t, i, o), o;
            },
            ob = (e, t, i) => ($C(e, 'symbol' != typeof t ? t + '' : t, i), i),
            sb = (e, t, i) => QC(YC(e), i, t),
            ab = (e, t, i) =>
              new Promise((n, r) => {
                var o = (e) => {
                    try {
                      a(i.next(e));
                    } catch (t) {
                      r(t);
                    }
                  },
                  s = (e) => {
                    try {
                      a(i.throw(e));
                    } catch (t) {
                      r(t);
                    }
                  },
                  a = (e) =>
                    e.done ? n(e.value) : Promise.resolve(e.value).then(o, s);
                a((i = i.apply(e, t)).next());
              }),
            cb = tb((e, t) => {
              var i = Object.prototype.hasOwnProperty,
                n = '~';
              function r() {}
              function o(e, t, i) {
                (this.fn = e), (this.context = t), (this.once = i || !1);
              }
              function s(e, t, i, r, s) {
                if ('function' != typeof i)
                  throw new TypeError('The listener must be a function');
                var a = new o(i, r || e, s),
                  c = n ? n + t : t;
                return (
                  e._events[c]
                    ? e._events[c].fn
                      ? (e._events[c] = [e._events[c], a])
                      : e._events[c].push(a)
                    : ((e._events[c] = a), e._eventsCount++),
                  e
                );
              }
              function a(e, t) {
                0 == --e._eventsCount
                  ? (e._events = new r())
                  : delete e._events[t];
              }
              function c() {
                (this._events = new r()), (this._eventsCount = 0);
              }
              Object.create &&
                ((r.prototype = Object.create(null)),
                new r().__proto__ || (n = !1)),
                (c.prototype.eventNames = function () {
                  var e,
                    t,
                    r = [];
                  if (0 === this._eventsCount) return r;
                  for (t in (e = this._events))
                    i.call(e, t) && r.push(n ? t.slice(1) : t);
                  return Object.getOwnPropertySymbols
                    ? r.concat(Object.getOwnPropertySymbols(e))
                    : r;
                }),
                (c.prototype.listeners = function (e) {
                  var t = n ? n + e : e,
                    i = this._events[t];
                  if (!i) return [];
                  if (i.fn) return [i.fn];
                  for (var r = 0, o = i.length, s = new Array(o); r < o; r++)
                    s[r] = i[r].fn;
                  return s;
                }),
                (c.prototype.listenerCount = function (e) {
                  var t = n ? n + e : e,
                    i = this._events[t];
                  return i ? (i.fn ? 1 : i.length) : 0;
                }),
                (c.prototype.emit = function (e, t, i, r, o, s) {
                  var a = n ? n + e : e;
                  if (!this._events[a]) return !1;
                  var c,
                    l,
                    d = this._events[a],
                    u = arguments.length;
                  if (d.fn) {
                    switch (
                      (d.once && this.removeListener(e, d.fn, void 0, !0), u)
                    ) {
                      case 1:
                        return d.fn.call(d.context), !0;
                      case 2:
                        return d.fn.call(d.context, t), !0;
                      case 3:
                        return d.fn.call(d.context, t, i), !0;
                      case 4:
                        return d.fn.call(d.context, t, i, r), !0;
                      case 5:
                        return d.fn.call(d.context, t, i, r, o), !0;
                      case 6:
                        return d.fn.call(d.context, t, i, r, o, s), !0;
                    }
                    for (l = 1, c = new Array(u - 1); l < u; l++)
                      c[l - 1] = arguments[l];
                    d.fn.apply(d.context, c);
                  } else {
                    var h,
                      p = d.length;
                    for (l = 0; l < p; l++)
                      switch (
                        (d[l].once &&
                          this.removeListener(e, d[l].fn, void 0, !0),
                        u)
                      ) {
                        case 1:
                          d[l].fn.call(d[l].context);
                          break;
                        case 2:
                          d[l].fn.call(d[l].context, t);
                          break;
                        case 3:
                          d[l].fn.call(d[l].context, t, i);
                          break;
                        case 4:
                          d[l].fn.call(d[l].context, t, i, r);
                          break;
                        default:
                          if (!c)
                            for (h = 1, c = new Array(u - 1); h < u; h++)
                              c[h - 1] = arguments[h];
                          d[l].fn.apply(d[l].context, c);
                      }
                  }
                  return !0;
                }),
                (c.prototype.on = function (e, t, i) {
                  return s(this, e, t, i, !1);
                }),
                (c.prototype.once = function (e, t, i) {
                  return s(this, e, t, i, !0);
                }),
                (c.prototype.removeListener = function (e, t, i, r) {
                  var o = n ? n + e : e;
                  if (!this._events[o]) return this;
                  if (!t) return a(this, o), this;
                  var s = this._events[o];
                  if (s.fn)
                    s.fn === t &&
                      (!r || s.once) &&
                      (!i || s.context === i) &&
                      a(this, o);
                  else {
                    for (var c = 0, l = [], d = s.length; c < d; c++)
                      (s[c].fn !== t ||
                        (r && !s[c].once) ||
                        (i && s[c].context !== i)) &&
                        l.push(s[c]);
                    l.length
                      ? (this._events[o] = 1 === l.length ? l[0] : l)
                      : a(this, o);
                  }
                  return this;
                }),
                (c.prototype.removeAllListeners = function (e) {
                  var t;
                  return (
                    e
                      ? ((t = n ? n + e : e), this._events[t] && a(this, t))
                      : ((this._events = new r()), (this._eventsCount = 0)),
                    this
                  );
                }),
                (c.prototype.off = c.prototype.removeListener),
                (c.prototype.addListener = c.prototype.on),
                (c.prefixed = n),
                (c.EventEmitter = c),
                void 0 !== t && (t.exports = c);
            }),
            lb = tb((e, t) => {
              var i = (t.exports = {
                v: [{ name: 'version', reg: /^(\d*)$/ }],
                o: [
                  {
                    name: 'origin',
                    reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
                    names: [
                      'username',
                      'sessionId',
                      'sessionVersion',
                      'netType',
                      'ipVer',
                      'address',
                    ],
                    format: '%s %s %d %s IP%d %s',
                  },
                ],
                s: [{ name: 'name' }],
                i: [{ name: 'description' }],
                u: [{ name: 'uri' }],
                e: [{ name: 'email' }],
                p: [{ name: 'phone' }],
                z: [{ name: 'timezones' }],
                r: [{ name: 'repeats' }],
                t: [
                  {
                    name: 'timing',
                    reg: /^(\d*) (\d*)/,
                    names: ['start', 'stop'],
                    format: '%d %d',
                  },
                ],
                c: [
                  {
                    name: 'connection',
                    reg: /^IN IP(\d) (\S*)/,
                    names: ['version', 'ip'],
                    format: 'IN IP%d %s',
                  },
                ],
                b: [
                  {
                    push: 'bandwidth',
                    reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
                    names: ['type', 'limit'],
                    format: '%s:%s',
                  },
                ],
                m: [
                  {
                    reg: /^(\w*) (\d*) ([\w/]*)(?: (.*))?/,
                    names: ['type', 'port', 'protocol', 'payloads'],
                    format: '%s %d %s %s',
                  },
                ],
                a: [
                  {
                    push: 'rtp',
                    reg: /^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,
                    names: ['payload', 'codec', 'rate', 'encoding'],
                    format: function (e) {
                      return e.encoding
                        ? 'rtpmap:%d %s/%s/%s'
                        : e.rate
                        ? 'rtpmap:%d %s/%s'
                        : 'rtpmap:%d %s';
                    },
                  },
                  {
                    push: 'fmtp',
                    reg: /^fmtp:(\d*) ([\S| ]*)/,
                    names: ['payload', 'config'],
                    format: 'fmtp:%d %s',
                  },
                  {
                    name: 'control',
                    reg: /^control:(.*)/,
                    format: 'control:%s',
                  },
                  {
                    name: 'rtcp',
                    reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
                    names: ['port', 'netType', 'ipVer', 'address'],
                    format: function (e) {
                      return null != e.address
                        ? 'rtcp:%d %s IP%d %s'
                        : 'rtcp:%d';
                    },
                  },
                  {
                    push: 'rtcpFbTrrInt',
                    reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
                    names: ['payload', 'value'],
                    format: 'rtcp-fb:%d trr-int %d',
                  },
                  {
                    push: 'rtcpFb',
                    reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
                    names: ['payload', 'type', 'subtype'],
                    format: function (e) {
                      return null != e.subtype
                        ? 'rtcp-fb:%s %s %s'
                        : 'rtcp-fb:%s %s';
                    },
                  },
                  {
                    push: 'ext',
                    reg: /^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,
                    names: [
                      'value',
                      'direction',
                      'encrypt-uri',
                      'uri',
                      'config',
                    ],
                    format: function (e) {
                      return (
                        'extmap:%d' +
                        (e.direction ? '/%s' : '%v') +
                        (e['encrypt-uri'] ? ' %s' : '%v') +
                        ' %s' +
                        (e.config ? ' %s' : '')
                      );
                    },
                  },
                  {
                    push: 'crypto',
                    reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
                    names: ['id', 'suite', 'config', 'sessionConfig'],
                    format: function (e) {
                      return null != e.sessionConfig
                        ? 'crypto:%d %s %s %s'
                        : 'crypto:%d %s %s';
                    },
                  },
                  { name: 'setup', reg: /^setup:(\w*)/, format: 'setup:%s' },
                  { name: 'mid', reg: /^mid:([^\s]*)/, format: 'mid:%s' },
                  { name: 'msid', reg: /^msid:(.*)/, format: 'msid:%s' },
                  { name: 'ptime', reg: /^ptime:(\d*)/, format: 'ptime:%d' },
                  {
                    name: 'maxptime',
                    reg: /^maxptime:(\d*)/,
                    format: 'maxptime:%d',
                  },
                  {
                    name: 'direction',
                    reg: /^(sendrecv|recvonly|sendonly|inactive)/,
                  },
                  { name: 'icelite', reg: /^(ice-lite)/ },
                  {
                    name: 'iceUfrag',
                    reg: /^ice-ufrag:(\S*)/,
                    format: 'ice-ufrag:%s',
                  },
                  {
                    name: 'icePwd',
                    reg: /^ice-pwd:(\S*)/,
                    format: 'ice-pwd:%s',
                  },
                  {
                    name: 'fingerprint',
                    reg: /^fingerprint:(\S*) (\S*)/,
                    names: ['type', 'hash'],
                    format: 'fingerprint:%s %s',
                  },
                  {
                    push: 'candidates',
                    reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,
                    names: [
                      'foundation',
                      'component',
                      'transport',
                      'priority',
                      'ip',
                      'port',
                      'type',
                      'raddr',
                      'rport',
                      'tcptype',
                      'generation',
                      'network-id',
                      'network-cost',
                    ],
                    format: function (e) {
                      var t = 'candidate:%s %d %s %d %s %d typ %s';
                      return (
                        (t += null != e.raddr ? ' raddr %s rport %d' : '%v%v'),
                        (t += null != e.tcptype ? ' tcptype %s' : '%v'),
                        null != e.generation && (t += ' generation %d'),
                        (t +=
                          null != e['network-id'] ? ' network-id %d' : '%v'),
                        (t +=
                          null != e['network-cost'] ? ' network-cost %d' : '%v')
                      );
                    },
                  },
                  { name: 'endOfCandidates', reg: /^(end-of-candidates)/ },
                  {
                    name: 'remoteCandidates',
                    reg: /^remote-candidates:(.*)/,
                    format: 'remote-candidates:%s',
                  },
                  {
                    name: 'iceOptions',
                    reg: /^ice-options:(\S*)/,
                    format: 'ice-options:%s',
                  },
                  {
                    push: 'ssrcs',
                    reg: /^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,
                    names: ['id', 'attribute', 'value'],
                    format: function (e) {
                      var t = 'ssrc:%d';
                      return (
                        null != e.attribute &&
                          ((t += ' %s'), null != e.value && (t += ':%s')),
                        t
                      );
                    },
                  },
                  {
                    push: 'ssrcGroups',
                    reg: /^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,
                    names: ['semantics', 'ssrcs'],
                    format: 'ssrc-group:%s %s',
                  },
                  {
                    name: 'msidSemantic',
                    reg: /^msid-semantic:\s?(\w*) (\S*)/,
                    names: ['semantic', 'token'],
                    format: 'msid-semantic: %s %s',
                  },
                  {
                    push: 'groups',
                    reg: /^group:(\w*) (.*)/,
                    names: ['type', 'mids'],
                    format: 'group:%s %s',
                  },
                  { name: 'rtcpMux', reg: /^(rtcp-mux)/ },
                  { name: 'rtcpRsize', reg: /^(rtcp-rsize)/ },
                  {
                    name: 'sctpmap',
                    reg: /^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,
                    names: ['sctpmapNumber', 'app', 'maxMessageSize'],
                    format: function (e) {
                      return null != e.maxMessageSize
                        ? 'sctpmap:%s %s %s'
                        : 'sctpmap:%s %s';
                    },
                  },
                  {
                    name: 'xGoogleFlag',
                    reg: /^x-google-flag:([^\s]*)/,
                    format: 'x-google-flag:%s',
                  },
                  {
                    push: 'rids',
                    reg: /^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,
                    names: ['id', 'direction', 'params'],
                    format: function (e) {
                      return e.params ? 'rid:%s %s %s' : 'rid:%s %s';
                    },
                  },
                  {
                    push: 'imageattrs',
                    reg: new RegExp(
                      '^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?',
                    ),
                    names: ['pt', 'dir1', 'attrs1', 'dir2', 'attrs2'],
                    format: function (e) {
                      return 'imageattr:%s %s %s' + (e.dir2 ? ' %s %s' : '');
                    },
                  },
                  {
                    name: 'simulcast',
                    reg: new RegExp(
                      '^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$',
                    ),
                    names: ['dir1', 'list1', 'dir2', 'list2'],
                    format: function (e) {
                      return 'simulcast:%s %s' + (e.dir2 ? ' %s %s' : '');
                    },
                  },
                  {
                    name: 'simulcast_03',
                    reg: /^simulcast:[\s\t]+([\S+\s\t]+)$/,
                    names: ['value'],
                    format: 'simulcast: %s',
                  },
                  {
                    name: 'framerate',
                    reg: /^framerate:(\d+(?:$|\.\d+))/,
                    format: 'framerate:%s',
                  },
                  {
                    name: 'sourceFilter',
                    reg: /^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,
                    names: [
                      'filterMode',
                      'netType',
                      'addressTypes',
                      'destAddress',
                      'srcList',
                    ],
                    format: 'source-filter: %s %s %s %s %s',
                  },
                  { name: 'bundleOnly', reg: /^(bundle-only)/ },
                  { name: 'label', reg: /^label:(.+)/, format: 'label:%s' },
                  {
                    name: 'sctpPort',
                    reg: /^sctp-port:(\d+)$/,
                    format: 'sctp-port:%s',
                  },
                  {
                    name: 'maxMessageSize',
                    reg: /^max-message-size:(\d+)$/,
                    format: 'max-message-size:%s',
                  },
                  { push: 'invalid', names: ['value'] },
                ],
              });
              Object.keys(i).forEach(function (e) {
                i[e].forEach(function (e) {
                  e.reg || (e.reg = /(.*)/), e.format || (e.format = '%s');
                });
              });
            }),
            db = tb((e) => {
              var t = function (e) {
                  return String(Number(e)) === e ? Number(e) : e;
                },
                i = function (e, i, n) {
                  var r = e.name && e.names;
                  e.push && !i[e.push]
                    ? (i[e.push] = [])
                    : r && !i[e.name] && (i[e.name] = {});
                  var o = e.push ? {} : r ? i[e.name] : i;
                  (function (e, i, n, r) {
                    if (r && !n) i[r] = t(e[1]);
                    else
                      for (var o = 0; o < n.length; o += 1)
                        null != e[o + 1] && (i[n[o]] = t(e[o + 1]));
                  })(n.match(e.reg), o, e.names, e.name),
                    e.push && i[e.push].push(o);
                },
                n = lb(),
                r = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
              e.parse = function (e) {
                var t = {},
                  o = [],
                  s = t;
                return (
                  e
                    .split(/(\r\n|\r|\n)/)
                    .filter(r)
                    .forEach(function (e) {
                      var t = e[0],
                        r = e.slice(2);
                      'm' === t &&
                        (o.push({ rtp: [], fmtp: [] }), (s = o[o.length - 1]));
                      for (var a = 0; a < (n[t] || []).length; a += 1) {
                        var c = n[t][a];
                        if (c.reg.test(r)) return i(c, s, r);
                      }
                    }),
                  (t.media = o),
                  t
                );
              };
              var o = function (e, i) {
                var n = i.split(/=(.+)/, 2);
                return (
                  2 === n.length
                    ? (e[n[0]] = t(n[1]))
                    : 1 === n.length && i.length > 1 && (e[n[0]] = void 0),
                  e
                );
              };
              (e.parseParams = function (e) {
                return e.split(/;\s?/).reduce(o, {});
              }),
                (e.parseFmtpConfig = e.parseParams),
                (e.parsePayloads = function (e) {
                  return e.toString().split(' ').map(Number);
                }),
                (e.parseRemoteCandidates = function (e) {
                  for (
                    var i = [], n = e.split(' ').map(t), r = 0;
                    r < n.length;
                    r += 3
                  )
                    i.push({ component: n[r], ip: n[r + 1], port: n[r + 2] });
                  return i;
                }),
                (e.parseImageAttributes = function (e) {
                  return e.split(' ').map(function (e) {
                    return e
                      .substring(1, e.length - 1)
                      .split(',')
                      .reduce(o, {});
                  });
                }),
                (e.parseSimulcastStreamList = function (e) {
                  return e.split(';').map(function (e) {
                    return e.split(',').map(function (e) {
                      var i,
                        n = !1;
                      return (
                        '~' !== e[0]
                          ? (i = t(e))
                          : ((i = t(e.substring(1, e.length))), (n = !0)),
                        { scid: i, paused: n }
                      );
                    });
                  });
                });
            }),
            ub = tb((e, t) => {
              var i = lb(),
                n = /%[sdv%]/g,
                r = function (e) {
                  var t = 1,
                    i = arguments,
                    r = i.length;
                  return e.replace(n, function (e) {
                    if (t >= r) return e;
                    var n = i[t];
                    switch (((t += 1), e)) {
                      case '%%':
                        return '%';
                      case '%s':
                        return String(n);
                      case '%d':
                        return Number(n);
                      case '%v':
                        return '';
                    }
                  });
                },
                o = function (e, t, i) {
                  var n = [
                    e +
                      '=' +
                      (t.format instanceof Function
                        ? t.format(t.push ? i : i[t.name])
                        : t.format),
                  ];
                  if (t.names)
                    for (var o = 0; o < t.names.length; o += 1) {
                      var s = t.names[o];
                      t.name ? n.push(i[t.name][s]) : n.push(i[t.names[o]]);
                    }
                  else n.push(i[t.name]);
                  return r.apply(null, n);
                },
                s = [
                  'v',
                  'o',
                  's',
                  'i',
                  'u',
                  'e',
                  'p',
                  'c',
                  'b',
                  't',
                  'r',
                  'z',
                  'a',
                ],
                a = ['i', 'c', 'b', 'a'];
              t.exports = function (e, t) {
                (t = t || {}),
                  null == e.version && (e.version = 0),
                  null == e.name && (e.name = ' '),
                  e.media.forEach(function (e) {
                    null == e.payloads && (e.payloads = '');
                  });
                var n = t.outerOrder || s,
                  r = t.innerOrder || a,
                  c = [];
                return (
                  n.forEach(function (t) {
                    i[t].forEach(function (i) {
                      i.name in e && null != e[i.name]
                        ? c.push(o(t, i, e))
                        : i.push in e &&
                          null != e[i.push] &&
                          e[i.push].forEach(function (e) {
                            c.push(o(t, i, e));
                          });
                    });
                  }),
                  e.media.forEach(function (e) {
                    c.push(o('m', i.m[0], e)),
                      r.forEach(function (t) {
                        i[t].forEach(function (i) {
                          i.name in e && null != e[i.name]
                            ? c.push(o(t, i, e))
                            : i.push in e &&
                              null != e[i.push] &&
                              e[i.push].forEach(function (e) {
                                c.push(o(t, i, e));
                              });
                        });
                      });
                  }),
                  c.join('\r\n') + '\r\n'
                );
              };
            }),
            hb = tb((e) => {
              var t = db(),
                i = ub();
              (e.write = i),
                (e.parse = t.parse),
                (e.parseFmtpConfig = t.parseFmtpConfig),
                (e.parseParams = t.parseParams),
                (e.parsePayloads = t.parsePayloads),
                (e.parseRemoteCandidates = t.parseRemoteCandidates),
                (e.parseImageAttributes = t.parseImageAttributes),
                (e.parseSimulcastStreamList = t.parseSimulcastStreamList);
            }),
            pb = nb(cb()),
            _b =
              (((FC = _b || {})[(FC.INVALID_PARAMETER = 4096)] =
                'INVALID_PARAMETER'),
              (FC[(FC.INVALID_OPERATION = 4097)] = 'INVALID_OPERATION'),
              (FC[(FC.NOT_SUPPORTED = 4098)] = 'NOT_SUPPORTED'),
              (FC[(FC.DEVICE_NOT_FOUND = 4099)] = 'DEVICE_NOT_FOUND'),
              (FC[(FC.INITIALIZE_FAILED = 4100)] = 'INITIALIZE_FAILED'),
              (FC[(FC.SIGNAL_CHANNEL_SETUP_FAILED = 16385)] =
                'SIGNAL_CHANNEL_SETUP_FAILED'),
              (FC[(FC.SIGNAL_CHANNEL_ERROR = 16386)] = 'SIGNAL_CHANNEL_ERROR'),
              (FC[(FC.ICE_TRANSPORT_ERROR = 16387)] = 'ICE_TRANSPORT_ERROR'),
              (FC[(FC.JOIN_ROOM_FAILED = 16388)] = 'JOIN_ROOM_FAILED'),
              (FC[(FC.CREATE_OFFER_FAILED = 16389)] = 'CREATE_OFFER_FAILED'),
              (FC[(FC.SIGNAL_CHANNEL_RECONNECTION_FAILED = 16390)] =
                'SIGNAL_CHANNEL_RECONNECTION_FAILED'),
              (FC[(FC.UPLINK_RECONNECTION_FAILED = 16391)] =
                'UPLINK_RECONNECTION_FAILED'),
              (FC[(FC.DOWNLINK_RECONNECTION_FAILED = 16392)] =
                'DOWNLINK_RECONNECTION_FAILED'),
              (FC[(FC.REMOTE_STREAM_NOT_EXIST = 16400)] =
                'REMOTE_STREAM_NOT_EXIST'),
              (FC[(FC.CLIENT_BANNED = 16448)] = 'CLIENT_BANNED'),
              (FC[(FC.SERVER_TIMEOUT = 16449)] = 'SERVER_TIMEOUT'),
              (FC[(FC.SUBSCRIPTION_TIMEOUT = 16450)] = 'SUBSCRIPTION_TIMEOUT'),
              (FC[(FC.PLAY_NOT_ALLOWED = 16451)] = 'PLAY_NOT_ALLOWED'),
              (FC[(FC.DEVICE_AUTO_RECOVER_FAILED = 16452)] =
                'DEVICE_AUTO_RECOVER_FAILED'),
              (FC[(FC.START_PUBLISH_CDN_FAILED = 16453)] =
                'START_PUBLISH_CDN_FAILED'),
              (FC[(FC.STOP_PUBLISH_CDN_FAILED = 16454)] =
                'STOP_PUBLISH_CDN_FAILED'),
              (FC[(FC.START_MIX_TRANSCODE_FAILED = 16455)] =
                'START_MIX_TRANSCODE_FAILED'),
              (FC[(FC.STOP_MIX_TRANSCODE_FAILED = 16456)] =
                'STOP_MIX_TRANSCODE_FAILED'),
              (FC[(FC.NOT_SUPPORTED_H264 = 16457)] = 'NOT_SUPPORTED_H264'),
              (FC[(FC.SWITCH_ROLE_FAILED = 16458)] = 'SWITCH_ROLE_FAILED'),
              (FC[(FC.API_CALL_TIMEOUT = 16459)] = 'API_CALL_TIMEOUT'),
              (FC[(FC.SCHEDULE_FAILED = 16460)] = 'SCHEDULE_FAILED'),
              (FC[(FC.API_CALL_ABORTED = 16461)] = 'API_CALL_ABORTED'),
              (FC[(FC.UNKNOWN = 65535)] = 'UNKNOWN'),
              FC),
            mb = _b,
            fb = class extends Error {
              constructor(e) {
                let {
                    name: t = 'RtcError',
                    message: i,
                    code: n = mb.UNKNOWN,
                    extraCode: r = 0,
                    constraint: o,
                  } = e,
                  s = '<'
                    .concat(
                      (function (e) {
                        for (let t in mb) if (mb[t] === e) return t;
                        return 'UNKNOWN';
                      })(n),
                      ' 0x',
                    )
                    .concat(n.toString(16), '>'),
                  a = ''
                    .concat(i)
                    .concat(o ? ' constraint: '.concat(o) : '')
                    .concat(null != i && i.includes(s) ? '' : ' '.concat(s));
                super(a),
                  ob(this, 'code'),
                  ob(this, 'extraCode'),
                  ob(this, 'message'),
                  ob(this, 'originMessage'),
                  ob(this, 'name'),
                  ob(this, 'constraint'),
                  (this.code = n),
                  (this.extraCode = r),
                  (this.name = t),
                  (this.message = a),
                  (this.constraint = o),
                  (this.originMessage = i);
              }
              getCode() {
                return this.code;
              }
              getExtraCode() {
                return this.extraCode;
              }
              toString() {
                return this.originMessage;
              }
            },
            gb = fb,
            Tb = (new Date().getTime(), 0),
            Eb = function () {
              return new Date().getTime() + Tb;
            },
            Sb = function () {
              let e = new Date();
              return e.setTime(Eb()), e.toLocaleString();
            },
            Ib = {};
          ib(Ib, {
            bytes2ms: () => KD,
            copyProperties: () => JD,
            deepClone: () => CO,
            deepMerge: () => RO,
            env: () => vb,
            fibonacci: () => ZD,
            formatedTime: () => NO,
            getConstructorName: () => pO,
            getContainerFromElement: () => bO,
            getEnv: () => UD,
            getInternalVersion: () => TO,
            getLoggerUrl: () => BD,
            getMuteStateFromFlag: () => IO,
            getNetworkQuality: () => vO,
            getNetworkType: () => GD,
            getOSType: () => jD,
            getReconnectionTimeout: () => eO,
            getStringByteLength: () => wO,
            getSysInfo: () => WD,
            getTerminalType: () => HD,
            getTurnServer: () => yO,
            getValueType: () => tO,
            glog: () => QD,
            ipv4ToUint32: () => AO,
            isArray: () => cO,
            isAudioWorkletSupported: () => _O,
            isBoolean: () => sO,
            isConstructor: () => hO,
            isEmpty: () => SO,
            isFunction: () => iO,
            isLangChinese: () => XD,
            isMediaStreamTrack: () => lO,
            isNumber: () => oO,
            isObject: () => aO,
            isOverseaSdkAppId: () => FD,
            isPlainObject: () => $D,
            isPromise: () => uO,
            isRemoteTrack: () => dO,
            isString: () => rO,
            isUndefined: () => nO,
            logVisibilityState: () => PO,
            ms2bytes: () => zD,
            ms2samples: () => qD,
            performanceNow: () => fO,
            promiseAny: () => mO,
            samples2ms: () => YD,
            stringify: () => DO,
            stringifyIncludeValue: () => OO,
          });
          var vb = {};
          ib(vb, {
            ANDROID_VERSION: () => Mb,
            CHROME_MAJOR_VERSION: () => Vk,
            CHROME_VERSION: () => xk,
            EDGE_VERSION: () => jb,
            EDG_MAJOR_VERSION: () => Jb,
            EDG_VERSION: () => Wb,
            FIREFOX_MAJOR_VERSION: () => Bb,
            FIREFOX_VERSION: () => Fb,
            HUAWEI_VERSION: () => Rk,
            IE_VERSION: () => ik,
            IOS_MAIN_VERSION: () => Gk,
            IOS_VERSION: () => jk,
            IPADQQB_VERSION: () => pk,
            IS_ANDROID: () => Lb,
            IS_ANDROID_WEBVIEW: () => Hk,
            IS_ANY_SAFARI: () => Fk,
            IS_CHROME: () => Lk,
            IS_CHROME_OS: () => gk,
            IS_CHROMIUM_BASE: () => Pk,
            IS_EDG: () => Gb,
            IS_EDGE: () => Hb,
            IS_ELECTRON: () => Sk,
            IS_FIREFOX: () => Ub,
            IS_HEADLESS_CHROME: () => Mk,
            IS_HUAWEI: () => Ak,
            IS_HUAWEIBROWSER: () => yk,
            IS_IE: () => tk,
            IS_IE8: () => ek,
            IS_IOS: () => Pb,
            IS_IOS_13_OR_14: () => Kk,
            IS_IOS_15_1: () => Jk,
            IS_IPAD: () => Nb,
            IS_IPADQQB: () => hk,
            IS_IPAD_PRO: () => Db,
            IS_IPHONE: () => Ob,
            IS_IPOD: () => wb,
            IS_LINUX: () => fk,
            IS_LOCAL: () => Yk,
            IS_MAC: () => mk,
            IS_MACQQB: () => dk,
            IS_MIBROWSER: () => Ik,
            IS_MQQB: () => sk,
            IS_NATIVE_ANDROID: () => xb,
            IS_OLD_ANDROID: () => Vb,
            IS_OPPOBROWSER: () => kk,
            IS_SAFARI: () => Uk,
            IS_SAFARI_15_1: () => Wk,
            IS_SAMSUNGBROWSER: () => Ck,
            IS_SOGOU: () => zb,
            IS_SOGOUM: () => Kb,
            IS_TBS: () => Qb,
            IS_UCBROWSER: () => Ek,
            IS_VIVOBROWSER: () => Dk,
            IS_WECHAT: () => nk,
            IS_WIN: () => _k,
            IS_WQQB: () => ck,
            IS_WX: () => Tk,
            IS_X5MQQB: () => ok,
            IS_XWEB: () => $b,
            MACQQB_VERSION: () => uk,
            MI_VERSION: () => vk,
            MQQB_VERSION: () => ak,
            OPPO_VERSION: () => Nk,
            SAFARI_VERSION: () => Bk,
            SAMSUNG_VERSION: () => bk,
            SOGOUM_VERSION: () => Yb,
            SOGOU_VERSION: () => qb,
            TBS_VERSION: () => Xb,
            USER_AGENT: () => yb,
            VIVO_VERSION: () => Ok,
            WECHAT_VERSION: () => rk,
            WQQB_VERSION: () => lk,
            XWEB_VERSION: () => Zb,
            browserInfo: () => qk,
            getBrowserInfo: () => Qk,
            getChromeMajorVersion: () => wk,
            getOSName: () => eN,
            getOSString: () => tN,
            getUserAgentData: () => $k,
            isLocalStorageEnabled: () => zk,
          });
          var yb = 'undefined' == typeof navigator ? '' : navigator.userAgent,
            Ab = (e) => new RegExp(e, 'i').test(yb),
            Rb = (e) => {
              if (Ab(e)) {
                let t = new RegExp(''.concat(e, '\\/([\\d.]+)')),
                  i = yb.match(t);
                if (i && i[1]) return i[1];
              }
              return '';
            },
            Cb = (e) => {
              if (Ab(e)) {
                let t = new RegExp(''.concat(e, '\\/(\\d+)')),
                  i = yb.match(t);
                if (i && i[1]) return parseFloat(i[1]);
              }
              return NaN;
            },
            bb = /AppleWebKit\/([\d.]+)/i.exec(yb),
            kb = bb ? parseFloat(bb[1]) : NaN,
            Nb = Ab('iPad'),
            Db =
              'undefined' != typeof navigator &&
              navigator.maxTouchPoints &&
              navigator.maxTouchPoints > 2 &&
              Ab('Macintosh'),
            Ob = Ab('iPhone') && !Nb,
            wb = Ab('iPod'),
            Pb = Ob || Nb || wb || Db,
            Lb = Ab('Android'),
            Mb = (function () {
              if (Lb) {
                let e = yb.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
                if (e) {
                  let t = e[1] && parseFloat(e[1]),
                    i = e[2] && parseFloat(e[2]);
                  if (t && i)
                    return parseFloat(''.concat(e[1], '.').concat(e[2]));
                  if (t) return t;
                }
              }
              return NaN;
            })(),
            Vb = Lb && Ab('webkit') && Mb < 2.3,
            xb = Lb && Mb < 5 && kb < 537,
            Ub = Ab('Firefox'),
            Fb = Rb('Firefox'),
            Bb = Cb('Firefox'),
            Hb = Ab('Edge'),
            jb = Rb('Edge'),
            Gb = Ab('Edg'),
            Wb = Rb('Edg'),
            Jb = Cb('Edg'),
            Kb = Ab('SogouMobileBrowser'),
            Yb = Rb('SogouMobileBrowser'),
            zb = Ab('MetaSr\\s'),
            qb = Rb('MetaSr\\s'),
            Qb = Ab('TBS'),
            Xb = Rb('TBS'),
            $b = Ab('XWEB'),
            Zb = Rb('XWEB'),
            ek = Ab('MSIE\\s8\\.0'),
            tk = Ab('MSIE\\/\\d+'),
            ik = (function () {
              if (tk) {
                let e = /MSIE\s(\d+)\.\d/.exec(yb),
                  t = e && parseFloat(e[1]);
                return (
                  !t &&
                    /Trident\/7.0/i.test(yb) &&
                    /rv:11.0/.test(yb) &&
                    (t = 11),
                  t
                );
              }
              return NaN;
            })(),
            nk = Ab('(micromessenger|webbrowser)'),
            rk = Rb('MicroMessenger'),
            ok = !Qb && Ab('MQQBrowser') && Ab('COVC'),
            sk = !Qb && Ab('MQQBrowser') && !Ab('COVC'),
            ak = sk || ok ? Rb('MQQBrowser') : '',
            ck = !Qb && Ab(' QQBrowser'),
            lk = Rb(' QQBrowser'),
            dk = !Qb && Ab('QQBrowserLite'),
            uk = Rb('QQBrowserLite'),
            hk = !Qb && Ab('MQBHD'),
            pk = Rb('MQBHD'),
            _k = Ab('Windows'),
            mk = !Pb && Ab('MAC OS X'),
            fk = !Lb && Ab('Linux'),
            gk = Ab('CrOS'),
            Tk = Ab('MicroMessenger'),
            Ek = Ab('UCBrowser'),
            Sk = Ab('Electron'),
            Ik = Ab('MiuiBrowser'),
            vk = Rb('MiuiBrowser'),
            yk = Ab('HuaweiBrowser'),
            Ak = Ab('Huawei'),
            Rk = Rb('HuaweiBrowser'),
            Ck = Ab('SamsungBrowser'),
            bk = Rb('SamsungBrowser'),
            kk = Ab('HeyTapBrowser'),
            Nk = Rb('HeyTapBrowser'),
            Dk = Ab('VivoBrowser'),
            Ok = Rb('VivoBrowser'),
            wk = () => Cb('Chrome'),
            Pk = Ab('Chrome'),
            Lk =
              !Hb &&
              !zb &&
              !Kb &&
              !Qb &&
              !$b &&
              !Gb &&
              !ck &&
              !Ik &&
              !yk &&
              !Ck &&
              !kk &&
              !Dk &&
              Pk,
            Mk = Ab('HeadlessChrome'),
            Vk = wk(),
            xk = Rb('Chrome'),
            Uk = !Pk && !sk && !ok && !dk && !hk && Ab('Safari'),
            Fk = Uk || Pb,
            Bk = Rb('Version'),
            Hk = /Android.*(wv|.0.0.0)/.test(yb),
            jk = (() => {
              if (Db) return Bk;
              if (Pb) {
                let e = yb.match(/OS (\d+)_(\d+)/i);
                if (e && e[1]) {
                  let t = e[1];
                  return e[2] && (t += '.'.concat(e[2])), t;
                }
              }
              return '';
            })(),
            Gk = Number(jk.split('.')[0]),
            Wk = '15.1' === Bk,
            Jk = '15.1' === jk,
            Kk = (() => {
              let e = Number(jk.split('.')[0]);
              return 14 === e || 13 === e;
            })(),
            Yk =
              'undefined' != typeof location &&
              ('file:' === location.protocol ||
                'localhost' === location.hostname ||
                '127.0.0.1' === location.hostname),
            zk = (() => {
              let e;
              return () => {
                if (nO(e))
                  try {
                    e = !!window.localStorage;
                  } catch (YL) {
                    e = !1;
                  }
                return e;
              };
            })(),
            qk = Qk();
          function Qk() {
            let e = new Map([
                [Ub, ['Firefox', Fb]],
                [Gb, ['Edg', Wb]],
                [Lk, ['Chrome', xk]],
                [Uk, ['Safari', Bk]],
                [Qb, ['TBS', Xb]],
                [$b, ['XWEB', Zb]],
                [nk && Ob, ['WeChat', rk]],
                [ck, ['QQ(Win)', lk]],
                [sk, ['QQ(Mobile)', ak]],
                [ok, ['QQ(Mobile X5)', ak]],
                [dk, ['QQ(Mac)', uk]],
                [hk, ['QQ(iPad)', pk]],
                [Ik, ['MI', vk]],
                [yk, ['HW', Rk]],
                [Ck, ['Samsung', bk]],
                [kk, ['OPPO', Nk]],
                [Dk, ['VIVO', Ok]],
                [Hb, ['EDGE', jb]],
                [Kb, ['SogouMobile', Yb]],
                [zb, ['Sogou', qb]],
              ]),
              t = 'unknown',
              i = 'unknown';
            return e.has(!0) && ([t, i] = e.get(!0)), { name: t, version: i };
          }
          var Xk = null;
          function $k() {
            return ab(this, null, function* () {
              if (Xk) return Xk;
              if (
                !navigator.userAgentData ||
                !iO(navigator.userAgentData.getHighEntropyValues)
              )
                return null;
              try {
                return (Xk = yield navigator.userAgentData.getHighEntropyValues(
                  [
                    'architecture',
                    'bitness',
                    'model',
                    'platformVersion',
                    'fullVersionList',
                  ],
                ));
              } catch (KL) {
                return null;
              }
            });
          }
          var Zk = new Map([
              [Lb, 'Android'],
              [Pb, 'iOS'],
              [_k, 'Windows'],
              [mk, 'MacOS'],
              [fk, 'Linux'],
              [gk, 'ChromeOS'],
            ]),
            eN = function () {
              return Zk.get(!0) ? Zk.get(!0) : Xk ? Xk.platform : 'unknown';
            },
            tN = () => {
              let e = eN();
              return (
                (e += '/'
                  .concat(qk.name, '/')
                  .concat(Uk ? qk.version : qk.version.split('.')[0])),
                null != Xk &&
                  Xk.platformVersion &&
                  (e += '/'.concat(Xk.platformVersion)),
                null != Xk &&
                  Xk.architecture &&
                  (e += '/'.concat(Xk.architecture)),
                e
              );
            },
            iN = {};
          ib(iN, {
            AUDIO_MUTE_BIT: () => jN,
            AUDIO_STAT_BIT: () => HN,
            AUX_STAT_BIT: () => BN,
            AUX_STREAM_MSID: () => JN,
            BACKEND_ENV: () => VN,
            BASE_DOC_URL: () => TN,
            BASE_HOST: () => _N,
            CAPABILITIES_KEYS: () => VD,
            CLASS_NAME: () => yD,
            CLOUD_CONSOLE_URL: () => gN,
            DATA_FREEZE_TIMING: () => fD,
            DOC_URL: () => EN,
            DTLS_STATE_UNKNOWN: () => tD,
            ENV_NAME: () => AN,
            EXCHANGE_SDP_TIMEOUT: () => uD,
            INTERVAL: () => LD,
            IS_WORKER: () => lN,
            IS_WORKLET: () => dN,
            KIBANA_EVENT: () => cD,
            LOCAL_STREAM_PUBLISH_STATE: () => mD,
            LOGGER_CMD_TYPE: () => yN,
            LOGGER_DOMAIN: () => SN,
            LOGGER_DOMAIN_OVERSEA: () => IN,
            LOG_LEVEL: () => RN,
            LOG_LEVEL_NAME: () => kD,
            MAIN_STREAM_MSID: () => WN,
            MICROPHONE_COMMUNICATIONS: () => bD,
            MICROPHONE_DEFAULT: () => RD,
            NAME: () => LN,
            NETWORK_TYPE: () => kN,
            NOT_SUPPORTED_H264: () => _D,
            PAUSED_RETRY_COUNT: () => AD,
            PEERCONNECTION_CONNECTING_TIMEOUT: () => SD,
            PEER_CONNECTION_STATE: () => iD,
            PEER_LEAVE_REASON: () => ND,
            RAF: () => PD,
            RECOVER_CAPTURE_INTERVAL: () => OD,
            REMOTE_STREAM_TYPE_AUX: () => YN,
            REMOTE_STREAM_TYPE_MAIN: () => KN,
            RENDER_FREEZE_TIMING: () => gD,
            RIC: () => wD,
            SCHEDULE_DOMAIN: () => ID,
            SCHEDULE_TIMEOUT: () => vD,
            SDP_SEMANTICS_PLAN_B: () => pD,
            SDP_SEMANTICS_UNIFIED_PLAN: () => hD,
            SECOND_HOST: () => mN,
            SIGNAL_PING_PONG_INTERVAL: () => bN,
            SIGNAL_PING_TIMEOUT: () => CN,
            SIGNAL_RECONNECTION_COUNT: () => aD,
            SMALL_STAT_BIT: () => FN,
            SPEAKER_DEFAULT: () => CD,
            STORAGE_EXPIRES_TIME: () => NN,
            STREAM_TYPE_BIG: () => TD,
            STREAM_TYPE_SMALL: () => ED,
            SUBSCRIBE_SMALL_RETRY_COUNT: () => DD,
            SYNC_USER_LIST_INTERVAL: () => lD,
            Scene: () => xN,
            Switch: () => DN,
            THIRD_HOST: () => fN,
            TIMEOUT: () => MD,
            TRANSPORT_DIRECTION: () => MN,
            TRTC_ERROR_ASSISTANCE: () => vN,
            TRTC_QUALITY_BAD: () => $N,
            TRTC_QUALITY_DISCONNECTED: () => eD,
            TRTC_QUALITY_EXCELLENT: () => qN,
            TRTC_QUALITY_GOOD: () => QN,
            TRTC_QUALITY_POOR: () => XN,
            TRTC_QUALITY_UNKNOWN: () => zN,
            TRTC_QUALITY_VERY_BAD: () => ZN,
            UPDATE_OFFER_TIMEOUT: () => dD,
            VIDEO_MUTE_BIT: () => GN,
            VIDEO_STAT_BIT: () => UN,
            audioProfileMap: () => ON,
            getRetryCount: () => oD,
            getScriptDir: () => uN,
            innerVersion: () => nN,
            loggerProxy: () => hN,
            screenProfileMap: () => PN,
            setLoggerProxy: () => pN,
            setRetryCount: () => rD,
            setVersion: () => oN,
            version: () => rN,
            videoProfileMap: () => wN,
          });
          var nN = '4.15.00.1600',
            rN = '5.0.0';
          function oN(e) {
            rN = e;
            let [t, i, n] = e.split('.').map((e) => parseInt(e, 10));
            nN = ''
              .concat(t, '.')
              .concat(Math.min(15, i), '.')
              .concat(Math.min(15, n), '.')
              .concat(i.toString().padStart(2, '0'))
              .concat(n.toString().padStart(2, '0'));
          }
          var sN,
            aN,
            cN,
            lN = 'undefined' != typeof importScripts,
            dN = 'undefined' != typeof registerProcessor,
            uN = () => {
              let e = lN ? self.location.href : document.currentScript.src;
              return e.substring(0, e.lastIndexOf('/') + 1);
            },
            hN = '',
            pN = (e) => (hN = e),
            _N = 'web.sdk.qcloud.com',
            mN = 'web.sdk.tencent.cn',
            fN = 'web.sdk.cloud.tencent.cn',
            gN = 'https://console.cloud.tencent.com/trtc',
            TN = 'https://'.concat(_N, '/trtc/webrtc/v5/doc'),
            EN = ''.concat(TN, '/zh-cn/'),
            SN = 'https://yun.tim.qq.com',
            IN = 'https://apisgp.my-imcloud.com',
            vN = 'trtc_error_assistance',
            yN = {
              LOG: 'jssdk_log',
              EVENT: 'jssdk_event',
              KEY_POINT: 'jssdk_new_endreport',
            },
            AN = {
              QCLOUD: 'qcloud',
              OLD_CLOUD_LADDER: 'trtc',
              WEBRTC: 'webrtc',
            },
            RN =
              (((cN = RN || {})[(cN.TRACE = 0)] = 'TRACE'),
              (cN[(cN.DEBUG = 1)] = 'DEBUG'),
              (cN[(cN.INFO = 2)] = 'INFO'),
              (cN[(cN.WARN = 3)] = 'WARN'),
              (cN[(cN.ERROR = 4)] = 'ERROR'),
              (cN[(cN.NONE = 5)] = 'NONE'),
              cN),
            CN = 18e3,
            bN = 2e3,
            kN = { unknown: 0, wifi: 1, '3g': 2, '2g': 3, '4g': 4, wired: 5 },
            NN = 6048e5,
            DN =
              (((aN = DN || {}).USEAINS = 'useAINS'),
              (aN.ENABLEDEBUG = 'enableDebug'),
              (aN.USEV2 = 'useV2'),
              (aN.USEWT = 'useWt'),
              aN),
            ON = {
              standard: { sampleRate: 48e3, channelCount: 1, bitrate: 40 },
              'standard-stereo': {
                sampleRate: 48e3,
                channelCount: 2,
                bitrate: 64,
              },
              high: { sampleRate: 48e3, channelCount: 1, bitrate: 192 },
              'high-stereo': {
                sampleRate: 48e3,
                channelCount: 2,
                bitrate: 192,
              },
            },
            wN = {
              '120p': { width: 160, height: 120, frameRate: 15, bitrate: 200 },
              '120p_2': {
                width: 160,
                height: 120,
                frameRate: 15,
                bitrate: 100,
              },
              '180p': { width: 320, height: 180, frameRate: 15, bitrate: 350 },
              '180p_2': {
                width: 320,
                height: 180,
                frameRate: 15,
                bitrate: 150,
              },
              '240p': { width: 320, height: 240, frameRate: 15, bitrate: 400 },
              '240p_2': {
                width: 320,
                height: 240,
                frameRate: 15,
                bitrate: 200,
              },
              '360p': { width: 640, height: 360, frameRate: 15, bitrate: 800 },
              '360p_2': {
                width: 640,
                height: 360,
                frameRate: 15,
                bitrate: 400,
              },
              '480p': { width: 640, height: 480, frameRate: 15, bitrate: 900 },
              '480p_2': {
                width: 640,
                height: 480,
                frameRate: 15,
                bitrate: 500,
              },
              '720p': {
                width: 1280,
                height: 720,
                frameRate: 15,
                bitrate: 1500,
              },
              '1080p': {
                width: 1920,
                height: 1080,
                frameRate: 15,
                bitrate: 2e3,
              },
              '1440p': {
                width: 2560,
                height: 1440,
                frameRate: 30,
                bitrate: 4860,
              },
              '4K': { width: 3840, height: 2160, frameRate: 30, bitrate: 9e3 },
            },
            PN = {
              '480p': { width: 640, height: 480, frameRate: 5, bitrate: 900 },
              '480p_2': {
                width: 640,
                height: 480,
                frameRate: 30,
                bitrate: 1e3,
              },
              '720p': { width: 1280, height: 720, frameRate: 5, bitrate: 1200 },
              '720p_2': {
                width: 1280,
                height: 720,
                frameRate: 30,
                bitrate: 3e3,
              },
              '1080p': {
                width: 1920,
                height: 1080,
                frameRate: 5,
                bitrate: 1600,
              },
              '1080p_2': {
                width: 1920,
                height: 1080,
                frameRate: 30,
                bitrate: 4e3,
              },
            },
            LN = {
              CANVAS: 'canvas',
              AUDIO: 'audio',
              VIDEO: 'video',
              SCREEN: 'screen',
              SMALL: 'small',
              BIG: 'big',
              AUXILIARY: 'auxiliary',
              SMALL_VIDEO: 'smallVideo',
              FACING_MODE_USER: 'user',
              FACING_MODE_ENVIRONMENT: 'environment',
              MUTE: 'mute',
              UNMUTE: 'unmute',
              ENDED: 'ended',
              PLAYING: 'playing',
              PAUSE: 'pause',
              ERROR: 'error',
              LOADEDDATA: 'loadeddata',
              AUDIO_INPUT: 'audioinput',
              VIDEO_INPUT: 'videoinput',
              DETAIL: 'detail',
              TEXT: 'text',
              MAIN: 'main',
              BACKUP: 'backup',
              BANNED: 'banned',
              KICK: 'kick',
              USER_TIME_OUT: 'user_time_out',
              ROOM_DISBAND: 'room_disband',
              SEI_MESSAGE: 'sei-message',
              ADD: 'add',
              REMOVE: 'remove',
              REPLACE: 'replace',
              TRACK: 'track',
              SUBSCRIBE: 'subscribe',
              UNSUBSCRIBE: 'unsubscribe',
              TRANSCEIVER_DIRECTION_SENDONLY: 'sendonly',
              TRANSCEIVER_DIRECTION_RECVONLY: 'recvonly',
              ENTER_PICTURE_IN_PICTURE: 'enterpictureinpicture',
              LEAVE_PICTURE_IN_PICTURE: 'leavepictureinpicture',
            },
            MN = {
              INACTIVE: 'inactive',
              SENDONLY: 'sendonly',
              RECVONLY: 'recvonly',
            },
            VN = {
              OLD_CLOUD_LADDER: 'wss://trtc.rtc.qq.com',
              WEBRTC: 'wss://webrtc.qq.com',
            },
            xN = (((sN = xN || {}).LIVE = 'live'), (sN.RTC = 'rtc'), sN),
            UN = 1,
            FN = 2,
            BN = 4,
            HN = 8,
            jN = 64,
            GN = 16,
            WN = '5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV',
            JN = '224d130c-7b5c-415b-aaa2-79c2eb5a6df2',
            KN = LN.MAIN,
            YN = LN.AUXILIARY,
            zN = 0,
            qN = 1,
            QN = 2,
            XN = 3,
            $N = 4,
            ZN = 5,
            eD = 6,
            tD = 'unknown',
            iD = {
              NEW: 'new',
              CONNECTING: 'connecting',
              FAILED: 'failed',
              CLOSED: 'closed',
              DISCONNECTED: 'disconnected',
              CONNECTED: 'connected',
              COMPLETED: 'completed',
            },
            nD = 1 / 0;
          function rD(e) {
            nD = e;
          }
          function oD() {
            return nD;
          }
          var sD,
            aD = 30,
            cD = {
              JOIN: 'join',
              DELTA_JOIN: 'delta-join',
              REJOIN: 'rejoin',
              LEAVE: 'leave',
              DELTA_LEAVE: 'delta-leave',
              PUBLISH: 'publish',
              DELTA_PUBLISH: 'delta-publish',
              UNPUBLISH: 'unpublish',
              SUBSCRIBE: 'subscribe',
              UNSUBSCRIBE: 'unsubscribe',
              UPLINK_CONNECTION: 'uplink-connection',
              UPLINK_RECONNECTION: 'uplink-reconnection',
              DOWNLINK_CONNECTION: 'downlink-connection',
              DOWNLINK_RECONNECTION: 'downlink-reconnection',
              ON_TRACK: 'ontrack',
              ICE_CONNECTION_STATE: 'iceConnectionState',
              LOCAL_STREAM_INITIALIZE: 'stream-initialize',
              SIGNAL_CONNECTION: 'websocketConnectionState',
              SIGNAL_RECONNECTION: 'websocketReconnectionState',
              UPDATE_STREAM: 'update-stream',
              RECOVER_LOCAL_AUDIO_TRACK: 'recover-local-audio-track',
              RECOVER_LOCAL_VIDEO_TRACK: 'recover-local-video-track',
              RECOVER_SUBSCRIPTION: 'recover-subscription',
              START_MIX_TRANSCODE: 'start-mix-transcode',
              STOP_MIX_TRANSCODE: 'stop-mix-transcode',
              PLAYER_ERROR: 'player-error',
              SCHEDULE: 'schedule',
              LOAD_WORKLET: 'load-worklet',
              VIDEO_FROZEN_COUNT: 'videoFrozenCount',
              GET_USER_MEDIA_RETRY: 'getUserMedia-retry',
            },
            lD = 1e4,
            dD = 1e4,
            uD = 1e4,
            hD = 'unified-plan',
            pD = 'plan-b',
            _D = 1028,
            mD =
              (((sD = mD || {})[(sD.UNPUBLISH = -1)] = 'UNPUBLISH'),
              (sD[(sD.PUBLISHING = 0)] = 'PUBLISHING'),
              (sD[(sD.PUBLISHED = 1)] = 'PUBLISHED'),
              sD),
            fD = 500,
            gD = 1e3,
            TD = LN.BIG,
            ED = LN.SMALL,
            SD = 1e4,
            ID = {
              MAIN: 'schedule.cloud-rtc.com',
              BACKUP: 'schedule.rtc.qcloud.com',
              MAIN_OVERSEA: 'schedule.rtc.tencentcloud.com',
              BACKUP_OVERSEA: 'schedule-ecdn.rtc.tencentcloud.com',
            },
            vD = 2e3,
            yD = {
              TRTC: 'TRTC',
              CLIENT: 'Client',
              LOCAL_STREAM: 'LocalStream',
              REMOTE_STREAM: 'RemoteStream',
              STREAM: 'Stream',
            },
            AD = 5,
            RD = 'default',
            CD = RD,
            bD = 'communications',
            kD = Object.keys(RN),
            ND = ['normal leave', 'timeout leave', 'kick', 'role change'],
            DD = 10,
            OD = 2e3,
            wD = 'ric',
            PD = 'raf',
            LD = 'interval',
            MD = 'timeout',
            VD = [
              'width',
              'height',
              'frameRate',
              'facingMode',
              'sampleRate',
              'sampleSize',
              'channelCount',
              'deviceId',
            ],
            xD = 1e8,
            UD = function () {
              return new URLSearchParams(location.search).get('trtc_env') || '';
            },
            FD = (e) => Number(e) < 14e8,
            BD = function (e, t) {
              let i;
              i = hN || (FD(e) ? IN : SN);
              let n = Math.floor(Math.random() * XC(2, 31));
              return ''
                .concat(i, '/v5/AVQualityReportSvc/C2S?random=')
                .concat(n, '&sdkappid=')
                .concat(e, '&cmdtype=')
                .concat(t);
            };
          function HD() {
            return Lb ? 4 : Ob ? 2 : Nb ? 3 : mk ? 12 : _k ? 5 : fk ? 13 : 1;
          }
          function jD() {
            return Lb
              ? 'Android'
              : Ob
              ? 'iPhone'
              : Nb
              ? 'iPad'
              : mk
              ? 'Mac'
              : _k
              ? 'Windows'
              : fk
              ? 'Linux'
              : 'unknown';
          }
          function GD() {
            let { userAgent: e, connection: t } = navigator,
              i = (e.match(/NetType\/\S+/) || [])[0] || '';
            (i = i.toLowerCase().replace('nettype/', '')),
              '3gnet' === i && (i = '3g');
            let n = t && t.type && t.type.toLowerCase(),
              r = t && t.effectiveType && t.effectiveType.toLowerCase();
            'slow-2' === r && (r = '2g');
            let o = i || 'unknown';
            if (n)
              switch (n) {
                case 'cellular':
                case 'wimax':
                  o = r || 'unknown';
                  break;
                case 'wifi':
                  o = 'wifi';
                  break;
                case 'ethernet':
                  o = 'wired';
                  break;
                default:
                  o = 'unknown';
              }
            return o;
          }
          var WD = function (e) {
            return {
              AbilityOption: {
                AVLimit: e,
                GeneralLimit: {
                  CPULimit: {
                    uint32_CPU_num: navigator.hardwareConcurrency || 0,
                    str_CPU_name: String(navigator.platform),
                    uint32_CPU_maxfreq: 0,
                    model: '',
                    uint32_total_memory: 0,
                  },
                  uint32_terminal_type: HD(),
                  uint32_device_type: 0,
                  str_os_verion: jD(),
                  uint32_link_type: 1,
                  str_client_version: nN,
                  uint32_net_type: kN[GD()],
                  ua: navigator.userAgent,
                  version: '',
                },
              },
            };
          };
          function JD(e, t) {
            for (let i of Reflect.ownKeys(t))
              if ('constructor' !== i && 'prototype' !== i && 'name' !== i) {
                let n = Object.getOwnPropertyDescriptor(t, i) || '';
                Object.defineProperty(e, i, n);
              }
            return e;
          }
          function KD(e) {
            return YD(
              e / 4,
              arguments.length > 1 && void 0 !== arguments[1]
                ? arguments[1]
                : 48e3,
            );
          }
          function YD(e) {
            return (
              (1e3 * e) /
              (arguments.length > 1 && void 0 !== arguments[1]
                ? arguments[1]
                : 48e3)
            );
          }
          function zD(e) {
            return (
              4 *
              qD(
                e,
                arguments.length > 1 && void 0 !== arguments[1]
                  ? arguments[1]
                  : 48e3,
              )
            );
          }
          function qD(e) {
            return (
              (e *
                (arguments.length > 1 && void 0 !== arguments[1]
                  ? arguments[1]
                  : 48e3)) /
              1e3
            );
          }
          var QD =
              'undefined' != typeof window && 'function' == typeof window.glog
                ? window.glog
                : () => {},
            XD = () => {
              let e = navigator.language;
              return (e = e.substring(0, 2)), 'zh' === e;
            },
            $D = function (e) {
              if (
                !e ||
                'object' != typeof e ||
                '[object Object]' != Object.prototype.toString.call(e)
              )
                return !1;
              let t = Object.getPrototypeOf(e);
              if (null === t) return !0;
              let i =
                Object.prototype.hasOwnProperty.call(t, 'constructor') &&
                t.constructor;
              return (
                'function' == typeof i &&
                i instanceof i &&
                Function.prototype.toString.call(i) ===
                  Function.prototype.toString.call(Object)
              );
            };
          function ZD(e) {
            let t =
              arguments.length > 2 && void 0 !== arguments[2]
                ? arguments[2]
                : 1;
            return e <= 1
              ? t
              : ZD(
                  e - 1,
                  t,
                  (arguments.length > 1 && void 0 !== arguments[1]
                    ? arguments[1]
                    : 1) + t,
                );
          }
          function eO(e) {
            return e > 8 ? 3e4 : 1e3 * ZD(e);
          }
          function tO(e) {
            return Reflect.apply(Object.prototype.toString, e, [])
              .replace(/^\[object\s(\w+)\]$/, '$1')
              .toLowerCase();
          }
          var iO = (e) => 'function' == typeof e,
            nO = (e) => void 0 === e,
            rO = (e) => 'string' == typeof e,
            oO = (e) => 'number' == typeof e,
            sO = (e) => 'boolean' == typeof e,
            aO = (e) => 'object' === tO(e),
            cO = (e) => 'array' === tO(e),
            lO = (e) => tO(e) === 'MediaStreamTrack'.toLowerCase(),
            dO = (e) => e.isRemote,
            uO = (e) => 'promise' === tO(e),
            hO = (e) => iO(e) && e.prototype.constructor === e,
            pO = (e) => (hO(e) ? e.prototype.constructor.name : ''),
            _O = 'undefined' != typeof AudioWorkletNode;
          function mO(e) {
            return new Promise((t, i) => {
              let n = [];
              e.forEach((r) => {
                r.then(t).catch((t) => {
                  n.push(t), n.length === e.length && i(n);
                });
              });
            });
          }
          function fO() {
            return performance && performance.now
              ? Math.floor(performance.now())
              : Date.now();
          }
          var gO = (e) => (+e < 10 ? '0'.concat(e) : e),
            TO = (e) => {
              let t = e.match(/^\d+\.\d+\.\d+/)[0];
              if (!t) return e;
              let i = t.split('.'),
                n = gO(i[1]) + gO(i[2]);
              return (
                i[1] - 15 > 0 && (i[1] = '15'),
                i[2] - 15 > 0 && (i[2] = '15'),
                ''.concat(i.join('.'), '.').concat(n)
              );
            },
            EO = Object.prototype.hasOwnProperty;
          function SO(e) {
            if (null == e) return !0;
            if ('boolean' == typeof e) return !1;
            if ('number' == typeof e) return 0 === e;
            if (
              'string' == typeof e ||
              'function' == typeof e ||
              Array.isArray(e)
            )
              return 0 === e.length;
            if (e instanceof Error) return '' === e.message;
            if ($D(e))
              switch (Object.prototype.toString.call(e)) {
                case '[object File]':
                case '[object Map]':
                case '[object Set]':
                  return 0 === e.size;
                case '[object Object]':
                  for (let t in e) if (EO.call(e, t)) return !1;
                  return !0;
              }
            return !1;
          }
          function IO(e, t) {
            return {
              userId: t,
              hasAudio: !!(e & HN),
              hasVideo: !!(e & UN),
              hasAuxiliary: !!(e & BN),
              hasSmall: !!(e & FN),
              audioMuted: !!(e & jN),
              videoMuted: !!(e & GN),
              audioAvailable: !(!(e & HN) || e & jN),
              videoAvailable: !(!(e & UN) || e & GN),
            };
          }
          function vO(e, t) {
            return e > 50 || t > 500
              ? 5
              : e > 30 || t > 350
              ? 4
              : e > 20 || t > 200
              ? 3
              : e > 10 || t > 100
              ? 2
              : e >= 0 || t >= 0
              ? 1
              : 0;
          }
          function yO(e) {
            let t = { urls: 'turn:'.concat(e.url) };
            return (
              !nO(e.username) &&
                !nO(e.credential) &&
                ((t.username = e.username),
                (t.credential = e.credential),
                (t.credentialType = 'password'),
                nO(e.credentialType) || (t.credentialType = e.credentialType)),
              t
            );
          }
          function AO(e) {
            let t =
              !(arguments.length > 1 && void 0 !== arguments[1]) ||
              arguments[1];
            if (!rO(e)) return 0;
            let i = e.split('.');
            return t
              ? ((Number(i[0]) << 24) |
                  (Number(i[1]) << 16) |
                  (Number(i[2]) << 8) |
                  Number(i[3])) >>>
                  0
              : ((Number(i[3]) << 24) |
                  (Number(i[2]) << 16) |
                  (Number(i[1]) << 8) |
                  Number(i[0])) >>>
                  0;
          }
          var RO = function (e, t, i, n) {
            if (!aO(e) || !aO(t)) return 0;
            let r,
              o = 0,
              s = Object.keys(t);
            for (let a = 0, c = s.length; a < c; a++)
              if (((r = s[a]), !(nO(t[r]) || (i && i.includes(r)))))
                if (aO(e[r]) && aO(t[r])) o += RO(e[r], t[r], i, n);
                else {
                  if (n && n.includes(t[r])) continue;
                  e[r] !== t[r] && ((e[r] = CO(t[r])), (o += 1));
                }
            return o;
          };
          function CO(e) {
            if (cO(e)) {
              let t = [];
              return (
                e.forEach((e, i) => {
                  t[i] = CO(e);
                }),
                t
              );
            }
            if (aO(e)) {
              let t = {};
              return (
                Object.keys(e).forEach((i) => {
                  t[i] = CO(e[i]);
                }),
                t
              );
            }
            return e;
          }
          var bO = (e) => (rO(e) ? document.getElementById(e) : e),
            kO = new Intl.DateTimeFormat('zh-CN', {
              dateStyle: 'short',
              timeStyle: 'medium',
            }),
            NO = () => kO.format(new Date());
          function DO(e, t) {
            let { keysToInclude: i, keysToExclude: n } = t;
            try {
              if (cO(e))
                return '['.concat(
                  e
                    .map((e) => DO(e, { keysToInclude: i, keysToExclude: n }))
                    .join(','),
                  ']',
                );
              if (!$D(e) || (!cO(i) && !cO(n))) return JSON.stringify(e);
              let t = {},
                r = new Set(i),
                o = new Set(n);
              return (
                Object.keys(e).forEach((s) => {
                  ((0 === o.size && r.has(s)) || (0 === r.size && !o.has(s))) &&
                    (t[s] =
                      $D(e[s]) || cO(e[s])
                        ? JSON.parse(
                            DO(e[s], { keysToExclude: n, keysToInclude: i }),
                          )
                        : e[s]);
                }),
                JSON.stringify(t)
              );
            } catch (sD) {
              return '{}';
            }
          }
          function OO(e) {
            let t =
                arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
              i = [];
            return (
              Object.keys(e).forEach((n) => {
                t === e[n] && i.push(n);
              }),
              DO(e, { keysToInclude: i })
            );
          }
          function wO(e) {
            return e.replace(/[\u4e00-\u9fa5]/g, 'aa').length;
          }
          var PO = (() => {
            let e = !1,
              t = document.visibilityState;
            return () => {
              document.visibilityState !== t &&
                jO.info('visibility change: '.concat(document.visibilityState)),
                !e &&
                  (document.addEventListener('visibilitychange', () => {
                    jO.info(
                      'visibility change: '.concat(document.visibilityState),
                    ),
                      (t = document.visibilityState);
                  }),
                  (e = !0));
            };
          })();
          function LO(e) {
            let { url: t, body: i, method: n, timeout: r } = e,
              o = new XMLHttpRequest();
            return new Promise((e, s) => {
              (o.onreadystatechange = () => {
                if (4 === o.readyState)
                  if (o.status >= 200 && o.status < 300)
                    try {
                      let t = JSON.parse(o.response);
                      e({ data: t });
                    } catch (t) {
                      e({ data: o.response });
                    }
                  else
                    s({
                      status: o.status,
                      statusText: o.statusText || 'request failed!',
                    });
              }),
                (o.timeout = r || 5e3),
                o.open(n || 'POST', t, !0),
                o.send(i);
            });
          }
          var MO,
            VO = function (e) {
              let {
                retryFunction: t,
                settings: i,
                onError: n,
                onRetrying: r,
                onRetryFailed: o,
                onRetrySuccess: s,
                context: a,
              } = e;
              return function () {
                for (
                  var e = arguments.length, c = new Array(e), l = 0;
                  l < e;
                  l++
                )
                  c[l] = arguments[l];
                let { retries: d = 5, timeout: u = 1e3 } = i,
                  h = 0,
                  p = -1,
                  _ = 0,
                  m = (e, i) =>
                    ab(this, null, function* () {
                      let l = a || this;
                      try {
                        let i = yield t.apply(l, c);
                        h > 0 && s && s.call(this, h), (h = 0), e(i);
                      } catch (f) {
                        let t = () => {
                            clearTimeout(p), (h = 0), (_ = 2), i(f);
                          },
                          s = () => {
                            2 !== _ && h < (iO(d) ? d() : d)
                              ? (h++,
                                (_ = 1),
                                iO(r) && r.call(this, h, t),
                                (p = window.setTimeout(
                                  () => {
                                    (p = -1), m(e, i);
                                  },
                                  iO(u) ? u(h) : u,
                                )))
                              : (t(), iO(o) && o.call(this, f));
                          };
                        iO(n)
                          ? n.call(this, {
                              error: f,
                              retry: s,
                              reject: i,
                              retryFuncArgs: c,
                              retryCount: h,
                            })
                          : s();
                      }
                    });
                return new Promise(m);
              };
            },
            xO = class {
              constructor(e) {
                ob(this, 'userId'),
                  ob(this, 'remoteUserId'),
                  ob(this, 'id'),
                  ob(this, 'sdkAppId'),
                  ob(this, 'type'),
                  ob(this, 'isLocal'),
                  (this.id = e.id),
                  (this.userId = e.userId),
                  (this.sdkAppId = e.sdkAppId),
                  (this.remoteUserId = e.remoteUserId),
                  (this.isLocal = !sO(e.isLocal) || e.isLocal),
                  (this.type = this.isLocal ? '' : e.type);
              }
              createChild(e) {
                return Object.setPrototypeOf(e, this);
              }
              setUserId(e) {
                this.userId = e;
              }
              setSdkAppId(e) {
                this.sdkAppId = e;
              }
              log(e, t) {
                let i = this.isLocal ? this.userId : this.remoteUserId;
                t.unshift(
                  '['
                    .concat(this.isLocal ? '↑' : '↓')
                    .concat(this.type && 'main' !== this.type ? '*' : '')
                    .concat(this.id)
                    .concat(i ? '|'.concat(i) : '', ']'),
                ),
                  jO.log(
                    e,
                    t,
                    nO(this.userId) || SO(this.userId),
                    this.userId,
                    this.sdkAppId,
                  );
              }
              info() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(2, t);
              }
              debug() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(1, t);
              }
              warn() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(3, t);
              }
              error() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(4, t);
              }
            },
            UO = new (nb(cb(), 1).default)(),
            FO =
              (((MO = FO || {}).ROOM_DESTROY = '1'),
              (MO.JOIN_START = '21'),
              (MO.JOIN_SCHEDULE_SUCCESS = '22'),
              (MO.JOIN_SIGNAL_CONNECTION_START = '23'),
              (MO.JOIN_SIGNAL_CONNECTION_END = '24'),
              (MO.JOIN_SEND_CMD = '25'),
              (MO.JOIN_RECEIVED_CMD_RES = '26'),
              (MO.JOIN_SUCCESS = '27'),
              (MO.JOIN_FAILED = '28'),
              (MO.LEAVE_START = '51'),
              (MO.LEAVE_SEND_CMD = '52'),
              (MO.LEAVE_SUCCESS = '53'),
              (MO.PUBLISH_START = '61'),
              (MO.SEND_FIRST_VIDEO_FRAME = '62'),
              (MO.PUBLISH_FAILED = '63'),
              (MO.SUBSCRIBE_START = '81'),
              (MO.SUBSCRIBE_SUCCESS = '82'),
              (MO.SUBSCRIBE_FAILED = '84'),
              (MO.UNSUBSCRIBE_SUCCESS = '83'),
              (MO.LOCAL_TRACK_CAPTURE_START = '101'),
              (MO.LOCAL_TRACK_CAPTURE_SUCCESS = '102'),
              (MO.LOCAL_TRACK_CAPTURE_FAILED = '103'),
              (MO.LOCAL_TRACK_PUBLISHED = '104'),
              (MO.LOCAL_TRACK_UNPUBLISHED = '105'),
              (MO.LOCAL_TRACK_REPLACED = '106'),
              (MO.SWITCH_DEVICE_SUCCESS = '107'),
              (MO.TRACK_MUTED = '108'),
              (MO.TRACK_UNMUTED = '109'),
              (MO.REMOTE_TRACK_SUBSCRIBED = '110'),
              (MO.REMOTE_TRACK_UNSUBSCRIBED = '111'),
              (MO.PLAY_TRACK_START = '151'),
              (MO.PLAYER_STATE_CHANGED = '152'),
              (MO.VIDEO_LOADED_DATA = '153'),
              (MO.AUTOPLAY_DIALOG_CLICK_CONFIRM = '154'),
              (MO.WORKLET_LOADED_SUCCESS = '155'),
              (MO.WORKLET_LOADED_FAILED = '156'),
              (MO.SIGNAL_CONNECTION_STATE_CHANGED = '201'),
              (MO.PEER_CONNECTION_STATE_CHANGED = '202'),
              (MO.SINGLE_CONNECTION_STAT = '203'),
              (MO.HEARTBEAT_REPORT = '251'),
              (MO.RECEIVED_PUBLISHED_USER_LIST = '252'),
              (MO.REMOTE_PUBLISH_STATE_CHANGED = '253'),
              (MO.AUDIO_LEVEL_INTERVAL = '260'),
              (MO.NETWORK_QUALITY = '261'),
              (MO.API_SUCCESS_RATE = '262'),
              MO),
            BO = FO,
            HO = !(Pb || Lb || Mk),
            jO = new (class {
              constructor() {
                ob(this, '_isEnableUploadLog', !0),
                  ob(this, '_localJoinedUser', new Map()),
                  ob(this, '_queue', []),
                  ob(this, '_timeoutId', -1),
                  ob(this, '_logLevel', 1),
                  ob(this, '_logLevelToUpload', 2),
                  !lN && !dN && (this.checkURLParam(), this.installEvents());
              }
              get isAbleToUpload() {
                return this._isEnableUploadLog && -1 !== this._timeoutId;
              }
              installEvents() {
                UO.on(BO.JOIN_SCHEDULE_SUCCESS, (e) => {
                  let { schedule: t } = e;
                  var i;
                  (null == (i = null == t ? void 0 : t.config)
                    ? void 0
                    : i.logLevelToUpload) &&
                    RN[t.config.logLevelToUpload] &&
                    (this._logLevelToUpload = t.config.logLevelToUpload);
                }),
                  UO.on(BO.JOIN_SUCCESS, (e) => {
                    let { room: t } = e;
                    this.addJoinedUser({
                      userId: t.userId,
                      sdkAppId: t.sdkAppId,
                    }),
                      this.startUpload();
                  }),
                  UO.once(BO.JOIN_FAILED, () => {
                    this.startUpload();
                  }),
                  UO.on(BO.LEAVE_SUCCESS, (e) => {
                    let { room: t } = e;
                    this.deleteJoinedUser(t.userId);
                  });
              }
              startUpload() {
                -1 === this._timeoutId && this.uploadInterval();
              }
              addJoinedUser(e) {
                this._localJoinedUser.set(e.userId, e), this.startUpload();
              }
              deleteJoinedUser(e) {
                this._localJoinedUser.delete(e);
              }
              uploadInterval() {
                this.upload().catch(() => {}),
                  (this._timeoutId = window.setTimeout(
                    () => this.uploadInterval(),
                    2e3,
                  ));
              }
              getLogsToUpload() {
                let e = { map: new Map(), splicedQueue: [] };
                if (
                  this._queue[0].forAllJoinedClients &&
                  0 === this._localJoinedUser.size
                )
                  return e;
                let t = 0;
                for (; t < this._queue.length && 50 !== t; t++) {
                  let i = this._queue[t];
                  if (i.forAllJoinedClients)
                    this._localJoinedUser.forEach((t) => {
                      let { userId: n, sdkAppId: r } = t;
                      e.map.has(n)
                        ? e.map.get(n).logs.push(i)
                        : e.map.set(n, { userId: n, sdkAppId: r, logs: [i] });
                    });
                  else if (rO(i.userId) && oO(i.sdkAppId)) {
                    let { userId: t, sdkAppId: n } = i;
                    e.map.has(t)
                      ? e.map.get(t).logs.push(i)
                      : e.map.set(t, { userId: t, sdkAppId: n, logs: [i] });
                  }
                }
                return (
                  e.map.size > 0 && (e.splicedQueue = this._queue.splice(0, t)),
                  e
                );
              }
              upload() {
                return ab(this, null, function* () {
                  if (0 === this._queue.length || !this._isEnableUploadLog)
                    return;
                  let { map: e, splicedQueue: t } = this.getLogsToUpload();
                  if (0 === e.size) return;
                  try {
                    let t = [...e.values()];
                    for (let e = 0; e < t.length; e++) {
                      let { userId: i, sdkAppId: n, logs: r } = t[e];
                      yield this.uploadLogWithRetry(
                        JSON.stringify({
                          timestamp: Sb(),
                          sdkAppId: String(n),
                          userId: i,
                          version: rN,
                          log: r.map((e) => e.log).join('\n'),
                        }),
                        n,
                      ),
                        r.forEach((e) => (e.uploaded = !0));
                    }
                  } catch (aN) {}
                  let i = t.filter((e) => !e.uploaded);
                  i.length > 0 && (this._queue = i.concat(this._queue));
                });
              }
              uploadLogWithRetry(e, t) {
                return VO({
                  retryFunction: () =>
                    LO({ url: BD(t, yN.LOG), body: e, timeout: 5e3 }),
                  settings: { retries: 3, timeout: 1e3 },
                  onError: (e) => {
                    let { retry: t } = e;
                    t();
                  },
                })();
              }
              getPrefix(e) {
                let t = new Date();
                t.setTime(Eb());
                let i = String(t.getMilliseconds());
                return (
                  'padStart' in String.prototype &&
                    (i = i.toString().padStart(3, '0')),
                  '['
                    .concat(
                      t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, '$1'),
                      ':',
                    )
                    .concat(i, '] <')
                    .concat(RN[e], '>')
                );
              }
              getLogLevel() {
                return this._logLevel;
              }
              setLogLevel(e) {
                nO(RN[e]) ||
                  (this._logLevel !== e && this.info('setLogLevel', e),
                  (this._logLevel = e));
              }
              enableUploadLog() {
                this._isEnableUploadLog = !0;
              }
              disableUploadLog() {
                this.warn('disableUploadLog'), (this._isEnableUploadLog = !1);
              }
              logChunkToString(e) {
                if (rO(e)) return e;
                try {
                  return JSON.stringify(e);
                } catch (sN) {
                  return '';
                }
              }
              log(e, t) {
                let i =
                    !(arguments.length > 2 && void 0 !== arguments[2]) ||
                    arguments[2],
                  n = arguments.length > 3 ? arguments[3] : void 0,
                  r = arguments.length > 4 ? arguments[4] : void 0;
                var o;
                if (
                  (t.unshift(this.getPrefix(e)),
                  this._isEnableUploadLog &&
                    e >= this._logLevelToUpload &&
                    this._queue.push({
                      log: t.reduce(
                        (e, t) =>
                          ''
                            .concat(e, ' ')
                            .concat(this.logChunkToString(t))
                            .trim(),
                        '',
                      ),
                      level: e,
                      userId: n,
                      sdkAppId: r,
                      forAllJoinedClients: i,
                    }),
                  e < this._logLevel)
                )
                  return;
                let s =
                  (null == (o = RN[e]) ? void 0 : o.toLowerCase()) || 'info';
                HO
                  ? console[s](
                      '%cTRTC%c%s',
                      'padding: 1px 4px;border-radius: 3px;color: #fff;background: #1E88E5;',
                      'display: inline',
                      ...t,
                    )
                  : console[s](...t);
              }
              debug() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(1, t);
              }
              info() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(2, t);
              }
              warn() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(3, t);
              }
              error() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                this.log(4, t);
              }
              createLogger(e) {
                return new xO(e);
              }
              checkURLParam() {
                let e = new URLSearchParams(location.search).get(
                    'logLevelToUpload',
                  ),
                  t = e ? Number(e) : -1;
                RN[t] && (this._logLevelToUpload = t);
              }
            })(),
            GO = function () {
              return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
                /[xy]/g,
                (e) => {
                  let t = (16 * Math.random()) | 0;
                  return ('x' == e ? t : (3 & t) | 8).toString(16);
                },
              );
            },
            WO = new (class {
              constructor() {
                ob(this, '_prefix', 'TRTC'),
                  ob(this, '_queue', new Map()),
                  this.checkStorage();
              }
              getRealKey(e) {
                return ''.concat(this._prefix, '_').concat(e);
              }
              checkStorage() {
                zk() &&
                  (setInterval(this.doFlush.bind(this), 2e4),
                  Object.keys(localStorage)
                    .filter((e) => {
                      if (e.startsWith(this._prefix)) {
                        let t = JSON.parse(localStorage.getItem(e));
                        if (t && t.expiresIn < Date.now()) return !0;
                      }
                      return !1;
                    })
                    .forEach((e) => localStorage.removeItem(e)));
              }
              doFlush() {
                if (zk())
                  try {
                    for (let [e, t] of this._queue)
                      localStorage.setItem(e, JSON.stringify(t));
                  } catch (YL) {
                    jO.warn(YL);
                  }
              }
              getItem(e) {
                if (!zk()) return null;
                try {
                  let t = JSON.parse(localStorage.getItem(this.getRealKey(e)));
                  return t && t.expiresIn >= Date.now() ? t.value : null;
                } catch (sN) {
                  jO.warn(sN);
                }
              }
              setItem(e, t) {
                if (zk())
                  try {
                    let i = { expiresIn: Date.now() + NN, value: t };
                    this._queue.set(this.getRealKey(e), i);
                  } catch (sD) {
                    jO.warn(sD);
                  }
              }
              deleteItem(e) {
                if (!zk()) return !1;
                try {
                  return (
                    (e = this.getRealKey(e)),
                    this._queue.delete(e),
                    localStorage.removeItem(e),
                    !0
                  );
                } catch (sN) {
                  return jO.warn(sN), !1;
                }
              }
              clear() {
                if (zk())
                  try {
                    localStorage.clear();
                  } catch (YL) {
                    jO.warn(YL);
                  }
              }
            })(),
            JO = {};
          ib(JO, {
            HTTPS_API: () => uw,
            IS_GET_CAPABILITIES_SUPPORTED: () => kw,
            IS_GET_SETTINGS_SUPPORTED: () => bw,
            IS_SEI_SUPPORTED: () => Nw,
            IS_SPC_SUPPORTED: () => yw,
            basis: () => Lw,
            checkSystemRequirementsInternal: () => cw,
            decodeSupportStatus: () => aw,
            encodeSupportStatus: () => sw,
            getBrowserInfo: () => ZO,
            getDisplayResolution: () => pw,
            isAddTransceiverSupported: () => vw,
            isBrowserSupported: () => ew,
            isGetReceiversSupported: () => Ew,
            isGetSendersSupported: () => Sw,
            isGetTransceiversSupported: () => Iw,
            isGetUserMediaSupported: () => _w,
            isMediaDevicesSupported: () => iw,
            isMediaSessionSupported: () => ww,
            isMediaStreamTrackProcessorSupported: () => ow,
            isReplaceTrackSupported: () => Rw,
            isScreenCaptureApiAvailable: () => dw,
            isSelectedCandidatePair: () => hw,
            isSetParametersSupported: () => Cw,
            isSmallStreamAPISupported: () => fw,
            isSmallStreamSupported: () => gw,
            isStopTransceiverSupported: () => Aw,
            isTRTCSupported: () => lw,
            isUnifiedPlanDefault: () => Tw,
            isUsedInHttpProtocol: () => rw,
            isWebAudioSupported: () => mw,
            isWebCodecSupported: () => Ow,
            isWebCodecsSupported: () => tw,
            isWebRTCSupported: () => Dw,
            isWebTransportSupported: () => Pw,
          });
          var KO = {
              AVOID_REPEATED_CALL: 'AVOID_REPEATED_CALL',
              INVALID_PARAMETER_REQUIRED: 'INVALID_PARAMETER_REQUIRED',
              INVALID_PARAMETER_TYPE: 'INVALID_PARAMETER_TYPE',
              INVALID_PARAMETER_EMPTY: 'INVALID_PARAMETER_EMPTY',
              INVALID_PARAMETER_INSTANCE: 'INVALID_PARAMETER_INSTANCE',
              INVALID_PARAMETER_RANGE: 'INVALID_PARAMETER_RANGE',
              INVALID_PARAMETER_MIN: 'INVALID_PARAMETER_MIN',
              INVALID_PARAMETER_MAX: 'INVALID_PARAMETER_MAX',
              INVALID_PARAMETER_STREAMTYPE: 'INVALID_PARAMETER_STREAMTYPE',
              API_CALL_TIMEOUT: 'API_CALL_TIMEOUT',
              SIGNAL_CHANNEL_RECONNECTION_FAILED:
                'SIGNAL_CHANNEL_RECONNECTION_FAILED',
              SIGNAL_CHANNEL_SETUP_FAILED: 'SIGNAL_CHANNEL_SETUP_FAILED',
              ERROR_MESSAGE: 'ERROR_MESSAGE',
              EXCHANGE_SDP_TIMEOUT: 'EXCHANGE_SDP_TIMEOUT',
              DOWNLINK_RECONNECTION_FAILED: 'DOWNLINK_RECONNECTION_FAILED',
              EXCHANGE_SDP_FAILED: 'EXCHANGE_SDP_FAILED',
              UPDATE_OFFER_TIMEOUT: 'UPDATE_OFFER_TIMEOUT',
              UPLINK_RECONNECTION_FAILED: 'UPLINK_RECONNECTION_FAILED',
              INVALID_RECORDID: 'INVALID_RECORDID',
              INVALID_PURE_AUDIO: 'INVALID_PURE_AUDIO',
              INVALID_STREAMID: 'INVALID_STREAMID',
              INVALID_USER_DEFINE_RECORDID: 'INVALID_USER_DEFINE_RECORDID',
              INVALID_USER_DEFINE_PUSH_ARGS: 'INVALID_USER_DEFINE_PUSH_ARGS',
              INVALID_PROXY: 'INVALID_PROXY',
              INVALID_JOIN: 'INVALID_JOIN',
              INVALID_ROOMID_STRING: 'INVALID_ROOMID_STRING',
              INVALID_ROOMID_INTEGER: 'INVALID_ROOMID_INTEGER',
              INVALID_SIGNAL_CHANNEL: 'INVALID_SIGNAL_CHANNEL',
              JOIN_ROOM_TIMEOUT: 'JOIN_ROOM_TIMEOUT',
              JOIN_ROOM_FAILED: 'JOIN_ROOM_FAILED',
              REJOIN_ROOM_FAILED: 'REJOIN_ROOM_FAILED',
              INVALID_DESTROY: 'INVALID_DESTROY',
              INVALID_PUBLISH: 'INVALID_PUBLISH',
              INVALID_UNPUBLISH: 'INVALID_UNPUBLISH',
              INVALID_AUDIENCE: 'INVALID_AUDIENCE',
              INVALID_INITIALIZE: 'INVALID_INITIALIZE',
              INVALID_DUPLICATE_PUBLISHING: 'INVALID_DUPLICATE_PUBLISHING',
              INVALID_SUBSCRIBE_UNDEFINED: 'INVALID_SUBSCRIBE_UNDEFINED',
              INVALID_SUBSCRIBE_LOCAL: 'INVALID_SUBSCRIBE_LOCAL',
              INVALID_REMOTE_STREAM: 'INVALID_REMOTE_STREAM',
              SUBSCRIBE_FAILED: 'SUBSCRIBE_FAILED',
              INVALID_ROLE: 'INVALID_ROLE',
              INVALID_PARAMETER_SWITCH_ROLE: 'INVALID_PARAMETER_SWITCH_ROLE',
              INVALID_OPERATION_SWITCH_ROLE: 'INVALID_OPERATION_SWITCH_ROLE',
              SWITCH_ROLE_TIMEOUT: 'SWITCH_ROLE_TIMEOUT',
              SWITCH_ROLE_FAILED: 'SWITCH_ROLE_FAILED',
              CLIENT_BANNED: 'CLIENT_BANNED',
              INVALID_OPERATION_START_PUBLISH_CDN:
                'INVALID_OPERATION_START_PUBLISH_CDN',
              INVALID_OPERATION_STOP_PUBLISH_CDN:
                'INVALID_OPERATION_STOP_PUBLISH_CDN',
              INVALID_STREAM_ID: 'INVALID_STREAM_ID',
              START_PUBLISH_CDN_FAILED: 'START_PUBLISH_CDN_FAILED',
              STOP_PUBLISH_CDN_FAILED: 'STOP_PUBLISH_CDN_FAILED',
              START_MIX_TRANSCODE: 'START_MIX_TRANSCODE',
              STOP_MIX_TRANSCODE: 'STOP_MIX_TRANSCODE',
              INVALID_AUDIO_VOLUME: 'INVALID_AUDIO_VOLUME',
              ENABLE_SMALL_STREAM_PUBLISHED: 'ENABLE_SMALL_STREAM_PUBLISHED',
              DISABLE_SMALL_STREAM_PUBLISHED: 'DISABLE_SMALL_STREAM_PUBLISHED',
              NOT_SUPPORTED_SMALL_STREAM: 'NOT_SUPPORTED_SMALL_STREAM',
              INVALID_SMALL_STREAM_PROFILE: 'INVALID_SMALL_STREAM_PROFILE',
              INVALID_PARAMETER_REMOTE_STREAM:
                'INVALID_PARAMETER_REMOTE_STREAM',
              INVALID_OPERATION_CHANGE_SMALL: 'INVALID_OPERATION_CHANGE_SMALL',
              REMOTE_NOT_PUBLISH_SMALL_STREAM:
                'REMOTE_NOT_PUBLISH_SMALL_STREAM',
              INVALID_SWITCH_DEVICE: 'INVALID_SWITCH_DEVICE',
              INVALID_SWITCH_DEVICE_PUBLISHING:
                'INVALID_SWITCH_DEVICE_PUBLISHING',
              INVALID_REPLACE_TRACK: 'INVALID_REPLACE_TRACK',
              INVALID_INITIALIZE_LOCAL_STREAM:
                'INVALID_INITIALIZE_LOCAL_STREAM',
              INVALID_ADD_TRACK_REPETITIVE: 'INVALID_ADD_TRACK_REPETITIVE',
              INVALID_ADD_TRACK_REMOVING: 'INVALID_ADD_TRACK_REMOVING',
              INVALID_ADD_TRACK_PUBLISHING: 'INVALID_ADD_TRACK_PUBLISHING',
              INVALID_STREAM_INITIALIZED: 'INVALID_STREAM_INITIALIZED',
              INVALID_ADD_TRACK_NUMBER: 'INVALID_ADD_TRACK_NUMBER',
              INVALID_REMOVE_AUDIO_TRACK: 'INVALID_REMOVE_AUDIO_TRACK',
              INVALID_REMOVE_AUDIO_ADDING: 'INVALID_REMOVE_AUDIO_ADDING',
              INVALID_REMOVE_AUDIO_ON: 'INVALID_REMOVE_AUDIO_ON',
              INVALID_REMOVE_TRACK_PUBLISHING:
                'INVALID_REMOVE_TRACK_PUBLISHING',
              INVALID_REMOVE_TRACK_NOT_TRACK: 'INVALID_REMOVE_TRACK_NOT_TRACK',
              INVALID_REMOVE_TRACK_NUMBER: 'INVALID_REMOVE_TRACK_NUMBER',
              INVALID_REPLACE_TRACK_NO_TRACK: 'INVALID_REPLACE_TRACK_NO_TRACK',
              REPEAT_JOIN: 'REPEAT_JOIN',
              CLIENT_DESTROYED: 'CLIENT_DESTROYED',
              NOT_BUG_PACKAGE: 'NOT_BUG_PACKAGE',
              START_MIX_TRANSCODE_FAILED: 'START_MIX_TRANSCODE_FAILED',
              STOP_MIX_TRANSCODE_FAILED: 'STOP_MIX_TRANSCODE_FAILED',
              MIX_TRANSCODE_NOT_STARTED: 'MIX_TRANSCODE_NOT_STARTED',
              CANNOT_LESS_THAN_ZERO: 'CANNOT_LESS_THAN_ZERO',
              MIX_PARAMS_VIDEO_FRAMERATE: 'MIX_PARAMS_VIDEO_FRAMERATE',
              MIX_PARAMS_VIDEO_GOP: 'MIX_PARAMS_VIDEO_GOP',
              MIX_PARAMS_AUDIO_BITRATE: 'MIX_PARAMS_AUDIO_BITRATE',
              MIX_PARAMS_USER_Z_ORDER: 'MIX_PARAMS_USER_Z_ORDER',
              MIX_PARAMS_NOT_SELF: 'MIX_PARAMS_NOT_SELF',
              MIX_PARAMS_USER_STREAM: 'MIX_PARAMS_USER_STREAM',
              INVALID_PLAY: 'INVALID_PLAY',
              INVALID_ELEMENT_ID: 'INVALID_ELEMENT_ID',
              INVALID_ELEMENT_ID_TYPE: 'INVALID_ELEMENT_ID_TYPE',
              PLAY_FAILED: 'PLAY_FAILED',
              INVALID_USERID: 'INVALID_USERID',
              INVALID_CREATE_STREAM_SOURCE: 'INVALID_CREATE_STREAM_SOURCE',
              INVALID_CREATE_STREAM_SCREEN: 'INVALID_CREATE_STREAM_SCREEN',
              INVALID_CREATE_STREAM_AUDIO: 'INVALID_CREATE_STREAM_AUDIO',
              INVALID_CREATE_STREAM_SCREEN_AUDIO:
                'INVALID_CREATE_STREAM_SCREEN_AUDIO',
              NOT_SUPPORTED_HTTP: 'NOT_SUPPORTED_HTTP',
              NOT_SUPPORTED_WEBRTC: 'NOT_SUPPORTED_WEBRTC',
              NOT_SUPPORTED_PROFILE: 'NOT_SUPPORTED_PROFILE',
              NOT_SUPPORTED_MEDIA: 'NOT_SUPPORTED_MEDIA',
              NOT_SUPPORTED_H264ENCODE: 'NOT_SUPPORTED_H264ENCODE',
              NOT_SUPPORTED_H264DECODE: 'NOT_SUPPORTED_H264DECODE',
              NOT_SUPPORTED_TRACK: 'NOT_SUPPORTED_TRACK',
              NOT_SUPPORTED_SWITCH_DEVICE: 'NOT_SUPPORTED_SWITCH_DEVICE',
              NOT_SUPPORTED_CAPTURE: 'NOT_SUPPORTED_CAPTURE',
              NOT_SUPPORTED_AUX: 'NOT_SUPPORTED_AUX',
              MICROPHONE_NOT_FOUND: 'MICROPHONE_NOT_FOUND',
              CAMERA_NOT_FOUND: 'CAMERA_NOT_FOUND',
              SIGNAL_RESPONSE_FAILED: 'SIGNAL_RESPONSE_FAILED',
              CATCH_HANDLER_ERROR: 'CATCH_HANDLER_ERROR',
              API_NOT_EXIST: 'API_NOT_EXIST',
              CONNECTION_CLOSED: 'CONNECTION_CLOSED',
              SUBSCRIBE_ALL_FALSE: 'SUBSCRIBE_ALL_FALSE',
              SEI_NOT_SUPPORT: 'SEI_NOT_SUPPORT',
              SEI_DISABLED: 'SEI_DISABLED',
              SEI_EMPTY: 'SEI_EMPTY',
              SEI_OVERSIZE: 'SEI_OVERSIZE',
              SEI_BEFORE_PUBLISH: 'SEI_BEFORE_PUBLISH',
              SEI_NOT_VIDEO: 'SEI_NOT_VIDEO',
              CALL_FREQUENCY_LIMIT: 'CALL_FREQUENCY_LIMIT',
              CONNECTION_ABORTED: 'CONNECTION_ABORTED',
              API_CALL_ABORTED: 'API_CALL_ABORTED',
              DUPLICATE_AUX: 'DUPLICATE_AUX',
            },
            YO = {
              AVOID_REPEATED_CALL: (e) =>
                'previous '.concat(
                  e.name,
                  '() is ongoing, please avoid repeated calls.',
                ),
              INVALID_PARAMETER_REQUIRED(e) {
                let { key: t, rule: i, fnName: n, value: r } = e;
                return "'"
                  .concat(t || i.name, "' is a required param when calling ")
                  .concat(n, '(), received: ')
                  .concat(r, '.');
              },
              INVALID_PARAMETER_TYPE(e) {
                let { key: t, rule: i, fnName: n, value: r } = e,
                  o = ''.concat(t || i.name),
                  s = '';
                return (
                  (s = Array.isArray(i.type) ? i.type.join('|') : i.type),
                  "'"
                    .concat(o, "' must be type of ")
                    .concat(s, ' when calling ')
                    .concat(n, '(), received type: ')
                    .concat(tO(r), '.')
                );
              },
              INVALID_PARAMETER_EMPTY(e) {
                let { key: t, rule: i, fnName: n, value: r } = e;
                return "'"
                  .concat(t || i.name, "' cannot be '")
                  .concat(r, "' when calling ")
                  .concat(n, '().');
              },
              INVALID_PARAMETER_INSTANCE(e) {
                let { key: t, rule: i, fnName: n, value: r } = e,
                  o = ''.concat(t || i.name),
                  s = ''.concat(i.instanceOf.name || i.instanceOf);
                return "'"
                  .concat(o, "' must be instanceof ")
                  .concat(s, ' when calling ')
                  .concat(n, '(), received type: ')
                  .concat(tO(r), '.');
              },
              INVALID_PARAMETER_RANGE(e) {
                let { key: t, rule: i, fnName: n, value: r } = e;
                return "'"
                  .concat(t || i.name, "' must be one of ")
                  .concat(i.values.join('|'), ' when calling ')
                  .concat(n, '(), received: ')
                  .concat(r, '.');
              },
              INVALID_PARAMETER_MIN(e) {
                let { key: t, rule: i, fnName: n, value: r } = e;
                return 'the min value of '
                  .concat(t || i.name, ' is ')
                  .concat(i.min, ', received: ')
                  .concat(r, '.');
              },
              INVALID_PARAMETER_MAX(e) {
                let { key: t, rule: i, fnName: n, value: r } = e;
                return 'the max value of '
                  .concat(t || i.name, ' is ')
                  .concat(i.max, ', received: ')
                  .concat(r, '.');
              },
              API_CALL_TIMEOUT: (e) =>
                ''.concat(e.commandDesc || e.command, ' timeout observed.'),
              SIGNAL_CHANNEL_RECONNECTION_FAILED:
                'signal channel reconnection failed, please check your network.',
              SIGNAL_CHANNEL_SETUP_FAILED: (e) =>
                'SignalChannel setup failure: (errorCode: '
                  .concat(e.errorCode, ', errorMsg: ')
                  .concat(e.errorMsg, ' }).'),
              ERROR_MESSAGE(e) {
                let t = ''.concat(e.type, ' failed');
                return (
                  e.message && (t = ''.concat(t, ': ').concat(e.message, '.')),
                  t
                );
              },
              EXCHANGE_SDP_TIMEOUT: 'exchange sdp timeout.',
              DOWNLINK_RECONNECTION_FAILED:
                'downlink reconnection failed, please check your network and re-join room.',
              EXCHANGE_SDP_FAILED: (e) =>
                'exchange sdp failed '.concat(e.errMsg, '.'),
              UPDATE_OFFER_TIMEOUT: 'update offer timeout observed.',
              UPLINK_RECONNECTION_FAILED:
                'uplink reconnection failed, please check your network and publish again.',
              INVALID_RECORDID: 'recordId must be an integer number.',
              INVALID_PURE_AUDIO: 'pureAudioPushMode must be 1 or 2.',
              INVALID_STREAMID:
                'streamId must be a sting literal within 64 bytes, and not be empty.',
              INVALID_USER_DEFINE_RECORDID:
                'userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.',
              INVALID_USER_DEFINE_PUSH_ARGS:
                'userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.',
              INVALID_PROXY: 'proxy server url must start with "wss://".',
              INVALID_JOIN: 'duplicate join() called.',
              INVALID_ROOMID_STRING: (e) =>
                "'".concat(
                  e,
                  "' must be validate string when useStringRoomId is true.",
                ),
              INVALID_ROOMID_INTEGER: (e) =>
                "'".concat(
                  e,
                  "' must be an integer between [1, 4294967294] when useStringRoomId is false.",
                ),
              INVALID_SIGNAL_CHANNEL: 'SignalChannel is not ready yet.',
              JOIN_ROOM_TIMEOUT: 'join room timeout.',
              JOIN_ROOM_FAILED(e) {
                let { error: t, code: i } = e;
                return 'Failed to join room - '.concat(t, ' code: ').concat(i);
              },
              REJOIN_ROOM_FAILED: (e) =>
                'reJoin room: '.concat(
                  e.roomId,
                  ' failed, please check your network.',
                ),
              INVALID_DESTROY: 'please call leave() before destroy().',
              INVALID_PUBLISH: 'please call join() before publish().',
              INVALID_UNPUBLISH: 'stream has not been published yet.',
              INVALID_AUDIENCE: 'no permission to publish() under live/'.concat(
                'audience',
                ', please call switchRole("',
                'anchor',
                '") firstly before publish().',
              ),
              INVALID_INITIALIZE:
                'cannot publish stream because stream is not initialized, is switching device, or has been closed.',
              INVALID_DUPLICATE_PUBLISHING: (e) =>
                'duplicate '
                  .concat(e, ' stream publishing, please unpublish your prev ')
                  .concat(e, ' stream and then re-publish.'),
              INVALID_SUBSCRIBE_UNDEFINED: 'stream is undefined or null.',
              INVALID_SUBSCRIBE_LOCAL: 'stream cannot be LocalStream.',
              INVALID_REMOTE_STREAM:
                'remoteStream does not exist because it has been unpublished by remote peer.',
              SUBSCRIBE_FAILED(e) {
                let { message: t, userId: i, streamType: n } = e;
                return 'failed to subscribe '
                  .concat(i, ' ')
                  .concat(n, ' stream, reason: ')
                  .concat(t, '.');
              },
              INVALID_ROLE: 'switchRole can only be called in live mode.',
              INVALID_PARAMETER_SWITCH_ROLE:
                'role could only be set to a value as '.concat(
                  'anchor',
                  ' or ',
                  'audience',
                  '.',
                ),
              INVALID_OPERATION_SWITCH_ROLE:
                'please call join() before switchRole().',
              SWITCH_ROLE_TIMEOUT: 'switchRole timeout.',
              SWITCH_ROLE_FAILED: (e) =>
                'switchRole failed, errCode: '
                  .concat(e.code, ' errMsg: ')
                  .concat(e.message, '.'),
              CLIENT_BANNED: (e) =>
                'client was banned because of '.concat(e.message, '.'),
              INVALID_OPERATION_START_PUBLISH_CDN:
                'please call startPublishCDNStream() after join room and publish the local stream.',
              INVALID_OPERATION_STOP_PUBLISH_CDN:
                'please call startPublishCDNStream() before stopPublishCDNStream().',
              START_PUBLISH_CDN_FAILED: (e) =>
                'startPublishCDNStream failed, errMsg: '.concat(e.message, '.'),
              STOP_PUBLISH_CDN_FAILED: (e) =>
                'stopPublishCDNStream failed, errMsg: '.concat(e.message, '.'),
              INVALID_STREAM_ID: (e) =>
                "'".concat(
                  e,
                  "' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores.",
                ),
              START_MIX_TRANSCODE:
                'please call startMixTranscode() after join().',
              STOP_MIX_TRANSCODE:
                'please call stopMixTranscode() after startMixTranscode().',
              INVALID_AUDIO_VOLUME: 'interval must be a number.',
              ENABLE_SMALL_STREAM_PUBLISHED:
                'Cannot enable small stream after localStream published.',
              DISABLE_SMALL_STREAM_PUBLISHED:
                'Cannot disable small stream after localStream published.',
              NOT_SUPPORTED_SMALL_STREAM:
                'your browser does not support opening small stream.',
              INVALID_SMALL_STREAM_PROFILE: 'small stream profile is invalid.',
              INVALID_PARAMETER_REMOTE_STREAM: 'remoteStream is invalid.',
              INVALID_OPERATION_CHANGE_SMALL:
                'cannot switch to the small stream without subscribing to the video of remoteStream.',
              REMOTE_NOT_PUBLISH_SMALL_STREAM:
                'remote peer does not publish small stream.',
              INVALID_SWITCH_DEVICE: 'cannot switch device on current stream.',
              INVALID_SWITCH_DEVICE_PUBLISHING:
                'cannot switch device when publishing localStream.',
              INVALID_REPLACE_TRACK:
                'cannot replace track when publishing localStream.',
              INVALID_INITIALIZE_LOCAL_STREAM:
                'local stream has not initialized yet.',
              INVALID_ADD_TRACK_REPETITIVE:
                'previous addTrack is ongoing, please avoid repetitive execution.',
              INVALID_ADD_TRACK_REMOVING:
                'cannot add track when a track is removing.',
              INVALID_ADD_TRACK_PUBLISHING:
                'cannot add track when publishing localStream.',
              INVALID_STREAM_INITIALIZED:
                "your local stream haven't been initialized yet.",
              INVALID_ADD_TRACK_NUMBER:
                'a Stream has at most one audio track and one video track.',
              INVALID_REMOVE_AUDIO_TRACK:
                'remove audio track is not supported on your browser.',
              INVALID_REMOVE_AUDIO_ADDING:
                'cannot remove track when a track is adding.',
              INVALID_REMOVE_AUDIO_ON:
                'previous removeTrack is ongoing, please avoid repetitive execution.',
              INVALID_REMOVE_TRACK_PUBLISHING:
                'cannot remove track when publishing localStream.',
              INVALID_REMOVE_TRACK_NOT_TRACK: 'localStream has not this track.',
              INVALID_REMOVE_TRACK_NUMBER:
                'remove the only video track is not supported, please use replaceTrack or muteVideo.',
              INVALID_REPLACE_TRACK_NO_TRACK: (e) =>
                'cannot replace '
                  .concat(e.kind, ' track because stream has not ')
                  .concat(e.kind, ' track'),
              NOT_BUG_PACKAGE:
                'You need to buy packages, refer to tencent console.',
              START_MIX_TRANSCODE_FAILED: (e) =>
                'startMixTranscode failed, errMsg: '.concat(e.message, '.'),
              STOP_MIX_TRANSCODE_FAILED: (e) =>
                'stopMixTranscode failed, errMsg: '.concat(e.message, '.'),
              MIX_TRANSCODE_NOT_STARTED: 'mixTranscode has not been started.',
              CANNOT_LESS_THAN_ZERO(e) {
                let { key: t, rule: i, fnName: n, value: r } = e;
                return "'"
                  .concat(t || i.name, "' cannot be less than 0 when calling ")
                  .concat(n, '().');
              },
              MIX_PARAMS_VIDEO_FRAMERATE:
                "'config.videoFramerate' should be an integer between 0 and 30, excluding 0.",
              MIX_PARAMS_VIDEO_GOP:
                "'config.videoGOP' should be an integer between 1 and 8.",
              MIX_PARAMS_AUDIO_BITRATE:
                "'config.audioBitrate' should be an integer between 32 and 192.",
              MIX_PARAMS_USER_Z_ORDER: (e) =>
                "'".concat(e, "' is required and must be between 1 and 15."),
              MIX_PARAMS_NOT_SELF: "'config.mixUsers' must contain self.",
              MIX_PARAMS_USER_STREAM:
                "'config.videoWidth' and 'config.videoHeight' of output stream should be contain all mix stream.",
              INVALID_PLAY:
                'duplicate play() call observed, please stop() firstly.',
              INVALID_ELEMENT_ID: (e) => {
                let { key: t, fnName: i } = e;
                return "'"
                  .concat(
                    t,
                    "' is not found in the document object when calling ",
                  )
                  .concat(i, '().');
              },
              INVALID_ELEMENT_ID_TYPE: (e) => {
                let { key: t, fnName: i, type: n } = e;
                return "the element corresponding to '"
                  .concat(t, "' must be instanceof HTMLElement when calling ")
                  .concat(i, '(), received: ')
                  .concat(n, '.');
              },
              PLAY_FAILED: (e) =>
                ''
                  .concat(e.media, ' play failed，browser exception: ')
                  .concat(e.error.toString()),
              INVALID_USERID: 'userId cannot be all spaces.',
              INVALID_CREATE_STREAM_SOURCE:
                'LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.',
              INVALID_CREATE_STREAM_SCREEN: 'screen/video cannot be both true.',
              INVALID_CREATE_STREAM_AUDIO:
                'audio/screenAudio cannot be both true.',
              INVALID_CREATE_STREAM_SCREEN_AUDIO:
                'when screen is true, screenAudio can be configured.',
              NOT_SUPPORTED_HTTP:
                'http protocol does not support the ability to capture microphone, camera and screen. please use https to deploy your page.',
              NOT_SUPPORTED_WEBRTC:
                'your browser or environment does not support full WebRTC capabilities.',
              NOT_SUPPORTED_PROFILE:
                'your browser does not support setVideoProfile.',
              NOT_SUPPORTED_MEDIA:
                'your browser or environment does not support navigator.mediaDevices.',
              NOT_SUPPORTED_H264ENCODE:
                'your device does not support H.264 encoding.',
              NOT_SUPPORTED_H264DECODE:
                'your device does not support H.264 decoding.',
              NOT_SUPPORTED_TRACK: (e) =>
                ''.concat(e, 'Track is not supported on your browser.'),
              NOT_SUPPORTED_SWITCH_DEVICE:
                'switchDevice is not supported on your browser.',
              NOT_SUPPORTED_CAPTURE:
                'Your browser or environment does not support screen sharing, please check whether the browser version.',
              MICROPHONE_NOT_FOUND:
                'no microphone detected, please check your microphone.',
              CAMERA_NOT_FOUND: 'no camera detected, please check your camera.',
              SIGNAL_RESPONSE_FAILED: (e) =>
                ''
                  .concat(e.signalResponse, ' failed, response code is ')
                  .concat(e.code, ' , errMsg: ')
                  .concat(e.message, '.'),
              CATCH_HANDLER_ERROR(e) {
                let { name: t, event: i } = e;
                return 'an error was caught on '
                  .concat(t, ".on('")
                  .concat(
                    i,
                    "', handler), please check your code on 'handler'.",
                  );
              },
              API_NOT_EXIST(e) {
                let { name: t } = e;
                return 'experimental api '.concat(t, ' does not exist.');
              },
              REPEAT_JOIN: (e) =>
                '['.concat(
                  e,
                  '] is calling client.join api or has already joined room, please avoid repeated join.',
                ),
              CONNECTION_CLOSED:
                'remoteStream has been unsubscribed or unpublished by remote user.',
              SUBSCRIBE_ALL_FALSE:
                'cannot subscribe when both audio & video are false, use client.unsubscribe() instead',
              CLIENT_DESTROYED(e) {
                let { funName: t } = e;
                return 'failed to call '.concat(
                  t,
                  '() because client was destroyed.',
                );
              },
              SEI_NOT_SUPPORT: (e) =>
                'not support to sendSEIMessage'.concat(
                  !1 === e ? ' without using h264 codec' : '',
                ),
              SEI_DISABLED: 'SEI is disabled',
              SEI_EMPTY: 'buffer cannot be empty',
              SEI_OVERSIZE: (e) =>
                'buffer size('.concat(e, ') is over 1000 Bytes'),
              SEI_BEFORE_PUBLISH:
                'please call sendSEIMessage() after publish() success',
              SEI_NOT_VIDEO: 'cannot send sei when localStream has not video.',
              CALL_FREQUENCY_LIMIT: (e) => {
                let {
                  isSize: t,
                  name: i,
                  timesInSecond: n,
                  maxSizeInSecond: r,
                } = e;
                return 'api '
                  .concat(i, ' call ')
                  .concat(t ? 'size' : 'times', ' is over ')
                  .concat(t ? ''.concat(r, ' bytes') : n, ' in a second.');
              },
              CONNECTION_ABORTED: (e) =>
                'connection aborted due to: '.concat(e),
              API_CALL_ABORTED(e) {
                let t;
                return (
                  (t = e.message.includes('REMOTE_STREAM_NOT_EXIST')
                    ? 'Subscribe '
                        .concat(e.userId, ' ')
                        .concat(
                          e.streamType,
                          ' stream aborted, reason: remote user ',
                        )
                        .concat(e.userId, ' unpublished stream.')
                    : 'API aborted, reason: '.concat(e.message)),
                  t
                );
              },
              DUPLICATE_AUX:
                'only one auxiliary stream can be published in a room.',
              NOT_SUPPORTED_AUX:
                'publish auxiliary stream is not supported on your browser.',
              INVALID_PARAMETER_STREAMTYPE: (e) =>
                "'streamType' is required when 'userId' is not '*', calling ".concat(
                  e,
                  '()',
                ),
            },
            zO = (e, t) =>
              t
                ? ''.concat(TN, '/').concat(e, '/').concat(t)
                : ''.concat(TN, '/').concat(e, '/index.html'),
            qO = () => {
              if (window.TRTC_ERROR_INFO && window.TRTC_ERROR_LINK)
                return {
                  TRTC_ERROR_INFO: window.TRTC_ERROR_INFO,
                  TRTC_ERROR_LINK: window.TRTC_ERROR_LINK,
                };
              let e = localStorage.getItem(vN);
              if (e) {
                e = JSON.parse(e);
                let t = document.createElement('script');
                (t.type = 'text/javascript'),
                  (t.text = e.message),
                  document.body.appendChild(t);
                let i = window.TRTC_ERROR_INFO,
                  n = window.TRTC_ERROR_LINK;
                return (
                  document.body.removeChild(t),
                  { TRTC_ERROR_INFO: i, TRTC_ERROR_LINK: n }
                );
              }
              return {};
            };
          function QO(e) {
            let { key: t, data: i, link: n, addDocLink: r = !0 } = e,
              o = '',
              s = '',
              a = '';
            iO(YO[t]) ? (o = YO[t](i)) : rO(YO[t]) && (o = YO[t]);
            let { TRTC_ERROR_INFO: c, TRTC_ERROR_LINK: l } = qO();
            n
              ? (a = ''.concat(n.className, '.html#').concat(n.fnName))
              : l &&
                l[t] &&
                (iO(l[t]) ? (a = l[t](i)) : rO(l[t]) && (a = l[t]));
            let d = o;
            return (
              XD() &&
                (c &&
                  c[t] &&
                  (iO(c[t]) ? (s = c[t](i)) : rO(c[t]) && (s = c[t])),
                s &&
                  ((d = r
                    ? ''
                        .concat(s, '\n请查看文档: ')
                        .concat(zO('zh-cn', a), '\n\n')
                    : ''.concat(s, '\n\n')),
                  (d += o))),
              r && (d += ' \nRefer to: '.concat(zO('en', a), '\n')),
              d
            );
          }
          var XO = {
              result: !1,
              detail: {
                isBrowserSupported: !1,
                isWebRTCSupported: !1,
                isWebCodecsSupported: !1,
                isMediaDevicesSupported: !1,
                isScreenShareSupported: !1,
                isSmallStreamSupported: !1,
                isH264EncodeSupported: !1,
                isVp8EncodeSupported: !1,
                isH264DecodeSupported: !1,
                isVp8DecodeSupported: !1,
              },
            },
            $O = new Map([
              [Ub, ['Firefox', Fb]],
              [Gb, ['Edg', Wb]],
              [Lk, ['Chrome', xk]],
              [Uk, ['Safari', Bk]],
              [Qb, ['TBS', Xb]],
              [$b, ['XWEB', Zb]],
              [nk && Ob, ['WeChat', rk]],
              [ck, ['QQ(Win)', lk]],
              [sk, ['QQ(Mobile)', ak]],
              [ok, ['QQ(Mobile X5)', ak]],
              [dk, ['QQ(Mac)', uk]],
              [hk, ['QQ(iPad)', pk]],
              [Ik, ['MI', vk]],
              [yk, ['HW', Rk]],
              [Ck, ['Samsung', bk]],
              [kk, ['OPPO', Nk]],
              [Dk, ['VIVO', Ok]],
              [Hb, ['EDGE', jb]],
              [Kb, ['SogouMobile', Yb]],
              [zb, ['Sogou', qb]],
            ]);
          function ZO() {
            let e = $O.get(!0);
            return {
              browserName: e ? e[0] : 'unknown',
              browserVersion: e ? e[1] : 'unknown',
            };
          }
          var ew = function () {
              return !(Ek || Hb || (Gb && Jb < 80) || (Ub && Bb < 56));
            },
            tw = function () {
              return [
                'VideoDecoder',
                'VideoEncoder',
                'AudioEncoder',
                'AudioDecoder',
                'MediaStreamTrackGenerator',
              ].every((e) => e in window);
            },
            iw = function () {
              if (!navigator.mediaDevices)
                return rw() || jO.error(YO.NOT_SUPPORTED_MEDIA), !1;
              let e = ['getUserMedia', 'enumerateDevices'];
              return (
                e.filter((e) => e in navigator.mediaDevices).length === e.length
              );
            },
            nw = !1;
          function rw() {
            return false;
          }
          var ow = function () {
              return (
                (null == window ? void 0 : window.OffscreenCanvas) &&
                (null == window ? void 0 : window.MediaStreamTrackProcessor) &&
                (null == window ? void 0 : window.MediaStreamTrackGenerator)
              );
            },
            sw = function () {
              return ab(this, null, function* () {
                if (
                  XO.detail.isH264EncodeSupported ||
                  XO.detail.isVp8EncodeSupported
                )
                  return {
                    isH264EncodeSupported: XO.detail.isH264EncodeSupported,
                    isVp8EncodeSupported: XO.detail.isVp8EncodeSupported,
                  };
                let e,
                  t = !1,
                  i = !1;
                try {
                  let n = new RTCPeerConnection(),
                    r = document.createElement(LN.CANVAS);
                  r.getContext('2d');
                  let o = r.captureStream(0);
                  return (
                    n.addTrack(o.getVideoTracks()[0], o),
                    (e = yield n.createOffer()),
                    -1 !== e.sdp.toLowerCase().indexOf('h264') && (t = !0),
                    -1 !== e.sdp.toLowerCase().indexOf('vp8') && (i = !0),
                    n.close(),
                    (XO.detail.isH264EncodeSupported = t),
                    (XO.detail.isVp8EncodeSupported = i),
                    {
                      isH264EncodeSupported: XO.detail.isH264EncodeSupported,
                      isVp8EncodeSupported: XO.detail.isVp8EncodeSupported,
                    }
                  );
                } catch (sD) {
                  return {
                    isH264EncodeSupported: !1,
                    isVp8EncodeSupported: !1,
                  };
                }
              });
            },
            aw = function () {
              return ab(this, null, function* () {
                if (
                  XO.detail.isH264DecodeSupported &&
                  XO.detail.isVp8DecodeSupported
                )
                  return {
                    isH264DecodeSupported: XO.detail.isH264DecodeSupported,
                    isVp8DecodeSupported: XO.detail.isVp8DecodeSupported,
                  };
                let e,
                  t = !1,
                  i = !1;
                try {
                  let n = new RTCPeerConnection();
                  return (
                    (e = yield n.createOffer({
                      offerToReceiveAudio: !0,
                      offerToReceiveVideo: !0,
                    })),
                    -1 !== e.sdp.toLowerCase().indexOf('h264') && (t = !0),
                    -1 !== e.sdp.toLowerCase().indexOf('vp8') && (i = !0),
                    n.close(),
                    { isH264DecodeSupported: t, isVp8DecodeSupported: i }
                  );
                } catch (sD) {
                  return {
                    isH264DecodeSupported: !1,
                    isVp8DecodeSupported: !1,
                  };
                }
              });
            },
            cw = function () {
              return ab(this, null, function* () {
                if (XO.result) return XO;
                let e = ew(),
                  t = Dw(),
                  i = tw(),
                  n = iw(),
                  { isH264EncodeSupported: r, isVp8EncodeSupported: o } =
                    yield sw(),
                  { isH264DecodeSupported: s, isVp8DecodeSupported: a } =
                    yield aw();
                return (
                  (XO.result = e && t && n && (r || o) && (s || a)),
                  (XO.detail.isBrowserSupported = e),
                  (XO.detail.isWebRTCSupported = t),
                  (XO.detail.isWebCodecsSupported = i),
                  (XO.detail.isMediaDevicesSupported = n),
                  (XO.detail.isScreenShareSupported = dw()),
                  (XO.detail.isSmallStreamSupported = gw()),
                  (XO.detail.isH264EncodeSupported = r),
                  (XO.detail.isVp8EncodeSupported = o),
                  (XO.detail.isH264DecodeSupported = s),
                  (XO.detail.isVp8DecodeSupported = a),
                  XO.result ||
                    jO.error(
                      ''
                        .concat(navigator.userAgent, ' ')
                        .concat(OO(XO.detail, !1)),
                    ),
                  XO
                );
              });
            },
            lw = function () {
              return XO.result;
            },
            dw = function () {
              return !(
                !navigator.mediaDevices ||
                !navigator.mediaDevices.getDisplayMedia
              );
            },
            uw = (e, t, i) => {
              false &&
                !Yk &&
                (e[t] = () => {
                  throw new gb({
                    code: mb.INVALID_OPERATION,
                    message: YO.NOT_SUPPORTED_HTTP,
                  });
                });
            },
            hw = function (e) {
              return (
                !(
                  'candidate-pair' !== e.type ||
                  !e.nominated ||
                  ('in-progress' !== e.state && 'succeeded' !== e.state)
                ) && !(sO(e.selected) && !e.selected)
              );
            };
          function pw() {
            let e = '';
            if (screen.width) {
              let t = screen.width
                  ? screen.width * window.devicePixelRatio
                  : '',
                i = screen.height
                  ? screen.height * window.devicePixelRatio
                  : '';
              e += ''.concat(t, ' * ').concat(i);
            }
            return e;
          }
          function _w() {
            return (
              navigator.getUserMedia ||
              (navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
            );
          }
          function mw() {
            let e = { isSupported: !1 },
              t = [
                'AudioContext',
                'webkitAudioContext',
                'mozAudioContext',
                'msAudioContext',
              ];
            for (let i = 0; i < t.length; i++)
              if (t[i] in window) {
                e.isSupported = !0;
                break;
              }
            return e.isSupported;
          }
          function fw() {
            return 'captureStream' in HTMLCanvasElement.prototype;
          }
          function gw() {
            return !(nk || Pb || (Vk && Vk < 63)) && !(!ew() || !fw());
          }
          var Tw = function () {
            if (
              nO(window.RTCRtpTransceiver) ||
              !('currentDirection' in RTCRtpTransceiver.prototype)
            )
              return !1;
            let e = null,
              t = !1;
            try {
              (e = new RTCPeerConnection({ sdpSemantics: hD })),
                e.addTransceiver(LN.AUDIO),
                (t = !0);
            } catch (sN) {}
            return null == e || e.close(), t;
          };
          function Ew() {
            return (
              'RTCPeerConnection' in window &&
              'getReceivers' in window.RTCPeerConnection.prototype
            );
          }
          function Sw() {
            return (
              'RTCPeerConnection' in window &&
              'getSenders' in window.RTCPeerConnection.prototype
            );
          }
          function Iw() {
            return (
              'RTCPeerConnection' in window &&
              'getTransceivers' in window.RTCPeerConnection.prototype
            );
          }
          function vw() {
            return (
              11 !== Gk &&
              'RTCPeerConnection' in window &&
              'addTransceiver' in window.RTCPeerConnection.prototype
            );
          }
          var yw = !(!vw() || (Pk && Vk < 74));
          function Aw() {
            return (
              'RTCRtpTransceiver' in window &&
              'stop' in window.RTCRtpTransceiver.prototype
            );
          }
          function Rw() {
            return (
              'RTCRtpSender' in window &&
              'replaceTrack' in window.RTCRtpSender.prototype
            );
          }
          function Cw() {
            return (
              'RTCRtpSender' in window &&
              'setParameters' in window.RTCRtpSender.prototype &&
              Sw()
            );
          }
          var bw =
              window.MediaStreamTrack &&
              'getSettings' in MediaStreamTrack.prototype,
            kw =
              window.MediaStreamTrack &&
              'getCapabilities' in MediaStreamTrack.prototype,
            Nw =
              'RTCRtpSender' in window &&
              'createEncodedStreams' in window.RTCRtpSender.prototype &&
              wk() >= 86,
            Dw = function () {
              return (
                [
                  'RTCPeerConnection',
                  'webkitRTCPeerConnection',
                  'RTCIceGatherer',
                ].filter((e) => e in window).length > 0
              );
            };
          function Ow() {
            let e = {
              AudioDecoder: !1,
              AudioEncoder: !1,
              VideoDecoder: !1,
              VideoEncoder: !1,
              ImageDecoder: !1,
            };
            return (
              nO(window.AudioDecoder) || (e.AudioDecoder = !0),
              nO(window.AudioEncoder) || (e.AudioEncoder = !0),
              nO(window.VideoDecoder) || (e.VideoDecoder = !0),
              nO(window.VideoEncoder) || (e.VideoEncoder = !0),
              nO(window.ImageDecoder) || (e.ImageDecoder = !0),
              e
            );
          }
          function ww() {
            return (
              'mediaSession' in navigator &&
              !nO(navigator.mediaSession.setActionHandler)
            );
          }
          function Pw() {
            return !nO(window.WebTransport);
          }
          function Lw() {
            let e = {
              browser: ''.concat(qk.name, '/').concat(qk.version),
              os: eN(),
              displayResolution: pw(),
              isScreenShareSupported: dw(),
              isWebRTCSupported: Dw(),
              isGetUserMediaSupported: _w(),
              isWebAudioSupported: mw(),
              isWebSocketsSupported:
                'WebSocket' in window && 2 === window.WebSocket.CLOSING,
              isWebCodecSupported: Ow(),
              isMediaSessionSupported: ww(),
              isWebTransportSupported: Pw(),
            };
            return (
              navigator.userAgent.includes('miniProgram') &&
                (e.browser = 'mini/'.concat(e.browser)),
              e
            );
          }
          var Mw = nb(cb(), 1),
            Vw = Symbol('instance'),
            xw = Symbol('cacheResult'),
            Uw = class {
              constructor(e, t, i) {
                (this.oldState = e),
                  (this.newState = t),
                  (this.action = i),
                  (this.aborted = !1);
              }
              abort(e) {
                (this.aborted = !0),
                  Gw.call(
                    e,
                    this.oldState,
                    new Error("action '".concat(this.action, "' aborted")),
                  );
              }
              toString() {
                return ''.concat(this.action, 'ing');
              }
            },
            Fw = class extends Error {
              constructor(e, t, i) {
                super(t),
                  (this.state = e),
                  (this.message = t),
                  (this.cause = i);
              }
            };
          var Bw = new Map();
          function Hw(e, t) {
            let i =
              arguments.length > 2 && void 0 !== arguments[2]
                ? arguments[2]
                : {};
            return (n, r, o) => {
              let s = i.action || r;
              if (!i.context) {
                let i = Bw.get(n) || [];
                Bw.has(n) || Bw.set(n, i),
                  i.push({ from: e, to: t, action: s });
              }
              let a = o.value;
              o.value = function () {
                let n = this;
                for (
                  var r = arguments.length, o = new Array(r), c = 0;
                  c < r;
                  c++
                )
                  o[c] = arguments[c];
                if (
                  (i.context &&
                    (n = Ww.get(
                      'function' == typeof i.context
                        ? i.context.call(this, ...o)
                        : i.context,
                    )),
                  n.state === t)
                )
                  return n[xw];
                n.state instanceof Uw &&
                  n.state.action == i.abortAction &&
                  n.state.abort(n);
                let l = null;
                if (
                  (Array.isArray(e)
                    ? 0 == e.length
                      ? n.state instanceof Uw && n.state.abort(n)
                      : ('string' != typeof n.state || !e.includes(n.state)) &&
                        (l = new Fw(
                          n._state,
                          ''
                            .concat(n.name, ' ')
                            .concat(s, ' to ')
                            .concat(t, ' failed: current state ')
                            .concat(n._state, ' not in from config'),
                        ))
                    : e !== n.state &&
                      (l = new Fw(
                        n._state,
                        ''
                          .concat(n.name, ' ')
                          .concat(s, ' to ')
                          .concat(t, ' failed: current state ')
                          .concat(n._state, ' not from ')
                          .concat(e),
                      )),
                  l)
                ) {
                  if (!i.fail) {
                    if (i.ignoreError) return l;
                    throw l;
                  }
                  i.fail.call(this, l);
                }
                let d = n.state,
                  u = new Uw(d, t, s);
                Gw.call(n, u);
                let h = (e) => {
                    var r;
                    return (
                      (n[xw] = e),
                      u.aborted ||
                        (Gw.call(n, t),
                        null === (r = i.success) ||
                          void 0 === r ||
                          r.call(this, n[xw])),
                      e
                    );
                  },
                  p = (e) => {
                    let t = e instanceof Error ? e.message : String(e);
                    if ((Gw.call(n, d, e), !i.fail)) {
                      if (i.ignoreError) return e;
                      throw e;
                    }
                    i.fail.call(
                      this,
                      new Fw(
                        n._state,
                        "action '".concat(s, "' failed :").concat(t),
                        e instanceof Error ? e : new Error(t),
                      ),
                    );
                  };
                try {
                  let e = a.apply(this, o);
                  return (function (e) {
                    return 'object' == typeof e && e && 'then' in e;
                  })(e)
                    ? e.then(h).catch(p)
                    : h(e);
                } catch (_) {
                  p(_);
                }
              };
            };
          }
          var jw =
            'undefined' != typeof window && window.__AFSM__
              ? (e, t) => {
                  window.dispatchEvent(new CustomEvent(e, { detail: t }));
                }
              : 'undefined' != typeof importScripts
              ? (e, t) => {
                  postMessage({ type: e, payload: t });
                }
              : () => {};
          function Gw(e, t) {
            let i = this._state;
            this._state = e;
            let n = e.toString();
            e && this.emit(n, i),
              this.emit(Ww.STATECHANGED, e, i, t),
              this.updateDevTools({
                value: e,
                old: i,
                err: t instanceof Error ? t.message : String(t),
              });
          }
          var Ww = class extends Mw.default {
            constructor(e, t, i) {
              super(),
                (this.name = e),
                (this.groupName = t),
                (this._state = Ww.INIT),
                e || (e = Date.now().toString(36)),
                i
                  ? Object.setPrototypeOf(this, i)
                  : (i = Object.getPrototypeOf(this)),
                t || (this.groupName = this.constructor.name);
              let n = i[Vw];
              n
                ? (this.name = n.name + '-' + n.count++)
                : (i[Vw] = { name: this.name, count: 0 }),
                this.updateDevTools({ diagram: this.stateDiagram });
            }
            get stateDiagram() {
              let e = Object.getPrototypeOf(this),
                t = Bw.get(e) || [],
                i = new Set(),
                n = [],
                r = [],
                o = new Set(),
                s = Object.getPrototypeOf(e);
              Bw.has(s) &&
                (s.stateDiagram.forEach((e) => i.add(e)),
                s.allStates.forEach((e) => o.add(e))),
                t.forEach((e) => {
                  let { from: t, to: i, action: o } = e;
                  'string' == typeof t
                    ? n.push({ from: t, to: i, action: o })
                    : t.length
                    ? t.forEach((e) => {
                        n.push({ from: e, to: i, action: o });
                      })
                    : r.push({ to: i, action: o });
                }),
                n.forEach((e) => {
                  let { from: t, to: n, action: r } = e;
                  o.add(t),
                    o.add(n),
                    o.add(r + 'ing'),
                    i.add(
                      ''.concat(t, ' --\x3e ').concat(r, 'ing : ').concat(r),
                    ),
                    i.add(
                      ''
                        .concat(r, 'ing --\x3e ')
                        .concat(n, ' : ')
                        .concat(r, ' 🟢'),
                    ),
                    i.add(
                      ''
                        .concat(r, 'ing --\x3e ')
                        .concat(t, ' : ')
                        .concat(r, ' 🔴'),
                    );
                }),
                r.forEach((e) => {
                  let { to: t, action: n } = e;
                  i.add(
                    ''
                      .concat(n, 'ing --\x3e ')
                      .concat(t, ' : ')
                      .concat(n, ' 🟢'),
                  ),
                    o.forEach((e) => {
                      e !== t &&
                        i.add(
                          ''
                            .concat(e, ' --\x3e ')
                            .concat(n, 'ing : ')
                            .concat(n),
                        );
                    });
                });
              let a = [...i];
              return (
                Object.defineProperties(e, {
                  stateDiagram: { value: a },
                  allStates: { value: o },
                }),
                a
              );
            }
            static get(e) {
              let t;
              return (
                'string' == typeof e
                  ? ((t = Ww.instances.get(e)),
                    t ||
                      Ww.instances.set(
                        e,
                        (t = new Ww(e, void 0, Object.create(Ww.prototype))),
                      ))
                  : ((t = Ww.instances2.get(e)),
                    t ||
                      Ww.instances2.set(
                        e,
                        (t = new Ww(
                          e.constructor.name,
                          void 0,
                          Object.create(Ww.prototype),
                        )),
                      )),
                t
              );
            }
            static getState(e) {
              var t;
              return null === (t = Ww.get(e)) || void 0 === t
                ? void 0
                : t.state;
            }
            updateDevTools() {
              let e =
                arguments.length > 0 && void 0 !== arguments[0]
                  ? arguments[0]
                  : {};
              jw(
                Ww.UPDATEAFSM,
                Object.assign({ name: this.name, group: this.groupName }, e),
              );
            }
            get state() {
              return this._state;
            }
            set state(e) {
              Gw.call(this, e);
            }
          };
          (Ww.STATECHANGED = 'stateChanged'),
            (Ww.UPDATEAFSM = 'updateAFSM'),
            (Ww.INIT = '[*]'),
            (Ww.ON = 'on'),
            (Ww.OFF = 'off'),
            (Ww.instances = new Map()),
            (Ww.instances2 = new WeakMap());
          var Jw =
              (null == window ? void 0 : window.requestIdleCallback) ||
              function (e) {
                let t = Date.now();
                return setTimeout(() => {
                  e({
                    didTimeout: !1,
                    timeRemaining: () => Math.max(0, 50 - (Date.now() - t)),
                  });
                }, 1e3);
              },
            Kw =
              (null == window ? void 0 : window.cancelIdleCallback) ||
              function (e) {
                clearTimeout(e);
              },
            Yw =
              (null == window ? void 0 : window.cancelAnimationFrame) ||
              (null == window ? void 0 : window.mozCancelAnimationFrame),
            zw = class {
              static generateTaskID() {
                return this.currentTaskID++;
              }
              static run() {
                let e =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : MD,
                  t = arguments.length > 1 ? arguments[1] : void 0,
                  i = arguments.length > 2 ? arguments[2] : void 0;
                (i = ZC(
                  e === LD
                    ? { delay: 2e3, count: 0, backgroundTask: !0 }
                    : e === wD
                    ? { delay: 1e4, count: 0 }
                    : e === PD
                    ? { fps: 60, delay: 16.6, count: 0, backgroundTask: !0 }
                    : { delay: 2e3, count: 0, backgroundTask: !0 },
                  i,
                )),
                  aO(t) && (i = ZC(ZC({}, i), t)),
                  iO(e) && ((t = e), (e = MD));
                let n = ZC(
                  {
                    taskID: this.generateTaskID(),
                    loopCount: 0,
                    intervalID: null,
                    timeoutID: null,
                    rafID: null,
                    ricID: null,
                    taskName: e,
                    callback: t,
                  },
                  i,
                );
                return this.taskMap.set(n.taskID, n), this[e](n), n.taskID;
              }
              static interval(e) {
                return (e.intervalID = setInterval(() => {
                  e.callback(), (e.loopCount += 1), this.isBreakLoop(e);
                }, e.delay));
              }
              static intervalInWorker(e) {
                e.delay = (1e3 / e.fps).toFixed(2);
                let t = new Worker(
                  URL.createObjectURL(
                    new Blob([
                      "\n        let timerID = null;\n        self.onmessage = function (e) {\n          if (e.data === 'start') {\n            timerID = setInterval(() => {\n              self.postMessage('tick');\n            }, ".concat(
                        e.delay,
                        ");\n          } else if (e.data === 'stop') {\n            clearInterval(timerID);\n          }\n        };\n      ",
                      ),
                    ]),
                  ),
                );
                (t.onmessage = (i) => {
                  'tick' === i.data &&
                    (e.callback(),
                    (e.loopCount += 1),
                    this.isBreakLoop(e) && t.postMessage('stop'));
                }),
                  (e.worker = t),
                  t.postMessage('start');
              }
              static timeout(e) {
                let t = () => {
                  if ((e.callback(), (e.loopCount += 1), !this.isBreakLoop(e)))
                    return (e.timeoutID = setTimeout(t, e.delay));
                };
                return (e.timeoutID = setTimeout(t, e.delay));
              }
              static ric(e) {
                let t,
                  i = fO(),
                  n = () => {
                    if (
                      ((t = fO() - i),
                      t >= e.delay &&
                        ((i = fO() - Math.floor(t % e.delay)),
                        e.callback(),
                        (e.loopCount += 1)),
                      !this.isBreakLoop(e))
                    )
                      return (e.ricID = Jw(n, { timeout: e.delay }));
                  };
                return (e.ricID = Jw(n, { timeout: e.delay }));
              }
              static raf(e) {
                e.delay = (1e3 / e.fps).toFixed(2);
                let t,
                  i = fO(),
                  n = () =>
                    document.hidden && e.backgroundTask
                      ? ((t = fO() - i),
                        (i = fO()),
                        e.callback(),
                        (e.loopCount += 1),
                        this.isBreakLoop(e)
                          ? void 0
                          : (e.timeoutID = setTimeout(
                              n,
                              e.delay - Math.floor(t % e.delay),
                            )))
                      : ((t = fO() - i),
                        t >= e.delay &&
                          ((i = fO() - Math.floor(t % e.delay)),
                          e.callback(),
                          (e.loopCount += 1)),
                        this.isBreakLoop(e)
                          ? void 0
                          : (e.rafID = requestAnimationFrame(n)));
                if (((e.rafID = requestAnimationFrame(n)), e.backgroundTask)) {
                  let t = () => {
                    if (document.hidden) {
                      let t = fO() - i;
                      t >= e.delay
                        ? n()
                        : (e.timeoutID = setTimeout(n, e.delay - t));
                    }
                  };
                  document.addEventListener('visibilitychange', t),
                    (e.onVisibilitychange = t),
                    document.hidden && t();
                }
                return e.taskID;
              }
              static hasTask(e) {
                return this.taskMap.has(e);
              }
              static clearTask(e) {
                if (!this.taskMap.has(e)) return !0;
                let {
                  intervalID: t,
                  timeoutID: i,
                  rafID: n,
                  ricID: r,
                  onVisibilitychange: o,
                  worker: s,
                } = this.taskMap.get(e);
                return (
                  s && s.terminate(),
                  t && clearInterval(t),
                  i && clearTimeout(i),
                  n && Yw(n),
                  r && Kw(r),
                  o && document.removeEventListener('visibilitychange', o),
                  this.taskMap.delete(e),
                  !0
                );
              }
              static isBreakLoop(e) {
                return (
                  !this.taskMap.has(e.taskID) ||
                  (0 !== e.count &&
                    e.loopCount >= e.count &&
                    (this.clearTask(e.taskID), !0))
                );
              }
            };
          (zw.taskMap = new Map()), (zw.currentTaskID = 1);
          var qw = zw;
          LN.SEI_MESSAGE;
          var Qw = {
              LOADED_DATA: LN.LOADEDDATA,
              MEDIA_TRACK_CHANGED: 'media-track-changed',
              PLAYER_STATE_CHANGED: 'player-state-changed',
            },
            Xw = new (class {
              constructor() {
                ob(this, '_roomIdMap', new Map()),
                  ob(this, '_configs'),
                  'undefined' == typeof registerProcessor &&
                    (this._configs = {
                      sdkAppId: '',
                      userId: '',
                      version: rN,
                      env: AN.QCLOUD,
                      browserVersion: qk.name + qk.version,
                      ua: navigator.userAgent,
                    });
              }
              setConfig(e) {
                let { sdkAppId: t, env: i, userId: n, roomId: r } = e;
                t !== this._configs.sdkAppId &&
                  (this._configs.sdkAppId = String(t)),
                  (this._configs.env = i),
                  (this._configs.userId = n),
                  this._roomIdMap.set(n, String(r));
              }
              logSuccessEvent(e) {
                Yk ||
                  !jO.isAbleToUpload ||
                  (this._configs.env === AN.QCLOUD &&
                    this.uploadEventToKibana(
                      eb(ZC({}, e), { result: 'success' }),
                    ));
              }
              logFailedEvent(e) {
                if (Yk || !jO.isAbleToUpload) return;
                let { eventType: t, code: i, error: n, userId: r } = e,
                  o = {
                    roomId: this._roomIdMap.get(r || this._configs.userId),
                    userId: r,
                    eventType: t,
                    result: 'failed',
                    code:
                      i ||
                      (null == n ? void 0 : n.extraCode) ||
                      (null == n ? void 0 : n.code) ||
                      mb.UNKNOWN,
                  };
                this._configs.env === AN.QCLOUD &&
                  this.uploadEventToKibana(eb(ZC({}, o), { error: n }));
              }
              uploadEventToKibana(e) {
                let t = 'stat-'.concat(e.eventType, '-').concat(e.result);
                ('delta-join' === e.eventType ||
                  'delta-leave' === e.eventType ||
                  'delta-publish' === e.eventType) &&
                  (t = ''.concat(e.eventType, ':').concat(e.delta)),
                  this.uploadEvent({ log: t, userId: e.userId }),
                  'failed' === e.result &&
                    ((t = 'stat-'
                      .concat(e.eventType, '-')
                      .concat(e.result, '-')
                      .concat(e.code)),
                    this.uploadEvent({
                      log: t,
                      userId: e.userId,
                      error: e.error,
                    }));
              }
              uploadEvent(e) {
                let { log: t, userId: i, error: n } = e,
                  r = {
                    timestamp: Sb(),
                    sdkAppId: this._configs.sdkAppId,
                    userId: i || this._configs.userId,
                    version: rN,
                    log: t,
                  };
                n && (r.errorInfo = n.message),
                  this.sendRequest(BD(this._configs.sdkAppId, yN.LOG), r);
              }
              sendRequest(e, t) {
                jO.isAbleToUpload
                  ? LO({ url: e, body: JSON.stringify(t) }).catch(() => {})
                  : setTimeout(() => {
                      this.sendRequest(e, t);
                    }, 1e3);
              }
            })(),
            $w = 'trtc_autoplay',
            Zw = ''.concat($w, '_mask'),
            eP = ''.concat($w, '_wrapper'),
            tP = ''.concat($w, '_header'),
            iP = ''.concat($w, '_content'),
            nP = ''.concat($w, '_action_wrapper'),
            rP = ''.concat($w, '_question'),
            oP = ''.concat($w, '_collapse'),
            sP = ''.concat($w, '_action_confirm'),
            aP = ''.concat($w, '_detail'),
            cP = '#2473E8',
            lP = 'dialog',
            dP = ''.concat(lP, '-show'),
            uP = ''.concat(lP, '-1'),
            hP = ''.concat(lP, '-2'),
            pP = !1,
            _P = () => !!document.querySelector('.'.concat(eP)),
            mP = ''
              .concat(TN, '/')
              .concat(
                XD() ? 'zh-cn' : 'en',
                '/tutorial-21-advanced-auto-play-policy.html',
              ),
            fP = "<br><a href='"
              .concat(mP, "' target='_blank'>")
              .concat(XD() ? '其他方案？' : 'Any other solution?', '</a>'),
            gP = ''.concat(
              XD()
                ? '浏览器自动播放策略：在用户与页面产生交互（点击、触摸）之前，浏览器禁止播放有声媒体。该弹窗用于帮助用户恢复音视频播放。'.concat(
                    fP,
                  )
                : 'Autoplay Policy: Before user interacts with the web page (clicking, touching), page will not be allowed to play media with sound. This Dialog is used to help users resume playback. '.concat(
                    fP,
                  ),
            ),
            TP = class {
              constructor() {
                if (
                  (ob(
                    this,
                    'content',
                    '音视频播放被浏览器拦截，请点击“恢复播放”。',
                  ),
                  ob(this, '_dialogNode', null),
                  ob(this, '_bodyPosition', ''),
                  ob(this, '_showDetail', !1),
                  ob(this, '_isCollapseClicked', !1),
                  ob(this, '_isQuestionClicked', !1),
                  XD() ||
                    (this.content =
                      'Media playback failed. Click the "Resume" to resume playback.'),
                  !pP)
                ) {
                  let e = document.createElement('style');
                  (e.innerHTML = '.'
                    .concat(
                      Zw,
                      '{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center;background:rgba(0,0,0,0.5);z-index:1500;}.',
                    )
                    .concat(Zw, ' div:not(.')
                    .concat(nP, '){display:block !important;}.')
                    .concat(
                      eP,
                      '{padding:14px;background:#fff;border-radius:3px;box-shadow:0px 3px 15px #434343;border:1px solid #d1cfcf;max-width:500px;}.',
                    )
                    .concat(eP, ' a{color:')
                    .concat(cP, ';}.')
                    .concat(
                      tP,
                      '{overflow:hidden;text-overflow:ellipsis;font-size:16px;font-weight:600;}.',
                    )
                    .concat(iP, '{margin:8px 0;}.')
                    .concat(
                      nP,
                      '{width:100%;display:flex !important;align-items:center;justify-content:right;float:right;}.',
                    )
                    .concat(oP, '{margin-right:auto;cursor:pointer}.')
                    .concat(
                      rP,
                      '{height:100%;line-height:16px;cursor:pointer;}.',
                    )
                    .concat(sP, '{margin-left:8px;color:#fff;background:')
                    .concat(
                      cP,
                      ';padding:4px 12px;outline:none;border:1px solid;border-radius:3px;font-weight:bold;}.',
                    )
                    .concat(sP, ':hover{opacity:0.9;}.')
                    .concat(oP, ',.')
                    .concat(sP, ',.')
                    .concat(iP, ',.')
                    .concat(
                      rP,
                      '{font-size:14px;}@media screen and (max-width:750px){.',
                    )
                    .concat(eP, '{width:80vw;}}')),
                    document.head.appendChild(e),
                    (pP = !0);
                }
                this.addDiaLog();
              }
              createDiaLog() {
                let e = document.createElement('template');
                e.innerHTML = '<div class="'
                  .concat(Zw, '"><div class=\'')
                  .concat(eP, "'><div class='")
                  .concat(tP, "'>")
                  .concat(location.host, "</div><div class='")
                  .concat(iP, "'>")
                  .concat(this.content, "</div><div class='")
                  .concat(
                    aP,
                    '\' style="visibility:hidden;width:100%;height:0;font-size:12px;color:gray;">',
                  )
                  .concat(gP, "</div><div class='")
                  .concat(nP, "'></div></div></div>")
                  .trim();
                let t = document.createElement('button');
                (t.className = sP),
                  (t.innerText = XD() ? '恢复播放' : 'Resume'),
                  (t.onclick = this.onConfirm.bind(this));
                let i = document.createElement('div');
                (i.className = rP),
                  (i.innerHTML =
                    '<?xml version="1.0" encoding="UTF-8"?>\n    <svg class="icon" width="18" height="18" p-id="2030" t="1639646523624" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">\n    <path d="m464 784.35c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z" p-id="2031"/>\n    <path d="m512 960c-247.04 0-448-200.96-448-448s200.96-448 448-448 448 200.96 448 448-200.96 448-448 448zm0-831.71c-211.58 0-383.71 172.13-383.71 383.71 0 211.55 172.13 383.71 383.71 383.71 211.55 0 383.71-172.16 383.71-383.71 0-211.58-172.16-383.71-383.71-383.71z" p-id="2032"/>\n    <path d="m512 673.7c-17.665 0-32.001-14.336-32.001-31.999v-54.112c0-52.353 40-92.352 75.328-127.65 25.887-25.92 52.672-52.672 52.672-74.017 0-53.343-43.072-96.735-95.999-96.735-53.823 0-95.999 41.536-95.999 94.559 0 17.665-14.336 31.999-32.001 31.999s-32.001-14.336-32.001-31.999c0-87.424 71.775-158.56 160-158.56s160 72.095 160 160.74c0 47.904-36.32 84.192-71.424 119.3-27.84 27.776-56.576 56.512-56.576 82.336v54.112c0 17.665-14.336 32.032-32.001 32.032z" p-id="2033"/>\n    </svg>\n    '),
                  (i.onclick = this.onQuestionClick.bind(this));
                let n = document.createElement('div');
                (n.className = oP),
                  (n.innerText = ''.concat(XD() ? '详情 >' : 'Detail >')),
                  (n.onclick = this.onCollapseClick.bind(this));
                let r = e.content.firstChild,
                  o = r.querySelector('.'.concat(nP));
                return o.appendChild(n), o.appendChild(i), o.appendChild(t), r;
              }
              addDiaLog() {
                _P() ||
                  ((this._dialogNode = this.createDiaLog()),
                  document.body.appendChild(this._dialogNode),
                  (this._dialogNode.onclick = this.onConfirm.bind(this)),
                  (this._dialogNode.querySelector('.'.concat(eP)).onclick = (
                    e,
                  ) => e.stopPropagation()),
                  (this._bodyPosition = document.body.style.position),
                  (document.body.style.position = 'fixed'),
                  jO.info('show autoplay dialog'),
                  Xw.uploadEvent({ log: dP }));
              }
              deleteDiaLog() {
                this._dialogNode &&
                  (document.body.removeChild(this._dialogNode),
                  (document.body.style.position = this._bodyPosition),
                  (this._dialogNode = null));
              }
              onConfirm() {
                jO.warn('confirm clicked, try resume stream'),
                  UO.emit(BO.AUTOPLAY_DIALOG_CLICK_CONFIRM),
                  this.deleteDiaLog();
              }
              onCollapseClick() {
                let e = this._dialogNode.querySelector('.'.concat(aP));
                (e.style.visibility = ''.concat(
                  this._showDetail ? 'hidden' : 'visible',
                )),
                  (e.style.height = ''.concat(
                    this._showDetail ? 0 : 'fit-content',
                  )),
                  (this._showDetail = !this._showDetail),
                  this._isCollapseClicked || Xw.uploadEvent({ log: uP }),
                  (this._isCollapseClicked = !0);
              }
              onQuestionClick() {
                window.open(mP, '_blank'),
                  this._isQuestionClicked || Xw.uploadEvent({ log: hP }),
                  (this._isQuestionClicked = !0);
              }
            },
            EP = {};
          ib(EP, { create: () => IP, remove: () => vP });
          var SP = new WeakMap();
          function IP(e, t) {
            SP.has(e) || SP.set(e, []);
            let i = SP.get(e),
              n = {
                add: (e, r) => (
                  'addEventListener' in t
                    ? (i.push(t.removeEventListener.bind(t, e, r)),
                      t.addEventListener(e, r))
                    : (i.push(t.off.bind(t, e, r)), t.on(e, r)),
                  n
                ),
              };
            return n;
          }
          function vP(e) {
            let t = SP.get(e);
            t && (t.forEach((e) => e()), SP.delete(e));
          }
          var yP = class extends Ww {
            constructor(e, t) {
              super(e.id, ''.concat(t, '-player')),
                (this.kind = t),
                ob(this, 'id'),
                ob(this, 'element', null),
                ob(this, 'container', null),
                ob(this, 'mediaStream', new MediaStream()),
                ob(this, 'track'),
                ob(this, 'url'),
                ob(this, 'attr'),
                ob(this, 'muted'),
                ob(this, '_log'),
                ob(this, '_pausedRetryCount'),
                ob(this, '_isElementPlayingFired', !1),
                ob(this, '_interval'),
                (this.id = e.id),
                (this._log = e.log),
                (this.track = e.track),
                (this.container = e.container),
                (this.muted = e.muted),
                (this._pausedRetryCount = AD),
                (this._state = 'STOPPED'),
                this.bindTrackEvents();
            }
            get isPlaying() {
              return 'PLAYING' === this._state;
            }
            get isStopped() {
              return 'STOPPED' === this._state;
            }
            setAttr(e) {
              this.attr = e;
            }
            setTrack(e) {
              if (
                e !== this.track &&
                (this.unbindTrackEvents(),
                (this.track = e),
                this.emit(Qw.MEDIA_TRACK_CHANGED, e),
                null !== e && (this.bindTrackEvents(), this.element))
              ) {
                let t = new MediaStream();
                t.addTrack(e), (this.element.srcObject = t);
              }
            }
            setUrl(e) {
              this.track &&
                (this.unbindTrackEvents(),
                this.element && (this.element.srcObject = null),
                (this.track = null)),
                e !== this.url &&
                  ((this.url = e),
                  null !== e &&
                    this.element &&
                    ((this.element.crossOrigin = 'anonymous'),
                    (this.element.src = e)));
            }
            setContainer(e) {
              (this.container = e),
                this.track &&
                  this.element &&
                  this.container &&
                  this.container.appendChild(this.element);
            }
            play() {
              return ab(this, null, function* () {
                if (
                  (this.element &&
                    this.element.parentElement !== this.container &&
                    this.container &&
                    this.container.append(this.element),
                  !this.isPlaying)
                )
                  try {
                    this.bindAutoPlayEvent(), yield this.element.play();
                  } catch (sN) {
                    let t = QO({
                      key: KO.PLAY_FAILED,
                      data: { media: this.kind, error: sN },
                    });
                    if (
                      (this.track && !this.track.muted && this._log.warn(sN),
                      t.includes('NotAllowedError'))
                    )
                      throw new gb({ code: mb.PLAY_NOT_ALLOWED, message: t });
                  }
              });
            }
            stop() {
              this.unbindEvents(),
                (this._isElementPlayingFired = !1),
                this.element &&
                  (this.container && this.container.removeChild(this.element),
                  (this.element.srcObject = null),
                  (this.element = null)),
                this.handleStopped(LN.ENDED),
                this._interval > 0 && qw.clearTask(this._interval);
            }
            pause() {
              var e;
              this.isPlaying && (null == (e = this.element) || e.pause());
            }
            resume() {
              return this.isPlaying
                ? Promise.resolve()
                : Jk
                ? this.replay()
                : this.play().catch(() => {});
            }
            setMuted(e) {
              this.element && (this.element.muted = e), (this.muted = e);
            }
            setRect(e, t) {
              this.element &&
                ((this.element.style.width = ''.concat(e, 'px')),
                (this.element.style.height = ''.concat(t, 'px')));
            }
            replay() {
              return this.stop(), this.play().catch(() => {});
            }
            bindElementEvents() {
              if (this.element) {
                let e = this.handleElementEvent.bind(this);
                return IP(this.element, this.element)
                  .add(LN.PLAYING, e)
                  .add(LN.ENDED, e)
                  .add(LN.PAUSE, e)
                  .add(LN.ERROR, e)
                  .add(LN.LOADEDDATA, e);
              }
            }
            bindTrackEvents() {
              if (this.track) {
                let e = this.handleTrackEvent.bind(this);
                null == EP ||
                  EP.create(this.track, this.track)
                    .add(LN.ENDED, e)
                    .add(LN.MUTE, e)
                    .add(LN.UNMUTE, e),
                  this.track.readyState === LN.ENDED &&
                    this.handleTrackEvent({ type: LN.ENDED }),
                  this.track.muted && this.handleTrackEvent({ type: LN.MUTE });
              }
            }
            bindAutoPlayEvent() {
              UO.on(BO.AUTOPLAY_DIALOG_CLICK_CONFIRM, this.resume, this);
            }
            unbindTrackEvents() {
              this.track && vP(this.track);
            }
            unbindEvents() {
              this.element && vP(this.element),
                this.unbindTrackEvents(),
                UO.off(BO.AUTOPLAY_DIALOG_CLICK_CONFIRM, this.resume, this);
            }
            handleElementEvent(e) {
              var t;
              switch (e.type) {
                case LN.PLAYING:
                  (this._isElementPlayingFired = !0),
                    this._log.info(''.concat(this.kind, ' player is playing')),
                    this.handlePlaying(LN.PLAYING),
                    this._interval &&
                      (qw.clearTask(this._interval), (this._interval = -1));
                  break;
                case LN.ENDED:
                  this._log.info(''.concat(this.kind, ' player is ended')),
                    this.handleStopped(LN.ENDED);
                  break;
                case LN.PAUSE:
                  this._log.info(''.concat(this.kind, ' player is paused')),
                    this.handlePaused(LN.PAUSE);
                  let e =
                    this.container &&
                    document.getElementById(this.container.id);
                  e ||
                    this._log.warn(
                      ''
                        .concat(
                          this.kind,
                          ' player has been remove, element ID: ',
                        )
                        .concat(null == (t = this.container) ? void 0 : t.id),
                    );
                  let i = wk();
                  this._pausedRetryCount > 0 &&
                    ((this.kind === LN.VIDEO && !_P()) ||
                      (this.kind === LN.AUDIO && ((oO(i) && i <= 70) || !e))) &&
                    (this._log.info(
                      ''.concat(this.kind, ' player auto resume when paused'),
                    ),
                    this.resume(),
                    this._pausedRetryCount--),
                    Pb &&
                      (this._interval = qw.run(
                        MD,
                        () => {
                          this.element &&
                            'PAUSED' === this._state &&
                            this.resume();
                        },
                        { delay: 3e3 },
                      ));
                  break;
                case LN.ERROR:
                  if (this.element && this.element.error) {
                    let { code: e, message: t } = this.element.error;
                    this._log.error(
                      ''
                        .concat(this.kind, ' player error observed. code: ')
                        .concat(e, ' message: ')
                        .concat(t, ' userAgent: ')
                        .concat(navigator.userAgent),
                    ),
                      Xw.uploadEvent({
                        log: 'stat-'
                          .concat(this.kind, '-')
                          .concat(cD.PLAYER_ERROR, '-')
                          .concat(e, '-')
                          .concat(navigator.userAgent),
                        error: this.element.error,
                      });
                  }
                  break;
                case LN.LOADEDDATA:
                  this.kind === LN.VIDEO && this.emit(Qw.LOADED_DATA);
              }
            }
            handleTrackEvent(e) {
              switch (e.type) {
                case LN.ENDED:
                  this._log.info(''.concat(this.kind, ' track is ended')),
                    this.handleStopped(LN.ENDED);
                  break;
                case LN.MUTE:
                  this._log.info(
                    ''.concat(
                      this.kind,
                      ' track is unable to provide media output',
                    ),
                  ),
                    this.handlePaused(LN.MUTE);
                  break;
                case LN.UNMUTE:
                  this._log.info(
                    ''.concat(
                      this.kind,
                      ' track is able to provide media output',
                    ),
                  ),
                    this._isElementPlayingFired &&
                      this.handlePlaying(LN.UNMUTE);
              }
            }
            handlePlaying(e) {
              this.emit(Qw.PLAYER_STATE_CHANGED, {
                type: this.kind,
                state: 'PLAYING',
                reason: e,
              });
            }
            handlePaused(e) {
              this.emit(Qw.PLAYER_STATE_CHANGED, {
                type: this.kind,
                state: 'PAUSED',
                reason: e,
              });
            }
            handleStopped(e) {
              this.emit(Qw.PLAYER_STATE_CHANGED, {
                type: this.kind,
                state: 'STOPPED',
                reason: e,
              });
            }
            getElement() {
              return this.element;
            }
          };
          rb([Hw([], 'PLAYING')], yP.prototype, 'handlePlaying', 1),
            rb(
              [Hw('PLAYING', 'PAUSED', { ignoreError: !0 })],
              yP.prototype,
              'handlePaused',
              1,
            ),
            rb([Hw([], 'STOPPED')], yP.prototype, 'handleStopped', 1);
          var AP = class extends yP {
              constructor(e) {
                super(e, LN.VIDEO),
                  ob(this, 'mirror'),
                  ob(this, 'objectFit'),
                  nO(e.mirror) || (this.mirror = e.mirror),
                  nO(e.objectFit) || (this.objectFit = e.objectFit);
              }
              initializeElement() {
                var e;
                let t = document.createElement(LN.VIDEO);
                if (this.track) {
                  let e = new MediaStream();
                  e.addTrack(this.track), (t.srcObject = e);
                }
                t.muted = !0;
                let i = 'width: 100%; height: 100%; object-fit: '.concat(
                  this.objectFit,
                  ';background-color: black;',
                );
                this.mirror && (i += 'transform: scaleX(-1);'),
                  t.setAttribute('id', 'video_'.concat(this.id)),
                  t.setAttribute('style', i),
                  t.setAttribute('autoplay', 'autoplay'),
                  t.setAttribute('playsinline', 'playsinline'),
                  null == (e = this.container) || e.appendChild(t),
                  (this.element = t),
                  this.bindElementEvents();
              }
              bindElementEvents() {
                let e = super.bindElementEvents();
                (this.handleElementEvent = this.handleElementEvent.bind(this)),
                  e &&
                    e
                      .add(LN.ENTER_PICTURE_IN_PICTURE, this.handleElementEvent)
                      .add(
                        LN.LEAVE_PICTURE_IN_PICTURE,
                        this.handleElementEvent,
                      );
              }
              handleElementEvent(e) {
                super.handleElementEvent(e);
                let t = e.type;
                if (this.mirror && this.element) {
                  let e = this.element.style.transform;
                  t === LN.ENTER_PICTURE_IN_PICTURE
                    ? (this.element.style.transform = e.replace(
                        'scaleX(-1)',
                        '',
                      ))
                    : t === LN.LEAVE_PICTURE_IN_PICTURE &&
                      !e.includes('scaleX') &&
                      (this.element.style.transform = ''.concat(
                        e,
                        ' scaleX(-1)',
                      ));
                }
              }
              setAttr(e) {
                let t = Object.assign(
                  {
                    autoplay: 'autoplay',
                    playsinline: 'playsinline',
                    muted: !0,
                  },
                  e,
                );
                (t.style = Object.assign(
                  { width: '100%', height: '100%' },
                  t.style,
                )),
                  super.setAttr(t);
              }
              setMirror(e) {
                this.element &&
                  (this.element.style.transform = e ? 'scaleX(-1)' : ''),
                  (this.mirror = e);
              }
              setObjectFit(e) {
                this.element && (this.element.style.objectFit = ''.concat(e)),
                  (this.objectFit = e);
              }
              play() {
                return this.element || this.initializeElement(), super.play();
              }
              getVideoFrame() {
                if (!this.element) return '';
                let e = document.createElement('canvas');
                return (
                  (e.width = this.element.videoWidth),
                  (e.height = this.element.videoHeight),
                  e.getContext('2d').drawImage(this.element, 0, 0),
                  e.toDataURL('image/png')
                );
              }
              getElement() {
                return this.element;
              }
            },
            RP = !1,
            CP = class {
              constructor(e) {
                ob(this, 'context_'),
                  ob(this, 'blob_'),
                  (this.context_ = e.context),
                  (this.blob_ = new Blob(
                    [
                      'class VolumeMeter extends AudioWorkletProcessor{constructor(){super(),this.volume=0,this.intervalTime=200,this.tick=this.intervalTime,this.isStop=!1,this.port.onmessage=t=>{let{data:e}=t;switch(e.name){case"setIntervalTime":this.intervalTime=e.intervalTime;break;case"stop":this.isStop=!0}}}process(t){let e=t[0];if(this.isStop)return!1;if(e.length>0){let i=e[0],s=0;for(let l=0;l<i.length;++l)s=Math.max(Math.abs(i[l]),s);this.volume=s,this.tick-=i.length,this.tick<0&&(this.tick+=this.intervalTime/1e3*sampleRate,this.port.postMessage({volume:this.volume}))}return!0}}registerProcessor("volume-meter",VolumeMeter);',
                    ],
                    { type: 'application/javascript' },
                  )),
                  this.addModuleToContext();
              }
              addModuleToContext() {
                return ab(this, null, function* () {
                  try {
                    yield this.context_.audioWorklet.addModule(
                      URL.createObjectURL(this.blob_),
                    ),
                      jO.info('worklet addModule success'),
                      UO.emit(BO.WORKLET_LOADED_SUCCESS),
                      (RP = !0);
                  } catch (YL) {
                    jO.info(
                      'worklet addModule catch error. '.concat(YL.message),
                    ),
                      UO.emit(BO.WORKLET_LOADED_FAILED);
                  }
                });
              }
              get initWorkletSuccess() {
                return RP;
              }
            };
          'undefined' != typeof window &&
            (window.AudioContext =
              window.AudioContext ||
              window.webkitAudioContext ||
              window.mozAudioContext);
          var bP,
            kP,
            NP = 0,
            DP = (e, t) => {
              let i = new window.AudioContext(t),
                n = ++NP,
                r = () => {
                  'suspended' === i.state
                    ? (i.resume(), document.addEventListener('click', r))
                    : 'interrupted' === i.state
                    ? i.resume()
                    : document.removeEventListener('click', r);
                };
              return (
                document.addEventListener('click', r),
                (i.onstatechange = () => {
                  jO.info(
                    ''
                      .concat(e, '-')
                      .concat(n, ' context state: ')
                      .concat(i.state),
                  ),
                    r();
                }),
                i
              );
            },
            OP = 0,
            wP = class {
              constructor(e) {
                ob(this, '_volume'),
                  ob(this, '_log'),
                  ob(this, '_track'),
                  ob(this, '_stream'),
                  ob(this, '_audioCtx'),
                  ob(this, '_destination'),
                  ob(this, '_streamSource'),
                  ob(this, '_scriptProcessorNode'),
                  ob(this, '_audioWorkletNode'),
                  ob(this, '_interval');
                let { track: t, log: i } = e;
                (this._volume = 0),
                  (this._log = i),
                  (this._track = t),
                  bP || (bP = DP('volume-meter')),
                  (this._audioCtx = bP),
                  (this._destination = this._audioCtx.destination);
                let n = new MediaStream();
                n.addTrack(this._track),
                  (this._streamSource =
                    this._audioCtx.createMediaStreamSource(n)),
                  (this._audioWorkletNode = null),
                  (this._scriptProcessorNode = null),
                  (this._interval = 200),
                  UO.on(
                    BO.AUDIO_LEVEL_INTERVAL,
                    this.handleAudioLevelInterval,
                    this,
                  ),
                  _O
                    ? (UO.on(
                        BO.WORKLET_LOADED_SUCCESS,
                        this.initAudioWorklet,
                        this,
                      ),
                      UO.on(
                        BO.WORKLET_LOADED_FAILED,
                        this.initScriptProcessor,
                        this,
                      ),
                      this.preload())
                    : this.initScriptProcessor(),
                  (OP += 1);
              }
              preload() {
                kP
                  ? kP.initWorkletSuccess && this.initAudioWorklet()
                  : (kP = new CP({ context: bP }));
              }
              initAudioWorklet() {
                if (!this._audioWorkletNode)
                  try {
                    (this._audioWorkletNode = new AudioWorkletNode(
                      this._audioCtx,
                      'volume-meter',
                    )),
                      (this._audioWorkletNode.port.onmessage = (e) => {
                        this._volume = e.data.volume || 0;
                      }),
                      this._streamSource
                        .connect(this._audioWorkletNode)
                        .connect(this._destination),
                      this.handleAudioLevelInterval({
                        interval: this._interval,
                      });
                  } catch (YL) {
                    Xw.logFailedEvent({
                      userId: this._log.userId,
                      eventType: cD.LOAD_WORKLET,
                      error: YL,
                    }),
                      this.initScriptProcessor();
                  }
              }
              initScriptProcessor() {
                if (!this._scriptProcessorNode)
                  try {
                    (this._scriptProcessorNode =
                      this._audioCtx.createScriptProcessor(2048, 1, 1)),
                      (this._scriptProcessorNode.onaudioprocess = (e) => {
                        let t = e.inputBuffer.getChannelData(0),
                          i = 0;
                        for (let n = 0; n < t.length; ++n) i += t[n] * t[n];
                        this._volume = Math.sqrt(i / t.length) || 0;
                      }),
                      this._streamSource.connect(this._scriptProcessorNode),
                      this._scriptProcessorNode.connect(this._destination);
                  } catch (YL) {
                    this._log.error(
                      'volumeMeter init script processor error: '.concat(YL),
                    );
                  }
              }
              destroy() {
                this._streamSource && this._streamSource.disconnect(),
                  this._scriptProcessorNode &&
                    ((this._scriptProcessorNode.onaudioprocess = null),
                    this._scriptProcessorNode.disconnect()),
                  this._audioWorkletNode &&
                    (this._audioWorkletNode.port.postMessage({ name: 'stop' }),
                    (this._audioWorkletNode.port.onmessage = null),
                    this._audioWorkletNode.disconnect()),
                  (this._audioWorkletNode = null),
                  (this._scriptProcessorNode = null),
                  (this._audioCtx = null),
                  UO.off(
                    BO.AUDIO_LEVEL_INTERVAL,
                    this.handleAudioLevelInterval,
                    this,
                  ),
                  UO.off(
                    BO.WORKLET_LOADED_SUCCESS,
                    this.initAudioWorklet,
                    this,
                  ),
                  UO.off(
                    BO.WORKLET_LOADED_FAILED,
                    this.initScriptProcessor,
                    this,
                  ),
                  OP > 0 && (OP -= 1),
                  0 === OP &&
                    (null == bP || bP.close(), (bP = null), (kP = null));
              }
              resume() {
                null == bP || bP.resume();
              }
              setTrack(e) {
                if (this._audioCtx && this._audioWorkletNode) {
                  if (!e) return this._streamSource.disconnect();
                  (this._track = e),
                    this._streamSource.disconnect(),
                    (this._streamSource =
                      this._audioCtx.createMediaStreamSource(
                        new MediaStream([e]),
                      )),
                    this._streamSource.connect(this._audioWorkletNode);
                }
              }
              getInternalAudioLevel() {
                return this._volume;
              }
              getCalculatedVolume() {
                return parseFloat(this._volume.toFixed(2));
              }
              handleAudioLevelInterval(e) {
                var t;
                let { interval: i } = e;
                (this._interval = i),
                  null == (t = this._audioWorkletNode) ||
                    t.port.postMessage({
                      name: 'setIntervalTime',
                      intervalTime: i,
                    });
              }
            },
            PP = null,
            LP = 0,
            MP = class extends yP {
              constructor(e) {
                super(e, LN.AUDIO),
                  ob(this, '_volumeMeter'),
                  ob(this, '_gainedTrack', null),
                  ob(this, '_gainNode', null),
                  ob(this, '_destination', null),
                  ob(this, '_mediaStreamSource', null),
                  ob(this, '_sourceElement', null),
                  ob(this, '_outputDeviceId'),
                  ob(this, '_volume', 1),
                  ob(this, '_loop', !1),
                  (this._outputDeviceId = e.outputDeviceId),
                  this.track && this.initVolumeMeter(this.track);
              }
              setTrack(e) {
                this.track !== e &&
                  (this._volumeMeter
                    ? this._volumeMeter.setTrack(e)
                    : e && this.initVolumeMeter(e)),
                  super.setTrack(e);
              }
              initVolumeMeter(e) {
                this._volumeMeter = new wP({
                  track: this._gainedTrack || e,
                  log: this._log,
                });
              }
              initializeElement() {
                if (
                  ('15.2' === jk || '15.3' === jk || '15.4' === jk) &&
                  this.muted
                )
                  return void this._log.info('audioElement is muted.');
                let e = document.createElement(LN.AUDIO);
                this.track &&
                  (e.srcObject = new MediaStream([
                    this._gainedTrack || this.track,
                  ])),
                  (e.muted = this.muted),
                  e.setAttribute('id', 'audio_'.concat(this.id)),
                  e.setAttribute('autoplay', 'autoplay'),
                  e.setAttribute('playsinline', 'playsinline'),
                  (this.element = e),
                  this.bindElementEvents();
              }
              play() {
                return ab(this, null, function* () {
                  this.element || this.initializeElement(),
                    this._outputDeviceId &&
                      (yield this.setSinkId(this._outputDeviceId)),
                    !this._volumeMeter &&
                      this.track &&
                      this.initVolumeMeter(this.track),
                    this.setVolume(this._volume),
                    yield sb(MP.prototype, this, 'play').call(this);
                });
              }
              stop() {
                this._volumeMeter &&
                  (this._volumeMeter.destroy(), (this._volumeMeter = null)),
                  this.destroyGain(),
                  super.stop();
              }
              resume() {
                return ab(this, null, function* () {
                  yield sb(MP.prototype, this, 'resume').call(this),
                    this._volumeMeter && this._volumeMeter.resume();
                });
              }
              setSinkId(e) {
                return ab(this, null, function* () {
                  this._outputDeviceId !== e &&
                    (this.element && (yield this.element.setSinkId(e)),
                    (this._outputDeviceId = e));
                });
              }
              setVolume(e) {
                (this._volume = e),
                  this._gainNode
                    ? (this._gainNode.gain.value = e)
                    : e > 1
                    ? this.createGain(e)
                    : this.element && (this.element.volume = e);
              }
              createGain(e) {
                PP || (PP = DP('player')),
                  this._log.info('create gainNode '.concat(e));
                let t = PP.createMediaStreamSource(
                    new MediaStream([this.track]),
                  ),
                  i = PP.createGain(),
                  n = PP.createMediaStreamDestination();
                t.connect(i),
                  i.connect(n),
                  (i.gain.value = e),
                  (this._gainNode = i),
                  (this._destination = n),
                  (this._mediaStreamSource = t),
                  (this._gainedTrack = n.stream.getAudioTracks()[0]),
                  (LP += 1),
                  this.element &&
                    (vP(this.element),
                    (this._sourceElement = this.element),
                    (this.element.muted = !0),
                    (this.element = null)),
                  this.play();
              }
              destroyGain() {
                var e, t, i;
                !this._gainNode ||
                  (this._log.info('destroy gainNode'),
                  null == (e = this._gainNode) || e.disconnect(),
                  null == (t = this._destination) || t.disconnect(),
                  null == (i = this._mediaStreamSource) || i.disconnect(),
                  (this._gainNode = null),
                  (this._destination = null),
                  (this._mediaStreamSource = null),
                  this._sourceElement &&
                    ((this._sourceElement.srcObject = null),
                    (this._sourceElement = null)),
                  (this._gainedTrack = null),
                  0 === (LP -= 1) &&
                    PP &&
                    (this._log.info('destroy gain audioContext'),
                    PP.close(),
                    (PP = null)));
              }
              setLoop(e) {
                !this.element || ((this.element.loop = e), (this._loop = e));
              }
              getAudioLevel() {
                var e;
                return (
                  (null == (e = this._volumeMeter)
                    ? void 0
                    : e.getCalculatedVolume()) || 0
                );
              }
              getInternalAudioLevel() {
                var e;
                return null == (e = this._volumeMeter)
                  ? void 0
                  : e.getInternalAudioLevel();
              }
            },
            VP = class extends Ww {
              constructor(e) {
                let {
                  userId: t,
                  sdkAppId: i,
                  mediaType: n,
                  room: r,
                  isInitPlayer: o = !0,
                } = e;
                var s;
                super(),
                  ob(this, 'id', GO()),
                  ob(this, 'userId', ''),
                  ob(this, 'isRemote'),
                  ob(this, 'mediaType'),
                  ob(this, 'room'),
                  ob(this, 'user'),
                  ob(this, '_log'),
                  ob(this, '_inputTrack'),
                  ob(this, '_outputTrack'),
                  ob(this, 'isPlayCalled'),
                  ob(this, 'container', null),
                  ob(this, 'player'),
                  ob(this, 'subVideoPlayerMap'),
                  ob(this, 'playerMuted', !1),
                  ob(this, 'abortCtrl'),
                  ob(this, 'audioOutputDeviceId'),
                  ob(this, 'playbackVolume', 1),
                  ob(this, 'objectFit', 'cover'),
                  ob(this, 'mirror', !1),
                  ob(this, 'isScreen', !1),
                  ob(this, 'manager'),
                  nO(t) || (this.userId = t),
                  (this.mediaType = n),
                  (this._log = jO.createLogger({
                    id: ''.concat(this.kind[0], 't'),
                    userId: null == (s = r || this.room) ? void 0 : s.userId,
                    remoteUserId: this instanceof lL ? void 0 : this.userId,
                    sdkAppId: i,
                    type: 2 === this.mediaType ? 'auxiliary' : 'main',
                    isLocal: this instanceof lL,
                  })),
                  o && this.initPlayer();
              }
              get log() {
                return this._log || jO;
              }
              get kind() {
                return 1 === this.mediaType ? LN.AUDIO : LN.VIDEO;
              }
              get muted() {
                return !(!this.outMediaTrack || this.outMediaTrack.enabled);
              }
              get strMediaType() {
                return 4 === this.mediaType
                  ? LN.VIDEO
                  : 2 === this.mediaType
                  ? LN.SCREEN
                  : LN.AUDIO;
              }
              get streamType() {
                return 0 == (2 & this.mediaType) ? 'main' : 'auxiliary';
              }
              play(e, t) {
                return ab(this, null, function* () {
                  let i = cO(e) ? e[0] : e;
                  if (this.isPlayCalled)
                    return (
                      this.log.info(
                        'play update options: '.concat(JSON.stringify(t)),
                      ),
                      t && !nO(t.muted) && this.setPlayerMute(t.muted),
                      t && !nO(t.objectFit) && (this.objectFit = t.objectFit),
                      this.isScreen
                        ? (this.mirror = !1)
                        : t && !nO(t.mirror) && (this.mirror = t.mirror),
                      void (
                        this.kind === LN.VIDEO &&
                        (this.player.setObjectFit(this.objectFit),
                        this.player.setMirror(this.mirror),
                        this.container !== i &&
                          i &&
                          ((this.container = i), this.player.setContainer(i)),
                        cO(e) &&
                          e.length >= 1 &&
                          (yield this.playSubContainer(e.slice(1), t)))
                      )
                    );
                  if (
                    (t && !nO(t.muted)
                      ? this.setPlayerMute(t.muted)
                      : (!this.isRemote || this.kind === LN.VIDEO) &&
                        this.setPlayerMute(!0),
                    t && !nO(t.objectFit) && (this.objectFit = t.objectFit),
                    this.isRemote || (this.mirror = !0),
                    this.isScreen
                      ? (this.mirror = !1)
                      : t && !nO(t.mirror) && (this.mirror = t.mirror),
                    this.kind === LN.VIDEO &&
                      (this.player.setObjectFit(this.objectFit),
                      this.player.setMirror(this.mirror)),
                    (this.isPlayCalled = !0),
                    i && ((this.container = i), this.player.setContainer(i)),
                    UO.emit(BO.PLAY_TRACK_START, { track: this }),
                    this._outputTrack)
                  ) {
                    this._log.info(
                      'play with options: '.concat(JSON.stringify(t)),
                    );
                    try {
                      this.player.setTrack(this._outputTrack),
                        yield this.player.play(),
                        cO(e) &&
                          e.length > 1 &&
                          (yield this.playSubContainer(e.slice(1), t));
                    } catch (n) {
                      throw (
                        (this.handleAutoPlayFailed(), this.emit('error', n), n)
                      );
                    }
                  } else this.log.info('play has not mediaTrack, abort');
                });
              }
              playSubContainer(e, t) {
                return ab(this, null, function* () {
                  if (!this._outputTrack || this.kind === LN.AUDIO) return;
                  this.subVideoPlayerMap ||
                    (this.subVideoPlayerMap = new Map()),
                    this.subVideoPlayerMap.forEach((t, i) => {
                      var n;
                      e.find((e) => i === e) ||
                        (t.stop(),
                        t.setContainer(null),
                        null == (n = this.subVideoPlayerMap) || n.delete(i));
                    });
                  for (let [n, r] of e.entries()) {
                    let e = this.subVideoPlayerMap.get(r);
                    e
                      ? t &&
                        (nO(t.mirror) || e.setMirror(t.mirror),
                        nO(t.objectFit) || e.setObjectFit(t.objectFit))
                      : this.subVideoPlayerMap.set(
                          r,
                          new AP({
                            id: this.userId || this.id,
                            track: this.outMediaTrack,
                            container: r,
                            muted: this.playerMuted,
                            objectFit: this.objectFit,
                            mirror: this.mirror,
                            log: this.log.createChild({
                              id: 'vp-sub'.concat(n + 1),
                            }),
                          }),
                        );
                  }
                  let i = [...this.subVideoPlayerMap.values()];
                  for (let e of i) yield e.play();
                });
              }
              initPlayer() {
                this.log.info('create player'),
                  this.kind === LN.AUDIO
                    ? (this.player = new MP({
                        id: this.userId || this.id,
                        track: this.outMediaTrack,
                        container: this.container || null,
                        muted: this.playerMuted,
                        outputDeviceId: this.audioOutputDeviceId,
                        log: this.log,
                      }))
                    : ((this.player = new AP({
                        id: this.userId || this.id,
                        track: this.outMediaTrack,
                        container: this.container || null,
                        muted: this.playerMuted,
                        objectFit: this.objectFit,
                        mirror: this.mirror,
                        log: this.log,
                      })),
                      this.player.on(Qw.LOADED_DATA, () => {
                        UO.emit(BO.VIDEO_LOADED_DATA, { track: this });
                      }),
                      this.player.on(Qw.MEDIA_TRACK_CHANGED, (e) => {
                        var t;
                        null == (t = this.subVideoPlayerMap) ||
                          t.forEach((t) => t.setTrack(e));
                      })),
                  this.player.on(Qw.PLAYER_STATE_CHANGED, (e) => {
                    UO.emit(BO.PLAYER_STATE_CHANGED, ZC({ track: this }, e)),
                      this.emit('player-state-changed', e);
                  });
              }
              setAudioOutput(e) {
                return ab(this, null, function* () {
                  var t;
                  (this.audioOutputDeviceId = e),
                    yield null == (t = this.player) ? void 0 : t.setSinkId(e);
                });
              }
              setAudioVolume(e) {
                var t;
                (this.playbackVolume = e),
                  this.log.info('setAudioVolume to '.concat(e)),
                  null == (t = this.player) || t.setVolume(e);
              }
              getAudioLevel() {
                var e;
                return (
                  (null == (e = this.player) ? void 0 : e.getAudioLevel()) || 0
                );
              }
              getInternalAudioLevel() {
                var e;
                return (
                  (null == (e = this.player)
                    ? void 0
                    : e.getInternalAudioLevel()) || 0
                );
              }
              stop() {
                !this.isPlayCalled ||
                  ((this.isPlayCalled = !1),
                  this.player &&
                    (this.log.info('stop '.concat(this.kind, ' player')),
                    this.player.stop(),
                    this.player.setContainer(null)),
                  this.subVideoPlayerMap &&
                    this.subVideoPlayerMap.size > 0 &&
                    this.subVideoPlayerMap.forEach((e) => {
                      e.stop(), e.setContainer(null);
                    }),
                  (this.container = null));
              }
              resume() {
                return ab(this, null, function* () {
                  var e;
                  !this.isPlayCalled ||
                    (yield null == (e = this.player) ? void 0 : e.resume());
                });
              }
              close() {
                this.log.info('close'), this.isPlayCalled && this.stop();
              }
              setMute(e) {
                return (
                  !!this.outMediaTrack &&
                  ((this.outMediaTrack.enabled = !e),
                  this.emit(e ? 'mute' : 'unmute', this),
                  UO.emit(e ? BO.TRACK_MUTED : BO.TRACK_UNMUTED, {
                    track: this,
                  }),
                  !0)
                );
              }
              setPlayerMute(e) {
                (this.playerMuted = e), this.player.setMuted(e);
              }
              get mediaTrack() {
                return this._inputTrack || null;
              }
              get outMediaTrack() {
                return this._outputTrack || null;
              }
              setInputMediaStreamTrack(e) {
                let t = this._inputTrack;
                if (e !== t)
                  return (
                    (this._inputTrack = e),
                    this.emit(
                      'input-media-track-changed',
                      e || null,
                      t || null,
                    ),
                    this.manager
                      ? this.manager.changeInput(this, t)
                      : this.setOutputMediaStreamTrack(e)
                  );
              }
              setOutputMediaStreamTrack(e) {
                var t;
                e !== this._outputTrack &&
                  (this.isRemote
                    ? this.log.debug('setOutputMediaStreamTrack', e.label)
                    : this.log.info(
                        'setOutputMediaStreamTrack',
                        null == (t = e.getSettings)
                          ? void 0
                          : t.call(e).deviceId,
                        e.label,
                      ),
                  (this._outputTrack = e),
                  (e.enabled = !this.muted),
                  this.updatePlayingState(!!e),
                  this.emit('output-media-track-changed', e));
              }
              setMediaType(e) {
                this.mediaType = e;
              }
              updatePlayingState(e) {
                if (this.isPlayCalled)
                  if (e) {
                    if (
                      (this.player.setTrack(this.outMediaTrack),
                      this.player.isStopped)
                    )
                      return (
                        this.player
                          .play()
                          .catch(() => this.handleAutoPlayFailed()),
                        void this.log.info(
                          'playing state updated, play '.concat(this.kind),
                        )
                      );
                  } else if (!this.player.isStopped)
                    return (
                      this.player.stop(),
                      void this.log.info(
                        'playing state updated, stop '.concat(this.kind),
                      )
                    );
                this.log.debug(
                  'updatePlayingState abort '
                    .concat(this.isPlayCalled, ' ')
                    .concat(e, ' ')
                    .concat(this.player.isStopped),
                );
              }
              handleAutoPlayFailed() {
                if (this.room && this.room.enableAutoPlayDialog) new TP();
                else {
                  let e = () => {
                    this.resume().then(() => {
                      document.removeEventListener('click', e, !0),
                        document.removeEventListener('touchstart', e, !0);
                    });
                  };
                  document.addEventListener('click', e, !0),
                    document.addEventListener('touchstart', e, !0);
                }
              }
            };
          rb([Hw([], Ww.INIT)], VP.prototype, 'close', 1);
          var xP = Object.prototype.hasOwnProperty;
          var UP = function (e) {
              if (null == e) return !0;
              if ('boolean' == typeof e) return !1;
              if ('number' == typeof e) return 0 === e;
              if (
                'string' == typeof e ||
                'function' == typeof e ||
                Array.isArray(e)
              )
                return 0 === e.length;
              if (e instanceof Error) return '' === e.message;
              if ($D(e))
                switch (Object.prototype.toString.call(e)) {
                  case '[object File]':
                  case '[object Map]':
                  case '[object Set]':
                    return 0 === e.size;
                  case '[object Object]':
                    for (let t in e) if (xP.call(e, t)) return !1;
                    return !0;
                }
              return !1;
            },
            FP = nb(cb(), 1),
            BP = (e) => (t) => t.deviceId === e,
            HP = class {
              constructor(e) {
                let t =
                  arguments.length > 1 && void 0 !== arguments[1]
                    ? arguments[1]
                    : 'Input';
                ob(this, 'kind'),
                  ob(this, 'type'),
                  ob(this, 'devices', []),
                  (this.kind = e),
                  (this.type = t);
              }
              update(e, t) {
                let i = e.filter(
                  (e) =>
                    e.kind ===
                    ''.concat(this.kind).concat(this.type.toLocaleLowerCase()),
                );
                (1 === this.devices.length && WP(this.devices[0])) ||
                  (t &&
                    (i.forEach((e) => {
                      if (e.deviceId && !this.devices.find(BP(e.deviceId))) {
                        let i = ''.concat(this.kind).concat(this.type, 'Added');
                        jO.warn(''.concat(i, ': ').concat(JSON.stringify(e))),
                          t.emit(i, e);
                      }
                    }),
                    this.devices.forEach((e) => {
                      if (e.deviceId && !i.find(BP(e.deviceId))) {
                        let i = ''
                          .concat(this.kind)
                          .concat(this.type, 'Removed');
                        jO.warn(''.concat(i, ': ').concat(JSON.stringify(e))),
                          t.emit(i, e);
                      }
                    }))),
                  (this.devices = i);
              }
              hasDevice(e) {
                return !!this.devices.find((t) => t.deviceId === e);
              }
            },
            jP = class extends FP.EventEmitter {
              constructor() {
                super(),
                  ob(this, 'audioInputs', new HP(LN.AUDIO)),
                  ob(this, 'videoInputs', new HP(LN.VIDEO)),
                  ob(this, 'audioOutputs', new HP(LN.AUDIO, 'Output')),
                  this.init(),
                  navigator.mediaDevices &&
                    (navigator.mediaDevices.addEventListener &&
                      navigator.mediaDevices.addEventListener(
                        'devicechange',
                        () => this.update(),
                      ),
                    'ondevicechange' in navigator.mediaDevices ||
                      qw.run(
                        LD,
                        () => {
                          this.update();
                        },
                        { delay: 1e4 },
                      ));
              }
              init() {
                JP().then((e) => {
                  this.audioInputs.update(e),
                    this.videoInputs.update(e),
                    this.audioOutputs.update(e);
                });
              }
              update() {
                return ab(this, arguments, function () {
                  var e = this;
                  let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : 0;
                  return (function* () {
                    let i = yield JP(t);
                    return (
                      e.audioInputs.update(i, e),
                      e.videoInputs.update(i, e),
                      e.audioOutputs.update(i, e),
                      e
                    );
                  })();
                });
              }
            },
            GP = dN || lN ? null : new jP();
          function WP(e) {
            return e.deviceId === e.groupId && '' === e.groupId;
          }
          function JP() {
            return ab(this, arguments, function () {
              let e =
                arguments.length > 0 && void 0 !== arguments[0]
                  ? arguments[0]
                  : 0;
              return (function* () {
                if (rw() || !iw()) return [];
                let t = yield navigator.mediaDevices.enumerateDevices();
                if (0 !== e) {
                  let i = { audio: !1, video: !1 };
                  if (
                    (t.forEach((e) => {
                      WP(e) &&
                        (e.kind === LN.AUDIO_INPUT
                          ? (i.audio = !0)
                          : e.kind === LN.VIDEO_INPUT && (i.video = !0));
                    }),
                    2 === e && (i.audio = !1),
                    1 === e && (i.video = !1),
                    i.audio || i.video)
                  ) {
                    let e = yield navigator.mediaDevices.getUserMedia(i);
                    (t = yield navigator.mediaDevices.enumerateDevices()),
                      e.getTracks().forEach((e) => e.stop());
                  }
                }
                return t.map((e, t) => {
                  let i = {
                    kind: e.kind,
                    deviceId: e.deviceId,
                    groupId: e.groupId,
                    label: e.label || ''.concat(e.kind, '_').concat(t),
                  };
                  return (
                    e.deviceId.length > 0 &&
                      qP.add(''.concat(e.deviceId, '_').concat(e.kind)),
                    e.getCapabilities &&
                      (i.getCapabilities = () => e.getCapabilities()),
                    i
                  );
                });
              })();
            });
          }
          function KP() {
            let e =
              arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
            return GP.update(e ? 1 : 0).then((e) => e.audioInputs.devices);
          }
          function YP() {
            let e =
              arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
            return GP.update(e ? 2 : 0).then((e) => e.videoInputs.devices);
          }
          function zP() {
            let e =
              arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
            return ab(this, null, function* () {
              return GP.update(e ? 1 : 0).then((e) => e.audioOutputs.devices);
            });
          }
          var qP = new Set();
          function QP(e, t) {
            return ab(this, null, function* () {
              let i = (yield KP()).find((e) => e.deviceId === RD);
              return (null == i ? void 0 : i.groupId) === e && i.label === t;
            });
          }
          var XP = VO({
            retryFunction: function (e) {
              return ab(this, null, function* () {
                let t = (function (e) {
                  return { audio: ZP(e), video: eL(e) };
                })(e);
                jO.info(
                  'getUserMedia with constraints: '.concat(JSON.stringify(t)),
                );
                let i = [],
                  n = [],
                  r = ['label', 'deviceId'];
                t.audio &&
                  ((i = yield KP()),
                  jO.info('microphones: '.concat(DO(i, { keysToInclude: r })))),
                  t.video &&
                    ((n = yield YP()),
                    jO.info('cameras: '.concat(DO(n, { keysToInclude: r }))));
                try {
                  let e = yield navigator.mediaDevices.getUserMedia(t);
                  return (
                    kw &&
                      e.getTracks().forEach((e) => {
                        jO.info(
                          ''
                            .concat(e.kind, ' capabilities: ')
                            .concat(
                              DO(e.getCapabilities(), { keysToInclude: VD }),
                            ),
                        );
                      }),
                    e
                  );
                } catch (o) {
                  if ('NotFoundError' === o.name) {
                    if (e.video && n && 0 === n.length)
                      throw new gb({
                        code: mb.DEVICE_NOT_FOUND,
                        message: QO({ key: KO.CAMERA_NOT_FOUND }),
                      });
                    if (e.audio && i && 0 === i.length)
                      throw new gb({
                        code: mb.DEVICE_NOT_FOUND,
                        message: QO({ key: KO.MICROPHONE_NOT_FOUND }),
                      });
                  }
                  throw new gb({
                    code: mb.INITIALIZE_FAILED,
                    name: o.name,
                    message: o.message,
                    constraint: o.constraint,
                  });
                }
              });
            },
            settings: { retries: 3, timeout: 500 },
            onError: (e) => {
              let {
                error: t,
                retry: i,
                reject: n,
                retryFuncArgs: r,
                retryCount: o,
              } = e;
              'NotReadableError' === t.name
                ? (r[0].video &&
                    ((r[0].maxResolution = !1),
                    r[0].frameRate &&
                      (r[0].frameRate = r[0].frameRate > 10 ? 10 : 5)),
                  2 === o && (r[0].useTrueAsConstraint = !0),
                  i())
                : n(t),
                r[0].microphoneId && $P(r[0].microphoneId, !1),
                r[0].cameraId && $P(r[0].cameraId, !0);
            },
            onRetrying: (e) => {
              jO.warn(
                'getUserMedia NotReadableError observed, retrying ['.concat(
                  e,
                  '/3]',
                ),
              );
            },
            onRetryFailed: (e) => {
              Xw.logFailedEvent({
                eventType: cD.GET_USER_MEDIA_RETRY,
                error: e,
              });
            },
            onRetrySuccess: (e) => {
              Xw.logSuccessEvent({ eventType: cD.GET_USER_MEDIA_RETRY }),
                Xw.uploadEvent({
                  log: 'stat-'
                    .concat(cD.GET_USER_MEDIA_RETRY, '-success-')
                    .concat(e),
                });
            },
          });
          function $P(e, t) {
            return ab(this, null, function* () {
              let i = (t ? yield YP() : yield KP()).find(
                (t) => t.deviceId === e,
              );
              i &&
                iO(i.getCapabilities) &&
                jO.warn(DO(i.getCapabilities(), { keysToInclude: VD }));
            });
          }
          function ZP(e) {
            if (!e.audio) return !1;
            if (e.useTrueAsConstraint) return !0;
            let t = {
              echoCancellation: !0,
              noiseSuppression: !0,
              autoGainControl: !0,
            };
            return (
              UP(e.microphoneId) ||
                (t.deviceId = e.useExact
                  ? { exact: e.microphoneId }
                  : e.microphoneId),
              oO(e.channelCount) &&
                e.channelCount > 1 &&
                (t.channelCount = e.channelCount),
              sO(e.echoCancellation) &&
                !e.echoCancellation &&
                (t.echoCancellation = !1),
              sO(e.noiseSuppression) &&
                !e.noiseSuppression &&
                (t.noiseSuppression = !1),
              sO(e.autoGainControl) &&
                !e.autoGainControl &&
                (t.autoGainControl = !1),
              !!UP(t) || t
            );
          }
          function eL(e) {
            if (!e.video) return !1;
            if (e.useTrueAsConstraint) return !0;
            let { maxResolution: t = !0 } = e,
              i = {};
            return (
              e.cameraId
                ? (i.deviceId = e.useExact ? { exact: e.cameraId } : e.cameraId)
                : e.facingMode && (i.facingMode = e.facingMode),
              e.width &&
                ((i.width = { ideal: e.width }),
                t && !Ub && (i.width.max = e.width)),
              e.height &&
                ((i.height = { ideal: e.height }),
                t && !Ub && (i.height.max = e.height)),
              Ub &&
                mk &&
                e.width &&
                e.height &&
                e.width * e.height < 101376 &&
                ((i.width = e.width), (i.height = e.height)),
              e.frameRate && (i.frameRate = e.frameRate),
              !!UP(i) || i
            );
          }
          var tL = XP;
          function iL(e) {
            return rL(
              (t, i) =>
                function () {
                  for (
                    var i = arguments.length, n = new Array(i), r = 0;
                    r < i;
                    r++
                  )
                    n[r] = arguments[r];
                  return ab(this, null, function* () {
                    return yield e.apply(this, n), t.apply(this, n);
                  });
                },
            );
          }
          function nL(e) {
            return rL(
              (t, i) =>
                function () {
                  for (
                    var i = arguments.length, n = new Array(i), r = 0;
                    r < i;
                    r++
                  )
                    n[r] = arguments[r];
                  return ab(this, null, function* () {
                    return e.call(this, t.apply(this, n));
                  });
                },
            );
          }
          function rL(e) {
            return function (t, i, n) {
              return (n.value = e(n.value, i)), n;
            };
          }
          var oL = new WeakMap(),
            sL = new WeakMap();
          function aL() {
            return function (e, t, i) {
              let n = i.value,
                r = (e) => {
                  let { fn: t, args: i, context: n, resolve: r, reject: o } = e;
                  t.apply(n, i).then(r, o);
                };
              return (
                (i.value = function () {
                  for (
                    var e = arguments.length, t = new Array(e), i = 0;
                    i < e;
                    i++
                  )
                    t[i] = arguments[i];
                  return new Promise((e, i) => {
                    if (oL.has(this)) {
                      let o = oL.get(this),
                        { length: s } = o;
                      o.push({
                        fn: n,
                        args: t,
                        context: this,
                        resolve: e,
                        reject: i,
                      }),
                        0 === s &&
                          r({
                            fn: n,
                            args: t,
                            context: this,
                            resolve: e,
                            reject: i,
                          });
                    } else
                      oL.set(this, [
                        {
                          fn: n,
                          args: t,
                          context: this,
                          resolve: e,
                          reject: i,
                        },
                      ]),
                        r({
                          fn: n,
                          args: t,
                          context: this,
                          resolve: e,
                          reject: i,
                        });
                  }).finally(() => {
                    let e = oL.get(this);
                    e && (e.shift(), e[0] && r(ZC({}, e[0])));
                  });
                }),
                i
              );
            };
          }
          function cL(e) {
            return function (t, i, n) {
              let r = n.value,
                o = (t) => (oO(e) ? t[e] : e(...t)),
                s = (e) => {
                  let { fn: t, args: i, context: n, resolve: r, reject: a } = e;
                  t.apply(n, i)
                    .then(r, a)
                    .finally(() => {
                      if (sL.has(n) && sL.get(n).has(o(i))) {
                        let e = sL.get(n).get(o(i));
                        e && (e.shift(), e[0] && s(ZC({}, e[0])));
                      }
                    });
                };
              return (
                (n.value = function () {
                  for (
                    var e = arguments.length, t = new Array(e), i = 0;
                    i < e;
                    i++
                  )
                    t[i] = arguments[i];
                  return new Promise((e, i) => {
                    if (sL.has(this))
                      if (sL.get(this).has(o(t))) {
                        let n = sL.get(this).get(o(t));
                        if (n) {
                          let { length: o } = n;
                          n.push({
                            fn: r,
                            args: t,
                            context: this,
                            resolve: e,
                            reject: i,
                          }),
                            0 === o &&
                              s({
                                fn: r,
                                args: t,
                                context: this,
                                resolve: e,
                                reject: i,
                              });
                        }
                      } else
                        sL.get(this).set(o(t), [
                          {
                            fn: r,
                            args: t,
                            context: this,
                            resolve: e,
                            reject: i,
                          },
                        ]),
                          s({
                            fn: r,
                            args: t,
                            context: this,
                            resolve: e,
                            reject: i,
                          });
                    else {
                      let n = new Map();
                      n.set(o(t), [
                        {
                          fn: r,
                          args: t,
                          context: this,
                          resolve: e,
                          reject: i,
                        },
                      ]),
                        sL.set(this, n),
                        s({
                          fn: r,
                          args: t,
                          context: this,
                          resolve: e,
                          reject: i,
                        });
                    }
                  });
                }),
                n
              );
            };
          }
          var lL = class extends VP {
            constructor(e) {
              super({
                mediaType: e,
                isInitPlayer:
                  !(arguments.length > 1 && void 0 !== arguments[1]) ||
                  arguments[1],
              }),
                ob(this, 'isRemote', !1),
                ob(this, 'deviceId'),
                ob(this, 'groupId', ''),
                ob(this, 'label', ''),
                ob(this, '_isRecapturing', !1),
                ob(this, '_lastRecaptureTime', 0),
                ob(this, '_onMuteTimeoutId', -1),
                ob(this, 'profile'),
                (this.onTrackMuted = this.onTrackMuted.bind(this)),
                (this.onTrackUnmuted = this.onTrackUnmuted.bind(this)),
                (this.onTrackEnded = this.onTrackEnded.bind(this));
            }
            get isPublished() {
              return 'publish' === this.state;
            }
            installTrackEvent(e) {
              IP(e, e)
                .add(LN.MUTE, this.onTrackMuted)
                .add(LN.UNMUTE, this.onTrackUnmuted)
                .add(LN.ENDED, this.onTrackEnded),
                e.muted && this.onTrackMuted(),
                e.readyState === LN.ENDED && this.onTrackEnded();
            }
            uninstallTrackEvent(e) {
              vP(e);
            }
            setStateToCapture() {}
            capture(e) {
              return ab(this, null, function* () {
                var t;
                try {
                  let i;
                  UO.emit(BO.LOCAL_TRACK_CAPTURE_START, { track: this }),
                    e.customSource
                      ? ((i = new MediaStream()), i.addTrack(e.customSource))
                      : (null == (t = this.mediaTrack) || t.stop(),
                        (i = yield tL(e)));
                  let n = i.getTracks()[0];
                  return (
                    yield this.setInputMediaStreamTrack(n),
                    e.customSource ||
                      (this.updateDeviceIdInUse(), this.listenDeviceChange()),
                    UO.emit(BO.LOCAL_TRACK_CAPTURE_SUCCESS, { track: this }),
                    i
                  );
                } catch (aN) {
                  throw (
                    (UO.emit(BO.LOCAL_TRACK_CAPTURE_FAILED, {
                      track: this,
                      error: aN,
                    }),
                    this.log.error('getUserMedia error observed '.concat(aN)),
                    aN)
                  );
                }
              });
            }
            setInputMediaStreamTrack(e) {
              this.state === Ww.INIT && this.setStateToCapture(),
                this._inputTrack && this.uninstallTrackEvent(this._inputTrack);
              let t = super.setInputMediaStreamTrack(e);
              return this.installTrackEvent(e), t;
            }
            publish(e, t) {
              return (
                (this.room = e),
                this.emit('4', {
                  mediaType: this.strMediaType,
                  state: 'starting',
                  prevState: 'stopped',
                }),
                (this.userId = e.userId),
                this._log.setUserId(e.userId),
                this._log.setSdkAppId(e.sdkAppId),
                UO.emit(BO.LOCAL_TRACK_PUBLISHED, { track: this }),
                t
              );
            }
            unpublish() {
              this.room && this.room.localTracks.delete(this),
                UO.emit(BO.LOCAL_TRACK_UNPUBLISHED, { track: this });
            }
            updateDeviceIdInUse() {
              return ab(this, null, function* () {
                if (this.mediaTrack && bw) {
                  let { deviceId: e, groupId: t } =
                      this.mediaTrack.getSettings(),
                    { label: i } = this.mediaTrack;
                  (yield (function (e) {
                    return ab(this, arguments, function (e) {
                      let {
                        newDeviceId: t,
                        oldDeviceId: i,
                        oldGroupId: n,
                        oldLabel: r,
                        kind: o,
                      } = e;
                      return (function* () {
                        return (
                          t === i &&
                          (o !== LN.AUDIO || t !== RD || (yield QP(n, r)))
                        );
                      })();
                    });
                  })({
                    newDeviceId: e,
                    oldDeviceId: this.deviceId,
                    oldGroupId: this.groupId,
                    oldLabel: this.label,
                    kind: this.kind,
                  })) ||
                    ((this.deviceId = e),
                    (this.label = i),
                    t && (this.groupId = t),
                    JP().then((t) => {
                      let i = t.find((t) => t.deviceId === e);
                      i && this.emit('2', i);
                    }));
                }
              });
            }
            setProfile(e) {
              this.log.info('setProfile', e), Object.assign(this.profile, e);
            }
            isNeedToRecapture() {
              let e =
                arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
              return !(
                !this.deviceId ||
                !this.mediaTrack ||
                (this.kind === LN.AUDIO &&
                  !(function (e) {
                    if (
                      e instanceof CanvasCaptureMediaStreamTrack ||
                      !(e instanceof MediaStreamTrack)
                    )
                      return !1;
                    let t = e.label.toLocaleLowerCase();
                    if (t.includes('mic') || t.includes('麦克风')) return !0;
                    let i = ''
                      .concat(
                        ((null == e ? void 0 : e.getSettings()) || {}).deviceId,
                        '_',
                      )
                      .concat(LN.AUDIO_INPUT);
                    return !!qP.has(i);
                  })(this.mediaTrack)) ||
                (this.kind === LN.VIDEO &&
                  !(function (e) {
                    if (
                      e instanceof CanvasCaptureMediaStreamTrack ||
                      !(e instanceof MediaStreamTrack)
                    )
                      return !1;
                    let t = e.label.toLocaleLowerCase();
                    if (t.includes('camera') || t.includes('webcam')) return !0;
                    let i = ''
                      .concat(
                        ((null == e ? void 0 : e.getSettings()) || {}).deviceId,
                        '_',
                      )
                      .concat(LN.VIDEO_INPUT);
                    return !!qP.has(i);
                  })(this.mediaTrack)) ||
                this._isRecapturing ||
                (e && mk && Uk)
              );
            }
            onTrackMuted() {
              if ((PO(), this.isNeedToRecapture(!0))) {
                if (Date.now() - this._lastRecaptureTime < OD)
                  return void setTimeout(() => this.onTrackMuted(), OD);
                this._onMuteTimeoutId = setTimeout(
                  () =>
                    ab(this, null, function* () {
                      var e;
                      (null == (e = this.mediaTrack) ? void 0 : e.muted) &&
                        'visible' === document.visibilityState &&
                        this.recapture(yield this.getRecoverCaptureDeviceId());
                    }),
                  5e3,
                );
              }
            }
            onTrackUnmuted() {
              this._onMuteTimeoutId > 0 && clearTimeout(this._onMuteTimeoutId);
            }
            onTrackEnded() {
              return ab(this, null, function* () {
                if (this.isNeedToRecapture()) {
                  if (Date.now() - this._lastRecaptureTime < OD)
                    return void setTimeout(() => this.onTrackEnded(), OD);
                  this.recapture(yield this.getRecoverCaptureDeviceId());
                }
              });
            }
            recapture(e) {
              return ab(this, null, function* () {
                var t;
                if (this._isRecapturing || !this._inputTrack) return;
                this.log.warn('recapture trying'),
                  null == (t = this._inputTrack) || t.stop(),
                  (this._isRecapturing = !0),
                  (this._lastRecaptureTime = Date.now());
                let i = { useExact: !0 };
                if ('user' === e || 'environment' === e) i.facingMode = e;
                else {
                  let t;
                  ('audio' === this.kind ? yield KP() : yield YP()).find(
                    (t) => t.deviceId === e,
                  ) && (t = e),
                    (i.deviceId = t);
                }
                return this.capture(i)
                  .then(() => {
                    (this._isRecapturing = !1),
                      this.log.warn('recapture success'),
                      this.emit('1', { deviceId: this.deviceId });
                  })
                  .catch((e) => {
                    (this._isRecapturing = !1),
                      this.log.warn('recapture failed '.concat(e.message)),
                      this.emit('5', e);
                  });
              });
            }
            getRecoverCaptureDeviceId() {
              return ab(this, null, function* () {
                let e = this instanceof hL;
                if (e && this.facingMode) return this.facingMode;
                let { deviceId: t } = this;
                if (t) {
                  let i = (dL.get(t) || 0) + 1;
                  if ((dL.set(t, i), i >= 3)) {
                    let n = e
                      ? (yield YP()).find((e) => !dL.has(e.deviceId))
                      : (yield KP()).find((e) => !dL.has(e.deviceId));
                    n &&
                      (this.log.warn(
                        ''
                          .concat(t, ' capture fail ')
                          .concat(i, ' times, change new ')
                          .concat(n.deviceId),
                      ),
                      (t = n.deviceId));
                  }
                }
                return t;
              });
            }
            close() {
              var e;
              super.close(),
                this._inputTrack &&
                  (this._inputTrack.stop(),
                  this.uninstallTrackEvent(this._inputTrack)),
                null == (e = this.manager) || e.removeInput(this);
            }
          };
          rb(
            [Hw(Ww.INIT, 'capture', { ignoreError: !0 })],
            lL.prototype,
            'setStateToCapture',
            1,
          ),
            rb([aL()], lL.prototype, 'capture', 1),
            rb(
              [
                Hw('capture', 'publish', {
                  ignoreError: !0,
                  success() {
                    this.room.localTracks.add(this),
                      this.emit('4', {
                        mediaType: this.strMediaType,
                        state: 'started',
                        prevState: 'starting',
                      });
                  },
                  fail(e) {
                    let t = 'error',
                      i = e.cause;
                    i.message.includes('timeout')
                      ? (t = 'timeout')
                      : i.code === mb.API_CALL_ABORTED && (t = 'api-call'),
                      this.emit('4', {
                        mediaType: this.strMediaType,
                        state: 'stopped',
                        prevState: 'starting',
                        reason: t,
                        error: i,
                      });
                  },
                }),
              ],
              lL.prototype,
              'publish',
              1,
            ),
            rb(
              [
                rL(
                  (e) =>
                    function () {
                      return ab(this, null, function* () {
                        let t =
                          'publish' === this.state ? 'started' : 'starting';
                        e.call(this),
                          this.emit('4', {
                            mediaType: this.strMediaType,
                            state: 'stopped',
                            prevState: t,
                            reason: 'api-call',
                          }),
                          2 === this.mediaType && (this.mediaType = 4);
                      });
                    },
                ),
                Hw([], 'capture'),
              ],
              lL.prototype,
              'unpublish',
              1,
            );
          var dL = new Map();
          UO.on(BO.SWITCH_DEVICE_SUCCESS, (e) => {
            e.track.deviceId && dL.delete(e.track.deviceId);
          });
          var uL = class extends lL {
              constructor(e) {
                super(1),
                  ob(this, 'mediaType', 1),
                  ob(this, 'volume', 0),
                  ob(this, 'captureVolume', 1),
                  ob(this, 'profile', {
                    echoCancellation: !0,
                    autoGainControl: !0,
                    noiseSuppression: !0,
                    sampleRate: 48e3,
                    channelCount: 1,
                    bitrate: 40,
                  }),
                  ob(this, 'playerMuted', !0),
                  (this.manager = e);
              }
              getAudioLevel() {
                let e =
                  (this.volume || super.getAudioLevel()) * this.captureVolume;
                return e > 1 ? 1 : e;
              }
              capture(e) {
                let { deviceId: t, customSource: i, useExact: n = !1 } = e;
                return super.capture({
                  video: !1,
                  audio: !0,
                  microphoneId: t,
                  echoCancellation: this.profile.echoCancellation,
                  autoGainControl: this.profile.autoGainControl,
                  noiseSuppression: this.profile.noiseSuppression,
                  sampleRate: this.profile.sampleRate,
                  channelCount: this.profile.channelCount,
                  useExact: n,
                  customSource: i,
                });
              }
              switchDevice(e) {
                return ab(this, null, function* () {
                  if (this.mediaTrack) {
                    if (this.deviceId === e) {
                      if (e !== RD) return;
                      if (yield QP(this.groupId, this.label)) return;
                    }
                    try {
                      this.log.info('switchDevice audio to: '.concat(e)),
                        this.mediaTrack && this.mediaTrack.stop(),
                        yield this.capture({ deviceId: e, useExact: !0 }),
                        this.room && (yield this.room.replaceTrack(this)),
                        UO.emit(BO.SWITCH_DEVICE_SUCCESS, { track: this }),
                        this.log.info('switch microphone success');
                    } catch (sD) {
                      throw (
                        (this.log.error('switch microphone failed '.concat(sD)),
                        this.deviceId && this.recapture(this.deviceId),
                        sD)
                      );
                    }
                  }
                });
              }
              listenDeviceChange() {
                GP &&
                  !GP.listeners('audioInputRemoved').includes(
                    this.handleMicrophoneRemoved,
                  ) &&
                  GP.on(
                    'audioInputRemoved',
                    this.handleMicrophoneRemoved,
                    this,
                  );
              }
              handleMicrophoneRemoved(e) {
                return ab(this, null, function* () {
                  if (e.deviceId === this.deviceId) {
                    this.log.warn(
                      'current microphone is lost: '.concat(JSON.stringify(e)),
                    );
                    let t = yield KP();
                    t[0]
                      ? this.recapture(t[0].deviceId)
                      : GP.on(
                          'audioInputAdded',
                          this.handleMicrophoneAdded,
                          this,
                        );
                  }
                });
              }
              handleMicrophoneAdded(e) {
                this.log.warn('microphone added: '.concat(JSON.stringify(e))),
                  this.recapture(e.deviceId);
              }
              update3A(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    echoCancellation: i,
                    noiseSuppression: n,
                    autoGainControl: r,
                  } = e;
                  return (function* () {
                    let e = !1;
                    !nO(i) &&
                      i !== t.profile.echoCancellation &&
                      ((t.profile.echoCancellation = i), (e = !0)),
                      !nO(n) &&
                        n !== t.profile.noiseSuppression &&
                        ((t.profile.noiseSuppression = n), (e = !0)),
                      !nO(r) &&
                        r !== t.profile.autoGainControl &&
                        ((t.profile.autoGainControl = r), (e = !0)),
                      e && t.deviceId && (yield t.recapture(t.deviceId));
                  })();
                });
              }
              setCaptureVolume(e) {
                var t;
                let i = e / 100;
                i !== this.captureVolume &&
                  (null == (t = this.manager) || t.setCaptureVolume(i),
                  (this.captureVolume = i));
              }
              close() {
                GP.off('audioInputAdded', this.handleMicrophoneAdded, this),
                  GP.off(
                    'audioInputRemoved',
                    this.handleMicrophoneRemoved,
                    this,
                  ),
                  super.close();
              }
            },
            hL = class extends lL {
              constructor(e) {
                super(4),
                  ob(this, 'mediaType', 4),
                  ob(this, 'profile', {
                    width: 640,
                    height: 480,
                    frameRate: 15,
                    bitrate: 500,
                  }),
                  ob(this, 'states', {
                    bytesSent: 0,
                    packetsSent: 0,
                    framesEncoded: 0,
                    framesSent: 0,
                    frameWidth: 0,
                    frameHeight: 0,
                  }),
                  ob(this, 'small'),
                  ob(this, 'isNeedToSetBandwidth'),
                  (this.manager = e);
                let t = () => {
                  this.isAllowed2k4k(this.profile)
                    ? this.room &&
                      this.settings.height >= 1440 &&
                      'publish' === this.state &&
                      this.room.sendAbilityStatus({ '2k4k': 1 })
                    : (this.log.warn(
                        'Resolution is reset to 1080p, need to upgrade ability here https://cloud.tencent.com/document/product/647/85386',
                      ),
                      this.setProfile(
                        eb(ZC({}, this.profile), { width: 1920, height: 1080 }),
                      ),
                      this.applyProfile());
                };
                this.on('input-media-track-changed', t), this.on('publish', t);
              }
              get facingMode() {
                if (bw && this.mediaTrack)
                  return this.mediaTrack.getSettings().facingMode;
              }
              capture(e) {
                let {
                  deviceId: t,
                  facingMode: i,
                  useExact: n = !1,
                  customSource: r,
                } = e;
                return super.capture({
                  audio: !1,
                  video: !0,
                  facingMode: i || this.facingMode,
                  cameraId: t,
                  width: this.profile.width,
                  height: this.profile.height,
                  frameRate: this.profile.frameRate,
                  useExact: n,
                  customSource: r,
                });
              }
              setOutputMediaStreamTrack(e) {
                var t;
                return (
                  super.setOutputMediaStreamTrack(e),
                  null == (t = this.room) ? void 0 : t.replaceTrack(this)
                );
              }
              setProfile(e) {
                !e ||
                  (e.width * e.height <= 19200 &&
                    Lb &&
                    Pk &&
                    (this.log.warn(
                      'resolution is '
                        .concat(e.width, '*')
                        .concat(e.height, ', fallback to 240*180'),
                    ),
                    e.width > e.height
                      ? ((e.width = 240), (e.height = 180))
                      : ((e.width = 180), (e.height = 240)),
                    (e.bitrate = Math.max(e.bitrate, 150))),
                  e.bitrate &&
                    (this.isNeedToSetBandwidth =
                      e.bitrate !== this.profile.bitrate),
                  this.isAllowed2k4k(this.profile)
                    ? super.setProfile(e)
                    : (this.log.warn(
                        'Resolution is reset to 1080p, need to upgrade ability here https://cloud.tencent.com/document/product/647/85386',
                      ),
                      super.setProfile(
                        eb(ZC({}, this.profile), { width: 1920, height: 1080 }),
                      )));
              }
              applyProfile() {
                var e;
                if (!this.mediaTrack) return;
                let t = this.settings;
                return t.height !== this.profile.height ||
                  t.width !== this.profile.width ||
                  t.frameRate !== this.profile.frameRate
                  ? null == (e = this.mediaTrack)
                    ? void 0
                    : e
                        .applyConstraints({
                          width: this.profile.width,
                          height: this.profile.height,
                          frameRate: this.profile.frameRate,
                        })
                        .then(() => {
                          if (
                            (this.manager && this.manager.changeInput(this),
                            this.room &&
                              this.settings.height >= 1440 &&
                              'publish' === this.state &&
                              this.room.sendAbilityStatus({ '2k4k': 1 }),
                            this.isNeedToSetBandwidth &&
                              this.room &&
                              this.room.setBandWidth)
                          )
                            return (
                              (this.isNeedToSetBandwidth = !1),
                              this.room.setBandWidth({
                                bandwidth: this.profile.bitrate,
                                type: LN.VIDEO,
                                videoType: LN.BIG,
                              })
                            );
                        })
                  : void 0;
              }
              get settings() {
                let e = {
                  width: this.profile.width,
                  height: this.profile.height,
                  frameRate: this.profile.frameRate,
                };
                return (
                  bw &&
                    this.mediaTrack &&
                    Object.assign(e, this.mediaTrack.getSettings()),
                  e
                );
              }
              isAllowed2k4k(e) {
                var t;
                return (
                  !(
                    this.room &&
                    this.room.scheduleResult &&
                    !this.isScreen &&
                    !(e.height * e.width < 3686400)
                  ) ||
                  1 ===
                    (null == (t = this.room.scheduleResult.trtcAutoConf)
                      ? void 0
                      : t['2k4k'])
                );
              }
              isNeedToSwitchDevice(e) {
                return !(
                  !this.mediaTrack ||
                  this.deviceId === e ||
                  this.facingMode === e
                );
              }
              switchDevice(e) {
                return ab(this, null, function* () {
                  try {
                    if (!this.isNeedToSwitchDevice(e)) return;
                    let t = { useExact: !0 };
                    'user' === e || 'environment' === e
                      ? (t.facingMode = e)
                      : (t.deviceId = e),
                      this.mediaTrack.stop(),
                      yield this.capture(t),
                      UO.emit(BO.SWITCH_DEVICE_SUCCESS, { track: this }),
                      this.log.info('switch camera success');
                  } catch (sD) {
                    throw (
                      (this.log.error('switch camera failed '.concat(sD)),
                      this.deviceId && this.recapture(this.deviceId),
                      sD)
                    );
                  }
                });
              }
              listenDeviceChange() {
                GP &&
                  !GP.listeners('videoInputRemoved').includes(
                    this.handleCameraRemoved,
                  ) &&
                  GP.on('videoInputRemoved', this.handleCameraRemoved, this);
              }
              handleCameraRemoved(e) {
                return ab(this, null, function* () {
                  if (e.deviceId === this.deviceId) {
                    this.log.warn(
                      'current camera is lost: '.concat(JSON.stringify(e)),
                    );
                    let t = yield YP();
                    t[0]
                      ? this.recapture(t[0].deviceId)
                      : GP.on('videoInputAdded', this.handleCameraAdded, this);
                  }
                });
              }
              handleCameraAdded(e) {
                return ab(this, null, function* () {
                  this.log.warn('camera added: '.concat(JSON.stringify(e))),
                    this.recapture(e.deviceId);
                });
              }
              close() {
                GP.off('videoInputAdded', this.handleCameraAdded, this),
                  GP.off('videoInputRemoved', this.handleCameraRemoved, this),
                  super.close();
              }
            };
          var pL = function (e) {
              return ab(this, null, function* () {
                let t = null,
                  i = (function (e) {
                    let t = {
                        systemAudio: 'include',
                        selfBrowserSurface: 'include',
                        surfaceSwitching: 'include',
                      },
                      i = {
                        width: Uk
                          ? { max: e.width }
                          : { ideal: e.width, max: e.width },
                        height: Uk
                          ? { max: e.height }
                          : { ideal: e.height, max: e.height },
                        frameRate: e.frameRate,
                        displaySurface: 'monitor',
                      };
                    if (((t.video = i), e.systemAudio)) {
                      let {
                        echoCancellation: i = !0,
                        noiseSuppression: n = !1,
                        autoGainControl: r = !1,
                      } = e;
                      t.audio = {
                        echoCancellation: i,
                        noiseSuppression: n,
                        autoGainControl: r,
                        sampleRate: 48e3,
                      };
                    }
                    return t;
                  })(e);
                jO.info(
                  'getDisplayMedia with constraints: '.concat(
                    JSON.stringify(i),
                  ),
                );
                let n = yield navigator.mediaDevices.getDisplayMedia(i);
                if (
                  (e.systemAudio &&
                    0 === n.getAudioTracks().length &&
                    ((Lk && Vk < 74) || Uk || Ub) &&
                    jO.warn('Your browser not support capture system audio'),
                  e.frameRate &&
                    n.getVideoTracks()[0] &&
                    n
                      .getVideoTracks()[0]
                      .applyConstraints({
                        frameRate: { min: e.frameRate, ideal: e.frameRate },
                        width: e.width,
                        height: e.height,
                      })
                      .catch((e) => {
                        jO.warn('screen applyConstraints failed: '.concat(e));
                      }),
                  e.audio)
                ) {
                  let i = (function (e) {
                    let t = {
                      echoCancellation: e.echoCancellation,
                      autoGainControl: e.autoGainControl,
                      noiseSuppression: e.noiseSuppression,
                      sampleRate: e.sampleRate,
                      channelCount: e.channelCount,
                    };
                    return (
                      nO(e.microphoneId) || (t.deviceId = e.microphoneId),
                      { audio: t, video: !1 }
                    );
                  })(e);
                  jO.info(
                    'getUserMedia with constraints: '.concat(JSON.stringify(i)),
                  ),
                    (t = yield navigator.mediaDevices.getUserMedia(i)),
                    n.addTrack(t.getAudioTracks()[0]);
                }
                return n;
              });
            },
            _L = class extends hL {
              constructor(e) {
                super(e),
                  ob(this, 'profile', {
                    width: 1920,
                    height: 1080,
                    frameRate: 5,
                    bitrate: 1600,
                  }),
                  ob(this, 'objectFit', 'contain'),
                  ob(this, 'isScreen', !0),
                  (this._log.id = 's-'.concat(this._log.id));
              }
              capture(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    systemAudio: i = !1,
                    autoGainControl: n,
                    echoCancellation: r,
                    noiseSuppression: o,
                    audioTrack: s,
                    videoTrack: a,
                  } = e;
                  return (function* () {
                    try {
                      let e;
                      return (
                        a || s
                          ? ((e = new MediaStream()),
                            a && e.addTrack(a),
                            s && e.addTrack(s))
                          : (e = yield pL({
                              audio: !1,
                              systemAudio: i,
                              width: t.profile.width,
                              height: t.profile.height,
                              frameRate: t.profile.frameRate,
                              autoGainControl: n,
                              echoCancellation: r,
                              noiseSuppression: o,
                            })),
                        yield t.setInputMediaStreamTrack(e.getVideoTracks()[0]),
                        e
                      );
                    } catch (e) {
                      throw (
                        (t.log.error(
                          'getDisplayMedia error observed '.concat(e),
                        ),
                        e instanceof gb
                          ? e
                          : new gb({
                              code: mb.INITIALIZE_FAILED,
                              name: e.name,
                              message: e.message,
                            }))
                      );
                    }
                  })();
                });
              }
              switchDevice(e) {
                return ab(this, null, function* () {
                  throw new Error('Method not implemented.');
                });
              }
            },
            mL = class extends uL {
              constructor(e) {
                super(e), (this._log.id = 's-'.concat(this._log.id));
              }
            },
            fL = class extends uL {
              constructor(e) {
                super(e),
                  ob(this, '_inputs', new Map()),
                  ob(this, '_destination'),
                  ob(this, 'audioContext', DP('audio-mixer')),
                  (this._log.id = 'm-'.concat(this._log.id)),
                  'running' !== this.audioContext.state &&
                    this._log.warn(
                      'audio mixer context state: '.concat(
                        this.audioContext.state,
                      ),
                    ),
                  (this._destination =
                    this.audioContext.createMediaStreamDestination()),
                  (this._destination.channelCount = 1);
              }
              setInputMediaStreamTrack(e) {
                this._inputTrack = e;
                let t = this.audioContext.createMediaStreamSource(
                  new MediaStream([e]),
                );
                this._inputs.set(e, { sourceNode: t }),
                  t.connect(this._destination),
                  this._outputTrack ||
                    ((this._outputTrack =
                      this._destination.stream.getAudioTracks()[0]),
                    this.setStateToCapture());
              }
              setTrackCaptureVolume(e, t) {
                if (!this._inputs.has(e) || !this._destination) return;
                let i = this._inputs.get(e),
                  { sourceNode: n } = i;
                i.gainNode ||
                  (this._log.info('create GainNode'),
                  (i.gainNode = this.audioContext.createGain())),
                  (i.gainNode.gain.value = t),
                  n.disconnect(),
                  n.connect(i.gainNode).connect(this._destination);
              }
              publish(e, t) {
                return (this.room = e), t;
              }
              unpublish() {
                delete this.room;
              }
              replaceTrack(e, t) {
                var i;
                if (!this.hasMix) return;
                let n = 1;
                if (t) {
                  let e = this._inputs.get(t);
                  e &&
                    (e.sourceNode.disconnect(),
                    e.gainNode &&
                      ((n = e.gainNode.gain.value),
                      null == (i = e.gainNode) || i.disconnect()),
                    this._inputs.delete(t));
                }
                this.setInputMediaStreamTrack(e.outMediaTrack),
                  1 !== n && this.setTrackCaptureVolume(e.outMediaTrack, n);
              }
              removeTrack(e) {
                let t = this._inputs.get(e);
                !t ||
                  (t.sourceNode.disconnect(),
                  this._inputs.delete(e),
                  this._inputTrack === e && delete this._inputTrack,
                  0 === this._inputs.size &&
                    (delete this._outputTrack, this.unpublish(), this.close()));
              }
              close() {
                this.stop(), this.audioContext.close();
              }
              get hasMix() {
                return !!this._outputTrack;
              }
              set channelCount(e) {
                this._destination.channelCount = e;
              }
            };
          rb(
            [Hw('capture', 'publish', { ignoreError: !0 })],
            fL.prototype,
            'publish',
            1,
          ),
            rb([Hw([], 'capture')], fL.prototype, 'unpublish', 1);
          var gL = class extends lL {
              constructor(e, t) {
                super(1),
                  ob(this, 'musicId'),
                  ob(this, 'mediaType', 1),
                  ob(this, 'volume', 0),
                  ob(this, 'profile', {
                    echoCancellation: !0,
                    autoGainControl: !0,
                    noiseSuppression: !0,
                    sampleRate: 48e3,
                    channelCount: 1,
                    bitrate: 40,
                  }),
                  ob(this, 'playerMuted', !1),
                  ob(this, 'audio'),
                  ob(this, '_audioContext'),
                  ob(this, '_destination'),
                  ob(this, '_source', null),
                  (this.manager = e),
                  this.initAudioContext(),
                  (this._destination =
                    this._audioContext.createMediaStreamDestination()),
                  (this._destination.channelCount = 1),
                  (this.audio = document.createElement('audio')),
                  (this.audio.src = t.url),
                  (this.audio.crossOrigin = 'anonymous'),
                  sO(t.loop) && this.loop(t.loop),
                  oO(t.volume) && this.setVolume(t.volume),
                  t.id && (this.musicId = t.id),
                  (this._source = this._audioContext.createMediaElementSource(
                    this.audio,
                  )),
                  this._source.connect(this._destination),
                  this.setInputMediaStreamTrack(
                    this._destination.stream.getAudioTracks()[0],
                  ),
                  this.installPlayerEvent();
              }
              play() {
                return ab(this, null, function* () {
                  try {
                    yield this.audio.play(),
                      yield sb(gL.prototype, this, 'play').call(this, null, {
                        muted: !1,
                      }),
                      this._log.info(
                        'music '.concat(this.musicId, ' play success'),
                      );
                  } catch (sN) {
                    this._log.error(
                      'music '.concat(this.musicId, ' play error'),
                      sN,
                    );
                  }
                });
              }
              installPlayerEvent() {
                this.audio.addEventListener(
                  'error',
                  this.handleAudioError.bind(this),
                );
              }
              uninstallPlayerEvent() {
                this.audio.removeEventListener(
                  'error',
                  this.handleAudioError.bind(this),
                );
              }
              handleAudioError(e) {
                this._log.warn(
                  'local music '.concat(this.musicId, ' audio error'),
                  e,
                );
              }
              initAudioContext() {
                (this._audioContext = DP('music')),
                  'running' !== this._audioContext.state &&
                    this._log.warn(
                      'local music '
                        .concat(this.musicId, ' context state: ')
                        .concat(this._audioContext.state),
                    );
              }
              destroy() {
                var e, t;
                null == (e = this._source) || e.disconnect(),
                  null == (t = this._destination) || t.disconnect(),
                  this.uninstallPlayerEvent(),
                  this.player.stop(),
                  this._audioContext.close().then(() => {
                    (this._source = null),
                      (this._destination = null),
                      (this._audioContext = null);
                  });
              }
              getStream() {
                var e;
                return (
                  (null == (e = this._destination) ? void 0 : e.stream) || null
                );
              }
              seek(e) {
                e < 0 && e > this.duration()
                  ? this._log.warn('Time beyond song duration.')
                  : (this.audio.currentTime = e);
              }
              getPosition() {
                return this.audio.currentTime || 0;
              }
              setVolume(e) {
                e > 1 && e < 0
                  ? this.log.warn('volume is out of range')
                  : (this.audio.volume = e);
              }
              getVolume() {
                return this.audio.volume || 0;
              }
              setPlayBackRate(e) {
                e > 8 && e < 0
                  ? this.log.warn('rate is out of range')
                  : (this.audio.playbackRate = e);
              }
              getPlayBackRate() {
                return this.audio.playbackRate || 0;
              }
              duration() {
                return this.audio.duration || 0;
              }
              loop(e) {
                return (
                  this.audio && sO(e) && (this.audio.loop = e),
                  this.audio.loop || !1
                );
              }
              setOperation(e) {
                'pause' === e && this.audio.pause(),
                  'resume' === e && (this.audio.pause(), this.audio.play()),
                  'stop' === e && (this.audio.pause(), this.seek(0));
              }
              listenDeviceChange() {}
            },
            TL = 'input',
            EL = 'output';
          var SL = (e) => (e = Number(e)) > 0 && e < 14e8;
          function IL(e) {
            return ab(this, arguments, function (e) {
              let { sdkAppId: t, userId: i, userSig: n, timestamp: r } = e;
              return (function* () {
                let e = 'https://'
                    .concat(
                      (function (e) {
                        let t;
                        return (
                          (t = SL(e)
                            ? 'intl-schedule.rtc.qq.com'
                            : 'schedule.rtc.qq.com'),
                          t
                        );
                      })(t),
                      '/api/v1/audioAiAuth?sdkAppId=',
                    )
                    .concat(t, '&userId=')
                    .concat(i, '&userSig=')
                    .concat(n, '&timestamp=')
                    .concat(r),
                  o = yield fetch(e),
                  {
                    data: { errCode: s, errMsg: a, sign: c, status: l },
                  } = yield o.json();
                if ('1' === l)
                  return { auth: !0, sign: c, status: l, message: a };
                let d = 'Init RTCAIDenoiser failed.',
                  u = '';
                switch (s) {
                  case 1:
                    u = 'Please check your params.';
                    break;
                  case 2:
                    u =
                      'You need to buy packages. Refer to: https://cloud.tencent.com/document/product/647/44247';
                    break;
                  case 3:
                    u = 'Server is invalid. Please contact our engineer. ';
                    break;
                  case 4:
                    u =
                      'Your packages is not active. Refer to: https://cloud.tencent.com/document/product/647/44247';
                    break;
                  case 5:
                    u =
                      'Your packages is expired. Refer to: https://cloud.tencent.com/document/product/647/44247';
                    break;
                  case 6:
                    u = 'Your version is not supported.';
                }
                return {
                  auth: !1,
                  status: l,
                  message: a
                    ? ''.concat(d, ' Reason: ').concat(a, '. ').concat(u)
                    : ''.concat(d, ', ').concat(u),
                };
              })();
            });
          }
          var vL = nb(cb(), 1);
          function yL(e, t) {
            t = t || {};
            let i,
              n = e.numberOfChannels,
              { sampleRate: r } = e,
              o = t.float32 ? 3 : 1,
              s = 3 === o ? 32 : 16;
            return (
              (i =
                2 === n
                  ? (function (e, t) {
                      let i = e.length + t.length,
                        n = new Float32Array(i),
                        r = 0,
                        o = 0;
                      for (; r < i; ) (n[r++] = e[o]), (n[r++] = t[o]), o++;
                      return n;
                    })(e.getChannelData(0), e.getChannelData(1))
                  : e.getChannelData(0)),
              (function (e, t, i, n, r) {
                let o = r / 8,
                  s = n * o,
                  a = new ArrayBuffer(44 + e.length * o),
                  c = new DataView(a);
                return (
                  AL(c, 0, 'RIFF'),
                  c.setUint32(4, 36 + e.length * o, !0),
                  AL(c, 8, 'WAVE'),
                  AL(c, 12, 'fmt '),
                  c.setUint32(16, 16, !0),
                  c.setUint16(20, t, !0),
                  c.setUint16(22, n, !0),
                  c.setUint32(24, i, !0),
                  c.setUint32(28, i * s, !0),
                  c.setUint16(32, s, !0),
                  c.setUint16(34, r, !0),
                  AL(c, 36, 'data'),
                  c.setUint32(40, e.length * o, !0),
                  1 === t
                    ? (function (e, t, i) {
                        for (let n = 0; n < i.length; n++, t += 2) {
                          let r = Math.max(-1, Math.min(1, i[n]));
                          e.setInt16(t, r < 0 ? 32768 * r : 32767 * r, !0);
                        }
                      })(c, 44, e)
                    : (function (e, t, i) {
                        for (let n = 0; n < i.length; n++, t += 4)
                          e.setFloat32(t, i[n], !0);
                      })(c, 44, e),
                  a
                );
              })(i, o, r, n, s)
            );
          }
          function AL(e, t, i) {
            for (let n = 0; n < i.length; n++)
              e.setUint8(t + n, i.charCodeAt(n));
          }
          var RL = class {
              constructor(e) {
                ob(this, 'audioContext_'),
                  ob(this, 'inputPCM_', new Float32Array()),
                  ob(this, 'outputPCM_', new Float32Array()),
                  (this.audioContext_ = e);
              }
              onDump(e, t) {
                if (t === TL) {
                  let t = this.inputPCM_.length,
                    i = new Float32Array(t + e[0].length);
                  i.set(this.inputPCM_), i.set(e[0], t), (this.inputPCM_ = i);
                }
                if (t === EL) {
                  let t = this.outputPCM_.length,
                    i = new Float32Array(t + e[0].length);
                  i.set(this.outputPCM_), i.set(e[0], t), (this.outputPCM_ = i);
                }
              }
              getBlob(e) {
                let t = e === TL ? this.inputPCM_ : this.outputPCM_,
                  i = this.audioContext_.createBuffer(2, t.length, 48e3);
                i.copyToChannel(t, 0, 0), i.copyToChannel(t, 1, 0);
                let n = yL(i);
                return (
                  (i = null),
                  new window.Blob([new DataView(n)], { type: 'audio/wav' })
                );
              }
              reset() {
                (this.inputPCM_ = new Float32Array()),
                  (this.outputPCM_ = new Float32Array());
              }
              destroy() {
                this.reset();
              }
            },
            CL = class {
              constructor(e) {
                let {
                  sdkAppId: t,
                  userId: i,
                  audioContext: n,
                  sign: r,
                  status: o,
                  worklet: s,
                  timestamp: a,
                  logger: c,
                } = e;
                ob(this, 'audioContext_'),
                  ob(this, 'destination_'),
                  ob(this, 'gainNode_'),
                  ob(this, 'log_'),
                  ob(this, 'workletNode_'),
                  ob(this, 'isDumping_', !1),
                  ob(this, 'dump_'),
                  ob(this, 'audioTrack_'),
                  ob(this, 'source_'),
                  ob(this, 'denoiserTrack_'),
                  ob(this, 'enableDenoise_', !0),
                  ob(this, 'emitter_', new vL.default()),
                  (this.audioContext_ = n),
                  (this.destination_ =
                    this.audioContext_.createMediaStreamDestination()),
                  (this.gainNode_ = this.audioContext_.createGain()),
                  (this.gainNode_.gain.value = 1.1),
                  (this.log_ = c),
                  (this.workletNode_ = s),
                  this.workletNode_
                    .connect(this.gainNode_)
                    .connect(this.destination_),
                  this.workletNode_.port.postMessage({
                    type: 'init',
                    data: {
                      sdkAppId: String(t),
                      userId: i,
                      timestamp: a,
                      sign: r,
                      status: o,
                    },
                  }),
                  (this.workletNode_.port.onmessage = (e) => {
                    let { type: t, data: i } = e.data;
                    if ('ondump' === t && this.isDumping_) {
                      let { inputPCM: e, outputPCM: t } = i;
                      this.dump_.onDump(e, TL), this.dump_.onDump(t, EL);
                    }
                    'dumped' === t && this.dumped();
                  }),
                  (this.dump_ = new RL(this.audioContext_));
              }
              dumped() {
                this.isDumping_ = !1;
                let e = this.dump_.getBlob(TL),
                  t = this.dump_.getBlob(EL);
                this.emitter_.emit('ondumpend', { blob: e, name: TL }),
                  this.emitter_.emit('ondumpend', { blob: t, name: EL }),
                  this.dumpedWAV(e, TL),
                  this.dumpedWAV(t, EL),
                  this.dump_.reset();
              }
              dumpedWAV(e, t) {
                let i = window.URL.createObjectURL(e),
                  n = document.createElement('a');
                (n.href = i),
                  (n.download = ''.concat(t, '-').concat(Date.now(), '.wav')),
                  n.click(),
                  window.URL.revokeObjectURL(i),
                  (n.href = '');
              }
              process(e) {
                return ab(this, null, function* () {
                  if (((this.audioTrack_ = e), !this.audioTrack_))
                    throw new Error(
                      'RTCAIDenoiser: cannot process without audioTrack.',
                    );
                  let t = new MediaStream();
                  t.addTrack(this.audioTrack_),
                    (this.source_ =
                      this.audioContext_.createMediaStreamSource(t)),
                    yield this.source_.connect(this.workletNode_),
                    yield this.enableTrackANS(this.audioTrack_, !1);
                  let i = this.destination_.stream;
                  return (
                    (this.denoiserTrack_ = i.getAudioTracks()[0]),
                    this.log_.info(
                      'RTCAIDenoiser: denoiser process track ID: '.concat(
                        e.id,
                        ' success.',
                      ),
                    ),
                    this.denoiserTrack_
                  );
                });
              }
              updateTrack(e) {
                return ab(this, null, function* () {
                  var t;
                  let i = new MediaStream();
                  yield i.addTrack(e);
                  let n = this.audioContext_.createMediaStreamSource(i);
                  this.source_.disconnect(),
                    n.connect(this.workletNode_),
                    null == (t = this.audioTrack_) || t.stop(),
                    (this.audioTrack_ = e),
                    (this.source_ = n),
                    this.log_.info('RTCAIDenoiser: updateTrack success.');
                });
              }
              disable() {
                return ab(this, null, function* () {
                  var e;
                  return (
                    (this.enableDenoise_ = !1),
                    null == (e = this.workletNode_) ||
                      e.port.postMessage({ type: 'disable' }),
                    this.audioTrack_ &&
                      (yield this.enableTrackANS(this.audioTrack_, !0)),
                    this.log_.info('RTCAIDenoiser: disable ai denoiser.'),
                    this.enableDenoise_
                  );
                });
              }
              enable() {
                return ab(this, null, function* () {
                  var e;
                  return (
                    (this.enableDenoise_ = !0),
                    null == (e = this.workletNode_) ||
                      e.port.postMessage({ type: 'enable' }),
                    this.audioTrack_ &&
                      (yield this.enableTrackANS(this.audioTrack_, !1)),
                    this.log_.info('RTCAIDenoiser: enable ai denoiser.'),
                    this.enableDenoise_
                  );
                });
              }
              enableTrackANS(e, t) {
                let i = e.getConstraints();
                return (
                  (i.noiseSuppression = t),
                  e
                    .applyConstraints(i)
                    .catch((e) =>
                      this.log_.warn(
                        ''.concat(t ? 'enable' : 'disable', ' ANS failed '),
                        e,
                      ),
                    )
                );
              }
              startDump() {
                return this.isDumping_
                  ? (this.log_.info(
                      'RTCAIDenoiser: data is currently being dumped.',
                    ),
                    !1)
                  : (this.workletNode_.port.postMessage({ type: 'startDump' }),
                    this.dump_
                      ? this.dump_.reset()
                      : (this.dump_ = new RL(this.audioContext_)),
                    (this.isDumping_ = !0),
                    this.log_.info('RTCAIDenoiser: start dump data.'),
                    !0);
              }
              stopDump() {
                !this.isDumping_ ||
                  (this.workletNode_.port.postMessage({ type: 'stopDump' }),
                  (this.isDumping_ = !1),
                  this.log_.info('RTCAIDenoiser: stop dump data.'));
              }
              getAudioTrack() {
                return this.audioTrack_;
              }
              getDenoiserTrack() {
                return this.destination_.stream.getAudioTracks()[0];
              }
              get enabled() {
                return this.enableDenoise_;
              }
              destroy() {
                var e, t, i, n, r, o;
                this.log_.info('RTCAIDenoiser: destroy processor.'),
                  null == (e = this.audioTrack_) || e.stop(),
                  null == (t = this.workletNode_) ||
                    t.port.postMessage({ type: 'destroy' }),
                  (this.workletNode_.port.onmessage = null),
                  null == (i = this.source_) || i.disconnect(),
                  null == (n = this.destination_) || n.disconnect(),
                  null == (r = this.workletNode_) || r.disconnect(),
                  null == (o = this.dump_) || o.destroy(),
                  this.emitter_.removeAllListeners();
              }
              on(e, t, i) {
                this.emitter_.on(e, t, i);
              }
              off(e, t, i) {
                '*' === e
                  ? this.emitter_.removeAllListeners()
                  : this.emitter_.off(e, t, i);
              }
            },
            bL = class {
              constructor(e) {
                let { assetsPath: t, log: i, audioContext: n } = e;
                (this.isLoaded_ = !1),
                  (this.audioContext_ = n),
                  (this.log_ = i),
                  (this.assetsPath_ = t);
              }
              createProcessor(e) {
                return ab(this, null, function* () {
                  let t = String(Date.now()).slice(0, -3),
                    {
                      auth: i,
                      sign: n,
                      status: r,
                      message: o,
                    } = yield IL(eb(ZC({}, e), { timestamp: t }));
                  if (!i)
                    throw (
                      (this.log_.info(
                        'RTCAIDenoiser: '
                          .concat(e.userId, ' auth result: ')
                          .concat(i, '. Message: ')
                          .concat(o),
                      ),
                      new Error(o))
                    );
                  try {
                    yield this.load();
                  } catch (c) {
                    throw new Error(
                      'Init wasm failed, please check your assetsPath.',
                    );
                  }
                  let s = yield this.initWorklet(),
                    a = new CL(
                      eb(ZC({}, e), {
                        audioContext: this.audioContext_,
                        timestamp: t,
                        sign: n,
                        status: r,
                        worklet: s,
                        logger: this.log_,
                      }),
                    );
                  return (
                    this.log_.info(
                      'RTCAIDenoiser: '.concat(
                        e.userId,
                        ' create denoiser processor success.',
                      ),
                    ),
                    a
                  );
                });
              }
              load() {
                return ab(this, null, function* () {
                  if (!this.isLoaded_)
                    try {
                      yield this.audioContext_.audioWorklet.addModule(
                        ''.concat(this.assetsPath_, '/denoiser-wasm.js'),
                      ),
                        (this.isLoaded_ = !0);
                    } catch (YL) {
                      throw (
                        (this.log_.error(
                          'Init assets from '
                            .concat(this.assetsPath_, ' failed! Reason: ')
                            .concat(YL),
                        ),
                        YL)
                      );
                    }
                });
              }
              initWorklet() {
                return ab(this, null, function* () {
                  try {
                    return new AudioWorkletNode(
                      this.audioContext_,
                      'trtc-denoiser-processor',
                      { numberOfInputs: 1, numberOfOutputs: 1 },
                    );
                  } catch (YL) {
                    return (
                      yield this.load(),
                      new AudioWorkletNode(
                        this.audioContext_,
                        'trtc-denoiser-processor',
                        { numberOfInputs: 1, numberOfOutputs: 1 },
                      )
                    );
                  }
                });
              }
              destroy() {
                var e;
                null == (e = this.audioContext_) || e.close();
              }
              isSupported() {
                return 'AudioWorklet' in window && 'WebAssembly' in window;
              }
            },
            kL = class {
              constructor(e) {
                let { room: t } = e;
                ob(this, '_localAudioTrack', null),
                  ob(this, '_localScreenAudioTrack', null),
                  ob(this, 'localMixAudioTrack'),
                  ob(this, 'isDenoiserInit', !1),
                  ob(this, 'isDenoiserEnabled', !1),
                  ob(this, 'isDenoiserProcessed', !1),
                  ob(this, 'mixedMusicMap', new Map()),
                  ob(this, 'cacheMusicMap', new Map()),
                  ob(this, '_log'),
                  ob(this, 'denoiserTrack', null),
                  ob(this, 'denoiser', null),
                  ob(this, 'denoiserProcessor'),
                  ob(this, 'initProcessorOptions'),
                  ob(this, 'denoiserContext'),
                  (this._log = jO.createLogger({
                    id: 'am',
                    userId: t.userId,
                    sdkAppId: t.sdkAppId,
                  }));
              }
              get mixedAudioTrack() {
                return this.localMixAudioTrack
                  ? this.localMixAudioTrack.outMediaTrack
                  : null;
              }
              get hasScreenAudioTrack() {
                return null !== this._localScreenAudioTrack;
              }
              get hasAudioTrack() {
                return null !== this._localAudioTrack;
              }
              changeInput(e, t) {
                var i, n, r;
                return e instanceof mL
                  ? ((this._localScreenAudioTrack = e),
                    void (e._outputTrack = e.mediaTrack))
                  : e instanceof gL
                  ? ((e._outputTrack = e.mediaTrack),
                    void (
                      null == (i = this.localMixAudioTrack) ||
                      i.replaceTrack(e, t)
                    ))
                  : e instanceof uL
                  ? ((this._localAudioTrack = e),
                    this.isDenoiserProcessed &&
                      (null == (n = this.denoiserProcessor) ||
                        n.updateTrack(e.mediaTrack)),
                    e.setOutputMediaStreamTrack(
                      this.isDenoiserProcessed
                        ? this.denoiserTrack
                        : e.mediaTrack,
                    ),
                    void (
                      null == (r = this.localMixAudioTrack) ||
                      r.replaceTrack(e, t)
                    ))
                  : e instanceof OL
                  ? e.setOutputMediaStreamTrack(e.mediaTrack)
                  : void 0;
              }
              removeInput(e) {
                if (e instanceof uL) return this.removeAudioTrack(e);
              }
              addMusicSource(e) {
                return ab(this, null, function* () {
                  this._log.info(
                    'add music source, id: '
                      .concat(e.id, ' url: ')
                      .concat(e.url),
                  );
                  let t,
                    { id: i, url: n, loop: r, volume: o } = e;
                  if (!this.mixedMusicMap.has(i))
                    return (
                      (t = this.cacheMusicMap.has(i)
                        ? this.cacheMusicMap.get(i)
                        : new gL(this, e)),
                      t.play(),
                      this._log.info('start mix audio '.concat(i, ' success.')),
                      this.mixedMusicMap.set(i, t),
                      this.cacheMusicMap.set(i, t),
                      t
                    );
                });
              }
              updateMusicSource(e) {
                return ab(this, null, function* () {
                  let {
                    id: t,
                    volume: i,
                    loop: n,
                    operation: r,
                    seekFrom: o,
                  } = e;
                  if (
                    (this._log.info(
                      'update music source, '.concat(JSON.stringify(e)),
                    ),
                    this.mixedMusicMap.has(t))
                  ) {
                    let e = this.mixedMusicMap.get(t);
                    nO(i) || e.setVolume(i),
                      nO(n) || e.loop(n),
                      nO(r) || e.setOperation(r),
                      nO(o) || e.seek(o);
                  }
                });
              }
              addAudioTrack(e) {
                return ab(this, null, function* () {
                  var t;
                  if (
                    (this.localMixAudioTrack ||
                      (this.localMixAudioTrack = new fL(this)),
                    this._log.info(
                      'start add audioTrack, userId: '.concat(e.userId),
                    ),
                    e === this._localAudioTrack)
                  ) {
                    if (bw) {
                      let i = yield null == (t = e.mediaTrack)
                        ? void 0
                        : t.getSettings();
                      this.localMixAudioTrack.channelCount =
                        (null == i ? void 0 : i.channelCount) || 1;
                    }
                    this.mixedMusicMap.forEach((e) => {
                      var t;
                      null == (t = this.localMixAudioTrack) ||
                        t.setInputMediaStreamTrack(e.outMediaTrack);
                    });
                  }
                  this.localMixAudioTrack.setInputMediaStreamTrack(
                    e.outMediaTrack,
                  ),
                    this._localAudioTrack &&
                      1 !== this._localAudioTrack.captureVolume &&
                      this.setCaptureVolume(
                        this._localAudioTrack.captureVolume,
                      );
                });
              }
              removeAudioTrack(e) {
                e === this._localAudioTrack &&
                  (this.localMixAudioTrack &&
                    this.mixedMusicMap.forEach((e) => {
                      this.localMixAudioTrack.removeTrack(e.outMediaTrack);
                    }),
                  (this._localAudioTrack = null)),
                  this.localMixAudioTrack &&
                    (this.localMixAudioTrack.removeTrack(e.outMediaTrack),
                    this.localMixAudioTrack.hasMix ||
                      delete this.localMixAudioTrack);
              }
              removeMusicSource(e) {
                let { id: t } = e;
                if (this.localMixAudioTrack) {
                  if (this.mixedMusicMap.has(t)) {
                    this._log.info('remove music source, music id: '.concat(t));
                    let e = this.mixedMusicMap.get(t);
                    e.stop(),
                      this.localMixAudioTrack.removeTrack(e.outMediaTrack),
                      this.mixedMusicMap.delete(t);
                  }
                  '*' === t && this.destroyAllMusic();
                }
              }
              destroyAllMusic() {
                this._log.info('destroy all music source.'),
                  this.mixedMusicMap.forEach((e, t) => {
                    this.removeMusicSource({ id: t });
                  });
              }
              destroyAllCache() {
                this._log.info('destroy all music cache.'),
                  this.cacheMusicMap.forEach((e) => e.stop());
              }
              initDenoiser(e) {
                return ab(this, null, function* () {
                  let { assetsPath: t, sdkAppId: i, userId: n, userSig: r } = e;
                  try {
                    (!this.denoiserContext ||
                      'closed' === this.denoiserContext.state) &&
                      (this.denoiserContext = DP('denoiser')),
                      this.denoiser ||
                        (this.denoiser = new bL({
                          assetsPath: t,
                          log: this._log,
                          audioContext: this.denoiserContext,
                        })),
                      this.denoiserProcessor ||
                        (this.denoiserProcessor =
                          yield this.denoiser.createProcessor({
                            sdkAppId: i,
                            userId: n,
                            userSig: r,
                          })),
                      (this.isDenoiserInit = !0),
                      (this.initProcessorOptions = e);
                  } catch (cN) {
                    throw cN;
                  }
                });
              }
              enableDenoiser(e) {
                return ab(this, null, function* () {
                  var e, t, i;
                  if (((this.isDenoiserEnabled = !0), this.hasAudioTrack))
                    if (this.isDenoiserProcessed)
                      null == (i = this.denoiserProcessor) || i.enable();
                    else {
                      let i =
                        null == (e = this._localAudioTrack)
                          ? void 0
                          : e.mediaTrack;
                      if (!i) return;
                      this.denoiserProcessor ||
                        (yield this.initDenoiser(this.initProcessorOptions)),
                        (this.denoiserTrack =
                          yield this.denoiserProcessor.process(i)),
                        (this.isDenoiserProcessed = !0),
                        (this._localAudioTrack._outputTrack =
                          this.denoiserTrack),
                        null == (t = this.localMixAudioTrack) ||
                          t.replaceTrack(this._localAudioTrack, i);
                    }
                });
              }
              disableDenoiser() {
                return ab(this, null, function* () {
                  var e;
                  this.isDenoiserEnabled &&
                    (null == (e = this.denoiserProcessor) || e.disable(),
                    (this.isDenoiserEnabled = !1));
                });
              }
              setCaptureVolume(e) {
                var t;
                this.localMixAudioTrack &&
                  this._localAudioTrack &&
                  this._localAudioTrack.outMediaTrack &&
                  (null == (t = this.localMixAudioTrack) ||
                    t.setTrackCaptureVolume(
                      this._localAudioTrack.outMediaTrack,
                      e,
                    ));
              }
              destroyDenoiserProcessor() {
                var e;
                this.denoiserProcessor &&
                  (this.denoiserProcessor.destroy(),
                  delete this.denoiserProcessor,
                  (this.isDenoiserInit = !1),
                  (this.isDenoiserEnabled = !1),
                  (this.isDenoiserProcessed = !1),
                  null == (e = this.denoiserTrack) || e.stop(),
                  (this.denoiserTrack = null)),
                  this.denoiserContext &&
                    (this.denoiserContext.close(), delete this.denoiserContext);
              }
              destroy() {
                var e;
                this.destroyAllMusic(),
                  this.destroyAllCache(),
                  this.destroyDenoiserProcessor(),
                  null == (e = this.denoiser) || e.destroy(),
                  this.localMixAudioTrack &&
                    (this.localMixAudioTrack.close(),
                    delete this.localMixAudioTrack);
              }
            },
            NL = class extends VP {
              constructor(e, t, i) {
                super({
                  userId: t.userId,
                  sdkAppId: e.sdkAppId,
                  mediaType: i,
                  room: e,
                }),
                  (this.room = e),
                  (this.user = t),
                  ob(this, 'tinyId'),
                  ob(this, 'isRemote', !0),
                  (this.tinyId = t.tinyId);
              }
              setMute(e) {
                return this.hasFlag && super.setMute(e);
              }
              setInputMediaStreamTrack(e) {
                super.setInputMediaStreamTrack(e),
                  this.hasFlag &&
                    this.isSubscribed &&
                    this.player.setTrack(this.outMediaTrack);
              }
              waitHasMediaTrack() {
                return new Promise((e) => {
                  this.mediaTrack
                    ? e()
                    : this.once('input-media-track-changed', e);
                });
              }
              get isSubscribing() {
                return 'subscribeing' === this.state.toString();
              }
              get isSubscribed() {
                return this.state === NL.STATE_SUBSCRIBE;
              }
              subscribe(e) {
                return e;
              }
              unsubscribe() {
                this.player.setTrack(null),
                  'main' === this.streamType &&
                    'video' === this.kind &&
                    this.room.changeType(!1, this.user);
              }
              updatePlayingState(e) {
                if (this.isPlayCalled && this.player.isStopped === e) {
                  if (
                    e &&
                    (!this.isSubscribed || !this.hasFlag || !this.outMediaTrack)
                  )
                    return void this.log.info(
                      'abort play, isSubscribed:'
                        .concat(this.isSubscribed, ' hasFlag:')
                        .concat(this.hasFlag, ' hasTrack:')
                        .concat(!!this.outMediaTrack),
                    );
                  super.updatePlayingState(e);
                }
              }
              onFlagChanged() {
                this.updatePlayingState(this.hasFlag);
              }
            },
            DL = NL;
          ob(DL, 'STATE_SUBSCRIBE', 'subscribe'),
            rb(
              [
                Hw(Ww.INIT, DL.STATE_SUBSCRIBE, {
                  success() {
                    this.log.info('subscribed'),
                      UO.emit(BO.REMOTE_TRACK_SUBSCRIBED, { track: this }),
                      this.updatePlayingState(!0);
                  },
                  ignoreError: !0,
                }),
              ],
              DL.prototype,
              'subscribe',
              1,
            ),
            rb(
              [
                Hw(DL.STATE_SUBSCRIBE, Ww.INIT, {
                  success() {
                    this.log.info('unsubscribed'),
                      this.updatePlayingState(!1),
                      UO.emit(BO.REMOTE_TRACK_UNSUBSCRIBED, { track: this });
                  },
                }),
              ],
              DL.prototype,
              'unsubscribe',
              1,
            );
          var OL = class extends DL {
              constructor(e, t) {
                super(e, t, 1),
                  ob(this, 'volume', 0),
                  ob(this, 'mediaType', 1),
                  ob(this, 'stat', {
                    bytesReceived: 0,
                    packetsReceived: 0,
                    packetsLost: 0,
                    end2EndDelay: 0,
                    jitterBufferDelay: 0,
                  }),
                  (this.manager = e.audioManager);
              }
              getAudioLevel() {
                let e =
                  (this.volume || super.getAudioLevel()) * this.playbackVolume;
                return e > 1 ? 1 : e;
              }
              get hasFlag() {
                return (
                  this.user.muteState.hasAudio &&
                  !this.user.muteState.audioMuted
                );
              }
              isFlagChanged(e) {
                let t = e.hasAudio && !e.audioMuted;
                return this.hasFlag || (this.volume = 0), this.hasFlag !== t;
              }
            },
            wL = class extends DL {
              constructor(e, t) {
                super(
                  e,
                  t,
                  arguments.length > 2 && void 0 !== arguments[2]
                    ? arguments[2]
                    : 4,
                ),
                  ob(this, 'mediaType', 4),
                  ob(this, 'stat', {
                    bytesReceived: 0,
                    packetsReceived: 0,
                    packetsLost: 0,
                    framesReceived: 0,
                    framesDecoded: 0,
                    frameWidth: 0,
                    frameHeight: 0,
                    end2EndDelay: 0,
                    jitterBufferDelay: 0,
                  }),
                  (this.manager = e.videoManager);
              }
              changeType(e) {
                this.room.changeType(e, this.user);
              }
              get hasFlag() {
                return (
                  this.user.muteState.hasVideo &&
                  !this.user.muteState.videoMuted
                );
              }
              isFlagChanged(e) {
                let t = e.hasVideo && !e.videoMuted;
                return this.hasFlag !== t;
              }
            },
            PL = class extends wL {
              constructor(e, t) {
                super(e, t, 2),
                  ob(this, 'mediaType', 2),
                  ob(this, 'objectFit', 'contain');
              }
              get hasFlag() {
                return this.user.muteState.hasAuxiliary;
              }
              isFlagChanged(e) {
                let t = e.hasAuxiliary;
                return this.hasFlag !== t;
              }
            };
          function LL() {}
          var ML = (e) => e(),
            VL = () => 'undefined' != typeof __FASTRX_DEVTOOLS__,
            xL = 1,
            UL = class extends Function {
              toString() {
                return ''
                  .concat(this.name, '(')
                  .concat(
                    this.args.length ? [...this.args].join(', ') : '',
                    ')',
                  );
              }
              subscribe(e) {
                let t = new GL(e, this, this.streamId++);
                return (
                  WL.subscribe(
                    { id: this.id, end: !1 },
                    { nodeId: t.sourceId, streamId: t.id },
                  ),
                  this(t),
                  t
                );
              }
            },
            FL = class {
              constructor() {
                (this.defers = new Set()), (this.disposed = !1);
              }
              next(e) {}
              complete() {
                this.dispose();
              }
              error(e) {
                this.dispose();
              }
              get bindDispose() {
                return () => this.dispose();
              }
              dispose() {
                (this.disposed = !0),
                  (this.complete = LL),
                  (this.error = LL),
                  (this.next = LL),
                  (this.dispose = LL),
                  (this.subscribe = LL),
                  this.doDefer();
              }
              subscribe(e) {
                return e instanceof UL ? e.subscribe(this) : e(this), this;
              }
              get bindSubscribe() {
                return (e) => this.subscribe(e);
              }
              doDefer() {
                this.defers.forEach(ML), this.defers.clear();
              }
              defer(e) {
                this.defers.add(e);
              }
              removeDefer(e) {
                this.defers.delete(e);
              }
              reset() {
                (this.disposed = !1),
                  delete this.complete,
                  delete this.next,
                  delete this.dispose,
                  delete this.next,
                  delete this.subscribe;
              }
              resetNext() {
                delete this.next;
              }
              resetComplete() {
                delete this.complete;
              }
              resetError() {
                delete this.error;
              }
            },
            BL = class extends FL {
              constructor(e) {
                super(), (this.sink = e), e.defer(this.bindDispose);
              }
              next(e) {
                this.sink.next(e);
              }
              complete() {
                this.sink.complete();
              }
              error(e) {
                this.sink.error(e);
              }
            };
          function HL(e, t, i) {
            if (VL()) {
              let n = Object.defineProperties(
                Object.setPrototypeOf(e, UL.prototype),
                {
                  streamId: { value: 0, writable: !0, configurable: !0 },
                  name: { value: t, writable: !0, configurable: !0 },
                  args: { value: i, writable: !0, configurable: !0 },
                  id: { value: 0, writable: !0, configurable: !0 },
                },
              );
              WL.create(n);
              for (let e = 0; e < i.length; e++) {
                let t = i[e];
                'function' == typeof t && t instanceof UL && WL.addSource(n, t);
              }
              return n;
            }
            return e;
          }
          function jL(e, t) {
            window.postMessage({
              source: 'fastrx-devtools-backend',
              payload: { event: e, payload: t },
            });
          }
          var GL = class extends BL {
              constructor(e, t, i) {
                super(e),
                  (this.source = t),
                  (this.id = i),
                  (this.sourceId = e.sourceId),
                  this.defer(() => {
                    WL.defer(this.source, this.id);
                  });
              }
              next(e) {
                WL.next(this.source, this.id, e), this.sink.next(e);
              }
              complete() {
                WL.complete(this.source, this.id), this.sink.complete();
              }
              error(e) {
                WL.complete(this.source, this.id, e), this.sink.error(e);
              }
            },
            WL = {
              addSource(e, t) {
                jL('addSource', {
                  id: e.id,
                  name: e.toString(),
                  source: { id: t.id, name: t.toString() },
                });
              },
              next(e, t, i) {
                jL('next', { id: e.id, streamId: t, data: i && i.toString() });
              },
              subscribe(e, t) {
                let { id: i, end: n } = e;
                jL('subscribe', {
                  id: i,
                  end: n,
                  sink: { nodeId: t && t.nodeId, streamId: t && t.streamId },
                });
              },
              complete(e, t, i) {
                jL('complete', {
                  id: e.id,
                  streamId: t,
                  err: i ? i.toString() : null,
                });
              },
              defer(e, t) {
                jL('defer', { id: e.id, streamId: t });
              },
              pipe(e) {
                jL('pipe', {
                  name: e.toString(),
                  id: e.id,
                  source: { id: e.source.id, name: e.source.toString() },
                });
              },
              update(e) {
                jL('update', { id: e.id, name: e.toString() });
              },
              create(e) {
                e.id || (e.id = xL++),
                  jL('create', { name: e.toString(), id: e.id });
              },
            },
            JL = class extends FL {
              constructor(e) {
                super(), (this.source = e), (this.sinks = new Set());
              }
              add(e) {
                e.defer(() => this.remove(e)),
                  1 === this.sinks.add(e).size &&
                    (this.reset(), this.subscribe(this.source));
              }
              remove(e) {
                this.sinks.delete(e), 0 === this.sinks.size && this.dispose();
              }
              next(e) {
                this.sinks.forEach((t) => t.next(e));
              }
              complete() {
                this.sinks.forEach((e) => e.complete()), this.sinks.clear();
              }
              error(e) {
                this.sinks.forEach((t) => t.error(e)), this.sinks.clear();
              }
            };
          var KL,
            YL,
            zL =
              ((KL = class extends BL {
                constructor(e, t, i) {
                  super(e), (this.mapper = t), (this.thisArg = i);
                }
                next(e) {
                  super.next(this.mapper.call(this.thisArg, e));
                }
              }),
              (YL = 'map'),
              function () {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                return (e) => {
                  if (e instanceof UL) {
                    let i = HL(
                      (n) => {
                        let r = new KL(n, ...t);
                        (r.sourceId = i.id), r.subscribe(e);
                      },
                      YL,
                      arguments,
                    );
                    return (i.source = e), WL.pipe(i), i;
                  }
                  return (i) => e(new KL(i, ...t));
                };
              });
          !(function (e) {
            for (
              var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), n = 1;
              n < t;
              n++
            )
              i[n - 1] = arguments[n];
            i.reduce((e, t) => t(e), e);
          })(
            (function (e) {
              return HL(
                (t) => {
                  let i = 0,
                    n = setInterval(() => t.next(i++), e);
                  return (
                    t.defer(() => {
                      clearInterval(n);
                    }),
                    'interval'
                  );
                },
                'interval',
                arguments,
              );
            })(250),
            zL(() => performance.now()),
            (function () {
              return (e) => {
                let t = new JL(e);
                if (e instanceof UL) {
                  let i = HL(
                    (e) => {
                      t.add(e);
                    },
                    'share',
                    arguments,
                  );
                  return (t.sourceId = i.id), (i.source = e), WL.pipe(i), i;
                }
                return HL(t.add.bind(t), 'share', arguments);
              };
            })(),
          );
          var qL = new Map();
          function QL(e, t) {
            let i = eb(ZC({}, t), { timestamp: Eb() });
            qL.has(e) ? qL.get(e).push(i) : qL.set(e, [i]);
          }
          UO.on(BO.JOIN_SUCCESS, (e) => {
            let { room: t } = e;
            QL(t.userId, { eventId: 32788, eventDesc: 'join room' });
          }),
            UO.on(BO.LEAVE_START, (e) => {
              let { room: t } = e;
              QL(t.userId, { eventId: 32789, eventDesc: 'leave room' });
            }),
            UO.on(BO.LOCAL_TRACK_PUBLISHED, (e) => {
              let { track: t } = e;
              if (t.room) {
                let e = 32769;
                4 === t.mediaType
                  ? (e = 32768)
                  : 2 === t.mediaType && (e = 32805),
                  QL(t.room.userId, {
                    eventId: e,
                    eventDesc: 'publish '.concat(t.kind),
                  });
              }
            }),
            UO.on(BO.LOCAL_TRACK_UNPUBLISHED, (e) => {
              let { track: t } = e;
              if (t.room) {
                let e = 32771;
                4 === t.mediaType
                  ? (e = 32770)
                  : 2 === t.mediaType && (e = 32806),
                  QL(t.room.userId, {
                    eventId: e,
                    eventDesc: 'unpublish '.concat(t.kind),
                  });
              }
            }),
            UO.on(BO.TRACK_MUTED, (e) => {
              let { track: t } = e;
              t.room &&
                (t.kind === LN.AUDIO
                  ? QL(t.room.userId, {
                      eventId: t.isRemote ? 32785 : 32772,
                      eventDesc: 'mute audio',
                      remoteUserId: t.isRemote ? t.userId : void 0,
                    })
                  : QL(t.room.userId, {
                      eventId: t.isRemote ? 32784 : 32773,
                      eventDesc: 'mute video',
                      remoteUserId: t.isRemote ? t.userId : void 0,
                    }));
            }),
            UO.on(BO.TRACK_UNMUTED, (e) => {
              let { track: t } = e;
              t.room &&
                (t.kind === LN.AUDIO
                  ? QL(t.room.userId, {
                      eventId: t.isRemote ? 32787 : 32774,
                      eventDesc: 'unmute audio',
                      remoteUserId: t.isRemote ? t.userId : void 0,
                    })
                  : QL(t.room.userId, {
                      eventId: t.isRemote ? 32786 : 32775,
                      eventDesc: 'unmute video',
                      remoteUserId: t.isRemote ? t.userId : void 0,
                    }));
            }),
            UO.on(BO.REMOTE_TRACK_SUBSCRIBED, (e) => {
              let { track: t } = e;
              !t.room ||
                (1 === t.mediaType &&
                  QL(t.room.userId, {
                    eventId: 32777,
                    eventDesc: ''.concat(LN.SUBSCRIBE, ' ').concat(t.kind),
                    remoteUserId: t.userId,
                  }),
                4 === t.mediaType &&
                  QL(t.room.userId, {
                    eventId: 32776,
                    eventDesc: ''.concat(LN.SUBSCRIBE, ' ').concat(t.kind),
                    remoteUserId: t.userId,
                  }),
                8 === t.mediaType &&
                  QL(t.room.userId, {
                    eventId: 32803,
                    eventDesc: ''
                      .concat(LN.SUBSCRIBE, ' ')
                      .concat(LN.SMALL_VIDEO),
                    remoteUserId: t.userId,
                  }));
            }),
            UO.on(BO.REMOTE_TRACK_UNSUBSCRIBED, (e) => {
              let { track: t } = e;
              !t.room ||
                (1 === t.mediaType &&
                  QL(t.room.userId, {
                    eventId: 32779,
                    eventDesc: ''.concat(LN.UNSUBSCRIBE, ' ').concat(t.kind),
                    remoteUserId: t.userId,
                  }),
                4 === t.mediaType &&
                  QL(t.room.userId, {
                    eventId: 32778,
                    eventDesc: ''.concat(LN.UNSUBSCRIBE, ' ').concat(t.kind),
                    remoteUserId: t.userId,
                  }),
                8 === t.mediaType &&
                  QL(t.room.userId, {
                    eventId: 32804,
                    eventDesc: ''
                      .concat(LN.UNSUBSCRIBE, ' ')
                      .concat(LN.SMALL_VIDEO),
                    remoteUserId: t.userId,
                  }));
            }),
            UO.on(BO.SWITCH_DEVICE_SUCCESS, (e) => {
              let { track: t } = e;
              t.room &&
                QL(t.room.userId, {
                  eventId: t.kind === LN.VIDEO ? 32780 : 32781,
                  eventDesc: 'switch '.concat(
                    t.kind === LN.VIDEO ? 'camera' : 'microphone',
                  ),
                });
            }),
            UO.on(BO.LOCAL_TRACK_REPLACED, (e) => {
              let { track: t } = e;
              t.room &&
                QL(t.room.userId, {
                  eventId: t.kind === LN.VIDEO ? 32782 : 32783,
                  eventDesc: 'replace '.concat(t.kind),
                });
            }),
            UO.on(BO.SIGNAL_CONNECTION_STATE_CHANGED, (e) => {
              let t,
                i,
                { room: n, prevState: r, state: o } = e;
              switch (o) {
                case 'CONNECTED':
                  'RECONNECTING' === r
                    ? ((t = 32795), (i = 'signal reconnected'))
                    : ((t = 32791), (i = 'signal connected'));
                  break;
                case 'DISCONNECTED':
                  'RECONNECTING' === r
                    ? ((t = 32796), (i = 'signal reconnect fail'))
                    : ((t = 32790), (i = 'signal disconnected'));
                  break;
                case 'RECONNECTING':
                  (t = 32794), (i = 'signal reconnecting');
              }
              t && i && QL(n.userId, { eventId: t, eventDesc: i });
            }),
            UO.on(BO.PEER_CONNECTION_STATE_CHANGED, (e) => {
              let t,
                i,
                { room: n, prevState: r, state: o, remoteUserId: s } = e,
                a = !!s,
                c = a ? 'downlink' : 'uplink';
              switch (o) {
                case 'CONNECTED':
                  'RECONNECTING' === r
                    ? ((t = a ? 32801 : 32798),
                      (i = ''.concat(c, ' reconnected')))
                    : ((t = a ? 32793 : 32792),
                      (i = ''.concat(c, ' connected')));
                  break;
                case 'DISCONNECTED':
                  'RECONNECTING' === r &&
                    ((t = a ? 32802 : 32799),
                    (i = ''.concat(c, ' reconnect fail')));
                  break;
                case 'RECONNECTING':
                  (t = a ? 32800 : 32797), (i = ''.concat(c, ' reconnecting'));
              }
              t &&
                i &&
                QL(n.userId, { eventId: t, eventDesc: i, remoteUserId: s });
            });
          var XL = nb(cb(), 1),
            $L = class extends XL.EventEmitter {
              constructor(e, t) {
                let i =
                  arguments.length > 2 && void 0 !== arguments[2]
                    ? arguments[2]
                    : 'userId';
                super(),
                  (this.mySelfId = e),
                  (this._log = t),
                  (this.key = i),
                  ob(this, 'userMap', new Map()),
                  ob(this, 'remotePublishedUserMap', new Map());
              }
              getPublishedUser(e) {
                return this.remotePublishedUserMap.get(e);
              }
              addUser(e) {
                let t = e[this.key],
                  { userId: i, tinyId: n, role: r } = e;
                if (this.userMap.has(t)) return;
                let o = {
                  userId: i,
                  tinyId: n,
                  role: 20 === r ? 'anchor' : 'audience',
                };
                this.userMap.set(t, o), this.emit('1', o);
              }
              deleteUser(e, t) {
                let i = this.userMap.get(e);
                if (!i) return;
                let n = 'peer leave ['.concat(e, ']');
                nO(t) || (n += ':'.concat(ND[t])), this._log.info(n);
                let r = this.remotePublishedUserMap.get(e);
                if (r) {
                  let t = r.muteState;
                  (r.flag = 0),
                    this.emit('5', r.userId),
                    this.deleteRemotePublishedUser(e),
                    this.emit('6', {
                      prevMuteState: t,
                      muteState: r.muteState,
                      flag: 0,
                    });
                }
                this.userMap.delete(e), this.emit('2', i.userId);
              }
              setUserList(e) {
                this.userMap.forEach((t) => {
                  e.findIndex((e) => e[this.key] === t[this.key]) < 0 &&
                    this.deleteUser(t[this.key], 0);
                }),
                  e.forEach((e) => {
                    !this.userMap.has(e[this.key]) &&
                      e[this.key] !== this.mySelfId &&
                      this.addUser(e);
                  });
              }
              addRemotePublishedUser(e) {
                this.remotePublishedUserMap.has(e[this.key]) ||
                  this.remotePublishedUserMap.set(e[this.key], e);
              }
              deleteRemotePublishedUser(e) {
                !this.remotePublishedUserMap.has(e) ||
                  this.remotePublishedUserMap.delete(e);
              }
              setRemotePublishedUserList(e) {
                this.remotePublishedUserMap.forEach((t) => {
                  let i = t[this.key];
                  if (e.findIndex((e) => e[this.key] === t[this.key]) < 0) {
                    this._log.info('remote ['.concat(i, '] unpublish'));
                    let e = t.muteState;
                    (t.flag = 0),
                      this.emit('5', t.userId),
                      this.deleteRemotePublishedUser(i),
                      this.emit('6', {
                        prevMuteState: e,
                        muteState: t.muteState,
                        flag: 0,
                      });
                  }
                }),
                  e.forEach((e) => {
                    var t;
                    let i = e[this.key];
                    if (i === this.mySelfId) return;
                    let { flag: n, userId: r, tinyId: o } = e,
                      s = IO(n, r),
                      a =
                        null == (t = this.remotePublishedUserMap.get(i))
                          ? void 0
                          : t.muteState;
                    if (a) {
                      let e = this.remotePublishedUserMap.get(i);
                      e &&
                        e.flag !== n &&
                        ((e.flag = n),
                        this._log.info(
                          'remote publish updated: '.concat(
                            JSON.stringify(e.muteState),
                          ),
                        ),
                        this.emit('6', {
                          prevMuteState: a,
                          muteState: s,
                          flag: n,
                        }));
                    } else
                      this._log.info(
                        'remote publish. state: '.concat(JSON.stringify(s)),
                      ),
                        this.addUser({ userId: r, tinyId: o, role: 20 }),
                        this.emit('3', e),
                        this.emit('6', {
                          prevMuteState: IO(0, r),
                          muteState: s,
                          flag: n,
                        });
                  });
              }
              clear() {
                this.userMap.clear(), this.remotePublishedUserMap.clear();
              }
            };
          var ZL,
            eM = !0,
            tM = {
              SCENE_LIVE: 'live',
              SCENE_RTC: 'rtc',
              ROLE_ANCHOR: 'anchor',
              ROLE_AUDIENCE: 'audience',
              STREAM_TYPE_MAIN: 'main',
              STREAM_TYPE_SUB: 'sub',
              AUDIO_PROFILE_STANDARD: 'standard',
              AUDIO_PROFILE_STANDARD_STEREO: 'standard-stereo',
              AUDIO_PROFILE_HIGH: 'high',
              AUDIO_PROFILE_HIGH_STEREO: 'high-stereo',
              QOS_PREFERENCE_SMOOTH: 'smooth',
              QOS_PREFERENCE_CLEAR: 'clear',
            },
            iM = {
              INVALID_PARAMETER: 5e3,
              INVALID_OPERATION: 5100,
              ENV_NOT_SUPPORTED: 5200,
              DEVICE_ERROR: 5300,
              SERVER_ERROR: 5400,
              OPERATION_FAILED: 5500,
              OPERATION_ABORT: 5998,
              UNKNOWN_ERROR: 5999,
            },
            nM =
              (((ZL = nM || {})[(ZL.INVALID_PARAMETER = 5e3)] =
                'INVALID_PARAMETER'),
              (ZL[(ZL.INVALID_PARAMETER_REQUIRED = 5001)] =
                'INVALID_PARAMETER_REQUIRED'),
              (ZL[(ZL.INVALID_PARAMETER_TYPE = 5002)] =
                'INVALID_PARAMETER_TYPE'),
              (ZL[(ZL.INVALID_PARAMETER_EMPTY = 5003)] =
                'INVALID_PARAMETER_EMPTY'),
              (ZL[(ZL.INVALID_PARAMETER_INSTANCE = 5004)] =
                'INVALID_PARAMETER_INSTANCE'),
              (ZL[(ZL.INVALID_PARAMETER_RANGE = 5005)] =
                'INVALID_PARAMETER_RANGE'),
              (ZL[(ZL.INVALID_PARAMETER_LESS_THAN_ZERO = 5006)] =
                'INVALID_PARAMETER_LESS_THAN_ZERO'),
              (ZL[(ZL.INVALID_PARAMETER_MIN = 5007)] = 'INVALID_PARAMETER_MIN'),
              (ZL[(ZL.INVALID_PARAMETER_MAX = 5008)] = 'INVALID_PARAMETER_MAX'),
              (ZL[(ZL.INVALID_ELEMENT_ID = 5009)] = 'INVALID_ELEMENT_ID'),
              (ZL[(ZL.INVALID_ELEMENT_ID_TYPE = 5010)] =
                'INVALID_ELEMENT_ID_TYPE'),
              (ZL[(ZL.INVALID_STREAM_ID = 5011)] = 'INVALID_STREAM_ID'),
              (ZL[(ZL.INVALID_ROOM_ID_STRING = 5012)] =
                'INVALID_ROOM_ID_STRING'),
              (ZL[(ZL.INVALID_ROOM_ID_INTEGER = 5013)] =
                'INVALID_ROOM_ID_INTEGER'),
              (ZL[(ZL.INVALID_STREAM_TYPE = 5014)] = 'INVALID_STREAM_TYPE'),
              (ZL[(ZL.INVALID_ROOM_ID_REQUIED = 5015)] =
                'INVALID_ROOM_ID_REQUIED'),
              (ZL[(ZL.INVALID_ROOM_ID_INTEGER_STRING = 5016)] =
                'INVALID_ROOM_ID_INTEGER_STRING'),
              (ZL[(ZL.INVALID_OPERATION = 5100)] = 'INVALID_OPERATION'),
              (ZL[(ZL.INVALID_OPERATION_NOT_JOINED = 5101)] =
                'INVALID_OPERATION_NOT_JOINED'),
              (ZL[(ZL.INVALID_OPERATION_REMOTE_USER_NOT_EXIST = 5102)] =
                'INVALID_OPERATION_REMOTE_USER_NOT_EXIST'),
              (ZL[(ZL.INVALID_OPERATION_STREAM_TYPE_NOT_EXIST = 5103)] =
                'INVALID_OPERATION_STREAM_TYPE_NOT_EXIST'),
              (ZL[(ZL.INVALID_OPERATION_REPEAT_CALL = 5104)] =
                'INVALID_OPERATION_REPEAT_CALL'),
              (ZL[(ZL.INVALID_OPERATION_NEED_VIDEO = 5105)] =
                'INVALID_OPERATION_NEED_VIDEO'),
              (ZL[(ZL.INVALID_OPERATION_NEED_AUDIO = 5106)] =
                'INVALID_OPERATION_NEED_AUDIO'),
              (ZL[(ZL.ENV_NOT_SUPPORTED = 5200)] = 'ENV_NOT_SUPPORTED'),
              (ZL[(ZL.NOT_SUPPORTED_HTTP = 5201)] = 'NOT_SUPPORTED_HTTP'),
              (ZL[(ZL.NOT_SUPPORTED_WEBRTC = 5202)] = 'NOT_SUPPORTED_WEBRTC'),
              (ZL[(ZL.NOT_SUPPORTED_H264_ENCODE = 5203)] =
                'NOT_SUPPORTED_H264_ENCODE'),
              (ZL[(ZL.NOT_SUPPORTED_H264_DECODE = 5204)] =
                'NOT_SUPPORTED_H264_DECODE'),
              (ZL[(ZL.NOT_SUPPORTED_SCREEN_SHARE = 5205)] =
                'NOT_SUPPORTED_SCREEN_SHARE'),
              (ZL[(ZL.NOT_SUPPORTED_SMALL_VIDEO = 5206)] =
                'NOT_SUPPORTED_SMALL_VIDEO'),
              (ZL[(ZL.NOT_SUPPORTED_SEI = 5207)] = 'NOT_SUPPORTED_SEI'),
              (ZL[(ZL.NOT_SUPPORTED_WEBGL = 5208)] = 'NOT_SUPPORTED_WEBGL'),
              (ZL[(ZL.NOT_SUPPORTED_CHROME_VERSION = 5209)] =
                'NOT_SUPPORTED_CHROME_VERSION'),
              (ZL[(ZL.DEVICE_ERROR = 5300)] = 'DEVICE_ERROR'),
              (ZL[(ZL.DEVICE_NOT_FOUND_ERROR = 5301)] =
                'DEVICE_NOT_FOUND_ERROR'),
              (ZL[(ZL.DEVICE_NOT_ALLOWED_ERROR = 5302)] =
                'DEVICE_NOT_ALLOWED_ERROR'),
              (ZL[(ZL.DEVICE_NOT_READABLE_ERROR = 5303)] =
                'DEVICE_NOT_READABLE_ERROR'),
              (ZL[(ZL.DEVICE_OVERCONSTRAINED_ERROR = 5304)] =
                'DEVICE_OVERCONSTRAINED_ERROR'),
              (ZL[(ZL.DEVICE_INVALID_STATE_ERROR = 5305)] =
                'DEVICE_INVALID_STATE_ERROR'),
              (ZL[(ZL.DEVICE_SECURITY_ERROR = 5306)] = 'DEVICE_SECURITY_ERROR'),
              (ZL[(ZL.DEVICE_ABORT_ERROR = 5307)] = 'DEVICE_ABORT_ERROR'),
              (ZL[(ZL.CAMERA_RECOVER_FAILED = 5308)] = 'CAMERA_RECOVER_FAILED'),
              (ZL[(ZL.MICROPHONE_RECOVER_FAILED = 5309)] =
                'MICROPHONE_RECOVER_FAILED'),
              (ZL[(ZL.SERVER_ERROR = 5400)] = 'SERVER_ERROR'),
              (ZL[(ZL.NEED_TO_BUY = 5401)] = 'NEED_TO_BUY'),
              (ZL[(ZL.ACCOUNT_NO_MONEY = -100013)] = 'ACCOUNT_NO_MONEY'),
              (ZL[(ZL.OPERATION_FAILED = 5500)] = 'OPERATION_FAILED'),
              (ZL[(ZL.FIREWALL_RESTRICTION = 5501)] = 'FIREWALL_RESTRICTION'),
              (ZL[(ZL.REJOIN_FAILED = 5502)] = 'REJOIN_FAILED'),
              (ZL[(ZL.EVENT_HANDLER_ERROR = 5503)] = 'EVENT_HANDLER_ERROR'),
              (ZL[(ZL.VIDEO_CONTEXT_ERROR = 5504)] = 'VIDEO_CONTEXT_ERROR'),
              (ZL[(ZL.OPERATION_ABORT = 5998)] = 'OPERATION_ABORT'),
              (ZL[(ZL.UNKNOWN_ERROR = 5999)] = 'UNKNOWN_ERROR'),
              ZL);
          var rM = eb(ZC({}, YO), {
            INVALID_PARAMETER(e) {
              let { fnName: t } = e;
              return "the parameters of the '".concat(
                t,
                "' you called does not meet the requirements, please check the API documentation.",
              );
            },
            INVALID_PARAMETER_REQUIRED(e) {
              let { key: t, rule: i, fnName: n, value: r } = e;
              return "'"
                .concat(t || i.name, "' is a required param when calling ")
                .concat(n, '(), received: ')
                .concat(r, '.');
            },
            INVALID_PARAMETER_TYPE(e) {
              let { key: t, rule: i, fnName: n, value: r } = e,
                o = ''.concat(t || i.name),
                s = '';
              return (
                (s = Array.isArray(i.type) ? i.type.join('|') : i.type),
                "'"
                  .concat(o, "' must be type of ")
                  .concat(s, ' when calling ')
                  .concat(n, '(), received type: ')
                  .concat(tO(r), '.')
              );
            },
            INVALID_PARAMETER_EMPTY(e) {
              let { key: t, rule: i, fnName: n, value: r } = e;
              return "'"
                .concat(t || i.name, "' cannot be '")
                .concat(r, "' when calling ")
                .concat(n, '().');
            },
            INVALID_PARAMETER_INSTANCE(e) {
              let { key: t, rule: i, fnName: n, value: r } = e,
                o = ''.concat(t || i.name),
                s = ''.concat(i.instanceOf.name || i.instanceOf);
              return "'"
                .concat(o, "' must be instanceof ")
                .concat(s, ' when calling ')
                .concat(n, '(), received type: ')
                .concat(tO(r), '.');
            },
            INVALID_PARAMETER_RANGE(e) {
              let { key: t, rule: i, fnName: n, value: r } = e;
              return "'"
                .concat(t || i.name, "' must be one of ")
                .concat(i.values.join('|'), ' when calling ')
                .concat(n, '(), received: ')
                .concat(r, '.');
            },
            INVALID_PARAMETER_LESS_THAN_ZERO(e) {
              let { key: t, rule: i, fnName: n } = e;
              return "'"
                .concat(t || i.name, "' cannot be less than 0 when calling ")
                .concat(n, '().');
            },
            INVALID_PARAMETER_MIN(e) {
              let { key: t, rule: i, value: n } = e;
              return 'the min value of '
                .concat(t || i.name, ' is ')
                .concat(i.min, ', received: ')
                .concat(n, '.');
            },
            INVALID_PARAMETER_MAX(e) {
              let { key: t, rule: i, value: n } = e;
              return 'the max value of '
                .concat(t || i.name, ' is ')
                .concat(i.max, ', received: ')
                .concat(n, '.');
            },
            INVALID_ELEMENT_ID(e) {
              let { key: t, fnName: i } = e;
              return "'"
                .concat(
                  t,
                  "' is not found in the document object when calling ",
                )
                .concat(i, '().');
            },
            INVALID_ELEMENT_ID_TYPE(e) {
              let { key: t, fnName: i, type: n } = e;
              return "the element corresponding to '"
                .concat(t, "' must be instanceof HTMLElement when calling ")
                .concat(i, '(), received: ')
                .concat(n, '.');
            },
            INVALID_STREAM_ID(e) {
              let { key: t } = e;
              return "'".concat(
                t,
                "' can only consist of uppercase and lowercase english letters (a-zA-Z), numbers (0-9), hyphens and underscores.",
              );
            },
            INVALID_ROOM_ID_STRING(e) {
              let { key: t } = e;
              return "'".concat(t, "' must be a valid string.");
            },
            INVALID_ROOM_ID_INTEGER(e) {
              let { key: t } = e;
              return "'".concat(
                t,
                "' must be an integer between [1, 4294967294].",
              );
            },
            INVALID_ROOM_ID_INTEGER_STRING(e) {
              let { key: t } = e;
              return "'".concat(
                t,
                "' must be an integer but go a string, use 'parseInt' to convert it or use 'strRoomId' instead.",
              );
            },
            INVALID_ROOM_ID_REQUIED: () =>
              "at least one of 'roomId'(between [1, 4294967294]) and 'strRoomId'(not empty) is required.",
            INVALID_STREAM_TYPE: (e) => {
              let { fnName: t } = e;
              return "'streamType' is required when 'userId' is not '*', calling ".concat(
                t,
                '()',
              );
            },
            INVALID_IMAGE_URL:
              "The 'src' param must be filled in when the background type is image.",
            INVALID_OPERATION(e) {
              let { fnName: t } = e;
              return "the API '".concat(
                t,
                "' you called does not meet the requirements, please check the API documentation.",
              );
            },
            INVALID_OPERATION_NOT_JOINED(e) {
              let { fnName: t } = e;
              return 'cannot '.concat(
                t,
                ' because you are not enter room yet.',
              );
            },
            INVALID_OPERATION_REMOTE_USER_NOT_EXIST(e) {
              let { fnName: t, value: i } = e;
              return 'cannot '
                .concat(t, ' because remote user(userId: ')
                .concat(i.userId, ') does not publishing stream.');
            },
            INVALID_OPERATION_STREAM_TYPE_NOT_EXIST(e) {
              let { fnName: t, value: i } = e;
              return 'cannot '
                .concat(t, ' because remote user(userId: ')
                .concat(i.userId, ') does not publishing ')
                .concat(i.streamType, ' video.');
            },
            INVALID_OPERATION_REPEAT_CALL(e) {
              let { fnName: t } = e;
              return 'you are already '
                .concat(t, "(), cannot repeated call '")
                .concat(t, "'.");
            },
            INVALID_OPERATION_NEED_VIDEO(e) {
              let { fnName: t } = e;
              return "cannot call '".concat(
                t,
                "' because the camera is not turned on.",
              );
            },
            INVALID_OPERATION_NEED_AUDIO(e) {
              let { fnName: t } = e;
              return "cannot call '".concat(
                t,
                "' because the microphone is not turned on.",
              );
            },
            ENV_NOT_SUPPORTED(e) {
              let { fnName: t } = e;
              return "the current browser does not support the capability of the function '".concat(
                t,
                "' you are calling, please check the API documentation.",
              );
            },
            NOT_SUPPORTED_WEBRTC:
              'the current browser does not support WebRTC capability, please check the SDK documentation.',
            NOT_SUPPORTED_H264_ENCODE:
              'this browser does not support H264 encode.',
            NOT_SUPPORTED_H264_DECODE:
              'this browser does not support H264 decode.',
            NOT_SUPPORTED_SCREEN_SHARE:
              'this browser does not support screen share, please check the browser version.',
            NOT_SUPPORTED_SMALL_VIDEO:
              'this browser does not support small video, please check the browser version.',
            NOT_SUPPORTED_SEI:
              'this browser does not support SEI, please check the browser version.',
            NOT_SUPPORTED_WEBGL:
              'this browser does not support WebGL, please check the browser version.',
            NOT_SUPPORTED_CHROME_VERSION(e) {
              let { fnName: t } = e;
              return 'cannot call '.concat(
                t,
                ' because the browser version is too low, please upgrade to the latest version',
              );
            },
            DEVICE_ERROR(e) {
              let { fnName: t, error: i } = e;
              return "'"
                .concat(t, "' got device exception")
                .concat(i ? ', error: '.concat(i.toString(), '.') : '.');
            },
            DEVICE_NOT_FOUND_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'NotFoundError, no '
                .concat(
                  i,
                  " detected, please check your device and the configuration on '",
                )
                .concat(t, "'")
                .concat(n ? ', error: '.concat(n.toString(), '.') : '.');
            },
            DEVICE_NOT_ALLOWED_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'NotAllowedError, you have disabled '
                .concat(
                  i,
                  ' access, please allow the current application to use the ',
                )
                .concat(i)
                .concat(n ? ', error: '.concat(n.toString(), '.') : '.');
            },
            DEVICE_NOT_READABLE_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'NotReadableError, the '.concat(
                i,
                ' maybe in use by another APP, please check if the device is pre-occupied by another APP.',
              );
            },
            DEVICE_OVERCONSTRAINED_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'OverconstrainedError, the device ID is incorrect, please check whether the device ID passed in is correct'.concat(
                n ? ', error: '.concat(n.toString(), '.') : '.',
              );
            },
            DEVICE_INVALID_STATE_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'InvalidStateError, after the user clicks and interacts with the page, turn on the '
                .concat(i)
                .concat(n ? ', error: '.concat(n.toString(), '.') : '.');
            },
            DEVICE_SECURITY_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'SecurityError, check whether the system security policy restricts the use of the '
                .concat(i, ', and it is recommended to turn on the ')
                .concat(i, ' after the user interacts with the page')
                .concat(n ? ', error: '.concat(n.toString(), '.') : '.');
            },
            DEVICE_ABORT_ERROR(e) {
              let { fnName: t, deviceType: i = oM(t), error: n } = e;
              return 'AbortError, an unknown exception in the system makes the device unusable, recommended to change the device or browser and re-check whether the device is normal'.concat(
                n ? ' error: '.concat(n.toString(), '.') : '.',
              );
            },
            CAMERA_RECOVER_FAILED(e) {
              let { error: t } = e;
              return 'camera recover capture failed '
                .concat((null == t ? void 0 : t.name) || '', ': ')
                .concat(
                  (null == t ? void 0 : t.originMessage) ||
                    (null == t ? void 0 : t.message),
                );
            },
            MICROPHONE_RECOVER_FAILED(e) {
              let { error: t } = e;
              return 'microphone recover capture failed '
                .concat((null == t ? void 0 : t.name) || '', ': ')
                .concat(
                  (null == t ? void 0 : t.originMessage) ||
                    (null == t ? void 0 : t.message),
                );
            },
            OPERATION_FAILED(e) {
              let { fnName: t, error: i } = e;
              return "'"
                .concat(t, "' failed, reason: ")
                .concat(null == i ? void 0 : i.toString());
            },
            FIREWALL_RESTRICTION: () =>
              'media connection failure due to firewall restrictions, please try to change your network.',
            EVENT_HANDLER_ERROR(e) {
              let { eventName: t } = e;
              return "an error was caught on trtc.on('".concat(
                t,
                "', handler), please check your code on 'handler'.",
              );
            },
            VIDEO_CONTEXT_ERROR(e) {
              let { reason: t, error: i } = e;
              return 'video context error '
                .concat(t, ' ')
                .concat((null == i ? void 0 : i.name) || '', ' ')
                .concat((null == i ? void 0 : i.message) || '');
            },
            SERVER_ERROR(e) {
              let { fnName: t, error: i } = e;
              return "'"
                .concat(t, "' got server error: ")
                .concat(
                  null == i ? void 0 : i.toString(),
                  ', please check the SDK documentation.',
                );
            },
            NEED_TO_BUY(e) {
              let { value: t, url: i } = e;
              return 'You need to buy packages for '
                .concat(t, '. Refer to: ')
                .concat(i);
            },
            ACCOUNT_NO_MONEY: (e) => {
              let { fnParams: t } = e;
              return 'your TRTC account run out of credit, please recharge.'.concat(
                t.sdkAppId ? ' SDKAppId: '.concat(t.sdkAppId) : '',
              );
            },
            OPERATION_ABORT(e) {
              let { fnName: t } = e;
              return "'".concat(t, "' abort");
            },
            UNKNOWN_ERROR(e) {
              let { fnName: t, error: i } = e;
              return "'"
                .concat(t, "' throw unknown exception")
                .concat(i ? ', error: '.concat(i.toString(), '.') : '.');
            },
          });
          function oM(e) {
            if (!e) return 'camera';
            let t = e.toLowerCase();
            return t.includes('screen')
              ? 'screen share'
              : t.includes('audio')
              ? 'microphone'
              : 'camera';
          }
          var sM = class extends Error {
            constructor(e) {
              let {
                code: t,
                extraCode: i,
                message: n = '',
                messageParams: r,
                fnName: o = '',
                originError: s,
              } = e;
              var a;
              let c;
              (c =
                n ||
                (function (e) {
                  let t,
                    { code: i, params: n, enableDocLink: r = !1 } = e,
                    s = '',
                    a = nM[i];
                  try {
                    t = rM[a];
                  } catch (o) {
                    t = rM.UNKNOWN_ERROR;
                  }
                  return (
                    iO(t) ? (s = t(n)) : rO(t) && (s = t),
                    r && (s += ' doc:'),
                    s
                  );
                })({ code: i || t, params: ZC({ fnName: o, error: s }, r) })),
                super(c),
                ob(this, 'name', 'RtcError'),
                ob(this, 'code'),
                ob(this, 'extraCode'),
                ob(this, 'functionName'),
                ob(this, 'message'),
                ob(this, 'handler'),
                ob(this, 'originError'),
                (this.name = nM[t]),
                (this.code = t),
                (this.extraCode = i),
                (this.functionName = o),
                (this.originError = s),
                (this.message = c),
                5302 === this.extraCode &&
                  (null == (a = this.originError)
                    ? void 0
                    : a.message.includes('system')) &&
                  (this.handler = () => {
                    let e = document.createElement('a');
                    _k
                      ? (e.href = 'ms-settings:privacy-'.concat(
                          {
                            startLocalVideo: 'webcam',
                            startLocalAudio: 'microphone',
                          }[this.functionName],
                        ))
                      : mk &&
                        (e.href =
                          'x-apple.systempreferences:com.apple.preference.security?Privacy_'.concat(
                            {
                              startLocalVideo: 'Camera',
                              startLocalAudio: 'Microphone',
                              startScreenShare: 'ScreenCapture',
                            }[this.functionName],
                          )),
                      e.href.length > 0 && e.click();
                  });
            }
            static convertFrom(e, t, i) {
              let n = e;
              if (e instanceof gb) {
                let { stack: r } = e,
                  o = { code: iM.UNKNOWN_ERROR, fnName: t, originError: e };
                switch (e.getCode()) {
                  case mb.INVALID_PARAMETER:
                    o.code = iM.INVALID_PARAMETER;
                    break;
                  case mb.INVALID_OPERATION:
                    o.code = iM.INVALID_OPERATION;
                    break;
                  case mb.NOT_SUPPORTED:
                  case mb.NOT_SUPPORTED_H264:
                    (o.code = iM.ENV_NOT_SUPPORTED),
                      e.getCode() === mb.NOT_SUPPORTED_H264 &&
                        (o.extraCode = e.message.includes(
                          YO.NOT_SUPPORTED_H264ENCODE,
                        )
                          ? 5203
                          : 5204);
                    break;
                  case mb.DEVICE_NOT_FOUND:
                  case mb.DEVICE_AUTO_RECOVER_FAILED:
                    o.code = iM.DEVICE_ERROR;
                    break;
                  case mb.JOIN_ROOM_FAILED:
                    o.messageParams = { fnParams: i };
                  case mb.SERVER_TIMEOUT:
                  case mb.SWITCH_ROLE_FAILED:
                    (o.code = iM.SERVER_ERROR),
                      (o.extraCode = e.getExtraCode());
                    break;
                  case mb.API_CALL_ABORTED:
                    o.code = iM.OPERATION_ABORT;
                    break;
                  case mb.INITIALIZE_FAILED:
                    (o.code = 5300),
                      (o.extraCode = (function (e) {
                        let t;
                        switch (e) {
                          case 'NotFoundError':
                            t = 5301;
                            break;
                          case 'NotAllowedError':
                            t = 5302;
                            break;
                          case 'NotReadableError':
                            t = 5303;
                            break;
                          case 'OverconstrainedError':
                            t = 5304;
                            break;
                          case 'InvalidStateError':
                            t = 5305;
                            break;
                          case 'SecurityError':
                            t = 5306;
                            break;
                          case 'AbortError':
                            t = 5307;
                            break;
                          default:
                            t = 5300;
                        }
                        return t;
                      })(e.name));
                    break;
                  case mb.UNKNOWN:
                    break;
                  default:
                    o.code = iM.OPERATION_FAILED;
                }
                (n = new sM(o)), r && (n.stack += r.substr(r.indexOf('\n')));
              } else {
                if (e instanceof sM) return e;
                n = new sM({
                  code: iM.UNKNOWN_ERROR,
                  fnName: t,
                  originError: e,
                });
              }
              return n;
            }
          };
          var aM = sM,
            cM = {
              type: 'object',
              properties: {
                cameraId: { type: 'string' },
                useFrontCamera: { type: 'boolean' },
                fillMode: {
                  type: 'string',
                  values: ['contain', 'cover', 'fill'],
                },
                mirror: { type: 'boolean' },
                small: {
                  properties: {
                    width: { type: 'number' },
                    height: { type: 'number' },
                    frameRate: { type: 'number' },
                    bitrate: { type: 'number' },
                  },
                },
                videoTrack: { instanceOf: MediaStreamTrack },
              },
            },
            lM = {
              type: 'object',
              properties: {
                systemAudio: { type: 'boolean' },
                fillMode: {
                  type: 'string',
                  values: ['contain', 'cover', 'fill'],
                },
                profile: {
                  type: ['string', 'object'],
                  properties: {
                    width: { type: 'number' },
                    height: { type: 'number' },
                    frameRate: { type: 'number' },
                    bitrate: { type: 'number' },
                  },
                },
                videoTrack: { instanceOf: MediaStreamTrack },
                audioTrack: { instanceOf: MediaStreamTrack },
              },
            },
            dM = {
              type: ['string', HTMLElement, null, 'array'],
              arrayItem: { instanceOf: HTMLElement },
              validate(e, t, i) {
                if (rO(e)) {
                  let n = document.getElementById(e);
                  if (!n)
                    throw new aM({
                      code: iM.INVALID_PARAMETER,
                      extraCode: 5009,
                      fnName: i,
                      messageParams: { key: t },
                    });
                  if (!(n instanceof HTMLElement))
                    throw new aM({
                      code: iM.INVALID_PARAMETER,
                      extraCode: 5010,
                      fnName: i,
                      messageParams: { key: t, type: tO(n) },
                    });
                }
              },
            },
            uM = { name: 'userId', required: !0, type: 'string' },
            hM = {
              type: 'object',
              properties: {
                microphoneId: { type: 'string' },
                audioTrack: { instanceOf: MediaStreamTrack },
                captureVolume: { type: 'number', min: 0 },
                earMonitorVolume: { type: 'number', min: 0, max: 100 },
                echoCancellation: { type: 'boolean' },
                autoGainControl: { type: 'boolean' },
                noiseSuppression: { type: 'boolean' },
              },
            };
          function pM(e, t) {
            if (!e)
              throw new aM({
                code: iM.INVALID_OPERATION,
                extraCode: 5101,
                fnName: t,
              });
          }
          function _M(e, t, i) {
            if (!e)
              throw new aM({
                code: iM.INVALID_OPERATION,
                extraCode: 5102,
                fnName: t,
                messageParams: { value: i },
              });
          }
          var mM = {
              create: [
                { name: 'RoomConfig', instanceOf: Function },
                {
                  name: 'CreateConfig',
                  type: 'object',
                  properties: {
                    plugins: {
                      type: 'array',
                      arrayItem: { instanceOf: Function },
                    },
                  },
                },
              ],
              enterRoom: {
                name: 'EnterRoomConfig',
                type: 'object',
                required: !0,
                validate(e, t, i) {
                  if (this._room.isJoined)
                    throw new aM({
                      code: iM.INVALID_OPERATION,
                      extraCode: 5104,
                      fnName: i,
                    });
                  if (e.roomId) {
                    if (rO(e.roomId))
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        extraCode: 5016,
                        fnName: i,
                        messageParams: { key: t },
                      });
                    if (
                      !(
                        /^[1-9]\d*$/.test(String(e.roomId)) &&
                        e.roomId < 4294967295
                      )
                    )
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        extraCode: 5013,
                        fnName: i,
                        messageParams: { key: t },
                      });
                  } else {
                    if (!e.strRoomId)
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        extraCode: 5015,
                        fnName: i,
                      });
                    if (
                      !/^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(
                        e.strRoomId,
                      )
                    )
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        extraCode: 5012,
                        fnName: i,
                        messageParams: { key: t },
                      });
                  }
                },
                properties: {
                  sdkAppId: { required: !0, type: 'number', allowEmpty: !1 },
                  userId: { required: !0, type: 'string', allowEmpty: !1 },
                  userSig: { required: !0, type: 'string', allowEmpty: !1 },
                  scene: { type: 'string', values: ['live', 'rtc'] },
                  role: { type: 'string', values: ['audience', 'anchor'] },
                  roomId: { type: ['string', 'number'] },
                  strRoomId: { type: 'string' },
                  proxy: {
                    type: ['object', 'string'],
                    properties: {
                      websocketProxy: { type: 'string' },
                      turnServer: {
                        type: ['object', 'array'],
                        properties: {
                          url: { required: !0, type: 'string' },
                          username: { type: 'string' },
                          credential: { type: 'string' },
                          credentialType: {
                            type: 'string',
                            values: ['password'],
                          },
                        },
                      },
                      loggerProxy: { type: 'string' },
                      webtransportProxy: { type: 'string' },
                    },
                  },
                  enableAutoPlayDialog: { type: 'boolean' },
                  userDefineRecordId: { type: 'string' },
                },
              },
              startLocalVideo: {
                name: 'LocalVideoConfig',
                type: 'object',
                properties: {
                  view: dM,
                  publish: { type: 'boolean' },
                  option: cM,
                },
                validate(e) {
                  var t;
                  if (
                    (null == (t = null == e ? void 0 : e.option) ||
                      !t.videoTrack) &&
                    rw()
                  )
                    throw new aM({
                      code: iM.ENV_NOT_SUPPORTED,
                      extraCode: 5201,
                    });
                },
              },
              updateLocalVideo: {
                name: 'updateLocalVideoConfig',
                type: 'object',
                required: !0,
                properties: {
                  view: eb(ZC({}, dM), { required: !1 }),
                  publish: { type: 'boolean' },
                  mute: { type: 'boolean' },
                  option: cM,
                },
              },
              startLocalAudio: {
                name: 'LocalAudioConfig',
                type: 'object',
                properties: { publish: { type: 'boolean' }, option: hM },
                validate(e) {
                  var t;
                  if (
                    (null == (t = null == e ? void 0 : e.option) ||
                      !t.audioTrack) &&
                    rw()
                  )
                    throw new aM({
                      code: iM.ENV_NOT_SUPPORTED,
                      extraCode: 5201,
                    });
                },
              },
              updateLocalAudio: {
                name: 'updateLocalAudioConfig',
                type: 'object',
                required: !0,
                properties: {
                  publish: { type: 'boolean' },
                  mute: { type: 'boolean' },
                  option: hM,
                },
              },
              startScreenShare: {
                name: 'ScreenShareConfig',
                type: 'object',
                properties: {
                  view: dM,
                  publish: { type: 'boolean' },
                  option: lM,
                },
                validate(e, t, i, n, r) {
                  var o;
                  if (
                    (null == (o = null == e ? void 0 : e.option) ||
                      !o.videoTrack) &&
                    rw()
                  )
                    throw new aM({
                      code: iM.ENV_NOT_SUPPORTED,
                      extraCode: 5201,
                    });
                  if (!dw())
                    throw new aM({
                      code: iM.ENV_NOT_SUPPORTED,
                      fnName: i,
                      extraCode: 5205,
                    });
                },
              },
              updateScreenShare: {
                name: 'updateScreenShareConfig',
                type: 'object',
                required: !0,
                properties: {
                  view: dM,
                  publish: { type: 'boolean' },
                  option: lM,
                },
              },
              muteRemoteAudio: [
                uM,
                { name: 'mute', required: !0, type: 'boolean' },
              ],
              setRemoteAudioVolume: [
                uM,
                { name: 'volume', required: !0, type: 'number', min: 0 },
              ],
              startRemoteVideo: {
                name: 'startRemoteVideoConfig',
                type: 'object',
                required: !0,
                properties: {
                  view: dM,
                  userId: { type: 'string', required: !0 },
                  streamType: { values: ['main', 'sub'], required: !0 },
                  option: {
                    type: 'object',
                    properties: {
                      fillMode: {
                        type: 'string',
                        values: ['contain', 'cover', 'fill'],
                      },
                      mirror: { type: 'boolean' },
                    },
                  },
                },
                validate(e, t, i) {
                  pM(this._room.isJoined, i);
                  let n = this._room.remotePublishedUserMap.get(e.userId);
                  if (
                    (_M(!!n, i, e),
                    n &&
                      (('main' === e.streamType &&
                        !n.muteState.videoAvailable) ||
                        ('sub' === e.streamType && !n.muteState.hasAuxiliary)))
                  )
                    throw new aM({
                      code: iM.INVALID_OPERATION,
                      extraCode: 5103,
                      fnName: i,
                      messageParams: { value: e },
                    });
                },
              },
              updateRemoteVideo: {
                name: 'updateRemoteVideoConfig',
                type: 'object',
                required: !0,
                properties: {
                  view: eb(ZC({}, dM), { required: !1 }),
                  userId: { type: 'string', required: !0 },
                  streamType: { values: ['main', 'sub'], required: !0 },
                  option: {
                    type: 'object',
                    properties: {
                      fillMode: {
                        type: 'string',
                        values: ['contain', 'cover', 'fill'],
                      },
                      mirror: { type: 'boolean' },
                    },
                  },
                },
                validate(e, t, i) {
                  pM(this._room.isJoined, i);
                  let n = this._room.remotePublishedUserMap.get(e.userId);
                  if (
                    (_M(!!n, i, e),
                    n &&
                      (('main' === e.streamType &&
                        !n.muteState.videoAvailable) ||
                        ('sub' === e.streamType && !n.muteState.hasAuxiliary)))
                  )
                    throw new aM({
                      code: iM.INVALID_OPERATION,
                      extraCode: 5103,
                      fnName: i,
                      messageParams: { value: e },
                    });
                },
              },
              stopRemoteVideo: {
                name: 'stopRemoteVideoConfig',
                type: 'object',
                required: !0,
                properties: {
                  userId: { type: 'string', required: !0 },
                  streamType: { values: ['main', 'sub'] },
                },
                validate(e, t, i) {
                  if ('*' !== e.userId && nO(e.streamType))
                    throw new aM({
                      code: iM.INVALID_PARAMETER,
                      extraCode: 5014,
                      fnName: i,
                    });
                },
              },
              switchRole: {
                name: 'role',
                required: !0,
                values: ['anchor', 'audience'],
                validate(e, t, i) {
                  pM(this._room.isJoined, i);
                },
              },
              enableAudioVolumeEvaluation: [
                { name: 'interval', type: 'number' },
                { name: 'enableInBackground', type: 'boolean' },
              ],
              sendSEIMessage: [
                {
                  name: 'buffer',
                  required: !0,
                  instanceOf: ArrayBuffer,
                  validate(e, t, i, n) {
                    if (!Nw)
                      throw new aM({
                        code: iM.ENV_NOT_SUPPORTED,
                        fnName: i,
                        extraCode: 5207,
                      });
                    if (!this._room.enableSEI)
                      throw new aM({
                        code: iM.INVALID_OPERATION,
                        messageParams: { key: KO.SEI_DISABLED },
                      });
                    if (e.byteLength > 1e3)
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        messageParams: {
                          key: KO.SEI_OVERSIZE,
                          data: e.byteLength,
                        },
                      });
                    if (0 === e.byteLength)
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        messageParams: { key: KO.SEI_EMPTY },
                      });
                    if (
                      (pM(this._room.isJoined, i),
                      !this._room.isMainStreamPublished)
                    )
                      throw new aM({
                        code: iM.INVALID_PARAMETER,
                        messageParams: { key: KO.SEI_BEFORE_PUBLISH },
                      });
                  },
                },
                {
                  name: 'options',
                  type: 'object',
                  properties: {
                    seiPayloadType: { type: 'number', values: [5, 243] },
                  },
                },
              ],
            },
            fM = { TRTC: mM },
            gM = class extends Error {};
          function TM(e, t) {
            let i = CO(e);
            for (let n = 0; n < t.length; n++) RO(i[n], t[n]);
            return i;
          }
          function EM(e) {
            this._resolve = Promise.resolve(e);
          }
          function SM(e) {
            this._reject = Promise.reject(e);
          }
          var IM = class {
              constructor(e, t) {
                (this.instance = e),
                  (this.group = t),
                  ob(this, 'started', !1),
                  ob(this, 'ops', []),
                  ob(this, 'startSame', () => !0),
                  ob(this, 'mergeUpdate', TM);
                let i = IM.instances.get(e);
                i ? i.set(t, this) : IM.instances.set(e, new Map([[t, this]]));
              }
              static get(e, t) {
                let i = IM.instances.get(e);
                return (i && i.get(t)) || new IM(e, t);
              }
              action(e, t, i) {
                let n = (t) => {
                    var i;
                    return (
                      0 === e
                        ? (this.started = !0)
                        : 3 === e && (this.started = !1),
                      this.ops.shift(),
                      null == (i = this.currentOp) || i.action(),
                      t
                    );
                  },
                  r = (t) => {
                    var i, n;
                    throw (
                      (this.ops.shift(),
                      0 === e &&
                        2 ===
                          (null == (i = this.currentOp) ? void 0 : i.type) &&
                        this.ops.shift().reject(new gM('start failed')),
                      null == (n = this.currentOp) || n.action(),
                      t)
                    );
                  },
                  o = {
                    type: e,
                    action: () => t(...o.args).then(n, r),
                    args: i,
                    resolve: EM,
                    reject: SM,
                  };
                try {
                  switch (this.state) {
                    case 1:
                      if (0 === e) throw new gM('already started');
                      break;
                    case 4:
                      if (2 === e) throw new gM('not started');
                      break;
                    default:
                      return this.cacheOp(o);
                  }
                } catch (s) {
                  return Promise.reject(s);
                }
                return this.ops.push(o), (o.promise = t(...o.args).then(n, r));
              }
              cacheOp(e) {
                if (1 === this.ops.length)
                  switch (this.state) {
                    case 0:
                    case 2:
                      if (0 === e.type) throw new gM('already start');
                      break;
                    case 3:
                      switch (e.type) {
                        case 2:
                          throw new gM('update not allowed when stopping');
                        case 3:
                          return this.currentOp.promise;
                      }
                      break;
                    default:
                      throw new gM('unknown state');
                  }
                else
                  switch (e.type) {
                    case 3:
                      if (3 === this.lastOpType) return this.lastOp.promise;
                      {
                        let e = new gM('keep stop');
                        if (
                          (this.ops.slice(1).forEach((t) => t.reject(e)),
                          (this.ops = this.ops.slice(0, 1)),
                          3 === this.state)
                        )
                          return this.currentOp.promise;
                      }
                      break;
                    case 2:
                      switch (this.lastOpType) {
                        case 2:
                          return (
                            (this.lastOp.args = this.mergeUpdate(
                              this.lastOp.args,
                              e.args,
                            )),
                            this.lastOp.promise
                          );
                        case 3:
                          throw new gM('update not allowed after stop');
                      }
                      break;
                    case 0:
                      switch (this.lastOpType) {
                        case 2:
                          throw new gM('start not allowed after update');
                        case 0:
                          throw new gM('duplicate start');
                        case 3:
                          if (this.startSame(this.currentOp.args, e.args))
                            throw (
                              (this.ops.pop().reject(new gM('keep start')),
                              new gM('already start'))
                            );
                      }
                  }
                e.promise = new Promise((t, i) => {
                  e._resolve ? e._resolve.then(t) : (e.resolve = t),
                    e._reject ? e._reject.catch(i) : (e.reject = i);
                });
                let { action: t } = e;
                return (
                  (e.action = () => t().then(e.resolve, e.reject)),
                  this.ops.push(e),
                  e.promise
                );
              }
              get lastOp() {
                return this.ops[this.ops.length - 1];
              }
              get lastOpType() {
                return this.lastOp.type;
              }
              get currentOp() {
                return this.ops[0];
              }
              get state() {
                return this.currentOp
                  ? this.currentOp.type
                  : this.started
                  ? 1
                  : 4;
              }
            },
            vM = IM;
          ob(vM, 'instances', new WeakMap());
          var yM = new WeakMap(),
            AM = (e, t) => {
              if (t instanceof gM) {
                let { stack: i } = t;
                (t = new aM({
                  code: iM.OPERATION_ABORT,
                  message: ''.concat(e, ' abort: ').concat(t.message),
                  fnName: e,
                })),
                  i && (t.stack += i.substr(i.indexOf('\n')));
              }
              throw t;
            };
          function RM(e, t) {
            return rL(
              (i, n) =>
                function () {
                  for (
                    var r = arguments.length, o = new Array(r), s = 0;
                    s < r;
                    s++
                  )
                    o[s] = arguments[s];
                  let a = vM.get(
                    this,
                    'string' == typeof e ? e : e.call(this, ...o),
                  );
                  return (
                    t && (a.startSame = t.bind(this)),
                    a.action(0, i.bind(this), o).catch(AM.bind(null, n))
                  );
                },
            );
          }
          function CM(e, t) {
            let { merge: i, debounce: n } = t || {};
            return rL(
              (t, r) =>
                function () {
                  for (
                    var o = arguments.length, s = new Array(o), a = 0;
                    a < o;
                    a++
                  )
                    s[a] = arguments[a];
                  let c = vM.get(
                    this,
                    'string' == typeof e ? e : e.call(this, ...s),
                  );
                  if (
                    (i && (c.mergeUpdate = i.bind(this)),
                    n && n.isNeedToDebounce.apply(this, s))
                  ) {
                    let { delay: e, getKey: i } = n;
                    return new Promise((n, o) => {
                      var a, l;
                      let d =
                        null == (a = yM.get(this)) ? void 0 : a.get(i(...s));
                      if (d) {
                        let { timeoutId: e, resolve: t } = d;
                        clearTimeout(e), t();
                      }
                      let u = setTimeout(() => {
                        if (3 === c.state || 4 === c.state) return n();
                        c.action(2, t.bind(this), s)
                          .catch(AM.bind(null, r))
                          .then(n, o);
                      }, e);
                      yM.has(this)
                        ? null == (l = yM.get(this)) ||
                          l.set(i(...s), { timeoutId: u, resolve: n })
                        : yM.set(
                            this,
                            new Map([[i(...s), { timeoutId: u, resolve: n }]]),
                          );
                    });
                  }
                  return c.action(2, t.bind(this), s).catch(AM.bind(null, r));
                },
            );
          }
          function bM(e) {
            return rL(
              (t, i) =>
                function () {
                  for (
                    var n = arguments.length, r = new Array(n), o = 0;
                    o < n;
                    o++
                  )
                    r[o] = arguments[o];
                  return vM
                    .get(this, 'string' == typeof e ? e : e.call(this, ...r))
                    .action(3, t.bind(this), r)
                    .catch(AM.bind(null, i));
                },
            );
          }
          var kM = {
            ERROR: 'error',
            AUTOPLAY_FAILED: 'autoplay-failed',
            KICKED_OUT: 'kicked-out',
            REMOTE_USER_ENTER: 'remote-user-enter',
            REMOTE_USER_EXIT: 'remote-user-exit',
            REMOTE_AUDIO_AVAILABLE: 'remote-audio-available',
            REMOTE_AUDIO_UNAVAILABLE: 'remote-audio-unavailable',
            REMOTE_VIDEO_AVAILABLE: 'remote-video-available',
            REMOTE_VIDEO_UNAVAILABLE: 'remote-video-unavailable',
            AUDIO_VOLUME: 'audio-volume',
            NETWORK_QUALITY: 'network-quality',
            CONNECTION_STATE_CHANGED: 'connection-state-changed',
            AUDIO_PLAY_STATE_CHANGED: 'audio-play-state-changed',
            VIDEO_PLAY_STATE_CHANGED: 'video-play-state-changed',
            SCREEN_SHARE_STOPPED: 'screen-share-stopped',
            DEVICE_CHANGED: 'device-changed',
            PUBLISH_STATE_CHANGED: 'publish-state-changed',
            STATISTICS: 'statistics',
            SEI_MESSAGE: 'sei-message',
            TRACK: 'track',
          };
          function NM(e) {
            return 'sub' === e
              ? 'auxiliary'
              : 'auxiliary' === e
              ? 'sub'
              : 'main';
          }
          function DM(e) {
            return e === tM.QOS_PREFERENCE_CLEAR
              ? 'detail'
              : e === tM.QOS_PREFERENCE_SMOOTH
              ? 'motion'
              : '';
          }
          function OM(e, t) {
            return {
              room: e,
              innerEmitter: UO,
              constants: iN,
              environment: vb,
              utils: Ib,
              eventLogger: Xw,
              log: e.getLogger(),
              errorModule: t,
              clearStarted(t, i) {
                let n = t.getAlias(),
                  r = vM.instances.get(e);
                if (r)
                  if (i) {
                    let e = r.get(n + i);
                    if (!e) return;
                    e.started = !1;
                  } else
                    r.forEach((e, t) => {
                      t.startsWith(n) && (e.started = !1);
                    });
              },
            };
          }
          var wM = new WeakMap();
          function PM() {
            for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
              t[i] = arguments[i];
            return rL(
              (e, i) =>
                function () {
                  for (
                    var n = arguments.length, r = new Array(n), o = 0;
                    o < n;
                    o++
                  )
                    r[o] = arguments[o];
                  try {
                    MM.call(this, t, r, i, this._name);
                  } catch (aN) {
                    return Promise.reject(aN);
                  }
                  return e.apply(this, r);
                },
            );
          }
          function LM() {
            for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
              t[i] = arguments[i];
            return rL(
              (e, i) =>
                function () {
                  for (
                    var n = arguments.length, r = new Array(n), o = 0;
                    o < n;
                    o++
                  )
                    r[o] = arguments[o];
                  try {
                    MM.call(this, t, r, i, this._name);
                  } catch (aN) {
                    throw aN;
                  }
                  return e.apply(this, r);
                },
            );
          }
          function MM(e, t, i, n) {
            if (cO(e))
              for (let r = 0; r < e.length; r++)
                VM.call(this, {
                  rule: e[r],
                  value: t[r],
                  key: e[r].name,
                  fnName: i,
                  className: n,
                });
            else
              VM.call(this, {
                rule: e,
                value: t[0],
                key: e.name,
                fnName: i,
                className: n,
              });
          }
          function VM(e) {
            let { rule: t, value: i, key: n, fnName: r, className: o } = e;
            function s(e) {
              return {
                code: iM.INVALID_PARAMETER,
                extraCode: e,
                fnName: r,
                messageParams: { key: n, rule: t, value: i },
              };
            }
            if (nO(i)) {
              if (t.required) throw new aM(s(5001));
              if (nO(t.defaultValue))
                return void (
                  iO(t.validate) && t.validate.call(this, i, n, r, o, this)
                );
              i = t.defaultValue;
            }
            if (Array.isArray(t.type)) {
              let e = !1;
              for (let n = 0; n < t.type.length; n++)
                null === t.type[n] && null === i && (e = !0),
                  iO(t.type[n]) && i instanceof t.type[n] && (e = !0),
                  rO(t.type[n]) &&
                    tO(i) === t.type[n].toLowerCase() &&
                    (e = !0);
              if (!e)
                throw new aM({
                  code: iM.INVALID_PARAMETER,
                  extraCode: 5002,
                  fnName: r,
                  messageParams: {
                    key: n,
                    rule: {
                      type: t.type.map((e) =>
                        hO(e) ? pO(e) : rO(e) ? e : tO(e),
                      ),
                    },
                    value: i,
                  },
                });
            } else if (!nO(t.type) && tO(i) !== t.type) throw new aM(s(5002));
            if (!1 === t.allowEmpty) {
              let e = oO(i) && (0 === i || Number.isNaN(i)),
                t = rO(i) && '' === i.trim();
              if (e || t) throw new aM(s(5003));
            }
            if (t.notLessThanZero && oO(i) && i < 0) throw new aM(s(5006));
            if (!nO(t.min) && oO(i) && i < t.min) throw new aM(s(5007));
            if (!nO(t.max) && oO(i) && i > t.max) throw new aM(s(5008));
            if (rO(t.instanceOf)) {
              if (!i || i._name !== t.instanceOf) throw new aM(s(5004));
            } else if (iO(t.instanceOf) && !(i instanceof t.instanceOf)) throw new aM(s(5004));
            if (Array.isArray(t.values) && !t.values.includes(i))
              throw new aM(s(5005));
            let { properties: a } = t;
            $D(a) &&
              aO(i) &&
              Object.keys(a).forEach((e) => {
                VM.call(this, {
                  rule: a[e],
                  value: i && i[e],
                  key: ''.concat(e),
                  fnName: r,
                  className: o,
                });
              });
            let { arrayItem: c } = t;
            $D(c) &&
              cO(i) &&
              i.forEach((e, t) => {
                VM.call(this, {
                  rule: c,
                  value: e,
                  key: ''.concat(n, '[').concat(t, ']'),
                  fnName: r,
                  className: o,
                });
              }),
              iO(t.validate) && t.validate.call(this, i, n, r, o, this);
          }
          function xM() {
            let e =
                arguments.length > 0 && void 0 !== arguments[0]
                  ? arguments[0]
                  : {},
              { namePrefix: t = () => '', getRemoteId: i = () => '' } = e;
            return rL(
              (e, n) =>
                function () {
                  for (
                    var r = arguments.length, o = new Array(r), s = 0;
                    s < r;
                    s++
                  )
                    o[s] = arguments[s];
                  function a(e, t, i) {
                    if (i && i.includes(e)) return 'hided';
                    if (t === o || e in o) return t;
                    try {
                      return t instanceof HTMLElement
                        ? 'id: '.concat(t.id, ' type:').concat(tO(t))
                        : (JSON.stringify(t), t);
                    } catch (n) {
                      return 'type:'.concat(tO(t));
                    }
                  }
                  let c = this._log || loggerManager,
                    l = t.call(this, ...o),
                    d = '' !== l ? ''.concat(l, '.').concat(n) : n;
                  o.length > 0
                    ? c.info(
                        ''
                          .concat(d, '() ')
                          .concat(
                            JSON.stringify(o, (e, t) =>
                              a(e, t, ['userSig', 'privateMapKey']),
                            ),
                          ),
                      )
                    : c.info(''.concat(d, '()'));
                  try {
                    let t = e.apply(this, o),
                      n = fO();
                    return uO(t)
                      ? t
                          .then(
                            (e) => (
                              c.info(
                                ''
                                  .concat(d, '() success ')
                                  .concat(i.call(this, ...o)),
                              ),
                              UO.emit(BO.API_SUCCESS_RATE, {
                                room: this._room,
                                apiName: d,
                                cost: fO() - n,
                              }),
                              e
                            ),
                          )
                          .catch((e) => {
                            throw (
                              ((e = aM.convertFrom.call(
                                this,
                                e,
                                d,
                                1 === o.length ? o[0] : o,
                              )),
                              c.error(
                                ''
                                  .concat(d, '() failed ')
                                  .concat(i.call(this, ...o), ' ')
                                  .concat(e, ' params: ')
                                  .concat(JSON.stringify(o, a)),
                              ),
                              UO.emit(BO.API_SUCCESS_RATE, {
                                room: this._room,
                                apiName: d,
                                error: e,
                              }),
                              e)
                            );
                          })
                      : (UO.emit(BO.API_SUCCESS_RATE, {
                          room: this._room,
                          apiName: d,
                          cost: fO() - n,
                        }),
                        t);
                  } catch (u) {
                    throw (
                      ((u = aM.convertFrom.call(this, u, d)),
                      c.error(
                        ''
                          .concat(d, '() failed ')
                          .concat(u, ' params: ')
                          .concat(JSON.stringify(o, a)),
                      ),
                      UO.emit(BO.API_SUCCESS_RATE, {
                        room: this._room,
                        apiName: d,
                        error: u,
                      }),
                      u)
                    );
                  }
                },
            );
          }
          var UM = (e) =>
              rL(
                (t, i) =>
                  function (n, r) {
                    return ab(this, null, function* () {
                      let o = this._plugins.get(n);
                      if (o)
                        return (
                          MM.call(this, o.getValidateRule(e), [r], i, 'TRTC'),
                          t.call(this, o, r)
                        );
                      this._log.warn('plugin '.concat(n, ' is not found'));
                    });
                  },
              ),
            FM = 0,
            BM = class {
              constructor(e) {
                (this.core = e),
                  ob(this, 'log'),
                  (FM += 1),
                  (this.log = e.log.createChild({
                    id: ''.concat(this.getAlias()).concat(FM),
                  })),
                  this.log.info(
                    '[audioMixer] created id='
                      .concat(this.getAlias())
                      .concat(FM),
                  ),
                  (this.core = e);
              }
              getName() {
                return 'AudioMixer';
              }
              getAlias() {
                return 'ax';
              }
              getGroup(e) {
                return null == e ? void 0 : e.id;
              }
              getValidateRule(e) {
                switch (e) {
                  case 'start':
                    return BM.startValidateRule;
                  case 'update':
                    return BM.updateValidateRule;
                  case 'stop':
                    return BM.stopValidateRule;
                }
              }
              start(e) {
                return ab(this, null, function* () {
                  let { room: t } = this.core;
                  yield t.audioManager.addMusicSource(e);
                });
              }
              update(e) {
                return ab(this, null, function* () {
                  let { room: t } = this.core;
                  yield t.audioManager.updateMusicSource(e);
                });
              }
              stop(e) {
                return ab(this, null, function* () {
                  let { room: t } = this.core;
                  yield t.audioManager.removeMusicSource(e);
                });
              }
            },
            HM = BM;
          ob(HM, 'startValidateRule', {
            name: 'options',
            required: !0,
            type: 'object',
            properties: {
              id: { type: 'string', required: !0 },
              url: { type: 'string', required: !0 },
              loop: { type: 'boolean' },
              volume: { type: 'number' },
            },
            validate(e, t, i) {
              if ('*' !== e.url) {
                let t = e.url.split('?')[0],
                  n = ['mp3', 'ogg', 'wav', 'flac'],
                  r = t.split('.').pop(),
                  o = n.indexOf(r) >= 0,
                  s = t.startsWith('blob'),
                  a = t.startsWith('data');
                if (!(o || s || a))
                  throw new aM({
                    code: iM.INVALID_PARAMETER,
                    message:
                      'start audioMixer plugin: music url is invalid, please check your file format.',
                    fnName: i,
                  });
              }
            },
          }),
            ob(HM, 'updateValidateRule', {
              name: 'options',
              required: !0,
              type: 'object',
              properties: {
                id: { type: 'string', required: !0 },
                loop: { type: 'boolean' },
                volume: { type: 'number' },
                seekFrom: { type: 'number' },
                operation: {
                  type: 'string',
                  values: ['pause', 'resume', 'stop'],
                },
              },
            }),
            ob(HM, 'stopValidateRule', {
              name: 'options',
              type: 'object',
              required: !0,
              properties: { id: { type: 'string', required: !0 } },
            });
          var jM = 0,
            GM = class {
              constructor(e) {
                (this.core = e),
                  ob(this, 'log'),
                  (jM += 1),
                  (this.log = e.log.createChild({
                    id: ''.concat(this.getAlias()).concat(jM),
                  })),
                  this.log.info(
                    '[audioDenoiser] created id='
                      .concat(this.getAlias())
                      .concat(jM),
                  );
              }
              static startValidateRule(e) {
                return {
                  name: 'options',
                  required: !0,
                  type: 'object',
                  properties: {
                    assetsPath: { type: 'string', required: !0 },
                    sdkAppId: { type: 'number', required: !0 },
                    userId: { type: 'string', required: !0 },
                    userSig: { type: 'string', required: !0 },
                  },
                  validate(t, i, n, r) {
                    if (!e.room.audioManager.hasAudioTrack)
                      throw new aM({
                        code: iM.INVALID_OPERATION,
                        extraCode: 5106,
                        fnName: n,
                      });
                  },
                };
              }
              getName() {
                return 'AIDenoiser';
              }
              getAlias() {
                return 'ad';
              }
              getGroup(e) {
                return 'AIDenoiser_'.concat(Date.now());
              }
              getValidateRule(e) {
                switch (e) {
                  case 'start':
                    return GM.startValidateRule(this.core);
                  case 'update':
                    return GM.updateValidateRule;
                  case 'stop':
                    return GM.stopValidateRule;
                }
              }
              start(e) {
                return ab(this, null, function* () {
                  let { room: t } = this.core,
                    { assetsPath: i, sdkAppId: n, userId: r, userSig: o } = e;
                  if (i && !t.audioManager.isDenoiserInit)
                    try {
                      yield t.audioManager.initDenoiser({
                        assetsPath: i,
                        sdkAppId: n,
                        userId: r,
                        userSig: o,
                      });
                    } catch (s) {
                      if (s.message)
                        throw new aM({
                          code: iM.INVALID_PARAMETER,
                          message: s.message,
                        });
                    }
                  yield t.audioManager.enableDenoiser(e),
                    t.sendAbilityStatus({ ai_denoise: 1 });
                });
              }
              update(e) {
                return ab(this, null, function* () {});
              }
              stop(e) {
                return ab(this, null, function* () {
                  let { room: e } = this.core;
                  yield e.audioManager.disableDenoiser();
                });
              }
            },
            WM = GM;
          ob(WM, 'updateValidateRule', { type: 'object' }),
            ob(WM, 'stopValidateRule', { type: 'object' });
          var JM = 0,
            KM = new Set(),
            YM = null;
          oN('5.3.0');
          var zM = class extends pb.EventEmitter {
              constructor(e, t) {
                super(),
                  ob(this, '_room'),
                  ob(this, '_eventListened', new Set()),
                  ob(this, '_localVideoTrack', null),
                  ob(this, '_localAudioTrack', null),
                  ob(this, '_localScreenTrack', null),
                  ob(this, '_localScreenAudioTrack', null),
                  ob(this, '_localVideoConfig', null),
                  ob(this, '_localScreenConfig', null),
                  ob(this, '_localAudioConfig', null),
                  ob(this, '_remoteVideoConfigMap', new Map()),
                  ob(this, '_remoteAudioConfigMap', new Map()),
                  ob(this, '_remoteAudioMuteMap', new Map()),
                  ob(this, '_mediaTrackMap', new WeakMap()),
                  ob(this, '_log', jO.createLogger({ id: 't'.concat(++JM) })),
                  ob(this, '_plugins', new Map()),
                  ob(this, '_networkQuality', null),
                  (this._room = new e(
                    ZC(
                      { logger: this._log, frameWorkType: zM.frameWorkType },
                      t,
                    ),
                  ));
                let i = {
                  RtcError: aM,
                  ErrorCode: iM,
                  ErrorCodeDictionary: nM,
                };
                t.plugins &&
                  t.plugins.forEach((e) => {
                    let t = new e(OM(this._room, i));
                    this._plugins.set(t.getName(), t);
                  });
                let n = new HM(OM(this._room, i));
                this._plugins.set(n.getName(), n);
                let r = new WM(OM(this._room, i));
                this._plugins.set(r.getName(), r),
                  this._room.on('audio-volume', (e) => {
                    !e.find((e) => '' === e.userId) &&
                      this._localAudioTrack &&
                      e.push({
                        userId: '',
                        volume: Math.floor(
                          100 * this._localAudioTrack.getAudioLevel(),
                        ),
                      }),
                      this.emit(kM.AUDIO_VOLUME, {
                        result: e.sort((e, t) => t.volume - e.volume),
                      });
                  }),
                  this._room.videoManager.on('error', (e) => {
                    let { reason: t, error: i } = e;
                    this._log.error(
                      new aM({
                        code: iM.OPERATION_FAILED,
                        extraCode: 5504,
                        messageParams: { reason: t, error: i },
                      }),
                    );
                  }),
                  this.on(kM.REMOTE_AUDIO_UNAVAILABLE, (e) => {
                    let { userId: t } = e;
                    this._stopRemoteAudio({ userId: t }, !1).catch(() => {});
                  }),
                  this.on(kM.REMOTE_VIDEO_UNAVAILABLE, (e) => {
                    let { userId: t, streamType: i } = e;
                    this._stopRemoteVideo(
                      { userId: t, streamType: i },
                      !1,
                    ).catch(() => {});
                  }),
                  IP(GP, GP)
                    .add('audioInputAdded', (e) => {
                      this.emit(kM.DEVICE_CHANGED, {
                        type: 'microphone',
                        action: 'add',
                        device: e,
                      });
                    })
                    .add('audioInputRemoved', (e) => {
                      this.emit(kM.DEVICE_CHANGED, {
                        type: 'microphone',
                        action: 'remove',
                        device: e,
                      });
                    })
                    .add('videoInputAdded', (e) => {
                      this.emit(kM.DEVICE_CHANGED, {
                        type: 'camera',
                        action: 'add',
                        device: e,
                      });
                    })
                    .add('videoInputRemoved', (e) => {
                      this.emit(kM.DEVICE_CHANGED, {
                        type: 'camera',
                        action: 'remove',
                        device: e,
                      });
                    })
                    .add('audioOutputAdded', (e) =>
                      ab(this, null, function* () {
                        if (
                          (this.emit(kM.DEVICE_CHANGED, {
                            type: 'speaker',
                            action: 'add',
                            device: e,
                          }),
                          YM && YM.deviceId === CD)
                        ) {
                          let e = (yield zP()).find((e) => e.deviceId === CD);
                          e &&
                            YM.groupId !== e.groupId &&
                            ((YM = e),
                            this.emit(kM.DEVICE_CHANGED, {
                              type: 'speaker',
                              action: 'active',
                              device: e,
                            }));
                        }
                      }),
                    )
                    .add('audioOutputRemoved', (e) =>
                      ab(this, null, function* () {
                        this.emit(kM.DEVICE_CHANGED, {
                          type: 'speaker',
                          action: 'remove',
                          device: e,
                        });
                        let t = (yield zP())[0];
                        t &&
                          YM &&
                          (YM.deviceId === e.deviceId ||
                            (YM.deviceId === CD && YM.groupId !== t.groupId)) &&
                          ((YM = t),
                          this.emit(kM.DEVICE_CHANGED, {
                            type: 'speaker',
                            action: 'active',
                            device: t,
                          }));
                      }),
                    ),
                  this._initActiveSpeaker(),
                  ((e, t) => {
                    let { emit: n } = e;
                    e.emit = function () {
                      for (
                        var r = arguments.length, o = new Array(r), s = 0;
                        s < r;
                        s++
                      )
                        o[s] = arguments[s];
                      try {
                        return n.apply(e, o);
                      } catch (i) {
                        let n = QO({
                          key: KO.CATCH_HANDLER_ERROR,
                          data: { name: t, event: o[0] },
                          addDocLink: !1,
                        });
                        return (
                          jO.warn(''.concat(n, '\n\n').concat(i.stack)), !1
                        );
                      }
                    };
                  })(this, 'trtc');
              }
              static create(e) {}
              static _create(e, t) {
                !(function () {
                  var e;
                  eM &&
                    ((eM = !1),
                    5 !== jO.getLogLevel() &&
                      (console.info(
                        '******************************************************************************',
                      ),
                      console.info('*   TRTC Web SDK'),
                      console.info(
                        '*   API Document: '.concat(TN, '/en/index.html'),
                      ),
                      console.info(
                        '*   Changelog: '.concat(
                          TN,
                          '/en/tutorial-01-info-changelog.html',
                        ),
                      ),
                      console.info(
                        '*   Report issues: https://github.com/LiteAVSDK/TRTC_Web/issues',
                      ),
                      console.info(
                        '******************************************************************************',
                      )),
                    jO.info('TRTC Web SDK Version:', rN),
                    jO.info('UA:', navigator.userAgent),
                    jO.info(
                      'URL: '
                        .concat(location.href)
                        .concat(
                          'IFRAME' ===
                            (null == (e = self.frameElement)
                              ? void 0
                              : e.tagName)
                            ? ' in iframe'
                            : '',
                        ),
                    ),
                    $k().then((e) => {
                      if (e) {
                        let t = 'UAData: '
                          .concat(e.platform, '/')
                          .concat(e.platformVersion);
                        e.architecture &&
                          e.bitness &&
                          (t += ' '
                            .concat(e.architecture, '/')
                            .concat(e.bitness)),
                          e.mobile && (t += ' mobile'),
                          e.model && (t += ' model: '.concat(e.model)),
                          e.fullVersionList &&
                            (t += ' '.concat(
                              e.fullVersionList
                                .filter((e) => 'Not/A)Brand' !== e.brand)
                                .map((e) =>
                                  ''.concat(e.brand, '/').concat(e.version),
                                )
                                .join(','),
                            )),
                          jO.info(t);
                      }
                    }));
                })();
                let i = new zM(e, t || {});
                return KM.add(i), i;
              }
              enterRoom(e) {
                return ab(this, null, function* () {
                  var t, i;
                  let {
                    scene: n = 'rtc',
                    enableAutoPlayDialog: r = !0,
                    autoReceiveAudio: o = !0,
                    autoReceiveVideo: s = !0,
                  } = e;
                  e.proxy &&
                    (this._room.setProxyServer(e.proxy),
                    !rO(e.proxy) &&
                      e.proxy.turnServer &&
                      (null == (i = (t = this._room).setTurnServer) ||
                        i.call(
                          t,
                          e.proxy.turnServer,
                          e.proxy.iceTransportPolicy,
                        ))),
                    (this._room.enableAutoPlayDialog = r),
                    (this._room.autoReceiveAudio = o),
                    (this._room.autoReceiveVideo = s),
                    sO(e.enableHWEncoder) &&
                      (this._room.enableHWEncoder = e.enableHWEncoder);
                  let a = {
                    sdkAppId: e.sdkAppId,
                    userId: e.userId,
                    userSig: e.userSig,
                    privateMapKey: e.privateMapKey || null,
                    role: 'audience' === e.role ? 21 : 20,
                    roomId: e.roomId || 0,
                    strRoomId: e.strRoomId || '',
                    businessInfo: e.businessInfo || null,
                    streamId: null,
                    userDefineRecordId: e.userDefineRecordId || null,
                    frameWorkType: e.frameWorkType,
                    component: e.component,
                    language: e.language,
                  };
                  e.strRoomId && !e.roomId && (this._room.useStringRoomId = !0),
                    IP(this, this._room)
                      .add('peer-join', (e) => {
                        let { userId: t } = e;
                        this.emit(kM.REMOTE_USER_ENTER, { userId: t });
                      })
                      .add('peer-leave', (e) => {
                        this.emit(kM.REMOTE_USER_EXIT, { userId: e });
                      })
                      .add('banned', (e) => {
                        this._exitRoom().then(() => {
                          this.emit(kM.KICKED_OUT, { reason: e.reason });
                        });
                      })
                      .add('error', (e) => {
                        this._exitRoom().then(() => {
                          this.emit(kM.ERROR, aM.convertFrom(e));
                        });
                      })
                      .add('signal-connection-state-changed', (e) => {
                        this.emit(kM.CONNECTION_STATE_CHANGED, e);
                      })
                      .add('network-quality', (e) => {
                        (this._networkQuality = e),
                          this.emit(kM.NETWORK_QUALITY, e);
                      })
                      .add('remote-published', (e) => {
                        [
                          e.remoteAudioTrack,
                          e.remoteVideoTrack,
                          e.remoteAuxiliaryTrack,
                        ].forEach((t) => {
                          IP(t, t)
                            .add('player-state-changed', (i) => {
                              let n = eb(ZC({}, i), { userId: e.userId });
                              t.kind === LN.VIDEO &&
                                (n.streamType = NM(t.streamType)),
                                this.emit(
                                  t.kind === LN.AUDIO
                                    ? kM.AUDIO_PLAY_STATE_CHANGED
                                    : kM.VIDEO_PLAY_STATE_CHANGED,
                                  n,
                                );
                            })
                            .add('error', (e) => {
                              e.getCode() === mb.PLAY_NOT_ALLOWED &&
                                this.emit(kM.AUTOPLAY_FAILED, {
                                  userId: t.userId,
                                });
                            });
                        });
                      })
                      .add('remote-unpublished', (e) => {
                        [
                          e.remoteAudioTrack,
                          e.remoteVideoTrack,
                          e.remoteAuxiliaryTrack,
                        ].forEach((e) => {
                          vP(e);
                        });
                      })
                      .add('remote-publish-state-changed', (e) => {
                        let { prevMuteState: t, muteState: i } = e,
                          { userId: n } = i;
                        this._room.remotePublishedUserMap.get(n);
                        let r = t.audioAvailable,
                          o = t.videoAvailable,
                          { audioAvailable: s, videoAvailable: a } = i;
                        s || this._remoteAudioConfigMap.delete(n),
                          a ||
                            this._remoteVideoConfigMap.delete(
                              ''.concat(n, '_', 'main'),
                            ),
                          i.hasAuxiliary ||
                            this._remoteVideoConfigMap.delete(
                              ''.concat(n, '_', 'sub'),
                            ),
                          r !== s &&
                            this.emit(
                              s
                                ? kM.REMOTE_AUDIO_AVAILABLE
                                : kM.REMOTE_AUDIO_UNAVAILABLE,
                              { userId: n },
                            ),
                          o !== a &&
                            this.emit(
                              a
                                ? kM.REMOTE_VIDEO_AVAILABLE
                                : kM.REMOTE_VIDEO_UNAVAILABLE,
                              { userId: n, streamType: 'main' },
                            ),
                          t.hasAuxiliary !== i.hasAuxiliary &&
                            this.emit(
                              i.hasAuxiliary
                                ? kM.REMOTE_VIDEO_AVAILABLE
                                : kM.REMOTE_VIDEO_UNAVAILABLE,
                              { userId: n, streamType: 'sub' },
                            );
                      })
                      .add('firewall-restriction', () => {
                        this.emit(
                          kM.ERROR,
                          new aM({
                            code: iM.OPERATION_FAILED,
                            extraCode: 5501,
                          }),
                        );
                      })
                      .add('sei-message', (e) => {
                        this.emit(
                          kM.SEI_MESSAGE,
                          eb(ZC({}, e), { streamType: NM(e.streamType) }),
                        );
                      })
                      .add('heartbeat-report', (e) => {
                        var t, i, n, r, o, s, a;
                        let c = { 2: 'big', 3: 'small', 7: 'sub' },
                          l = {
                            rtt:
                              e.msg_up_stream_info.msg_network_status
                                .uint32_rtt ||
                              (null == (t = e.msg_down_stream_info[0])
                                ? void 0
                                : t.msg_network_status.uint32_rtt) ||
                              (null == (i = this._networkQuality)
                                ? void 0
                                : i.uplinkRTT) ||
                              (null == (n = this._networkQuality)
                                ? void 0
                                : n.downlinkRTT) ||
                              0,
                            upLoss:
                              (null == (r = this._networkQuality)
                                ? void 0
                                : r.uplinkLoss) || 0,
                            downLoss:
                              (null == (o = this._networkQuality)
                                ? void 0
                                : o.downlinkLoss) || 0,
                            bytesSent: e.bytes_sent || 0,
                            bytesReceived: e.bytes_received || 0,
                            localStatistics: {
                              audio: {
                                bitrate:
                                  ((null ==
                                  (s = e.msg_up_stream_info.msg_audio_status)
                                    ? void 0
                                    : s.uint32_audio_codec_bitrate) || 0) / 1e3,
                                audioLevel:
                                  ((null ==
                                  (a = e.msg_up_stream_info.msg_audio_status)
                                    ? void 0
                                    : a.uint32_audio_level) || 0) / xD,
                              },
                              video: e.msg_up_stream_info.msg_video_status
                                .filter((e) => c[e.uint32_video_stream_type])
                                .map((e) => ({
                                  bitrate:
                                    (e.uint32_video_codec_bitrate || 0) / 1e3,
                                  width: e.uint32_video_width,
                                  height: e.uint32_video_height,
                                  frameRate: e.uint32_video_enc_fps,
                                  videoType: c[e.uint32_video_stream_type],
                                })),
                            },
                            remoteStatistics: e.msg_down_stream_info.map(
                              (e) => ({
                                userId: e.msg_user_info.str_identifier,
                                audio: {
                                  bitrate:
                                    (e.msg_audio_status
                                      .uint32_audio_codec_bitrate || 0) / 1e3,
                                  audioLevel:
                                    (e.msg_audio_status.uint32_audio_level ||
                                      0) / xD,
                                },
                                video: e.msg_video_status.map((e) => ({
                                  bitrate:
                                    (e.uint32_video_codec_bitrate || 0) / 1e3,
                                  width: e.uint32_video_width,
                                  height: e.uint32_video_height,
                                  frameRate: e.uint32_video_dec_fps,
                                  videoType: c[e.uint32_video_stream_type],
                                })),
                              }),
                            ),
                          };
                        this.emit(kM.STATISTICS, l);
                      }),
                    this._handleReceiveMode(),
                    yield this._room.join(a, n, zM.frameWorkType),
                    this._checkTrackToPublish();
                });
              }
              exitRoom() {
                return ab(this, null, function* () {
                  return yield this._exitRoom();
                });
              }
              switchRole(e, t) {
                return ab(this, null, function* () {
                  null != t &&
                    t.privateMapKey &&
                    (this._room.privateMapKey = t.privateMapKey),
                    yield this._room.switchRole(e),
                    'anchor' === e && this._checkTrackToPublish();
                });
              }
              destroy() {
                vP(GP),
                  this.removeAllListeners(),
                  this._room.destroy(),
                  KM.delete(this),
                  this._localAudioTrack && this.stopLocalAudio(),
                  this._localVideoTrack && this.stopLocalVideo(),
                  this._localScreenTrack && this.stopScreenShare();
              }
              startLocalAudio() {
                return ab(this, arguments, function () {
                  var e = this;
                  let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : { publish: !0 };
                  return (function* () {
                    if (e._localAudioTrack)
                      return void e._log.warn('local audio is already started');
                    let { publish: i = !0, mute: n, option: r } = t,
                      o = new uL(e._room.audioManager),
                      s = {},
                      a = { muted: !0 };
                    r &&
                      (nO(r.microphoneId)
                        ? nO(r.audioTrack) || (s.customSource = r.audioTrack)
                        : (s.deviceId = r.microphoneId),
                      r &&
                        oO(r.captureVolume) &&
                        o.setCaptureVolume(r.captureVolume),
                      nO(r.profile) ||
                        (rO(r.profile)
                          ? ON[r.profile] && o.setProfile(ON[r.profile])
                          : o.setProfile(r.profile)),
                      oO(r.earMonitorVolume) &&
                        ((a.muted = !(r.earMonitorVolume > 0)),
                        (a.volume = r.earMonitorVolume)),
                      nO(r.echoCancellation) ||
                        (o.profile.echoCancellation = r.echoCancellation),
                      nO(r.noiseSuppression) ||
                        (o.profile.noiseSuppression = r.noiseSuppression),
                      nO(r.autoGainControl) ||
                        (o.profile.autoGainControl = r.autoGainControl)),
                      o.on('5', (t) => {
                        e.emit(
                          kM.ERROR,
                          new aM({
                            code: iM.DEVICE_ERROR,
                            extraCode: 5309,
                            messageParams: { error: t },
                          }),
                        );
                      }),
                      o.on('2', (t) => {
                        e.emit(kM.DEVICE_CHANGED, {
                          type: 'microphone',
                          action: 'active',
                          device: t,
                        });
                      }),
                      o.on('4', (t) => {
                        let i;
                        t.error && (i = aM.convertFrom(t.error)),
                          e.emit(
                            kM.PUBLISH_STATE_CHANGED,
                            eb(ZC({}, t), { error: i }),
                          );
                      }),
                      e._listenOutputTrackChanged(o),
                      yield o.capture(s),
                      nO(n) || o.setMute(n),
                      IP(o, o).add('player-state-changed', (t) => {
                        e.emit(
                          kM.AUDIO_PLAY_STATE_CHANGED,
                          eb(ZC({}, t), { userId: '' }),
                        );
                      }),
                      i &&
                        e._room.isJoined &&
                        e._room.publish(o).catch(() => {}),
                      yield e._updateAudioPlayOption({
                        playOption: a,
                        track: o,
                      }),
                      (e._localAudioTrack = o),
                      (e._localAudioConfig = eb(ZC({}, t), { publish: i }));
                  })();
                });
              }
              updateLocalAudio(e) {
                return ab(this, null, function* () {
                  if (!this._localAudioTrack || !this._localAudioConfig) return;
                  let { publish: t, mute: i, option: n } = e,
                    r = {};
                  n &&
                    (n.microphoneId
                      ? yield this._localAudioTrack.switchDevice(n.microphoneId)
                      : nO(n.audioTrack) ||
                        (yield this._localAudioTrack.setInputMediaStreamTrack(
                          n.audioTrack,
                        )),
                    nO(n.captureVolume) ||
                      this._localAudioTrack.setCaptureVolume(n.captureVolume),
                    nO(n.earMonitorVolume) ||
                      ((r.muted = !(n.earMonitorVolume > 0)),
                      (r.volume = n.earMonitorVolume)),
                    yield this._localAudioTrack.update3A(n)),
                    this._room.isJoined &&
                      !nO(t) &&
                      (t &&
                        !this._localAudioConfig.publish &&
                        this._room
                          .publish(this._localAudioTrack)
                          .catch(() => {}),
                      this._localAudioConfig.publish &&
                        !t &&
                        this._room
                          .unpublish(this._localAudioTrack)
                          .catch(() => {})),
                    nO(i) || this._localAudioTrack.setMute(i),
                    yield this._updateAudioPlayOption({
                      playOption: r,
                      track: this._localAudioTrack,
                      prevConfig: this._localAudioConfig,
                    }),
                    RO(this._localAudioConfig, e);
                });
              }
              stopLocalAudio() {
                return ab(this, null, function* () {
                  !this._localAudioTrack ||
                    (this._room.isJoined &&
                      (yield this._room
                        .unpublish(this._localAudioTrack)
                        .catch(() => {})),
                    this._localAudioTrack.stop(),
                    this._localAudioTrack.close(),
                    vP(this._localAudioTrack),
                    (this._localAudioTrack = null),
                    (this._localAudioConfig = null));
                });
              }
              startLocalVideo() {
                return ab(this, arguments, function () {
                  var e = this;
                  let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : { publish: !0, view: null };
                  return (function* () {
                    if (e._localVideoTrack)
                      return void e._log.warn('local video is already started');
                    let { view: i, publish: n = !0, mute: r, option: o } = t,
                      s = new hL(e._room.videoManager),
                      a = {},
                      c = {};
                    if (
                      (o &&
                        (o.cameraId
                          ? (a.deviceId = o.cameraId)
                          : nO(o.useFrontCamera)
                          ? nO(o.videoTrack) || (a.customSource = o.videoTrack)
                          : (a.facingMode = o.useFrontCamera
                              ? LN.FACING_MODE_USER
                              : LN.FACING_MODE_ENVIRONMENT),
                        nO(o.profile) ||
                          (rO(o.profile)
                            ? wN[o.profile] && s.setProfile(wN[o.profile])
                            : s.setProfile(o.profile)),
                        nO(o.fillMode) || (c.objectFit = o.fillMode),
                        nO(o.mirror) || (c.mirror = o.mirror),
                        nO(o.small) ||
                          (gw()
                            ? rO(o.small)
                              ? (s.small = wN[o.small])
                              : !0 === o.small
                              ? (s.small = wN['120p'])
                              : (s.small = o.small)
                            : e._log.warn('small stream is not supported'))),
                      s.on('5', (t) => {
                        e.emit(
                          kM.ERROR,
                          new aM({
                            code: iM.DEVICE_ERROR,
                            extraCode: 5308,
                            messageParams: { error: t },
                          }),
                        );
                      }),
                      s.on('2', (t) => {
                        e.emit(kM.DEVICE_CHANGED, {
                          type: 'camera',
                          action: 'active',
                          device: t,
                        });
                      }),
                      s.on('4', (t) => {
                        let i;
                        t.error && (i = aM.convertFrom(t.error)),
                          e.emit(
                            kM.PUBLISH_STATE_CHANGED,
                            eb(ZC({}, t), { error: i }),
                          );
                      }),
                      e._listenOutputTrackChanged(s),
                      yield s.capture(a),
                      nO(r) || s.setMute(r),
                      (null == o ? void 0 : o.qosPreference) && s.mediaTrack)
                    ) {
                      let e = DM(o.qosPreference);
                      s.mediaTrack.contentHint = e;
                    }
                    IP(s, s).add('player-state-changed', (t) => {
                      e.emit(
                        kM.VIDEO_PLAY_STATE_CHANGED,
                        eb(ZC({}, t), { userId: '', streamType: 'main' }),
                      );
                    }),
                      n &&
                        e._room.isJoined &&
                        e._room.publish(s).catch(() => {}),
                      yield e._updateVideoPlayOption({
                        view: i,
                        playOption: c,
                        track: s,
                      }),
                      (e._localVideoTrack = s),
                      (e._localVideoConfig = eb(ZC({}, t), {
                        view: i,
                        publish: n,
                      }));
                  })();
                });
              }
              updateLocalVideo(e) {
                return ab(this, null, function* () {
                  if (!this._localVideoTrack || !this._localVideoConfig) return;
                  let { view: t, publish: i, mute: n, option: r } = e,
                    o = {};
                  if (r) {
                    if (
                      (nO(r.profile) ||
                        (rO(r.profile)
                          ? wN[r.profile] &&
                            this._localVideoTrack.setProfile(wN[r.profile])
                          : this._localVideoTrack.setProfile(r.profile),
                        (!r.cameraId ||
                          !this._localVideoTrack.isNeedToSwitchDevice(
                            r.cameraId,
                          )) &&
                          nO(r.useFrontCamera) &&
                          this._localVideoTrack.applyProfile()),
                      r.cameraId
                        ? yield this._localVideoTrack.switchDevice(r.cameraId)
                        : nO(r.useFrontCamera)
                        ? nO(r.videoTrack) ||
                          (yield this._localVideoTrack.setInputMediaStreamTrack(
                            r.videoTrack,
                          ))
                        : yield this._localVideoTrack.switchDevice(
                            r.useFrontCamera
                              ? LN.FACING_MODE_USER
                              : LN.FACING_MODE_ENVIRONMENT,
                          ),
                      nO(r.fillMode) || (o.objectFit = r.fillMode),
                      nO(r.mirror) || (o.mirror = r.mirror),
                      r.qosPreference && this._localVideoTrack.mediaTrack)
                    ) {
                      let e = DM(r.qosPreference);
                      this._localVideoTrack.mediaTrack.contentHint = e;
                    }
                    if (r.small) {
                      let e = !this._localVideoTrack.small;
                      gw()
                        ? (!0 === r.small
                            ? (this._localVideoTrack.small = wN['120p'])
                            : rO(r.small)
                            ? (this._localVideoTrack.small = wN[r.small])
                            : (this._localVideoTrack.small = r.small),
                          this._room.videoManager.update(),
                          e && this._room.enableSmall(!0))
                        : this._log.warn('small stream is not supported');
                    } else
                      !1 === r.small &&
                        this._localVideoTrack.small &&
                        (delete this._localVideoTrack.small,
                        this._room.videoManager.update(),
                        this._room.enableSmall(!1));
                  }
                  this._room.isJoined &&
                    !nO(i) &&
                    (i &&
                      !this._localVideoConfig.publish &&
                      this._room.publish(this._localVideoTrack).catch(() => {}),
                    this._localVideoConfig.publish &&
                      !i &&
                      this._room
                        .unpublish(this._localVideoTrack)
                        .catch(() => {})),
                    nO(n) || this._localVideoTrack.setMute(n),
                    yield this._updateVideoPlayOption({
                      view: t,
                      playOption: o,
                      track: this._localVideoTrack,
                      prevConfig: this._localVideoConfig,
                    }),
                    RO(this._localVideoConfig, e);
                });
              }
              stopLocalVideo() {
                return ab(this, null, function* () {
                  !this._localVideoTrack ||
                    (this._room.isJoined &&
                      (yield this._room
                        .unpublish(this._localVideoTrack)
                        .catch(() => {})),
                    this._localVideoTrack.stop(),
                    this._localVideoTrack.close(),
                    vP(this._localVideoTrack),
                    (this._localVideoTrack = null),
                    (this._localVideoConfig = null));
                });
              }
              startScreenShare() {
                return ab(this, arguments, function () {
                  var e = this;
                  let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : { publish: !0, view: null };
                  return (function* () {
                    if (e._localScreenTrack)
                      return void e._log.warn(
                        'screen share is already started',
                      );
                    let { view: i = null, publish: n = !0, option: r } = t,
                      o = new _L(e._room.videoManager);
                    o.on('4', (t) => {
                      let i;
                      t.error && (i = aM.convertFrom(t.error)),
                        e.emit(
                          kM.PUBLISH_STATE_CHANGED,
                          eb(ZC({}, t), { error: i }),
                        );
                    }),
                      e._listenOutputTrackChanged(o);
                    let s = null;
                    o.setMediaType(2);
                    let a = {},
                      c = {};
                    r &&
                      (nO(r.profile) ||
                        (rO(r.profile)
                          ? PN[r.profile] && o.setProfile(PN[r.profile])
                          : o.setProfile(r.profile)),
                      r.systemAudio &&
                        ((a.systemAudio = !0),
                        (a.echoCancellation = r.echoCancellation),
                        (a.noiseSuppression = r.noiseSuppression),
                        (a.autoGainControl = r.autoGainControl)),
                      nO(r.fillMode) || (c.objectFit = r.fillMode),
                      r.videoTrack && (a.videoTrack = r.videoTrack),
                      r.audioTrack && (a.audioTrack = r.audioTrack));
                    let l = yield o.capture(a);
                    if (null != r && r.qosPreference) {
                      let e = DM(r.qosPreference);
                      o.mediaTrack.contentHint = e;
                    }
                    if (
                      (o.mediaTrack.addEventListener(LN.ENDED, () => {
                        e._stopScreenShare(), e.emit(kM.SCREEN_SHARE_STOPPED);
                      }),
                      l.getAudioTracks()[0] &&
                        ((s = new mL(e._room.audioManager)),
                        s.setInputMediaStreamTrack(l.getAudioTracks()[0])),
                      IP(o, o).add('player-state-changed', (t) => {
                        e.emit(
                          kM.VIDEO_PLAY_STATE_CHANGED,
                          eb(ZC({}, t), { userId: '', streamType: 'sub' }),
                        );
                      }),
                      n && e._room.isJoined)
                    ) {
                      let t = [o];
                      s && t.push(s), e._room.publish(...t).catch(() => {});
                    }
                    yield e._updateVideoPlayOption({
                      view: i,
                      playOption: c,
                      track: o,
                    }),
                      (e._localScreenTrack = o),
                      (e._localScreenAudioTrack = s),
                      (e._localScreenConfig = eb(ZC({}, t), {
                        view: i,
                        publish: n,
                      }));
                  })();
                });
              }
              updateScreenShare(e) {
                return ab(this, null, function* () {
                  if (!this._localScreenTrack || !this._localScreenConfig)
                    return;
                  let { view: t, publish: i, option: n } = e,
                    r = {};
                  if (
                    n &&
                    (nO(n.fillMode) || (r.objectFit = n.fillMode),
                    n.qosPreference)
                  ) {
                    let e = DM(n.qosPreference);
                    this._localScreenTrack.mediaTrack.contentHint = e;
                  }
                  this._room.isJoined &&
                    !nO(i) &&
                    (i &&
                      !this._localScreenConfig.publish &&
                      this._room
                        .publish(this._localScreenTrack)
                        .catch(() => {}),
                    this._localScreenConfig.publish &&
                      !i &&
                      this._room
                        .unpublish(this._localScreenTrack)
                        .catch(() => {})),
                    yield this._updateVideoPlayOption({
                      view: t,
                      playOption: r,
                      track: this._localScreenTrack,
                      prevConfig: this._localScreenConfig,
                    }),
                    RO(this._localScreenConfig, e);
                });
              }
              stopScreenShare() {
                return ab(this, null, function* () {
                  return yield this._stopScreenShare();
                });
              }
              startRemoteVideo(e) {
                return ab(this, null, function* () {
                  let { view: t, userId: i, streamType: n, option: r } = e,
                    o = ''.concat(i, '_').concat(n);
                  if (this._remoteVideoConfigMap.has(o))
                    return void this._log.warn(
                      'remote video has already started. userId:'
                        .concat(i, ', streamType:')
                        .concat(n),
                    );
                  let s = this._room.remotePublishedUserMap.get(i);
                  if (!s) return;
                  let a = {},
                    c =
                      'main' === n
                        ? s.remoteVideoTrack
                        : s.remoteAuxiliaryTrack;
                  this._listenOutputTrackChanged(c),
                    r &&
                      (nO(r.fillMode) || (a.objectFit = r.fillMode),
                      nO(r.mirror) || (a.mirror = r.mirror),
                      'main' === n &&
                        !nO(r.small) &&
                        this._room.changeType(r.small, c.user)),
                    yield this._room.subscribe(c),
                    yield this._updateVideoPlayOption({
                      view: t,
                      playOption: a,
                      track: c,
                    }),
                    this._remoteVideoConfigMap.set(o, e),
                    this._emitTrackEvent(c);
                });
              }
              updateRemoteVideo(e) {
                return ab(this, null, function* () {
                  let { view: t, userId: i, streamType: n, option: r } = e,
                    o = ''.concat(i, '_').concat(n),
                    s = this._remoteVideoConfigMap.get(o);
                  if (!s || !this._room.remotePublishedUserMap.has(i)) return;
                  let a = {};
                  r &&
                    (nO(r.fillMode) || (a.objectFit = r.fillMode),
                    nO(r.mirror) || (a.mirror = r.mirror));
                  let c = null,
                    l = this._room.remotePublishedUserMap.get(i);
                  'main' === n &&
                    (null == l ? void 0 : l.muteState.hasVideo) &&
                    (c = l.remoteVideoTrack),
                    'sub' === n &&
                      (null == l ? void 0 : l.muteState.hasAuxiliary) &&
                      (c = l.remoteAuxiliaryTrack),
                    c &&
                      ('main' === n &&
                        r &&
                        !nO(r.small) &&
                        this._room.changeType(r.small, c.user),
                      yield this._updateVideoPlayOption({
                        view: t,
                        playOption: a,
                        track: c,
                        prevConfig: s,
                      })),
                    RO(s, e);
                });
              }
              stopRemoteVideo(e) {
                return ab(this, null, function* () {
                  return this._stopRemoteVideo(e);
                });
              }
              _stopRemoteVideo(e) {
                let t =
                  !(arguments.length > 1 && void 0 !== arguments[1]) ||
                  arguments[1];
                return ab(this, null, function* () {
                  let i = [],
                    n = this._room.remotePublishedUserMap.get(e.userId);
                  if (n) {
                    let {
                      muteState: t,
                      remoteVideoTrack: r,
                      remoteAuxiliaryTrack: o,
                    } = n;
                    'main' === e.streamType &&
                      (r.stop(), t.hasVideo && i.push(r)),
                      'sub' === e.streamType &&
                        (o.stop(), t.hasAuxiliary && i.push(o));
                  }
                  for (let e of i)
                    t &&
                      (yield this._room.unsubscribe(e),
                      this._mediaTrackMap.get(e.outMediaTrack) === e.userId &&
                        this._mediaTrackMap.delete(e.outMediaTrack));
                  this._remoteVideoConfigMap.delete(
                    ''.concat(e.userId, '_').concat(e.streamType),
                  );
                });
              }
              muteRemoteAudio(e, t) {
                return ab(this, null, function* () {
                  if ('*' === e)
                    if (t) yield this._stopRemoteAudio({ userId: e });
                    else {
                      let e = [...this._room.remotePublishedUserMap.values()];
                      for (let t of e)
                        t.muteState.hasAudio &&
                          (yield this._startRemoteAudio({ userId: t.userId }));
                    }
                  else
                    t
                      ? yield this._stopRemoteAudio({ userId: e })
                      : yield this._startRemoteAudio({ userId: e });
                  this._remoteAudioMuteMap.set(e, t);
                });
              }
              setRemoteAudioVolume(e, t) {
                if ('*' === e) {
                  let e = [...this._room.remotePublishedUserMap.values()];
                  for (let i of e)
                    this._updateAudioPlayOption({
                      playOption: { volume: t },
                      track: i.remoteAudioTrack,
                    });
                } else if (e) {
                  let i = this._room.remotePublishedUserMap.get(e);
                  i &&
                    this._updateAudioPlayOption({
                      playOption: { volume: t },
                      track: i.remoteAudioTrack,
                    });
                }
              }
              startPlugin(e, t) {
                return ab(this, null, function* () {
                  return e.start(t);
                });
              }
              updatePlugin(e, t) {
                return ab(this, null, function* () {
                  return e.update(t);
                });
              }
              stopPlugin(e, t) {
                return ab(this, null, function* () {
                  return e.stop(t);
                });
              }
              enableAudioVolumeEvaluation() {
                let e =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : 2e3,
                  t =
                    arguments.length > 1 &&
                    void 0 !== arguments[1] &&
                    arguments[1];
                this._room.enableAudioVolumeEvaluation(e, t);
              }
              on(e, t, i) {
                return super.on(e, t, i), this._eventListened.add(e), this;
              }
              off(e, t, i) {
                return (
                  '*' === e
                    ? (this._eventListened.clear(), this.removeAllListeners())
                    : super.off(e, t, i),
                  this
                );
              }
              getVideoTrack() {
                let e =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : { userId: '', streamType: 'main' },
                  { userId: t = '', streamType: i = 'main' } = e;
                if ('' === t) {
                  if ('main' === i && this._localVideoTrack)
                    return this._localVideoTrack.mediaTrack;
                  if ('sub' === i && this._localScreenTrack)
                    return this._localScreenTrack.mediaTrack;
                } else {
                  let e = this._room.remotePublishedUserMap.get(t);
                  if (e)
                    return 'main' === i
                      ? e.remoteVideoTrack.mediaTrack
                      : e.remoteAuxiliaryTrack.mediaTrack;
                }
                return null;
              }
              getAudioTrack(e) {
                if (e) {
                  let t = this._room.remotePublishedUserMap.get(e);
                  if (t) return t.remoteAudioTrack.mediaTrack;
                } else if (this._localAudioTrack)
                  return this._localAudioTrack.mediaTrack;
                return null;
              }
              setCurrentSpeaker(e) {
                var t;
                null == (t = this._localAudioTrack) || t.setAudioOutput(e),
                  this._room.remotePublishedUserMap.forEach((t) =>
                    t.remoteAudioTrack.setAudioOutput(e),
                  );
              }
              _startRemoteAudio(e) {
                return this._doStartRemoteAudio(e);
              }
              _doStartRemoteAudio(e) {
                return ab(this, null, function* () {
                  let { userId: t, option: i } = e;
                  if (this._remoteAudioConfigMap.has(t))
                    return void this._log.warn(
                      'remote audio has already started. userId:'.concat(t),
                    );
                  let n = this._room.remotePublishedUserMap.get(t);
                  if (!n) return;
                  let r = {};
                  i && (nO(i.volume) || (r.volume = i.volume));
                  let o = n.remoteAudioTrack;
                  this._listenOutputTrackChanged(o),
                    yield this._room.subscribe(o),
                    yield this._updateAudioPlayOption({
                      playOption: r,
                      track: o,
                    }),
                    this._remoteAudioConfigMap.set(t, e),
                    this._emitTrackEvent(o);
                });
              }
              _stopRemoteAudio(e) {
                let t =
                  !(arguments.length > 1 && void 0 !== arguments[1]) ||
                  arguments[1];
                return ab(this, null, function* () {
                  let i = this._room.remotePublishedUserMap.get(e.userId);
                  i &&
                    (i.remoteAudioTrack.stop(),
                    i.muteState.hasAudio &&
                      t &&
                      (yield this._room.unsubscribe(i.remoteAudioTrack)),
                    this._mediaTrackMap.get(
                      i.remoteAudioTrack.outMediaTrack,
                    ) === e.userId &&
                      this._mediaTrackMap.delete(
                        i.remoteAudioTrack.outMediaTrack,
                      )),
                    this._remoteAudioConfigMap.delete(''.concat(e.userId));
                });
              }
              _updateVideoPlayOption(e) {
                return ab(this, arguments, function (e) {
                  let { view: t, playOption: i, track: n, prevConfig: r } = e;
                  return (function* () {
                    if (nO(t) && r && r.view && !SO(i)) {
                      let e;
                      (e = cO(r.view) ? r.view : bO(r.view)),
                        e && (yield n.play(e, i));
                    }
                    if (!nO(t)) {
                      let e;
                      (e = cO(t) ? t : bO(t)),
                        e ? yield n.play(e, i) : n.stop();
                    }
                  })();
                });
              }
              _updateAudioPlayOption(e) {
                return ab(this, arguments, function (e) {
                  let { playOption: t = {}, track: i, prevConfig: n } = e;
                  return (function* () {
                    if (!i.isPlayCalled)
                      try {
                        yield i.play(null, t);
                      } catch (cN) {}
                    nO(t.muted) || i.setPlayerMute(t.muted),
                      nO(t.volume) || i.setAudioVolume(t.volume / 100);
                  })();
                });
              }
              _listenOutputTrackChanged(e) {
                0 === e.listeners('output-media-track-changed').length &&
                  e.on('output-media-track-changed', () =>
                    this._emitTrackEvent(e),
                  );
              }
              _emitTrackEvent(e) {
                let t = e.isRemote ? e.userId : '';
                e.outMediaTrack &&
                  this._mediaTrackMap.get(e.outMediaTrack) !== t &&
                  (this._mediaTrackMap.set(e.outMediaTrack, t),
                  this.emit(kM.TRACK, {
                    userId: t,
                    streamType: NM(e.streamType),
                    track: e.outMediaTrack,
                  }));
              }
              _checkTrackToPublish() {
                var e, t, i;
                let n = [];
                if (
                  ((null == (e = this._localAudioConfig)
                    ? void 0
                    : e.publish) &&
                    this._localAudioTrack &&
                    n.push(this._localAudioTrack),
                  (null == (t = this._localVideoConfig) ? void 0 : t.publish) &&
                    this._localVideoTrack &&
                    n.push(this._localVideoTrack),
                  null != (i = this._localScreenConfig) &&
                    i.publish &&
                    (this._localScreenTrack && n.push(this._localScreenTrack),
                    this._localScreenAudioTrack &&
                      n.push(this._localScreenAudioTrack)),
                  0 !== n.length)
                )
                  return this._room.publish(...n).catch(() => {});
              }
              _handleReceiveMode() {
                this._room.autoReceiveAudio &&
                  IP(this, this).add(kM.REMOTE_AUDIO_AVAILABLE, (e) =>
                    ab(this, [e], function (e) {
                      var t = this;
                      let { userId: i } = e;
                      return (function* () {
                        t._remoteAudioMuteMap.get('*') ||
                          t._remoteAudioMuteMap.get(i) ||
                          t._doStartRemoteAudio({ userId: i }).catch(() => {});
                      })();
                    }),
                  ),
                  this._room.autoReceiveVideo &&
                    IP(this, this).add(kM.REMOTE_VIDEO_AVAILABLE, (e) => {
                      let { userId: t, streamType: i } = e,
                        n = this._room.remotePublishedUserMap.get(t);
                      if (n) {
                        let e =
                          'main' === i
                            ? n.remoteVideoTrack
                            : n.remoteAuxiliaryTrack;
                        this._room
                          .subscribe(e)
                          .then(() => {
                            this._emitTrackEvent(e);
                          })
                          .catch(() => {});
                      }
                    });
              }
              _exitRoom() {
                return ab(this, null, function* () {
                  this._room.isJoined && (yield this._room.leave()),
                    [...this._remoteAudioConfigMap.keys()].forEach((e) => {
                      this._stopRemoteAudio({ userId: e }).catch();
                    }),
                    [...this._remoteVideoConfigMap.keys()].forEach((e) => {
                      let t = e.includes('main') ? 'main' : 'sub',
                        i = e.split('_'.concat(t))[0];
                      i &&
                        this._stopRemoteVideo({
                          userId: i,
                          streamType: t,
                        }).catch();
                    }),
                    this._remoteVideoConfigMap.clear(),
                    this._remoteAudioConfigMap.clear(),
                    this._remoteAudioMuteMap.clear(),
                    this._room.remotePublishedUserMap.forEach((e) => {
                      vP(e.remoteAudioTrack),
                        vP(e.remoteVideoTrack),
                        vP(e.remoteAuxiliaryTrack);
                    }),
                    vP(this);
                });
              }
              _stopScreenShare() {
                return ab(this, null, function* () {
                  var e, t, i;
                  if (this._localScreenTrack) {
                    if (this._room.isJoined) {
                      let t = [this._localScreenTrack];
                      this._localScreenAudioTrack &&
                        t.push(this._localScreenAudioTrack),
                        yield null == (e = this._room)
                          ? void 0
                          : e.unpublish(...t).catch(() => {});
                    }
                    this._localScreenTrack.stop(),
                      this._localScreenTrack.close(),
                      null == (t = this._localScreenAudioTrack) || t.stop(),
                      null == (i = this._localScreenAudioTrack) || i.close(),
                      vP(this._localScreenTrack),
                      (this._localScreenTrack = null),
                      (this._localScreenAudioTrack = null),
                      (this._localScreenConfig = null);
                  }
                });
              }
              _initActiveSpeaker() {
                return ab(this, null, function* () {
                  if (YM && !WP(YM))
                    this.emit(kM.DEVICE_CHANGED, {
                      type: 'speaker',
                      action: 'active',
                      device: YM,
                    });
                  else {
                    let e = yield zP();
                    if (e[0] && !WP(e[0]))
                      (YM = e[0]),
                        this.emit(kM.DEVICE_CHANGED, {
                          type: 'speaker',
                          action: 'active',
                          device: e[0],
                        });
                    else {
                      let e = (e) => {
                        let { track: t } = e;
                        'audio' === t.kind &&
                          (!YM || WP(YM)) &&
                          (this._initActiveSpeaker(),
                          UO.off('102', this._initActiveSpeaker));
                      };
                      UO.on('102', e);
                    }
                  }
                });
              }
              sendSEIMessage(e, t) {
                this._room.sendSEI(e, t || { seiPayloadType: 243 });
              }
              static setLogLevel(e, t) {
                jO.setLogLevel(e),
                  nO(t) || (t ? jO.enableUploadLog() : jO.disableUploadLog());
              }
              static isSupported() {
                return cw();
              }
              static getCameraList() {
                return YP(!0);
              }
              static getMicrophoneList() {
                return KP(!0);
              }
              static getSpeakerList() {
                return zP(!0);
              }
              static setCurrentSpeaker(e) {
                return ab(this, null, function* () {
                  (yield zP()).forEach((t) => {
                    t.deviceId === e &&
                      (KM.forEach((i) => {
                        i.setCurrentSpeaker(e),
                          i.emit(kM.DEVICE_CHANGED, {
                            type: 'speaker',
                            action: 'active',
                            device: t,
                          });
                      }),
                      (YM = t));
                  });
                });
              }
            },
            qM = zM;
          ob(qM, '_loggerManager', jO),
            ob(qM, 'EVENT', kM),
            ob(qM, 'ERROR_CODE', iM),
            ob(qM, 'TYPE', tM),
            ob(qM, 'frameWorkType', 30),
            rb(
              [
                PM(fM.TRTC.enterRoom),
                RM('room', (e, t) => {
                  let [i] = e,
                    [n] = t;
                  return (
                    (i.roomId || i.strRoomId) === (n.roomId || n.strRoomId) &&
                    i.userId === n.userId &&
                    i.sdkAppId === n.sdkAppId
                  );
                }),
                rL(
                  (e) =>
                    function (t) {
                      return (
                        this._log.setUserId(t.userId),
                        this._log.setSdkAppId(t.sdkAppId),
                        e.call(this, t).catch((e) => {
                          throw (vP(this), e);
                        })
                      );
                    },
                ),
                xM(),
              ],
              qM.prototype,
              'enterRoom',
              1,
            ),
            rb([xM()], qM.prototype, 'exitRoom', 1),
            rb(
              [
                PM(fM.TRTC.switchRole),
                CM('room', { merge: (e, t) => t }),
                xM(),
              ],
              qM.prototype,
              'switchRole',
              1,
            ),
            rb([xM()], qM.prototype, 'destroy', 1),
            rb(
              [
                PM(fM.TRTC.startLocalAudio),
                RM('audio', (e, t) => {
                  let [i] = e,
                    [n] = t;
                  var r, o;
                  return (
                    (null == (r = null == i ? void 0 : i.option)
                      ? void 0
                      : r.microphoneId) ===
                    (null == (o = null == n ? void 0 : n.option)
                      ? void 0
                      : o.microphoneId)
                  );
                }),
                xM(),
              ],
              qM.prototype,
              'startLocalAudio',
              1,
            ),
            rb(
              [
                PM(fM.TRTC.updateLocalAudio),
                CM('audio', {
                  debounce: {
                    delay: 200,
                    getKey: () => ''.concat(JM, '-localAudio'),
                    isNeedToDebounce: (e) => {
                      var t;
                      return !nO(
                        null == (t = e.option) ? void 0 : t.captureVolume,
                      );
                    },
                  },
                }),
                xM(),
              ],
              qM.prototype,
              'updateLocalAudio',
              1,
            ),
            rb([bM('audio'), xM()], qM.prototype, 'stopLocalAudio', 1),
            rb(
              [
                PM(fM.TRTC.startLocalVideo),
                RM('video', (e, t) => {
                  let [i] = e,
                    [n] = t;
                  var r, o;
                  return (
                    (null == (r = null == i ? void 0 : i.option)
                      ? void 0
                      : r.cameraId) ===
                    (null == (o = null == n ? void 0 : n.option)
                      ? void 0
                      : o.cameraId)
                  );
                }),
                xM(),
              ],
              qM.prototype,
              'startLocalVideo',
              1,
            ),
            rb(
              [PM(fM.TRTC.updateLocalVideo), CM('video'), xM()],
              qM.prototype,
              'updateLocalVideo',
              1,
            ),
            rb([bM('video'), xM()], qM.prototype, 'stopLocalVideo', 1),
            rb(
              [PM(fM.TRTC.startScreenShare), RM('screen', () => !0), xM()],
              qM.prototype,
              'startScreenShare',
              1,
            ),
            rb(
              [PM(fM.TRTC.updateScreenShare), CM('screen'), xM()],
              qM.prototype,
              'updateScreenShare',
              1,
            ),
            rb([xM()], qM.prototype, 'stopScreenShare', 1),
            rb(
              [
                PM(fM.TRTC.startRemoteVideo),
                RM(
                  (e) => 'v'.concat(e.userId).concat(e.streamType),
                  () => !0,
                ),
                xM({
                  getRemoteId: (e) =>
                    ''.concat(e.userId, '_').concat(e.streamType),
                }),
              ],
              qM.prototype,
              'startRemoteVideo',
              1,
            ),
            rb(
              [
                PM(fM.TRTC.updateRemoteVideo),
                CM((e) => 'v'.concat(e.userId).concat(e.streamType)),
                xM({
                  getRemoteId: (e) =>
                    ''.concat(e.userId, '_').concat(e.streamType),
                }),
              ],
              qM.prototype,
              'updateRemoteVideo',
              1,
            ),
            rb(
              [
                PM(fM.TRTC.stopRemoteVideo),
                rL(
                  (e) =>
                    function (t) {
                      return ab(this, null, function* () {
                        if ('*' === t.userId) {
                          let e = [];
                          return (
                            this._room.remotePublishedUserMap.forEach((t) => {
                              this._remoteVideoConfigMap.has(
                                ''.concat(t.userId, '_', 'main'),
                              ) &&
                                e.push(
                                  this.stopRemoteVideo({
                                    streamType: 'main',
                                    userId: t.userId,
                                  }).catch(() => {}),
                                ),
                                this._remoteVideoConfigMap.has(
                                  ''.concat(t.userId, '_', 'sub'),
                                ) &&
                                  e.push(
                                    this.stopRemoteVideo({
                                      streamType: 'sub',
                                      userId: t.userId,
                                    }).catch(() => {}),
                                  );
                            }),
                            Promise.all(e)
                          );
                        }
                        return e.call(this, t);
                      });
                    },
                ),
                xM({
                  getRemoteId: (e) =>
                    ''.concat(e.userId, '_').concat(e.streamType),
                }),
              ],
              qM.prototype,
              'stopRemoteVideo',
              1,
            ),
            rb(
              [bM((e) => 'v'.concat(e.userId).concat(e.streamType))],
              qM.prototype,
              '_stopRemoteVideo',
              1,
            ),
            rb(
              [PM(...fM.TRTC.muteRemoteAudio), xM({ getRemoteId: (e) => e })],
              qM.prototype,
              'muteRemoteAudio',
              1,
            ),
            rb(
              [
                LM(...fM.TRTC.setRemoteAudioVolume),
                (function (e, t) {
                  return rL(
                    (i, n) =>
                      function () {
                        for (
                          var n = arguments.length, r = new Array(n), o = 0;
                          o < n;
                          o++
                        )
                          r[o] = arguments[o];
                        var s, a;
                        let c =
                          null == (s = wM.get(this)) ? void 0 : s.get(t(...r));
                        c && c > 0 && clearTimeout(c);
                        let l = window.setTimeout(() => {
                          i.apply(this, r);
                        }, e);
                        wM.has(this)
                          ? null == (a = wM.get(this)) || a.set(t(...r), l)
                          : wM.set(this, new Map([[t(...r), l]]));
                      },
                  );
                })(200, (e) => e),
                xM({ getRemoteId: (e) => e }),
              ],
              qM.prototype,
              'setRemoteAudioVolume',
              1,
            ),
            rb(
              [
                UM('start'),
                RM((e, t) => e.getAlias() + e.getGroup(t)),
                xM({ namePrefix: (e) => e.getName() }),
              ],
              qM.prototype,
              'startPlugin',
              1,
            ),
            rb(
              [
                UM('update'),
                CM((e, t) => e.getAlias() + e.getGroup(t)),
                xM({ namePrefix: (e) => e.getName() }),
              ],
              qM.prototype,
              'updatePlugin',
              1,
            ),
            rb(
              [
                UM('stop'),
                bM((e, t) => e.getAlias() + e.getGroup(t)),
                xM({ namePrefix: (e) => e.getName() }),
              ],
              qM.prototype,
              'stopPlugin',
              1,
            ),
            rb(
              [LM(...fM.TRTC.enableAudioVolumeEvaluation)],
              qM.prototype,
              'enableAudioVolumeEvaluation',
              1,
            ),
            rb(
              [
                RM(
                  (e) => 'a'.concat(e.userId),
                  () => !0,
                ),
              ],
              qM.prototype,
              '_startRemoteAudio',
              1,
            ),
            rb(
              [
                rL(
                  (e) =>
                    function (t) {
                      return ab(this, null, function* () {
                        return '*' === t.userId
                          ? Promise.all(
                              [
                                ...this._room.remotePublishedUserMap.values(),
                              ].map((e) =>
                                this._stopRemoteAudio(
                                  eb(ZC({}, t), { userId: e.userId }),
                                ).catch(() => {}),
                              ),
                            )
                          : e.call(this, t);
                      });
                    },
                ),
                bM((e) => 'a'.concat(e.userId)),
              ],
              qM.prototype,
              '_stopRemoteAudio',
              1,
            ),
            rb([bM('room')], qM.prototype, '_exitRoom', 1),
            rb([bM('screen')], qM.prototype, '_stopScreenShare', 1),
            rb(
              [
                PM(fM.TRTC.sendSEIMessage),
                (function (e) {
                  let { timesInSecond: t, maxSizeInSecond: i, getSize: n } = e;
                  return rL((e, r) => {
                    let o = new Map();
                    return (
                      UO.on(BO.ROOM_DESTROY, (e) => {
                        let { room: t } = e;
                        return o.delete(t);
                      }),
                      function () {
                        let s = o.get(this);
                        for (
                          var a = arguments.length, c = new Array(a), l = 0;
                          l < a;
                          l++
                        )
                          c[l] = arguments[l];
                        if (
                          (s ||
                            ((s = {
                              callCountInSecond: 0,
                              timestamp: 0,
                              totalSizeInSecond: 0,
                            }),
                            o.set(this, s)),
                          0 === s.timestamp
                            ? (s.timestamp = Date.now())
                            : Date.now() - s.timestamp > 1e3 &&
                              ((s.timestamp = Date.now()),
                              (s.callCountInSecond = 0),
                              (s.totalSizeInSecond = 0)),
                          n && (s.totalSizeInSecond += n(...c)),
                          0 !== s.timestamp &&
                            Date.now() - s.timestamp < 1e3 &&
                            (s.callCountInSecond >= t ||
                              s.totalSizeInSecond > i))
                        )
                          throw new gb({
                            code: mb.INVALID_OPERATION,
                            message: QO({
                              key: KO.CALL_FREQUENCY_LIMIT,
                              data: {
                                isTimes: s.callCountInSecond >= t,
                                isSize: s.totalSizeInSecond > i,
                                name: r,
                                timesInSecond: t,
                                maxSizeInSecond: i,
                              },
                            }),
                          });
                        s.callCountInSecond++, e.call(this, ...c);
                      }
                    );
                  });
                })({
                  timesInSecond: 30,
                  maxSizeInSecond: 8e3,
                  getSize: function () {
                    for (
                      var e = arguments.length, t = new Array(e), i = 0;
                      i < e;
                      i++
                    )
                      t[i] = arguments[i];
                    return t[0].byteLength;
                  },
                }),
              ],
              qM.prototype,
              'sendSEIMessage',
              1,
            ),
            rb([PM(fM.TRTC.create)], qM, '_create', 1);
          var QM = qM,
            XM = class {
              constructor() {
                (this._set = new Set()),
                  UO.on(BO.LEAVE_SUCCESS, this.delete, this);
              }
              add(e) {
                let { room: t, roomId: i } = e;
                if ('rtc' === t.scene) return;
                let n = this.getKey(
                  t.userId,
                  i || t.roomId,
                  t.sdkAppId,
                  t.useStringRoomId,
                );
                this._set.add(n);
              }
              delete(e) {
                let { room: t, roomId: i } = e;
                if ('rtc' === t.scene) return;
                let n = this.getKey(
                  t.userId,
                  t.roomId || i,
                  t.sdkAppId,
                  t.useStringRoomId,
                );
                this._set.delete(n);
              }
              getKey(e, t, i, n) {
                return ''
                  .concat(i, '_')
                  .concat(t, '_')
                  .concat(e, '_')
                  .concat(n);
              }
              isJoined(e) {
                let { userId: t, roomId: i, sdkAppId: n, room: r } = e;
                return (
                  'rtc' !== r.scene &&
                  this._set.has(this.getKey(t, i, n, r.useStringRoomId))
                );
              }
            };
          function $M() {
            return ab(this, null, function* () {
              let e, t;
              try {
                let t = yield KP();
                e = t && t.length;
              } catch (u) {}
              try {
                let e = yield YP();
                t = e && e.length;
              } catch (u) {}
              let i = { microphone: e, camera: t },
                {
                  isH264EncodeSupported: n,
                  isVp8EncodeSupported: r,
                  isH264DecodeSupported: o,
                  isVp8DecodeSupported: s,
                } = this.checkSystemResult.detail,
                a = JO.basis(),
                c = {
                  webRTC: a.isWebRTCSupported,
                  getUserMedia: a.isGetUserMediaSupported,
                  webSocket: a.isWebSocketsSupported,
                  screenShare: a.isScreenShareSupported,
                  webAudio: a.isWebAudioSupported,
                  h264Encode: n,
                  h264Decode: o,
                  vp8Encode: r,
                  vp8Decode: s,
                },
                l = { browser: a.browser, os: a.os, trtc: c, devices: i },
                d = {
                  isWebCodecSupported: a.isWebCodecSupported,
                  isMediaSessionSupported: a.isMediaSessionSupported,
                  isWebTransportSupported: a.isWebTransportSupported,
                };
              Xw.uploadEvent({
                log: 'trtcstats-'.concat(JSON.stringify(l)),
                userId: this.userId,
              }),
                this._log.info('TrtcStats-'.concat(JSON.stringify(l))),
                Xw.uploadEvent({
                  log: 'trtcadvancedstats-'.concat(JSON.stringify(d)),
                  userId: this.userId,
                });
            });
          }
          var ZM = nb(cb()),
            eV = '1',
            tV = '5',
            iV = '2',
            nV = '3',
            rV = '4',
            oV = {
              CLIENT_BANNED: 9,
              CHANNEL_SETUP_RESULT: 19,
              CHANNEL_RECONNECT_RESULT: 514,
              JOIN_ROOM_RESULT: 20,
              PEER_JOIN: 4134,
              PEER_LEAVE: 4135,
              STREAM_ADDED: 16,
              STREAM_REMOVED: 18,
              UPLINK_NETWORK_STATS: 22,
              UPDATE_REMOTE_MUTE_STAT: 23,
              PUBLISH_RESULT: 4098,
              PUBLISH_STATE_CHANGE_RESULT: 4112,
              UNPUBLISH_RESULT: 4100,
              SUBSCRIBE_RESULT: 4102,
              UNSUBSCRIBE_RESULT: 4104,
              SUBSCRIBE_CHANGE_RESULT: 4106,
              MUTE_RESULT: 4108,
              UPDATE_OFFER_RESULT: 4128,
              START_PUBLISH_TENCENT_CDN_RES: 1286,
              STOP_PUBLISH_TENCENT_CDN_RES: 1288,
              START_PUBLISH_GIVEN_CDN_RES: 777,
              STOP_PUBLISH_GIVEN_CDN_RES: 779,
              START_MIX_TRANSCODE_RES: 781,
              STOP_MIX_TRANSCODE_RES: 783,
              USER_LIST_RES: 4137,
              SWITCH_ROLE_RES: 4110,
              UPDATE_CONSTRAINT_CONFIG_RES: 772,
              REBUILD_PEER_CONNECTION_RES: 4150,
              SPC_PUBLISH_RESULT: 4146,
              SPC_SUBSCRIBE_RESULT: 4156,
              ABILITY_STATUS_REPORT_RESULT: 4158,
            },
            sV = [
              oV.UPDATE_REMOTE_MUTE_STAT,
              oV.UPLINK_NETWORK_STATS,
              oV.USER_LIST_RES,
              oV.MUTE_RESULT,
            ],
            aV = {
              CLIENT_BANNED: 'client-banned',
              CHANNEL_SETUP_RESULT: 'channel-setup-result',
              CHANNEL_RECONNECT_RESULT: 'channel-reconnect-result',
              JOIN_ROOM_RESULT: 'join-room-result',
              PEER_JOIN: 'peer-join',
              PEER_LEAVE: 'peer-leave',
              STREAM_ADDED: 'stream-added',
              STREAM_REMOVED: 'stream-removed',
              UPLINK_NETWORK_STATS: 'uplink-network-stats',
              UPDATE_REMOTE_MUTE_STAT: 'update-remote-mute-stat',
              PUBLISH_RESULT: 'publish-result',
              PUBLISH_STATE_CHANGE_RESULT: 'publish-state-change-result',
              UNPUBLISH_RESULT: 'unpublish-result',
              SUBSCRIBE_RESULT: 'subscribe-result',
              SUBSCRIBE_CHANGE_RESULT: 'subscribe-change-result',
              UNSUBSCRIBE_RESULT: 'unsubscribe-result',
              UPDATE_OFFER_RESULT: 'update-offer-result',
              START_PUBLISH_TENCENT_CDN_RES: 'start-publish-tencent-cdn-res',
              STOP_PUBLISH_TENCENT_CDN_RES: 'stop-publish-tencent-cdn-res',
              START_PUBLISH_GIVEN_CDN_RES: 'start-publish-given-cdn-res',
              STOP_PUBLISH_GIVEN_CDN_RES: 'stop-publish-given-cdn-res',
              START_MIX_TRANSCODE_RES: 'start-mix-transcode-res',
              STOP_MIX_TRANSCODE_RES: 'stop-mix-transcode-res',
              USER_LIST_RES: 'user-list-res',
              SWITCH_ROLE_RES: 'switch_role_res',
              MUTE_RESULT: 'mute-result',
              UPDATE_CONSTRAINT_CONFIG_RES: 'update-contraint-config-res',
              REBUILD_PEER_CONNECTION_RES: 'rebuild-pc-res',
              SPC_PUBLISH_RESULT: 'spc-publish-result',
              SPC_SUBSCRIBE_RESULT: 'spc-subscribe-result',
              ABILITY_STATUS_REPORT_RESULT: 'ability-status-report',
            },
            cV = 'publish_change',
            lV = 'join',
            dV = 'leave',
            uV = 'quality_report',
            hV = 'mute_uplink',
            pV = 'publish',
            _V = 'publish_state_change',
            mV = 'unpublish',
            fV = 'subscribe',
            gV = 'unsubscribe',
            TV = 'subscribe_change',
            EV = 'start_publishing',
            SV = 'stop_publishing',
            IV = 'start_push_user_cdn',
            vV = 'stop_push_user_cdn',
            yV = 'start_mcu_mix',
            AV = 'stop_mcu_mix',
            RV = 'get_user_list',
            CV = 'change_role',
            bV = 'update_constraint_config',
            kV = 'rebuild_pc',
            NV = 'join/v2',
            DV = 'publish/v2',
            OV = 'subscribe/v3',
            wV = 'ability_status_report',
            PV = 'reconnect',
            LV = new WeakMap();
          function MV(e) {
            let {
              settings: t = { retries: 5, timeout: 2e3 },
              onError: i,
              onRetrying: n,
              onRetryFailed: r,
            } = e;
            return function (e, o, s) {
              let a = VO({
                retryFunction: s.value,
                settings: t,
                onError(t) {
                  let { error: n, retry: r, reject: s, retryFuncArgs: a } = t;
                  i &&
                    i.call(
                      this,
                      n,
                      () => {
                        var t;
                        null != (t = LV.get(e)) && t.has(o) ? r() : s(n);
                      },
                      s,
                      a,
                    );
                },
                onRetrying(t, i) {
                  var r;
                  iO(n) && n.call(this, t, i),
                    null != (r = LV.get(e)) &&
                      r.has(o) &&
                      (LV.get(e).get(o).stopRetry = i);
                },
                onRetryFailed: r,
              });
              return (
                (s.value = function () {
                  let t = LV.get(e);
                  for (
                    var i = arguments.length, n = new Array(i), r = 0;
                    r < i;
                    r++
                  )
                    n[r] = arguments[r];
                  return (
                    t
                      ? t.set(o, { args: n })
                      : LV.set(e, new Map([[o, { args: n }]])),
                    a.apply(this, n).finally(() => {
                      var t;
                      return null == (t = LV.get(e)) ? void 0 : t.delete(o);
                    })
                  );
                }),
                s
              );
            };
          }
          function VV(e) {
            let { fnName: t, callback: i, validateArgs: n = !0 } = e;
            return function (e, r, o) {
              let s = o.value;
              return (
                (o.value = function () {
                  for (
                    var r, o, a = arguments.length, c = new Array(a), l = 0;
                    l < a;
                    l++
                  )
                    c[l] = arguments[l];
                  if (null != (r = LV.get(e)) && r.has(t)) {
                    let { stopRetry: r, args: s } = LV.get(e).get(t),
                      a = !0;
                    if (n)
                      for (let e of s)
                        if (!c.find((t) => t === e)) {
                          a = !1;
                          break;
                        }
                    a &&
                      (i && i.apply(this, c),
                      r && r(),
                      null == (o = LV.get(e)) || o.delete(t));
                  }
                  return s.apply(this, c);
                }),
                o
              );
            };
          }
          var xV = null,
            UV = !0;
          function FV(e) {
            sO(e) &&
              e !== UV &&
              ((UV = e), jO.info('setIsNeedToSchedule '.concat(e)));
          }
          function BV(e) {
            return ab(this, arguments, function (e) {
              let {
                userId: t,
                sdkAppId: i,
                useStringRoomId: n,
                roomId: r,
                userSig: o,
                version: s,
                frameWorkType: a,
              } = e;
              return (function* () {
                if (!UV && xV) return { isCached: !0, result: xV };
                let e = { delta: 0, count: [1, 1], msg: [], detail: [] };
                try {
                  let c = new FormData();
                  c.append('userId', String(t)),
                    c.append('sdkAppId', String(i)),
                    c.append('isStrGroupId', String(n)),
                    c.append('groupId', String(r)),
                    c.append('sdkVersion', s),
                    c.append('userSig', String(o)),
                    a && c.append('frameWorkType', String(a));
                  let l = fO(),
                    d = yield (function (e, t, i) {
                      return new Promise((n, r) => {
                        let o = null;
                        mO([
                          JV(
                            (e) => (t.count[0] = e + 1),
                            (e) => {
                              let { error: i, retry: n } = e;
                              (t.msg[0] = i.message), o || n();
                            },
                          )(GV(i, LN.MAIN), e, {
                            get timeout() {
                              return 1e3 * ZD(2 + t.count[0]);
                            },
                          }),
                          JV(
                            (e) => (t.count[1] = e + 1),
                            (e) => {
                              let { error: i, retry: n } = e;
                              (t.msg[1] = i.message), o || n();
                            },
                          )(GV(i, LN.BACKUP), e, {
                            get timeout() {
                              return 1e3 * ZD(2 + t.count[1]);
                            },
                          }),
                        ])
                          .then((e) => {
                            (o = e), n(o);
                          })
                          .catch(r);
                      });
                    })(c, e, i);
                  d.config &&
                    (d.config.loggerDomain && pN(d.config.loggerDomain),
                    sO(d.config.scheduleCache) && FV(!d.config.scheduleCache)),
                    (e.delta = fO() - l);
                  let u = (function (e, t, i) {
                    let n = performance.getEntriesByType('resource'),
                      r = GV(e, LN.MAIN),
                      o = GV(e, LN.BACKUP),
                      s = {
                        totalCost: 0,
                        local: 0,
                        dns: 0,
                        tcp: 0,
                        tls: 0,
                        request: 0,
                        response: 0,
                      };
                    for (let a of n)
                      if (
                        a.startTime >= i &&
                        (a.name === r || a.name === o) &&
                        a.transferSize > 0
                      ) {
                        let e = a.name === r ? LN.MAIN : LN.BACKUP,
                          i = Math.round(a.duration),
                          n = Math.round(a.domainLookupStart - a.startTime),
                          o = Math.round(
                            a.domainLookupEnd - a.domainLookupStart,
                          ),
                          c = Math.round(
                            a.requestStart - a.secureConnectionStart,
                          ),
                          l = Math.round(
                            a.secureConnectionStart - a.connectStart,
                          ),
                          d = Math.round(a.responseStart - a.requestStart),
                          u = Math.round(a.responseEnd - a.responseStart),
                          h = [n, o, c, l, d, u];
                        Xw.uploadEvent({
                          log: 'stat-schedule-net:'
                            .concat(i, '(')
                            .concat(h.join('->'), ') ')
                            .concat(e),
                          userId: t,
                        }),
                          (s = eb(ZC({}, s), {
                            totalCost: i,
                            local: n,
                            dns: o,
                            tcp: l,
                            tls: c,
                            request: d,
                            response: u,
                          }));
                        break;
                      }
                    return s;
                  })(Number(i), t, l);
                  return (xV = d), { isCached: !1, result: d, detailCost: u };
                } catch (c) {
                  let e = cO(c) ? c[0] : c,
                    t = oO(e.code) ? e.code : 0,
                    i = 'schedule failed'.concat(
                      e.message ? ': '.concat(e.message) : '',
                    ),
                    n = new gb({
                      code: mb.SCHEDULE_FAILED,
                      extraCode: t,
                      message: QO({
                        key: KO.JOIN_ROOM_FAILED,
                        data: { error: i, code: t },
                      }),
                    });
                  throw (jO.error(i, t), n);
                }
              })();
            });
          }
          document &&
            document.head.insertAdjacentHTML(
              'beforeend',
              Object.values(ID)
                .map((e) =>
                  '<link rel="dns-prefetch" href="https://'.concat(e, '">'),
                )
                .join('\r\n'),
            ),
            UO.on('28', () => FV(!0)),
            UO.on('63', () => FV(!0)),
            UO.on('84', () => FV(!0)),
            UO.on('201', (e) => {
              'RECONNECTING' === e.state && FV(!0);
            }),
            UO.on('202', (e) => {
              'RECONNECTING' === e.state && FV(!0);
            });
          var HV = { main: '', backup: '' };
          function jV(e) {
            cO(e) ? ((HV.main = e[0]), (HV.backup = e[1])) : (HV.main = e);
          }
          function GV(e) {
            let t,
              i =
                arguments.length > 1 && void 0 !== arguments[1]
                  ? arguments[1]
                  : LN.MAIN;
            return (
              (t = FD(e)
                ? i === LN.MAIN
                  ? ID.MAIN_OVERSEA
                  : ID.BACKUP_OVERSEA
                : i === LN.MAIN
                ? ID.MAIN
                : ID.BACKUP),
              'https://'.concat(HV[i] || t, '/api/v1/config')
            );
          }
          function WV(e, t, i) {
            return new Promise((n, r) => {
              LO({ url: e, body: t, timeout: i.timeout })
                .then((e) => {
                  0 === e.data.code
                    ? n(e.data.data)
                    : r({ code: e.data.code, message: e.data.msg });
                })
                .catch(r);
            });
          }
          var JV = (e, t) =>
            VO({
              retryFunction: WV,
              settings: { retries: 3, timeout: 0 },
              onError: t,
              onRetrying: e,
            });
          var KV = new Set();
          var YV = class extends ZM.default {
            constructor(e) {
              var t, i;
              super(),
                ob(this, 'room'),
                ob(this, 'url'),
                ob(this, 'backupUrl'),
                ob(this, 'race'),
                ob(this, '_socketInUse'),
                ob(this, '_socket'),
                ob(this, '_backupSocket'),
                ob(this, '_signalInfo', {
                  tinyId: void 0,
                  clientIp: '',
                  signalIp: '',
                  relayIp: '',
                  relayInnerIp: '',
                  relayPort: 0,
                }),
                ob(this, '_currentState', 'DISCONNECTED'),
                ob(this, '_isReconnecting', !1),
                ob(this, '_seq', 0),
                ob(this, '_log'),
                ob(this, '_lastMessageTime', -1),
                ob(this, '_connnectStartTime', -1),
                ob(this, '_stopConnectRetry'),
                ob(this, 'bytesSent', 0),
                ob(this, 'bytesReceived', 0),
                ob(this, 'keepAlive', !1),
                (this.room = e.room),
                (this.race = e.race || !0),
                ((null ==
                (i = null == (t = this.room.scheduleResult) ? void 0 : t.config)
                  ? void 0
                  : i.keepAliveClient) || 0) -
                  KV.size >
                  0 &&
                  this.room.enableSPC &&
                  ((this.keepAlive = !0), KV.add(this)),
                (this.url = e.url),
                (this.backupUrl = e.backupUrl),
                (this._seq = 0),
                (this._log = jO.createLogger({
                  id: 'ws',
                  userId: this.userId,
                  sdkAppId: this.sdkAppId,
                })),
                (this.onmessage = this.onmessage.bind(this)),
                (this.onerror = this.onerror.bind(this)),
                (this.onclose = this.onclose.bind(this));
            }
            get urlParam() {
              let e = '?sdkAppId='
                .concat(encodeURIComponent(this.sdkAppId), '&userId=')
                .concat(encodeURIComponent(this.userId), '&userSig=')
                .concat(encodeURIComponent(this.userSig), '&keepAlive=')
                .concat(encodeURIComponent(Number(this.keepAlive)));
              return this.race ? ''.concat(e, '&race=1') : e;
            }
            get _urlWithParam() {
              return ''
                .concat(this.url)
                .concat(this.race ? '/v2/ws' : '')
                .concat(this.urlParam);
            }
            get _backupUrlWithParam() {
              return ''
                .concat(this.backupUrl)
                .concat(this.race ? '/v2/ws' : '')
                .concat(this.urlParam);
            }
            get isConnected() {
              return 'CONNECTED' === this._currentState;
            }
            get isConnecting() {
              return 'CONNECTING' === this._currentState;
            }
            get sdkAppId() {
              return this.room.sdkAppId;
            }
            get userId() {
              return this.room.userId;
            }
            get userSig() {
              return this.room.userSig;
            }
            get isOnline() {
              return (
                'CONNECTED' === this._currentState &&
                Date.now() - this._lastMessageTime < 12e3
              );
            }
            connect() {
              return ab(this, arguments, function () {
                var e = this;
                let t =
                  arguments.length > 0 && void 0 !== arguments[0]
                    ? arguments[0]
                    : 1e4;
                return (function* () {
                  if (e.isConnected) return Promise.resolve();
                  e._log.info(
                    'connect to ['
                      .concat(e.url, ', ')
                      .concat(e.backupUrl, ']')
                      .concat(t ? ' timeout: '.concat(t) : '', ' keepAlive: ')
                      .concat(Number(e.keepAlive)),
                  );
                  let i = e._urlWithParam,
                    n = e._backupUrlWithParam;
                  (e._connnectStartTime = fO()),
                    (e._socketInUse = yield mO([
                      e.connectWS({ url: i, isMain: !0, timeout: t }),
                      e.connectWS({ url: n, isMain: !1, timeout: t }),
                    ])),
                    e.unbindAndCloseSocket(
                      e._socketInUse === e._socket ? LN.BACKUP : LN.MAIN,
                    ),
                    e.emitConnectionStateChanged('CONNECTED');
                })();
              });
            }
            connectWS(e) {
              let { url: t, timeout: i, isMain: n } = e,
                r = new WebSocket(t);
              this.bindSocket(r),
                n ? (this._socket = r) : (this._backupSocket = r);
              let o = -1;
              return new Promise((e, t) => {
                (r.onclose = t),
                  (r.onerror = t),
                  (r.onopen = () => e(r)),
                  i &&
                    (o = setTimeout(() => {
                      this.unbindAndCloseSocket(n ? LN.MAIN : LN.BACKUP),
                        t(
                          new gb({
                            code: mb.SIGNAL_CHANNEL_SETUP_FAILED,
                            message: 'ws connect timeout',
                          }),
                        );
                    }, i));
              }).finally(() => {
                (r.onclose = null),
                  (r.onerror = null),
                  (r.onopen = null),
                  clearTimeout(o);
              });
            }
            bindSocket(e) {
              e.addEventListener('close', this.onclose),
                e.addEventListener('error', this.onerror),
                e.addEventListener('message', this.onmessage);
            }
            unbindSocket(e) {
              e.removeEventListener('close', this.onclose),
                e.removeEventListener('error', this.onerror),
                e.removeEventListener('message', this.onmessage);
            }
            unbindAndCloseSocket(e) {
              if (e === LN.MAIN) {
                if (this._socket) {
                  this.unbindSocket(this._socket);
                  try {
                    this._socket.close(1e3);
                  } catch (sD) {}
                  this._socket = null;
                }
              } else if (this._backupSocket) {
                this.unbindSocket(this._backupSocket);
                try {
                  this._backupSocket.close(1e3);
                } catch (sD) {}
                this._backupSocket = null;
              }
            }
            onclose(e) {
              if (
                e.target === this._socketInUse &&
                (this._log.warn(
                  ''
                    .concat(
                      e.target === this._socket ? 'main' : 'backup',
                      ' is closed code:',
                    )
                    .concat(e.code, ' ')
                    .concat(e.reason),
                ),
                this.emitConnectionStateChanged('DISCONNECTED'),
                !e.wasClean || 1e3 !== e.code)
              ) {
                (this._socketInUse.onclose = null),
                  this._socketInUse.close(4011);
                let e = this._socketInUse === this._socket;
                this.unbindAndCloseSocket(e ? LN.MAIN : LN.BACKUP),
                  (this._socketInUse = null),
                  this.reconnect();
              }
            }
            onerror(e) {
              this._log.error(
                ''.concat(
                  e.target === this._socket ? 'main' : 'backup',
                  ' error observed',
                ),
              ),
                e.target === this._socketInUse &&
                  (this.unbindAndCloseSocket(LN.MAIN),
                  this.unbindAndCloseSocket(LN.BACKUP),
                  (this._socketInUse = null),
                  this.reconnect());
            }
            onmessage(e) {
              if (!this.isConnected) return;
              (this._lastMessageTime = Date.now()),
                (this.bytesReceived += wO(e.data));
              let t = JSON.parse(e.data),
                { cmd: i, data: n } = t,
                r = Object.values(oV),
                o = Object.keys(oV)[r.indexOf(i)],
                s = aV[o];
              switch (
                (sV.includes(i) ||
                  (this._log.debug(
                    'received '.concat(i, ' msg: ').concat(e.data),
                  ),
                  s && this._log.info('Received event: [ '.concat(s, ' ]'))),
                i)
              ) {
                case oV.CHANNEL_SETUP_RESULT:
                  if (0 === t.code)
                    (this._signalInfo.clientIp = n.clientIp),
                      (this._signalInfo.signalIp = n.signalInnerIp),
                      n.svrTime &&
                        (function (e) {
                          Tb = e - new Date().getTime();
                          let t = new Date();
                          t.setTime(e),
                            jO.info(
                              'baseTime from server: '
                                .concat(t, ' offset: ')
                                .concat(Tb),
                            );
                        })(n.svrTime),
                      this._log.info('ChannelSetup Success'),
                      UO.emit(BO.API_SUCCESS_RATE, {
                        room: this.room,
                        apiName: 'WebsocketConnect',
                        cost: fO() - this._connnectStartTime,
                      }),
                      (this._connnectStartTime = -1),
                      this.emit(eV, { signalInfo: this._signalInfo });
                  else {
                    let e = new gb({
                      code: mb.SIGNAL_CHANNEL_SETUP_FAILED,
                      extraCode: t.code,
                      message: QO({
                        key: KO.SIGNAL_CHANNEL_SETUP_FAILED,
                        data: { errorCode: t.code, errorMsg: t.message },
                      }),
                    });
                    this._log.error(''.concat(t.code, ', ').concat(t.message)),
                      this.close(),
                      UO.emit(BO.API_SUCCESS_RATE, {
                        room: this.room,
                        apiName: 'WebsocketConnect',
                        error: e,
                      }),
                      this.emit(tV, e);
                  }
                  break;
                case oV.JOIN_ROOM_RESULT:
                  0 === t.code &&
                    ((this._signalInfo.relayIp = n.relayOuterIp),
                    (this._signalInfo.relayInnerIp = n.relayInnerIp),
                    (this._signalInfo.relayPort = n.relayPort),
                    (this._signalInfo.tinyId = t.tinyId),
                    this._log.info(
                      'signalIp:'
                        .concat(this._signalInfo.signalIp, ' clientIp:')
                        .concat(this._signalInfo.clientIp, ' relayIp: ')
                        .concat(this._signalInfo.relayIp),
                    )),
                    this.emit(s, { data: t });
                  break;
                default:
                  this.emit(s, { data: t });
              }
            }
            reGetSignalChannelUrl() {
              return ab(this, null, function* () {
                try {
                  FV(!0), yield this.room.schedule(this.room.roomId);
                  let { mainUrl: e, backupUrl: t } =
                    this.room.getSignalChannelUrl();
                  (this.url = e), (this.backupUrl = t);
                } catch (sN) {}
              });
            }
            reconnect() {
              return ab(this, null, function* () {
                if (!this._isReconnecting) {
                  if (!this.room.isJoined && this.keepAlive)
                    return void this.close();
                  this._isReconnecting = !0;
                  try {
                    this._log.warn('reconnect'), yield this.connect();
                    let { roomId: e, useStringRoomId: t } = this.room,
                      {
                        relayIp: i,
                        relayInnerIp: n,
                        relayPort: r,
                      } = this._signalInfo,
                      { data: o } = yield this.sendWaitForResponse({
                        command: PV,
                        data: {
                          roomId: e,
                          useStringRoomId: t,
                          relayInnerIp: n,
                          relayOuterIp: i,
                          relayPort: r,
                        },
                        responseCommand: aV.CHANNEL_RECONNECT_RESULT,
                      });
                    0 === o.code
                      ? (this._log.warn('reconnect success'),
                        this.stopReconnection(),
                        UO.emit(BO.API_SUCCESS_RATE, {
                          room: this.room,
                          apiName: 'WebsocketReconnect',
                          cost: fO() - this._connnectStartTime,
                        }),
                        (this._connnectStartTime = -1),
                        this.room.syncUserList(),
                        this.room.checkConnectionsToReconnect())
                      : (this._log.warn(
                          'reconnect failed, '
                            .concat(o.code, ' ')
                            .concat(o.message),
                        ),
                        this.room.reJoin());
                  } catch (sN) {
                    this.room.reJoin();
                  }
                }
              });
            }
            send(e) {
              let t =
                arguments.length > 1 && void 0 !== arguments[1]
                  ? arguments[1]
                  : {};
              if (this.isConnected && !this.room.isLeft) {
                let i = {
                    cmd: e,
                    data: t,
                    userId: this.userId,
                    tinyId: this._signalInfo.tinyId,
                    seq: ++this._seq,
                  },
                  n = JSON.stringify(i);
                return (
                  this._socketInUse.send(n), (this.bytesSent += wO(n)), i.seq
                );
              }
            }
            sendWaitForResponse(e) {
              let {
                command: t,
                data: i,
                timeout: n = 5e3,
                responseCommand: r,
                commandDesc: o,
                enableLog: s = !0,
              } = e;
              return new Promise((e, a) => {
                let c = setTimeout(() => {
                    this.off(r, l);
                    let e = new gb({
                      code: mb.API_CALL_TIMEOUT,
                      message: QO({
                        key: KO.API_CALL_TIMEOUT,
                        data: { commandDesc: o, command: t },
                      }),
                    });
                    s && this._log.warn(e), a(e);
                  }, n),
                  l = (t) => {
                    t.data.seq === d && (clearTimeout(c), this.off(r, l), e(t));
                  };
                this.on(r, l);
                let d = this.send(t, i);
              });
            }
            sendWaitForResponseWithRetry(e) {
              let {
                commandDesc: t,
                command: i,
                retries: n = 0,
                retryTimeout: r = 0,
              } = e;
              return VO({
                retryFunction: this.sendWaitForResponse,
                onRetrying: (e) => {
                  this._log.warn(
                    ''
                      .concat(t || i, ' timeout observed, retrying [')
                      .concat(e, '/')
                      .concat(n, ']'),
                  );
                },
                settings: { retries: n, timeout: r },
                context: this,
              })(e);
            }
            getCurrentState() {
              return this._currentState;
            }
            getSignalInfo() {
              return this._signalInfo;
            }
            stopReconnection() {
              (this._isReconnecting = !1),
                this._stopConnectRetry && this._stopConnectRetry();
            }
            close() {
              this._log.info('closed'),
                KV.delete(this),
                this.stopReconnection(),
                (this._signalInfo = {
                  tinyId: void 0,
                  clientIp: '',
                  signalIp: '',
                  relayIp: '',
                  relayInnerIp: '',
                  relayPort: 0,
                }),
                (this._socketInUse = null),
                (this.bytesSent = 0),
                (this.bytesReceived = 0),
                this._stopConnectRetry && this._stopConnectRetry(),
                this.unbindAndCloseSocket(LN.MAIN),
                this.unbindAndCloseSocket(LN.BACKUP),
                this.emitConnectionStateChanged('DISCONNECTED');
            }
            stopKeepAliveIn() {
              let e =
                arguments.length > 0 && void 0 !== arguments[0]
                  ? arguments[0]
                  : 3600;
              if (this.keepAlive) {
                this._log.info('stopKeepAlive in '.concat(e, 's'));
                let t = setTimeout(() => {
                    (this.keepAlive = !1),
                      this._log.info('close due to not used '.concat(e, 's')),
                      this.close();
                  }, 1e3 * e),
                  i = (e) => {
                    e instanceof Uw &&
                      'join' === e.action &&
                      (this._log.info('stopKeepAlive clear timeout'),
                      clearTimeout(t),
                      this.room.off(Ww.STATECHANGED, i));
                  };
                this.room.on(Ww.STATECHANGED, i);
              }
            }
            emitConnectionStateChanged(e) {
              e !== this._currentState &&
                (this._log.info(
                  ''.concat(this._currentState, ' -> ').concat(e),
                ),
                this.emit(iV, { prevState: this._currentState, state: e }),
                (this._currentState = e),
                'CONNECTED' === e && this.emit(nV));
            }
          };
          rb(
            [
              MV({
                settings: { retries: 1 / 0, timeout: 2e3 },
                onError(e, t) {
                  this.room.isDestroyed || t();
                },
                onRetrying(e, t) {
                  this._log.warn('retrying to connect '.concat(e)),
                    e >= 3 && e % 3 == 0 && this.reGetSignalChannelUrl(),
                    t &&
                      ((this._stopConnectRetry = t),
                      this.room.isDestroyed && t());
                },
              }),
            ],
            YV.prototype,
            'connect',
            1,
          );
          var zV = nb(cb()),
            qV = class {
              constructor(e) {
                let t =
                  arguments.length > 1 &&
                  void 0 !== arguments[1] &&
                  arguments[1];
                (this.dataView = e),
                  this.isSEI &&
                    (t
                      ? this.addPreventionByte()
                      : this.removePreventionByte());
              }
              addPreventionByte() {
                let e = this.seiPayloadStartIndex,
                  t = this.dataView.byteLength - 2,
                  i = [],
                  n = 0;
                for (let o = e; o <= t; o++) {
                  let e = this.dataView.getInt8(o);
                  switch (e) {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                      2 === n && (i.push(3), (n = 0)),
                        0 == e ? n++ : (n = 0),
                        i.push(e);
                      break;
                    default:
                      (n = 0), i.push(e);
                  }
                }
                i.push(this.dataView.getInt8(this.dataView.byteLength - 1));
                let r = new DataView(
                  new Uint8Array([
                    ...new Uint8Array(this.dataView.buffer).slice(0, e),
                    ...i,
                  ]).buffer,
                );
                this.dataView = r;
              }
              removePreventionByte() {
                let e = this.seiPayloadStartIndex,
                  t = this.dataView.byteLength - 1,
                  i = [],
                  n = 0;
                for (let o = e; o <= t; o++)
                  switch (this.dataView.getInt8(o)) {
                    case 0:
                      n++, i.push(this.dataView.getInt8(o));
                      break;
                    case 3:
                      2 !== n && i.push(this.dataView.getInt8(o)), (n = 0);
                      break;
                    default:
                      i.push(this.dataView.getInt8(o)), (n = 0);
                  }
                let r = new DataView(
                  new Uint8Array([
                    ...new Uint8Array(this.dataView.buffer).slice(0, e),
                    ...i,
                  ]).buffer,
                );
                this.dataView = r;
              }
              get isSEI() {
                return 6 === this.dataView.getUint8(4);
              }
              get seiPayloadStartIndex() {
                let e = 6;
                for (
                  let t = 6;
                  t < this.dataView.buffer.byteLength &&
                  (e++, 255 === this.dataView.getUint8(t));
                  t++
                );
                return e;
              }
              get seiPayloadType() {
                return this.isSEI ? this.dataView.getUint8(5) : null;
              }
              get seiPayload() {
                if (!this.isSEI) return null;
                let e = 0,
                  t = 6;
                for (let r = 6; r < this.dataView.buffer.byteLength; r++) {
                  let i = this.dataView.getUint8(r);
                  if ((t++, 255 !== i)) {
                    e += i;
                    break;
                  }
                  e += 255;
                }
                let i = new ArrayBuffer(e),
                  n = new DataView(i);
                for (let r = 0; r < i.byteLength; r++, t++)
                  n.setInt8(r, this.dataView.getInt8(t));
                return n;
              }
            },
            QV = class {
              constructor(e, t) {
                (this._singlePC = e),
                  (this._log = t),
                  ob(this, '_seiMessageList', []),
                  ob(this, '_smallSeiMessageList', []),
                  ob(this, '_seiPayloadType', 243),
                  ob(this, '_seiAbortMap', new Map()),
                  ob(this, '_nonSeiAbortMap', new Map()),
                  ob(this, 'onSEIMessage', null);
              }
              isRunning(e) {
                return this._seiAbortMap.has(e);
              }
              start(e) {
                let t = e.direction === LN.TRANSCEIVER_DIRECTION_SENDONLY,
                  i = (t ? e.sender : e.receiver).createEncodedStreams(),
                  n = i.readable,
                  r = i.writable,
                  o = new TransformStream({
                    transform: t
                      ? (t, i) => this.encodeVideoFrame(t, i, e)
                      : (t, i) => this.decodeVideoFrame(t, i, e),
                  }),
                  s = new AbortController();
                n
                  .pipeThrough(o)
                  .pipeTo(r, s)
                  .catch((e) => {
                    this._log.warn(e);
                  }),
                  this._seiAbortMap.set(e, s);
              }
              restart(e) {
                this.stop(e), this.start(e);
              }
              stop(e) {
                var t;
                null == (t = this._seiAbortMap.get(e)) || t.abort(),
                  this._seiAbortMap.delete(e);
              }
              destroy() {
                this._seiAbortMap.forEach((e) => e.abort()),
                  this._seiAbortMap.clear(),
                  this._nonSeiAbortMap.forEach((e) => e.abort()),
                  this._nonSeiAbortMap.clear(),
                  (this.onSEIMessage = null);
              }
              handleEncodedStreams() {
                try {
                  this._singlePC
                    .getPeerConnection()
                    .getTransceivers()
                    .forEach((e, t) => {
                      var i, n;
                      if ('inactive' !== e.direction && e.mid)
                        if (t < 4)
                          1 === t || 2 === t
                            ? this.isRunning(e) || this.start(e)
                            : this._nonSeiAbortMap.has(e) ||
                              this.pipeSenderOrReceiver(e);
                        else {
                          let r = (t - 4) % 3 == 1,
                            o = (t - 4) % 3 == 2;
                          (null ==
                          (n = null == (i = e.receiver) ? void 0 : i.track)
                            ? void 0
                            : n.kind) === LN.VIDEO &&
                          (r || o)
                            ? this.isRunning(e) || this.start(e)
                            : this._nonSeiAbortMap.has(e) ||
                              this.pipeSenderOrReceiver(e);
                        }
                    });
                } catch (YL) {
                  this._log.warn(YL);
                }
              }
              pipeSenderOrReceiver(e) {
                let t =
                    e.direction === LN.TRANSCEIVER_DIRECTION_SENDONLY
                      ? e.sender
                      : e.receiver,
                  { readable: i, writable: n } = t.createEncodedStreams(),
                  r = new AbortController();
                this._nonSeiAbortMap.set(e, r), i.pipeTo(n, r).catch(() => {});
              }
              push(e, t) {
                var i, n;
                t &&
                  t.seiPayloadType &&
                  (this._seiPayloadType = t.seiPayloadType),
                  this._seiMessageList.push(e),
                  (null ==
                  (n =
                    null == (i = this._singlePC.getPeerConnection())
                      ? void 0
                      : i.getSenders()[2])
                    ? void 0
                    : n.track) && this._smallSeiMessageList.push(e);
              }
              hasSEI(e) {
                let t = new DataView(e);
                return 1 === t.getInt32(0) && 6 === t.getInt8(4);
              }
              isEmptyFrame(e) {
                return 'empty' === e.type || 0 === e.data.byteLength;
              }
              getNaluCount(e) {
                let t = 0,
                  i = 0,
                  n = new DataView(e);
                for (let r = 0; r < e.byteLength; r++)
                  switch (n.getUint8(r)) {
                    case 0:
                      t++;
                      break;
                    case 1:
                      (2 === t || 3 === t) && i++, (t = 0);
                      break;
                    default:
                      t = 0;
                  }
                return i;
              }
              encodeVideoFrame(e, t, i) {
                try {
                  let t =
                    2 === Number(i.mid)
                      ? this._smallSeiMessageList
                      : this._seiMessageList;
                  if (
                    this._singlePC.isUsingH264 &&
                    t.length > 0 &&
                    !this.isEmptyFrame(e)
                  ) {
                    let i = 9 - this.getNaluCount(e.data);
                    if (i <= 0) return;
                    let n = t
                        .splice(0, i)
                        .reverse()
                        .map(this.encodeSEINalu.bind(this)),
                      r = n.reduce((e, t) => e + t.dataView.byteLength, 0),
                      o = new ArrayBuffer(r + e.data.byteLength),
                      s = new DataView(o),
                      a = new DataView(e.data),
                      c = 0;
                    for (let e = 0; e < n.length; e++)
                      for (let t = 0; t < n[e].dataView.byteLength; t++)
                        s.setInt8(c++, n[e].dataView.getInt8(t));
                    for (let t = 0; t < e.data.byteLength; t++)
                      s.setInt8(c++, a.getInt8(t));
                    (e.data = o),
                      this._log.debug(''.concat(n.length, ' sei sent'));
                  }
                } catch (aN) {
                  this._log.warn(aN);
                }
                t.enqueue(e);
              }
              decodeVideoFrame(e, t, i) {
                try {
                  if (
                    this._singlePC.isUsingH264 &&
                    !this.isEmptyFrame(e) &&
                    this.hasSEI(e.data)
                  ) {
                    let t = [],
                      n = new DataView(e.data),
                      r = 0,
                      o = -1,
                      s = -1;
                    for (let i = 0; i < e.data.byteLength; i++) {
                      let a = n.getUint8(i);
                      if (0 === a) r++;
                      else if (1 === a) {
                        if (2 === r || 3 === r) {
                          let a = i - r;
                          if (
                            (-1 === o
                              ? (o = a)
                              : -1 === s &&
                                ((s = a),
                                t.push(
                                  new qV(new DataView(n.buffer.slice(o, s))),
                                ),
                                (o = a),
                                (s = -1)),
                            6 !== n.getUint8(i + 1))
                          ) {
                            e.data = new DataView(n.buffer.slice(a)).buffer;
                            break;
                          }
                        }
                        r = 0;
                      } else r = 0;
                    }
                    this._log.debug(''.concat(t.length, ' sei received')),
                      iO(this.onSEIMessage) &&
                        t.reverse().forEach((e) => {
                          let t = Number(i.mid);
                          this.onSEIMessage({
                            seiPayloadType: e.seiPayloadType,
                            data: e.seiPayload.buffer,
                            mid: t,
                            streamType: (t - 4) % 3 == 2 ? 'auxiliary' : 'main',
                          });
                        });
                  }
                } catch (aN) {
                  this._log.warn(aN);
                }
                t.enqueue(e);
              }
              encodeSEINalu(e) {
                let t = e.byteLength,
                  i = parseInt(String(t / 255), 10),
                  n = t % 255,
                  r = [];
                r.push(0, 0, 0, 1, 6, this._seiPayloadType);
                for (let s = 0; s < i; s++) r.push(255);
                r.push(n);
                let o = new DataView(e);
                return (
                  r.push(...new Uint8Array(o.buffer)),
                  r.push(128),
                  new qV(new DataView(new Uint8Array(r).buffer), !0)
                );
              }
            },
            XV = 0,
            $V = !1,
            ZV = new Set(),
            ex = !1,
            tx = class {
              constructor(e) {
                ob(this, 'userId'),
                  ob(this, 'tinyId'),
                  ob(this, '_sdpSemantics'),
                  ob(this, '_isUplink'),
                  ob(this, '_room'),
                  ob(this, '_log'),
                  ob(this, '_signalChannel'),
                  ob(this, '_isErrorObserved', !1),
                  ob(this, '_waitForPeerConnectionConnectedPromise'),
                  ob(
                    this,
                    '_waitForPeerConnectionConnectedPromiseReject',
                    null,
                  ),
                  ob(this, '_peerConnection', null),
                  ob(this, '_emitter', new zV.default()),
                  ob(this, '_currentState', 'DISCONNECTED'),
                  ob(this, '_isReconnecting', !1),
                  ob(this, '_reconnectionCount', 0),
                  ob(this, '_reconnectionTimer', -1),
                  ob(this, '_isFirstConnection', !0),
                  ob(this, '_prevTime', -1),
                  ob(this, '_enableSEI'),
                  ob(this, '_sei'),
                  ob(this, '_localAddress'),
                  ob(this, '_remoteAddress'),
                  (this.userId = e.userId),
                  (this.tinyId = e.tinyId),
                  (this._room = e.room),
                  (this._sdpSemantics = e.room.sdpSemantics),
                  (this._isUplink = e.isUplink),
                  (this._log = jO.createLogger({
                    id: 'n',
                    userId: this._room.userId,
                    remoteUserId: this.userId,
                    sdkAppId: this._room.sdkAppId,
                    isLocal: this._isUplink,
                  })),
                  (this._signalChannel = e.signalChannel),
                  (this._enableSEI = e.enableSEI),
                  this._enableSEI &&
                    Nw &&
                    (this._sei = new QV(this, this._log, this._isUplink));
              }
              beforeConnect() {
                this._prevTime < 0 && (this._prevTime = fO());
              }
              afterConnect(e) {
                return ab(this, null, function* () {
                  try {
                    yield e,
                      this._isFirstConnection
                        ? ((this._isFirstConnection = !1),
                          UO.emit(BO.API_SUCCESS_RATE, {
                            room: this._room,
                            apiName: 'PeerConnectionConnect',
                            cost: Math.min(fO() - this._prevTime, 3e4),
                          }))
                        : this._isReconnecting &&
                          UO.emit(BO.API_SUCCESS_RATE, {
                            room: this._room,
                            apiName: 'PeerConnectionReconnect',
                            cost: fO() - this._prevTime,
                          }),
                      (this._prevTime = -1);
                  } catch (sN) {
                    throw (
                      (this._isFirstConnection
                        ? ((this._isFirstConnection = !1),
                          UO.emit(BO.API_SUCCESS_RATE, {
                            room: this._room,
                            apiName: 'PeerConnectionConnect',
                            error: sN,
                          }))
                        : this._isReconnecting &&
                          this._reconnectionCount >= 3 &&
                          UO.emit(BO.API_SUCCESS_RATE, {
                            room: this._room,
                            apiName: 'PeerConnectionReconnect',
                            error: sN,
                          }),
                      sN)
                    );
                  }
                });
              }
              initialize() {
                let e = {
                  encodedInsertableStreams: this._enableSEI && Nw,
                  iceServers: this._room.getIceServers(),
                  iceTransportPolicy: this._room.getIceTransportPolicy(),
                  sdpSemantics: this._sdpSemantics,
                  bundlePolicy: 'max-bundle',
                  rtcpMuxPolicy: 'require',
                  tcpCandidatePolicy: 'disable',
                  IceTransportsType: 'nohost',
                };
                (this._peerConnection = new RTCPeerConnection(e)),
                  (this._peerConnection.onconnectionstatechange =
                    this.onConnectionStateChange.bind(this));
              }
              close(e) {
                this._log.info('close connection'),
                  this._emitter.emit('closed', e),
                  this._isReconnecting && this.stopReconnection(),
                  this.closePeerConnection(),
                  this._sei && (this._sei.destroy(), (this._sei = null)),
                  ZV.delete(this);
              }
              closePeerConnection() {
                let e =
                  arguments.length > 0 &&
                  void 0 !== arguments[0] &&
                  arguments[0];
                this._peerConnection &&
                  (this._log.info('close pc'),
                  (this._peerConnection.onconnectionstatechange = null),
                  this._peerConnection.close(),
                  (this._peerConnection = null),
                  e && this.emitConnectionStateChangedEvent('DISCONNECTED')),
                  this._waitForPeerConnectionConnectedPromiseReject &&
                    this._waitForPeerConnectionConnectedPromiseReject(
                      new gb({
                        code: mb.API_CALL_ABORTED,
                        message: 'connection closed',
                      }),
                    );
              }
              getDTLSTransportState() {
                if (!this._peerConnection) return tD;
                let e = null;
                if (this._isUplink) {
                  if (!Sw() || 0 === this._peerConnection.getSenders().length)
                    return tD;
                  e = this._peerConnection.getSenders()[0].transport;
                } else {
                  if (!Ew() || 0 === this._peerConnection.getReceivers().length)
                    return tD;
                  e = this._peerConnection.getReceivers()[0].transport;
                }
                return e ? e.state : tD;
              }
              onConnectionStateChange(e) {
                let t = this._peerConnection.iceConnectionState,
                  i = this.getDTLSTransportState();
                if (
                  (this._log.info(
                    'connectionState: '
                      .concat(e.target.connectionState, ', ICE: ')
                      .concat(t, ', DTLS: ')
                      .concat(i),
                  ),
                  e.target.connectionState === iD.CONNECTING &&
                    this.emitConnectionStateChangedEvent('CONNECTING'),
                  e.target.connectionState === iD.FAILED ||
                    e.target.connectionState === iD.CLOSED)
                ) {
                  let n = 'connection '
                      .concat(
                        e.target.connectionState,
                        '. ICE Transport state: ',
                      )
                      .concat(t, ', DTLS Transport state: ')
                      .concat(i),
                    r = new gb({ message: n, code: mb.ICE_TRANSPORT_ERROR });
                  this.emitConnectionStateChangedEvent('DISCONNECTED'),
                    this.startReconnection(),
                    this._isErrorObserved || this._emitter.emit('error', r);
                }
                (e.target.connectionState === iD.CONNECTED ||
                  e.target.connectionState === iD.COMPLETED) &&
                  (this.logSelectedCandidate(),
                  Xw.logSuccessEvent({
                    userId: this._room.userId,
                    eventType: cD.ICE_CONNECTION_STATE,
                  }),
                  this.emitConnectionStateChangedEvent('CONNECTED'));
              }
              emitConnectionStateChangedEvent(e) {
                return (
                  e !== this._currentState &&
                  ('CONNECTED' === e
                    ? ((XV = 0), ($V = !1), (ex = !0), ZV.add(this))
                    : ZV.delete(this),
                  UO.emit(BO.PEER_CONNECTION_STATE_CHANGED, {
                    room: this._room,
                    prevState: this._currentState,
                    state: e,
                    remoteUserId: this._isUplink ? void 0 : this.userId,
                  }),
                  this._emitter.emit('connection-state-changed', {
                    prevState: this._currentState,
                    state: e,
                  }),
                  (this._currentState = e),
                  !0)
                );
              }
              getPeerConnection() {
                return this._peerConnection;
              }
              getRoom() {
                return this._room;
              }
              getUserId() {
                return this.userId;
              }
              getTinyId() {
                return this.tinyId;
              }
              logSelectedCandidate() {
                return ab(this, null, function* () {
                  if (!this._peerConnection) return;
                  let e = yield this._peerConnection.getStats();
                  for (let [, t] of e)
                    if (hw(t)) {
                      let i = e.get(t.localCandidateId),
                        n = e.get(t.remoteCandidateId);
                      i &&
                        (this._log.info(
                          'local candidate: '
                            .concat(i.candidateType, ' ')
                            .concat(i.protocol, ':')
                            .concat(i.ip || i.address, ':')
                            .concat(i.port, ' ')
                            .concat(i.networkType || '', ' ')
                            .concat(
                              'relay' === i.candidateType
                                ? 'relayProtocol:'.concat(i.relayProtocol)
                                : '',
                            ),
                        ),
                        (this._localAddress = ''
                          .concat(i.ip || i.address, ':')
                          .concat(i.port))),
                        n &&
                          (this._log.info(
                            'remote candidate: '
                              .concat(n.candidateType, ' ')
                              .concat(n.protocol, ':')
                              .concat(n.ip || n.address, ':')
                              .concat(n.port),
                          ),
                          (this._remoteAddress = ''
                            .concat(n.protocol, ':')
                            .concat(n.ip || n.address)));
                      break;
                    }
                });
              }
              getCurrentState() {
                return this._currentState;
              }
              waitForPeerConnectionConnected() {
                return (
                  this._waitForPeerConnectionConnectedPromise ||
                    ((this._waitForPeerConnectionConnectedPromise = new Promise(
                      (e, t) => {
                        if ('CONNECTED' === this._currentState) return e();
                        this._waitForPeerConnectionConnectedPromiseReject = t;
                        let i = (t) => {
                            'CONNECTED' === t.state &&
                              (clearTimeout(o), r(), e());
                          },
                          n = (e) => {
                            let { room: i } = e;
                            i === this._room &&
                              (clearTimeout(o),
                              r(),
                              t(
                                new gb({
                                  code: mb.API_CALL_ABORTED,
                                  message: QO({
                                    key: KO.CONNECTION_ABORTED,
                                    data: 'leave room',
                                  }),
                                }),
                              ));
                          },
                          r = () => {
                            UO.off(BO.LEAVE_SUCCESS, n, this),
                              this._emitter.off(
                                'connection-state-changed',
                                i,
                                this,
                              );
                          },
                          o = setTimeout(() => {
                            r();
                            let e = new gb({
                              code: mb.API_CALL_TIMEOUT,
                              message: 'connection timeout',
                            });
                            (XV += 1),
                              ((e) => XV > 2 && !$V && 0 === ZV.size && e)(
                                this._signalChannel.isConnected,
                              ) &&
                                (this._log.warn('firewall restrition'),
                                ($V = !0),
                                this._emitter.emit('firewall-restriction')),
                              t(e);
                          }, SD);
                        UO.on(BO.LEAVE_SUCCESS, n, this),
                          this._emitter.on('connection-state-changed', i, this);
                      },
                    )),
                    (this._waitForPeerConnectionConnectedPromise =
                      this._waitForPeerConnectionConnectedPromise.finally(
                        () => {
                          (this._waitForPeerConnectionConnectedPromise = null),
                            (this._waitForPeerConnectionConnectedPromiseReject =
                              null);
                        },
                      ))),
                  this._waitForPeerConnectionConnectedPromise
                );
              }
              getReconnectionCount() {
                return this._reconnectionCount;
              }
              startReconnection() {
                (this._isReconnecting = !0), this.reconnect();
              }
              clearReconnectionTimer() {
                -1 !== this._reconnectionTimer &&
                  (clearTimeout(this._reconnectionTimer),
                  (this._reconnectionTimer = -1));
              }
              stopReconnection() {
                this._log.info('stop reconnection'),
                  (this._isReconnecting = !1),
                  (this._reconnectionCount = 0),
                  this.clearReconnectionTimer(),
                  this._signalChannel.off(nV, this.reconnect, this);
              }
              beforeReconnect() {
                if (-1 !== this._reconnectionTimer)
                  return (
                    this._log.warn('reconnect() is reconnecting, ignore'), -1
                  );
                if (this._reconnectionCount >= oD()) {
                  this._log.warn(
                    'SDK has tried reconnect for '.concat(
                      this._reconnectionCount,
                      ' times, but all failed, please check your network',
                    ),
                  ),
                    this.stopReconnection();
                  let e = new gb({
                    code: this._isUplink
                      ? mb.UPLINK_RECONNECTION_FAILED
                      : mb.DOWNLINK_RECONNECTION_FAILED,
                    message: QO({
                      key: this._isUplink
                        ? KO.UPLINK_RECONNECTION_FAILED
                        : KO.DOWNLINK_RECONNECTION_FAILED,
                    }),
                  });
                  return (
                    this.emitConnectionStateChangedEvent('DISCONNECTED'),
                    this._emitter.emit('error', e),
                    -1
                  );
                }
                return this._signalChannel.isConnected
                  ? ((this._reconnectionCount += 1),
                    this._log.warn(
                      'reconnect() trying ['.concat(
                        this._reconnectionCount,
                        ']',
                      ),
                    ),
                    1)
                  : (this._log.warn(
                      'reconnect() signal channel is not connected, suspend reconnection until signal is connected',
                    ),
                    this._signalChannel.once(nV, this.reconnect, this),
                    -1);
              }
              on(e, t, i) {
                this._emitter.on(e, t, i);
              }
              off(e, t, i) {
                this._emitter.off(e, t, i);
              }
              getIsReconnecting() {
                return this._isReconnecting;
              }
              get isH264() {
                var e, t;
                return !(
                  null ==
                    (t =
                      null == (e = this._peerConnection)
                        ? void 0
                        : e.remoteDescription) || !t.sdp.includes('H264')
                );
              }
            },
            ix = nb(hb()),
            nx = function (e) {
              return ix.default.parse(e);
            },
            rx = function (e) {
              return ix.default.write(e);
            };
          function ox(e) {
            return Object.keys(e).filter((t) => e[t]);
          }
          var sx = class extends tx {
              constructor(e) {
                super(eb(ZC({}, e), { isUplink: !1 })),
                  ob(this, '_flag', 0),
                  ob(this, 'role', 'anchor'),
                  ob(this, 'remoteAudioTrack'),
                  ob(this, 'remoteVideoTrack'),
                  ob(this, 'remoteAuxiliaryTrack'),
                  ob(this, 'ssrc', { audio: 0, video: 0, auxiliary: 0 }),
                  ob(this, '_isSDPExchanging', !1),
                  (this.flag = e.flag),
                  (this.remoteAudioTrack =
                    e.remoteAudioTrack || new OL(this._room, this)),
                  (this.remoteVideoTrack =
                    e.remoteVideoTrack || new wL(this._room, this)),
                  (this.remoteAuxiliaryTrack =
                    e.remoteAuxiliaryTrack || new PL(this._room, this));
              }
              get subscribeState() {
                let e = { audio: !1, video: !1, auxiliary: !1, smallVideo: !1 };
                return (
                  this.remoteVideoTrack.isSubscribed &&
                    (8 & this.remoteVideoTrack.mediaType
                      ? (e.smallVideo = !0)
                      : (e.video = !0)),
                  this.remoteAudioTrack.isSubscribed && (e.audio = !0),
                  this.remoteAuxiliaryTrack.isSubscribed && (e.auxiliary = !0),
                  e
                );
              }
              get muteState() {
                return IO(this.flag, this.userId);
              }
              get flag() {
                return this._flag;
              }
              set flag(e) {
                var t, i, n;
                e !== this._flag &&
                  ((this._flag = e),
                  null == (t = this.remoteAudioTrack) || t.onFlagChanged(),
                  null == (i = this.remoteVideoTrack) || i.onFlagChanged(),
                  null == (n = this.remoteAuxiliaryTrack) || n.onFlagChanged());
              }
              get hasMainStream() {
                return (
                  this.muteState.hasAudio ||
                  this.muteState.hasVideo ||
                  this.muteState.hasSmall
                );
              }
              get hasAuxStream() {
                return this.muteState.hasAuxiliary;
              }
              get isMainStreamSubscribed() {
                return (
                  (this.subscribeState.audio ||
                    this.subscribeState.video ||
                    this.subscribeState.smallVideo) &&
                  (this.muteState.hasAudio ||
                    this.muteState.hasVideo ||
                    this.muteState.hasSmall)
                );
              }
              get isAuxStreamSubscribed() {
                return (
                  this.subscribeState.auxiliary && this.muteState.hasAuxiliary
                );
              }
              get isSmallStreamSubscribed() {
                return (
                  this.subscribeState.smallVideo && this.muteState.hasSmall
                );
              }
              get isBigStreamSubscribed() {
                return this.subscribeState.video && this.muteState.hasVideo;
              }
              isStreamUnpublished(e) {
                return e === LN.MAIN
                  ? !this.muteState.hasAudio && !this.muteState.hasVideo
                  : !this.muteState.hasAuxiliary;
              }
              initialize() {
                super.initialize(),
                  this.installEvents(),
                  (this._peerConnection.ontrack = this.onTrack.bind(this));
              }
              close(e) {
                super.close(e),
                  this.emitConnectionStateChangedEvent('DISCONNECTED'),
                  this.remoteAudioTrack.close(),
                  this.remoteVideoTrack.close(),
                  this.remoteAuxiliaryTrack.close(),
                  this.uninstallEvents();
              }
              installEvents() {}
              uninstallEvents() {
                this._emitter.removeAllListeners();
              }
              emitConnectionStateChangedEvent(e) {
                var t, i;
                let n = this._currentState,
                  r = super.emitConnectionStateChangedEvent(e);
                return (
                  r &&
                    n !== e &&
                    (null == (t = this.remoteVideoTrack) ||
                      t.emit('connection-state-changed', {
                        prevState: n,
                        state: e,
                      }),
                    null == (i = this.remoteAuxiliaryTrack) ||
                      i.emit('connection-state-changed', {
                        prevState: n,
                        state: e,
                      })),
                  r
                );
              }
              onTrack(e) {
                let t = e.streams[0],
                  { track: i } = e,
                  n = t.id === WN ? LN.MAIN : LN.AUXILIARY;
                this._log.debug('ontrack '.concat(n, ' ').concat(i.kind));
                let r = LN.AUDIO;
                i.kind === LN.VIDEO &&
                  (r = n === LN.MAIN ? LN.VIDEO : LN.AUXILIARY);
                let o = this.remoteAudioTrack;
                r === LN.VIDEO
                  ? (o = this.remoteVideoTrack)
                  : r === LN.AUXILIARY && (o = this.remoteAuxiliaryTrack),
                  o.setInputMediaStreamTrack(i);
              }
              addRRTRLine(e) {
                let t = e.split('\r\n'),
                  i = new Map();
                t.forEach((e, n) => {
                  /^a=rtcp-fb:/.test(e) &&
                    t[n + 1] &&
                    !/^a=rtcp-fb:/.test(t[n + 1]) &&
                    i.set(
                      n + 1,
                      ''.concat(e.match(/^a=rtcp-fb:\d+/)[0], ' rrtr'),
                    );
                });
                let n = [...i];
                for (let r = 0; r < n.length; r++) {
                  let [e, i] = n[r];
                  t.splice(e + r, 0, i);
                }
                return t.join('\r\n');
              }
              addSPSDescription(e) {
                let t = nx(e);
                return (
                  t.media.forEach((e) => {
                    e.type === LN.VIDEO &&
                      e.fmtp.forEach((e) => {
                        e.config += ';sps-pps-idr-in-keyframe=1';
                      });
                  }),
                  rx(t)
                );
              }
              removeSDESDescription(e) {
                let t = [
                    'urn:ietf:params:rtp-hdrext:sdes:mid',
                    'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id',
                    'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
                  ],
                  i = nx(e);
                return (
                  i.media.forEach((e) => {
                    !e.ext || (e.ext = e.ext.filter((e) => !t.includes(e.uri)));
                  }),
                  rx(i)
                );
              }
              isSubscriptionStateNotChanged(e) {
                return (
                  JSON.stringify(e) === JSON.stringify(this.subscribeState)
                );
              }
              subscribe(e, t) {
                return ab(this, null, function* () {
                  var i, n;
                  try {
                    if (
                      (((null == (i = this._peerConnection)
                        ? void 0
                        : i.connectionState) === iD.NEW ||
                        (null == (n = this._peerConnection)
                          ? void 0
                          : n.connectionState) === iD.CONNECTING) &&
                        (yield this.waitForPeerConnectionConnected()),
                      this.isSubscriptionStateNotChanged(e))
                    )
                      return void (
                        this._peerConnection ||
                        (this.initialize(), yield this.connect(e))
                      );
                    if (
                      (this._log.info(
                        'subscribe '.concat(t, ' ').concat(JSON.stringify(e)),
                      ),
                      this._peerConnection || this._isSDPExchanging)
                    ) {
                      let t = 'subscribe_change';
                      Object.values(e).find((e) => !0 === e) ||
                        (t = 'unsubscribe'),
                        yield this.sendSubscription(t, e);
                    } else this.initialize(), yield this.connect(e);
                  } catch (cN) {
                    throw this._room.isJoined && this.isStreamUnpublished(t)
                      ? (this._log.warn(
                          ''
                            .concat(cN.message, ' ')
                            .concat(JSON.stringify(this.muteState)),
                        ),
                        new gb({
                          code: mb.REMOTE_STREAM_NOT_EXIST,
                          message: 'remote user '.concat(
                            this.userId,
                            ' unpublished stream',
                          ),
                        }))
                      : cN;
                  }
                });
              }
              unsubscribe(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let { remoteTracks: i, streamType: n } = e;
                  return (function* () {
                    if (
                      'CONNECTED' === t._currentState &&
                      (('main' === n && !t.isMainStreamSubscribed) ||
                        ('auxiliary' === n && !t.isAuxStreamSubscribed))
                    )
                      return void t._log.info(
                        ''.concat(n, ' stream already unsubscribed'),
                      );
                    let e = ZC({}, t.subscribeState);
                    i.forEach((t) => {
                      switch (t.mediaType) {
                        case 1:
                          e.audio = !1;
                          break;
                        case 4:
                          e.video = !1;
                          break;
                        case 8:
                          e.smallVideo = !1;
                          break;
                        case 2:
                          e.auxiliary = !1;
                      }
                    });
                    let r = 'subscribe_change';
                    Object.values(e).find((e) => !0 === e) ||
                      (r = 'unsubscribe'),
                      t._log.info(
                        ''
                          .concat('unsubscribe' === r ? r : 'subscribe', ' ')
                          .concat(n, ' [')
                          .concat(ox(e), ']'),
                      ),
                      yield t.sendSubscription(r, e),
                      'unsubscribe' === r &&
                        (t.closePeerConnection(),
                        t.emitConnectionStateChangedEvent('DISCONNECTED'));
                  })();
                });
              }
              sendSubscription(e) {
                let t =
                    arguments.length > 1 && void 0 !== arguments[1]
                      ? arguments[1]
                      : this.subscribeState,
                  i = { srcTinyId: this.tinyId, srcUserId: this.userId },
                  n = gV,
                  r = aV.UNSUBSCRIBE_RESULT;
                return (
                  'subscribe_change' === e &&
                    ((i = {
                      audio: t.audio,
                      bigVideo: t.video,
                      auxVideo: t.auxiliary,
                      smallVideo: t.smallVideo,
                      srcTinyId: this.tinyId,
                    }),
                    (n = TV),
                    (r = aV.SUBSCRIBE_CHANGE_RESULT)),
                  this._signalChannel
                    .sendWaitForResponse({
                      command: n,
                      data: i,
                      responseCommand: r,
                      timeout: 1e4,
                    })
                    .then((t) => {
                      let { data: i } = t;
                      if (0 !== i.code) {
                        let t = new gb({
                          code: i.code,
                          message: QO({
                            key: KO.ERROR_MESSAGE,
                            data: { type: e, message: i.message },
                          }),
                        });
                        throw (this._log.error(t), t);
                      }
                    })
                );
              }
              connect() {
                return ab(this, arguments, function () {
                  var e = this;
                  let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : this.subscribeState;
                  return (function* () {
                    try {
                      yield e.exchangeSDP(t),
                        yield e.waitForPeerConnectionConnected();
                    } catch (sD) {
                      throw (e.closePeerConnection(!0), sD);
                    }
                  })();
                });
              }
              exchangeSDP(e) {
                return ab(this, null, function* () {
                  try {
                    (this._isSDPExchanging = !0),
                      yield this.createOffer(),
                      this._log.info('createOffer success, sending offer');
                    let { type: t, sdp: i } =
                        this._peerConnection.localDescription,
                      n = {
                        type: t,
                        sdp: i,
                        srcUserId: this.userId,
                        srcTinyId: this.tinyId,
                        audio: e.audio,
                        bigVideo: e.video,
                        auxVideo: e.auxiliary,
                        smallVideo: e.smallVideo,
                      },
                      r = yield this._signalChannel.sendWaitForResponse({
                        command: fV,
                        commandDesc: 'exchange sdp',
                        data: n,
                        responseCommand: aV.SUBSCRIBE_RESULT,
                        timeout: uD,
                      });
                    if (!this._peerConnection) {
                      let e = new gb({
                        code: mb.INVALID_OPERATION,
                        message: QO({ key: KO.CONNECTION_CLOSED }),
                      });
                      throw (this._log.warn(e), e);
                    }
                    yield this.onSubscribeResult(r),
                      (this._isSDPExchanging = !1);
                  } catch (sD) {
                    throw ((this._isSDPExchanging = !1), sD);
                  }
                });
              }
              createOffer() {
                return ab(this, null, function* () {
                  let e = { voiceActivityDetection: !1 };
                  vw() && this._sdpSemantics === hD
                    ? (this._peerConnection.addTransceiver(LN.AUDIO, {
                        direction: MN.RECVONLY,
                      }),
                      this._peerConnection.addTransceiver(LN.VIDEO, {
                        direction: MN.RECVONLY,
                      }),
                      this._peerConnection.addTransceiver(LN.VIDEO, {
                        direction: MN.RECVONLY,
                      }))
                    : ((e.offerToReceiveAudio = !0),
                      (e.offerToReceiveVideo = !0));
                  let t = yield this._peerConnection.createOffer(e);
                  if (t.sdp) {
                    let { isH264DecodeSupported: e } = yield aw();
                    e ||
                      (this._log.warn('remove h264 desc from sdp'),
                      (t.sdp = (function (e) {
                        let t = nx(e);
                        return (
                          t.media.forEach((e) => {
                            var t, i;
                            if (e.type === LN.VIDEO) {
                              let n = new Set();
                              e.rtp.forEach((e) => {
                                let { payload: t, codec: i } = e;
                                return 'H264' === i && n.add(t);
                              }),
                                e.fmtp.forEach((e) => {
                                  let { payload: t, config: i } = e,
                                    r = i.match(/apt=(\d+)/);
                                  r && r[1] && n.has(Number(r[1])) && n.add(t);
                                });
                              let r = (e) => {
                                let { payload: t } = e;
                                return !n.has(t);
                              };
                              (e.rtp = e.rtp.filter(r)),
                                (e.rtcpFb =
                                  null == (t = e.rtcpFb)
                                    ? void 0
                                    : t.filter(r)),
                                (e.fmtp = e.fmtp.filter(r)),
                                (e.payloads =
                                  null == (i = e.payloads)
                                    ? void 0
                                    : i
                                        .split(' ')
                                        .filter((e) => !n.has(Number(e)))
                                        .join(' '));
                            }
                          }),
                          rx(t)
                        );
                      })(t.sdp))),
                      (t.sdp = this.addRRTRLine(t.sdp)),
                      (t.sdp = this.addSPSDescription(t.sdp)),
                      (t.sdp = (function (e) {
                        let t = nx(e);
                        return (
                          t.media.forEach((e) => {
                            e.type === LN.AUDIO &&
                              e.fmtp.forEach((e) => {
                                e.config += ';sprop-stereo=1;stereo=1';
                              });
                          }),
                          rx(t)
                        );
                      })(t.sdp)),
                      this._sdpSemantics === hD &&
                        (t.sdp = this.removeSDESDescription(t.sdp));
                  }
                  yield this._peerConnection.setLocalDescription(t);
                });
              }
              onSubscribeResult(e) {
                return ab(this, null, function* () {
                  let { code: t, message: i = '' } = (e && e.data) || {},
                    { type: n, sdp: r } = (e && e.data && e.data.data) || {};
                  if (t === _D)
                    throw new gb({
                      code: mb.NOT_SUPPORTED_H264,
                      message: QO({ key: KO.NOT_SUPPORTED_H264DECODE }),
                    });
                  try {
                    if (0 !== t)
                      throw new gb({
                        code: t,
                        message: QO({
                          key: KO.EXCHANGE_SDP_FAILED,
                          data: { errMsg: i },
                        }),
                      });
                    this._log.debug('accept remote answer: '.concat(r)),
                      yield this._peerConnection.setRemoteDescription({
                        type: n,
                        sdp: r,
                      }),
                      this._sei &&
                        (this._sei.handleEncodedStreams(),
                        (this._sei.onSEIMessage = (e) => {
                          this._emitter.emit(
                            'sei-message',
                            eb(ZC({}, e), { userId: this.userId }),
                          );
                        })),
                      this.updateSSRC(r);
                  } catch (o) {
                    throw (this._log.error(o), o);
                  }
                });
              }
              updateSSRC(e) {
                try {
                  nx(e).media.forEach((e) => {
                    if (e.ssrcs)
                      if (e.type === LN.AUDIO) {
                        let t = e.ssrcs.find((e) => {
                          var t;
                          return null == (t = e.value)
                            ? void 0
                            : t.includes(WN);
                        });
                        t && (this.ssrc.audio = Number(t.id));
                      } else {
                        let t = e.ssrcs.find((e) => {
                            var t;
                            return null == (t = e.value)
                              ? void 0
                              : t.includes(WN);
                          }),
                          i = e.ssrcs.find((e) => {
                            var t;
                            return null == (t = e.value)
                              ? void 0
                              : t.includes(JN);
                          });
                        t && (this.ssrc.video = Number(t.id)),
                          i && (this.ssrc.auxiliary = Number(i.id));
                      }
                  });
                } catch (sD) {}
              }
              getMainStreamVideoTrackId() {
                return this.remoteVideoTrack && this.remoteVideoTrack.mediaTrack
                  ? this.remoteVideoTrack.mediaTrack.id
                  : '';
              }
              getAuxStreamVideoTrackId() {
                return this.remoteAuxiliaryTrack &&
                  this.remoteAuxiliaryTrack.mediaTrack
                  ? this.remoteAuxiliaryTrack.mediaTrack.id
                  : '';
              }
              reconnect() {
                return ab(this, null, function* () {
                  if (
                    !(sb(sx.prototype, this, 'beforeReconnect').call(this) < 0)
                  )
                    try {
                      this.closePeerConnection(),
                        this.initialize(),
                        yield this.connect(),
                        this.stopReconnection(),
                        this._log.warn('reconnect() success');
                    } catch (sD) {
                      let t = eO(this._reconnectionCount);
                      this._log.warn(
                        'reconnect() timeout, try again after '.concat(
                          t / 1e3,
                          's',
                        ),
                      ),
                        (this._reconnectionTimer = setTimeout(() => {
                          this.clearReconnectionTimer(), this.reconnect();
                        }, t));
                    }
                });
              }
              getIsReconnecting() {
                return this._isReconnecting;
              }
              clearReconnectionTimer() {
                -1 !== this._reconnectionTimer &&
                  (clearTimeout(this._reconnectionTimer),
                  (this._reconnectionTimer = -1));
              }
              getCurrentState() {
                return this._currentState;
              }
              setDelay(e) {
                let { audioDelay: t, videoDelay: i } = e;
                (this.remoteAudioTrack.stat.end2EndDelay = t),
                  (this.remoteVideoTrack.stat.end2EndDelay = i);
              }
            },
            ax = sx;
          rb(
            [
              rL(
                (e) =>
                  function () {
                    for (
                      var t = arguments.length, i = new Array(t), n = 0;
                      n < t;
                      n++
                    )
                      i[n] = arguments[n];
                    return new Promise((t, n) => {
                      let r = (e) => {
                        this._emitter.off('closed', r),
                          n(
                            new gb({
                              code: mb.API_CALL_ABORTED,
                              message: QO({
                                key: KO.CONNECTION_ABORTED,
                                data: e,
                              }),
                            }),
                          );
                      };
                      this._emitter.on('closed', r),
                        e
                          .apply(this, i)
                          .then(t, n)
                          .finally(() => {
                            this._emitter.off('closed', r);
                          });
                    });
                  },
              ),
            ],
            ax.prototype,
            'subscribe',
            1,
          ),
            rb(
              [nL(tx.prototype.afterConnect), iL(tx.prototype.beforeConnect)],
              ax.prototype,
              'connect',
              1,
            );
          var cx = ax,
            lx = { voiceActivityDetection: !1 },
            dx = class extends tx {
              constructor(e) {
                super(eb(ZC({}, e), { isUplink: !0 })),
                  ob(this, 'localMainAudioTrack', null),
                  ob(this, 'localMainVideoTrack', null),
                  ob(this, 'localAuxAudioTrack', null),
                  ob(this, 'localAuxVideoTrack', null),
                  ob(this, 'ssrc', {
                    audio: 0,
                    video: 0,
                    small: 0,
                    auxiliary: 0,
                  }),
                  ob(this, '_isPublishingAux', !1),
                  ob(this, '_publishingLocalAudioTrack'),
                  ob(this, '_publishingLocalVideoTrack'),
                  ob(this, '_mediaSettings', {
                    videoCodec: '',
                    videoWidth: 0,
                    videoHeight: 0,
                    videoBps: 0,
                    videoFps: 0,
                    audioCodec: 'opus',
                    audioFs: 0,
                    audioChannel: 0,
                    audioBps: 0,
                    smallVideoWidth: 0,
                    smallVideoHeight: 0,
                    smallVideoFps: 0,
                    smallVideoBps: 0,
                    auxVideoWidth: 0,
                    auxVideoHeight: 0,
                    auxVideoFps: 0,
                    auxVideoBps: 0,
                  }),
                  ob(this, '_audioManager'),
                  (this._audioManager = e.audioManager);
              }
              get isMainStreamPublished() {
                return !(
                  !this.localMainAudioTrack && !this.localMainVideoTrack
                );
              }
              get isAuxStreamPublished() {
                return !(!this.localAuxVideoTrack && !this.localAuxAudioTrack);
              }
              get publishState() {
                var e, t, i, n;
                let r = {
                  audio: !1,
                  bigVideo: !1,
                  smallVideo: !1,
                  auxVideo: !1,
                };
                if (this._peerConnection) {
                  let o = this._peerConnection.getSenders();
                  o &&
                    (Iw()
                      ? ((r.audio = !(null == (e = o[0]) || !e.track)),
                        (r.bigVideo = !(null == (t = o[1]) || !t.track)),
                        (r.smallVideo = !(null == (i = o[2]) || !i.track)),
                        (r.auxVideo = !(null == (n = o[3]) || !n.track)))
                      : o.forEach((e) => {
                          e.track &&
                            (e.track.kind === LN.AUDIO
                              ? (r.audio = !0)
                              : ((r.bigVideo = !0),
                                this._room.videoManager.hasSmall &&
                                  (r.smallVideo = !0)));
                        }));
                }
                return r;
              }
              initialize() {
                super.initialize(), this.installEvents();
              }
              reset() {
                this._isReconnecting && this.stopReconnection(),
                  this.closePeerConnection(),
                  this.uninstallEvents();
              }
              close(e) {
                super.close(e),
                  this.reset(),
                  this.emitConnectionStateChangedEvent('DISCONNECTED');
              }
              installEvents() {
                this._emitter
                  .listeners('connection-state-changed')
                  .includes(this.handleConnectionStateChange) ||
                  this._emitter.on(
                    'connection-state-changed',
                    this.handleConnectionStateChange,
                    this,
                  );
              }
              uninstallEvents() {
                this._emitter.off(
                  'connection-state-changed',
                  this.handleConnectionStateChange,
                  this,
                );
              }
              emitConnectionStateChangedEvent(e, t) {
                var i, n, r;
                let o = this._currentState,
                  s = super.emitConnectionStateChangedEvent(e);
                return (
                  s &&
                    o !== e &&
                    (t
                      ? t.emit('connection-state-changed', {
                          prevState: o,
                          state: e,
                        })
                      : (null == (i = this.localMainVideoTrack) ||
                          i.emit('connection-state-changed', {
                            prevState: o,
                            state: e,
                          }),
                        null == (n = this.localAuxVideoTrack) ||
                          n.emit('connection-state-changed', {
                            prevState: o,
                            state: e,
                          }),
                        null == (r = this._publishingLocalVideoTrack) ||
                          r.emit('connection-state-changed', {
                            prevState: o,
                            state: e,
                          }))),
                  s
                );
              }
              publish(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    localAudioTrack: i,
                    localVideoTrack: n,
                    isAuxiliary: r,
                  } = e;
                  return (function* () {
                    var e;
                    let o;
                    t._peerConnection || t.initialize(),
                      i && (t._publishingLocalAudioTrack = i),
                      n && (t._publishingLocalVideoTrack = n),
                      (t._isPublishingAux = r),
                      n &&
                        !r &&
                        n.small &&
                        (o = t._room.videoManager.smallTrack),
                      t.sendMediaSettings(),
                      vw()
                        ? yield t.publishByTransceiver({
                            localAudioTrack: i,
                            localVideoTrack: n,
                            smallTrack: o,
                            isAuxiliary: r,
                          })
                        : yield t.publishByAddTrack({
                            localAudioTrack: i,
                            localVideoTrack: n,
                            smallTrack: o,
                          }),
                      (t._publishingLocalAudioTrack = null),
                      (t._publishingLocalVideoTrack = null),
                      (t._isPublishingAux = !1),
                      r
                        ? (n && (t.localAuxVideoTrack = n),
                          i && (t.localAuxAudioTrack = i))
                        : (n && (t.localMainVideoTrack = n),
                          i && (t.localMainAudioTrack = i)),
                      null == (e = t._sei) || e.handleEncodedStreams(),
                      t.installTrackMuteEvents(i, n),
                      t.sendMutedFlag();
                  })();
                });
              }
              publishByTransceiver(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    localAudioTrack: i,
                    localVideoTrack: n,
                    smallTrack: r,
                    isAuxiliary: o,
                  } = e;
                  return (function* () {
                    t._log.info('publish by transceiver');
                    let e = new MediaStream(),
                      s = null == n ? void 0 : n.outMediaTrack,
                      a = t._audioManager.mixedAudioTrack;
                    a && e.addTrack(a), s && e.addTrack(s);
                    let c = t._peerConnection.getTransceivers();
                    if (0 === c.length)
                      t._peerConnection.addTransceiver(a || LN.AUDIO, {
                        direction: MN.SENDONLY,
                        streams: [e],
                      }),
                        t._peerConnection.addTransceiver(
                          o ? LN.VIDEO : s || LN.VIDEO,
                          { direction: MN.SENDONLY, streams: [e] },
                        ),
                        t._peerConnection.addTransceiver(r || LN.VIDEO, {
                          direction: MN.SENDONLY,
                          streams: [e],
                        }),
                        t._peerConnection.addTransceiver((o && s) || LN.VIDEO, {
                          direction: MN.SENDONLY,
                          streams: [e],
                        }),
                        yield t.connect();
                    else {
                      let e = [];
                      if (
                        (a &&
                          (c[0].sender.track || e.push(0),
                          yield c[0].sender.replaceTrack(a),
                          yield t.setBandwidth({
                            bandwidth:
                              (null == i ? void 0 : i.profile.bitrate) || 40,
                            type: LN.AUDIO,
                          })),
                        s)
                      ) {
                        let i = o ? 3 : 1;
                        yield c[i].sender.replaceTrack(s),
                          yield t.setBandwidth({
                            bandwidth: n.profile.bitrate,
                            type: LN.VIDEO,
                            videoType: o ? LN.AUXILIARY : LN.BIG,
                          }),
                          e.push(i),
                          r &&
                            (yield c[2].sender.replaceTrack(r),
                            yield t.setBandwidth({
                              bandwidth: n.small.bitrate,
                              type: LN.VIDEO,
                              videoType: LN.SMALL,
                            }),
                            e.push(2));
                      }
                      yield t.setTransceiverDirection(MN.SENDONLY, e),
                        yield t.doPublishChange(),
                        null == n ||
                          n.emit('connection-state-changed', {
                            prevState: 'DISCONNECTED',
                            state: 'CONNECTING',
                          }),
                        null == n ||
                          n.emit('connection-state-changed', {
                            prevState: 'CONNECTING',
                            state: 'CONNECTED',
                          });
                    }
                  })();
                });
              }
              publishByAddTrack(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    localAudioTrack: i,
                    localVideoTrack: n,
                    smallTrack: r,
                  } = e;
                  return (function* () {
                    t._log.info('publish by addtrack');
                    let e = null == n ? void 0 : n.outMediaTrack,
                      o = t._audioManager.mixedAudioTrack;
                    if (
                      t._peerConnection &&
                      'new' !== t._peerConnection.connectionState
                    )
                      return (
                        o && (yield t.addTrack(i)),
                        void (e && (yield t.addTrack(n)))
                      );
                    let s = new MediaStream();
                    if (
                      (o && s.addTrack(o),
                      e && s.addTrack(e),
                      o && t._peerConnection.addTrack(o, s),
                      e && (t._peerConnection.addTrack(e, s), r))
                    ) {
                      let e = new MediaStream();
                      e.addTrack(r), t._peerConnection.addTrack(r, e);
                    }
                    yield t.connect();
                  })();
                });
              }
              enableSmall(e) {
                return ab(this, null, function* () {
                  let t = this._peerConnection.getTransceivers();
                  e
                    ? this._room.videoManager.smallTrack &&
                      (yield t[2].sender.replaceTrack(
                        this._room.videoManager.smallTrack,
                      ),
                      yield this.setTransceiverDirection(MN.SENDONLY, [2]))
                    : (yield t[2].sender.replaceTrack(null),
                      yield this.setTransceiverDirection(MN.INACTIVE, [2])),
                    this.updateMediaSettings(),
                    yield this.doPublishChange();
                });
              }
              installTrackMuteEvents() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                t.forEach((e) => {
                  e &&
                    (null == e || e.on('mute', this.sendMutedFlag, this),
                    null == e || e.on('unmute', this.sendMutedFlag, this));
                });
              }
              uninstallTrackMuteEvents() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                t.forEach((e) => {
                  e &&
                    (null == e || e.off('mute', this.sendMutedFlag, this),
                    null == e || e.off('unmute', this.sendMutedFlag, this));
                });
              }
              unpublish(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let { localAudioTrack: i, localVideoTrack: n } = e;
                  return (function* () {
                    if (!Iw())
                      return i && i.outMediaTrack && !n && t.localMainVideoTrack
                        ? (yield t.removeTrack(i),
                          void (t.localMainAudioTrack = null))
                        : n && n.outMediaTrack && !i && t.localMainAudioTrack
                        ? (yield t.removeTrack(n),
                          void (t.localMainVideoTrack = null))
                        : (yield t.doUnpublish(),
                          t.uninstallTrackMuteEvents(i, n),
                          void t.emitConnectionStateChangedEvent(
                            'DISCONNECTED',
                            n,
                          ));
                    let e = n && n === t.localAuxVideoTrack,
                      r = null == n ? void 0 : n.outMediaTrack,
                      o = t._peerConnection.getSenders(),
                      s = [];
                    i &&
                      (t._audioManager.mixedAudioTrack ||
                        (yield o[0].replaceTrack(null), s.push(0)),
                      e
                        ? (t.localAuxAudioTrack = null)
                        : (t.localMainAudioTrack = null)),
                      r &&
                        (e
                          ? (yield o[3].replaceTrack(null),
                            (t.localAuxVideoTrack = null),
                            (t._mediaSettings = eb(ZC({}, t._mediaSettings), {
                              auxVideoBps: 0,
                              auxVideoFps: 0,
                              auxVideoWidth: 0,
                              auxVideoHeight: 0,
                            })),
                            s.push(3))
                          : (yield o[1].replaceTrack(null),
                            yield o[2].replaceTrack(null),
                            (t.localMainVideoTrack = null),
                            (t._mediaSettings = eb(ZC({}, t._mediaSettings), {
                              videoWidth: 0,
                              videoHeight: 0,
                              videoBps: 0,
                              videoFps: 0,
                              audioFs: 0,
                              audioChannel: 0,
                              audioBps: 0,
                              smallVideoWidth: 0,
                              smallVideoHeight: 0,
                              smallVideoFps: 0,
                              smallVideoBps: 0,
                            })),
                            s.push(1, 2))),
                      t.isMainStreamPublished || t.isAuxStreamPublished
                        ? (yield t.setTransceiverDirection(MN.INACTIVE, s),
                          yield t.doPublishChange(!1))
                        : yield t.doUnpublish(),
                      t.uninstallTrackMuteEvents(i, n),
                      null == n ||
                        n.emit('connection-state-changed', {
                          prevState: t._currentState,
                          state: 'DISCONNECTED',
                        });
                  })();
                });
              }
              doPublishChange() {
                let e =
                  !(arguments.length > 0 && void 0 !== arguments[0]) ||
                  arguments[0];
                return ab(this, null, function* () {
                  let t = {
                      state: this.publishState,
                      constraintConfig: this._mediaSettings,
                    },
                    i = yield this._signalChannel.sendWaitForResponse({
                      command: _V,
                      data: t,
                      responseCommand: aV.PUBLISH_STATE_CHANGE_RESULT,
                      enableLog: e,
                    });
                  this.checkPublishResultCode(i.data.code, i.data.message);
                });
              }
              doUnpublish() {
                let e =
                  arguments.length > 0 &&
                  void 0 !== arguments[0] &&
                  arguments[0];
                return this._signalChannel
                  .sendWaitForResponse({
                    command: mV,
                    commandDesc: 'unpublish',
                    responseCommand: aV.UNPUBLISH_RESULT,
                    enableLog: e,
                  })
                  .catch((e) => {
                    if (e.getCode() === mb.API_CALL_TIMEOUT)
                      return Promise.resolve();
                    throw e;
                  });
              }
              updateMediaSettings() {
                let {
                  detail: { isH264EncodeSupported: e, isVp8EncodeSupported: t },
                } = this._room.checkSystemResult;
                e
                  ? (this._mediaSettings.videoCodec = 'H264')
                  : t && (this._mediaSettings.videoCodec = 'VP8');
                let i =
                    this._publishingLocalAudioTrack ||
                    this.localMainAudioTrack ||
                    this.localAuxAudioTrack,
                  { localMainVideoTrack: n, localAuxVideoTrack: r } = this;
                if (
                  (this._publishingLocalVideoTrack &&
                    (this._isPublishingAux
                      ? (r = this._publishingLocalVideoTrack)
                      : (n = this._publishingLocalVideoTrack)),
                  bw)
                ) {
                  if (i && i.outMediaTrack) {
                    let e = i.outMediaTrack.getSettings();
                    (this._mediaSettings.audioChannel = e.channelCount || 1),
                      (this._mediaSettings.audioBps = 1e3 * i.profile.bitrate),
                      (this._mediaSettings.audioFs = e.sampleRate || 0);
                  }
                  if (n && n.outMediaTrack) {
                    let e = n.outMediaTrack.getSettings();
                    (this._mediaSettings.videoWidth = e.width || 0),
                      (this._mediaSettings.videoHeight = e.height || 0),
                      (this._mediaSettings.videoFps = e.frameRate || 0),
                      (this._mediaSettings.videoBps = 1e3 * n.profile.bitrate),
                      n.small &&
                        ((this._mediaSettings.smallVideoWidth = n.small.width),
                        (this._mediaSettings.smallVideoHeight = n.small.height),
                        (this._mediaSettings.smallVideoFps = n.small.frameRate),
                        (this._mediaSettings.smallVideoBps =
                          1e3 * n.small.bitrate));
                  }
                  if (r && r.outMediaTrack) {
                    let e = r.outMediaTrack.getSettings();
                    (this._mediaSettings.auxVideoWidth = e.width || 0),
                      (this._mediaSettings.auxVideoHeight = e.height || 0),
                      (this._mediaSettings.auxVideoFps = e.frameRate || 0),
                      (this._mediaSettings.auxVideoBps =
                        1e3 * r.profile.bitrate);
                  }
                } else
                  i &&
                    i.outMediaTrack &&
                    ((this._mediaSettings.audioChannel =
                      i.profile.channelCount),
                    (this._mediaSettings.audioBps = 1e3 * i.profile.bitrate),
                    (this._mediaSettings.audioFs = i.profile.sampleRate)),
                    n &&
                      n.outMediaTrack &&
                      ((this._mediaSettings.videoWidth = n.profile.width),
                      (this._mediaSettings.videoHeight = n.profile.height),
                      (this._mediaSettings.videoFps = n.profile.frameRate),
                      (this._mediaSettings.videoBps = 1e3 * n.profile.bitrate));
                this._log.info(
                  'updateMediaSettings: '.concat(
                    JSON.stringify(this._mediaSettings),
                  ),
                );
              }
              sendMediaSettings() {
                this.updateMediaSettings(),
                  this._signalChannel
                    .sendWaitForResponse({
                      command: bV,
                      data: this._mediaSettings,
                      responseCommand: aV.UPDATE_CONSTRAINT_CONFIG_RES,
                    })
                    .then((e) => {
                      0 !== e.data.code && this._log.warn(e.data.message);
                    })
                    .catch(() => {});
              }
              addTrack(e) {
                return ab(this, null, function* () {
                  var t;
                  if (!this._peerConnection) return;
                  let i =
                    e === this.localAuxAudioTrack ||
                    e === this.localAuxVideoTrack;
                  this._log.info(
                    'is adding '
                      .concat(e.kind, ' track to current published local ')
                      .concat(i ? LN.AUXILIARY : LN.MAIN, ' stream'),
                  ),
                    null == (t = this._sei) || t.handleEncodedStreams(),
                    vw()
                      ? yield this.addTrackByTransceiver(e, i)
                      : yield this.addTrackBySender(e);
                });
              }
              addTrackByTransceiver(e, t) {
                return ab(this, null, function* () {
                  var i;
                  if (!e.mediaTrack) return;
                  let n = this._peerConnection.getTransceivers();
                  if (e.kind === LN.AUDIO)
                    yield n[0].sender.replaceTrack(
                      this._audioManager.mixedAudioTrack,
                    );
                  else {
                    let r = t ? 3 : 1;
                    yield n[r].sender.replaceTrack(e.outMediaTrack),
                      1 === r &&
                        (null == (i = this.localMainVideoTrack)
                          ? void 0
                          : i.small) &&
                        (yield n[2].sender.replaceTrack(
                          this._room.videoManager.smallTrack,
                        )),
                      n[r].direction === MN.INACTIVE &&
                        (yield this.setTransceiverDirection(MN.SENDONLY, [r]));
                  }
                  this.updateMediaSettings(), yield this.doPublishChange();
                });
              }
              addTrackBySender(e) {
                return ab(this, null, function* () {
                  if (!e.outMediaTrack) return;
                  let t = e.outMediaTrack;
                  Iw() &&
                    this._peerConnection
                      .getTransceivers()
                      .findIndex((e) => 'stopped' === e.direction) >= 0 &&
                    (this._log.warn(
                      'transceiver is stopping, negotiate sdp first',
                    ),
                    yield this.updateOffer('remove', t));
                  let i = this._peerConnection
                    .getSenders()
                    .find((e) => e.track && e.track.kind === t.kind);
                  if (i && i.track) {
                    this._log.warn(
                      'sender already exists, remove sender first',
                    );
                    let e = i.track;
                    this.removeSender(i), yield this.updateOffer('remove', e);
                  }
                  let n =
                    t.kind === LN.VIDEO
                      ? t
                      : this._audioManager.mixedAudioTrack;
                  if (
                    (n &&
                      this._peerConnection.addTrack(t, new MediaStream([n])),
                    t.kind === LN.VIDEO && e instanceof hL && e.small)
                  ) {
                    let e = new MediaStream(),
                      { smallTrack: t } = this._room.videoManager;
                    e.addTrack(t), this._peerConnection.addTrack(t, e);
                  }
                  yield this.updateOffer('add', t);
                });
              }
              isNeedToResetOfferOrder() {
                if (
                  this._sdpSemantics === pD ||
                  !this._peerConnection ||
                  !this._peerConnection.localDescription
                )
                  return !1;
                let { sdp: e } = this._peerConnection.localDescription,
                  t = nx(e);
                for (let i = 0; i < t.media.length; i++)
                  if (
                    0 === Number(t.media[i].mid) &&
                    t.media[i].type === LN.VIDEO
                  )
                    return !0;
                return !1;
              }
              removeSender(e) {
                let t = null;
                Iw() &&
                  (t = this._peerConnection
                    .getTransceivers()
                    .find((t) => t.sender && t.sender.track === e.track)),
                  this._peerConnection.removeTrack(e),
                  t &&
                    iO(t.stop) &&
                    (this._log.info('stop transceiver'), t.stop());
              }
              removeTrack(e) {
                return ab(this, null, function* () {
                  if (!this._peerConnection) return;
                  let t =
                    e === this.localAuxAudioTrack ||
                    e === this.localAuxVideoTrack;
                  this._log.info(
                    'is removing '
                      .concat(e.kind, ' track from current published local ')
                      .concat(t ? LN.AUXILIARY : LN.MAIN, ' stream'),
                  ),
                    vw()
                      ? yield this.removeTrackByTransceiver(e, t)
                      : yield this.removeTrackBySender(e);
                });
              }
              removeTrackByTransceiver(e, t) {
                return ab(this, null, function* () {
                  if (!e.outMediaTrack) return;
                  let i = this._peerConnection.getTransceivers();
                  if (e.kind === LN.AUDIO)
                    this._audioManager.mixedAudioTrack ||
                      (yield i[0].sender.replaceTrack(null));
                  else {
                    let n = t ? 3 : 1;
                    yield i[n].sender.replaceTrack(null),
                      1 === n &&
                        e.small &&
                        (yield i[2].sender.replaceTrack(null)),
                      yield this.setTransceiverDirection(MN.INACTIVE, [n]);
                  }
                  this.updateMediaSettings(), yield this.doPublishChange();
                });
              }
              setTransceiverDirection(e, t) {
                return ab(this, null, function* () {
                  if (!Ub) return;
                  let i = !1,
                    n = !1;
                  this._log.info(
                    'setting transceiver '
                      .concat(t.join(','), ' direction to ')
                      .concat(e),
                  );
                  let r = this._peerConnection.getTransceivers();
                  if (
                    (t.forEach((t) => {
                      r[t].direction !== e && ((r[t].direction = e), (i = !0));
                    }),
                    i)
                  ) {
                    this._log.info('updating offer');
                    let e = yield this._peerConnection.createOffer();
                    yield this._peerConnection.setLocalDescription(e);
                  }
                  let o = -1,
                    s = this._peerConnection.remoteDescription.sdp
                      .split('\r\n')
                      .map((i) => {
                        if (
                          (i.match(
                            new RegExp(
                              'a=('
                                .concat(MN.INACTIVE, '|')
                                .concat(MN.RECVONLY, '|')
                                .concat(MN.SENDONLY, ')'),
                            ),
                          ) && o++,
                          t.includes(o))
                        ) {
                          if (
                            e === MN.INACTIVE &&
                            i.includes('a='.concat(MN.RECVONLY))
                          )
                            return (n = !0), 'a='.concat(e);
                          if (
                            e === MN.SENDONLY &&
                            i.includes('a='.concat(MN.INACTIVE))
                          )
                            return (n = !0), 'a='.concat(MN.RECVONLY);
                        }
                        return i;
                      })
                      .join('\r\n');
                  n &&
                    (this._log.info('updating answer'),
                    yield this._peerConnection.setRemoteDescription({
                      type: 'answer',
                      sdp: s,
                    }));
                });
              }
              removeTrackBySender(e) {
                return ab(this, null, function* () {
                  if (!e.outMediaTrack) return;
                  if (
                    e.kind === LN.VIDEO &&
                    this.isNeedToResetOfferOrder() &&
                    this.localMainAudioTrack
                  )
                    return (
                      this.reset(),
                      this.initialize(),
                      void (yield this.publish({
                        localAudioTrack: this.localMainAudioTrack,
                        isAuxiliary: !1,
                      }))
                    );
                  let t = this._peerConnection
                    .getSenders()
                    .find((t) => t.track === e.outMediaTrack);
                  t &&
                    (this.removeSender(t),
                    e.kind === LN.VIDEO &&
                      e.small &&
                      this._peerConnection.getSenders().forEach((e) => {
                        e.track &&
                          e.track.kind === LN.VIDEO &&
                          this.removeSender(e);
                      })),
                    yield this.updateOffer('remove', e.outMediaTrack);
                });
              }
              replaceTrack(e) {
                return ab(this, null, function* () {
                  var t;
                  let i,
                    n =
                      null == (t = this._peerConnection)
                        ? void 0
                        : t.getSenders();
                  if (!n || 0 === n.length || !e.mediaTrack) return;
                  if (
                    ((i = vw()
                      ? e.kind === LN.AUDIO
                        ? n[0]
                        : n[1]
                      : n.find((t) => t.track && t.track.kind === e.kind)),
                    !i)
                  )
                    return;
                  let r =
                    e === this.localAuxAudioTrack ||
                    e === this.localAuxVideoTrack;
                  this._log.info(
                    'is replacing '
                      .concat(e.kind, ' track on ')
                      .concat(r ? LN.AUXILIARY : LN.MAIN, ' stream'),
                  ),
                    e.kind === LN.AUDIO
                      ? yield i.replaceTrack(this._audioManager.mixedAudioTrack)
                      : e.kind === LN.VIDEO &&
                        (r
                          ? n[3] && (yield n[3].replaceTrack(e.outMediaTrack))
                          : yield i.replaceTrack(e.outMediaTrack));
                });
              }
              updateOffer(e, t) {
                return ab(this, null, function* () {
                  try {
                    let i = yield this._peerConnection.createOffer(lx);
                    Ub &&
                      i.sdp &&
                      (i.sdp = this.setSDPDirection(i.sdp, 'sendrecv')),
                      yield this._peerConnection.setLocalDescription(i);
                    let n = this.updateMediaSettings(),
                      r = {
                        action: e,
                        trackId: t.id,
                        kind: t.kind === LN.VIDEO ? 'bigVideo' : t.kind,
                        type: 'offer',
                        sdp: this._peerConnection.localDescription.sdp,
                        constraintConfig: n,
                        state: this.publishState,
                      };
                    this._log.info(
                      'createOffer success, sending updated offer to remote server',
                    ),
                      this._log.debug('updatedOffer: '.concat(r.sdp));
                    let o = yield this._signalChannel.sendWaitForResponse({
                        command: cV,
                        data: r,
                        responseCommand: aV.UPDATE_OFFER_RESULT,
                        timeout: dD,
                        commandDesc: 'update offer',
                      }),
                      { code: s, message: a } = o.data;
                    0 !== s && this.checkPublishResultCode(s, a),
                      yield this.acceptAnswer(o.data.data),
                      i.sdp && this.updateSSRC(i.sdp);
                  } catch (aN) {
                    throw (this._log.error(aN), aN);
                  }
                });
              }
              setBandwidth(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let { bandwidth: i, type: n, videoType: r, sdp: o } = e;
                  return (function* () {
                    if (!Cw())
                      return o
                        ? n === LN.VIDEO
                          ? t.updateVideoBandwidthRestriction(o, i, r)
                          : t.updateAudioBandwidthRestriction(o, i)
                        : void 0;
                    let e,
                      s = t._peerConnection.getSenders();
                    if (vw()) {
                      let t = 0;
                      n === LN.VIDEO &&
                        (t = r === LN.SMALL ? 2 : r === LN.AUXILIARY ? 3 : 1),
                        (e = s[t]);
                    } else e = s.find((e) => e.track && e.track.kind === n);
                    if (e) {
                      let s = e.getParameters();
                      (!s.encodings || 0 === s.encodings.length) &&
                        (s.encodings = [{}]),
                        (s.encodings[0].maxBitrate = 1e3 * i);
                      try {
                        return (
                          yield e.setParameters(s),
                          t._log.info(
                            ''
                              .concat(r || '')
                              .concat(n, ' bandwidth ')
                              .concat(i, ' kbps'),
                          ),
                          o
                        );
                      } catch (a) {
                        if (
                          (t._log.info(
                            'failed to set bandwidth by setting maxBitrate: '.concat(
                              a,
                            ),
                          ),
                          o)
                        )
                          return n === LN.VIDEO
                            ? t.updateVideoBandwidthRestriction(o, i, r)
                            : t.updateAudioBandwidthRestriction(o, i);
                      }
                    }
                    return o;
                  })();
                });
              }
              updateVideoBandwidthRestriction(e, t, i) {
                let n = 'AS';
                Ub && ((n = 'TIAS'), (t *= 1e3));
                let r = 0,
                  o = -1;
                return (
                  i === LN.SMALL ? (r = 1) : i === LN.AUXILIARY && (r = 2),
                  (e = e.replace(
                    /m=video (.*)\r\nc=IN (.*)\r\n/g,
                    (e) => (
                      (o += 1),
                      o === r
                        ? ''.concat(e, 'b=').concat(n, ':').concat(t, '\r\n')
                        : e
                    ),
                  ))
                );
              }
              updateAudioBandwidthRestriction(e, t) {
                let i = 'AS';
                return (
                  Ub && ((i = 'TIAS'), (t *= 1e3)),
                  (e = e.replace(
                    /m=audio (.*)\r\nc=IN (.*)\r\n/,
                    'm=audio $1\r\nc=IN $2\r\nb='
                      .concat(i, ':')
                      .concat(t, '\r\n'),
                  ))
                );
              }
              removeBandwidthRestriction(e) {
                return e
                  .replace(/b=AS:.*\r\n/, '')
                  .replace(/b=TIAS:.*\r\n/, '');
              }
              removeVideoOrientation(e) {
                return e.replace(/urn:3gpp:video-orientation/, '');
              }
              connect() {
                return ab(this, null, function* () {
                  try {
                    yield this.exchangeSDP(),
                      yield this.waitForPeerConnectionConnected();
                  } catch (sN) {
                    throw (
                      (this.closePeerConnection(!0), this.uninstallEvents(), sN)
                    );
                  }
                });
              }
              exchangeSDP() {
                return ab(this, null, function* () {
                  try {
                    yield this.createOffer(),
                      this._log.info(
                        'createOffer success, sending offer to remote server',
                      ),
                      yield this.doExchangeSDP();
                  } catch (sN) {
                    throw sN;
                  }
                });
              }
              createOffer() {
                return ab(this, null, function* () {
                  try {
                    let e = yield this._peerConnection.createOffer(lx);
                    yield this._peerConnection.setLocalDescription(e),
                      e.sdp && this.updateSSRC(e.sdp);
                  } catch (sN) {
                    throw sN;
                  }
                });
              }
              doExchangeSDP() {
                let e = {
                  command: pV,
                  responseCommand: aV.PUBLISH_RESULT,
                  data: {
                    type: this._peerConnection.localDescription.type,
                    sdp: this.removeVideoOrientation(
                      this._peerConnection.localDescription.sdp,
                    ),
                    screen:
                      this.localMainVideoTrack instanceof _L ||
                      this.localAuxVideoTrack instanceof _L,
                    state: this.publishState,
                    constraintConfig: this._mediaSettings,
                  },
                  enableLog: !1,
                };
                return (
                  this._log.debug('sending sdp offer: '.concat(e.data.sdp)),
                  this._signalChannel.sendWaitForResponse(e).then((e) => {
                    let { code: t, message: i, data: n } = e.data;
                    return 0 === t
                      ? this.acceptAnswer(n)
                      : this.checkPublishResultCode(t, i);
                  })
                );
              }
              setSDPDirection(e, t) {
                let i =
                    arguments.length > 2 && void 0 !== arguments[2]
                      ? arguments[2]
                      : 'all',
                  n = nx(e);
                return (
                  n.media.forEach((e) => {
                    ('all' === i || e.type === i) && (e.direction = t);
                  }),
                  rx(n)
                );
              }
              acceptAnswer(e) {
                return ab(this, null, function* () {
                  var t, i, n, r, o;
                  try {
                    let s;
                    if (
                      this._publishingLocalAudioTrack ||
                      this._publishingLocalVideoTrack ||
                      this.isMainStreamPublished
                    ) {
                      let e =
                          (null == (t = this._publishingLocalVideoTrack)
                            ? void 0
                            : t.profile.bitrate) ||
                          (null == (i = this.localMainVideoTrack)
                            ? void 0
                            : i.profile.bitrate),
                        o =
                          (null == (n = this._publishingLocalAudioTrack)
                            ? void 0
                            : n.profile.bitrate) ||
                          (null == (r = this.localMainAudioTrack)
                            ? void 0
                            : r.profile.bitrate);
                      if (e) {
                        let t = this._isPublishingAux ? LN.AUXILIARY : LN.BIG;
                        s = yield this.setBandwidth({
                          bandwidth: e,
                          type: LN.VIDEO,
                          sdp: s,
                          videoType: t,
                        });
                      }
                      o &&
                        (s = yield this.setBandwidth({
                          bandwidth: o,
                          type: LN.AUDIO,
                          sdp: s,
                        }));
                    }
                    if (
                      ((s = this.removeVideoOrientation(e.sdp)),
                      null != (o = this._publishingLocalVideoTrack) && o.small)
                    ) {
                      let { smallStreamConfig: e } = this._room;
                      s = yield this.setBandwidth({
                        bandwidth:
                          this._publishingLocalVideoTrack.small.bitrate ||
                          e.bitrate,
                        type: LN.VIDEO,
                        videoType: LN.SMALL,
                        sdp: s,
                      });
                    }
                    let a = { type: e.type, sdp: s };
                    yield this._peerConnection.setRemoteDescription(a),
                      this._log.debug('accepted answer: '.concat(s));
                  } catch (Qx) {
                    throw (
                      (this._log.error(
                        'failed to accept remote answer '.concat(Qx),
                      ),
                      Qx)
                    );
                  }
                });
              }
              sendMutedFlag(e) {
                var t, i, n;
                if (
                  e === this.localAuxAudioTrack ||
                  e === this.localAuxVideoTrack
                )
                  return;
                let r = {
                  audio: !(null == (t = this.localMainAudioTrack) || !t.muted),
                  bigVideo: !(
                    null == (i = this.localMainVideoTrack) || !i.muted
                  ),
                  auxVideo: !(
                    null == (n = this.localAuxVideoTrack) || !n.muted
                  ),
                };
                this._log.info('send muted state: '.concat(JSON.stringify(r))),
                  this._signalChannel.send(hV, r);
              }
              getIsReconnecting() {
                return this._isReconnecting;
              }
              reconnect() {
                return ab(this, null, function* () {
                  if (
                    !(sb(dx.prototype, this, 'beforeReconnect').call(this) < 0)
                  )
                    try {
                      yield this._signalChannel.sendWaitForResponse({
                        command: mV,
                        responseCommand: aV.UNPUBLISH_RESULT,
                        enableLog: !1,
                      }),
                        this.closePeerConnection(),
                        this.initialize(),
                        this.isMainStreamPublished &&
                          (yield this.publish({
                            localAudioTrack: this.localMainAudioTrack,
                            localVideoTrack: this.localMainVideoTrack,
                            isAuxiliary: !1,
                          })),
                        this.isAuxStreamPublished &&
                          (yield this.publish({
                            localAudioTrack: this.localAuxAudioTrack,
                            localVideoTrack: this.localAuxVideoTrack,
                            isAuxiliary: !0,
                          })),
                        this._log.warn(
                          'reconnect() uplink reconnect successfully',
                        ),
                        this.stopReconnection();
                    } catch (sD) {
                      let t = eO(this._reconnectionCount);
                      this._log.warn(
                        'reconnect() timeout, try again after '.concat(
                          t / 1e3,
                          's',
                        ),
                      ),
                        (this._reconnectionTimer = setTimeout(() => {
                          this.clearReconnectionTimer(), this.reconnect();
                        }, t));
                    }
                });
              }
              handleConnectionStateChange(e) {
                'CONNECTED' === e.state &&
                  (this.localMainVideoTrack ||
                    (this._publishingLocalVideoTrack &&
                      !this._isPublishingAux)) &&
                  UO.emit(BO.SEND_FIRST_VIDEO_FRAME, { room: this._room });
              }
              updateSSRC(e) {
                try {
                  nx(e).media.forEach((e, t) => {
                    if (e.type === LN.AUDIO) {
                      let t = e.ssrcs && e.ssrcs[0];
                      t && (this.ssrc.audio = Number(t.id));
                    } else {
                      if (this._sdpSemantics === pD && e.ssrcGroups)
                        return void e.ssrcGroups.forEach((e, t) => {
                          let i = Number(e.ssrcs.split(' ')[0]);
                          0 === t
                            ? (this.ssrc.video = i)
                            : 1 === t && (this.ssrc.small = i);
                        });
                      let i = e.ssrcs && e.ssrcs[0];
                      if (!i) return;
                      switch (t) {
                        case 1:
                          this.ssrc.video = Number(i.id);
                          break;
                        case 2:
                          this.ssrc.small = Number(i.id);
                          break;
                        case 3:
                          this.ssrc.auxiliary = Number(i.id);
                      }
                    }
                  });
                } catch (sD) {}
              }
              getVideoTrackId() {
                let e =
                  arguments.length > 0 && void 0 !== arguments[0]
                    ? arguments[0]
                    : LN.VIDEO;
                if (this._peerConnection) {
                  let t = this._peerConnection.getSenders();
                  if (e === LN.AUXILIARY && t[3] && t[3].track)
                    return t[3].track.id;
                  if (e === LN.VIDEO && t[1] && t[1].track)
                    return t[1].track.id;
                }
                if (this.localMainVideoTrack && e === LN.VIDEO) {
                  let e = this.localMainVideoTrack.mediaTrack;
                  if (e) return e.id;
                }
                if (this.localAuxVideoTrack && e === LN.AUXILIARY) {
                  let e = this.localAuxVideoTrack.mediaTrack;
                  if (e) return e.id;
                }
                return '';
              }
              getSSRC() {
                return this.ssrc;
              }
              checkPublishResultCode(e, t) {
                if (0 !== e)
                  throw e === _D
                    ? (this._log.error(YO.NOT_SUPPORTED_H264ENCODE),
                      new gb({
                        code: mb.NOT_SUPPORTED_H264,
                        message: QO({ key: KO.NOT_SUPPORTED_H264ENCODE }),
                      }))
                    : new gb({
                        code: mb.UNKNOWN,
                        message: QO({
                          key: KO.SIGNAL_RESPONSE_FAILED,
                          data: {
                            signalResponse: aV.PUBLISH_RESULT,
                            code: e,
                            message: t,
                          },
                        }),
                      });
              }
              sendSEI(e, t) {
                var i;
                null == (i = this._sei) || i.push(e, t);
              }
            },
            ux = dx;
          rb(
            [
              rL(
                (e) =>
                  function () {
                    for (
                      var t = arguments.length, i = new Array(t), n = 0;
                      n < t;
                      n++
                    )
                      i[n] = arguments[n];
                    return new Promise((t, n) => {
                      let r = (e) => {
                        this._emitter.off('closed', r),
                          n(
                            new gb({
                              code: mb.API_CALL_ABORTED,
                              message: QO({
                                key: KO.CONNECTION_ABORTED,
                                data: e,
                              }),
                            }),
                          );
                      };
                      this._emitter.on('closed', r),
                        e
                          .apply(this, i)
                          .then(t, n)
                          .finally(() => {
                            this._emitter.off('closed', r);
                          });
                    });
                  },
              ),
            ],
            ux.prototype,
            'publish',
            1,
          ),
            rb(
              [nL(tx.prototype.afterConnect), iL(tx.prototype.beforeConnect)],
              ux.prototype,
              'connect',
              1,
            );
          var hx = ux,
            px = class {
              constructor(e, t) {
                (this.room = e),
                  ob(this, '_log'),
                  ob(this, '_prevReportTime'),
                  ob(this, '_prevReport', {}),
                  ob(this, '_prevEncoderImplementation'),
                  ob(this, '_prevQualityLimitationReason'),
                  ob(this, '_prevAuxQualityLimitationReason'),
                  ob(this, '_prevDecoderImplementationMap', new Map()),
                  ob(this, 'totalBytesSent', 0),
                  ob(this, 'totalBytesReceived', 0),
                  ob(this, '_spcStats', null),
                  (this._log = t),
                  (this._prevReportTime = 0),
                  (this._prevEncoderImplementation = ''),
                  (this._prevQualityLimitationReason = ''),
                  (this._prevAuxQualityLimitationReason = '');
              }
              get statInterval() {
                return 0 === this._prevReportTime
                  ? 2
                  : (Date.now() - this._prevReportTime) / 1e3;
              }
              getSenderStats(e) {
                return ab(this, null, function* () {
                  let t = {
                      audio: {
                        bytesSent: 0,
                        packetsSent: 0,
                        audioLevel: 0,
                        totalAudioEnergy: 0,
                      },
                      video: {
                        bytesSent: 0,
                        packetsSent: 0,
                        framesEncoded: 0,
                        frameWidth: 0,
                        frameHeight: 0,
                        framesSent: 0,
                        fpsCapture: 0,
                      },
                      small: {
                        bytesSent: 0,
                        packetsSent: 0,
                        framesEncoded: 0,
                        frameWidth: 0,
                        frameHeight: 0,
                        framesSent: 0,
                        fpsCapture: 0,
                      },
                      auxiliary: {
                        bytesSent: 0,
                        packetsSent: 0,
                        framesEncoded: 0,
                        frameWidth: 0,
                        frameHeight: 0,
                        framesSent: 0,
                        fpsCapture: 0,
                      },
                      rtt: 0,
                    },
                    i = e.getPeerConnection(),
                    n = e.getSSRC();
                  if (i)
                    try {
                      if (
                        ((this._spcStats || (yield i.getStats())).forEach(
                          (i) => {
                            var r;
                            if ('outbound-rtp' === i.type)
                              if ((i.mediaType || i.kind) === LN.VIDEO) {
                                let r, o;
                                if (
                                  (i.ssrc === n.video
                                    ? ((r = LN.VIDEO),
                                      (o = e.localMainVideoTrack))
                                    : i.ssrc === n.small
                                    ? (r = LN.SMALL)
                                    : i.ssrc === n.auxiliary &&
                                      ((o = e.localAuxVideoTrack),
                                      (r = LN.AUXILIARY)),
                                  !r)
                                )
                                  return;
                                (t[r].bytesSent = i.bytesSent),
                                  (t[r].packetsSent = i.packetsSent),
                                  (t[r].framesEncoded = i.framesEncoded),
                                  nO(i.keyFramesEncoded) ||
                                    (t[r].keyFramesEncoded =
                                      i.keyFramesEncoded),
                                  nO(i.nackCount) ||
                                    (t[r].nackCount = i.nackCount),
                                  nO(i.pliCount) ||
                                    (t[r].pliCount = i.pliCount),
                                  nO(i.retransmittedPacketsSent) ||
                                    (t[r].retransmittedPacketsSent =
                                      i.retransmittedPacketsSent),
                                  nO(i.totalEncodeTime) ||
                                    (t[r].totalEncodeTime = i.totalEncodeTime),
                                  nO(i.totalPacketSendDelay) ||
                                    (t[r].totalPacketSendDelay =
                                      i.totalPacketSendDelay),
                                  i.ssrc === n.video
                                    ? (!nO(i.encoderImplementation) &&
                                        this._prevEncoderImplementation !==
                                          i.encoderImplementation &&
                                        (this._log.info(
                                          'encoderImplementation change to '.concat(
                                            i.encoderImplementation,
                                          ),
                                        ),
                                        (this._prevEncoderImplementation =
                                          i.encoderImplementation)),
                                      !nO(i.qualityLimitationReason) &&
                                        0 !== i.bytesSent &&
                                        this._prevQualityLimitationReason !==
                                          i.qualityLimitationReason &&
                                        (this._log.info(
                                          'qualityLimitationReason change to '.concat(
                                            i.qualityLimitationReason,
                                          ),
                                        ),
                                        (this._prevQualityLimitationReason =
                                          i.qualityLimitationReason)))
                                    : i.ssrc === n.auxiliary &&
                                      !nO(i.qualityLimitationReason) &&
                                      0 !== i.bytesSent &&
                                      this._prevAuxQualityLimitationReason !==
                                        i.qualityLimitationReason &&
                                      (this._log.info(
                                        'aux qualityLimitationReason change to '.concat(
                                          i.qualityLimitationReason,
                                        ),
                                      ),
                                      (this._prevAuxQualityLimitationReason =
                                        i.qualityLimitationReason));
                              } else
                                (t.audio.bytesSent = i.bytesSent),
                                  (t.audio.packetsSent = i.packetsSent);
                            else
                              'candidate-pair' === i.type
                                ? hw(i) &&
                                  oO(i.currentRoundTripTime) &&
                                  ((t.rtt = Math.floor(
                                    1e3 * i.currentRoundTripTime,
                                  )),
                                  (this.totalBytesSent = i.bytesSent))
                                : 'media-source' === i.type &&
                                  (i.kind === LN.AUDIO
                                    ? ((t.audio.audioLevel = i.audioLevel || 0),
                                      (t.audio.totalAudioEnergy =
                                        i.totalAudioEnergy || 0))
                                    : i.kind === LN.VIDEO &&
                                      (i.trackIdentifier ===
                                      e.getVideoTrackId(LN.VIDEO)
                                        ? (t.video.fpsCapture =
                                            i.framesPerSecond)
                                        : i.trackIdentifier ===
                                          e.getVideoTrackId(LN.AUXILIARY)
                                        ? (t.auxiliary.fpsCapture =
                                            i.framesPerSecond)
                                        : (t.small.fpsCapture =
                                            i.framesPerSecond)));
                            if (
                              (!nO(i.audioLevel) &&
                                (null == (r = e.localMainAudioTrack)
                                  ? void 0
                                  : r.mediaTrack) &&
                                i.trackIdentifier ===
                                  e.localMainAudioTrack.mediaTrack.id &&
                                (t.audio.audioLevel = i.audioLevel || 0),
                              !nO(i.frameWidth))
                            ) {
                              let r = LN.SMALL;
                              i.trackIdentifier ===
                                e.getVideoTrackId(LN.VIDEO) ||
                              i.ssrc === n.video
                                ? (r = LN.VIDEO)
                                : (i.trackIdentifier ===
                                    e.getVideoTrackId(LN.AUXILIARY) ||
                                    i.ssrc === n.auxiliary) &&
                                  (r = LN.AUXILIARY),
                                (t[r].frameWidth = i.frameWidth),
                                (t[r].frameHeight = i.frameHeight),
                                (t[r].framesSent = i.framesSent);
                            }
                          },
                        ),
                        e.localMainAudioTrack)
                      ) {
                        let i = e.localMainAudioTrack.getInternalAudioLevel();
                        (t.audio.micAudioLevel = i),
                          0 === t.audio.audioLevel && (t.audio.audioLevel = i);
                      }
                      this.totalBytesSent ||
                        (this.totalBytesSent +=
                          t.audio.bytesSent +
                          t.video.bytesSent +
                          t.auxiliary.bytesSent);
                    } catch (r) {
                      this._log.warn(
                        'failed to getStats on sender connection '.concat(r),
                      );
                    }
                  return t;
                });
              }
              getReceiverStats(e) {
                return ab(this, null, function* () {
                  let t = {
                      tinyId: e.tinyId,
                      userId: e.userId,
                      rtt: 0,
                      hasAudio: !1,
                      hasVideo: !1,
                      hasAuxiliary: !1,
                      isSmallSubscribed: !1,
                      audio: {
                        bytesReceived: 0,
                        packetsReceived: 0,
                        packetsLost: 0,
                        jitter: 0,
                        audioLevel: 0,
                        totalAudioEnergy: 0,
                        insertedSamplesForDeceleration: 0,
                        removedSamplesForAcceleration: 0,
                      },
                      video: {
                        bytesReceived: 0,
                        packetsReceived: 0,
                        packetsLost: 0,
                        framesReceived: 0,
                        framesDecoded: 0,
                        frameWidth: 0,
                        frameHeight: 0,
                        fpsDecoded: 0,
                      },
                      auxiliary: {
                        bytesReceived: 0,
                        packetsReceived: 0,
                        packetsLost: 0,
                        framesReceived: 0,
                        framesDecoded: 0,
                        frameWidth: 0,
                        frameHeight: 0,
                        fpsDecoded: 0,
                      },
                    },
                    i = e.getPeerConnection();
                  if (i)
                    try {
                      let { ssrc: n } = e,
                        { muteState: r, subscribeState: o } = e;
                      (this._spcStats || (yield i.getStats())).forEach((i) => {
                        if ('inbound-rtp' === i.type)
                          if ((i.mediaType || i.kind) === LN.AUDIO) {
                            if (i.ssrc !== n.audio || !r.hasAudio) return;
                            (t.audio.packetsReceived = i.packetsReceived),
                              (t.audio.bytesReceived = i.bytesReceived),
                              (t.audio.packetsLost = i.packetsLost),
                              i.insertedSamplesForDeceleration &&
                                (t.audio.insertedSamplesForDeceleration =
                                  i.insertedSamplesForDeceleration),
                              i.removedSamplesForAcceleration &&
                                (t.audio.removedSamplesForAcceleration =
                                  i.removedSamplesForAcceleration);
                            let { remoteAudioTrack: o } = e;
                            (o.stat.packetsReceived = i.packetsReceived),
                              (o.stat.bytesReceived = i.bytesReceived),
                              (o.stat.packetsLost = i.packetsLost),
                              i.jitterBufferDelay &&
                                (o.stat.jitterBufferDelay = Math.floor(
                                  (i.jitterBufferDelay /
                                    i.jitterBufferEmittedCount) *
                                    1e3,
                                )),
                              (t.hasAudio = !0);
                          } else {
                            if (Ub && 0 === i.bytesReceived) return;
                            let s;
                            i.ssrc === n.video &&
                              r.hasVideo &&
                              ((t.video.packetsReceived = i.packetsReceived),
                              (t.video.bytesReceived = i.bytesReceived),
                              (t.video.packetsLost = i.packetsLost),
                              (t.video.framesReceived = i.framesReceived),
                              (t.video.framesDecoded = i.framesDecoded),
                              (t.video.fpsDecoded = i.framesPerSecond),
                              (t.hasVideo = !0),
                              (s = e.remoteVideoTrack),
                              r.hasSmall &&
                                o.smallVideo &&
                                (t.isSmallSubscribed = !0),
                              i.decoderImplementation &&
                                (!this._prevDecoderImplementationMap.has(
                                  t.userId,
                                ) ||
                                  this._prevDecoderImplementationMap.get(
                                    t.userId,
                                  ) !== i.decoderImplementation) &&
                                (this._log.info(
                                  ''
                                    .concat(
                                      t.userId,
                                      ' decoderImplementation change to ',
                                    )
                                    .concat(i.decoderImplementation),
                                ),
                                this._prevDecoderImplementationMap.set(
                                  t.userId,
                                  i.decoderImplementation,
                                ))),
                              i.ssrc === n.auxiliary &&
                                r.hasAuxiliary &&
                                ((t.auxiliary.packetsReceived =
                                  i.packetsReceived),
                                (t.auxiliary.bytesReceived = i.bytesReceived),
                                (t.auxiliary.packetsLost = i.packetsLost),
                                (t.auxiliary.framesReceived = i.framesReceived),
                                (t.auxiliary.framesDecoded = i.framesDecoded),
                                (t.auxiliary.fpsDecoded = i.framesPerSecond),
                                (s = e.remoteAuxiliaryTrack),
                                (t.hasAuxiliary = !0)),
                              s &&
                                ((s.stat.packetsReceived = i.packetsReceived),
                                (s.stat.bytesReceived = i.bytesReceived),
                                (s.stat.packetsLost = i.packetsLost),
                                (s.stat.framesReceived = i.framesReceived),
                                (s.stat.framesDecoded = i.framesDecoded),
                                i.jitterBufferDelay &&
                                  (s.stat.jitterBufferDelay = Math.floor(
                                    (i.jitterBufferDelay /
                                      i.jitterBufferEmittedCount) *
                                      1e3,
                                  )));
                          }
                        else
                          'candidate-pair' === i.type &&
                            hw(i) &&
                            oO(i.currentRoundTripTime) &&
                            ((t.rtt = Math.floor(1e3 * i.currentRoundTripTime)),
                            (this.totalBytesReceived = i.bytesReceived));
                        nO(i.frameWidth) ||
                          ((i.trackIdentifier ===
                            e.getMainStreamVideoTrackId() ||
                            i.ssrc === n.video) &&
                            ((t.video.frameWidth = i.frameWidth),
                            (t.video.frameHeight = i.frameHeight),
                            (e.remoteVideoTrack.stat.frameWidth = i.frameWidth),
                            (e.remoteVideoTrack.stat.frameHeight =
                              i.frameHeight)),
                          (i.trackIdentifier === e.getAuxStreamVideoTrackId() ||
                            i.ssrc === n.auxiliary) &&
                            ((t.auxiliary.frameWidth = i.frameWidth),
                            (t.auxiliary.frameHeight = i.frameHeight),
                            (e.remoteAuxiliaryTrack.stat.frameWidth =
                              i.frameWidth),
                            (e.remoteAuxiliaryTrack.stat.frameHeight =
                              i.frameHeight))),
                          !nO(i.audioLevel) &&
                            e.muteState.audioAvailable &&
                            e.remoteAudioTrack.mediaTrack &&
                            i.trackIdentifier ===
                              e.remoteAudioTrack.mediaTrack.id &&
                            ((t.audio.audioLevel = i.audioLevel || 0),
                            (t.audio.totalAudioEnergy =
                              i.totalAudioEnergy || 0));
                      }),
                        0 === t.audio.audioLevel &&
                          e.muteState.audioAvailable &&
                          (t.audio.audioLevel =
                            e.remoteAudioTrack.getInternalAudioLevel() || 0),
                        this.totalBytesReceived ||
                          (this.totalBytesReceived +=
                            t.audio.bytesReceived +
                            t.video.bytesReceived +
                            t.auxiliary.bytesReceived);
                    } catch (aN) {
                      this._log.warn(
                        'failed to getStats on receiver connection '.concat(aN),
                      );
                    }
                  return t;
                });
              }
              getStats(e, t) {
                return ab(this, null, function* () {
                  let i = {},
                    n = [];
                  if (this.room.singlePC) {
                    let e = this.room.singlePC.getPeerConnection();
                    if (!e) return { senderStats: i, receiverStats: n };
                    let t = yield e.getStats(),
                      r = [],
                      o = new Set([
                        'inbound-rtp',
                        'outbound-rtp',
                        'track',
                        'candidate-pair',
                        'media-source',
                      ]);
                    t.forEach((e) => o.has(e.type) && r.push(e)),
                      (this._spcStats = r);
                  }
                  e && (i = yield this.getSenderStats(e));
                  for (let [e, r] of t) {
                    let e = yield this.getReceiverStats(r);
                    n.push(e);
                  }
                  return { senderStats: i, receiverStats: n };
                });
              }
              getDifferenceValue(e, t) {
                if (UP(e)) return t;
                let i = t - e;
                return i < 0 ? 0 : i;
              }
              prepareReport(e) {
                let { stats: t, report: i, freezeMap: n } = e;
                if (!UP(t.senderStats)) {
                  let e = {
                    uint32_audio_level: t.senderStats.audio.audioLevel * xD,
                    uint32_audio_energy:
                      1e6 * t.senderStats.audio.totalAudioEnergy,
                    uint32_audio_codec_bitrate: t.senderStats.audio.bytesSent,
                  };
                  t.senderStats.audio.micAudioLevel &&
                    (e.uint32_mic_audio_level =
                      t.senderStats.audio.micAudioLevel * xD);
                  let n = [];
                  if (t.senderStats.video.bytesSent) {
                    let e = {
                      uint32_video_stream_type: 2,
                      uint32_video_codec_fps: t.senderStats.video.framesSent,
                      uint32_video_capture_fps: t.senderStats.video.fpsCapture,
                      uint32_video_width: t.senderStats.video.frameWidth,
                      uint32_video_height: t.senderStats.video.frameHeight,
                      uint32_video_codec_bitrate: t.senderStats.video.bytesSent,
                      uint32_video_enc_fps: t.senderStats.video.framesEncoded,
                      uint32_key_frame_count:
                        t.senderStats.video.keyFramesEncoded,
                      uint32_nack_count: t.senderStats.video.nackCount,
                      uint32_pli_count: t.senderStats.video.pliCount,
                      uint32_encode_cost:
                        1e3 * (t.senderStats.video.totalEncodeTime || 0),
                      uint32_send_packet_cost:
                        1e3 * (t.senderStats.video.totalPacketSendDelay || 0),
                      uint32_video_arq_packets:
                        t.senderStats.video.retransmittedPacketsSent,
                    };
                    n.push(e);
                  }
                  if (t.senderStats.small.bytesSent) {
                    let e = {
                      uint32_video_stream_type: 3,
                      uint32_video_codec_fps:
                        t.senderStats.small.framesSent || 0,
                      uint32_video_capture_fps:
                        t.senderStats.small.fpsCapture || 0,
                      uint32_video_width: t.senderStats.small.frameWidth || 0,
                      uint32_video_height: t.senderStats.small.frameHeight || 0,
                      uint32_video_codec_bitrate: t.senderStats.small.bytesSent,
                      uint32_video_enc_fps:
                        t.senderStats.small.framesEncoded || 0,
                      uint32_key_frame_count:
                        t.senderStats.small.keyFramesEncoded,
                      uint32_nack_count: t.senderStats.small.nackCount,
                      uint32_pli_count: t.senderStats.small.pliCount,
                      uint32_encode_cost:
                        1e3 * (t.senderStats.small.totalEncodeTime || 0),
                      uint32_send_packet_cost:
                        1e3 * (t.senderStats.small.totalPacketSendDelay || 0),
                      uint32_video_arq_packets:
                        t.senderStats.small.retransmittedPacketsSent,
                    };
                    n.push(e);
                  }
                  if (t.senderStats.auxiliary.bytesSent) {
                    let e = {
                      uint32_video_stream_type: 7,
                      uint32_video_codec_fps:
                        t.senderStats.auxiliary.framesSent || 0,
                      uint32_video_capture_fps:
                        t.senderStats.auxiliary.fpsCapture || 0,
                      uint32_video_width:
                        t.senderStats.auxiliary.frameWidth || 0,
                      uint32_video_height:
                        t.senderStats.auxiliary.frameHeight || 0,
                      uint32_video_codec_bitrate:
                        t.senderStats.auxiliary.bytesSent,
                      uint32_video_enc_fps:
                        t.senderStats.auxiliary.framesEncoded || 0,
                      uint32_key_frame_count:
                        t.senderStats.auxiliary.keyFramesEncoded,
                      uint32_nack_count: t.senderStats.auxiliary.nackCount,
                      uint32_pli_count: t.senderStats.auxiliary.pliCount,
                      uint32_encode_cost:
                        1e3 * (t.senderStats.auxiliary.totalEncodeTime || 0),
                      uint32_send_packet_cost:
                        1e3 *
                        (t.senderStats.auxiliary.totalPacketSendDelay || 0),
                      uint32_video_arq_packets:
                        t.senderStats.auxiliary.retransmittedPacketsSent,
                    };
                    n.push(e);
                  }
                  let r = {
                    uint32_bitrate: 0,
                    uint32_lost: 0,
                    uint32_rtt: t.senderStats.rtt,
                  };
                  i.msg_up_stream_info = {
                    msg_audio_status: e,
                    msg_video_status: n,
                    msg_network_status: r,
                  };
                }
                let { statInterval: r } = this;
                (i.msg_down_stream_info = []),
                  t.receiverStats.forEach((e) => {
                    let t = {
                      msg_user_info: {
                        str_identifier: e.userId,
                        uint64_tinyid: e.tinyId,
                      },
                      msg_network_status: {
                        uint32_rtt: e.rtt,
                        uint32_bitrate: 0,
                        uint32_lost: 0,
                      },
                      msg_audio_status: {},
                      msg_video_status: [],
                    };
                    if (e.hasAudio) {
                      let i = {
                        uint32_audio_codec_bitrate: e.audio.bytesReceived,
                        uint32_audio_total_bitrate: e.audio.bytesReceived,
                        uint32_audio_level: 1e8 * e.audio.audioLevel,
                        uint32_audio_energy: 1e6 * e.audio.totalAudioEnergy,
                        uint32_audio_receive: e.audio.packetsReceived,
                        uint32_audio_origin_lost: e.audio.packetsLost,
                      };
                      t.msg_audio_status = i;
                    }
                    if (e.hasVideo) {
                      let i = n.get(''.concat(e.userId, '_').concat(KN)),
                        r = i ? i.duration : 0,
                        o = {
                          uint32_video_stream_type: e.isSmallSubscribed ? 3 : 2,
                          uint32_video_receive_fps: e.video.framesReceived,
                          uint32_video_width: e.video.frameWidth,
                          uint32_video_height: e.video.frameHeight,
                          uint32_video_codec_bitrate: e.video.bytesReceived,
                          uint32_video_receive: e.video.packetsReceived,
                          uint32_video_origin_lost: e.video.packetsLost,
                          uint32_video_block_time: r,
                          uint32_video_dec_fps: e.video.framesDecoded,
                        };
                      t.msg_video_status.push(o);
                    }
                    if (e.hasAuxiliary) {
                      let i = n.get(''.concat(e.userId, '_').concat(YN)),
                        r = i ? i.duration : 0,
                        o = {
                          uint32_video_stream_type: 7,
                          uint32_video_receive_fps: e.auxiliary.framesReceived,
                          uint32_video_width: e.auxiliary.frameWidth,
                          uint32_video_height: e.auxiliary.frameHeight,
                          uint32_video_codec_bitrate: e.auxiliary.bytesReceived,
                          uint32_video_receive:
                            e.auxiliary.packetsReceived +
                            e.auxiliary.packetsLost,
                          uint32_video_origin_lost: e.auxiliary.packetsLost,
                          uint32_video_block_time: r,
                          uint32_video_dec_fps: e.auxiliary.framesDecoded,
                        };
                      t.msg_video_status.push(o);
                    }
                    i.msg_down_stream_info.push(t);
                  });
                let o = this._prevReport;
                if (
                  ((this._prevReport = JSON.parse(JSON.stringify(i))),
                  i.msg_up_stream_info.msg_audio_status &&
                    o.msg_up_stream_info.msg_audio_status)
                ) {
                  let e = o.msg_up_stream_info.msg_audio_status,
                    t = i.msg_up_stream_info.msg_audio_status;
                  if (0 === e.uint32_audio_codec_bitrate)
                    t.uint32_audio_codec_bitrate = 0;
                  else {
                    let n = this.getDifferenceValue(
                      e.uint32_audio_codec_bitrate,
                      t.uint32_audio_codec_bitrate,
                    );
                    (t.uint32_audio_codec_bitrate = Math.round((8 * n) / r)),
                      (i.msg_up_stream_info.msg_network_status.uint32_bitrate +=
                        t.uint32_audio_codec_bitrate);
                  }
                }
                let s = o.msg_up_stream_info.msg_video_status;
                i.msg_up_stream_info.msg_video_status.forEach((e) => {
                  let t = s.find(
                    (t) =>
                      t.uint32_video_stream_type === e.uint32_video_stream_type,
                  );
                  if (!t || 0 === t.uint32_video_codec_bitrate)
                    return (
                      (e.uint32_video_codec_bitrate = 0),
                      (e.uint32_video_enc_fps = 0),
                      void (e.uint32_video_codec_fps = 0)
                    );
                  let n = 0,
                    o = 0,
                    a = 0;
                  t &&
                    e.uint32_video_codec_bitrate >=
                      t.uint32_video_codec_bitrate &&
                    ((n = t.uint32_video_codec_bitrate),
                    (o = t.uint32_video_enc_fps),
                    (a = t.uint32_video_codec_fps));
                  let c = this.getDifferenceValue(
                    n,
                    e.uint32_video_codec_bitrate,
                  );
                  (e.uint32_video_codec_bitrate = Math.round((8 * c) / r)),
                    (i.msg_up_stream_info.msg_network_status.uint32_bitrate +=
                      e.uint32_video_codec_bitrate),
                    (e.uint32_video_enc_fps = Math.round(
                      this.getDifferenceValue(o, e.uint32_video_enc_fps) / r,
                    )),
                    (e.uint32_video_codec_fps = Math.round(
                      this.getDifferenceValue(a, e.uint32_video_codec_fps) / r,
                    )),
                    _k &&
                      115 === wk() &&
                      0 === t.uint32_video_width &&
                      0 === t.uint32_video_height &&
                      0 === t.uint32_video_codec_fps &&
                      (e.uint32_video_codec_fps = e.uint32_video_enc_fps),
                    nO(t.uint32_key_frame_count) ||
                      (e.uint32_key_frame_count = Math.round(
                        this.getDifferenceValue(
                          t.uint32_key_frame_count,
                          e.uint32_key_frame_count,
                        ),
                      )),
                    nO(t.uint32_nack_count) ||
                      (e.uint32_nack_count = Math.round(
                        this.getDifferenceValue(
                          t.uint32_nack_count,
                          e.uint32_nack_count,
                        ),
                      )),
                    nO(t.uint32_pli_count) ||
                      (e.uint32_pli_count = Math.round(
                        this.getDifferenceValue(
                          t.uint32_pli_count,
                          e.uint32_pli_count,
                        ),
                      )),
                    nO(t.uint32_video_arq_packets) ||
                      (e.uint32_video_arq_packets = Math.round(
                        this.getDifferenceValue(
                          t.uint32_video_arq_packets,
                          e.uint32_video_arq_packets,
                        ),
                      )),
                    nO(t.uint32_encode_cost) ||
                      (e.uint32_encode_cost = Math.round(
                        this.getDifferenceValue(
                          t.uint32_encode_cost,
                          e.uint32_encode_cost,
                        ) / r,
                      )),
                    nO(t.uint32_send_packet_cost) ||
                      (e.uint32_send_packet_cost = Math.round(
                        this.getDifferenceValue(
                          t.uint32_send_packet_cost,
                          e.uint32_send_packet_cost,
                        ) / r,
                      ));
                });
                let a = i.msg_down_stream_info,
                  c = o.msg_down_stream_info;
                return (
                  a.forEach((e) => {
                    let t = c.find(
                      (t) =>
                        t.msg_user_info.uint64_tinyid ===
                        e.msg_user_info.uint64_tinyid,
                    );
                    if (t) {
                      if (UP(e.msg_audio_status) || UP(t.msg_audio_status))
                        e.msg_audio_status = {};
                      else {
                        let i = e.msg_audio_status,
                          n = t.msg_audio_status;
                        (i.uint32_audio_origin_lost = this.getDifferenceValue(
                          n.uint32_audio_origin_lost,
                          i.uint32_audio_origin_lost,
                        )),
                          (i.uint32_audio_receive = this.getDifferenceValue(
                            n.uint32_audio_receive,
                            i.uint32_audio_receive,
                          )),
                          (i.uint32_audio_receive +=
                            i.uint32_audio_origin_lost);
                        let o = this.getDifferenceValue(
                          n.uint32_audio_codec_bitrate,
                          i.uint32_audio_codec_bitrate,
                        );
                        (i.uint32_audio_codec_bitrate = Math.round(
                          (8 * o) / r,
                        )),
                          (i.uint32_audio_total_bitrate = Math.round(
                            (8 * o) / r,
                          ));
                      }
                      if (e.msg_video_status && t.msg_video_status) {
                        let i = t.msg_video_status;
                        (e.msg_video_status = e.msg_video_status.filter((e) =>
                          i.find(
                            (t) =>
                              t.uint32_video_stream_type ===
                              e.uint32_video_stream_type,
                          ),
                        )),
                          e.msg_video_status.forEach((e) => {
                            let t = i.find(
                                (t) =>
                                  t.uint32_video_stream_type ===
                                  e.uint32_video_stream_type,
                              ),
                              n = t.uint32_video_receive,
                              o = t.uint32_video_origin_lost,
                              s = t.uint32_video_codec_bitrate,
                              a = t.uint32_video_receive_fps,
                              c = t.uint32_video_dec_fps;
                            (e.uint32_video_origin_lost =
                              this.getDifferenceValue(
                                o,
                                e.uint32_video_origin_lost,
                              )),
                              (e.uint32_video_receive =
                                this.getDifferenceValue(
                                  n,
                                  e.uint32_video_receive,
                                ) + e.uint32_video_origin_lost);
                            let l = this.getDifferenceValue(
                              s,
                              e.uint32_video_codec_bitrate,
                            );
                            e.uint32_video_codec_bitrate = Math.round(
                              (8 * l) / r,
                            );
                            let d = this.getDifferenceValue(
                              a,
                              e.uint32_video_receive_fps,
                            );
                            (e.uint32_video_receive_fps = Math.round(d / r)),
                              (e.uint32_video_dec_fps = Math.round(
                                this.getDifferenceValue(
                                  c,
                                  e.uint32_video_dec_fps,
                                ) / r,
                              ));
                          });
                      }
                    }
                  }),
                  i
                );
              }
              getStatsReport(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    uplinkConnection: i,
                    downlinkConnections: n,
                    freezeMap: r,
                  } = e;
                  return (function* () {
                    let e = {
                        msg_up_stream_info: {
                          msg_audio_status: {
                            uint32_audio_format: 11,
                            uint32_audio_sample_rate: 0,
                            uint32_audio_codec_bitrate: 0,
                            uint32_audio_receive: 0,
                            uint32_audio_origin_lost: 0,
                            uint32_audio_level: 0,
                            uint32_audio_energy: 0,
                          },
                          msg_video_status: [],
                          msg_network_status: {
                            uint32_bitrate: 0,
                            uint32_rtt: 0,
                            uint32_lost: 0,
                          },
                        },
                        msg_down_stream_info: [
                          {
                            msg_user_info: {
                              str_identifier: '',
                              uint64_tinyid: 0,
                            },
                            msg_audio_status: {
                              uint32_audio_format: 11,
                              uint32_audio_sample_rate: 0,
                              uint32_audio_codec_bitrate: 0,
                              uint32_audio_total_bitrate: 0,
                              uint32_audio_level: 0,
                              uint32_audio_energy: 0,
                              uint32_audio_receive: 0,
                              uint32_audio_origin_lost: 0,
                              uint32_audio_final_lost: 0,
                            },
                            msg_video_status: [
                              {
                                uint32_video_stream_type: 0,
                                uint32_video_receive_fps: 0,
                                uint32_video_width: 0,
                                uint32_video_height: 0,
                                uint32_video_codec_bitrate: 0,
                                uint32_video_receive: 0,
                                uint32_video_origin_lost: 0,
                                uint32_video_block_time: 0,
                                uint32_video_dec_fps: 0,
                              },
                            ],
                            msg_network_status: {
                              uint32_bitrate: 0,
                              uint32_rtt: 0,
                              uint32_lost: 0,
                            },
                          },
                        ],
                      },
                      o = yield t.getStats(i, n);
                    return (
                      '{}' === JSON.stringify(t._prevReport) &&
                        (t._prevReport = JSON.parse(JSON.stringify(e))),
                      t.prepareReport({ stats: o, report: e, freezeMap: r }),
                      (t._prevReportTime = Date.now()),
                      e
                    );
                  })();
                });
              }
              reset() {
                (this._prevReportTime = 0),
                  (this._prevReport = {}),
                  (this._prevEncoderImplementation = ''),
                  (this._prevQualityLimitationReason = ''),
                  (this._prevDecoderImplementationMap = new Map());
              }
            },
            _x = nb(cb()),
            mx = class extends _x.default {
              constructor(e) {
                let { signalChannel: t, room: i } = e;
                super(),
                  ob(this, '_room'),
                  ob(this, '_signalChannel'),
                  ob(this, '_log'),
                  ob(this, '_uplinkRTT', 0),
                  ob(this, '_uplinkLoss', 0),
                  ob(this, '_downlinkRTT', 0),
                  ob(this, '_downlinkLoss', 0),
                  ob(this, '_downlinkPrevStatMap', new Map()),
                  ob(this, '_downlinkLossAndRTTMap', new Map()),
                  ob(this, '_interval', -1),
                  ob(this, '_uplinkNetworkQuality', 0),
                  ob(this, '_downlinkNetworkQuality', 0),
                  (this._room = i),
                  (this._signalChannel = t),
                  (this._log = jO.createLogger({
                    id: 'q',
                    userId: this._room.userId,
                    sdkAppId: this._room.sdkAppId,
                  })),
                  this.initialize();
              }
              get uplinkNetworkQuality() {
                return this._uplinkNetworkQuality;
              }
              set uplinkNetworkQuality(e) {
                e !== this._uplinkNetworkQuality &&
                  this._log.info(
                    'uplink '
                      .concat(this.uplinkNetworkQuality, ' -> ')
                      .concat(e, ', rtt: ')
                      .concat(this._uplinkRTT, ', loss: ')
                      .concat(this._uplinkLoss),
                  ),
                  (this._uplinkNetworkQuality = e);
              }
              get downlinkNetworkQuality() {
                return this._downlinkNetworkQuality;
              }
              set downlinkNetworkQuality(e) {
                if (e !== this._downlinkNetworkQuality) {
                  let { rtt: t, loss: i } = this.getAverageLossAndRTT([
                    ...this._downlinkLossAndRTTMap.values(),
                  ]);
                  this._log.info(
                    'downlink '
                      .concat(this.downlinkNetworkQuality, ' -> ')
                      .concat(e, ', rtt: ')
                      .concat(t, ', loss: ')
                      .concat(i),
                  );
                }
                this._downlinkNetworkQuality = e;
              }
              initialize() {
                this._signalChannel.on(aV.UPLINK_NETWORK_STATS, (e) => {
                  this.handleUplinkNetworkQuality(e);
                }),
                  this._signalChannel.on(
                    iV,
                    this.handleSignalConnectionStateChange.bind(this),
                  ),
                  this.start();
              }
              handleUplinkNetworkQuality(e) {
                var t, i;
                if (0 !== e.data.code) return;
                let n = e.data.data;
                if (
                  (n.delay && this.updateDelay(n.delay),
                  !this._room.uplinkConnection)
                )
                  return (
                    (this.uplinkNetworkQuality = 0),
                    (this._uplinkLoss = 0),
                    void (this._uplinkRTT = 0)
                  );
                let r =
                  null ==
                  (i = null == (t = this._room) ? void 0 : t.uplinkConnection)
                    ? void 0
                    : i.getPeerConnection();
                if (r && this.isPeerConnectionDisconnected(r))
                  return (
                    (this.uplinkNetworkQuality = 6),
                    (this._uplinkLoss = 0),
                    void (this._uplinkRTT = 0)
                  );
                let o = n.expectAudPkg + n.expectVidPkg,
                  s = n.recvAudPkg + n.recvVidPkg,
                  a = o - s;
                (0 === o && 0 === s) ||
                  ((this._uplinkLoss = a <= 0 ? 0 : Math.round((a / o) * 100)),
                  (this._uplinkRTT = n.rtt),
                  (this.uplinkNetworkQuality = this.getNetworkQuality(
                    this._uplinkLoss,
                    this._uplinkRTT,
                  )));
              }
              handleDownlinkNetworkQuality() {
                return ab(this, null, function* () {
                  if (0 === this._room.remotePublishedUserMap.size)
                    return void (this.downlinkNetworkQuality = 0);
                  let e = [...this._room.remotePublishedUserMap.values()],
                    t = e.filter((e) => {
                      var t;
                      return (
                        (null == (t = e.getPeerConnection())
                          ? void 0
                          : t.connectionState) === iD.CONNECTED
                      );
                    });
                  if (
                    e.filter((e) =>
                      this.isPeerConnectionDisconnected(e.getPeerConnection()),
                    ).length === e.length
                  )
                    return void (this.downlinkNetworkQuality = 6);
                  for (let r = 0; r < t.length; r++) {
                    let e = t[r].getPeerConnection();
                    if (!e) return;
                    let {
                      rtt: i,
                      totalPacketsLost: n,
                      totalPacketsReceived: o,
                    } = yield this.getStat(e);
                    if (!this._downlinkPrevStatMap.has(e)) {
                      this._downlinkPrevStatMap.set(e, {
                        totalPacketsLost: n,
                        totalPacketsReceived: o,
                      });
                      continue;
                    }
                    let s = 0,
                      a = this._downlinkPrevStatMap.get(e),
                      c = n - a.totalPacketsLost,
                      l = o - a.totalPacketsReceived;
                    (s = c <= 0 || l < 0 ? 0 : Math.round((c / (c + l)) * 100)),
                      this._downlinkPrevStatMap.set(e, {
                        totalPacketsLost: n,
                        totalPacketsReceived: o,
                      }),
                      this._downlinkLossAndRTTMap.set(e, {
                        rtt: i,
                        loss: s,
                        userId: t[r].getUserId(),
                        audioDelay: t[r].remoteAudioTrack.stat.end2EndDelay,
                        videoDelay: t[r].remoteVideoTrack.stat.end2EndDelay,
                      });
                  }
                  if (
                    ([...this._downlinkPrevStatMap.keys()].forEach((e) => {
                      this.isPeerConnectionDisconnected(e) &&
                        (this._downlinkPrevStatMap.delete(e),
                        this._downlinkLossAndRTTMap.delete(e));
                    }),
                    0 === this._downlinkLossAndRTTMap.size)
                  )
                    return;
                  let { rtt: i, loss: n } = this.getAverageLossAndRTT([
                    ...this._downlinkLossAndRTTMap.values(),
                  ]);
                  (this._downlinkRTT = i),
                    (this._downlinkLoss = n),
                    (this.downlinkNetworkQuality = this.getNetworkQuality(
                      n,
                      i,
                    ));
                });
              }
              getStat(e) {
                return ab(this, null, function* () {
                  let t = {
                    rtt: 0,
                    totalPacketsLost: 0,
                    totalPacketsReceived: 0,
                  };
                  if (!e || !Ew()) return t;
                  let i = e.getReceivers();
                  try {
                    for (let e = 0; e < i.length; e++)
                      (yield i[e].getStats()).forEach((e) => {
                        'candidate-pair' === e.type &&
                          oO(e.currentRoundTripTime) &&
                          (t.rtt = Math.round(1e3 * e.currentRoundTripTime)),
                          'inbound-rtp' === e.type &&
                            (e.mediaType === LN.AUDIO ||
                              e.mediaType === LN.VIDEO) &&
                            ((t.totalPacketsLost += e.packetsLost),
                            (t.totalPacketsReceived += e.packetsReceived));
                      });
                    return t;
                  } catch (n) {
                    return t;
                  }
                });
              }
              getAverageLossAndRTT(e) {
                let t = { rtt: 0, loss: 0 };
                return (
                  Array.isArray(e) &&
                    e.length > 0 &&
                    (e.forEach((e) => {
                      (t.rtt += e.rtt), (t.loss += e.loss);
                    }),
                    Object.keys(t).forEach((i) => {
                      t[i] = Math.round(t[i] / e.length);
                    })),
                  t
                );
              }
              getNetworkQuality(e, t) {
                return e > 50 || t > 500
                  ? 5
                  : e > 30 || t > 350
                  ? 4
                  : e > 20 || t > 200
                  ? 3
                  : e > 10 || t > 100
                  ? 2
                  : e >= 0 || t >= 0
                  ? 1
                  : 0;
              }
              handleSignalConnectionStateChange(e) {
                'DISCONNECTED' === e.state
                  ? ((this._uplinkRTT = 0),
                    (this._uplinkLoss = 0),
                    (this.uplinkNetworkQuality = 6))
                  : 'CONNECTED' === e.state &&
                    6 === this.uplinkNetworkQuality &&
                    (this.uplinkNetworkQuality = 5);
              }
              handleUplinkConnectionStateChange(e) {
                let { state: t } = e;
                'DISCONNECTED' === t
                  ? ((this._uplinkLoss = 0),
                    (this._uplinkRTT = 0),
                    (this.uplinkNetworkQuality = 6))
                  : 'CONNECTED' === t &&
                    6 === this.uplinkNetworkQuality &&
                    (this.uplinkNetworkQuality = 5);
              }
              isPeerConnectionDisconnected(e) {
                return !(
                  !e ||
                  (e.connectionState !== iD.DISCONNECTED &&
                    e.connectionState !== iD.FAILED &&
                    e.connectionState !== iD.CLOSED)
                );
              }
              setUplinkConnection(e) {
                (this._room.uplinkConnection = e),
                  this._room.uplinkConnection
                    ? this._room.uplinkConnection.on(
                        'connection-state-changed',
                        this.handleUplinkConnectionStateChange.bind(this),
                      )
                    : ((this.uplinkNetworkQuality = 0),
                      (this._uplinkRTT = 0),
                      (this._uplinkLoss = 0));
              }
              start() {
                -1 === this._interval
                  ? (this._log.debug('start network quality calculating'),
                    (this._interval = qw.run(
                      wD,
                      () => {
                        this.handleDownlinkNetworkQuality();
                        let e = [...this._downlinkLossAndRTTMap.values()];
                        UO.emit(BO.NETWORK_QUALITY, {
                          room: this._room,
                          uplink: {
                            rtt: this._uplinkRTT,
                            loss: this._uplinkLoss,
                          },
                          downlinks: e,
                        }),
                          this.emit(mx.EVENT_NETWORK_QUALITY, {
                            uplinkNetworkQuality: this.uplinkNetworkQuality,
                            downlinkNetworkQuality: this.downlinkNetworkQuality,
                            uplinkRTT: this._uplinkRTT,
                            uplinkLoss: this._uplinkLoss,
                            downlinkRTT: this._downlinkRTT,
                            downlinkLoss: this._downlinkLoss,
                            downlinkInfo: e,
                          });
                      },
                      { delay: 2e3 },
                    )))
                  : this._log.info(
                      'network quality calculating is already started',
                    );
              }
              stop() {
                this._log.debug('stopped'),
                  -1 !== this._interval &&
                    (qw.clearTask(this._interval), (this._interval = -1)),
                  this._downlinkLossAndRTTMap.clear(),
                  this._downlinkPrevStatMap.clear();
              }
              updateDelay(e) {
                let { tinyIdToUserIdMap: t } = this._room;
                e.forEach((e) => {
                  let { srcTinyId: i, videoDelay: n, audioDelay: r } = e,
                    o = t.get(i);
                  if (o) {
                    let e = this._room.remotePublishedUserMap.get(o);
                    null == e || e.setDelay({ videoDelay: n, audioDelay: r });
                  }
                });
              }
            },
            fx = mx;
          ob(fx, 'EVENT_NETWORK_QUALITY', '0');
          var gx = class {
            constructor(e) {
              (this._signalInfo = {
                tinyId: void 0,
                clientIp: '',
                signalIp: '',
                relayIp: '',
                relayInnerIp: '',
                relayPort: 0,
              }),
                (this._apiSuccessRateMap = new Map()),
                (this._eventMap = new Map()),
                (this._frameWorkType = e.frameWorkType || 30),
                (this._component = e.component || 0),
                (this.connectionType = e.connectionType || 1),
                (this._language = e.language || 0),
                (this._room = e.room),
                (this._keyPrefix = 'key_point'),
                (this._log = jO.createLogger({
                  id: 'kpm',
                  userId: this._room.userId,
                  sdkAppId: this._room.sdkAppId,
                })),
                Object.getOwnPropertyNames(this.__proto__).forEach((e) => {
                  e.startsWith('handle') &&
                    iO(this[e]) &&
                    (this[e] = (function (e) {
                      let { fn: t, context: i } = e;
                      return function () {
                        try {
                          for (
                            var e = arguments.length, n = new Array(e), r = 0;
                            r < e;
                            r++
                          )
                            n[r] = arguments[r];
                          let o = t.apply(i, n);
                          return uO(o)
                            ? o.catch((e) =>
                                jO.error(
                                  ''
                                    .concat(t.name, '() error observed ')
                                    .concat(e),
                                ),
                              )
                            : o;
                        } catch (sD) {
                          jO.error(
                            ''.concat(t.name, '() error observed ').concat(sD),
                          );
                        }
                      };
                    })({ fn: this[e], context: this }));
                }),
                this.initData(),
                this.installEvents(),
                (this._intervalId = qw.run(wD, this.setStorage.bind(this), {
                  delay: 2e4,
                }));
            }
            get _storageKey() {
              return ''.concat(this._keyPrefix, '_').concat(this._room.userId);
            }
            initData() {
              (this._firstPublishedUserList = []),
                (this._networkQuality = {
                  totalUplinkRTT: 0,
                  totalUplinkLoss: 0,
                  count: 0,
                  totalDownlinkRTTAndLossMap: new Map(),
                }),
                (this._basicInfo = {
                  string_sdk_version: rN,
                  uint32_os_type: 15,
                  string_device_name: '',
                  string_http_user_agent: navigator.userAgent,
                  string_os_version: '',
                  uint32_avg_rtt: 0,
                  uint32_avg_up_loss: 0,
                  uint32_scene: 'live' === this._room.scene ? 1 : 0,
                  uint32_joining_duration: 0,
                  uint32_networkType: kN[GD()],
                  uint32_framework: this._frameWorkType,
                  uint32_component: this._component,
                  uint32_connection_type: this.connectionType,
                  uint32_caller_coding_language: this._language,
                  string_domain: location.hostname,
                }),
                (this._pathJoinRoom = {
                  uint64_start_time: 0,
                  uint64_send_request_acc_ip_cmd_start_time: 0,
                  uint64_send_request_acc_ip_cmd_end_time: 0,
                  uint64_send_request_enter_room_cmd_start_time: 0,
                  uint64_send_request_enter_room_cmd_end_time: 0,
                  uint64_send_first_video_frame_time: 0,
                  uint64_recv_userlist_time: 0,
                  uint64_end_time: 0,
                  int32_send_request_acc_ip_cmd_ret: 0,
                  int32_send_request_enter_room_cmd_ret: 0,
                  int32_end_ret: 0,
                }),
                (this._pathLeaveRoom = {
                  uint64_start_time: 0,
                  uint64_send_request_exit_room_cmd_start_time: 0,
                  uint64_send_request_exit_room_cmd_end_time: 0,
                  uint64_end_time: 0,
                  int32_send_request_exit_room_cmd_ret: 0,
                  int32_end_ret: 0,
                }),
                (this._localStreamStat = {
                  totalVideoBitrate: 0,
                  totalVideoFPS: 0,
                  totalVideoHeight: 0,
                  totalVideoWidth: 0,
                  totalAudioLevel: 0,
                  videoCount: 0,
                  audioLevelCount: 0,
                  publishStartTime: 0,
                  statsToReport: {
                    uint32_audio_capture_db: 0,
                    uint32_video_big_capture_fps: 0,
                    uint32_video_big_bitrate: 0,
                    uint32_video_big_resolution: 0,
                  },
                }),
                (this._pathMainVideoMap = new Map()),
                (this._pathMainAudioMap = new Map()),
                (this._pathAuxiliaryMap = new Map()),
                (this._remoteStreamStatMap = new Map()),
                this._apiSuccessRateMap.clear(),
                $k().then((e) => {
                  (this._basicInfo.string_os_version = tN()),
                    e && (this._basicInfo.string_device_name = e.model);
                });
            }
            addEvent(e, t) {
              return this._eventMap.set(e, t), UO.on(e, t), this;
            }
            installEvents() {
              (this.handleUnload = this.handleUnload.bind(this)),
                window.addEventListener('unload', this.handleUnload),
                this._room.once('banned', () =>
                  this.handleLeaveSuccess({
                    room: this._room,
                    roomId: this._room.roomId,
                  }),
                ),
                this.addEvent(BO.JOIN_START, this.handleJoinStart)
                  .addEvent(
                    BO.JOIN_SCHEDULE_SUCCESS,
                    this.handleJoinScheduleSuccess,
                  )
                  .addEvent(
                    BO.JOIN_SIGNAL_CONNECTION_START,
                    this.handleSignalConnectionStart,
                  )
                  .addEvent(
                    BO.JOIN_SIGNAL_CONNECTION_END,
                    this.handleSignalConnectionEnd,
                  )
                  .addEvent(BO.JOIN_SEND_CMD, this.handleJoinSendCMD)
                  .addEvent(
                    BO.JOIN_RECEIVED_CMD_RES,
                    this.handleJoinReceivedCMDResponce,
                  )
                  .addEvent(BO.JOIN_SUCCESS, this.handleJoinSuccess)
                  .addEvent(BO.JOIN_FAILED, this.handleJoinFailed)
                  .addEvent(BO.LEAVE_START, this.handleLeaveStart)
                  .addEvent(BO.LEAVE_SUCCESS, this.handleLeaveSuccess)
                  .addEvent(BO.LEAVE_SEND_CMD, this.handleLeaveSendCMD)
                  .addEvent(
                    BO.LOCAL_TRACK_CAPTURE_START,
                    this.handleTrackCaptureStart,
                  )
                  .addEvent(
                    BO.LOCAL_TRACK_CAPTURE_SUCCESS,
                    this.handleTrackCaptureSuccess,
                  )
                  .addEvent(
                    BO.LOCAL_TRACK_CAPTURE_FAILED,
                    this.handleTrackCaptureFailed,
                  )
                  .addEvent(BO.PUBLISH_START, this.handlePublishStart)
                  .addEvent(
                    BO.SEND_FIRST_VIDEO_FRAME,
                    this.handleSendFirstVideoFrame,
                  )
                  .addEvent(BO.SUBSCRIBE_START, this.handleSubscribeStart)
                  .addEvent(BO.SUBSCRIBE_SUCCESS, this.handleSubscribed)
                  .addEvent(BO.PLAY_TRACK_START, this.handlePlayStart)
                  .addEvent(BO.VIDEO_LOADED_DATA, this.handleVideoLoadedData)
                  .addEvent(BO.PLAYER_STATE_CHANGED, (e) => {
                    let { track: t, state: i, type: n } = e;
                    !dO(t) ||
                      !this.hitTest(t.room) ||
                      ('PLAYING' === i &&
                        (n === LN.AUDIO
                          ? this.handleAudioPlaying(t)
                          : this.handleVideoPlaying(t)));
                  })
                  .addEvent(BO.NETWORK_QUALITY, this.handleNetworkQuality)
                  .addEvent(BO.HEARTBEAT_REPORT, this.handleHeartbeatStats)
                  .addEvent(
                    BO.RECEIVED_PUBLISHED_USER_LIST,
                    this.handleReceivedPublishUserList,
                  )
                  .addEvent(BO.REMOTE_PUBLISH_STATE_CHANGED, (e) => {
                    let { room: t, prevMuteState: i, muteState: n } = e;
                    if (!this.hitTest(t)) return;
                    let r = i.hasAudio || i.hasVideo || i.hasSmall,
                      o = i.hasAuxiliary,
                      s = n.hasAudio || n.hasVideo || n.hasSmall,
                      a = n.hasAuxiliary;
                    !r && s && this.handleRemoteStreamAdded(n.userId, 'main'),
                      !o &&
                        a &&
                        this.handleRemoteStreamAdded(n.userId, 'auxiliary');
                  })
                  .addEvent(BO.API_SUCCESS_RATE, this.handleAPISuccessRate)
                  .addEvent(BO.SINGLE_CONNECTION_STAT, (e) => {
                    let { room: t, stat: i } = e;
                    this.hitTest(t) &&
                      ((this._pathJoinRoom.int32_ice_cost = i.ice),
                      (this._pathJoinRoom.int32_dtls_cost = i.dtls),
                      (this._pathJoinRoom.int32_peer_connection_cost =
                        i.peerConnection));
                  });
            }
            uninstallEvents() {
              window.removeEventListener('unload', this.handleUnload),
                this._eventMap.forEach((e, t) => UO.off(t, e)),
                this._eventMap.clear();
            }
            destroy() {
              this.uninstallEvents(), qw.clearTask(this._intervalId);
            }
            handleUnload() {
              this._room.isJoined &&
                this.handleLeaveSuccess({
                  room: this._room,
                  roomId: this._room.roomId,
                });
            }
            handleJoinStart(e) {
              this.hitTest(e.room) &&
                (0 === this._pathJoinRoom.uint64_start_time &&
                  ((this._pathJoinRoom.uint64_start_time = Date.now()),
                  this.checkStorage()),
                e.params &&
                  (nO(e.params.frameWorkType) ||
                    ((this._frameWorkType = e.params.frameWorkType),
                    (this._basicInfo.uint32_framework = this._frameWorkType)),
                  nO(e.params.component) ||
                    ((this._component = e.params.component),
                    (this._basicInfo.uint32_component = this._component)),
                  nO(e.params.language) ||
                    ((this._language = e.params.language),
                    (this._basicInfo.uint32_caller_coding_language =
                      this._language))));
            }
            handleJoinScheduleSuccess(e) {
              let { room: t, detailCost: i } = e;
              if (this.hitTest(t) && i) {
                let {
                  totalCost: e,
                  local: t,
                  dns: n,
                  tcp: r,
                  tls: o,
                  request: s,
                  response: a,
                } = i;
                (this._pathJoinRoom.int32_schedule_cost = e),
                  (this._pathJoinRoom.int32_schedule_local = t),
                  (this._pathJoinRoom.int32_schedule_dns = n),
                  (this._pathJoinRoom.int32_schedule_tcp = r),
                  (this._pathJoinRoom.int32_schedule_tls = o),
                  (this._pathJoinRoom.int32_schedule_request = s),
                  (this._pathJoinRoom.int32_schedule_response = a);
              }
            }
            handleSignalConnectionStart(e) {
              let { room: t } = e;
              this.hitTest(t) &&
                0 ===
                  this._pathJoinRoom
                    .uint64_send_request_acc_ip_cmd_start_time &&
                (this._pathJoinRoom.uint64_send_request_acc_ip_cmd_start_time =
                  Date.now());
            }
            handleSignalConnectionEnd(e) {
              let { room: t, error: i } = e;
              this.hitTest(t) &&
                0 ===
                  this._pathJoinRoom.uint64_send_request_acc_ip_cmd_end_time &&
                ((this._pathJoinRoom.uint64_send_request_acc_ip_cmd_end_time =
                  Date.now()),
                i &&
                  ((this._pathJoinRoom.int32_send_request_acc_ip_cmd_ret =
                    i instanceof gb
                      ? Number(i.getExtraCode() || i.getCode())
                      : mb.UNKNOWN),
                  (this._pathJoinRoom.int32_end_ret =
                    this._pathJoinRoom.int32_send_request_acc_ip_cmd_ret)));
            }
            handleJoinSendCMD(e) {
              this.hitTest(e.room) &&
                0 ===
                  this._pathJoinRoom
                    .uint64_send_request_enter_room_cmd_start_time &&
                (this._pathJoinRoom.uint64_send_request_enter_room_cmd_start_time =
                  Date.now());
            }
            handleJoinReceivedCMDResponce(e) {
              this.hitTest(e.room) &&
                0 ===
                  this._pathJoinRoom
                    .uint64_send_request_enter_room_cmd_end_time &&
                ((this._pathJoinRoom.uint64_send_request_enter_room_cmd_end_time =
                  Date.now()),
                (this._pathJoinRoom.int32_send_request_enter_room_cmd_ret =
                  e.code),
                0 !== e.code &&
                  (this._pathJoinRoom.int32_end_ret =
                    this._pathJoinRoom.int32_send_request_enter_room_cmd_ret));
            }
            handleJoinSuccess(e) {
              this.hitTest(e.room) &&
                0 === this._pathJoinRoom.uint64_end_time &&
                ((this._pathJoinRoom.uint64_end_time = Date.now()),
                (this._pathJoinRoom.int32_end_ret = 0),
                (this._signalInfo = e.room.getSignalInfo()));
            }
            handleJoinFailed(e) {
              let { room: t, error: i } = e;
              this.hitTest(t) &&
                ((this._pathJoinRoom.uint64_end_time = Date.now()),
                0 === this._pathJoinRoom.int32_end_ret &&
                  (this._pathJoinRoom.int32_end_ret =
                    i.code ||
                    this._pathJoinRoom.int32_send_request_enter_room_cmd_ret ||
                    this._pathJoinRoom.int32_send_request_acc_ip_cmd_ret),
                setTimeout(() => {
                  this.report();
                }));
            }
            handleReceivedPublishUserList(e) {
              this.hitTest(e.room) &&
                0 === this._pathJoinRoom.uint64_recv_userlist_time &&
                ((this._pathJoinRoom.uint64_recv_userlist_time = Date.now()),
                (this._firstPublishedUserList = e.publishedUserList || []));
            }
            handleSendFirstVideoFrame(e) {
              let { room: t } = e;
              !this.hitTest(t) ||
                (0 === this._pathJoinRoom.uint64_send_first_video_frame_time &&
                  0 !== this._pathJoinRoom.uint64_start_time &&
                  (this._pathJoinRoom.uint64_send_first_video_frame_time =
                    Date.now()));
            }
            handleLeaveStart(e) {
              this.hitTest(e.room) &&
                (this._pathLeaveRoom.uint64_start_time = Date.now());
            }
            handleLeaveSuccess(e) {
              this.hitTest(e.room) &&
                0 === this._pathLeaveRoom.uint64_end_time &&
                ((this._pathLeaveRoom.uint64_end_time = Date.now()),
                0 !== this._pathJoinRoom.uint64_end_time
                  ? (this._basicInfo.uint32_joining_duration =
                      this._pathLeaveRoom.uint64_end_time -
                      this._pathJoinRoom.uint64_end_time)
                  : this._log.warn('pathJoinRoom endTime is 0'),
                this.report());
            }
            handleLeaveSendCMD(e) {
              this.hitTest(e.room) &&
                ((this._pathLeaveRoom.uint64_send_request_exit_room_cmd_start_time =
                  Date.now()),
                (this._pathLeaveRoom.uint64_send_request_exit_room_cmd_end_time =
                  Date.now()));
            }
            handleRemoteStreamAdded(e, t) {
              var i;
              let n = ''.concat(e, '_').concat(t);
              if (!this._remoteStreamStatMap.has(n)) {
                let r = {
                  userId: e,
                  totalVideoFPS: 0,
                  totalVideoBitrate: 0,
                  totalAudioLevel: 0,
                  totalAudioBitrate: 0,
                  totalLoss: 0,
                  audioCount: 0,
                  audioLevelCount: 0,
                  videoCount: 0,
                  networkQualityCount: 0,
                  streamAddedTime: Date.now(),
                  subscribeStartTime: 0,
                  subscribedTime: 0,
                  playStreamTime: 0,
                  statsToReport: eb(ZC({}, Sx), {
                    msg_user_info: new Ix({
                      userId: e,
                      tinyId:
                        null == (i = this._room.remotePublishedUserMap.get(e))
                          ? void 0
                          : i.tinyId,
                      role: 20,
                    }),
                  }),
                };
                (r.statsToReport.uint32_stream_type = 'main' === t ? 2 : 7),
                  this._remoteStreamStatMap.set(n, r);
              }
            }
            handleSubscribeStart(e) {
              let {
                room: t,
                remotePublishedUser: i,
                streamType: n,
                subscribeState: r,
              } = e;
              if (!this.hitTest(t)) return;
              let { userId: o, tinyId: s, role: a } = i,
                c = new Ix({
                  userId: o,
                  tinyId: s,
                  role: 'anchor' === a ? 20 : 21,
                }),
                l = Date.now(),
                d = ''.concat(o, '_').concat(n),
                u = this._remoteStreamStatMap.get(d);
              u && 0 === u.subscribeStartTime && (u.subscribeStartTime = l),
                'main' === n
                  ? (i.muteState.hasVideo &&
                      (r.video || r.smallVideo) &&
                      !this._pathMainVideoMap.has(d) &&
                      this._pathMainVideoMap.set(d, {
                        statsToReport: {
                          msg_user_info: c,
                          uint64_start_enter_time:
                            this._pathJoinRoom.uint64_start_time,
                          uint64_render_first_frame_time: 0,
                          uint64_combine_first_frame_time: 0,
                        },
                        userId: o,
                        sendSubscribeCMDTime: l,
                      }),
                    i.muteState.hasAudio &&
                      r.audio &&
                      !this._pathMainAudioMap.has(d) &&
                      this._pathMainAudioMap.set(d, {
                        statsToReport: {
                          msg_user_info: c,
                          uint64_start_enter_time:
                            this._pathJoinRoom.uint64_start_time,
                          uint64_play_first_frame_time: 0,
                        },
                        userId: o,
                        sendSubscribeCMDTime: l,
                      }))
                  : i.muteState.hasAuxiliary &&
                    r.auxiliary &&
                    !this._pathAuxiliaryMap.has(d) &&
                    this._pathAuxiliaryMap.set(d, { sendSubscribeCMDTime: l });
            }
            handleSubscribed(e) {
              let { room: t, remotePublishedUser: i, streamType: n } = e;
              if (this.hitTest(t)) {
                let e = ''.concat(i.userId, '_').concat(n),
                  t = this._remoteStreamStatMap.get(e);
                t && 0 === t.subscribedTime && (t.subscribedTime = Date.now());
              }
            }
            handlePlayStart(e) {
              let { track: t } = e;
              if (!dO(t) || !this.hitTest(t.room)) return;
              let i = ''.concat(t.userId, '_').concat(t.streamType),
                n = this._remoteStreamStatMap.get(i);
              0 === (null == n ? void 0 : n.playStreamTime) &&
                (n.playStreamTime = Date.now());
            }
            handleVideoLoadedData(e) {
              let { track: t } = e;
              if (!dO(t) || !this.hitTest(t.room)) return;
              let i = ''.concat(t.userId, '_').concat(t.streamType),
                n = this._pathMainVideoMap.get(i);
              n &&
                0 === n.statsToReport.uint64_combine_first_frame_time &&
                (n.statsToReport.uint64_combine_first_frame_time = Date.now());
            }
            handleVideoPlaying(e) {
              let t = ''.concat(e.userId, '_').concat(e.streamType),
                i = Date.now(),
                n = this._pathMainVideoMap.get(t),
                r = this._remoteStreamStatMap.get(t);
              if (
                n &&
                (0 === n.statsToReport.uint64_render_first_frame_time &&
                  (n.statsToReport.uint64_render_first_frame_time = i),
                r)
              ) {
                let {
                  statsToReport: e,
                  playStreamTime: t,
                  subscribedTime: o,
                } = r;
                0 === e.uint32_video_render_first &&
                  t - o <= 100 &&
                  (e.uint32_video_render_first = i - n.sendSubscribeCMDTime);
              }
              let o = this._pathAuxiliaryMap.get(t);
              if (o && r) {
                let {
                  statsToReport: e,
                  playStreamTime: t,
                  subscribedTime: n,
                } = r;
                0 === e.uint32_video_render_first &&
                  t - n <= 100 &&
                  (e.uint32_video_render_first = i - o.sendSubscribeCMDTime);
              }
            }
            handleAudioPlaying(e) {
              let t = ''.concat(e.userId, '_').concat(e.streamType),
                i = this._pathMainAudioMap.get(t);
              i &&
                0 === i.statsToReport.uint64_play_first_frame_time &&
                (i.statsToReport.uint64_play_first_frame_time = Date.now());
            }
            handleNetworkQuality(e) {
              this.hitTest(e.room) &&
                ((this._networkQuality.totalUplinkLoss += e.uplink.loss),
                (this._networkQuality.totalUplinkRTT += e.uplink.rtt),
                this._networkQuality.count++,
                e.downlinks.forEach((e) => {
                  let {
                      rtt: t,
                      loss: i,
                      userId: n,
                      videoDelay: r,
                      audioDelay: o,
                    } = e,
                    s = this._networkQuality.totalDownlinkRTTAndLossMap.get(n);
                  if (s)
                    (s.totalRTT += t),
                      (s.totalLoss += i),
                      r &&
                        ((s.totalVideoDelay = (s.totalVideoDelay || 0) + r),
                        (s.videoDelayCount = (s.videoDelayCount || 0) + 1)),
                      o &&
                        ((s.totalAudioDelay = (s.totalAudioDelay || 0) + o),
                        (s.audioDelayCount = (s.audioDelayCount || 0) + 1)),
                      s.count++;
                  else {
                    let e, s, a, c;
                    r && ((s = r), (a = 1)),
                      o && ((e = o), (c = 1)),
                      this._networkQuality.totalDownlinkRTTAndLossMap.set(n, {
                        totalRTT: t,
                        totalLoss: i,
                        count: 1,
                        totalAudioDelay: e,
                        totalVideoDelay: s,
                        audioDelayCount: c,
                        videoDelayCount: a,
                      });
                  }
                }));
            }
            handleHeartbeatStats(e) {
              if (this.hitTest(e.room)) {
                let { msg_up_stream_info: t, msg_down_stream_info: i } =
                  e.report;
                if (t.msg_video_status[0]) {
                  let {
                    uint32_video_codec_bitrate: e,
                    uint32_video_enc_fps: i,
                    uint32_video_width: n,
                    uint32_video_height: r,
                  } = t.msg_video_status[0];
                  (this._localStreamStat.totalVideoBitrate += e),
                    (this._localStreamStat.totalVideoFPS += i),
                    (this._localStreamStat.totalVideoWidth += n),
                    (this._localStreamStat.totalVideoHeight += r),
                    this._localStreamStat.videoCount++;
                }
                if (t.msg_audio_status) {
                  let { uint32_audio_level: e } = t.msg_audio_status;
                  Math.floor((e / xD) * 100) > 0 &&
                    ((this._localStreamStat.totalAudioLevel += e / xD),
                    this._localStreamStat.audioLevelCount++);
                }
                i.forEach((e) => {
                  let {
                      msg_user_info: t,
                      msg_audio_status: i,
                      msg_video_status: n,
                    } = e,
                    r = t.str_identifier,
                    o = this._room.remotePublishedUserMap.get(r);
                  if (
                    (n.forEach((e) => {
                      let t = 2 === e.uint32_video_stream_type,
                        i = 7 === e.uint32_video_stream_type,
                        n = ''.concat(r, '_').concat(t ? 'main' : 'auxiliary'),
                        s = this._remoteStreamStatMap.get(n);
                      if (
                        s &&
                        ((t &&
                          (null == o
                            ? void 0
                            : o.remoteVideoTrack.isSubscribed)) ||
                          (i && (null == o ? void 0 : o.remoteAuxiliaryTrack)))
                      ) {
                        (s.totalVideoFPS += e.uint32_video_receive_fps),
                          (s.totalVideoBitrate += e.uint32_video_codec_bitrate),
                          s.videoCount++,
                          0 === s.statsToReport.uint32_video_width &&
                            (s.statsToReport.uint32_video_width =
                              e.uint32_video_width),
                          0 === s.statsToReport.uint32_video_height &&
                            (s.statsToReport.uint32_video_height =
                              e.uint32_video_height);
                        let i = t ? o.remoteVideoTrack : o.remoteAuxiliaryTrack;
                        i.stat.jitterBufferDelay &&
                          (s.videoJitterBufferDelay = i.stat.jitterBufferDelay),
                          i.stat.framesReceived &&
                            (s.statsToReport.uint32_video_consume_render_rate =
                              Math.floor(
                                (i.stat.framesDecoded / i.stat.framesReceived) *
                                  XC(10, 6),
                              ));
                      }
                    }),
                    i)
                  ) {
                    let e = ''.concat(r, '_', 'main'),
                      t = this._remoteStreamStatMap.get(e);
                    this._remoteStreamStatMap.has(e) &&
                      t &&
                      (null == o ? void 0 : o.remoteAudioTrack.isSubscribed) &&
                      ((t.totalAudioBitrate += i.uint32_audio_codec_bitrate),
                      t.audioCount++,
                      o.remoteAudioTrack.stat.jitterBufferDelay &&
                        (t.audioJitterBufferDelay =
                          o.remoteAudioTrack.stat.jitterBufferDelay),
                      Math.floor((i.uint32_audio_level / xD) * 100) > 0 &&
                        ((t.totalAudioLevel += i.uint32_audio_level / xD),
                        t.audioLevelCount++));
                  }
                });
              }
            }
            handlePublishStart(e) {
              let { room: t } = e;
              this.hitTest(t) &&
                0 === this._localStreamStat.publishStartTime &&
                (this._localStreamStat.publishStartTime = Date.now());
            }
            handleTrackCaptureStart(e) {
              let { track: t } = e;
              1 === t.mediaType &&
                !this._pathJoinRoom.uint64_init_audio_start_time &&
                (this._pathJoinRoom.uint64_init_audio_start_time = Date.now()),
                4 === t.mediaType &&
                  !this._pathJoinRoom.uint64_init_camera_start_time &&
                  (this._pathJoinRoom.uint64_init_camera_start_time =
                    Date.now());
            }
            handleTrackCaptureSuccess(e) {
              let { track: t } = e;
              1 === t.mediaType &&
                !this._pathJoinRoom.uint64_init_audio_end_time &&
                ((this._pathJoinRoom.int32_init_audio_ret = 0),
                (this._pathJoinRoom.uint64_init_audio_end_time = Date.now())),
                4 === t.mediaType &&
                  !this._pathJoinRoom.uint64_init_camera_end_time &&
                  ((this._pathJoinRoom.int32_init_camera_ret = 0),
                  (this._pathJoinRoom.uint64_init_camera_end_time =
                    Date.now()));
            }
            handleTrackCaptureFailed(e) {
              let { track: t, error: i } = e,
                n =
                  {
                    NotFoundError: 1,
                    NotAllowedError: 2,
                    NotReadableError: 3,
                    OverConstrainedError: 4,
                    AbortError: 5,
                    InvalidStateError: 6,
                    SecurityError: 7,
                    TypeError: 8,
                  }[i.name] ||
                  (i instanceof gb
                    ? i.getExtraCode() || i.getCode()
                    : mb.UNKNOWN);
              1 === t.mediaType &&
                !this._pathJoinRoom.uint64_init_audio_end_time &&
                ((this._pathJoinRoom.int32_init_audio_ret = n),
                (this._pathJoinRoom.uint64_init_audio_end_time = Date.now())),
                4 === t.mediaType &&
                  !this._pathJoinRoom.uint64_init_camera_end_time &&
                  ((this._pathJoinRoom.int32_init_camera_ret = n),
                  (this._pathJoinRoom.uint64_init_camera_end_time =
                    Date.now()));
            }
            handleAPISuccessRate(e) {
              let { room: t, apiName: i, error: n, cost: r } = e;
              if (!this.hitTest(t)) return;
              let o = vx[i],
                s = {
                  uint32_function_request_type: o,
                  uint32_avg_value: 0,
                  uint32_max_value: 0,
                  uint32_request_count: 1,
                  uint32_success_count: 0,
                  msg_error_code: [],
                };
              if (n) {
                let e = n.extraCode || n.code || mb.UNKNOWN;
                Xw.logFailedEvent({
                  eventType: i,
                  code: e,
                  userId: this._room.userId,
                  error: n,
                });
                let t = { int32_error_code: e, error_count: 1 };
                s.msg_error_code.push(t);
              } else
                oO(r) &&
                  (Xw.logSuccessEvent({
                    eventType: i,
                    userId: this._room.userId,
                  }),
                  (s.uint32_avg_value = r),
                  (s.uint32_max_value = r),
                  (s.uint32_success_count = 1));
              let a = this._apiSuccessRateMap.get(o);
              a
                ? (a.uint32_success_count + s.uint32_success_count > 0 &&
                    (a.uint32_avg_value =
                      (a.uint32_avg_value * a.uint32_success_count +
                        s.uint32_avg_value) /
                      (a.uint32_success_count + s.uint32_success_count)),
                  (a.uint32_max_value = Math.max(
                    a.uint32_max_value,
                    s.uint32_max_value,
                  )),
                  (a.uint32_request_count += 1),
                  (a.uint32_success_count =
                    a.uint32_success_count + s.uint32_success_count),
                  s.msg_error_code.forEach((e) => {
                    let t = a.msg_error_code.find(
                      (t) => t.int32_error_code === e.int32_error_code,
                    );
                    t ? (t.error_count += 1) : a.msg_error_code.push(e);
                  }))
                : this._apiSuccessRateMap.set(o, s);
            }
            hasVideoFlag(e) {
              return (
                this._firstPublishedUserList.findIndex(
                  (t) => t.userId === e && t.flag & UN,
                ) >= 0
              );
            }
            hasAudioFlag(e) {
              return (
                this._firstPublishedUserList.findIndex(
                  (t) => t.userId === e && t.flag & HN,
                ) >= 0
              );
            }
            hasAuxFlag(e) {
              return (
                this._firstPublishedUserList.findIndex(
                  (t) => t.userId === e && t.flag & BN,
                ) >= 0
              );
            }
            hitTest(e) {
              return e === this._room;
            }
            checkStorage() {
              return ab(this, null, function* () {
                try {
                  let e = WO.getItem(this._storageKey);
                  e && (yield this.upload(e), WO.deleteItem(this._storageKey));
                } catch (YL) {
                  this._log.warn(YL);
                }
              });
            }
            setStorage() {
              this.prepareReport();
              let e = this.getReportData();
              0 !== e.msg_path_enter_room.uint64_start_time &&
                WO.setItem(this._storageKey, e);
            }
            prepareReport() {
              if (
                (this._networkQuality.count > 0 &&
                  ((this._basicInfo.uint32_avg_rtt = Math.floor(
                    this._networkQuality.totalUplinkRTT /
                      this._networkQuality.count,
                  )),
                  (this._basicInfo.uint32_avg_up_loss = Math.floor(
                    this._networkQuality.totalUplinkLoss /
                      this._networkQuality.count,
                  ))),
                this._localStreamStat.videoCount > 0)
              ) {
                (this._localStreamStat.statsToReport.uint32_video_big_capture_fps =
                  Math.floor(
                    this._localStreamStat.totalVideoFPS /
                      this._localStreamStat.videoCount,
                  )),
                  (this._localStreamStat.statsToReport.uint32_video_big_bitrate =
                    Math.floor(
                      this._localStreamStat.totalVideoBitrate /
                        this._localStreamStat.videoCount,
                    ));
                let e = Math.floor(
                    this._localStreamStat.totalVideoWidth /
                      this._localStreamStat.videoCount,
                  ),
                  t = Math.floor(
                    this._localStreamStat.totalVideoHeight /
                      this._localStreamStat.videoCount,
                  );
                this._localStreamStat.statsToReport.uint32_video_big_resolution =
                  (e << 16) | t;
              }
              this._localStreamStat.audioLevelCount > 0 &&
                (this._localStreamStat.statsToReport.uint32_audio_capture_db =
                  Math.floor(
                    (this._localStreamStat.totalAudioLevel /
                      this._localStreamStat.audioLevelCount) *
                      100,
                  )),
                this._remoteStreamStatMap.forEach((e, t) => {
                  let { userId: i } = e,
                    n = this._networkQuality.totalDownlinkRTTAndLossMap.get(i);
                  if (n) {
                    let {
                      totalLoss: t,
                      count: i,
                      audioDelayCount: r,
                      videoDelayCount: o,
                      totalAudioDelay: s,
                      totalVideoDelay: a,
                    } = n;
                    (e.statsToReport.uint32_avg_down_loss = Math.floor(t / i)),
                      r &&
                        s &&
                        ((e.statsToReport.uint32_audio_network_p2p_delay =
                          Math.floor(s / r)),
                        e.audioJitterBufferDelay &&
                          (e.statsToReport.uint32_p2p_delay = Math.floor(
                            e.statsToReport.uint32_audio_network_p2p_delay +
                              e.audioJitterBufferDelay,
                          ))),
                      o &&
                        a &&
                        (e.statsToReport.uint32_video_network_p2p_delay =
                          Math.floor(a / o));
                  }
                  e.videoCount > 0 &&
                    ((e.statsToReport.uint32_video_avg_fps = Math.floor(
                      e.totalVideoFPS / e.videoCount,
                    )),
                    (e.statsToReport.uint32_video_avg_bitrate = Math.floor(
                      e.totalVideoBitrate / e.videoCount,
                    ))),
                    e.audioCount > 0 &&
                      (e.statsToReport.uint32_audio_recv_bitrate =
                        e.statsToReport.uint32_audio_bitrate =
                          Math.floor(e.totalAudioBitrate / e.audioCount)),
                    e.audioLevelCount > 0 &&
                      (e.statsToReport.uint32_audio_play_db = Math.floor(
                        (e.totalAudioLevel / e.audioLevelCount) * 100,
                      ));
                  let { callDurationCalculator: r } = this._room;
                  r &&
                    ((e.statsToReport.uint32_audio_play_time = r.getDuration(
                      t,
                      LN.AUDIO,
                    )),
                    (e.statsToReport.uint32_video_play_time = r.getDuration(
                      t,
                      LN.VIDEO,
                    ))),
                    (e.statsToReport.uint32_video_render_first = Math.min(
                      e.statsToReport.uint32_video_render_first,
                      Ex,
                    ));
                  let { badCaseDetector: o } = this._room,
                    { dataFreeze: s, count: a } = o.getDataFreezeDuration(t),
                    { renderFreeze: c } = o.getRenderFreezeDuration(t);
                  (e.statsToReport.uint32_video_block_count = a),
                    (e.statsToReport.uint32_video_block_time = Math.min(
                      s,
                      e.statsToReport.uint32_video_play_time,
                    )),
                    (e.statsToReport.uint32_video_external_block_time =
                      Math.min(c, e.statsToReport.uint32_video_play_time)),
                    o.isBlackStream(t) &&
                    0 === e.statsToReport.uint32_video_avg_fps
                      ? (e.statsToReport.uint32_video_black_screen_subjective = 1)
                      : (e.statsToReport.uint32_video_black_screen_subjective = 0),
                    (0 === e.subscribeStartTime ||
                      e.subscribeStartTime - e.streamAddedTime > 100 ||
                      0 === e.playStreamTime) &&
                      (this._pathMainAudioMap.delete(t),
                      this._pathMainVideoMap.delete(t),
                      (e.statsToReport.uint32_video_render_first = 0));
                }),
                this._pathMainAudioMap.forEach((e, t) => {
                  this.hasAudioFlag(e.userId)
                    ? e.statsToReport.uint64_play_first_frame_time -
                        e.statsToReport.uint64_start_enter_time >
                        Ex &&
                      (e.statsToReport.uint64_play_first_frame_time =
                        e.statsToReport.uint64_start_enter_time + Ex)
                    : this._pathMainAudioMap.delete(t);
                }),
                this._pathMainVideoMap.forEach((e, t) => {
                  this.hasVideoFlag(e.userId)
                    ? e.statsToReport.uint64_render_first_frame_time -
                        e.statsToReport.uint64_start_enter_time >
                        Ex &&
                      (e.statsToReport.uint64_render_first_frame_time =
                        e.statsToReport.uint64_start_enter_time + Ex)
                    : this._pathMainVideoMap.delete(t);
                }),
                this._pathJoinRoom.uint64_end_time -
                  this._pathJoinRoom.uint64_start_time >
                  Ex &&
                  (this._pathJoinRoom.uint64_end_time =
                    this._pathJoinRoom.uint64_start_time + Ex);
            }
            getReportData() {
              return {
                uint32_sdk_app_id: Number(this._room.sdkAppId),
                msg_user_info: new Ix({
                  userId: this._room.userId,
                  tinyId: this._room.tinyId,
                  role: 'anchor' === this._room.role ? 20 : 21,
                }),
                msg_basic_info: this._basicInfo,
                uint32_acc_ip: AO(this._signalInfo.relayIp),
                uint32_client_ip: AO(this._signalInfo.clientIp, !1),
                uint32_acc_port: this._signalInfo.relayPort || 0,
                uint64_timestamp: Date.now(),
                uint32_seq: Math.floor(2147483648 * Math.random()),
                msg_path_enter_room: this._pathJoinRoom,
                msg_path_exit_room: this._pathLeaveRoom,
                msg_path_recv_video: [...this._pathMainVideoMap.values()].map(
                  (e) => e.statsToReport,
                ),
                msg_quality_statistics: [
                  ...this._remoteStreamStatMap.values(),
                ].map((e) => e.statsToReport),
                str_room_name: String(this._room.roomId || 0),
                msg_path_recv_audio: [...this._pathMainAudioMap.values()].map(
                  (e) => e.statsToReport,
                ),
                uint32_info_client_ip: AO(this._signalInfo.clientIp, !1),
                error_code: [],
                msg_local_statistics: this._localStreamStat.statsToReport,
                msg_function_request_stats: [
                  ...this._apiSuccessRateMap.values(),
                ],
              };
            }
            report() {
              try {
                this.prepareReport();
                let e = this.getReportData();
                this.upload(e),
                  WO.deleteItem(this._storageKey),
                  this.initData();
              } catch (YL) {
                this._log.warn(YL);
              }
            }
            upload(e) {
              if (
                Yk ||
                0 === e.msg_path_enter_room.uint64_start_time ||
                [_N, mN, fN].findIndex((e) => e === location.host) >= 0
              )
                return;
              let t = Number(this._room.sdkAppId),
                i = BD(t, yN.KEY_POINT),
                n = !1;
              navigator.sendBeacon &&
                (n = navigator.sendBeacon(i, JSON.stringify(e))),
                n || LO({ url: i, body: JSON.stringify(e) });
            }
            setConnectionType(e) {
              (this.connectionType = e),
                (this._basicInfo.uint32_connection_type = e);
            }
          };
          rb(
            [MV({ settings: { timeout: 500, retries: 3 } })],
            gx.prototype,
            'upload',
            1,
          );
          var Tx,
            Ex = 5e3,
            Sx = {
              msg_user_info: null,
              uint32_video_avg_fps: 0,
              uint32_video_width: 0,
              uint32_video_height: 0,
              uint32_video_avg_bitrate: 0,
              uint32_video_block_time: 0,
              uint32_video_play_time: 0,
              uint32_audio_block_time: 0,
              uint32_audio_play_time: 0,
              uint32_audio_play_db: 0,
              uint32_avg_down_loss: 0,
              uint32_stream_type: 0,
              uint32_video_render_first: 0,
              uint32_video_block_count: 0,
              uint32_audio_block_count: 0,
              uint32_audio_bitrate: 0,
              uint32_video_black_screen_subjective: 0,
              uint32_audio_recv_bitrate: 0,
              uint32_video_external_block_time: 0,
              uint32_video_consume_render_rate: 0,
            },
            Ix = class {
              constructor(e) {
                (this.str_identifier = String(e.userId)),
                  (this.str_tinyid = String(e.tinyId || 0)),
                  (this.uint32_role = e.role);
              }
            },
            vx =
              (((Tx = vx || {})[(Tx.enterRoom = 50001)] = 'enterRoom'),
              (Tx[(Tx.exitRoom = 50002)] = 'exitRoom'),
              (Tx[(Tx.switchRole = 50003)] = 'switchRole'),
              (Tx[(Tx.destroy = 50004)] = 'destroy'),
              (Tx[(Tx.startLocalAudio = 50005)] = 'startLocalAudio'),
              (Tx[(Tx.updateLocalAudio = 50006)] = 'updateLocalAudio'),
              (Tx[(Tx.stopLocalAudio = 50007)] = 'stopLocalAudio'),
              (Tx[(Tx.startLocalVideo = 50008)] = 'startLocalVideo'),
              (Tx[(Tx.updateLocalVideo = 50009)] = 'updateLocalVideo'),
              (Tx[(Tx.stopLocalVideo = 50010)] = 'stopLocalVideo'),
              (Tx[(Tx.startScreenShare = 50011)] = 'startScreenShare'),
              (Tx[(Tx.updateScreenShare = 50012)] = 'updateScreenShare'),
              (Tx[(Tx.stopScreenShare = 50013)] = 'stopScreenShare'),
              (Tx[(Tx.enableAudioVolumeEvaluation = 50014)] =
                'enableAudioVolumeEvaluation'),
              (Tx[(Tx.startRemoteVideo = 50015)] = 'startRemoteVideo'),
              (Tx[(Tx.updateRemoteVideo = 50016)] = 'updateRemoteVideo'),
              (Tx[(Tx.stopRemoteVideo = 50017)] = 'stopRemoteVideo'),
              (Tx[(Tx.muteRemoteAudio = 50018)] = 'muteRemoteAudio'),
              (Tx[(Tx.setRemoteAudioVolume = 50019)] = 'setRemoteAudioVolume'),
              (Tx[(Tx.startMixTranscode = 50020)] = 'startMixTranscode'),
              (Tx[(Tx.stopMixTranscode = 50021)] = 'stopMixTranscode'),
              (Tx[(Tx.startPublishCDNStream = 50022)] =
                'startPublishCDNStream'),
              (Tx[(Tx.stopPublishCDNStream = 50023)] = 'stopPublishCDNStream'),
              (Tx[(Tx.PeerConnectionConnect = 50024)] =
                'PeerConnectionConnect'),
              (Tx[(Tx.PeerConnectionReconnect = 50025)] =
                'PeerConnectionReconnect'),
              (Tx[(Tx.WebsocketConnect = 50026)] = 'WebsocketConnect'),
              (Tx[(Tx.WebsocketReconnect = 50027)] = 'WebsocketReconnect'),
              (Tx[(Tx.schedule = 50028)] = 'schedule'),
              (Tx[(Tx.SPCConnect = 50029)] = 'SPCConnect'),
              (Tx[(Tx.SPCReconnect = 50030)] = 'SPCReconnect'),
              (Tx[(Tx.videoCtxGl = 50031)] = 'videoCtxGl'),
              (Tx[(Tx.videoCtxGlRecover = 50032)] = 'videoCtxGlRecover'),
              (Tx[(Tx.videoCtx2d = 50033)] = 'videoCtx2d'),
              (Tx[(Tx['CDNStreaming.startPlugin'] = 50034)] =
                'CDNStreaming.startPlugin'),
              (Tx[(Tx['CDNStreaming.updatePlugin'] = 50035)] =
                'CDNStreaming.updatePlugin'),
              (Tx[(Tx['CDNStreaming.stopPlugin'] = 50036)] =
                'CDNStreaming.stopPlugin'),
              (Tx[(Tx['AIDenoiser.startPlugin'] = 50037)] =
                'AIDenoiser.startPlugin'),
              (Tx[(Tx['AIDenoiser.updatePlugin'] = 50038)] =
                'AIDenoiser.updatePlugin'),
              (Tx[(Tx['AIDenoiser.stopPlugin'] = 50039)] =
                'AIDenoiser.stopPlugin'),
              (Tx[(Tx['AudioMixer.startPlugin'] = 50040)] =
                'AudioMixer.startPlugin'),
              (Tx[(Tx['AudioMixer.updatePlugin'] = 50041)] =
                'AudioMixer.updatePlugin'),
              (Tx[(Tx['AudioMixer.stopPlugin'] = 50042)] =
                'AudioMixer.stopPlugin'),
              Tx),
            yx = gx,
            Ax = class {
              constructor() {
                ob(this, '_startTime'),
                  ob(this, '_endTime'),
                  (this._startTime = 0),
                  (this._endTime = 0),
                  this.start();
              }
              start() {
                0 === this._startTime && (this._startTime = fO());
              }
              stop() {
                0 === this._endTime && (this._endTime = fO());
              }
              getDuration() {
                return 0 === this._endTime
                  ? fO() - this._startTime
                  : this._endTime - this._startTime;
              }
              get endTime() {
                return this._endTime;
              }
            },
            Rx = class {
              constructor(e) {
                ob(this, '_room', null),
                  ob(this, '_durationMap'),
                  ob(this, '_eventMap', new Map()),
                  (this._room = e.room),
                  (this._durationMap = new Map()),
                  this.installEvents();
              }
              installEvents() {
                this._eventMap
                  .set(BO.SUBSCRIBE_SUCCESS, this.handleSubscribed)
                  .set(BO.UNSUBSCRIBE_SUCCESS, this.handleStreamStopped)
                  .set(BO.REMOTE_PUBLISH_STATE_CHANGED, (e) => {
                    let { room: t, prevMuteState: i, muteState: n } = e;
                    var r;
                    let { userId: o } = n;
                    if (!this.hitTest(t)) return;
                    i.hasAudio &&
                      !n.hasAudio &&
                      this.stopDurationItem(
                        ''.concat(o, '_', 'main'),
                        LN.AUDIO,
                      ),
                      i.hasVideo &&
                        !n.hasVideo &&
                        this.stopDurationItem(
                          ''.concat(o, '_', 'main'),
                          LN.VIDEO,
                        ),
                      i.hasAuxiliary &&
                        !n.hasAuxiliary &&
                        this.stopDurationItem(
                          ''.concat(o, '_', 'auxiliary'),
                          LN.VIDEO,
                        );
                    let s =
                      null == (r = this._room)
                        ? void 0
                        : r.remotePublishedUserMap.get(o);
                    !s ||
                      (!i.hasAudio &&
                        n.hasAudio &&
                        s.remoteAudioTrack.isSubscribed &&
                        this.addDuractionItem(o, LN.AUDIO, 'main'),
                      !i.hasVideo &&
                        n.hasVideo &&
                        s.remoteVideoTrack.isSubscribed &&
                        this.addDuractionItem(o, LN.VIDEO, 'main'),
                      !i.hasAuxiliary &&
                        n.hasAuxiliary &&
                        s.remoteAuxiliaryTrack.isSubscribed &&
                        this.addDuractionItem(o, LN.VIDEO, 'auxiliary'));
                  }),
                  this._eventMap.forEach((e, t) => UO.on(t, e, this));
              }
              uninstallEvents() {
                this._eventMap.forEach((e, t) => UO.off(t, e, this)),
                  this._eventMap.clear();
              }
              handleSubscribed(e) {
                let { room: t, streamType: i, remotePublishedUser: n } = e;
                if (!this.hitTest(t)) return;
                let { userId: r } = n,
                  o = ''.concat(r, '_').concat(i);
                if (n.muteState.hasAudio && 'main' === i)
                  if (n.remoteAudioTrack.isSubscribed) {
                    let e = new Ax(),
                      t = this._durationMap.get(o);
                    t
                      ? this.isRecording(t.audio) || t.audio.push(e)
                      : this._durationMap.set(o, {
                          userId: r,
                          type: i,
                          audio: [e],
                          video: [],
                        });
                  } else this.stopDurationItem(o, LN.AUDIO);
                if (n.muteState.hasVideo || n.muteState.hasAuxiliary)
                  if (
                    n.remoteVideoTrack.isSubscribed ||
                    n.remoteAuxiliaryTrack.isSubscribed
                  ) {
                    let e = new Ax(),
                      t = this._durationMap.get(o);
                    t
                      ? this.isRecording(t.video) || t.video.push(e)
                      : this._durationMap.set(o, {
                          userId: r,
                          type: i,
                          audio: [],
                          video: [e],
                        });
                  } else this.stopDurationItem(o, LN.VIDEO);
              }
              handleStreamStopped(e) {
                let { room: t, streamType: i, remotePublishedUser: n } = e;
                if (!this.hitTest(t)) return;
                let { userId: r } = n,
                  o = ''.concat(r, '_').concat(i);
                this.stopDurationItem(o, LN.AUDIO),
                  this.stopDurationItem(o, LN.VIDEO);
              }
              isRecording(e) {
                return e.findIndex((e) => 0 === e.endTime) >= 0;
              }
              addDuractionItem(e, t, i) {
                let n = ''.concat(e, '_').concat(i),
                  r = new Ax(),
                  o = this._durationMap.get(n);
                o
                  ? this.isRecording(o[t]) || o[t].push(r)
                  : this._durationMap.set(n, {
                      userId: e,
                      type: i,
                      audio: t === LN.AUDIO ? [r] : [],
                      video: t === LN.AUDIO ? [] : [r],
                    });
              }
              stopDurationItem(e, t) {
                if (this._durationMap.has(e)) {
                  let i = this._durationMap
                    .get(e)
                    [t].find((e) => 0 === e.endTime);
                  i && i.stop();
                }
              }
              hitTest(e) {
                return this._room === e;
              }
              getDuration(e, t) {
                return this._durationMap.has(e)
                  ? this._durationMap
                      .get(e)
                      [t].reduce((e, t) => e + t.getDuration(), 0)
                  : 0;
              }
              getDurationMap() {
                return this._durationMap;
              }
              reset() {
                this._durationMap.clear();
              }
              destroy() {
                (this._room = null), this.uninstallEvents();
              }
            },
            Cx = class {
              constructor(e) {
                ob(this, '_room'),
                  ob(this, '_renderFreezeMap', new Map()),
                  ob(this, '_isVideoPlayingEventFiredMap', new Map()),
                  ob(this, '_dataFreezeMap', new Map()),
                  ob(this, '_monitorFreezeData', new Map()),
                  ob(this, '_eventMap', new Map()),
                  (this._room = e.room),
                  this.installEvents();
              }
              installEvents() {
                this._eventMap
                  .set(BO.LEAVE_SUCCESS, (e) => {
                    let { room: t } = e;
                    this.hitTest(t) && this.stop();
                  })
                  .set(BO.PLAY_TRACK_START, this.onPlayTrackStart)
                  .set(BO.UNSUBSCRIBE_SUCCESS, (e) => {
                    let { room: t, streamType: i, remotePublishedUser: n } = e;
                    if (!this.hitTest(t)) return;
                    let { userId: r } = n,
                      o = ''.concat(r, '_').concat(i);
                    this.stopDataFreeze({ key: o, userId: r, type: i });
                  })
                  .set(BO.REMOTE_PUBLISH_STATE_CHANGED, (e) => {
                    let { room: t, prevMuteState: i, muteState: n } = e;
                    if (!this.hitTest(t)) return;
                    let { userId: r } = n;
                    if (i.hasVideo && !n.hasVideo) {
                      let e = 'main',
                        t = ''.concat(n.userId, '_').concat(e);
                      this.stopDataFreeze({ key: t, userId: r, type: e });
                    }
                    if (i.hasAuxiliary && !n.hasAuxiliary) {
                      let e = 'auxiliary',
                        t = ''.concat(n.userId, '_').concat(e);
                      this.stopDataFreeze({ key: t, userId: r, type: e });
                    }
                  })
                  .set(BO.PLAYER_STATE_CHANGED, (e) => {
                    let { track: t, state: i, reason: n, type: r } = e;
                    if (dO(t) && this.hitTest(t.room) && r === LN.VIDEO) {
                      if ('PLAYING' === i) {
                        let e = ''.concat(t.userId, '_').concat(t.streamType);
                        this._isVideoPlayingEventFiredMap.set(e, !0);
                      }
                      n === LN.MUTE
                        ? this.onVideoTrackMuted(t)
                        : n === LN.UNMUTE && this.onVideoTrackUnmuted(t);
                    }
                  })
                  .set(BO.HEARTBEAT_REPORT, this.onHearBeatReport),
                  this._eventMap.forEach((e, t) => UO.on(t, e, this));
              }
              uninstallEvents() {
                this._eventMap.forEach((e, t) => UO.off(t, e, this)),
                  this._eventMap.clear();
              }
              stop() {
                this._renderFreezeMap.clear(),
                  this._dataFreezeMap.clear(),
                  this._isVideoPlayingEventFiredMap.clear();
              }
              onVideoTrackMuted(e) {
                if (!e.isSubscribed) return;
                let { userId: t, streamType: i } = e,
                  n = ''.concat(t, '_').concat(i),
                  r = this._dataFreezeMap.get(n),
                  o = new Ax();
                r
                  ? r.durationItemList.push(o)
                  : this._dataFreezeMap.set(n, {
                      userId: t,
                      type: i,
                      durationItemList: [o],
                      isFreezing() {
                        let e =
                          this.durationItemList[
                            this.durationItemList.length - 1
                          ];
                        return e && 0 === e.endTime;
                      },
                    });
              }
              onVideoTrackUnmuted(e) {
                if (!e.isSubscribed) return;
                let { userId: t, streamType: i } = e,
                  n = ''.concat(t, '_').concat(i);
                this.stopDataFreeze({ key: n, userId: t, type: i });
              }
              onHearBeatReport(e) {
                let { room: t, report: i } = e;
                !this.hitTest(t) ||
                  i.msg_down_stream_info.forEach((e) => {
                    let t = this._room.remotePublishedUserMap.get(
                      e.msg_user_info.str_identifier,
                    );
                    if (!t) return;
                    let { userId: i, muteState: n } = t;
                    e.msg_video_status.forEach((e) => {
                      2 === e.uint32_video_stream_type &&
                        n.hasVideo &&
                        !n.videoMuted &&
                        t.remoteVideoTrack.isSubscribed &&
                        this.handleRenderFreeze({
                          userId: i,
                          fps: e.uint32_video_dec_fps,
                          type: 'main',
                        }),
                        7 === e.uint32_video_stream_type &&
                          n.hasAuxiliary &&
                          t.remoteAuxiliaryTrack.isSubscribed &&
                          this.handleRenderFreeze({
                            userId: i,
                            fps: e.uint32_video_dec_fps,
                            type: 'auxiliary',
                          });
                    });
                  });
              }
              stopDataFreeze(e) {
                let { key: t, userId: i, type: n } = e,
                  r = this._dataFreezeMap.get(t);
                if (!r || !r.isFreezing()) return;
                let o = r.durationItemList[r.durationItemList.length - 1];
                o.stop();
                let s = o.getDuration();
                s > fD
                  ? this._monitorFreezeData.set(t, {
                      userId: i,
                      type: n,
                      duration: s,
                    })
                  : r.durationItemList.pop();
              }
              getTotalDuration(e) {
                return e.reduce((e, t) => {
                  let i = t.getDuration();
                  return e + Math.min(i, 5e3);
                }, 0);
              }
              handleRenderFreeze(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let { userId: i, fps: n, type: r } = e;
                  return (function* () {
                    let e = ''.concat(i, '_').concat(r),
                      o = t._renderFreezeMap.get(e);
                    if (n <= 2) {
                      let n = fO();
                      o &&
                        !o.isFreeze &&
                        (o.freezeTimeline.push({ startTime: n, endTime: 0 }),
                        (o.isFreeze = !0)),
                        o ||
                          t._renderFreezeMap.set(e, {
                            userId: i,
                            type: r,
                            isFreeze: !0,
                            freezeTimeline: [{ startTime: n, endTime: 0 }],
                            renderFreezeTotal: 0,
                          });
                    } else if (o && o.isFreeze) {
                      o.isFreeze = !1;
                      let e = o.freezeTimeline.pop();
                      if (e) {
                        e.endTime = fO();
                        let t = e.endTime - e.startTime;
                        o.freezeTimeline.push(e),
                          (o.renderFreezeTotal += Math.min(5e3, t));
                      }
                    }
                  })();
                });
              }
              onPlayTrackStart(e) {
                let { track: t } = e;
                if (
                  !dO(t) ||
                  !this.hitTest(t.room) ||
                  t.kind !== LN.VIDEO ||
                  t.hasFlag
                )
                  return;
                let i = ''.concat(t.userId, '_').concat(t.streamType);
                this._isVideoPlayingEventFiredMap.has(i) ||
                  this._isVideoPlayingEventFiredMap.set(i, !1);
              }
              getDataFreezeDuration(e) {
                let t = { dataFreeze: 0, count: 0 },
                  i = this._dataFreezeMap.get(e);
                if (i) {
                  if (i.isFreezing()) {
                    let e = i.durationItemList[i.durationItemList.length - 1];
                    e.stop(), e.getDuration() < fD && i.durationItemList.pop();
                  }
                  (t.dataFreeze = this.getTotalDuration(i.durationItemList)),
                    (t.count = i.durationItemList.length);
                }
                return t;
              }
              getRenderFreezeDuration(e) {
                let t = this._renderFreezeMap.get(e),
                  i = 0,
                  n = 0;
                if (t)
                  if (t.isFreeze) {
                    let e =
                      fO() -
                      t.freezeTimeline[t.freezeTimeline.length - 1].startTime;
                    (i = t.renderFreezeTotal + Math.min(e, 5e3)),
                      (n = t.freezeTimeline.length);
                  } else i = t.renderFreezeTotal;
                return { renderFreeze: i, count: n };
              }
              getMonitorFreeze() {
                return this._monitorFreezeData;
              }
              isBlackStream(e) {
                return (
                  !!this._isVideoPlayingEventFiredMap.has(e) &&
                  !this._isVideoPlayingEventFiredMap.get(e)
                );
              }
              resetMonitor() {
                this._monitorFreezeData.clear();
              }
              hitTest(e) {
                return e === this._room;
              }
              destroy() {
                this.uninstallEvents();
              }
            },
            bx = nb(cb(), 1),
            kx = [-1, -1, -1, 1, 1, -1, 1, 1],
            Nx = [0, 0, 0, 1, 1, 0, 1, 1],
            Dx = class extends Ww {
              constructor(e, t) {
                super(),
                  (this.context = e),
                  ob(this, 'name'),
                  ob(this, 'input'),
                  ob(this, 'output'),
                  ob(this, 'texture'),
                  ob(this, 'image'),
                  ob(this, 'ctx2d', null),
                  ob(this, 'fbo'),
                  ob(this, 'width', 0),
                  ob(this, 'height', 0),
                  ob(this, 'x', 0),
                  ob(this, 'y', 0),
                  ob(this, 'program'),
                  ob(this, 'vertexShader'),
                  ob(this, 'fragmentShader'),
                  ob(this, 'totalFrames', 0),
                  ob(this, 'dropFrames', 0),
                  ob(this, 'matchInputSize', !0),
                  ob(this, 'texCoordBuffer'),
                  ob(this, 'positionBuffer'),
                  ob(this, 'lastInfo', {
                    timestamp: 0,
                    totalFrames: 0,
                    x: 0,
                    y: 0,
                    width: 0,
                    height: 0,
                    fps: 0,
                  }),
                  ob(this, '_canvas', null),
                  this.context.on('disconnect', this.close, this),
                  (this.name = t.name),
                  (this.matchInputSize = !1 !== t.matchInputSize),
                  (this.width = t.width || e.width),
                  (this.height = t.height || e.height);
                let i = e._gl;
                if (i)
                  try {
                    !1 !== t.createTexture &&
                      (this.texture = i.createTexture()),
                      (this.texCoordBuffer = this.createBuffer(Nx)),
                      (this.positionBuffer = this.createBuffer(kx)),
                      this.useTexture(() => {
                        i.texParameteri(
                          i.TEXTURE_2D,
                          i.TEXTURE_MIN_FILTER,
                          i.LINEAR,
                        ),
                          i.texParameteri(
                            i.TEXTURE_2D,
                            i.TEXTURE_MAG_FILTER,
                            i.LINEAR,
                          ),
                          i.texParameteri(
                            i.TEXTURE_2D,
                            i.TEXTURE_WRAP_S,
                            i.CLAMP_TO_EDGE,
                          ),
                          i.texParameteri(
                            i.TEXTURE_2D,
                            i.TEXTURE_WRAP_T,
                            i.CLAMP_TO_EDGE,
                          );
                      }),
                      t.useFbo &&
                        ((this.fbo = i.createFramebuffer()),
                        this.useBufferFrame(() => {
                          this.useTexture(() => {
                            i.texImage2D(
                              i.TEXTURE_2D,
                              0,
                              i.RGBA,
                              this.width,
                              this.height,
                              0,
                              i.RGBA,
                              i.UNSIGNED_BYTE,
                              null,
                            ),
                              i.framebufferTexture2D(
                                i.FRAMEBUFFER,
                                i.COLOR_ATTACHMENT0,
                                i.TEXTURE_2D,
                                this.texture,
                                0,
                              );
                          });
                        })),
                      t.useDefaultProgram &&
                        (this.program = this.context.defaultProgam),
                      t.vertexShaderSource &&
                        t.fragmentShaderSource &&
                        ((this.vertexShader = e.createShader(
                          i.VERTEX_SHADER,
                          t.vertexShaderSource,
                        )),
                        (this.fragmentShader = e.createShader(
                          i.FRAGMENT_SHADER,
                          t.fragmentShaderSource,
                        )),
                        (this.program = e.createProgram(
                          this.vertexShader,
                          this.fragmentShader,
                        )));
                  } catch (n) {
                    this.context.destroy(
                      ''.concat(this.name, ' init failed'),
                      n,
                    );
                  }
                else if (e.ctx2d && t.create2d) {
                  let e = document.createElement('canvas'),
                    t =
                      'function' == typeof e.transferControlToOffscreen
                        ? e.transferControlToOffscreen()
                        : e;
                  (t.width = this.width),
                    (t.height = this.height),
                    (this.ctx2d = t.getContext('2d')),
                    (this.image = t),
                    (this._canvas = t);
                }
              }
              connect(e) {
                for (
                  var t = arguments.length,
                    i = new Array(t > 1 ? t - 1 : 0),
                    n = 1;
                  n < t;
                  n++
                )
                  i[n - 1] = arguments[n];
                return e.addInput(this, ...i), (this.output = e), e;
              }
              addInput(e) {
                (this.input = e),
                  this.matchInputSize &&
                    e.width &&
                    e.height &&
                    this.resize(e.width, e.height);
              }
              requestFrame(e) {
                return (
                  !!(
                    (this.context._gl && this.render(e)) ||
                    (this.context.ctx2d && this.render2d(e))
                  ) && (this.totalFrames++, !0)
                );
              }
              render2d(e) {
                var t;
                return (
                  !(null == (t = this.input) || !t.requestFrame(e)) &&
                  this.draw2d(this.input.image, 0, 0, this.width, this.height)
                );
              }
              disconnect() {
                for (
                  var e, t = arguments.length, i = new Array(t), n = 0;
                  n < t;
                  n++
                )
                  i[n] = arguments[n];
                null == (e = this.output) || e.removeInput(this, ...i),
                  delete this.output;
              }
              removeInput(e) {
                delete this.input;
              }
              close() {
                var e, t;
                this.context.off('disconnect', this.close, this),
                  null == (e = this.output) || e.removeInput(this),
                  delete this.output,
                  null == (t = this.input) || t.disconnect();
                let i = this.context._gl;
                i &&
                  (i.deleteBuffer(this.texCoordBuffer),
                  i.deleteBuffer(this.positionBuffer),
                  this.fbo && i.deleteFramebuffer(this.fbo),
                  this.texture && i.deleteTexture(this.texture),
                  this.vertexShader && i.deleteShader(this.vertexShader),
                  this.fragmentShader && i.deleteShader(this.fragmentShader),
                  this.program &&
                    this.program !== this.context.defaultProgam &&
                    i.deleteProgram(this.program)),
                  this._canvas &&
                    ((this._canvas.width = 0),
                    (this._canvas.height = 0),
                    (this.ctx2d = null)),
                  this.removeAllListeners();
              }
              useTexture(e, t) {
                this.texture && this.context.useTexture(this.texture, e, t);
              }
              useInputTexture(e, t) {
                this.context.useTexture(this.input.texture, e, t);
              }
              useProgram() {
                this.context._gl.useProgram(this.program);
              }
              useBufferFrame(e) {
                let t = this.context._gl;
                t.bindFramebuffer(t.FRAMEBUFFER, this.fbo),
                  e(),
                  t.bindFramebuffer(t.FRAMEBUFFER, null);
              }
              createBuffer(e) {
                let t = this.context._gl,
                  i = t.createBuffer();
                return (
                  t.bindBuffer(t.ARRAY_BUFFER, i),
                  t.bufferData(
                    t.ARRAY_BUFFER,
                    new Float32Array(e),
                    t.STATIC_DRAW,
                  ),
                  i
                );
              }
              setTexBuffer(e) {
                let t = this.context._gl,
                  i = this.texCoordBuffer;
                t.bindBuffer(t.ARRAY_BUFFER, i),
                  t.bufferData(
                    t.ARRAY_BUFFER,
                    new Float32Array(e),
                    t.STATIC_DRAW,
                  );
              }
              setPosBuffer(e) {
                let t = this.context._gl,
                  i = this.positionBuffer;
                t.bindBuffer(t.ARRAY_BUFFER, i),
                  t.bufferData(
                    t.ARRAY_BUFFER,
                    new Float32Array(e),
                    t.STATIC_DRAW,
                  );
              }
              changeBufferData(e, t) {
                let i = this.context._gl;
                i.bindBuffer(i.ARRAY_BUFFER, e),
                  i.bufferData(
                    i.ARRAY_BUFFER,
                    new Float32Array(t),
                    i.STATIC_DRAW,
                  );
              }
              setAttributes(e) {
                let t = this.context._gl;
                for (let i in e) {
                  let n = t.getAttribLocation(this.program, i);
                  t.bindBuffer(t.ARRAY_BUFFER, e[i]),
                    t.enableVertexAttribArray(n),
                    t.vertexAttribPointer(n, 2, t.FLOAT, !1, 0, 0);
                }
              }
              getVertexPoint(e, t) {
                return [(e / this.width) * 2 - 1, (t / this.height) * 2 - 1];
              }
              layout2texCoords(e) {
                return [
                  ...this.getVertexPoint(e.x, e.y),
                  ...this.getVertexPoint(e.x, e.y + e.height),
                  ...this.getVertexPoint(e.x + e.width, e.y),
                  ...this.getVertexPoint(e.x + e.width, e.y + e.height),
                ];
              }
              resize(e, t) {
                (this.width === e && this.height === t) ||
                  ((this.width = e),
                  (this.height = t),
                  this._canvas &&
                    ((this._canvas.width = e), (this._canvas.height = t)),
                  this.texture &&
                    this.fbo &&
                    this.useTexture((i) =>
                      i.texImage2D(
                        i.TEXTURE_2D,
                        0,
                        i.RGBA,
                        e,
                        t,
                        0,
                        i.RGBA,
                        i.UNSIGNED_BYTE,
                        null,
                      ),
                    ),
                  this.output &&
                    this.output.matchInputSize &&
                    this.output.resize(e, t));
              }
              draw2d(e, t, i, n, r) {
                return (
                  !(!this.ctx2d || !e) &&
                  (e instanceof ImageData
                    ? this.ctx2d.putImageData(e, t, i)
                    : this.ctx2d.drawImage(e, t, i, n, r),
                  !0)
                );
              }
              getInfo() {
                var e;
                let { totalFrames: t, x: i, y: n, width: r, height: o } = this,
                  s = Date.now(),
                  a =
                    ((t - this.lastInfo.totalFrames) /
                      ((s - this.lastInfo.timestamp) / 1e3)) >>
                    0;
                return (
                  (this.lastInfo = {
                    totalFrames: t,
                    x: i,
                    y: n,
                    width: r,
                    height: o,
                    timestamp: s,
                    fps: a,
                  }),
                  ZC(
                    { parent: null == (e = this.input) ? void 0 : e.getInfo() },
                    this.lastInfo,
                  )
                );
              }
            };
          rb([Hw(Ww.INIT, 'connected')], Dx.prototype, 'connect', 1),
            rb(
              [Hw('connected', Ww.INIT, { ignoreError: !0 })],
              Dx.prototype,
              'disconnect',
              1,
            ),
            rb([Hw([], 'closed')], Dx.prototype, 'close', 1);
          var Ox = [0, 1, 0, 0, 1, 1, 1, 0],
            wx = class extends Dx {
              constructor(e, t) {
                super(
                  e,
                  Object.assign(
                    {
                      useDefaultProgram: !0,
                      createTexture: !1,
                      name: 'destination',
                    },
                    t,
                  ),
                ),
                  ob(this, '_intervalId', 0),
                  ob(this, '_sequence', 0),
                  e._gl
                    ? this.setTexBuffer(Ox)
                    : e.ctx2d && (this.ctx2d = e.ctx2d);
              }
              start(e) {
                this._intervalId = qw.run(
                  'intervalInWorker',
                  () => {
                    e !== this.context.frameRate &&
                      (qw.clearTask(this._intervalId),
                      this.start(this.context.frameRate)),
                      this.requestFrame(this._sequence++);
                    let t = this.context._gl;
                    t &&
                      t.getError() !== t.NO_ERROR &&
                      this.context.destroy(
                        ''
                          .concat(this.name, ' req ')
                          .concat(this._sequence, ' render ')
                          .concat(this.totalFrames, ' faild ')
                          .concat(t.getError()),
                      );
                  },
                  { fps: this.context.frameRate },
                );
              }
              render(e) {
                var t;
                return (
                  !(null == (t = this.input) || !t.requestFrame(e)) &&
                  (this.useProgram(),
                  this.useInputTexture((e) => {
                    this.setAttributes({
                      a_position: this.positionBuffer,
                      a_texCoord: this.texCoordBuffer,
                    }),
                      e.drawArrays(e.TRIANGLE_STRIP, 0, 4);
                  }),
                  !0)
                );
              }
              addInput(e) {
                for (
                  var t = arguments.length,
                    i = new Array(t > 1 ? t - 1 : 0),
                    n = 1;
                  n < t;
                  n++
                )
                  i[n - 1] = arguments[n];
                super.addInput(e, ...i), this.start(this.context.frameRate);
              }
              removeInput(e) {
                super.removeInput(e), qw.clearTask(this._intervalId);
              }
            },
            Px = class extends wx {
              constructor(e, t) {
                super(e, t),
                  ob(this, '_videoTrack'),
                  ([this._videoTrack] = e._canvas
                    .captureStream(e.frameRate)
                    .getVideoTracks());
                let i = (e) => {
                  let t = () => this._videoTrack.removeEventListener(e, i),
                    i = () => {
                      t(), this.context.destroy('video track '.concat(e));
                    };
                  this.once('closed', t),
                    this._videoTrack.addEventListener(e, i);
                };
                e._gl && i('mute'), i('ended');
              }
              get videoTrack() {
                return this._videoTrack;
              }
              close() {
                super.close(), this._videoTrack.stop();
              }
              resize(e, t) {
                super.resize(e, t), this.context.setSize(e, t);
              }
            },
            Lx = class extends Px {
              constructor(e, t) {
                super(e, { name: 'smallDestination' }), (this.resolution = t);
              }
              resize(e, t) {
                let i,
                  n = e * t,
                  r = this.resolution.width * this.resolution.height;
                jO.info(
                  'big res: '
                    .concat(e, '*')
                    .concat(t, ' small res: ')
                    .concat(this.resolution.width, '*')
                    .concat(this.resolution.height, ' '),
                ),
                  n > r
                    ? (i = n / r)
                    : (jO.warn(
                        'Small stream resolution is not smaller than big stream, which is invalid. big: '
                          .concat(e, ' * ')
                          .concat(t, ' small: ')
                          .concat(this.resolution.width, ' * ')
                          .concat(this.resolution.height),
                      ),
                      (i = n / 19200)),
                  super.resize(e / Math.sqrt(i), t / Math.sqrt(i));
              }
            },
            Mx = class extends Dx {
              constructor(e, t) {
                super(e, { name: 'imageSource' }),
                  (this.image = t),
                  ob(this, '_image'),
                  ob(this, '_totalFrames', 0);
              }
              _render(e, t) {
                let { width: i, height: n } = this;
                if (this.image instanceof HTMLVideoElement) {
                  if (iO(this.image.getVideoPlaybackQuality) && !Fk) {
                    let e =
                      this.image.getVideoPlaybackQuality().totalVideoFrames;
                    if (this._totalFrames === e) return !1;
                    (this._totalFrames = e),
                      (this.dropFrames = this._totalFrames - this.totalFrames);
                  }
                  ({ videoWidth: i, videoHeight: n } = this.image);
                } else if (
                  this.image instanceof HTMLImageElement ||
                  this.image instanceof ImageData ||
                  this.image instanceof ImageBitmap
                ) {
                  if (
                    (({ width: i, height: n } = this.image),
                    this.image !== this._image)
                  )
                    this._image = this.image;
                  else if (i === this.width && n === this.height) return !1;
                } else
                  (this.image instanceof HTMLCanvasElement ||
                    this.image instanceof OffscreenCanvas) &&
                    (({ width: i, height: n } = this.image),
                    (this._image = this.image));
                return (
                  this.width === i && this.height === n && this.totalFrames
                    ? t &&
                      this.useTexture((e) => {
                        e.texSubImage2D(
                          e.TEXTURE_2D,
                          0,
                          0,
                          0,
                          e.RGBA,
                          e.UNSIGNED_BYTE,
                          this.image,
                        );
                      })
                    : (t &&
                        this.useTexture((e) => {
                          e.texImage2D(
                            e.TEXTURE_2D,
                            0,
                            e.RGBA,
                            e.RGBA,
                            e.UNSIGNED_BYTE,
                            this.image,
                          );
                        }),
                      this.resize(i, n)),
                  !0
                );
              }
              render(e) {
                return this._render(e, !0);
              }
              render2d(e) {
                return this._render(e, !1);
              }
            },
            Vx = class extends Mx {
              constructor(e, t) {
                super(e, document.createElement('video')),
                  (this._videoTrack = t),
                  ob(this, '_mediaStream'),
                  (this.name = 'videoTrackSource'),
                  (this._mediaStream = new MediaStream([t])),
                  (this.image.srcObject = this._mediaStream),
                  this.image.play();
              }
              replaceTrack(e) {
                var t, i;
                this._videoTrack !== e &&
                  (null == (t = this._mediaStream) ||
                    t.removeTrack(this._videoTrack),
                  (this._videoTrack = e),
                  null == (i = this._mediaStream) ||
                    i.addTrack(this._videoTrack),
                  this.image.play());
              }
              close() {
                super.close(),
                  delete this._mediaStream,
                  (this.image.srcObject = null);
              }
            },
            xx = class extends Ww {
              constructor(e) {
                super(),
                  ob(this, 'frameRate'),
                  ob(this, '_canvas'),
                  ob(this, '_gl'),
                  ob(this, 'ctx2d'),
                  ob(this, 'defaultProgam'),
                  ob(this, 'log'),
                  ob(this, 'hasAlpha', !1),
                  ob(this, 'glFaild', !1),
                  ob(this, 'name'),
                  (this.name = e.name),
                  (this.log = e.logger.createChild({
                    id: 'vc-'.concat(this.name),
                  })),
                  (this.frameRate = e.frameRate);
              }
              create(e) {
                if (
                  ((this.glFaild = !1),
                  (this.hasAlpha = e.alpha),
                  (this._canvas = document.createElement('canvas')),
                  e.use2d)
                )
                  return (
                    (this.ctx2d = this._canvas.getContext('2d', {
                      alpha: e.alpha,
                    })),
                    void this.log.info('video context created use 2d')
                  );
                let t = this._canvas.getContext('webgl', { alpha: e.alpha });
                if (t) {
                  this._gl = t;
                  try {
                    let e = this.createShader(
                        t.VERTEX_SHADER,
                        '\n// 顶点着色器\nattribute vec4 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_texCoord;\n\nvoid main() {\n  gl_Position = a_position;\n  v_texCoord = a_texCoord;\n}\n',
                      ),
                      i = this.createShader(
                        t.FRAGMENT_SHADER,
                        '\n// 片元着色器\nprecision mediump float;\nvarying vec2 v_texCoord;\nuniform sampler2D u_texture;\n\nvoid main() {\n  gl_FragColor = texture2D(u_texture, v_texCoord);\n} ',
                      );
                    (this.defaultProgam = this.createProgram(e, i)),
                      t.enable(t.BLEND),
                      t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA),
                      this._canvas.addEventListener('webglcontextlost', () => {
                        this.destroy('webglcontextlost');
                      }),
                      this.log.info('video context created use webgl');
                  } catch (aN) {
                    return (
                      this.log.warn('video context create faild use webgl'), aN
                    );
                  }
                } else
                  (this.ctx2d = this._canvas.getContext('2d')),
                    this.ctx2d &&
                      this.log.info('video context created downgrade to 2d');
                !this.ctx2d && !this._gl && delete this._canvas;
              }
              get available() {
                return !!this._canvas;
              }
              createVideoTrackSource(e) {
                return new Vx(this, e);
              }
              createVideoTrackDestination(e) {
                return new Px(this, e);
              }
              createVideoImageSource(e) {
                return new Mx(this, e);
              }
              set width(e) {
                var t;
                null == (t = this._gl) || t.viewport(0, 0, e, this.height),
                  this._canvas && (this._canvas.width = e);
              }
              get width() {
                var e;
                return (null == (e = this._canvas) ? void 0 : e.width) || 0;
              }
              set height(e) {
                var t;
                null == (t = this._gl) || t.viewport(0, 0, this.width, e),
                  this._canvas && (this._canvas.height = e);
              }
              get height() {
                var e;
                return (null == (e = this._canvas) ? void 0 : e.height) || 0;
              }
              setSize(e, t) {
                var i;
                null == (i = this._gl) || i.viewport(0, 0, e, t),
                  this._canvas &&
                    ((this._canvas.width = e), (this._canvas.height = t));
              }
              disconnect() {
                this.emit('disconnect');
              }
              destroy(e, t) {
                var i;
                return (
                  this.disconnect(),
                  this.log.info(
                    'video context destroy '.concat(e ? ':'.concat(e) : ''),
                  ),
                  null == (i = this._gl) || i.deleteProgram(this.defaultProgam),
                  delete this._gl,
                  delete this.ctx2d,
                  this._canvas &&
                    (this._canvas.remove(),
                    (this._canvas.width = 0),
                    (this._canvas.height = 0),
                    delete this._canvas),
                  [e, t]
                );
              }
              createShader(e, t) {
                let i = this._gl,
                  n = i.createShader(e);
                return i.shaderSource(n, t), i.compileShader(n), n;
              }
              createProgram(e, t) {
                let i = this._gl,
                  n = i.createProgram();
                return (
                  i.attachShader(n, e),
                  i.attachShader(n, t),
                  i.linkProgram(n),
                  n
                );
              }
              useTexture(e, t, i) {
                let n = this._gl;
                n.activeTexture(n.TEXTURE0 + (i || 0)),
                  n.bindTexture(n.TEXTURE_2D, e),
                  t(n),
                  n.bindTexture(n.TEXTURE_2D, null);
              }
            };
          rb([Hw(Ww.INIT, 'created')], xx.prototype, 'create', 1),
            rb(
              [
                Hw('created', Ww.INIT, {
                  ignoreError: !0,
                  success(e) {
                    e[0] &&
                      ((this.glFaild = !0), this.emit('unavailable', ...e)),
                      this.removeAllListeners();
                  },
                }),
              ],
              xx.prototype,
              'destroy',
              1,
            );
          var Ux = [1, 0, 1, 1, 0, 0, 0, 1],
            Fx = class extends Dx {
              constructor(e) {
                if (
                  (super(e, {
                    useDefaultProgram: !0,
                    useFbo: !0,
                    create2d: !0,
                    name: 'mirror',
                  }),
                  e._gl)
                )
                  try {
                    this.setTexBuffer(Ux);
                  } catch (sN) {
                    e.destroy('mirror set texCoords faild', sN);
                  }
                else
                  this.ctx2d &&
                    setTimeout(
                      (e) => {
                        e.scale(-1, 1), e.translate(-this.width, 0);
                      },
                      0,
                      this.ctx2d,
                    );
              }
              render(e) {
                var t;
                return (
                  !(null == (t = this.input) || !t.requestFrame(e)) &&
                  (this.useProgram(),
                  this.useBufferFrame(() => {
                    this.useInputTexture((e) => {
                      this.setAttributes({
                        a_position: this.positionBuffer,
                        a_texCoord: this.texCoordBuffer,
                      }),
                        e.drawArrays(e.TRIANGLE_STRIP, 0, 4);
                    });
                  }),
                  !0)
                );
              }
            },
            Bx = class {
              constructor(e, t) {
                (this.node = e), (this.layout = t), ob(this, 'positionBuffer');
              }
              get x() {
                return this.layout.x || this.node.x;
              }
              get y() {
                return this.layout.y || this.node.y;
              }
              get width() {
                return this.layout.width || this.node.width;
              }
              get height() {
                return this.layout.height || this.node.height;
              }
              get right() {
                return this.x + this.width;
              }
              get bottom() {
                return this.y + this.height;
              }
            },
            Hx = class extends Dx {
              constructor(e) {
                super(e, {
                  useDefaultProgram: !0,
                  useFbo: !0,
                  name: 'mix',
                  create2d: !0,
                }),
                  ob(this, 'inputs', []);
              }
              addInput(e, t) {
                if (this.inputs[t.zIndex])
                  throw new Error('input already exists');
                let i = new Bx(e, t);
                this.inputs[t.zIndex] = i;
              }
              resize(e, t) {
                let i = this.inputs.reduce(
                  (e, t) =>
                    t
                      ? Object.assign(e, {
                          width: Math.max(e.width, t.right),
                          height: Math.max(e.height, t.bottom),
                        })
                      : e,
                  { width: 0, height: 0 },
                );
                super.resize(i.width, i.height),
                  this.context._gl &&
                    this.inputs.forEach((e) => {
                      if (e) {
                        let t = this.layout2texCoords(e);
                        e.positionBuffer
                          ? this.changeBufferData(e.positionBuffer, t)
                          : (e.positionBuffer = this.createBuffer(t));
                      }
                    });
              }
              connect(e) {
                for (
                  var t = arguments.length,
                    i = new Array(t > 1 ? t - 1 : 0),
                    n = 1;
                  n < t;
                  n++
                )
                  i[n - 1] = arguments[n];
                return super.connect(e, ...i), this.resize(0, 0), e;
              }
              removeInput(e) {
                this.inputs[
                  this.inputs.findIndex(
                    (t) => (null == t ? void 0 : t.node) === e,
                  )
                ] = void 0;
              }
              render(e) {
                let t = this.context._gl;
                return (
                  !(
                    this.inputs.reduce(
                      (t, i) => (!i || !i.node.requestFrame(e)) && t,
                      !0,
                    ) || !t
                  ) &&
                  (this.useProgram(),
                  t.clearColor(0, 0, 0, 0),
                  t.clear(t.COLOR_BUFFER_BIT | t.DEPTH_BUFFER_BIT),
                  this.setAttributes({ a_texCoord: this.texCoordBuffer }),
                  this.useBufferFrame(() => {
                    for (let e = 0; e < this.inputs.length; e++) {
                      let t = this.inputs[e];
                      t &&
                        t.node.useTexture((e) => {
                          this.setAttributes({ a_position: t.positionBuffer }),
                            e.drawArrays(e.TRIANGLE_STRIP, 0, 4);
                        });
                    }
                  }),
                  !0)
                );
              }
              render2d(e) {
                if (
                  !this.inputs.reduce(
                    (t, i) => (!i || !i.node.requestFrame(e)) && t,
                    !0,
                  ) &&
                  this.ctx2d
                ) {
                  this.ctx2d.clearRect(0, 0, this.width, this.height);
                  for (let e = 0; e < this.inputs.length; e++) {
                    let t = this.inputs[e];
                    t && this.draw2d(t.node.image, t.x, t.y, t.width, t.height);
                  }
                  return !0;
                }
                return !1;
              }
              getInfo() {
                let { totalFrames: e, x: t, y: i, width: n, height: r } = this,
                  o = Date.now(),
                  s =
                    ((e - this.lastInfo.totalFrames) /
                      ((o - this.lastInfo.timestamp) / 1e3)) >>
                    0;
                return (
                  (this.lastInfo = {
                    totalFrames: e,
                    x: t,
                    y: i,
                    width: n,
                    height: r,
                    timestamp: o,
                    fps: s,
                  }),
                  ZC(
                    {
                      parent: this.inputs
                        .filter((e) => e)
                        .map((e) => e.node.getInfo()),
                    },
                    this.lastInfo,
                  )
                );
              }
              close() {
                super.close(),
                  this.inputs.forEach((e) => {
                    var t;
                    if (
                      e &&
                      (null == (t = e.node) || t.disconnect(),
                      e.positionBuffer && this.context._gl)
                    )
                      try {
                        this.context._gl.deleteBuffer(e.positionBuffer);
                      } catch (aN) {}
                  });
              }
            },
            jx = class extends bx.EventEmitter {
              constructor(e) {
                let { room: t } = e;
                super(),
                  ob(this, 'videoContext'),
                  ob(this, 'destination'),
                  ob(this, 'smallVideoContext'),
                  ob(this, 'smallDestination'),
                  ob(this, 'smallTrackSource'),
                  ob(this, 'smallImageSource'),
                  ob(this, '_isMirror', !1),
                  ob(this, 'cameraTrack'),
                  ob(this, 'cameraNode'),
                  ob(this, 'waterMarkNode'),
                  ob(this, 'mirrorNode'),
                  ob(this, 'mixNode'),
                  ob(this, 'screenTrack'),
                  ob(this, 'screenNode'),
                  ob(this, '_isMixScreen', !1),
                  ob(this, '_hasWaterMark', !1),
                  ob(this, '_log'),
                  ob(this, '_checkId', 0),
                  ob(this, '_room'),
                  ob(this, '_use2d', !0),
                  ob(this, '_waterMarkOption'),
                  ob(this, '_isOpenVirtualBackground', !1),
                  ob(this, '_virtualBackgroundTrack'),
                  ob(this, 'virtualBackgroundInstance'),
                  (this._room = t),
                  (this._log = jO.createLogger({
                    id: 'vm',
                    userId: t.userId,
                    sdkAppId: t.sdkAppId,
                  })),
                  (this.videoContext = new xx({
                    frameRate: 15,
                    logger: this._log,
                    name: 'm',
                  })),
                  this.videoContext.on('unavailable', (e, t) => {
                    this.emit('error', { reason: e, error: t }),
                      this._log.warn(
                        'video context unavailable',
                        e,
                        t,
                        'glFaild:'.concat(this.videoContext.glFaild),
                      ),
                      UO.emit('262', {
                        room: this._room,
                        apiName: 'videoCtxGl',
                        error: t || new Error(e),
                      }),
                      this.update();
                  }),
                  (this.smallVideoContext = new xx({
                    frameRate: 15,
                    logger: this._log,
                    name: 's',
                  })),
                  this.enablePrintDetail();
              }
              get renderMode() {
                return this._use2d ? '2d' : 'webgl';
              }
              set renderMode(e) {
                let t = '2d' === e;
                this._use2d !== t &&
                  ((this._use2d = t),
                  this.videoContext &&
                    (this.clear(),
                    this.videoContext.destroy(),
                    this.videoContext.create({
                      alpha: this._hasWaterMark,
                      use2d: this._use2d,
                    }),
                    this.update()));
              }
              enablePrintDetail() {
                let e =
                  arguments.length > 0 && void 0 !== arguments[0]
                    ? arguments[0]
                    : 2e3;
                this._checkId = qw.run(
                  LD,
                  () => {
                    this.destination &&
                      this._log.debug(this.destination.getInfo());
                  },
                  { delay: e },
                );
              }
              destroy() {
                this.videoContext.destroy(),
                  this.smallVideoContext.destroy(),
                  qw.clearTask(this._checkId);
              }
              get active() {
                return (
                  ((Jk && Wk) ||
                    this._isMixScreen ||
                    this._isMirror ||
                    this._hasWaterMark) &&
                  this.checkOrCreateVideoContext()
                );
              }
              sendCreateResult() {
                let e =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : 'videoCtxGl',
                  t = arguments.length > 1 ? arguments[1] : void 0;
                UO.emit('262', { room: this._room, apiName: e, error: t });
              }
              checkOrCreateVideoContext() {
                if (this.videoContext.available) {
                  if (this.videoContext.hasAlpha || !this._hasWaterMark)
                    return !0;
                  this.clear(), this.videoContext.destroy();
                } else
                  this.videoContext.glFaild &&
                    (this.clear(), (this._use2d = !0));
                let e = this.videoContext.create({
                  alpha: this._hasWaterMark,
                  use2d: this._use2d,
                });
                return (
                  this.videoContext._gl
                    ? this.sendCreateResult()
                    : (this._use2d ||
                        (this.emit('error', { reason: 'create', error: e }),
                        this.sendCreateResult('videoCtxGl', e)),
                      this.sendCreateResult(
                        'videoCtx2d',
                        this.videoContext.ctx2d
                          ? void 0
                          : new Error('create 2d context failed'),
                      )),
                  this.videoContext.available
                );
              }
              get smallTrack() {
                return this.smallDestination.videoTrack;
              }
              get hasSmall() {
                return !!this.smallTrackSource || !!this.smallImageSource;
              }
              get initialTrack() {
                var e;
                return this._isOpenVirtualBackground &&
                  this._virtualBackgroundTrack
                  ? this._virtualBackgroundTrack
                  : null == (e = this.cameraTrack)
                  ? void 0
                  : e.mediaTrack;
              }
              _setMainOutput(e) {
                let t = this.cameraTrack,
                  { small: i, settings: n } = t;
                return (
                  i
                    ? (this.smallVideoContext.available ||
                        (this.smallVideoContext.create({
                          alpha: !1,
                          use2d: !0,
                        }),
                        (this.smallDestination = new Lx(
                          this.smallVideoContext,
                          i,
                        ))),
                      (this.smallVideoContext.frameRate = i.frameRate),
                      (this.smallDestination.resolution = i),
                      e
                        ? (this.smallTrackSource &&
                            (this.smallTrackSource.close(),
                            delete this.smallTrackSource),
                          this.smallImageSource
                            ? (this.smallImageSource.image = e)
                            : ((this.smallImageSource =
                                this.smallVideoContext.createVideoImageSource(
                                  e,
                                )),
                              this.smallImageSource.connect(
                                this.smallDestination,
                              )))
                        : (this.smallImageSource &&
                            (this.smallImageSource.close(),
                            delete this.smallImageSource),
                          this.smallTrackSource
                            ? this.smallTrackSource.replaceTrack(
                                this.initialTrack,
                              )
                            : ((this.smallTrackSource =
                                this.smallVideoContext.createVideoTrackSource(
                                  this.initialTrack,
                                )),
                              (this.smallTrackSource.width = n.width),
                              (this.smallTrackSource.height = n.height),
                              this.smallTrackSource.connect(
                                this.smallDestination,
                              ))))
                    : this.smallVideoContext.available &&
                      (this.smallVideoContext.destroy(),
                      delete this.smallDestination,
                      delete this.smallTrackSource,
                      delete this.smallImageSource),
                  t.setOutputMediaStreamTrack(
                    e ? this.destination.videoTrack : this.initialTrack,
                  )
                );
              }
              update() {
                return ab(this, null, function* () {
                  var e, t;
                  if (!this.cameraTrack || !this.cameraTrack.mediaTrack) return;
                  if (!this.active)
                    return (
                      this.cameraNode && this.clear(), this._setMainOutput()
                    );
                  {
                    let { settings: e, profile: t } = this.cameraTrack;
                    this.destination ||
                      (this.destination =
                        this.videoContext.createVideoTrackDestination({
                          name: 'mainDestination',
                        })),
                      this.cameraNode
                        ? this.cameraNode.replaceTrack(this.initialTrack)
                        : ((this.cameraNode =
                            this.videoContext.createVideoTrackSource(
                              this.initialTrack,
                            )),
                          this.cameraNode.resize(e.width, e.height)),
                      (this.videoContext.frameRate = t.frameRate);
                  }
                  let i = this.cameraNode;
                  return (
                    i.disconnect(),
                    this._isMirror &&
                      (this.mirrorNode ||
                        (this.mirrorNode = new Fx(this.videoContext)),
                      (i = i.connect(this.mirrorNode)),
                      i.disconnect(),
                      this._log.info('start mirror')),
                    this.mixNode && this.mixNode.close(),
                    delete this.mixNode,
                    (this._isMixScreen || this._hasWaterMark) &&
                      ((this.mixNode = new Hx(this.videoContext)),
                      i.connect(this.mixNode, { zIndex: 1 }),
                      this._hasWaterMark &&
                        !this.waterMarkNode &&
                        this._waterMarkOption &&
                        ((this.waterMarkNode =
                          this.videoContext.createVideoImageSource(
                            this._waterMarkOption.image,
                          )),
                        this.waterMarkNode.resize(
                          this._waterMarkOption.width,
                          this._waterMarkOption.height,
                        ),
                        (this.waterMarkNode.x = this._waterMarkOption.x),
                        (this.waterMarkNode.y = this._waterMarkOption.y)),
                      null == (e = this.waterMarkNode) ||
                        e.connect(this.mixNode, { zIndex: 2 }),
                      this.screenTrack &&
                        !this.screenNode &&
                        (this.screenNode =
                          this.videoContext.createVideoTrackSource(
                            this.screenTrack.mediaTrack,
                          )),
                      null == (t = this.screenNode) ||
                        t.connect(this.mixNode, { zIndex: 0 }),
                      (i = this.mixNode),
                      this._log.info(
                        'start mix',
                        ''
                          .concat(this.mixNode.width, 'x')
                          .concat(this.mixNode.height),
                      )),
                    i.connect(this.destination),
                    this._setMainOutput(this.videoContext._canvas)
                  );
                });
              }
              changeInput(e, t) {
                return (
                  this._log.info('change input'),
                  e instanceof _L
                    ? this.setScreenTrack(e)
                    : e instanceof hL
                    ? this.setCameraTrack(e)
                    : e instanceof wL
                    ? e.setOutputMediaStreamTrack(e.mediaTrack)
                    : void 0
                );
              }
              removeInput(e) {
                var t;
                e instanceof _L
                  ? (null == (t = this.screenNode) || t.close(),
                    delete this.screenNode,
                    delete this.screenTrack,
                    this.update())
                  : e instanceof hL &&
                    (this.clear(),
                    delete this.cameraTrack,
                    this.smallImageSource &&
                      (this.smallImageSource.close(),
                      delete this.smallImageSource),
                    this.smallTrackSource &&
                      (this.smallTrackSource.close(),
                      delete this.smallTrackSource));
              }
              setCameraTrack(e) {
                return ab(this, null, function* () {
                  return (
                    (this.cameraTrack = e),
                    this._isOpenVirtualBackground && (yield this.updateAr()),
                    this.update()
                  );
                });
              }
              setScreenTrack(e) {
                return (
                  (this.screenTrack = e),
                  this._isMixScreen &&
                    (this.screenNode
                      ? this.screenNode.replaceTrack(e.mediaTrack)
                      : this.update()),
                  e.setOutputMediaStreamTrack(e.mediaTrack)
                );
              }
              loadImage(e) {
                return new Promise((t, i) => {
                  let n = new Image();
                  (n.crossOrigin = 'anonymous'),
                    (n.src = e),
                    (n.onload = () => t(n)),
                    (n.onerror = i);
                });
              }
              setWatermark(e) {
                return ab(this, null, function* () {
                  let t = yield this.loadImage(e.imageUrl),
                    {
                      x: i = 0,
                      y: n = 0,
                      width: r = t.width,
                      height: o = t.height,
                    } = e;
                  (this._hasWaterMark = !0),
                    (this._waterMarkOption = {
                      x: i,
                      y: n,
                      width: r,
                      height: o,
                      image: t,
                    }),
                    this._log.info(
                      'start watermark',
                      JSON.stringify({ x: i, y: n, width: r, height: o }),
                    ),
                    this.update();
                });
              }
              stopWatermark() {
                var e;
                !this._hasWaterMark ||
                  ((this._hasWaterMark = !1),
                  this._log.info('stop watermark'),
                  null == (e = this.waterMarkNode) || e.close(),
                  delete this.waterMarkNode,
                  this.update());
              }
              get mixScreen() {
                return this._isMixScreen;
              }
              set mixScreen(e) {
                var t;
                (this._isMixScreen = e),
                  this._isMixScreen ||
                    (null == (t = this.screenNode) || t.close(),
                    delete this.screenNode),
                  this.update();
              }
              set mirror(e) {
                var t;
                (this._isMirror = e),
                  this._isMirror ||
                    (null == (t = this.mirrorNode) || t.close(),
                    delete this.mirrorNode),
                  this.update();
              }
              get mirror() {
                return this._isMirror;
              }
              enableAr(e) {
                return ab(this, null, function* () {
                  (this.virtualBackgroundInstance = e),
                    (this._isOpenVirtualBackground = !0),
                    this.virtualBackgroundInstance.ar.enable(
                      this.cameraTrack.mediaTrack.clone(),
                    ),
                    this.virtualBackgroundInstance.ar.listen(
                      'output',
                      this.handleArOutput.bind(this),
                    );
                });
              }
              handleArOutput(e) {
                (this._virtualBackgroundTrack = e), this.update();
              }
              updateAr() {
                return ab(this, null, function* () {
                  var e;
                  null == (e = this.cameraTrack) ||
                    !e.mediaTrack ||
                    (yield this.virtualBackgroundInstance.ar.updateInputTrack(
                      this.cameraTrack.mediaTrack.clone(),
                    ));
                });
              }
              disableAr() {
                var e;
                !this._isOpenVirtualBackground ||
                  ((this._isOpenVirtualBackground = !1),
                  null == (e = this._virtualBackgroundTrack) || e.stop(),
                  (this._virtualBackgroundTrack = null),
                  this.update());
              }
              clear() {
                this.videoContext.disconnect(),
                  delete this.destination,
                  delete this.cameraNode,
                  delete this.mirrorNode,
                  delete this.screenNode,
                  delete this.waterMarkNode;
              }
            },
            Gx = 0,
            Wx = class extends Ww {
              constructor(e) {
                super('room'),
                  (this.seq = ++Gx),
                  (this.role = 'anchor'),
                  (this.localTracks = new Set()),
                  (this.enableAutoPlayDialog = !0),
                  (this.autoReceiveAudio = !0),
                  (this.autoReceiveVideo = !0),
                  (this.scheduleResult = {
                    domains: null,
                    iceServers: null,
                    iceTransportPolicy: null,
                    trtcAutoConf: null,
                  }),
                  (this._isUsingCachedSchedule = !1),
                  (this._log = jO.createLogger({ id: 'r'.concat(this.seq) })),
                  (this._joinedTimestamp = 0),
                  (this.isDestroyed = !1),
                  (this.useStringRoomId = !!e.useStringRoomId),
                  sO(e.autoReceiveAudio) &&
                    (this.autoReceiveAudio = e.autoReceiveAudio),
                  sO(e.autoReceiveVideo) &&
                    (this.autoReceiveVideo = e.autoReceiveVideo),
                  sO(e.enableAutoPlayDialog) &&
                    (this.enableAutoPlayDialog = e.enableAutoPlayDialog),
                  (this._sdkType = e.sdkType),
                  (this.keyPointManager = new yx({
                    room: this,
                    frameWorkType: e.frameWorkType,
                    component: e.component,
                    language: e.language,
                  })),
                  (this.callDurationCalculator = new Rx({ room: this })),
                  (this.badCaseDetector = new Cx({ room: this })),
                  (this.audioManager = new kL({ room: this })),
                  (this.videoManager = new jx({ room: this }));
              }
              get isMainStreamPublished() {
                for (let e of this.localTracks) if (4 & e.mediaType) return !0;
                return !1;
              }
              get isAuxStreamPublished() {
                for (let e of this.localTracks) if (2 & e.mediaType) return !0;
                return !1;
              }
              get hasAuxStream() {
                for (let e of this.remotePublishedUserMap.values())
                  if (e.muteState.hasAuxiliary) return !0;
                return this.isAuxStreamPublished;
              }
              getLogger() {
                return this._log;
              }
              get isJoined() {
                return 'joined' === this.state;
              }
              get isLeft() {
                return 'left' === this.state;
              }
              addTrack(e) {
                return ab(this, null, function* () {
                  return this.publish(e);
                });
              }
              removeTrack(e) {
                return ab(this, null, function* () {
                  return this.unpublish(e);
                });
              }
              replaceTrack(e) {
                return ab(this, null, function* () {});
              }
              setEncodedDataProcessingListener(e) {
                throw new Error('Method not implemented.');
              }
              enableAIVoice(e) {
                throw new Error('Method not implemented.');
              }
              setProxyServer(e) {
                if (rO(e))
                  e.startsWith('wss://')
                    ? (this.proxy_ws = e)
                    : e.startsWith('https://') && (this.proxy_wt = e);
                else if ($D(e)) {
                  let {
                    websocketProxy: t,
                    webtransportProxy: i,
                    loggerProxy: n,
                    scheduleProxy: r,
                    unifiedProxy: o,
                  } = e;
                  (this.proxy_ws = t),
                    (this.proxy_wt = i),
                    (this.proxy_unified = o),
                    o
                      ? (jV([o, o]), pN('https://'.concat(o)))
                      : (n && pN(n), r && jV(r));
                }
              }
              getRemoteAudioStats() {
                return ab(this, null, function* () {
                  let e = {};
                  return (
                    this.remotePublishedUserMap.forEach((t) => {
                      e[t.userId] = t.remoteAudioTrack.stat;
                    }),
                    e
                  );
                });
              }
              getTransportStats() {
                return ab(this, null, function* () {
                  var e;
                  let t = {
                    rtt:
                      (null == (e = this.quality) ? void 0 : e.uplinkRTT) || 0,
                    downlinksRTT: {},
                  };
                  if (this.quality)
                    for (let i of this.quality.downlinkInfo)
                      t.downlinksRTT[i.userId] = i.rtt;
                  return t;
                });
              }
              getRemoteVideoStats() {
                return ab(this, arguments, function () {
                  var e = this;
                  let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : 'main';
                  return (function* () {
                    let i = {};
                    return (
                      e.remotePublishedUserMap.forEach((e) => {
                        let n =
                          'auxiliary' === t
                            ? e.remoteAuxiliaryTrack
                            : e.remoteVideoTrack;
                        i[e.userId] = n.stat;
                      }),
                      i
                    );
                  })();
                });
              }
              checkDestroy() {
                if (this.isDestroyed)
                  throw new gb({
                    code: mb.INVALID_OPERATION,
                    message: QO({
                      key: KO.CLIENT_DESTROYED,
                      data: { funName: 'join' },
                    }),
                  });
              }
              destroy() {
                if (this.isJoined)
                  throw (
                    (this._log.warn(YO.INVALID_DESTROY),
                    new gb({
                      code: mb.INVALID_OPERATION,
                      message: QO({ key: KO.INVALID_DESTROY }),
                    }))
                  );
                this._log.info('destroy room'),
                  this.audioManager.destroy(),
                  this.videoManager.destroy(),
                  this.keyPointManager.destroy(),
                  this.callDurationCalculator.destroy(),
                  this.badCaseDetector.destroy(),
                  (this.isDestroyed = !0),
                  UO.emit(BO.ROOM_DESTROY, { room: this });
              }
              schedule(e, t) {
                return ab(this, null, function* () {
                  var i, n;
                  let r = fO();
                  try {
                    let {
                      isCached: o,
                      result: s,
                      detailCost: a,
                    } = yield BV({
                      userId: this.userId,
                      sdkAppId: this.sdkAppId,
                      roomId: e,
                      useStringRoomId: this.useStringRoomId,
                      version: rN,
                      userSig: this.userSig,
                      frameWorkType: t,
                    });
                    (this._isUsingCachedSchedule = o),
                      this._log.info(
                        'schedule cache:'.concat(+o, ' ').concat(
                          DO(s, {
                            keysToExclude: ['username', 'credential'],
                          }),
                        ),
                      ),
                      o &&
                        UO.once(BO.JOIN_RECEIVED_CMD_RES, () =>
                          this.sendAbilityStatus({ scheduleCache: 1 }),
                        ),
                      (this.scheduleResult = ZC(
                        ZC({}, this.scheduleResult),
                        s,
                      )),
                      oO(null == (i = s.config) ? void 0 : i.retryCount) &&
                        rD(s.config.retryCount),
                      rO(null == (n = s.config) ? void 0 : n.loggerDomain) &&
                        pN(s.config.loggerDomain),
                      UO.emit(BO.JOIN_SCHEDULE_SUCCESS, {
                        room: this,
                        schedule: this.scheduleResult,
                        detailCost: a,
                      }),
                      UO.emit(BO.API_SUCCESS_RATE, {
                        room: this,
                        apiName: 'schedule',
                        cost: fO() - r,
                      });
                  } catch (o) {
                    throw (
                      (UO.emit(BO.API_SUCCESS_RATE, {
                        room: this,
                        apiName: 'schedule',
                        error: o,
                      }),
                      o)
                    );
                  }
                });
              }
            },
            Jx = nb(cb()),
            Kx = nb(hb()),
            Yx = (e) => {
              let {
                  serverAbility: t,
                  clientAbility: i,
                  offerSDP: n,
                  enableCustomMessage: r,
                } = e,
                o = nx(n),
                s = {
                  extmapAllowMixed: 'extmap-allow-mixed',
                  groups: o.groups,
                  icelite: 'ice-lite',
                  media: [],
                  msidSemantic: { semantic: '', token: 'WMS' },
                  name: '-',
                  origin: {
                    address: '127.0.0.1',
                    username: '-',
                    sessionId: String(Date.now()),
                    sessionVersion: 1,
                    netType: 'IN',
                    ipVer: 4,
                  },
                  timing: { start: 0, stop: 0 },
                  version: 0,
                },
                a = {
                  candidates: t.candidates.map((e) => ({
                    component: 1,
                    foundation: '1',
                    generation: 0,
                    ip: e.ip,
                    port: e.port,
                    priority: e.priority,
                    transport: e.foundation,
                    type: e.type,
                  })),
                  connection: { version: 4, ip: '0.0.0.0' },
                  direction: LN.TRANSCEIVER_DIRECTION_RECVONLY,
                  ext: t.audio.extensions.map((e) => ({
                    value: e.id,
                    uri: e.uri,
                  })),
                  fingerprint: { type: t.dtls.hash, hash: t.dtls.fingerprint },
                  fmtp: [
                    {
                      payload: t.audio.codecs[0].payload,
                      config: t.audio.codecs[0].fmtp,
                    },
                  ],
                  icePwd: t.ice.password,
                  iceUfrag: t.ice.ufrag,
                  mid: '0',
                  payloads: String(t.audio.codecs[0].payload),
                  port: o.media[0].port,
                  protocol: o.media[0].protocol,
                  type: LN.AUDIO,
                  setup: t.dtls.setup,
                  rtcpFb: t.audio.codecs[0].rtcpfb.map((e) => ({
                    payload: t.audio.codecs[0].payload,
                    type: e.id,
                    subtype: e.params[0],
                  })),
                  rtcpMux: 'rtcp-mux',
                  rtcpRsize: 'rtcp-rsize',
                  rtp: [
                    {
                      payload: t.audio.codecs[0].payload,
                      codec: t.audio.codecs[0].codec,
                      rate: t.audio.codecs[0].rate,
                      encoding: t.audio.codecs[0].channels,
                    },
                  ],
                };
              return (
                s.media.push(a),
                [1, 2, 3].forEach((e) => {
                  s.media.push(
                    zx({
                      mid: e,
                      serverAbility: t,
                      clientAbility: i,
                      parsedOffer: o,
                    }),
                  );
                }),
                r && s.media.push(o.media.find((e) => 'dc' === e.mid)),
                rx(s)
              );
            },
            zx = (e) => {
              let {
                  mid: t,
                  serverAbility: i,
                  clientAbility: n,
                  parsedOffer: r,
                  useAllCodec: o = !1,
                } = e,
                s = {
                  candidates: i.candidates.map((e) => ({
                    component: 1,
                    foundation: '1',
                    generation: 0,
                    ip: e.ip,
                    port: e.port,
                    priority: e.priority,
                    transport: e.foundation,
                    type: e.type,
                  })),
                  connection: { version: 4, ip: '0.0.0.0' },
                  direction: LN.TRANSCEIVER_DIRECTION_RECVONLY,
                  ext: i.video.extensions.map((e) => ({
                    value: e.id,
                    uri: e.uri,
                  })),
                  fingerprint: { type: i.dtls.hash, hash: i.dtls.fingerprint },
                  fmtp: [],
                  icePwd: i.ice.password,
                  iceUfrag: i.ice.ufrag,
                  mid: String(t),
                  payloads: '',
                  port: r.media[0].port,
                  protocol: r.media[0].protocol,
                  type: LN.VIDEO,
                  setup: i.dtls.setup,
                  rtcpFb: [],
                  rtcpMux: 'rtcp-mux',
                  rtcpRsize: 'rtcp-rsize',
                  rtp: [],
                };
              if (i.video.codecs.length > 0)
                if (o)
                  for (let a = 0; a < i.video.codecs.length; a++)
                    qx(s, i.video.codecs[a]);
                else {
                  let e = i.video.codecs.findIndex(
                    (e) =>
                      e.codec.toLowerCase() === (i.useVp8 ? 'vp8' : 'h264'),
                  );
                  qx(s, i.video.codecs[e]);
                }
              else if (o)
                for (let a = 0; a < n.video.codecs.length; a++)
                  qx(s, n.video.codecs[a]);
              else qx(s, n.video.codecs[0]);
              return (s.payloads = s.payloads.trim()), s;
            },
            qx = (e, t) => {
              (e.payloads = ''.concat(e.payloads, ' ').concat(t.payload)),
                e.fmtp.push({ payload: t.payload, config: t.fmtp }),
                (e.rtcpFb = [
                  ...(e.rtcpFb || []),
                  ...(t.rtcpfb || t.rtcpFb).map((e) => ({
                    payload: t.payload,
                    type: e.id,
                    subtype: e.params[0],
                  })),
                ]),
                e.rtp.push({
                  payload: t.payload,
                  codec: t.codec.toUpperCase(),
                  rate: t.rate,
                }),
                t.rtx &&
                  ((e.payloads = ''.concat(e.payloads, ' ').concat(t.rtx)),
                  e.fmtp.push({
                    payload: t.rtx,
                    config: 'apt='.concat(t.payload),
                  }),
                  e.rtp.push({ payload: t.rtx, codec: 'rtx', rate: t.rate }));
            };
          var Qx,
            Xx = (e) => {
              let t = Kx.default.parse(e);
              return (
                t.media.forEach((e) => {
                  var i;
                  (e.type === LN.AUDIO || e.type === LN.VIDEO) &&
                    ((function (e) {
                      if (!e.rtcpFb) return;
                      let t = [];
                      e.rtcpFb.forEach((i, n) => {
                        var r;
                        t.push(i),
                          e.rtcpFb &&
                            (null == (r = e.rtcpFb[n + 1])
                              ? void 0
                              : r.payload) !== i.payload &&
                            'rrtr' !== i.type &&
                            t.push({ payload: i.payload, type: 'rrtr' });
                      }),
                        (e.rtcpFb = t);
                    })(e),
                    (function (e) {
                      e.type === LN.VIDEO &&
                        e.fmtp &&
                        e.fmtp.forEach((e) => {
                          e.config.includes('apt') ||
                            (e.config += ';sps-pps-idr-in-keyframe=1');
                        });
                    })(e),
                    (function (e) {
                      e.type === LN.AUDIO &&
                        e.fmtp &&
                        e.fmtp.forEach((e) => {
                          e.config += ';sprop-stereo=1;stereo=1';
                        });
                    })(e),
                    (function (e) {
                      let t = new Set([
                        'urn:ietf:params:rtp-hdrext:sdes:mid',
                        'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id',
                        'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id',
                      ]);
                      e.ext && (e.ext = e.ext.filter((e) => !t.has(e.uri)));
                    })(e)),
                    (null == (i = e.payloads)
                      ? void 0
                      : i.includes('datachannel')) &&
                      t.groups &&
                      e.mid &&
                      ((t.groups[0].mids = t.groups[0].mids.replace(
                        e.mid,
                        'dc',
                      )),
                      (e.mid = 'dc'));
                }),
                Kx.default.write(t)
              );
            },
            $x =
              (((Qx = $x || {}).TRACK = 'track'),
              (Qx.DATA_CHANNEL_MESSAGE = 'data_channel_msg'),
              (Qx[(Qx.CONNECTION_STATE_CHANGED = 'connection-state-changed')] =
                'CONNECTION_STATE_CHANGED'),
              (Qx[(Qx.FIREWALL_RESTRICTION = 'firewall-restriction')] =
                'FIREWALL_RESTRICTION'),
              (Qx.RECONNECTED = 'spc-reconnected'),
              (Qx.RECONNECT_FAILED = 'spc-reconnect-failed'),
              (Qx.ERROR = 'error'),
              (Qx.SEI_MESSAGE = 'sei-message'),
              Qx),
            Zx = 0,
            eU = !1,
            tU = new Set(),
            iU = 1,
            nU = class extends Jx.default {
              constructor(e) {
                let { signalChannel: t, room: i, enableCustomMessage: n } = e;
                super(),
                  ob(this, 'stat', {
                    iceStartTime: 0,
                    iceEndTime: 0,
                    dtlsStartTime: 0,
                    dtlsEndTime: 0,
                    peerConnectionStartTime: 0,
                    peerConnectionEndTime: 0,
                  }),
                  ob(this, 'currentState', 'DISCONNECTED'),
                  ob(this, '_room'),
                  ob(this, '_signalChannel'),
                  ob(this, '_peerConnection', null),
                  ob(this, '_datachannel', null),
                  ob(this, '_enableCustomMessage'),
                  ob(this, '_log'),
                  ob(this, '_downlinkMIDMap', new Map()),
                  ob(this, '_downlinkMIDUserIDMap', new Map()),
                  ob(this, '_reconnectionTimer', -1),
                  ob(this, 'reconnectionCount', 0),
                  ob(this, '_clientAbility', null),
                  ob(this, '_serverAbility', null),
                  ob(this, 'addDownlinkQueue', new Set()),
                  ob(this, 'removeDownlinkQueue', new Set()),
                  ob(this, '_parsedAnswer', null),
                  ob(this, '_updateSDPPromise', null),
                  ob(this, '_waitForPCConnectedPromise'),
                  ob(this, '_waitForPCConnectedPromiseReject', null),
                  ob(this, '_isSDPLogged', !1),
                  ob(this, 'seiCodec', null),
                  (this._room = i),
                  (this._enableCustomMessage = n),
                  (this._signalChannel = t),
                  (this._log = jO.createLogger({
                    id: 'spc'.concat(iU++),
                    userId: this._room.userId,
                    sdkAppId: this._room.sdkAppId,
                  })),
                  this._room.enableSEI &&
                    Nw &&
                    ((this.seiCodec = new QV(this, this._log)),
                    (this.seiCodec.onSEIMessage = (e) => {
                      this.emit('sei-message', {
                        userId: this._downlinkMIDUserIDMap.get(e.mid),
                        data: e.data,
                        seiPayloadType: e.seiPayloadType,
                        streamType: e.streamType,
                      });
                    }));
              }
              get isH264EncodeSupported() {
                let e =
                  this._room.checkSystemResult.detail.isH264EncodeSupported;
                return (
                  this._serverAbility &&
                    (e =
                      e &&
                      !!this._serverAbility.video.codecs.find(
                        (e) => 'h264' === e.codec.toLowerCase(),
                      )),
                  e
                );
              }
              get isVP8EncodeSupported() {
                let e =
                  this._room.checkSystemResult.detail.isVp8EncodeSupported;
                return (
                  this._serverAbility && (e = e && this._serverAbility.useVp8),
                  e
                );
              }
              get isUsingH264() {
                var e, t;
                return !(
                  null ==
                    (t =
                      null == (e = this._peerConnection)
                        ? void 0
                        : e.remoteDescription) || !t.sdp.includes('H264')
                );
              }
              get uplinkSSRC() {
                return this._peerConnection &&
                  this._peerConnection.localDescription
                  ? ((e) => {
                      let t = nx(e),
                        i = {
                          audioSsrc: 0,
                          audioRtxSsrc: 0,
                          bigVideoSsrc: 0,
                          bigVideoRtxSsrc: 0,
                          smallVideoSsrc: 0,
                          smallVideoRtxSsrc: 0,
                          auxVideoSsrc: 0,
                          auxVideoRtxSsrc: 0,
                        };
                      return (
                        t.media.forEach((e, t) => {
                          var n;
                          if (e.ssrcs && !nO(e.ssrcs[0].id)) {
                            let r = Number(e.ssrcs[0].id),
                              o = Number(
                                null ==
                                  (n = e.ssrcs.filter(
                                    (e) => 'cname' === e.attribute,
                                  )[1])
                                  ? void 0
                                  : n.id,
                              );
                            switch (t) {
                              case 0:
                                i.audioSsrc = r;
                                break;
                              case 1:
                                (i.bigVideoSsrc = r), (i.bigVideoRtxSsrc = o);
                                break;
                              case 2:
                                (i.smallVideoSsrc = r),
                                  (i.smallVideoRtxSsrc = o);
                                break;
                              case 3:
                                (i.auxVideoSsrc = r), (i.auxVideoRtxSsrc = o);
                            }
                          }
                        }),
                        i
                      );
                    })(this._peerConnection.localDescription.sdp)
                  : {
                      audioSsrc: 0,
                      audioRtxSsrc: 0,
                      bigVideoSsrc: 0,
                      bigVideoRtxSsrc: 0,
                      smallVideoSsrc: 0,
                      smallVideoRtxSsrc: 0,
                      auxVideoSsrc: 0,
                      auxVideoRtxSsrc: 0,
                    };
              }
              get isReconnecting() {
                return (
                  'RECONNECTING' === this.currentState ||
                  this._reconnectionTimer > 0 ||
                  this.reconnectionCount > 0
                );
              }
              get dtlsTransport() {
                if (!this._peerConnection) return null;
                let e = this._peerConnection.getSenders();
                return 0 === e.length ? null : e[0].transport;
              }
              initialize() {
                return ab(this, null, function* () {
                  try {
                    (this._peerConnection = new RTCPeerConnection({
                      encodedInsertableStreams: this._room.enableSEI && Nw,
                      offerExtmapAllowMixed: !0,
                      iceServers: this._room.getIceServers(),
                      iceTransportPolicy: this._room.getIceTransportPolicy(),
                      sdpSemantics: this._room.sdpSemantics,
                      bundlePolicy: 'max-bundle',
                      rtcpMuxPolicy: 'require',
                      tcpCandidatePolicy: 'disable',
                      IceTransportsType: 'nohost',
                    })),
                      (this._peerConnection.oniceconnectionstatechange = () => {
                        if (!this._peerConnection) return;
                        let e = this._peerConnection.iceConnectionState;
                        this._log.debug('ice state: '.concat(e)),
                          'checking' === e && 0 === this.stat.iceStartTime
                            ? (this.stat.iceStartTime = Date.now())
                            : 'connected' === e &&
                              0 === this.stat.iceEndTime &&
                              (this.stat.iceEndTime = Date.now());
                      }),
                      (this._peerConnection.onconnectionstatechange =
                        this.onConnectionStateChange.bind(this)),
                      (this._peerConnection.ontrack = (e) =>
                        this.emit('track', e)),
                      this._enableCustomMessage &&
                        ((this._datachannel =
                          this._peerConnection.createDataChannel(
                            ''.concat(this._room.userId, 'dc'),
                          )),
                        (this._datachannel.binaryType = 'arraybuffer'),
                        (this._datachannel.onopen = () => {
                          this._log.info('datachannel open');
                        }),
                        (this._datachannel.onclose = () => {
                          this._log.warn('datachannel close');
                        }),
                        (this._datachannel.onmessage = (e) => {
                          let t = new oU(e.data);
                          this.emit('data_channel_msg', { data: t });
                        }),
                        (this._datachannel.onerror = (e) => {
                          this._log.warn('datachannel error', e);
                        })),
                      this._peerConnection.addTransceiver(LN.AUDIO, {
                        direction: LN.TRANSCEIVER_DIRECTION_SENDONLY,
                      }),
                      this._peerConnection.addTransceiver(LN.VIDEO, {
                        direction: LN.TRANSCEIVER_DIRECTION_SENDONLY,
                      }),
                      this._peerConnection.addTransceiver(LN.VIDEO, {
                        direction: LN.TRANSCEIVER_DIRECTION_SENDONLY,
                      }),
                      this._peerConnection.addTransceiver(LN.VIDEO, {
                        direction: LN.TRANSCEIVER_DIRECTION_SENDONLY,
                      });
                    let e = yield this._peerConnection.createOffer();
                    return (
                      yield this.setOffer(e),
                      this.dtlsTransport &&
                        (this.dtlsTransport.onstatechange = () => {
                          let { dtlsTransport: e } = this;
                          !e ||
                            (this._log.debug('dtls state: '.concat(e.state)),
                            'connecting' === e.state &&
                            0 === this.stat.dtlsStartTime
                              ? (this.stat.dtlsStartTime = Date.now())
                              : 'connected' === e.state &&
                                0 === this.stat.dtlsEndTime &&
                                (this.stat.dtlsEndTime = Date.now()));
                        }),
                      (this._clientAbility = ((e, t) => {
                        var i, n;
                        let r = nx(e),
                          o = {
                            ice: { ufrag: '', password: '' },
                            dtls: { hash: '', fingerprint: '', setup: '' },
                            audio: { codecs: [], extensions: [] },
                            video: { codecs: [], extensions: [] },
                            useDataChannel: t,
                          };
                        (o.ice.ufrag = String(r.media[0].iceUfrag)),
                          (o.ice.password = r.media[0].icePwd || ''),
                          r.fingerprint &&
                            ((o.dtls.hash = r.fingerprint.type),
                            (o.dtls.fingerprint = r.fingerprint.hash),
                            (o.dtls.setup = r.setup || '')),
                          r.media[0].fingerprint &&
                            ((o.dtls.hash = r.media[0].fingerprint.type),
                            (o.dtls.fingerprint = r.media[0].fingerprint.hash)),
                          (o.dtls.setup = r.media[0].setup || '');
                        let s = r.media[0],
                          a = r.media[1];
                        s.ext &&
                          (o.audio.extensions = s.ext.map((e) => ({
                            id: e.value,
                            uri: e.uri,
                          }))),
                          a.ext &&
                            (o.video.extensions = a.ext.map((e) => ({
                              id: e.value,
                              uri: e.uri,
                            })));
                        let c = {
                          codec: s.rtp[0].codec,
                          fmtp: s.fmtp[0].config,
                          payload: s.fmtp[0].payload,
                          rate: s.rtp[0].rate,
                          channel: s.rtp[0].encoding,
                          rtcpFb: [],
                          rtx: 0,
                        };
                        null == (i = s.rtcpFb) ||
                          i.forEach((e) => {
                            let { payload: t, type: i, subtype: n } = e;
                            if (t === c.payload) {
                              let e = { id: i, params: [] };
                              n && e.params.push(n), c.rtcpFb.push(e);
                            }
                          }),
                          o.audio.codecs.push(c);
                        for (let l = 0; l < a.rtp.length; l++) {
                          if (['rtx', 'red', 'ulpfec'].includes(a.rtp[l].codec))
                            continue;
                          let e = a.fmtp.filter(
                            (e) => e.payload === a.rtp[l].payload,
                          )[0];
                          o.video.codecs.push({
                            payload: a.rtp[l].payload,
                            codec: a.rtp[l].codec,
                            fmtp: e ? e.config : '',
                            rate: a.rtp[l].rate,
                            rtx:
                              'rtx' ===
                              (null == (n = a.rtp[l + 1]) ? void 0 : n.codec)
                                ? a.rtp[l + 1].payload
                                : 0,
                            rtcpFb: ((null == a ? void 0 : a.rtcpFb) || [])
                              .filter((e) => e.payload === a.rtp[l].payload)
                              .map((e) => {
                                let { type: t, subtype: i } = e;
                                return { id: t, params: i ? [i] : [] };
                              }),
                          });
                        }
                        return o;
                      })(e.sdp, this._enableCustomMessage)),
                      this._clientAbility
                    );
                  } catch (sN) {
                    throw (
                      (this._log.error('initialize failed '.concat(sN)), sN)
                    );
                  }
                });
              }
              connect(e) {
                let t =
                  arguments.length > 1 &&
                  void 0 !== arguments[1] &&
                  arguments[1];
                return ab(this, null, function* () {
                  var i;
                  try {
                    if ('CONNECTED' === this.currentState) return;
                    let n = fO(),
                      r = {
                        type: 'answer',
                        sdp: Yx({
                          serverAbility: e,
                          clientAbility: this._clientAbility,
                          offerSDP: this._peerConnection.localDescription.sdp,
                          enableCustomMessage: this._enableCustomMessage,
                        }),
                      };
                    (this._serverAbility = e),
                      yield this.setAnswer(r),
                      yield this.waitForPeerConnectionConnected(),
                      t ||
                        UO.emit(BO.API_SUCCESS_RATE, {
                          room: this._room,
                          apiName: 'SPCConnect',
                          cost: Math.min(fO() - n, 3e4),
                        }),
                      null == (i = this.seiCodec) || i.handleEncodedStreams();
                  } catch (n) {
                    let t = n instanceof gb && n.code === mb.API_CALL_ABORTED;
                    throw (
                      (t || this._log.error('connect failed: '.concat(n), e),
                      this.reset(),
                      !t &&
                        !this.isReconnecting &&
                        (UO.emit(BO.API_SUCCESS_RATE, {
                          room: this._room,
                          apiName: 'SPCConnect',
                          error: n,
                        }),
                        this.emitConnectionStateChangedEvent('DISCONNECTED'),
                        this.startReconnection()),
                      n)
                    );
                  }
                });
              }
              reconnect() {
                return ab(this, null, function* () {
                  if (-1 === this._reconnectionTimer) {
                    if (!this._signalChannel.isConnected)
                      return (
                        this._log.warn(
                          'reconnect() wait signal channel is connected',
                        ),
                        void this._signalChannel.once(nV, this.reconnect, this)
                      );
                    try {
                      this.reconnectionCount++,
                        this._log.warn(
                          'reconnect() trying ['.concat(
                            this.reconnectionCount,
                            ']',
                          ),
                        ),
                        this.reset();
                      let e = yield this.initialize(),
                        t = yield this._signalChannel.sendWaitForResponse({
                          command: kV,
                          responseCommand: aV.REBUILD_PEER_CONNECTION_RES,
                          data: { ability: e },
                          enableLog: !1,
                        });
                      if (0 !== t.data.code)
                        throw new gb({
                          code: t.data.code,
                          message: t.data.message,
                        });
                      yield this.connect(t.data.data.ability, !0),
                        this._log.warn('reconnect() success'),
                        this.stopReconnection(),
                        this.emit('spc-reconnected');
                    } catch (sN) {
                      if (!this.isReconnecting) return;
                      if (null != sN && sN.message.includes('timeout')) {
                        let e = eO(this.reconnectionCount);
                        this._log.warn(
                          'reconnect() timeout, try again after '.concat(
                            e / 1e3,
                            's',
                          ),
                        ),
                          (this._reconnectionTimer = window.setTimeout(() => {
                            this.clearReconnectionTimer(), this.reconnect();
                          }, e));
                      } else
                        this._log.error(
                          'reconnect() failed '
                            .concat(null == sN ? void 0 : sN.code, ' ')
                            .concat(sN),
                        ),
                          UO.emit(BO.API_SUCCESS_RATE, {
                            room: this._room,
                            apiName: 'SPCReconnect',
                            error: sN,
                          }),
                          this.reconnectionCount >= oD() &&
                            this._log.warn(
                              'SDK has tried reconnect for '.concat(
                                oD(),
                                ' times, but all failed, please check your network',
                              ),
                            ),
                          this.stopReconnection(),
                          this.emitConnectionStateChangedEvent('DISCONNECTED'),
                          this.emit('error');
                    }
                  } else this._log.warn('reconnect() is reconnecting, ignore current reconnection');
                });
              }
              getPeerConnection() {
                return this._peerConnection;
              }
              startReconnection() {
                return ab(this, null, function* () {
                  this._log.warn('start reconnect'),
                    this.emitConnectionStateChangedEvent('RECONNECTING');
                  let e = fO();
                  yield this.reconnect(),
                    UO.emit(BO.API_SUCCESS_RATE, {
                      room: this._room,
                      apiName: 'SPCReconnect',
                      cost: Math.min(fO() - e, 3e4),
                    });
                });
              }
              stopReconnection() {
                this.isReconnecting &&
                  (this._log.info('stop reconnect'),
                  (this.reconnectionCount = 0),
                  this.clearReconnectionTimer(),
                  this._signalChannel.off(nV, this.reconnect, this));
              }
              checkPeerConnectionToReconnect() {
                var e;
                !this.isReconnecting &&
                  (null == (e = this._peerConnection)
                    ? void 0
                    : e.connectionState) === iD.CLOSED &&
                  this.startReconnection();
              }
              clearReconnectionTimer() {
                -1 !== this._reconnectionTimer &&
                  (clearTimeout(this._reconnectionTimer),
                  (this._reconnectionTimer = -1));
              }
              onConnectionStateChange(e) {
                let t = this._peerConnection.iceConnectionState,
                  i = this.getDTLSTransportState();
                this._log.info(
                  'connectionState: '
                    .concat(e.target.connectionState, ' ICE: ')
                    .concat(t, ' DTLS: ')
                    .concat(i),
                ),
                  e.target.connectionState === iD.CONNECTING &&
                    (0 === this.stat.peerConnectionStartTime &&
                      (this.stat.peerConnectionStartTime = Date.now()),
                    this.emitConnectionStateChangedEvent('CONNECTING')),
                  (e.target.connectionState === iD.FAILED ||
                    e.target.connectionState === iD.CLOSED) &&
                    (this.emitConnectionStateChangedEvent('DISCONNECTED'),
                    this.startReconnection()),
                  (e.target.connectionState === iD.CONNECTED ||
                    e.target.connectionState === iD.COMPLETED) &&
                    (0 === this.stat.peerConnectionEndTime &&
                      (this.stat.peerConnectionEndTime = Date.now()),
                    UO.emit(BO.SINGLE_CONNECTION_STAT, {
                      room: this._room,
                      stat: {
                        ice: this.stat.iceEndTime - this.stat.iceStartTime,
                        dtls: this.stat.dtlsEndTime - this.stat.dtlsStartTime,
                        peerConnection:
                          this.stat.peerConnectionEndTime -
                          this.stat.peerConnectionStartTime,
                      },
                    }),
                    this.logSelectedCandidate(),
                    this.emitConnectionStateChangedEvent('CONNECTED'));
              }
              getDTLSTransportState() {
                if (!this._peerConnection) return tD;
                let e = null;
                return Sw() && 0 !== this._peerConnection.getSenders().length
                  ? ((e = this._peerConnection.getSenders()[0].transport),
                    Ew() &&
                    0 !== this._peerConnection.getReceivers().length &&
                    e
                      ? e.state
                      : tD)
                  : tD;
              }
              emitConnectionStateChangedEvent(e) {
                e !== this.currentState &&
                  (('RECONNECTING' === this.currentState &&
                    'CONNECTING' === e) ||
                    (this.emit($x.CONNECTION_STATE_CHANGED, {
                      prevState: this.currentState,
                      state: e,
                    }),
                    (this.currentState = e)));
              }
              logSelectedCandidate() {
                return ab(this, null, function* () {
                  if (!this._peerConnection) return;
                  let e = yield this._peerConnection.getStats();
                  for (let [t, i] of e)
                    if (hw(i)) {
                      let t = e.get(i.localCandidateId),
                        n = e.get(i.remoteCandidateId);
                      t &&
                        this._log.info(
                          'local candidate: '
                            .concat(t.candidateType, ' ')
                            .concat(t.protocol, ':')
                            .concat(t.ip || t.address, ':')
                            .concat(t.port, ' ')
                            .concat(t.networkType || '', ' ')
                            .concat(
                              'relay' === t.candidateType
                                ? 'relayProtocol:'.concat(t.relayProtocol)
                                : '',
                            ),
                        ),
                        n &&
                          this._log.info(
                            'remote candidate: '
                              .concat(n.candidateType, ' ')
                              .concat(n.protocol, ':')
                              .concat(n.ip || n.address, ':')
                              .concat(n.port),
                          );
                      break;
                    }
                });
              }
              waitForPeerConnectionConnected() {
                return (
                  this._waitForPCConnectedPromise ||
                    ((this._waitForPCConnectedPromise = new Promise((e, t) => {
                      if ('CONNECTED' === this.currentState) return e();
                      this._waitForPCConnectedPromiseReject = t;
                      let i = (t) => {
                          'CONNECTED' === t.state &&
                            (clearTimeout(o), r(), e());
                        },
                        n = (e) => {
                          let { room: i } = e;
                          i === this._room &&
                            (clearTimeout(o),
                            r(),
                            t(
                              new gb({
                                code: mb.API_CALL_ABORTED,
                                message: QO({
                                  key: KO.CONNECTION_ABORTED,
                                  data: 'leave room',
                                }),
                              }),
                            ));
                        },
                        r = () => {
                          UO.off(BO.LEAVE_SUCCESS, n, this),
                            this.off($x.CONNECTION_STATE_CHANGED, i, this);
                        },
                        o = setTimeout(() => {
                          r();
                          let e = new gb({
                            code: mb.API_CALL_TIMEOUT,
                            message: 'connection timeout',
                          });
                          (Zx += 1),
                            ((e) => Zx > 2 && !eU && 0 === tU.size && e)(
                              this._signalChannel.isConnected,
                            ) &&
                              (this._log.warn('firewall restrition'),
                              (eU = !0),
                              this.emit($x.FIREWALL_RESTRICTION)),
                            t(e);
                        }, SD);
                      UO.on(BO.LEAVE_SUCCESS, n, this),
                        this.on($x.CONNECTION_STATE_CHANGED, i, this);
                    })),
                    (this._waitForPCConnectedPromise =
                      this._waitForPCConnectedPromise.finally(() => {
                        (this._waitForPCConnectedPromise = null),
                          (this._waitForPCConnectedPromiseReject = null);
                      }))),
                  this._waitForPCConnectedPromise
                );
              }
              waitForReconnected() {
                return this.isReconnecting
                  ? new Promise((e, t) => {
                      this.once('spc-reconnected', e), this.once('error', t);
                    })
                  : Promise.resolve();
              }
              addDownlink(e) {
                return ab(this, null, function* () {
                  var t;
                  if (
                    (this._log.info(
                      'addDownlink('.concat(e.userId, ') trying'),
                    ),
                    this.isReconnecting && (yield this.waitForReconnected()),
                    this.updateLocalAndRemoteSDPConfig(e),
                    0 === this.addDownlinkQueue.size)
                  )
                    try {
                      yield this.updateSDP({ isNeedToCreateOffer: !0 }),
                        null == (t = this.seiCodec) || t.handleEncodedStreams(),
                        this._log.info(
                          'addDownlink('.concat(e.userId, ') done'),
                        );
                    } catch (aN) {
                      this._log.info(
                        'addDownlink('.concat(e.userId, ') failed'),
                      ),
                        yield this.startReconnection();
                    }
                });
              }
              updateLocalAndRemoteSDPConfig(e) {
                let { ssrc: t, userId: i, tinyId: n } = e;
                if (!this._peerConnection) return;
                this._log.info(
                  'updateLocalAndRemoteSDPConfig '
                    .concat(i, ' ')
                    .concat(JSON.stringify(t)),
                );
                let r,
                  o,
                  s,
                  a = this._peerConnection
                    .getTransceivers()
                    .filter((e) => 'inactive' === e.direction)
                    .slice(0, 3)
                    .map(
                      (e) => (
                        (e.direction = LN.TRANSCEIVER_DIRECTION_RECVONLY),
                        Number(e.mid)
                      ),
                    );
                if (
                  (0 === a.length &&
                    (this._peerConnection.addTransceiver(LN.AUDIO, {
                      direction: LN.TRANSCEIVER_DIRECTION_RECVONLY,
                    }),
                    this._peerConnection.addTransceiver(LN.VIDEO, {
                      direction: LN.TRANSCEIVER_DIRECTION_RECVONLY,
                    }),
                    this._peerConnection.addTransceiver(LN.VIDEO, {
                      direction: LN.TRANSCEIVER_DIRECTION_RECVONLY,
                    })),
                  this._parsedAnswer ||
                    (this._parsedAnswer = nx(
                      this._peerConnection.remoteDescription.sdp,
                    )),
                  3 === a.length)
                )
                  (r = this._parsedAnswer.media.find(
                    (e) => Number(e.mid) === Number(a[0]),
                  )),
                    (o = this._parsedAnswer.media.find(
                      (e) => Number(e.mid) === Number(a[1]),
                    )),
                    (s = this._parsedAnswer.media.find(
                      (e) => Number(e.mid) === Number(a[2]),
                    ));
                else {
                  r = JSON.parse(JSON.stringify(this._parsedAnswer.media[0]));
                  let e = zx({
                    mid: 1,
                    serverAbility: this._serverAbility,
                    clientAbility: this._clientAbility,
                    parsedOffer: nx(this._peerConnection.localDescription.sdp),
                    useAllCodec: !0,
                  });
                  (o = JSON.parse(JSON.stringify(e))),
                    (s = JSON.parse(JSON.stringify(e))),
                    (r.mid = this._parsedAnswer.media.length),
                    this._parsedAnswer.media.push(r),
                    (o.mid = this._parsedAnswer.media.length),
                    this._parsedAnswer.media.push(o),
                    (s.mid = this._parsedAnswer.media.length),
                    this._parsedAnswer.media.push(s);
                }
                (r.direction = LN.TRANSCEIVER_DIRECTION_SENDONLY),
                  (r.ssrcs = [
                    { id: t.audio, attribute: 'cname', value: ''.concat(n) },
                    {
                      id: t.audio,
                      attribute: 'msid',
                      value: ''
                        .concat(n, '-')
                        .concat(LN.MAIN, ' ')
                        .concat(n, '-audio'),
                    },
                  ]),
                  (o.direction = LN.TRANSCEIVER_DIRECTION_SENDONLY),
                  (o.ssrcs = [
                    { id: t.video, attribute: 'cname', value: ''.concat(n) },
                    {
                      id: t.video,
                      attribute: 'msid',
                      value: ''
                        .concat(n, '-')
                        .concat(LN.MAIN, ' ')
                        .concat(n, '-bigvideo'),
                    },
                    { id: t.videoRtx, attribute: 'cname', value: ''.concat(n) },
                    {
                      id: t.videoRtx,
                      attribute: 'msid',
                      value: ''
                        .concat(n, '-')
                        .concat(LN.MAIN, ' ')
                        .concat(n, '-bigvideo'),
                    },
                  ]),
                  (o.ssrcGroups = [
                    {
                      semantics: 'FID',
                      ssrcs: ''.concat(t.video, ' ').concat(t.videoRtx),
                    },
                  ]),
                  (s.direction = LN.TRANSCEIVER_DIRECTION_SENDONLY);
                let c = ''.concat(n, '-aux');
                (s.ssrcs = [
                  { id: t.auxiliary, attribute: 'cname', value: c },
                  {
                    id: t.auxiliary,
                    attribute: 'msid',
                    value: ''.concat(c, ' ').concat(n, '-aux').concat(LN.VIDEO),
                  },
                  {
                    id: t.auxiliaryRtx,
                    attribute: 'cname',
                    value: ''.concat(c, ' ').concat(n, '-aux').concat(LN.VIDEO),
                  },
                  {
                    id: t.auxiliaryRtx,
                    attribute: 'msid',
                    value: ''.concat(c, ' ').concat(n, '-aux').concat(LN.VIDEO),
                  },
                ]),
                  (s.ssrcGroups = [
                    {
                      semantics: 'FID',
                      ssrcs: ''.concat(t.auxiliary, ' ').concat(t.auxiliaryRtx),
                    },
                  ]),
                  this._parsedAnswer.groups &&
                    (this._parsedAnswer.groups[0].mids =
                      this._parsedAnswer.media.map((e) => e.mid).join(' ')),
                  this._downlinkMIDMap.set(i, [r.mid, o.mid, s.mid]),
                  this._downlinkMIDUserIDMap.set(r.mid, i),
                  this._downlinkMIDUserIDMap.set(o.mid, i),
                  this._downlinkMIDUserIDMap.set(s.mid, i);
              }
              removeDownlink(e, t) {
                return ab(this, null, function* () {
                  if (!this._downlinkMIDMap.has(t) || !this._peerConnection)
                    return;
                  this._log.info('removeDownlink('.concat(t, ') trying')),
                    this.isReconnecting && (yield this.waitForReconnected());
                  let i = this._downlinkMIDMap.get(t),
                    n = !1;
                  this._peerConnection.getTransceivers().forEach((e) => {
                    null != i &&
                      i.includes(Number(e.mid)) &&
                      ((n = !0), (e.direction = 'inactive'));
                  }),
                    this._parsedAnswer ||
                      (this._parsedAnswer = nx(
                        this._peerConnection.remoteDescription.sdp,
                      )),
                    this._parsedAnswer.media.forEach((e) => {
                      null != i &&
                        i.includes(Number(e.mid)) &&
                        ((n = !0),
                        (e.direction = 'inactive'),
                        (e.ssrcs = []),
                        (e.ssrcGroups = []));
                    }),
                    0 === this.removeDownlinkQueue.size &&
                      n &&
                      (yield this.updateSDP({
                        isNeedToCreateOffer: !0,
                        tinyIdRemoving: e,
                      })),
                    this._downlinkMIDMap.delete(t),
                    null == i ||
                      i.forEach((e) => this._downlinkMIDUserIDMap.delete(e)),
                    this._log.info('removeDownlink('.concat(t, ') done'));
                });
              }
              setBandwidth(e) {
                return ab(this, null, function* () {
                  var t;
                  if (!this._peerConnection) return;
                  let { audio: i, bigVideo: n, smallVideo: r, auxVideo: o } = e;
                  try {
                    if (Cw()) {
                      let e = this._peerConnection.getSenders().slice(0, 4);
                      for (let t = 0; t < e.length; t++) {
                        let s,
                          a = e[t];
                        0 === t && i
                          ? (s = i)
                          : 1 === t && n
                          ? (s = n)
                          : 2 === t && r
                          ? (s = r)
                          : 3 === t && o && (s = o),
                          s && (yield this.setSenderMaxBitrate(a, s));
                      }
                      if (
                        n &&
                        e[1].track &&
                        this._peerConnection.remoteDescription
                      ) {
                        this._parsedAnswer ||
                          (this._parsedAnswer = nx(
                            this._peerConnection.remoteDescription.sdp,
                          ));
                        let e = n > 5e3 ? 5e3 : n;
                        null != (t = this._parsedAnswer.media[1]) &&
                          t.fmtp[0] &&
                          (this._parsedAnswer.media[1].fmtp[0].config +=
                            ';x-google-start-bitrate='.concat(e)),
                          yield this.updateSDP({
                            localDescription:
                              this._peerConnection.localDescription,
                          });
                      }
                    } else yield this.setBandwidthBySDP(e);
                    this._log.info('setBandwidth '.concat(JSON.stringify(e)));
                  } catch (Qx) {
                    this._log.error('failed to set bandwidth'.concat(Qx));
                  }
                });
              }
              setSenderMaxBitrate(e, t) {
                let i = e.getParameters();
                return (
                  (!i.encodings || 0 === i.encodings.length) &&
                    (i.encodings = [{}]),
                  'unlimited' === t
                    ? delete i.encodings[0].maxBitrate
                    : (i.encodings[0].maxBitrate = 1e3 * t),
                  e.setParameters(i)
                );
              }
              setBandwidthBySDP(e) {
                let { audio: t, bigVideo: i, smallVideo: n, auxVideo: r } = e;
                if (
                  !this._peerConnection ||
                  !this._peerConnection.localDescription
                )
                  return;
                let o = nx(this._peerConnection.localDescription.sdp);
                this._parsedAnswer ||
                  (this._parsedAnswer = nx(
                    this._peerConnection.remoteDescription.sdp,
                  ));
                let s = Ub ? 'TIAS' : 'AS';
                t &&
                  ((o.media[0].bandwidth = [
                    { type: s, limit: Ub ? 1e3 * t : t },
                  ]),
                  (this._parsedAnswer.media[0].bandwidth = [
                    { type: s, limit: Ub ? 1e3 * t : t },
                  ])),
                  i &&
                    ((o.media[1].bandwidth = [
                      { type: s, limit: Ub ? 1e3 * i : i },
                    ]),
                    (this._parsedAnswer.media[1].bandwidth = [
                      { type: s, limit: Ub ? 1e3 * i : i },
                    ])),
                  n &&
                    ((o.media[2].bandwidth = [
                      { type: s, limit: Ub ? 1e3 * n : n },
                    ]),
                    (this._parsedAnswer.media[2].bandwidth = [
                      { type: s, limit: Ub ? 1e3 * n : n },
                    ])),
                  r &&
                    ((o.media[3].bandwidth = [
                      { type: s, limit: Ub ? 1e3 * r : r },
                    ]),
                    (this._parsedAnswer.media[3].bandwidth = [
                      { type: s, limit: Ub ? 1e3 * r : r },
                    ]));
                let a = { type: 'offer', sdp: rx(o) };
                return this.updateSDP({ localDescription: a });
              }
              updateSDP(e) {
                let {
                  isNeedToCreateOffer: t = !1,
                  localDescription: i,
                  tinyIdRemoving: n,
                } = e;
                if (!this._parsedAnswer) return;
                let r = rx(this._parsedAnswer);
                return (
                  (this._updateSDPPromise = new Promise((e, n) =>
                    ab(this, null, function* () {
                      var o, s;
                      try {
                        t &&
                          this._peerConnection &&
                          (this._log.info('creating offer'),
                          (i = yield this._peerConnection.createOffer())),
                          i && (yield this.setOffer(i)),
                          yield this.setAnswer({ type: 'answer', sdp: r }),
                          (this._updateSDPPromise = null),
                          e();
                      } catch (a) {
                        this._log.error(a),
                          !this._isSDPLogged &&
                            this._peerConnection &&
                            (this._log.warn(
                              'transceivers: '.concat(
                                JSON.stringify(
                                  this._peerConnection
                                    .getTransceivers()
                                    .map((e) => {
                                      let {
                                        mid: t,
                                        currentDirection: i,
                                        direction: n,
                                        stopped: r,
                                      } = e;
                                      return {
                                        mid: t,
                                        currentDirection: i,
                                        direction: n,
                                        stopped: r,
                                      };
                                    }),
                                ),
                              ),
                            ),
                            this._log.warn(
                              'parsedAnswer: '.concat(
                                JSON.stringify(this._parsedAnswer),
                              ),
                            ),
                            this._log.warn(
                              'local sdp: '.concat(
                                null == i ? void 0 : i.sdp,
                              ) || 0,
                            ),
                            this._log.warn('remote sdp: '.concat(r) || 0),
                            (this._isSDPLogged = !0)),
                          (this._updateSDPPromise = null),
                          n(a);
                      }
                    }),
                  )),
                  this._updateSDPPromise
                );
              }
              setOffer(e) {
                return (
                  this._log.info('setting offer'),
                  this._peerConnection.setLocalDescription({
                    type: 'offer',
                    sdp: Xx(e.sdp),
                  })
                );
              }
              setAnswer(e) {
                return (
                  this._log.info('setting answer'),
                  this._room.enableHWEncoder &&
                    e.sdp &&
                    (e.sdp = e.sdp.replaceAll('42e01f', '42001f')),
                  this._peerConnection.setRemoteDescription(e)
                );
              }
              sendDataChannelMessage(e) {
                var t;
                null == (t = this._datachannel) || t.send(e);
              }
              reset() {
                var e;
                null == (e = this._peerConnection) || e.close(),
                  (this._waitForPCConnectedPromise = null),
                  (this._parsedAnswer = null);
              }
              close() {
                this._log.info('close pc'),
                  this.reset(),
                  this.emitConnectionStateChangedEvent('DISCONNECTED'),
                  this._downlinkMIDMap.clear(),
                  this.stopReconnection(),
                  this.removeAllListeners();
              }
              sendSEI(e, t) {
                var i;
                null == (i = this.seiCodec) || i.push(e, t);
              }
            };
          rb([aL()], nU.prototype, 'updateSDP', 1);
          var rU = class {
              constructor(e) {
                ob(this, 'tag'), ob(this, 'len'), ob(this, 'data');
                let t = new DataView(e);
                (this.tag = t.getUint16()),
                  (this.len = t.getUint16(2)),
                  (this.data = new Uint8Array(e).slice(4, 4 + this.len).buffer);
              }
            },
            oU = class {
              constructor(e) {
                ob(this, 'tinyId'), ob(this, 'data');
                let t = new DataView(e),
                  i = 0,
                  n = [];
                for (; i < t.byteLength; ) {
                  let r = t.getUint16(i + 2),
                    o = new rU(
                      new Uint8Array(e).slice(i, i + 2 + 2 + r).buffer,
                    );
                  n.push(o), (i += 4 + r);
                }
                n.forEach((e) => {
                  1 === e.tag
                    ? (this.tinyId = new TextDecoder().decode(e.data))
                    : 2 === e.tag && (this.data = e.data);
                });
              }
            },
            sU = new Set();
          function aU() {
            let e = Math.floor(4294967296 * Math.random());
            return sU.has(e) ? aU() : (sU.add(e), e);
          }
          var cU = nb(cb()),
            lU = class extends cU.default {
              constructor(e) {
                super(),
                  ob(this, 'userId'),
                  ob(this, 'tinyId'),
                  ob(this, '_sdpSemantics'),
                  ob(this, '_isUplink'),
                  ob(this, '_room'),
                  ob(this, '_log'),
                  ob(this, '_signalChannel'),
                  ob(this, '_currentState', 'DISCONNECTED'),
                  ob(this, '_prevTime', -1),
                  ob(this, '_enableSEI'),
                  ob(this, '_sei'),
                  (this.userId = e.userId),
                  (this.tinyId = e.tinyId),
                  (this._room = e.room),
                  (this._sdpSemantics = e.room.sdpSemantics),
                  (this._isUplink = e.isUplink),
                  (this._log = jO.createLogger({
                    id: 'n',
                    userId: this._room.userId,
                    remoteUserId: this._isUplink ? void 0 : this.userId,
                    sdkAppId: this._room.sdkAppId,
                    isLocal: this._isUplink,
                  })),
                  (this._signalChannel = e.signalChannel),
                  (this._enableSEI = e.enableSEI),
                  this._enableSEI &&
                    Nw &&
                    (this._sei = new QV(this, this._log, this._isUplink));
              }
              get _peerConnection() {
                var e;
                return (
                  (null == (e = this.singlePC)
                    ? void 0
                    : e.getPeerConnection()) || null
                );
              }
              get singlePC() {
                return this._room.singlePC;
              }
              close(e) {
                this._log.info('close connection'),
                  this.emit('closed', e),
                  this._sei && (this._sei.destroy(), (this._sei = null));
              }
              emitConnectionStateChangedEvent(e) {
                return (
                  e !== this._currentState &&
                  (UO.emit(BO.PEER_CONNECTION_STATE_CHANGED, {
                    room: this._room,
                    prevState: this._currentState,
                    state: e,
                    remoteUserId: this._isUplink ? void 0 : this.userId,
                  }),
                  this.emit('connection-state-changed', {
                    prevState: this._currentState,
                    state: e,
                  }),
                  (this._currentState = e),
                  !0)
                );
              }
              getPeerConnection() {
                return this._peerConnection;
              }
              getRoom() {
                return this._room;
              }
              getUserId() {
                return this.userId;
              }
              getTinyId() {
                return this.tinyId;
              }
              getCurrentState() {
                return this._currentState;
              }
              get isH264() {
                var e, t;
                return !(
                  null ==
                    (t =
                      null == (e = this._peerConnection)
                        ? void 0
                        : e.remoteDescription) || !t.sdp.includes('H264')
                );
              }
            },
            dU = class extends lU {
              constructor(e) {
                super(eb(ZC({}, e), { isUplink: !0 })),
                  ob(this, 'localMainAudioTrack', null),
                  ob(this, 'localMainVideoTrack', null),
                  ob(this, 'localAuxAudioTrack', null),
                  ob(this, 'localAuxVideoTrack', null),
                  ob(this, '_isPublishingAux', !1),
                  ob(this, '_publishingLocalAudioTrack'),
                  ob(this, '_publishingLocalVideoTrack'),
                  ob(this, '_mediaSettings', {
                    videoCodec: '',
                    videoWidth: 0,
                    videoHeight: 0,
                    videoBps: 0,
                    videoFps: 0,
                    audioCodec: 'opus',
                    audioFs: 0,
                    audioChannel: 0,
                    audioBps: 0,
                    smallVideoWidth: 0,
                    smallVideoHeight: 0,
                    smallVideoFps: 0,
                    smallVideoBps: 0,
                    auxVideoWidth: 0,
                    auxVideoHeight: 0,
                    auxVideoFps: 0,
                    auxVideoBps: 0,
                  }),
                  ob(this, '_audioManager'),
                  (this._audioManager = e.audioManager),
                  this.initialize();
              }
              get ssrc() {
                if (!this.singlePC)
                  return {
                    audio: 0,
                    video: 0,
                    videoRtx: 0,
                    small: 0,
                    smallRtx: 0,
                    auxiliary: 0,
                    auxiliaryRtx: 0,
                  };
                let {
                  audioSsrc: e,
                  bigVideoSsrc: t,
                  bigVideoRtxSsrc: i,
                  smallVideoSsrc: n,
                  smallVideoRtxSsrc: r,
                  auxVideoSsrc: o,
                  auxVideoRtxSsrc: s,
                } = this.singlePC.uplinkSSRC;
                return {
                  audio: e || 0,
                  video: t || 0,
                  videoRtx: i || 0,
                  small: n || 0,
                  smallRtx: r || 0,
                  auxiliary: o || 0,
                  auxiliaryRtx: s || 0,
                };
              }
              get isMainStreamPublished() {
                return !(
                  !this.localMainAudioTrack && !this.localMainVideoTrack
                );
              }
              get isAuxStreamPublished() {
                return !(!this.localAuxVideoTrack && !this.localAuxAudioTrack);
              }
              get publishState() {
                var e, t, i, n;
                let r = {
                  audio: !1,
                  bigVideo: !1,
                  smallVideo: !1,
                  auxVideo: !1,
                };
                if (this._peerConnection) {
                  let o = this._peerConnection.getSenders();
                  o &&
                    (Iw()
                      ? ((r.audio = !(null == (e = o[0]) || !e.track)),
                        (r.bigVideo = !(null == (t = o[1]) || !t.track)),
                        (r.smallVideo = !(null == (i = o[2]) || !i.track)),
                        (r.auxVideo = !(null == (n = o[3]) || !n.track)))
                      : o.forEach((e) => {
                          e.track &&
                            (e.track.kind === LN.AUDIO
                              ? (r.audio = !0)
                              : ((r.bigVideo = !0),
                                this._room.videoManager.hasSmall &&
                                  (r.smallVideo = !0)));
                        }));
                }
                return r;
              }
              get muteState() {
                var e, t, i;
                return {
                  audio: !(null == (e = this.localMainAudioTrack) || !e.muted),
                  bigVideo: !(
                    null == (t = this.localMainVideoTrack) || !t.muted
                  ),
                  auxVideo: !(
                    null == (i = this.localAuxVideoTrack) || !i.muted
                  ),
                };
              }
              initialize() {
                this.installEvents();
              }
              reset() {
                this.uninstallEvents();
              }
              close(e) {
                super.close(e),
                  this.reset(),
                  this.emitConnectionStateChangedEvent('DISCONNECTED');
              }
              installEvents() {
                var e;
                this.listeners('connection-state-changed').includes(
                  this.handleConnectionStateChange,
                ) ||
                  this.on(
                    'connection-state-changed',
                    this.handleConnectionStateChange,
                    this,
                  ),
                  this.listeners('spc-reconnected').includes(
                    this.onSinglePCReconnected,
                  ) ||
                    null == (e = this.singlePC) ||
                    e.on('spc-reconnected', this.onSinglePCReconnected, this);
              }
              uninstallEvents() {
                var e;
                this.off(
                  'connection-state-changed',
                  this.handleConnectionStateChange,
                  this,
                ),
                  null == (e = this.singlePC) ||
                    e.off('spc-reconnected', this.onSinglePCReconnected, this);
              }
              emitConnectionStateChangedEvent(e, t) {
                var i, n, r;
                let o = this._currentState,
                  s = super.emitConnectionStateChangedEvent(e);
                return (
                  s &&
                    o !== e &&
                    (t
                      ? t.emit('connection-state-changed', {
                          prevState: o,
                          state: e,
                        })
                      : (null == (i = this.localMainVideoTrack) ||
                          i.emit('connection-state-changed', {
                            prevState: o,
                            state: e,
                          }),
                        null == (n = this.localAuxVideoTrack) ||
                          n.emit('connection-state-changed', {
                            prevState: o,
                            state: e,
                          }),
                        null == (r = this._publishingLocalVideoTrack) ||
                          r.emit('connection-state-changed', {
                            prevState: o,
                            state: e,
                          }))),
                  s
                );
              }
              publish(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let {
                    localAudioTrack: i,
                    localVideoTrack: n,
                    isAuxiliary: r,
                  } = e;
                  return (function* () {
                    var e, o, s, a, c, l, d;
                    if (!t.singlePC) return;
                    if (
                      (yield t.singlePC.waitForPeerConnectionConnected(),
                      i && (t._publishingLocalAudioTrack = i),
                      n)
                    ) {
                      if (
                        !t.singlePC.isH264EncodeSupported &&
                        !t.singlePC.isVP8EncodeSupported
                      )
                        throw new gb({
                          code: mb.NOT_SUPPORTED_H264,
                          message: QO({ key: KO.NOT_SUPPORTED_H264ENCODE }),
                        });
                      Lb &&
                        115 === wk() &&
                        n.profile.width * n.profile.height <= 230400 &&
                        (t._log.warn('fallback video to 480p'),
                        n.setProfile(wN['480p_2']),
                        yield n.applyProfile()),
                        (t._publishingLocalVideoTrack = n);
                    }
                    let u;
                    (t._isPublishingAux = r),
                      n &&
                        !r &&
                        n.small &&
                        (u = t._room.videoManager.smallTrack),
                      vw() &&
                        (yield t.publishByTransceiver({
                          localAudioTrack: i,
                          localVideoTrack: n,
                          smallTrack: u,
                          isAuxiliary: r,
                        })),
                      null == (e = t.singlePC.seiCodec) ||
                        e.handleEncodedStreams(),
                      (t._publishingLocalAudioTrack = null),
                      (t._publishingLocalVideoTrack = null),
                      (t._isPublishingAux = !1),
                      r
                        ? (n && (t.localAuxVideoTrack = n),
                          i && (t.localAuxAudioTrack = i))
                        : (n && (t.localMainVideoTrack = n),
                          i && (t.localMainAudioTrack = i)),
                      yield t.singlePC.setBandwidth({
                        audio:
                          (null == (o = t.localMainAudioTrack)
                            ? void 0
                            : o.profile.bitrate) ||
                          (null == (s = t.localAuxAudioTrack)
                            ? void 0
                            : s.profile.bitrate),
                        bigVideo:
                          null == (a = t.localMainVideoTrack)
                            ? void 0
                            : a.profile.bitrate,
                        smallVideo:
                          null ==
                          (l =
                            null == (c = t.localMainVideoTrack)
                              ? void 0
                              : c.small)
                            ? void 0
                            : l.bitrate,
                        auxVideo:
                          null == (d = t.localAuxVideoTrack)
                            ? void 0
                            : d.profile.bitrate,
                      }),
                      yield t._signalChannel.sendWaitForResponse({
                        command: DV,
                        responseCommand: aV.SPC_PUBLISH_RESULT,
                        data: eb(ZC({}, t.singlePC.uplinkSSRC), {
                          state: t.publishState,
                          muteState: t.muteState,
                        }),
                      }),
                      t.sendMediaSettings(),
                      t.installTrackMuteEvents(i, n);
                  })();
                });
              }
              publishByTransceiver(e) {
                let {
                  localAudioTrack: t,
                  localVideoTrack: i,
                  smallTrack: n,
                  isAuxiliary: r,
                } = e;
                this._log.info('publish by transceiver');
                let o = null == i ? void 0 : i.outMediaTrack,
                  s = this._audioManager.mixedAudioTrack,
                  a = this._peerConnection.getTransceivers(),
                  c = [],
                  l = [];
                if (s) {
                  let e = a[0].sender.replaceTrack(s);
                  l.push(0), c.push(e);
                }
                if (o)
                  if (r) {
                    let e = a[3].sender.replaceTrack(o);
                    l.push(3), c.push(e);
                  } else {
                    let e = a[1].sender.replaceTrack(o);
                    l.push(1), c.push(e);
                  }
                if (n) {
                  let e = a[2].sender.replaceTrack(n);
                  l.push(2), c.push(e);
                }
                let d = this.setTransceiverDirection(MN.SENDONLY, l);
                return c.push(d), Promise.all(c);
              }
              enableSmall(e) {
                return ab(this, null, function* () {
                  if (!this.singlePC) return;
                  let t = this._peerConnection.getTransceivers();
                  e
                    ? this._room.videoManager.smallTrack &&
                      (yield t[2].sender.replaceTrack(
                        this._room.videoManager.smallTrack,
                      ),
                      yield this.setTransceiverDirection(MN.SENDONLY, [2]))
                    : (yield t[2].sender.replaceTrack(null),
                      yield this.setTransceiverDirection(MN.INACTIVE, [2])),
                    this.updateMediaSettings(),
                    yield this.doPublishChange();
                });
              }
              installTrackMuteEvents() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                t.forEach((e) => {
                  e &&
                    (null == e || e.on('mute', this.sendMutedFlag, this),
                    null == e || e.on('unmute', this.sendMutedFlag, this));
                });
              }
              uninstallTrackMuteEvents() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                t.forEach((e) => {
                  e &&
                    (null == e || e.off('mute', this.sendMutedFlag, this),
                    null == e || e.off('unmute', this.sendMutedFlag, this));
                });
              }
              unpublish(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let { localAudioTrack: i, localVideoTrack: n } = e;
                  return (function* () {
                    let e = n && n === t.localAuxVideoTrack,
                      r = null == n ? void 0 : n.outMediaTrack,
                      o = t._peerConnection.getSenders(),
                      s = [];
                    i &&
                      (t._audioManager.mixedAudioTrack ||
                        (yield o[0].replaceTrack(null), s.push(0)),
                      e
                        ? (t.localAuxAudioTrack = null)
                        : (t.localMainAudioTrack = null)),
                      r &&
                        (e
                          ? (yield o[3].replaceTrack(null),
                            (t.localAuxVideoTrack = null),
                            (t._mediaSettings = eb(ZC({}, t._mediaSettings), {
                              auxVideoBps: 0,
                              auxVideoFps: 0,
                              auxVideoWidth: 0,
                              auxVideoHeight: 0,
                            })),
                            s.push(3))
                          : (yield o[1].replaceTrack(null),
                            yield o[2].replaceTrack(null),
                            (t.localMainVideoTrack = null),
                            (t._mediaSettings = eb(ZC({}, t._mediaSettings), {
                              videoWidth: 0,
                              videoHeight: 0,
                              videoBps: 0,
                              videoFps: 0,
                              audioFs: 0,
                              audioChannel: 0,
                              audioBps: 0,
                              smallVideoWidth: 0,
                              smallVideoHeight: 0,
                              smallVideoFps: 0,
                              smallVideoBps: 0,
                            })),
                            s.push(1, 2))),
                      t.isMainStreamPublished || t.isAuxStreamPublished
                        ? (yield t.setTransceiverDirection(MN.INACTIVE, s),
                          yield t.doPublishChange(!1))
                        : yield t.doUnpublish(),
                      t.uninstallTrackMuteEvents(i, n),
                      null == n ||
                        n.emit('connection-state-changed', {
                          prevState: t._currentState,
                          state: 'DISCONNECTED',
                        });
                  })();
                });
              }
              doPublishChange() {
                let e =
                  !(arguments.length > 0 && void 0 !== arguments[0]) ||
                  arguments[0];
                return ab(this, null, function* () {
                  let t = {
                      state: this.publishState,
                      constraintConfig: this._mediaSettings,
                    },
                    i = yield this._signalChannel.sendWaitForResponse({
                      command: _V,
                      data: t,
                      responseCommand: aV.PUBLISH_STATE_CHANGE_RESULT,
                      enableLog: e,
                    });
                  this.checkPublishResultCode(i.data.code, i.data.message);
                });
              }
              doUnpublish() {
                let e =
                  arguments.length > 0 &&
                  void 0 !== arguments[0] &&
                  arguments[0];
                return this._signalChannel
                  .sendWaitForResponse({
                    command: mV,
                    commandDesc: 'unpublish',
                    responseCommand: aV.UNPUBLISH_RESULT,
                    enableLog: e,
                  })
                  .catch((e) => {
                    if (e.getCode() === mb.API_CALL_TIMEOUT)
                      return Promise.resolve();
                    throw e;
                  });
              }
              updateMediaSettings() {
                let {
                  detail: { isH264EncodeSupported: e, isVp8EncodeSupported: t },
                } = this._room.checkSystemResult;
                e
                  ? (this._mediaSettings.videoCodec = 'H264')
                  : t && (this._mediaSettings.videoCodec = 'VP8');
                let i =
                    this._publishingLocalAudioTrack ||
                    this.localMainAudioTrack ||
                    this.localAuxAudioTrack,
                  { localMainVideoTrack: n, localAuxVideoTrack: r } = this;
                if (
                  (this._publishingLocalVideoTrack &&
                    (this._isPublishingAux
                      ? (r = this._publishingLocalVideoTrack)
                      : (n = this._publishingLocalVideoTrack)),
                  bw)
                ) {
                  if (i && i.outMediaTrack) {
                    let e = i.outMediaTrack.getSettings();
                    (this._mediaSettings.audioChannel = e.channelCount || 1),
                      (this._mediaSettings.audioBps = 1e3 * i.profile.bitrate),
                      (this._mediaSettings.audioFs = e.sampleRate || 0);
                  }
                  if (n && n.outMediaTrack) {
                    let e = n.outMediaTrack.getSettings();
                    (this._mediaSettings.videoWidth = e.width || 0),
                      (this._mediaSettings.videoHeight = e.height || 0),
                      (this._mediaSettings.videoFps = e.frameRate || 0),
                      (this._mediaSettings.videoBps = 1e3 * n.profile.bitrate),
                      n.small &&
                        ((this._mediaSettings.smallVideoWidth = n.small.width),
                        (this._mediaSettings.smallVideoHeight = n.small.height),
                        (this._mediaSettings.smallVideoFps = n.small.frameRate),
                        (this._mediaSettings.smallVideoBps =
                          1e3 * n.small.bitrate));
                  }
                  if (r && r.outMediaTrack) {
                    let e = r.outMediaTrack.getSettings();
                    (this._mediaSettings.auxVideoWidth = e.width || 0),
                      (this._mediaSettings.auxVideoHeight = e.height || 0),
                      (this._mediaSettings.auxVideoFps = e.frameRate || 0),
                      (this._mediaSettings.auxVideoBps =
                        1e3 * r.profile.bitrate);
                  }
                } else
                  i &&
                    i.outMediaTrack &&
                    ((this._mediaSettings.audioChannel =
                      i.profile.channelCount),
                    (this._mediaSettings.audioBps = 1e3 * i.profile.bitrate),
                    (this._mediaSettings.audioFs = i.profile.sampleRate)),
                    n &&
                      n.outMediaTrack &&
                      ((this._mediaSettings.videoWidth = n.profile.width),
                      (this._mediaSettings.videoHeight = n.profile.height),
                      (this._mediaSettings.videoFps = n.profile.frameRate),
                      (this._mediaSettings.videoBps = 1e3 * n.profile.bitrate));
                this._log.info(
                  'updateMediaSettings: '.concat(
                    JSON.stringify(this._mediaSettings),
                  ),
                );
              }
              sendMediaSettings() {
                this.updateMediaSettings(),
                  this._signalChannel
                    .sendWaitForResponse({
                      command: bV,
                      data: this._mediaSettings,
                      responseCommand: aV.UPDATE_CONSTRAINT_CONFIG_RES,
                    })
                    .then((e) => {
                      0 !== e.data.code && this._log.warn(e.data.message);
                    })
                    .catch(() => {});
              }
              addTrack(e) {
                return ab(this, null, function* () {
                  var t;
                  if (!this._peerConnection) return;
                  let i =
                    e === this.localAuxAudioTrack ||
                    e === this.localAuxVideoTrack;
                  this._log.info(
                    'is adding '
                      .concat(e.kind, ' track to current published local ')
                      .concat(i ? LN.AUXILIARY : LN.MAIN, ' stream'),
                  ),
                    null == (t = this._sei) || t.handleEncodedStreams(),
                    Iw() && (yield this.addTrackByTransceiver(e, i));
                });
              }
              addTrackByTransceiver(e, t) {
                return ab(this, null, function* () {
                  var i;
                  if (!e.mediaTrack) return;
                  let n = this._peerConnection.getTransceivers();
                  if (e.kind === LN.AUDIO)
                    yield n[0].sender.replaceTrack(
                      this._audioManager.mixedAudioTrack,
                    );
                  else {
                    let r = t ? 3 : 1;
                    yield n[r].sender.replaceTrack(e.outMediaTrack),
                      1 === r &&
                        (null == (i = this.localMainVideoTrack)
                          ? void 0
                          : i.small) &&
                        (yield n[2].sender.replaceTrack(
                          this._room.videoManager.smallTrack,
                        )),
                      n[r].direction === MN.INACTIVE &&
                        (yield this.setTransceiverDirection(MN.SENDONLY, [r]));
                  }
                  this.updateMediaSettings(), yield this.doPublishChange();
                });
              }
              removeTrack(e) {
                return ab(this, null, function* () {
                  if (!this._peerConnection) return;
                  let t =
                    e === this.localAuxAudioTrack ||
                    e === this.localAuxVideoTrack;
                  this._log.info(
                    'is removing '
                      .concat(e.kind, ' track from current published local ')
                      .concat(t ? LN.AUXILIARY : LN.MAIN, ' stream'),
                  ),
                    Iw() && (yield this.removeTrackByTransceiver(e, t));
                });
              }
              removeTrackByTransceiver(e, t) {
                return ab(this, null, function* () {
                  if (!e.mediaTrack) return;
                  let i = this._peerConnection.getTransceivers();
                  if (e.kind === LN.AUDIO)
                    this._audioManager.mixedAudioTrack ||
                      (yield i[0].sender.replaceTrack(null));
                  else {
                    let e = t ? 3 : 1;
                    yield i[e].sender.replaceTrack(null),
                      1 === e &&
                        this._room.videoManager.hasSmall &&
                        (yield i[2].sender.replaceTrack(null)),
                      yield this.setTransceiverDirection(MN.INACTIVE, [e]);
                  }
                  this.updateMediaSettings(), yield this.doPublishChange();
                });
              }
              setTransceiverDirection(e, t) {
                return ab(this, null, function* () {
                  if (!Ub) return;
                  let i = !1,
                    n = !1;
                  this._log.info(
                    'setting transceiver '
                      .concat(t.join(','), ' direction to ')
                      .concat(e),
                  );
                  let r = this._peerConnection.getTransceivers();
                  if (
                    (t.forEach((t) => {
                      r[t].direction !== e && ((r[t].direction = e), (i = !0));
                    }),
                    i)
                  ) {
                    this._log.info('updating offer');
                    let e = yield this._peerConnection.createOffer();
                    yield this._peerConnection.setLocalDescription(e);
                  }
                  let o = -1,
                    s = this._peerConnection.remoteDescription.sdp
                      .split('\r\n')
                      .map((i) => {
                        if (
                          (i.match(
                            new RegExp(
                              'a=('
                                .concat(MN.INACTIVE, '|')
                                .concat(MN.RECVONLY, '|')
                                .concat(MN.SENDONLY, ')'),
                            ),
                          ) && o++,
                          t.includes(o))
                        ) {
                          if (
                            e === MN.INACTIVE &&
                            i.includes('a='.concat(MN.RECVONLY))
                          )
                            return (n = !0), 'a='.concat(e);
                          if (
                            e === MN.SENDONLY &&
                            i.includes('a='.concat(MN.INACTIVE))
                          )
                            return (n = !0), 'a='.concat(MN.RECVONLY);
                        }
                        return i;
                      })
                      .join('\r\n');
                  n &&
                    (this._log.info('updating answer'),
                    yield this._peerConnection.setRemoteDescription({
                      type: 'answer',
                      sdp: s,
                    }));
                });
              }
              replaceTrack(e) {
                return ab(this, null, function* () {
                  var t;
                  let i =
                      null == (t = this._peerConnection)
                        ? void 0
                        : t.getSenders(),
                    n = e.mediaTrack;
                  if (
                    !i ||
                    0 === i.length ||
                    !n ||
                    i.find((e) => e.track === n)
                  )
                    return;
                  let r =
                    e === this.localAuxAudioTrack ||
                    e === this.localAuxVideoTrack;
                  this._log.info(
                    'is replacing '
                      .concat(n.kind, ' track on ')
                      .concat(r ? LN.AUXILIARY : LN.MAIN, ' stream'),
                  ),
                    n.kind === LN.AUDIO &&
                      i[0] &&
                      (yield i[0].replaceTrack(
                        this._audioManager.mixedAudioTrack,
                      )),
                    n.kind === LN.VIDEO &&
                      (!r &&
                        i[1] &&
                        (yield i[1].replaceTrack(e.outMediaTrack || n)),
                      r && i[3] && (yield i[3].replaceTrack(e.outMediaTrack)));
                });
              }
              setBandwidth(e) {
                return ab(this, arguments, function (e) {
                  var t = this;
                  let { bandwidth: i, type: n, videoType: r } = e;
                  return (function* () {
                    if (t.singlePC) {
                      let e = {};
                      n === LN.AUDIO
                        ? (e.audio = i)
                        : 'big' === r
                        ? (e.bigVideo = i)
                        : 'small' === r
                        ? (e.smallVideo = i)
                        : (e.auxVideo = i),
                        yield t.singlePC.setBandwidth(e);
                    }
                  })();
                });
              }
              sendMutedFlag(e) {
                e === this.localAuxAudioTrack ||
                  e === this.localAuxVideoTrack ||
                  (this._log.info(
                    'send muted state: '.concat(JSON.stringify(this.muteState)),
                  ),
                  this._signalChannel.send(hV, this.muteState));
              }
              handleConnectionStateChange(e) {
                'CONNECTED' === e.state &&
                  (this.localMainVideoTrack ||
                    (this._publishingLocalVideoTrack &&
                      !this._isPublishingAux)) &&
                  UO.emit(BO.SEND_FIRST_VIDEO_FRAME, { room: this._room });
              }
              getVideoTrackId() {
                let e =
                  arguments.length > 0 && void 0 !== arguments[0]
                    ? arguments[0]
                    : LN.VIDEO;
                if (this._peerConnection) {
                  let t = this._peerConnection.getSenders();
                  if (e === LN.AUXILIARY && t[3] && t[3].track)
                    return t[3].track.id;
                  if (e === LN.VIDEO && t[1] && t[1].track)
                    return t[1].track.id;
                }
                if (this.localMainVideoTrack && e === LN.VIDEO) {
                  let e = this.localMainVideoTrack.mediaTrack;
                  if (e) return e.id;
                }
                if (this.localAuxVideoTrack && e === LN.AUXILIARY) {
                  let e = this.localAuxVideoTrack.mediaTrack;
                  if (e) return e.id;
                }
                return '';
              }
              getSSRC() {
                return this.ssrc;
              }
              checkPublishResultCode(e, t) {
                if (0 !== e)
                  throw e === _D
                    ? (this._log.error(YO.NOT_SUPPORTED_H264ENCODE),
                      new gb({
                        code: mb.NOT_SUPPORTED_H264,
                        message: QO({ key: KO.NOT_SUPPORTED_H264ENCODE }),
                      }))
                    : new gb({
                        code: mb.UNKNOWN,
                        message: QO({
                          key: KO.SIGNAL_RESPONSE_FAILED,
                          data: {
                            signalResponse: aV.PUBLISH_RESULT,
                            code: e,
                            message: t,
                          },
                        }),
                      });
              }
              sendSEI(e, t) {
                var i;
                null == (i = this._sei) || i.push(e, t);
              }
              onSinglePCReconnected() {
                return ab(this, null, function* () {
                  this.isMainStreamPublished &&
                    (this._log.warn('republish main stream'),
                    yield this.publish({
                      localAudioTrack: this.localMainAudioTrack,
                      localVideoTrack: this.localMainVideoTrack,
                      isAuxiliary: !1,
                    })),
                    this.isAuxStreamPublished &&
                      (this._log.warn('republish aux stream'),
                      yield this.publish({
                        localAudioTrack: this.localAuxAudioTrack,
                        localVideoTrack: this.localAuxVideoTrack,
                        isAuxiliary: !0,
                      }));
                });
              }
            };
          function uU(e) {
            return Object.keys(e).filter((t) => e[t]);
          }
          var hU = class extends lU {
            constructor(e) {
              super(eb(ZC({}, e), { isUplink: !1 })),
                ob(this, '_flag', 0),
                ob(this, 'role', 'anchor'),
                ob(this, 'remoteAudioTrack'),
                ob(this, 'remoteVideoTrack'),
                ob(this, 'remoteAuxiliaryTrack'),
                ob(this, 'ssrc', {
                  audio: 0,
                  video: 0,
                  videoRtx: 0,
                  auxiliary: 0,
                  auxiliaryRtx: 0,
                }),
                (this.flag = e.flag),
                (this.remoteAudioTrack = new OL(this._room, this)),
                (this.remoteVideoTrack = new wL(this._room, this)),
                (this.remoteAuxiliaryTrack = new PL(this._room, this)),
                this.initialize();
            }
            get subscribeState() {
              let e = { audio: !1, video: !1, auxiliary: !1, smallVideo: !1 };
              return (
                this.remoteVideoTrack.isSubscribed &&
                  (8 & this.remoteVideoTrack.mediaType
                    ? (e.smallVideo = !0)
                    : (e.video = !0)),
                this.remoteAudioTrack.isSubscribed && (e.audio = !0),
                this.remoteAuxiliaryTrack.isSubscribed && (e.auxiliary = !0),
                e
              );
            }
            get muteState() {
              return IO(this.flag, this.userId);
            }
            get flag() {
              return this._flag;
            }
            set flag(e) {
              var t, i, n;
              e !== this._flag &&
                ((this._flag = e),
                null == (t = this.remoteAudioTrack) || t.onFlagChanged(),
                null == (i = this.remoteVideoTrack) || i.onFlagChanged(),
                null == (n = this.remoteAuxiliaryTrack) || n.onFlagChanged());
            }
            get hasMainStream() {
              return (
                this.muteState.hasAudio ||
                this.muteState.hasVideo ||
                this.muteState.hasSmall
              );
            }
            get hasAuxStream() {
              return this.muteState.hasAuxiliary;
            }
            get isMainStreamSubscribed() {
              return (
                (this.subscribeState.audio ||
                  this.subscribeState.video ||
                  this.subscribeState.smallVideo) &&
                (this.muteState.hasAudio ||
                  this.muteState.hasVideo ||
                  this.muteState.hasSmall)
              );
            }
            get isAuxStreamSubscribed() {
              return (
                this.subscribeState.auxiliary && this.muteState.hasAuxiliary
              );
            }
            get isSmallStreamSubscribed() {
              return this.subscribeState.smallVideo && this.muteState.hasSmall;
            }
            get isBigStreamSubscribed() {
              return this.subscribeState.video && this.muteState.hasVideo;
            }
            isStreamUnpublished(e) {
              return e === LN.MAIN
                ? !this.muteState.hasAudio && !this.muteState.hasVideo
                : !this.muteState.hasAuxiliary;
            }
            initialize() {
              this.installEvents();
            }
            close(e) {
              super.close(e),
                this.emitConnectionStateChangedEvent('DISCONNECTED'),
                this.remoteAudioTrack.close(),
                this.remoteVideoTrack.close(),
                this.remoteAuxiliaryTrack.close(),
                this.uninstallEvents(),
                this.removeDownlink();
            }
            installEvents() {
              !this.singlePC ||
                (this.listeners('track').includes(this.onTrack) ||
                  this.singlePC.on('track', this.onTrack, this),
                this.listeners('spc-reconnected').includes(
                  this.onSinglePCReconnected,
                ) ||
                  this.singlePC.on(
                    'spc-reconnected',
                    this.onSinglePCReconnected,
                    this,
                  ));
            }
            uninstallEvents() {
              !this.singlePC ||
                (this.singlePC.off('track', this.onTrack, this),
                this.singlePC.off(
                  'spc-reconnected',
                  this.onSinglePCReconnected,
                  this,
                ));
            }
            emitConnectionStateChangedEvent(e) {
              var t, i;
              let n = this._currentState,
                r = super.emitConnectionStateChangedEvent(e);
              return (
                r &&
                  n !== e &&
                  (null == (t = this.remoteVideoTrack) ||
                    t.emit('connection-state-changed', {
                      prevState: n,
                      state: e,
                    }),
                  null == (i = this.remoteAuxiliaryTrack) ||
                    i.emit('connection-state-changed', {
                      prevState: n,
                      state: e,
                    })),
                r
              );
            }
            onTrack(e) {
              let t = e.streams[0],
                { track: i } = e;
              if (t.id.split('-')[0] !== this.tinyId) return;
              let n = t.id.includes('aux') ? 'auxiliary' : 'main';
              this._log.debug('ontrack '.concat(n, ' ').concat(i.kind));
              let r = LN.AUDIO;
              i.kind === LN.VIDEO &&
                (r = n === LN.MAIN ? LN.VIDEO : LN.AUXILIARY);
              let o = this.remoteAudioTrack;
              r === LN.VIDEO
                ? (o = this.remoteVideoTrack)
                : r === LN.AUXILIARY && (o = this.remoteAuxiliaryTrack),
                o.setInputMediaStreamTrack(i);
            }
            isSubscriptionStateNotChanged(e) {
              return JSON.stringify(e) === JSON.stringify(this.subscribeState);
            }
            subscribe(e, t) {
              return ab(this, null, function* () {
                try {
                  if (this.isSubscriptionStateNotChanged(e)) return;
                  if (
                    (this._log.info('subscribe '.concat(t, ' ').concat(uU(e))),
                    this.hasSSRC)
                  ) {
                    let t = 'subscribe_change';
                    Object.values(e).find((e) => !0 === e) ||
                      (t = 'unsubscribe'),
                      yield this.sendSubscription(t, e);
                  } else yield this.doSubscribe(e);
                } catch (aN) {
                  throw this._room.isJoined && this.isStreamUnpublished(t)
                    ? (this._log.warn(
                        ''
                          .concat(aN.message, ' ')
                          .concat(JSON.stringify(this.muteState)),
                      ),
                      new gb({
                        code: mb.REMOTE_STREAM_NOT_EXIST,
                        message: 'remote user '.concat(
                          this.userId,
                          ' unpublished stream',
                        ),
                      }))
                    : aN;
                }
              });
            }
            unsubscribe(e) {
              return ab(this, arguments, function (e) {
                var t = this;
                let { remoteTracks: i, streamType: n } = e;
                return (function* () {
                  var e;
                  if (
                    ('main' === n && !t.isMainStreamSubscribed) ||
                    ('auxiliary' === n && !t.isAuxStreamSubscribed)
                  )
                    return void t._log.info(
                      ''.concat(n, ' stream already unsubscribed'),
                    );
                  let r = ZC({}, t.subscribeState);
                  i.forEach((e) => {
                    switch (e.mediaType) {
                      case 1:
                        r.audio = !1;
                        break;
                      case 4:
                        r.video = !1;
                        break;
                      case 8:
                        r.smallVideo = !1;
                        break;
                      case 2:
                        r.auxiliary = !1;
                    }
                  });
                  let o = 'subscribe_change';
                  Object.values(r).find((e) => !0 === e) || (o = 'unsubscribe'),
                    t._log.info(
                      ''
                        .concat('unsubscribe' === o ? o : 'subscribe', ' ')
                        .concat(n, ' [')
                        .concat(uU(r), ']'),
                    ),
                    'unsubscribe' === o &&
                      (null == (e = t.singlePC) ||
                        e.removeDownlinkQueue.add(t.tinyId)),
                    yield t.sendSubscription(o, r),
                    'unsubscribe' === o && (yield t.removeDownlink());
                })();
              });
            }
            sendSubscription(e) {
              let t =
                  arguments.length > 1 && void 0 !== arguments[1]
                    ? arguments[1]
                    : this.subscribeState,
                i = { srcTinyId: this.tinyId, srcUserId: this.userId },
                n = gV,
                r = aV.UNSUBSCRIBE_RESULT;
              return (
                'subscribe_change' === e &&
                  ((i = {
                    audio: t.audio,
                    bigVideo: t.video,
                    auxVideo: t.auxiliary,
                    smallVideo: t.smallVideo,
                    srcTinyId: this.tinyId,
                  }),
                  (n = TV),
                  (r = aV.SUBSCRIBE_CHANGE_RESULT)),
                this._signalChannel
                  .sendWaitForResponse({
                    command: n,
                    data: i,
                    responseCommand: r,
                    timeout: 1e4,
                  })
                  .then((t) => {
                    let { data: i } = t;
                    if (0 !== i.code) {
                      let t = new gb({
                        code: i.code,
                        message: QO({
                          key: KO.ERROR_MESSAGE,
                          data: { type: e, message: i.message },
                        }),
                      });
                      throw (this._log.error(t), t);
                    }
                  })
              );
            }
            getMainStreamVideoTrackId() {
              return this.remoteVideoTrack && this.remoteVideoTrack.mediaTrack
                ? this.remoteVideoTrack.mediaTrack.id
                : '';
            }
            getAuxStreamVideoTrackId() {
              return this.remoteAuxiliaryTrack &&
                this.remoteAuxiliaryTrack.mediaTrack
                ? this.remoteAuxiliaryTrack.mediaTrack.id
                : '';
            }
            setDelay(e) {
              let { audioDelay: t, videoDelay: i } = e;
              (this.remoteAudioTrack.stat.end2EndDelay = t),
                (this.remoteVideoTrack.stat.end2EndDelay = i);
            }
            onSinglePCReconnected() {
              (this.ssrc.audio || this.ssrc.video || this.ssrc.auxiliary) &&
                (this._log.warn(
                  'resubscribe '.concat(JSON.stringify(this.subscribeState)),
                ),
                this.doSubscribe(this.subscribeState, !1));
            }
            get hasSSRC() {
              return this.ssrc.audio && this.ssrc.video && this.ssrc.auxiliary;
            }
            doSubscribe() {
              return ab(this, arguments, function () {
                var e = this;
                let t =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : this.subscribeState,
                  i =
                    !(arguments.length > 1 && void 0 !== arguments[1]) ||
                    arguments[1];
                return (function* () {
                  if (e.singlePC) {
                    if (
                      (e.singlePC.addDownlinkQueue.add(e.tinyId),
                      yield e.singlePC.waitForPeerConnectionConnected(),
                      i || !e.hasSSRC)
                    ) {
                      let i = {
                          audioSsrc: aU(),
                          bigVideoSsrc: aU(),
                          bigVideoRtxSsrc: aU(),
                          auxVideoSsrc: aU(),
                          auxVideoRtxSsrc: aU(),
                        },
                        {
                          audioSsrc: r,
                          bigVideoSsrc: o,
                          bigVideoRtxSsrc: s,
                          auxVideoSsrc: a,
                          auxVideoRtxSsrc: c,
                        } = i;
                      (e.ssrc = {
                        audio: r,
                        video: o,
                        videoRtx: s,
                        auxiliary: a,
                        auxiliaryRtx: c,
                      }),
                        e.singlePC.addDownlinkQueue.delete(e.tinyId),
                        yield e.singlePC.addDownlink({
                          userId: e.userId,
                          tinyId: e.tinyId,
                          ssrc: e.ssrc,
                        });
                      try {
                        let n =
                          yield e._signalChannel.sendWaitForResponseWithRetry({
                            command: OV,
                            responseCommand: aV.SPC_SUBSCRIBE_RESULT,
                            data: {
                              srcUserId: e.userId,
                              srcTinyId: e.tinyId,
                              audio: t.audio,
                              bigVideo: t.video,
                              auxVideo: t.auxiliary,
                              smallVideo: t.smallVideo,
                              customData: !1,
                              ssrc: i,
                            },
                            retries: 3,
                            retryTimeout: 0,
                          });
                        if (0 !== n.data.code)
                          throw new gb({
                            code: n.data.code,
                            message: n.data.message,
                          });
                      } catch (n) {
                        throw (yield e.removeDownlink(), n);
                      }
                      return;
                    }
                    e.singlePC.addDownlinkQueue.delete(e.tinyId),
                      yield e.singlePC.addDownlink({
                        userId: e.userId,
                        tinyId: e.tinyId,
                        ssrc: e.ssrc,
                      });
                  }
                })();
              });
            }
            removeDownlink() {
              return ab(this, null, function* () {
                !this.singlePC ||
                  ((this.ssrc = {
                    audio: 0,
                    video: 0,
                    videoRtx: 0,
                    auxiliary: 0,
                    auxiliaryRtx: 0,
                  }),
                  this.singlePC.removeDownlinkQueue.delete(this.tinyId),
                  yield this.singlePC.removeDownlink(this.tinyId, this.userId));
              });
            }
          };
          rb(
            [
              rL(
                (e) =>
                  function () {
                    for (
                      var t = arguments.length, i = new Array(t), n = 0;
                      n < t;
                      n++
                    )
                      i[n] = arguments[n];
                    return new Promise((t, n) => {
                      let r = (e) => {
                        this.off('closed', r),
                          n(
                            new gb({
                              code: mb.API_CALL_ABORTED,
                              message: QO({
                                key: KO.CONNECTION_ABORTED,
                                data: e,
                              }),
                            }),
                          );
                      };
                      this.on('closed', r),
                        e
                          .apply(this, i)
                          .then(t, n)
                          .finally(() => {
                            this.off('closed', r);
                          });
                    });
                  },
              ),
            ],
            hU.prototype,
            'subscribe',
            1,
          );
          var pU = hU;
          var {
              isString: _U,
              isPlainObject: mU,
              isUndefined: fU,
              getNetworkType: gU,
              getTerminalType: TU,
              isEmpty: EU,
            } = Ib,
            SU = class extends Wx {
              constructor(e) {
                super(e),
                  (this._heartbeat = -1),
                  (this._lastHeartBeatTime = -1),
                  (this._joinTimeout = -1),
                  (this._firstPublishedList = null),
                  (this._joinReject = null),
                  (this._isRelayChanged = !1),
                  (this._signalChannel = null),
                  (this.uplinkConnection = null),
                  (this.singlePC = null),
                  (this.enableSPC = yw),
                  (this._changeBigSmallRecords = new Map()),
                  (this._networkQuality = null),
                  (this._networkType = gU()),
                  (this._turnServers = []),
                  (this._syncUserListInterval = -1),
                  (this._smallStreamConfig = {
                    bitrate: 100,
                    frameRate: 15,
                    height: 120,
                    width: 160,
                  }),
                  (this.enableSEI = !1),
                  (this._enableAudioVolumeEvaluation = !1),
                  (this._audioVolumeIntervalId = 0),
                  (this._enableMultiAuxStream = !1),
                  (this._pureAudioPushMode = !1),
                  (this.enableHWEncoder = !1),
                  (this._stats = new px(this, this._log)),
                  (this.userManager = new $L(this.userId, this._log)),
                  (this._version = rN),
                  (this.sdpSemantics = pD),
                  fU(e.sdpSemantics)
                    ? JO.isUnifiedPlanDefault() && (this.sdpSemantics = hD)
                    : (this.sdpSemantics = e.sdpSemantics),
                  this._log.info(
                    'sdpSemantics: '
                      .concat(this.sdpSemantics, ', netType: ')
                      .concat(this._networkType),
                  ),
                  e.iceTransportPolicy &&
                    (this._iceTransportPolicy = e.iceTransportPolicy),
                  (this._enableMultiAuxStream =
                    !fU(e.enableMultiAuxStream) && e.enableMultiAuxStream),
                  (this.enableSEI = e.enableSEI),
                  !fU(e.enableSPC) && yw && (this.enableSPC = e.enableSPC),
                  (this.enableHWEncoder = e.enableHWEncoder || !1),
                  this._initBusinessInfo(e);
              }
              get isMainStreamPublished() {
                var e;
                return !(
                  null == (e = this.uplinkConnection) ||
                  !e.isMainStreamPublished
                );
              }
              get isMainAudioPublished() {
                var e;
                return !(
                  null == (e = this.uplinkConnection) || !e.localMainAudioTrack
                );
              }
              get isAuxStreamPublished() {
                var e;
                return !(
                  null == (e = this.uplinkConnection) || !e.isAuxStreamPublished
                );
              }
              get hasAuxStream() {
                return (
                  [...this.remotePublishedUserMap.values()].findIndex(
                    (e) => e.muteState.hasAuxiliary,
                  ) >= 0
                );
              }
              get userMap() {
                return this.userManager.userMap;
              }
              get remotePublishedUserMap() {
                return this.userManager.remotePublishedUserMap;
              }
              get tinyIdToUserIdMap() {
                return new Map(
                  [...this.remotePublishedUserMap.values()].map((e) => [
                    e.tinyId,
                    e.userId,
                  ]),
                );
              }
              join(e, t, i) {
                return ab(this, null, function* () {
                  return (
                    (this.userManager.mySelfId = this.userId),
                    this.userManager.on('1', (e) => {
                      this.emit('peer-join', e);
                    }),
                    this.userManager.on('2', (e) => {
                      this.closeDownLinkConnection(e, 'remote user exitRoom'),
                        this.emit('peer-leave', e);
                    }),
                    this.userManager.on(
                      '3',
                      this.createDownlinkConnection,
                      this,
                    ),
                    this.userManager.on(
                      '5',
                      this.closeDownLinkConnection,
                      this,
                    ),
                    this.userManager.on('6', (e) => {
                      var t = ((e, t) => {
                        var i = {};
                        for (var n in e)
                          zC.call(e, n) && t.indexOf(n) < 0 && (i[n] = e[n]);
                        if (null != e && KC)
                          for (var n of KC(e))
                            t.indexOf(n) < 0 && qC.call(e, n) && (i[n] = e[n]);
                        return i;
                      })(e, []);
                      UO.emit(
                        BO.REMOTE_PUBLISH_STATE_CHANGED,
                        ZC({ room: this }, t),
                      ),
                        this.emit('remote-publish-state-changed', ZC({}, t));
                    }),
                    (this._joinOptions = e),
                    new Promise((t, i) =>
                      ab(this, null, function* () {
                        this._joinReject = i;
                        try {
                          this.checkDestroy();
                          let i = yield this.initialize();
                          yield this.doJoin(e, i),
                            t(),
                            this._firstPublishedList &&
                              this.onPublishedUserList({
                                data: { userList: this._firstPublishedList },
                              });
                        } catch (n) {
                          i(n);
                        }
                        this._joinReject = null;
                      }),
                    )
                  );
                });
              }
              doJoin(e) {
                return new Promise((t, i) =>
                  ab(this, null, function* () {
                    var n, r, o;
                    let s;
                    if (
                      (e.privateMapKey &&
                        (this.privateMapKey = e.privateMapKey),
                      this._signalChannel.once(tV, (e) => {
                        this.clearJoinTimeout(),
                          UO.emit(BO.JOIN_SIGNAL_CONNECTION_END, {
                            room: this,
                            error: e,
                          }),
                          i(e);
                      }),
                      sO(
                        null ==
                          (r =
                            null == (n = this.scheduleResult)
                              ? void 0
                              : n.config)
                          ? void 0
                          : r.singlePC,
                      ) &&
                        yw &&
                        (this.enableSPC = this.scheduleResult.config.singlePC),
                      this.enableSPC && !this.singlePC)
                    ) {
                      (this.singlePC = new nU({
                        signalChannel: this._signalChannel,
                        room: this,
                        enableCustomMessage: !1,
                      })),
                        this.singlePC.on('sei-message', (e) =>
                          this.emit('sei-message', e),
                        ),
                        this.singlePC.once('error', () => this.fallbackToMPC());
                      try {
                        s = yield this.singlePC.initialize();
                      } catch (l) {
                        this.fallbackToMPC();
                      }
                    }
                    this.keyPointManager.setConnectionType(
                      this.singlePC ? 1 : 2,
                    );
                    let a = {
                      roomId: String(e.roomId || e.strRoomId),
                      useStringRoomId: this.useStringRoomId,
                      privateMapKey: this.privateMapKey,
                      trtcRole: e.role,
                      trtcScene: 'live' === this.scene ? 2 : 1,
                      sdpSemantics: this.sdpSemantics,
                      version: this._version,
                      ua: (navigator && navigator.userAgent) || '',
                      terminalType: TU(),
                      netType: kN[this._networkType],
                      bussinessInfo: this._businessInfo,
                      ability: s,
                      sdkType: this._sdkType,
                      userSig: this.userSig,
                    };
                    this._log.debug(
                      'join room signal data: '.concat(JSON.stringify(a)),
                    );
                    let c = 5e3;
                    (null == (o = this.scheduleResult.config)
                      ? void 0
                      : o.enterRoomTimeout) &&
                      this.scheduleResult.config.enterRoomTimeout >= 1 &&
                      (c = 1e3 * this.scheduleResult.config.enterRoomTimeout),
                      (this._joinTimeout = window.setTimeout(() => {
                        i(
                          new gb({
                            code: mb.JOIN_ROOM_FAILED,
                            message: QO({ key: KO.JOIN_ROOM_TIMEOUT }),
                          }),
                        );
                      }, c)),
                      UO.emit(BO.JOIN_SEND_CMD, { room: this }),
                      this._signalChannel.send(this.singlePC ? NV : lV, a),
                      this._signalChannel.once(aV.JOIN_ROOM_RESULT, (e) => {
                        this.clearJoinTimeout();
                        let {
                          code: n,
                          message: r,
                          data: o,
                          tinyId: s,
                        } = e.data;
                        UO.emit(BO.JOIN_RECEIVED_CMD_RES, {
                          room: this,
                          code: n,
                        }),
                          0 === n
                            ? (this._log.info(
                                'Join room success, start heartbeat',
                              ),
                              s && (this.tinyId = s),
                              this.startHeartbeat(),
                              this.syncUserList(),
                              this.startSyncUserListInterval(),
                              (this._firstPublishedList = o.publishers),
                              this.singlePC &&
                                this.singlePC
                                  .connect(o.ability)
                                  .catch(() => {}),
                              t())
                            : (this._log.error(
                                'Join room failed result: '
                                  .concat(n, ' error: ')
                                  .concat(r),
                              ),
                              i(
                                new gb({
                                  code: mb.JOIN_ROOM_FAILED,
                                  extraCode: n,
                                  message: QO({
                                    key: KO.JOIN_ROOM_FAILED,
                                    data: { error: r, code: n },
                                  }),
                                }),
                              ));
                      });
                  }),
                );
              }
              reJoin() {
                let e =
                  !(arguments.length > 0 && void 0 !== arguments[0]) ||
                  arguments[0];
                return ab(this, null, function* () {
                  if (this.isJoined)
                    try {
                      if (
                        (this._log.warn(
                          'reJoin pending: '.concat(this._joinOptions.roomId),
                        ),
                        this.singlePC &&
                          (this.singlePC.close(), (this.singlePC = null)),
                        this._signalChannel &&
                          ((this._signalChannel.race = e),
                          this._signalChannel.close(),
                          yield this._signalChannel.connect()),
                        yield this.doJoin(
                          eb(ZC({}, this._joinOptions), {
                            role: 'anchor' === this.role ? 20 : 21,
                            privateMapKey: this.privateMapKey,
                          }),
                        ),
                        this._log.warn('reJoin success'),
                        Xw.logSuccessEvent({
                          userId: this.userId,
                          eventType: cD.REJOIN,
                        }),
                        this.singlePC)
                      ) {
                        let e = (t) => {
                          var i;
                          'CONNECTED' === t.state &&
                            (null == (i = this.singlePC) ||
                              i.off($x.CONNECTION_STATE_CHANGED, e),
                            this.uplinkConnection instanceof dU &&
                              this.uplinkConnection.onSinglePCReconnected(),
                            this.remotePublishedUserMap.forEach((e) => {
                              e.installEvents(), e.doSubscribe();
                            }));
                        };
                        this.singlePC.on($x.CONNECTION_STATE_CHANGED, e),
                          this.checkConnectionsToReconnect(),
                          this.uplinkConnection instanceof hx &&
                            !this.uplinkConnection.getIsReconnecting() &&
                            this.uplinkConnection.startReconnection();
                      }
                    } catch (sD) {
                      this._log.warn('reJoin fail '.concat(sD)),
                        this.reset(),
                        Xw.logFailedEvent({
                          userId: this.userId,
                          eventType: cD.REJOIN,
                          error: sD,
                        }),
                        this.emit(
                          'error',
                          new gb({
                            code: mb.JOIN_ROOM_FAILED,
                            message: QO({
                              key: KO.REJOIN_ROOM_FAILED,
                              data: { roomId: this._joinOptions.roomId },
                            }),
                          }),
                        );
                    }
                  else this._log.warn('reJoin abort');
                });
              }
              initialize() {
                return ab(this, null, function* () {
                  let { mainUrl: e, backupUrl: t } = this.getSignalChannelUrl(),
                    i =
                      this._signalChannel ||
                      (function (e) {
                        let t = [...KV.values()].find(
                          (t) => t.room.userId === e && !t.room.isJoined,
                        );
                        return t || null;
                      })(this.userId),
                    n = !!(i && i.isConnected && i.keepAlive);
                  return (
                    this._log.info(
                      ''.concat(n ? 'reuse' : 'setup', ' signal channel'),
                    ),
                    n
                      ? ((i.url = e),
                        (i.backupUrl = t),
                        (i.room = this),
                        (this._signalChannel = i))
                      : (this._signalChannel = new YV({
                          sdkAppId: this.sdkAppId,
                          userId: this.userId,
                          userSig: this.userSig,
                          url: e,
                          backupUrl: t,
                          room: this,
                        })),
                    this._networkQuality ||
                      ((this._networkQuality = new fx({
                        signalChannel: this._signalChannel,
                        room: this,
                      })),
                      this._networkQuality.on(fx.EVENT_NETWORK_QUALITY, (e) => {
                        this.emit('network-quality', e);
                      })),
                    IP(this, this._signalChannel)
                      .add(iV, (e) => {
                        UO.emit(
                          BO.SIGNAL_CONNECTION_STATE_CHANGED,
                          ZC({ room: this }, e),
                        ),
                          this.emit('signal-connection-state-changed', e);
                      })
                      .add(rV, (e) => {
                        this.reset(), this.emit('error', e);
                      })
                      .add(aV.PEER_JOIN, (e) => {
                        let { srcTinyId: t, userId: i, role: n } = e.data.data;
                        this.userManager.addUser({
                          userId: i,
                          tinyId: t,
                          role: n,
                        });
                      })
                      .add(aV.PEER_LEAVE, (e) => {
                        let { userId: t, reason: i = 0 } = e.data.data;
                        this.userManager.deleteUser(t, i);
                      })
                      .add(aV.UPDATE_REMOTE_MUTE_STAT, (e) => {
                        this._lastHeartBeatTime > 0 &&
                          Date.now() - this._lastHeartBeatTime >= 1e4 &&
                          this.doHeartbeat(),
                          this.onPublishedUserList(e.data);
                      })
                      .add(aV.CLIENT_BANNED, (e) => {
                        let t = e.data.data,
                          { reason: i } = t;
                        if (
                          (Xw.uploadEvent({
                            log: 'stat-banned:'.concat(i),
                            userId: this.userId,
                          }),
                          'user_time_out' === i)
                        )
                          return (
                            this._log.warn(
                              ''
                                .concat(i, ' last heart beat time: ')
                                .concat(this._lastHeartBeatTime, ' interval: ')
                                .concat(
                                  Date.now() - this._lastHeartBeatTime,
                                  ', visibility: ',
                                )
                                .concat(document.visibilityState),
                            ),
                            void this.reJoin()
                          );
                        this._log['kick' === i ? 'error' : 'info'](
                          'user was banned because of ['.concat(i, ']'),
                        ),
                          this.reset(),
                          this.emit('banned', { reason: i });
                      }),
                    this._signalChannel.once(eV, (e) => {
                      (this.tinyId = e.signalInfo.tinyId),
                        UO.emit(BO.JOIN_SIGNAL_CONNECTION_END, { room: this });
                    }),
                    UO.emit(BO.JOIN_SIGNAL_CONNECTION_START, { room: this }),
                    yield this._signalChannel.connect(),
                    n
                  );
                });
              }
              setSignalChannel(e) {
                (this._signalChannel = e), e || vP(this);
              }
              leave() {
                return ab(this, null, function* () {
                  var e;
                  try {
                    yield this.doHeartbeat();
                  } catch (sD) {}
                  this._log.info('leave() => leaving room'),
                    UO.emit(BO.LEAVE_SEND_CMD, { room: this }),
                    null == (e = this._signalChannel) || e.send(dV);
                });
              }
              clearNetworkQuality() {
                this._networkQuality &&
                  (this._networkQuality.stop(), (this._networkQuality = null));
              }
              closeConnections() {
                this.remotePublishedUserMap.forEach((e) => {
                  this.closeDownLinkConnection(e.userId, 'you exitRoom');
                });
              }
              clearJoinTimeout() {
                clearTimeout(this._joinTimeout), (this._joinTimeout = -1);
              }
              startHeartbeat() {
                -1 === this._heartbeat &&
                  (this._heartbeat = qw.run(wD, this.doHeartbeat.bind(this), {
                    delay: 2e3,
                  }));
              }
              stopHeartbeat() {
                -1 !== this._heartbeat &&
                  (this._log.info('stopHeartbeat'),
                  qw.clearTask(this._heartbeat),
                  (this._heartbeat = -1),
                  (this._lastHeartBeatTime = -1));
              }
              doHeartbeat() {
                return ab(this, null, function* () {
                  var e;
                  let t = this.badCaseDetector.getMonitorFreeze(),
                    i = yield this._stats.getStatsReport({
                      uplinkConnection: this.uplinkConnection,
                      downlinkConnections: this.remotePublishedUserMap,
                      freezeMap: t,
                    });
                  if (
                    (this.badCaseDetector.resetMonitor(),
                    null == (e = this._signalChannel) || !e.isConnected)
                  )
                    return;
                  let n = this._signalChannel.isConnected
                      ? (function (e) {
                          if (qL.has(e)) {
                            let t = qL.get(e).map((e) => ({
                              uint32_event_id: e.eventId,
                              uint64_date: e.timestamp,
                              str_userid: e.remoteUserId,
                              str_event_json: e.eventDesc,
                            }));
                            return qL.delete(e), t;
                          }
                          return [];
                        })(this.userId)
                      : [],
                    r = ZC(
                      {
                        str_sdk_version: nN,
                        uint64_datetime: new Date().getTime(),
                        msg_user_info: {
                          str_identifier: this.userId,
                          uint64_tinyid: this.tinyId,
                        },
                        msg_device_info: {
                          uint32_terminal_type: 15,
                          str_device_name: navigator.platform,
                          str_os_version: '',
                          uint32_net_type: kN[this._networkType],
                        },
                        msg_event_msg: n,
                        str_acc_ip: this.getSignalInfo().relayIp,
                        str_client_ip: this.getSignalInfo().clientIp,
                      },
                      i,
                    );
                  UO.emit(BO.HEARTBEAT_REPORT, { room: this, report: r }),
                    this._signalChannel.send(uV, r),
                    this.emit(
                      'heartbeat-report',
                      eb(ZC({}, r), {
                        bytes_sent:
                          this._stats.totalBytesSent +
                          this._signalChannel.bytesSent,
                        bytes_received:
                          this._stats.totalBytesReceived +
                          this._signalChannel.bytesReceived,
                      }),
                    );
                  let o = Date.now();
                  this._lastHeartBeatTime > 0 &&
                    o - this._lastHeartBeatTime > 1e4 &&
                    this._log.warn(
                      'heartbeat took '.concat(o - this._lastHeartBeatTime),
                    ),
                    this._signalChannel.isConnected &&
                      (this._lastHeartBeatTime = o),
                    !this._isRelayChanged &&
                      this.isRelayMaybeFailed() &&
                      (this.reJoin(), (this._isRelayChanged = !0));
                });
              }
              onPublishedUserList(e) {
                if (!this.isJoined) return;
                let t = e.data.userList.map((e) => {
                  let { userId: t, srcTinyId: i, flag: n } = e,
                    r = this.remotePublishedUserMap.get(t);
                  return (
                    r && this.checkSubscribeBigSmallVideo(r),
                    { userId: t, tinyId: i, flag: n }
                  );
                });
                UO.emit(BO.RECEIVED_PUBLISHED_USER_LIST, {
                  room: this,
                  publishedUserList: t,
                }),
                  this.userManager.setRemotePublishedUserList(t);
              }
              closeUplink() {
                let e =
                  arguments.length > 0 && void 0 !== arguments[0]
                    ? arguments[0]
                    : 'you unpublished';
                this.uplinkConnection &&
                  (this.localTracks.size > 0 &&
                    this.uplinkConnection.doUnpublish(),
                  this.uplinkConnection.close(e),
                  (this.uplinkConnection = null)),
                  this.localTracks.forEach((e) => e.unpublish()),
                  this.localTracks.clear();
              }
              createDownlinkConnection(e) {
                let { userId: t, tinyId: i, flag: n } = e,
                  r = new (this.singlePC ? pU : cx)({
                    userId: t,
                    tinyId: i,
                    room: this,
                    signalChannel: this._signalChannel,
                    enableSEI: this.enableSEI,
                    flag: n,
                  });
                this.userManager.addRemotePublishedUser(r),
                  this.installDownlinkEvents(r, t),
                  this.emit('remote-published', r);
              }
              closeDownLinkConnection(e) {
                let t =
                    arguments.length > 1 && void 0 !== arguments[1]
                      ? arguments[1]
                      : 'remote user unpublished',
                  i = this.remotePublishedUserMap.get(e);
                i && (i.close(t), this.emit('remote-unpublished', i));
              }
              installDownlinkEvents(e, t) {
                e.on('error', (e) => {
                  let i = e.getCode();
                  i !== mb.ICE_TRANSPORT_ERROR &&
                    (i === mb.DOWNLINK_RECONNECTION_FAILED &&
                      this.closeDownLinkConnection(t),
                    this.emit('error', e));
                }),
                  e.on('connection-state-changed', (t) => {
                    this.emit(
                      'media-connection-state-changed',
                      eb(ZC({}, t), { userId: e.userId }),
                    );
                  }),
                  e.on('firewall-restriction', () => {
                    this.emit('firewall-restriction');
                  });
              }
              startSyncUserListInterval() {
                -1 === this._syncUserListInterval &&
                  (this._syncUserListInterval = qw.run(
                    wD,
                    this.syncUserList.bind(this),
                  ));
              }
              stopSyncUserListInterval() {
                qw.clearTask(this._syncUserListInterval),
                  (this._syncUserListInterval = -1);
              }
              syncUserList() {
                return this.getUserList()
                  .then((e) => {
                    this.userManager.setUserList(e);
                  })
                  .catch((e) => {
                    this._log.debug('sync user list failed: '.concat(e));
                  });
              }
              getUserList() {
                var e;
                return null != (e = this._signalChannel) && e.isConnected
                  ? this._signalChannel
                      .sendWaitForResponse({
                        command: RV,
                        responseCommand: aV.USER_LIST_RES,
                        enableLog: !1,
                        timeout: 2e3,
                      })
                      .then((e) => {
                        let { data: t } = e,
                          { code: i, message: n } = t;
                        if (0 === i)
                          return ((t.data && t.data.userList) || []).map(
                            (e) => {
                              let { userId: t, srcTinyId: i, role: n } = e;
                              return { userId: t, tinyId: i, role: n };
                            },
                          );
                        throw QO({
                          key: KO.SIGNAL_RESPONSE_FAILED,
                          data: {
                            signalResponse: aV.USER_LIST_RES,
                            code: i,
                            message: n,
                          },
                        });
                      })
                  : Promise.reject('not connected');
              }
              getAllConnections() {
                let e = [...this.remotePublishedUserMap.values()];
                return (
                  this.uplinkConnection && e.push(this.uplinkConnection), e
                );
              }
              isRelayMaybeFailed() {
                if (
                  (this._signalChannel && !this._signalChannel.isOnline) ||
                  !ex
                )
                  return !1;
                if (this.singlePC) return this.singlePC.reconnectionCount > 6;
                let e = this.getAllConnections();
                if (0 === e.length) return !1;
                for (let t = 0; t < e.length; t++)
                  if (e[t].getReconnectionCount() < 6) return !1;
                return !0;
              }
              checkConnectionsToReconnect() {
                this.singlePC ||
                  this.getAllConnections().forEach((e) => {
                    if (e instanceof tx && !e.getIsReconnecting()) {
                      let t = e.getPeerConnection();
                      t &&
                        t.connectionState === iD.CLOSED &&
                        (this._log.warn(
                          '['.concat(
                            e.getUserId(),
                            '] pc is closed but not reconnect',
                          ),
                        ),
                        e.startReconnection());
                    }
                  });
              }
              fallbackToMPC() {
                return ab(this, null, function* () {
                  var e;
                  if (
                    (this._log.warn('fallback to multi pc'),
                    Xw.uploadEvent({
                      log: 'stat-fallback',
                      userId: this.userId,
                    }),
                    (this.enableSPC = !1),
                    null == (e = this.singlePC) || e.close(),
                    (this.singlePC = null),
                    yield this.reJoin(!1),
                    this.uplinkConnection)
                  ) {
                    let e = this.uplinkConnection;
                    (this.uplinkConnection = new hx({
                      userId: this.userId,
                      tinyId: this.tinyId,
                      room: this,
                      signalChannel: this._signalChannel,
                      enableSEI: this.enableSEI,
                      audioManager: this.audioManager,
                    })),
                      e.isMainStreamPublished &&
                        (yield this.uplinkConnection.publish({
                          localAudioTrack: e.localMainAudioTrack,
                          localVideoTrack: e.localMainVideoTrack,
                          isAuxiliary: !1,
                        })),
                      e.isAuxStreamPublished &&
                        (yield this.uplinkConnection.publish({
                          localAudioTrack: e.localAuxAudioTrack,
                          localVideoTrack: e.localAuxVideoTrack,
                          isAuxiliary: !0,
                        }));
                  }
                  this.remotePublishedUserMap.forEach((e) => {
                    let t = new cx({
                      userId: e.userId,
                      tinyId: e.tinyId,
                      room: this,
                      signalChannel: this._signalChannel,
                      enableSEI: this.enableSEI,
                      flag: e.flag,
                      remoteAudioTrack: e.remoteAudioTrack,
                      remoteVideoTrack: e.remoteVideoTrack,
                      remoteAuxiliaryTrack: e.remoteAuxiliaryTrack,
                    });
                    this.installDownlinkEvents(t, e.userId),
                      this.remotePublishedUserMap.set(e.userId, t),
                      e.isMainStreamSubscribed &&
                        t.subscribe(e.subscribeState, 'main'),
                      e.isAuxStreamSubscribed &&
                        t.subscribe(e.subscribeState, 'auxiliary');
                  });
                });
              }
              destroy() {
                this.isDestroyed ||
                  (this._signalChannel &&
                    (this._log.info('destroying SignalChannel'),
                    this._signalChannel.close(),
                    (this._signalChannel = null)),
                  super.destroy(),
                  this._joinReject &&
                    (this._joinReject(
                      new gb({
                        code: mb.INVALID_OPERATION,
                        message: QO({
                          key: KO.CLIENT_DESTROYED,
                          data: { funName: 'join' },
                        }),
                      }),
                    ),
                    this.clearJoinTimeout(),
                    this.reset()),
                  this.removeAllListeners());
              }
              switchRole(e) {
                return ab(this, null, function* () {
                  this.role !== e &&
                    ('audience' === e &&
                      this.uplinkConnection &&
                      this.closeUplink('you switch role to audience'),
                    yield this.doSwitchRole(e));
                });
              }
              doSwitchRole(e) {
                let t = {
                  command: CV,
                  data: {
                    role: 'anchor' === e ? 20 : 21,
                    privateMapKey: this.privateMapKey,
                  },
                  responseCommand: aV.SWITCH_ROLE_RES,
                  retries: 1,
                };
                return (
                  this._log.info(
                    'switchRole signal data: '.concat(JSON.stringify(t.data)),
                  ),
                  this._signalChannel
                    .sendWaitForResponseWithRetry(t)
                    .then((t) => {
                      let { code: i, message: n } = t.data;
                      if (0 !== i)
                        throw new gb({
                          code: mb.SWITCH_ROLE_FAILED,
                          message: QO({
                            key: KO.SWITCH_ROLE_FAILED,
                            data: { message: n, code: i },
                          }),
                        });
                      this.role = e;
                    })
                    .catch((e) => {
                      throw (
                        (e instanceof gb &&
                          e.getCode() === mb.API_CALL_TIMEOUT &&
                          (e = new gb({
                            code: mb.SWITCH_ROLE_FAILED,
                            message: QO({ key: KO.SWITCH_ROLE_TIMEOUT }),
                          })),
                        this._log.error(e),
                        e)
                      );
                    })
                );
              }
              publish() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                return ab(this, null, function* () {
                  let e = {},
                    i = {};
                  t.forEach((t) => {
                    t instanceof uL &&
                      (t instanceof mL ? (i.audio = t) : (e.audio = t)),
                      t instanceof hL &&
                        (t instanceof _L && 2 === t.mediaType
                          ? (i.video = t)
                          : (e.video = t));
                  });
                  let n = EU(e),
                    r = EU(i);
                  (!n || !r) &&
                    !this.uplinkConnection &&
                    (this.singlePC
                      ? (this.uplinkConnection = new dU({
                          userId: this.userId,
                          tinyId: this.tinyId,
                          room: this,
                          signalChannel: this._signalChannel,
                          enableSEI: this.enableSEI,
                          audioManager: this.audioManager,
                        }))
                      : (this.uplinkConnection = new hx({
                          userId: this.userId,
                          tinyId: this.tinyId,
                          room: this,
                          signalChannel: this._signalChannel,
                          enableSEI: this.enableSEI,
                          audioManager: this.audioManager,
                        })),
                    this.uplinkConnection.on(
                      'connection-state-changed',
                      (e) => {
                        this.emit(
                          'media-connection-state-changed',
                          eb(ZC({}, e), { userId: this.userId }),
                        );
                      },
                    ),
                    this.uplinkConnection.on('firewall-restriction', () => {
                      this.emit('firewall-restriction');
                    }),
                    this.uplinkConnection.on('error', (e) => {
                      let t = e.getCode();
                      t !== mb.ICE_TRANSPORT_ERROR &&
                        (t === mb.UPLINK_RECONNECTION_FAILED &&
                          this.closeUplink(),
                        this.emit('error', e));
                    }));
                  let o = t.map((e) => e.kind).join(',');
                  n ||
                    (this._log.info('publish() => main '.concat(o)),
                    yield this.uplinkConnection.publish({
                      localAudioTrack: e.audio,
                      localVideoTrack: e.video,
                      isAuxiliary: !1,
                    }),
                    this._log.info('main is published')),
                    r ||
                      (this._log.info('publish() => aux '.concat(o)),
                      yield this.uplinkConnection.publish({
                        localAudioTrack: i.audio,
                        localVideoTrack: i.video,
                        isAuxiliary: !0,
                      }),
                      this._log.info('aux is published'));
                });
              }
              unpublish() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                return ab(this, null, function* () {
                  if (
                    ('live' === this.scene && 'anchor' !== this.role) ||
                    (!this.isMainStreamPublished &&
                      !this.isAuxStreamPublished) ||
                    !this.uplinkConnection
                  )
                    return;
                  let e = {},
                    i = {};
                  t.forEach((t) => {
                    !t.mediaTrack ||
                      !t.isPublished ||
                      (t instanceof uL &&
                        (t instanceof mL ? (i.audio = t) : (e.audio = t)),
                      t instanceof hL &&
                        (t instanceof _L && 2 === t.mediaType
                          ? (i.video = t)
                          : (e.video = t)));
                  });
                  try {
                    let n = t.map((e) => e.kind).join(',');
                    EU(e) ||
                      (this._log.info('unpublish() => main '.concat(n)),
                      yield this.uplinkConnection.unpublish({
                        localAudioTrack: e.audio,
                        localVideoTrack: e.video,
                      })),
                      EU(i) ||
                        (this._log.info('unpublish() => aux '.concat(n)),
                        yield this.uplinkConnection.unpublish({
                          localAudioTrack: i.audio,
                          localVideoTrack: i.video,
                        }));
                  } catch (n) {}
                  0 === this.localTracks.size &&
                    !this.audioManager.mixedAudioTrack &&
                    this.closeUplink('you unpublished');
                });
              }
              addTrack(e) {
                if (!this.uplinkConnection || !e.mediaTrack)
                  return Promise.resolve();
                let t = this.uplinkConnection.addTrack(e);
                return e.publish(this, t), t;
              }
              removeTrack(e) {
                return this.uplinkConnection && e.mediaTrack
                  ? this.uplinkConnection
                      .removeTrack(e)
                      .then((t) => (e.unpublish(), t))
                  : Promise.resolve();
              }
              replaceTrack(e) {
                return this.uplinkConnection && e.mediaTrack
                  ? this.uplinkConnection.replaceTrack(e).then((t) => {
                      UO.emit(BO.LOCAL_TRACK_REPLACED, { track: e });
                    })
                  : Promise.resolve();
              }
              setBandWidth(e) {
                return ab(this, null, function* () {
                  !this.uplinkConnection ||
                    (yield this.uplinkConnection.setBandwidth(e),
                    yield this.uplinkConnection.sendMediaSettings());
                });
              }
              enableSmall(e) {
                return ab(this, null, function* () {
                  if (
                    !this.uplinkConnection ||
                    !this.uplinkConnection.localMainVideoTrack
                  )
                    return Promise.resolve();
                  e &&
                    this.uplinkConnection.localMainVideoTrack.small &&
                    (yield this.setBandWidth({
                      type: LN.VIDEO,
                      videoType: LN.SMALL,
                      bandwidth:
                        this.uplinkConnection.localMainVideoTrack.small.bitrate,
                    })),
                    yield this.uplinkConnection.enableSmall(e);
                });
              }
              subscribe() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                return ab(this, null, function* () {
                  if (((t = t.filter((e) => !e.isSubscribed)), 0 === t.length))
                    return;
                  let { userId: e } = t[0],
                    i = this.remotePublishedUserMap.get(e);
                  if (!i) return;
                  let n = t.find((e) => 2 === e.mediaType)
                    ? 'auxiliary'
                    : 'main';
                  try {
                    let r = ZC({}, i.subscribeState);
                    t.forEach((e) => {
                      switch (e.mediaType) {
                        case 1:
                          r.audio = !0;
                          break;
                        case 4:
                          r.video = !0;
                          break;
                        case 2:
                          r.auxiliary = !0;
                      }
                    });
                    let o = this._changeBigSmallRecords.get(e);
                    o &&
                      o.options.smallVideo &&
                      i.muteState.hasSmall &&
                      r.video &&
                      ((r.video = !1), (r.smallVideo = !0)),
                      UO.emit(BO.SUBSCRIBE_START, {
                        room: this,
                        streamType: n,
                        remotePublishedUser: i,
                        subscribeState: r,
                      }),
                      this._log.info(
                        'subscribe() => '
                          .concat(e, ' ')
                          .concat(n, ' [')
                          .concat(ox(r), '] prev: [')
                          .concat(ox(i.subscribeState), ']'),
                      ),
                      yield i.subscribe(r, n);
                    for (let e of t)
                      e.mediaTrack || (yield e.waitHasMediaTrack());
                    i.remoteVideoTrack.setMediaType(r.smallVideo ? 8 : 4),
                      UO.emit(BO.SUBSCRIBE_SUCCESS, {
                        room: this,
                        streamType: n,
                        remotePublishedUser: i,
                      });
                  } catch (cN) {
                    let i = cN instanceof gb ? cN.getCode() : mb.UNKNOWN,
                      r = cN;
                    throw (
                      (cN instanceof gb
                        ? i === mb.REMOTE_STREAM_NOT_EXIST &&
                          ((r = new gb({
                            code: mb.API_CALL_ABORTED,
                            message: QO({
                              key: KO.API_CALL_ABORTED,
                              data: {
                                message: cN.message,
                                userId: e,
                                streamType: n,
                              },
                            }),
                          })),
                          this._log.warn(r))
                        : ((r = new gb({
                            code: i,
                            message: QO({
                              key: KO.SUBSCRIBE_FAILED,
                              data: {
                                message: cN.message,
                                userId: e,
                                streamType: n,
                              },
                            }),
                          })),
                          this._log.error(r)),
                      r)
                    );
                  }
                });
              }
              unsubscribe() {
                for (
                  var e = arguments.length, t = new Array(e), i = 0;
                  i < e;
                  i++
                )
                  t[i] = arguments[i];
                return ab(this, null, function* () {
                  let { userId: e } = t[0],
                    i = this.remotePublishedUserMap.get(e);
                  if (!i) return;
                  let n = t.find((e) => 2 === e.mediaType)
                    ? 'auxiliary'
                    : 'main';
                  this._log.info('unsubscribe() => '.concat(e, ' ').concat(n));
                  try {
                    yield i.unsubscribe({ remoteTracks: t, streamType: n });
                  } catch (cN) {
                    this._log.warn('unsubscribe() => failed '.concat(cN));
                  }
                  t.forEach((e) => {
                    e.unsubscribe(), 8 === e.mediaType && e.setMediaType(4);
                  }),
                    UO.emit(BO.UNSUBSCRIBE_SUCCESS, {
                      room: this,
                      streamType: n,
                      remotePublishedUser: i,
                    });
                });
              }
              setEncodedDataProcessingListener(e) {
                throw new Error('Method not implemented.');
              }
              enableAudioVolumeEvaluation() {
                let e =
                    arguments.length > 0 && void 0 !== arguments[0]
                      ? arguments[0]
                      : 2e3,
                  t = arguments.length > 1 ? arguments[1] : void 0;
                if (e <= 0)
                  return (
                    (this._enableAudioVolumeEvaluation = !1),
                    void qw.clearTask(this._audioVolumeIntervalId)
                  );
                (e = Math.floor(Math.max(e, 100))),
                  UO.emit(BO.AUDIO_LEVEL_INTERVAL, { interval: e }),
                  this._audioVolumeIntervalId &&
                    qw.clearTask(this._audioVolumeIntervalId),
                  (this._enableAudioVolumeEvaluation = !0),
                  (this._audioVolumeIntervalId = qw.run(
                    PD,
                    () => {
                      var e;
                      let t = [];
                      null == (e = this.remotePublishedUserMap) ||
                        e.forEach((e) => {
                          if (e.muteState.hasAudio) {
                            let i = Math.floor(
                              100 * e.remoteAudioTrack.getAudioLevel(),
                            );
                            t.push({ userId: e.userId, volume: i });
                          }
                        }),
                        this.emit('audio-volume', t);
                    },
                    { fps: 1e3 / e, backgroundTask: t },
                  ));
              }
              getLocalAudioStats() {
                return ab(this, null, function* () {
                  let e = {};
                  if (
                    ((e[this.userId] = { bytesSent: 0, packetsSent: 0 }),
                    this.uplinkConnection)
                  ) {
                    let t = yield this._stats.getSenderStats(
                      this.uplinkConnection,
                    );
                    e[this.userId] = {
                      bytesSent: t.audio.bytesSent,
                      packetsSent: t.audio.packetsSent,
                    };
                  }
                  return e;
                });
              }
              getLocalVideoStats() {
                return ab(this, null, function* () {
                  let e = {};
                  if (
                    ((e[this.userId] = {
                      bytesSent: 0,
                      packetsSent: 0,
                      framesEncoded: 0,
                      framesSent: 0,
                      frameWidth: 0,
                      frameHeight: 0,
                    }),
                    this.uplinkConnection)
                  ) {
                    let {
                      video: {
                        bytesSent: t,
                        packetsSent: i,
                        framesEncoded: n,
                        framesSent: r,
                        frameWidth: o,
                        frameHeight: s,
                      },
                    } = yield this._stats.getSenderStats(this.uplinkConnection);
                    e[this.userId] = {
                      bytesSent: t,
                      packetsSent: i,
                      framesEncoded: n,
                      framesSent: r,
                      frameWidth: o,
                      frameHeight: s,
                    };
                  }
                  return e;
                });
              }
              getTransportStats() {
                return ab(this, null, function* () {
                  let e = { rtt: 0, downlinksRTT: {} };
                  if (this.uplinkConnection) {
                    let t = yield this._stats.getSenderStats(
                      this.uplinkConnection,
                    );
                    e.rtt = t.rtt;
                  }
                  for (let [, t] of this.remotePublishedUserMap) {
                    let i = yield this._stats.getReceiverStats(t);
                    e.downlinksRTT[i.userId] = i.rtt;
                  }
                  return e;
                });
              }
              getRemoteVideoStats(e) {
                return ab(this, null, function* () {
                  let t = {};
                  for (let [i, n] of this.remotePublishedUserMap)
                    'main' === e &&
                      n.muteState.hasVideo &&
                      (t[i] = n.remoteVideoTrack.stat),
                      'auxiliary' === e &&
                        n.muteState.hasAuxiliary &&
                        (t[i] = n.remoteAuxiliaryTrack.stat);
                  return t;
                });
              }
              getRemoteAudioStats() {
                return ab(this, null, function* () {
                  let e = {};
                  for (let [t, i] of this.remotePublishedUserMap)
                    i.muteState.hasAudio && (e[t] = i.remoteAudioTrack.stat);
                  return e;
                });
              }
              setTurnServer(e, t) {
                this._log.info(
                  'set turn server: '
                    .concat(JSON.stringify(e), ' ')
                    .concat(t || ''),
                );
                let i = [];
                Array.isArray(e)
                  ? e.forEach((e) => i.push(Ib.getTurnServer(e)))
                  : Ib.isPlainObject(e) && i.push(Ib.getTurnServer(e)),
                  (this._turnServers = i),
                  t && (this._iceTransportPolicy = t);
              }
              sendStartMixTranscode(e) {
                return this._signalChannel.sendWaitForResponse({
                  command: yV,
                  data: e,
                  timeout: 5e3,
                  responseCommand: aV.START_MIX_TRANSCODE_RES,
                  commandDesc: 'startMixTranscode',
                });
              }
              sendStopMixTranscode(e) {
                return this._signalChannel.sendWaitForResponse({
                  command: AV,
                  data: e,
                  timeout: 5e3,
                  responseCommand: aV.STOP_MIX_TRANSCODE_RES,
                  commandDesc: 'stopMixTranscode',
                });
              }
              sendStartPublishCDN(e) {
                let t =
                  !(arguments.length > 1 && void 0 !== arguments[1]) ||
                  arguments[1];
                return this._signalChannel.sendWaitForResponse({
                  command: t ? EV : IV,
                  data: e,
                  timeout: 5e3,
                  responseCommand: t
                    ? aV.START_PUBLISH_TENCENT_CDN_RES
                    : aV.START_PUBLISH_GIVEN_CDN_RES,
                  commandDesc: 'startPublishCDN',
                });
              }
              sendStopPublishCDN(e) {
                let t =
                  !(arguments.length > 1 && void 0 !== arguments[1]) ||
                  arguments[1];
                return this._signalChannel.sendWaitForResponse({
                  command: t ? SV : vV,
                  data: e,
                  timeout: 5e3,
                  responseCommand: t
                    ? aV.STOP_PUBLISH_TENCENT_CDN_RES
                    : aV.STOP_PUBLISH_GIVEN_CDN_RES,
                  commandDesc: 'stopPublishCDN',
                });
              }
              sendAbilityStatus(e) {
                var t;
                null == (t = this._signalChannel) ||
                  t
                    .sendWaitForResponse({
                      command: wV,
                      data: e,
                      timeout: 5e3,
                      responseCommand: aV.ABILITY_STATUS_REPORT_RESULT,
                      commandDesc: 'ability status report',
                    })
                    .catch((e) => {});
              }
              getIceServers() {
                return 0 === this._turnServers.length &&
                  this.scheduleResult.iceServers
                  ? this.scheduleResult.iceServers
                  : this._turnServers;
              }
              getIceTransportPolicy() {
                return (
                  this._iceTransportPolicy ||
                  this.scheduleResult.iceTransportPolicy ||
                  'all'
                );
              }
              getLogger() {
                return this._log;
              }
              enableAIVoice() {
                throw new Error('Method not implemented.');
              }
              getSignalChannelUrl() {
                let e = { mainUrl: '', backupUrl: '' },
                  t = Ib.getEnv();
                return (
                  t
                    ? ((e.mainUrl = 'wss://'.concat(t, '.rtc.qq.com')),
                      (e.backupUrl = e.mainUrl))
                    : this.proxy_ws
                    ? ((e.mainUrl = this.proxy_ws), (e.backupUrl = e.mainUrl))
                    : Array.isArray(this.scheduleResult.domains) &&
                      this.scheduleResult.domains.length > 0 &&
                      ((e.mainUrl = 'wss://'.concat(
                        this.scheduleResult.domains[0],
                      )),
                      (e.backupUrl = e.mainUrl),
                      this.scheduleResult.domains[1] &&
                        (e.backupUrl = 'wss://'.concat(
                          this.scheduleResult.domains[1],
                        ))),
                  e
                );
              }
              getSignalInfo() {
                var e;
                return (
                  (null == (e = this._signalChannel)
                    ? void 0
                    : e.getSignalInfo()) || { clientIp: '', relayIp: '' }
                );
              }
              reset() {
                let e =
                  arguments.length > 0 &&
                  void 0 !== arguments[0] &&
                  arguments[0];
                this.stopSyncUserListInterval(),
                  this.stopHeartbeat(),
                  this.closeConnections(),
                  this.clearNetworkQuality(),
                  this.closeUplink('you exitRoom'),
                  this._signalChannel &&
                    (e &&
                    this._signalChannel.keepAlive &&
                    this._signalChannel.isConnected
                      ? this._signalChannel.stopKeepAliveIn(3600)
                      : this._signalChannel.close(),
                    this.setSignalChannel(null)),
                  this._stats.reset(),
                  this.userManager.clear(),
                  this.userManager.removeAllListeners(),
                  this.singlePC &&
                    (this.singlePC.close(), (this.singlePC = null)),
                  (this.scheduleResult = {
                    domains: null,
                    iceServers: null,
                    iceTransportPolicy: null,
                    trtcAutoConf: null,
                  });
              }
              checkSubscribeBigSmallVideo(e) {
                return ab(this, null, function* () {
                  let {
                    subscribeState: t,
                    userId: i,
                    muteState: { hasSmall: n, hasVideo: r },
                  } = e;
                  if ((!n && !r) || (!t.video && !t.smallVideo)) return;
                  let o = this._changeBigSmallRecords.get(i);
                  if (!o || o.isSubscribing || o.reSubscribeCount <= 0) return;
                  let { options: s, reSubscribeCount: a } = o;
                  if (
                    (s.video && t.video) ||
                    (s.smallVideo && t.smallVideo && n)
                  )
                    return;
                  let c = {
                    audio:
                      e.remoteAudioTrack.isSubscribed ||
                      e.remoteAudioTrack.isSubscribing,
                    auxiliary:
                      e.remoteAuxiliaryTrack.isSubscribed ||
                      e.remoteAuxiliaryTrack.isSubscribing,
                    video: s.video,
                    smallVideo: s.smallVideo,
                  };
                  try {
                    if (
                      (!n &&
                        c.smallVideo &&
                        ((c.video = !0), (c.smallVideo = !1)),
                      c.smallVideo === t.smallVideo && c.video === t.video)
                    )
                      return;
                    (o.isSubscribing = !0),
                      (o.reSubscribeCount = a - 1),
                      yield e.subscribe(c, 'main'),
                      e.remoteVideoTrack.setMediaType(c.smallVideo ? 8 : 4),
                      this._log.info(
                        'change ['
                          .concat(i, '] to ')
                          .concat(
                            c.smallVideo ? 'small' : 'big',
                            ' video successfully. count ',
                          )
                          .concat(DD - o.reSubscribeCount, '.'),
                      ),
                      (o.isSubscribing = !1),
                      (o.reSubscribeCount = DD);
                  } catch (l) {
                    this._log.info(
                      'change ['
                        .concat(i, '] to ')
                        .concat(
                          c.smallVideo ? 'small' : 'big',
                          ' video failed. count ',
                        )
                        .concat(DD - o.reSubscribeCount, '.'),
                    ),
                      (o.isSubscribing = !1),
                      0 === o.reSubscribeCount &&
                        this._changeBigSmallRecords.delete(i);
                  }
                });
              }
              changeType(e, t) {
                let i = {
                  options: { video: !e, smallVideo: e },
                  isSubscribing: !1,
                  reSubscribeCount: DD,
                };
                this._changeBigSmallRecords.set(t.userId, i),
                  this._log.info(
                    'set ['
                      .concat(t.userId, '] video prefer type: ')
                      .concat(e ? 'small' : 'big'),
                  );
              }
              get smallStreamConfig() {
                return this._smallStreamConfig;
              }
              _initBusinessInfo(e) {
                this._businessInfo = e.businessInfo;
                let t = {};
                if (
                  (_U(e.businessInfo) && (t = JSON.parse(e.businessInfo)),
                  !fU(e.pureAudioPushMode))
                ) {
                  if (!Number.isInteger(Number(e.pureAudioPushMode)))
                    throw new gb({
                      code: mb.INVALID_PARAMETER,
                      message: QO({ key: KO.INVALID_PURE_AUDIO }),
                    });
                  (this._pureAudioPushMode = e.pureAudioPushMode),
                    t.Str_uc_params || (t.Str_uc_params = {}),
                    (t.Str_uc_params.pure_audio_push_mod =
                      this._pureAudioPushMode);
                }
                if (!fU(e.userDefineRecordId)) {
                  let i = /^[A-Za-z0-9_-]{1,64}$/gi;
                  if (null === e.userDefineRecordId.match(i))
                    throw new gb({
                      code: mb.INVALID_PARAMETER,
                      message: QO({ key: KO.INVALID_USER_DEFINE_RECORDID }),
                    });
                  t.Str_uc_params || (t.Str_uc_params = {}),
                    (t.Str_uc_params.userdefine_record_id =
                      e.userDefineRecordId);
                }
                if (!fU(e.userDefinePushArgs)) {
                  if (
                    !(
                      _U(e.userDefinePushArgs) &&
                      String(e.userDefinePushArgs) &&
                      String(e.userDefinePushArgs).length <= 256
                    )
                  )
                    throw new gb({
                      code: mb.INVALID_PARAMETER,
                      message: QO({ key: KO.INVALID_USER_DEFINE_PUSH_ARGS }),
                    });
                  t.Str_uc_params || (t.Str_uc_params = {}),
                    (t.Str_uc_params.userdefine_push_args =
                      e.userDefinePushArgs);
                }
                EU(t) || (this._businessInfo = JSON.stringify(t));
              }
              sendSEI(e, t) {
                this.singlePC && this.singlePC.sendSEI(e, t);
              }
            };
          return (
            rb(
              [
                Hw(['left', Ww.INIT], 'joined'),
                MV({
                  settings: { retries: 1, timeout: 0 },
                  onError(e, t, i) {
                    this._isUsingCachedSchedule && !this.isDestroyed
                      ? (this._log.warn('is using cached schedule, retry join'),
                        FV(!0),
                        this.reset(),
                        t())
                      : this._signalChannel &&
                        this._signalChannel.isConnected &&
                        this._signalChannel.keepAlive
                      ? (this._log.warn('is using keepAlive ws, retry join'),
                        this._signalChannel.close(),
                        this.reset(),
                        t())
                      : (this.reset(), this._log.error(e), i(e));
                  },
                }),
                rL((e) => {
                  let t = new XM();
                  return function (i, n, r) {
                    return ab(this, null, function* () {
                      let o = String(i.roomId || i.strRoomId);
                      if (
                        ((this.userId = i.userId),
                        (this.sdkAppId = i.sdkAppId),
                        (this.userSig = i.userSig),
                        this._log.setSdkAppId(this.sdkAppId),
                        this._log.setUserId(this.userId),
                        (this.scene = n),
                        (i.privateMapKey = i.privateMapKey || ''),
                        this.isJoined)
                      )
                        throw new gb({
                          code: mb.INVALID_OPERATION,
                          message: QO({ key: KO.INVALID_JOIN }),
                        });
                      if (
                        (this.checkDestroy(),
                        t.isJoined({
                          userId: this.userId,
                          roomId: o,
                          sdkAppId: this.sdkAppId,
                          room: this,
                        }))
                      )
                        throw new gb({
                          code: mb.INVALID_OPERATION,
                          message: QO({
                            key: KO.REPEAT_JOIN,
                            data: this.userId,
                          }),
                        });
                      t.add({ room: this, roomId: o }),
                        (this.role = 21 === i.role ? 'audience' : 'anchor'),
                        this._log.info(
                          'Join() => joining room: '
                            .concat(o, ' useStringRoomId: ')
                            .concat(this.useStringRoomId, ' scene: ')
                            .concat(this.scene, ' role: ')
                            .concat(this.role),
                        ),
                        UO.emit(BO.JOIN_START, {
                          room: this,
                          roomId: o,
                          params: i,
                        }),
                        (this.checkSystemResult =
                          yield JO.checkSystemRequirementsInternal()),
                        this.checkDestroy();
                      let s = Ib.getEnv();
                      s ||
                        ((s = AN.QCLOUD),
                        this.proxy_ws &&
                          (this.proxy_ws.startsWith(VN.OLD_CLOUD_LADDER)
                            ? (s = AN.OLD_CLOUD_LADDER)
                            : this.proxy_ws.startsWith(VN.WEBRTC) &&
                              (s = AN.WEBRTC))),
                        Xw.setConfig({
                          env: s,
                          sdkAppId: String(this.sdkAppId),
                          userId: this.userId,
                          roomId: o,
                        }),
                        $M.call(this);
                      let {
                        isH264EncodeSupported: a,
                        isVp8EncodeSupported: c,
                      } = this.checkSystemResult.detail;
                      if (!JO.isWebRTCSupported() || (!a && !c))
                        throw new gb({
                          code: mb.NOT_SUPPORTED,
                          message: QO({ key: KO.NOT_SUPPORTED_WEBRTC }),
                        });
                      try {
                        !this.proxy_ws &&
                          !this.proxy_wt &&
                          !this.scheduleResult.domains &&
                          !Ib.getEnv() &&
                          (yield this.schedule(o, r));
                        let t = yield e.call(this, i, n, r);
                        return (
                          (this.roomId = o),
                          (this._joinedTimestamp = Ib.performanceNow()),
                          UO.emit(BO.JOIN_SUCCESS, { room: this }),
                          Xw.uploadEvent({
                            log: 'stat-conv-'
                              .concat(Number(Yk), '-')
                              .concat(location.hostname),
                            userId: this.userId,
                          }),
                          t
                        );
                      } catch (l) {
                        throw (
                          (t.delete({ room: this, roomId: o }),
                          UO.emit(BO.JOIN_FAILED, { room: this, error: l }),
                          l)
                        );
                      }
                    });
                  };
                }),
              ],
              SU.prototype,
              'join',
              1,
            ),
            rb(
              [
                Hw('joined', 'left', {
                  ignoreError: !0,
                  success() {
                    this.reset(!0);
                  },
                }),
                rL(
                  (e) =>
                    function () {
                      return ab(this, null, function* () {
                        UO.emit(BO.LEAVE_START, { room: this }),
                          yield e.call(this),
                          UO.emit(BO.LEAVE_SUCCESS, {
                            room: this,
                            roomId: this.roomId,
                          });
                      });
                    },
                ),
                (function (e) {
                  return function (t, i, n) {
                    let r = n.value;
                    return (
                      (n.value = function () {
                        var t, i;
                        let n = [];
                        for (
                          var o = arguments.length, s = new Array(o), a = 0;
                          a < o;
                          a++
                        )
                          s[a] = arguments[a];
                        return (
                          null == (t = oL.get(this)) ||
                            t.forEach((e) => n.push(e)),
                          null == (i = sL.get(this)) ||
                            i.forEach((e) => e.forEach((e) => n.push(e))),
                          n.forEach((t) => {
                            t.reject(
                              new gb({ code: mb.API_CALL_ABORTED, message: e }),
                            );
                          }),
                          oL.delete(this),
                          sL.delete(this),
                          r.apply(this, s)
                        );
                      }),
                      n
                    );
                  };
                })('leave room'),
                VV({ fnName: 'publish', validateArgs: !1 }),
                VV({ fnName: 'unsubscribe', validateArgs: !1 }),
              ],
              SU.prototype,
              'leave',
              1,
            ),
            rb(
              [
                aL(),
                rL(
                  (e) =>
                    function () {
                      for (
                        var t = arguments.length, i = new Array(t), n = 0;
                        n < t;
                        n++
                      )
                        i[n] = arguments[n];
                      return ab(this, null, function* () {
                        if (
                          ('live' === this.scene && 'anchor' !== this.role) ||
                          ((i = i.filter(
                            (e) => e.outMediaTrack && 'capture' === e.state,
                          )),
                          !i.length)
                        )
                          return;
                        UO.emit('61', { room: this }),
                          i.forEach((e) => {
                            'audio' === e.kind &&
                              this.audioManager.addAudioTrack(e);
                          });
                        let t = e.apply(this, i);
                        return (
                          i.forEach((e) => {
                            var i;
                            e.publish(this, t),
                              'audio' === e.kind &&
                                (null ==
                                  (i = this.audioManager.localMixAudioTrack) ||
                                  i.publish(this, t));
                          }),
                          t
                        );
                      });
                    },
                ),
                MV({
                  settings: { retries: oD, timeout: (e) => eO(e) },
                  onError(e, t, i) {
                    var n;
                    null != (n = e.message) && n.includes('timeout')
                      ? (this._log.warn('publish timeout'), t())
                      : (this._log.error('publish failed: '.concat(e)),
                        i(e),
                        UO.emit(BO.PUBLISH_FAILED, { room: this }));
                  },
                }),
              ],
              SU.prototype,
              'publish',
              1,
            ),
            rb(
              [
                VV({
                  fnName: 'publish',
                  callback() {
                    for (
                      var e, t = arguments.length, i = new Array(t), n = 0;
                      n < t;
                      n++
                    )
                      i[n] = arguments[n];
                    0 === this.localTracks.size &&
                      (null == (e = this.uplinkConnection) ||
                        e.close('you unpublished'),
                      (this.uplinkConnection = null),
                      i.forEach((e) => e.unpublish()));
                  },
                }),
                (function (e) {
                  return function (t, i, n) {
                    let r = n.value;
                    return (
                      (n.value = function () {
                        for (
                          var t = arguments.length, i = new Array(t), n = 0;
                          n < t;
                          n++
                        )
                          i[n] = arguments[n];
                        let o = oL.get(this);
                        if (o) {
                          let t = o.filter((t, n) => {
                            if (0 === n) return !0;
                            let r = !0;
                            return (
                              t.args.forEach((e) => {
                                i.find((t) => t === e) || (r = !1);
                              }),
                              !r ||
                                (t.reject(
                                  new gb({
                                    code: mb.API_CALL_ABORTED,
                                    message: e,
                                  }),
                                ),
                                !1)
                            );
                          });
                          oL.set(this, t);
                        }
                        return r.apply(this, i);
                      }),
                      n
                    );
                  };
                })('api-call'),
                aL(),
                rL(
                  (e) =>
                    function () {
                      for (
                        var t = arguments.length, i = new Array(t), n = 0;
                        n < t;
                        n++
                      )
                        i[n] = arguments[n];
                      i.forEach((e) => {
                        'audio' === e.kind &&
                          this.audioManager.removeAudioTrack(e);
                      });
                      let r = e.apply(this, i);
                      return i.forEach((e) => e.unpublish()), r;
                    },
                ),
              ],
              SU.prototype,
              'unpublish',
              1,
            ),
            rb(
              [
                cL(function () {
                  for (
                    var e = arguments.length, t = new Array(e), i = 0;
                    i < e;
                    i++
                  )
                    t[i] = arguments[i];
                  return t[0].userId;
                }),
                rL(
                  (e) =>
                    function () {
                      for (
                        var t = arguments.length, i = new Array(t), n = 0;
                        n < t;
                        n++
                      )
                        i[n] = arguments[n];
                      let r = e.apply(this, i);
                      return (
                        i.forEach((e) => !e.isSubscribed && e.subscribe(r)), r
                      );
                    },
                ),
                MV({
                  settings: { retries: oD, timeout: (e) => eO(e) },
                  onError(e, t, i, n) {
                    e.message.includes('timeout')
                      ? (this._log.warn('subscribe timeout'), t())
                      : (this._log.error('subscribe failed: '.concat(e)),
                        i(e),
                        UO.emit(BO.SUBSCRIBE_FAILED, {
                          room: this,
                          remoteTracks: n,
                        }));
                  },
                }),
              ],
              SU.prototype,
              'subscribe',
              1,
            ),
            rb(
              [
                VV({
                  fnName: 'subscribe',
                  callback() {
                    for (
                      var e = arguments.length, t = new Array(e), i = 0;
                      i < e;
                      i++
                    )
                      t[i] = arguments[i];
                    this.singlePC ||
                      t.forEach((e) => {
                        let t = this.remotePublishedUserMap.get(e.userId);
                        t &&
                          !t.isMainStreamSubscribed &&
                          !t.isAuxStreamSubscribed &&
                          t.close('you unsubscribed');
                      });
                  },
                }),
                cL(function () {
                  for (
                    var e = arguments.length, t = new Array(e), i = 0;
                    i < e;
                    i++
                  )
                    t[i] = arguments[i];
                  return t[0].userId;
                }),
              ],
              SU.prototype,
              'unsubscribe',
              1,
            ),
            (QM.create = QM._create.bind(QM, SU)),
            QM
          );
        });

        /***/
      },

      /***/ 627: /***/ (__unused_webpack_module, exports) => {
        'use strict';

        Object.defineProperty(exports, '__esModule', { value: true });
        var ListenerType;
        (function (ListenerType) {
          /// 错误回调，表示 SDK 不可恢复的错误，一定要监听并分情况给用户适当的界面提示
          ///
          /// 参数param：
          ///
          /// errCode	错误码
          ///
          /// errMsg	错误信息
          ///
          /// extraInfo	扩展信息字段，个别错误码可能会带额外的信息帮助定位问题
          ListenerType['onError'] = 'onError';
          /// 警告回调，用于告知您一些非严重性问题，例如出现卡顿或者可恢复的解码失败。
          ///
          /// 参数param：
          ///
          /// warningCode	错误码
          ///
          /// warningMsg	警告信息
          ///
          /// extraInfo	扩展信息字段，个别警告码可能会带额外的信息帮助定位问题
          ListenerType['onWarning'] = 'onWarning';
          /// 已加入房间的回调
          ///
          /// 调用 TRTCCloud 中的 enterRoom() 接口执行进房操作后，会收到来自 SDK 的 onEnterRoom(result) 回调：
          ///
          /// 如果加入成功，result 会是一个正数（result > 0），代表加入房间的时间消耗，单位是毫秒（ms）。
          ///
          /// 如果加入失败，result 会是一个负数（result < 0），代表进房失败的错误码。
          ///
          /// 参数param：
          ///
          /// result > 0 时为进房耗时（ms），result < 0 时为进房错误码
          ListenerType['onEnterRoom'] = 'onEnterRoom';
          /// 离开房间的事件回调
          ///
          /// 调用 TRTCCloud 中的 exitRoom() 接口会执行退出房间的相关逻辑，例如释放音视频设备资源和编解码器资源等。 待资源释放完毕，SDK 会通过 onExitRoom() 回调通知到您。
          ///
          /// 如果您要再次调用 enterRoom() 或者切换到其他的音视频 SDK，请等待 onExitRoom() 回调到来之后再执行相关操作。 否则可能会遇到音频设备被占用等各种异常问题。
          ///
          /// 参数param：
          ///
          /// reason	离开房间原因，0：主动调用 exitRoom 退房；1：被服务器踢出当前房间；2：当前房间整个被解散。
          ListenerType['onExitRoom'] = 'onExitRoom';
          /// 切换角色的事件回调
          ///
          /// 调用 TRTCCloud 中的 switchRole() 接口会切换主播和观众的角色，该操作会伴随一个线路切换的过程， 待 SDK 切换完成后，会抛出 onSwitchRole() 事件回调。
          ///
          /// 参数param：
          ///
          /// errCode	错误码，0代表切换成功
          ///
          /// errMsg	错误信息。
          ListenerType['onSwitchRole'] = 'onSwitchRole';
          /// 有用户加入当前房间。
          ///
          /// 出于性能方面的考虑，在两种不同的应用场景下，该通知的行为会有差别：
          ///
          /// 通话场景（TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL 和 TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL）：该场景下用户没有角色的区别，任何用户进入房间都会触发该通知。
          ///
          /// 直播场景（TRTCCloudDef.TRTC_APP_SCENE_LIVE 和 TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM）：该场景不限制观众的数量，如果任何用户进出都抛出回调会引起很大的性能损耗，所以该场景下只有主播进入房间时才会触发该通知，观众进入房间不会触发该通知。
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ListenerType['onRemoteUserEnterRoom'] = 'onRemoteUserEnterRoom';
          /// 有用户离开当前房间。
          ///
          /// 与 onRemoteUserEnterRoom 相对应，在两种不同的应用场景下，该通知的行为会有差别：
          ///
          /// 通话场景（TRTCCloudDef.TRTC_APP_SCENE_VIDEOCALL 和 TRTCCloudDef.TRTC_APP_SCENE_AUDIOCALL）：该场景下用户没有角色的区别，任何用户的离开都会触发该通知。
          ///
          /// 直播场景（TRTCCloudDef.TRTC_APP_SCENE_LIVE 和 TRTCCloudDef.TRTC_APP_SCENE_VOICE_CHATROOM）：只有主播离开房间时才会触发该通知，观众离开房间不会触发该通知。
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// reason	离开原因，0表示用户主动退出房间，1表示用户超时退出，2表示被踢出房间。
          ListenerType['onRemoteUserLeaveRoom'] = 'onRemoteUserLeaveRoom';
          /// 请求跨房通话（主播 PK）的结果回调
          ///
          /// 调用 TRTCCloud 中的 connectOtherRoom() 接口会将两个不同房间中的主播拉通视频通话，也就是所谓的“主播PK”功能。 调用者会收到 onConnectOtherRoom() 回调来获知跨房通话是否成功， 如果成功，两个房间中的所有用户都会收到 PK 主播的 onUserVideoAvailable() 回调。
          ///
          /// 参数param：
          ///
          /// userId	要 PK 的目标主播 userid。
          ///
          /// errCode 错误码，ERR_NULL 代表切换成功，其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
          ///
          /// errMsg 错误信息
          ListenerType['onConnectOtherRoom'] = 'onConnectOtherRoom';
          /// 结束跨房通话（主播 PK）的结果回调
          ListenerType['onDisConnectOtherRoom'] = 'onDisConnectOtherRoom';
          /// 切换房间 (switchRoom) 的结果回调
          ///
          /// 参数param：
          ///
          /// errCode 错误码
          ///
          /// errMsg 错误信息
          ListenerType['onSwitchRoom'] = 'onSwitchRoom';
          /// 远端用户是否存在可播放的主路画面（一般用于摄像头）
          ///
          /// 当您收到 onUserVideoAvailable(userId, true) 通知时，表示该路画面已经有可用的视频数据帧到达。 此时，您需要调用 startRemoteView(userid) 接口加载该用户的远程画面。 然后，您会收到名为 onFirstVideoFrame(userid) 的首帧画面渲染回调。
          ///
          /// 当您收到 onUserVideoAvailable(userId, false) 通知时，表示该路远程画面已经被关闭，可能由于该用户调用了 muteLocalVideo() 或 stopLocalPreview()。
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// available	画面是否开启
          ListenerType['onUserVideoAvailable'] = 'onUserVideoAvailable';
          /// 远端用户是否存在可播放的辅路画面（一般用于屏幕分享）
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// available	屏幕分享是否开启
          ListenerType['onUserSubStreamAvailable'] = 'onUserSubStreamAvailable';
          /// 远端用户是否存在可播放的音频数据
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// available	声音是否开启
          ListenerType['onUserAudioAvailable'] = 'onUserAudioAvailable';
          /// 开始渲染本地或远程用户的首帧画面
          ///
          /// 如果 userId 为 null，代表开始渲染本地采集的摄像头画面，需要您先调用 startLocalPreview 触发。 如果 userId 不为 null，代表开始渲染远程用户的首帧画面，需要您先调用 startRemoteView 触发。
          ///
          /// 只有当您调用 startLocalPreview()、startRemoteView() 或 startRemoteSubStreamView() 之后，才会触发该回调。
          ///
          /// 参数param：
          ///
          /// userId	本地或远程用户 ID，如果 userId == null 代表本地，userId != null 代表远程。
          ///
          /// streamType	视频流类型：摄像头或屏幕分享。
          ///
          /// width	画面宽度
          ///
          /// height	画面高度
          ListenerType['onFirstVideoFrame'] = 'onFirstVideoFrame';
          /// 开始播放远程用户的首帧音频（本地声音暂不通知）。
          ///
          /// 参数param：
          ///
          /// userId	远程用户 ID。
          ListenerType['onFirstAudioFrame'] = 'onFirstAudioFrame';
          /// 首帧本地音频数据已经被送出。
          ///
          /// SDK 会在 enterRoom() 并 startLocalPreview() 成功后开始摄像头采集，并将采集到的画面进行编码。 当 SDK 成功向云端送出第一帧视频数据后，会抛出这个回调事件。
          ///
          /// 参数param：
          ///
          /// streamType	视频流类型，大画面、小画面或辅流画面（屏幕分享）
          ListenerType['onSendFirstLocalVideoFrame'] =
            'onSendFirstLocalVideoFrame';
          /// 首帧本地音频数据已经被送出
          ///
          /// SDK 会在 enterRoom() 并 startLocalAudio() 成功后开始麦克风采集，并将采集到的声音进行编码。 当 SDK 成功向云端送出第一帧音频数据后，会抛出这个回调事件。
          ListenerType['onSendFirstLocalAudioFrame'] =
            'onSendFirstLocalAudioFrame';
          /// 网络质量：该回调每2秒触发一次，统计当前网络的上行和下行质量。
          ///
          /// userId 为本地用户 ID 代表自己当前的视频质量
          ///
          /// 参数param：
          ///
          /// localQuality	上行网络质量
          ///
          /// remoteQuality	下行网络质量
          ListenerType['onNetworkQuality'] = 'onNetworkQuality';
          /// 技术指标统计回调
          ///
          /// 如果您是熟悉音视频领域相关术语，可以通过这个回调获取 SDK 的所有技术指标。 如果您是首次开发音视频相关项目，可以只关注 onNetworkQuality 回调。
          ///
          /// 注意：每2秒回调一次
          ///
          /// 参数param：
          ///
          /// statics	状态数据
          ListenerType['onStatistics'] = 'onStatistics';
          /// SDK 跟服务器的连接断开
          ListenerType['onConnectionLost'] = 'onConnectionLost';
          /// SDK 尝试重新连接到服务器。
          ListenerType['onTryToReconnect'] = 'onTryToReconnect';
          /// SDK 跟服务器的连接恢复。
          ListenerType['onConnectionRecovery'] = 'onConnectionRecovery';
          /// 服务器测速的回调，SDK 对多个服务器 IP 做测速，每个 IP 的测速结果通过这个回调通知。
          ///
          /// 参数param：
          ///
          /// currentResult	当前完成的测速结果
          ///
          /// finishedCount	已完成测速的服务器数量
          ///
          /// totalCount	需要测速的服务器总数量
          ListenerType['onSpeedTest'] = 'onSpeedTest';
          /// 摄像头准备就绪。
          ListenerType['onCameraDidReady'] = 'onCameraDidReady';
          /// 麦克风准备就绪
          ListenerType['onMicDidReady'] = 'onMicDidReady';
          /// 用于提示音量大小的回调，包括每个 userId 的音量和远端总音量。
          ///
          /// 您可以通过调用 TRTCCloud 中的 enableAudioVolumeEvaluation 接口来开关这个回调或者设置它的触发间隔。 需要注意的是，调用 enableAudioVolumeEvaluation 开启音量回调后，无论频道内是否有人说话，都会按设置的时间间隔调用这个回调; 如果没有人说话，则 userVolumes 为空，totalVolume 为0。
          ///
          /// 注意：userId 为本地用户 ID 时表示自己的音量，userVolumes 内仅包含正在说话（音量不为0）的用户音量信息。
          ///
          /// 参数param：
          ///
          /// userVolumes	所有正在说话的房间成员的音量，取值范围0 - 100。
          ///
          /// totalVolume	所有远端成员的总音量, 取值范围0 - 100。
          ListenerType['onUserVoiceVolume'] = 'onUserVoiceVolume';
          /// 收到自定义消息回调
          ///
          /// 当房间中的某个用户使用 sendCustomCmdMsg 发送自定义消息时，房间中的其它用户可以通过 onRecvCustomCmdMsg 接口接收消息
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// cmdID	命令 ID
          ///
          /// seq	消息序号
          ///
          /// message	消息数据
          ListenerType['onRecvCustomCmdMsg'] = 'onRecvCustomCmdMsg';
          /// 自定义消息丢失回调
          ///
          /// 实时音视频使用 UDP 通道，即使设置了可靠传输（reliable）也无法确保100%不丢失，只是丢消息概率极低，能满足常规可靠性要求。 在发送端设置了可靠传输（reliable）后，SDK 都会通过此回调通知过去时间段内（通常为5s）传输途中丢失的自定义消息数量统计信息。
          ///
          /// 注意：
          ///
          /// 只有在发送端设置了可靠传输（reliable），接收方才能收到消息的丢失回调
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// cmdID	数据流 ID
          ///
          /// errCode	错误码，当前版本为-1
          ///
          /// missed	丢失的消息数量
          ListenerType['onMissCustomCmdMsg'] = 'onMissCustomCmdMsg';
          /// 收到 SEI 消息的回调
          ///
          /// 当房间中的某个用户使用 sendSEIMsg 发送数据时，房间中的其它用户可以通过 onRecvSEIMsg 接口接收数据。
          ///
          /// 参数param：
          ///
          /// userId	用户标识
          ///
          /// message	数据
          ListenerType['onRecvSEIMsg'] = 'onRecvSEIMsg';
          /// 开始向腾讯云的直播 CDN 推流的回调，对应于 TRTCCloud 中的 startPublishing() 接口
          ///
          /// 参数param：
          ///
          /// errCode	0表示成功，其余值表示失败
          ///
          /// errMsg	具体错误原因
          ListenerType['onStartPublishing'] = 'onStartPublishing';
          /// 停止向腾讯云的直播 CDN 推流的回调，对应于 TRTCCloud 中的 stopPublishing() 接口
          ///
          /// 参数param：
          ///
          /// errCode	0表示成功，其余值表示失败
          ///
          /// errMsg	具体错误原因
          ListenerType['onStopPublishing'] = 'onStopPublishing';
          /// 启动旁路推流到 CDN 完成的回调
          ///
          /// 对应于 TRTCCloud 中的 startPublishCDNStream() 接口
          ///
          /// 注意：Start 回调如果成功，只能说明转推请求已经成功告知给腾讯云，如果目标 CDN 有异常，还是有可能会转推失败。
          ///
          /// 参数param：
          ///
          /// errCode	0表示成功，其余值表示失败
          ///
          /// errMsg	具体错误原因
          ListenerType['onStartPublishCDNStream'] = 'onStartPublishCDNStream';
          /// 停止旁路推流到 CDN 完成的回调
          ///
          /// 对应于 TRTCCloud 中的 stopPublishCDNStream() 接口
          ///
          /// 参数param：
          ///
          /// errCode	0表示成功，其余值表示失败
          ///
          /// errMsg	具体错误原因
          ListenerType['onStopPublishCDNStream'] = 'onStopPublishCDNStream';
          /// 设置云端的混流转码参数的回调，对应于 TRTCCloud 中的 setMixTranscodingConfig() 接口。
          ///
          /// 参数param：
          ///
          /// errCode	0表示成功，其余值表示失败
          ///
          /// errMsg	具体错误原因
          ListenerType['onSetMixTranscodingConfig'] =
            'onSetMixTranscodingConfig';
          /// 背景音乐开始播放
          ListenerType['onMusicObserverStart'] = 'onMusicObserverStart';
          /// 背景音乐的播放进度
          ListenerType['onMusicObserverPlayProgress'] =
            'onMusicObserverPlayProgress';
          /// 背景音乐已播放完毕
          ListenerType['onMusicObserverComplete'] = 'onMusicObserverComplete';
          /// 截图完成时回调
          ///
          /// 参数
          ///
          /// errorCode为0表示截图成功，其他值表示失败
          ListenerType['onSnapshotComplete'] = 'onSnapshotComplete';
          ///当屏幕分享开始时，SDK 会通过此回调通知
          ListenerType['onScreenCaptureStarted'] = 'onScreenCaptureStarted';
          ///当屏幕分享暂停时，SDK 会通过此回调通知
          ///
          ///参数
          ///
          /// reason	原因，0：用户主动暂停；1：屏幕窗口不可见暂停
          ///
          /// 注意：回调的值只针对ios生效
          ListenerType['onScreenCapturePaused'] = 'onScreenCapturePaused';
          ///当屏幕分享恢复时，SDK 会通过此回调通知
          ///
          ///参数
          ///
          /// reason	恢复原因，0：用户主动恢复；1：屏幕窗口恢复可见从而恢复分享
          ///
          /// 注意：回调的值只针对ios生效
          ListenerType['onScreenCaptureResumed'] = 'onScreenCaptureResumed';
          ///当屏幕分享停止时，SDK 会通过此回调通知
          ///
          ///参数
          ///
          ///reason	停止原因，0：用户主动停止；1：屏幕窗口关闭导致停止
          ListenerType['onScreenCaptureStoped'] = 'onScreenCaptureStoped';
          /// 本地设备通断回调
          ///
          /// 注意：该回调仅支持windows和Mac平台
          ///
          /// 参数
          ///
          /// deviceId	设备 ID
          ///
          /// type 设备类型
          ///
          /// state 事件类型
          ListenerType['onDeviceChange'] = 'onDeviceChange';
          /// 麦克风测试音量回调
          ///
          /// 麦克风测试接口 startMicDeviceTest 会触发这个回调
          ///
          /// 注意：该回调仅支持windows和Mac平台
          ///
          /// 参数：
          ///
          /// volume 音量值，取值范围0 - 100
          ListenerType['onTestMicVolume'] = 'onTestMicVolume';
          /// 扬声器测试音量回调
          ///
          /// 扬声器测试接口 startSpeakerDeviceTest 会触发这个回调
          ///
          /// 注意：该回调仅支持windows和Mac平台
          ///
          /// 参数：
          ///
          /// volume 音量值，取值范围0 - 100
          ListenerType['onTestSpeakerVolume'] = 'onTestSpeakerVolume';
          /// 推流操作回调
          ///
          /// 0表示成功 其他失败
          ListenerType['onStreamPublish'] = 'onStreamPublish';
        })(ListenerType || (ListenerType = {}));
        exports['default'] = ListenerType;

        /***/
      },

      /***/ 315: /***/ function (
        __unused_webpack_module,
        exports,
        __webpack_require__,
      ) {
        'use strict';

        var __assign =
          (this && this.__assign) ||
          function () {
            __assign =
              Object.assign ||
              function (t) {
                for (var s, i = 1, n = arguments.length; i < n; i++) {
                  s = arguments[i];
                  for (var p in s)
                    if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
                }
                return t;
              };
            return __assign.apply(this, arguments);
          };
        var __createBinding =
          (this && this.__createBinding) ||
          (Object.create
            ? function (o, m, k, k2) {
                if (k2 === undefined) k2 = k;
                var desc = Object.getOwnPropertyDescriptor(m, k);
                if (
                  !desc ||
                  ('get' in desc
                    ? !m.__esModule
                    : desc.writable || desc.configurable)
                ) {
                  desc = {
                    enumerable: true,
                    get: function () {
                      return m[k];
                    },
                  };
                }
                Object.defineProperty(o, k2, desc);
              }
            : function (o, m, k, k2) {
                if (k2 === undefined) k2 = k;
                o[k2] = m[k];
              });
        var __setModuleDefault =
          (this && this.__setModuleDefault) ||
          (Object.create
            ? function (o, v) {
                Object.defineProperty(o, 'default', {
                  enumerable: true,
                  value: v,
                });
              }
            : function (o, v) {
                o['default'] = v;
              });
        var __importStar =
          (this && this.__importStar) ||
          function (mod) {
            if (mod && mod.__esModule) return mod;
            var result = {};
            if (mod != null)
              for (var k in mod)
                if (
                  k !== 'default' &&
                  Object.prototype.hasOwnProperty.call(mod, k)
                )
                  __createBinding(result, mod, k);
            __setModuleDefault(result, mod);
            return result;
          };
        var __awaiter =
          (this && this.__awaiter) ||
          function (thisArg, _arguments, P, generator) {
            function adopt(value) {
              return value instanceof P
                ? value
                : new P(function (resolve) {
                    resolve(value);
                  });
            }
            return new (P || (P = Promise))(function (resolve, reject) {
              function fulfilled(value) {
                try {
                  step(generator.next(value));
                } catch (e) {
                  reject(e);
                }
              }
              function rejected(value) {
                try {
                  step(generator['throw'](value));
                } catch (e) {
                  reject(e);
                }
              }
              function step(result) {
                result.done
                  ? resolve(result.value)
                  : adopt(result.value).then(fulfilled, rejected);
              }
              step(
                (generator = generator.apply(thisArg, _arguments || [])).next(),
              );
            });
          };
        var __generator =
          (this && this.__generator) ||
          function (thisArg, body) {
            var _ = {
                label: 0,
                sent: function () {
                  if (t[0] & 1) throw t[1];
                  return t[1];
                },
                trys: [],
                ops: [],
              },
              f,
              y,
              t,
              g;
            return (
              (g = { next: verb(0), throw: verb(1), return: verb(2) }),
              typeof Symbol === 'function' &&
                (g[Symbol.iterator] = function () {
                  return this;
                }),
              g
            );
            function verb(n) {
              return function (v) {
                return step([n, v]);
              };
            }
            function step(op) {
              if (f) throw new TypeError('Generator is already executing.');
              while (_)
                try {
                  if (
                    ((f = 1),
                    y &&
                      (t =
                        op[0] & 2
                          ? y['return']
                          : op[0]
                          ? y['throw'] || ((t = y['return']) && t.call(y), 0)
                          : y.next) &&
                      !(t = t.call(y, op[1])).done)
                  )
                    return t;
                  if (((y = 0), t)) op = [op[0] & 2, t.value];
                  switch (op[0]) {
                    case 0:
                    case 1:
                      t = op;
                      break;
                    case 4:
                      _.label++;
                      return { value: op[1], done: false };
                    case 5:
                      _.label++;
                      y = op[1];
                      op = [0];
                      continue;
                    case 7:
                      op = _.ops.pop();
                      _.trys.pop();
                      continue;
                    default:
                      if (
                        !((t = _.trys),
                        (t = t.length > 0 && t[t.length - 1])) &&
                        (op[0] === 6 || op[0] === 2)
                      ) {
                        _ = 0;
                        continue;
                      }
                      if (
                        op[0] === 3 &&
                        (!t || (op[1] > t[0] && op[1] < t[3]))
                      ) {
                        _.label = op[1];
                        break;
                      }
                      if (op[0] === 6 && _.label < t[1]) {
                        _.label = t[1];
                        t = op;
                        break;
                      }
                      if (t && _.label < t[2]) {
                        _.label = t[2];
                        _.ops.push(op);
                        break;
                      }
                      if (t[2]) _.ops.pop();
                      _.trys.pop();
                      continue;
                  }
                  op = body.call(thisArg, _);
                } catch (e) {
                  op = [6, e];
                  y = 0;
                } finally {
                  f = t = 0;
                }
              if (op[0] & 5) throw op[1];
              return { value: op[0] ? op[1] : void 0, done: true };
            }
          };
        var __importDefault =
          (this && this.__importDefault) ||
          function (mod) {
            return mod && mod.__esModule ? mod : { default: mod };
          };
        Object.defineProperty(exports, '__esModule', { value: true });
        // @ts-nocheck
        var ListenerType_1 = __importDefault(__webpack_require__(627));
        var trtc_cloud_js_sdk_1 = __importStar(__webpack_require__(79));
        var TXUntils_1 = __webpack_require__(802);
        var TrtcWrapper = /** @class */ (function () {
          function TrtcWrapper() {
            this._trtcCloud = null;
            this._framework = 7; // 罗盘上报
            this._localPlayOptions = {
              rotation:
                trtc_cloud_js_sdk_1.TRTCVideoRotation.TRTCVideoRotation0,
              fillMode:
                trtc_cloud_js_sdk_1.TRTCVideoFillMode.TRTCVideoFillMode_Fill,
              mirrorType:
                trtc_cloud_js_sdk_1.TRTCVideoMirrorType
                  .TRTCVideoMirrorType_Enable,
            };
            // 远端预览模式, 所有远端流, 采用相同模式
            this._remotePlayOptions = {
              rotation:
                trtc_cloud_js_sdk_1.TRTCVideoRotation.TRTCVideoRotation0,
              fillMode:
                trtc_cloud_js_sdk_1.TRTCVideoFillMode.TRTCVideoFillMode_Fill,
              mirrorType:
                trtc_cloud_js_sdk_1.TRTCVideoMirrorType
                  .TRTCVideoMirrorType_Disable, // 远端流默认关闭镜像, ref: https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/RemoteStream.html#play
            };
            this._screenShareOptions = {
              videoResolution:
                trtc_cloud_js_sdk_1.TRTCVideoResolution
                  .TRTCVideoResolution_1920_1080,
              videoFps: 15,
              videoBitrate: 1500,
              screenAudio: false, // 屏幕分享是否采集系统音频, 默认 false 不采集
            };
            (0, TXUntils_1.logSuccess)('TrtcWrapper new come');
            this._trtcCloud = trtc_cloud_js_sdk_1.default.getTRTCShareInstance({
              frameWorkType: this._framework,
            });
            this._addTRTCEvents();
          }
          TrtcWrapper.prototype.getSDKVersion = function () {
            return this._trtcCloud.getSDKVersion();
          };
          TrtcWrapper.prototype.sharedInstance = function () {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.destroySharedInstance = function () {
            return __awaiter(this, void 0, void 0, function () {
              var error_1;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    this._removeTRTCEvents();
                    return [4 /*yield*/, this.exitRoom()];
                  case 1:
                    _a.sent();
                    (0, TXUntils_1.logSuccess)('destroySharedInstance success');
                    return [3 /*break*/, 3];
                  case 2:
                    error_1 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 房间start
          TrtcWrapper.prototype.enterRoom = function (param) {
            var _a;
            return __awaiter(this, void 0, void 0, function () {
              var userId,
                sdkAppId,
                userSig,
                roomId,
                strRoomId,
                role,
                streamId,
                userDefineRecordId,
                privateMapKey,
                enterRoomParams,
                error_2;
              return __generator(this, function (_b) {
                switch (_b.label) {
                  case 0:
                    _b.trys.push([0, 2, , 3]);
                    (0, TXUntils_1.logSuccess)('begin enterRoom');
                    userId = (0, TXUntils_1.getFlutterArgs)(param, 'userId');
                    sdkAppId = (0, TXUntils_1.getFlutterArgs)(
                      param,
                      'sdkAppId',
                    );
                    userSig = (0, TXUntils_1.getFlutterArgs)(param, 'userSig');
                    roomId = (0, TXUntils_1.getFlutterArgs)(param, 'roomId');
                    strRoomId = (0, TXUntils_1.getFlutterArgs)(
                      param,
                      'strRoomId',
                    );
                    role = (0, TXUntils_1.getFlutterArgs)(param, 'role');
                    streamId = (0, TXUntils_1.getFlutterArgs)(
                      param,
                      'streamId',
                    );
                    userDefineRecordId = (0, TXUntils_1.getFlutterArgs)(
                      param,
                      'userDefineRecordId',
                    );
                    privateMapKey = (0, TXUntils_1.getFlutterArgs)(
                      param,
                      'privateMapKey',
                    );
                    enterRoomParams = {
                      userId: userId,
                      sdkAppId: sdkAppId,
                      userSig: userSig,
                      roomId:
                        typeof roomId === 'string'
                          ? parseInt(roomId, 10)
                          : roomId,
                      strRoomId: strRoomId,
                      role: role,
                      streamId: streamId,
                      userDefineRecordId: userDefineRecordId,
                      privateMapKey: privateMapKey,
                    };
                    return [
                      4 /*yield*/,
                      (_a = this._trtcCloud) === null || _a === void 0
                        ? void 0
                        : _a.enterRoom(enterRoomParams),
                    ];
                  case 1:
                    _b.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_2 = _b.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          TrtcWrapper.prototype.exitRoom = function () {
            return __awaiter(this, void 0, void 0, function () {
              var error_3;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 4, , 5]);
                    return [4 /*yield*/, this.stopLocalPreview()];
                  case 1:
                    _a.sent();
                    return [4 /*yield*/, this._trtcCloud.stopLocalAudio()];
                  case 2:
                    _a.sent();
                    return [4 /*yield*/, this._trtcCloud.exitRoom()];
                  case 3:
                    _a.sent();
                    window.DestoryLocalStreamCallBack();
                    (0, TXUntils_1.logSuccess)('exitRoom success');
                    return [3 /*break*/, 5];
                  case 4:
                    error_3 = _a.sent();
                    return [3 /*break*/, 5];
                  case 5:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 切换角色
          TrtcWrapper.prototype.switchRole = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var role, error_4;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    role = (0, TXUntils_1.getFlutterArgs)(_args, 'role');
                    return [4 /*yield*/, this._trtcCloud.switchRole(role)];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_4 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          TrtcWrapper.prototype.switchRoom = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('switchRoom');
                return [2 /*return*/];
              });
            });
          };
          // 请求跨房通话
          TrtcWrapper.prototype.connectOtherRoom = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('connectOtherRoom');
                return [2 /*return*/];
              });
            });
          };
          // 退出跨房通话
          TrtcWrapper.prototype.disconnectOtherRoom = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('disconnectOtherRoom');
                return [2 /*return*/];
              });
            });
          };
          // 设置订阅模式（需要在进入房前设置才能生效）
          TrtcWrapper.prototype.setDefaultStreamRecvMode = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setDefaultStreamRecvMode');
                return [2 /*return*/];
              });
            });
          };
          // 创建子房间示例（用于多房间并发观看）
          TrtcWrapper.prototype.createSubCloud = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('createSubCloud');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.destroySubCloud = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('destroySubCloud');
                return [2 /*return*/];
              });
            });
          };
          // 开启本地音频的采集和发布 TODO: 后续支持参数
          TrtcWrapper.prototype.startLocalAudio = function () {
            return __awaiter(this, void 0, void 0, function () {
              var error_5;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, this._trtcCloud.startLocalAudio()];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_5 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 停止本地音频的采集和发布
          TrtcWrapper.prototype.stopLocalAudio = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var error_6;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, this._trtcCloud.stopLocalAudio()];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_6 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 暂停/恢复发布本地的音频流
          TrtcWrapper.prototype.muteLocalAudio = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var mute, error_7;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
                    return [4 /*yield*/, this._trtcCloud.muteLocalAudio(mute)];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_7 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 设定本地音频的采集音量
          TrtcWrapper.prototype.setAudioCaptureVolume = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setAudioCaptureVolume');
                return [2 /*return*/];
              });
            });
          };
          // 设定SDK音频的播放音量
          TrtcWrapper.prototype.setAudioPlayoutVolume = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setAudioPlayoutVolume');
                return [2 /*return*/];
              });
            });
          };
          // 获取SDK音频的播放音量
          TrtcWrapper.prototype.getAudioPlayoutVolume = function (_args) {
            (0, TXUntils_1.noSupportFunction)('getAudioPlayoutVolume');
          };
          // 设置音频路由
          TrtcWrapper.prototype.setAudioRoute = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setAudioRoute');
                return [2 /*return*/];
              });
            });
          };
          // 开启本地摄像头的预览画面
          TrtcWrapper.prototype.startLocalPreview = function (
            _element,
            viewId,
            _args,
          ) {
            var _a, _b;
            return __awaiter(this, void 0, void 0, function () {
              var error_8;
              return __generator(this, function (_c) {
                switch (_c.label) {
                  case 0:
                    _c.trys.push([0, 3, , 4]);
                    return [
                      4 /*yield*/,
                      (_a = this._trtcCloud) === null || _a === void 0
                        ? void 0
                        : _a.startLocalPreview(viewId),
                    ];
                  case 1:
                    _c.sent();
                    return [
                      4 /*yield*/,
                      (_b = this._trtcCloud) === null || _b === void 0
                        ? void 0
                        : _b.setLocalRenderParams(this.getLocalPlayOptions()),
                    ];
                  case 2:
                    _c.sent();
                    this._emitEvent(ListenerType_1.default.onStreamPublish, 0);
                    return [3 /*break*/, 4];
                  case 3:
                    error_8 = _c.sent();
                    this._emitEvent(ListenerType_1.default.onStreamPublish, 1);
                    return [3 /*break*/, 4];
                  case 4:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 停止摄像头预览
          TrtcWrapper.prototype.stopLocalPreview = function (_args) {
            var _a;
            return __awaiter(this, void 0, void 0, function () {
              var error_9;
              return __generator(this, function (_b) {
                switch (_b.label) {
                  case 0:
                    _b.trys.push([0, 2, , 3]);
                    return [
                      4 /*yield*/,
                      (_a = this._trtcCloud) === null || _a === void 0
                        ? void 0
                        : _a.stopLocalPreview(),
                    ];
                  case 1:
                    _b.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_9 = _b.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 暂停/恢复发布本地的视频流
          TrtcWrapper.prototype.muteLocalVideo = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var mute, error_10;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
                    return [4 /*yield*/, this._trtcCloud.muteLocalVideo(mute)];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_10 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          TrtcWrapper.prototype.switchCamera = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('switchCamera');
                return [2 /*return*/];
              });
            });
          };
          // 订阅远端用户的视频流，并绑定视频渲染控件, streamType 视频流类型, 0 - 大流; 1 - 小流; 2 - 屏幕分享流
          TrtcWrapper.prototype.startRemoteView = function (
            _element,
            _viewId,
            _args,
          ) {
            var _a;
            return __awaiter(this, void 0, void 0, function () {
              var userId, streamType, error_11;
              return __generator(this, function (_b) {
                switch (_b.label) {
                  case 0:
                    userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
                    streamType = (0, TXUntils_1.getFlutterArgs)(
                      _args,
                      'streamType',
                    );
                    _b.label = 1;
                  case 1:
                    _b.trys.push([1, 3, , 4]);
                    // ref: https://tapd.woa.com/20396022/prong/stories/view/1020396022883872355
                    return [
                      4 /*yield*/,
                      (_a = this._trtcCloud) === null || _a === void 0
                        ? void 0
                        : _a.startRemoteView(userId, _viewId, streamType),
                    ];
                  case 2:
                    // ref: https://tapd.woa.com/20396022/prong/stories/view/1020396022883872355
                    _b.sent();
                    return [3 /*break*/, 4];
                  case 3:
                    error_11 = _b.sent();
                    return [3 /*break*/, 4];
                  case 4:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 停止订阅远端用户的视频流，并释放渲染控件
          TrtcWrapper.prototype.stopRemoteView = function (_args) {
            var _a;
            return __awaiter(this, void 0, void 0, function () {
              var userId, error_12;
              return __generator(this, function (_b) {
                switch (_b.label) {
                  case 0:
                    userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
                    _b.label = 1;
                  case 1:
                    _b.trys.push([1, 3, , 4]);
                    return [
                      4 /*yield*/,
                      (_a = this._trtcCloud) === null || _a === void 0
                        ? void 0
                        : _a.stopRemoteView(
                            userId,
                            trtc_cloud_js_sdk_1.TRTCVideoStreamType
                              .TRTCVideoStreamTypeBig,
                          ),
                    ];
                  case 2:
                    _b.sent();
                    return [3 /*break*/, 4];
                  case 3:
                    error_12 = _b.sent();
                    return [3 /*break*/, 4];
                  case 4:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 停止订阅所有远端用户的视频流，并释放全部渲染资源
          TrtcWrapper.prototype.stopAllRemoteView = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                try {
                  this._trtcCloud.stopAllRemoteView();
                } catch (error) {
                  // ……
                }
                return [2 /*return*/];
              });
            });
          };
          // 设置视频编码器的编码参数 // TODO: 确认: 入参需要调整
          TrtcWrapper.prototype.setVideoEncoderParam = function (_args) {
            var _a;
            return __awaiter(this, void 0, void 0, function () {
              var config, _b, error_13;
              return __generator(this, function (_c) {
                switch (_c.label) {
                  case 0:
                    _c.trys.push([0, 3, , 4]);
                    config = JSON.parse(_args);
                    _b = config;
                    if (!_b) return [3 /*break*/, 2];
                    return [
                      4 /*yield*/,
                      (_a = this._trtcCloud) === null || _a === void 0
                        ? void 0
                        : _a.setVideoEncoderParam(config),
                    ];
                  case 1:
                    _b = _c.sent();
                    _c.label = 2;
                  case 2:
                    _b;
                    return [3 /*break*/, 4];
                  case 3:
                    error_13 = _c.sent();
                    return [3 /*break*/, 4];
                  case 4:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 暂停/恢复订阅远端用户的视频流
          // TODO: 上个版本实现
          TrtcWrapper.prototype.muteRemoteVideoStream = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('muteRemoteVideoStream'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 暂停/恢复订阅所有远端用户的视频流
          // TODO: 上个版本实现
          TrtcWrapper.prototype.muteAllRemoteVideoStreams = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('muteAllRemoteVideoStreams'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 暂停/恢复播放远端的音频流
          TrtcWrapper.prototype.muteRemoteAudio = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var mute, userId, error_14;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
                    userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
                    return [
                      4 /*yield*/,
                      this._trtcCloud.muteRemoteAudio(userId, mute),
                    ];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_14 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 暂停/恢复播放所有远端用户的音频流
          TrtcWrapper.prototype.muteAllRemoteAudio = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var mute, error_15;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    mute = (0, TXUntils_1.getFlutterArgs)(_args, 'mute');
                    return [
                      4 /*yield*/,
                      this._trtcCloud.muteAllRemoteAudio(mute),
                    ];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_15 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 启用音量大小提示
          TrtcWrapper.prototype.enableAudioVolumeEvaluation = function (_args) {
            try {
              var intervalMs = (0, TXUntils_1.getFlutterArgs)(
                _args,
                'intervalMs',
              );
              this._trtcCloud.enableAudioVolumeEvaluation(intervalMs);
              return 0;
            } catch (error) {
              // ……
            }
          };
          // 设定某一个远端用户的声音播放音量
          TrtcWrapper.prototype.setRemoteAudioVolume = function (_args) {
            try {
              var userId = (0, TXUntils_1.getFlutterArgs)(_args, 'userId');
              var volume = (0, TXUntils_1.getFlutterArgs)(_args, 'volume');
              this._trtcCloud.setRemoteAudioVolume(userId, volume);
            } catch (error) {
              // ……
            }
          };
          // 开启大小画面双路编码模式. 请在 enterRoom 之后，开启摄像头之前调用
          TrtcWrapper.prototype.enableEncSmallVideoStream = function (_args) {
            return __awaiter(this, void 0, Number, function () {
              var enable, params, error_16;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    enable = (0, TXUntils_1.getFlutterArgs)(_args, 'enable');
                    params = (0, TXUntils_1.getFlutterArgs)(_args, 'params');
                    return [
                      4 /*yield*/,
                      this._trtcCloud.enableSmallVideoStream(enable, params),
                    ];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_16 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          TrtcWrapper.prototype.setLogLevel = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setLogLevel'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 开始向腾讯云直播 CDN 上发布音视频流
          TrtcWrapper.prototype.startPublishing = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('startPublishing'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 停止向腾讯云直播 CDN 上发布音视频流
          // TODO:上个版本有实现
          TrtcWrapper.prototype.stopPublishing = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('stopPublishing'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 开始向非腾讯云 CDN 上发布音视频流
          // TODO:上个版本有实现
          TrtcWrapper.prototype.startPublishCDNStream = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('startPublishCDNStream'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 停止向非腾讯云 CDN 上发布音视频流
          // TODO:上个版本有实现
          TrtcWrapper.prototype.stopPublishCDNStream = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('stopPublishCDNStream'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 设置云端混流的排版布局和转码参数
          // TODO:上个版本有实现
          TrtcWrapper.prototype.setMixTranscodingConfig = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setMixTranscodingConfig'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // TODO: 确认: 参数需要调整
          TrtcWrapper.prototype.startScreenCapture = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var viewId, streamType, screenShareParams, error_17;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    viewId = (0, TXUntils_1.getFlutterArgs)(_args, 'viewId');
                    streamType = (0, TXUntils_1.getFlutterArgs)(
                      _args,
                      'streamType',
                    );
                    screenShareParams = this.getScreenShareOptions();
                    return [
                      4 /*yield*/,
                      this._trtcCloud.startScreenShare(
                        viewId,
                        streamType,
                        screenShareParams,
                      ),
                    ];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_17 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 停止屏幕分享
          TrtcWrapper.prototype.stopScreenCapture = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var error_18;
              return __generator(this, function (_a) {
                switch (_a.label) {
                  case 0:
                    _a.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, this._trtcCloud.stopScreenShare()];
                  case 1:
                    _a.sent();
                    return [3 /*break*/, 3];
                  case 2:
                    error_18 = _a.sent();
                    return [3 /*break*/, 3];
                  case 3:
                    return [2 /*return*/];
                }
              });
            });
          };
          // 暂停屏幕分享
          // TODO:上个版本有实现
          TrtcWrapper.prototype.pauseScreenCapture = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('pauseScreenCapture'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // 恢复屏幕分享
          TrtcWrapper.prototype.resumeScreenCapture = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('resumeScreenCapture'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // ==============================【设备接口】==================================
          TrtcWrapper.prototype.getDevicesList = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var type, deviceList, _a, map, error_19;
              return __generator(this, function (_b) {
                switch (_b.label) {
                  case 0:
                    _b.trys.push([0, 8, , 9]);
                    type = (0, TXUntils_1.getFlutterArgs)(_args, 'type');
                    deviceList = [];
                    _a = type;
                    switch (_a) {
                      case 0:
                        return [3 /*break*/, 1];
                      case 1:
                        return [3 /*break*/, 3];
                      case 2:
                        return [3 /*break*/, 5];
                    }
                    return [3 /*break*/, 7];
                  case 1:
                    return [4 /*yield*/, this._trtcCloud.getMicDevicesList()];
                  case 2:
                    deviceList = _b.sent();
                    return [3 /*break*/, 7];
                  case 3:
                    return [
                      4 /*yield*/,
                      this._trtcCloud.getSpeakerDevicesList(),
                    ];
                  case 4:
                    deviceList = _b.sent();
                    return [3 /*break*/, 7];
                  case 5:
                    return [
                      4 /*yield*/,
                      this._trtcCloud.getCameraDevicesList(),
                    ];
                  case 6:
                    deviceList = _b.sent();
                    return [3 /*break*/, 7];
                  case 7:
                    map = { deviceList: deviceList, count: deviceList.length };
                    return [2 /*return*/, JSON.stringify(map)];
                  case 8:
                    error_19 = _b.sent();
                    return [3 /*break*/, 9];
                  case 9:
                    return [2 /*return*/];
                }
              });
            });
          };
          TrtcWrapper.prototype.setCurrentDevice = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var type, deviceId, _a, _b, error_20;
              return __generator(this, function (_c) {
                switch (_c.label) {
                  case 0:
                    _c.trys.push([0, 7, , 8]);
                    type = (0, TXUntils_1.getFlutterArgs)(_args, 'type');
                    deviceId = (0, TXUntils_1.getFlutterArgs)(
                      _args,
                      'deviceId',
                    );
                    if (!(type === 1)) return [3 /*break*/, 3];
                    _a = deviceId;
                    if (!_a) return [3 /*break*/, 2];
                    return [
                      4 /*yield*/,
                      this._trtcCloud.setCurrentMicDevice(deviceId),
                    ];
                  case 1:
                    _a = _c.sent();
                    _c.label = 2;
                  case 2:
                    _a;
                    _c.label = 3;
                  case 3:
                    if (!(type === 2)) return [3 /*break*/, 6];
                    _b = deviceId;
                    if (!_b) return [3 /*break*/, 5];
                    return [
                      4 /*yield*/,
                      this._trtcCloud.setCurrentCameraDevice(deviceId),
                    ];
                  case 4:
                    _b = _c.sent();
                    _c.label = 5;
                  case 5:
                    _b;
                    _c.label = 6;
                  case 6:
                    return [3 /*break*/, 8];
                  case 7:
                    error_20 = _c.sent();
                    return [3 /*break*/, 8];
                  case 8:
                    return [2 /*return*/];
                }
              });
            });
          };
          TrtcWrapper.prototype.getCurrentDevice = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var type, deviceInfo, _a, error_21;
              return __generator(this, function (_b) {
                switch (_b.label) {
                  case 0:
                    type = (0, TXUntils_1.getFlutterArgs)(_args, 'type');
                    deviceInfo = {};
                    _b.label = 1;
                  case 1:
                    _b.trys.push([1, 9, , 10]);
                    _a = type;
                    switch (_a) {
                      case 0:
                        return [3 /*break*/, 2];
                      case 1:
                        return [3 /*break*/, 4];
                      case 2:
                        return [3 /*break*/, 6];
                    }
                    return [3 /*break*/, 8];
                  case 2:
                    return [4 /*yield*/, this._trtcCloud.getCurrentMicDevice()];
                  case 3:
                    deviceInfo = _b.sent();
                    return [3 /*break*/, 8];
                  case 4:
                    return [
                      4 /*yield*/,
                      this._trtcCloud.getCurrentSpeakerDevice(),
                    ];
                  case 5:
                    deviceInfo = _b.sent();
                    return [3 /*break*/, 8];
                  case 6:
                    return [
                      4 /*yield*/,
                      this._trtcCloud.getCurrentCameraDevice(),
                    ];
                  case 7:
                    deviceInfo = _b.sent();
                    return [3 /*break*/, 8];
                  case 8:
                    return [2 /*return*/, JSON.stringify(deviceInfo)];
                  case 9:
                    error_21 = _b.sent();
                    return [3 /*break*/, 10];
                  case 10:
                    return [2 /*return*/];
                }
              });
            });
          };
          // TODO: 确认: 下面这些还需要返回 0 吗
          TrtcWrapper.prototype.setCurrentDeviceVolume = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setCurrentDeviceVolume');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.getCurrentDeviceVolume = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('getCurrentDeviceVolume');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.setCurrentDeviceMute = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setCurrentDeviceMute');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.getCurrentDeviceMute = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('getCurrentDeviceMute');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.startCameraDeviceTest = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('startCameraDeviceTest');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.stopCameraDeviceTest = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('stopCameraDeviceTest');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.startMicDeviceTest = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('startMicDeviceTest');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.stopMicDeviceTest = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('stopMicDeviceTest');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.startSpeakerDeviceTest = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('startSpeakerDeviceTest');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.stopSpeakerDeviceTest = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('stopSpeakerDeviceTest');
                return [2 /*return*/];
              });
            });
          };
          // ==============================【not Support】==================================
          // 设置本地画面的渲染参数
          TrtcWrapper.prototype.setLocalRenderParams = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setLocalRenderParams');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.updateLocalView = function (
            _element,
            _viewId,
            _args,
          ) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('updateLocalView');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.updateRemoteView = function (
            _element,
            _viewId,
            _args,
          ) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('updateLocalView');
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.setWatermark = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('setWatermark');
                return [2 /*return*/];
              });
            });
          };
          // 获取本地音频的采集音量
          TrtcWrapper.prototype.getAudioCaptureVolume = function (_args) {
            (0, TXUntils_1.noSupportFunction)('getAudioCaptureVolume'); // 通过音量事件获取即可
          };
          // 切换指定远端用户的大小画面
          // TODO: 上个版本有实现
          TrtcWrapper.prototype.setRemoteVideoStreamType = function (_args) {
            (0, TXUntils_1.noSupportFunction)('setAudioCaptureVolume');
          };
          // ==============================【录音相关】==================================
          TrtcWrapper.prototype.startAudioRecording = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.stopAudioRecording = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.startLocalRecording = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.stopLocalRecording = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // ==============================【背景音相关】==================================
          // TODO:上个版本有实现
          TrtcWrapper.prototype.startPlayMusic = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('startPlayMusic'); // trtcCloud 无接口
                resumeScreenCapture;
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.stopPlayMusic = function () {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('stopPlayMusic'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.resumePlayMusic = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('resumePlayMusic'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          TrtcWrapper.prototype.pausePlayMusic = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                (0, TXUntils_1.noSupportFunction)('pausePlayMusic'); // trtcCloud 无接口
                return [2 /*return*/];
              });
            });
          };
          // ==============================【日志相关】==================================
          // 	启用/禁用控制台日志打印
          TrtcWrapper.prototype.setConsoleEnabled = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              var enabled;
              return __generator(this, function (_a) {
                enabled = (0, TXUntils_1.getFlutterArgs)(_args, 'enabled');
                enabled
                  ? TRTC.Logger.enableUploadLog()
                  : TRTC.Logger.disableUploadLog();
                return [2 /*return*/];
              });
            });
          };
          // 	启用/禁用日志的本地压缩
          TrtcWrapper.prototype.setLogCompressEnabled = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // 设置本地日志的保存路径
          TrtcWrapper.prototype.setLogDirPath = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // 	设置日志回调
          TrtcWrapper.prototype.setLogDelegate = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // 	显示仪表盘
          TrtcWrapper.prototype.showDebugView = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // 	设置仪表盘的边距
          TrtcWrapper.prototype.setDebugViewMargin = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // 调用实验性接口
          TrtcWrapper.prototype.callExperimentalAPI = function (_args) {
            return __awaiter(this, void 0, void 0, function () {
              return __generator(this, function (_a) {
                return [2 /*return*/];
              });
            });
          };
          // ==============================【set、get】==================================
          TrtcWrapper.prototype.setLocalPlayOptions = function (playOption) {
            this._localPlayOptions = __assign(
              __assign({}, this._localPlayOptions),
              playOption,
            );
          };
          TrtcWrapper.prototype.getLocalPlayOptions = function () {
            return this._localPlayOptions;
          };
          TrtcWrapper.prototype.setRemotePlayOptions = function (playOption) {
            if (playOption === void 0) {
              playOption = {};
            }
            this._remotePlayOptions = __assign(
              __assign({}, this._remotePlayOptions),
              playOption,
            );
          };
          TrtcWrapper.prototype.getRemotePlayOptions = function () {
            return this._remotePlayOptions || {};
          };
          TrtcWrapper.prototype.setScreenShareOptions = function (
            screenShareOption,
          ) {
            if (screenShareOption === void 0) {
              screenShareOption = {};
            }
            this._screenShareOptions = __assign(
              __assign({}, this._screenShareOptions),
              screenShareOption,
            );
          };
          TrtcWrapper.prototype.getScreenShareOptions = function () {
            return this._screenShareOptions;
          };
          // ==============================【事件相关】==================================
          TrtcWrapper.prototype.setEventHandler = function (handler) {
            this.handler = handler;
          };
          TrtcWrapper.prototype._emitEvent = function (methodName, data) {
            var _a;
            if (data instanceof Array || typeof data === 'object') {
              data = JSON.stringify(data);
            }
            (_a = this.handler) === null || _a === void 0
              ? void 0
              : _a.call(this, methodName.toString(), data);
          };
          TrtcWrapper.prototype._addTRTCEvents = function () {
            var _this = this;
            var _a, _b, _c, _d, _e, _f, _g, _h, _j;
            (_a = this._trtcCloud) === null || _a === void 0
              ? void 0
              : _a.on('onEnterRoom', function (result) {
                  return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                      result > 0 &&
                        (0, TXUntils_1.logInfo)(
                          'enter room success, time consuming: '.concat(result),
                        );
                      return [2 /*return*/];
                    });
                  });
                });
            (_b = this._trtcCloud) === null || _b === void 0
              ? void 0
              : _b.on('onExitRoom', function (reason) {
                  return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                      // 离开房间原因，0：主动调用 exitRoom 退房；1：被服务器踢出当前房间；2：当前房间整个被解散
                      (0,
                      TXUntils_1.logInfo)('exit room, reason: '.concat(reason));
                      return [2 /*return*/];
                    });
                  });
                });
            (_c = this._trtcCloud) === null || _c === void 0
              ? void 0
              : _c.on('onRemoteUserEnterRoom', function (userId) {
                  return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                      this._emitEvent(
                        ListenerType_1.default.onRemoteUserEnterRoom,
                        userId,
                      );
                      return [2 /*return*/];
                    });
                  });
                });
            (_d = this._trtcCloud) === null || _d === void 0
              ? void 0
              : _d.on('onRemoteUserLeaveRoom', function (userId, reason) {
                  return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                      this._emitEvent(
                        ListenerType_1.default.onRemoteUserLeaveRoom,
                        { userId: userId, reason: reason },
                      );
                      return [2 /*return*/];
                    });
                  });
                });
            (_e = this._trtcCloud) === null || _e === void 0
              ? void 0
              : _e.on('onUserVideoAvailable', function (userId, available) {
                  _this._emitEvent(
                    ListenerType_1.default.onUserVideoAvailable,
                    { userId: userId, available: available },
                  );
                });
            (_f = this._trtcCloud) === null || _f === void 0
              ? void 0
              : _f.on('onUserAudioAvailable', function (userId, available) {
                  _this._emitEvent(
                    ListenerType_1.default.onUserAudioAvailable,
                    { userId: userId, available: available },
                  );
                });
            (_g = this._trtcCloud) === null || _g === void 0
              ? void 0
              : _g.on('onUserSubStreamAvailable', function (userId, available) {
                  _this._emitEvent(
                    ListenerType_1.default.onUserSubStreamAvailable,
                    { userId: userId, available: available },
                  );
                });
            (_h = this._trtcCloud) === null || _h === void 0
              ? void 0
              : _h.on('onUserVoiceVolume', function (userVolumes) {
                  _this._emitEvent(ListenerType_1.default.onUserVoiceVolume, {
                    userVolumes: userVolumes,
                    totalVolume: 0,
                  });
                });
            (_j = this._trtcCloud) === null || _j === void 0
              ? void 0
              : _j.on('onError', function (errCode, errMsg) {
                  _this._emitEvent(ListenerType_1.default.onError, {
                    errCode: errCode,
                    errMsg: errMsg,
                  });
                });
          };
          TrtcWrapper.prototype._removeTRTCEvents = function () {
            var _a;
            (_a = this._trtcCloud) === null || _a === void 0
              ? void 0
              : _a.removeAllListeners(); // TRTCCloud 继承 eventemitter3
          };
          return TrtcWrapper;
        })();
        exports['default'] = TrtcWrapper;

        /***/
      },

      /***/ 802: /***/ (__unused_webpack_module, exports) => {
        'use strict';

        Object.defineProperty(exports, '__esModule', { value: true });
        exports.getVideoResolution =
          exports.logError =
          exports.logInfo =
          exports.logSuccess =
          exports.noSupportFunction =
          exports.getFlutterArgs =
            void 0;
        var sdkName = '<TRTC Wrapper>';
        function getNowTime() {
          var date = new Date();
          var fmt = 'hh:mm:ss:S';
          var o = {
            'M+': date.getMonth() + 1,
            'd+': date.getDate(),
            'h+': date.getHours(),
            'm+': date.getMinutes(),
            's+': date.getSeconds(),
            'q+': Math.floor((date.getMonth() + 3) / 3),
            S: date.getMilliseconds(), //毫秒
          };
          if (/(y+)/.test(fmt))
            fmt = fmt.replace(
              RegExp.$1,
              (date.getFullYear() + '').substr(4 - RegExp.$1.length),
            );
          for (var k in o)
            if (new RegExp('(' + k + ')').test(fmt))
              fmt = fmt.replace(
                RegExp.$1,
                // eslint-disable-next-line eqeqeq
                RegExp.$1.length == 1
                  ? o[k]
                  : ('00' + o[k]).substr(('' + o[k]).length),
              );
          return fmt;
        }
        function getFlutterArgs(_args, key) {
          try {
            return JSON.parse(_args)[key];
          } catch (ex) {
            logError(
              '_getFlutterArgs error _args: '
                .concat(_args, ' ,key:')
                .concat(key),
            );
          }
        }
        exports.getFlutterArgs = getFlutterArgs;
        function noSupportFunction(funName) {
          console.warn(
            '['
              .concat(getNowTime(), '] ')
              .concat(sdkName, ' web sdk not supper ')
              .concat(funName),
          );
        }
        exports.noSupportFunction = noSupportFunction;
        function logSuccess(line) {
          console.info(
            '%c ['.concat(getNowTime(), '] ').concat(sdkName, ' ').concat(line),
            'color:green;font-size:18px;',
          );
        }
        exports.logSuccess = logSuccess;
        function logInfo(line) {
          console.info(
            '%c ['.concat(getNowTime(), '] ').concat(sdkName, ' ').concat(line),
            'font-size:18px;color:blue;',
          );
        }
        exports.logInfo = logInfo;
        function logError(line) {
          console.error(
            '%c ['.concat(getNowTime(), '] ').concat(sdkName, ' ').concat(line),
            'color:red;font-size:18px',
          );
        }
        exports.logError = logError;
        function getVideoResolution(_videoResolution) {
          var line =
            '120*120 = 1;\n  160*160 = 3;\n  270*270 = 5;\n  480*480 = 7;\n  160*120 = 50;\n  240*180 = 52;\n  280*210 = 54;\n  320*240 = 56;\n  400*300 = 58;\n  480*360 = 60;\n  640*480 = 62;\n  960*720 = 64;\n  160*90 = 100;\n  256*144 = 102;\n  320*180 = 104;\n  480*270 = 106;\n  640*360 = 108;\n  960*540 = 110;\n  1280*720 = 112;\n  1920*1080 = 114;';
          var ls = line.split(';');
          var v = '360*360';
          ls.forEach(function (item) {
            if (
              item.indexOf('=') >= 0 &&
              item.endsWith('= '.concat(_videoResolution))
            ) {
              v = item.split('=')[0].trim().replace(/\n/g, '');
              return v;
            }
          });
          return v;
        }
        exports.getVideoResolution = getVideoResolution;

        /***/
      },

      /******/
    };
    /************************************************************************/
    /******/ // The module cache
    /******/ var __webpack_module_cache__ = {};
    /******/
    /******/ // The require function
    /******/ function __webpack_require__(moduleId) {
      /******/ // Check if module is in cache
      /******/ var cachedModule = __webpack_module_cache__[moduleId];
      /******/ if (cachedModule !== undefined) {
        /******/ return cachedModule.exports;
        /******/
      }
      /******/ // Create a new module (and put it into the cache)
      /******/ var module = (__webpack_module_cache__[moduleId] = {
        /******/ // no module.id needed
        /******/ // no module.loaded needed
        /******/ exports: {},
        /******/
      });
      /******/
      /******/ // Execute the module function
      /******/ __webpack_modules__[moduleId].call(
        module.exports,
        module,
        module.exports,
        __webpack_require__,
      );
      /******/
      /******/ // Return the exports of the module
      /******/ return module.exports;
      /******/
    }
    /******/
    /************************************************************************/
    /******/ /* webpack/runtime/global */
    /******/ (() => {
      /******/ __webpack_require__.g = (function () {
        /******/ if (typeof globalThis === 'object') return globalThis;
        /******/ try {
          /******/ return this || new Function('return this')();
          /******/
        } catch (e) {
          /******/ if (typeof window === 'object') return window;
          /******/
        }
        /******/
      })();
      /******/
    })();
    /******/
    /************************************************************************/
    /******/
    /******/ // startup
    /******/ // Load entry module and return exports
    /******/ // This entry module is referenced by other modules so it can't be inlined
    /******/ var __webpack_exports__ = __webpack_require__(315);
    /******/ __webpack_exports__ = __webpack_exports__['default'];
    /******/
    /******/ return __webpack_exports__;
    /******/
  })();
});
