UNPKG

mediaquad-video-component

Version:

1,454 lines 620 kB
import { openBlock as se, createElementBlock as Se, normalizeStyle as Ne, createElementVNode as j, defineComponent as Fs, resolveDirective as dr, withDirectives as hr, normalizeClass as Fe, resolveComponent as jt, createBlock as Le, createCommentVNode as Ae, toDisplayString as Ye, createVNode as zt, Fragment as fr, renderList as gr } from "vue"; var mr = { mounted: function(n, e) { var t = 60, s = n.closest('div[data="root"]'); s || (s = n); var i = s.getBoundingClientRect(), r = i.width + i.left, a = i.left, o = e.value; n.classList.add("tooltip"), n.setAttribute("tabindex", "0"); function l() { var u = document.createElement("span"); u.textContent = o, u.setAttribute("id", "tooltip"), n.appendChild(u); var d = u.getBoundingClientRect(); if (d.right > r) { var h = d.right - r + 10; u.style.transform = "translateX(-".concat(h, "px)"); } else if (d.left < a) { var g = Math.abs(d.left) + 10; u.style.transform = "translateX(".concat(g, "px)"); } u.style.bottom = "".concat(t, "px"), n.addEventListener("mouseleave", c), n.addEventListener("blur", c), n.removeEventListener("mouseenter", l), n.removeEventListener("focus", l); } function c() { var u = n.querySelector("#tooltip"); u && n.removeChild(u), n.removeEventListener("mouseleave", c), n.removeEventListener("blur", c), n.addEventListener("mouseenter", l), n.addEventListener("focus", l); } n.addEventListener("mouseenter", l), n.addEventListener("focus", l); } }; function pr(n, e, t, s) { function i(r) { return r instanceof t ? r : new t(function(a) { a(r); }); } return new (t || (t = Promise))(function(r, a) { function o(u) { try { c(s.next(u)); } catch (d) { a(d); } } function l(u) { try { c(s.throw(u)); } catch (d) { a(d); } } function c(u) { u.done ? r(u.value) : i(u.value).then(o, l); } c((s = s.apply(n, e || [])).next()); }); } function yr(n, e) { var t = { label: 0, sent: function() { if (r[0] & 1) throw r[1]; return r[1]; }, trys: [], ops: [] }, s, i, r, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return a.next = o(0), a.throw = o(1), a.return = o(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() { return this; }), a; function o(c) { return function(u) { return l([c, u]); }; } function l(c) { if (s) throw new TypeError("Generator is already executing."); for (; a && (a = 0, c[0] && (t = 0)), t; ) try { if (s = 1, i && (r = c[0] & 2 ? i.return : c[0] ? i.throw || ((r = i.return) && r.call(i), 0) : i.next) && !(r = r.call(i, c[1])).done) return r; switch (i = 0, r && (c = [c[0] & 2, r.value]), c[0]) { case 0: case 1: r = c; break; case 4: return t.label++, { value: c[1], done: !1 }; case 5: t.label++, i = c[1], c = [0]; continue; case 7: c = t.ops.pop(), t.trys.pop(); continue; default: if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (c[0] === 6 || c[0] === 2)) { t = 0; continue; } if (c[0] === 3 && (!r || c[1] > r[0] && c[1] < r[3])) { t.label = c[1]; break; } if (c[0] === 6 && t.label < r[1]) { t.label = r[1], r = c; break; } if (r && t.label < r[2]) { t.label = r[2], t.ops.push(c); break; } r[2] && t.ops.pop(), t.trys.pop(); continue; } c = e.call(n, t); } catch (u) { c = [6, u], i = 0; } finally { s = r = 0; } if (c[0] & 5) throw c[1]; return { value: c[0] ? c[1] : void 0, done: !0 }; } } function Tr(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } var Zi = { exports: {} }; (function(n, e) { (function(t) { var s = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, i = /^(?=([^\/?#]*))\1([^]*)$/, r = /(?:\/|^)\.(?=\/)/g, a = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, o = { // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or // // E.g // With opts.alwaysNormalize = false (default, spec compliant) // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g // With opts.alwaysNormalize = true (not spec compliant) // http://a.com/b/cd + /e/f/../g => http://a.com/e/g buildAbsoluteURL: function(l, c, u) { if (u = u || {}, l = l.trim(), c = c.trim(), !c) { if (!u.alwaysNormalize) return l; var d = o.parseURL(l); if (!d) throw new Error("Error trying to parse base URL."); return d.path = o.normalizePath( d.path ), o.buildURLFromParts(d); } var h = o.parseURL(c); if (!h) throw new Error("Error trying to parse relative URL."); if (h.scheme) return u.alwaysNormalize ? (h.path = o.normalizePath(h.path), o.buildURLFromParts(h)) : c; var g = o.parseURL(l); if (!g) throw new Error("Error trying to parse base URL."); if (!g.netLoc && g.path && g.path[0] !== "/") { var f = i.exec(g.path); g.netLoc = f[1], g.path = f[2]; } g.netLoc && !g.path && (g.path = "/"); var m = { // 2c) Otherwise, the embedded URL inherits the scheme of // the base URL. scheme: g.scheme, netLoc: h.netLoc, path: null, params: h.params, query: h.query, fragment: h.fragment }; if (!h.netLoc && (m.netLoc = g.netLoc, h.path[0] !== "/")) if (!h.path) m.path = g.path, h.params || (m.params = g.params, h.query || (m.query = g.query)); else { var y = g.path, T = y.substring(0, y.lastIndexOf("/") + 1) + h.path; m.path = o.normalizePath(T); } return m.path === null && (m.path = u.alwaysNormalize ? o.normalizePath(h.path) : h.path), o.buildURLFromParts(m); }, parseURL: function(l) { var c = s.exec(l); return c ? { scheme: c[1] || "", netLoc: c[2] || "", path: c[3] || "", params: c[4] || "", query: c[5] || "", fragment: c[6] || "" } : null; }, normalizePath: function(l) { for (l = l.split("").reverse().join("").replace(r, ""); l.length !== (l = l.replace(a, "")).length; ) ; return l.split("").reverse().join(""); }, buildURLFromParts: function(l) { return l.scheme + l.netLoc + l.path + l.params + l.query + l.fragment; } }; n.exports = o; })(); })(Zi); var Os = Zi.exports; function Zs(n, e) { var t = Object.keys(n); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(n); e && (s = s.filter(function(i) { return Object.getOwnPropertyDescriptor(n, i).enumerable; })), t.push.apply(t, s); } return t; } function ce(n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e] != null ? arguments[e] : {}; e % 2 ? Zs(Object(t), !0).forEach(function(s) { Sr(n, s, t[s]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : Zs(Object(t)).forEach(function(s) { Object.defineProperty(n, s, Object.getOwnPropertyDescriptor(t, s)); }); } return n; } function Er(n, e) { if (typeof n != "object" || !n) return n; var t = n[Symbol.toPrimitive]; if (t !== void 0) { var s = t.call(n, e || "default"); if (typeof s != "object") return s; throw new TypeError("@@toPrimitive must return a primitive value."); } return (e === "string" ? String : Number)(n); } function xr(n) { var e = Er(n, "string"); return typeof e == "symbol" ? e : String(e); } function Sr(n, e, t) { return e = xr(e), e in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n; } function ne() { return ne = Object.assign ? Object.assign.bind() : function(n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (n[s] = t[s]); } return n; }, ne.apply(this, arguments); } const O = Number.isFinite || function(n) { return typeof n == "number" && isFinite(n); }, vr = Number.isSafeInteger || function(n) { return typeof n == "number" && Math.abs(n) <= Lr; }, Lr = Number.MAX_SAFE_INTEGER || 9007199254740991; let p = /* @__PURE__ */ function(n) { return n.MEDIA_ATTACHING = "hlsMediaAttaching", n.MEDIA_ATTACHED = "hlsMediaAttached", n.MEDIA_DETACHING = "hlsMediaDetaching", n.MEDIA_DETACHED = "hlsMediaDetached", n.BUFFER_RESET = "hlsBufferReset", n.BUFFER_CODECS = "hlsBufferCodecs", n.BUFFER_CREATED = "hlsBufferCreated", n.BUFFER_APPENDING = "hlsBufferAppending", n.BUFFER_APPENDED = "hlsBufferAppended", n.BUFFER_EOS = "hlsBufferEos", n.BUFFER_FLUSHING = "hlsBufferFlushing", n.BUFFER_FLUSHED = "hlsBufferFlushed", n.MANIFEST_LOADING = "hlsManifestLoading", n.MANIFEST_LOADED = "hlsManifestLoaded", n.MANIFEST_PARSED = "hlsManifestParsed", n.LEVEL_SWITCHING = "hlsLevelSwitching", n.LEVEL_SWITCHED = "hlsLevelSwitched", n.LEVEL_LOADING = "hlsLevelLoading", n.LEVEL_LOADED = "hlsLevelLoaded", n.LEVEL_UPDATED = "hlsLevelUpdated", n.LEVEL_PTS_UPDATED = "hlsLevelPtsUpdated", n.LEVELS_UPDATED = "hlsLevelsUpdated", n.AUDIO_TRACKS_UPDATED = "hlsAudioTracksUpdated", n.AUDIO_TRACK_SWITCHING = "hlsAudioTrackSwitching", n.AUDIO_TRACK_SWITCHED = "hlsAudioTrackSwitched", n.AUDIO_TRACK_LOADING = "hlsAudioTrackLoading", n.AUDIO_TRACK_LOADED = "hlsAudioTrackLoaded", n.SUBTITLE_TRACKS_UPDATED = "hlsSubtitleTracksUpdated", n.SUBTITLE_TRACKS_CLEARED = "hlsSubtitleTracksCleared", n.SUBTITLE_TRACK_SWITCH = "hlsSubtitleTrackSwitch", n.SUBTITLE_TRACK_LOADING = "hlsSubtitleTrackLoading", n.SUBTITLE_TRACK_LOADED = "hlsSubtitleTrackLoaded", n.SUBTITLE_FRAG_PROCESSED = "hlsSubtitleFragProcessed", n.CUES_PARSED = "hlsCuesParsed", n.NON_NATIVE_TEXT_TRACKS_FOUND = "hlsNonNativeTextTracksFound", n.INIT_PTS_FOUND = "hlsInitPtsFound", n.FRAG_LOADING = "hlsFragLoading", n.FRAG_LOAD_EMERGENCY_ABORTED = "hlsFragLoadEmergencyAborted", n.FRAG_LOADED = "hlsFragLoaded", n.FRAG_DECRYPTED = "hlsFragDecrypted", n.FRAG_PARSING_INIT_SEGMENT = "hlsFragParsingInitSegment", n.FRAG_PARSING_USERDATA = "hlsFragParsingUserdata", n.FRAG_PARSING_METADATA = "hlsFragParsingMetadata", n.FRAG_PARSED = "hlsFragParsed", n.FRAG_BUFFERED = "hlsFragBuffered", n.FRAG_CHANGED = "hlsFragChanged", n.FPS_DROP = "hlsFpsDrop", n.FPS_DROP_LEVEL_CAPPING = "hlsFpsDropLevelCapping", n.MAX_AUTO_LEVEL_UPDATED = "hlsMaxAutoLevelUpdated", n.ERROR = "hlsError", n.DESTROYING = "hlsDestroying", n.KEY_LOADING = "hlsKeyLoading", n.KEY_LOADED = "hlsKeyLoaded", n.LIVE_BACK_BUFFER_REACHED = "hlsLiveBackBufferReached", n.BACK_BUFFER_REACHED = "hlsBackBufferReached", n.STEERING_MANIFEST_LOADED = "hlsSteeringManifestLoaded", n; }({}), $ = /* @__PURE__ */ function(n) { return n.NETWORK_ERROR = "networkError", n.MEDIA_ERROR = "mediaError", n.KEY_SYSTEM_ERROR = "keySystemError", n.MUX_ERROR = "muxError", n.OTHER_ERROR = "otherError", n; }({}), A = /* @__PURE__ */ function(n) { return n.KEY_SYSTEM_NO_KEYS = "keySystemNoKeys", n.KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess", n.KEY_SYSTEM_NO_SESSION = "keySystemNoSession", n.KEY_SYSTEM_NO_CONFIGURED_LICENSE = "keySystemNoConfiguredLicense", n.KEY_SYSTEM_LICENSE_REQUEST_FAILED = "keySystemLicenseRequestFailed", n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED = "keySystemServerCertificateRequestFailed", n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED = "keySystemServerCertificateUpdateFailed", n.KEY_SYSTEM_SESSION_UPDATE_FAILED = "keySystemSessionUpdateFailed", n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED = "keySystemStatusOutputRestricted", n.KEY_SYSTEM_STATUS_INTERNAL_ERROR = "keySystemStatusInternalError", n.MANIFEST_LOAD_ERROR = "manifestLoadError", n.MANIFEST_LOAD_TIMEOUT = "manifestLoadTimeOut", n.MANIFEST_PARSING_ERROR = "manifestParsingError", n.MANIFEST_INCOMPATIBLE_CODECS_ERROR = "manifestIncompatibleCodecsError", n.LEVEL_EMPTY_ERROR = "levelEmptyError", n.LEVEL_LOAD_ERROR = "levelLoadError", n.LEVEL_LOAD_TIMEOUT = "levelLoadTimeOut", n.LEVEL_PARSING_ERROR = "levelParsingError", n.LEVEL_SWITCH_ERROR = "levelSwitchError", n.AUDIO_TRACK_LOAD_ERROR = "audioTrackLoadError", n.AUDIO_TRACK_LOAD_TIMEOUT = "audioTrackLoadTimeOut", n.SUBTITLE_LOAD_ERROR = "subtitleTrackLoadError", n.SUBTITLE_TRACK_LOAD_TIMEOUT = "subtitleTrackLoadTimeOut", n.FRAG_LOAD_ERROR = "fragLoadError", n.FRAG_LOAD_TIMEOUT = "fragLoadTimeOut", n.FRAG_DECRYPT_ERROR = "fragDecryptError", n.FRAG_PARSING_ERROR = "fragParsingError", n.FRAG_GAP = "fragGap", n.REMUX_ALLOC_ERROR = "remuxAllocError", n.KEY_LOAD_ERROR = "keyLoadError", n.KEY_LOAD_TIMEOUT = "keyLoadTimeOut", n.BUFFER_ADD_CODEC_ERROR = "bufferAddCodecError", n.BUFFER_INCOMPATIBLE_CODECS_ERROR = "bufferIncompatibleCodecsError", n.BUFFER_APPEND_ERROR = "bufferAppendError", n.BUFFER_APPENDING_ERROR = "bufferAppendingError", n.BUFFER_STALLED_ERROR = "bufferStalledError", n.BUFFER_FULL_ERROR = "bufferFullError", n.BUFFER_SEEK_OVER_HOLE = "bufferSeekOverHole", n.BUFFER_NUDGE_ON_STALL = "bufferNudgeOnStall", n.INTERNAL_EXCEPTION = "internalException", n.INTERNAL_ABORTED = "aborted", n.UNKNOWN = "unknown", n; }({}); const Ve = function() { }, Es = { trace: Ve, debug: Ve, log: Ve, warn: Ve, info: Ve, error: Ve }; let ot = Es; function Ar(n) { const e = self.console[n]; return e ? e.bind(self.console, `[${n}] >`) : Ve; } function Rr(n, ...e) { e.forEach(function(t) { ot[t] = n[t] ? n[t].bind(n) : Ar(t); }); } function br(n, e) { if (typeof console == "object" && n === !0 || typeof n == "object") { Rr( n, // Remove out from list here to hard-disable a log-level // 'trace', "debug", "log", "info", "warn", "error" ); try { ot.log(`Debug logs enabled for "${e}" in hls.js version 1.5.19`); } catch { ot = Es; } } else ot = Es; } const v = ot, Ir = /^(\d+)x(\d+)$/, ei = /(.+?)=(".*?"|.*?)(?:,|$)/g; class te { constructor(e) { typeof e == "string" && (e = te.parseAttrList(e)), ne(this, e); } get clientAttrs() { return Object.keys(this).filter((e) => e.substring(0, 2) === "X-"); } decimalInteger(e) { const t = parseInt(this[e], 10); return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t; } hexadecimalInteger(e) { if (this[e]) { let t = (this[e] || "0x").slice(2); t = (t.length & 1 ? "0" : "") + t; const s = new Uint8Array(t.length / 2); for (let i = 0; i < t.length / 2; i++) s[i] = parseInt(t.slice(i * 2, i * 2 + 2), 16); return s; } else return null; } hexadecimalIntegerAsNumber(e) { const t = parseInt(this[e], 16); return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t; } decimalFloatingPoint(e) { return parseFloat(this[e]); } optionalFloat(e, t) { const s = this[e]; return s ? parseFloat(s) : t; } enumeratedString(e) { return this[e]; } bool(e) { return this[e] === "YES"; } decimalResolution(e) { const t = Ir.exec(this[e]); if (t !== null) return { width: parseInt(t[1], 10), height: parseInt(t[2], 10) }; } static parseAttrList(e) { let t; const s = {}, i = '"'; for (ei.lastIndex = 0; (t = ei.exec(e)) !== null; ) { let r = t[2]; r.indexOf(i) === 0 && r.lastIndexOf(i) === r.length - 1 && (r = r.slice(1, -1)); const a = t[1].trim(); s[a] = r; } return s; } } function Dr(n) { return n !== "ID" && n !== "CLASS" && n !== "START-DATE" && n !== "DURATION" && n !== "END-DATE" && n !== "END-ON-NEXT"; } function Cr(n) { return n === "SCTE35-OUT" || n === "SCTE35-IN"; } class en { constructor(e, t) { if (this.attr = void 0, this._startDate = void 0, this._endDate = void 0, this._badValueForSameId = void 0, t) { const s = t.attr; for (const i in s) if (Object.prototype.hasOwnProperty.call(e, i) && e[i] !== s[i]) { v.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`), this._badValueForSameId = i; break; } e = ne(new te({}), s, e); } if (this.attr = e, this._startDate = new Date(e["START-DATE"]), "END-DATE" in this.attr) { const s = new Date(this.attr["END-DATE"]); O(s.getTime()) && (this._endDate = s); } } get id() { return this.attr.ID; } get class() { return this.attr.CLASS; } get startDate() { return this._startDate; } get endDate() { if (this._endDate) return this._endDate; const e = this.duration; return e !== null ? new Date(this._startDate.getTime() + e * 1e3) : null; } get duration() { if ("DURATION" in this.attr) { const e = this.attr.decimalFloatingPoint("DURATION"); if (O(e)) return e; } else if (this._endDate) return (this._endDate.getTime() - this._startDate.getTime()) / 1e3; return null; } get plannedDuration() { return "PLANNED-DURATION" in this.attr ? this.attr.decimalFloatingPoint("PLANNED-DURATION") : null; } get endOnNext() { return this.attr.bool("END-ON-NEXT"); } get isValid() { return !!this.id && !this._badValueForSameId && O(this.startDate.getTime()) && (this.duration === null || this.duration >= 0) && (!this.endOnNext || !!this.class); } } class Ht { constructor() { this.aborted = !1, this.loaded = 0, this.retry = 0, this.total = 0, this.chunkCount = 0, this.bwEstimate = 0, this.loading = { start: 0, first: 0, end: 0 }, this.parsing = { start: 0, end: 0 }, this.buffering = { start: 0, first: 0, end: 0 }; } } var J = { AUDIO: "audio", VIDEO: "video", AUDIOVIDEO: "audiovideo" }; class tn { constructor(e) { this._byteRange = null, this._url = null, this.baseurl = void 0, this.relurl = void 0, this.elementaryStreams = { [J.AUDIO]: null, [J.VIDEO]: null, [J.AUDIOVIDEO]: null }, this.baseurl = e; } // setByteRange converts a EXT-X-BYTERANGE attribute into a two element array setByteRange(e, t) { const s = e.split("@", 2); let i; s.length === 1 ? i = (t == null ? void 0 : t.byteRangeEndOffset) || 0 : i = parseInt(s[1]), this._byteRange = [i, parseInt(s[0]) + i]; } get byteRange() { return this._byteRange ? this._byteRange : []; } get byteRangeStartOffset() { return this.byteRange[0]; } get byteRangeEndOffset() { return this.byteRange[1]; } get url() { return !this._url && this.baseurl && this.relurl && (this._url = Os.buildAbsoluteURL(this.baseurl, this.relurl, { alwaysNormalize: !0 })), this._url || ""; } set url(e) { this._url = e; } } class Xt extends tn { constructor(e, t) { super(t), this._decryptdata = null, this.rawProgramDateTime = null, this.programDateTime = null, this.tagList = [], this.duration = 0, this.sn = 0, this.levelkeys = void 0, this.type = void 0, this.loader = null, this.keyLoader = null, this.level = -1, this.cc = 0, this.startPTS = void 0, this.endPTS = void 0, this.startDTS = void 0, this.endDTS = void 0, this.start = 0, this.deltaPTS = void 0, this.maxStartPTS = void 0, this.minEndPTS = void 0, this.stats = new Ht(), this.data = void 0, this.bitrateTest = !1, this.title = null, this.initSegment = null, this.endList = void 0, this.gap = void 0, this.urlId = 0, this.type = e; } get decryptdata() { const { levelkeys: e } = this; if (!e && !this._decryptdata) return null; if (!this._decryptdata && this.levelkeys && !this.levelkeys.NONE) { const t = this.levelkeys.identity; if (t) this._decryptdata = t.getDecryptData(this.sn); else { const s = Object.keys(this.levelkeys); if (s.length === 1) return this._decryptdata = this.levelkeys[s[0]].getDecryptData(this.sn); } } return this._decryptdata; } get end() { return this.start + this.duration; } get endProgramDateTime() { if (this.programDateTime === null || !O(this.programDateTime)) return null; const e = O(this.duration) ? this.duration : 0; return this.programDateTime + e * 1e3; } get encrypted() { var e; if ((e = this._decryptdata) != null && e.encrypted) return !0; if (this.levelkeys) { const t = Object.keys(this.levelkeys), s = t.length; if (s > 1 || s === 1 && this.levelkeys[t[0]].encrypted) return !0; } return !1; } setKeyFormat(e) { if (this.levelkeys) { const t = this.levelkeys[e]; t && !this._decryptdata && (this._decryptdata = t.getDecryptData(this.sn)); } } abortRequests() { var e, t; (e = this.loader) == null || e.abort(), (t = this.keyLoader) == null || t.abort(); } setElementaryStreamInfo(e, t, s, i, r, a = !1) { const { elementaryStreams: o } = this, l = o[e]; if (!l) { o[e] = { startPTS: t, endPTS: s, startDTS: i, endDTS: r, partial: a }; return; } l.startPTS = Math.min(l.startPTS, t), l.endPTS = Math.max(l.endPTS, s), l.startDTS = Math.min(l.startDTS, i), l.endDTS = Math.max(l.endDTS, r); } clearElementaryStreamInfo() { const { elementaryStreams: e } = this; e[J.AUDIO] = null, e[J.VIDEO] = null, e[J.AUDIOVIDEO] = null; } } class wr extends tn { constructor(e, t, s, i, r) { super(s), this.fragOffset = 0, this.duration = 0, this.gap = !1, this.independent = !1, this.relurl = void 0, this.fragment = void 0, this.index = void 0, this.stats = new Ht(), this.duration = e.decimalFloatingPoint("DURATION"), this.gap = e.bool("GAP"), this.independent = e.bool("INDEPENDENT"), this.relurl = e.enumeratedString("URI"), this.fragment = t, this.index = i; const a = e.enumeratedString("BYTERANGE"); a && this.setByteRange(a, r), r && (this.fragOffset = r.fragOffset + r.duration); } get start() { return this.fragment.start + this.fragOffset; } get end() { return this.start + this.duration; } get loaded() { const { elementaryStreams: e } = this; return !!(e.audio || e.video || e.audiovideo); } } const kr = 10; class _r { constructor(e) { this.PTSKnown = !1, this.alignedSliding = !1, this.averagetargetduration = void 0, this.endCC = 0, this.endSN = 0, this.fragments = void 0, this.fragmentHint = void 0, this.partList = null, this.dateRanges = void 0, this.live = !0, this.ageHeader = 0, this.advancedDateTime = void 0, this.updated = !0, this.advanced = !0, this.availabilityDelay = void 0, this.misses = 0, this.startCC = 0, this.startSN = 0, this.startTimeOffset = null, this.targetduration = 0, this.totalduration = 0, this.type = null, this.url = void 0, this.m3u8 = "", this.version = null, this.canBlockReload = !1, this.canSkipUntil = 0, this.canSkipDateRanges = !1, this.skippedSegments = 0, this.recentlyRemovedDateranges = void 0, this.partHoldBack = 0, this.holdBack = 0, this.partTarget = 0, this.preloadHint = void 0, this.renditionReports = void 0, this.tuneInGoal = 0, this.deltaUpdateFailed = void 0, this.driftStartTime = 0, this.driftEndTime = 0, this.driftStart = 0, this.driftEnd = 0, this.encryptedFragments = void 0, this.playlistParsingError = null, this.variableList = null, this.hasVariableRefs = !1, this.fragments = [], this.encryptedFragments = [], this.dateRanges = {}, this.url = e; } reloaded(e) { if (!e) { this.advanced = !0, this.updated = !0; return; } const t = this.lastPartSn - e.lastPartSn, s = this.lastPartIndex - e.lastPartIndex; this.updated = this.endSN !== e.endSN || !!s || !!t || !this.live, this.advanced = this.endSN > e.endSN || t > 0 || t === 0 && s > 0, this.updated || this.advanced ? this.misses = Math.floor(e.misses * 0.6) : this.misses = e.misses + 1, this.availabilityDelay = e.availabilityDelay; } get hasProgramDateTime() { return this.fragments.length ? O(this.fragments[this.fragments.length - 1].programDateTime) : !1; } get levelTargetDuration() { return this.averagetargetduration || this.targetduration || kr; } get drift() { const e = this.driftEndTime - this.driftStartTime; return e > 0 ? (this.driftEnd - this.driftStart) * 1e3 / e : 1; } get edge() { return this.partEnd || this.fragmentEnd; } get partEnd() { var e; return (e = this.partList) != null && e.length ? this.partList[this.partList.length - 1].end : this.fragmentEnd; } get fragmentEnd() { var e; return (e = this.fragments) != null && e.length ? this.fragments[this.fragments.length - 1].end : 0; } get age() { return this.advancedDateTime ? Math.max(Date.now() - this.advancedDateTime, 0) / 1e3 : 0; } get lastPartIndex() { var e; return (e = this.partList) != null && e.length ? this.partList[this.partList.length - 1].index : -1; } get lastPartSn() { var e; return (e = this.partList) != null && e.length ? this.partList[this.partList.length - 1].fragment.sn : this.endSN; } } function Ms(n) { return Uint8Array.from(atob(n), (e) => e.charCodeAt(0)); } function Pr(n) { const e = xs(n).subarray(0, 16), t = new Uint8Array(16); return t.set(e, 16 - e.length), t; } function Fr(n) { const e = function(s, i, r) { const a = s[i]; s[i] = s[r], s[r] = a; }; e(n, 0, 3), e(n, 1, 2), e(n, 4, 5), e(n, 6, 7); } function Or(n) { const e = n.split(":"); let t = null; if (e[0] === "data" && e.length === 2) { const s = e[1].split(";"), i = s[s.length - 1].split(","); if (i.length === 2) { const r = i[0] === "base64", a = i[1]; r ? (s.splice(-1, 1), t = Ms(a)) : t = Pr(a); } } return t; } function xs(n) { return Uint8Array.from(unescape(encodeURIComponent(n)), (e) => e.charCodeAt(0)); } const tt = typeof self < "u" ? self : void 0; var X = { CLEARKEY: "org.w3.clearkey", FAIRPLAY: "com.apple.fps", PLAYREADY: "com.microsoft.playready", WIDEVINE: "com.widevine.alpha" }, ge = { CLEARKEY: "org.w3.clearkey", FAIRPLAY: "com.apple.streamingkeydelivery", PLAYREADY: "com.microsoft.playready", WIDEVINE: "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" }; function Qt(n) { switch (n) { case ge.FAIRPLAY: return X.FAIRPLAY; case ge.PLAYREADY: return X.PLAYREADY; case ge.WIDEVINE: return X.WIDEVINE; case ge.CLEARKEY: return X.CLEARKEY; } } var dt = { CENC: "1077efecc0b24d02ace33c1e52e2fb4b", CLEARKEY: "e2719d58a985b3c9781ab030af78d30e", FAIRPLAY: "94ce86fb07ff4f43adb893d2fa968ca2", PLAYREADY: "9a04f07998404286ab92e65be0885f95", WIDEVINE: "edef8ba979d64acea3c827dcd51d21ed" }; function Jt(n) { if (n === dt.WIDEVINE) return X.WIDEVINE; if (n === dt.PLAYREADY) return X.PLAYREADY; if (n === dt.CENC || n === dt.CLEARKEY) return X.CLEARKEY; } function Zt(n) { switch (n) { case X.FAIRPLAY: return ge.FAIRPLAY; case X.PLAYREADY: return ge.PLAYREADY; case X.WIDEVINE: return ge.WIDEVINE; case X.CLEARKEY: return ge.CLEARKEY; } } function ht(n) { const { drmSystems: e, widevineLicenseUrl: t } = n, s = e ? [X.FAIRPLAY, X.WIDEVINE, X.PLAYREADY, X.CLEARKEY].filter((i) => !!e[i]) : []; return !s[X.WIDEVINE] && t && s.push(X.WIDEVINE), s; } const sn = function(n) { return tt != null && (n = tt.navigator) != null && n.requestMediaKeySystemAccess ? self.navigator.requestMediaKeySystemAccess.bind(self.navigator) : null; }(); function Mr(n, e, t, s) { let i; switch (n) { case X.FAIRPLAY: i = ["cenc", "sinf"]; break; case X.WIDEVINE: case X.PLAYREADY: i = ["cenc"]; break; case X.CLEARKEY: i = ["cenc", "keyids"]; break; default: throw new Error(`Unknown key-system: ${n}`); } return Nr(i, e, t, s); } function Nr(n, e, t, s) { return [{ initDataTypes: n, persistentState: s.persistentState || "optional", distinctiveIdentifier: s.distinctiveIdentifier || "optional", sessionTypes: s.sessionTypes || [s.sessionType || "temporary"], audioCapabilities: e.map((r) => ({ contentType: `audio/mp4; codecs="${r}"`, robustness: s.audioRobustness || "", encryptionScheme: s.audioEncryptionScheme || null })), videoCapabilities: t.map((r) => ({ contentType: `video/mp4; codecs="${r}"`, robustness: s.videoRobustness || "", encryptionScheme: s.videoEncryptionScheme || null })) }]; } function nn(n) { const e = new Uint16Array(n.buffer, n.byteOffset, n.byteLength / 2), t = String.fromCharCode.apply(null, Array.from(e)), s = t.substring(t.indexOf("<"), t.length), a = new DOMParser().parseFromString(s, "text/xml").getElementsByTagName("KID")[0]; if (a) { const o = a.childNodes[0] ? a.childNodes[0].nodeValue : a.getAttribute("VALUE"); if (o) { const l = Ms(o).subarray(0, 16); return Fr(l), l; } } return null; } function He(n, e, t) { return Uint8Array.prototype.slice ? n.slice(e, t) : new Uint8Array(Array.prototype.slice.call(n, e, t)); } const Ns = (n, e) => e + 10 <= n.length && n[e] === 73 && n[e + 1] === 68 && n[e + 2] === 51 && n[e + 3] < 255 && n[e + 4] < 255 && n[e + 6] < 128 && n[e + 7] < 128 && n[e + 8] < 128 && n[e + 9] < 128, rn = (n, e) => e + 10 <= n.length && n[e] === 51 && n[e + 1] === 68 && n[e + 2] === 73 && n[e + 3] < 255 && n[e + 4] < 255 && n[e + 6] < 128 && n[e + 7] < 128 && n[e + 8] < 128 && n[e + 9] < 128, lt = (n, e) => { const t = e; let s = 0; for (; Ns(n, e); ) { s += 10; const i = Wt(n, e + 6); s += i, rn(n, e + 10) && (s += 10), e += s; } if (s > 0) return n.subarray(t, t + s); }, Wt = (n, e) => { let t = 0; return t = (n[e] & 127) << 21, t |= (n[e + 1] & 127) << 14, t |= (n[e + 2] & 127) << 7, t |= n[e + 3] & 127, t; }, Br = (n, e) => Ns(n, e) && Wt(n, e + 6) + 10 <= n.length - e, Bs = (n) => { const e = on(n); for (let t = 0; t < e.length; t++) { const s = e[t]; if (an(s)) return Hr(s); } }, an = (n) => n && n.key === "PRIV" && n.info === "com.apple.streaming.transportStreamTimestamp", Ur = (n) => { const e = String.fromCharCode(n[0], n[1], n[2], n[3]), t = Wt(n, 4), s = 10; return { type: e, size: t, data: n.subarray(s, s + t) }; }, on = (n) => { let e = 0; const t = []; for (; Ns(n, e); ) { const s = Wt(n, e + 6); e += 10; const i = e + s; for (; e + 8 < i; ) { const r = Ur(n.subarray(e)), a = $r(r); a && t.push(a), e += r.size + 10; } rn(n, e) && (e += 10); } return t; }, $r = (n) => n.type === "PRIV" ? Gr(n) : n.type[0] === "W" ? Kr(n) : Vr(n), Gr = (n) => { if (n.size < 2) return; const e = we(n.data, !0), t = new Uint8Array(n.data.subarray(e.length + 1)); return { key: n.type, info: e, data: t.buffer }; }, Vr = (n) => { if (n.size < 2) return; if (n.type === "TXXX") { let t = 1; const s = we(n.data.subarray(t), !0); t += s.length + 1; const i = we(n.data.subarray(t)); return { key: n.type, info: s, data: i }; } const e = we(n.data.subarray(1)); return { key: n.type, data: e }; }, Kr = (n) => { if (n.type === "WXXX") { if (n.size < 2) return; let t = 1; const s = we(n.data.subarray(t), !0); t += s.length + 1; const i = we(n.data.subarray(t)); return { key: n.type, info: s, data: i }; } const e = we(n.data); return { key: n.type, data: e }; }, Hr = (n) => { if (n.data.byteLength === 8) { const e = new Uint8Array(n.data), t = e[3] & 1; let s = (e[4] << 23) + (e[5] << 15) + (e[6] << 7) + e[7]; return s /= 45, t && (s += 4772185884e-2), Math.round(s); } }, we = (n, e = !1) => { const t = Wr(); if (t) { const c = t.decode(n); if (e) { const u = c.indexOf("\0"); return u !== -1 ? c.substring(0, u) : c; } return c.replace(/\0/g, ""); } const s = n.length; let i, r, a, o = "", l = 0; for (; l < s; ) { if (i = n[l++], i === 0 && e) return o; if (i === 0 || i === 3) continue; switch (i >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: o += String.fromCharCode(i); break; case 12: case 13: r = n[l++], o += String.fromCharCode((i & 31) << 6 | r & 63); break; case 14: r = n[l++], a = n[l++], o += String.fromCharCode((i & 15) << 12 | (r & 63) << 6 | (a & 63) << 0); break; } } return o; }; let es; function Wr() { if (!navigator.userAgent.includes("PlayStation 4")) return !es && typeof self.TextDecoder < "u" && (es = new self.TextDecoder("utf-8")), es; } const be = { hexDump: function(n) { let e = ""; for (let t = 0; t < n.length; t++) { let s = n[t].toString(16); s.length < 2 && (s = "0" + s), e += s; } return e; } }, _t = Math.pow(2, 32) - 1, Yr = [].push, ln = { video: 1, audio: 2, id3: 3, text: 4 }; function re(n) { return String.fromCharCode.apply(null, n); } function cn(n, e) { const t = n[e] << 8 | n[e + 1]; return t < 0 ? 65536 + t : t; } function N(n, e) { const t = un(n, e); return t < 0 ? 4294967296 + t : t; } function ti(n, e) { let t = N(n, e); return t *= Math.pow(2, 32), t += N(n, e + 4), t; } function un(n, e) { return n[e] << 24 | n[e + 1] << 16 | n[e + 2] << 8 | n[e + 3]; } function ts(n, e, t) { n[e] = t >> 24, n[e + 1] = t >> 16 & 255, n[e + 2] = t >> 8 & 255, n[e + 3] = t & 255; } function qr(n) { const e = n.byteLength; for (let t = 0; t < e; ) { const s = N(n, t); if (s > 8 && n[t + 4] === 109 && n[t + 5] === 111 && n[t + 6] === 111 && n[t + 7] === 102) return !0; t = s > 1 ? t + s : e; } return !1; } function H(n, e) { const t = []; if (!e.length) return t; const s = n.byteLength; for (let i = 0; i < s; ) { const r = N(n, i), a = re(n.subarray(i + 4, i + 8)), o = r > 1 ? i + r : s; if (a === e[0]) if (e.length === 1) t.push(n.subarray(i + 8, o)); else { const l = H(n.subarray(i + 8, o), e.slice(1)); l.length && Yr.apply(t, l); } i = o; } return t; } function jr(n) { const e = [], t = n[0]; let s = 8; const i = N(n, s); s += 4; let r = 0, a = 0; t === 0 ? (r = N(n, s), a = N(n, s + 4), s += 8) : (r = ti(n, s), a = ti(n, s + 8), s += 16), s += 2; let o = n.length + a; const l = cn(n, s); s += 2; for (let c = 0; c < l; c++) { let u = s; const d = N(n, u); u += 4; const h = d & 2147483647; if ((d & 2147483648) >>> 31 === 1) return v.warn("SIDX has hierarchical references (not supported)"), null; const f = N(n, u); u += 4, e.push({ referenceSize: h, subsegmentDuration: f, // unscaled info: { duration: f / i, start: o, end: o + h - 1 } }), o += h, u += 4, s = u; } return { earliestPresentationTime: r, timescale: i, version: t, referencesCount: l, references: e }; } function dn(n) { const e = [], t = H(n, ["moov", "trak"]); for (let i = 0; i < t.length; i++) { const r = t[i], a = H(r, ["tkhd"])[0]; if (a) { let o = a[0]; const l = N(a, o === 0 ? 12 : 20), c = H(r, ["mdia", "mdhd"])[0]; if (c) { o = c[0]; const u = N(c, o === 0 ? 12 : 20), d = H(r, ["mdia", "hdlr"])[0]; if (d) { const h = re(d.subarray(8, 12)), g = { soun: J.AUDIO, vide: J.VIDEO }[h]; if (g) { const f = H(r, ["mdia", "minf", "stbl", "stsd"])[0], m = zr(f); e[l] = { timescale: u, type: g }, e[g] = ce({ timescale: u, id: l }, m); } } } } } return H(n, ["moov", "mvex", "trex"]).forEach((i) => { const r = N(i, 4), a = e[r]; a && (a.default = { duration: N(i, 12), flags: N(i, 20) }); }), e; } function zr(n) { const e = n.subarray(8), t = e.subarray(86), s = re(e.subarray(4, 8)); let i = s; const r = s === "enca" || s === "encv"; if (r) { const o = H(e, [s])[0].subarray(s === "enca" ? 28 : 78); H(o, ["sinf"]).forEach((c) => { const u = H(c, ["schm"])[0]; if (u) { const d = re(u.subarray(4, 8)); if (d === "cbcs" || d === "cenc") { const h = H(c, ["frma"])[0]; h && (i = re(h)); } } }); } switch (i) { case "avc1": case "avc2": case "avc3": case "avc4": { const a = H(t, ["avcC"])[0]; i += "." + ft(a[1]) + ft(a[2]) + ft(a[3]); break; } case "mp4a": { const a = H(e, [s])[0], o = H(a.subarray(28), ["esds"])[0]; if (o && o.length > 12) { let l = 4; if (o[l++] !== 3) break; l = ss(o, l), l += 2; const c = o[l++]; if (c & 128 && (l += 2), c & 64 && (l += o[l++]), o[l++] !== 4) break; l = ss(o, l); const u = o[l++]; if (u === 64) i += "." + ft(u); else break; if (l += 12, o[l++] !== 5) break; l = ss(o, l); const d = o[l++]; let h = (d & 248) >> 3; h === 31 && (h += 1 + ((d & 7) << 3) + ((o[l] & 224) >> 5)), i += "." + h; } break; } case "hvc1": case "hev1": { const a = H(t, ["hvcC"])[0], o = a[1], l = ["", "A", "B", "C"][o >> 6], c = o & 31, u = N(a, 2), d = (o & 32) >> 5 ? "H" : "L", h = a[12], g = a.subarray(6, 12); i += "." + l + c, i += "." + u.toString(16).toUpperCase(), i += "." + d + h; let f = ""; for (let m = g.length; m--; ) { const y = g[m]; (y || f) && (f = "." + y.toString(16).toUpperCase() + f); } i += f; break; } case "dvh1": case "dvhe": { const a = H(t, ["dvcC"])[0], o = a[2] >> 1 & 127, l = a[2] << 5 & 32 | a[3] >> 3 & 31; i += "." + Re(o) + "." + Re(l); break; } case "vp09": { const a = H(t, ["vpcC"])[0], o = a[4], l = a[5], c = a[6] >> 4 & 15; i += "." + Re(o) + "." + Re(l) + "." + Re(c); break; } case "av01": { const a = H(t, ["av1C"])[0], o = a[1] >>> 5, l = a[1] & 31, c = a[2] >>> 7 ? "H" : "M", u = (a[2] & 64) >> 6, d = (a[2] & 32) >> 5, h = o === 2 && u ? d ? 12 : 10 : u ? 10 : 8, g = (a[2] & 16) >> 4, f = (a[2] & 8) >> 3, m = (a[2] & 4) >> 2, y = a[2] & 3; i += "." + o + "." + Re(l) + c + "." + Re(h) + "." + g + "." + f + m + y + "." + Re(1) + "." + Re(1) + "." + Re(1) + "." + 0; break; } } return { codec: i, encrypted: r }; } function ss(n, e) { const t = e + 5; for (; n[e++] & 128 && e < t; ) ; return e; } function ft(n) { return ("0" + n.toString(16).toUpperCase()).slice(-2); } function Re(n) { return (n < 10 ? "0" : "") + n; } function Xr(n, e) { if (!n || !e) return n; const t = e.keyId; return t && e.isCommonEncryption && H(n, ["moov", "trak"]).forEach((i) => { const a = H(i, ["mdia", "minf", "stbl", "stsd"])[0].subarray(8); let o = H(a, ["enca"]); const l = o.length > 0; l || (o = H(a, ["encv"])), o.forEach((c) => { const u = l ? c.subarray(28) : c.subarray(78); H(u, ["sinf"]).forEach((h) => { const g = hn(h); if (g) { const f = g.subarray(8, 24); f.some((m) => m !== 0) || (v.log(`[eme] Patching keyId in 'enc${l ? "a" : "v"}>sinf>>tenc' box: ${be.hexDump(f)} -> ${be.hexDump(t)}`), g.set(t, 8)); } }); }); }), n; } function hn(n) { const e = H(n, ["schm"])[0]; if (e) { const t = re(e.subarray(4, 8)); if (t === "cbcs" || t === "cenc") return H(n, ["schi", "tenc"])[0]; } return null; } function Qr(n, e) { return H(e, ["moof", "traf"]).reduce((t, s) => { const i = H(s, ["tfdt"])[0], r = i[0], a = H(s, ["tfhd"]).reduce((o, l) => { const c = N(l, 4), u = n[c]; if (u) { let d = N(i, 4); if (r === 1) { if (d === _t) return v.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"), o; d *= _t + 1, d += N(i, 8); } const h = u.timescale || 9e4, g = d / h; if (O(g) && (o === null || g < o)) return g; } return o; }, null); return a !== null && O(a) && (t === null || a < t) ? a : t; }, null); } function Jr(n, e) { let t = 0, s = 0, i = 0; const r = H(n, ["moof", "traf"]); for (let a = 0; a < r.length; a++) { const o = r[a], l = H(o, ["tfhd"])[0], c = N(l, 4), u = e[c]; if (!u) continue; const d = u.default, h = N(l, 0) | (d == null ? void 0 : d.flags); let g = d == null ? void 0 : d.duration; h & 8 && (h & 2 ? g = N(l, 12) : g = N(l, 8)); const f = u.timescale || 9e4, m = H(o, ["trun"]); for (let y = 0; y < m.length; y++) { if (t = Zr(m[y]), !t && g) { const T = N(m[y], 4); t = g * T; } u.type === J.VIDEO ? s += t / f : u.type === J.AUDIO && (i += t / f); } } if (s === 0 && i === 0) { let a = 1 / 0, o = 0, l = 0; const c = H(n, ["sidx"]); for (let u = 0; u < c.length; u++) { const d = jr(c[u]); if (d != null && d.references) { a = Math.min(a, d.earliestPresentationTime / d.timescale); const h = d.references.reduce((g, f) => g + f.info.duration || 0, 0); o = Math.max(o, h + d.earliestPresentationTime / d.timescale), l = o - a; } } if (l && O(l)) return l; } return s || i; } function Zr(n) { const e = N(n, 0); let t = 8; e & 1 && (t += 4), e & 4 && (t += 4); let s = 0; const i = N(n, 4); for (let r = 0; r < i; r++) { if (e & 256) { const a = N(n, t); s += a, t += 4; } e & 512 && (t += 4), e & 1024 && (t += 4), e & 2048 && (t += 4); } return s; } function ea(n, e, t) { H(e, ["moof", "traf"]).forEach((s) => { H(s, ["tfhd"]).forEach((i) => { const r = N(i, 4), a = n[r]; if (!a) return; const o = a.timescale || 9e4; H(s, ["tfdt"]).forEach((l) => { const c = l[0], u = t * o; if (u) { let d = N(l, 4); if (c === 0) d -= u, d = Math.max(d, 0), ts(l, 4, d); else { d *= Math.pow(2, 32), d += N(l, 8), d -= u, d = Math.max(d, 0); const h = Math.floor(d / (_t + 1)), g = Math.floor(d % (_t + 1)); ts(l, 4, h), ts(l, 8, g); } } }); }); }); } function ta(n) { const e = { valid: null, remainder: null }, t = H(n, ["moof"]); if (t.length < 2) return e.remainder = n, e; const s = t[t.length - 1]; return e.valid = He(n, 0, s.byteOffset - 8), e.remainder = He(n, s.byteOffset - 8), e; } function Te(n, e) { const t = new Uint8Array(n.length + e.length); return t.set(n), t.set(e, n.length), t; } function si(n, e) { const t = [], s = e.samples, i = e.timescale, r = e.id; let a = !1; return H(s, ["moof"]).map((l) => { const c = l.byteOffset - 8; H(l, ["traf"]).map((d) => { const h = H(d, ["tfdt"]).map((g) => { const f = g[0]; let m = N(g, 4); return f === 1 && (m *= Math.pow(2, 32), m += N(g, 8)), m / i; })[0]; return h !== void 0 && (n = h), H(d, ["tfhd"]).map((g) => { const f = N(g, 4), m = N(g, 0) & 16777215, y = (m & 1) !== 0, T = (m & 2) !== 0, E = (m & 8) !== 0; let x = 0; const b = (m & 16) !== 0; let S = 0; const D = (m & 32) !== 0; let R = 8; f === r && (y && (R += 8), T && (R += 4), E && (x = N(g, R), R += 4), b && (S = N(g, R), R += 4), D && (R += 4), e.type === "video" && (a = sa(e.codec)), H(d, ["trun"]).map((w) => { const _ = w[0], I = N(w, 0) & 16777215, k = (I & 1) !== 0; let K = 0; const P = (I & 4) !== 0, V = (I & 256) !== 0; let G = 0; const U = (I & 512) !== 0; let q = 0; const Z = (I & 1024) !== 0, M = (I & 2048) !== 0; let F = 0; const z = N(w, 4); let W = 8; k && (K = N(w, W), W += 4), P && (W += 4); let Q = K + c; for (let ie = 0; ie < z; ie++) { if (V ? (G = N(w, W), W += 4) : G = x, U ? (q = N(w, W), W += 4) : q = S, Z && (W += 4), M && (_ === 0 ? F = N(w, W) : F = un(w, W), W += 4), e.type === J.VIDEO) { let ae = 0; for (; ae < q; ) { const ue = N(s, Q); if (Q += 4, ia(a, s[Q])) { const me = s.subarray(Q, Q + ue); fn(me, a ? 2 : 1, n + F / i, t); } Q += ue, ae += ue + 4; } } n += G / i; } })); }); }); }), t; } function sa(n) { if (!n) return !1; const e = n.indexOf("."), t = e < 0 ? n : n.substring(0, e); return t === "hvc1" || t === "hev1" || // Dolby Vision t === "dvh1" || t === "dvhe"; } function ia(n, e) { if (n) { const t = e >> 1 & 63; return t === 39 || t === 40; } else return (e & 31) === 6; } function fn(n, e, t, s) { const i = gn(n); let r = 0; r += e; let a = 0, o = 0, l = 0; for (; r < i.length; ) { a = 0; do { if (r >= i.length) break; l = i[r++], a += l; } while (l === 255); o = 0; do { if (r >= i.length) break; l = i[r++], o += l; } while (l === 255); const c = i.length - r; let u = r; if (o < c) r += o; else if (o > c) { v.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`); break; } if (a === 4) { if (i[u++] === 181) { const h = cn(i, u); if (u += 2, h === 49) { const g = N(i, u); if (u += 4, g === 1195456820) { const f = i[u++]; if (f === 3) { const m = i[u++], y = 31 & m, T = 64 & m, E = T ? 2 + y * 3 : 0, x = new Uint8Array(E); if (T) { x[0] = m; for (let b = 1; b < E; b++) x[b] = i[u++]; } s.push({ type: f, payloadType: a, pts: t, bytes: x }); } } } } } else if (a === 5 && o > 16) { const d = []; for (let f = 0; f < 16; f++) { const m = i[u++].toString(16); d.push(m.length == 1 ? "0" + m : m), (f === 3 || f === 5 || f === 7 || f === 9) && d.push("-"); } const h = o - 16, g = new Uint8Array(h); for (let f = 0; f < h; f++) g[f] = i[u++]; s.push({ payloadType: a, pts: t, uuid: d.join(""), userData: we(g), userDataBytes: g }); } } } function gn(n) { const e = n.byteLength, t = []; let s = 1; for (; s < e - 2; ) n[s] === 0 && n[s + 1] === 0 && n[s + 2] === 3 ? (t.push(s + 2), s += 2) : s++; if (t.length === 0) return n; const i = e - t.length, r = new Uint8Array(i); let a = 0; for (s = 0; s < i; a++, s++) a === t[0] && (a++, t.shift()), r[s] = n[a]; return r; } function na(n) { const e = n[0]; let t = "", s = "", i = 0, r = 0, a = 0, o = 0, l = 0, c = 0; if (e === 0) { for (; re(n.subarray(c, c + 1)) !== "\0"; ) t += re(n.subarray(c, c + 1)), c += 1; for (t += re(n.subarray(c, c + 1)), c += 1; re(n.subarray(c, c + 1)) !== "\0"; ) s += re(n.subarray(c, c + 1)), c += 1; s += re(n.subarray(c, c + 1)), c += 1, i = N(n, 12), r = N(n, 16), o = N(n, 20), l = N(n, 24), c = 28; } else if (e === 1) { c += 4, i = N(n, c), c += 4; const d = N(n, c); c += 4; const h = N(n, c); for (c += 4, a = 2 ** 32 * d + h, vr(a) || (a = Number.MAX_SAFE_INTEGER, v.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")), o = N(n, c), c += 4, l = N(n, c), c += 4; re(n.subarray(c, c + 1)) !== "\0"; ) t += re(n.subarray(c, c + 1)), c += 1; for (t += re(n.subarray(c, c + 1)), c += 1; re(n.subarray(c, c + 1)) !== "\0"; ) s += re(n.subarray(c, c + 1)), c += 1; s += re(n.subarray(c, c + 1)), c += 1; } const u = n.subarray(c, n.byteLength); return { schemeIdUri: t, value: s, timeScale: i, presentationTime: a, presentationTimeDelta: r, eventDuration: o, id: l, payload: u }; } function ra(n, ...e) { const t = e.length; let s = 8, i = t; for (; i--; ) s += e[i].byteLength; const r = new Uint8Array(s); for (r[0] = s >> 24 & 255, r[1] = s >> 16 & 255, r[2] = s >> 8 & 255, r[3] = s & 255, r.set(n, 4), i = 0, s = 8; i < t; i++) r.set(e[i], s), s += e[i].byteLength; return r; } function aa(n, e, t) { if (n.byteLength !== 16) throw new RangeError("Invalid system id"); let s, i; s = 0, i = new Uint8Array(); let r; s > 0 ? (r = new Uint8Array(4), e.length > 0 && new DataView(r.buffer).setUint32(0, e.length, !1)) : r = new Uint8Array(); const a = new Uint8Array(4); return t && t.byteLength > 0 && new DataView(a.buffer).setUint32(0, t.byteLength, !1), ra( [112,