import gt from "vue";
import ne, { ref as nA, getCurrentScope as ge, onScopeDispose as Ie, unref as Be, watch as Zt, computed as PA, watchEffect as he, onMounted as wt, nextTick as Ce, onUnmounted as ce, onActivated as de, onDeactivated as Ee } from "@vue/composition-api/dist/vue-composition-api.mjs";
import zt from "axios";
var xA, rA, aA, NA, OA, MA, kA, SA, pA, S, fA, q, EA, z, KA, hA, CA, it;
window.JSMpeg = { Player: null, VideoElement: null, BitBuffer: null, Source: {}, Demuxer: {}, Decoder: {}, Renderer: {}, AudioOutput: {}, Now: function() {
  return window.performance ? window.performance.now() / 1e3 : Date.now() / 1e3;
}, CreateVideoElements: function() {
  for (var A = document.querySelectorAll(".jsmpeg"), t = 0; t < A.length; t++)
    new JSMpeg.VideoElement(A[t]);
}, Fill: function(A, t) {
  if (A.fill)
    A.fill(t);
  else
    for (var e = 0; e < A.length; e++)
      A[e] = t;
}, Base64ToArrayBuffer: function(A) {
  for (var t = window.atob(A), e = t.length, i = new Uint8Array(e), o = 0; o < e; o++)
    i[o] = t.charCodeAt(o);
  return i.buffer;
}, WASM_BINARY_INLINED: null }, document.readyState === "complete" ? JSMpeg.CreateVideoElements() : document.addEventListener("DOMContentLoaded", JSMpeg.CreateVideoElements), JSMpeg.VideoElement = ((xA = function(A) {
  var t = A.dataset.url;
  if (!t)
    throw "VideoElement has no `data-url` attribute";
  var e = function(h, B) {
    for (var u in B)
      h.style[u] = B[u];
  };
  this.container = A, e(this.container, { display: "inline-block", position: "relative", minWidth: "80px", minHeight: "80px" }), this.canvas = document.createElement("canvas"), this.canvas.width = 960, this.canvas.height = 540, e(this.canvas, { display: "block", width: "100%" }), this.container.appendChild(this.canvas), this.playButton = document.createElement("div"), this.playButton.innerHTML = xA.PLAY_BUTTON, e(this.playButton, { zIndex: 2, position: "absolute", top: "0", bottom: "0", left: "0", right: "0", maxWidth: "75px", maxHeight: "75px", margin: "auto", opacity: "0.7", cursor: "pointer" }), this.container.appendChild(this.playButton);
  var i = { canvas: this.canvas };
  for (var o in A.dataset)
    try {
      i[o] = JSON.parse(A.dataset[o]);
    } catch {
      i[o] = A.dataset[o];
    }
  if (this.player = new JSMpeg.Player(t, i), A.playerInstance = this.player, !i.poster || i.autoplay || this.player.options.streaming || (i.decodeFirstFrame = !1, this.poster = new Image(), this.poster.src = i.poster, this.poster.addEventListener("load", this.posterLoaded), e(this.poster, { display: "block", zIndex: 1, position: "absolute", top: 0, left: 0, bottom: 0, right: 0 }), this.container.appendChild(this.poster)), this.player.options.streaming || this.container.addEventListener("click", this.onClick.bind(this)), (i.autoplay || this.player.options.streaming) && (this.playButton.style.display = "none"), this.player.audioOut && !this.player.audioOut.unlocked) {
    var g = this.container;
    (i.autoplay || this.player.options.streaming) && (this.unmuteButton = document.createElement("div"), this.unmuteButton.innerHTML = xA.UNMUTE_BUTTON, e(this.unmuteButton, { zIndex: 2, position: "absolute", bottom: "10px", right: "20px", width: "75px", height: "75px", margin: "auto", opacity: "0.7", cursor: "pointer" }), this.container.appendChild(this.unmuteButton), g = this.unmuteButton), this.unlockAudioBound = this.onUnlockAudio.bind(this, g), g.addEventListener("touchstart", this.unlockAudioBound, !1), g.addEventListener("click", this.unlockAudioBound, !0);
  }
}).prototype.onUnlockAudio = function(A, t) {
  this.unmuteButton && (t.preventDefault(), t.stopPropagation()), this.player.audioOut.unlock(function() {
    this.unmuteButton && (this.unmuteButton.style.display = "none"), A.removeEventListener("touchstart", this.unlockAudioBound), A.removeEventListener("click", this.unlockAudioBound);
  }.bind(this));
}, xA.prototype.onClick = function(A) {
  this.player.isPlaying ? (this.player.pause(), this.playButton.style.display = "block") : (this.player.play(), this.playButton.style.display = "none", this.poster && (this.poster.style.display = "none"));
}, xA.PLAY_BUTTON = '<svg style="max-width: 75px; max-height: 75px;" viewBox="0 0 200 200" alt="Play video"><circle cx="100" cy="100" r="90" fill="none" stroke-width="15" stroke="#fff"/><polygon points="70, 55 70, 145 145, 100" fill="#fff"/></svg>', xA.UNMUTE_BUTTON = '<svg style="max-width: 75px; max-height: 75px;" viewBox="0 0 75 75"><polygon class="audio-speaker" stroke="none" fill="#fff" points="39,13 22,28 6,28 6,47 21,47 39,62 39,13"/><g stroke="#fff" stroke-width="5"><path d="M 49,50 69,26"/><path d="M 69,50 49,26"/></g></svg>', xA), JSMpeg.Player = ((rA = function(A, t) {
  if (this.options = t || {}, t.source ? (this.source = new t.source(A, t), t.streaming = !!this.source.streaming) : A.match(/^wss?:\/\//) ? (this.source = new JSMpeg.Source.WebSocket(A, t), t.streaming = !0) : t.progressive !== !1 ? (this.source = new JSMpeg.Source.AjaxProgressive(A, t), t.streaming = !1) : (this.source = new JSMpeg.Source.Ajax(A, t), t.streaming = !1), this.maxAudioLag = t.maxAudioLag || 0.25, this.loop = t.loop !== !1, this.autoplay = !!t.autoplay || t.streaming, this.demuxer = new JSMpeg.Demuxer.TS(t), this.source.connect(this.demuxer), !t.disableWebAssembly && JSMpeg.WASMModule.IsSupported() && (this.wasmModule = JSMpeg.WASMModule.GetModule(), t.wasmModule = this.wasmModule), t.video !== !1 && (this.video = t.wasmModule ? new JSMpeg.Decoder.MPEG1VideoWASM(t) : new JSMpeg.Decoder.MPEG1Video(t), this.renderer = !t.disableGl && JSMpeg.Renderer.WebGL.IsSupported() ? new JSMpeg.Renderer.WebGL(t) : new JSMpeg.Renderer.Canvas2D(t), this.demuxer.connect(JSMpeg.Demuxer.TS.STREAM.VIDEO_1, this.video), this.video.connect(this.renderer)), t.audio !== !1 && JSMpeg.AudioOutput.WebAudio.IsSupported() && (this.audio = t.wasmModule ? new JSMpeg.Decoder.MP2AudioWASM(t) : new JSMpeg.Decoder.MP2Audio(t), this.audioOut = new JSMpeg.AudioOutput.WebAudio(t), this.demuxer.connect(JSMpeg.Demuxer.TS.STREAM.AUDIO_1, this.audio), this.audio.connect(this.audioOut)), Object.defineProperty(this, "currentTime", { get: this.getCurrentTime, set: this.setCurrentTime }), Object.defineProperty(this, "volume", { get: this.getVolume, set: this.setVolume }), this.paused = !0, this.unpauseOnShow = !1, t.pauseWhenHidden !== !1 && document.addEventListener("visibilitychange", this.showHide.bind(this)), this.wasmModule)
    if (this.wasmModule.ready)
      this.startLoading();
    else if (JSMpeg.WASM_BINARY_INLINED) {
      var e = JSMpeg.Base64ToArrayBuffer(JSMpeg.WASM_BINARY_INLINED);
      this.wasmModule.loadFromBuffer(e, this.startLoading.bind(this));
    } else
      this.wasmModule.loadFromFile("jsmpeg.wasm", this.startLoading.bind(this));
  else
    this.startLoading();
}).prototype.startLoading = function() {
  this.source.start(), this.autoplay && this.play();
}, rA.prototype.showHide = function(A) {
  document.visibilityState === "hidden" ? (this.unpauseOnShow = this.wantsToPlay, this.pause()) : this.unpauseOnShow && this.play();
}, rA.prototype.play = function(A) {
  this.animationId || (this.animationId = requestAnimationFrame(this.update.bind(this)), this.wantsToPlay = !0, this.paused = !1);
}, rA.prototype.pause = function(A) {
  this.paused || (cancelAnimationFrame(this.animationId), this.animationId = null, this.wantsToPlay = !1, this.isPlaying = !1, this.paused = !0, this.audio && this.audio.canPlay && (this.audioOut.stop(), this.seek(this.currentTime)), this.options.onPause && this.options.onPause(this));
}, rA.prototype.getVolume = function() {
  return this.audioOut ? this.audioOut.volume : 0;
}, rA.prototype.setVolume = function(A) {
  this.audioOut && (this.audioOut.volume = A);
}, rA.prototype.stop = function(A) {
  this.pause(), this.seek(0), this.video && this.options.decodeFirstFrame !== !1 && this.video.decode();
}, rA.prototype.destroy = function() {
  this.pause(), this.source.destroy(), this.video && this.video.destroy(), this.renderer && this.renderer.destroy(), this.audio && this.audio.destroy(), this.audioOut && this.audioOut.destroy();
}, rA.prototype.seek = function(A) {
  var t = this.audio && this.audio.canPlay ? this.audio.startTime : this.video.startTime;
  this.video && this.video.seek(A + t), this.audio && this.audio.seek(A + t), this.startTime = JSMpeg.Now() - A;
}, rA.prototype.getCurrentTime = function() {
  return this.audio && this.audio.canPlay ? this.audio.currentTime - this.audio.startTime : this.video.currentTime - this.video.startTime;
}, rA.prototype.setCurrentTime = function(A) {
  this.seek(A);
}, rA.prototype.update = function() {
  this.animationId = requestAnimationFrame(this.update.bind(this)), this.source.established ? (this.isPlaying || (this.isPlaying = !0, this.startTime = JSMpeg.Now() - this.currentTime, this.options.onPlay && this.options.onPlay(this)), this.options.streaming ? this.updateForStreaming() : this.updateForStaticFile()) : this.renderer && this.renderer.renderProgress(this.source.progress);
}, rA.prototype.updateForStreaming = function() {
  if (this.video && this.video.decode(), this.audio) {
    var A = !1;
    do
      this.audioOut.enqueuedTime > this.maxAudioLag && (this.audioOut.resetEnqueuedTime(), this.audioOut.enabled = !1), A = this.audio.decode();
    while (A);
    this.audioOut.enabled = !0;
  }
}, rA.prototype.nextFrame = function() {
  return !(!this.source.established || !this.video) && this.video.decode();
}, rA.prototype.updateForStaticFile = function() {
  var A = !1, t = 0;
  if (this.audio && this.audio.canPlay) {
    for (; !A && this.audio.decodedTime - this.audio.currentTime < 0.25; )
      A = !this.audio.decode();
    this.video && this.video.currentTime < this.audio.currentTime && (A = !this.video.decode()), t = this.demuxer.currentTime - this.audio.currentTime;
  } else if (this.video) {
    var e = JSMpeg.Now() - this.startTime + this.video.startTime, i = e - this.video.currentTime, o = 1 / this.video.frameRate;
    this.video && i > 0 && (i > 2 * o && (this.startTime += i), A = !this.video.decode()), t = this.demuxer.currentTime - e;
  }
  this.source.resume(t), A && this.source.completed ? this.loop ? this.seek(0) : (this.pause(), this.options.onEnded && this.options.onEnded(this)) : A && this.options.onStalled && this.options.onStalled(this);
}, rA), JSMpeg.BitBuffer = ((aA = function(A, t) {
  typeof A == "object" ? (this.bytes = A instanceof Uint8Array ? A : new Uint8Array(A), this.byteLength = this.bytes.length) : (this.bytes = new Uint8Array(A || 1048576), this.byteLength = 0), this.mode = t || aA.MODE.EXPAND, this.index = 0;
}).prototype.resize = function(A) {
  var t = new Uint8Array(A);
  this.byteLength !== 0 && (this.byteLength = Math.min(this.byteLength, A), t.set(this.bytes, 0, this.byteLength)), this.bytes = t, this.index = Math.min(this.index, this.byteLength << 3);
}, aA.prototype.evict = function(A) {
  var t = this.index >> 3, e = this.bytes.length - this.byteLength;
  if (this.index === this.byteLength << 3 || A > e + t)
    return this.byteLength = 0, void (this.index = 0);
  t !== 0 && (this.bytes.copyWithin ? this.bytes.copyWithin(0, t, this.byteLength) : this.bytes.set(this.bytes.subarray(t, this.byteLength)), this.byteLength = this.byteLength - t, this.index -= t << 3);
}, aA.prototype.write = function(A) {
  var t = typeof A[0] == "object", e = 0, i = this.bytes.length - this.byteLength;
  if (t) {
    e = 0;
    for (var o = 0; o < A.length; o++)
      e += A[o].byteLength;
  } else
    e = A.byteLength;
  if (e > i)
    if (this.mode === aA.MODE.EXPAND) {
      var g = Math.max(2 * this.bytes.length, e - i);
      this.resize(g);
    } else
      this.evict(e);
  if (t)
    for (o = 0; o < A.length; o++)
      this.appendSingleBuffer(A[o]);
  else
    this.appendSingleBuffer(A);
  return e;
}, aA.prototype.appendSingleBuffer = function(A) {
  A = A instanceof Uint8Array ? A : new Uint8Array(A), this.bytes.set(A, this.byteLength), this.byteLength += A.length;
}, aA.prototype.findNextStartCode = function() {
  for (var A = this.index + 7 >> 3; A < this.byteLength; A++)
    if (this.bytes[A] == 0 && this.bytes[A + 1] == 0 && this.bytes[A + 2] == 1)
      return this.index = A + 4 << 3, this.bytes[A + 3];
  return this.index = this.byteLength << 3, -1;
}, aA.prototype.findStartCode = function(A) {
  for (var t = 0; ; )
    if ((t = this.findNextStartCode()) === A || t === -1)
      return t;
  return -1;
}, aA.prototype.nextBytesAreStartCode = function() {
  var A = this.index + 7 >> 3;
  return A >= this.byteLength || this.bytes[A] == 0 && this.bytes[A + 1] == 0 && this.bytes[A + 2] == 1;
}, aA.prototype.peek = function(A) {
  for (var t = this.index, e = 0; A; ) {
    var i = 8 - (7 & t), o = i < A ? i : A, g = i - o;
    e = e << o | (this.bytes[t >> 3] & 255 >> 8 - o << g) >> g, t += o, A -= o;
  }
  return e;
}, aA.prototype.read = function(A) {
  var t = this.peek(A);
  return this.index += A, t;
}, aA.prototype.skip = function(A) {
  return this.index += A;
}, aA.prototype.rewind = function(A) {
  this.index = Math.max(this.index - A, 0);
}, aA.prototype.has = function(A) {
  return (this.byteLength << 3) - this.index >= A;
}, aA.MODE = { EVICT: 1, EXPAND: 2 }, aA), JSMpeg.Source.Ajax = ((NA = function(A, t) {
  this.url = A, this.destination = null, this.request = null, this.streaming = !1, this.completed = !1, this.established = !1, this.progress = 0, this.onEstablishedCallback = t.onSourceEstablished, this.onCompletedCallback = t.onSourceCompleted;
}).prototype.connect = function(A) {
  this.destination = A;
}, NA.prototype.start = function() {
  this.request = new XMLHttpRequest(), this.request.onreadystatechange = function() {
    this.request.readyState === this.request.DONE && this.request.status === 200 && this.onLoad(this.request.response);
  }.bind(this), this.request.onprogress = this.onProgress.bind(this), this.request.open("GET", this.url), this.request.responseType = "arraybuffer", this.request.send();
}, NA.prototype.resume = function(A) {
}, NA.prototype.destroy = function() {
  this.request.abort();
}, NA.prototype.onProgress = function(A) {
  this.progress = A.loaded / A.total;
}, NA.prototype.onLoad = function(A) {
  this.established = !0, this.completed = !0, this.progress = 1, this.onEstablishedCallback && this.onEstablishedCallback(this), this.onCompletedCallback && this.onCompletedCallback(this), this.destination && this.destination.write(A);
}, NA), JSMpeg.Source.Fetch = ((OA = function(A, t) {
  this.url = A, this.destination = null, this.request = null, this.streaming = !0, this.completed = !1, this.established = !1, this.progress = 0, this.aborted = !1, this.onEstablishedCallback = t.onSourceEstablished, this.onCompletedCallback = t.onSourceCompleted;
}).prototype.connect = function(A) {
  this.destination = A;
}, OA.prototype.start = function() {
  var A = { method: "GET", headers: new Headers(), cache: "default" };
  self.fetch(this.url, A).then(function(t) {
    if (t.ok && t.status >= 200 && t.status <= 299)
      return this.progress = 1, this.established = !0, this.pump(t.body.getReader());
  }.bind(this)).catch(function(t) {
    throw t;
  });
}, OA.prototype.pump = function(A) {
  return A.read().then(function(t) {
    if (!t.done)
      return this.aborted ? A.cancel() : (this.destination && this.destination.write(t.value.buffer), this.pump(A));
    this.completed = !0;
  }.bind(this)).catch(function(t) {
    throw t;
  });
}, OA.prototype.resume = function(A) {
}, OA.prototype.abort = function() {
  this.aborted = !0;
}, OA), JSMpeg.Source.AjaxProgressive = ((MA = function(A, t) {
  this.url = A, this.destination = null, this.request = null, this.streaming = !1, this.completed = !1, this.established = !1, this.progress = 0, this.fileSize = 0, this.loadedSize = 0, this.chunkSize = t.chunkSize || 1048576, this.isLoading = !1, this.loadStartTime = 0, this.throttled = t.throttled !== !1, this.aborted = !1, this.onEstablishedCallback = t.onSourceEstablished, this.onCompletedCallback = t.onSourceCompleted;
}).prototype.connect = function(A) {
  this.destination = A;
}, MA.prototype.start = function() {
  this.request = new XMLHttpRequest(), this.request.onreadystatechange = function() {
    this.request.readyState === this.request.DONE && (this.fileSize = parseInt(this.request.getResponseHeader("Content-Length")), this.loadNextChunk());
  }.bind(this), this.request.onprogress = this.onProgress.bind(this), this.request.open("HEAD", this.url), this.request.send();
}, MA.prototype.resume = function(A) {
  !this.isLoading && this.throttled && 8 * this.loadTime + 2 > A && this.loadNextChunk();
}, MA.prototype.destroy = function() {
  this.request.abort(), this.aborted = !0;
}, MA.prototype.loadNextChunk = function() {
  var A = this.loadedSize, t = Math.min(this.loadedSize + this.chunkSize - 1, this.fileSize - 1);
  if (A >= this.fileSize || this.aborted)
    return this.completed = !0, void (this.onCompletedCallback && this.onCompletedCallback(this));
  this.isLoading = !0, this.loadStartTime = JSMpeg.Now(), this.request = new XMLHttpRequest(), this.request.onreadystatechange = function() {
    this.request.readyState === this.request.DONE && this.request.status >= 200 && this.request.status < 300 ? this.onChunkLoad(this.request.response) : this.request.readyState === this.request.DONE && this.loadFails++ < 3 && this.loadNextChunk();
  }.bind(this), A === 0 && (this.request.onprogress = this.onProgress.bind(this)), this.request.open("GET", this.url + "?" + A + "-" + t), this.request.setRequestHeader("Range", "bytes=" + A + "-" + t), this.request.responseType = "arraybuffer", this.request.send();
}, MA.prototype.onProgress = function(A) {
  this.progress = A.loaded / A.total;
}, MA.prototype.onChunkLoad = function(A) {
  var t = !this.established;
  this.established = !0, this.progress = 1, this.loadedSize += A.byteLength, this.loadFails = 0, this.isLoading = !1, t && this.onEstablishedCallback && this.onEstablishedCallback(this), this.destination && this.destination.write(A), this.loadTime = JSMpeg.Now() - this.loadStartTime, this.throttled || this.loadNextChunk();
}, MA), JSMpeg.Source.WebSocket = ((kA = function(A, t) {
  this.url = A, this.options = t, this.socket = null, this.streaming = !0, this.callbacks = { connect: [], data: [] }, this.destination = null, this.reconnectInterval = t.reconnectInterval !== void 0 ? t.reconnectInterval : 5, this.shouldAttemptReconnect = !!this.reconnectInterval, this.completed = !1, this.established = !1, this.progress = 0, this.reconnectTimeoutId = 0, this.onEstablishedCallback = t.onSourceEstablished, this.onCompletedCallback = t.onSourceCompleted;
}).prototype.connect = function(A) {
  this.destination = A;
}, kA.prototype.destroy = function() {
  clearTimeout(this.reconnectTimeoutId), this.shouldAttemptReconnect = !1, this.socket.close();
}, kA.prototype.start = function() {
  this.shouldAttemptReconnect = !!this.reconnectInterval, this.progress = 0, this.established = !1, this.options.protocols ? this.socket = new WebSocket(this.url, this.options.protocols) : this.socket = new WebSocket(this.url), this.socket.binaryType = "arraybuffer", this.socket.onmessage = this.onMessage.bind(this), this.socket.onopen = this.onOpen.bind(this), this.socket.onerror = this.onClose.bind(this), this.socket.onclose = this.onClose.bind(this);
}, kA.prototype.resume = function(A) {
}, kA.prototype.onOpen = function() {
  this.progress = 1;
}, kA.prototype.onClose = function() {
  this.shouldAttemptReconnect && (clearTimeout(this.reconnectTimeoutId), this.reconnectTimeoutId = setTimeout(function() {
    this.start();
  }.bind(this), 1e3 * this.reconnectInterval));
}, kA.prototype.onMessage = function(A) {
  var t = !this.established;
  this.established = !0, t && this.onEstablishedCallback && this.onEstablishedCallback(this), this.destination && this.destination.write(A.data);
}, kA), JSMpeg.Demuxer.TS = ((SA = function(A) {
  this.bits = null, this.leftoverBytes = null, this.guessVideoFrameEnd = !0, this.pidsToStreamIds = {}, this.pesPacketInfo = {}, this.startTime = 0, this.currentTime = 0;
}).prototype.connect = function(A, t) {
  this.pesPacketInfo[A] = { destination: t, currentLength: 0, totalLength: 0, pts: 0, buffers: [] };
}, SA.prototype.write = function(A) {
  if (this.leftoverBytes) {
    var t = A.byteLength + this.leftoverBytes.byteLength;
    this.bits = new JSMpeg.BitBuffer(t), this.bits.write([this.leftoverBytes, A]);
  } else
    this.bits = new JSMpeg.BitBuffer(A);
  for (; this.bits.has(1504) && this.parsePacket(); )
    ;
  var e = this.bits.byteLength - (this.bits.index >> 3);
  this.leftoverBytes = e > 0 ? this.bits.bytes.subarray(this.bits.index >> 3) : null;
}, SA.prototype.parsePacket = function() {
  if (this.bits.read(8) !== 71 && !this.resync())
    return !1;
  var A = 187 + (this.bits.index >> 3);
  this.bits.read(1);
  var t = this.bits.read(1);
  this.bits.read(1);
  var e = this.bits.read(13);
  this.bits.read(2);
  var i = this.bits.read(2);
  this.bits.read(4);
  var o = this.pidsToStreamIds[e];
  if (t && o && (b = this.pesPacketInfo[o]) && b.currentLength && this.packetComplete(b), 1 & i) {
    if (2 & i) {
      var g = this.bits.read(8);
      this.bits.skip(g << 3);
    }
    if (t && this.bits.nextBytesAreStartCode()) {
      this.bits.skip(24), o = this.bits.read(8), this.pidsToStreamIds[e] = o;
      var h = this.bits.read(16);
      this.bits.skip(8);
      var B = this.bits.read(2);
      this.bits.skip(6);
      var u = this.bits.read(8), c = this.bits.index + (u << 3);
      if (b = this.pesPacketInfo[o]) {
        var f = 0;
        if (2 & B) {
          this.bits.skip(4);
          var n = this.bits.read(3);
          this.bits.skip(1);
          var d = this.bits.read(15);
          this.bits.skip(1);
          var E = this.bits.read(15);
          this.bits.skip(1), f = (1073741824 * n + 32768 * d + E) / 9e4, this.currentTime = f, this.startTime === -1 && (this.startTime = f);
        }
        var I = h ? h - u - 3 : 0;
        this.packetStart(b, f, I);
      }
      this.bits.index = c;
    }
    var b;
    if (o && (b = this.pesPacketInfo[o])) {
      var s = this.bits.index >> 3, a = !t && 2 & i;
      (this.packetAddData(b, s, A) || this.guessVideoFrameEnd && a) && this.packetComplete(b);
    }
  }
  return this.bits.index = A << 3, !0;
}, SA.prototype.resync = function() {
  if (!this.bits.has(9024))
    return !1;
  for (var A = this.bits.index >> 3, t = 0; t < 187; t++)
    if (this.bits.bytes[A + t] === 71) {
      for (var e = !0, i = 1; i < 5; i++)
        if (this.bits.bytes[A + t + 188 * i] !== 71) {
          e = !1;
          break;
        }
      if (e)
        return this.bits.index = A + t + 1 << 3, !0;
    }
  return this.bits.skip(1496), !1;
}, SA.prototype.packetStart = function(A, t, e) {
  A.totalLength = e, A.currentLength = 0, A.pts = t;
}, SA.prototype.packetAddData = function(A, t, e) {
  return A.buffers.push(this.bits.bytes.subarray(t, e)), A.currentLength += e - t, A.totalLength !== 0 && A.currentLength >= A.totalLength;
}, SA.prototype.packetComplete = function(A) {
  A.destination.write(A.pts, A.buffers), A.totalLength = 0, A.currentLength = 0, A.buffers = [];
}, SA.STREAM = { PACK_HEADER: 186, SYSTEM_HEADER: 187, PROGRAM_MAP: 188, PRIVATE_1: 189, PADDING: 190, PRIVATE_2: 191, AUDIO_1: 192, VIDEO_1: 224, DIRECTORY: 255 }, SA), JSMpeg.Decoder.Base = ((pA = function(A) {
  this.destination = null, this.canPlay = !1, this.collectTimestamps = !A.streaming, this.bytesWritten = 0, this.timestamps = [], this.timestampIndex = 0, this.startTime = 0, this.decodedTime = 0, Object.defineProperty(this, "currentTime", { get: this.getCurrentTime });
}).prototype.destroy = function() {
}, pA.prototype.connect = function(A) {
  this.destination = A;
}, pA.prototype.bufferGetIndex = function() {
  return this.bits.index;
}, pA.prototype.bufferSetIndex = function(A) {
  this.bits.index = A;
}, pA.prototype.bufferWrite = function(A) {
  return this.bits.write(A);
}, pA.prototype.write = function(A, t) {
  this.collectTimestamps && (this.timestamps.length === 0 && (this.startTime = A, this.decodedTime = A), this.timestamps.push({ index: this.bytesWritten << 3, time: A })), this.bytesWritten += this.bufferWrite(t), this.canPlay = !0;
}, pA.prototype.seek = function(A) {
  if (this.collectTimestamps) {
    this.timestampIndex = 0;
    for (var t = 0; t < this.timestamps.length && !(this.timestamps[t].time > A); t++)
      this.timestampIndex = t;
    var e = this.timestamps[this.timestampIndex];
    e ? (this.bufferSetIndex(e.index), this.decodedTime = e.time) : (this.bufferSetIndex(0), this.decodedTime = this.startTime);
  }
}, pA.prototype.decode = function() {
  this.advanceDecodedTime(0);
}, pA.prototype.advanceDecodedTime = function(A) {
  if (this.collectTimestamps) {
    for (var t = -1, e = this.bufferGetIndex(), i = this.timestampIndex; i < this.timestamps.length && !(this.timestamps[i].index > e); i++)
      t = i;
    if (t !== -1 && t !== this.timestampIndex)
      return this.timestampIndex = t, void (this.decodedTime = this.timestamps[this.timestampIndex].time);
  }
  this.decodedTime += A;
}, pA.prototype.getCurrentTime = function() {
  return this.decodedTime;
}, pA), JSMpeg.Decoder.MPEG1Video = (((S = function(A) {
  JSMpeg.Decoder.Base.call(this, A), this.onDecodeCallback = A.onVideoDecode;
  var t = A.videoBufferSize || 524288, e = A.streaming ? JSMpeg.BitBuffer.MODE.EVICT : JSMpeg.BitBuffer.MODE.EXPAND;
  this.bits = new JSMpeg.BitBuffer(t, e), this.customIntraQuantMatrix = new Uint8Array(64), this.customNonIntraQuantMatrix = new Uint8Array(64), this.blockData = new Int32Array(64), this.currentFrame = 0, this.decodeFirstFrame = A.decodeFirstFrame !== !1;
}).prototype = Object.create(JSMpeg.Decoder.Base.prototype)).constructor = S, S.prototype.write = function(A, t) {
  if (JSMpeg.Decoder.Base.prototype.write.call(this, A, t), !this.hasSequenceHeader) {
    if (this.bits.findStartCode(S.START.SEQUENCE) === -1)
      return !1;
    this.decodeSequenceHeader(), this.decodeFirstFrame && this.decode();
  }
}, S.prototype.decode = function() {
  var A = JSMpeg.Now();
  if (!this.hasSequenceHeader)
    return !1;
  if (this.bits.findStartCode(S.START.PICTURE) === -1)
    return this.bits.byteLength, this.bits.index, !1;
  this.decodePicture(), this.advanceDecodedTime(1 / this.frameRate);
  var t = JSMpeg.Now() - A;
  return this.onDecodeCallback && this.onDecodeCallback(this, t), !0;
}, S.prototype.readHuffman = function(A) {
  var t = 0;
  do
    t = A[t + this.bits.read(1)];
  while (t >= 0 && A[t] !== 0);
  return A[t + 2];
}, S.prototype.frameRate = 30, S.prototype.decodeSequenceHeader = function() {
  var A = this.bits.read(12), t = this.bits.read(12);
  if (this.bits.skip(4), this.frameRate = S.PICTURE_RATE[this.bits.read(4)], this.bits.skip(30), A === this.width && t === this.height || (this.width = A, this.height = t, this.initBuffers(), this.destination && this.destination.resize(A, t)), this.bits.read(1)) {
    for (var e = 0; e < 64; e++)
      this.customIntraQuantMatrix[S.ZIG_ZAG[e]] = this.bits.read(8);
    this.intraQuantMatrix = this.customIntraQuantMatrix;
  }
  if (this.bits.read(1)) {
    for (e = 0; e < 64; e++) {
      var i = S.ZIG_ZAG[e];
      this.customNonIntraQuantMatrix[i] = this.bits.read(8);
    }
    this.nonIntraQuantMatrix = this.customNonIntraQuantMatrix;
  }
  this.hasSequenceHeader = !0;
}, S.prototype.initBuffers = function() {
  this.intraQuantMatrix = S.DEFAULT_INTRA_QUANT_MATRIX, this.nonIntraQuantMatrix = S.DEFAULT_NON_INTRA_QUANT_MATRIX, this.mbWidth = this.width + 15 >> 4, this.mbHeight = this.height + 15 >> 4, this.mbSize = this.mbWidth * this.mbHeight, this.codedWidth = this.mbWidth << 4, this.codedHeight = this.mbHeight << 4, this.codedSize = this.codedWidth * this.codedHeight, this.halfWidth = this.mbWidth << 3, this.halfHeight = this.mbHeight << 3, this.currentY = new Uint8ClampedArray(this.codedSize), this.currentY32 = new Uint32Array(this.currentY.buffer), this.currentCr = new Uint8ClampedArray(this.codedSize >> 2), this.currentCr32 = new Uint32Array(this.currentCr.buffer), this.currentCb = new Uint8ClampedArray(this.codedSize >> 2), this.currentCb32 = new Uint32Array(this.currentCb.buffer), this.forwardY = new Uint8ClampedArray(this.codedSize), this.forwardY32 = new Uint32Array(this.forwardY.buffer), this.forwardCr = new Uint8ClampedArray(this.codedSize >> 2), this.forwardCr32 = new Uint32Array(this.forwardCr.buffer), this.forwardCb = new Uint8ClampedArray(this.codedSize >> 2), this.forwardCb32 = new Uint32Array(this.forwardCb.buffer);
}, S.prototype.currentY = null, S.prototype.currentCr = null, S.prototype.currentCb = null, S.prototype.pictureType = 0, S.prototype.forwardY = null, S.prototype.forwardCr = null, S.prototype.forwardCb = null, S.prototype.fullPelForward = !1, S.prototype.forwardFCode = 0, S.prototype.forwardRSize = 0, S.prototype.forwardF = 0, S.prototype.decodePicture = function(A) {
  if (this.currentFrame++, this.bits.skip(10), this.pictureType = this.bits.read(3), this.bits.skip(16), !(this.pictureType <= 0 || this.pictureType >= S.PICTURE_TYPE.B)) {
    if (this.pictureType === S.PICTURE_TYPE.PREDICTIVE) {
      if (this.fullPelForward = this.bits.read(1), this.forwardFCode = this.bits.read(3), this.forwardFCode === 0)
        return;
      this.forwardRSize = this.forwardFCode - 1, this.forwardF = 1 << this.forwardRSize;
    }
    var t = 0;
    do
      t = this.bits.findNextStartCode();
    while (t === S.START.EXTENSION || t === S.START.USER_DATA);
    for (; t >= S.START.SLICE_FIRST && t <= S.START.SLICE_LAST; )
      this.decodeSlice(255 & t), t = this.bits.findNextStartCode();
    if (t !== -1 && this.bits.rewind(32), this.destination && this.destination.render(this.currentY, this.currentCr, this.currentCb, !0), this.pictureType === S.PICTURE_TYPE.INTRA || this.pictureType === S.PICTURE_TYPE.PREDICTIVE) {
      var e = this.forwardY, i = this.forwardY32, o = this.forwardCr, g = this.forwardCr32, h = this.forwardCb, B = this.forwardCb32;
      this.forwardY = this.currentY, this.forwardY32 = this.currentY32, this.forwardCr = this.currentCr, this.forwardCr32 = this.currentCr32, this.forwardCb = this.currentCb, this.forwardCb32 = this.currentCb32, this.currentY = e, this.currentY32 = i, this.currentCr = o, this.currentCr32 = g, this.currentCb = h, this.currentCb32 = B;
    }
  }
}, S.prototype.quantizerScale = 0, S.prototype.sliceBegin = !1, S.prototype.decodeSlice = function(A) {
  for (this.sliceBegin = !0, this.macroblockAddress = (A - 1) * this.mbWidth - 1, this.motionFwH = this.motionFwHPrev = 0, this.motionFwV = this.motionFwVPrev = 0, this.dcPredictorY = 128, this.dcPredictorCr = 128, this.dcPredictorCb = 128, this.quantizerScale = this.bits.read(5); this.bits.read(1); )
    this.bits.skip(8);
  do
    this.decodeMacroblock();
  while (!this.bits.nextBytesAreStartCode());
}, S.prototype.macroblockAddress = 0, S.prototype.mbRow = 0, S.prototype.mbCol = 0, S.prototype.macroblockType = 0, S.prototype.macroblockIntra = !1, S.prototype.macroblockMotFw = !1, S.prototype.motionFwH = 0, S.prototype.motionFwV = 0, S.prototype.motionFwHPrev = 0, S.prototype.motionFwVPrev = 0, S.prototype.decodeMacroblock = function() {
  for (var A = 0, t = this.readHuffman(S.MACROBLOCK_ADDRESS_INCREMENT); t === 34; )
    t = this.readHuffman(S.MACROBLOCK_ADDRESS_INCREMENT);
  for (; t === 35; )
    A += 33, t = this.readHuffman(S.MACROBLOCK_ADDRESS_INCREMENT);
  if (A += t, this.sliceBegin)
    this.sliceBegin = !1, this.macroblockAddress += A;
  else {
    if (this.macroblockAddress + A >= this.mbSize)
      return;
    for (A > 1 && (this.dcPredictorY = 128, this.dcPredictorCr = 128, this.dcPredictorCb = 128, this.pictureType === S.PICTURE_TYPE.PREDICTIVE && (this.motionFwH = this.motionFwHPrev = 0, this.motionFwV = this.motionFwVPrev = 0)); A > 1; )
      this.macroblockAddress++, this.mbRow = this.macroblockAddress / this.mbWidth | 0, this.mbCol = this.macroblockAddress % this.mbWidth, this.copyMacroblock(this.motionFwH, this.motionFwV, this.forwardY, this.forwardCr, this.forwardCb), A--;
    this.macroblockAddress++;
  }
  this.mbRow = this.macroblockAddress / this.mbWidth | 0, this.mbCol = this.macroblockAddress % this.mbWidth;
  var e = S.MACROBLOCK_TYPE[this.pictureType];
  this.macroblockType = this.readHuffman(e), this.macroblockIntra = 1 & this.macroblockType, this.macroblockMotFw = 8 & this.macroblockType, 16 & this.macroblockType && (this.quantizerScale = this.bits.read(5)), this.macroblockIntra ? (this.motionFwH = this.motionFwHPrev = 0, this.motionFwV = this.motionFwVPrev = 0) : (this.dcPredictorY = 128, this.dcPredictorCr = 128, this.dcPredictorCb = 128, this.decodeMotionVectors(), this.copyMacroblock(this.motionFwH, this.motionFwV, this.forwardY, this.forwardCr, this.forwardCb));
  for (var i = 2 & this.macroblockType ? this.readHuffman(S.CODE_BLOCK_PATTERN) : this.macroblockIntra ? 63 : 0, o = 0, g = 32; o < 6; o++)
    i & g && this.decodeBlock(o), g >>= 1;
}, S.prototype.decodeMotionVectors = function() {
  var A, t, e = 0;
  this.macroblockMotFw ? ((A = this.readHuffman(S.MOTION)) !== 0 && this.forwardF !== 1 ? (e = this.bits.read(this.forwardRSize), t = (Math.abs(A) - 1 << this.forwardRSize) + e + 1, A < 0 && (t = -t)) : t = A, this.motionFwHPrev += t, this.motionFwHPrev > (this.forwardF << 4) - 1 ? this.motionFwHPrev -= this.forwardF << 5 : this.motionFwHPrev < -this.forwardF << 4 && (this.motionFwHPrev += this.forwardF << 5), this.motionFwH = this.motionFwHPrev, this.fullPelForward && (this.motionFwH <<= 1), (A = this.readHuffman(S.MOTION)) !== 0 && this.forwardF !== 1 ? (e = this.bits.read(this.forwardRSize), t = (Math.abs(A) - 1 << this.forwardRSize) + e + 1, A < 0 && (t = -t)) : t = A, this.motionFwVPrev += t, this.motionFwVPrev > (this.forwardF << 4) - 1 ? this.motionFwVPrev -= this.forwardF << 5 : this.motionFwVPrev < -this.forwardF << 4 && (this.motionFwVPrev += this.forwardF << 5), this.motionFwV = this.motionFwVPrev, this.fullPelForward && (this.motionFwV <<= 1)) : this.pictureType === S.PICTURE_TYPE.PREDICTIVE && (this.motionFwH = this.motionFwHPrev = 0, this.motionFwV = this.motionFwVPrev = 0);
}, S.prototype.copyMacroblock = function(A, t, e, i, o) {
  var g, h, B, u, c, f, n, d, E, I, b, s, a, Q, r, C, l, p, m, D = this.currentY32, G = this.currentCb32, R = this.currentCr32;
  if (h = (g = this.codedWidth) - 16, B = A >> 1, u = t >> 1, c = (1 & A) == 1, f = (1 & t) == 1, n = ((this.mbRow << 4) + u) * g + (this.mbCol << 4) + B, E = (d = this.mbRow * g + this.mbCol << 2) + (g << 2), c)
    if (f)
      for (; d < E; ) {
        for (b = e[n] + e[n + g], n++, I = 0; I < 4; I++)
          a = b + (s = e[n] + e[n + g]) + 2 >> 2 & 255, a |= (b = e[++n] + e[n + g]) + s + 2 << 6 & 65280, a |= b + (s = e[++n] + e[n + g]) + 2 << 14 & 16711680, b = e[++n] + e[n + g], n++, a |= b + s + 2 << 22 & 4278190080, D[d++] = a;
        d += h >> 2, n += h - 1;
      }
    else
      for (; d < E; ) {
        for (b = e[n++], I = 0; I < 4; I++)
          a = b + (s = e[n++]) + 1 >> 1 & 255, a |= (b = e[n++]) + s + 1 << 7 & 65280, a |= b + (s = e[n++]) + 1 << 15 & 16711680, a |= (b = e[n++]) + s + 1 << 23 & 4278190080, D[d++] = a;
        d += h >> 2, n += h - 1;
      }
  else if (f)
    for (; d < E; ) {
      for (I = 0; I < 4; I++)
        a = e[n] + e[n + g] + 1 >> 1 & 255, a |= e[++n] + e[n + g] + 1 << 7 & 65280, a |= e[++n] + e[n + g] + 1 << 15 & 16711680, a |= e[++n] + e[n + g] + 1 << 23 & 4278190080, n++, D[d++] = a;
      d += h >> 2, n += h;
    }
  else
    for (; d < E; ) {
      for (I = 0; I < 4; I++)
        a = e[n], a |= e[++n] << 8, a |= e[++n] << 16, a |= e[++n] << 24, n++, D[d++] = a;
      d += h >> 2, n += h;
    }
  if (h = (g = this.halfWidth) - 8, B = A / 2 >> 1, u = t / 2 >> 1, c = (A / 2 & 1) == 1, f = (t / 2 & 1) == 1, n = ((this.mbRow << 3) + u) * g + (this.mbCol << 3) + B, E = (d = this.mbRow * g + this.mbCol << 1) + (g << 1), c)
    if (f)
      for (; d < E; ) {
        for (Q = i[n] + i[n + g], l = o[n] + o[n + g], n++, I = 0; I < 2; I++)
          C = Q + (r = i[n] + i[n + g]) + 2 >> 2 & 255, m = l + (p = o[n] + o[n + g]) + 2 >> 2 & 255, C |= (Q = i[++n] + i[n + g]) + r + 2 << 6 & 65280, m |= (l = o[n] + o[n + g]) + p + 2 << 6 & 65280, C |= Q + (r = i[++n] + i[n + g]) + 2 << 14 & 16711680, m |= l + (p = o[n] + o[n + g]) + 2 << 14 & 16711680, Q = i[++n] + i[n + g], l = o[n] + o[n + g], n++, C |= Q + r + 2 << 22 & 4278190080, m |= l + p + 2 << 22 & 4278190080, R[d] = C, G[d] = m, d++;
        d += h >> 2, n += h - 1;
      }
    else
      for (; d < E; ) {
        for (Q = i[n], l = o[n], n++, I = 0; I < 2; I++)
          C = Q + (r = i[n]) + 1 >> 1 & 255, m = l + (p = o[n++]) + 1 >> 1 & 255, C |= (Q = i[n]) + r + 1 << 7 & 65280, m |= (l = o[n++]) + p + 1 << 7 & 65280, C |= Q + (r = i[n]) + 1 << 15 & 16711680, m |= l + (p = o[n++]) + 1 << 15 & 16711680, C |= (Q = i[n]) + r + 1 << 23 & 4278190080, m |= (l = o[n++]) + p + 1 << 23 & 4278190080, R[d] = C, G[d] = m, d++;
        d += h >> 2, n += h - 1;
      }
  else if (f)
    for (; d < E; ) {
      for (I = 0; I < 2; I++)
        C = i[n] + i[n + g] + 1 >> 1 & 255, m = o[n] + o[n + g] + 1 >> 1 & 255, C |= i[++n] + i[n + g] + 1 << 7 & 65280, m |= o[n] + o[n + g] + 1 << 7 & 65280, C |= i[++n] + i[n + g] + 1 << 15 & 16711680, m |= o[n] + o[n + g] + 1 << 15 & 16711680, C |= i[++n] + i[n + g] + 1 << 23 & 4278190080, m |= o[n] + o[n + g] + 1 << 23 & 4278190080, n++, R[d] = C, G[d] = m, d++;
      d += h >> 2, n += h;
    }
  else
    for (; d < E; ) {
      for (I = 0; I < 2; I++)
        C = i[n], m = o[n], C |= i[++n] << 8, m |= o[n] << 8, C |= i[++n] << 16, m |= o[n] << 16, C |= i[++n] << 24, m |= o[n] << 24, n++, R[d] = C, G[d] = m, d++;
      d += h >> 2, n += h;
    }
}, S.prototype.dcPredictorY = 0, S.prototype.dcPredictorCr = 0, S.prototype.dcPredictorCb = 0, S.prototype.blockData = null, S.prototype.decodeBlock = function(A) {
  var t, e = 0;
  if (this.macroblockIntra) {
    var i, o;
    if (A < 4 ? (i = this.dcPredictorY, o = this.readHuffman(S.DCT_DC_SIZE_LUMINANCE)) : (i = A === 4 ? this.dcPredictorCr : this.dcPredictorCb, o = this.readHuffman(S.DCT_DC_SIZE_CHROMINANCE)), o > 0) {
      var g = this.bits.read(o);
      this.blockData[0] = g & 1 << o - 1 ? i + g : i + (-1 << o | g + 1);
    } else
      this.blockData[0] = i;
    A < 4 ? this.dcPredictorY = this.blockData[0] : A === 4 ? this.dcPredictorCr = this.blockData[0] : this.dcPredictorCb = this.blockData[0], this.blockData[0] <<= 8, t = this.intraQuantMatrix, e = 1;
  } else
    t = this.nonIntraQuantMatrix;
  for (var h, B, u, c = 0; ; ) {
    var f = 0, n = this.readHuffman(S.DCT_COEFF);
    if (n === 1 && e > 0 && this.bits.read(1) === 0)
      break;
    n === 65535 ? (f = this.bits.read(6), (c = this.bits.read(8)) === 0 ? c = this.bits.read(8) : c === 128 ? c = this.bits.read(8) - 256 : c > 128 && (c -= 256)) : (f = n >> 8, c = 255 & n, this.bits.read(1) && (c = -c));
    var d = S.ZIG_ZAG[e += f];
    e++, c <<= 1, this.macroblockIntra || (c += c < 0 ? -1 : 1), !(1 & (c = c * this.quantizerScale * t[d] >> 4)) && (c -= c > 0 ? 1 : -1), c > 2047 ? c = 2047 : c < -2048 && (c = -2048), this.blockData[d] = c * S.PREMULTIPLIER_MATRIX[d];
  }
  A < 4 ? (h = this.currentY, u = this.codedWidth - 8, B = this.mbRow * this.codedWidth + this.mbCol << 4, 1 & A && (B += 8), 2 & A && (B += this.codedWidth << 3)) : (h = A === 4 ? this.currentCb : this.currentCr, u = (this.codedWidth >> 1) - 8, B = (this.mbRow * this.codedWidth << 2) + (this.mbCol << 3)), this.macroblockIntra ? e === 1 ? (S.CopyValueToDestination(this.blockData[0] + 128 >> 8, h, B, u), this.blockData[0] = 0) : (S.IDCT(this.blockData), S.CopyBlockToDestination(this.blockData, h, B, u), JSMpeg.Fill(this.blockData, 0)) : e === 1 ? (S.AddValueToDestination(this.blockData[0] + 128 >> 8, h, B, u), this.blockData[0] = 0) : (S.IDCT(this.blockData), S.AddBlockToDestination(this.blockData, h, B, u), JSMpeg.Fill(this.blockData, 0)), e = 0;
}, S.CopyBlockToDestination = function(A, t, e, i) {
  for (var o = 0; o < 64; o += 8, e += i + 8)
    t[e + 0] = A[o + 0], t[e + 1] = A[o + 1], t[e + 2] = A[o + 2], t[e + 3] = A[o + 3], t[e + 4] = A[o + 4], t[e + 5] = A[o + 5], t[e + 6] = A[o + 6], t[e + 7] = A[o + 7];
}, S.AddBlockToDestination = function(A, t, e, i) {
  for (var o = 0; o < 64; o += 8, e += i + 8)
    t[e + 0] += A[o + 0], t[e + 1] += A[o + 1], t[e + 2] += A[o + 2], t[e + 3] += A[o + 3], t[e + 4] += A[o + 4], t[e + 5] += A[o + 5], t[e + 6] += A[o + 6], t[e + 7] += A[o + 7];
}, S.CopyValueToDestination = function(A, t, e, i) {
  for (var o = 0; o < 64; o += 8, e += i + 8)
    t[e + 0] = A, t[e + 1] = A, t[e + 2] = A, t[e + 3] = A, t[e + 4] = A, t[e + 5] = A, t[e + 6] = A, t[e + 7] = A;
}, S.AddValueToDestination = function(A, t, e, i) {
  for (var o = 0; o < 64; o += 8, e += i + 8)
    t[e + 0] += A, t[e + 1] += A, t[e + 2] += A, t[e + 3] += A, t[e + 4] += A, t[e + 5] += A, t[e + 6] += A, t[e + 7] += A;
}, S.IDCT = function(A) {
  for (var t, e, i, o, g, h, B, u, c, f, n, d, E, I, b, s, a, Q, r = 0; r < 8; ++r)
    t = A[32 + r], e = A[16 + r] + A[48 + r], i = A[40 + r] - A[24 + r], h = A[8 + r] + A[56 + r], B = A[24 + r] + A[40 + r], c = (E = (473 * (o = A[8 + r] - A[56 + r]) - 196 * i + 128 >> 8) - (g = h + B)) - (362 * (h - B) + 128 >> 8), I = (f = (u = A[0 + r]) - t) + (n = (362 * (A[16 + r] - A[48 + r]) + 128 >> 8) - e), b = (d = u + t) + e, s = f - n, a = d - e, Q = -c - (473 * i + 196 * o + 128 >> 8), A[0 + r] = g + b, A[8 + r] = E + I, A[16 + r] = s - c, A[24 + r] = a - Q, A[32 + r] = a + Q, A[40 + r] = c + s, A[48 + r] = I - E, A[56 + r] = b - g;
  for (r = 0; r < 64; r += 8)
    t = A[4 + r], e = A[2 + r] + A[6 + r], i = A[5 + r] - A[3 + r], h = A[1 + r] + A[7 + r], B = A[3 + r] + A[5 + r], c = (E = (473 * (o = A[1 + r] - A[7 + r]) - 196 * i + 128 >> 8) - (g = h + B)) - (362 * (h - B) + 128 >> 8), I = (f = (u = A[0 + r]) - t) + (n = (362 * (A[2 + r] - A[6 + r]) + 128 >> 8) - e), b = (d = u + t) + e, s = f - n, a = d - e, Q = -c - (473 * i + 196 * o + 128 >> 8), A[0 + r] = g + b + 128 >> 8, A[1 + r] = E + I + 128 >> 8, A[2 + r] = s - c + 128 >> 8, A[3 + r] = a - Q + 128 >> 8, A[4 + r] = a + Q + 128 >> 8, A[5 + r] = c + s + 128 >> 8, A[6 + r] = I - E + 128 >> 8, A[7 + r] = b - g + 128 >> 8;
}, S.PICTURE_RATE = [0, 23.976, 24, 25, 29.97, 30, 50, 59.94, 60, 0, 0, 0, 0, 0, 0, 0], S.ZIG_ZAG = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]), S.DEFAULT_INTRA_QUANT_MATRIX = new Uint8Array([8, 16, 19, 22, 26, 27, 29, 34, 16, 16, 22, 24, 27, 29, 34, 37, 19, 22, 26, 27, 29, 34, 34, 38, 22, 22, 26, 27, 29, 34, 37, 40, 22, 26, 27, 29, 32, 35, 40, 48, 26, 27, 29, 32, 35, 40, 48, 58, 26, 27, 29, 34, 38, 46, 56, 69, 27, 29, 35, 38, 46, 56, 69, 83]), S.DEFAULT_NON_INTRA_QUANT_MATRIX = new Uint8Array([16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16]), S.PREMULTIPLIER_MATRIX = new Uint8Array([32, 44, 42, 38, 32, 25, 17, 9, 44, 62, 58, 52, 44, 35, 24, 12, 42, 58, 55, 49, 42, 33, 23, 12, 38, 52, 49, 44, 38, 30, 20, 10, 32, 44, 42, 38, 32, 25, 17, 9, 25, 35, 33, 30, 25, 20, 14, 7, 17, 24, 23, 20, 17, 14, 9, 5, 9, 12, 12, 10, 9, 7, 5, 2]), S.MACROBLOCK_ADDRESS_INCREMENT = new Int16Array([3, 6, 0, 9, 12, 0, 0, 0, 1, 15, 18, 0, 21, 24, 0, 27, 30, 0, 33, 36, 0, 0, 0, 3, 0, 0, 2, 39, 42, 0, 45, 48, 0, 0, 0, 5, 0, 0, 4, 51, 54, 0, 57, 60, 0, 0, 0, 7, 0, 0, 6, 63, 66, 0, 69, 72, 0, 75, 78, 0, 81, 84, 0, -1, 87, 0, -1, 90, 0, 93, 96, 0, 99, 102, 0, 105, 108, 0, 111, 114, 0, 0, 0, 9, 0, 0, 8, 117, 120, 0, 123, 126, 0, 129, 132, 0, 135, 138, 0, 0, 0, 15, 0, 0, 14, 0, 0, 13, 0, 0, 12, 0, 0, 11, 0, 0, 10, 141, -1, 0, -1, 144, 0, 147, 150, 0, 153, 156, 0, 159, 162, 0, 165, 168, 0, 171, 174, 0, 177, 180, 0, 183, -1, 0, -1, 186, 0, 189, 192, 0, 195, 198, 0, 201, 204, 0, 207, 210, 0, 213, 216, 0, 219, 222, 0, 0, 0, 21, 0, 0, 20, 0, 0, 19, 0, 0, 18, 0, 0, 17, 0, 0, 16, 0, 0, 35, 0, 0, 34, 0, 0, 33, 0, 0, 32, 0, 0, 31, 0, 0, 30, 0, 0, 29, 0, 0, 28, 0, 0, 27, 0, 0, 26, 0, 0, 25, 0, 0, 24, 0, 0, 23, 0, 0, 22]), S.MACROBLOCK_TYPE_INTRA = new Int8Array([3, 6, 0, -1, 9, 0, 0, 0, 1, 0, 0, 17]), S.MACROBLOCK_TYPE_PREDICTIVE = new Int8Array([3, 6, 0, 9, 12, 0, 0, 0, 10, 15, 18, 0, 0, 0, 2, 21, 24, 0, 0, 0, 8, 27, 30, 0, 33, 36, 0, -1, 39, 0, 0, 0, 18, 0, 0, 26, 0, 0, 1, 0, 0, 17]), S.MACROBLOCK_TYPE_B = new Int8Array([3, 6, 0, 9, 15, 0, 12, 18, 0, 24, 21, 0, 0, 0, 12, 27, 30, 0, 0, 0, 14, 39, 42, 0, 36, 33, 0, 0, 0, 4, 0, 0, 6, 54, 48, 0, 45, 51, 0, 0, 0, 8, 0, 0, 10, -1, 57, 0, 0, 0, 1, 60, 63, 0, 0, 0, 30, 0, 0, 17, 0, 0, 22, 0, 0, 26]), S.MACROBLOCK_TYPE = [null, S.MACROBLOCK_TYPE_INTRA, S.MACROBLOCK_TYPE_PREDICTIVE, S.MACROBLOCK_TYPE_B], S.CODE_BLOCK_PATTERN = new Int16Array([6, 3, 0, 9, 18, 0, 12, 15, 0, 24, 33, 0, 36, 39, 0, 27, 21, 0, 30, 42, 0, 60, 57, 0, 54, 48, 0, 69, 51, 0, 81, 75, 0, 63, 84, 0, 45, 66, 0, 72, 78, 0, 0, 0, 60, 105, 120, 0, 132, 144, 0, 114, 108, 0, 126, 141, 0, 87, 93, 0, 117, 96, 0, 0, 0, 32, 135, 138, 0, 99, 123, 0, 129, 102, 0, 0, 0, 4, 90, 111, 0, 0, 0, 8, 0, 0, 16, 0, 0, 44, 150, 168, 0, 0, 0, 28, 0, 0, 52, 0, 0, 62, 183, 177, 0, 156, 180, 0, 0, 0, 1, 165, 162, 0, 0, 0, 61, 0, 0, 56, 171, 174, 0, 0, 0, 2, 0, 0, 40, 153, 186, 0, 0, 0, 48, 192, 189, 0, 147, 159, 0, 0, 0, 20, 0, 0, 12, 240, 249, 0, 0, 0, 63, 231, 225, 0, 195, 219, 0, 252, 198, 0, 0, 0, 24, 0, 0, 36, 0, 0, 3, 207, 261, 0, 243, 237, 0, 204, 213, 0, 210, 234, 0, 201, 228, 0, 216, 222, 0, 258, 255, 0, 264, 246, 0, -1, 282, 0, 285, 291, 0, 0, 0, 33, 0, 0, 9, 318, 330, 0, 306, 348, 0, 0, 0, 5, 0, 0, 10, 279, 267, 0, 0, 0, 6, 0, 0, 18, 0, 0, 17, 0, 0, 34, 339, 357, 0, 309, 312, 0, 270, 276, 0, 327, 321, 0, 351, 354, 0, 303, 297, 0, 294, 288, 0, 300, 273, 0, 342, 345, 0, 315, 324, 0, 336, 333, 0, 363, 375, 0, 0, 0, 41, 0, 0, 14, 0, 0, 21, 372, 366, 0, 360, 369, 0, 0, 0, 11, 0, 0, 19, 0, 0, 7, 0, 0, 35, 0, 0, 13, 0, 0, 50, 0, 0, 49, 0, 0, 58, 0, 0, 37, 0, 0, 25, 0, 0, 45, 0, 0, 57, 0, 0, 26, 0, 0, 29, 0, 0, 38, 0, 0, 53, 0, 0, 23, 0, 0, 43, 0, 0, 46, 0, 0, 42, 0, 0, 22, 0, 0, 54, 0, 0, 51, 0, 0, 15, 0, 0, 30, 0, 0, 39, 0, 0, 47, 0, 0, 55, 0, 0, 27, 0, 0, 59, 0, 0, 31]), S.MOTION = new Int16Array([3, 6, 0, 12, 9, 0, 0, 0, 0, 18, 15, 0, 24, 21, 0, 0, 0, -1, 0, 0, 1, 27, 30, 0, 36, 33, 0, 0, 0, 2, 0, 0, -2, 42, 45, 0, 48, 39, 0, 60, 54, 0, 0, 0, 3, 0, 0, -3, 51, 57, 0, -1, 69, 0, 81, 75, 0, 78, 63, 0, 72, 66, 0, 96, 84, 0, 87, 93, 0, -1, 99, 0, 108, 105, 0, 0, 0, -4, 90, 102, 0, 0, 0, 4, 0, 0, -7, 0, 0, 5, 111, 123, 0, 0, 0, -5, 0, 0, 7, 114, 120, 0, 126, 117, 0, 0, 0, -6, 0, 0, 6, 153, 162, 0, 150, 147, 0, 135, 138, 0, 156, 141, 0, 129, 159, 0, 132, 144, 0, 0, 0, 10, 0, 0, 9, 0, 0, 8, 0, 0, -8, 171, 198, 0, 0, 0, -9, 180, 192, 0, 168, 183, 0, 165, 186, 0, 174, 189, 0, 0, 0, -10, 177, 195, 0, 0, 0, 12, 0, 0, 16, 0, 0, 13, 0, 0, 14, 0, 0, 11, 0, 0, 15, 0, 0, -16, 0, 0, -12, 0, 0, -14, 0, 0, -15, 0, 0, -11, 0, 0, -13]), S.DCT_DC_SIZE_LUMINANCE = new Int8Array([6, 3, 0, 18, 15, 0, 9, 12, 0, 0, 0, 1, 0, 0, 2, 27, 24, 0, 21, 30, 0, 0, 0, 0, 36, 33, 0, 0, 0, 4, 0, 0, 3, 39, 42, 0, 0, 0, 5, 0, 0, 6, 48, 45, 0, 51, -1, 0, 0, 0, 7, 0, 0, 8]), S.DCT_DC_SIZE_CHROMINANCE = new Int8Array([6, 3, 0, 12, 9, 0, 18, 15, 0, 24, 21, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 30, 27, 0, 0, 0, 3, 36, 33, 0, 0, 0, 4, 42, 39, 0, 0, 0, 5, 48, 45, 0, 0, 0, 6, 51, -1, 0, 0, 0, 7, 0, 0, 8]), S.DCT_COEFF = new Int32Array([3, 6, 0, 12, 9, 0, 0, 0, 1, 21, 24, 0, 18, 15, 0, 39, 27, 0, 33, 30, 0, 42, 36, 0, 0, 0, 257, 60, 66, 0, 54, 63, 0, 48, 57, 0, 0, 0, 513, 51, 45, 0, 0, 0, 2, 0, 0, 3, 81, 75, 0, 87, 93, 0, 72, 78, 0, 96, 90, 0, 0, 0, 1025, 69, 84, 0, 0, 0, 769, 0, 0, 258, 0, 0, 1793, 0, 0, 65535, 0, 0, 1537, 111, 108, 0, 0, 0, 1281, 105, 102, 0, 117, 114, 0, 99, 126, 0, 120, 123, 0, 156, 150, 0, 162, 159, 0, 144, 147, 0, 129, 135, 0, 138, 132, 0, 0, 0, 2049, 0, 0, 4, 0, 0, 514, 0, 0, 2305, 153, 141, 0, 165, 171, 0, 180, 168, 0, 177, 174, 0, 183, 186, 0, 0, 0, 2561, 0, 0, 3329, 0, 0, 6, 0, 0, 259, 0, 0, 5, 0, 0, 770, 0, 0, 2817, 0, 0, 3073, 228, 225, 0, 201, 210, 0, 219, 213, 0, 234, 222, 0, 216, 231, 0, 207, 192, 0, 204, 189, 0, 198, 195, 0, 243, 261, 0, 273, 240, 0, 246, 237, 0, 249, 258, 0, 279, 276, 0, 252, 255, 0, 270, 282, 0, 264, 267, 0, 0, 0, 515, 0, 0, 260, 0, 0, 7, 0, 0, 1026, 0, 0, 1282, 0, 0, 4097, 0, 0, 3841, 0, 0, 3585, 315, 321, 0, 333, 342, 0, 312, 291, 0, 375, 357, 0, 288, 294, 0, -1, 369, 0, 285, 303, 0, 318, 363, 0, 297, 306, 0, 339, 309, 0, 336, 348, 0, 330, 300, 0, 372, 345, 0, 351, 366, 0, 327, 354, 0, 360, 324, 0, 381, 408, 0, 417, 420, 0, 390, 378, 0, 435, 438, 0, 384, 387, 0, 0, 0, 2050, 396, 402, 0, 465, 462, 0, 0, 0, 8, 411, 399, 0, 429, 432, 0, 453, 414, 0, 426, 423, 0, 0, 0, 10, 0, 0, 9, 0, 0, 11, 0, 0, 5377, 0, 0, 1538, 0, 0, 771, 0, 0, 5121, 0, 0, 1794, 0, 0, 4353, 0, 0, 4609, 0, 0, 4865, 444, 456, 0, 0, 0, 1027, 459, 450, 0, 0, 0, 261, 393, 405, 0, 0, 0, 516, 447, 441, 0, 516, 519, 0, 486, 474, 0, 510, 483, 0, 504, 498, 0, 471, 537, 0, 507, 501, 0, 522, 513, 0, 534, 531, 0, 468, 477, 0, 492, 495, 0, 549, 546, 0, 525, 528, 0, 0, 0, 263, 0, 0, 2562, 0, 0, 2306, 0, 0, 5633, 0, 0, 5889, 0, 0, 6401, 0, 0, 6145, 0, 0, 1283, 0, 0, 772, 0, 0, 13, 0, 0, 12, 0, 0, 14, 0, 0, 15, 0, 0, 517, 0, 0, 6657, 0, 0, 262, 540, 543, 0, 480, 489, 0, 588, 597, 0, 0, 0, 27, 609, 555, 0, 606, 603, 0, 0, 0, 19, 0, 0, 22, 591, 621, 0, 0, 0, 18, 573, 576, 0, 564, 570, 0, 0, 0, 20, 552, 582, 0, 0, 0, 21, 558, 579, 0, 0, 0, 23, 612, 594, 0, 0, 0, 25, 0, 0, 24, 600, 615, 0, 0, 0, 31, 0, 0, 30, 0, 0, 28, 0, 0, 29, 0, 0, 26, 0, 0, 17, 0, 0, 16, 567, 618, 0, 561, 585, 0, 654, 633, 0, 0, 0, 37, 645, 648, 0, 0, 0, 36, 630, 636, 0, 0, 0, 34, 639, 627, 0, 663, 666, 0, 657, 624, 0, 651, 642, 0, 669, 660, 0, 0, 0, 35, 0, 0, 267, 0, 0, 40, 0, 0, 268, 0, 0, 266, 0, 0, 32, 0, 0, 264, 0, 0, 265, 0, 0, 38, 0, 0, 269, 0, 0, 270, 0, 0, 33, 0, 0, 39, 0, 0, 7937, 0, 0, 6913, 0, 0, 7681, 0, 0, 4098, 0, 0, 7425, 0, 0, 7169, 0, 0, 271, 0, 0, 274, 0, 0, 273, 0, 0, 272, 0, 0, 1539, 0, 0, 2818, 0, 0, 3586, 0, 0, 3330, 0, 0, 3074, 0, 0, 3842]), S.PICTURE_TYPE = { INTRA: 1, PREDICTIVE: 2, B: 3 }, S.START = { SEQUENCE: 179, SLICE_FIRST: 1, SLICE_LAST: 175, PICTURE: 0, EXTENSION: 181, USER_DATA: 178 }, S), JSMpeg.Decoder.MPEG1VideoWASM = (((fA = function(A) {
  JSMpeg.Decoder.Base.call(this, A), this.onDecodeCallback = A.onVideoDecode, this.module = A.wasmModule, this.bufferSize = A.videoBufferSize || 524288, this.bufferMode = A.streaming ? JSMpeg.BitBuffer.MODE.EVICT : JSMpeg.BitBuffer.MODE.EXPAND, this.decodeFirstFrame = A.decodeFirstFrame !== !1, this.hasSequenceHeader = !1;
}).prototype = Object.create(JSMpeg.Decoder.Base.prototype)).constructor = fA, fA.prototype.initializeWasmDecoder = function() {
  this.module.instance && (this.instance = this.module.instance, this.functions = this.module.instance.exports, this.decoder = this.functions._mpeg1_decoder_create(this.bufferSize, this.bufferMode));
}, fA.prototype.destroy = function() {
  this.decoder && this.functions._mpeg1_decoder_destroy(this.decoder);
}, fA.prototype.bufferGetIndex = function() {
  if (this.decoder)
    return this.functions._mpeg1_decoder_get_index(this.decoder);
}, fA.prototype.bufferSetIndex = function(A) {
  this.decoder && this.functions._mpeg1_decoder_set_index(this.decoder, A);
}, fA.prototype.bufferWrite = function(A) {
  this.decoder || this.initializeWasmDecoder();
  for (var t = 0, e = 0; e < A.length; e++)
    t += A[e].length;
  var i = this.functions._mpeg1_decoder_get_write_ptr(this.decoder, t);
  for (e = 0; e < A.length; e++)
    this.instance.heapU8.set(A[e], i), i += A[e].length;
  return this.functions._mpeg1_decoder_did_write(this.decoder, t), t;
}, fA.prototype.write = function(A, t) {
  JSMpeg.Decoder.Base.prototype.write.call(this, A, t), !this.hasSequenceHeader && this.functions._mpeg1_decoder_has_sequence_header(this.decoder) && this.loadSequenceHeader();
}, fA.prototype.loadSequenceHeader = function() {
  if (this.hasSequenceHeader = !0, this.frameRate = this.functions._mpeg1_decoder_get_frame_rate(this.decoder), this.codedSize = this.functions._mpeg1_decoder_get_coded_size(this.decoder), this.destination) {
    var A = this.functions._mpeg1_decoder_get_width(this.decoder), t = this.functions._mpeg1_decoder_get_height(this.decoder);
    this.destination.resize(A, t);
  }
  this.decodeFirstFrame && this.decode();
}, fA.prototype.decode = function() {
  var A = JSMpeg.Now();
  if (!this.decoder || !this.functions._mpeg1_decoder_decode(this.decoder))
    return !1;
  if (this.destination) {
    var t = this.functions._mpeg1_decoder_get_y_ptr(this.decoder), e = this.functions._mpeg1_decoder_get_cr_ptr(this.decoder), i = this.functions._mpeg1_decoder_get_cb_ptr(this.decoder), o = this.instance.heapU8.subarray(t, t + this.codedSize), g = this.instance.heapU8.subarray(e, e + (this.codedSize >> 2)), h = this.instance.heapU8.subarray(i, i + (this.codedSize >> 2));
    this.destination.render(o, g, h, !1);
  }
  this.advanceDecodedTime(1 / this.frameRate);
  var B = JSMpeg.Now() - A;
  return this.onDecodeCallback && this.onDecodeCallback(this, B), !0;
}, fA), JSMpeg.Decoder.MP2Audio = ((q = function(A) {
  JSMpeg.Decoder.Base.call(this, A), this.onDecodeCallback = A.onAudioDecode;
  var t = A.audioBufferSize || 131072, e = A.streaming ? JSMpeg.BitBuffer.MODE.EVICT : JSMpeg.BitBuffer.MODE.EXPAND;
  this.bits = new JSMpeg.BitBuffer(t, e), this.left = new Float32Array(1152), this.right = new Float32Array(1152), this.sampleRate = 44100, this.D = new Float32Array(1024), this.D.set(q.SYNTHESIS_WINDOW, 0), this.D.set(q.SYNTHESIS_WINDOW, 512), this.V = [new Float32Array(1024), new Float32Array(1024)], this.U = new Int32Array(32), this.VPos = 0, this.allocation = [new Array(32), new Array(32)], this.scaleFactorInfo = [new Uint8Array(32), new Uint8Array(32)], this.scaleFactor = [new Array(32), new Array(32)], this.sample = [new Array(32), new Array(32)];
  for (var i = 0; i < 2; i++)
    for (var o = 0; o < 32; o++)
      this.scaleFactor[i][o] = [0, 0, 0], this.sample[i][o] = [0, 0, 0];
}).prototype = Object.create(JSMpeg.Decoder.Base.prototype), q.prototype.constructor = q, q.prototype.decode = function() {
  var A = JSMpeg.Now(), t = this.bits.index >> 3;
  if (t >= this.bits.byteLength)
    return !1;
  var e = this.decodeFrame(this.left, this.right);
  if (this.bits.index = t + e << 3, !e)
    return !1;
  this.destination && this.destination.play(this.sampleRate, this.left, this.right), this.advanceDecodedTime(this.left.length / this.sampleRate);
  var i = JSMpeg.Now() - A;
  return this.onDecodeCallback && this.onDecodeCallback(this, i), !0;
}, q.prototype.getCurrentTime = function() {
  var A = this.destination ? this.destination.enqueuedTime : 0;
  return this.decodedTime - A;
}, q.prototype.decodeFrame = function(A, t) {
  var e = this.bits.read(11), i = this.bits.read(2), o = this.bits.read(2), g = !this.bits.read(1);
  if (e !== q.FRAME_SYNC || i !== q.VERSION.MPEG_1 || o !== q.LAYER.II)
    return 0;
  var h = this.bits.read(4) - 1;
  if (h > 13)
    return 0;
  var B = this.bits.read(2), u = q.SAMPLE_RATE[B];
  if (B === 3)
    return 0;
  i === q.VERSION.MPEG_2 && (B += 4, h += 14);
  var c = this.bits.read(1);
  this.bits.read(1);
  var f = this.bits.read(2), n = 0;
  f === q.MODE.JOINT_STEREO ? n = this.bits.read(2) + 1 << 2 : (this.bits.skip(2), n = f === q.MODE.MONO ? 0 : 32), this.bits.skip(4), g && this.bits.skip(16);
  var d = 144e3 * q.BIT_RATE[h] / (u = q.SAMPLE_RATE[B]) + c | 0, E = 0, I = 0;
  if (i === q.VERSION.MPEG_2)
    E = 2, I = 30;
  else {
    var b = f === q.MODE.MONO ? 0 : 1, s = q.QUANT_LUT_STEP_1[b][h];
    I = 63 & (E = q.QUANT_LUT_STEP_2[s][B]), E >>= 6;
  }
  n > I && (n = I);
  for (var a = 0; a < n; a++)
    this.allocation[0][a] = this.readAllocation(a, E), this.allocation[1][a] = this.readAllocation(a, E);
  for (a = n; a < I; a++)
    this.allocation[0][a] = this.allocation[1][a] = this.readAllocation(a, E);
  var Q = f === q.MODE.MONO ? 1 : 2;
  for (a = 0; a < I; a++) {
    for (r = 0; r < Q; r++)
      this.allocation[r][a] && (this.scaleFactorInfo[r][a] = this.bits.read(2));
    f === q.MODE.MONO && (this.scaleFactorInfo[1][a] = this.scaleFactorInfo[0][a]);
  }
  for (a = 0; a < I; a++) {
    for (var r = 0; r < Q; r++)
      if (this.allocation[r][a]) {
        var C = this.scaleFactor[r][a];
        switch (this.scaleFactorInfo[r][a]) {
          case 0:
            C[0] = this.bits.read(6), C[1] = this.bits.read(6), C[2] = this.bits.read(6);
            break;
          case 1:
            C[0] = C[1] = this.bits.read(6), C[2] = this.bits.read(6);
            break;
          case 2:
            C[0] = C[1] = C[2] = this.bits.read(6);
            break;
          case 3:
            C[0] = this.bits.read(6), C[1] = C[2] = this.bits.read(6);
        }
      }
    f === q.MODE.MONO && (this.scaleFactor[1][a][0] = this.scaleFactor[0][a][0], this.scaleFactor[1][a][1] = this.scaleFactor[0][a][1], this.scaleFactor[1][a][2] = this.scaleFactor[0][a][2]);
  }
  for (var l = 0, p = 0; p < 3; p++)
    for (var m = 0; m < 4; m++) {
      for (a = 0; a < n; a++)
        this.readSamples(0, a, p), this.readSamples(1, a, p);
      for (a = n; a < I; a++)
        this.readSamples(0, a, p), this.sample[1][a][0] = this.sample[0][a][0], this.sample[1][a][1] = this.sample[0][a][1], this.sample[1][a][2] = this.sample[0][a][2];
      for (a = I; a < 32; a++)
        this.sample[0][a][0] = 0, this.sample[0][a][1] = 0, this.sample[0][a][2] = 0, this.sample[1][a][0] = 0, this.sample[1][a][1] = 0, this.sample[1][a][2] = 0;
      for (var D = 0; D < 3; D++) {
        for (this.VPos = this.VPos - 64 & 1023, r = 0; r < 2; r++) {
          q.MatrixTransform(this.sample[r], D, this.V[r], this.VPos), JSMpeg.Fill(this.U, 0);
          for (var G = 512 - (this.VPos >> 1), R = this.VPos % 128 >> 1; R < 1024; ) {
            for (var N = 0; N < 32; ++N)
              this.U[N] += this.D[G++] * this.V[r][R++];
            R += 96, G += 32;
          }
          for (R = 1120 - R, G -= 480; R < 1024; ) {
            for (N = 0; N < 32; ++N)
              this.U[N] += this.D[G++] * this.V[r][R++];
            R += 96, G += 32;
          }
          for (var L = r === 0 ? A : t, J = 0; J < 32; J++)
            L[l + J] = this.U[J] / 2147418112;
        }
        l += 32;
      }
    }
  return this.sampleRate = u, d;
}, q.prototype.readAllocation = function(A, t) {
  var e = q.QUANT_LUT_STEP_3[t][A], i = q.QUANT_LUT_STEP4[15 & e][this.bits.read(e >> 4)];
  return i ? q.QUANT_TAB[i - 1] : 0;
}, q.prototype.readSamples = function(A, t, e) {
  var i = this.allocation[A][t], o = this.scaleFactor[A][t][e], g = this.sample[A][t], h = 0;
  if (i) {
    if (o === 63)
      o = 0;
    else {
      var B = o / 3 | 0;
      o = q.SCALEFACTOR_BASE[o % 3] + (1 << B >> 1) >> B;
    }
    var u = i.levels;
    i.group ? (h = this.bits.read(i.bits), g[0] = h % u, h = h / u | 0, g[1] = h % u, g[2] = h / u | 0) : (g[0] = this.bits.read(i.bits), g[1] = this.bits.read(i.bits), g[2] = this.bits.read(i.bits));
    var c = 65536 / (u + 1) | 0;
    h = ((u = (u + 1 >> 1) - 1) - g[0]) * c, g[0] = h * (o >> 12) + (h * (4095 & o) + 2048 >> 12) >> 12, h = (u - g[1]) * c, g[1] = h * (o >> 12) + (h * (4095 & o) + 2048 >> 12) >> 12, h = (u - g[2]) * c, g[2] = h * (o >> 12) + (h * (4095 & o) + 2048 >> 12) >> 12;
  } else
    g[0] = g[1] = g[2] = 0;
}, q.MatrixTransform = function(A, t, e, i) {
  var o, g, h, B, u, c, f, n, d, E, I, b, s, a, Q, r, C, l, p, m, D, G, R, N, L, J, _, U, k, F, x, y, v;
  o = A[0][t] + A[31][t], g = 0.500602998235 * (A[0][t] - A[31][t]), h = A[1][t] + A[30][t], B = 0.505470959898 * (A[1][t] - A[30][t]), u = A[2][t] + A[29][t], c = 0.515447309923 * (A[2][t] - A[29][t]), f = A[3][t] + A[28][t], n = 0.53104259109 * (A[3][t] - A[28][t]), d = A[4][t] + A[27][t], E = 0.553103896034 * (A[4][t] - A[27][t]), I = A[5][t] + A[26][t], b = 0.582934968206 * (A[5][t] - A[26][t]), s = A[6][t] + A[25][t], a = 0.622504123036 * (A[6][t] - A[25][t]), Q = A[7][t] + A[24][t], r = 0.674808341455 * (A[7][t] - A[24][t]), C = A[8][t] + A[23][t], l = 0.744536271002 * (A[8][t] - A[23][t]), p = A[9][t] + A[22][t], m = 0.839349645416 * (A[9][t] - A[22][t]), D = A[10][t] + A[21][t], G = 0.972568237862 * (A[10][t] - A[21][t]), R = A[11][t] + A[20][t], N = 1.16943993343 * (A[11][t] - A[20][t]), L = A[12][t] + A[19][t], J = 1.48416461631 * (A[12][t] - A[19][t]), _ = A[13][t] + A[18][t], U = 2.05778100995 * (A[13][t] - A[18][t]), k = A[14][t] + A[17][t], F = 3.40760841847 * (A[14][t] - A[17][t]), v = o + (x = A[15][t] + A[16][t]), x = 0.502419286188 * (o - x), o = h + k, k = 0.52249861494 * (h - k), h = u + _, _ = 0.566944034816 * (u - _), u = f + L, L = 0.64682178336 * (f - L), f = d + R, R = 0.788154623451 * (d - R), d = I + D, D = 1.06067768599 * (I - D), I = s + p, p = 1.72244709824 * (s - p), s = Q + C, C = 5.10114861869 * (Q - C), Q = v + s, s = 0.509795579104 * (v - s), v = o + I, o = 0.601344886935 * (o - I), I = h + d, d = 0.899976223136 * (h - d), h = u + f, f = 2.56291544774 * (u - f), u = Q + h, Q = 0.541196100146 * (Q - h), h = v + I, I = 1.30656296488 * (v - I), v = u + h, u = 0.707106781187 * (u - h), h = Q + I, h += Q = 0.707106781187 * (Q - I), I = s + f, s = 0.541196100146 * (s - f), f = o + d, d = 1.30656296488 * (o - d), o = I + f, f = 0.707106781187 * (I - f), I = s + d, o += I += s = 0.707106781187 * (s - d), I += f, f += s, d = x + C, x = 0.509795579104 * (x - C), C = k + p, k = 0.601344886935 * (k - p), p = _ + D, D = 0.899976223136 * (_ - D), _ = L + R, R = 2.56291544774 * (L - R), L = d + _, d = 0.541196100146 * (d - _), _ = C + p, p = 1.30656296488 * (C - p), C = L + _, _ = 0.707106781187 * (L - _), L = d + p, p = 0.707106781187 * (d - p), d = x + R, x = 0.541196100146 * (x - R), R = k + D, D = 1.30656296488 * (k - D), k = d + R, R = 0.707106781187 * (d - R), d = x + D, C += k += d += x = 0.707106781187 * (x - D), k += L += p, L += d += R, d += _, _ += R += x, R += p, p += x, D = g + (y = 10.1900081235 * (A[15][t] - A[16][t])), g = 0.502419286188 * (g - y), y = B + F, B = 0.52249861494 * (B - F), F = c + U, U = 0.566944034816 * (c - U), c = n + J, n = 0.64682178336 * (n - J), J = E + N, E = 0.788154623451 * (E - N), N = b + G, G = 1.06067768599 * (b - G), b = a + m, m = 1.72244709824 * (a - m), a = r + l, r = 5.10114861869 * (r - l), l = D + a, a = 0.509795579104 * (D - a), D = y + b, y = 0.601344886935 * (y - b), b = F + N, N = 0.899976223136 * (F - N), F = c + J, J = 2.56291544774 * (c - J), c = l + F, l = 0.541196100146 * (l - F), F = D + b, b = 1.30656296488 * (D - b), D = c + F, F = 0.707106781187 * (c - F), c = l + b, b = 0.707106781187 * (l - b), l = a + J, J = 0.541196100146 * (a - J), a = y + N, N = 1.30656296488 * (y - N), y = l + a, a = 0.707106781187 * (l - a), l = J + N, y += l += N = 0.707106781187 * (J - N), l += a, J = a + N, a = g + r, g = 0.509795579104 * (g - r), r = B + m, B = 0.601344886935 * (B - m), m = U + G, G = 0.899976223136 * (U - G), U = n + E, E = 2.56291544774 * (n - E), n = a + U, a = 0.541196100146 * (a - U), U = r + m, m = 1.30656296488 * (r - m), r = n + U, U = 0.707106781187 * (n - U), n = a + m, m = 0.707106781187 * (a - m), a = g + E, g = 0.541196100146 * (g - E), E = B + G, G = 1.30656296488 * (B - G), B = a + E, E = 0.707106781187 * (a - E), a = g + G, D += r += B += a += g = 0.707106781187 * (g - G), r += y, y += B += n += m, B += c += b, c += n += a += E, n += l, l += a += U, a += F, F += U += E += g, U += J, J += E += m, E += b, b += m += g, m += N, N += g, e[i + 48] = -v, e[i + 49] = e[i + 47] = -D, e[i + 50] = e[i + 46] = -C, e[i + 51] = e[i + 45] = -r, e[i + 52] = e[i + 44] = -o, e[i + 53] = e[i + 43] = -y, e[i + 54] = e[i + 42] = -k, e[i + 55] = e[i + 41] = -B, e[i + 56] = e[i + 40] = -h, e[i + 57] = e[i + 39] = -c, e[i + 58] = e[i + 38] = -L, e[i + 59] = e[i + 37] = -n, e[i + 60] = e[i + 36] = -I, e[i + 61] = e[i + 35] = -l, e[i + 62] = e[i + 34] = -d, e[i + 63] = e[i + 33] = -a, e[i + 32] = -u, e[i + 0] = u, e[i + 31] = -F, e[i + 1] = F, e[i + 30] = -_, e[i + 2] = _, e[i + 29] = -U, e[i + 3] = U, e[i + 28] = -f, e[i + 4] = f, e[i + 27] = -J, e[i + 5] = J, e[i + 26] = -R, e[i + 6] = R, e[i + 25] = -E, e[i + 7] = E, e[i + 24] = -Q, e[i + 8] = Q, e[i + 23] = -b, e[i + 9] = b, e[i + 22] = -p, e[i + 10] = p, e[i + 21] = -m, e[i + 11] = m, e[i + 20] = -s, e[i + 12] = s, e[i + 19] = -N, e[i + 13] = N, e[i + 18] = -x, e[i + 14] = x, e[i + 17] = -g, e[i + 15] = g, e[i + 16] = 0;
}, q.FRAME_SYNC = 2047, q.VERSION = { MPEG_2_5: 0, MPEG_2: 2, MPEG_1: 3 }, q.LAYER = { III: 1, II: 2, I: 3 }, q.MODE = { STEREO: 0, JOINT_STEREO: 1, DUAL_CHANNEL: 2, MONO: 3 }, q.SAMPLE_RATE = new Uint16Array([44100, 48e3, 32e3, 0, 22050, 24e3, 16e3, 0]), q.BIT_RATE = new Uint16Array([32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160]), q.SCALEFACTOR_BASE = new Uint32Array([33554432, 26632170, 21137968]), q.SYNTHESIS_WINDOW = new Float32Array([0, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -1, -1, -1, -1, -1.5, -1.5, -2, -2, -2.5, -2.5, -3, -3.5, -3.5, -4, -4.5, -5, -5.5, -6.5, -7, -8, -8.5, -9.5, -10.5, -12, -13, -14.5, -15.5, -17.5, -19, -20.5, -22.5, -24.5, -26.5, -29, -31.5, -34, -36.5, -39.5, -42.5, -45.5, -48.5, -52, -55.5, -58.5, -62.5, -66, -69.5, -73.5, -77, -80.5, -84.5, -88, -91.5, -95, -98, -101, -104, 106.5, 109, 111, 112.5, 113.5, 114, 114, 113.5, 112, 110.5, 107.5, 104, 100, 94.5, 88.5, 81.5, 73, 63.5, 53, 41.5, 28.5, 14.5, -1, -18, -36, -55.5, -76.5, -98.5, -122, -147, -173.5, -200.5, -229.5, -259.5, -290.5, -322.5, -355.5, -389.5, -424, -459.5, -495.5, -532, -568.5, -605, -641.5, -678, -714, -749, -783.5, -817, -849, -879.5, -908.5, -935, -959.5, -981, -1000.5, -1016, -1028.5, -1037.5, -1042.5, -1043.5, -1040, -1031.5, 1018.5, 1e3, 976, 946.5, 911, 869.5, 822, 767.5, 707, 640, 565.5, 485, 397, 302.5, 201, 92.5, -22.5, -144, -272.5, -407, -547.5, -694, -846, -1003, -1165, -1331.5, -1502, -1675.5, -1852.5, -2031.5, -2212.5, -2394, -2576.5, -2758.5, -2939.5, -3118.5, -3294.5, -3467.5, -3635.5, -3798.5, -3955, -4104.5, -4245.5, -4377.5, -4499, -4609.5, -4708, -4792.5, -4863.5, -4919, -4958, -4979.5, -4983, -4967.5, -4931.5, -4875, -4796, -4694.5, -4569.5, -4420, -4246, -4046, -3820, -3567, 3287, 2979.5, 2644, 2280.5, 1888, 1467.5, 1018.5, 541, 35, -499, -1061, -1650, -2266.5, -2909, -3577, -4270, -4987.5, -5727.5, -6490, -7274, -8077.5, -8899.5, -9739, -10594.5, -11464.5, -12347, -13241, -14144.5, -15056, -15973.5, -16895.5, -17820, -18744.5, -19668, -20588, -21503, -22410.5, -23308.5, -24195, -25068.5, -25926.5, -26767, -27589, -28389, -29166.5, -29919, -30644.5, -31342, -32009.5, -32645, -33247, -33814.5, -34346, -34839.5, -35295, -35710, -36084.5, -36417.5, -36707.5, -36954, -37156.5, -37315, -37428, -37496, 37519, 37496, 37428, 37315, 37156.5, 36954, 36707.5, 36417.5, 36084.5, 35710, 35295, 34839.5, 34346, 33814.5, 33247, 32645, 32009.5, 31342, 30644.5, 29919, 29166.5, 28389, 27589, 26767, 25926.5, 25068.5, 24195, 23308.5, 22410.5, 21503, 20588, 19668, 18744.5, 17820, 16895.5, 15973.5, 15056, 14144.5, 13241, 12347, 11464.5, 10594.5, 9739, 8899.5, 8077.5, 7274, 6490, 5727.5, 4987.5, 4270, 3577, 2909, 2266.5, 1650, 1061, 499, -35, -541, -1018.5, -1467.5, -1888, -2280.5, -2644, -2979.5, 3287, 3567, 3820, 4046, 4246, 4420, 4569.5, 4694.5, 4796, 4875, 4931.5, 4967.5, 4983, 4979.5, 4958, 4919, 4863.5, 4792.5, 4708, 4609.5, 4499, 4377.5, 4245.5, 4104.5, 3955, 3798.5, 3635.5, 3467.5, 3294.5, 3118.5, 2939.5, 2758.5, 2576.5, 2394, 2212.5, 2031.5, 1852.5, 1675.5, 1502, 1331.5, 1165, 1003, 846, 694, 547.5, 407, 272.5, 144, 22.5, -92.5, -201, -302.5, -397, -485, -565.5, -640, -707, -767.5, -822, -869.5, -911, -946.5, -976, -1e3, 1018.5, 1031.5, 1040, 1043.5, 1042.5, 1037.5, 1028.5, 1016, 1000.5, 981, 959.5, 935, 908.5, 879.5, 849, 817, 783.5, 749, 714, 678, 641.5, 605, 568.5, 532, 495.5, 459.5, 424, 389.5, 355.5, 322.5, 290.5, 259.5, 229.5, 200.5, 173.5, 147, 122, 98.5, 76.5, 55.5, 36, 18, 1, -14.5, -28.5, -41.5, -53, -63.5, -73, -81.5, -88.5, -94.5, -100, -104, -107.5, -110.5, -112, -113.5, -114, -114, -113.5, -112.5, -111, -109, 106.5, 104, 101, 98, 95, 91.5, 88, 84.5, 80.5, 77, 73.5, 69.5, 66, 62.5, 58.5, 55.5, 52, 48.5, 45.5, 42.5, 39.5, 36.5, 34, 31.5, 29, 26.5, 24.5, 22.5, 20.5, 19, 17.5, 15.5, 14.5, 13, 12, 10.5, 9.5, 8.5, 8, 7, 6.5, 5.5, 5, 4.5, 4, 3.5, 3.5, 3, 2.5, 2.5, 2, 2, 1.5, 1.5, 1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]), q.QUANT_LUT_STEP_1 = [[0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2], [0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2]], q.QUANT_TAB = { A: 91, B: 94, C: 8, D: 12 }, q.QUANT_LUT_STEP_2 = [[q.QUANT_TAB.C, q.QUANT_TAB.C, q.QUANT_TAB.D], [q.QUANT_TAB.A, q.QUANT_TAB.A, q.QUANT_TAB.A], [q.QUANT_TAB.B, q.QUANT_TAB.A, q.QUANT_TAB.B]], q.QUANT_LUT_STEP_3 = [[68, 68, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52], [67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 32, 32, 32, 32, 32, 32, 32], [69, 69, 69, 69, 52, 52, 52, 52, 52, 52, 52, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36]], q.QUANT_LUT_STEP4 = [[0, 1, 2, 17], [0, 1, 2, 3, 4, 5, 6, 17], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17], [0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], q.QUANT_TAB = [{ levels: 3, group: 1, bits: 5 }, { levels: 5, group: 1, bits: 7 }, { levels: 7, group: 0, bits: 3 }, { levels: 9, group: 1, bits: 10 }, { levels: 15, group: 0, bits: 4 }, { levels: 31, group: 0, bits: 5 }, { levels: 63, group: 0, bits: 6 }, { levels: 127, group: 0, bits: 7 }, { levels: 255, group: 0, bits: 8 }, { levels: 511, group: 0, bits: 9 }, { levels: 1023, group: 0, bits: 10 }, { levels: 2047, group: 0, bits: 11 }, { levels: 4095, group: 0, bits: 12 }, { levels: 8191, group: 0, bits: 13 }, { levels: 16383, group: 0, bits: 14 }, { levels: 32767, group: 0, bits: 15 }, { levels: 65535, group: 0, bits: 16 }], q), JSMpeg.Decoder.MP2AudioWASM = (((EA = function(A) {
  JSMpeg.Decoder.Base.call(this, A), this.onDecodeCallback = A.onAudioDecode, this.module = A.wasmModule, this.bufferSize = A.audioBufferSize || 131072, this.bufferMode = A.streaming ? JSMpeg.BitBuffer.MODE.EVICT : JSMpeg.BitBuffer.MODE.EXPAND, this.sampleRate = 0;
}).prototype = Object.create(JSMpeg.Decoder.Base.prototype)).constructor = EA, EA.prototype.initializeWasmDecoder = function() {
  this.module.instance && (this.instance = this.module.instance, this.functions = this.module.instance.exports, this.decoder = this.functions._mp2_decoder_create(this.bufferSize, this.bufferMode));
}, EA.prototype.destroy = function() {
  this.decoder && this.functions._mp2_decoder_destroy(this.decoder);
}, EA.prototype.bufferGetIndex = function() {
  if (this.decoder)
    return this.functions._mp2_decoder_get_index(this.decoder);
}, EA.prototype.bufferSetIndex = function(A) {
  this.decoder && this.functions._mp2_decoder_set_index(this.decoder, A);
}, EA.prototype.bufferWrite = function(A) {
  this.decoder || this.initializeWasmDecoder();
  for (var t = 0, e = 0; e < A.length; e++)
    t += A[e].length;
  var i = this.functions._mp2_decoder_get_write_ptr(this.decoder, t);
  for (e = 0; e < A.length; e++)
    this.instance.heapU8.set(A[e], i), i += A[e].length;
  return this.functions._mp2_decoder_did_write(this.decoder, t), t;
}, EA.prototype.decode = function() {
  var A = JSMpeg.Now();
  if (!this.decoder || this.functions._mp2_decoder_decode(this.decoder) === 0)
    return !1;
  if (this.sampleRate || (this.sampleRate = this.functions._mp2_decoder_get_sample_rate(this.decoder)), this.destination) {
    var t = this.functions._mp2_decoder_get_left_channel_ptr(this.decoder), e = this.functions._mp2_decoder_get_right_channel_ptr(this.decoder), i = t / Float32Array.BYTES_PER_ELEMENT, o = e / Float32Array.BYTES_PER_ELEMENT, g = this.instance.heapF32.subarray(i, i + EA.SAMPLES_PER_FRAME), h = this.instance.heapF32.subarray(o, o + EA.SAMPLES_PER_FRAME);
    this.destination.play(this.sampleRate, g, h);
  }
  this.advanceDecodedTime(EA.SAMPLES_PER_FRAME / this.sampleRate);
  var B = JSMpeg.Now() - A;
  return this.onDecodeCallback && this.onDecodeCallback(this, B), !0;
}, EA.prototype.getCurrentTime = function() {
  var A = this.destination ? this.destination.enqueuedTime : 0;
  return this.decodedTime - A;
}, EA.SAMPLES_PER_FRAME = 1152, EA), JSMpeg.Renderer.WebGL = ((z = function(A) {
  A.canvas ? (this.canvas = A.canvas, this.ownsCanvasElement = !1) : (this.canvas = document.createElement("canvas"), this.ownsCanvasElement = !0), this.width = this.canvas.width, this.height = this.canvas.height, this.enabled = !0, this.hasTextureData = {};
  var t = { preserveDrawingBuffer: !!A.preserveDrawingBuffer, alpha: !1, depth: !1, stencil: !1, antialias: !1, premultipliedAlpha: !1 };
  if (this.gl = this.canvas.getContext("webgl", t) || this.canvas.getContext("experimental-webgl", t), !this.gl)
    throw new Error("Failed to get WebGL Context");
  this.handleContextLostBound = this.handleContextLost.bind(this), this.handleContextRestoredBound = this.handleContextRestored.bind(this), this.canvas.addEventListener("webglcontextlost", this.handleContextLostBound, !1), this.canvas.addEventListener("webglcontextrestored", this.handleContextRestoredBound, !1), this.initGL();
}).prototype.initGL = function() {
  this.hasTextureData = {};
  var A = this.gl, t = null;
  A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), this.vertexBuffer = A.createBuffer();
  var e = new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]);
  A.bindBuffer(A.ARRAY_BUFFER, this.vertexBuffer), A.bufferData(A.ARRAY_BUFFER, e, A.STATIC_DRAW), this.program = this.createProgram(z.SHADER.VERTEX_IDENTITY, z.SHADER.FRAGMENT_YCRCB_TO_RGBA), t = A.getAttribLocation(this.program, "vertex"), A.enableVertexAttribArray(t), A.vertexAttribPointer(t, 2, A.FLOAT, !1, 0, 0), this.textureY = this.createTexture(0, "textureY"), this.textureCb = this.createTexture(1, "textureCb"), this.textureCr = this.createTexture(2, "textureCr"), this.loadingProgram = this.createProgram(z.SHADER.VERTEX_IDENTITY, z.SHADER.FRAGMENT_LOADING), t = A.getAttribLocation(this.loadingProgram, "vertex"), A.enableVertexAttribArray(t), A.vertexAttribPointer(t, 2, A.FLOAT, !1, 0, 0), this.shouldCreateUnclampedViews = !this.allowsClampedTextureData();
}, z.prototype.handleContextLost = function(A) {
  A.preventDefault();
}, z.prototype.handleContextRestored = function(A) {
  this.initGL();
}, z.prototype.destroy = function() {
  var A = this.gl;
  this.deleteTexture(A.TEXTURE0, this.textureY), this.deleteTexture(A.TEXTURE1, this.textureCb), this.deleteTexture(A.TEXTURE2, this.textureCr), A.useProgram(null), A.deleteProgram(this.program), A.deleteProgram(this.loadingProgram), A.bindBuffer(A.ARRAY_BUFFER, null), A.deleteBuffer(this.vertexBuffer), this.canvas.removeEventListener("webglcontextlost", this.handleContextLostBound, !1), this.canvas.removeEventListener("webglcontextrestored", this.handleContextRestoredBound, !1), this.ownsCanvasElement && this.canvas.remove();
}, z.prototype.resize = function(A, t) {
  this.width = 0 | A, this.height = 0 | t, this.canvas.width = this.width, this.canvas.height = this.height, this.gl.useProgram(this.program);
  var e = this.width + 15 >> 4 << 4;
  this.gl.viewport(0, 0, e, this.height);
}, z.prototype.createTexture = function(A, t) {
  var e = this.gl, i = e.createTexture();
  return e.bindTexture(e.TEXTURE_2D, i), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.uniform1i(e.getUniformLocation(this.program, t), A), i;
}, z.prototype.createProgram = function(A, t) {
  var e = this.gl, i = e.createProgram();
  return e.attachShader(i, this.compileShader(e.VERTEX_SHADER, A)), e.attachShader(i, this.compileShader(e.FRAGMENT_SHADER, t)), e.linkProgram(i), e.useProgram(i), i;
}, z.prototype.compileShader = function(A, t) {
  var e = this.gl, i = e.createShader(A);
  if (e.shaderSource(i, t), e.compileShader(i), !e.getShaderParameter(i, e.COMPILE_STATUS))
    throw new Error(e.getShaderInfoLog(i));
  return i;
}, z.prototype.allowsClampedTextureData = function() {
  var A = this.gl, t = A.createTexture();
  return A.bindTexture(A.TEXTURE_2D, t), A.texImage2D(A.TEXTURE_2D, 0, A.LUMINANCE, 1, 1, 0, A.LUMINANCE, A.UNSIGNED_BYTE, new Uint8ClampedArray([0])), A.getError() === 0;
}, z.prototype.renderProgress = function(A) {
  var t = this.gl;
  t.useProgram(this.loadingProgram);
  var e = t.getUniformLocation(this.loadingProgram, "progress");
  t.uniform1f(e, A), t.drawArrays(t.TRIANGLE_STRIP, 0, 4);
}, z.prototype.render = function(A, t, e, i) {
  if (this.enabled) {
    var o = this.gl, g = this.width + 15 >> 4 << 4, h = this.height, B = g >> 1, u = h >> 1;
    i && this.shouldCreateUnclampedViews && (A = new Uint8Array(A.buffer), t = new Uint8Array(t.buffer), e = new Uint8Array(e.buffer)), o.useProgram(this.program), this.updateTexture(o.TEXTURE0, this.textureY, g, h, A), this.updateTexture(o.TEXTURE1, this.textureCb, B, u, t), this.updateTexture(o.TEXTURE2, this.textureCr, B, u, e), o.drawArrays(o.TRIANGLE_STRIP, 0, 4);
  }
}, z.prototype.updateTexture = function(A, t, e, i, o) {
  var g = this.gl;
  g.activeTexture(A), g.bindTexture(g.TEXTURE_2D, t), this.hasTextureData[A] ? g.texSubImage2D(g.TEXTURE_2D, 0, 0, 0, e, i, g.LUMINANCE, g.UNSIGNED_BYTE, o) : (this.hasTextureData[A] = !0, g.texImage2D(g.TEXTURE_2D, 0, g.LUMINANCE, e, i, 0, g.LUMINANCE, g.UNSIGNED_BYTE, o));
}, z.prototype.deleteTexture = function(A, t) {
  var e = this.gl;
  e.activeTexture(A), e.bindTexture(e.TEXTURE_2D, null), e.deleteTexture(t);
}, z.IsSupported = function() {
  try {
    if (!window.WebGLRenderingContext)
      return !1;
    var A = document.createElement("canvas");
    return !(!A.getContext("webgl") && !A.getContext("experimental-webgl"));
  } catch {
    return !1;
  }
}, z.SHADER = { FRAGMENT_YCRCB_TO_RGBA: ["precision mediump float;", "uniform sampler2D textureY;", "uniform sampler2D textureCb;", "uniform sampler2D textureCr;", "varying vec2 texCoord;", "mat4 rec601 = mat4(", "1.16438,  0.00000,  1.59603, -0.87079,", "1.16438, -0.39176, -0.81297,  0.52959,", "1.16438,  2.01723,  0.00000, -1.08139,", "0, 0, 0, 1", ");", "void main() {", "float y = texture2D(textureY, texCoord).r;", "float cb = texture2D(textureCb, texCoord).r;", "float cr = texture2D(textureCr, texCoord).r;", "gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;", "}"].join(`
`), FRAGMENT_LOADING: ["precision mediump float;", "uniform float progress;", "varying vec2 texCoord;", "void main() {", "float c = ceil(progress-(1.0-texCoord.y));", "gl_FragColor = vec4(c,c,c,1);", "}"].join(`
`), VERTEX_IDENTITY: ["attribute vec2 vertex;", "varying vec2 texCoord;", "void main() {", "texCoord = vertex;", "gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);", "}"].join(`
`) }, z), JSMpeg.Renderer.Canvas2D = ((KA = function(A) {
  A.canvas ? (this.canvas = A.canvas, this.ownsCanvasElement = !1) : (this.canvas = document.createElement("canvas"), this.ownsCanvasElement = !0), this.width = this.canvas.width, this.height = this.canvas.height, this.enabled = !0, this.context = this.canvas.getContext("2d");
}).prototype.destroy = function() {
  this.ownsCanvasElement && this.canvas.remove();
}, KA.prototype.resize = function(A, t) {
  this.width = 0 | A, this.height = 0 | t, this.canvas.width = this.width, this.canvas.height = this.height, this.imageData = this.context.getImageData(0, 0, this.width, this.height), JSMpeg.Fill(this.imageData.data, 255);
}, KA.prototype.renderProgress = function(A) {
  var t = this.canvas.width, e = this.canvas.height, i = this.context;
  i.fillStyle = "#222", i.fillRect(0, 0, t, e), i.fillStyle = "#fff", i.fillRect(0, e - e * A, t, e * A);
}, KA.prototype.render = function(A, t, e) {
  this.YCbCrToRGBA(A, t, e, this.imageData.data), this.context.putImageData(this.imageData, 0, 0);
}, KA.prototype.YCbCrToRGBA = function(A, t, e, i) {
  if (this.enabled)
    for (var o, g, h, B, u, c = this.width + 15 >> 4 << 4, f = c >> 1, n = 0, d = c, E = c + (c - this.width), I = 0, b = f - (this.width >> 1), s = 0, a = 4 * this.width, Q = 4 * this.width, r = this.width >> 1, C = this.height >> 1, l = 0; l < C; l++) {
      for (var p = 0; p < r; p++) {
        o = t[I], g = e[I], I++, h = o + (103 * o >> 8) - 179, B = (88 * g >> 8) - 44 + (183 * o >> 8) - 91, u = g + (198 * g >> 8) - 227;
        var m = A[n++], D = A[n++];
        i[s] = m + h, i[s + 1] = m - B, i[s + 2] = m + u, i[s + 4] = D + h, i[s + 5] = D - B, i[s + 6] = D + u, s += 8;
        var G = A[d++], R = A[d++];
        i[a] = G + h, i[a + 1] = G - B, i[a + 2] = G + u, i[a + 4] = R + h, i[a + 5] = R - B, i[a + 6] = R + u, a += 8;
      }
      n += E, d += E, s += Q, a += Q, I += b;
    }
}, KA), JSMpeg.AudioOutput.WebAudio = ((hA = function(A) {
  this.context = hA.CachedContext = hA.CachedContext || new (window.AudioContext || window.webkitAudioContext)(), this.gain = this.context.createGain(), this.destination = this.gain, this.gain.connect(this.context.destination), this.context._connections = (this.context._connections || 0) + 1, this.startTime = 0, this.buffer = null, this.wallclockStartTime = 0, this.volume = 1, this.enabled = !0, this.unlocked = !hA.NeedsUnlocking(), Object.defineProperty(this, "enqueuedTime", { get: this.getEnqueuedTime });
}).prototype.destroy = function() {
  this.gain.disconnect(), this.context._connections--, this.context._connections === 0 && (this.context.close(), hA.CachedContext = null);
}, hA.prototype.play = function(A, t, e) {
  if (this.enabled) {
    if (!this.unlocked) {
      var i = JSMpeg.Now();
      return this.wallclockStartTime < i && (this.wallclockStartTime = i), void (this.wallclockStartTime += t.length / A);
    }
    this.gain.gain.value = this.volume;
    var o = this.context.createBuffer(2, t.length, A);
    o.getChannelData(0).set(t), o.getChannelData(1).set(e);
    var g = this.context.createBufferSource();
    g.buffer = o, g.connect(this.destination);
    var h = this.context.currentTime, B = o.duration;
    this.startTime < h && (this.startTime = h, this.wallclockStartTime = JSMpeg.Now()), g.start(this.startTime), this.startTime += B, this.wallclockStartTime += B;
  }
}, hA.prototype.stop = function() {
  this.gain.gain.value = 0;
}, hA.prototype.getEnqueuedTime = function() {
  return Math.max(this.wallclockStartTime - JSMpeg.Now(), 0);
}, hA.prototype.resetEnqueuedTime = function() {
  this.startTime = this.context.currentTime, this.wallclockStartTime = JSMpeg.Now();
}, hA.prototype.unlock = function(A) {
  if (this.unlocked)
    A && A();
  else {
    this.unlockCallback = A;
    var t = this.context.createBuffer(1, 1, 22050), e = this.context.createBufferSource();
    e.buffer = t, e.connect(this.destination), e.start(0), setTimeout(this.checkIfUnlocked.bind(this, e, 0), 0);
  }
}, hA.prototype.checkIfUnlocked = function(A, t) {
  A.playbackState === A.PLAYING_STATE || A.playbackState === A.FINISHED_STATE ? (this.unlocked = !0, this.unlockCallback && (this.unlockCallback(), this.unlockCallback = null)) : t < 10 && setTimeout(this.checkIfUnlocked.bind(this, A, t + 1), 100);
}, hA.NeedsUnlocking = function() {
  return /iPhone|iPad|iPod/i.test(navigator.userAgent);
}, hA.IsSupported = function() {
  return window.AudioContext || window.webkitAudioContext;
}, hA.CachedContext = null, hA), JSMpeg.WASMModule = ((CA = function() {
  this.stackSize = 5242880, this.pageSize = 65536, this.onInitCallbacks = [], this.ready = !1, this.loadingFromFileStarted = !1, this.loadingFromBufferStarted = !1;
}).prototype.write = function(A) {
  this.loadFromBuffer(A);
}, CA.prototype.loadFromFile = function(A, t) {
  if (t && this.onInitCallbacks.push(t), !this.loadingFromFileStarted) {
    this.loadingFromFileStarted = !0, this.onInitCallback = t;
    var e = new JSMpeg.Source.Ajax(A, {});
    e.connect(this), e.start();
  }
}, CA.prototype.loadFromBuffer = function(A, t) {
  if (t && this.onInitCallbacks.push(t), !this.loadingFromBufferStarted)
    if (this.loadingFromBufferStarted = !0, this.moduleInfo = this.readDylinkSection(A), this.moduleInfo) {
      this.memory = new WebAssembly.Memory({ initial: 256 });
      var e = { memory: this.memory, memoryBase: 0, __memory_base: 0, table: new WebAssembly.Table({ initial: this.moduleInfo.tableSize, element: "anyfunc" }), tableBase: 0, __table_base: 0, abort: this.c_abort.bind(this), ___assert_fail: this.c_assertFail.bind(this), _sbrk: this.c_sbrk.bind(this) };
      this.brk = this.align(this.moduleInfo.memorySize + this.stackSize), WebAssembly.instantiate(A, { env: e }).then(function(o) {
        this.instance = o.instance, this.instance.exports.__post_instantiate && this.instance.exports.__post_instantiate(), this.createHeapViews(), this.ready = !0;
        for (var g = 0; g < this.onInitCallbacks.length; g++)
          this.onInitCallbacks[g](this);
      }.bind(this));
    } else
      for (var i = 0; i < this.onInitCallbacks.length; i++)
        this.onInitCallbacks[i](null);
}, CA.prototype.createHeapViews = function() {
  this.instance.heapU8 = new Uint8Array(this.memory.buffer), this.instance.heapU32 = new Uint32Array(this.memory.buffer), this.instance.heapF32 = new Float32Array(this.memory.buffer);
}, CA.prototype.align = function(A) {
  var t = Math.pow(2, this.moduleInfo.memoryAlignment);
  return Math.ceil(A / t) * t;
}, CA.prototype.c_sbrk = function(A) {
  var t = this.brk;
  if (this.brk += A, this.brk > this.memory.buffer.byteLength) {
    var e = this.brk - this.memory.buffer.byteLength, i = Math.ceil(e / this.pageSize);
    this.memory.grow(i), this.createHeapViews();
  }
  return t;
}, CA.prototype.c_abort = function(A) {
}, CA.prototype.c_assertFail = function(A) {
}, CA.prototype.readDylinkSection = function(A) {
  var t = new Uint8Array(A), e = 0, i = function() {
    for (var g = 0, h = 1; ; ) {
      var B = t[e++];
      if (g += (127 & B) * h, h *= 128, !(128 & B))
        return g;
    }
  }, o = function(g) {
    for (var h = 0; h < g.length; h++) {
      var B = typeof g[h] == "string" ? g[h].charCodeAt(0) : g[h];
      if (t[e++] !== B)
        return !1;
    }
    return !0;
  };
  return o([0, "a", "s", "m"]) ? (e = 9, i(), o([6, "d", "y", "l", "i", "n", "k"]) ? { memorySize: i(), memoryAlignment: i(), tableSize: i(), tableAlignment: i() } : null) : null;
}, CA.IsSupported = function() {
  return !!window.WebAssembly;
}, CA.GetModule = function() {
  return CA.CACHED_MODULE = CA.CACHED_MODULE || new CA();
}, CA), JSMpeg.WASM_BINARY_INLINED = " ", (it = (it = gt) || gt) && !it.__composition_api_installed__ && it.use(ne), gt.version;
var It = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Qe(A) {
  if (A.__esModule)
    return A;
  var t = A.default;
  if (typeof t == "function") {
    var e = function i() {
      if (this instanceof i) {
        var o = [null];
        return o.push.apply(o, arguments), new (Function.bind.apply(t, o))();
      }
      return t.apply(this, arguments);
    };
    e.prototype = t.prototype;
  } else
    e = {};
  return Object.defineProperty(e, "__esModule", { value: !0 }), Object.keys(A).forEach(function(i) {
    var o = Object.getOwnPropertyDescriptor(A, i);
    Object.defineProperty(e, i, o.get ? o : { enumerable: !0, get: function() {
      return A[i];
    } });
  }), e;
}
var Ct = {}, le = { get exports() {
  return Ct;
}, set exports(A) {
  Ct = A;
} }, ct = {}, ue = { get exports() {
  return ct;
}, set exports(A) {
  ct = A;
} };
const pe = Qe(Object.freeze(Object.defineProperty({ __proto__: null, default: {} }, Symbol.toStringTag, { value: "Module" })));
var Dt;
function LA() {
  return Dt || (Dt = 1, ue.exports = (A = A || function(t, e) {
    var i;
    if (typeof window < "u" && window.crypto && (i = window.crypto), typeof self < "u" && self.crypto && (i = self.crypto), typeof globalThis < "u" && globalThis.crypto && (i = globalThis.crypto), !i && typeof window < "u" && window.msCrypto && (i = window.msCrypto), !i && It !== void 0 && It.crypto && (i = It.crypto), !i)
      try {
        i = pe;
      } catch {
      }
    var o = function() {
      if (i) {
        if (typeof i.getRandomValues == "function")
          try {
            return i.getRandomValues(new Uint32Array(1))[0];
          } catch {
          }
        if (typeof i.randomBytes == "function")
          try {
            return i.randomBytes(4).readInt32LE();
          } catch {
          }
      }
      throw new Error("Native crypto module could not be used to get secure random number.");
    }, g = Object.create || function() {
      function s() {
      }
      return function(a) {
        var Q;
        return s.prototype = a, Q = new s(), s.prototype = null, Q;
      };
    }(), h = {}, B = h.lib = {}, u = B.Base = { extend: function(s) {
      var a = g(this);
      return s && a.mixIn(s), a.hasOwnProperty("init") && this.init !== a.init || (a.init = function() {
        a.$super.init.apply(this, arguments);
      }), a.init.prototype = a, a.$super = this, a;
    }, create: function() {
      var s = this.extend();
      return s.init.apply(s, arguments), s;
    }, init: function() {
    }, mixIn: function(s) {
      for (var a in s)
        s.hasOwnProperty(a) && (this[a] = s[a]);
      s.hasOwnProperty("toString") && (this.toString = s.toString);
    }, clone: function() {
      return this.init.prototype.extend(this);
    } }, c = B.WordArray = u.extend({ init: function(s, a) {
      s = this.words = s || [], this.sigBytes = a != e ? a : 4 * s.length;
    }, toString: function(s) {
      return (s || n).stringify(this);
    }, concat: function(s) {
      var a = this.words, Q = s.words, r = this.sigBytes, C = s.sigBytes;
      if (this.clamp(), r % 4)
        for (var l = 0; l < C; l++) {
          var p = Q[l >>> 2] >>> 24 - l % 4 * 8 & 255;
          a[r + l >>> 2] |= p << 24 - (r + l) % 4 * 8;
        }
      else
        for (var m = 0; m < C; m += 4)
          a[r + m >>> 2] = Q[m >>> 2];
      return this.sigBytes += C, this;
    }, clamp: function() {
      var s = this.words, a = this.sigBytes;
      s[a >>> 2] &= 4294967295 << 32 - a % 4 * 8, s.length = t.ceil(a / 4);
    }, clone: function() {
      var s = u.clone.call(this);
      return s.words = this.words.slice(0), s;
    }, random: function(s) {
      for (var a = [], Q = 0; Q < s; Q += 4)
        a.push(o());
      return new c.init(a, s);
    } }), f = h.enc = {}, n = f.Hex = { stringify: function(s) {
      for (var a = s.words, Q = s.sigBytes, r = [], C = 0; C < Q; C++) {
        var l = a[C >>> 2] >>> 24 - C % 4 * 8 & 255;
        r.push((l >>> 4).toString(16)), r.push((15 & l).toString(16));
      }
      return r.join("");
    }, parse: function(s) {
      for (var a = s.length, Q = [], r = 0; r < a; r += 2)
        Q[r >>> 3] |= parseInt(s.substr(r, 2), 16) << 24 - r % 8 * 4;
      return new c.init(Q, a / 2);
    } }, d = f.Latin1 = { stringify: function(s) {
      for (var a = s.words, Q = s.sigBytes, r = [], C = 0; C < Q; C++) {
        var l = a[C >>> 2] >>> 24 - C % 4 * 8 & 255;
        r.push(String.fromCharCode(l));
      }
      return r.join("");
    }, parse: function(s) {
      for (var a = s.length, Q = [], r = 0; r < a; r++)
        Q[r >>> 2] |= (255 & s.charCodeAt(r)) << 24 - r % 4 * 8;
      return new c.init(Q, a);
    } }, E = f.Utf8 = { stringify: function(s) {
      try {
        return decodeURIComponent(escape(d.stringify(s)));
      } catch {
        throw new Error("Malformed UTF-8 data");
      }
    }, parse: function(s) {
      return d.parse(unescape(encodeURIComponent(s)));
    } }, I = B.BufferedBlockAlgorithm = u.extend({ reset: function() {
      this._data = new c.init(), this._nDataBytes = 0;
    }, _append: function(s) {
      typeof s == "string" && (s = E.parse(s)), this._data.concat(s), this._nDataBytes += s.sigBytes;
    }, _process: function(s) {
      var a, Q = this._data, r = Q.words, C = Q.sigBytes, l = this.blockSize, p = C / (4 * l), m = (p = s ? t.ceil(p) : t.max((0 | p) - this._minBufferSize, 0)) * l, D = t.min(4 * m, C);
      if (m) {
        for (var G = 0; G < m; G += l)
          this._doProcessBlock(r, G);
        a = r.splice(0, m), Q.sigBytes -= D;
      }
      return new c.init(a, D);
    }, clone: function() {
      var s = u.clone.call(this);
      return s._data = this._data.clone(), s;
    }, _minBufferSize: 0 });
    B.Hasher = I.extend({ cfg: u.extend(), init: function(s) {
      this.cfg = this.cfg.extend(s), this.reset();
    }, reset: function() {
      I.reset.call(this), this._doReset();
    }, update: function(s) {
      return this._append(s), this._process(), this;
    }, finalize: function(s) {
      return s && this._append(s), this._doFinalize();
    }, blockSize: 16, _createHelper: function(s) {
      return function(a, Q) {
        return new s.init(Q).finalize(a);
      };
    }, _createHmacHelper: function(s) {
      return function(a, Q) {
        return new b.HMAC.init(s, Q).finalize(a);
      };
    } });
    var b = h.algo = {};
    return h;
  }(Math), A)), ct;
  var A;
}
var bt, dt = {}, fe = { get exports() {
  return dt;
}, set exports(A) {
  dt = A;
} };
function me() {
  return bt || (bt = 1, fe.exports = (A = LA(), function() {
    var t = A, e = t.lib.WordArray;
    function i(o, g, h) {
      for (var B = [], u = 0, c = 0; c < g; c++)
        if (c % 4) {
          var f = h[o.charCodeAt(c - 1)] << c % 4 * 2 | h[o.charCodeAt(c)] >>> 6 - c % 4 * 2;
          B[u >>> 2] |= f << 24 - u % 4 * 8, u++;
        }
      return e.create(B, u);
    }
    t.enc.Base64 = { stringify: function(o) {
      var g = o.words, h = o.sigBytes, B = this._map;
      o.clamp();
      for (var u = [], c = 0; c < h; c += 3)
        for (var f = (g[c >>> 2] >>> 24 - c % 4 * 8 & 255) << 16 | (g[c + 1 >>> 2] >>> 24 - (c + 1) % 4 * 8 & 255) << 8 | g[c + 2 >>> 2] >>> 24 - (c + 2) % 4 * 8 & 255, n = 0; n < 4 && c + 0.75 * n < h; n++)
          u.push(B.charAt(f >>> 6 * (3 - n) & 63));
      var d = B.charAt(64);
      if (d)
        for (; u.length % 4; )
          u.push(d);
      return u.join("");
    }, parse: function(o) {
      var g = o.length, h = this._map, B = this._reverseMap;
      if (!B) {
        B = this._reverseMap = [];
        for (var u = 0; u < h.length; u++)
          B[h.charCodeAt(u)] = u;
      }
      var c = h.charAt(64);
      if (c) {
        var f = o.indexOf(c);
        f !== -1 && (g = f);
      }
      return i(o, g, B);
    }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" };
  }(), A.enc.Base64)), dt;
  var A;
}
var St, Et = {}, ye = { get exports() {
  return Et;
}, set exports(A) {
  Et = A;
} };
function we() {
  return St || (St = 1, ye.exports = (A = LA(), function(t) {
    var e = A, i = e.lib, o = i.WordArray, g = i.Hasher, h = e.algo, B = [];
    (function() {
      for (var E = 0; E < 64; E++)
        B[E] = 4294967296 * t.abs(t.sin(E + 1)) | 0;
    })();
    var u = h.MD5 = g.extend({ _doReset: function() {
      this._hash = new o.init([1732584193, 4023233417, 2562383102, 271733878]);
    }, _doProcessBlock: function(E, I) {
      for (var b = 0; b < 16; b++) {
        var s = I + b, a = E[s];
        E[s] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8);
      }
      var Q = this._hash.words, r = E[I + 0], C = E[I + 1], l = E[I + 2], p = E[I + 3], m = E[I + 4], D = E[I + 5], G = E[I + 6], R = E[I + 7], N = E[I + 8], L = E[I + 9], J = E[I + 10], _ = E[I + 11], U = E[I + 12], k = E[I + 13], F = E[I + 14], x = E[I + 15], y = Q[0], v = Q[1], M = Q[2], w = Q[3];
      y = c(y, v, M, w, r, 7, B[0]), w = c(w, y, v, M, C, 12, B[1]), M = c(M, w, y, v, l, 17, B[2]), v = c(v, M, w, y, p, 22, B[3]), y = c(y, v, M, w, m, 7, B[4]), w = c(w, y, v, M, D, 12, B[5]), M = c(M, w, y, v, G, 17, B[6]), v = c(v, M, w, y, R, 22, B[7]), y = c(y, v, M, w, N, 7, B[8]), w = c(w, y, v, M, L, 12, B[9]), M = c(M, w, y, v, J, 17, B[10]), v = c(v, M, w, y, _, 22, B[11]), y = c(y, v, M, w, U, 7, B[12]), w = c(w, y, v, M, k, 12, B[13]), M = c(M, w, y, v, F, 17, B[14]), y = f(y, v = c(v, M, w, y, x, 22, B[15]), M, w, C, 5, B[16]), w = f(w, y, v, M, G, 9, B[17]), M = f(M, w, y, v, _, 14, B[18]), v = f(v, M, w, y, r, 20, B[19]), y = f(y, v, M, w, D, 5, B[20]), w = f(w, y, v, M, J, 9, B[21]), M = f(M, w, y, v, x, 14, B[22]), v = f(v, M, w, y, m, 20, B[23]), y = f(y, v, M, w, L, 5, B[24]), w = f(w, y, v, M, F, 9, B[25]), M = f(M, w, y, v, p, 14, B[26]), v = f(v, M, w, y, N, 20, B[27]), y = f(y, v, M, w, k, 5, B[28]), w = f(w, y, v, M, l, 9, B[29]), M = f(M, w, y, v, R, 14, B[30]), y = n(y, v = f(v, M, w, y, U, 20, B[31]), M, w, D, 4, B[32]), w = n(w, y, v, M, N, 11, B[33]), M = n(M, w, y, v, _, 16, B[34]), v = n(v, M, w, y, F, 23, B[35]), y = n(y, v, M, w, C, 4, B[36]), w = n(w, y, v, M, m, 11, B[37]), M = n(M, w, y, v, R, 16, B[38]), v = n(v, M, w, y, J, 23, B[39]), y = n(y, v, M, w, k, 4, B[40]), w = n(w, y, v, M, r, 11, B[41]), M = n(M, w, y, v, p, 16, B[42]), v = n(v, M, w, y, G, 23, B[43]), y = n(y, v, M, w, L, 4, B[44]), w = n(w, y, v, M, U, 11, B[45]), M = n(M, w, y, v, x, 16, B[46]), y = d(y, v = n(v, M, w, y, l, 23, B[47]), M, w, r, 6, B[48]), w = d(w, y, v, M, R, 10, B[49]), M = d(M, w, y, v, F, 15, B[50]), v = d(v, M, w, y, D, 21, B[51]), y = d(y, v, M, w, U, 6, B[52]), w = d(w, y, v, M, p, 10, B[53]), M = d(M, w, y, v, J, 15, B[54]), v = d(v, M, w, y, C, 21, B[55]), y = d(y, v, M, w, N, 6, B[56]), w = d(w, y, v, M, x, 10, B[57]), M = d(M, w, y, v, G, 15, B[58]), v = d(v, M, w, y, k, 21, B[59]), y = d(y, v, M, w, m, 6, B[60]), w = d(w, y, v, M, _, 10, B[61]), M = d(M, w, y, v, l, 15, B[62]), v = d(v, M, w, y, L, 21, B[63]), Q[0] = Q[0] + y | 0, Q[1] = Q[1] + v | 0, Q[2] = Q[2] + M | 0, Q[3] = Q[3] + w | 0;
    }, _doFinalize: function() {
      var E = this._data, I = E.words, b = 8 * this._nDataBytes, s = 8 * E.sigBytes;
      I[s >>> 5] |= 128 << 24 - s % 32;
      var a = t.floor(b / 4294967296), Q = b;
      I[15 + (s + 64 >>> 9 << 4)] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), I[14 + (s + 64 >>> 9 << 4)] = 16711935 & (Q << 8 | Q >>> 24) | 4278255360 & (Q << 24 | Q >>> 8), E.sigBytes = 4 * (I.length + 1), this._process();
      for (var r = this._hash, C = r.words, l = 0; l < 4; l++) {
        var p = C[l];
        C[l] = 16711935 & (p << 8 | p >>> 24) | 4278255360 & (p << 24 | p >>> 8);
      }
      return r;
    }, clone: function() {
      var E = g.clone.call(this);
      return E._hash = this._hash.clone(), E;
    } });
    function c(E, I, b, s, a, Q, r) {
      var C = E + (I & b | ~I & s) + a + r;
      return (C << Q | C >>> 32 - Q) + I;
    }
    function f(E, I, b, s, a, Q, r) {
      var C = E + (I & s | b & ~s) + a + r;
      return (C << Q | C >>> 32 - Q) + I;
    }
    function n(E, I, b, s, a, Q, r) {
      var C = E + (I ^ b ^ s) + a + r;
      return (C << Q | C >>> 32 - Q) + I;
    }
    function d(E, I, b, s, a, Q, r) {
      var C = E + (b ^ (I | ~s)) + a + r;
      return (C << Q | C >>> 32 - Q) + I;
    }
    e.MD5 = g._createHelper(u), e.HmacMD5 = g._createHmacHelper(u);
  }(Math), A.MD5)), Et;
  var A;
}
var vt, Qt = {}, De = { get exports() {
  return Qt;
}, set exports(A) {
  Qt = A;
} }, lt = {}, be = { get exports() {
  return lt;
}, set exports(A) {
  lt = A;
} };
function Se() {
  return vt || (vt = 1, be.exports = (B = LA(), t = (A = B).lib, e = t.WordArray, i = t.Hasher, o = A.algo, g = [], h = o.SHA1 = i.extend({ _doReset: function() {
    this._hash = new e.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
  }, _doProcessBlock: function(u, c) {
    for (var f = this._hash.words, n = f[0], d = f[1], E = f[2], I = f[3], b = f[4], s = 0; s < 80; s++) {
      if (s < 16)
        g[s] = 0 | u[c + s];
      else {
        var a = g[s - 3] ^ g[s - 8] ^ g[s - 14] ^ g[s - 16];
        g[s] = a << 1 | a >>> 31;
      }
      var Q = (n << 5 | n >>> 27) + b + g[s];
      Q += s < 20 ? 1518500249 + (d & E | ~d & I) : s < 40 ? 1859775393 + (d ^ E ^ I) : s < 60 ? (d & E | d & I | E & I) - 1894007588 : (d ^ E ^ I) - 899497514, b = I, I = E, E = d << 30 | d >>> 2, d = n, n = Q;
    }
    f[0] = f[0] + n | 0, f[1] = f[1] + d | 0, f[2] = f[2] + E | 0, f[3] = f[3] + I | 0, f[4] = f[4] + b | 0;
  }, _doFinalize: function() {
    var u = this._data, c = u.words, f = 8 * this._nDataBytes, n = 8 * u.sigBytes;
    return c[n >>> 5] |= 128 << 24 - n % 32, c[14 + (n + 64 >>> 9 << 4)] = Math.floor(f / 4294967296), c[15 + (n + 64 >>> 9 << 4)] = f, u.sigBytes = 4 * c.length, this._process(), this._hash;
  }, clone: function() {
    var u = i.clone.call(this);
    return u._hash = this._hash.clone(), u;
  } }), A.SHA1 = i._createHelper(h), A.HmacSHA1 = i._createHmacHelper(h), B.SHA1)), lt;
  var A, t, e, i, o, g, h, B;
}
var Mt, kt, Rt = {}, ve = { get exports() {
  return Rt;
}, set exports(A) {
  Rt = A;
} };
function Ft() {
  return kt || (kt = 1, De.exports = function(o) {
    return function() {
      var g = o, h = g.lib, B = h.Base, u = h.WordArray, c = g.algo, f = c.MD5, n = c.EvpKDF = B.extend({ cfg: B.extend({ keySize: 4, hasher: f, iterations: 1 }), init: function(d) {
        this.cfg = this.cfg.extend(d);
      }, compute: function(d, E) {
        for (var I, b = this.cfg, s = b.hasher.create(), a = u.create(), Q = a.words, r = b.keySize, C = b.iterations; Q.length < r; ) {
          I && s.update(I), I = s.update(d).finalize(E), s.reset();
          for (var l = 1; l < C; l++)
            I = s.finalize(I), s.reset();
          a.concat(I);
        }
        return a.sigBytes = 4 * r, a;
      } });
      g.EvpKDF = function(d, E, I) {
        return n.create(I).compute(d, E);
      };
    }(), o.EvpKDF;
  }(LA(), Se(), Mt || (Mt = 1, ve.exports = (A = LA(), e = (t = A).lib.Base, i = t.enc.Utf8, void (t.algo.HMAC = e.extend({ init: function(o, g) {
    o = this._hasher = new o.init(), typeof g == "string" && (g = i.parse(g));
    var h = o.blockSize, B = 4 * h;
    g.sigBytes > B && (g = o.finalize(g)), g.clamp();
    for (var u = this._oKey = g.clone(), c = this._iKey = g.clone(), f = u.words, n = c.words, d = 0; d < h; d++)
      f[d] ^= 1549556828, n[d] ^= 909522486;
    u.sigBytes = c.sigBytes = B, this.reset();
  }, reset: function() {
    var o = this._hasher;
    o.reset(), o.update(this._iKey);
  }, update: function(o) {
    return this._hasher.update(o), this;
  }, finalize: function(o) {
    var g = this._hasher, h = g.finalize(o);
    return g.reset(), g.finalize(this._oKey.clone().concat(h));
  } })))))), Qt;
  var A, t, e, i;
}
var Gt, Bt, qt = {}, Me = { get exports() {
  return qt;
}, set exports(A) {
  qt = A;
} };
le.exports = function(A) {
  return function() {
    var t = A, e = t.lib.BlockCipher, i = t.algo, o = [], g = [], h = [], B = [], u = [], c = [], f = [], n = [], d = [], E = [];
    (function() {
      for (var s = [], a = 0; a < 256; a++)
        s[a] = a < 128 ? a << 1 : a << 1 ^ 283;
      var Q = 0, r = 0;
      for (a = 0; a < 256; a++) {
        var C = r ^ r << 1 ^ r << 2 ^ r << 3 ^ r << 4;
        C = C >>> 8 ^ 255 & C ^ 99, o[Q] = C, g[C] = Q;
        var l = s[Q], p = s[l], m = s[p], D = 257 * s[C] ^ 16843008 * C;
        h[Q] = D << 24 | D >>> 8, B[Q] = D << 16 | D >>> 16, u[Q] = D << 8 | D >>> 24, c[Q] = D, D = 16843009 * m ^ 65537 * p ^ 257 * l ^ 16843008 * Q, f[C] = D << 24 | D >>> 8, n[C] = D << 16 | D >>> 16, d[C] = D << 8 | D >>> 24, E[C] = D, Q ? (Q = l ^ s[s[s[m ^ l]]], r ^= s[s[r]]) : Q = r = 1;
      }
    })();
    var I = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], b = i.AES = e.extend({ _doReset: function() {
      if (!this._nRounds || this._keyPriorReset !== this._key) {
        for (var s = this._keyPriorReset = this._key, a = s.words, Q = s.sigBytes / 4, r = 4 * ((this._nRounds = Q + 6) + 1), C = this._keySchedule = [], l = 0; l < r; l++)
          l < Q ? C[l] = a[l] : (D = C[l - 1], l % Q ? Q > 6 && l % Q == 4 && (D = o[D >>> 24] << 24 | o[D >>> 16 & 255] << 16 | o[D >>> 8 & 255] << 8 | o[255 & D]) : (D = o[(D = D << 8 | D >>> 24) >>> 24] << 24 | o[D >>> 16 & 255] << 16 | o[D >>> 8 & 255] << 8 | o[255 & D], D ^= I[l / Q | 0] << 24), C[l] = C[l - Q] ^ D);
        for (var p = this._invKeySchedule = [], m = 0; m < r; m++) {
          if (l = r - m, m % 4)
            var D = C[l];
          else
            D = C[l - 4];
          p[m] = m < 4 || l <= 4 ? D : f[o[D >>> 24]] ^ n[o[D >>> 16 & 255]] ^ d[o[D >>> 8 & 255]] ^ E[o[255 & D]];
        }
      }
    }, encryptBlock: function(s, a) {
      this._doCryptBlock(s, a, this._keySchedule, h, B, u, c, o);
    }, decryptBlock: function(s, a) {
      var Q = s[a + 1];
      s[a + 1] = s[a + 3], s[a + 3] = Q, this._doCryptBlock(s, a, this._invKeySchedule, f, n, d, E, g), Q = s[a + 1], s[a + 1] = s[a + 3], s[a + 3] = Q;
    }, _doCryptBlock: function(s, a, Q, r, C, l, p, m) {
      for (var D = this._nRounds, G = s[a] ^ Q[0], R = s[a + 1] ^ Q[1], N = s[a + 2] ^ Q[2], L = s[a + 3] ^ Q[3], J = 4, _ = 1; _ < D; _++) {
        var U = r[G >>> 24] ^ C[R >>> 16 & 255] ^ l[N >>> 8 & 255] ^ p[255 & L] ^ Q[J++], k = r[R >>> 24] ^ C[N >>> 16 & 255] ^ l[L >>> 8 & 255] ^ p[255 & G] ^ Q[J++], F = r[N >>> 24] ^ C[L >>> 16 & 255] ^ l[G >>> 8 & 255] ^ p[255 & R] ^ Q[J++], x = r[L >>> 24] ^ C[G >>> 16 & 255] ^ l[R >>> 8 & 255] ^ p[255 & N] ^ Q[J++];
        G = U, R = k, N = F, L = x;
      }
      U = (m[G >>> 24] << 24 | m[R >>> 16 & 255] << 16 | m[N >>> 8 & 255] << 8 | m[255 & L]) ^ Q[J++], k = (m[R >>> 24] << 24 | m[N >>> 16 & 255] << 16 | m[L >>> 8 & 255] << 8 | m[255 & G]) ^ Q[J++], F = (m[N >>> 24] << 24 | m[L >>> 16 & 255] << 16 | m[G >>> 8 & 255] << 8 | m[255 & R]) ^ Q[J++], x = (m[L >>> 24] << 24 | m[G >>> 16 & 255] << 16 | m[R >>> 8 & 255] << 8 | m[255 & N]) ^ Q[J++], s[a] = U, s[a + 1] = k, s[a + 2] = F, s[a + 3] = x;
    }, keySize: 8 });
    t.AES = e._createHelper(b);
  }(), A.AES;
}(LA(), me(), we(), Ft(), Gt || (Gt = 1, Me.exports = (Bt = LA(), Ft(), void (Bt.lib.Cipher || function(A) {
  var t = Bt, e = t.lib, i = e.Base, o = e.WordArray, g = e.BufferedBlockAlgorithm, h = t.enc;
  h.Utf8;
  var B = h.Base64, u = t.algo.EvpKDF, c = e.Cipher = g.extend({ cfg: i.extend(), createEncryptor: function(r, C) {
    return this.create(this._ENC_XFORM_MODE, r, C);
  }, createDecryptor: function(r, C) {
    return this.create(this._DEC_XFORM_MODE, r, C);
  }, init: function(r, C, l) {
    this.cfg = this.cfg.extend(l), this._xformMode = r, this._key = C, this.reset();
  }, reset: function() {
    g.reset.call(this), this._doReset();
  }, process: function(r) {
    return this._append(r), this._process();
  }, finalize: function(r) {
    return r && this._append(r), this._doFinalize();
  }, keySize: 4, ivSize: 4, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, _createHelper: function() {
    function r(C) {
      return typeof C == "string" ? Q : s;
    }
    return function(C) {
      return { encrypt: function(l, p, m) {
        return r(p).encrypt(C, l, p, m);
      }, decrypt: function(l, p, m) {
        return r(p).decrypt(C, l, p, m);
      } };
    };
  }() });
  e.StreamCipher = c.extend({ _doFinalize: function() {
    return this._process(!0);
  }, blockSize: 1 });
  var f = t.mode = {}, n = e.BlockCipherMode = i.extend({ createEncryptor: function(r, C) {
    return this.Encryptor.create(r, C);
  }, createDecryptor: function(r, C) {
    return this.Decryptor.create(r, C);
  }, init: function(r, C) {
    this._cipher = r, this._iv = C;
  } }), d = f.CBC = function() {
    var r = n.extend();
    function C(l, p, m) {
      var D, G = this._iv;
      G ? (D = G, this._iv = A) : D = this._prevBlock;
      for (var R = 0; R < m; R++)
        l[p + R] ^= D[R];
    }
    return r.Encryptor = r.extend({ processBlock: function(l, p) {
      var m = this._cipher, D = m.blockSize;
      C.call(this, l, p, D), m.encryptBlock(l, p), this._prevBlock = l.slice(p, p + D);
    } }), r.Decryptor = r.extend({ processBlock: function(l, p) {
      var m = this._cipher, D = m.blockSize, G = l.slice(p, p + D);
      m.decryptBlock(l, p), C.call(this, l, p, D), this._prevBlock = G;
    } }), r;
  }(), E = (t.pad = {}).Pkcs7 = { pad: function(r, C) {
    for (var l = 4 * C, p = l - r.sigBytes % l, m = p << 24 | p << 16 | p << 8 | p, D = [], G = 0; G < p; G += 4)
      D.push(m);
    var R = o.create(D, p);
    r.concat(R);
  }, unpad: function(r) {
    var C = 255 & r.words[r.sigBytes - 1 >>> 2];
    r.sigBytes -= C;
  } };
  e.BlockCipher = c.extend({ cfg: c.cfg.extend({ mode: d, padding: E }), reset: function() {
    var r;
    c.reset.call(this);
    var C = this.cfg, l = C.iv, p = C.mode;
    this._xformMode == this._ENC_XFORM_MODE ? r = p.createEncryptor : (r = p.createDecryptor, this._minBufferSize = 1), this._mode && this._mode.__creator == r ? this._mode.init(this, l && l.words) : (this._mode = r.call(p, this, l && l.words), this._mode.__creator = r);
  }, _doProcessBlock: function(r, C) {
    this._mode.processBlock(r, C);
  }, _doFinalize: function() {
    var r, C = this.cfg.padding;
    return this._xformMode == this._ENC_XFORM_MODE ? (C.pad(this._data, this.blockSize), r = this._process(!0)) : (r = this._process(!0), C.unpad(r)), r;
  }, blockSize: 4 });
  var I = e.CipherParams = i.extend({ init: function(r) {
    this.mixIn(r);
  }, toString: function(r) {
    return (r || this.formatter).stringify(this);
  } }), b = (t.format = {}).OpenSSL = { stringify: function(r) {
    var C = r.ciphertext, l = r.salt;
    return (l ? o.create([1398893684, 1701076831]).concat(l).concat(C) : C).toString(B);
  }, parse: function(r) {
    var C, l = B.parse(r), p = l.words;
    return p[0] == 1398893684 && p[1] == 1701076831 && (C = o.create(p.slice(2, 4)), p.splice(0, 4), l.sigBytes -= 16), I.create({ ciphertext: l, salt: C });
  } }, s = e.SerializableCipher = i.extend({ cfg: i.extend({ format: b }), encrypt: function(r, C, l, p) {
    p = this.cfg.extend(p);
    var m = r.createEncryptor(l, p), D = m.finalize(C), G = m.cfg;
    return I.create({ ciphertext: D, key: l, iv: G.iv, algorithm: r, mode: G.mode, padding: G.padding, blockSize: r.blockSize, formatter: p.format });
  }, decrypt: function(r, C, l, p) {
    return p = this.cfg.extend(p), C = this._parse(C, p.format), r.createDecryptor(l, p).finalize(C.ciphertext);
  }, _parse: function(r, C) {
    return typeof r == "string" ? C.parse(r, this) : r;
  } }), a = (t.kdf = {}).OpenSSL = { execute: function(r, C, l, p) {
    p || (p = o.random(8));
    var m = u.create({ keySize: C + l }).compute(r, p), D = o.create(m.words.slice(C), 4 * l);
    return m.sigBytes = 4 * C, I.create({ key: m, iv: D, salt: p });
  } }, Q = e.PasswordBasedCipher = s.extend({ cfg: s.cfg.extend({ kdf: a }), encrypt: function(r, C, l, p) {
    var m = (p = this.cfg.extend(p)).kdf.execute(l, r.keySize, r.ivSize);
    p.iv = m.iv;
    var D = s.encrypt.call(this, r, C, m.key, p);
    return D.mixIn(m), D;
  }, decrypt: function(r, C, l, p) {
    p = this.cfg.extend(p), C = this._parse(C, p.format);
    var m = p.kdf.execute(l, r.keySize, r.ivSize, C.salt);
    return p.iv = m.iv, s.decrypt.call(this, r, C, m.key, p);
  } });
}()))));
const ke = Ct, Vt = (() => {
  const A = Math.floor(9 * Math.random()) + 1;
  return `${ke.encrypt("camera-player", "kt".repeat(A)).toString()}${A}`;
})(), TA = { env: "test", apiHost: { test: "https://ts.keytop.cn", prod: "https://ts.keytop.cn" } }, ut = (A) => ({ test: `${A.apiHost.test}/cameraPlayerServer`, prod: `${A.apiHost.prod}/cameraPlayerServer` })[A.env], $A = zt.create({ timeout: 2e4 });
$A.interceptors.request.use((A) => (A.headers.token = Vt, A)), $A.interceptors.response.use((A) => {
  const { data: t, status: e } = A;
  return t && e === 200 ? t : Promise.reject();
}, (A) => zt.isCancel(A) ? Promise.reject(new Error("axios-cancel")) : Promise.reject(A));
const pt = (A) => typeof A == "function", xt = (A) => ((t) => t !== null && typeof t == "object")(A) && pt(A.then) && pt(A.catch), Nt = (A) => {
  const t = (i) => i < 10 ? `0${i}` : i, e = A % 6e4 / 1e3;
  return `${t(parseInt(A % 36e5 / 6e4))}:${t(e)}`;
};
function $t(A, t, e, i, o, g, h, B) {
  var u, c = typeof A == "function" ? A.options : A;
  if (t && (c.render = t, c.staticRenderFns = e, c._compiled = !0), i && (c.functional = !0), g && (c._scopeId = "data-v-" + g), h ? (u = function(d) {
    (d = d || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) || typeof __VUE_SSR_CONTEXT__ > "u" || (d = __VUE_SSR_CONTEXT__), o && o.call(this, d), d && d._registeredComponents && d._registeredComponents.add(h);
  }, c._ssrRegister = u) : o && (u = B ? function() {
    o.call(this, (c.functional ? this.parent : this).$root.$options.shadowRoot);
  } : o), u)
    if (c.functional) {
      c._injectStyles = u;
      var f = c.render;
      c.render = function(d, E) {
        return u.call(E), f(d, E);
      };
    } else {
      var n = c.beforeCreate;
      c.beforeCreate = n ? [].concat(n, u) : [u];
    }
  return { exports: A, options: c };
}
const Jt = {};
var Re = $t({}, function() {
  var A = this.$createElement, t = this._self._c || A;
  return t("span", { staticClass: "anticon anticon-loading", attrs: { role: "img", "aria-label": "loading" } }, [t("svg", { staticClass: "anticon-spin", attrs: { focusable: "false", "data-icon": "loading", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", viewBox: "0 0 1024 1024" } }, [t("path", { attrs: { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } })])]);
}, [], !1, Fe, "377806c9", null, null);
function Fe(A) {
  for (let t in Jt)
    this[t] = Jt[t];
}
const Ge = function() {
  return Re.exports;
}();
function qe(A) {
  return !!ge() && (Ie(A), !0);
}
function Ae(A) {
  return typeof A == "function" ? A() : Be(A);
}
const te = typeof window < "u", ee = () => {
}, xe = Ne();
function Ne() {
  var A;
  return te && ((A = window == null ? void 0 : window.navigator) == null ? void 0 : A.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
}
function zA(A) {
  var t;
  const e = Ae(A);
  return (t = e == null ? void 0 : e.$el) != null ? t : e;
}
const ie = te ? window : void 0;
function ht(...A) {
  let t, e, i, o;
  if (typeof A[0] == "string" || Array.isArray(A[0]) ? ([e, i, o] = A, t = ie) : [t, e, i, o] = A, !t)
    return ee;
  Array.isArray(e) || (e = [e]), Array.isArray(i) || (i = [i]);
  const g = [], h = () => {
    g.forEach((c) => c()), g.length = 0;
  }, B = Zt(() => [zA(t), Ae(o)], ([c, f]) => {
    h(), c && g.push(...e.flatMap((n) => i.map((d) => ((E, I, b, s) => (E.addEventListener(I, b, s), () => E.removeEventListener(I, b, s)))(c, n, d, f))));
  }, { immediate: !0, flush: "post" }), u = () => {
    B(), h();
  };
  return qe(u), u;
}
let Tt = !1;
function Lt(A, t, e = {}) {
  const { window: i = ie, ignore: o = [], capture: g = !0, detectIframe: h = !1 } = e;
  if (!i)
    return;
  xe && !Tt && (Tt = !0, Array.from(i.document.body.children).forEach((f) => f.addEventListener("click", ee)));
  let B = !0;
  const u = (f) => o.some((n) => {
    if (typeof n == "string")
      return Array.from(i.document.querySelectorAll(n)).some((d) => d === f.target || f.composedPath().includes(d));
    {
      const d = zA(n);
      return d && (f.target === d || f.composedPath().includes(d));
    }
  }), c = [ht(i, "click", (f) => {
    const n = zA(A);
    n && n !== f.target && !f.composedPath().includes(n) && (f.detail === 0 && (B = !u(f)), B ? t(f) : B = !0);
  }, { passive: !0, capture: g }), ht(i, "pointerdown", (f) => {
    const n = zA(A);
    n && (B = !f.composedPath().includes(n) && !u(f));
  }, { passive: !0 }), h && ht(i, "blur", (f) => {
    var n;
    const d = zA(A);
    ((n = i.document.activeElement) == null ? void 0 : n.tagName) !== "IFRAME" || d != null && d.contains(i.document.activeElement) || t(f);
  })].filter(Boolean);
  return () => c.forEach((f) => f());
}
const Je = { inserted(A, t) {
  const e = !t.modifiers.bubble;
  if (typeof t.value == "function")
    A.__onClickOutside_stop = Lt(A, t.value, { capture: e });
  else {
    const [i, o] = t.value;
    A.__onClickOutside_stop = Lt(A, i, Object.assign({ capture: e }, o));
  }
}, unbind(A) {
  A.__onClickOutside_stop();
} };
(function() {
  let A = !1;
  const t = nA(!1);
})();
var ot = {};
({ get exports() {
  return ot;
}, set exports(A) {
  ot = A;
} }.exports = {}).forEach = function(A, t) {
  for (var e = 0; e < A.length; e++) {
    var i = t(A[e]);
    if (i)
      return i;
  }
};
var st = {}, Ut = { get exports() {
  return st;
}, set exports(A) {
  st = A;
} }.exports = {};
Ut.isIE = function(A) {
  return ((t = navigator.userAgent.toLowerCase()).indexOf("msie") !== -1 || t.indexOf("trident") !== -1 || t.indexOf(" edge/") !== -1) && (!A || A === function() {
    var e = 3, i = document.createElement("div"), o = i.getElementsByTagName("i");
    do
      i.innerHTML = "<!--[if gt IE " + ++e + "]><i></i><![endif]-->";
    while (o[0]);
    return e > 4 ? e : void 0;
  }());
  var t;
}, Ut.isLegacyOpera = function() {
  return !!window.opera;
};
var ft = {};
({ get exports() {
  return ft;
}, set exports(A) {
  ft = A;
} }.exports = {}).getOption = function(A, t, e) {
  var i = A[t];
  return i == null && e !== void 0 ? e : i;
};
var _t = ft;
function Ht() {
  var A = {}, t = 0, e = 0, i = 0;
  return { add: function(o, g) {
    g || (g = o, o = 0), o > e ? e = o : o < i && (i = o), A[o] || (A[o] = []), A[o].push(g), t++;
  }, process: function() {
    for (var o = i; o <= e; o++)
      for (var g = A[o], h = 0; h < g.length; h++)
        (0, g[h])();
  }, size: function() {
    return t;
  } };
}
var mt = "_erd";
function Yt(A) {
  return A[mt];
}
var Te = { initState: function(A) {
  return A[mt] = {}, Yt(A);
}, getState: Yt, cleanState: function(A) {
  delete A[mt];
} }, ZA = st, Le = ot.forEach, VA = ot.forEach, Ue = function(A) {
  var t = A.stateHandler.getState;
  return { isDetectable: function(e) {
    var i = t(e);
    return i && !!i.isDetectable;
  }, markAsDetectable: function(e) {
    t(e).isDetectable = !0;
  }, isBusy: function(e) {
    return !!t(e).busy;
  }, markBusy: function(e, i) {
    t(e).busy = !!i;
  } };
}, _e = function(A) {
  var t = {};
  function e(i) {
    var o = A.get(i);
    return o === void 0 ? [] : t[o] || [];
  }
  return { get: e, add: function(i, o) {
    var g = A.get(i);
    t[g] || (t[g] = []), t[g].push(o);
  }, removeListener: function(i, o) {
    for (var g = e(i), h = 0, B = g.length; h < B; ++h)
      if (g[h] === o) {
        g.splice(h, 1);
        break;
      }
  }, removeAllListeners: function(i) {
    var o = e(i);
    o && (o.length = 0);
  } };
}, He = function() {
  var A = 1;
  return { generate: function() {
    return A++;
  } };
}, Ye = function(A) {
  var t = A.idGenerator, e = A.stateHandler.getState;
  return { get: function(i) {
    var o = e(i);
    return o && o.id !== void 0 ? o.id : null;
  }, set: function(i) {
    var o = e(i);
    if (!o)
      throw new Error("setId required the element to have a resize detection state.");
    var g = t.generate();
    return o.id = g, g;
  } };
}, Pe = function(A) {
  function t() {
  }
  var e = { log: t, warn: t, error: t };
  if (!A && window.console) {
    var i = function(o, g) {
      o[g] = function() {
        var h = console[g];
        if (h.apply)
          h.apply(console, arguments);
        else
          for (var B = 0; B < arguments.length; B++)
            h(arguments[B]);
      };
    };
    i(e, "log"), i(e, "warn"), i(e, "error");
  }
  return e;
}, Pt = st, Oe = function(A) {
  var t = (A = A || {}).reporter, e = _t.getOption(A, "async", !0), i = _t.getOption(A, "auto", !0);
  i && !e && (t && t.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."), e = !0);
  var o, g = Ht(), h = !1;
  function B() {
    for (h = !0; g.size(); ) {
      var c = g;
      g = Ht(), c.process();
    }
    h = !1;
  }
  function u() {
    var c;
    c = B, o = setTimeout(c, 0);
  }
  return { add: function(c, f) {
    !h && i && e && g.size() === 0 && u(), g.add(c, f);
  }, force: function(c) {
    h || (c === void 0 && (c = e), o && (clearTimeout(o), o = null), c ? u() : B());
  } };
}, RA = Te, Ke = function(A) {
  var t = (A = A || {}).reporter, e = A.batchProcessor, i = A.stateHandler.getState;
  if (!t)
    throw new Error("Missing required dependency: reporter.");
  function o(h) {
    var B = A.important ? " !important; " : "; ";
    return (h.join(B) + B).trim();
  }
  function g(h) {
    return i(h).object;
  }
  return { makeDetectable: function(h, B, u) {
    u || (u = B, B = h, h = null), (h = h || {}).debug, ZA.isIE(8) ? u(B) : function(c, f) {
      var n = o(["display: block", "position: absolute", "top: 0", "left: 0", "width: 100%", "height: 100%", "border: none", "padding: 0", "margin: 0", "opacity: 0", "z-index: -1000", "pointer-events: none"]), d = !1, E = window.getComputedStyle(c), I = c.offsetWidth, b = c.offsetHeight;
      function s() {
        function a() {
          if (E.position === "static") {
            c.style.setProperty("position", "relative", h.important ? "important" : "");
            var r = function(C, l, p, m) {
              var D = p[m];
              D !== "auto" && function(G) {
                return G.replace(/[^-\d\.]/g, "");
              }(D) !== "0" && (C.warn("An element that is positioned static has style." + m + "=" + D + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + m + " will be set to 0. Element: ", l), l.style.setProperty(m, "0", h.important ? "important" : ""));
            };
            r(t, c, E, "top"), r(t, c, E, "right"), r(t, c, E, "bottom"), r(t, c, E, "left");
          }
        }
        E.position !== "" && (a(), d = !0);
        var Q = document.createElement("object");
        Q.style.cssText = n, Q.tabIndex = -1, Q.type = "text/html", Q.setAttribute("aria-hidden", "true"), Q.onload = function() {
          d || a(), function r(C, l) {
            if (!C.contentDocument) {
              var p = i(C);
              return p.checkForObjectDocumentTimeoutId && window.clearTimeout(p.checkForObjectDocumentTimeoutId), void (p.checkForObjectDocumentTimeoutId = setTimeout(function() {
                p.checkForObjectDocumentTimeoutId = 0, r(C, l);
              }, 100));
            }
            l(C.contentDocument);
          }(this, function(r) {
            f(c);
          });
        }, ZA.isIE() || (Q.data = "about:blank"), i(c) && (c.appendChild(Q), i(c).object = Q, ZA.isIE() && (Q.data = "about:blank"));
      }
      i(c).startSize = { width: I, height: b }, e ? e.add(s) : s();
    }(B, u);
  }, addListener: function(h, B) {
    function u() {
      B(h);
    }
    if (ZA.isIE(8))
      i(h).object = { proxy: u }, h.attachEvent("onresize", u);
    else {
      var c = g(h);
      if (!c)
        throw new Error("Element is not detectable by this strategy.");
      c.contentDocument.defaultView.addEventListener("resize", u);
    }
  }, uninstall: function(h) {
    if (i(h)) {
      var B = g(h);
      B && (ZA.isIE(8) ? h.detachEvent("onresize", B.proxy) : h.removeChild(B), i(h).checkForObjectDocumentTimeoutId && window.clearTimeout(i(h).checkForObjectDocumentTimeoutId), delete i(h).object);
    }
  } };
}, We = function(A) {
  var t = (A = A || {}).reporter, e = A.batchProcessor, i = A.stateHandler.getState;
  A.stateHandler.hasState;
  var o = A.idHandler;
  if (!e)
    throw new Error("Missing required dependency: batchProcessor");
  if (!t)
    throw new Error("Missing required dependency: reporter.");
  var g = function() {
    var E = 500, I = 500, b = document.createElement("div");
    b.style.cssText = u(["position: absolute", "width: 1000px", "height: 1000px", "visibility: hidden", "margin: 0", "padding: 0"]);
    var s = document.createElement("div");
    s.style.cssText = u(["position: absolute", "width: 500px", "height: 500px", "overflow: scroll", "visibility: none", "top: -1500px", "left: -1500px", "visibility: hidden", "margin: 0", "padding: 0"]), s.appendChild(b), document.body.insertBefore(s, document.body.firstChild);
    var a = E - s.clientWidth, Q = I - s.clientHeight;
    return document.body.removeChild(s), { width: a, height: Q };
  }(), h = "erd_scroll_detection_container";
  function B(E) {
    (function(I, b, s) {
      function a(l, p) {
        p = p || function(D) {
          I.head.appendChild(D);
        };
        var m = I.createElement("style");
        return m.innerHTML = l, m.id = b, p(m), m;
      }
      if (!I.getElementById(b)) {
        var Q = s + "_animation", r = s + "_animation_active", C = `/* Created by the element-resize-detector library. */
`;
        C += "." + s + " > div::-webkit-scrollbar { " + u(["display: none"]) + ` }

`, C += "." + r + " { " + u(["-webkit-animation-duration: 0.1s", "animation-duration: 0.1s", "-webkit-animation-name: " + Q, "animation-name: " + Q]) + ` }
`, C += "@-webkit-keyframes " + Q + ` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
`, a(C += "@keyframes " + Q + " { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }");
      }
    })(E, "erd_scroll_detection_scrollbar_style", h);
  }
  function u(E) {
    var I = A.important ? " !important; " : "; ";
    return (E.join(I) + I).trim();
  }
  function c(E, I, b) {
    if (E.addEventListener)
      E.addEventListener(I, b);
    else {
      if (!E.attachEvent)
        return t.error("[scroll] Don't know how to add event listeners.");
      E.attachEvent("on" + I, b);
    }
  }
  function f(E, I, b) {
    if (E.removeEventListener)
      E.removeEventListener(I, b);
    else {
      if (!E.detachEvent)
        return t.error("[scroll] Don't know how to remove event listeners.");
      E.detachEvent("on" + I, b);
    }
  }
  function n(E) {
    return i(E).container.childNodes[0].childNodes[0].childNodes[0];
  }
  function d(E) {
    return i(E).container.childNodes[0].childNodes[0].childNodes[1];
  }
  return B(window.document), { makeDetectable: function(E, I, b) {
    function s() {
      if (E.debug) {
        var k = Array.prototype.slice.call(arguments);
        if (k.unshift(o.get(I), "Scroll: "), t.log.apply)
          t.log.apply(null, k);
        else
          for (var F = 0; F < k.length; F++)
            t.log(k[F]);
      }
    }
    function a(k) {
      var F = i(k).container.childNodes[0], x = window.getComputedStyle(F);
      return !x.width || x.width.indexOf("px") === -1;
    }
    function Q() {
      var k = window.getComputedStyle(I), F = {};
      return F.position = k.position, F.width = I.offsetWidth, F.height = I.offsetHeight, F.top = k.top, F.right = k.right, F.bottom = k.bottom, F.left = k.left, F.widthCSS = k.width, F.heightCSS = k.height, F;
    }
    function r() {
      if (s("storeStyle invoked."), i(I)) {
        var k = Q();
        i(I).style = k;
      } else
        s("Aborting because element has been uninstalled");
    }
    function C(k, F, x) {
      i(k).lastWidth = F, i(k).lastHeight = x;
    }
    function l() {
      return 2 * g.width + 1;
    }
    function p() {
      return 2 * g.height + 1;
    }
    function m(k) {
      return k + 10 + l();
    }
    function D(k) {
      return k + 10 + p();
    }
    function G(k, F, x) {
      var y = n(k), v = d(k), M = m(F), w = D(x), Z = function(W) {
        return 2 * W + l();
      }(F), K = function(W) {
        return 2 * W + p();
      }(x);
      y.scrollLeft = M, y.scrollTop = w, v.scrollLeft = Z, v.scrollTop = K;
    }
    function R() {
      var k = i(I).container;
      if (!k) {
        (k = document.createElement("div")).className = h, k.style.cssText = u(["visibility: hidden", "display: inline", "width: 0px", "height: 0px", "z-index: -1", "overflow: hidden", "margin: 0", "padding: 0"]), i(I).container = k, function(x) {
          x.className += " " + h + "_animation_active";
        }(k), I.appendChild(k);
        var F = function() {
          i(I).onRendered && i(I).onRendered();
        };
        c(k, "animationstart", F), i(I).onAnimationStart = F;
      }
      return k;
    }
    function N() {
      if (s("Injecting elements"), i(I)) {
        (function() {
          var eA = i(I).style;
          if (eA.position === "static") {
            I.style.setProperty("position", "relative", E.important ? "important" : "");
            var IA = function(T, X, j, BA) {
              var $ = j[BA];
              $ !== "auto" && function(P) {
                return P.replace(/[^-\d\.]/g, "");
              }($) !== "0" && (T.warn("An element that is positioned static has style." + BA + "=" + $ + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + BA + " will be set to 0. Element: ", X), X.style[BA] = 0);
            };
            IA(t, I, eA, "top"), IA(t, I, eA, "right"), IA(t, I, eA, "bottom"), IA(t, I, eA, "left");
          }
        })();
        var k = i(I).container;
        k || (k = R());
        var F, x, y, v, M = g.width, w = g.height, Z = u(["position: absolute", "flex: none", "overflow: hidden", "z-index: -1", "visibility: hidden", "width: 100%", "height: 100%", "left: 0px", "top: 0px"]), K = u(["position: absolute", "flex: none", "overflow: hidden", "z-index: -1", "visibility: hidden"].concat(["left: " + (F = (F = -(1 + M)) ? F + "px" : "0"), "top: " + (x = (x = -(1 + w)) ? x + "px" : "0"), "right: " + (v = (v = -M) ? v + "px" : "0"), "bottom: " + (y = (y = -w) ? y + "px" : "0")])), W = u(["position: absolute", "flex: none", "overflow: scroll", "z-index: -1", "visibility: hidden", "width: 100%", "height: 100%"]), uA = u(["position: absolute", "flex: none", "overflow: scroll", "z-index: -1", "visibility: hidden", "width: 100%", "height: 100%"]), gA = u(["position: absolute", "left: 0", "top: 0"]), mA = u(["position: absolute", "width: 200%", "height: 200%"]), DA = document.createElement("div"), yA = document.createElement("div"), cA = document.createElement("div"), WA = document.createElement("div"), GA = document.createElement("div"), XA = document.createElement("div");
        DA.dir = "ltr", DA.style.cssText = Z, DA.className = h, yA.className = h, yA.style.cssText = K, cA.style.cssText = W, WA.style.cssText = gA, GA.style.cssText = uA, XA.style.cssText = mA, cA.appendChild(WA), GA.appendChild(XA), yA.appendChild(cA), yA.appendChild(GA), DA.appendChild(yA), k.appendChild(DA), c(cA, "scroll", jA), c(GA, "scroll", V), i(I).onExpandScroll = jA, i(I).onShrinkScroll = V;
      } else
        s("Aborting because element has been uninstalled");
      function jA() {
        var eA = i(I);
        eA && eA.onExpand ? eA.onExpand() : s("Aborting expand scroll handler: element has been uninstalled");
      }
      function V() {
        var eA = i(I);
        eA && eA.onShrink ? eA.onShrink() : s("Aborting shrink scroll handler: element has been uninstalled");
      }
    }
    function L() {
      function k(w, Z, K) {
        var W = function(mA) {
          return n(mA).childNodes[0];
        }(w), uA = m(Z), gA = D(K);
        W.style.setProperty("width", uA + "px", E.important ? "important" : ""), W.style.setProperty("height", gA + "px", E.important ? "important" : "");
      }
      function F(w) {
        var Z = I.offsetWidth, K = I.offsetHeight, W = Z !== i(I).lastWidth || K !== i(I).lastHeight;
        s("Storing current size", Z, K), C(I, Z, K), e.add(0, function() {
          if (W)
            if (i(I))
              if (x()) {
                if (E.debug) {
                  var uA = I.offsetWidth, gA = I.offsetHeight;
                  uA === Z && gA === K || t.warn(o.get(I), "Scroll: Size changed before updating detector elements.");
                }
                k(I, Z, K);
              } else
                s("Aborting because element container has not been initialized");
            else
              s("Aborting because element has been uninstalled");
        }), e.add(1, function() {
          i(I) ? x() ? G(I, Z, K) : s("Aborting because element container has not been initialized") : s("Aborting because element has been uninstalled");
        }), W && w && e.add(2, function() {
          i(I) ? x() ? w() : s("Aborting because element container has not been initialized") : s("Aborting because element has been uninstalled");
        });
      }
      function x() {
        return !!i(I).container;
      }
      function y() {
        s("notifyListenersIfNeeded invoked");
        var w = i(I);
        return i(I).lastNotifiedWidth === void 0 && w.lastWidth === w.startSize.width && w.lastHeight === w.startSize.height ? s("Not notifying: Size is the same as the start size, and there has been no notification yet.") : w.lastWidth === w.lastNotifiedWidth && w.lastHeight === w.lastNotifiedHeight ? s("Not notifying: Size already notified") : (s("Current size not notified, notifying..."), w.lastNotifiedWidth = w.lastWidth, w.lastNotifiedHeight = w.lastHeight, void Le(i(I).listeners, function(Z) {
          Z(I);
        }));
      }
      function v() {
        s("Scroll detected."), a(I) ? s("Scroll event fired while unrendered. Ignoring...") : F(y);
      }
      if (s("registerListenersAndPositionElements invoked."), i(I)) {
        i(I).onRendered = function() {
          if (s("startanimation triggered."), a(I))
            s("Ignoring since element is still unrendered...");
          else {
            s("Element rendered.");
            var w = n(I), Z = d(I);
            w.scrollLeft !== 0 && w.scrollTop !== 0 && Z.scrollLeft !== 0 && Z.scrollTop !== 0 || (s("Scrollbars out of sync. Updating detector elements..."), F(y));
          }
        }, i(I).onExpand = v, i(I).onShrink = v;
        var M = i(I).style;
        k(I, M.width, M.height);
      } else
        s("Aborting because element has been uninstalled");
    }
    function J() {
      if (s("finalizeDomMutation invoked."), i(I)) {
        var k = i(I).style;
        C(I, k.width, k.height), G(I, k.width, k.height);
      } else
        s("Aborting because element has been uninstalled");
    }
    function _() {
      b(I);
    }
    function U() {
      var k;
      s("Installing..."), i(I).listeners = [], k = Q(), i(I).startSize = { width: k.width, height: k.height }, s("Element start size", i(I).startSize), e.add(0, r), e.add(1, N), e.add(2, L), e.add(3, J), e.add(4, _);
    }
    b || (b = I, I = E, E = null), E = E || {}, s("Making detectable..."), function(k) {
      return !function(F) {
        var x = F.getRootNode && F.getRootNode().contains(F);
        return F === F.ownerDocument.body || F.ownerDocument.body.contains(F) || x;
      }(k) || window.getComputedStyle(k) === null;
    }(I) ? (s("Element is detached"), R(), s("Waiting until element is attached..."), i(I).onRendered = function() {
      s("Element is now attached"), U();
    }) : U();
  }, addListener: function(E, I) {
    if (!i(E).listeners.push)
      throw new Error("Cannot add listener to an element that is not detectable.");
    i(E).listeners.push(I);
  }, uninstall: function(E) {
    var I = i(E);
    I && (I.onExpandScroll && f(n(E), "scroll", I.onExpandScroll), I.onShrinkScroll && f(d(E), "scroll", I.onShrinkScroll), I.onAnimationStart && f(I.container, "animationstart", I.onAnimationStart), I.container && E.removeChild(I.container));
  }, initDocument: B };
};
function Ot(A) {
  return Array.isArray(A) || A.length !== void 0;
}
function Kt(A) {
  if (Array.isArray(A))
    return A;
  var t = [];
  return VA(A, function(e) {
    t.push(e);
  }), t;
}
function Wt(A) {
  return A && A.nodeType === 1;
}
function FA(A, t, e) {
  var i = A[t];
  return i == null && e !== void 0 ? e : i;
}
var oe = ((A) => (A.Ready = "READY", A.Play = "PLAY", A.Stop = "STOP", A))(oe || {});
const JA = { name: "CameraPlayer" };
JA.props = { rtspUrl: { type: [String, Function], default: "" }, videoKey: { type: String, default: () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(A) {
  const t = 16 * Math.random() | 0;
  return (A === "x" ? t : 3 & t | 8).toString(16);
}) }, envConfig: { type: Object, default: () => TA }, mode: { type: String, default: "aspectFit" }, width: { type: Number }, height: { type: Number }, poster: { type: String }, duration: { type: Number, default: 18e4 }, resize: { type: Object }, controls: { type: Boolean, default: !0 }, autoplay: { type: Boolean, default: !1 }, beforeEndThreshold: { type: Number, default: 1e4 }, onBeforeEnd: { type: Function, default: () => {
} }, keep: { type: Boolean, default: !1 }, videoOutputOptions: { type: Object, default: () => ({ outputOptions: ["-qscale", "10", "-strict", "unofficial"], size: "800x?" }) }, errorRetryDelay: { type: Number, default: 1500 }, errorRetryCount: { type: Number, default: 7 }, errorRtspUrlRefreshCount: { type: Number, default: 3 } }, JA.setup = (A, t) => {
  const e = "Repetitive operation", i = "Task not found", o = "Invalid argument", g = "Connection refused", h = "Conversion failed", B = "Parameter validation error", u = "Unknown", c = "Request timeout", f = { outputOptions: ["-qscale", "10", "-strict", "unofficial"], size: "800x?" }, n = A, d = t.emit, E = PA(() => n.keep ? 18e5 : n.duration), I = PA(() => Object.assign(f, n.videoOutputOptions)), b = (() => {
    const T = nA(!1), X = () => T.value = window.innerWidth <= 768;
    return X(), window.addEventListener("resize", X), T;
  })(), s = nA(), a = PA(() => {
    let T = [`camera-player__mode-${n.mode}`];
    switch (n.mode) {
      case "aspectFit":
        if (C.value && s.value && l.value) {
          const { width: X, height: j } = C.value.getBoundingClientRect(), { width: BA, height: $ } = ((P, H) => {
            let lA = { width: 0, height: 0 };
            if (P.indexOf("%") !== -1) {
              const Y = parseInt(P) / 100;
              lA.width = H.width * Y, lA.height = H.height * Y;
            } else {
              if (P.indexOf("x") === -1)
                throw new Error("size 格式错误");
              {
                const Y = parseInt(P.split("x")[0]), O = Y / H.width;
                lA.width = Y, lA.height = H.height * O;
              }
            }
            return lA;
          })(I.value.size, s.value);
          X > BA && j > $ && (X > j ? l.value.style.height = "100%" : l.value.style.width = "100%");
        }
        break;
      case "aspectFill":
        if (C.value && s.value) {
          const { width: X, height: j } = C.value.getBoundingClientRect();
          s.value.width / s.value.height >= X / j ? T.push(`camera-player__mode-${n.mode}--width`) : T.push(`camera-player__mode-${n.mode}--height`);
        }
    }
    return T.join(" ");
  }), Q = PA(() => {
    let T = "";
    return T = ["READY", "STOP"].includes(r.value) ? "play" : "stop", T;
  }), r = nA("READY"), C = nA(), l = nA(), p = ((T, X = TA) => `${((j) => ({ test: `${j.apiHost.test.replace("http", "ws")}/cameraPlayerServer`, prod: `${j.apiHost.prod.replace("http", "ws")}/cameraPlayerServer` })[j.env])(X)}/stream/${T}?token=${encodeURIComponent(Vt)}`)(n.videoKey, n.envConfig);
  let m, D;
  nA(!0);
  const G = () => {
    m = window.setTimeout(() => {
      if (+/* @__PURE__ */ new Date() - D > 6e3)
        return yA(), void clearTimeout(m);
      G();
    }, 1e3);
  };
  let R = null;
  const N = nA();
  he(() => {
    let T = {};
    n.resize ? T = { width: "100%" } : n.width && n.height && (T = { width: `${n.width}px`, height: `${n.height}px` }), N.value = T;
  }), wt(async () => {
    if (n.resize) {
      const { width: T, height: X } = n.resize, j = T / X, BA = ($) => {
        const { width: P } = $.getBoundingClientRect();
        N.value = { width: "100%", height: `${(P / j).toFixed(3)}px` };
      };
      C.value && (function(P) {
        var H;
        if ((P = P || {}).idHandler)
          H = { get: function(AA) {
            return P.idHandler.get(AA, !0);
          }, set: P.idHandler.set };
        else {
          var lA = He(), Y = Ye({ idGenerator: lA, stateHandler: RA });
          H = Y;
        }
        var O = P.reporter;
        O || (O = Pe(O === !1));
        var UA = FA(P, "batchProcessor", Oe({ reporter: O })), wA = {};
        wA.callOnAdd = !!FA(P, "callOnAdd", !0), wA.debug = !!FA(P, "debug", !1);
        var QA, bA = _e(H), qA = Ue({ stateHandler: RA }), oA = FA(P, "strategy", "object"), _A = FA(P, "important", !1), At = { reporter: O, batchProcessor: UA, stateHandler: RA, idHandler: H, important: _A };
        if (oA === "scroll" && (Pt.isLegacyOpera() ? (O.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."), oA = "object") : Pt.isIE(9) && (O.warn("Scroll strategy is not supported on IE9. Changing to object strategy."), oA = "object")), oA === "scroll")
          QA = We(At);
        else {
          if (oA !== "object")
            throw new Error("Invalid strategy name: " + oA);
          QA = Ke(At);
        }
        var HA = {};
        return { listenTo: function(AA, iA, YA) {
          function yt(sA) {
            var tA = bA.get(sA);
            VA(tA, function(dA) {
              dA(sA);
            });
          }
          function rt(sA, tA, dA) {
            bA.add(tA, dA), sA && dA(tA);
          }
          if (YA || (YA = iA, iA = AA, AA = {}), !iA)
            throw new Error("At least one element required.");
          if (!YA)
            throw new Error("Listener required.");
          if (Wt(iA))
            iA = [iA];
          else {
            if (!Ot(iA))
              return O.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
            iA = Kt(iA);
          }
          var tt = 0, at = FA(AA, "callOnAdd", wA.callOnAdd), nt = FA(AA, "onReady", function() {
          }), vA = FA(AA, "debug", wA.debug);
          VA(iA, function(sA) {
            RA.getState(sA) || (RA.initState(sA), H.set(sA));
            var tA = H.get(sA);
            if (vA && O.log("Attaching listener to element", tA, sA), !qA.isDetectable(sA))
              return vA && O.log(tA, "Not detectable."), qA.isBusy(sA) ? (vA && O.log(tA, "System busy making it detectable"), rt(at, sA, YA), HA[tA] = HA[tA] || [], void HA[tA].push(function() {
                ++tt === iA.length && nt();
              })) : (vA && O.log(tA, "Making detectable..."), qA.markBusy(sA, !0), QA.makeDetectable({ debug: vA, important: _A }, sA, function(dA) {
                if (vA && O.log(tA, "onElementDetectable"), RA.getState(dA)) {
                  qA.markAsDetectable(dA), qA.markBusy(dA, !1), QA.addListener(dA, yt), rt(at, dA, YA);
                  var et = RA.getState(dA);
                  if (et && et.startSize) {
                    var se = dA.offsetWidth, re = dA.offsetHeight;
                    et.startSize.width === se && et.startSize.height === re || yt(dA);
                  }
                  HA[tA] && VA(HA[tA], function(ae) {
                    ae();
                  });
                } else
                  vA && O.log(tA, "Element uninstalled before being detectable.");
                delete HA[tA], ++tt === iA.length && nt();
              }));
            vA && O.log(tA, "Already detecable, adding listener."), rt(at, sA, YA), tt++;
          }), tt === iA.length && nt();
        }, removeListener: bA.removeListener, removeAllListeners: bA.removeAllListeners, uninstall: function(AA) {
          if (!AA)
            return O.error("At least one element is required.");
          if (Wt(AA))
            AA = [AA];
          else {
            if (!Ot(AA))
              return O.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
            AA = Kt(AA);
          }
          VA(AA, function(iA) {
            bA.removeAllListeners(iA), QA.uninstall(iA), RA.cleanState(iA);
          });
        }, initDocument: function(AA) {
          QA.initDocument && QA.initDocument(AA);
        } };
      }().listenTo(C.value, BA), BA(C.value), await Ce(), U());
    }
  });
  const L = nA(), J = nA(), _ = nA(""), U = () => {
    let T = ["camera-player__mode-poster-aspectFill"];
    if (C.value && J.value) {
      const { width: X, height: j } = C.value.getBoundingClientRect();
      J.value.width / J.value.height >= X / j ? T.push("camera-player__mode-poster-aspectFill--width") : T.push("camera-player__mode-poster-aspectFill--height");
    }
    _.value = T.join(" ");
  }, k = nA(0), F = PA(() => n.keep ? "" : Nt(E.value));
  let x;
  const y = nA(0), v = () => {
    x = window.setTimeout(() => {
      var T;
      if (y.value += 1e3, k.value = +(y.value / E.value * 100).toFixed(3), y.value >= E.value)
        return y.value = E.value, k.value = 100, r.value = "STOP", d("stop"), clearTimeout(x), clearTimeout(m), void (w.value = !0);
      n.keep || E.value - y.value !== n.beforeEndThreshold || ((T = n.onBeforeEnd) == null || T.call(n)), v();
    }, 1e3);
  }, M = PA(() => Nt(y.value)), w = nA(!0), Z = () => {
    K.value || (["READY", "STOP"].includes(r.value) ? GA() : r.value === "PLAY" && yA());
  }, K = nA(!1);
  let W, uA = 1, gA = "", mA = 0;
  const DA = async (T) => {
    var BA, $, P, H, lA;
    (BA = W == null ? void 0 : W.abort) == null || BA.call(W), W = new AbortController(), K.value = !0, d("loading", !0), V.value = "";
    const { videoKey: X, errorRtspUrlRefreshCount: j } = n;
    if (mA === j ? (gA = "", mA = 1) : mA++, gA === "")
      if (pt(T)) {
        const Y = T();
        if (xt(Y))
          try {
            gA = await Y;
          } catch {
          }
        else
          gA = Y;
      } else if (xt(T))
        try {
          await T;
        } catch {
        }
      else
        gA = T;
    try {
      const { code: Y, data: O, message: UA } = await ((wA, QA, bA = TA) => $A.post(`${ut(bA)}/start`, wA, QA))({ key: X, rtspUrl: gA, duration: E.value, keep: n.keep, outputOptions: I.value.outputOptions, size: I.value.size }, { signal: W == null ? void 0 : W.signal }, n.envConfig);
      if (K.value = !1, d("loading", !1), Y === 2e3) {
        r.value = "PLAY", d("play"), w.value = !1;
        const { video_details: wA } = O, QA = ((oA) => {
          const _A = /^\d+x\d+$/;
          return oA.find((At) => _A.test(At)) || "";
        })(wA), [bA, qA] = QA.split("x");
        s.value = { width: bA, height: qA }, R || (R = new window.JSMpeg.Player(p, { loop: !1, canvas: l.value, onVideoDecode(oA, _A) {
          D = +/* @__PURE__ */ new Date();
        }, onAudioDecode(oA, _A) {
        }, onPlay(oA) {
        }, onPause(oA) {
        }, onEnded(oA) {
        }, onStalled(oA) {
        }, onSourceEstablished(oA) {
        }, onSourceCompleted(oA) {
        } })), y.value = 0, k.value = 0, v(), uA = 1, G();
      } else
        Y === 5e3 ? (r.value = "STOP", UA.indexOf("Invalid argument") !== -1 ? V.value = IA(o) : UA.indexOf("Connection refused") !== -1 ? uA >= n.errorRetryCount ? (d("stop"), V.value = IA(g), uA = 1) : (K.value = !0, d("loading", !0), await ((wA = 3e3) => new Promise((QA) => setTimeout(QA, wA)))(n.errorRetryDelay), uA++, await DA(T)) : UA.indexOf("Conversion failed") !== -1 ? V.value = IA(h) : UA.indexOf("signal SIGKILL") !== -1 ? (K.value = !0, d("loading", !0)) : V.value = IA(u)) : Y === 5001 ? V.value = IA(e) : Y === 4e3 && (V.value = IA(B));
    } catch (Y) {
      uA = 1, ((P = ($ = Y == null ? void 0 : Y.message) == null ? void 0 : $.indexOf) == null ? void 0 : P.call($, "timeout")) >= 0 && (V.value = IA(c), WA()), ((lA = (H = Y == null ? void 0 : Y.message) == null ? void 0 : H.indexOf) == null ? void 0 : lA.call(H, "axios-cancel")) >= 0 || (K.value = !1, d("loading", !1));
    }
  }, yA = async () => {
    V.value = "", await WA();
  };
  let cA;
  const WA = async () => {
    var X, j, BA, $, P;
    (X = cA == null ? void 0 : cA.abort) == null || X.call(cA), cA = new AbortController(), K.value = !0, d("loading", !0);
    const { videoKey: T } = n;
    try {
      const { code: H } = await ((lA, Y, O = TA) => $A.post(`${ut(O)}/stop`, lA, Y))({ key: T }, { signal: cA == null ? void 0 : cA.signal }, n.envConfig);
      K.value = !1, d("loading", !1), H === 2e3 ? (r.value = "STOP", d("stop"), y.value = 0, k.value = 0, clearTimeout(x), clearTimeout(m), w.value = !0, gA = "", mA = 0) : H === 5e3 ? (V.value = IA(i), r.value = "STOP", d("stop"), y.value = 0, k.value = 0, clearTimeout(x), clearTimeout(m), w.value = !0, gA = "", mA = 0) : H === 4e3 && (V.value = IA(B));
    } catch (H) {
      ((BA = (j = H == null ? void 0 : H.message) == null ? void 0 : j.indexOf) == null ? void 0 : BA.call(j, "timeout")) >= 0 && (V.value = IA(c)), ((P = ($ = H == null ? void 0 : H.message) == null ? void 0 : $.indexOf) == null ? void 0 : P.call($, "axios-cancel")) >= 0 || (K.value = !1, d("loading", !1));
    }
  }, GA = async () => {
    jA(), await DA(n.rtspUrl);
  }, XA = async () => {
    await yA(), R && (R == null || R.destroy(), R = null), clearTimeout(x), clearTimeout(m), clearTimeout(eA);
  }, jA = () => {
    r.value = "READY", clearTimeout(m), w.value = !0, y.value = 0, k.value = 0, clearTimeout(x), gA = "", mA = 0;
  }, V = nA("");
  let eA;
  Zt(V, (T) => {
    T !== "" && (clearTimeout(eA), eA = window.setTimeout(() => {
      V.value = "";
    }, 6e3));
  });
  const IA = (T) => `Error: ${T}`;
  return wt(() => {
    n.autoplay && Z();
  }), ce(() => {
    XA();
  }), de(() => {
  }), Ee(() => {
  }), Object.assign({ VideoStatus: oe, duration: E, clsMode: a, clsIcon: Q, videoStatus: r, wrapperEl: C, canvasEl: l, style: N, posterEl: L, handlePosterLoad: (T) => {
    L.value && (J.value = { width: L.value.width, height: L.value.height }, U());
  }, clsPosterMode: _, percent: k, formatDuration: F, currentTime: y, formatCurrentTime: M, visibleMobileOperate: w, handleOperate: () => {
    b.value && (w.value = !0);
  }, handleIcon: Z, loading: K, tips: V, handleClickOutside: () => {
    r.value === "PLAY" && (w.value = !1);
  } }, { play: GA, stop: yA, destroy: XA, setRtspUrl: async ({ rtspUrl: T }) => {
    jA(), await DA(T);
  } });
}, JA.components = Object.assign({ Loading: Ge }, JA.components), JA.directives = Object.assign({ onClickOutside: Je }, JA.directives);
const Xt = {};
var Xe = $t(JA, function() {
  var A = this, t = A.$createElement, e = A._self._c || t;
  return e("div", { ref: "wrapperEl", staticClass: "camera-player", class: [A.clsMode, A.videoStatus], style: A.style, on: { click: A.handleOperate } }, [e("canvas", { ref: "canvasEl", staticClass: "camera-player__canvas", class: { "no-play": A.videoStatus !== A.VideoStatus.Play }, attrs: { width: "0", height: "0" } }), e("img", { directives: [{ name: "show", rawName: "v-show", value: A.poster && A.clsPosterMode !== "" && A.videoStatus !== A.VideoStatus.Play, expression: `
      poster && clsPosterMode !== '' && videoStatus !== VideoStatus.Play
    ` }], ref: "posterEl", staticClass: "camera-player__poster", class: A.clsPosterMode, attrs: { src: A.poster }, on: { load: A.handlePosterLoad } }), A.controls ? e("div", { staticClass: "camera-player__control", on: { click: function(i) {
    i.stopPropagation();
  } } }, [e("div", { staticClass: "camera-player__control-top" }, [e("div", { staticClass: "play-icon", class: [A.clsIcon], on: { click: A.handleIcon } }), e("div", { staticClass: "camera-player__control-time" }, [A._v(" " + A._s(A.formatCurrentTime) + " "), A.keep ? A._e() : [A._v("/")], A._v(" " + A._s(A.formatDuration) + " ")], 2)]), A.keep ? A._e() : e("div", { staticClass: "camera-player__control-progress" }, [e("div", { staticClass: "camera-player__control-progress-inner", style: { width: `${A.percent}%` } })])]) : A._e(), A.controls ? e("Transition", { attrs: { name: "fade" } }, [e("div", { directives: [{ name: "show", rawName: "v-show", value: !A.loading && A.visibleMobileOperate, expression: "!loading && visibleMobileOperate" }], staticClass: "camera-player__control-icon-m", on: { click: function(i) {
    i.stopPropagation(), A.videoStatus === A.VideoStatus.Play && (A.visibleMobileOperate = !1);
  } } }, [e("div", { directives: [{ name: "show", rawName: "v-show", value: [A.VideoStatus.Ready, A.VideoStatus.Stop].includes(A.videoStatus), expression: "[VideoStatus.Ready, VideoStatus.Stop].includes(videoStatus)" }], staticClass: "play-icon-m play", on: { click: function(i) {
    return i.stopPropagation(), A.handleIcon.apply(null, arguments);
  } } }), e("div", { directives: [{ name: "show", rawName: "v-show", value: [A.VideoStatus.Play].includes(A.videoStatus), expression: "[VideoStatus.Play].includes(videoStatus)" }, { name: "on-click-outside", rawName: "v-on-click-outside", value: A.handleClickOutside, expression: "handleClickOutside" }], staticClass: "play-icon-m stop", on: { click: function(i) {
    return i.stopPropagation(), A.handleIcon.apply(null, arguments);
  } } })])]) : A._e(), e("div", { directives: [{ name: "show", rawName: "v-show", value: A.loading, expression: "loading" }], staticClass: "camera-player__loading", on: { click: function(i) {
    i.stopPropagation();
  } } }, [e("Loading", { staticClass: "camera-player__loading-icon" })], 1), A.controls ? e("Transition", { attrs: { name: "fade" } }, [e("div", { directives: [{ name: "show", rawName: "v-show", value: A.visibleMobileOperate, expression: "visibleMobileOperate" }], staticClass: "camera-player__bottom-m" }, [e("div", [A._v(" " + A._s(A.formatCurrentTime) + " ")]), A.keep ? A._e() : e("div", { staticClass: "camera-player__control-progress-m" }, [e("div", { staticClass: "camera-player__control-progress-inner-m", style: { width: `${A.percent}%` } })]), e("div", [A._v(" " + A._s(A.formatDuration) + " ")])])]) : A._e(), e("div", { directives: [{ name: "show", rawName: "v-show", value: A.tips !== "", expression: "tips !== ''" }], staticClass: "camera-player__tips" }, [A._v(" " + A._s(A.tips) + " ")]), A.videoStatus === A.VideoStatus.Play ? A._t("timer", null, { duration: A.duration, currentTime: A.currentTime }) : A._e()], 2);
}, [], !1, je, "12326f1e", null, null);
function je(A) {
  for (let t in Xt)
    this[t] = Xt[t];
}
const jt = function() {
  return Xe.exports;
}(), ei = (A = {}) => {
  const { env: t = "test", apiHost: e = { test: "https://ts.keytop.cn", prod: "https://ts.keytop.cn" } } = A;
  Object.assign(TA, { env: t, apiHost: e });
}, ii = { getH264: (A, t, e = TA) => $A.post(`${ut(e)}/getH264`, A, t) };
Object.assign(jt, { install: (A, t = {}) => {
  const { env: e = "test", apiHost: i = { test: "https://ts.keytop.cn", prod: "https://ts.keytop.cn" } } = t;
  Object.assign(TA, { env: e, apiHost: i }), A.component("camera-player", jt);
} });
export {
  jt as default,
  ii as server,
  ei as setGlobalOptions
};
